/* ==========================================================================
   Aman Tripathi — "Signal, not noise"
   Two themes: Paper (ECG chart paper) and Scope (oscilloscope phosphor).
   ========================================================================== */

:root {
  --bg: #f4f1ea;
  --bg-raised: #fbf9f4;
  --bg-sunk: #ece8de;
  --ink: #17150f;
  --ink-2: #4a463d;
  --ink-3: #7d776b;
  --line: #ddd7ca;
  --line-strong: #c9c2b2;
  --grid-minor: rgba(209, 42, 63, 0.07);
  --grid-major: rgba(209, 42, 63, 0.14);
  --accent: #d12a3f;
  --accent-soft: rgba(209, 42, 63, 0.12);
  --on-accent: #ffffff;
  --raw: rgba(23, 21, 15, 0.38);
  --ghost: rgba(23, 21, 15, 0.14);
  --ok: #1f8a4c;
  --warn: #c9861a;
  --bad: #d12a3f;
  --figure-bg: #fcfcfb;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --maxw: 1160px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0a0c0b;
  --bg-raised: #101412;
  --bg-sunk: #070908;
  --ink: #e6ece8;
  --ink-2: #a8b2ac;
  --ink-3: #6c7a72;
  --line: #1d2622;
  --line-strong: #2b3832;
  --grid-minor: rgba(91, 228, 155, 0.035);
  --grid-major: rgba(91, 228, 155, 0.075);
  --accent: #5be49b;
  --accent-soft: rgba(91, 228, 155, 0.12);
  --on-accent: #06110b;
  --raw: rgba(230, 236, 232, 0.34);
  --ghost: rgba(230, 236, 232, 0.12);
  --ok: #5be49b;
  --warn: #f2c14e;
  --bad: #ff6b6b;
  --figure-bg: #f3f4f2;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0c0b;
    --bg-raised: #101412;
    --bg-sunk: #070908;
    --ink: #e6ece8;
    --ink-2: #a8b2ac;
    --ink-3: #6c7a72;
    --line: #1d2622;
    --line-strong: #2b3832;
    --grid-minor: rgba(91, 228, 155, 0.035);
    --grid-major: rgba(91, 228, 155, 0.075);
    --accent: #5be49b;
    --accent-soft: rgba(91, 228, 155, 0.12);
    --on-accent: #06110b;
    --raw: rgba(230, 236, 232, 0.34);
    --ghost: rgba(230, 236, 232, 0.12);
    --ok: #5be49b;
    --warn: #f2c14e;
    --bad: #ff6b6b;
    --figure-bg: #f3f4f2;
    color-scheme: dark;
  }
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.serif { font-family: var(--serif); font-weight: 400; }
.muted { color: var(--ink-3); }
.accent { color: var(--accent); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.grid-paper {
  background-color: var(--bg);
  background-image:
    linear-gradient(var(--grid-major) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-major) 1px, transparent 1px),
    linear-gradient(var(--grid-minor) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-minor) 1px, transparent 1px);
  background-size: 40px 40px, 40px 40px, 8px 8px, 8px 8px;
  background-position: -1px -1px;
}

/* ---------- nav ---------- */
.nav {
  position: fixed; z-index: 50; top: 14px; left: 50%;
  transform: translateX(-50%);
  width: min(calc(100% - 24px), 980px);
  display: flex; align-items: center; gap: 6px;
  padding: 7px 7px 7px 18px;
  border: 1px solid transparent; border-radius: 999px;
  transition: background-color 0.35s var(--ease), border-color 0.35s var(--ease), box-shadow 0.35s var(--ease);
}
.nav.solid {
  background: color-mix(in srgb, var(--bg-raised) 82%, transparent);
  border-color: var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  box-shadow: 0 8px 30px -18px rgba(0, 0, 0, 0.35);
}
.nav__brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; letter-spacing: -0.01em; margin-right: auto; white-space: nowrap; }
.nav__brand svg { width: 26px; height: 16px; color: var(--accent); }
.nav__links { display: flex; gap: 2px; list-style: none; margin: 0; padding: 0; }
.nav__links a, .nav__btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px;
  font-size: 14px; color: var(--ink-2); text-decoration: none;
  background: none; border: 0; cursor: pointer; font-family: var(--sans);
  transition: color 0.2s, background-color 0.2s;
}
.nav__links a:hover, .nav__btn:hover { color: var(--ink); background: var(--ghost); }
.nav__btn svg { width: 15px; height: 15px; }
.nav__cta {
  padding: 9px 16px; border-radius: 999px; background: var(--ink); color: var(--bg);
  font-size: 14px; font-weight: 500; text-decoration: none; white-space: nowrap;
}
.nav__cta:hover { opacity: 0.88; }
.theme-label { font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; }

