:root {
  color-scheme: light dark;
  --paper: #f3efe6;
  --paper-2: #ebe6da;
  --card: #fbf9f4;
  --ink: #1c1d1f;
  --muted: #676b71;
  --line: #d8d2c4;
  --accent: #c2410c;
  --accent-ink: #fff8f1;
  --focus: #c2410c;
  --shadow: 0 1px 0 rgba(28, 29, 31, 0.04), 0 10px 30px -18px rgba(28, 29, 31, 0.35);
  --h0: #4b6a88;
  --h1: #5a7a4a;
  --h2: #a7802e;
  --h3: #7b4f7a;
  --h4: #2f7a78;
  --h5: #9a4b3c;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #151412;
    --paper-2: #1b1a17;
    --card: #1e1c19;
    --ink: #ece7dc;
    --muted: #a19b8f;
    --line: #34312b;
    --accent: #f08a4b;
    --accent-ink: #1a0f08;
    --focus: #f5a472;
    --shadow: 0 1px 0 rgba(0, 0, 0, 0.2), 0 12px 32px -18px rgba(0, 0, 0, 0.8);
    --h0: #8fb0cf;
    --h1: #9cc184;
    --h2: #e0b861;
    --h3: #c99bc7;
    --h4: #6fc3bf;
    --h5: #e0917e;
  }
}

:root[data-theme="dark"] {
  --paper: #151412;
  --paper-2: #1b1a17;
  --card: #1e1c19;
  --ink: #ece7dc;
  --muted: #a19b8f;
  --line: #34312b;
  --accent: #f08a4b;
  --accent-ink: #1a0f08;
  --focus: #f5a472;
  --h0: #8fb0cf;
  --h1: #9cc184;
  --h2: #e0b861;
  --h3: #c99bc7;
  --h4: #6fc3bf;
  --h5: #e0917e;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  text-rendering: optimizeLegibility;
}

.wrap {
  width: min(1180px, 100% - 32px);
  margin-inline: auto;
}

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

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

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

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

.masthead {
  padding: 72px 0 40px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(1200px 400px at 85% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    var(--paper);
}

.overline {
  margin: 0 0 16px;
  font: 600 12px/1.3 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead h1 {
  margin: 0;
  font-size: clamp(2.3rem, 5.5vw, 4.4rem);
  max-width: 14ch;
}

.lede {
  max-width: 62ch;
  margin: 20px 0 0;
  font-size: 1.12rem;
  color: color-mix(in srgb, var(--ink) 82%, var(--paper));
}

.meta {
  margin: 18px 0 0;
  font: 13px/1.4 var(--mono);
  color: var(--muted);
}

.band { padding: 56px 0 8px; }

.section-head {
  display: grid;
  gap: 6px;
  margin-bottom: 22px;
}
.section-head h2 { margin: 0; font-size: clamp(1.6rem, 3vw, 2.1rem); }
.section-head p { margin: 0; color: var(--muted); max-width: 70ch; }

/* Dials */
.dials {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.dial {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.dial h3 { margin: 0 0 4px; font-size: 1.2rem; }
.dial .q { margin: 0 0 12px; font-size: 0.92rem; color: var(--muted); }

.settings { display: flex; flex-wrap: wrap; gap: 6px; }

.chip {
  --c: var(--h0);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 3px 10px;
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--c) 13%, var(--card));
  color: color-mix(in srgb, var(--c) 75%, var(--ink));
  font: 600 12.5px/1.2 var(--sans);
  white-space: nowrap;
}
.chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--c);
}
button.chip { cursor: pointer; }
button.chip[aria-pressed="true"] {
  background: var(--c);
  color: var(--card);
  border-color: var(--c);
}
button.chip[aria-pressed="true"]::before { background: var(--card); }

.c0 { --c: var(--h0); } .c1 { --c: var(--h1); } .c2 { --c: var(--h2); }
.c3 { --c: var(--h3); } .c4 { --c: var(--h4); } .c5 { --c: var(--h5); }

.setting-note {
  margin: 12px 0 0;
  min-height: 1.5em;
  font-size: 0.88rem;
  color: var(--muted);
}

/* Matrix */
.matrix-scroll {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.matrix {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.matrix th,
.matrix td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
.matrix thead th {
  font: 600 11.5px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--paper-2);
}
.matrix tbody tr:last-child td,
.matrix tbody tr:last-child th { border-bottom: 0; }
.matrix th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  white-space: nowrap;
  background: var(--card);
  box-shadow: 1px 0 0 var(--line);
}
.matrix thead th:first-child { background: var(--paper-2); }
.matrix tbody th a {
  color: inherit;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 500;
}
.matrix tbody th a:hover { text-decoration: underline; text-underline-offset: 3px; }
.matrix .num {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  font: 600 12px/1 var(--sans);
}

.is-dimmed { opacity: 0.28; transition: opacity 0.2s; }

/* Cards */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 520px), 1fr));
  gap: 22px;
}

.card {
  display: grid;
  grid-template-rows: auto 1fr;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: opacity 0.2s, transform 0.2s;
}
.card.is-dimmed { transform: scale(0.99); }

.thumb {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10;
  background: var(--paper-2);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}
