/* ==========================================================================
   Richter Center · design system ("Seismograph": paper, ink and a red needle)
   Every color, radius and shadow comes from the tokens below; dark mode only overrides tokens.
   Magnitude colors: --m2 (under 3) .. --m7 (7+). Depth colors: --d1 (shallow) .. --d4 (very deep).
   ========================================================================== */

@font-face { font-family: "Space Grotesk"; src: url("/static/fonts/space-grotesk.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --font-head: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-body: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;

  --bg: #fbfbf8;
  --bg-alt: #f3f2ed;
  --surface: #ffffff;
  --surface-2: #f6f5f1;
  --text: #121417;
  --muted: #5b626d;
  --faint: #8b929c;
  --border: #e6e4dd;
  --border-strong: #d4d0c6;
  --ink: #121417;
  --ink-text: #ffffff;
  --accent: #e0362a;          /* the needle */
  --accent-soft: #fdecea;
  --accent-text: #c42b20;
  --live: #e0362a;
  --focus: 0 0 0 3px rgba(224, 54, 42, .28);
  --shadow: 0 1px 2px rgba(18, 20, 23, .05), 0 8px 24px -12px rgba(18, 20, 23, .18);
  --shadow-lg: 0 2px 6px rgba(18, 20, 23, .06), 0 24px 48px -20px rgba(18, 20, 23, .28);
  --glass: rgba(255, 255, 255, .86);

  --m2: #8f9aa6;
  --m3: #e3b23c;
  --m4: #f08a24;
  --m5: #e0362a;
  --m6: #ad2251;
  --m7: #5b1f76;
  --d1: #ef4f2c;
  --d2: #f4a62a;
  --d3: #26a093;
  --d4: #3a67d4;
  --up: #1f8f55;

  --map-land: #efede6;
  --map-water: #d9e3e8;
  --map-line: #c9c4b8;
  --map-label: #6b7079;
  --map-halo: #fbfbf8;
  --map-glow: #dfe9f0;

  --radius-lg: 20px;
  --radius: 14px;
  --radius-sm: 9px;
  --container: 1220px;
}

[data-theme="dark"] {
  --bg: #0b0d11;
  --bg-alt: #101319;
  --surface: #13161c;
  --surface-2: #191d24;
  --text: #edeff2;
  --muted: #a3aab5;
  --faint: #737b87;
  --border: #252a32;
  --border-strong: #343a44;
  --ink: #edeff2;
  --ink-text: #0b0d11;
  --accent: #ff5a4a;
  --accent-soft: #2a1513;
  --accent-text: #ff7a6c;
  --live: #ff4d3d;
  --focus: 0 0 0 3px rgba(255, 90, 74, .35);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -12px rgba(0, 0, 0, .6);
  --shadow-lg: 0 2px 6px rgba(0, 0, 0, .3), 0 24px 48px -20px rgba(0, 0, 0, .8);
  --glass: rgba(19, 22, 28, .86);

  --m2: #8792a0;
  --m3: #f0c24a;
  --m4: #ff9a3a;
  --m5: #ff5a4a;
  --m6: #ea4b84;
  --m7: #b06be0;
  --up: #46c283;

  --map-land: #262c37;
  --map-water: #121a24;
  --map-line: #3c4451;
  --map-label: #8f98a6;
  --map-halo: #121a24;
  --map-glow: #23405a;
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font-body); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { margin: 0 0 .4em; font-family: var(--font-head); font-weight: 700; line-height: 1.12; letter-spacing: -.02em; }
h1 { font-size: clamp(30px, 4.6vw, 52px); letter-spacing: -.035em; }
h2 { font-size: clamp(22px, 2.6vw, 30px); }
h3 { font-size: 18px; }
p { margin: 0 0 1em; }
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--accent); }
img, svg { max-width: 100%; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--ink); color: var(--ink-text); }
.skip-link:focus { top: 12px; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.mono { font-family: var(--font-mono); font-size: .92em; }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(12px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.brand-mark { display: block; width: 34px; height: 34px; }
.wordmark { font-family: var(--font-head); font-weight: 700; font-size: 20px; letter-spacing: -.03em; }
.wordmark span { color: var(--accent); }
.main-nav { display: flex; align-items: center; gap: 2px; margin-left: 8px; }
.main-nav a { position: relative; padding: 8px 11px; border-radius: 999px; font-size: 14.5px; font-weight: 600; color: var(--muted); text-decoration: none; white-space: nowrap; }
.main-nav a:hover { color: var(--text); background: var(--surface-2); }
.main-nav a[aria-current="page"] { color: var(--text); }
.main-nav a[aria-current="page"]::after { content: ""; position: absolute; left: 11px; right: 11px; bottom: 2px; height: 2px; border-radius: 2px; background: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; min-width: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; font-size: 14px; font-weight: 600; }
.icon-btn:hover { border-color: var(--border-strong); }
.search-btn { padding: 0 12px 0 11px; color: var(--muted); }
.search-btn kbd { padding: 1px 6px; border: 1px solid var(--border); border-radius: 6px; font: 600 11px var(--font-mono); color: var(--faint); }
.theme-toggle .icon-sun { display: none; }
[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
.menu-toggle { display: none; }

/* --------------------------------------------------------------------------
   Buttons, chips, badges
   -------------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 42px; padding: 0 18px; border: 1px solid transparent; border-radius: 999px; font-weight: 700; font-size: 15px; text-decoration: none; cursor: pointer; white-space: nowrap; transition: transform .15s, background-color .15s, border-color .15s; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--ink-text); }
.btn-primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-ghost { background: var(--surface); border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { border-color: var(--text); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.link-arrow { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; text-decoration: none; }
.link-arrow::after { content: "→"; transition: transform .15s; }
.link-arrow:hover::after { transform: translateX(3px); }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; font: 700 12px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.live-dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--live); flex: none; }
.live-dot::after { content: ""; position: absolute; inset: -5px; border-radius: 50%; border: 2px solid var(--live); opacity: 0; animation: ring 2s ease-out infinite; }
@keyframes ring { 0% { transform: scale(.3); opacity: .9; } 100% { transform: scale(1.6); opacity: 0; } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 13.5px; font-weight: 600; text-decoration: none; color: var(--text); white-space: nowrap; }
a.chip:hover { border-color: var(--text); }
.chip small { color: var(--muted); font-weight: 600; }
.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12.5px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.tag.is-alert-green { color: #1f8f55; border-color: color-mix(in srgb, #1f8f55 35%, transparent); }
.tag.is-alert-yellow { color: #a87d00; border-color: color-mix(in srgb, #e3b23c 50%, transparent); }
.tag.is-alert-orange { color: #d4680f; border-color: color-mix(in srgb, #f08a24 45%, transparent); }
.tag.is-alert-red { color: var(--accent-text); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tag.is-tsunami { color: var(--d4); border-color: color-mix(in srgb, var(--d4) 40%, transparent); }

/* Magnitude badge: the site's signature element */
.mag { --c: var(--m2); display: inline-grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 12px; background: color-mix(in srgb, var(--c) 16%, var(--surface)); color: color-mix(in srgb, var(--c) 82%, var(--text)); border: 1px solid color-mix(in srgb, var(--c) 34%, transparent); font: 700 17px/1 var(--font-head); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.mag.lg { width: 64px; height: 64px; border-radius: 16px; font-size: 24px; }
.mag.sm { width: 38px; height: 38px; border-radius: 10px; font-size: 14.5px; }
.m2 { --c: var(--m2); } .m3 { --c: var(--m3); } .m4 { --c: var(--m4); } .m5 { --c: var(--m5); } .m6 { --c: var(--m6); } .m7 { --c: var(--m7); }
.mag.m6, .mag.m7 { background: var(--c); color: #fff; border-color: transparent; }

/* --------------------------------------------------------------------------
   Cards, sections, stats
   -------------------------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.section { padding: 56px 0; }
.section-tight { padding: 32px 0; }
.section-alt { background: var(--bg-alt); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.section-head p { margin: 0; color: var(--muted); max-width: 640px; }
.kicker { display: block; margin-bottom: 8px; font: 700 12px/1 var(--font-body); letter-spacing: .12em; text-transform: uppercase; color: var(--accent-text); }
.panel { padding: 24px; }
.panel h2, .panel h3 { margin-bottom: 14px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.stat-label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-value { display: block; margin-top: 4px; font: 700 30px/1.1 var(--font-head); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.stat-note { display: block; margin-top: 4px; font-size: 13px; color: var(--muted); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
.layout > aside { display: grid; gap: 20px; position: sticky; top: 84px; }
.stack { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-content: start; }
.under-map { margin-top: 8px; }

/* Quake list rows */
.quake-list { margin: 0; padding: 0; list-style: none; }
.quake-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--border); text-decoration: none; color: inherit; }
.quake-list li:last-child .quake-row { border-bottom: 0; }
a.quake-row:hover .quake-place { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.quake-place { display: block; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quake-meta { display: block; font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.quake-when { text-align: right; font-size: 13px; color: var(--muted); white-space: nowrap; }
.quake-when strong { display: block; color: var(--text); font-weight: 650; }
.quake-row.is-new { animation: flash 2.4s ease-out; }
@keyframes flash { 0% { background: var(--accent-soft); } 100% { background: transparent; } }

.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { font-size: 13.5px; color: var(--muted); }

/* --------------------------------------------------------------------------
   Maps
   -------------------------------------------------------------------------- */
.map { position: relative; width: 100%; height: 420px; overflow: hidden; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--map-water); }
.map-canvas { position: absolute; inset: 0; }
.map .maplibregl-ctrl-attrib { font-size: 11px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.map .maplibregl-ctrl-attrib a { color: var(--muted); }
.maplibregl-ctrl-group { background: var(--surface) !important; border: 1px solid var(--border); box-shadow: none !important; border-radius: 10px !important; }
.maplibregl-ctrl-group button + button { border-top-color: var(--border) !important; }
[data-theme="dark"] .maplibregl-ctrl-group button .maplibregl-ctrl-icon { filter: invert(1); }
.maplibregl-popup-content { padding: 0 !important; border-radius: 14px !important; background: var(--surface) !important; color: var(--text); box-shadow: var(--shadow-lg) !important; overflow: hidden; }
.maplibregl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.maplibregl-popup-close-button { width: 28px; height: 28px; font-size: 18px; color: var(--muted); }
.pop { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; min-width: 240px; max-width: 300px; padding: 14px 16px; font: 14px/1.45 var(--font-body); }
.pop-title { font-weight: 700; }
.pop-meta { color: var(--muted); font-size: 12.5px; }
.pop a.link-arrow { grid-column: 1 / -1; font-size: 13.5px; }
.map-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; font-size: 12px; color: var(--muted); }
.map-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 4px; border-radius: 50%; vertical-align: -1px; }
.map-loading { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; pointer-events: none; transition: opacity .3s; }
.map.is-ready .map-loading { opacity: 0; }

/* Home: live hero */
.live-hero { position: relative; height: min(76vh, 760px); min-height: 520px; border-bottom: 1px solid var(--border); background: radial-gradient(ellipse at 62% 50%, var(--bg-alt), var(--bg) 70%); }
.live-hero .map { background: transparent; }
.live-hero .map { position: absolute; inset: 0; width: auto; height: auto; border: 0; border-radius: 0; }
@media (min-width: 1100px) { .live-hero > .map { left: min(34vw, 500px); width: auto; } }
.hero-panel { position: absolute; top: 28px; left: max(24px, calc((100vw - var(--container)) / 2 + 24px)); z-index: 2; width: min(440px, calc(100% - 48px)); padding: 26px; border-radius: var(--radius-lg); background: var(--glass); backdrop-filter: blur(14px) saturate(1.3); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.hero-panel h1 { font-size: clamp(30px, 3.6vw, 44px); margin-bottom: 10px; }
.hero-panel .lead { color: var(--muted); margin-bottom: 18px; }
.hero-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.hero-count { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.hero-count b { display: block; font: 700 26px/1.1 var(--font-head); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.hero-count span { font-size: 12px; color: var(--muted); font-weight: 600; }
.hero-strongest { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 12px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); text-decoration: none; }
.hero-strongest small { display: block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.hero-strongest strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero-tools { position: absolute; right: max(24px, calc((100vw - var(--container)) / 2 + 24px)); bottom: 24px; z-index: 2; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.seg { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 999px; background: var(--glass); backdrop-filter: blur(10px); }
.seg button, .seg a { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.seg [aria-pressed="true"], .seg [aria-current="true"] { background: var(--ink); color: var(--ink-text); }
.legend-box { padding: 8px 12px; border-radius: 12px; background: var(--glass); backdrop-filter: blur(10px); border: 1px solid var(--border); }

/* Seismogram strip (last 24 hours) */
.seismo { position: relative; height: 120px; border: 1px solid var(--border); border-radius: var(--radius-lg); background:
  repeating-linear-gradient(90deg, transparent 0 calc(100% / 24 - 1px), var(--border) calc(100% / 24 - 1px) calc(100% / 24)), var(--surface); overflow: hidden; }
.seismo svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.seismo-trace { fill: none; stroke: var(--ink); stroke-width: 1.3; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.seismo-scale { display: flex; justify-content: space-between; margin-top: 6px; font: 600 11.5px var(--font-mono); color: var(--faint); }
.seismo-pin { position: absolute; transform: translate(-50%, 0); top: 6px; padding: 2px 7px; border-radius: 999px; background: var(--ink); color: var(--ink-text); font: 700 11px var(--font-body); white-space: nowrap; text-decoration: none; }

/* Energy bars */
.energy-bars { display: grid; gap: 10px; }
.energy-bar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 64px; gap: 10px; align-items: center; font-size: 13px; }
.energy-bar span:first-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.energy-track { height: 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); overflow: hidden; }
.energy-track svg { display: block; width: 100%; height: 100%; }
.energy-track rect { fill: var(--c, var(--accent)); }
.energy-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.energy-bar.is-this span:first-child { color: var(--text); font-weight: 700; }

/* Charts */
.chart-box { position: relative; height: 280px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 340px; }

/* History cards */
.history-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.history-card { display: grid; gap: 10px; padding: 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); text-decoration: none; transition: transform .2s, box-shadow .2s; }
.history-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.history-year { font: 700 28px/1 var(--font-head); letter-spacing: -.03em; }
.history-card p { margin: 0; font-size: 14px; color: var(--muted); }

/* Explore cards */
.explore-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.explore-card { position: relative; display: flex; flex-direction: column; gap: 8px; min-height: 170px; padding: 22px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); text-decoration: none; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.explore-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--border-strong); }
.explore-card h3 { margin: 0; }
.explore-card p { margin: 0; font-size: 14px; color: var(--muted); }
.explore-card svg.explore-art { position: absolute; right: -10px; bottom: -14px; width: 120px; height: 90px; color: var(--border-strong); }
.explore-icon { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--accent-soft); color: var(--accent-text); }

/* Country bars */
.bar-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.bar-item { display: grid; grid-template-columns: minmax(110px, 180px) minmax(0, 1fr) 62px; gap: 12px; align-items: center; font-size: 14px; text-decoration: none; }
.bar-item .bar { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.bar-item .bar svg { display: block; width: 100%; height: 100%; }
.bar-item .bar rect { fill: var(--accent); }
.bar-item b { text-align: right; font-variant-numeric: tabular-nums; }
a.bar-item:hover span:first-child { text-decoration: underline; text-decoration-color: var(--accent); }
aside .bar-item { grid-template-columns: minmax(0, 1fr) 80px 44px; gap: 10px; font-size: 13.5px; }

/* --------------------------------------------------------------------------
   Page head & breadcrumbs
   -------------------------------------------------------------------------- */
.page-head { padding: 40px 0 24px; }
.page-head .lead { max-width: 720px; font-size: 18px; color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; font-size: 13px; color: var(--muted); }
.crumbs li + li::before { content: "/"; margin-right: 6px; color: var(--faint); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }

/* Quake page */
.quake-hero { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: center; padding: 36px 0 26px; }
.dial { --c: var(--m2); position: relative; display: grid; place-items: center; width: 132px; height: 132px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, var(--surface)) 55%, transparent 56%); }
.dial::before, .dial::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid color-mix(in srgb, var(--c) 55%, transparent); }
.dial::after { animation: ripple 3s ease-out infinite; }
@keyframes ripple { 0% { transform: scale(.8); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.dial b { font: 700 46px/1 var(--font-head); letter-spacing: -.04em; color: color-mix(in srgb, var(--c) 80%, var(--text)); }
.dial small { position: absolute; bottom: 26px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.quake-hero h1 { font-size: clamp(26px, 3.4vw, 40px); margin-bottom: 8px; }
.quake-hero .when { color: var(--muted); }
.quake-hero .chips { margin-top: 12px; }
.facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--border); }
.fact { padding: 16px 18px; background: var(--surface); }
.fact dt { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fact dd { margin: 4px 0 0; font: 700 20px/1.2 var(--font-head); letter-spacing: -.02em; }
.fact dd small { display: block; margin-top: 2px; font: 500 12.5px/1.35 var(--font-body); letter-spacing: 0; color: var(--muted); }
.callout { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--radius); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.callout strong { font-family: var(--font-head); font-size: 18px; }
.callout p { margin: 4px 0 0; color: var(--muted); font-size: 14.5px; }
.city-list { margin: 0; padding: 0; list-style: none; }
.city-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14.5px; }
.city-list li:last-child { border-bottom: 0; }
.city-list a { text-decoration: none; font-weight: 600; }
.city-list a:hover { text-decoration: underline; }
.city-list span { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Tables */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.data-table th { padding: 10px 12px; text-align: left; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700; border-bottom: 1px solid var(--border-strong); white-space: nowrap; }
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table td.n, .data-table th.n { text-align: right; font-variant-numeric: tabular-nums; }
.data-table tr:hover td { background: var(--surface-2); }
.data-table a { font-weight: 650; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.filter-input { width: 100%; max-width: 360px; height: 42px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); }

/* Tabs (latest) */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 18px; }
.toolbar .seg { background: var(--surface); }

/* --------------------------------------------------------------------------
   Map explorer (full screen)
   -------------------------------------------------------------------------- */
.is-fullmap .site-footer, .is-fullmap .cookie-notice { display: none; }
.explorer { position: relative; height: calc(100vh - 65px); height: calc(100dvh - 65px); background: var(--map-water); }
.explorer .map { position: absolute; inset: 0; width: auto; height: auto; border: 0; border-radius: 0; }
.explorer-panel { position: absolute; top: 16px; left: 16px; z-index: 3; width: 340px; max-height: calc(100% - 32px); overflow: auto; padding: 18px; border-radius: var(--radius-lg); background: var(--glass); backdrop-filter: blur(14px) saturate(1.3); border: 1px solid var(--border); box-shadow: var(--shadow-lg); }
.explorer-panel h1 { font-size: 22px; margin-bottom: 4px; }
.explorer-panel .count { font: 700 15px var(--font-body); color: var(--muted); margin-bottom: 14px; }
.explorer-panel .count b { color: var(--text); font-family: var(--font-head); font-size: 18px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span, .field legend { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field fieldset { border: 0; margin: 0; padding: 0; }
.field .seg { width: 100%; background: var(--surface); }
.field .seg button { flex: 1; padding: 0 6px; }
.range-row { display: flex; align-items: center; gap: 10px; }
.range-row output { min-width: 44px; text-align: right; font: 700 15px var(--font-head); }
input[type="range"] { flex: 1; accent-color: var(--accent); }
.years { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.years input { width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 10px; background: var(--surface); font-variant-numeric: tabular-nums; }
.replay { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--border); }
.replay-row { display: flex; align-items: center; gap: 10px; }
.replay-clock { font: 700 15px var(--font-mono); }
.replay-progress { height: 4px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.replay-progress span { display: block; height: 100%; width: 0; background: var(--accent); }
.explorer-legend { position: absolute; right: 16px; bottom: 30px; z-index: 3; }
.panel-toggle { display: none; }

/* --------------------------------------------------------------------------
   Richter scale page
   -------------------------------------------------------------------------- */
.scale-hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 28px; align-items: stretch; }
.scale-stage { --c: var(--m4); position: relative; display: grid; align-content: center; justify-items: center; gap: 6px; min-height: 380px; padding: 28px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--surface); overflow: hidden; }
.scale-rings { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.scale-rings span { position: absolute; width: var(--s, 100px); height: var(--s, 100px); border-radius: 50%; border: 2px solid color-mix(in srgb, var(--c) 40%, transparent); animation: ripple 2.6s ease-out infinite; }
.scale-rings span:nth-child(2) { animation-delay: .85s; }
.scale-rings span:nth-child(3) { animation-delay: 1.7s; }
.scale-value { position: relative; font: 700 104px/1 var(--font-head); letter-spacing: -.05em; color: color-mix(in srgb, var(--c) 85%, var(--text)); font-variant-numeric: tabular-nums; }
.scale-word { position: relative; font: 700 20px var(--font-head); }
.scale-stage input[type="range"] { position: relative; width: 100%; max-width: 440px; margin-top: 18px; }
.scale-ticks { position: relative; display: flex; justify-content: space-between; width: 100%; max-width: 440px; font: 600 11.5px var(--font-mono); color: var(--faint); }
.scale-facts { display: grid; gap: 12px; }
.scale-fact { padding: 16px 18px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.scale-fact dt { font-size: 12.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.scale-fact dd { margin: 4px 0 0; font: 600 18px/1.35 var(--font-head); }
.ladder { display: grid; gap: 6px; }
.ladder-row { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 14px; align-items: center; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; text-align: left; }
.ladder-row.is-active { border-color: var(--text); box-shadow: var(--shadow); }
.ladder-row strong { display: block; font-family: var(--font-head); }
.ladder-row span { font-size: 13.5px; color: var(--muted); }
.compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: end; }
.compare label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.compare input { height: 46px; padding: 0 14px; border: 1px solid var(--border-strong); border-radius: 12px; background: var(--surface); font: 700 20px var(--font-head); }
.compare-out { margin-top: 16px; font: 600 18px/1.5 var(--font-head); }
.compare-out b { color: var(--accent-text); }

/* --------------------------------------------------------------------------
   Prose (info pages)
   -------------------------------------------------------------------------- */
.prose { max-width: 760px; }
.prose h2 { margin-top: 1.6em; font-size: 22px; }
.prose li { margin-bottom: .4em; }

/* --------------------------------------------------------------------------
   Search
   -------------------------------------------------------------------------- */
.searchbox { position: relative; }
.searchbox form { display: flex; align-items: center; gap: 8px; height: 52px; padding: 0 6px 0 16px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); }
.searchbox input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; outline: none; font-size: 16px; }
.searchbox .btn { height: 40px; }
.search-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 30; margin: 0; padding: 6px; list-style: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-lg); }
.search-results[hidden] { display: none; }
.search-results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; border-radius: 10px; text-decoration: none; }
.search-results a:hover, .search-results [aria-selected="true"] a { background: var(--surface-2); }
.search-results small { color: var(--muted); }
.search-dialog { width: min(560px, calc(100vw - 32px)); margin: 12vh auto 0; padding: 0; border: 0; background: transparent; overflow: visible; }
.search-dialog::backdrop { background: rgba(10, 12, 16, .45); backdrop-filter: blur(3px); }
.search-dialog .hint { margin: 10px 4px 0; color: #e8e8e8; font-size: 13px; text-align: center; }
.city-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 0; padding: 0; list-style: none; }
.city-grid a { display: flex; justify-content: space-between; gap: 8px; padding: 10px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); text-decoration: none; font-weight: 600; font-size: 14.5px; }
.city-grid a:hover { border-color: var(--text); }
.city-grid small { color: var(--muted); font-weight: 500; }

