/* ---------------------------------------------------------------
   Sidhant Panda — CV site
   Apple design language: near-black on near-white, one accent,
   whitespace as the design.
---------------------------------------------------------------- */

@font-face {
  font-family: "Inter";
  src: url("/fonts/inter-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbfbfd;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --secondary: #6e6e73;
  --label: #86868b;
  --accent: #0066cc;
  --hairline: rgba(0, 0, 0, 0.10);
  --card: #f5f5f7;
  --ok: #1a7f37;
  --bad: #bf1029;
  --num-a: #0059c9;
  --num-b: #2aa5ff;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-alt: #101012;
    --text: #f5f5f7;
    --secondary: #a1a1a6;
    --label: #86868b;
    --hairline: rgba(255, 255, 255, 0.14);
    --card: #141416;
    --ok: #3fb950;
    --bad: #ff6369;
    --num-a: #2997ff;
    --num-b: #6fd6ff;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-alt: #101012;
  --text: #f5f5f7;
  --secondary: #a1a1a6;
  --label: #86868b;
  --hairline: rgba(255, 255, 255, 0.14);
  --card: #141416;
  --ok: #3fb950;
  --bad: #ff6369;
  --num-a: #2997ff;
  --num-b: #6fd6ff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding-left: 22px;
  padding-right: 22px;
}

.measure { max-width: 640px; }
.nowrap { white-space: nowrap; }

section { padding-top: 120px; }
section:last-of-type { padding-bottom: 120px; }
@media (min-width: 735px) {
  section { padding-top: 150px; }
  section:last-of-type { padding-bottom: 150px; }
}

/* --- type scale ------------------------------------------------ */

h1, h2, h3 { font-weight: 700; letter-spacing: -0.02em; }

h2 {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.1;
  margin-bottom: 24px;
}

h3 { font-size: 21px; line-height: 1.3; }

p { color: var(--text); }
.muted { color: var(--secondary); }

.section-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--label);
  margin-bottom: 16px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

::selection { background: rgba(0, 102, 204, 0.18); }

/* --- hero ------------------------------------------------------ */

.hero {
  padding-top: 140px;
  text-align: center;
}
@media (min-width: 735px) { .hero { padding-top: 170px; } }

