/*
 * suddendeath.localhost — noir.
 * Charcoal and navy, one red. Large type on purpose: J reads with low vision,
 * so the root is 19px (118.75%) and body copy lands near 20px.
 * Mobile first: base rules are the phone layout, media queries widen it.
 */

:root {
  --bg: #0d1016;
  --bg-2: #121722;
  --panel: #171d2a;
  --line: #262f42;
  --ink: #ebe7df;
  --ink-2: #c5c9d3;
  --muted: #9aa2b3;
  --red: #d7263d;
  --red-deep: #8e1222;
  --gold: #d9b26a;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Helvetica Neue", "Segoe UI", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --gutter: 16px;
  --max: 1200px;
}

* { box-sizing: border-box; }

html {
  font-size: 118.75%;           /* 19px */
  background: var(--bg);
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.0526rem;         /* about 20px */
  line-height: 1.6;
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(40, 60, 110, .35), transparent 60%),
    var(--bg);
  overflow-x: hidden;
  overflow-wrap: anywhere;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--ink); text-decoration-color: var(--red); text-underline-offset: .18em; }
a:hover, a:focus-visible { color: #fff; text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.muted { color: var(--muted); }

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

/* ---------- top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .6rem var(--gutter);
  background: rgba(13, 16, 22, .92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  font-family: var(--sans);
}
.brand {
  font-weight: 800; letter-spacing: .08em; text-decoration: none;
  font-size: .88rem; white-space: nowrap;
}
.brand span, .title span { color: var(--red); }
.bar nav { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: flex-end; }
.bar nav a { font-size: .84rem; text-decoration: none; color: var(--ink-2); padding: .25rem 0; }
.bar nav a:hover { color: #fff; box-shadow: inset 0 -2px 0 var(--red); }

/* ---------- title page ---------- */
.hero {
  min-height: calc(100vh - 3.2rem);
  min-height: calc(100svh - 3.2rem);
  display: flex; flex-direction: column; justify-content: center;
  padding: 3rem var(--gutter) 4rem;
  max-width: var(--max); margin: 0 auto;
}
.kicker {
  font-family: var(--sans); text-transform: uppercase; letter-spacing: .22em;
  font-size: .8rem; color: var(--muted); margin: 0 0 .8rem;
}
.title {
  font-family: var(--sans); font-weight: 900;
  /* Sized by viewport width so the one word always fits on one line. The body's
     overflow-wrap:anywhere would otherwise split it as SUDDENDEAT / H. */
  font-size: clamp(1.9rem, 10.6vw, 7rem);
  line-height: .9; letter-spacing: .02em; margin: 0;
  white-space: nowrap; overflow-wrap: normal;
  text-shadow: 0 0 40px rgba(215, 38, 61, .18);
}
.rule { width: 5rem; height: 4px; background: var(--red); margin: 1.6rem 0 1.4rem; }
.logline {
  font-size: clamp(1.2rem, 4.6vw, 1.75rem);
  line-height: 1.45; max-width: 38em; margin: 0 0 1.6rem; color: var(--ink);
}
.facts {
  list-style: none; padding: 0; margin: 0 0 2rem;
  display: flex; flex-wrap: wrap; gap: .4rem 1.4rem;
  font-family: var(--sans); font-size: .9rem; color: var(--muted);
}
.facts strong { color: var(--ink); }
.cta { display: flex; flex-wrap: wrap; gap: .75rem; margin: 0; }
.btn {
  font-family: var(--sans); font-weight: 700; font-size: .95rem;
  text-decoration: none; padding: .75rem 1.3rem; border-radius: 3px;
  background: var(--red); color: #fff; border: 2px solid var(--red);
}
.btn:hover { background: var(--red-deep); border-color: var(--red-deep); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--red); }

/* ---------- section titles ---------- */
.board, .bible { padding: 3.5rem 0; border-top: 1px solid var(--line); }
.bible { background: linear-gradient(180deg, var(--bg-2), var(--bg) 30rem); }
.sec-title {
  font-family: var(--sans); font-weight: 900; text-transform: uppercase;
  letter-spacing: .12em; font-size: clamp(1.6rem, 6vw, 2.6rem); margin: 0 0 .6rem;
}
.sec-title::after { content: ""; display: block; width: 3rem; height: 3px; background: var(--red); margin-top: .6rem; }
.lede { color: var(--ink-2); max-width: 40em; margin: 0 0 2rem; }

