/* =========================================================
   Janos Fazekas · personal site
   Tokens → base → layout → components → sections → motion
   ========================================================= */

/* ---------- Tokens (dark is default) ---------- */
:root {
  color-scheme: dark;
  --bg: #0a0c12;
  --bg-2: #0e111a;
  --surface: #121622;
  --surface-2: #171c2b;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef1f7;
  --muted: #9aa3b8;
  --faint: #5d667c;
  --accent: #3d7bff;
  --accent-2: #7aa6ff;
  --accent-soft: rgba(61, 123, 255, 0.16);
  --accent-glow: rgba(61, 123, 255, 0.35);
  --tile-off: #1b2132;
  --tile-off-text: #5d667c;
  --nav-bg: rgba(10, 12, 18, 0.62);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.7);
  --mesh-1: rgba(61, 123, 255, 0.55);
  --mesh-2: rgba(120, 80, 255, 0.35);
  --mesh-3: rgba(0, 190, 255, 0.28);

  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;

  --radius: 20px;
  --radius-sm: 12px;
  --wrap: 1160px;
  --gutter: 16px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

/* Light theme: follow the OS unless the visitor picked dark */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f6f7fb;
    --bg-2: #eef1f7;
    --surface: #ffffff;
    --surface-2: #f3f5fa;
    --border: rgba(13, 18, 32, 0.09);
    --border-strong: rgba(13, 18, 32, 0.18);
    --text: #0d1220;
    --muted: #535d72;
    --faint: #8a93a6;
    --accent: #1f5eff;
    --accent-2: #1f5eff;
    --accent-soft: rgba(31, 94, 255, 0.1);
    --accent-glow: rgba(31, 94, 255, 0.22);
    --tile-off: #e4e8f1;
    --tile-off-text: #8a93a6;
    --nav-bg: rgba(246, 247, 251, 0.72);
    --shadow: 0 1px 2px rgba(13, 18, 32, 0.04), 0 18px 36px -24px rgba(13, 18, 32, 0.25);
    --mesh-1: rgba(31, 94, 255, 0.28);
    --mesh-2: rgba(120, 80, 255, 0.18);
    --mesh-3: rgba(0, 170, 255, 0.18);
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f7fb;
  --bg-2: #eef1f7;
  --surface: #ffffff;
  --surface-2: #f3f5fa;
  --border: rgba(13, 18, 32, 0.09);
  --border-strong: rgba(13, 18, 32, 0.18);
  --text: #0d1220;
  --muted: #535d72;
  --faint: #8a93a6;
  --accent: #1f5eff;
  --accent-2: #1f5eff;
  --accent-soft: rgba(31, 94, 255, 0.1);
  --accent-glow: rgba(31, 94, 255, 0.22);
  --tile-off: #e4e8f1;
  --tile-off-text: #8a93a6;
  --nav-bg: rgba(246, 247, 251, 0.72);
  --shadow: 0 1px 2px rgba(13, 18, 32, 0.04), 0 18px 36px -24px rgba(13, 18, 32, 0.25);
  --mesh-1: rgba(31, 94, 255, 0.28);
  --mesh-2: rgba(120, 80, 255, 0.18);
  --mesh-3: rgba(0, 170, 255, 0.18);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 84px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.6 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s var(--ease), color 0.3s var(--ease);
}
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.1; margin: 0; letter-spacing: -0.02em; }
p { margin: 0; }
a { color: inherit; }
ul, ol { margin: 0; padding: 0; list-style: none; }
svg { display: block; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 10px; text-decoration: none;
}
.skip:focus { top: 12px; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
@media (min-width: 720px) { :root { --gutter: 32px; } }

.eyebrow {
  font: 500 12px/1.4 var(--font-body);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-2);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px;
  background: var(--accent); color: #fff; border: 1px solid transparent;
  font: 600 15px/1 var(--font-body); text-decoration: none; white-space: nowrap;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), background-color 0.2s;
  box-shadow: 0 8px 24px -10px var(--accent-glow);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 12px 30px -10px var(--accent-glow); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--border-strong); box-shadow: none; }
.btn--ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 14px; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border-radius: 999px; border: 1px solid var(--border-strong);
  background: transparent; color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.icon-btn .i-moon { fill: currentColor; stroke: none; }
