/* DIORAMA: two surfaces. The world (#stage, fixed, pictures only) and the paper (everything read, in flow). */

:root {
  --ink: #231f2b;
  --ink-2: rgba(35, 31, 43, 0.82);
  --ink-3: rgba(35, 31, 43, 0.62);
  --paper: #e9e2d4;
  --paper-shade: #cfc8c9;
  --cream: #f6e7c8;
  --cream-2: #e9dcc3;
  --accent: #b5482e;
  --night: #0b0d1b;
  --font-display: 'Zen Maru Gothic', sans-serif;
  --font-body: Karla, system-ui, sans-serif;
  --font-serif: Georgia, 'Times New Roman', serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --rail-w: 172px;
  --gutter: clamp(16px, 3.2vw, 46px);
  --content-l: calc(var(--rail-w) + var(--gutter) * 2);
}

* { box-sizing: border-box; }
html { background: var(--night); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15.5px;
  line-height: 1.5;
  overflow-x: hidden;
  overflow-x: clip;
}
html { overflow-x: hidden; overflow-x: clip; }
img, video { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p, ol, ul { margin: 0; padding: 0; }
ol, ul { list-style: none; }

.vh {
  position: absolute !important;
  width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
#stage :focus-visible { outline: none; }

.skip {
  position: fixed; left: 12px; top: -80px; z-index: 60;
  padding: 10px 14px; background: var(--paper); color: var(--ink);
  font: 600 13px var(--font-body); text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------------------------------------------------------------- the world */

#stage {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  background: #07080f;
  contain: strict;
}
.scene { position: absolute; inset: 0; visibility: hidden; overflow: hidden; }
.scene.on { visibility: visible; }
#sc-sky { background: #131d25; }
.flat {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  will-change: transform;
  pointer-events: none; user-select: none;
  max-width: none;
  backface-visibility: hidden;
}
.glow { border-radius: 50%; }
#g-doorglow { background: radial-gradient(closest-side, rgba(255, 196, 110, 0.42), rgba(255, 180, 90, 0.16) 45%, rgba(255, 170, 80, 0) 100%); }
#r-lamp { background: radial-gradient(closest-side, rgba(255, 190, 110, 0.34), rgba(255, 170, 90, 0.12) 50%, rgba(255, 170, 80, 0) 100%); }
.tvglow { background: radial-gradient(closest-side, rgba(170, 196, 255, 0.36), rgba(150, 180, 255, 0.12) 50%, rgba(150, 180, 255, 0) 100%); }

.tvset { position: absolute; left: 0; top: 0; }
.tvset > img, .tvset > .tvglow { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
.tvset > .tvglow { left: -32%; top: -8%; width: 135%; height: 135%; }
.tvset > .tvshade { position: absolute; left: 3%; top: 84%; width: 96%; height: 20%; border-radius: 50%; background: radial-gradient(closest-side, rgba(3, 3, 10, 0.7), rgba(3, 3, 10, 0.35) 55%, rgba(3, 3, 10, 0) 100%); }

/* the dark comes across the room like a sliding screen: one straight edge, the room behind it unlit */
.wipe { position: absolute; inset: 0; overflow: hidden; will-change: transform; box-shadow: -4px 0 0 #0d0a14, -26px 0 30px -6px rgba(8, 6, 18, 0.55); }

/* the giant chapter word and its one line: the only type printed on the world */
.word {
  font-family: var(--font-display); font-weight: 700;
  line-height: 0.9; letter-spacing: -0.025em;
  color: var(--cream);
  white-space: nowrap;
  text-shadow: 0 2px 0 rgba(11, 9, 22, 0.35);
}
.word small {
  display: block; font-size: 0.2em; letter-spacing: 0.01em; line-height: 1.5;
  padding-left: 0.14em; color: var(--cream-2);
}
.word .l { display: block; }
.say {
  font-family: var(--font-serif); font-style: italic;
  color: var(--cream-2); line-height: 1.34;
  text-shadow: 0 1px 0 rgba(11, 9, 22, 0.5);
}
.say.mono { font-family: var(--font-mono); font-style: normal; font-weight: 500; letter-spacing: 0.04em; }

#motes { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; }

/* inside the television */
#box { position: absolute; overflow: hidden; background: #07080f; transform-origin: 0 0; will-change: transform; }
.set { position: absolute; inset: 0; will-change: transform; overflow: hidden; background: #05050b; box-shadow: -5px 0 0 #0b0911, 5px 0 0 #0b0911; }
.set .back { position: absolute; left: 0; top: 0; width: 100%; height: 100%; object-fit: cover; will-change: transform; }
.set .inset {
  position: absolute; will-change: transform;
  box-shadow: 0 26px 50px rgba(0, 0, 0, 0.55), 0 3px 8px rgba(0, 0, 0, 0.45);
  outline: 2px solid rgba(12, 10, 18, 0.9);
  object-fit: cover; background: #0a0a12;
}
.lvl { position: absolute; left: 0; top: 0; will-change: transform; overflow: hidden; }
#lvl-3 { background: #07080f; }
.ltv { position: absolute; left: 0; top: 0; width: 1200px; height: 1093px; max-width: none; transform-origin: 0 0; will-change: transform; }
#dot {
  position: absolute; width: 160px; height: 160px; margin: -80px 0 0 -80px; border-radius: 50%; will-change: transform, opacity; opacity: 0;
  background: radial-gradient(closest-side, #f4f7ff 0, #dfe8ff 5%, rgba(170, 196, 255, 0.5) 9%, rgba(150, 180, 255, 0.14) 30%, rgba(150, 180, 255, 0) 100%);
}
.lvl img { position: absolute; left: 0; top: 0; width: 100%; height: 100%; }
#crt {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse 74% 78% at 50% 50%, rgba(5, 5, 12, 0) 68%, rgba(5, 5, 12, 0.5) 100%);
  box-shadow: inset 0 0 0 2px rgba(5, 5, 12, 0.9), inset 0 0 60px 18px rgba(5, 5, 12, 0.6);
}

/* ---------------------------------------------------------------- the paper */

main { position: relative; z-index: 2; }
section { position: relative; }
.pin { position: sticky; top: 0; height: 100vh; height: 100svh; pointer-events: none; }
.pin > * { pointer-events: auto; }

.paper { position: relative; color: var(--ink); }
.paper > .shadow {
  position: absolute; inset: 0;
  box-shadow: 10px 22px 46px rgba(3, 3, 12, 0.55), 2px 5px 10px rgba(3, 3, 12, 0.4);
  background: rgba(3, 3, 12, 0.5);
}
.paper > .face {
  position: relative;
  background: var(--paper-shade) url(../img/washi.webp);
  background-blend-mode: multiply;
}
/* the scene's light, fixed in the frame, lying on whatever paper passes it */
.paper > .face > .lit {
  position: fixed; left: 0; top: 0; width: 600px; height: 600px;
  transform-origin: 0 0; will-change: transform; pointer-events: none;
  background: radial-gradient(closest-side, rgba(255, 240, 212, 0.9), rgba(255, 236, 204, 0.5) 45%, rgba(255, 234, 200, 0) 100%);
}
.paper > .face > .body { position: relative; }
.paper.small > .face { background-color: #ded6cf; }
.paper.small > .face::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: rgba(255, 238, 208, 0.62); opacity: var(--lit, 0.5);
}

.label {
  font: 600 11.5px/1.4 var(--font-body); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
}
.mono { font-family: var(--font-mono); font-weight: 500; font-size: 12px; letter-spacing: 0.02em; }
.go {
  color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: 2px; text-underline-offset: 0.2em;
}
.go:hover { color: var(--accent); }
a.go::after { content: '\00a0\2192'; color: var(--accent); font-family: var(--font-body); font-weight: 600; }

/* --- hero: the title slip --- */
#hero { height: 300vh; }
.title-slip {
  position: absolute; right: clamp(18px, 4.6vw, 80px); top: 50%;
  width: min(330px, 86vw);
  will-change: transform;
}
.title-slip .body { padding: 22px 24px 18px; }
.title-slip h1 {
  font: 700 31px/1.04 var(--font-display); letter-spacing: -0.015em; margin: 6px 0 10px; text-wrap: balance;
}
.title-slip .statement { font: 400 15px/1.46 var(--font-serif); color: var(--ink-2); }
.title-slip .counter { display: block; margin-top: 10px; color: var(--ink-3); font-size: 11.5px; }
.index { margin-top: 14px; padding-top: 11px; border-top: 1px solid rgba(35, 31, 43, 0.22); columns: 2; column-gap: 16px; }
.index li {
  display: flex; align-items: baseline; gap: 6px; break-inside: avoid;
  font: 600 11.5px/1.3 var(--font-body); color: var(--ink-2); padding: 2.5px 0;
}
.index li i { font: 500 9px var(--font-mono); font-style: normal; color: var(--ink-3); flex: none; width: 2.2em; }
.index li a { text-decoration: none; }
.index li a:hover { color: var(--accent); }
.index li span.c { margin-left: auto; font: 500 10px var(--font-mono); color: var(--ink-3); }

/* --- the rail --- */
#rail {
  position: fixed; left: 0; top: 50%; z-index: 5;
  width: var(--rail-w);
  will-change: transform;
}
#rail .body { padding: 16px 14px 16px 18px; }
#rail li {
  position: relative; font: 600 12px/1.25 var(--font-body); color: rgba(35, 31, 43, 0.5); padding: 2.8px 0;
}
#rail li a { color: var(--ink-2); text-decoration: none; }
#rail li a:hover { color: var(--accent); }
#rail li.now, #rail li.now a { color: var(--ink); }
#rail li.now::before {
  content: ''; position: absolute; left: -11px; top: 0.62em; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
}

/* a link that takes the keyboard's focus is never left in the wings */
#rail:focus-within { transform: translate3d(0, -50%, 0) !important; }
.title-slip:focus-within { transform: translate3d(0, -50%, 0) !important; }

/* --- the clock tag --- */
#clock {
  position: fixed; right: clamp(14px, 3vw, 44px); top: 0; z-index: 5;
  will-change: transform;
}
#clock .body { padding: 26px 16px 10px; text-align: center; }
#clock b { display: block; font: 500 30px/1 var(--font-mono); letter-spacing: 0.01em; color: var(--ink); }
#clock.at20 b { color: var(--accent); }
#clock .dial { display: flex; gap: 6px; justify-content: center; margin-top: 9px; }
#clock .dial i { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--ink-3); }
#clock .dial i.on { background: var(--ink); border-color: var(--ink); }