.portrait {
  width: 140px;
  height: 140px;
  margin: 0 auto 40px;
  border-radius: 50%;
  background: var(--bg-alt);
  border: 1px solid var(--hairline);
  overflow: hidden;
}
.portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero h1 {
  font-size: clamp(56px, 9vw, 80px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.hero .tagline {
  font-size: clamp(19px, 2.6vw, 24px);
  line-height: 1.4;
  color: var(--secondary);
  max-width: 640px;
  margin: 22px auto 0;
  font-weight: 400;
}

.hero .cta {
  margin-top: 44px;
  display: flex;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  font-size: 17px;
  font-weight: 500;
  line-height: 1;
  padding: 15px 28px;
  border-radius: 980px;
  transition: opacity 0.2s ease;
}
.btn:hover { text-decoration: none; opacity: 0.85; }

.btn-primary {
  background: var(--text);
  color: var(--bg);
}
.btn-secondary {
  color: var(--text);
  border: 1px solid var(--text);
}

.cta-note {
  margin: 22px auto 0;
  max-width: 480px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--label);
}

/* --- key metrics: grouped by scope, under the case study --------- */

/* One card per scope, so a platform metric never reads as a company one.
   Columns are minmax(0, 1fr): a plain 1fr can't shrink below its content,
   which is what let "10,000+" push its column wider than the others. */
.stats {
  display: grid;
  gap: 14px;
  margin-top: 56px;
}
@media (min-width: 735px) {
  .stats { grid-template-columns: minmax(0, 3fr) minmax(0, 1fr); }
}
.stat-group {
  background: var(--card);
  border-radius: 18px;
  padding: 22px 0 26px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
/* numbers sit on a shared baseline across cards, whatever the caption length */
.stat-group .stat-tiles { margin-top: auto; }
.stat-cap {
  padding: 0 22px;
  margin-bottom: 16px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
}
.stat-tiles { display: grid; grid-template-columns: minmax(0, 1fr); }
.stat-tiles .metric + .metric {
  border-top: 1px solid var(--hairline);
  margin-top: 18px;
  padding-top: 18px;
}
@media (min-width: 735px) {
  .stat-group--main .stat-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stat-tiles .metric + .metric {
    border-top: 0;
    border-left: 1px solid var(--hairline);
    margin-top: 0;
    padding-top: 0;
  }
}

.metric { padding: 0 22px; min-width: 0; }
.metric .value {
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(180deg, var(--num-a), var(--num-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.metric .name {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.4;
  color: var(--secondary);
}

/* --- case-study teaser ----------------------------------------- */

.teaser p + p { margin-top: 1em; }
.teaser .more { display: inline-block; margin-top: 28px; font-size: 19px; }
/* Two columns at body size: fills the row without the long lines (or the
   odd type size) a single wide paragraph would need. */
@media (min-width: 735px) {
  .teaser-body { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
  .teaser-body .more { margin-top: 20px; }
}
@media (max-width: 734px) {
  .teaser-body > p { margin-bottom: 1em; }
}

/* --- career storyline -------------------------------------------- */

.story-wrap { overflow-x: auto; margin-top: 16px; }

/* Scroll-driven scene (main.js adds .story--scrub; its JS sets the track's
   height and the pin's top). The track is the scroll distance; the pin
   holds still inside it while scrolling flies the rocket. */
.story--scrub .story-pin { position: sticky; }
.story--scrub .story-card { margin-top: 20px; }
.story--scrub .story-hint { margin-top: 10px; }
.story--scrub .story-wrap { scrollbar-width: none; }
.story--scrub .story-wrap::-webkit-scrollbar { display: none; }
/* phones: the pinned scene must fit one screen, so the card tightens up */
@media (max-width: 734px) {
  .story--scrub .story-card { padding: 22px 22px; gap: 6px; }
  .story--scrub .story-when .y { font-size: 28px; }
  .story--scrub .story-what h3 { font-size: 18px; margin-bottom: 6px; }
  .story--scrub .story-what p { font-size: 14px; line-height: 1.5; }
  .story--scrub .story-hint { font-size: 12px; }
}
.story-wrap svg {
  display: block;
  min-width: 680px;
  width: 100%;
  height: auto;
}

.story-node { cursor: pointer; outline: none; }
.story-node:focus-visible .ring { opacity: 1; }
.story-node .hit { fill: transparent; }
.story-node .ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.5;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.story-node .pt {
  fill: var(--bg);
  stroke: var(--secondary);
  stroke-width: 1.5;
  transition: fill 0.2s ease, stroke 0.2s ease;
}
.story-node .yr {
  font-size: 12px;
  fill: var(--label);
  font-variant-numeric: tabular-nums;
}
.story-node .lb {
  font-size: 15px;
  font-weight: 500;
  fill: var(--secondary);
  transition: fill 0.2s ease;
}
.story-node:hover .ring { opacity: 0.45; }
.story-node:hover .pt { stroke: var(--accent); }
.story-node:hover .lb { fill: var(--text); }
.story-node[aria-pressed="true"] .ring { opacity: 1; }
.story-node[aria-pressed="true"] .pt { fill: var(--accent); stroke: var(--accent); }
.story-node[aria-pressed="true"] .lb { fill: var(--text); font-weight: 600; }

/* line draws + terrain fades + nodes stagger in on first reveal */
.reveal .story-line { stroke-dasharray: 1; stroke-dashoffset: 1; }
.reveal.in .story-line { stroke-dashoffset: 0; transition: stroke-dashoffset 1.2s ease-out 0.15s; }
.reveal .story-area { opacity: 0; }
.reveal.in .story-area { opacity: 1; transition: opacity 0.9s ease-out 0.9s; }
.reveal .story-node { opacity: 0; }
.reveal.in .story-node { opacity: 1; transition: opacity 0.4s ease-out; }
/* keyed off data-i, not :nth-of-type — the flight layer injects sibling <g>s */
.reveal.in .story-node[data-i="0"] { transition-delay: 0.25s; }
.reveal.in .story-node[data-i="1"] { transition-delay: 0.45s; }
.reveal.in .story-node[data-i="2"] { transition-delay: 0.65s; }
.reveal.in .story-node[data-i="3"] { transition-delay: 0.85s; }
.reveal.in .story-node[data-i="4"] { transition-delay: 1.05s; }
.reveal.in .story-node[data-i="5"] { transition-delay: 1.25s; }

/* --- storyline flight layer (injected by main.js) ----------------- */

/* accent fill trailing the rocket: drawn behind it, grey ahead of it */
.story-trail {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  pointer-events: none;
}

/* milestone pips — shipped work, placed along the curve */
.story-pip { cursor: default; }
.story-pip .dot {
  fill: var(--bg);
  stroke: var(--secondary);
  stroke-width: 1.2;
  opacity: 0.55;
  transform-box: fill-box;
  transform-origin: center;
  transition: opacity 0.25s ease, stroke 0.25s ease, fill 0.25s ease;
}
.story-pip.lit .dot {
  fill: var(--accent);
  stroke: var(--accent);
  opacity: 1;
}
.story-pip.pop .dot { animation: pip-pop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes pip-pop {
  0% { transform: scale(1); }
  40% { transform: scale(2.6); }
  100% { transform: scale(1); }
}
.story-pip .pip-label {
  font-size: 12.5px;
  font-weight: 500;
  fill: var(--text);
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.story-pip:hover .pip-label,
.story-pip:focus-visible .pip-label { opacity: 1; }
.story-pip:hover .dot { fill: var(--accent); stroke: var(--accent); opacity: 1; }
/* a milestone already spelled out in the log below doesn't need its own label */
.story-pip.in-log:hover .pip-label { opacity: 0; }
/* hovering its chip in the log swells the pip, and vice versa */
.story-pip.focus .dot {
  fill: var(--accent);
  stroke: var(--accent);
  opacity: 1;
  transform: scale(2);
}

/* focus dimming: while a leg is being narrated, everything outside it recedes.
   Beats a camera push here — no motion sickness over five legs.
   :not(.active) is needed to outrank the .reveal.in stagger rules above. */
.story-wrap svg.dimmed .story-node:not(.active),
.story-wrap svg.dimmed .story-pip:not(.active) {
  opacity: 0.28;
  transition: opacity 0.4s ease;
  transition-delay: 0s;
}

/* year HUD: counts the years actually elapsing during a flight */
.story-hud {
  font-size: 27px;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  fill: var(--label);
  opacity: 0.5;
  pointer-events: none;
  transition: fill 0.3s ease, opacity 0.3s ease;
}
.story-hud.live { fill: var(--accent); opacity: 1; }

/* the rocket */
.story-ship {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  filter: url(#story-glow);
}
.story-ship.visible { opacity: 1; }
.ship-body { fill: var(--accent); }
.ship-flame {
  fill: var(--accent);
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 100% 50%;
  transition: opacity 0.2s ease;
}
.story-ship.flying .ship-flame {
  opacity: 0.85;
  animation: ship-thrust 0.14s ease-in-out infinite alternate;
}
@keyframes ship-thrust {
  from { transform: scaleX(0.55); }
  to { transform: scaleX(1.2); }
}

/* landing effects */
.fx-ring {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.8;
  vector-effect: non-scaling-stroke;
  transform-box: fill-box;
  transform-origin: center;
  animation: fx-ring 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
  pointer-events: none;
}
@keyframes fx-ring {
  from { transform: scale(0.55); opacity: 0.9; }
  to { transform: scale(4.2); opacity: 0; }
}
.fx-spark {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: fx-spark 0.5s ease-out forwards;
  pointer-events: none;
}
@keyframes fx-spark {
  from { transform: translate(0, 0) scale(1); opacity: 0.9; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; }
}
.fx-chip {
  font-size: 13px;
  font-weight: 600;
  fill: var(--accent);
  font-variant-numeric: tabular-nums;
  animation: fx-chip 1.6s ease-out forwards;
  pointer-events: none;
}
@keyframes fx-chip {
  0% { opacity: 0; transform: translateY(7px); }
  16% { opacity: 1; transform: translateY(0); }
  68% { opacity: 1; transform: translateY(-5px); }
  100% { opacity: 0; transform: translateY(-14px); }
}

/* exhaust, shed continuously while the rocket is under thrust */
.fx-puff {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: fx-puff 0.62s ease-out forwards;
  pointer-events: none;
}
@keyframes fx-puff {
  from { transform: translate(0, 0) scale(1); opacity: 0.5; }
  to { transform: translate(var(--dx), var(--dy)) scale(0.15); opacity: 0; }
}
/* the smaller ring fired when a milestone is crossed, vs. a chapter landing */
.fx-ring.small { animation-duration: 0.45s; }

/* the pilot: a portrait riding the rocket, hat by chapter */
.story-pilot {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.story-pilot.visible { opacity: 1; }
.pilot-eyes {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  animation: pilot-blink 4.6s infinite;
}
@keyframes pilot-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  95% { transform: scaleY(0.1); }
}
/* a happy squint and a wider grin on touchdown */
.pilot-body.land .pilot-eyes { animation: pilot-squint 0.6s ease-out; }
@keyframes pilot-squint {
  0%, 100% { transform: scaleY(1); }
  25%, 70% { transform: scaleY(0.35); }
}
.pilot-grin { transform-box: fill-box; transform-origin: 50% 0; }
.pilot-body.land .pilot-grin { animation: pilot-grin 0.6s ease-out; }
@keyframes pilot-grin {
  0%, 100% { transform: scale(1); }
  30%, 70% { transform: scale(1.25, 1.5); }
}
.pilot-bob { animation: pilot-bob 2.4s ease-in-out infinite; }
@keyframes pilot-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-1.6px); }
}
.pilot-body { transform-box: fill-box; transform-origin: 50% 100%; }
.pilot-body.land { animation: pilot-land 0.5s cubic-bezier(0.3, 1.4, 0.5, 1); }
@keyframes pilot-land {
  0% { transform: scale(1); }
  30% { transform: scale(1.14, 0.84); }
  60% { transform: scale(0.95, 1.07); }
  100% { transform: scale(1); }
}
/* hats drop in with a bounce; the outgoing one flips off */
.hat {
  opacity: 0;
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.hat.on { opacity: 1; animation: hat-on 0.55s cubic-bezier(0.25, 1.5, 0.5, 1) both; }
.hat.off { opacity: 0; animation: hat-off 0.4s ease-in both; }
@keyframes hat-on {
  0% { opacity: 0; transform: translateY(-14px) rotate(-18deg); }
  45% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
@keyframes hat-off {
  0% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translate(7px, -18px) rotate(32deg); }
}
.hat .tassel {
  transform-box: fill-box;
  transform-origin: 0 0;
  animation: tassel 1.6s ease-in-out infinite alternate;
}
@keyframes tassel {
  from { transform: rotate(-7deg); }
  to { transform: rotate(9deg); }
}
.hat .beacon { fill: var(--accent); animation: beacon 1.4s ease-in-out infinite; }
@keyframes beacon {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
/* the "+N years" pill over the rider's hat */
.fx-chip .chip-bg { fill: var(--card); stroke: var(--accent); stroke-width: 0.8; }

/* --- the log: what happened between two chapters ------------------ */

.story-log { margin-top: 18px; }
/* Reserve the taller leg's height so switching legs doesn't shift the page.
   Only where the chip count is predictable — on a phone they wrap freely and
   a fixed height would just leave a hole under the short legs. */
@media (min-width: 735px) {
  .story-log { min-height: 104px; }
}
.log-head {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--label);
  font-variant-numeric: tabular-nums;
  margin-bottom: 12px;
}
.log-chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.log-chips li {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13.5px;
  line-height: 1.2;
  color: var(--secondary);
  background: var(--card);
  opacity: 0;
  transform: translateY(9px) scale(0.96);
  transition: opacity 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              transform 0.4s cubic-bezier(0.22, 1, 0.36, 1),
              color 0.2s ease, border-color 0.2s ease;
}
.log-chips li.in {
  opacity: 1;
  transform: none;
}
.log-chips li.focus,
.log-chips li:hover {
  color: var(--text);
  border-color: var(--accent);
}

.story-hint {
  margin-top: 14px;
  font-size: 13px;
  color: var(--label);
}
.story-skip {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.story-skip:hover { text-decoration: underline; }

.story-card {
  background: var(--card);
  border-radius: 18px;
  padding: 30px 32px;
  margin-top: 28px;
  display: grid;
  gap: 10px 48px;
}
@media (min-width: 735px) {
  .story-card { grid-template-columns: 150px 1fr; }
}
.story-when .y {
  display: block;
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.story-when .y2 {
  display: block;
  margin-top: 6px;
  font-size: 14px;
  color: var(--label);
  font-variant-numeric: tabular-nums;
}
.story-what h3 { margin-bottom: 8px; letter-spacing: -0.01em; }
.story-what p { font-size: 15px; color: var(--secondary); max-width: 640px; }
.story-card-in { animation: story-in 0.35s ease-out; }

@keyframes story-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* --- experience timeline --------------------------------------- */

.timeline { border-top: 1px solid var(--hairline); }

.role {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px 40px;
  padding: 40px 0;
  border-bottom: 1px solid var(--hairline);
}
@media (min-width: 735px) {
  .role { grid-template-columns: 200px 1fr; }
}

.role .dates {
  font-size: 15px;
  color: var(--label);
  font-variant-numeric: tabular-nums;
  padding-top: 3px;
  white-space: nowrap;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  margin-left: 8px;
  vertical-align: 1px;
  animation: live-pulse 2.4s ease-out infinite;
}
@keyframes live-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 45%, transparent); }
  70%, 100% { box-shadow: 0 0 0 8px transparent; }
}

.role .org {
  color: var(--secondary);
  font-weight: 400;
}

.org-link {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: color-mix(in srgb, var(--secondary) 50%, transparent);
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}
.org-link:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.role ul {
  margin-top: 12px;
  list-style: none;
}
.role li {
  position: relative;
  padding-left: 20px;
  color: var(--secondary);
  font-size: 16px;
  max-width: 640px;
}
.role li + li { margin-top: 10px; }
.role li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.65em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--label);
}

/* --- how I work cards ------------------------------------------ */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
@media (min-width: 735px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
}

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 32px 28px;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.card:hover { transform: translateY(-4px); }
.card h3 { margin-bottom: 14px; letter-spacing: -0.01em; }
.card p { font-size: 15px; color: var(--secondary); }

/* --- footer ----------------------------------------------------- */

footer {
  border-top: 1px solid var(--hairline);
  padding: 48px 0 64px;
  font-size: 15px;
  color: var(--secondary);
}
footer .row {
  display: flex;
  gap: 10px 28px;
  flex-wrap: wrap;
  align-items: center;
}

.theme-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  padding: 6px;
  border: none;
  background: none;
  color: var(--label);
  cursor: pointer;
  transition: color 0.2s ease;
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg { display: block; }
.theme-toggle .tt-sun { display: none; }
:root[data-theme="dark"] .tt-sun { display: block; }
:root[data-theme="dark"] .tt-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .tt-sun { display: block; }
  :root:not([data-theme="light"]) .tt-moon { display: none; }
}

/* --- case-study page -------------------------------------------- */

.article { padding-top: 140px; padding-bottom: 120px; }
.article header { margin-bottom: 80px; }
.article h1 {
  font-size: clamp(40px, 6.5vw, 64px);
  line-height: 1.05;
  max-width: 820px;
}
.article .standfirst {
  margin-top: 24px;
  font-size: 21px;
  line-height: 1.5;
  color: var(--secondary);
  max-width: 640px;
}
.article h2 {
  font-size: 28px;
  margin: 72px 0 20px;
}
.article p, .article li { max-width: 640px; color: var(--text); }
.article p + p { margin-top: 1em; }
.article ul { margin: 1em 0 0 1.2em; }
.article li + li { margin-top: 8px; }
.article .back { display: inline-block; margin-bottom: 40px; font-size: 15px; }

.diagram {
  margin: 40px 0 8px;
  overflow-x: auto;
}
.diagram svg {
  display: block;
  min-width: 640px;
  width: 100%;
  height: auto;
  color: var(--text);
}
.diagram-caption {
  font-size: 13px;
  color: var(--label);
  margin-top: 10px;
}

/* --- reconciliation demo ----------------------------------------- */

.demo {
  max-width: 720px;
  margin: 48px 0 16px;
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 28px;
}

.demo-head h3 { letter-spacing: -0.01em; }
.demo-sub { font-size: 13px !important; color: var(--label) !important; margin-top: 6px; }

.demo-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 22px;
}
@media (min-width: 600px) {
  .demo-grid { grid-template-columns: 1fr 1fr; }
}

.demo-doc {
  background: var(--card);
  border-radius: 12px;
  padding: 16px 18px;
}
.demo-doc-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--label);
  margin-bottom: 10px;
}
.demo-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 14px;
  padding: 4px 0;
}
.demo-row span { color: var(--secondary); }
.demo-row b { font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }

.demo-checks { margin-top: 22px; border-top: 1px solid var(--hairline); }
.demo-check {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 14px;
}
.demo-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--label);
  align-self: center;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.demo-what { color: var(--secondary); }
.demo-verdict { margin-left: auto; font-weight: 500; text-align: right; }

.demo-check[data-state="match"] .demo-dot { background: var(--ok); border-color: var(--ok); }
.demo-check[data-state="match"] .demo-verdict { color: var(--ok); }
.demo-check[data-state="mismatch"] .demo-dot { background: var(--bad); border-color: var(--bad); }
.demo-check[data-state="mismatch"] .demo-verdict { color: var(--bad); }
.demo-check[data-state="unmatched"] .demo-dot { background: var(--label); border-color: var(--label); }
.demo-check[data-state="unmatched"] .demo-verdict { color: var(--secondary); }
.demo-check[data-state="resolved"] .demo-dot { background: transparent; border-color: var(--ok); }
.demo-check[data-state="resolved"] .demo-verdict { color: var(--ok); }

.demo-fix {
  flex: none;
  align-self: center;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  padding: 6px 14px;
  border-radius: 980px;
  border: 1px solid var(--text);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.demo-fix:hover { opacity: 0.7; }

.demo-panel {
  background: var(--card);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 10px 0;
}
.demo-q { display: block; font-size: 13px; color: var(--secondary); margin-bottom: 10px; }
.demo-choices { display: flex; gap: 10px; flex-wrap: wrap; }
.demo-choices button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  padding: 9px 16px;
  border-radius: 980px;
  border: 1px solid var(--text);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.demo-choices button:hover { opacity: 0.7; }

.demo-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 22px;
}
.demo-gate { font-size: 13px; color: var(--label); }