@media (max-width: 860px) {
  .nav__links { display: none; }
  .theme-label { display: none; }
}

/* ---------- buttons, chips ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 20px; border-radius: 999px;
  font: 500 15px/1 var(--sans); text-decoration: none;
  border: 1px solid var(--line-strong); color: var(--ink); background: transparent;
  transition: transform 0.2s var(--ease), background-color 0.2s, border-color 0.2s;
}
.btn:hover { transform: translateY(-1px); border-color: var(--ink-3); }
.btn--solid { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn--solid:hover { border-color: var(--ink); }
.btn svg { width: 16px; height: 16px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-raised);
  font: 500 11.5px/1.2 var(--mono); letter-spacing: 0.04em; color: var(--ink-2);
  white-space: nowrap; text-decoration: none;
}
a.chip:hover { border-color: var(--ink-3); color: var(--ink); }
.chip--accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); background: var(--accent-soft); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.dot--live { box-shadow: 0 0 0 0 var(--accent); animation: ping 2.4s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 8px transparent; } }

/* ---------- hero (scroll-scrubbed PPG) ---------- */
.hero { position: relative; height: 330vh; }
.hero__stick { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; }
.hero__text { position: relative; z-index: 2; width: 100%; padding-top: clamp(88px, 14vh, 150px); }
.hero__eyebrow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 22px; color: var(--ink-2); }
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(44px, min(7.6vw, 10.5vh), 118px); line-height: 0.95; letter-spacing: -0.02em;
  margin: 0; max-width: 12ch;
}
.hero h1 em { font-style: italic; color: var(--accent); }
.hero__lede { max-width: 46ch; margin: clamp(14px, 2.4vh, 22px) 0 0; font-size: clamp(16px, 1.5vw, 19px); color: var(--ink-2); }
.hero__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: clamp(16px, 2.8vh, 26px); }

.hero__scope { position: relative; flex: 1; min-height: 190px; margin: 8px 0 58px; }
.hero__scope canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero__stages {
  position: absolute; z-index: 3; right: var(--gutter); top: clamp(110px, 17vh, 170px);
  list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; text-align: right;
}
.hero__stages li { font: 500 11.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); transition: color 0.3s; }
.hero__stages li span { display: inline-block; margin-right: 10px; color: var(--ink-3); }
.hero__stages li.on { color: var(--ink); }
.hero__stages li.on span { color: var(--accent); }
.hero__readout {
  position: absolute; z-index: 3; left: var(--gutter); bottom: 22px; right: var(--gutter);
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px;
  color: var(--ink-3);
}
.hero__f1 { display: flex; align-items: baseline; gap: 10px; color: var(--ink-2); }
.hero__f1 b { font: 500 clamp(26px, 3vw, 38px)/1 var(--mono); color: var(--accent); letter-spacing: -0.02em; }
.scroll-cue { display: inline-flex; align-items: center; gap: 8px; }
.scroll-cue i { width: 1px; height: 26px; background: linear-gradient(var(--ink-3), transparent); animation: cue 2s infinite var(--ease); }
@keyframes cue { 0% { transform: scaleY(0); transform-origin: top; } 50% { transform: scaleY(1); transform-origin: top; } 51% { transform-origin: bottom; } 100% { transform: scaleY(0); transform-origin: bottom; } }

@media (max-width: 860px) {
  .hero { height: 260vh; }
  .hero__stages { top: auto; bottom: 24px; left: var(--gutter); right: auto; text-align: left; }
  .hero__stages li { display: none; }
  .hero__stages li.current { display: block; color: var(--ink); }
  #heroSource, .scroll-cue { display: none; }
  .hero__readout { justify-content: flex-end; }
  .hero__lede { max-width: 34ch; }
}