/* --- start: the coin and the bubble --- */
#start-head { height: 200vh; position: relative; }
.hello {
  position: absolute; left: var(--content-l); right: var(--gutter); top: 118vh;
  display: flex; align-items: center; gap: clamp(18px, 3vw, 44px);
}
.coin { position: relative; flex: none; width: clamp(150px, 17vw, 236px); aspect-ratio: 1; container-type: size; }
.coin .disc {
  position: absolute; inset: 0; border-radius: 50%;
  background: #3b2e44; border: 4px solid #ffd892;
  box-shadow: 8px 18px 40px rgba(3, 3, 12, 0.6), inset 0 -18px 30px rgba(15, 10, 25, 0.5);
}
.coin .clipin { position: absolute; inset: 4px; border-radius: 50%; overflow: hidden; }
.coin .clipout { position: absolute; left: -30cqw; top: -60cqw; width: 160cqw; height: 110cqw; overflow: hidden; }
.coin img { position: absolute; width: 118cqw; height: 118cqw; max-width: none; will-change: transform; transform-origin: 50% 100%; }
.coin .clipin img { left: calc(-9cqw - 4px); top: calc(-6cqw - 4px); }
.coin .clipout img { left: 21cqw; top: 54cqw; }
.coin .rim {
  position: absolute; inset: 0; border-radius: 50%; border: 4px solid #ffd892;
  clip-path: inset(50% 0 0 0);
}
.bubble { flex: 0 1 560px; will-change: transform; transform-origin: 0 60%; }
.bubble::before {
  content: ''; position: absolute; left: -19px; top: 50%; width: 22px; height: 30px; margin-top: -15px;
  background: #e4dbcd; clip-path: polygon(100% 0, 0 58%, 100% 100%);
}
.bubble .body { padding: 26px 30px 28px 34px; }
.bubble p { font: 400 clamp(18px, 1.75vw, 25px)/1.42 var(--font-serif); color: var(--ink); }

