:root {
  color-scheme: light;
  --paper: #f0f1ec;
  --card: #f7f8f4;
  --ink: #171814;
  --muted: #67685f;
  --line: #d4d6cd;
  --accent: #2f49ff;         /* "share" accent — CTA + share moment only */
  --accent-ink: #1a2ab8;
  --warn: #c96a1f;           /* decorative "soon" markers only (large/graphical) */
  --warn-ink: #9a4a12;       /* error TEXT — ≥4.5:1 on paper & card */
  --field-line: #8b8d83;     /* form input border — ≥3:1 on #fff (WCAG 1.4.11) */
  --font-display: "Bricolage Grotesque", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --pad: clamp(20px, 5vw, 72px);
  --page-pad: max(var(--pad), calc((100vw - 1600px) / 2));
  --prose: 720px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 380;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

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

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* Prose column for text-first sections; galleries break wider. */
.wrap { max-width: var(--prose); }

.eyebrow {
  margin: 0 0 clamp(16px, 3vw, 26px);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}
.eyebrow::before { content: "\25aa\00a0\00a0"; color: var(--accent); }

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  padding: clamp(18px, 3vw, 30px) var(--page-pad);
  font-family: var(--font-mono);
  font-size: 0.82rem;
}
.brand { font-weight: 700; letter-spacing: 0.01em; text-decoration: none; }
.site-header nav { display: flex; align-items: baseline; gap: clamp(16px, 3vw, 28px); }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }
.nav-cta { color: var(--accent-ink) !important; font-weight: 700; }

/* Hero */
.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  gap: clamp(40px, 6vw, 96px);
  padding: clamp(40px, 6vw, 88px) var(--page-pad) clamp(56px, 7vw, 104px);
  min-height: calc(100svh - 76px);
}
/* Faint ambient backdrop — biased right, faded out over the copy so text stays
   on plain paper. The CSS demo remains the hero's primary element (spec §5). */
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: url("assets/hero-ambient.webp") center right / cover no-repeat;
  opacity: 0.35;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, transparent 40%, #000 88%);
          mask-image: linear-gradient(90deg, transparent 0%, transparent 40%, #000 88%);
}
.hero-copy { max-width: 620px; }

.hero-title {
  margin: 0;
  font-weight: 250;
  font-size: clamp(2.6rem, 5.4vw, 5rem);
  line-height: 1.0;
  letter-spacing: -0.025em;
}
.hero-share { display: block; color: var(--accent); font-weight: 500; }

.hero-lede {
  max-width: 46ch;
  margin: clamp(22px, 3vw, 32px) 0 clamp(28px, 4vw, 40px);
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  font-weight: 400;
  color: var(--muted);
}

/* Waitlist form */
.waitlist { max-width: 520px; }
.waitlist-row { display: flex; gap: 10px; flex-wrap: wrap; }
.waitlist-input {
  flex: 1 1 220px;
  min-width: 0;
  padding: 13px 16px;
  border: 1px solid var(--field-line);
  border-radius: 2px;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.95rem;
}
.waitlist-input::placeholder { color: var(--muted); }
.waitlist-input:focus-visible { outline-offset: 0; border-color: var(--accent); }
.waitlist-input[aria-invalid="true"] { border-color: var(--warn-ink); }

.cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 22px;
  border: 0;
  border-radius: 2px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.cta-primary:hover { background: var(--accent-ink); }

.waitlist-note { margin: 12px 0 0; font-family: var(--font-mono); font-size: 0.76rem; color: var(--muted); }
.waitlist-error { margin: 12px 0 0; font-family: var(--font-mono); font-size: 0.78rem; color: var(--warn-ink); }
.waitlist-success {
  margin: 0;
  padding: 14px 16px;
  border-left: 2px solid var(--accent);
  font-size: 1rem;
}
.waitlist-success strong { font-weight: 600; }

