/* A comic read one frame at a time, turned like a page. Every frame has a portrait and a landscape picture;
   the screen's shape chooses which. On a wide screen the reader may instead open a spread: two portraits. */
:root { --ink: #ece4d4; --muted: #9b937f; --gold: #d2ad63; --night: #0c0e14; --turn: 700ms; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--night); color: var(--ink); overflow: hidden; }
body { font: 500 18px/1.35 "Literata", Georgia, serif; -webkit-tap-highlight-color: transparent; user-select: none; }

#stage { position: fixed; inset: 0; perspective: 2200px; }
.leaf { position: absolute; inset: 0; display: flex; gap: 0; transform-style: preserve-3d; backface-visibility: hidden;
  transition: transform var(--turn) cubic-bezier(.6,.05,.25,1), opacity var(--turn) ease; }
.leaf.spread { gap: 2px; background: #000; }
.side { position: relative; flex: 1 1 0; overflow: hidden; background: #05060a; }
.side img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block;
  animation: settle 9s ease-out both; }
.spread .side img { object-fit: cover; }
@keyframes settle { from { transform: scale(1.06); } to { transform: scale(1); } }

/* The turn: the old leaf swings away from its spine, the new one lies under it. */
.leaf.out-next { transform-origin: left center; transform: rotateY(-100deg); opacity: .0; }
.leaf.out-prev { transform-origin: right center; transform: rotateY(100deg); opacity: .0; }
.leaf.under { transform: scale(.985); filter: brightness(.55); transition: transform var(--turn) ease, filter var(--turn) ease; }
.leaf.under.up { transform: none; filter: none; }

/* Words come after the picture, the way an eye reaches them: a beat late, one at a time. */
.words { position: absolute; display: flex; flex-direction: column; gap: .7em; padding: clamp(18px, 4vw, 48px);
  max-width: min(30em, 92%); pointer-events: none; }
.words.top { top: 0; left: 0; right: 0; margin: 0 auto; align-items: center; text-align: center; padding-top: max(64px, 8vh); }
.words.bottom { bottom: 0; left: 0; right: 0; margin: 0 auto; align-items: center; text-align: center; padding-bottom: max(56px, 9vh); }
.words.left { left: 0; top: 0; bottom: 0; justify-content: center; max-width: min(22em, 36%); }
.words.right { right: 0; top: 0; bottom: 0; justify-content: center; align-items: flex-end; text-align: right; max-width: min(22em, 36%); }
.say { opacity: 0; transform: translateY(6px); transition: opacity 900ms ease, transform 900ms ease; }
.say.on { opacity: 1; transform: none; }
.caption { font: italic 500 clamp(19px, 2.3vw, 27px)/1.35 "Cormorant Garamond", Georgia, serif; color: var(--ink);
  text-shadow: 0 1px 14px #000, 0 0 3px #000; }
.speech { font-size: clamp(17px, 1.9vw, 22px); text-shadow: 0 1px 12px #000, 0 0 3px #000; }
.speech b { display: block; font: 500 11px/1 "Literata", serif; letter-spacing: .28em; text-transform: uppercase; color: var(--gold);
  margin-bottom: .45em; opacity: .85; }
.speech q { quotes: none; }
.speech.hiss q { letter-spacing: .12em; font-style: italic; color: #d9d2c2; }
.hide-words .words { display: none; }

#bar { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; font: 500 11px/1 "Literata", serif; letter-spacing: .28em; text-transform: uppercase; color: var(--muted);
  background: linear-gradient(#000a, transparent); opacity: 0; transition: opacity .4s; z-index: 5; }
body.chrome #bar, #bar:hover { opacity: 1; }
#bar button { background: none; border: 1px solid #ffffff33; color: var(--ink); border-radius: 999px; padding: 7px 12px;
  font: 500 12px/1 "Literata", serif; letter-spacing: .05em; cursor: pointer; margin-left: 6px; }
#bar button[hidden] { display: none; }
#dots { position: fixed; bottom: 14px; left: 0; right: 0; display: flex; justify-content: center; gap: 7px; z-index: 5; }
#dots i { width: 6px; height: 6px; border-radius: 50%; background: #ffffff38; transition: background .3s, transform .3s; }
#dots i.on { background: var(--gold); transform: scale(1.4); }
