/* Hell's Best Kept Secret: "Light on the Dust" (docs/DESIGN.md).
   A dim room. Ten shafts of light (one per commandment) are lit by the film's own clock; the dust is seen only where the light falls. */
:root {
  --wall: #120e0b; --cream: #f6ead0; --dim: #cfb98f; --ash: #b9ad98; --amber: #f4bd62;
  --paper: #f1e6cc; --ink: #24180f; --rust: #7a2f12; --walnut: #3a2616; --brass: #8a6f45;
  --a: -24deg;                                   /* the lean of the shafts; light.js reads it */
  --pitch: calc(9.76vw + 4.76vh);                /* distance between shafts (ten span the screen) */
  --bw: calc(var(--pitch) * 0.46);               /* width of a shaft */
  --ghost: 0.085; --lit: 0.46;                   /* a shaft's brightness: unlit ghost / lit */
  --serif: 'IM Fell English', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sc: 'IM Fell English', 'Iowan Old Style', Georgia, serif;   /* capitals with space between letters stand for small caps */
  --text: 'Libre Caslon Text', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --fh: min(calc(100vh - 262px), 640px);         /* height of the film frame; it is 4:3 */
  --fw: calc(var(--fh) * 4 / 3);
}
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--wall); color: var(--cream); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 19px/1.62 var(--text); overflow-x: hidden; min-height: 100vh; }
img { max-width: 100%; }
a { color: inherit; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 3px; }
.sheet :focus-visible, .table .sheet a:focus-visible { outline-color: var(--rust); }

