/* Witness: the night of the Ages, the parchment of the map, the painted moment. One serif voice throughout. */
:root {
  --night: #0d1120;
  --night-2: #161b2e;
  --cream: #f4ecd8;
  --soft: rgba(244, 236, 216, .72);
  --faint: rgba(244, 236, 216, .45);
  --gold: #d9ab4f;
  --gold-hi: #f2cf86;
  --ink: #1e2330;
  --parchment: #ede3cd;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: -apple-system, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--night); overflow: hidden; color: var(--cream); font-family: var(--serif);
  -webkit-user-select: none; user-select: none; overscroll-behavior: none; }
canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui > * { pointer-events: auto; }
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* ---- bar */
.bar { position: absolute; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 44px 1fr 44px; align-items: start; gap: 8px;
  padding: calc(var(--safe-t) + 12px) 14px 26px; background: linear-gradient(rgba(8, 10, 18, .62), rgba(8, 10, 18, 0)); pointer-events: none; }
.bar > * { pointer-events: auto; }
.bar.on-paper { background: linear-gradient(rgba(237, 227, 205, .92), rgba(237, 227, 205, 0)); color: var(--ink); }
.round { width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(244, 236, 216, .28); background: rgba(13, 17, 32, .42);
  font-size: 22px; line-height: 1; display: grid; place-items: center; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.on-paper .round { border-color: rgba(30, 35, 48, .3); background: rgba(237, 227, 205, .6); color: var(--ink); }
.where { text-align: center; min-width: 0; }
.kicker { font-family: var(--sans); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--soft); }
.on-paper .kicker { color: rgba(30, 35, 48, .62); }
.title { font-size: 21px; line-height: 1.15; margin-top: 3px; text-shadow: 0 1px 12px rgba(0, 0, 0, .5); }
.on-paper .title { text-shadow: none; }
.clocks { margin-top: 7px; border: 1px solid rgba(217, 171, 79, .45); background: rgba(13, 17, 32, .45); border-radius: 999px; padding: 4px 11px;
  font-family: var(--sans); font-size: 11.5px; color: var(--cream); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.clocks b { color: var(--gold-hi); font-weight: 600; }
.clocks .sep { opacity: .5; margin: 0 6px; }
.clock-detail { position: absolute; top: calc(var(--safe-t) + 118px); left: 16px; right: 16px; max-width: 460px; margin: 0 auto;
  background: rgba(13, 17, 32, .9); border: 1px solid rgba(217, 171, 79, .35); border-radius: 14px; padding: 14px 16px; font-size: 15px; line-height: 1.45; }
.clock-detail h4 { margin: 0 0 2px; font-family: var(--sans); font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--soft); font-weight: 500; }
.clock-detail .big { font-size: 22px; color: var(--gold-hi); margin-bottom: 8px; }
.clock-detail p { margin: 8px 0 0; color: var(--soft); }

/* ---- hint + readout */
.hint { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 112px); width: max-content; max-width: calc(100% - 40px);
  text-align: center; font-size: 16px; padding: 9px 16px; border-radius: 999px; background: rgba(13, 17, 32, .66); color: var(--cream);
  border: 1px solid rgba(244, 236, 216, .18); pointer-events: none; animation: breathe 3.2s ease-in-out infinite; }
.hint.on-paper { background: rgba(237, 227, 205, .9); color: var(--ink); border-color: rgba(30, 35, 48, .2); }
@keyframes breathe { 50% { opacity: .62; } }
.hint.top { top: calc(var(--safe-t) + 92px); bottom: auto; }
.readout { position: absolute; left: 0; right: 0; bottom: 0; padding: 30px 18px calc(var(--safe-b) + 16px);
  background: linear-gradient(rgba(13, 17, 32, 0), rgba(13, 17, 32, .9) 40%); pointer-events: none; }
.readout .year { font-size: 30px; line-height: 1; }
.readout .era { font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin: 6px 0 9px; }
.readout .alive { display: flex; flex-wrap: wrap; gap: 5px 6px; }
.chip { font-family: var(--sans); font-size: 11.5px; padding: 3px 8px 3px 7px; border-radius: 999px; background: rgba(244, 236, 216, .08);
  border: 1px solid rgba(244, 236, 216, .14); color: var(--soft); white-space: nowrap; }
.chip i { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }

/* ---- reading */
.reading { position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 22px calc(var(--safe-b) + 84px);
  background: linear-gradient(rgba(6, 8, 14, 0), rgba(6, 8, 14, .78) 38%, rgba(6, 8, 14, .9)); pointer-events: none; }