/* ---------- storyboard ---------- */
.act {
  font-family: var(--sans); font-size: 1.15rem; letter-spacing: .1em; text-transform: uppercase;
  margin: 2.6rem 0 1.2rem; color: var(--ink-2);
  display: flex; align-items: baseline; gap: .7rem; flex-wrap: wrap;
}
.act-n { color: var(--red); font-weight: 900; }
.grid { display: grid; grid-template-columns: 1fr; gap: 1.6rem; }
.panel {
  margin: 0; background: var(--panel); border: 1px solid var(--line);
  border-radius: 4px; overflow: hidden;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .45);
}
.frame { aspect-ratio: 16 / 9; background: #05070b; border-bottom: 1px solid var(--line); }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.pending {
  height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .2rem;
  font-family: var(--sans); color: var(--muted); text-align: center; padding: 1rem;
  background: repeating-linear-gradient(135deg, #0a0d13 0 14px, #0d1119 14px 28px);
}
.pending span { text-transform: uppercase; letter-spacing: .2em; font-size: .85rem; color: var(--ink-2); }
.pending small { font-size: .8rem; }
.panel figcaption { padding: 1rem 1.1rem 1.2rem; }
.meta { display: flex; flex-wrap: wrap; align-items: center; gap: .45rem; margin: 0 0 .35rem; font-family: var(--sans); }
.pid { font-family: var(--mono); font-size: .85rem; color: var(--red); font-weight: 700; }
.chip {
  font-family: var(--sans); font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  padding: .12rem .5rem; border: 1px solid var(--line); border-radius: 99px; color: var(--muted);
  white-space: nowrap;
}
.chip.tower { color: var(--gold); border-color: rgba(217, 178, 106, .45); }
.chip.note { color: #fff; background: var(--red-deep); border-color: var(--red-deep); }
.panel h4 { font-family: var(--sans); font-size: 1.15rem; margin: 0 0 .4rem; line-height: 1.25; }
.caption { font-style: italic; color: var(--ink-2); margin: 0 0 .6rem; }
details > summary {
  cursor: pointer; font-family: var(--sans); font-size: .88rem; color: var(--muted);
  padding: .3rem 0; list-style-position: inside;
}
details > summary:hover { color: var(--ink); }
.panel dl { margin: .5rem 0 0; font-size: .95rem; }
.panel dt { font-family: var(--sans); font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red); margin-top: .6rem; }
.panel dd { margin: .15rem 0 0; color: var(--ink-2); }
.board-notes { margin-top: 2.6rem; padding: 1rem 1.1rem; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.board-notes > summary { font-size: 1rem; color: var(--ink); }

/* ---------- bible ---------- */
.bible-layout { display: block; }
.side { display: none; }
.toc-mobile {
  margin: 0 0 1.6rem; padding: .7rem 1rem; background: var(--panel);
  border: 1px solid var(--line); border-radius: 4px;
}
.toc-mobile > summary { font-size: 1rem; color: var(--ink); font-weight: 700; }
.toc-head {
  font-family: var(--sans); font-size: .75rem; letter-spacing: .18em; text-transform: uppercase;
  color: var(--red); margin: 1.1rem 0 .4rem;
}
.toc-list, .toc-sub { list-style: none; margin: 0; padding: 0; }
.toc-list > li > a {
  display: flex; gap: .55rem; padding: .38rem .5rem; border-radius: 3px;
  text-decoration: none; font-family: var(--sans); font-size: .92rem; line-height: 1.3; color: var(--ink-2);
}
.toc-list > li > a:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.toc-list > li.on > a { background: rgba(215, 38, 61, .14); color: #fff; box-shadow: inset 3px 0 0 var(--red); }
.num { font-family: var(--mono); font-size: .8rem; color: var(--muted); min-width: 1.4rem; padding-top: .1rem; }
.toc-sub { margin: .2rem 0 .5rem 2.3rem; border-left: 1px solid var(--line); }
.toc-sub a { display: block; padding: .2rem .7rem; font-family: var(--sans); font-size: .84rem; color: var(--muted); text-decoration: none; }
.toc-sub a:hover { color: #fff; }

.doc { min-width: 0; max-width: 46em; }
.doc-meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1rem; align-items: center;
  font-family: var(--sans); font-size: .82rem; color: var(--muted); margin: 0 0 1rem;
}

/* rendered Markdown */
.md h1, .md h2, .md h3, .md h4, .md h5, .md h6 { font-family: var(--sans); line-height: 1.2; scroll-margin-top: 4rem; }
.md h1 { font-size: clamp(1.6rem, 6vw, 2.3rem); margin: .2rem 0 1.2rem; }
.md h2 { font-size: 1.45rem; margin: 2.4rem 0 .8rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.md h3 { font-size: 1.2rem; margin: 1.8rem 0 .6rem; color: var(--ink); }
.md h4, .md h5, .md h6 { font-size: 1.05rem; margin: 1.4rem 0 .5rem; color: var(--ink-2); }
.md p { margin: 0 0 1.05rem; }
.md ul, .md ol { margin: 0 0 1.1rem; padding-left: 1.4rem; }
.md li { margin: .3rem 0; }
.md li > ul, .md li > ol { margin: .3rem 0 .4rem; }
.md ul li::marker { color: var(--red); }
.md strong { color: #fff; }
.md em { color: var(--ink); }
.md code {
  font-family: var(--mono); font-size: .86em; background: #0a0d13; border: 1px solid var(--line);
  padding: .05em .35em; border-radius: 3px; color: var(--gold);
}
.md pre { background: #0a0d13; border: 1px solid var(--line); border-radius: 4px; padding: 1rem; overflow-x: auto; }
.md pre code { background: none; border: 0; padding: 0; color: var(--ink-2); overflow-wrap: normal; }
.md blockquote { margin: 0 0 1.1rem; padding: .2rem 0 .2rem 1rem; border-left: 3px solid var(--red); color: var(--ink-2); }
.md hr { border: 0; height: 1px; background: var(--line); margin: 2rem 0; }
.md del { color: var(--muted); }
/* Tables scroll inside their own box so the page never scrolls sideways at 390px. */
.tbl { overflow-x: auto; margin: 0 0 1.3rem; border: 1px solid var(--line); border-radius: 4px; -webkit-overflow-scrolling: touch; }
.md table { border-collapse: collapse; width: 100%; font-size: .92rem; font-family: var(--sans); }
.md th, .md td { padding: .5rem .7rem; border-bottom: 1px solid var(--line); vertical-align: top; text-align: left; overflow-wrap: normal; min-width: 6rem; }
.md th { background: #0f141e; color: #fff; font-weight: 700; white-space: nowrap; }
.md tbody tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }
.md .al-center { text-align: center; }
.md .al-right { text-align: right; }

.pager {
  display: grid; grid-template-columns: 1fr; gap: .8rem;
  margin: 3rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--line);
}
.pager a {
  display: block; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: 4px;
  text-decoration: none; font-family: var(--sans); font-size: .95rem; background: var(--panel);
}
.pager a:hover { border-color: var(--red); }
.pager small { display: block; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--red); }
.pager .next { text-align: right; }

/* ---------- footer ---------- */
.foot {
  border-top: 2px solid var(--red-deep);
  padding: 2rem var(--gutter) 3rem; max-width: var(--max); margin: 0 auto;
  font-family: var(--sans); font-size: .9rem;
}
.fiction { color: var(--ink-2); max-width: 46em; margin: 0 0 .6rem; }
.fiction strong { color: var(--red); letter-spacing: .04em; }

/* ---------- wider screens ---------- */
@media (min-width: 640px) {
  :root { --gutter: 28px; }
  .pager { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1000px) {
  .toc-mobile { display: none; }
  .bible-layout { display: grid; grid-template-columns: 19rem minmax(0, 1fr); gap: 2.6rem; align-items: start; }
  .side {
    display: block; position: sticky; top: 3.6rem;
    max-height: calc(100vh - 4.6rem); overflow-y: auto; padding-right: .4rem;
  }
  .side .toc-head:first-child { margin-top: 0; }
}
@media (min-width: 1240px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 640px) {
  .brand { letter-spacing: .14em; font-size: .95rem; }
  .bar nav { gap: 1rem; }
  .bar nav a { font-size: .9rem; }
}
/* Land below the sticky bar when a ?doc= link jumps here. */
#doc, #storyboard, #bible { scroll-margin-top: 3.4rem; }
/* Docs separate sections with --- and the h2 already draws a rule; show one line, not two. */
.md hr + h2 { border-top: 0; padding-top: 0; margin-top: 0; }
