@font-face { font-family: "Atkinson Hyperlegible"; src: url(fonts/atk-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Atkinson Hyperlegible"; src: url(fonts/atk-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Zilla Slab"; src: url(fonts/zilla-700.woff2) format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --paper: #F3EEE3;
  --ink: #1D2330;
  --red: #CF4630;
  --teal: #1E6B73;
  --mustard: #E9C979;
  --rose: #EDB3B8;
  --slate: #B9C3CC;
  --body: 20px;
  --fade: 150ms;
  --bar-h: 52px;
  --nav-h: 76px;
}
@media (prefers-reduced-motion: reduce) { :root { --fade: 0ms; } }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible", system-ui, sans-serif;
  font-size: var(--body);
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}
/* honest newsprint: a faint fibre speckle, no gradient */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .11  0 0 0 0 .14  0 0 0 0 .19  0 0 0 .09 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body.past { background: #DCE3DE; }
body.past::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
  border: 8px solid var(--teal);
}

#app { position: relative; z-index: 1; display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ---------- top bar: thin and always the same */
.bar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 8px;
  min-height: var(--bar-h); padding: 6px max(12px, env(safe-area-inset-left)) 6px max(12px, env(safe-area-inset-right));
  border-bottom: 2px solid var(--ink); background: var(--paper);
  font-size: 15px; line-height: 1.25;
}
body.past .bar { background: #DCE3DE; border-bottom-color: var(--teal); }
.where { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.bar-ch { font-family: "Zilla Slab", Georgia, serif; font-weight: 700; font-size: 17px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-pg { font-size: 14px; }
.barbtn {
  font: inherit; font-weight: 700; color: var(--ink); background: transparent;
  border: 2px solid var(--ink); border-radius: 6px; min-height: 40px; min-width: 40px; padding: 0 10px; cursor: pointer;
}
.sizes { display: flex; gap: 4px; }
.size { padding: 0 6px; min-width: 38px; }
.size[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.barbtn:focus-visible { background: var(--red); color: var(--paper); border-color: var(--ink); }
:focus-visible { outline: 4px solid var(--ink); outline-offset: 3px; }

/* ---------- page */
#page {
  flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; outline: none;
  padding: 20px max(18px, env(safe-area-inset-left)) 28px;
  transition: opacity var(--fade) linear;
}
#page.fading { opacity: 0; }
.col { max-width: 640px; margin: 0 auto; }
.col > * + * { margin-top: 18px; }
p { margin: 0; max-width: 60ch; text-align: left; }

h1, h2, h3 { font-family: "Zilla Slab", Georgia, serif; font-weight: 700; line-height: 1.1; margin: 0; }
.chapnum { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 6px; }
.chapnum .n { font-family: "Zilla Slab", Georgia, serif; font-size: 120px; line-height: .8; color: var(--red);
  text-shadow: 2px 2px 0 rgba(29,35,48,.18); }
.chapnum h1 { font-size: 34px; padding-bottom: 4px; }
.chapnum .of { display: block; font-family: "Atkinson Hyperlegible", sans-serif; font-size: 15px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 4px; }

.note { font-weight: 700; font-size: .8em; letter-spacing: .04em; text-transform: uppercase; border-bottom: 2px solid var(--ink); padding-bottom: 2px; display: inline-block; }
body.past .note { border-color: var(--teal); color: var(--teal); }
.warn { border: 2px solid var(--ink); border-left: 10px solid var(--slate); padding: 10px 14px; font-size: .9em; }

/* ---------- dialogue: one block per spoken line, tag on the left */
.say { display: grid; grid-template-columns: 58px 1fr; gap: 12px; align-items: start; }
.say .face { width: 58px; height: 58px; border: 2px solid var(--ink); object-fit: cover; display: block; background: var(--slate); }
.say .who { display: flex; align-items: center; gap: 8px; font-weight: 700; line-height: 1.2; margin-bottom: 2px; flex-wrap: wrap; }
.say .how { font-weight: 700; font-size: 14px; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 6px; text-transform: uppercase; letter-spacing: .05em; }
.say .line { border-left: 4px solid var(--c, var(--ink)); padding-left: 12px; }
.mark { width: 20px; height: 20px; flex: 0 0 20px; display: inline-block; }

/* ---------- pictures */
figure { margin: 0; }
.pic { position: relative; border: 2px solid var(--ink); background: var(--paper); }
.pic img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
body.past .pic { border-color: var(--teal); }
figcaption { font-size: .85em; margin-top: 6px; font-weight: 700; }
figcaption .tagp { display: inline-block; margin-right: 6px; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; background: var(--ink); color: var(--paper); padding: 0 6px; border-radius: 3px; vertical-align: 2px; }
body.past figcaption .tagp { background: var(--teal); }

/* ---------- chips */
.chips-label { font-size: .75em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 6px !important; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0; }
.chips li { border: 1.5px solid var(--ink); border-radius: 6px; padding: 2px 10px; font-size: max(17px, .85em); line-height: 1.4; background: var(--paper); }

/* ---------- banners */
.banner { background: var(--teal); color: var(--paper); font-family: "Zilla Slab", Georgia, serif; font-weight: 700; font-size: 24px; padding: 10px 16px; letter-spacing: .02em; }
.banner.end { background: var(--paper); color: var(--teal); border: 3px solid var(--teal); }

/* ---------- cards */
.cards { display: grid; gap: 14px; }
.card { display: flow-root; border: 2px solid var(--ink); background: var(--paper); padding: 10px; }
.card .por { float: left; margin: 0 14px 6px 0; width: 112px; height: 112px; border: 2px solid var(--ink); object-fit: cover; display: block; }
.card .por.sock { object-fit: contain; background: var(--paper); }
.card h3 { font-size: 24px; display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.card h3 .mark { flex-shrink: 0; }
.card dl { margin: 0; font-size: max(17px, .82em); line-height: 1.4; }
.card dt { font-weight: 700; display: inline; }
.card dt::after { content: ": "; }
.card dd { display: inline; margin: 0; }
.card dd::after { content: ""; display: block; margin-bottom: 3px; }
.card .look { margin-top: 4px; font-size: max(17px, .82em); line-height: 1.4; }
@media (max-width: 420px) {
  .card .por { width: 84px; height: 84px; margin-right: 10px; }
  .card h3 { font-size: 21px; }
}

.place { border: 2px solid var(--ink); background: var(--paper); }
.place img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-bottom: 2px solid var(--ink); }
.place .pbody { padding: 12px 14px; }
.place h2 { font-size: 26px; margin-bottom: 8px; }
.place p + p { margin-top: 4px; }
.place b { display: block; line-height: 1.3; margin-top: 6px; }
body.past .place, body.past .place img { border-color: var(--teal); }
.places-mini { display: grid; gap: 14px; }

/* ---------- choices */
.choices { margin-top: 26px !important; border-top: 2px solid var(--ink); padding-top: 14px; }
.choices h2 { font-size: 22px; margin-bottom: 10px; }
.choice {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  font: inherit; font-weight: 700; color: var(--ink); background: var(--paper);
  border: 2px solid var(--ink); border-radius: 8px; padding: 12px 16px; min-height: 60px; cursor: pointer;
}
.choice + .choice { margin-top: 10px; }
.choice .num { flex: 0 0 auto; font-family: "Zilla Slab", Georgia, serif; font-size: 1.1em; }
.choice:focus-visible { background: var(--red); color: var(--paper); }
.choice:focus-visible { outline: 5px solid var(--ink); outline-offset: 3px; }
.choice[aria-pressed="true"], .choice[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); }
.chosen { margin-top: 12px !important; font-weight: 700; border-left: 6px solid var(--red); padding-left: 10px; }
.hint { margin-top: 10px !important; font-size: .85em; }

/* ---------- cover + how */
.cover-title { font-family: "Zilla Slab", Georgia, serif; font-size: clamp(76px, 22vw, 132px); line-height: .85; margin: 0; letter-spacing: -.01em; text-shadow: 2px 2px 0 rgba(207,70,48,.55); }
.cover-sub { font-weight: 700; font-size: 22px; }
.cover-art { border: 2px solid var(--ink); }
.cover-art img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: 50% 70%; }
.cover-line { font-size: 22px; }
.big { display: block; width: 100%; font: inherit; font-weight: 700; font-size: 22px; min-height: 60px; border-radius: 8px; border: 2px solid var(--ink); cursor: pointer; padding: 10px 16px; }
.big.primary { background: var(--red); color: var(--paper); font-family: "Zilla Slab", Georgia, serif; font-size: 26px; }
.big.plain { background: var(--paper); color: var(--ink); }
.big.plain:focus-visible { background: var(--red); color: var(--paper); }
.big.primary:focus-visible { background: var(--ink); }
.btns > * + * { margin-top: 10px; }
.how h1 { font-size: 34px; }
.how ul { list-style: none; padding: 0; margin: 0; }
.how li { border-left: 6px solid var(--ink); padding: 4px 0 4px 14px; }
.how li + li { margin-top: 12px; }
.how li.blue { border-left-color: var(--teal); }
.how .markrow { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 17px; font-weight: 700; }
.how .markrow span { display: inline-flex; align-items: center; gap: 6px; }
.cnote { background: var(--slate); border: 2px solid var(--ink); padding: 12px 16px; }
.cnote b { display: block; }
.saved { border: 2px dashed var(--ink); padding: 10px 14px; }

/* ---------- end */
.theend { text-align: center; padding-top: 6vh; }
.theend h1 { font-size: clamp(44px, 12vw, 72px); }
.theend .tri { width: 54px; height: 54px; margin: 18px auto; display: block; }
.theend p { margin: 0 auto; }

/* ---------- bottom turn bar */
.turn {
  flex: 0 0 auto; display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px;
  padding: 10px max(12px, env(safe-area-inset-left)) max(10px, env(safe-area-inset-bottom));
  border-top: 2px solid var(--ink); background: var(--paper);
}
body.past .turn { background: #DCE3DE; border-top-color: var(--teal); }
.navbtn {
  font: inherit; font-weight: 700; font-size: 20px; min-height: 56px; border-radius: 8px; cursor: pointer;
  border: 2px solid var(--ink); background: var(--paper); color: var(--ink); padding: 0 16px;
}
.navbtn.next { background: var(--ink); color: var(--paper); }
.navbtn:focus-visible { background: var(--red); color: var(--paper); }
.navbtn:disabled { opacity: .38; cursor: default; }
.navbtn.small { min-height: 44px; font-size: 18px; }
.navbtn.wide { width: 100%; margin-top: 16px; }
@media (min-width: 900px) { .bar { padding-left: calc(50% - 320px); padding-right: calc(50% - 320px); } .turn { grid-template-columns: 1fr 1fr; padding-left: calc(50% - 320px); padding-right: calc(50% - 320px); } }

/* ---------- people dialog */
dialog {
  border: 3px solid var(--ink); background: var(--paper); color: var(--ink); padding: 16px;
  width: min(680px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); overflow-y: auto;
}
dialog::backdrop { background: rgba(29,35,48,.55); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 4px; }
.dlg-head h2 { font-size: 32px; }
.dlg-sub { font-size: .85em; margin-bottom: 12px; }

@media (hover: hover) {
  .barbtn:hover, .choice:hover, .big.plain:hover, .navbtn:hover:not(:disabled) { background: var(--red); color: var(--paper); }
  .big.primary:hover { background: var(--ink); }
}
.mark.sockm { border-radius: 4px; border: 1.5px solid var(--ink); object-fit: cover; }
@media (hover: hover) { .choice[aria-pressed="true"]:hover { background: var(--ink); color: var(--paper); } }

/* ---------- store: ads and offers from the author */
.adhead { background: var(--ink); color: var(--paper); font-weight: 700; font-size: 18px; letter-spacing: .04em; text-transform: uppercase; padding: 6px 12px; margin: 6px 0 8px; max-width: none; }
.offers { list-style: none; padding: 0; margin: 0; display: grid; gap: 14px; }
.offer { border: 2px solid var(--ink); background: var(--paper); padding: 12px 14px; }
.offer h3 { font-size: 23px; margin: 6px 0 6px; }
.offer p + p, .offer ul + p { margin-top: 8px; }
.offer ul { margin: 6px 0 0; padding-left: 22px; }
.adtag { display: inline-block; font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; border: 1.5px solid var(--ink); border-radius: 4px; padding: 0 6px; line-height: 1.5; }
.offerlink { display: inline-block; margin-top: 10px; font-weight: 700; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 2px; padding: 8px 0; min-height: 44px; }
.offerlink:focus-visible { background: var(--red); color: var(--paper); }
@media (max-width: 420px) {
  .bar { gap: 5px; padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
  .barbtn { padding: 0 7px; }
  .size { padding: 0 4px; min-width: 34px; }
  .sizes { gap: 3px; }
}