.thumb img.desktop {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.thumb img.mobile {
  position: absolute;
  right: 14px;
  bottom: -38%;
  width: 22%;
  aspect-ratio: 390 / 844;
  object-fit: cover;
  object-position: top;
  border-radius: 12px;
  border: 3px solid var(--ink);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  transition: bottom 0.3s;
}
.thumb:hover img.mobile,
.thumb:focus-visible img.mobile { bottom: 10px; }

.placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
  background:
    repeating-linear-gradient(135deg, transparent 0 14px, color-mix(in srgb, var(--line) 45%, transparent) 14px 15px),
    var(--paper-2);
}
.placeholder b {
  font: 500 clamp(2.5rem, 7vw, 4.5rem)/1 var(--serif);
  color: var(--ink);
}

.card-body {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px 20px 20px;
}

.card-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0;
  font-size: 1.55rem;
}
.card-title .n {
  font: 600 13px/1 var(--mono);
  color: var(--accent);
}

.hypothesis {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.12rem;
  font-style: italic;
}
.summary { margin: 0; color: var(--muted); }

.card .settings { gap: 5px; }
.card .chip { font-size: 11.5px; min-height: 24px; padding: 2px 8px; }

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  font: 12.5px/1.5 var(--mono);
  color: var(--muted);
}
.facts span { white-space: nowrap; }
.facts .warn { color: var(--accent); }

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
}
.status.built::before { background: #2f9e62; }
.status.failed::before { background: #c0392b; }
.status.starter::before,
.status.unbuilt::before,
.status.missing::before { background: #c7a13a; }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: var(--paper);
  font: 600 14px/1 var(--sans);
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: color-mix(in srgb, var(--ink) 85%, var(--accent)); }
.button.quiet {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.button.quiet:hover { border-color: var(--ink); }
.button[aria-disabled="true"] { opacity: 0.45; pointer-events: none; }

.compare-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 14px;
  cursor: pointer;
}
.compare-toggle input { width: 16px; height: 16px; accent-color: var(--accent); }

.reaction {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.reaction-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
.reaction-buttons button {
  min-height: 34px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: 600 13px/1 var(--sans);
  cursor: pointer;
}
.reaction-buttons button[aria-pressed="true"] {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.reaction textarea {
  width: 100%;
  min-height: 64px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: 14px/1.45 var(--sans);
  resize: vertical;
}

/* Compare */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.compare-pane {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--card);
  box-shadow: var(--shadow);
}
.compare-pane header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 1.1rem;
}
.compare-pane header a { font: 600 13px/1 var(--sans); color: var(--accent); }
.compare-pane iframe {
  width: 100%;
  height: min(78vh, 900px);
  border: 0;
  background: #fff;
}

/* Release */
.release {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 14px;
}
.release article {
  display: grid;
  gap: 8px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.release h3 { margin: 0; font-size: 1.2rem; }
.release dl { margin: 0; display: grid; gap: 6px; }
.release dt {
  font: 600 11px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.release dd { margin: 0 0 4px; }
.release .tested { font-size: 0.88rem; color: var(--muted); }

/* Promises */
.promises {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  gap: 12px;
  padding: 0;
  margin: 0;
  list-style: none;
  counter-reset: promise;
}
.promises li {
  position: relative;
  padding: 16px 18px 16px 54px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  counter-increment: promise;
}
.promises li::before {
  content: counter(promise);
  position: absolute;
  left: 16px;
  top: 15px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--accent);
  color: var(--accent);
  font: 600 13px/1 var(--mono);
}
.promises strong { display: block; font-family: var(--serif); font-size: 1.12rem; font-weight: 500; }
.promises p { margin: 4px 0 0; }
.promises .where { font-size: 0.88rem; color: var(--muted); }

/* Notes */
.notes-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.copy-status { font-size: 0.9rem; color: var(--muted); }
.notes-preview {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: 13px/1.5 var(--mono);
  resize: vertical;
}

.footer {
  margin-top: 56px;
  padding: 22px 0 48px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.9rem;
}

@media (max-width: 760px) {
  .masthead { padding-top: 48px; }
  .band { padding-top: 44px; }
  .compare-grid { grid-template-columns: 1fr; }
  .compare-pane iframe { height: 70vh; }
  .thumb img.mobile { bottom: 10px; width: 24%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* Videos */
.videos { display: grid; gap: 8px; }
.videos-label,
.videos-empty {
  margin: 0;
  font: 600 11.5px/1.2 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.video-strip {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px;
}
.video-thumb {
  position: relative;
  display: grid;
  grid-template-rows: auto auto;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: var(--paper-2);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}
.video-thumb img,
.video-fallback {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: grid;
  place-items: center;
  font-size: 22px;
  color: var(--muted);
}
.video-thumb::after {
  content: "▶";
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
}
.video-thumb:hover { border-color: var(--ink); }
.video-caption { display: grid; gap: 2px; padding: 7px 9px 8px; }
.video-title { font: 600 13px/1.25 var(--sans); }
.video-info { font: 11.5px/1.3 var(--mono); color: var(--muted); }

.player {
  width: min(1100px, calc(100% - 24px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
}
.player::backdrop { background: rgba(10, 10, 12, 0.72); }
.player-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.player-head h2 { margin: 0; font-size: 1.15rem; }
.player video { display: block; width: 100%; max-height: 72vh; background: #000; }
.player-meta { margin: 0; padding: 10px 14px 12px; font: 12px/1.4 var(--mono); color: var(--muted); overflow-wrap: anywhere; }