/* ---------- the room: wall, shafts, dust ---------- */
.room { position: fixed; inset: 0; z-index: -6; pointer-events: none;
  background:
    url('plaster.svg') 0 0 / 420px 420px repeat,
    radial-gradient(120% 90% at 28% 12%, #2b2018 0%, #1a130e 46%, #0d0a08 100%);
  background-blend-mode: soft-light, normal; }
.rays { position: fixed; left: 50%; top: 50%; width: 0; height: 0; z-index: -4; pointer-events: none; transform: rotate(var(--a)); }
.rays .r { position: absolute; top: -130vmax; height: 260vmax; width: var(--bw);
  left: calc((var(--i) - 4.5) * var(--pitch) - var(--bw) / 2);
  background: linear-gradient(90deg, rgba(255,204,120,0) 0, rgba(255,204,120,.55) 16%, rgba(255,228,170,.82) 50%, rgba(255,204,120,.55) 84%, rgba(255,204,120,0) 100%);
  mix-blend-mode: screen; opacity: var(--ghost); transition: opacity 1.4s ease; }
.rays .r.flare { animation: flare 1.8s ease-out 1; }
@keyframes flare { 0% { opacity: var(--ghost); } 35% { opacity: .78; } 100% { opacity: var(--lit); } }
html.lit-1 .r1, html.lit-2 .r2, html.lit-3 .r3, html.lit-4 .r4, html.lit-5 .r5,
html.lit-6 .r6, html.lit-7 .r7, html.lit-8 .r8, html.lit-9 .r9, html.lit-10 .r10 { opacity: var(--lit); }
.dust { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -3; pointer-events: none; }

/* ---------- the two keys ---------- */
.keys { position: fixed; top: 10px; left: 10px; right: 10px; z-index: 60; display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; pointer-events: none; transition: transform .35s ease, opacity .35s ease; }
.keys > * { pointer-events: auto; }
.keys.away { transform: translateY(-120%); opacity: 0; }
.keys.away > * { pointer-events: none; }
.key { display: inline-flex; align-items: center; gap: 8px; min-height: 46px; min-width: 46px; padding: 0 14px; font: 400 15px/1 var(--text); letter-spacing: .04em; color: var(--cream); background: rgba(18,14,11,.88); border: 1px solid var(--brass); border-radius: 6px; cursor: pointer; }
.key:hover { border-color: var(--amber); }
.key .glyph { font-size: 20px; color: var(--amber); }
.share { position: relative; }

/* ---------- the title ---------- */
main { position: relative; display: block; }
.name { position: relative; text-align: center; padding: 64px 16px 12px; }
.name::before { content: ""; position: absolute; left: 50%; top: -10px; width: min(100vw, 1280px); height: calc(100% + 56px); transform: translateX(-50%);
  background: radial-gradient(closest-side, rgba(12,9,7,.9) 0%, rgba(12,9,7,.88) 74%, rgba(12,9,7,0) 100%); z-index: -2; pointer-events: none; }
.name h1 { margin: 0; font: 400 clamp(2.1rem, 1.1rem + 3.7vw, 4.1rem)/1.04 var(--serif); letter-spacing: .005em; color: var(--cream); text-shadow: 0 0 34px rgba(244,189,98,.28), 0 2px 0 rgba(0,0,0,.5); }
.name .by { margin: 8px 0 0; font: 400 clamp(.86rem, .75rem + .35vw, 1.05rem)/1.3 var(--sc); text-transform: uppercase; letter-spacing: .16em; color: var(--cream); }
.name .dot { color: var(--amber); padding: 0 .35em; }

/* ---------- the stage: ten lamps, the film, the readout ---------- */
.stage { position: relative; display: grid; grid-template-columns: 1fr var(--fw) 1fr; grid-template-areas: "a screen b" ". readout ."; align-items: center; column-gap: clamp(14px, 2.4vw, 36px); row-gap: 10px; max-width: 1560px; margin: 0 auto; padding: 4px 16px 0; }
.lamps { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.lamps-a { grid-area: a; justify-self: end; }
.lamps-b { grid-area: b; justify-self: start; }
.screen { grid-area: screen; justify-self: center; position: relative; width: var(--fw); height: var(--fh); background: #000;
  box-shadow: 0 0 0 2px #6b4a2a, 0 0 0 12px var(--walnut), 0 0 0 14px #1b110a, 0 30px 80px rgba(0,0,0,.85), 0 0 120px rgba(244,189,98,.07); }
.facade { position: absolute; inset: 0; z-index: 2; display: block; color: var(--cream); text-decoration: none; overflow: hidden; background: #000; }
.facade img { width: 100%; height: 100%; object-fit: cover; display: block; filter: saturate(.9) brightness(.82); transition: filter .5s ease; }
.facade:hover img, .facade:focus-visible img { filter: saturate(1) brightness(.96); }
.facade::after { content: "Watch the film · 38:18"; position: absolute; left: 0; right: 0; bottom: 0; padding: 38px 12px 14px; text-align: center; font: 400 .95rem/1.2 var(--text); text-transform: uppercase; letter-spacing: .16em; background: linear-gradient(0deg, rgba(8,6,4,.92), rgba(8,6,4,0)); }
.playmark { position: absolute; left: 50%; top: 46%; width: 92px; height: 92px; margin: -46px 0 0 -46px; border-radius: 50%; background: rgba(18,14,11,.72); border: 3px solid var(--amber); box-shadow: 0 0 34px rgba(244,189,98,.5); transition: transform .3s ease, box-shadow .3s ease; }
.playmark::before { content: ""; position: absolute; left: 36px; top: 26px; width: 34px; height: 40px; background: var(--amber); clip-path: polygon(0 0, 100% 50%, 0 100%); }
.facade:hover .playmark, .facade:focus-visible .playmark { transform: scale(1.07); box-shadow: 0 0 60px rgba(244,189,98,.8); }
.slot { position: absolute; inset: 0; }
.slot iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
html.is-on .facade { display: none; }

/* the ten lamps: arched windows, dark glass until the film says that commandment */
.lamp { position: relative; display: block; width: 52px; height: 70px; text-decoration: none; color: var(--cream); border-radius: 26px 26px 2px 2px; -webkit-tap-highlight-color: transparent; }
.lamp svg { display: block; width: 100%; height: 100%; overflow: visible; }
.lamp .frame { fill: #1d140d; stroke: var(--brass); stroke-width: 2.4; }
.lamp .glass { fill: #17100b; transition: fill 1.4s ease; }
.lamp .bar { fill: none; stroke: var(--brass); stroke-width: 1.2; opacity: .6; transition: stroke 1.4s ease; }
.lamp .num { position: absolute; left: 0; right: 0; bottom: 7px; text-align: center; font: 400 15px/1 var(--sc); text-transform: uppercase; letter-spacing: .04em; color: var(--cream); transition: color 1.4s ease; }
.lamp:hover .glass { fill: #2e2116; }
.lamp { transition: filter 1.4s ease; }
.lamp.is-lit { filter: drop-shadow(0 0 14px rgba(244,189,98,.65)); }
.lamp.is-lit .glass { fill: var(--amber); }
.lamp.is-lit .bar { stroke: rgba(36,24,15,.45); }
.lamp.is-lit .num { color: var(--ink); }

.readout { grid-area: readout; text-align: center; position: relative; padding: 2px 0 0; }
.readout::before { content: ""; position: absolute; left: 50%; top: -6px; width: min(94vw, 900px); height: calc(100% + 10px); transform: translateX(-50%); background: radial-gradient(closest-side, rgba(12,9,7,.82), rgba(12,9,7,0)); z-index: -2; pointer-events: none; }
.readout p { margin: 0; }
.now { font: 400 1.12rem/1.35 var(--serif); }
.nowt { font-family: var(--text); font-size: .95em; letter-spacing: .06em; color: var(--amber); padding-right: .55em; font-variant-numeric: lining-nums tabular-nums; }
.count { font: 400 .86rem/1.4 var(--text); letter-spacing: .14em; text-transform: uppercase; color: var(--cream); }
.count b { font: 400 1.05em/1 var(--text); color: var(--amber); padding-right: .15em; }

/* ---------- the table: sheets of paper in the light ---------- */
.table { position: relative; margin-top: 70px; padding: 84px 16px 70px; }
.tablebg { position: absolute; inset: 0; z-index: -5; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0,0,0,0) 0, rgba(0,0,0,0) 172px, rgba(0,0,0,.34) 178px, rgba(0,0,0,.5) 180px, rgba(255,214,150,.04) 182px, rgba(0,0,0,0) 188px, rgba(0,0,0,0) 190px),
    url('wood.svg') 0 0 / 900px 540px repeat,
    linear-gradient(180deg, #24170d 0%, #331f11 40%, #2a190d 100%); }
.tablebg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(8,6,4,.85) 0, rgba(8,6,4,0) 22%, rgba(8,6,4,0) 78%, rgba(8,6,4,.75) 100%); }
.rail { position: absolute; left: 0; right: 0; top: -14px; height: 30px; z-index: -5; background: linear-gradient(180deg, #5a3b22 0, #3a2616 45%, #1f130a 100%); box-shadow: 0 -10px 30px rgba(0,0,0,.7), 0 8px 24px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,214,150,.25); pointer-events: none; }
html.is-full .tablebg { filter: brightness(1.12) saturate(1.06); }

.sheet { position: relative; max-width: 900px; margin: 0 auto 54px; padding: clamp(22px, 4.4vw, 52px) clamp(18px, 4.6vw, 58px); color: var(--ink);
  background:
    url('plaster.svg') 0 0 / 420px 420px repeat,
    linear-gradient(172deg, #f6ecd4 0%, #f1e6cc 55%, #e9dcbd 100%);
  background-blend-mode: multiply, normal;
  border-radius: 2px; box-shadow: inset 0 0 0 1px rgba(122,47,18,.14), 0 1px 0 rgba(255,255,255,.4) inset, 0 26px 56px rgba(0,0,0,.65), 0 3px 8px rgba(0,0,0,.55); }
.sheet:nth-of-type(odd) { transform: rotate(-.22deg); }
.sheet:nth-of-type(even) { transform: rotate(.2deg); }
.sheet h2 { text-wrap: balance; margin: 0 0 .15em; font: 400 clamp(1.7rem, 1.2rem + 1.8vw, 2.5rem)/1.1 var(--serif); color: var(--ink); }
.sheet h2::after { content: ""; display: block; height: 5px; margin-top: .45em; border-top: 1px solid var(--rust); border-bottom: 1px solid var(--rust); width: 100%; opacity: .7; }
.sheet h3.small { margin: 1.6em 0 .5em; font: 400 1.05rem/1.3 var(--sc); text-transform: uppercase; letter-spacing: .12em; color: var(--rust); }
.sheet p { margin: .8em 0; overflow-wrap: anywhere; }
.sheet a { color: var(--rust); text-underline-offset: 3px; text-decoration-thickness: 1px; }
.sheet a:hover { text-decoration-thickness: 2px; }
#about p, .lede, .closing-q p { text-align: justify; text-justify: inter-word; hyphens: auto; -webkit-hyphens: auto; }
.hint { font: italic 400 .98rem/1.45 var(--text); color: #4d3825; margin: .7em 0 1em !important; }
.lede { font: 400 1.18rem/1.6 var(--text); }
strong { font-weight: 400; }
a.bible-ref { color: var(--rust); text-decoration: underline dotted; text-underline-offset: 3px; cursor: pointer; }

/* rows: parts and the ten */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { border-bottom: 1px dotted rgba(36,24,15,.4); }
.rows li:last-child { border-bottom: 0; }
a.row { display: grid; grid-template-columns: 4.6rem 1fr; align-items: baseline; gap: 6px 12px; min-height: 46px; padding: .52rem .7rem; color: var(--ink); text-decoration: none; position: relative; }
a.row:hover { background: rgba(122,47,18,.08); }
a.row .t { font: 400 .98rem/1.3 var(--text); letter-spacing: .04em; color: #4d3825; font-variant-numeric: lining-nums tabular-nums; }
a.row .pt { font: 400 1.22rem/1.3 var(--serif); }
.parts li.now a.row { background: rgba(244,189,98,.34); box-shadow: inset 5px 0 0 var(--rust); }
.parts li.now a.row .pt { color: #000; text-shadow: 0 0 0 #000; }
.parts li.now a.row .t::before { content: "▶ "; color: var(--rust); letter-spacing: 0; }
.tenrows a.row { grid-template-columns: 3.6rem 1fr auto; }
.tenrows .rn { font: 400 1.5rem/1 var(--serif); color: var(--rust); }
.tenrows li.lit a.row .rn::after { content: " ●"; font-size: .5em; vertical-align: middle; color: #b8791a; }
.tenrows .pt { font-size: 1.12rem; }

/* said in the film */
.lines { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.lines li { margin: 0 0 1.5rem; padding-left: 1.1rem; border-left: 3px solid rgba(122,47,18,.55); }
blockquote.line { margin: 0; }
blockquote.line p { margin: 0; font: italic 400 clamp(1.25rem, 1rem + 1vw, 1.65rem)/1.42 var(--text); }
blockquote.line footer { margin-top: .35rem; }
a.when { display: inline-flex; align-items: center; min-height: 44px; font: 400 .86rem/1 var(--text); text-transform: uppercase; letter-spacing: .12em; }
.closing-q { margin: 1.2rem 0 0; }
.closing-q p { margin: 0; font: italic 400 clamp(1.25rem, 1rem + 1vw, 1.65rem)/1.55 var(--text); }
.closing h2 { text-align: center; }

/* downloads, own copy, elsewhere */
.files { list-style: none; margin: 1rem 0 0; padding: 0; display: grid; gap: 10px; }
.files a.file { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 14px; min-height: 48px; padding: .7rem 1rem; color: var(--ink); text-decoration: none; background: rgba(36,24,15,.06); border: 1px solid rgba(36,24,15,.4); border-radius: 4px; font: 400 1.15rem/1.3 var(--serif); }
.files a.file:hover { background: rgba(244,189,98,.38); border-color: var(--rust); }
.files .meta { font: 400 .88rem/1.3 var(--text); letter-spacing: .05em; color: #4d3825; }
.own { margin: 1.3rem 0 0; }
.own summary { cursor: pointer; min-height: 46px; display: flex; align-items: center; font: 400 1.1rem/1.3 var(--serif); color: var(--rust); text-decoration: underline; text-underline-offset: 3px; }
.ownframe { margin-top: .6rem; background: #000; border: 8px solid var(--walnut); }
.ownframe video { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; background: #000; }
.more { margin: 0; padding-left: 1.2rem; }
.more li { margin: .15rem 0; }
.more a { display: inline-flex; align-items: center; min-height: 44px; padding: .35rem 0; overflow-wrap: anywhere; }
.foot { text-align: center; padding: 10px 0 0; }
.foot p { margin: 0; font: 400 .95rem/1.4 var(--sc); text-transform: uppercase; letter-spacing: .12em; }
.foot a { display: inline-block; min-height: 44px; padding: 10px 14px; color: var(--cream); }

/* ---------- states ---------- */
html.is-playing .readout .nowt { color: var(--cream); }
html.is-full .readout .count b { color: var(--cream); }

/* ---------- small screens ---------- */
@media (max-width: 900px) {
  :root { --fw: calc(100vw - 40px); --fh: calc(var(--fw) * 3 / 4); }
  .stage { grid-template-columns: 1fr; grid-template-areas: "screen" "a" "b" "readout"; row-gap: 8px; padding: 2px 14px 0; }
  .lamps { display: flex; justify-content: center; gap: 8px; }
  .lamps-a, .lamps-b { justify-self: center; }
  .lamp { width: 48px; height: 64px; }
  .name { padding-top: 62px; }
  .name h1 { font-size: clamp(2rem, 9.4vw, 3rem); }
  .table { padding: 70px 10px 50px; margin-top: 50px; }
  body { font-size: 18px; }
  a.row { grid-template-columns: 3.9rem 1fr; }
  .tenrows a.row { grid-template-columns: 3rem 1fr; }
  .tenrows a.row .t { grid-column: 2; }
  .key .kl { font-size: 14px; }
}
@media (max-width: 700px) { .name::before { width: 100vw; background: linear-gradient(180deg, rgba(12,9,7,0) 0, rgba(12,9,7,.9) 16%, rgba(12,9,7,.9) 84%, rgba(12,9,7,0) 100%); } }
@media (max-width: 560px) { .name .by .dot { display: none; } .name .by .who { display: block; } }
@media (max-width: 380px) { .lamp { width: 44px; height: 60px; } .lamps { gap: 6px; } .lamp .num { font-size: 13px; } }
@media (min-width: 901px) and (max-height: 700px) { .name { padding-top: 58px; } }

/* ---------- no script: the shafts stay as faint ghosts; every control is a plain link ---------- */
html:not(.js) .dust { display: none; }

/* ---------- reduced motion: instant changes, no drift ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation: none !important; scroll-behavior: auto !important; }
}
html.is-still *, html.is-still *::before, html.is-still *::after { transition-duration: 0s !important; animation: none !important; }
@media (forced-colors: active) {
  .lamp .frame, .lamp .glass { stroke: CanvasText; } .lamp.is-lit .glass { fill: Highlight; } a.row, .key { border: 1px solid CanvasText; }
}
