/* Chapters IV and V: a picture story that plays as you scroll. */
.story-page { display: block; place-items: normal; padding: 0; background: #0d0704; }
.film { position: fixed; inset: 0; z-index: 0; background: #120a06 center / cover no-repeat; }
.film::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(rgba(10, 5, 2, .45), transparent 18%, transparent 78%, rgba(10, 5, 2, .5)); }
.film canvas { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity .9s ease; }
.film canvas.on { opacity: 1; }
.story-head { position: relative; z-index: 6; padding: 10px 8px 0; }
.story { position: relative; z-index: 2; }
.story:focus { outline: none; }

/* tabs hang from the right edge of the screen here */
.story-page .tabs { position: fixed; left: auto; right: -10px; top: 50%; translate: 0 -50%; margin: 0; z-index: 6; }
.story-page .tab { border-radius: 12px 0 0 12px; padding: 15px 19px 15px 11px; background: linear-gradient(270deg, #4a140c, #8b2b18 60%, #9e3820); box-shadow: -4px 4px 10px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 210, 160, .25); }
.story-page .tab:hover, .story-page .tab:focus-visible { transform: translateX(-6px); }
.story-page .tab[aria-current="page"] { transform: translateX(-11px); background: linear-gradient(270deg, #5d2a0c, #b8892e 65%, #d8ad4c); }
@media (max-width: 1179px), (max-aspect-ratio: 11/10) {
  .story-page .tabs { position: static; translate: none; }
  .story-page .tab { border-radius: 999px; padding: 8px 14px 9px; box-shadow: 0 4px 10px rgba(0, 0, 0, .45); }
  .story-page .tab:hover, .story-page .tab:focus-visible, .story-page .tab[aria-current="page"] { transform: none; }
}
@media (max-width: 759px) {
  .story-page .tabs { gap: 5px; justify-content: flex-start; }
  .story-page .tab { padding: 9px 9px 10px; min-width: 38px; }
  .story-head { padding-right: 50px; }
  .plaque .kicker { flex-wrap: wrap; gap: 0 .35em; font-size: 19px; }
  .plaque .kicker img { display: none; }
}

/* parchment plaques and caption cards */
.plaque, .beat .card {
  position: relative; color: var(--ink); border-radius: 10px;
  background: #e3c690 url(../assets/parchment-tile.webp) 0 0 / 100% auto repeat-y;
  box-shadow: 0 0 0 1.5px rgba(60, 30, 10, .55), 0 18px 40px rgba(0, 0, 0, .55), inset 0 0 40px rgba(120, 70, 20, .35);
}
.plaque::before, .beat .card::before { content: ""; position: absolute; inset: 6px; border: 1.5px solid rgba(124, 34, 18, .45); border-radius: 7px; pointer-events: none; }
.title-card { min-height: 100svh; display: grid; place-items: center; padding: 14svh 5vw 18svh; }
.plaque { width: min(760px, 92vw); padding: clamp(26px, 4vw, 46px) clamp(22px, 5vw, 56px); text-align: center; animation: plaqueIn 1.1s cubic-bezier(.2, .8, .2, 1) both .2s; }
@keyframes plaqueIn { from { opacity: 0; transform: translateY(26px) scale(.97); } }
.plaque .kicker { justify-content: center; }
.plaque h1, .plaque h2 { margin: .1em 0 .2em; font: 400 clamp(42px, 7vw, 86px)/1 "Unifraktur", serif; color: var(--title-ink); }
.plaque h2 { font-size: clamp(40px, 6vw, 72px); }
.plaque p { font-size: clamp(18px, 2vw, 21px); line-height: 1.5; margin: .4em auto; max-width: 34em; }
.plaque .chaos { font: 500 clamp(22px, 2.8vw, 30px)/1.3 "Grenze Gotisch", serif; color: var(--red); }
.start-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 18px; margin-top: 18px !important; }
.start-row .or-scroll { font-style: italic; opacity: .8; }

.beat { position: relative; height: 215svh; }
.beat .card { position: absolute; top: 108svh; width: min(440px, 34vw); padding: 20px 24px 18px; font-size: clamp(17px, 1.35vw, 19.5px); line-height: 1.5;
  transform: rotate(var(--r, -.6deg)); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .8, .2, 1); }
.beat .card.l { left: 4vw; } .beat .card.r { right: 6vw; --r: .7deg; }
.js-story .beat .card:not(.in) { opacity: 0; transform: translateY(30px) rotate(var(--r, -.6deg)); }
.beat-no { margin: 0; font: 500 13px/1 "Grenze", serif; letter-spacing: .16em; text-transform: uppercase; color: var(--red); }
.beat h2 { margin: .25em 0 .3em; font: 400 clamp(28px, 2.6vw, 36px)/1.05 "Unifraktur", serif; color: var(--title-ink); }
.beat .card p { margin: 0 0 .55em; }
.quip { padding: 8px 12px; border-radius: 10px; background: rgba(255, 248, 230, .55); border: 1.5px solid rgba(43, 26, 16, .35); }
.quip b { font-family: "Grenze Gotisch", serif; font-weight: 500; color: var(--red); margin-right: .3em; }
.end-card { min-height: 110svh; display: grid; place-items: center; padding: 12svh 5vw 20svh; }
.end-card .pager { margin-top: 22px; }
.end-card .pager a { background: rgba(126, 34, 18, .08); color: var(--red); border-color: rgba(124, 34, 18, .35); }

/* the reel: one pip per scene, and a play button */
.reel { position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); translate: -50% 0; z-index: 7; display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: 999px; background: rgba(18, 9, 4, .68); border: 1px solid rgba(214, 166, 90, .45); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
.reel ol { list-style: none; display: flex; gap: 5px; margin: 0; padding: 0; }
.reel a { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; text-decoration: none; color: #f0d9aa; font: 600 13px/1 "Grenze", serif;
  border: 1.5px solid rgba(240, 190, 110, .35); transition: background .25s, color .25s, transform .25s; }
.reel a:hover { background: rgba(240, 190, 110, .2); }
.reel a[aria-current] { background: linear-gradient(135deg, #f7dc8e, #b8892e); color: #2a1608; border-color: #f7dc8e; transform: scale(1.12); }
.reel a:focus-visible, .reel button:focus-visible { outline: 2px solid #f3c66b; outline-offset: 2px; }
.reel-play { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px 0 10px; border-radius: 999px; cursor: pointer; border: 0;
  background: radial-gradient(120% 140% at 35% 25%, #c23b22, #861a10 55%, #5c0d07); color: #fbe6bf; font: 600 14px/1 "Grenze", serif; }
.reel-play svg { width: 14px; height: 14px; fill: currentColor; }
[data-play] .pause, [data-play][aria-pressed="true"] .go { display: none; }
[data-play][aria-pressed="true"] .pause { display: inline; }
.btn .pause, .btn .go { width: 14px; height: 14px; fill: currentColor; }

/* without WebGL (or without JavaScript) each scene keeps its picture as a sticky backdrop */
.still { display: block; position: sticky; top: 0; height: 100svh; margin: 0; }
.still img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gl-on .still { display: none; }
.nogl .film canvas { display: none; }

@media (max-width: 759px) {
  .beat { height: 200svh; }
  .beat .card, .beat .card.r { left: 4vw; right: 4vw; width: auto; top: 112svh; padding: 18px 18px 16px; font-size: 17px; }
  .reel { gap: 5px; padding: 5px 6px; }
  .reel a { width: 24px; height: 24px; font-size: 12px; }
  .reel-play .lbl { display: none; }
  .reel-play { padding: 0 10px; }
}
@media (max-width: 380px) { .reel ol { gap: 3px; } .reel a { width: 22px; height: 22px; } }
@media (prefers-reduced-motion: reduce) { .plaque { animation: none; } .beat .card { transition: none; } }

/* the finished film plays in front of the living pictures for every scene it covers */
.film video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .6s ease; pointer-events: none; }
.film.vid video { opacity: 1; }
.watch-link { display: inline-block; margin-top: 10px; font: 600 17px "Grenze", serif; color: var(--red); text-underline-offset: .2em; }

/* short laptop windows: all seven tabs still fit between the top and bottom of the screen */
@media (min-width: 1180px) and (min-aspect-ratio: 11/10) and (max-height: 820px) {
  .story-page .tabs { gap: 6px; }
  .story-page .tab { padding: 10px 15px 10px 9px; font-size: 15px; }
}
@media (min-width: 1180px) and (min-aspect-ratio: 11/10) and (max-height: 600px) {
  .story-page .tabs { gap: 4px; }
  .story-page .tab { padding: 7px 13px 7px 8px; font-size: 13px; }
}
/* short laptop windows: the title plaque (and its Play button) fits above the reel */
@media (max-height: 760px) and (min-width: 760px) {
  .title-card { padding: 8svh 5vw 15svh; }
  .plaque { padding-block: clamp(20px, 5svh, 46px); }
  .plaque h1 { font-size: clamp(40px, min(7vw, 11svh), 86px); }
}

@media (min-width: 1180px) and (min-aspect-ratio: 11/10) and (max-height: 1240px) {
  .story-page .tabs { gap: 5px; }
  .story-page .tab { padding: 10px 15px 10px 9px; font-size: 15px; }
}
@media (min-width: 1180px) and (min-aspect-ratio: 11/10) and (max-height: 720px) {
  .story-page .tabs { gap: 3px; }
  .story-page .tab { padding: 6px 13px 6px 8px; font-size: 13px; }
}