/* ---------- proof bar ---------- */
.proof { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 2; }
.proof__row { display: grid; grid-template-columns: repeat(4, 1fr); }
.proof__item { padding: 22px 20px; border-left: 1px solid var(--line); display: grid; gap: 4px; text-decoration: none; }
.proof__item:first-child { border-left: 0; padding-left: 0; }
.proof__item b { font: 400 26px/1.1 var(--serif); letter-spacing: -0.01em; }
.proof__item span { color: var(--ink-3); }
a.proof__item:hover b { color: var(--accent); }
@media (max-width: 860px) {
  .proof__row { grid-template-columns: 1fr 1fr; }
  .proof__item:nth-child(3) { border-left: 0; padding-left: 0; }
  .proof__item:nth-child(n+3) { border-top: 1px solid var(--line); }
}

/* ---------- sections ---------- */
.section { padding: clamp(80px, 12vw, 150px) 0; position: relative; }
.section + .section { border-top: 1px solid var(--line); }
.section__head { display: grid; grid-template-columns: 1fr 1.25fr; gap: 24px 48px; align-items: end; margin-bottom: clamp(36px, 5vw, 60px); }
.section__label { display: flex; align-items: center; gap: 10px; color: var(--ink-3); margin-bottom: 14px; }
.section__label b { color: var(--accent); font-weight: 500; }
.section__title { font: 400 clamp(38px, 5.4vw, 72px)/1 var(--serif); letter-spacing: -0.02em; margin: 0; }
.section__title em { font-style: italic; color: var(--accent); }
.section__intro { margin: 0; color: var(--ink-2); max-width: 52ch; }
@media (max-width: 860px) { .section__head { grid-template-columns: 1fr; } }

