/* ---------- Tokens ---------- */
:root {
  --bg: #f6f4ef;
  --surface: #fffdf9;
  --ink: #141414;
  --muted: #66645e;
  --line: rgba(20, 20, 20, 0.1);
  --accent: #e8551f;
  --accent-soft: rgba(232, 85, 31, 0.1);
  --bar: #2a2a28;
  --bar-neg: #b9b5ab;
  --dark: #141414;
  --on-dark: #f6f4ef;

  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --max: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111110;
    --surface: #1a1a18;
    --ink: #f1efe9;
    --muted: #9d9a92;
    --line: rgba(241, 239, 233, 0.1);
    --accent: #ff7a45;
    --accent-soft: rgba(255, 122, 69, 0.14);
    --bar: #e9e6de;
    --bar-neg: #4a4944;
    --dark: #1d1d1b;
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 17px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1, h2, h3 { margin: 0; font-weight: 500; letter-spacing: -0.02em; }
h1 em, h2 em { font-family: var(--serif); font-style: italic; font-weight: 400; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: inherit; }
::selection { background: var(--accent); color: #fff; }

.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }

/* Placeholder marker — remove the class once the text is real */
.ph {
  background: var(--accent-soft);
  outline: 1px dashed var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* ---------- Buttons & links ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 22px;
  border-radius: 999px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--bg);
  font: 500 15px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
  transition: transform .2s ease, background .2s ease, color .2s ease, border-color .2s ease;
}
.btn:hover { transform: translateY(-1px); background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--small { padding: 10px 16px; font-size: 14px; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn--light { background: var(--on-dark); color: #141414; border-color: var(--on-dark); }
.btn--ghost-light { background: transparent; color: var(--on-dark); border-color: rgba(246, 244, 239, 0.25); }
.btn--ghost-light:hover { background: transparent; border-color: var(--on-dark); color: var(--on-dark); }
.link { text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .2s; }
.link:hover { border-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.skip {
  position: absolute; left: 16px; top: -60px; z-index: 20;
  padding: 10px 16px; border-radius: 999px;
  background: var(--ink); color: var(--bg); font-size: 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s;
}
.nav.is-scrolled { border-bottom-color: var(--line); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 24px; }
.nav__logo { font: 600 20px/1 var(--sans); letter-spacing: -0.03em; text-decoration: none; }
.nav__logo span { color: var(--accent); }
.nav__links { display: flex; gap: 28px; font-size: 15px; }
.nav__links a { text-decoration: none; color: var(--muted); transition: color .2s; }
.nav__links a:hover, .nav__links a[aria-current] { color: var(--ink); }
.nav__links a { position: relative; }
.nav__links a[aria-current]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 1.5px;
  background: var(--accent); border-radius: 1px;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding-top: clamp(32px, 5vw, 64px);
  padding-bottom: clamp(48px, 7vw, 88px);
}
.eyebrow { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); margin-bottom: 24px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #2fb36d; box-shadow: 0 0 0 4px rgba(47, 179, 109, .18); animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(47, 179, 109, 0); } }
.eyebrow__link { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line); transition: border-color .2s; }
.eyebrow__link:hover { border-color: var(--accent); }
.hero h1 { font-size: clamp(38px, 4.6vw, 58px); line-height: 1.04; text-wrap: balance; }
.hero h1 em { color: var(--accent); }
.lead { margin-top: 24px; font-size: clamp(17px, 1.6vw, 19px); color: var(--muted); max-width: 54ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 32px; }

.hero__chart {
  margin: 0;
  padding: 24px 24px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 30px 60px -30px rgba(20, 20, 20, .18);
}
.chart__head { display: flex; justify-content: space-between; font-size: 13px; font-weight: 500; margin-bottom: 12px; }
.chart__unit { color: var(--muted); font-weight: 400; }
.bridge { width: 100%; height: auto; display: block; overflow: visible; }
.bridge__axis { stroke: var(--line); stroke-width: 1; }
.bar { rx: 4; transform-box: fill-box; transform-origin: bottom; transform: scaleY(0); }
.bar--total { fill: var(--bar); }
.bar--neg { fill: var(--bar-neg); transform-origin: top; }
.bar--pos { fill: var(--accent); }
.is-visible .bar { animation: grow .7s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(var(--d) * 120ms + 200ms); }
@keyframes grow { to { transform: scaleY(1); } }
.bridge__labels text { font: 500 10px var(--sans); fill: var(--muted); text-anchor: middle; }
.bridge__labels .is-accent { fill: var(--accent); }
.hero__chart figcaption { margin-top: 10px; font: italic 400 17px/1.3 var(--serif); color: var(--muted); }

/* ---------- Numbers ---------- */
.numbers {
  display: grid; grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
.num { padding: 28px 20px 28px 0; display: flex; flex-direction: column; gap: 6px; }
.num + .num { padding-left: 24px; border-left: 1px solid var(--line); }
.num strong { font: 400 clamp(36px, 4vw, 48px)/1 var(--serif); letter-spacing: -0.01em; align-self: flex-start; }
.num span { font-size: 14px; color: var(--muted); line-height: 1.45; }

/* ---------- Sections ---------- */
.section { padding-top: clamp(80px, 11vw, 140px); }
.section__head { max-width: 760px; margin-bottom: clamp(36px, 5vw, 56px); }
.kicker { font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); margin-bottom: 16px; }
.section h2 { font-size: clamp(30px, 4vw, 48px); line-height: 1.1; text-wrap: balance; }

.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.card {
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .3s ease, border-color .3s ease;
}
.card:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.card__icon { display: inline-block; font: italic 400 22px/1 var(--serif); color: var(--accent); margin-bottom: 40px; }
.card h3 { font-size: 20px; margin-bottom: 10px; }
.card p { color: var(--muted); font-size: 16px; }

/* Cases */
.case {
  display: grid; grid-template-columns: 0.9fr 1.1fr; gap: clamp(24px, 4vw, 56px);
  padding: clamp(20px, 3vw, 32px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 6px);
  margin-bottom: 20px;
}
.case__visual {
  border-radius: var(--radius);
  min-height: 260px;
  display: grid; place-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  overflow: hidden;
  position: relative;
}
.case__tag { font-size: 13px; color: var(--muted); margin-bottom: 8px; }
.case h3 { font-size: clamp(24px, 2.6vw, 32px); margin-bottom: 20px; text-wrap: balance; }
.case__facts { margin: 0; display: grid; gap: 14px; }
.case__facts > div { display: grid; grid-template-columns: 80px 1fr; gap: 16px; }
.case__facts dt { font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); padding-top: 3px; }
.case__facts dd { margin: 0; font-size: 16px; }

/* Case visuals: abstract, swap for screenshots later */
.mini-flow { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; }
.mini-flow span { padding: 7px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.mini-flow span.is-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.mini-flow i { width: 1px; height: 12px; background: var(--muted); opacity: .5; }

.brief { width: 64%; padding: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; display: grid; gap: 10px; transform: rotate(-3deg); box-shadow: 0 20px 40px -24px rgba(20, 20, 20, .25); }
.brief span { height: 8px; border-radius: 4px; background: var(--line); }
.brief span:first-child { height: 12px; width: 60%; background: var(--ink); opacity: .85; }
.brief span.short { width: 45%; background: var(--accent); }

/* Forecast lead time: same price move, seen earlier */
.viz-days { width: 78%; display: grid; gap: 18px; font-size: 13px; }
.viz-days__row { display: grid; gap: 6px; }
.viz-days__row span { color: var(--muted); }
.track { height: 12px; border-radius: 6px; background: var(--line); position: relative; overflow: hidden; }
.track i { position: absolute; top: 0; bottom: 0; right: 0; border-radius: 6px; }
.track .late { left: 62%; background: var(--bar-neg); }
.track .early { left: 22%; background: var(--accent); }
.viz-days__note { font: italic 400 26px/1 var(--serif); color: var(--accent); }

/* Many files → few */
.viz-files { display: flex; align-items: center; gap: 22px; }
.viz-files__many { display: grid; grid-template-columns: repeat(6, 12px); gap: 5px; }
.viz-files__many i { width: 12px; height: 15px; border-radius: 2px; background: var(--bar-neg); opacity: .7; }
.viz-files__few { display: grid; grid-template-columns: repeat(2, 26px); gap: 8px; }
.viz-files__few i { width: 26px; height: 32px; border-radius: 4px; background: var(--accent); }
.viz-files__arrow { font-size: 24px; color: var(--muted); }

/* Apps */
.section__sub { margin-top: 16px; color: var(--muted); max-width: 60ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 28px; }
.filter {
  font: 500 14px/1 var(--sans);
  padding: 9px 15px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.filter:hover { color: var(--ink); border-color: var(--ink); }
.filter.is-active { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.apps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.app {
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform .3s ease, border-color .3s ease;
}
.app[hidden] { display: none; }
.app:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.app__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  display: grid; place-items: center;
  background:
    radial-gradient(120% 90% at 85% 10%, hsl(var(--hue) 75% 62% / .55), transparent 60%),
    radial-gradient(90% 80% at 10% 100%, hsl(calc(var(--hue) + 40) 60% 55% / .35), transparent 60%),
    hsl(var(--hue) 25% 92%);
  border-bottom: 1px solid var(--line);
}
.app__cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: top left; }
.app__initial { font: italic 400 88px/1 var(--serif); color: hsl(var(--hue) 45% 28% / .8); }
.app__status {
  position: absolute; top: 12px; left: 12px;
  font-size: 12px; font-weight: 500;
  padding: 5px 10px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(6px);
  color: var(--muted);
}
.app__status--live { color: #1d8a52; }
.app__status--live::before { content: "● "; }
.app__status--request { color: var(--accent); }
.app__body { padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.app h3 { font-size: 20px; }
.app__body > p { color: var(--muted); font-size: 15px; }
.app__body > .app__shows { font-size: 14px; color: var(--ink); }
.app__shows span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }
.app__tags { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.app__tags li { font-size: 12px; padding: 4px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.app__links { margin-top: auto; padding-top: 8px; display: flex; gap: 16px; }
.app__link { font-size: 14px; font-weight: 500; text-decoration: none; color: var(--accent); }
.app__link:hover { text-decoration: underline; }
.app__link--quiet { color: var(--muted); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .app__cover {
    background:
      radial-gradient(120% 90% at 85% 10%, hsl(var(--hue) 70% 50% / .45), transparent 60%),
      radial-gradient(90% 80% at 10% 100%, hsl(calc(var(--hue) + 40) 60% 45% / .3), transparent 60%),
      hsl(var(--hue) 12% 16%);
  }
  :root:not([data-theme="light"]) .app__initial { color: hsl(var(--hue) 60% 80% / .85); }
}
.timeline strong { color: var(--ink); font-weight: 500; }

.side { margin-top: 28px; color: var(--muted); font-size: 16px; }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: s; }
.step { padding-top: 24px; border-top: 2px solid var(--ink); }
.step__n { font: italic 400 44px/1 var(--serif); color: var(--accent); display: block; margin-bottom: 16px; }
.step h3 { font-size: 20px; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 16px; }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.timeline li { display: grid; grid-template-columns: 180px 1fr; gap: 24px; padding: 24px 0; border-bottom: 1px solid var(--line); }
.timeline__when { font-size: 15px; color: var(--muted); align-self: start; justify-self: start; }
.timeline h3 { font-size: 19px; margin-bottom: 4px; display: inline-block; }
.timeline p { color: var(--muted); font-size: 16px; }

/* Toolbox */
.tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.tools h3 { font-size: 15px; font-weight: 600; margin-bottom: 14px; }
.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { font-size: 14px; padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }

/* ---------- Contact ---------- */
.contact {
  margin-top: clamp(96px, 12vw, 160px);
  background: var(--dark);
  color: var(--on-dark);
  padding: clamp(80px, 12vw, 150px) 0;
  position: relative;
  overflow: hidden;
}
.contact::after {
  content: ""; position: absolute; width: 520px; height: 520px; right: -140px; top: -160px;
  background: radial-gradient(circle, rgba(232, 85, 31, .35), transparent 65%);
  pointer-events: none;
}
.contact .kicker { color: #ff8a5c; }
.contact__title { font-size: clamp(64px, 13vw, 168px); line-height: .92; letter-spacing: -0.045em; }
.contact__title em { font-family: var(--serif); font-style: italic; font-weight: 400; color: #ff7a45; letter-spacing: -0.02em; }
.contact__lead { margin-top: 24px; font-size: 19px; color: rgba(246, 244, 239, .7); max-width: 46ch; }
.contact__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 40px; position: relative; z-index: 1; }

/* ---------- Footer ---------- */
.footer { display: flex; justify-content: space-between; gap: 16px; padding-top: 28px; padding-bottom: 28px; font-size: 14px; color: var(--muted); }

/* ---------- Reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1); }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .bar { transform: none; animation: none !important; }
  .dot { animation: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .grid--3, .steps, .tools { grid-template-columns: 1fr; }
  .apps { grid-template-columns: repeat(2, 1fr); }
  .numbers { grid-template-columns: repeat(2, 1fr); }
  .num:nth-child(3) { padding-left: 0; border-left: 0; }
  .num:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .case { grid-template-columns: 1fr; }
  .case__visual { min-height: 200px; }
}
@media (max-width: 640px) {
  .nav__links { display: none; }
  .apps { grid-template-columns: 1fr; }
  .timeline li { grid-template-columns: 1fr; gap: 6px; }
  .case__facts > div { grid-template-columns: 1fr; gap: 2px; }
  .footer { flex-direction: column; }
}

/* ---------- 404 ---------- */
.notfound { min-height: 100vh; display: flex; flex-direction: column; justify-content: center; }
.notfound h1 { font-size: clamp(40px, 6vw, 72px); line-height: 1.04; max-width: 14ch; }
.notfound h1 em { color: var(--accent); }
