:root {
  --paper: #f3efe6;
  --paper-2: #ebe4d6;
  --card: #fffaf4;
  --ink: #1a1f27;
  --muted: #4a433c;
  --line: #e0d5c4;
  --brand: #f4e7d4;
  --stroke: #3a2a22;
  --allow: #1f6b4a;
  --warn: #8a5a12;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Segoe UI", ui-sans-serif, system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  color: var(--ink);
  background: var(--paper);
  font: 18px/1.55 var(--sans);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); overflow-x: clip; }
::selection { background: var(--brand); color: var(--stroke); }
button, input { font: inherit; color: inherit; }
a { color: var(--allow); }
img, svg { display: block; }

.skip {
  position: absolute;
  left: 12px;
  top: -48px;
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 8px;
  z-index: 20;
}
.skip:focus { top: 12px; }

.wrap { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  backdrop-filter: blur(16px);
}
.top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 76px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
  flex: 0 0 auto;
}
.brand svg { width: 40px; height: 40px; }
.brand-name {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.brand-sub { display: block; margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.2; }
.nav { display: flex; gap: 18px; min-width: 0; overflow-x: auto; }
.nav a {
  color: var(--ink);
  text-decoration: none;
  text-underline-offset: 0.35em;
  white-space: nowrap;
  font-size: 15px;
}
.nav a:hover,
.nav a[aria-current="page"] { color: var(--allow); text-decoration: underline; }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 400px);
  gap: 36px 56px;
  align-items: center;
  padding: 72px 0 8px;
  background: radial-gradient(460px 360px at 100% 0%, var(--brand), transparent 70%);
}
.kicker {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
h1, h2, h3, .fact-value { font-family: var(--serif); letter-spacing: -0.02em; }
h1 {
  margin: 12px 0 18px;
  max-width: 10em;
  font-size: clamp(42px, 4.8vw, 68px);
  font-weight: 600;
  line-height: 1.02;
  text-wrap: balance;
}
.lead { margin: 0; max-width: 36em; font-size: 20px; line-height: 1.5; }
.firm { margin: 14px 0 0; max-width: 38em; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.button, .button-quiet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 18px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
}
.button { background: var(--allow); color: #fff; }
.button:hover,
.allow:hover { background: color-mix(in srgb, var(--allow) 86%, #000); }
.button-quiet { color: var(--ink); border: 1px solid var(--line); background: var(--card); }
.button-quiet:hover { border-color: var(--stroke); }

.facts {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  overflow: hidden;
}
.fact {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px 16px;
  text-decoration: none;
  color: inherit;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
.fact:last-child { border-bottom: 0; }
.fact:hover { background: color-mix(in srgb, var(--paper-2) 70%, var(--card)); }
.fact-kicker { color: var(--muted); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; }
.fact-value {
  display: block;
  font-size: clamp(32px, 3vw, 44px);
  font-weight: 600;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}
.fact:hover .fact-value { color: var(--allow); }
.fact-note { color: var(--muted); font-size: 14px; }
.fact-go { color: var(--allow); font-size: 14px; font-weight: 600; margin-top: 2px; }
.fact-go::after { content: " →"; }

.block { margin-top: 96px; }
.block h2 {
  margin: 8px 0 18px;
  max-width: 14em;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  font-size: clamp(34px, 4vw, 52px);
  font-weight: 600;
  line-height: 1.08;
  text-wrap: balance;
}
.intro { margin: 0 0 22px; max-width: 40em; color: var(--muted); }
section[id] { scroll-margin-top: 92px; }

.chapter,
.band {
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  padding-right: calc(50vw - 50%);
  padding-left: calc(50vw - 50%);
}
.chapter {
  margin-top: 96px;
  padding-top: 64px;
  padding-bottom: 68px;
  background: var(--paper-2);
}
.band {
  margin-top: 96px;
  padding-top: 72px;
  padding-bottom: 72px;
  background: var(--stroke);
  color: var(--brand);
}
.band .kicker,
.band .intro,
.band h2 { color: var(--brand); }
.band h2 { border-bottom-color: color-mix(in srgb, var(--brand) 35%, transparent); }
.band .quiet { color: color-mix(in srgb, var(--brand) 82%, transparent); }
.band .quiet a { color: var(--paper); font-weight: 600; text-underline-offset: 0.22em; }
.band :focus-visible { outline-color: var(--paper); }

.stage {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  min-width: 0;
}
.case-list { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.case {
  text-align: left;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 11px 12px 11px 14px;
  cursor: pointer;
  min-height: 44px;
}
.case-title { display: block; font-weight: 600; }
.case-hint { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; line-height: 1.35; }
.case[aria-selected="true"] {
  background: var(--card);
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--allow);
}
.case:hover { border-color: var(--line); background: color-mix(in srgb, var(--card) 72%, transparent); }

.window {
  display: grid;
  grid-template-columns: 188px minmax(0, 1fr);
  min-width: 0;
  min-height: 560px;
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--stroke) 20%, var(--line));
  border-radius: 22px;
  overflow: hidden;
  box-shadow:
    inset 0 1px 0 rgba(255, 250, 244, 0.9),
    0 24px 50px rgba(58, 42, 34, 0.1),
    0 2px 8px rgba(58, 42, 34, 0.05);
}
.rail {
  padding: 16px 12px;
  background: var(--paper-2);
  border-right: 1px solid var(--line);
}
.rail-label {
  margin: 14px 8px 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.rail-item {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 14px;
}
.rail-item.is-on { background: var(--card); box-shadow: inset 2px 0 0 var(--allow); }
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 560px; }
.chat-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
}
.chat-top strong { font-weight: 600; }
.pill {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--stroke);
  font-size: 13px;
}
.thread {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  min-height: 280px;
}
.bubble-user {
  align-self: flex-end;
  max-width: min(460px, 100%);
  margin: 0;
  padding: 10px 14px;
  background: var(--brand);
  color: var(--stroke);
  border-radius: 16px 16px 4px 16px;
}
.tool {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}
.tool span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--allow);
  flex: 0 0 auto;
}
.bubble-answer {
  min-width: 0;
  max-width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
}
.answer-lead { margin: 0 0 10px; }
.note { margin: 10px 0 0; color: var(--muted); font-size: 16px; }
.sheet { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 16px;
}
th {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.num { text-align: right; white-space: nowrap; }
.permit { margin-top: 4px; }
.permit-head { display: flex; align-items: center; gap: 8px; }
.permit-head h3 { margin: 0; font-family: var(--sans); font-size: 17px; font-weight: 600; letter-spacing: 0; }
.permit-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f4e0b8;
  color: var(--warn);
  font-weight: 700;
}
.permit-warn { margin: 10px 0; color: var(--warn); }
.permit-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.deny, .allow, .replay {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  cursor: pointer;
}
.deny, .replay { background: transparent; border: 1px solid var(--line); }
.allow { background: var(--allow); color: #fff; border: 0; font-weight: 600; }
.outcome {
  margin-top: 8px;
  padding: 12px;
  border-radius: 12px;
  background: var(--paper);
  border-left: 3px solid var(--stroke);
}
.outcome p { margin: 0; }
.outcome.is-allow { border-left-color: var(--allow); }
.replay { margin-top: 10px; }
.composer {
  margin: 0 14px 8px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}
.composer span {
  display: block;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.composer p { margin: 4px 0 0; overflow-wrap: anywhere; }
.composer-note { margin: 0 16px 14px; color: var(--muted); font-size: 13px; }

.fear-grid { counter-reset: fear; }
.fear-grid, .limit-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; }
.limit-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.connect-grid {
  counter-reset: step;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.fear, .card {
  margin: 0;
  padding: 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
}
.fear { counter-increment: fear; }
.fear:nth-child(3n + 1) { grid-column: 1 / -1; }
.fear::before {
  content: counter(fear, decimal-leading-zero);
  display: block;
  margin-bottom: 14px;
  color: var(--stroke);
  font-family: var(--serif);
  font-size: 32px;
  line-height: 1;
}
.fear:nth-child(3n + 1) {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  column-gap: 22px;
  align-items: start;
}
.fear:nth-child(3n + 1)::before {
  grid-row: 1 / span 2;
  margin: 2px 0 0;
  font-size: 44px;
}
.fear:nth-child(3n + 1) h3,
.fear:nth-child(3n + 1) p { grid-column: 2; }
.fear h3, .card h3 { margin: 0 0 8px; font-size: 26px; font-weight: 600; line-height: 1.2; }
.fear p, .card p { margin: 0; color: var(--muted); }
.connect-grid .card { counter-increment: step; position: relative; padding: 22px 22px 22px 78px; }
.connect-grid .card::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 22px;
  top: 22px;
  color: var(--stroke);
  font-family: var(--serif);
  font-size: 28px;
  line-height: 1;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.chips li {
  padding: 7px 12px;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 15px;
}
.limit-grid .card { border-top-width: 3px; }
.limit-grid .card:nth-child(1) { border-top-color: var(--allow); }
.limit-grid .card:nth-child(2) { border-top-color: var(--warn); }
.limit-grid .card:nth-child(3) { border-top-color: var(--stroke); }
.limit-note { margin: 14px 0 0; max-width: 46em; }

.band #downloads {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  color: var(--brand);
  list-style: none;
}
.band #downloads a {
  display: inline-flex;
  align-items: center;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 12px;
  background: var(--allow);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}
