@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

/* Tokens. One accent (emerald): pill dot, FOUND/COMMITTED, primary hover, link hover, the glow. */
:root {
  --bg: #fafafa;
  --surface: #ffffff;
  --surface-2: #f5f5f5;
  --text: #0a0a0a;
  --muted: #525252;
  --faint: #6b6b6b;
  --border: #e7e7e7;
  --border-strong: #d6d6d6;
  --grid: rgba(10, 10, 10, 0.09);

  --accent: #10b981;
  --accent-ink: #047857;
  --accent-hover-bg: #047857;
  --accent-hover-fg: #ffffff;
  --glow: rgba(16, 185, 129, 0.32);

  --shadow: 0 1px 2px rgba(10, 10, 10, 0.04), 0 8px 24px -12px rgba(10, 10, 10, 0.1);
  --shadow-lg: 0 1px 2px rgba(10, 10, 10, 0.04), 0 24px 48px -24px rgba(10, 10, 10, 0.18);

  /* Status pills */
  --gray-fg: #525252;   --gray-bg: #f0f0f0;   --gray-bd: #e0e0e0;
  --blue-fg: #1d4ed8;   --blue-bg: #eff4ff;   --blue-bd: #d4e1fd;
  --amber-fg: #a14a06;  --amber-bg: #fff7e8;  --amber-bd: #fbe2b4;
  --violet-fg: #6d28d9; --violet-bg: #f5f1ff; --violet-bd: #e3d8fd;
  --green-fg: #047857;  --green-bg: #ecfdf5;  --green-bd: #b7ecd5;
  --red-fg: #b91c1c;    --red-bg: #fef2f2;    --red-bd: #fbd0d0;

  /* Code */
  --code-k: #7c3aed;
  --code-s: #a14a06;
  --code-c: #6b6b6b;
  --code-d: #0e6aa8;
  --code-f: #1d4ed8;

  --sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 10px;
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0a0a;
    --surface: #111111;
    --surface-2: #171717;
    --text: #ededed;
    --muted: #a3a3a3;
    --faint: #8f8f8f;
    --border: #232323;
    --border-strong: #303030;
    --grid: rgba(255, 255, 255, 0.07);

    --accent: #34d399;
    --accent-ink: #34d399;
    --accent-hover-bg: #34d399;
    --accent-hover-fg: #04150e;
    --glow: rgba(52, 211, 153, 0.18);

    --shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 12px 32px -16px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 1px 2px rgba(0, 0, 0, 0.5), 0 24px 56px -24px rgba(0, 0, 0, 0.8);

    --gray-fg: #b5b5b5;   --gray-bg: #1c1c1c;   --gray-bd: #2c2c2c;
    --blue-fg: #8db4ff;   --blue-bg: #0f1a33;   --blue-bd: #1d2f57;
    --amber-fg: #f5b454;  --amber-bg: #2a1d08;  --amber-bd: #4a3410;
    --violet-fg: #c4a8ff; --violet-bg: #1e1433;  --violet-bd: #35255a;
    --green-fg: #34d399;  --green-bg: #0b2a1f;  --green-bd: #134d38;
    --red-fg: #f87171;    --red-bg: #2a0e0e;    --red-bd: #4f1d1d;

    --code-k: #c4a8ff;
    --code-s: #f5c77e;
    --code-c: #8f8f8f;
    --code-d: #7cc4f5;
    --code-f: #8db4ff;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: inherit; }
code, pre { font-family: var(--mono); }

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 2px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 20px;
}
@media (min-width: 640px) { .wrap { padding-inline: 32px; } }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  z-index: 10;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: 6px;
  text-decoration: none;
}
.skip:focus { top: 12px; }

/* Backdrop: faint dot grid, faded out from the hero. */
.backdrop {
  position: absolute;
  inset: 0 0 auto 0;
  height: min(820px, 100vh);
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(var(--grid) 1px, transparent 1.2px);
  background-size: 22px 22px;
  background-position: 50% 0;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 60% 30%, #000 10%, transparent 75%);
  mask-image: radial-gradient(ellipse 70% 60% at 60% 30%, #000 10%, transparent 75%);
}

/* Nav */
.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 19px;
  letter-spacing: -0.03em;
  text-decoration: none;
}
.nav__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: color .15s;
}
.nav__link:hover { color: var(--accent-ink); }
.nav__right { display: flex; align-items: center; gap: 4px; margin-right: -10px; }

