/*
 * Postfork website styles. One shared stylesheet, no build step, no external fonts.
 * Dark-first; light theme via prefers-color-scheme.
 *
 * Contrast (WCAG 2.x, measured on the page ground):
 *   dark  — text #e8eaed 16.2:1, muted #9ba4ae 7.8:1, accent #f7931a 8.5:1,
 *           branch #5eead4 13.2:1, button ink #111 on #f7931a 8.2:1
 *   light — text #16181b 16.5:1, muted #545a62 6.4:1, accent #a14d06 5.4:1,
 *           branch #0f766e 5.1:1
 *   focus ring (3px, offset from the element, so measured on the page ground):
 *   dark  — #ffffff on #0b0c0e 19.6:1; light — #16181b on #f7f6f2 16.5:1.
 *   Primary buttons add an inner #111 ring on #f7931a (8.2:1).
 */

:root {
  color-scheme: dark light;

  --bg: #0b0c0e;
  --surface: #14161a;
  --surface-2: #1b1e23;
  --line: #2a2e35;
  --line-strong: #3a3f48;
  --text: #e8eaed;
  --muted: #9ba4ae;
  --heading: #ffffff;
  --accent: #f7931a;
  --accent-fill: #f7931a;
  --accent-ink: #111111;
  --focus: #ffffff;
  --accent-soft: rgba(247, 147, 26, 0.12);
  --branch: #5eead4;
  --branch-soft: rgba(94, 234, 212, 0.1);
  --warn: #f2c14e;
  --warn-soft: rgba(242, 193, 78, 0.1);
  --code-bg: #101215;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 20px 40px -24px rgba(0, 0, 0, 0.8);
  --glow: radial-gradient(60% 80% at 75% 0%, rgba(247, 147, 26, 0.16), rgba(247, 147, 26, 0) 70%),
    radial-gradient(50% 60% at 10% 10%, rgba(94, 234, 212, 0.07), rgba(94, 234, 212, 0) 70%);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --radius-s: 6px;
  --radius-m: 10px;
  --radius-l: 16px;
  --wrap: 1160px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f7f6f2;
    --surface: #ffffff;
    --surface-2: #efede7;
    --line: #dcd8cf;
    --line-strong: #c4bfb4;
    --text: #16181b;
    --muted: #545a62;
    --heading: #0b0c0e;
    --accent: #a14d06;
    --accent-fill: #f7931a;
    --accent-ink: #111111;
    --focus: #16181b;
    --accent-soft: rgba(247, 147, 26, 0.14);
    --branch: #0f766e;
    --branch-soft: rgba(15, 118, 110, 0.08);
    --warn: #8a5a00;
    --warn-soft: rgba(242, 193, 78, 0.18);
    --code-bg: #f1efe9;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 16px 32px -24px rgba(0, 0, 0, 0.25);
    --glow: radial-gradient(60% 80% at 75% 0%, rgba(247, 147, 26, 0.14), rgba(247, 147, 26, 0) 70%),
      radial-gradient(50% 60% at 10% 10%, rgba(15, 118, 110, 0.06), rgba(15, 118, 110, 0) 70%);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: 5rem;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  max-width: 100%;
}

a {
  color: var(--accent);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

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

h1,
h2,
h3,
h4 {
  color: var(--heading);
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin: 0 0 0.6em;
}

h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  letter-spacing: -0.025em;
  font-weight: 700;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 700;
}

h3 {
  font-size: 1.2rem;
  font-weight: 650;
}

p {
  margin: 0 0 1em;
}

code,
kbd,
.mono {
  font-family: var(--mono);
  font-size: 0.88em;
}

code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 0.05em 0.35em;
  white-space: nowrap;
}

pre code {
  white-space: pre;
  border: 0;
  padding: 0;
  background: none;
}

strong {
  color: var(--heading);
  font-weight: 650;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -3rem;
  z-index: 100;
  background: var(--accent-fill);
  color: var(--accent-ink);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-s);
  font-weight: 600;
  text-decoration: none;
}

.skip:focus {
  top: 0.75rem;
}

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

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- Status strip ---------- */

.status-strip {
  background: var(--warn-soft);
  border-bottom: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--text);
}