/* ---------------------------------------------------------------------------
   Hero demo: prompt → tool → share → teammate. One persistent device window;
   overlays enter/exit on a shared 12s loop so they stay in sync without JS.
--------------------------------------------------------------------------- */
.demo { display: flex; justify-content: center; }
.device {
  --loop: 12s;
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 4 / 3.2;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 60px -34px rgba(23, 24, 20, 0.55);
  overflow: hidden;
}
/* Pause the loop while the demo is scrolled offscreen (JS toggles .paused). */
.device.paused * { animation-play-state: paused; }
.device-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted);
}
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.device-url { margin-left: 10px; }
/* flex:1 fills the height the bar leaves, whether .device is sized by
   aspect-ratio (desktop) or min-height (mobile) — no magic pixel offset. */
.device-body { position: relative; flex: 1; min-height: 0; padding: 18px; }

/* Prompt line (types in beat A) */
.prompt {
  display: flex; align-items: baseline; gap: 8px;
  padding: 11px 13px;
  border: 1px solid var(--line); border-radius: 4px;
  background: var(--card);
  font-family: var(--font-mono); font-size: 0.8rem;
}
.prompt-caret { color: var(--accent); font-weight: 700; }
.prompt-text {
  /* Typewriter coupling: steps(N) here, `width: Nch` in @keyframes type,
     and the N-character prompt string in index.html must all use the same N. */
  overflow: hidden; white-space: nowrap;
  border-right: 2px solid var(--accent);
  animation: type var(--loop) steps(25) infinite;
}