/* ---------- signals strip ---------- */
.signals { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); }
.signal { position: relative; padding: 18px 20px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 220px; display: flex; flex-direction: column; }
.signal:nth-child(3n) { border-right: 0; }
.signal:nth-last-child(-n+3) { border-bottom: 0; }
.signal__top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.signal__name { font: 400 28px/1 var(--serif); }
.signal__spec { color: var(--ink-3); }
.signal canvas, .signal svg.sigsvg { width: 100%; height: 84px; margin: 14px 0 12px; display: block; }
.signal p { margin: auto 0 0; font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
@media (max-width: 960px) {
  .signals { grid-template-columns: 1fr 1fr; }
  .signal:nth-child(3n) { border-right: 1px solid var(--line); }
  .signal:nth-child(2n) { border-right: 0; }
  .signal:nth-last-child(-n+3) { border-bottom: 1px solid var(--line); }
  .signal:nth-last-child(-n+2) { border-bottom: 0; }
}
@media (max-width: 600px) {
  .signals { grid-template-columns: 1fr; }
  .signal { border-right: 0 !important; border-bottom: 1px solid var(--line) !important; min-height: 0; }
  .signal:last-child { border-bottom: 0 !important; }
}

/* ---------- work gallery ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 26px; }
.filter {
  padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  font: 500 13px/1 var(--sans); color: var(--ink-2); cursor: pointer; transition: all 0.2s;
}
.filter:hover { border-color: var(--ink-3); color: var(--ink); }
.filter[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.work { display: grid; grid-template-columns: repeat(6, 1fr); gap: 18px; }
.card {
  grid-column: span 2; position: relative; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised);
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform 0.4s var(--ease), border-color 0.3s, box-shadow 0.4s var(--ease), opacity 0.35s;
}
.card--wide { grid-column: span 4; }
.card--half { grid-column: span 3; }
.card:hover { transform: translateY(-3px); border-color: var(--line-strong); box-shadow: 0 24px 50px -32px rgba(0, 0, 0, 0.45); }
.card.is-hidden { display: none; }
.card__screen { position: relative; aspect-ratio: 16 / 10; border-bottom: 1px solid var(--line); overflow: hidden; }
.card--wide .card__screen { aspect-ratio: 16 / 7.4; }
.card--half .card__screen { aspect-ratio: 16 / 8.6; }
.card__screen canvas, .card__screen > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.card__hud { position: absolute; z-index: 2; left: 14px; right: 14px; top: 12px; display: flex; justify-content: space-between; gap: 8px; color: var(--ink-3); pointer-events: none; }
.card__hud span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.card__hud span:first-child { flex: 0 1 auto; } .card__hud span:last-child { flex: 0 0 auto; max-width: 60%; }
.card__hud .on { color: var(--accent); }
.card__body { padding: 20px 22px 22px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.card__kicker { color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; }
.card h3 { font: 400 30px/1.05 var(--serif); letter-spacing: -0.01em; margin: 0; }
.card--wide h3 { font-size: clamp(30px, 3.2vw, 42px); }
.card p { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.55; }
.card__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 8px; }
.card__go { position: absolute; right: 18px; bottom: 18px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; transition: all 0.3s var(--ease); background: var(--bg-raised); }
.card__go svg { width: 15px; height: 15px; }
.card:hover .card__go { background: var(--accent); border-color: var(--accent); color: var(--on-accent); transform: rotate(-45deg); }
.card__body { padding-right: 64px; }

.term { font: 500 13px/1.5 var(--mono); background: var(--bg-sunk); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; color: var(--ink-2); display: flex; gap: 10px; overflow-x: auto; white-space: nowrap; }
.term::before { content: "$"; color: var(--accent); }

.subhead { display: flex; align-items: center; gap: 14px; margin: 54px 0 22px; color: var(--ink-3); }
.subhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* chat-to-pay phone */
.phone-scene { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; gap: 18px; padding: 44px 18px 0; }
.phone { width: min(56%, 250px); height: 100%; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: 30px 30px 0 0; background: var(--bg); padding: 30px 12px 0; display: flex; flex-direction: column; gap: 7px; overflow: hidden; position: relative; }
.phone::before { content: ""; position: absolute; top: 9px; left: 50%; width: 64px; height: 14px; border-radius: 10px; background: var(--ink); transform: translateX(-50%); opacity: 0.85; }
.bubble { max-width: 86%; padding: 7px 10px; border-radius: 13px; font-size: 11.5px; line-height: 1.35; background: var(--bg-sunk); color: var(--ink); opacity: 0; transform: translateY(6px); transition: opacity 0.4s, transform 0.4s var(--ease); }
.bubble.me { align-self: flex-end; background: #1f7aec; color: #fff; }
.bubble.show { opacity: 1; transform: none; }
.bubble mark { background: var(--accent-soft); color: inherit; border-radius: 3px; padding: 0 2px; box-shadow: inset 0 -2px 0 var(--accent); }
.slip { align-self: center; width: min(40%, 190px); border: 1px solid var(--line); border-radius: 14px; background: var(--bg-raised); padding: 12px; font-size: 11.5px; display: grid; gap: 6px; opacity: 0; transform: translateY(10px); transition: opacity 0.5s, transform 0.5s var(--ease); margin-bottom: 26px; box-shadow: 0 18px 40px -26px rgba(0,0,0,.5); }
.slip.show { opacity: 1; transform: none; }
.slip .row { display: flex; justify-content: space-between; gap: 6px; color: var(--ink-2); }
.slip .total { border-top: 1px solid var(--line); padding-top: 6px; color: var(--ink); font-weight: 600; }
.slip .total b { font: 500 16px/1 var(--mono); }
.slip .ok { color: var(--ok); font-family: var(--mono); font-size: 10.5px; letter-spacing: .04em; }
@media (max-width: 520px) { .slip { display: none; } .phone { width: 70%; } }

@media (max-width: 960px) {
  .work { grid-template-columns: repeat(2, 1fr); }
  .card, .card--half { grid-column: span 1; }
  .card--wide { grid-column: span 2; }
}
@media (max-width: 640px) {
  .work { grid-template-columns: 1fr; }
  .card, .card--wide, .card--half { grid-column: span 1; }
  .card--wide .card__screen { aspect-ratio: 16 / 10; }
}

/* ---------- experience ---------- */
.xp { display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(28px, 5vw, 70px); align-items: start; }
.role { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); overflow: hidden; }
.role__screen { height: 210px; border-bottom: 1px solid var(--line); position: relative; }
.role__screen canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.role__body { padding: clamp(22px, 3vw, 34px); }
.role__meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--ink-3); margin-bottom: 14px; }
.role h3 { font: 400 clamp(32px, 3.6vw, 46px)/1 var(--serif); margin: 0 0 4px; letter-spacing: -0.01em; }
.role h4 { margin: 0 0 22px; font-weight: 500; color: var(--ink-2); font-size: 16px; }
.story { display: grid; gap: 18px; }
.story > div { display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.story .mono { color: var(--accent); padding-top: 4px; }
.story p { margin: 0; color: var(--ink-2); }
.story strong { color: var(--ink); font-weight: 500; }
@media (max-width: 640px) { .story > div { grid-template-columns: 1fr; gap: 4px; } }

.timeline { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.timeline li { position: relative; padding: 0 0 30px 26px; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--bg); border: 1.5px solid var(--ink-3); }
.timeline li.now::before { background: var(--accent); border-color: var(--accent); }
.timeline .mono { color: var(--ink-3); }
.timeline h5 { margin: 6px 0 2px; font: 400 24px/1.15 var(--serif); }
.timeline p { margin: 0; color: var(--ink-2); font-size: 15px; }
@media (max-width: 960px) { .xp { grid-template-columns: 1fr; } }

/* ---------- papers & open source ---------- */
.os { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; }
.paper {
  grid-row: span 2; border: 1px solid var(--line); border-radius: 6px; background: var(--figure-bg); color: #1b1b1b;
  padding: clamp(26px, 4vw, 46px); font-family: "Times New Roman", var(--serif); position: relative; text-decoration: none;
  box-shadow: 0 1px 0 var(--line), 0 30px 60px -40px rgba(0,0,0,.5);
  transition: transform 0.4s var(--ease);
}
.paper:hover { transform: translateY(-3px) rotate(-0.3deg); }
.paper__venue { font: 500 10.5px/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: #6d6d6d; display: flex; justify-content: space-between; gap: 10px; border-bottom: 1px solid #d9d9d9; padding-bottom: 10px; }
.paper h3 { font: 400 clamp(22px, 2.5vw, 30px)/1.15 "Times New Roman", var(--serif); text-align: center; margin: 24px 0 10px; }
.paper__authors { text-align: center; font-size: 15px; color: #333; margin-bottom: 20px; }
.paper__abs { columns: 2; column-gap: 22px; font-size: 13.5px; line-height: 1.45; text-align: justify; hyphens: auto; color: #2a2a2a; }
.paper__abs b { font-style: italic; }
.paper__link { margin-top: 22px; display: inline-flex; gap: 8px; align-items: center; font: 500 12px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: #b3202f; }
@media (max-width: 600px) { .paper__abs { columns: 1; } }

.os__card { border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-raised); padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.os__card h3 { font: 400 28px/1.05 var(--serif); margin: 0; }
.os__card p { margin: 0; color: var(--ink-2); font-size: 15.5px; }
.diffs { display: grid; gap: 8px; }
.diff { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; font-size: 14.5px; background: var(--bg); transition: border-color .2s; }
.diff:hover { border-color: var(--ink-3); }
.diff svg { width: 16px; height: 16px; color: var(--ok); }
.diff .num { font-size: 12px; color: var(--ink-3); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 860px) { .os { grid-template-columns: 1fr; } .paper { grid-row: auto; } }

/* ---------- about + faq ---------- */
.about { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 6vw, 90px); }
.about__text p { font-size: clamp(18px, 1.7vw, 21px); line-height: 1.55; margin: 0 0 18px; color: var(--ink-2); }
.about__text p:first-child { color: var(--ink); }
.about__text p:first-child::first-line { font-weight: 500; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-top: 28px; }
.facts div { background: var(--bg-raised); padding: 14px 16px; }
.facts .mono { color: var(--ink-3); font-size: 11px; }
.facts p { margin: 4px 0 0; font-size: 15px; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary { list-style: none; cursor: pointer; padding: 20px 40px 20px 0; position: relative; font: 400 24px/1.2 var(--serif); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 18px; font: 300 24px/1 var(--sans); color: var(--ink-3); transition: transform .3s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); color: var(--accent); }
.faq details p { margin: 0 0 22px; color: var(--ink-2); max-width: 56ch; }
@media (max-width: 860px) { .about { grid-template-columns: 1fr; } }

/* ---------- contact ---------- */
.contact { padding: clamp(90px, 14vw, 170px) 0 60px; border-top: 1px solid var(--line); position: relative; overflow: hidden; }
.contact canvas { position: absolute; left: 0; right: 0; bottom: 84px; width: 100%; height: 150px; opacity: 0.9; pointer-events: none; }
.contact__mail {
  display: inline-block; font: 400 clamp(34px, 7.6vw, 108px)/1 var(--serif); letter-spacing: -0.02em;
  text-decoration: none; margin: 18px 0 34px; word-break: break-word;
  background: linear-gradient(var(--accent), var(--accent)) 0 100% / 0 2px no-repeat; transition: background-size .5s var(--ease), color .3s;
}
.contact__mail:hover { background-size: 100% 2px; color: var(--accent); }
.contact__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; position: relative; z-index: 2; }
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 26px 0 30px; border-top: 1px solid var(--line); color: var(--ink-3); margin-top: 200px; position: relative; z-index: 2; background: var(--bg); }
.footer a { color: var(--ink-3); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.8s var(--ease), transform 0.8s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ==========================================================================
   Case-study pages
   ========================================================================== */
.cs-hero { padding: clamp(120px, 18vh, 170px) 0 clamp(40px, 6vw, 70px); }
.crumbs { display: flex; gap: 10px; align-items: center; color: var(--ink-3); margin-bottom: 26px; }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.cs-hero h1 { font: 400 clamp(48px, 8vw, 112px)/0.95 var(--serif); letter-spacing: -0.025em; margin: 0 0 22px; max-width: 14ch; }
.cs-hero h1 em { color: var(--accent); }
.cs-answer { font-size: clamp(19px, 2vw, 25px); line-height: 1.45; color: var(--ink-2); max-width: 36ch; margin: 0; }
.cs-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

.cs-visual { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised); position: relative; height: clamp(260px, 38vw, 440px); }
.cs-visual canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cs-visual .card__hud { top: 16px; left: 18px; right: 18px; }

.cs-layout { display: grid; grid-template-columns: 300px 1fr; gap: clamp(30px, 6vw, 90px); padding: clamp(50px, 7vw, 90px) 0; }
.cs-layout > * { min-width: 0; }
.spec { position: sticky; top: 100px; align-self: start; border-top: 1px solid var(--ink); }
.spec dl { margin: 0; }
.spec div { display: grid; grid-template-columns: 96px 1fr; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.spec dt { font: 500 11px/1.5 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding-top: 2px; }
.spec dd { margin: 0; font-size: 14.5px; line-height: 1.45; }
.cs-body { max-width: 720px; }
.cs-body h2 { font: 400 clamp(32px, 3.6vw, 44px)/1.05 var(--serif); letter-spacing: -0.01em; margin: 64px 0 18px; }
.cs-body h2:first-child { margin-top: 0; }
.cs-body h2 .mono { display: block; color: var(--accent); margin-bottom: 10px; font-size: 12px; }
.cs-body p, .cs-body li { color: var(--ink-2); font-size: 17.5px; line-height: 1.7; }
.cs-body p strong, .cs-body li strong { color: var(--ink); font-weight: 500; }
.cs-body ul { padding-left: 20px; }
.cs-body li { margin-bottom: 6px; }
.cs-body code { font: 500 0.86em var(--mono); background: var(--bg-sunk); border: 1px solid var(--line); padding: 1px 6px; border-radius: 6px; }
.pipeline { list-style: none; padding: 0; margin: 24px 0; counter-reset: step; border-left: 1px solid var(--line); }
.pipeline li { counter-increment: step; position: relative; padding: 0 0 22px 30px; margin: 0; }
.pipeline li::before { content: counter(step, decimal-leading-zero); position: absolute; left: -15px; top: 2px; width: 30px; height: 22px; display: grid; place-items: center; background: var(--bg); font: 500 11px/1 var(--mono); color: var(--accent); }
.pipeline b { display: block; color: var(--ink); font-weight: 500; font-size: 17.5px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin: 28px 0; }
.stats div { background: var(--bg-raised); padding: 20px 18px; }
.stats b { display: block; font: 400 clamp(34px, 4vw, 48px)/1 var(--serif); letter-spacing: -0.02em; color: var(--accent); }
.stats span { display: block; margin-top: 8px; font-size: 14px; color: var(--ink-2); line-height: 1.4; }
@media (max-width: 640px) { .stats { grid-template-columns: 1fr 1fr; } }

.table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 15px; }
.table th { text-align: left; font: 500 11px/1.4 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--ink-3); padding: 10px 10px 10px 0; border-bottom: 1px solid var(--ink); }
.table td { padding: 12px 10px 12px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); vertical-align: top; }
.table td:first-child { color: var(--ink); }
.table .num { text-align: right; }
.table-scroll { overflow-x: auto; }