.status-strip .wrap {
  padding-top: 0.45rem;
  padding-bottom: 0.45rem;
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  flex-wrap: wrap;
}

.status-strip .tag {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--warn);
  font-weight: 700;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  -webkit-backdrop-filter: saturate(140%) blur(10px);
  backdrop-filter: saturate(140%) blur(10px);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.75rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--heading);
  font-weight: 700;
  font-size: 1.12rem;
  letter-spacing: -0.01em;
}

.brand svg {
  width: 30px;
  height: auto;
  flex: none;
}

.site-nav {
  display: flex;
  gap: 0.25rem 1.1rem;
  flex-wrap: wrap;
  margin-left: auto;
  font-size: 0.93rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.35rem 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--heading);
}

.site-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 0.4em;
  text-decoration-color: var(--accent-fill);
  text-decoration-thickness: 2px;
}

.langs {
  font-family: var(--mono);
  font-size: 0.8rem;
  display: flex;
  gap: 0.35rem;
  align-items: center;
  color: var(--muted);
}

.langs a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.2rem 0.35rem;
  border-radius: 4px;
  border: 1px solid transparent;
}

.langs a[aria-current="true"] {
  color: var(--heading);
  border-color: var(--line-strong);
}

@media (max-width: 760px) {
  .site-header {
    position: static;
  }

  .site-header .wrap {
    padding-top: 0.6rem;
    padding-bottom: 0.6rem;
    gap: 0.5rem 1rem;
  }

  .site-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 0.2rem;
  }

  .site-nav a {
    white-space: nowrap;
  }

  .langs {
    margin-left: auto;
  }
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--glow);
  overflow: hidden;
}

.hero .wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 3rem;
  align-items: center;
  padding-top: clamp(3rem, 7vw, 6rem);
  padding-bottom: clamp(3rem, 7vw, 5.5rem);
}

.eyebrow {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1rem;
  font-weight: 600;
}

.hero .lede {
  font-size: clamp(1.08rem, 1.6vw, 1.25rem);
  color: var(--text);
  max-width: 40em;
}

.hero .lede-2 {
  color: var(--muted);
  max-width: 40em;
}

.hero h1 .hl {
  color: var(--accent);
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  margin: 1.4rem 0 1.8rem;
}

.chips li {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--text);
  background: var(--surface);
}

.chips li.open {
  border-color: var(--warn);
  color: var(--warn);
  background: var(--warn-soft);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.15rem;
  border-radius: var(--radius-m);
  font-weight: 650;
  font-size: 0.98rem;
  text-decoration: none;
  border: 1px solid transparent;
  line-height: 1.2;
}

.btn-primary {
  background: var(--accent-fill);
  color: var(--accent-ink);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-primary:focus-visible {
  box-shadow: inset 0 0 0 2px var(--accent-ink);
}

.btn-ghost {
  border-color: var(--line-strong);
  color: var(--heading);
  background: var(--surface);
}

.btn-ghost:hover {
  border-color: var(--muted);
}

.btn small {
  font-weight: 500;
  opacity: 0.75;
  font-family: var(--mono);
  font-size: 0.75rem;
}

/* Spec card in the hero */

.spec-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.spec-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface-2);
}

.spec-card header .dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--warn);
  margin-right: 0.45rem;
  vertical-align: 0.05em;
}

.spec-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
}

.spec-card dt,
.spec-card dd {
  margin: 0;
  padding: 0.62rem 1.1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
}

.spec-card dt {
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding-top: 0.75rem;
}

.spec-card dd {
  color: var(--heading);
}