/* Show the icon of the theme you'd switch to */
.icon-btn .i-sun { display: block; }
.icon-btn .i-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-btn .i-sun { display: none; }
  :root:not([data-theme="dark"]) .icon-btn .i-moon { display: block; }
}
:root[data-theme="light"] .icon-btn .i-sun { display: none; }
:root[data-theme="light"] .icon-btn .i-moon { display: block; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: var(--nav-bg);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav__inner {
  max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter);
  height: 64px; display: flex; align-items: center; gap: 16px;
}
.nav__brand { text-decoration: none; }
.monogram {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  background: linear-gradient(135deg, var(--accent), #6f5bff);
  color: #fff; font: 700 15px/1 var(--font-display); letter-spacing: -0.02em;
}
.nav nav { flex: 1; }
.nav__links { display: none; gap: 4px; justify-content: center; }
.nav__links a {
  display: block; padding: 8px 12px; border-radius: 999px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav__links a:hover, .nav__links a.is-active { color: var(--text); background: var(--accent-soft); }
.nav__actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
@media (min-width: 860px) { .nav__links { display: flex; } }

/* ---------- Cards ---------- */
.card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color 0.25s var(--ease), transform 0.25s var(--ease), box-shadow 0.25s var(--ease), background-color 0.3s;
}
.card::after {
  content: ""; position: absolute; inset: -1px; border-radius: inherit; pointer-events: none;
  background: radial-gradient(400px circle at var(--mx, 50%) var(--my, 0%), var(--accent-glow), transparent 45%);
  opacity: 0; transition: opacity 0.3s;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude; padding: 1px;
}
@media (hover: hover) {
  .card:hover { border-color: var(--border-strong); }
  .card:hover::after { opacity: 1; }
}

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section--tight { padding: 48px 0; }
@media (min-width: 720px) { .section { padding: 104px 0; } .section--tight { padding: 64px 0; } }
.section__head { margin-bottom: 32px; max-width: 640px; }
.section__head h2 { font-size: clamp(30px, 5vw, 48px); margin-top: 10px; }
.section__sub { color: var(--muted); margin-top: 12px; font-size: 17px; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 72px 0 80px; isolation: isolate; }
@media (min-width: 720px) { .hero { padding: 120px 0 128px; } }
.hero__inner { position: relative; z-index: 1; }
.hero__name {
  font-size: clamp(64px, 17vw, 184px);
  line-height: 0.88; letter-spacing: -0.055em; font-weight: 700;
  margin: 18px 0 26px;
  background: linear-gradient(180deg, var(--text) 30%, color-mix(in srgb, var(--text) 55%, var(--accent)));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__lead { font: 500 clamp(17px, 2.2vw, 22px)/1.45 var(--font-display); color: var(--text); max-width: 760px; }
.hero__about { color: var(--muted); max-width: 640px; margin-top: 14px; font-size: 17px; }
.hero__lead + .hero__about { margin-top: 18px; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }
.logos-block { margin-top: 56px; }
.logos__label { font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 18px; }
.logos { display: flex; flex-wrap: wrap; align-items: center; gap: 22px 40px; color: var(--muted); }
.logos li { display: flex; align-items: center; height: 40px; opacity: 0.85; transition: opacity 0.2s, color 0.2s; }
.logos li:hover { opacity: 1; color: var(--text); }
.logo { display: block; width: auto; }
.logo--unilever { height: 42px; }
.logo--pg { height: 30px; }
.logo--ms { height: 21px; }
.logo--bolt { font: 800 31px/1 var(--font-body); letter-spacing: -0.045em; display: inline-flex; align-items: baseline; }
.bolt-o { display: inline-block; width: 0.56em; height: 0.84em; margin: 0 0.035em 0 0.03em; transform: translateY(0.29em); }
@media (max-width: 400px) { .logos { gap: 18px 28px; } .logo--ms { height: 17px; } }

.mesh { position: absolute; inset: -20% -10% auto; height: 120%; z-index: 0; pointer-events: none; filter: blur(70px); opacity: 0.9; }
.mesh span { position: absolute; border-radius: 50%; }
.mesh span:nth-child(1) { width: 46vw; height: 46vw; max-width: 620px; max-height: 620px; right: -6%; top: 2%; background: var(--mesh-1); animation: drift1 22s ease-in-out infinite alternate; }
.mesh span:nth-child(2) { width: 34vw; height: 34vw; max-width: 480px; max-height: 480px; right: 22%; top: 30%; background: var(--mesh-2); animation: drift2 26s ease-in-out infinite alternate; }
.mesh span:nth-child(3) { width: 28vw; height: 28vw; max-width: 380px; max-height: 380px; right: 4%; top: 48%; background: var(--mesh-3); animation: drift3 30s ease-in-out infinite alternate; }
.hero::after { content: ""; position: absolute; inset: auto 0 0; height: 160px; background: linear-gradient(transparent, var(--bg)); z-index: 0; }
@keyframes drift1 { to { transform: translate(-8%, 10%) scale(1.1); } }
@keyframes drift2 { to { transform: translate(12%, -8%) scale(0.9); } }
@keyframes drift3 { to { transform: translate(-14%, -6%) scale(1.15); } }

/* ---------- Story (scroll-driven intro) ---------- */
.story { position: relative; padding: 24px 0 8px; }
.story__sticky { position: relative; }
.story__stage { display: grid; gap: 40px; }
.scene__kicker { font: 500 14px/1.4 var(--font-body); letter-spacing: 0.06em; color: var(--accent-2); margin-bottom: 14px; }
.scene__line {
  font: 600 clamp(32px, 5.6vw, 76px)/1.06 var(--font-display); letter-spacing: -0.035em;
  max-width: 15ch; color: var(--text); text-wrap: balance;
}
.scene__line em { font-style: normal; color: var(--accent-2); }
.story__dots, .story__skip, .story__glow { display: none; }

/* Scroll-driven version (JS on, motion allowed) */
.story.is-live { height: calc(var(--scenes, 5) * 70vh + 100vh); padding: 0; }
.story.is-live .story__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; align-items: center; overflow: hidden; }
.story.is-live .story__stage { display: grid; gap: 0; }
.story.is-live .scene {
  grid-area: 1 / 1; opacity: 0; transform: translateY(36px); pointer-events: none;
  transition: opacity 0.6s var(--ease), transform 0.8s var(--ease);
}
.story.is-live .scene.is-active { opacity: 1; transform: none; }
.story.is-live .scene.is-past { transform: translateY(-36px); }
.story.is-live .w { opacity: 0.14; transition: opacity 0.35s linear; }
.story.is-live .w.on { opacity: 1; }
.story.is-live .story__glow {
  display: block; position: absolute; width: 70vmax; height: 70vmax; border-radius: 50%;
  left: var(--gx, 70%); top: var(--gy, 40%); transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--glow-c, var(--mesh-1)), transparent 62%);
  filter: blur(30px); opacity: 0.55; pointer-events: none;
  transition: left 1.4s var(--ease), top 1.4s var(--ease), background 1.4s;
}
.story.is-live .story__dots { display: flex; flex-direction: column; gap: 10px; position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); }
.story__dots li { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); transition: height 0.3s var(--ease), background-color 0.3s; }
.story__dots li.on { background: var(--accent); height: 22px; border-radius: 6px; }
.story.is-live .story__skip {
  display: inline-block; position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%);
  font-size: 13px; color: var(--muted); text-decoration: none; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--border);
}
.story__skip:hover { color: var(--text); border-color: var(--accent); }