.bars { display: grid; gap: 14px; margin: 26px 0; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 54px; align-items: center; gap: 14px; font-size: 14.5px; }
.bar-track { position: relative; height: 22px; }
.bar-track span { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 0 4px 4px 0; }
.bar-track .b-raw { background: var(--ghost); top: 3px; bottom: 3px; }
.bar-track .b-new { background: var(--accent); height: 6px; top: auto; bottom: 0; transition: width 1.2s var(--ease); }
.bar-row .num { text-align: right; font-size: 13px; color: var(--ink); }
.legend { display: flex; gap: 18px; color: var(--ink-3); font-size: 13px; }
.legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-right: 6px; vertical-align: middle; }

.figure { margin: 30px 0; }
.figure img { border-radius: 10px; border: 1px solid var(--line); background: var(--figure-bg); padding: 10px; }
.figure figcaption { margin-top: 10px; font-size: 13.5px; color: var(--ink-3); }
.figure--bleed { margin-left: 0; margin-right: 0; }

pre.code { font: 13.5px/1.65 var(--mono); background: var(--bg-sunk); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; overflow-x: auto; color: var(--ink-2); }
pre.code .c { color: var(--ink-3); }
pre.code .p { color: var(--accent); }

.cs-next { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.cs-next a { padding: 40px 0; text-decoration: none; display: grid; gap: 8px; }
.cs-next a:last-child { text-align: right; border-left: 1px solid var(--line); padding-left: 30px; }
.cs-next a:first-child { padding-right: 30px; }
.cs-next .mono { color: var(--ink-3); }
.cs-next b { font: 400 clamp(26px, 3vw, 38px)/1.05 var(--serif); }
.cs-next a:hover b { color: var(--accent); }
@media (max-width: 860px) {
  .cs-layout { grid-template-columns: 1fr; }
  .spec { position: static; }
}

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .hero { height: auto; }
  .hero__stick { position: relative; height: auto; min-height: 100svh; }
}

/* liquid glass nav, matching the home page */
.nav.solid {
  border-color: transparent;
  background: linear-gradient(165deg, rgba(255,255,255,.42), rgba(255,255,255,.14) 60%, rgba(255,255,255,.26));
  backdrop-filter: blur(16px) saturate(1.8) brightness(1.04); -webkit-backdrop-filter: blur(16px) saturate(1.8) brightness(1.04);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9), inset 0 0 0 1px rgba(255,255,255,.38), 0 12px 32px -16px rgba(0,0,0,.35);
}
:root[data-theme="dark"] .nav.solid {
  background: linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.04) 60%, rgba(255,255,255,.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.08), 0 12px 32px -16px rgba(0,0,0,.7);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .nav.solid {
    background: linear-gradient(165deg, rgba(255,255,255,.13), rgba(255,255,255,.04) 60%, rgba(255,255,255,.08));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.2), inset 0 0 0 1px rgba(255,255,255,.08), 0 12px 32px -16px rgba(0,0,0,.7);
  }
}