/* Hero. Centred in the space between nav and footer, so the footer sits at the bottom. */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  padding: clamp(16px, 3vh, 40px) 0 clamp(24px, 9vh, 96px); /* sits a little above centre */
}
.hero__visual { margin-top: 16px; }
@media (min-width: 960px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) minmax(0, 460px);
    grid-template-areas: "pill ." "copy visual";
    column-gap: 48px;
    row-gap: 20px;
    align-items: start;
  }
  .pill { grid-area: pill; }
  .hero__copy { grid-area: copy; }
  .hero__visual { grid-area: visual; margin-top: 0; } /* top aligns with the H1 */
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-self: start;
  gap: 6px;
  margin: 0;
  padding: 4px 12px 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.pill__dot {
  width: 6px;
  height: 6px;
  margin-right: 2px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

h1 {
  margin: 0;
  font-size: clamp(40px, 8.5vw, 56px);
  font-weight: 650;
  line-height: 1.02;
  letter-spacing: -0.038em;
  text-wrap: balance;
}
.h1-accent {
  background: linear-gradient(90deg, var(--text) 10%, var(--accent-ink) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  color: transparent;
}
@media (prefers-color-scheme: dark) {
  .h1-accent { background-image: linear-gradient(90deg, var(--text) 10%, var(--accent) 100%); }
}

.lede {
  margin: 20px 0 0;
  max-width: 31em;
  color: var(--muted);
  font-size: clamp(17px, 2.2vw, 18px);
  line-height: 1.5;
  text-wrap: pretty;
}

.hero__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .18s, color .18s, border-color .18s, transform .15s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--text); color: var(--bg); }
.btn--primary:hover { background: var(--accent-hover-bg); color: var(--accent-hover-fg); }
.btn--ghost { background: var(--surface); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface-2); }

/* Install snippet: only rendered when CONFIG.LAUNCHED is true. */
.install {
  display: inline-flex;
  align-items: center;
  height: 44px;
  padding-left: 14px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: var(--surface);
  font-size: 14px;
}
.install code { white-space: nowrap; }
.install__prompt { color: var(--faint); user-select: none; }

.copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  height: 100%;
  margin-left: 6px;
  padding: 0 12px;
  border: 0;
  border-radius: 0 7px 7px 0;
  background: none;
  color: var(--faint);
  font: inherit;
  cursor: pointer;
  transition: color .15s;
}
.copy:hover { color: var(--text); }
.copy__done { display: none; }
.copy.is-copied { color: var(--text); }
.copy.is-copied .copy__icon { display: none; }
.copy.is-copied .copy__done { display: block; }

/* Demo card: gradient border, emerald glow behind. */
.hero__visual { position: relative; }
.hero__visual::before {
  content: "";
  position: absolute;
  inset: 8% 4% -2% 8%;
  z-index: -1;
  border-radius: 50%;
  background: var(--glow);
  filter: blur(64px);
  pointer-events: none;
}
.demo {
  border: 1px solid transparent;
  border-radius: 12px;
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    linear-gradient(150deg, color-mix(in srgb, var(--accent) 75%, transparent) 0%, var(--border) 45%, color-mix(in srgb, var(--border) 60%, transparent) 100%) border-box;
  box-shadow: var(--shadow-lg);
  font-family: var(--mono);
  font-size: 12.5px;
  overflow: hidden;
}
.demo__head {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  padding: 0 8px 0 8px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 70%, var(--surface));
}

/* Segmented control */
.seg {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
}
.seg__btn {
  height: 26px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
  font: 500 12.5px var(--sans);
  cursor: pointer;
  transition: background-color .15s, color .15s, box-shadow .15s;
}
.seg__btn:hover { color: var(--text); }
.seg__btn[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--border);
}

.scenario {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  padding-right: 8px;
  color: var(--muted);
  font: 500 12.5px var(--sans);
  transition: opacity .3s;
}
.scenario__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--red-fg); transition: background-color .3s; }
.scenario.is-with .scenario__dot, .scene--with .scenario__dot { background: var(--accent); }
.demo__copy { display: none; margin-left: auto; height: 32px; border-radius: 6px; font: 13px var(--sans); }
.demo.is-code .demo__copy { display: inline-flex; }
.demo.is-code .scenario { display: none; }

/* Panels share one grid cell, so switching tabs never changes the card height. */
.demo__body { display: grid; }
.panel { grid-area: 1 / 1; min-width: 0; visibility: hidden; opacity: 0; transition: opacity .2s, visibility .2s; }
.panel.is-active { visibility: visible; opacity: 1; }
.panel:focus-visible { outline-offset: -3px; border-radius: 0 0 11px 11px; }