.demo-btn {
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  padding: 12px 24px;
  border-radius: 980px;
  border: none;
  background: var(--text);
  color: var(--bg);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.demo-btn:hover:not(:disabled) { opacity: 0.85; }
.demo-btn:disabled { opacity: 0.35; cursor: default; }

.demo-done { margin-top: 22px; animation: demo-in 0.5s ease-out; }
.demo-done[hidden] { display: none; }
.demo-job { font-size: 15px !important; font-weight: 500; }
.demo-job-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--ok);
  color: #fff;
  font-size: 12px;
  margin-right: 6px;
  vertical-align: -3px;
}
.demo-kicker { font-size: 13px !important; color: var(--label) !important; margin-top: 8px; }

@keyframes demo-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* --- auditor chat demo ------------------------------------------- */

.chat-log { display: flex; flex-direction: column; gap: 10px; }
.chat-log:not(:empty) { margin-top: 22px; }

.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.55;
  animation: demo-in 0.35s ease-out;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--text);
  color: var(--bg);
  border-bottom-right-radius: 6px;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: var(--card);
  color: var(--text);
  border-bottom-left-radius: 6px;
}

.chat-code {
  display: block;
  margin-top: 10px;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: var(--secondary);
  background: var(--bg);
  border: 1px solid var(--hairline);
  border-radius: 8px;
  padding: 7px 10px;
}
.chat-cite {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: var(--label);
}