.band #downloads a:hover { background: color-mix(in srgb, var(--allow) 86%, #000); }
.downloads { display: flex; flex-wrap: wrap; gap: 10px; margin: 16px 0 8px; }
.quiet { color: var(--muted); }

.doc { padding: 28px 0 80px; }
.doc h1 { margin-top: 18px; }
.doc h2 {
  margin: 48px 0 8px;
  font-size: clamp(28px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.15;
}
.doc p,
.doc li { max-width: 42em; }
.doc ul,
.doc ol { max-width: 44em; padding-left: 1.2em; }
.doc li { margin: 8px 0; }
#list { margin-top: 12px; }
#list > p { color: var(--muted); }
#list article { margin-top: 8px; padding: 8px 0 4px; border-top: 1px solid var(--line); }
#list h2 { margin: 22px 0 8px; }
#list h3 {
  margin: 18px 0 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.foot {
  margin-top: 0;
  padding: 36px 0 64px;
  color: var(--muted);
  font-size: 14px;
}
.foot p { margin: 0; max-width: 46em; }

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

@media (max-width: 900px) {
  .hero, .stage, .window, .fear-grid, .limit-grid, .connect-grid { grid-template-columns: 1fr; }
  .hero { padding-top: 36px; background-position: 100% 0; }
  .top-row {
    flex-wrap: wrap;
    align-items: flex-start;
    min-height: 0;
    padding: 12px 0;
  }
  .nav {
    width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    row-gap: 6px;
    column-gap: 14px;
  }
  .case-list {
    flex-direction: row;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 4px;
  }
  .case { flex: 0 0 auto; scroll-snap-align: start; white-space: nowrap; }
  .case-hint { display: none; }
  .rail { display: none; }
  .window, .chat { min-height: 0; }
  h1 { max-width: none; }
  section[id] { scroll-margin-top: 180px; }
  .fear:nth-child(3n + 1) { grid-column: auto; }
}

@media (max-width: 520px) {
  .wrap { width: min(1120px, calc(100% - 24px)); }
  .permit-actions { flex-direction: column; }
  .deny, .allow { width: 100%; }
  .block, .chapter, .band { margin-top: 64px; }
  .chapter, .band { padding-top: 40px; padding-bottom: 44px; }
  .fear:nth-child(3n + 1) { display: block; }
  .fear:nth-child(3n + 1)::before { font-size: 32px; }
  .connect-grid .card { padding-left: 22px; }
  .connect-grid .card::before { position: static; display: block; margin-bottom: 10px; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .hero h1,
  .hero .lead,
  .facts,
  .doc > h1 {
    animation: rise 0.75s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .hero .lead { animation-delay: 70ms; }
  .facts { animation-delay: 120ms; }
  .button:hover,
  .allow:hover { transform: translateY(-1px); }

  @supports (animation-timeline: view()) {
    .block {
      animation: rise linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 30%;
    }
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
