/* © 2026 Giuseppe Della Corte — All rights reserved */
/* Shared by every story page: dark editorial reading layer */

body.story-page {
  --bg: #070707;
  --fg: #ece7df;
  --muted: #8f8a82;
  --border: #242424;
  --card-bg: #0e0e0e;
  --hover-bg: #171717;
  --tag-border: #555555;
  --btn-hover: #dcdcdc;
  --shadow: rgba(255,255,255,0.04);
  --pixel-shadow: 4px 4px 0 var(--orange);
  --modal-overlay: rgba(0,0,0,0.8);
  --ink: #ece7df;
  --ink-dim: #b9b3aa;
  --ember: #ffb168;
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --display: 'Instrument Serif', 'Newsreader', Georgia, serif;
  --mono: 'Space Mono', ui-monospace, monospace;
  --hp: 0;
  --sp: 0;
  --bar-h: 34px;
  background: var(--bg);
  background-image: none;
  color: var(--ink);
}

body.story-page .topbar { border-bottom-color: var(--border); }
body.story-page .topnav a.is-active { color: var(--fg); }
body.story-page .site-footer { border-top-color: var(--border); }
body.story-page ::selection { background: var(--orange); color: #070707; }

/* film grain */
body.story-page::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 70;
  opacity: 0.06;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='300' height='300'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  background-size: 300px 300px;
}

/* ============ COVER ============ */
.cover-runway { position: relative; height: 165svh; }

.cover {
  position: sticky;
  top: var(--topbar-h);
  height: calc(100svh - var(--topbar-h));
  overflow: hidden;
  display: grid;
  align-items: end;
  background: #000;
}

.cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 30%;
  image-rendering: pixelated;
  transform-origin: 50% 32%;
  transform: scale(calc(1 + var(--hp) * 2.4));
  opacity: calc(0.55 - var(--hp) * 0.5);
  will-change: transform, opacity;
}

.cover-void {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: calc(1 - var(--hp) * 0.6);
  transform-origin: 50% 32%;
  transform: scale(calc(1 + var(--hp) * 0.6));
  pointer-events: none;
}
html:not(.js) .cover-void { display: none; }

.cover-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(7,7,7,0.97) 0%, rgba(7,7,7,0.86) 30%, rgba(7,7,7,0.4) 58%, rgba(7,7,7,0.15) 100%);
  pointer-events: none;
}

.cover-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 12svh;
  transform: translateY(calc(var(--hp) * -16vh));
  opacity: calc(1.15 - var(--hp) * 1.45);
  will-change: transform, opacity;
}

.crumbs {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2.2rem;
}
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); }
.crumbs span:last-child { color: var(--orange); }

html.js .cover-copy > * { animation: rise 1.1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
html.js .cover-copy > :nth-child(2) { animation-delay: 0.12s; }
html.js .cover-copy > :nth-child(3) { animation-delay: 0.3s; }
html.js .cover-copy > :nth-child(4) { animation-delay: 0.45s; }
@keyframes rise { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

.cover-title {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(3.2rem, 11vw, 9.5rem);
  line-height: 0.92;
  letter-spacing: -0.015em;
  color: #fff;
  margin: 0 0 1.6rem -0.04em;
  text-wrap: balance;
}

.cover-sub {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.35rem, 2.6vw, 2.1rem);
  line-height: 1.25;
  color: var(--ember);
  max-width: 24ch;
  margin-bottom: 2rem;
  text-wrap: balance;
}

.cover-meta {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 2;
  color: var(--ink-dim);
}
.cover-meta a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--orange); }
.cover-meta a:hover { color: var(--orange); }
.cover-meta .dot { color: var(--orange); margin: 0 0.4rem; }

.cover-cue {
  position: absolute;
  right: clamp(1.25rem, 5vw, 4rem);
  bottom: 12svh;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: calc(1 - var(--hp) * 3);
}
.cover-cue span { writing-mode: vertical-rl; }
.cover-cue i { display: block; width: 1px; height: 64px; background: linear-gradient(var(--orange), transparent); animation: cue 1.8s ease-in-out infinite; }
@keyframes cue { 0%, 100% { transform: translateY(0); opacity: 1; } 60% { transform: translateY(10px); opacity: 0.4; } }