/* --------------------------------------------------------------------------
   Ads
   -------------------------------------------------------------------------- */
.ad { display: grid; place-items: center; align-content: center; gap: 4px; margin: 0 auto; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: repeating-linear-gradient(135deg, transparent 0 10px, var(--surface-2) 10px 20px); color: var(--faint); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; }
.ad small { letter-spacing: 0; text-transform: none; }
.ad.is-live { border: 0; background: none; }
.ad-leaderboard { width: 100%; max-width: 728px; min-height: 90px; }
.ad-rect { width: 100%; max-width: 300px; min-height: 250px; }
.ad-band { padding: 18px 0; }

/* --------------------------------------------------------------------------
   Footer & cookie notice
   -------------------------------------------------------------------------- */
.site-footer { margin-top: 40px; padding: 48px 0 28px; border-top: 1px solid var(--border); background: var(--bg-alt); font-size: 14.5px; }
.footer-inner { display: grid; grid-template-columns: 1.6fr repeat(3, 1fr); gap: 32px; }
.footer-brand p { margin-top: 10px; color: var(--muted); max-width: 360px; }
.footer-col h2 { margin-bottom: 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-family: var(--font-body); }
.footer-col ul { margin: 0; padding: 0; list-style: none; }
.footer-col li { margin-bottom: 6px; }
.footer-col a { text-decoration: none; }
.footer-col a:hover { text-decoration: underline; }
.footer-note { grid-column: 1 / -1; margin: 12px 0 0; padding-top: 20px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.cookie-notice { position: fixed; left: 16px; right: 16px; bottom: 16px; z-index: 60; display: flex; align-items: center; gap: 16px; max-width: 760px; margin: 0 auto; padding: 14px 16px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); font-size: 14px; }
.cookie-notice p { margin: 0; color: var(--muted); }
.cookie-notice[hidden] { display: none; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .main-nav a { padding: 8px 8px; font-size: 14px; }
  .history-grid, .explore-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .city-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .layout, .grid-2, .scale-hero { grid-template-columns: minmax(0, 1fr); }
  .layout > aside { position: static; }
  .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .stat-grid, .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .menu-toggle { display: inline-flex; }
  .main-nav { position: fixed; inset: 64px 0 auto 0; display: none; flex-direction: column; align-items: stretch; gap: 0; margin: 0; padding: 8px 16px 16px; background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg); }
  .main-nav.is-open { display: flex; }
  .main-nav a { padding: 12px 8px; font-size: 16px; border-radius: 10px; }
  .main-nav a[aria-current="page"]::after { display: none; }
  .main-nav a[aria-current="page"] { background: var(--surface-2); }
}
@media (max-width: 720px) {
  .container { padding: 0 16px; }
  .section { padding: 40px 0; }
  .search-btn span, .search-btn kbd { display: none; }
  .live-hero { height: auto; min-height: 0; display: flex; flex-direction: column; }
  .live-hero .map { position: relative; height: 56vh; min-height: 340px; }
  .hero-panel { position: relative; top: auto; left: auto; width: auto; margin: -40px 16px 0; }
  .hero-tools { right: 12px; bottom: auto; top: 12px; }
  .hero-tools .legend-box { display: none; }
  .history-grid, .explore-grid, .city-grid { grid-template-columns: minmax(0, 1fr); }
  .quake-hero { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-top: 24px; }
  .dial { width: 104px; height: 104px; }
  .dial b { font-size: 36px; }
  .dial small { bottom: 18px; }
  .stat-value { font-size: 24px; }
  .bar-item { grid-template-columns: 110px minmax(0, 1fr) 52px; }
  .energy-bar { grid-template-columns: 96px minmax(0, 1fr) 52px; }
  .quake-row { gap: 10px; }
  .footer-inner { grid-template-columns: minmax(0, 1fr); }
  .explorer-panel { top: auto; bottom: 0; left: 0; right: 0; width: auto; max-height: 62%; border-radius: var(--radius-lg) var(--radius-lg) 0 0; transform: translateY(calc(100% - 64px)); transition: transform .3s; }
  .explorer-panel.is-open { transform: none; }
  .panel-toggle { display: flex; width: 100%; justify-content: space-between; align-items: center; margin: -4px 0 10px; background: none; border: 0; padding: 0; font: 700 15px var(--font-body); cursor: pointer; }
  .explorer-legend { bottom: auto; top: 12px; right: 12px; }
  .scale-value { font-size: 80px; }
  .compare { grid-template-columns: 1fr; }
  .cookie-notice { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* Magnitude classes again, last, so they win over components that set a default --c (.dial, .scale-stage). */
.m2 { --c: var(--m2); } .m3 { --c: var(--m3); } .m4 { --c: var(--m4); } .m5 { --c: var(--m5); } .m6 { --c: var(--m6); } .m7 { --c: var(--m7); }