.reading .ref { font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.reading .verse { margin: 0; font-size: 20px; line-height: 1.42; max-width: 560px; min-height: 3em; }
.reading .verse span { color: rgba(244, 236, 216, .38); transition: color .25s; }
.reading .verse span.on { color: var(--cream); }
.moment-nav { position: absolute; left: 0; right: 0; bottom: calc(var(--safe-b) + 22px); display: flex; justify-content: space-between; padding: 0 18px; }
.pill { border: 1px solid var(--gold); background: var(--gold); color: #1b1408; border-radius: 999px; padding: 10px 20px; font-family: var(--sans);
  font-size: 15px; font-weight: 600; }
.pill.ghost { background: rgba(13, 17, 32, .5); color: var(--cream); border-color: rgba(244, 236, 216, .3); font-weight: 500;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.pill.glow { box-shadow: 0 0 0 0 rgba(242, 207, 134, .7); animation: glow 2.2s ease-out infinite; }
@keyframes glow { 0% { box-shadow: 0 0 0 0 rgba(242, 207, 134, .65); } 100% { box-shadow: 0 0 0 16px rgba(242, 207, 134, 0); } }
.pill.big { font-size: 17px; padding: 13px 38px; }

/* ---- sheet */
.sheet { position: absolute; left: 0; right: 0; bottom: 0; max-height: 74%; overflow: auto; -webkit-overflow-scrolling: touch;
  background: #f3ead6; color: var(--ink); border-radius: 20px 20px 0 0; padding: 22px 22px calc(var(--safe-b) + 26px);
  box-shadow: 0 -12px 40px rgba(0, 0, 0, .35); animation: rise .38s cubic-bezier(.2, .8, .2, 1); }
@keyframes rise { from { transform: translateY(40px); opacity: 0; } }
.sheet-body { max-width: 560px; margin: 0 auto; }
.sheet-close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; border-radius: 50%; border: 0; background: rgba(30, 35, 48, .08);
  color: var(--ink); font-size: 20px; line-height: 1; }
.sheet .kind { font-family: var(--sans); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: #8a6420; }
.sheet .kind.history { color: #3d5f7a; }
.sheet .kind.traditions { color: #7a3d5a; }
.sheet h2 { margin: 6px 36px 8px 0; font-size: 25px; line-height: 1.15; font-weight: 500; }
.sheet h3 { margin: 20px 0 8px; font-family: var(--sans); font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: rgba(30, 35, 48, .6); font-weight: 600; }
.sheet p { font-size: 17px; line-height: 1.5; margin: 0 0 10px; }
.sheet .src { font-family: var(--sans); font-size: 12.5px; color: rgba(30, 35, 48, .62); line-height: 1.4; }
.sheet .meta { font-family: var(--sans); font-size: 13px; color: rgba(30, 35, 48, .7); }
.sheet .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.sheet .actions .pill { font-size: 14px; padding: 9px 16px; }
.sheet .actions .pill.ghost { background: transparent; color: var(--ink); border-color: rgba(30, 35, 48, .3); backdrop-filter: none; }
.sheet ul { list-style: none; padding: 0; margin: 0; }
.sheet li { padding: 10px 0; border-top: 1px solid rgba(30, 35, 48, .1); }
.sheet li:first-child { border-top: 0; }
.sheet li .t { font-size: 17px; }
.sheet li .s { font-family: var(--sans); font-size: 12.5px; color: rgba(30, 35, 48, .62); margin-top: 2px; line-height: 1.4; }
.sheet li .b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 7px; }
.sheet li button.row { all: unset; display: block; width: 100%; cursor: pointer; }
.sheet .chip { background: rgba(30, 35, 48, .06); border-color: rgba(30, 35, 48, .14); color: rgba(30, 35, 48, .8); display: inline-block; margin: 0 4px 6px 0; }
.sheet .strata li { position: relative; padding-left: 22px; }
.sheet .strata li::before { content: ""; position: absolute; left: 4px; top: 16px; width: 9px; height: 9px; border-radius: 50%; background: #c9a24a; }
.sheet .strata li.now::before { background: #e3b55a; box-shadow: 0 0 0 4px rgba(227, 181, 90, .3); }
.sheet .stat { display: flex; gap: 22px; margin: 6px 0 4px; }
.sheet .stat div { font-family: var(--sans); font-size: 12px; color: rgba(30, 35, 48, .6); }
.sheet .stat b { display: block; font-family: var(--serif); font-size: 28px; font-weight: 500; color: var(--ink); }
.sheet .done { color: #8a6420; }
.sheet label { font-family: var(--sans); font-size: 14px; margin-right: 16px; }

/* ---- title */
.title-card { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; padding: 24px;
  background: radial-gradient(ellipse at 50% 42%, rgba(13, 17, 32, .2), rgba(13, 17, 32, .78) 70%); transition: opacity 1.2s; }
.title-card.gone { opacity: 0; pointer-events: none; }
.mark { font-size: clamp(32px, 10vw, 54px); letter-spacing: .3em; text-transform: uppercase; margin-right: -.32em; color: var(--cream);
  text-shadow: 0 0 40px rgba(242, 207, 134, .35); }
.tag { font-size: 21px; font-style: italic; color: var(--gold-hi); margin: 10px 0 26px; }
.sub { font-size: 16px; line-height: 1.5; color: var(--soft); margin: 0 0 30px; }
.toggles { margin-top: 22px; font-family: var(--sans); font-size: 14px; color: var(--soft); display: flex; gap: 20px; }
.toggles input { accent-color: var(--gold); }
.fine { margin-top: 26px; font-family: var(--sans); font-size: 11.5px; line-height: 1.5; color: var(--faint); max-width: 360px; }

@media (min-width: 700px) {
  .reading .verse { font-size: 23px; }
  .sheet { left: 50%; right: auto; width: 560px; transform: translateX(-50%); animation: none; }
}

/* ---- the opening */
.chapter-card { position: absolute; left: 0; right: 0; top: 34%; text-align: center; pointer-events: none; opacity: 0; }
.chapter-card .k { font-family: var(--sans); font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--gold-hi); }
.chapter-card .t { font-size: 40px; margin-top: 8px; text-shadow: 0 2px 30px rgba(0, 0, 0, .7); }
.reading.calling { top: 0; bottom: 0; display: grid; align-content: center; padding: 120px 30px 120px; text-align: center;
  background: radial-gradient(ellipse at 50% 50%, rgba(6, 8, 14, .7), rgba(6, 8, 14, .35) 70%); }
.reading.calling .verse { font-size: 27px; line-height: 1.4; margin: 0 auto; font-style: italic; }
.reading.calling .ref { text-align: center; }
.sheet .kind.glitch { color: #b0306a; }
.sheet .stone { width: 64px; height: 46px; margin: 4px auto 14px; border-radius: 50%; background: radial-gradient(ellipse at 38% 32%, #ffffff, #ece6da 55%, #c9c0b0);
  box-shadow: 0 6px 18px rgba(30, 35, 48, .25), 0 0 0 6px rgba(227, 181, 90, .18); }
.sheet .verse-q { font-style: italic; }
.pill.auto { padding: 10px 14px; }
.pill.auto.on { background: rgba(217, 171, 79, .28); border-color: var(--gold); color: var(--gold-hi); }
.toggles { flex-wrap: wrap; justify-content: center; row-gap: 8px; }

/* ---- the title's modes */
.modes { display: grid; gap: 12px; width: min(340px, 100%); margin: 0 0 6px; }
.modes .pill { display: grid; gap: 3px; text-decoration: none; text-align: center; padding: 13px 22px; border-radius: 22px; }
.modes .pill b { font-size: 18px; font-weight: 600; }
.modes .pill small { font-size: 12px; font-weight: 400; opacity: .82; line-height: 1.35; }

/* ---- the cinema: no chrome, film subtitles, cards */
.watch { margin: 14px 0 0; font-family: var(--sans); font-size: 13px; }
.watch a { color: var(--gold-hi); text-decoration: none; border-bottom: 1px solid rgba(242, 207, 134, .4); }
.cinema .bar, .cinema .hint, .cinema .moment-nav, .cinema .clock-detail, .cinema #sheet { display: none !important; }
.cinema .reading { padding: 0 6% calc(var(--safe-b) + 7%); background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, .42)); text-align: center; }
.cinema .reading .ref { display: none; }
.cinema .reading .verse { margin: 0 auto; min-height: 0; max-width: 980px; color: #fff; font-size: clamp(19px, 3.3vw, 34px); line-height: 1.32;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .9), 0 0 18px rgba(0, 0, 0, .65); text-wrap: balance; }
.cinema .chapter-card .t { font-size: clamp(34px, 7vw, 64px); }
.cinema .readout { padding-bottom: calc(var(--safe-b) + 28px); }
.cine-card { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; pointer-events: none; }
.cine-card .t { font-size: clamp(40px, 11vw, 96px); letter-spacing: .3em; margin-right: -.3em; text-transform: uppercase; text-shadow: 0 0 50px rgba(242, 207, 134, .4); }
.cine-card .s { margin-top: 18px; font-family: var(--sans); font-size: clamp(12px, 2.2vw, 18px); letter-spacing: .3em; text-transform: uppercase; color: var(--gold-hi); }
.cine-end { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; text-align: center; padding: 8%; background: rgba(5, 6, 12, .88);
  pointer-events: none; }
.cine-end .t { font-size: clamp(32px, 8vw, 64px); letter-spacing: .3em; margin-right: -.3em; text-transform: uppercase; }
.cine-end .s { margin: 14px 0 34px; font-family: var(--sans); letter-spacing: .25em; text-transform: uppercase; font-size: clamp(13px, 1.4vw, 24px); color: var(--gold-hi); }
.cine-end ul { list-style: none; padding: 0; margin: 0; font-family: var(--sans); font-size: clamp(14px, 1.55vw, 27px); line-height: 1.75; color: rgba(244, 236, 216, .82); max-width: 62em; }

.cinema .chapter-card { top: 14%; }

/* ---- the film's notes: lower-third cards */
.cine-note { position: absolute; left: 5%; bottom: 8%; width: min(42%, 720px); padding: 20px 28px 22px; pointer-events: none;
  background: linear-gradient(100deg, rgba(8, 10, 18, .82), rgba(8, 10, 18, .55)); border-left: 3px solid var(--gold); border-radius: 0 14px 14px 0;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.cine-note .kind { font-family: var(--sans); font-size: clamp(10px, 1.05vw, 17px); letter-spacing: .26em; text-transform: uppercase; color: var(--gold-hi); }
.cine-note.history .kind { color: #9fc4e0; }
.cine-note.traditions .kind { color: #e0a8c4; }
.cine-note.history { border-left-color: #7ea6c4; }
.cine-note.traditions { border-left-color: #c48aa6; }
.cine-note h3 { margin: 8px 0 8px; font-size: clamp(20px, 2.3vw, 38px); font-weight: 500; line-height: 1.15; }
.cine-note p { margin: 0; font-size: clamp(15px, 1.55vw, 26px); line-height: 1.42; color: rgba(244, 236, 216, .9); }
.cine-note .ref { margin-top: 10px; font-family: var(--sans); font-size: clamp(10px, 1vw, 16px); color: rgba(244, 236, 216, .55); }
.cinema .reading.quiet { background: none; }
@media (max-aspect-ratio: 1/1) { .cine-note { left: 4%; right: 4%; width: auto; bottom: 20%; } .cine-note[data-pos='t'] { bottom: auto; top: 6%; } .cine-note[data-pos='bb'] { bottom: 6%; } }
/* the card's corner is chosen per note so it never covers a face (see noteLayout in app.js) */
.cine-note[data-pos='ln'], .cine-note[data-pos='rn'] { width: min(32%, 520px); }
.cine-note[data-pos='r'], .cine-note[data-pos='tr'], .cine-note[data-pos='rn'] { left: auto; right: 5%; border-left: 0; border-right: 3px solid var(--gold); border-radius: 14px 0 0 14px;
  background: linear-gradient(260deg, rgba(8, 10, 18, .82), rgba(8, 10, 18, .55)); }
.cine-note[data-pos='tl'], .cine-note[data-pos='tr'] { bottom: auto; top: 6%; }

/* ---- transport: play/pause, back 30 s, forward 30 s */
.transport { position: absolute; right: max(14px, env(safe-area-inset-right)); top: calc(var(--safe-t) + 74px); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.cinema .transport { top: calc(var(--safe-t) + 18px); flex-direction: row; gap: 12px; transition: opacity .5s; }
.cinema .transport.idle { opacity: 0; pointer-events: none; }
.tbtn { position: relative; width: 56px; height: 56px; border-radius: 50%; border: 1px solid rgba(244, 236, 216, .3); background: rgba(13, 17, 32, .5); color: var(--cream);
  display: grid; place-items: center; padding: 0; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.tbtn.big { width: 64px; height: 64px; background: rgba(217, 171, 79, .28); border-color: var(--gold); }
.tbtn svg { width: 26px; height: 26px; fill: currentColor; }
.tbtn.big svg { width: 30px; height: 30px; }
.tbtn b { position: absolute; font: 700 9.5px var(--sans); letter-spacing: 0; top: 50%; left: 50%; transform: translate(-50%, -40%); }
.tbtn:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; }
.tbtn:active { transform: scale(.94); }
.tbtn .i-play, .tbtn.paused .i-pause { display: none; }
.tbtn.paused .i-play { display: block; }
.ttime { font: 12px var(--sans); color: var(--soft); text-align: center; min-width: 78px; text-shadow: 0 1px 6px rgba(0, 0, 0, .7); }
.cinema .ttime { order: 4; align-self: center; }
@media (max-width: 520px) { .tbtn { width: 52px; height: 52px; } .tbtn.big { width: 60px; height: 60px; } }

/* ---- Light only: always say so, and offer the way out */
.lightpill { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 150px); width: max-content; max-width: calc(100% - 40px);
  font: 500 13px/1.35 var(--sans); text-align: center; color: var(--cream); background: rgba(13, 17, 32, .72); border: 1px solid var(--gold); border-radius: 999px; padding: 9px 18px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