/* --- start: the sheet with three windows --- */
.sheet {
  margin-left: var(--content-l); margin-right: var(--gutter);
  max-width: 1060px;
}
.sheet .body { padding: clamp(22px, 4vw, 58px) clamp(18px, 4vw, 58px) clamp(34px, 5.4vw, 80px); }
.sheet-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: clamp(26px, 4vw, 56px); }
.sheet-head .lede { font: italic 400 17px/1.4 var(--font-serif); color: var(--ink-2); }
.post { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: clamp(18px, 3vw, 40px); align-items: end; }
.post + .post { margin-top: clamp(40px, 7vw, 96px); }
.post.flip { grid-template-columns: minmax(0, 1fr) minmax(0, 2.4fr); }
.post.flip .win { order: 2; }
.post.flip .cap { text-align: right; }
.post.third { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); margin-left: 9%; }
.win { position: relative; overflow: hidden; aspect-ratio: 16 / 9; background: #0e0d15; }
.win .media { position: absolute; left: 0; top: -6%; width: 100%; height: 112%; object-fit: cover; will-change: transform; }
/* the window is a hole in the sheet: the cut edge catches light below and to the right, and throws shade inside */
.win { box-shadow: 0 1.5px 0 rgba(255, 252, 240, 0.75), 1.5px 0 0 rgba(255, 252, 240, 0.5), 0 -1px 0 rgba(35, 31, 43, 0.35), -1px 0 0 rgba(35, 31, 43, 0.3); }
.win::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 20px 22px -12px rgba(5, 4, 12, 0.9), inset 16px 0 20px -12px rgba(5, 4, 12, 0.7), inset 0 0 0 1px rgba(20, 16, 26, 0.9);
}
.cap h3 { font: 700 clamp(21px, 2.1vw, 28px)/1.16 var(--font-display); letter-spacing: -0.01em; margin: 8px 0 10px; }
.cap h3 a { text-decoration-color: var(--accent); }
.cap .line { font: 400 16.5px/1.4 var(--font-serif); color: var(--ink-2); }
.after-sheet { height: 60vh; }