/* Story */
.story { display: grid; }
.scene { grid-area: 1 / 1; min-width: 0; padding: 12px 10px 12px; }
.scene__label { display: none; }
.call {
  padding: 2px 8px 10px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.call__short { display: none; }
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 0 8px;
  border-radius: 6px;
  transition: opacity .4s ease, background-color .4s;
}
.msg { overflow: hidden; color: var(--muted); white-space: nowrap; text-overflow: ellipsis; }
.tag {
  justify-self: start;
  padding: 2px 7px;
  border: 1px solid var(--bd);
  border-radius: 5px;
  background: var(--bg-c);
  color: var(--fg);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.row[data-tone="gray"]   { --fg: var(--gray-fg);   --bg-c: var(--gray-bg);   --bd: var(--gray-bd); }
.row[data-tone="blue"]   { --fg: var(--blue-fg);   --bg-c: var(--blue-bg);   --bd: var(--blue-bd); }
.row[data-tone="amber"]  { --fg: var(--amber-fg);  --bg-c: var(--amber-bg);  --bd: var(--amber-bd); }
.row[data-tone="violet"] { --fg: var(--violet-fg); --bg-c: var(--violet-bg); --bd: var(--violet-bd); }
.row[data-tone="green"]  { --fg: var(--green-fg);  --bg-c: var(--green-bg);  --bd: var(--green-bd); }
.row[data-tone="red"]    { --fg: var(--red-fg);    --bg-c: var(--red-bg);    --bd: var(--red-bd); }
.row--final { background: color-mix(in srgb, var(--bg-c) 70%, transparent); }
.row--final .msg { color: var(--text); }

/* Motion mode: scenes stacked, steps pre-rendered dimmed and lit in sequence. */
html.motion .scene { transition: opacity .35s ease, visibility .35s; }
html.motion .story:not(.is-playing) .scene--without,
html.motion .story.is-playing .scene:not(.is-active) { opacity: 0; visibility: hidden; }
html.motion .story.is-playing .row { opacity: .25; }
html.motion .story.is-playing .row--final { background-color: transparent; }
html.motion .story.is-playing .row.is-lit { opacity: 1; }
html.motion .story.is-playing .row--final.is-lit { background-color: color-mix(in srgb, var(--bg-c) 70%, transparent); }

/* Static mode (no JS or reduced motion): both final states side by side. */
html:not(.motion) .scenario { display: none; }
html:not(.motion) .story { grid-template-columns: repeat(2, minmax(0, 1fr)); }
html:not(.motion) .scene { grid-area: auto; padding-inline: 6px; }
html:not(.motion) .scene + .scene { border-left: 1px solid var(--border); }
html:not(.motion) .scene__label {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 8px 6px;
  color: var(--muted);
  font: 500 12.5px var(--sans);
}
html:not(.motion) .call { font-size: 12px; }
html:not(.motion) .call__args { display: none; }
html:not(.motion) .call__short { display: inline; }
html:not(.motion) .row { grid-template-columns: minmax(0, 1fr); row-gap: 3px; padding-block: 5px; }
html:not(.motion) .msg { white-space: normal; line-height: 1.35; font-size: 12px; }
@media (max-width: 520px) {
  html:not(.motion) .story { grid-template-columns: minmax(0, 1fr); }
  html:not(.motion) .scene + .scene { border-left: 0; border-top: 1px solid var(--border); }
}

/* Code panel */
#panel-code { overflow-x: auto; }
.panel pre {
  margin: 0;
  padding: 16px 18px;
  width: max-content;
  min-width: 100%;
  font-size: 11.5px;
  line-height: 1.65;
  tab-size: 4;
}
.k { color: var(--code-k); }
.s { color: var(--code-s); }
.c { color: var(--code-c); }
.d { color: var(--code-d); }
.f { color: var(--code-f); }

@media (max-width: 520px) {
  .row { grid-template-columns: 88px minmax(0, 1fr); gap: 8px; padding-block: 5px; }
  .msg { white-space: normal; line-height: 1.4; }
  .demo__head { gap: 6px; }
  .seg__btn { padding: 0 9px; }
}

/* Early access modal. Kept light in both themes so the Tally form stays readable. */
.modal {
  width: min(480px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 24px 24px 12px;
  border: 1px solid #e7e7e7;
  border-radius: 14px;
  background: #ffffff;
  color: #0a0a0a;
  color-scheme: light;
  box-shadow: 0 24px 64px -16px rgba(0, 0, 0, 0.35);
}
.modal::backdrop {
  background: rgba(10, 10, 10, 0.45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.modal__head:has(h2[hidden]) { position: absolute; top: 16px; right: 24px; } /* just the close button */
.modal h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.modal__close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-right: -6px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #525252;
  cursor: pointer;
}
.modal__close:hover { background: #f5f5f5; color: #0a0a0a; }
.modal :focus-visible { outline-color: #0a0a0a; }
.modal__sub { margin: 6px 0 12px; color: #525252; font-size: 14.5px; }
/* Tally pads its fields ~8px; pull the iframe out so they line up with the heading. */
.modal__form { margin-inline: -8px; }
.modal__form iframe { display: block; width: 100%; border: 0; }
.modal__thanks { margin: 4px 0 16px; }
.modal__thanks p { margin: 0 0 10px; }
.modal__thanks-title { padding-right: 32px; font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.modal__thanks-text { color: #525252; font-size: 15px; }
.modal__thanks a { color: #0a0a0a; text-underline-offset: 3px; }
.modal__thanks a:hover { color: #047857; }
html:has(.modal[open]) { overflow: hidden; }

/* Footer */
.footer {
  padding-block: 18px 22px;
  color: var(--faint);
  font-size: 13.5px;
}
.footer p { margin: 0; }
.footer a { color: var(--muted); text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; transition: color .15s, text-decoration-color .15s; }
.footer a:hover { color: var(--accent-ink); text-decoration-color: currentColor; }
.nowrap { white-space: nowrap; }

/* Entrance */
@media (prefers-reduced-motion: no-preference) {
  .hero__visual { animation: rise .6s .1s cubic-bezier(.2, .7, .2, 1) both; }
  .modal[open] { animation: pop .2s ease-out; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
  @keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.98); } }
}