html:not(.js) .cover-runway { height: auto; }
html:not(.js) .cover { position: relative; top: auto; }

/* ============ READING BAR ============ */
.story-bar {
  position: sticky;
  top: var(--topbar-h);
  z-index: 55;
  height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  /* same gutter as .topbar in styles.css so both bars line up */
  padding: 0 max(1.5rem, calc(50% - 750px + 1.5rem));
  font-family: var(--mono);
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(7,7,7,0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.story-bar-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.story-bar-right { display: flex; align-items: center; gap: 1.4rem; white-space: nowrap; }
.story-bar-chapter { color: var(--ink); white-space: nowrap; }
.story-bar-left { color: var(--muted); }
.bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--muted);
  background: none;
  border: 1px solid #333;
  padding: 0.32rem 0.6rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.bar-btn:hover { color: var(--ink); border-color: #666; }
.bar-btn[aria-pressed="true"] { color: var(--ink); border-color: var(--orange); }
.music-btn.is-armed { border-color: var(--orange); color: var(--ink); animation: armed 1.6s ease-in-out infinite; }
@keyframes armed { 50% { box-shadow: 0 0 0 4px rgba(255,107,0,0.18); } }
.music-btn .wave { opacity: 0.35; transition: opacity 0.3s ease; }
.music-btn[aria-pressed="true"] svg { color: var(--orange); }
.music-btn[aria-pressed="true"] .wave-1 { opacity: 1; animation: wave 1.6s ease-in-out infinite; }
.music-btn[aria-pressed="true"] .wave-2 { opacity: 1; animation: wave 1.6s ease-in-out 0.4s infinite; }
.music-btn.is-loading svg { animation: blinkslow 0.8s ease-in-out infinite; }
@keyframes wave { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes blinkslow { 50% { opacity: 0.3; } }

/* popovers in the reading bar (share, follow) */
.pop-wrap { position: relative; display: inline-flex; }
.pop {
  position: absolute;
  right: 0;
  top: calc(100% + 0.6rem);
  width: min(22rem, calc(100vw - 2rem));
  background: #0e0e0e;
  border: 1px solid #333;
  box-shadow: 0 18px 50px rgba(0,0,0,0.6);
  padding: 1rem;
  display: grid;
  gap: 0.6rem;
  text-transform: none;
  letter-spacing: 0;
  white-space: normal;
  text-align: left;
}
.pop[hidden] { display: none; }
.pop-title { font-family: var(--display); font-size: 1.35rem; color: #fff; line-height: 1.1; }
.pop-text { font-family: var(--serif); font-size: 0.98rem; color: var(--muted); margin-top: -0.3rem; }
.pop .follow-btn { justify-content: flex-start; }
.follow-pop-note { font-family: var(--serif); font-size: 0.9rem; line-height: 1.5; color: var(--muted); }
.share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
.share-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 1px solid #3a3a3a;
  padding: 0.7rem 0.8rem;
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.share-item:hover { border-color: var(--ink); }
.share-item b { font-weight: 400; }
.share-item::before { content: ''; width: 8px; height: 8px; background: var(--orange); flex-shrink: 0; }
.share-item[data-net="copy"]::before, .share-item[data-net="native"]::before { background: var(--ember); }

/* keep your place: a tab on the left edge */
.keep {
  position: fixed;
  left: 0;
  top: 50%;
  z-index: 60;
  display: flex;
  align-items: stretch;
  transform: translate(-105%, -50%);
  transition: transform 0.45s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.keep.show { transform: translate(0, -50%); }
.keep-btn {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font: inherit;
  text-align: left;
  background: #111;
  color: var(--ink);
  border: 1px solid #333;
  border-left: 3px solid var(--orange);
  padding: 0.7rem 0.9rem 0.7rem 0.8rem;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.keep-btn:hover { background: #181818; border-color: #555; border-left-color: var(--orange); }
.keep-btn svg { flex-shrink: 0; color: var(--orange); }
.keep.is-set .keep-btn svg path { fill: var(--orange); }
.keep-text { display: flex; flex-direction: column; gap: 0.15rem; }
.keep-k { font-family: var(--mono); font-size: 0.58rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink); }
.keep-v { font-family: var(--serif); font-size: 0.88rem; color: var(--muted); line-height: 1.3; }
.keep.is-set .keep-k { color: var(--ember); }
.keep-x {
  font: inherit;
  font-size: 1rem;
  background: #111;
  color: var(--muted);
  border: 1px solid #333;
  border-left: 0;
  padding: 0 0.7rem;
  cursor: pointer;
}
.keep-x:hover { color: var(--ink); }
.keep.pulse .keep-btn { animation: keeppulse 0.6s ease; }
@keyframes keeppulse { 30% { background: #2a1a0c; } }

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 66;
  transform: translate(-50%, 16px);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #070707;
  background: var(--ember);
  padding: 0.7rem 1rem;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ RESUME ============ */
.resume {
  position: fixed;
  left: 50%;
  bottom: 1.6rem;
  z-index: 65;
  display: flex;
  align-items: stretch;
  transform: translate(-50%, 20px);
  opacity: 0;
  transition: opacity 0.4s ease, transform 0.4s ease;
  box-shadow: 0 18px 50px rgba(0,0,0,0.6);
}
.resume.show { opacity: 1; transform: translate(-50%, 0); }
.resume[hidden], .toast[hidden] { display: none; }
html:not(.js) .keep, html:not(.js) .resume, html:not(.js) .toast { display: none; }
.resume-btn {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-align: left;
  font: inherit;
  background: var(--ink);
  color: #070707;
  border: 0;
  padding: 0.75rem 1.1rem;
  cursor: pointer;
}
.resume-btn:hover { background: #fff; }
.resume-k { font-family: var(--mono); font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; color: #555; }
.resume-v { font-family: var(--display); font-size: 1.2rem; line-height: 1.1; }
.resume-k { white-space: nowrap; }
.resume-dismiss {
  font-family: var(--mono);
  font-size: 0.58rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  background: #151515;
  color: var(--muted);
  border: 1px solid #2a2a2a;
  border-left: 0;
  padding: 0 1rem;
  cursor: pointer;
}
.resume-dismiss:hover { color: var(--ink); }
.story-bar-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 1px;
  width: 100%;
  background: var(--orange);
  transform-origin: 0 50%;
  transform: scaleX(var(--sp));
}
html:not(.js) .story-bar { display: none; }

/* ============ CONTENTS ============ */
.contents {
  max-width: 1100px;
  margin: 0 auto;
  padding: 14vh clamp(1.25rem, 5vw, 4rem) 10vh;
}
.contents-label {
  font-family: var(--mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1.6rem;
}
.contents ol { list-style: none; max-width: 760px; }
.contents li + li { border-top: 1px solid var(--border); }
.contents a {
  display: grid;
  grid-template-columns: 4rem 1fr;
  align-items: baseline;
  padding: 1rem 0;
  text-decoration: none;
  color: var(--ink-dim);
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.6vw, 2rem);
  line-height: 1.15;
  transition: color 0.2s ease, padding-left 0.25s ease;
}
.contents a span { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; color: var(--muted); }
.contents a:hover { color: #fff; padding-left: 0.5rem; }
.contents a:hover span { color: var(--orange); }

/* ============ CHAPTER OPENERS ============ */
.chapter { scroll-margin-top: calc(var(--topbar-h) + var(--bar-h)); }

.opener {
  position: relative;
  min-height: calc(100svh - var(--topbar-h) - var(--bar-h));
  display: grid;
  align-items: end;
  overflow: hidden;
  background: #000;
  isolation: isolate;
}
@property --kb { syntax: '<number>'; inherits: false; initial-value: 1; }
.opener-img {
  position: absolute;
  inset: -12% 0;
  width: 100%;
  height: 124%;
  object-fit: cover;
  object-position: 50% 50%;
  image-rendering: pixelated;
  opacity: 0.38;
  --kb: 1;
  transform: translateY(calc(var(--py, 0) * -1px)) scale(var(--kb));
  will-change: transform;
  z-index: -1;
  animation: kenburns 28s ease-in-out infinite alternate;
}
@keyframes kenburns { from { --kb: 1; } to { --kb: 1.09; } }
.opener::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(to top, rgba(7,7,7,1) 0%, rgba(7,7,7,0.78) 30%, rgba(7,7,7,0.2) 60%, rgba(7,7,7,0.45) 100%);
  pointer-events: none;
}
.opener-copy {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 18vh clamp(1.25rem, 5vw, 4rem) 10vh;
}
.opener-num {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 1.6rem;
}
.opener h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7.2vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.012em;
  color: #fff;
  max-width: 16ch;
  text-wrap: balance;
}
.opener-text { background: var(--bg); }
.opener-text::before { background: radial-gradient(ellipse at 20% 110%, rgba(255,107,0,0.12), transparent 55%); }
.opener-ember::before { background: radial-gradient(ellipse at 50% 120%, rgba(255,107,0,0.28), transparent 60%); }

/* ============ SCENES (image chapters, scroll-driven) ============ */
.scene { position: relative; height: 230svh; --p: 0; }
.scene-stage {
  position: sticky;
  top: calc(var(--topbar-h) + var(--bar-h));
  height: calc(100svh - var(--topbar-h) - var(--bar-h));
  overflow: hidden;
  background: #000;
  isolation: isolate;
}
.scene-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  image-rendering: pixelated;
  will-change: transform, opacity;
}
.scene-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(7,7,7,0.96) 0%, rgba(7,7,7,0.55) 30%, rgba(7,7,7,0) 58%);
  opacity: clamp(0, 1.5 - var(--p) * 2.4, 1);
  pointer-events: none;
}
.scene-stage::after {
  /* the last stretch fades to the page so the prose arrives on black */
  content: '';
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #070707;
  opacity: clamp(0, var(--p) * 4 - 3.2, 1);
  pointer-events: none;
}
.scene-copy {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 3;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 clamp(1.25rem, 5vw, 4rem) 9vh;
  opacity: clamp(0, 1.45 - var(--p) * 2.4, 1);
  transform: translateY(calc(var(--p) * -9vh));
}
.scene-copy h2 {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(2.6rem, 7.2vw, 6.4rem);
  line-height: 0.98;
  letter-spacing: -0.012em;
  color: #fff;
  max-width: 16ch;
  text-wrap: balance;
}

/* I · descend: the spiral pulls you to its point */
.scene[data-fx="descend"] .scene-img {
  transform-origin: 50% 50%;
  transform: scale(calc(1 + var(--p) * 1.4));
  opacity: calc(0.4 + var(--p) * 0.5);
}

/* II · split: Nietzsche first, then Freud */
.scene[data-fx="split"] .scene-img { clip-path: inset(0 50% 0 0); opacity: clamp(0.18, 1.05 - var(--p) * 1.7, 0.95); transform: scale(1.04); }
.scene[data-fx="split"] .scene-img-r { clip-path: inset(0 0 0 50%); opacity: clamp(0.18, var(--p) * 1.7 - 0.55, 0.95); }
.scene-name {
  position: absolute;
  top: 10vh;
  z-index: 3;
  font-family: var(--display);
  font-size: clamp(1.4rem, 2.6vw, 2.2rem);
  line-height: 1.1;
  color: #fff;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.scene-name span { font-family: var(--mono); font-size: 0.62rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--orange); }
.scene-name-l { left: clamp(1.25rem, 5vw, 4rem); opacity: clamp(0, 1.1 - var(--p) * 1.9, 1); }
.scene-name-r { right: clamp(1.25rem, 5vw, 4rem); text-align: right; align-items: flex-end; opacity: clamp(0, var(--p) * 1.9 - 0.75, 1); }
.scene[data-fx="split"] .scene-stage::before {
  content: '';
  position: absolute;
  left: 50%; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(transparent, var(--orange) 30%, var(--orange) 70%, transparent);
  z-index: 2;
  opacity: 0.6;
}

/* III · spotlight: the picture emerges from a widening cone of light */
.scene[data-fx="spotlight"] .scene-img {
  opacity: 0.85;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 42%, #000 calc(var(--p) * 110%), transparent calc(var(--p) * 110% + 22%));
  mask-image: radial-gradient(ellipse 60% 70% at 50% 42%, #000 calc(var(--p) * 110%), transparent calc(var(--p) * 110% + 22%));
  transform: scale(calc(1.08 - var(--p) * 0.08));
}

/* V · approach: walk toward the flame */
.scene[data-fx="approach"] .scene-img {
  transform-origin: 50% 48%;
  transform: scale(calc(1 + var(--p) * 0.9));
  opacity: calc(0.45 + var(--p) * 0.45);
}
.scene[data-fx="approach"] .scene-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(circle at 50% 48%, rgba(255,120,20,0.55), rgba(255,107,0,0.12) 22%, transparent 48%);
  opacity: calc(var(--p) * 1.1);
  pointer-events: none;
  mix-blend-mode: screen;
}

/* VI · pan: from Tolkien to the hobbits */
.scene[data-fx="pan"] .scene-img {
  width: 150%;
  left: 0;
  object-position: 0 50%;
  transform: translateX(calc(var(--p) * -33.33%));
  opacity: 0.75;
}

html:not(.js) .scene { height: auto; --p: 0.45; }
html:not(.js) .scene-stage { position: static; height: 70svh; }
html:not(.js) .scene-stage::after { display: none; }

/* ============ PROSE ============ */
.prose {
  max-width: 41rem;
  margin: 0 auto;
  padding: 9vh clamp(1.25rem, 5vw, 2rem);
}
.prose p {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-size: clamp(1.15rem, 1.5vw, 1.36rem);
  line-height: 1.62;
  color: var(--ink);
  margin-bottom: 1.6em;
  text-wrap: pretty;
}
.prose p:last-child { margin-bottom: 0; }
.prose .lede {
  font-family: var(--display);
  font-size: clamp(1.8rem, 3.2vw, 2.7rem);
  line-height: 1.18;
  color: #fff;
  margin-bottom: 1.2em;
}
.prose .strong-line {
  font-family: var(--display);
  font-size: clamp(1.5rem, 2.4vw, 2rem);
  line-height: 1.25;
  color: var(--ember);
}
.prose a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--orange); text-decoration-thickness: 1px; text-underline-offset: 4px; }
.prose a:hover { color: var(--orange); }
.prose strong { font-weight: 500; color: #fff; }
.prose em { color: #fff; }

/* paragraphs rise as they enter (JS only) */
/* text is never invisible: it only dims and lifts, so crawlers and screenshots always see it */
html.js .prose p { opacity: 0.28; transform: translateY(14px); transition: opacity 0.7s ease, transform 0.7s ease; }
html.js .prose p.in { opacity: 1; transform: none; }

/* ============ STATEMENT BEATS ============ */
.beat { position: relative; height: 170svh; }
.beat-stage {
  position: sticky;
  top: calc(var(--topbar-h) + var(--bar-h));
  height: calc(100svh - var(--topbar-h) - var(--bar-h));
  display: grid;
  place-content: center;
  padding: 0 clamp(1.25rem, 5vw, 4rem);
  text-align: center;
  overflow: hidden;
}
.beat-text {
  font-family: var(--display);
  font-size: clamp(2rem, 5.4vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  color: #fff;
  max-width: 20ch;
  margin: 0 auto;
  text-wrap: balance;
}
.beat-text .w { transition: opacity 0.35s ease; }
html.js .beat-text .w { opacity: 0.16; }
html.js .beat-text .w.on { opacity: 1; }
.beat-cite {
  margin-top: 2rem;
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--orange);
}
.beat-cite a { color: inherit; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
html:not(.js) .beat { height: auto; padding: 14vh 0; }
html:not(.js) .beat-stage { position: static; height: auto; }

/* canvas beat */
.beat-canvas canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.55;
}
.beat-canvas .beat-text, .beat-canvas .beat-cite { position: relative; z-index: 1; text-shadow: 0 2px 24px rgba(0,0,0,0.9); }
html:not(.js) .beat-canvas canvas { display: none; }

/* virtues beat */
.beat-virtues { height: 300svh; }
.beat-virtues .beat-stage { text-align: left; }
.virtues { list-style: none; max-width: 34ch; margin: 0 auto; display: grid; gap: clamp(0.4rem, 1.2vh, 0.9rem); }
.virtues li {
  font-family: var(--display);
  font-size: clamp(1.35rem, 2.3vw, 2.1rem);
  line-height: 1.15;
  color: var(--ink);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.virtues li strong { font-weight: 400; color: var(--ember); }
.virtues li em { color: var(--ink-dim); }
html.js .virtues li { opacity: 0.12; transform: translateX(-6px); }
html.js .virtues li.on { opacity: 1; transform: none; }

/* ============ ENDING ============ */
.ending {
  position: relative;
  min-height: 100svh;
  display: grid;
  place-items: center;
  overflow: hidden;
  isolation: isolate;
  margin-top: 6vh;
}
.ending-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.6;
  z-index: -1;
}
.ending-shade {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: radial-gradient(ellipse at 50% 55%, rgba(7,7,7,0.2), rgba(7,7,7,0.92) 70%);
  pointer-events: none;
}
.ending-copy {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 16vh clamp(1.25rem, 5vw, 4rem);
  max-width: 900px;
}
.ending-statement {
  font-family: var(--display);
  font-size: clamp(2.4rem, 7vw, 6.4rem);
  line-height: 1;
  letter-spacing: -0.015em;
  color: #fff;
  margin-bottom: 2rem;
  text-wrap: balance;
}
html.js .ending-statement .w { opacity: 0.16; transition: opacity 0.5s ease; }
html.js .ending-statement .w.on { opacity: 1; }
.ending-line {
  font-family: var(--serif);
  font-size: clamp(1.15rem, 1.6vw, 1.45rem);
  line-height: 1.6;
  color: var(--ink);
  max-width: 44ch;
  margin: 0 auto;
}
.ending-line strong { font-weight: 500; color: var(--ember); }

/* ============ OUTRO ============ */
.story-outro { border-top: 1px solid var(--border); }
.outro-inner { max-width: 41rem; margin: 0 auto; padding: 8vh clamp(1.25rem, 5vw, 2rem) 4rem; }
.outro-note { font-family: var(--serif); font-size: 1.05rem; line-height: 1.6; color: var(--muted); margin-bottom: 2rem; }
.outro-note a, .outro-author a { color: var(--ink); text-decoration: underline; text-decoration-color: var(--orange); text-underline-offset: 4px; }
.outro-note a:hover, .outro-author a:hover { color: var(--orange); }
.outro-actions { display: flex; flex-wrap: wrap; gap: 0.8rem; margin-bottom: 2.5rem; }
.outro-btn {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  padding: 0.9rem 1.2rem;
  border: 1px solid #3a3a3a;
  transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.outro-btn:hover { border-color: var(--ink); }
button.outro-btn { font: inherit; font-family: var(--mono); font-size: 0.68rem; letter-spacing: 0.12em; cursor: pointer; background: none; }
button.outro-btn-primary { background: var(--orange); }
.outro-btn-primary { background: var(--orange); border-color: var(--orange); color: #070707; }
.outro-btn-primary:hover { background: var(--ember); border-color: var(--ember); }
.outro-author { display: flex; gap: 1rem; align-items: flex-start; font-family: var(--serif); font-size: 1.05rem; line-height: 1.6; color: var(--ink-dim); }
.outro-author img { width: 56px; height: 56px; border: 1px solid #3a3a3a; image-rendering: pixelated; flex-shrink: 0; }
.outro-author strong { color: var(--ink); font-weight: 500; }

/* ============ RESPONSIVE ============ */
@media (max-width: 780px) {
  .cover-copy { padding-bottom: 9svh; }
  .cover-cue { display: none; }
  .cover-sub { max-width: none; }
  /* keep the title as the left anchor so it sits under the GDC95 wordmark; it just truncates */
  .story-bar-title { flex: 1 1 auto; min-width: 0; }
  .story-bar-right { flex: 0 0 auto; gap: 0.9rem; }
  .sound-toggle span { display: none; }
  .resume { left: 1rem; right: 1rem; transform: translate(0, 20px); }
  .resume.show { transform: none; }
  .resume-btn { flex: 1; }
  .contents a { grid-template-columns: 3rem 1fr; }
  .opener-copy { padding-top: 24vh; }
  .scene { height: 200svh; }
  .scene-name { top: 7vh; font-size: 1.1rem; }
  .bar-btn-label { display: none; }
  .bar-btn { padding: 0.32rem 0.45rem; }
  .pop-wrap { position: static; }
  .pop { right: 1rem; left: 1rem; width: auto; top: calc(var(--topbar-h) + var(--bar-h) + 0.5rem); position: fixed; }
  .keep { top: auto; bottom: 1rem; left: 1rem; transform: translate(0, 140%); }
  .keep.show { transform: none; }
  .keep-v { display: none; }
  .keep-btn { padding: 0.6rem 0.8rem; }
  .toast { bottom: 4.6rem; white-space: normal; text-align: center; max-width: calc(100vw - 2rem); }
  .beat { height: 150svh; }
  .beat-virtues { height: 260svh; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  .cover-runway { height: auto; }
  .cover { position: relative; top: auto; }
  .cover-img, .cover-copy, .cover-cue { transform: none !important; opacity: 1 !important; }
  .cover-img { opacity: 0.5 !important; }
  .cover-cue i { animation: none; }
  .opener-img { transform: none !important; animation: none; }
  .scene { height: auto; --p: 0.45 !important; }
  .scene-stage { position: static; height: 70svh; }
  .scene-stage::after { display: none; }
  .music-btn[aria-pressed="true"] .wave, .music-btn.is-loading svg, .music-btn.is-armed, .keep.pulse .keep-btn { animation: none; }
  .keep { transition: none; }
  .cover-void { display: none; }
  html.js .cover-copy > * { animation: none; }
  .sound-toggle.is-on .sound-bars b { animation: none; }
  html.js .prose p { opacity: 1; transform: none; transition: none; }
  .beat { height: auto; padding: 14vh 0; }
  .beat-stage { position: static; height: auto; }
  html.js .beat-text .w, html.js .ending-statement .w, html.js .virtues li { opacity: 1; transform: none; }
  .beat-canvas canvas { display: none; }
}

/* ============ FOLLOW (story page overrides) ============ */
.story-page .follow { border-top-color: var(--border); margin-top: 3.5rem; }
.story-page .follow-title { font-family: var(--display); font-weight: 400; font-size: 1.9rem; letter-spacing: 0; color: #fff; margin-bottom: 0.6rem; }
.story-page .follow-text, .story-page .follow-note { font-family: var(--serif); font-size: 1.02rem; color: var(--muted); }
.story-page .follow-btn { border-color: #3a3a3a; color: var(--ink); font-size: 0.68rem; letter-spacing: 0.12em; }
.story-page .follow-btn:hover { border-color: var(--ink); }
.story-page .follow-btn.is-on { border-color: var(--orange); color: var(--ember); }

.story-page .follow { margin-bottom: 2.8rem; }