/* --- tv: head, episode cards, the turn --- */
#tv-head { height: 285vh; }
.ep { height: 100vh; height: 100svh; display: flex; align-items: center; }
.ep.high { align-items: flex-start; padding-top: 5vh; }
.card {
  margin-left: var(--content-l); width: min(360px, calc(100vw - 32px));
  will-change: transform; transform-origin: 20% 50%;
}
.card .body { padding: 22px 24px 24px; }
.card .meta { display: flex; gap: 10px; align-items: baseline; }
.card .meta .mono { color: var(--ink); }
.card h3 { font: 700 30px/1.08 var(--font-display); letter-spacing: -0.015em; margin: 8px 0 10px; }
.card .line { font: 400 16px/1.44 var(--font-serif); color: var(--ink-2); }
.card .line::first-letter { text-transform: uppercase; }
.card .go { display: inline-block; margin-top: 12px; font: 600 13px/1.4 var(--font-body); }
#tv-turn { height: 350vh; position: relative; }
.turn-slip {
  position: absolute; left: var(--content-l); top: 150vh;
  width: min(400px, calc(100vw - 32px));
  will-change: transform; transform-origin: 20% 50%;
}
.turn-slip .body { padding: 22px 24px; }
.turn-slip p { font: 400 17px/1.46 var(--font-serif); color: var(--ink); }

/* --- tv-also: the strip --- */
#tv-also { padding: 6vh 0 30vh; }
.strip { margin-left: var(--content-l); margin-right: var(--gutter); max-width: 1060px; }
.strip .body { padding: 22px clamp(16px, 2.4vw, 30px) 26px; }
.strip ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2.4vw, 34px); margin-top: 14px; }
.strip li .win { margin-bottom: 12px; }
.strip li h3 { font: 700 17px/1.24 var(--font-display); margin-top: 4px; }
.strip li h3 a { text-decoration-color: var(--accent); }

/* --- next --- */
#next { height: 250vh; }

/* ---------------------------------------------------------------- small screens */
@media (max-width: 820px) {
  :root { --rail-w: 0px; --content-l: 14px; --gutter: 14px; }
  #rail { top: 10px; left: 10px; width: auto; max-width: calc(100vw - 120px); }
  #rail .body { padding: 7px 12px 7px 22px; }
  #rail li { display: none; font-size: 12px; line-height: 1.5; padding: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  #rail li.now { display: block; }
  #rail:focus-within, .title-slip:focus-within { transform: none !important; }
  #rail li.now::before { left: -12px; top: 0.45em; }
  #clock .body { padding: 12px 10px 8px; }
  #clock b { font-size: 20px; }
  #clock .dial { gap: 4px; margin-top: 6px; }
  #clock .dial i { width: 5px; height: 5px; }
  .title-slip { right: 12px; left: 12px; width: auto; top: auto; bottom: 14px; }
  .title-slip .body { padding: 16px 18px 14px; }
  .title-slip h1 { font-size: 25px; margin: 4px 0 6px; }
  .title-slip .statement { font-size: 14px; line-height: 1.4; }
  .title-slip .counter { margin-top: 6px; font-size: 11px; }
  .index { margin-top: 9px; padding-top: 8px; column-gap: 14px; }
  .index li { font-size: 11.5px; padding: 1px 0; }
  .index li i { display: none; }
  .hello { flex-direction: column; align-items: flex-start; gap: 6px; }
  .coin { width: 132px; margin-left: 6px; }
  .bubble { flex: none; width: 100%; transform-origin: 20% 0; margin-top: 12px; }
  .bubble::before { left: 54px; top: -17px; width: 30px; height: 20px; margin: 0; clip-path: polygon(0 100%, 40% 0, 100% 100%); }
  .bubble .body { padding: 18px 20px 20px; }
  .post, .post.flip, .post.third { grid-template-columns: 1fr; gap: 12px; margin-left: 0; }
  .post.flip .win { order: 0; }
  .post.flip .cap { text-align: left; }
  .ep, .ep.high { align-items: flex-end; padding: 0 0 9vh; }
  .card h3 { font-size: 25px; }
  .strip ul { grid-template-columns: 1fr; gap: 16px; }
  .strip li { display: grid; grid-template-columns: 116px 1fr; gap: 12px; align-items: center; }
  .strip li .win { margin: 0; }
  .strip li h3 { font-size: 15px; }
}

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