/* ---------- Bento / impact ---------- */
.bento { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 720px) { .bento { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; } }
.stat { padding: 22px 20px 20px; min-height: 150px; display: flex; flex-direction: column; justify-content: space-between; overflow: hidden; }
.stat--wide { grid-column: span 2; }
.stat--hero { grid-column: span 2; min-height: 200px; background: linear-gradient(140deg, var(--accent-soft), transparent 60%), var(--surface); }
@media (min-width: 720px) { .stat--hero { grid-row: span 2; min-height: 316px; } }
.stat__num {
  font: 700 clamp(38px, 6vw, 56px)/1 var(--font-display); letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap;
}
.stat--hero .stat__num { font-size: clamp(56px, 10vw, 104px); color: var(--accent-2); }
.stat__pre { font-size: 0.5em; vertical-align: 0.6em; margin-right: 4px; color: var(--muted); letter-spacing: 0; }
.stat__pre--inline { font-size: 1em; vertical-align: 0; margin-right: 0.04em; }
.stat__label { color: var(--muted); font-size: 14px; line-height: 1.4; margin-top: 14px; }
.stat__label strong { color: var(--text); font-weight: 600; display: block; font-size: 15px; }
.stat__tag {
  align-self: flex-start; font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-2); background: var(--accent-soft); border-radius: 999px; padding: 4px 9px; margin-bottom: 14px;
}