/* Tool (builds in beat B, then stays) */
.tool {
  margin-top: 16px;
  opacity: 0;
  animation: toolIn var(--loop) ease infinite;
}
.tool-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.tool-head strong { font-size: 1.05rem; font-weight: 600; }
.tool-tag {
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.tool-rows { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tool-rows li {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 4px;
  font-size: 0.86rem;
  opacity: 0;
  animation: rowIn var(--loop) ease infinite;
}
.tool-rows li:nth-child(1) { animation-delay: calc(var(--loop) * 0.005); }
.tool-rows li:nth-child(2) { animation-delay: calc(var(--loop) * 0.03); }
.tool-rows li:nth-child(3) { animation-delay: calc(var(--loop) * 0.055); }
.tool-rows i { font-style: normal; font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); }
.tool-rows em {
  font-style: normal; font-family: var(--font-mono); font-size: 0.64rem;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
}
.tool-rows em.soon { color: var(--warn); }

/* Share sheet (slides up in beat C) */
.share {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 18px 18px;
  border-top: 1px solid var(--line);
  border-radius: 12px 12px 0 0;
  background: #fff;
  box-shadow: 0 -16px 30px -22px rgba(23, 24, 20, 0.4);
  transform: translateY(110%);
  animation: shareIn var(--loop) cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.share-title { margin: 0 0 12px; font-size: 0.95rem; font-weight: 600; }
.share-people { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  display: inline-grid; place-items: center;
  font-family: var(--font-mono); font-size: 0.6rem; color: var(--muted);
}
.avatar::before { content: attr(data-initials); }
.share-role { margin-left: 6px; font-family: var(--font-mono); font-size: 0.7rem; color: var(--muted); }
.share-copy {
  width: 100%; padding: 11px; border: 0; border-radius: 4px;
  background: var(--accent); color: #fff;
  font-family: var(--font-mono); font-size: 0.82rem; font-weight: 700; cursor: default;
}

/* Teammate's screen (peeks in during beat D) */
.teammate {
  position: absolute; right: 14px; bottom: 14px;
  width: 52%;
  border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 36px -22px rgba(23, 24, 20, 0.5);
  overflow: hidden;
  opacity: 0; transform: translateY(18px) scale(0.96);
  animation: teammateIn var(--loop) cubic-bezier(0.2, 0.8, 0.2, 1) infinite;
}
.teammate-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 11px; border-bottom: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.66rem; color: var(--muted);
}
.teammate-bar .avatar { width: 20px; height: 20px; font-size: 0.5rem; }
.teammate-rows { display: grid; gap: 7px; padding: 12px; }
.teammate-rows span { height: 9px; border-radius: 2px; background: var(--card); }
.teammate-rows span:nth-child(2) { width: 80%; }
.teammate-rows span:nth-child(3) { width: 62%; }

@keyframes type {
  0%   { width: 0; }
  16%  { width: 25ch; }
  100% { width: 25ch; }
}
@keyframes toolIn {
  0%, 24% { opacity: 0; }
  32%, 100% { opacity: 1; }
}
@keyframes rowIn {
  0%, 26% { opacity: 0; transform: translateY(8px); }
  38%, 100% { opacity: 1; transform: none; }
}
@keyframes shareIn {
  0%, 46%  { transform: translateY(110%); }
  56%, 74% { transform: translateY(0); }
  84%, 100% { transform: translateY(110%); }
}
@keyframes teammateIn {
  0%, 76%  { opacity: 0; transform: translateY(18px) scale(0.96); }
  86%, 96% { opacity: 1; transform: translateY(0) scale(1); }
  100%     { opacity: 0; transform: translateY(18px) scale(0.96); }
}

/* Sections */
.section { padding: clamp(64px, 9vw, 132px) var(--page-pad); }
.section-title {
  max-width: 22ch;
  margin: 0 0 clamp(28px, 4vw, 48px);
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 300;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.section-close, .section-tech { max-width: 48ch; margin: clamp(36px, 5vw, 56px) 0 0; }
.section-close { font-size: clamp(1.2rem, 2vw, 1.6rem); font-weight: 300; letter-spacing: -0.01em; }
.section-tech { font-family: var(--font-mono); font-size: 0.85rem; color: var(--muted); }

/* 4.2 Problem vignettes */
.vignettes {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(18px, 2.5vw, 30px);
}
.vignette { margin: 0; }
.mock {
  border: 1px solid var(--line); border-radius: 8px; background: var(--card);
  padding: 16px; min-height: 168px;
}
.mock-head { font-size: 0.9rem; font-weight: 600; margin-bottom: 14px; }
.mock-row { display: flex; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.mock-row span { width: 46%; height: 8px; border-radius: 2px; background: #dfe0d9; }
.mock-row b { width: 34px; height: 14px; border-radius: 3px; background: #dfe0d9; display: inline-block; }
.mock-row b.soon { background: var(--warn); opacity: 0.75; }
.mock-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.mock-grid i { height: 26px; border-radius: 3px; background: #dfe0d9; }
.mock-grid i.on { background: var(--accent); opacity: 0.7; }
.mock-lane { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.mock-lane b { width: 8px; height: 24px; border-radius: 2px; background: #dfe0d9; }
.mock-lane b.p1 { background: var(--warn); }
.mock-lane b.p2 { background: var(--accent); opacity: 0.7; }
.mock-lane span { flex: 1; height: 8px; border-radius: 2px; background: #dfe0d9; }
.vignette-cap { margin: 14px 0 0; font-size: 0.9rem; color: var(--muted); }

/* 4.3 Steps */
.steps {
  list-style: none; margin: clamp(8px, 2vw, 16px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(24px, 3vw, 44px);
}
.step { border-top: 2px solid var(--ink); padding-top: 18px; }
.step-n { font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted); }
.step h3 { margin: 10px 0 8px; font-size: clamp(1.3rem, 2vw, 1.7rem); font-weight: 500; letter-spacing: -0.01em; }
.step p { margin: 0; color: var(--muted); max-width: 34ch; }

/* 4.4 Hard parts */
.hard-list {
  list-style: none; margin: clamp(8px, 2vw, 16px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 3vw, 48px) clamp(32px, 5vw, 72px);
}
.hard-list li { border-top: 1px solid var(--line); padding-top: 18px; }
.hard-list h3 { margin: 0 0 8px; font-size: clamp(1.2rem, 1.8vw, 1.5rem); font-weight: 520; letter-spacing: -0.01em; }
.hard-list p { margin: 0; color: var(--muted); max-width: 42ch; }

/* 4.5 Gallery */
.gallery-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, 1fr); gap: clamp(18px, 2.5vw, 30px);
}
.gtool { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--card); }
.gtool-shot {
  display: block; width: 100%; height: 156px;
  object-fit: cover; object-position: center;
  background: #fff; border-bottom: 1px solid var(--line);
}
.gtool strong { display: block; padding: 14px 16px 0; font-size: 1rem; font-weight: 600; }
.gtool p { margin: 6px 0 0; padding: 0 16px 16px; font-size: 0.85rem; color: var(--muted); }

/* 4.6 FAQ */
.faq-list { max-width: var(--prose); }
.faq details { border-top: 1px solid var(--line); padding: 4px 0; }
.faq details:last-of-type { border-bottom: 1px solid var(--line); }
.faq summary {
  list-style: none; cursor: pointer; padding: 18px 32px 18px 0; position: relative;
  font-size: clamp(1.05rem, 1.6vw, 1.3rem); font-weight: 500; letter-spacing: -0.01em;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+"; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); color: var(--accent); font-size: 1.3rem;
}
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0 0 20px; max-width: 56ch; color: var(--muted); }
.faq a { color: var(--accent-ink); }

/* 4.7 Final CTA */
.final { background: var(--card); }
.final .section-title { max-width: 20ch; font-weight: 250; }

/* Footer */
footer {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 24px;
  padding: clamp(28px, 4vw, 40px) var(--page-pad);
  border-top: 1px solid var(--line);
  font-family: var(--font-mono); font-size: 0.78rem; color: var(--muted);
}
footer nav { display: flex; flex-wrap: wrap; gap: 18px; }
footer a { text-decoration: none; }
footer a:hover { color: var(--ink); }

/* Entrance for hero copy (one-shot; not the demo loop) */
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
.hero .eyebrow { animation: rise 0.6s ease 0.05s backwards; }
.hero-title { animation: rise 0.6s ease 0.16s backwards; }
.hero-lede { animation: rise 0.6s ease 0.32s backwards; }
.hero .waitlist { animation: rise 0.6s ease 0.44s backwards; }

/* Reduced motion: demo settles on the share frame, statically. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; }
  html { scroll-behavior: auto; }
  .prompt-text { border-right: 0; width: auto; }
  .tool, .tool-rows li { opacity: 1; transform: none; }
  .share { transform: translateY(0); }
  .teammate { display: none; }
}

/* Wide screens: FAQ and final CTA go two-column so they fill the frame
   like the grid sections do (heading rail left, content right). */
@media (min-width: 1100px) {
  .faq {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    column-gap: clamp(48px, 6vw, 120px);
    align-items: start;
  }
  .faq-list { max-width: none; }
  .final .wrap {
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    column-gap: clamp(48px, 6vw, 120px);
    align-items: center;
  }
  .final .section-title { margin: 0; }
}

/* Responsive */
@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; min-height: auto; gap: 44px; }
  .hero-copy { max-width: none; }
  .device { max-width: 520px; }
  .vignettes, .steps, .gallery-grid { grid-template-columns: 1fr 1fr; }
  .hard-list { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .vignettes, .steps, .gallery-grid { grid-template-columns: 1fr; }
  .waitlist-row { flex-direction: column; align-items: stretch; }
  .waitlist-input { flex: 0 0 auto; width: 100%; }
  .cta-primary { width: 100%; justify-content: center; }
  /* Mobile demo composition: taller device, a more prominent teammate inset — not a shrunk desktop. */
  .device { aspect-ratio: auto; min-height: 420px; }
  .teammate { width: 66%; }
}