.chat-bubble.typing { display: flex; gap: 5px; padding: 16px; }
.chat-bubble.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--label);
  animation: chat-typing 1s ease-in-out infinite;
}
.chat-bubble.typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-bubble.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-typing {
  0%, 60%, 100% { opacity: 0.35; transform: none; }
  30% { opacity: 1; transform: translateY(-3px); }
}

.chat-chips { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.chat-chips button {
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.3;
  padding: 9px 16px;
  border-radius: 980px;
  border: 1px solid var(--text);
  background: none;
  color: var(--text);
  cursor: pointer;
  transition: opacity 0.2s ease;
}
.chat-chips button:hover:not(:disabled) { opacity: 0.7; }
.chat-chips button:disabled { opacity: 0.35; cursor: default; border-color: var(--hairline); }

/* --- 404 --------------------------------------------------------- */

.notfound {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}
.notfound h1 { font-size: clamp(48px, 8vw, 72px); letter-spacing: -0.02em; }
.notfound p { margin-top: 18px; color: var(--secondary); }

/* --- scroll reveal ----------------------------------------------- */

.reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease-out, transform 0.5s ease-out;
}
.reveal.in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .live-dot { animation: none; }
  .card { transition: none; }
  .card:hover { transform: none; }
  .demo-done { animation: none; }
  .chat-bubble { animation: none; }
  .chat-bubble.typing span { animation: none; }
  .story-card-in { animation: none; }
  /* the rocket stays as a static position marker; nothing moves or flashes */
  .story-ship { transition: none; }
  .ship-flame { display: none; }
  .story-pip .dot { transition: none; }
  .story-pip.pop .dot { animation: none; }
  .fx-ring, .fx-spark, .fx-chip, .fx-puff { display: none; }
  .pilot-bob, .pilot-body.land, .hat .tassel, .hat .beacon,
  .pilot-eyes, .pilot-body.land .pilot-eyes, .pilot-body.land .pilot-grin { animation: none; }
  .hat.on, .hat.off { animation: none; }
  .story-pilot { transition: none; }
  /* the log still carries its information, it just arrives without motion */
  .log-chips li { transition: none; opacity: 1; transform: none; }
}