/* ---------- Map fade (journey map) ---------- */
.tilemap { width: 100%; height: auto; }
.tilemap {
  -webkit-mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 9%, #000 91%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  mask-composite: intersect;
}

/* ---------- Cases ---------- */
.cases { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@media (min-width: 640px) { .cases { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .cases { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.case { padding: 20px; display: flex; flex-direction: column; }
.case__viz {
  position: relative; height: 116px; margin-bottom: 18px; overflow: hidden;
  display: grid; place-items: center;
  border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: radial-gradient(70% 100% at 50% 100%, var(--accent-soft), transparent 70%), var(--surface-2);
}
.case__viz::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 14px 14px; background-position: center;
  -webkit-mask-image: radial-gradient(circle at 50% 50%, #000, transparent 72%);
  mask-image: radial-gradient(circle at 50% 50%, #000, transparent 72%);
}
.case__viz svg { position: relative; width: 66%; max-width: 168px; height: auto; overflow: visible; transition: transform 0.45s var(--ease); }
@media (hover: hover) { .case:hover .case__viz svg { transform: scale(1.06); } }
.v-dim { fill: var(--tile-off); }
.v-dots circle, .v-mid { fill: color-mix(in srgb, var(--accent) 45%, var(--tile-off)); }
.v-acc, .v-acc-fill { fill: var(--accent); }
.v-soft { fill: var(--accent-soft); }
.v-line { stroke: var(--border-strong); stroke-width: 2; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.v-curve { stroke: var(--accent); stroke-width: 3; fill: none; stroke-linecap: round; }
.v-ring { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, var(--tile-off)); stroke-width: 2.5; }
.v-ring--halo { stroke: var(--accent-soft); stroke-width: 6; }
.v-up { fill: none; stroke: var(--accent-2); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.v-route { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 5 6; }
@keyframes march { to { stroke-dashoffset: -22; } }

/* Tile animations: play once when the tile appears, loop while hovered.
   Every resting state is the finished picture, so reduced motion shows it complete. */
.a-float, .a-out, .a-pop, .a-left, .a-right, .a-rise, .a-pulse { transform-box: fill-box; transform-origin: center; }
.a-draw { stroke-dasharray: 1; stroke-dashoffset: 0; }
.a-pulse { fill: none; stroke: var(--accent); stroke-width: 2; opacity: 0; }
.case.is-in .v-route { animation: march 1s linear 2; }
.case.is-in .a-float { animation: float 3s ease-in-out calc(var(--i) * -0.6s) 1; }
.case.is-in .a-pulse { animation: pulse 2.4s var(--ease) 0.2s 1; }
.case.is-in .a-out { animation: popOut 2.6s var(--ease) calc(var(--i) * 90ms) 1 both; }
.case.is-in .a-draw { animation: draw 2.6s var(--ease) 1 both; }
.case.is-in .a-fade { animation: fadeIn 2.6s var(--ease) 1 both; }
.case.is-in .a-pop { animation: pop 2.6s var(--ease) 1 both; }
.case.is-in .a-pop--late { animation-name: popLate; }
.case.is-in .a-left { animation: slideL 2.6s var(--ease) 1 both; }
.case.is-in .a-right { animation: slideR 2.6s var(--ease) 1 both; }
.case.is-in .a-rise { animation: rise 2.6s var(--ease) 1 both; }
@media (hover: hover) {
  .case:hover .v-route, .case:hover .a-float, .case:hover .a-pulse, .case:hover .a-out, .case:hover .a-draw,
  .case:hover .a-fade, .case:hover .a-pop, .case:hover .a-left, .case:hover .a-right, .case:hover .a-rise { animation-iteration-count: infinite; }
}
/* Bolt network: grows row by row from a single node (one 4s timeline) */
.net-e { fill: none; stroke: color-mix(in srgb, var(--accent) 40%, var(--border-strong)); stroke-width: 2; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.net-n { fill: var(--accent); transform-box: fill-box; transform-origin: center; }
@keyframes netN0 { 0%, 4% { transform: scale(0); } 14%, 100% { transform: scale(1); } }
.case.is-in .net-n0 { animation: netN0 4s var(--ease) 1 both; }
@keyframes netE1 { 0%, 13% { stroke-dashoffset: 1; } 23%, 100% { stroke-dashoffset: 0; } }
.case.is-in .net-e1 { animation: netE1 4s var(--ease) 1 both; }
@keyframes netN2 { 0%, 22% { transform: scale(0); } 32%, 100% { transform: scale(1); } }
.case.is-in .net-n2 { animation: netN2 4s var(--ease) 1 both; }
@keyframes netE3 { 0%, 31% { stroke-dashoffset: 1; } 41%, 100% { stroke-dashoffset: 0; } }
.case.is-in .net-e3 { animation: netE3 4s var(--ease) 1 both; }
@keyframes netN4 { 0%, 40% { transform: scale(0); } 50%, 100% { transform: scale(1); } }
.case.is-in .net-n4 { animation: netN4 4s var(--ease) 1 both; }
@keyframes netE5 { 0%, 49% { stroke-dashoffset: 1; } 59%, 100% { stroke-dashoffset: 0; } }
.case.is-in .net-e5 { animation: netE5 4s var(--ease) 1 both; }
@keyframes netN6 { 0%, 58% { transform: scale(0); } 68%, 100% { transform: scale(1); } }
.case.is-in .net-n6 { animation: netN6 4s var(--ease) 1 both; }
@media (hover: hover) { .case:hover .net-n, .case:hover .net-e { animation-iteration-count: infinite; } }
@keyframes float { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(1.5px, -3px); } 75% { transform: translate(-1.5px, 2px); } }
@keyframes pulse { 0% { transform: scale(0.8); opacity: 0.9; } 70%, 100% { transform: scale(1.9); opacity: 0; } }
@keyframes popOut { 0% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } 45%, 100% { transform: none; opacity: 1; } }
@keyframes draw { 0% { stroke-dashoffset: 1; } 55%, 100% { stroke-dashoffset: 0; } }
@keyframes fadeIn { 0%, 15% { opacity: 0; } 60%, 100% { opacity: 1; } }
@keyframes pop { 0%, 35% { transform: scale(0); } 55%, 100% { transform: scale(1); } }
@keyframes popLate { 0%, 50% { transform: scale(0); } 62%, 100% { transform: scale(1); } }
@keyframes slideL { 0% { transform: translateX(-10px); } 40%, 100% { transform: none; } }
@keyframes slideR { 0% { transform: translateX(10px); } 40%, 100% { transform: none; } }
@keyframes rise { 0%, 45% { transform: translateY(6px); opacity: 0; } 70%, 100% { transform: none; opacity: 1; } }
.case__meta { font-size: 12px; color: var(--accent-2); font-weight: 600; letter-spacing: 0.02em; }
.case__title { font-size: 20px; margin-top: 8px; }
.case__teaser { color: var(--muted); font-size: 15px; margin-top: 8px; }
.case__toggle {
  margin-top: 14px; align-self: flex-start; background: none; border: 0; padding: 6px 0; cursor: pointer;
  color: var(--text); font: 600 14px/1 var(--font-body); display: inline-flex; align-items: center; gap: 8px;
}
.case__toggle span {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  border: 1px solid var(--border-strong); font-size: 14px; transition: transform 0.3s var(--ease), background-color 0.2s;
}
.case__toggle:hover span { border-color: var(--accent); }
.case__toggle[aria-expanded="true"] span { transform: rotate(45deg); background: var(--accent); border-color: var(--accent); color: #fff; }
.case__body { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.case__body dl { margin: 0; display: grid; gap: 4px; }
.case__body dt { font-size: 11px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-2); margin-top: 10px; }
.case__body dt:first-child { margin-top: 0; }
.case__body dd { margin: 0; color: var(--muted); font-size: 14.5px; }
.case.is-open { border-color: var(--accent); }
.case:target { border-color: var(--accent); }
.case__body:not([hidden]) { animation: fadeDown 0.35s var(--ease); }
@keyframes fadeDown { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 28px; max-width: 760px; }
.timeline::before, .timeline::after {
  content: ""; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--border-strong);
}
.timeline::after { background: linear-gradient(var(--accent), var(--accent-2)); bottom: auto; height: calc(var(--progress, 1) * (100% - 16px)); transition: height 0.1s linear; }
.tl { position: relative; padding-bottom: 28px; }
.tl:last-child { padding-bottom: 0; }
.tl::before {
  content: ""; position: absolute; left: -28px; top: 4px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--accent); z-index: 1;
}
.tl--now::before { background: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.tl__year { display: inline-block; font: 600 14px/1.5 var(--font-display); color: var(--accent-2); letter-spacing: 0.02em; }
.tl__card { margin-top: 6px; }
.tl__card h3 { font-size: 21px; }
.tl__card p { color: var(--muted); margin-top: 6px; max-width: 600px; }
@media (min-width: 720px) {
  .timeline { padding-left: 0; margin-left: 150px; padding-left: 40px; }
  .timeline::before, .timeline::after { left: 7px; }
  .tl::before { left: -40px; }
  .tl__year { position: absolute; left: -190px; width: 130px; text-align: right; top: 0; }
  .tl__card { margin-top: 0; }
}

/* ---------- Journey map ---------- */
.journey { display: grid; gap: 24px; }
.journey__map {
  position: sticky; top: 64px; z-index: 2; background: var(--bg);
  padding: 8px 0 12px; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter);
  border-bottom: 1px solid var(--border);
}
.journey__svg { height: 190px; width: 100%; }
.journey__caption { font: 600 13px/1.3 var(--font-display); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent-2); margin-top: 6px; }
.jm-land { fill: var(--tile-off); stroke: var(--bg); stroke-width: calc(0.6px * var(--k, 1)); }
.jm-route { fill: none; stroke: var(--accent); stroke-width: calc(2.4px * var(--k, 1)); stroke-linecap: round; transition: stroke-dashoffset 1.1s var(--ease); }
.jm-city circle { fill: var(--surface-2); stroke: var(--faint); stroke-width: calc(2px * var(--k, 1)); transition: fill 0.4s, stroke 0.4s, r 0.4s; }
.jm-city text { fill: var(--faint); font-family: var(--font-display); font-weight: 600; font-size: calc(13px * var(--k, 1)); transition: fill 0.4s; }
.jm-city.is-on circle { fill: var(--accent); stroke: var(--accent); }
.jm-city.is-on text { fill: var(--text); }
.jm-city.is-here circle { stroke: var(--accent-soft); stroke-width: calc(8px * var(--k, 1)); }
.tl { transition: opacity 0.4s; }
.timeline.is-tracking .tl:not(.is-current) .tl__card { opacity: 0.55; transition: opacity 0.4s; }
.timeline.is-tracking .tl.is-current .tl__card { opacity: 1; }
@media (min-width: 960px) {
  .journey { grid-template-columns: minmax(0, 1fr) minmax(0, 460px); gap: 48px; align-items: start; }
  .journey__map { order: 2; top: 120px; margin: 0; padding: 0; border: 0; background: none; }
  .journey__svg { height: auto; aspect-ratio: 1 / 1; }
  .journey .timeline { margin-left: 150px; }
}

/* ---------- Capabilities ---------- */
.caps { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 640px) { .caps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .caps { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; } }
.cap { padding: 22px; }
.cap h3 { font-size: 20px; }
.cap p { color: var(--muted); margin-top: 8px; font-size: 15px; }
.cap--note { background: linear-gradient(140deg, var(--accent-soft), transparent 70%), var(--surface); }
.evid { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.evid a {
  display: inline-block; font-size: 12.5px; font-weight: 500; text-decoration: none;
  padding: 6px 10px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-2);
  border: 1px solid transparent; transition: border-color 0.2s;
}
.evid a:hover { border-color: var(--accent); }

/* ---------- Contact ---------- */
.contact__card { padding: 36px 24px; text-align: center; overflow: hidden; background: radial-gradient(600px circle at 50% 0%, var(--accent-soft), transparent 70%), var(--surface); }
@media (min-width: 720px) { .contact__card { padding: 64px 48px; } }
.contact__card h2 { font-size: clamp(40px, 7vw, 72px); margin-top: 12px; letter-spacing: -0.04em; }
.contact__sub { color: var(--muted); max-width: 560px; margin: 16px auto 0; font-size: 17px; }
.contact__links { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 30px; }
.contact__links .btn { max-width: 100%; }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; color: var(--faint); font-size: 14px; }
.footer__inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--text); }

/* ---------- Reveal motion ---------- */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s var(--ease), transform 0.7s var(--ease); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .jm-route { stroke-dashoffset: 0 !important; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
  .mesh span { animation: none; }
}

/* ---------- Small screens ---------- */
@media (max-width: 400px) {
  .nav__actions .btn--sm { padding: 0 12px; font-size: 13px; }
  .stat { padding: 18px 16px; }
  .stat__num { font-size: 34px; }
}