.spec-card dd .note {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.spec-card dt:nth-last-of-type(1),
.spec-card dd:nth-last-of-type(1) {
  border-bottom: 0;
}

.spec-card .open {
  color: var(--warn);
  font-weight: 650;
}

@media (max-width: 900px) {
  .hero .wrap {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }
}

/* ---------- Sections ---------- */

.section {
  padding: clamp(3.5rem, 7vw, 6rem) 0;
  border-bottom: 1px solid var(--line);
}

.section.alt {
  background: var(--surface);
}

.section-head {
  max-width: 46rem;
  margin-bottom: 2.5rem;
}

.section-head .kicker {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.75rem;
  font-weight: 600;
}

.section-head p {
  color: var(--muted);
  font-size: 1.08rem;
}

.prose {
  max-width: 46rem;
}

.prose p,
.prose li {
  color: var(--text);
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.9rem;
}

.principle {
  margin: 0 0 2.5rem;
  padding: 1.6rem 1.75rem;
  border-left: 3px solid var(--accent-fill);
  background: var(--accent-soft);
  border-radius: 0 var(--radius-m) var(--radius-m) 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.45;
  color: var(--heading);
  max-width: 52rem;
}

.principle p {
  margin: 0;
}

.principle cite {
  display: block;
  margin-top: 0.75rem;
  font-style: normal;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 1.25rem;
}

.grid-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid-4 {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

@media (max-width: 980px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .grid-3 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .grid-2,
  .grid-4 {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 1.4rem 1.4rem 1.2rem;
}

.section.alt .card {
  background: var(--bg);
}

.card h3 {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.card p:last-child,
.card ul:last-child {
  margin-bottom: 0;
}

.card p {
  color: var(--muted);
  font-size: 0.97rem;
}

.card .ico {
  width: 2rem;
  height: 2rem;
  flex: none;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.card .ico.branch {
  background: var(--branch-soft);
  color: var(--branch);
}

.card .meta {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.75rem;
}

.card .meta a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* Is / is not list */

.isnot {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  overflow: hidden;
}

.isnot li {
  display: grid;
  grid-template-columns: minmax(10rem, 0.8fr) 2fr;
  gap: 1rem;
  padding: 0.85rem 1.2rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}

.isnot li:last-child {
  border-bottom: 0;
}

.isnot li > span:first-child {
  color: var(--heading);
  font-weight: 600;
}

.isnot li > span:last-child {
  color: var(--muted);
}

@media (max-width: 640px) {
  .isnot li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
}

/* Callouts */

.callout {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 1.1rem 1.25rem;
  background: var(--surface);
  margin: 1.5rem 0;
}

.section.alt .callout {
  background: var(--bg);
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout .label {
  display: block;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 0.4rem;
  font-weight: 700;
  color: var(--muted);
}

.callout.warn {
  border-color: color-mix(in srgb, var(--warn) 55%, var(--line));
  background: var(--warn-soft);
}

.callout.warn .label {
  color: var(--warn);
}

.callout.claim {
  border-color: color-mix(in srgb, var(--accent-fill) 55%, var(--line));
  background: var(--accent-soft);
}

.callout.claim .label {
  color: var(--accent);
}

.callout.verbatim p {
  font-style: italic;
}

/* Figures and diagrams */

figure {
  margin: 0;
}

.figure {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
  padding: 1.25rem;
  overflow-x: auto;
}

.section.alt .figure {
  background: var(--bg);
}

.figure svg {
  display: block;
  width: 100%;
  height: auto;
  min-width: 640px;
}

.figure.compact svg {
  min-width: 0;
}

.figure figcaption {
  margin-top: 0.9rem;
  font-size: 0.86rem;
  color: var(--muted);
}

.dg-text {
  fill: var(--text);
  font-family: var(--sans);
  font-size: 13px;
}

.dg-strong {
  fill: var(--heading);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 650;
}

.dg-small {
  fill: var(--muted);
  font-family: var(--sans);
  font-size: 11.5px;
}

.dg-mono {
  fill: var(--text);
  font-family: var(--mono);
  font-size: 12px;
}

.dg-mono-accent {
  fill: var(--accent);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
}

.dg-lane-label {
  fill: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dg-step {
  fill: var(--accent-ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}

.dg-step-bg {
  fill: var(--accent-fill);
}

.dg-step-bg.branch {
  fill: var(--branch);
}

/* Light theme: the dark-teal branch circle needs light digits (#fff on #0f766e 5.5:1). */
@media (prefers-color-scheme: light) {
  .dg-step-bg.branch + .dg-step {
    fill: #ffffff;
  }
}

.dg-lane {
  fill: var(--surface-2);
  stroke: var(--line);
  stroke-width: 1;
}

.dg-box {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.2;
}

.section.alt .dg-box {
  fill: var(--bg);
}

.dg-box.accent {
  stroke: var(--accent-fill);
  stroke-width: 1.6;
}

.dg-box.branch {
  stroke: var(--branch);
  stroke-width: 1.6;
}

.dg-box.ghost {
  stroke-dasharray: 5 4;
  fill: none;
}

.dg-block {
  fill: var(--line-strong);
}

.dg-block.accent {
  fill: var(--accent-fill);
}

.dg-block.ghost {
  fill: none;
  stroke: var(--line-strong);
  stroke-dasharray: 3 3;
  stroke-width: 1.2;
}

.dg-line {
  stroke: var(--muted);
  stroke-width: 1.4;
  fill: none;
}

.dg-line.accent {
  stroke: var(--accent-fill);
}

.dg-line.branch {
  stroke: var(--branch);
}

.dg-line.dash {
  stroke-dasharray: 5 4;
}

.dg-head {
  fill: var(--muted);
}

.dg-head.accent {
  fill: var(--accent-fill);
}

.dg-head.branch {
  fill: var(--branch);
}

/* Steps */

.steps {
  list-style: none;
  counter-reset: step;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding: 0.1rem 0 0 2.6rem;
  color: var(--text);
  font-size: 0.97rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid color-mix(in srgb, var(--accent-fill) 50%, transparent);
}

.steps.branch li::before {
  background: var(--branch-soft);
  color: var(--branch);
  border-color: color-mix(in srgb, var(--branch) 50%, transparent);
}

.steps li strong {
  display: block;
}

/* Checklist and lists */

.ticks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.ticks li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.55rem;
  color: var(--text);
}

.ticks li::before {
  content: "";
  position: absolute;
  left: 0.15rem;
  top: 0.62em;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--accent-fill);
}

.ticks.branch li::before {
  background: var(--branch);
}

/* Tables */

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.section.alt .table-wrap {
  background: var(--bg);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--line);
}

thead th {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  background: var(--surface-2);
  white-space: nowrap;
}

tbody tr:last-child th,
tbody tr:last-child td {
  border-bottom: 0;
}

tbody th {
  color: var(--heading);
  font-weight: 650;
  white-space: nowrap;
}

td.verdict-good {
  color: var(--branch);
  font-weight: 600;
}

td.verdict-bad {
  color: var(--warn);
  font-weight: 600;
}

caption {
  caption-side: bottom;
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-size: 0.84rem;
  color: var(--muted);
}

/* Details / disclosure */

details.more {
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
  margin-top: 1.25rem;
}

.section.alt details.more {
  background: var(--bg);
}

details.more > summary {
  cursor: pointer;
  padding: 0.9rem 1.15rem;
  font-weight: 650;
  color: var(--heading);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

details.more > summary::-webkit-details-marker {
  display: none;
}

details.more > summary::after {
  content: "+";
  font-family: var(--mono);
  color: var(--accent);
  font-size: 1.1rem;
}

details.more[open] > summary::after {
  content: "\2212";
}

details.more > .body {
  padding: 0 1.15rem 1.15rem;
}

details.more .table-wrap {
  border-radius: var(--radius-s);
}

/* Gates */

.gates {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.gates li {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: 1rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  background: var(--surface);
}

.section.alt .gates li {
  background: var(--bg);
}

.gates .id {
  font-family: var(--mono);
  font-weight: 700;
  color: var(--heading);
  font-size: 0.95rem;
}

.gates .what strong {
  display: block;
}

.gates .what span {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
  font-weight: 600;
}

.badge.cleared {
  color: var(--branch);
  border-color: color-mix(in srgb, var(--branch) 60%, transparent);
  background: var(--branch-soft);
}

.badge.open {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 60%, transparent);
  background: var(--warn-soft);
}

@media (max-width: 560px) {
  .gates li {
    grid-template-columns: 2.6rem 1fr;
  }

  .gates .badge {
    grid-column: 2;
    justify-self: start;
  }
}

/* Link list */

.links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

.links a {
  word-break: break-word;
}

/* Code panel */

.code {
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 0.9rem 1rem;
  font-family: var(--mono);
  font-size: 0.86rem;
  overflow-x: auto;
  margin: 0 0 1rem;
  color: var(--text);
}

.code .c {
  color: var(--muted);
}

.code .k {
  color: var(--accent);
  font-weight: 600;
}

/* ---------- FAQ ---------- */

.page-head {
  border-bottom: 1px solid var(--line);
  background: var(--glow);
}

.page-head .wrap {
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.page-head .lede {
  color: var(--muted);
  max-width: 44rem;
  font-size: 1.1rem;
}

.faq-layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 3rem;
  padding-top: 3rem;
  padding-bottom: 4rem;
}

.faq-toc {
  position: sticky;
  top: 5rem;
  align-self: start;
  font-size: 0.88rem;
}

.faq-toc h2 {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.faq-toc ol {
  margin: 0;
  padding-left: 1.2rem;
  display: grid;
  gap: 0.35rem;
  color: var(--muted);
}

.faq-toc a {
  color: var(--text);
  text-decoration: none;
}

.faq-toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

@media (max-width: 900px) {
  .faq-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .faq-toc {
    position: static;
  }
}

.faq-item {
  padding: 0 0 2rem;
  margin: 0 0 2rem;
  border-bottom: 1px solid var(--line);
  max-width: 46rem;
}

.faq-item:last-child {
  border-bottom: 0;
}

.faq-item h2 {
  font-size: 1.35rem;
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
}

.faq-item p,
.faq-item li {
  color: var(--text);
}

.faq-item ul,
.faq-item ol {
  padding-left: 1.25rem;
}

.faq-item li {
  margin-bottom: 0.35rem;
}

.faq-item .short {
  font-size: 1.1rem;
  color: var(--heading);
}

.copy-link {
  flex: none;
  width: 1.4rem;
  height: 1.4rem;
  display: inline-grid;
  place-items: center;
  border-radius: 4px;
  color: var(--muted);
  text-decoration: none;
  font-family: var(--mono);
  font-size: 0.9rem;
  font-weight: 400;
}

.copy-link::before {
  content: "#";
}

.copy-link:hover,
.copy-link:focus-visible {
  color: var(--accent);
}

.copy-link[data-state="copied"]::before {
  content: "\2713";
  color: var(--branch);
}

/* ---------- Footer ---------- */

.site-footer {
  font-size: 0.9rem;
  color: var(--muted);
  padding: 3rem 0 2.5rem;
}

.site-footer .cols {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: 2rem;
}

.site-footer h2 {
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer .fine {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  font-size: 0.82rem;
}

@media (max-width: 760px) {
  .site-footer .cols {
    grid-template-columns: 1fr;
  }
}

/* ---------- Paper fallback and 404 ---------- */

.paper-fallback {
  margin: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.paper-fallback .paper-bar {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.88rem;
  background: var(--surface);
}

.paper-fallback .paper-bar .brand {
  font-size: 1rem;
}

.paper-fallback .paper-bar .brand svg {
  width: 24px;
  height: auto;
}

.paper-fallback .paper-bar .spacer {
  margin-left: auto;
}

.paper-fallback .paper-main {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.paper-fallback object {
  flex: 1 1 auto;
  width: 100%;
  border: 0;
  background: #ffffff;
}

.paper-fallback .paper-alt {
  padding: 2rem 1.25rem;
  max-width: 40rem;
  margin: 0 auto;
  color: var(--text);
  background: var(--bg);
}

.notfound {
  padding: clamp(4rem, 10vw, 8rem) 0;
}

@media print {
  .site-header,
  .status-strip,
  .site-footer,
  .actions {
    display: none;
  }

  body {
    background: #ffffff;
    color: #000000;
  }
}

/* ---------- Logo (inline SVG) ---------- */

.logo-base {
  fill: var(--muted);
}

.logo-link {
  stroke: var(--muted);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
}

.logo-ghost {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
  stroke-dasharray: 2 1.6;
}

.logo-ghost-box {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.2;
}

.logo-accent {
  fill: var(--accent-fill);
}

.logo-accent-link {
  stroke: var(--accent-fill);
  stroke-width: 1.6;
  fill: none;
  stroke-linecap: round;
}

/* ---------- Flow spacing inside sections ---------- */

.section > .wrap > * + * {
  margin-top: 2rem;
}

.section > .wrap > h3 {
  margin-top: 3rem;
}

.card .steps + p,
.card ol + p {
  margin-top: 1.1rem;
}

.callout ol {
  padding-left: 1.25rem;
}

.callout ol li {
  margin-bottom: 0.45rem;
}
