/* ==========================================================================
   Part 2: the marketing site. Built only from the tokens in app.css (Ink,
   ADR 0015 in theafeai/afe). No literal colours here: scripts/check-design.mjs
   fails CI on any #hex, rgb(), hsl() or undefined var(--…) in this file.
   Site-only sizes live in the one :root block below; they are not colours, so
   the themes need nothing extra.
   ========================================================================== */

@font-face {
  font-family: "Instrument Sans Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 400 700;
  src: url("fonts/instrument-sans-latin-wght-normal.woff2") format("woff2-variations");
}
@font-face {
  font-family: "JetBrains Mono Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url("fonts/jetbrains-mono-latin-wght-normal.woff2") format("woff2-variations");
}

:root {
  /* Site-only display sizes (marketing headings are larger than app titles). */
  --fs-lede: 1.1875rem; /* 19px: hero and section ledes */
  --fs-2xl: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem); /* section headings */
  --fs-display: clamp(2.375rem, 1.5rem + 3.8vw, 4.25rem); /* hero heading */
  --site-w: 1180px;
  --gutter: var(--space-4);
  --section-y: clamp(4rem, 3rem + 4vw, 7rem);
  --header-h: 3.75rem;
}
@media (min-width: 640px) {
  :root {
    --gutter: var(--space-6);
  }
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    transition-duration: 0ms !important;
    animation-duration: 0ms !important;
  }
}
body {
  overflow-x: hidden;
}
img,
svg {
  max-width: 100%;
}
.icon {
  width: 1rem;
  height: 1rem;
  flex: none;
}
.wrap {
  width: 100%;
  max-width: var(--site-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.skip {
  position: absolute;
  left: -999px;
}
.skip:focus {
  left: var(--space-4);
  top: var(--space-2);
  background: var(--surface);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 50;
}

/* Header ------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .wrap {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  height: var(--header-h);
}
.brand {
  display: inline-flex;
  align-items: center;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}
.site-nav {
  display: flex;
  gap: var(--space-1);
  margin-right: auto;
}
.site-nav a,
.footer-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: var(--fs-md);
  font-weight: 500;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  transition:
    color var(--dur) var(--ease),
    background var(--dur) var(--ease);
}
.site-nav a:hover,
.footer-links a:hover {
  color: var(--text);
  background: var(--surface-2);
}
.header-actions {
  display: flex;
  gap: var(--space-2);
  margin-left: auto;
}
@media (max-width: 860px) {
  .site-nav {
    display: none;
  }
}
@media (max-width: 420px) {
  .header-actions .btn-github-label {
    display: none;
  }
}

/* Sections ----------------------------------------------------------------- */
.section {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border);
}
.section-intro {
  max-width: 44rem;
  margin-bottom: var(--space-7);
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 var(--space-4);
  font-size: var(--fs-sm);
  font-weight: 550;
  color: var(--muted);
}
.section h2,
.cta h2 {
  font-size: var(--fs-2xl);
  letter-spacing: -0.03em;
  margin: 0 0 var(--space-4);
}
.lede {
  color: var(--text-2);
  font-size: var(--fs-lede);
  line-height: var(--lh);
  margin: 0;
}
.split {
  display: grid;
  gap: var(--space-7);
  align-items: start;
}
@media (min-width: 960px) {
  .split {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
  .split .section-intro {
    margin-bottom: 0;
    position: sticky;
    top: calc(var(--header-h) + var(--space-6));
  }
}
.points {
  list-style: none;
  margin: var(--space-5) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
  color: var(--text-2);
}
.points li {
  display: grid;
  grid-template-columns: 1rem 1fr;
  gap: var(--space-3);
  align-items: start;
}
.points .icon {
  margin-top: 0.2rem;
  color: var(--text);
}
.points strong {
  color: var(--text);
  font-weight: 600;
}

/* Hero --------------------------------------------------------------------- */
.hero {
  padding: clamp(3.5rem, 2rem + 6vw, 7rem) 0 var(--space-7);
}
.hero-copy {
  max-width: 52rem;
}
.hero h1 {
  font-size: var(--fs-display);
  line-height: 1.02;
  letter-spacing: -0.045em;
  margin: 0 0 var(--space-5);
}
.hero h1 .quiet {
  color: var(--muted);
}
.hero .lede {
  max-width: 40rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: var(--space-6) 0 0;
}
.btn-lg {
  height: 2.75rem;
  padding: 0 var(--space-5);
  font-size: var(--fs-base);
}
.hero-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin: var(--space-6) 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.hero-tools .badge {
  height: 1.75rem;
  padding: 0 var(--space-3) 0 var(--space-2);
  font-size: var(--fs-md);
}
.hero-tools .tool-mark {
  width: 1rem;
  height: 1rem;
}
.status-pill {
  margin-bottom: var(--space-5);
}
.status-pill .dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: var(--warn);
  box-shadow: 0 0 0 3px var(--warn-bg);
}

/* Product frame: the app, drawn with its own components --------------------- */
.frame {
  margin: var(--space-7) 0 0;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}
.frame-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: 2.5rem;
  padding: 0 var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--sidebar);
}
.frame-dots {
  display: flex;
  gap: 6px;
}
.frame-dots span {
  width: 0.625rem;
  height: 0.625rem;
  border-radius: 50%;
  background: var(--surface-3);
}
.frame-url {
  flex: 1;
  max-width: 22rem;
  margin: 0 auto;
  text-align: center;
  font-family: var(--mono);
  font-size: var(--fs-xs);
  color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--radius-pill);
  padding: 0.2rem var(--space-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.frame-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-height: 30rem;
}
@media (min-width: 900px) {
  .frame-body {
    grid-template-columns: 13.5rem minmax(0, 1fr);
  }
}
.frame-side {
  display: none;
  padding: var(--space-4) var(--space-3);
  background: var(--sidebar);
  border-right: 1px solid var(--border);
}
@media (min-width: 900px) {
  .frame-side {
    display: block;
  }
}
.frame-side .brand-mark {
  height: 1.125rem;
  margin: var(--space-1) var(--space-3) var(--space-5);
  display: block;
}
.frame-nav-title {
  margin: 0 var(--space-3) var(--space-2);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.frame-nav {
  list-style: none;
  margin: 0 0 var(--space-5);
  padding: 0;
  display: grid;
  gap: 2px;
}
.frame-nav li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0.4rem var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--fs-md);
  color: var(--text-2);
}
.frame-nav li .icon {
  color: var(--muted);
}
.frame-nav li[aria-current="page"] {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 550;
}
.frame-nav li[aria-current="page"] .icon {
  color: var(--text);
}
.frame-main {
  padding: var(--space-5) var(--space-4);
  min-width: 0;
}
@media (min-width: 640px) {
  .frame-main {
    padding: var(--space-6);
  }
}
.frame-main h3 {
  font-size: var(--fs-xl);
  letter-spacing: -0.025em;
  margin: 0 0 var(--space-1);
}
.frame-main .frame-lede {
  margin: 0 0 var(--space-4);
  color: var(--text-2);
}
.frame-summary {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin: 0 0 var(--space-3);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.frame-summary strong {
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.frame .callout {
  margin-bottom: var(--space-4);
}

/* Environment matrix (mirrors EnvironmentMatrix in the app) */
.mx-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}
.mx {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
  min-width: 46rem;
  font-size: var(--fs-md);
  line-height: var(--lh-dense);
}
.mx th,
.mx td {
  text-align: left;
  vertical-align: top;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.mx td + td,
.mx th + th {
  border-left: 1px solid var(--border);
}
.mx tbody tr:last-child th,
.mx tbody tr:last-child td {
  border-bottom: 0;
}
.mx thead th {
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.mx tbody th {
  font-weight: 600;
  color: var(--text);
  width: 8rem;
  border-right: 1px solid var(--border);
}
.mx tbody th code {
  display: block;
  font-weight: 400;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.mx-selected {
  background: var(--env-selected);
  box-shadow: inset 0 0 0 1.5px var(--select);
}
.mx-empty {
  color: var(--faint);
  text-align: center !important;
  vertical-align: middle !important;
}
.cell {
  display: grid;
  gap: 0.3rem;
}
.cell-id {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
}
.cell-id code {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
}
.cell-id span,
.cell-meta {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.cell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.cell-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.cell-meta .tool-mark {
  width: 0.8125rem;
  height: 0.8125rem;
}
.cell-note {
  font-size: var(--fs-sm);
  color: var(--text-2);
}
/* Kind badges (from EnvironmentMatrix.css) */
.badge.kind {
  background: transparent;
}
.badge.kind-rollback,
.badge.kind-manual {
  color: var(--warn);
  border-color: var(--warn-border);
}
.drift-badge {
  color: var(--bad);
  background: transparent;
  border-color: color-mix(in srgb, var(--bad) 35%, transparent);
}

/* Feature grid: cells divided by hairlines, not boxed ------------------------ */
.features {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border-top: 1px solid var(--border);
}
@media (min-width: 680px) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1000px) {
  .features {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.feature {
  padding: var(--space-6) var(--space-5) var(--space-6) 0;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 680px) {
  .feature {
    padding: var(--space-6) var(--space-6) var(--space-6) 0;
  }
  .feature + .feature {
    padding-left: var(--space-6);
  }
}
@media (min-width: 680px) and (max-width: 999px) {
  .feature:nth-child(2n + 1) {
    padding-left: 0;
  }
  .feature:nth-child(2n) {
    border-left: 1px solid var(--border);
  }
}
@media (min-width: 1000px) {
  .feature:nth-child(3n + 1) {
    padding-left: 0;
  }
  .feature:nth-child(3n + 2),
  .feature:nth-child(3n) {
    border-left: 1px solid var(--border);
  }
}
.feature-icon {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  margin-bottom: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
}
.feature h3 {
  font-size: var(--fs-lg);
  margin: 0 0 var(--space-2);
}
.feature p {
  margin: 0;
  color: var(--text-2);
}
.feature .badge {
  margin-top: var(--space-3);
}

/* Problem: three short statements ----------------------------------------- */
.trio {
  display: grid;
  gap: var(--space-6);
  counter-reset: trio;
}
@media (min-width: 860px) {
  .trio {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.trio > div {
  counter-increment: trio;
  border-top: 1px solid var(--text);
  padding-top: var(--space-4);
}
.trio > div::before {
  content: counter(trio, decimal-leading-zero);
  display: block;
  margin-bottom: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.trio h3 {
  font-size: var(--fs-lg);
  margin: 0 0 var(--space-2);
}
.trio p {
  margin: 0;
  color: var(--text-2);
}

/* Timeline mock ----------------------------------------------------------- */
.panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.panel-head strong {
  color: var(--text);
  font-weight: 600;
}
.panel .events {
  border: 0;
}
.panel .row-link {
  grid-template-columns: 4.5rem minmax(0, 1fr);
  cursor: default;
}
.panel .row-link:hover {
  background: transparent;
}
.panel .row-badges {
  grid-column: 2;
  justify-content: flex-start;
}
@media (min-width: 640px) {
  .panel .row-link {
    grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  }
  .panel .row-badges {
    grid-column: auto;
    justify-content: flex-end;
  }
}

/* Confidence scale --------------------------------------------------------- */
.scale {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.scale li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: var(--space-4);
  align-items: baseline;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
}
.scale li .badge {
  justify-self: start;
}
.gap-demo {
  margin-top: var(--space-6);
}
.gap-demo .gap-list li {
  grid-template-columns: auto minmax(0, 1fr);
}
@media (min-width: 640px) {
  .gap-demo .gap-list li {
    grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr) auto;
  }
}

/* Commit journey ----------------------------------------------------------- */
.journey {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
}
@media (min-width: 1000px) {
  .journey {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.journey li {
  position: relative;
  display: grid;
  gap: var(--space-2);
  align-content: start;
  padding: var(--space-4) 0 var(--space-4) var(--space-6);
  min-width: 0;
}
/* The edge into the next step: solid when certain, dashed when probable. */
.journey li::before {
  content: "";
  position: absolute;
  left: 0.4375rem;
  top: 0;
  bottom: 0;
  border-left: 2px solid var(--edge, var(--conf-certain));
}
.journey li::after {
  content: "";
  position: absolute;
  left: 0;
  top: var(--space-4);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: var(--bg);
  box-shadow: inset 0 0 0 2px var(--text);
}
.journey li:first-child::before {
  top: var(--space-4);
}
.journey li:last-child::before {
  bottom: auto;
  height: var(--space-4);
}
.journey li.edge-strong {
  --edge: var(--conf-strong);
}
.journey li.edge-probable::before {
  border-left-style: dashed;
}
.journey li.edge-probable {
  --edge: var(--conf-probable);
}
@media (min-width: 1000px) {
  .journey li {
    padding: var(--space-6) var(--space-4) 0 0;
  }
  .journey li::before {
    left: 0;
    right: 0;
    top: 0.4375rem;
    bottom: auto;
    border-left: 0;
    border-top: 2px solid var(--edge, var(--conf-certain));
  }
  .journey li:first-child::before {
    top: 0.4375rem;
    left: 0.5rem;
  }
  .journey li:last-child::before {
    height: auto;
    right: auto;
    width: 0.5rem;
  }
  .journey li.edge-probable::before {
    border-left-style: none;
    border-top-style: dashed;
  }
  .journey li::after {
    top: 0;
  }
}
.journey-step {
  font-size: var(--fs-sm);
  color: var(--muted);
}
.journey code {
  font-size: var(--fs-md);
  font-weight: 600;
  color: var(--text);
  overflow-wrap: anywhere;
}
.journey .badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.containment {
  margin-top: var(--space-6);
  max-width: 44rem;
}

/* How it works ------------------------------------------------------------- */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--space-6);
  counter-reset: step;
}
@media (min-width: 760px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1100px) {
  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}
.steps li {
  counter-increment: step;
}
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  margin-bottom: var(--space-4);
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: var(--fs-sm);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.steps h3 {
  font-size: var(--fs-lg);
  margin: 0 0 var(--space-2);
}
.steps p {
  margin: 0;
  color: var(--text-2);
}

/* Code block --------------------------------------------------------------- */
.code {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
  color: var(--muted);
}
.code pre {
  margin: 0;
  padding: var(--space-4);
  overflow-x: auto;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--text);
}
.code .c {
  color: var(--muted);
}
.code .p {
  color: var(--muted);
  user-select: none;
}
.copy-state {
  font-size: var(--fs-sm);
  color: var(--ok);
}

/* Roadmap ------------------------------------------------------------------ */
.roadmap {
  display: grid;
  gap: var(--space-6);
}
@media (min-width: 900px) {
  .roadmap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.roadmap section {
  border-top: 1px solid var(--text);
  padding-top: var(--space-4);
}
.roadmap-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}
.roadmap h3 {
  font-size: var(--fs-lg);
  margin: 0;
}
.roadmap ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.roadmap li {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  line-height: var(--lh-dense);
}
.roadmap li strong {
  display: block;
  color: var(--text);
  font-weight: 600;
  margin-bottom: 0.15rem;
}
.roadmap li .badge {
  margin-top: var(--space-2);
}
.roadmap-note {
  margin: var(--space-5) 0 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.status-later {
  color: var(--muted);
  background: transparent;
}

/* FAQ ---------------------------------------------------------------------- */
.faq {
  border-top: 1px solid var(--border);
}
.faq details {
  border-bottom: 1px solid var(--border);
}
.faq summary {
  display: flex;
  width: 100%;
  padding: var(--space-4) 0;
  font-size: var(--fs-base);
  font-weight: 600;
}
.faq summary:hover {
  text-decoration: none;
}
.faq details > div {
  padding: 0 0 var(--space-4) var(--space-5);
  color: var(--text-2);
  max-width: 46rem;
}
.faq details p {
  margin: 0 0 var(--space-2);
}

/* Closing CTA and footer -------------------------------------------------- */
.cta {
  padding: var(--section-y) 0;
  border-top: 1px solid var(--border);
  text-align: center;
}
.cta .lede {
  max-width: 34rem;
  margin: 0 auto;
}
.cta .hero-actions {
  justify-content: center;
}
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--sidebar);
  padding: var(--space-6) 0;
  font-size: var(--fs-sm);
  color: var(--muted);
}
.site-footer .wrap {
  display: grid;
  gap: var(--space-5);
}
@media (min-width: 860px) {
  .site-footer .wrap {
    grid-template-columns: auto 1fr auto;
    align-items: center;
  }
}
.footer-brand {
  display: grid;
  gap: var(--space-2);
}
.footer-brand p {
  margin: 0;
}
.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
}
.footer-links a {
  font-size: var(--fs-sm);
}
@media (min-width: 860px) {
  .footer-links {
    justify-content: center;
  }
}
.site-footer .theme-switch {
  width: 15rem;
  max-width: 100%;
}
.frame-spacer {
  visibility: hidden;
}
/* GitHub mark inside ink buttons follows the button text, not the tool colour. */
.tool-mark.mark-ink {
  fill: currentColor;
}
