:root {
  --ink: #0c0a08;
  --paper: #efe5cf;
  --dim: rgba(239, 229, 207, .58);
  --faint: rgba(239, 229, 207, .32);
  --gold: #c9a961;
  --accent: var(--gold);
  --serif: 'EB Garamond', Georgia, 'Times New Roman', serif;
  --display: 'Cormorant Garamond', 'EB Garamond', Georgia, serif;
  --shadow: 0 1px 2px rgba(0,0,0,.9), 0 0 18px rgba(0,0,0,.75);
}
body[data-q="Burnt Norton"] { --accent: #d9a6a1; }
body[data-q="East Coker"] { --accent: #c49a5c; }
body[data-q="The Dry Salvages"] { --accent: #8fb6c4; }
body[data-q="Little Gidding"] { --accent: #e88048; }
body[data-q="Tintern Abbey"] { --accent: #a9c08f; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--ink); color: var(--paper); font-family: var(--serif); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; background: none; border: 1px solid rgba(239,229,207,.25); border-radius: 2px; padding: .25em .7em; cursor: pointer; letter-spacing: .06em; }
button:hover, button:focus-visible { border-color: var(--accent); color: #fff; outline: none; }
a { color: var(--accent); }

/* ---------- stage ---------- */
#stage { position: fixed; inset: 0; overflow: hidden; }
.plate { position: absolute; inset: 0; opacity: 0; will-change: opacity; }
.plate .bg { position: absolute; inset: -60px; background-size: cover; background-position: center; filter: blur(38px) brightness(.32) saturate(.8); }
.plate .fg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: brightness(.66) saturate(.86) sepia(.12) contrast(1.03); will-change: transform; transform-origin: 50% 50%; }
.plate.portrait .fg { object-fit: contain; left: auto; right: 4vw; width: 52vw; filter: brightness(.78) saturate(.9) sepia(.1); }
#scrim { position: absolute; inset: 0; z-index: 2; background:
  linear-gradient(90deg, rgba(8,6,4,.86) 0%, rgba(8,6,4,.62) 34%, rgba(8,6,4,.12) 62%, rgba(8,6,4,.25) 100%),
  linear-gradient(0deg, rgba(8,6,4,.85) 0%, rgba(8,6,4,0) 22%); }
#particles { position: absolute; inset: 0; z-index: 3; width: 100%; height: 100%; mix-blend-mode: screen; }
#veil { position: absolute; inset: 0; z-index: 4; background: #000; opacity: 0; }

/* ---------- reader ---------- */
#where { position: fixed; top: 4.2vh; left: 7vw; z-index: 3; text-shadow: var(--shadow); }
#where .q { font-family: var(--display); font-size: clamp(15px, 1.25vw, 22px); letter-spacing: .32em; text-transform: uppercase; color: var(--accent); }
#where .meta { font-size: clamp(12px, .9vw, 16px); font-style: italic; color: var(--dim); margin-top: .3em; letter-spacing: .03em; }

#reader { position: fixed; left: 7vw; top: 0; bottom: 0; width: min(47vw, 720px); z-index: 2; overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 11%, #000 25%, #000 80%, transparent 94%);
          mask-image: linear-gradient(180deg, transparent 0%, transparent 11%, #000 25%, #000 80%, transparent 94%); }
#column { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.block { display: none; }
.block.on { display: block; }
.line { font-size: clamp(17px, 1.62vw, 30px); line-height: 1.46; text-shadow: var(--shadow); white-space: pre-wrap; cursor: pointer; opacity: .2; }
.line:hover { color: #fff; }
.gap { height: .9em; }
.w { opacity: .55; }
.line .dag { color: var(--accent); font-size: .62em; vertical-align: super; margin-left: .25em; cursor: pointer; opacity: .9; }
mark.motif { background: none; color: inherit; border-bottom: 1px solid var(--accent); box-shadow: inset 0 -.32em 0 rgba(201,169,97,.18); }
#numeral { position: absolute; left: -.08em; top: 22vh; font-family: var(--display); font-weight: 300; font-size: clamp(60px, 8vw, 150px); color: var(--accent); opacity: 0; text-shadow: var(--shadow); pointer-events: none; }

/* ---------- glosses ---------- */
#glosses { position: fixed; right: 3.2vw; top: 14vh; width: min(25vw, 380px); z-index: 3; display: flex; flex-direction: column; gap: 14px; }
.gloss { background: rgba(10,8,6,.66); border-left: 2px solid var(--accent); padding: .7em .95em .8em; backdrop-filter: blur(6px); cursor: pointer; opacity: 0; transition: border-color .2s; }
.gloss:hover { border-left-color: #fff; }
.gloss .k { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--accent); }
.gloss .t { font-family: var(--display); font-size: clamp(17px, 1.3vw, 23px); font-weight: 500; line-height: 1.15; margin: .15em 0 .3em; }
.gloss .n { font-size: clamp(13px, .95vw, 16px); line-height: 1.38; color: var(--dim); }
body.noglosses #glosses { display: none; }

/* ---------- cards ---------- */
#card::before { content: ''; position: absolute; inset: -18vh -12vw -18vh -14vw; z-index: -1; background: radial-gradient(ellipse at 38% 50%, rgba(8,6,4,.72) 0%, rgba(8,6,4,.45) 45%, rgba(8,6,4,0) 72%); }
#card { position: fixed; left: 7vw; top: 50%; transform: translateY(-50%); width: min(52vw, 820px); z-index: 4; pointer-events: none; text-shadow: var(--shadow); opacity: 0; }
#card h1 { font-family: var(--display); font-weight: 300; font-size: clamp(44px, 5.4vw, 104px); letter-spacing: .04em; margin: 0 0 .1em; line-height: 1; }
#card .kicker { letter-spacing: .34em; text-transform: uppercase; font-size: clamp(12px, .95vw, 16px); color: var(--accent); margin: 0 0 1.4em; }
#card .facts { font-style: italic; color: var(--dim); font-size: clamp(15px, 1.2vw, 21px); margin: .3em 0 1.2em; }
#card .sum { font-size: clamp(15px, 1.15vw, 20px); line-height: 1.5; color: var(--dim); max-width: 40em; }
#card .epi { margin: 1.8em 0 0; opacity: 0; }
#card .epi .g { font-size: clamp(17px, 1.5vw, 27px); line-height: 1.4; }
#card .epi .e { font-style: italic; color: var(--dim); font-size: clamp(14px, 1.1vw, 19px); margin-top: .3em; }
#card .epi .r { font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: var(--faint); margin-top: .4em; }

#nowplaying { position: fixed; left: 7vw; bottom: 74px; z-index: 3; font-size: clamp(12px, .9vw, 15px); color: var(--dim); text-shadow: var(--shadow); opacity: 0; cursor: pointer; max-width: 46vw; }
#nowplaying .lbl { letter-spacing: .2em; text-transform: uppercase; font-size: 10.5px; color: var(--accent); margin-right: .6em; }
#nowplaying i { color: var(--paper); }
#caption { position: fixed; right: 3.2vw; bottom: 74px; z-index: 3; font-size: clamp(11px, .8vw, 14px); color: var(--faint); text-align: right; max-width: 34vw; text-shadow: var(--shadow); opacity: 0; }
#caption i { color: var(--dim); }

/* ---------- bar ---------- */
#bar { position: fixed; left: 0; right: 0; bottom: 0; height: 58px; z-index: 6; display: flex; align-items: center; gap: 14px; padding: 0 20px; background: linear-gradient(0deg, rgba(8,6,4,.92), rgba(8,6,4,.55)); font-size: 14px; }
#play { min-width: 72px; }
#time { font-variant-numeric: tabular-nums; color: var(--dim); min-width: 92px; }
#scrub { position: relative; flex: 1; height: 34px; cursor: pointer; }
#lanes { position: absolute; inset: 0; width: 100%; height: 100%; }
#head { position: absolute; top: 2px; bottom: 2px; width: 2px; background: #fff; box-shadow: 0 0 8px rgba(255,255,255,.7); left: 0; }
#tip { position: absolute; bottom: 40px; transform: translateX(-50%); background: rgba(10,8,6,.92); border: 1px solid rgba(239,229,207,.2); padding: .3em .6em; font-size: 13px; white-space: nowrap; display: none; pointer-events: none; }
#bar nav { display: flex; gap: 8px; align-items: center; }
#bar nav button { font-size: 13px; }
#glossToggle[aria-pressed="false"] { opacity: .45; }
#vol { width: 74px; accent-color: var(--gold); }

/* ---------- start ---------- */
#start { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: radial-gradient(ellipse at 60% 40%, rgba(40,28,18,.55), rgba(8,6,4,.96)); text-align: center; }
#start h1 { font-family: var(--display); font-weight: 300; font-size: clamp(54px, 8vw, 132px); margin: .1em 0; letter-spacing: .03em; }
#start .kicker { letter-spacing: .4em; text-transform: uppercase; color: var(--gold); }
#start .by { font-style: italic; color: var(--dim); font-size: clamp(16px, 1.4vw, 22px); line-height: 1.5; }
#begin { margin: 1.6em 0 1.2em; font-size: 20px; padding: .45em 2.2em; border-color: var(--gold); letter-spacing: .3em; text-transform: uppercase; }
#start .hint { color: var(--faint); max-width: 34em; margin: 0 auto; line-height: 1.5; padding: 0 16px; }
#start .hint b { color: var(--dim); font-weight: 500; }
#start.gone { display: none; }

/* ---------- panel ---------- */
#panel { position: fixed; inset: 0 0 58px 0; z-index: 10; background: rgba(9,7,5,.95); backdrop-filter: blur(8px); display: flex; flex-direction: column; }
.panel-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; border-bottom: 1px solid rgba(239,229,207,.12); }
.tabs { display: flex; gap: 8px; }
.tabs button.on { border-color: var(--gold); color: var(--gold); }
#panelBody { overflow: auto; padding: 24px 28px 48px; flex: 1; }
#panelBody h2 { font-family: var(--display); font-weight: 400; font-size: 34px; margin: .2em 0 .3em; }
#panelBody h3 { font-family: var(--display); font-weight: 500; font-size: 24px; margin: 1.4em 0 .4em; color: var(--gold); }
#panelBody p.lede { color: var(--dim); max-width: 60em; line-height: 1.5; }

.formgrid { display: grid; grid-template-columns: 170px repeat(5, minmax(150px, 1fr)); gap: 8px; min-width: 980px; }
.formgrid .colh { font-size: 13px; color: var(--dim); line-height: 1.35; padding: 6px 4px; }
.formgrid .colh b { display: block; font-family: var(--display); font-size: 26px; color: var(--paper); font-weight: 400; }
.formgrid .rowh { padding: 10px 8px; border-left: 3px solid var(--qc); }
.formgrid .rowh b { font-family: var(--display); font-size: 22px; font-weight: 500; display: block; }
.formgrid .rowh span { font-size: 13px; color: var(--dim); font-style: italic; }
.cell { background: rgba(239,229,207,.04); border: 1px solid rgba(239,229,207,.08); border-top: 2px solid var(--qc); padding: 10px; font-size: 13.5px; line-height: 1.4; color: var(--dim); cursor: pointer; }
.cell:hover { background: rgba(239,229,207,.09); color: var(--paper); }
.cell.now { outline: 1px solid var(--gold); }
.cell .mus { margin-top: .6em; font-size: 12px; color: var(--gold); }
.cell .dur { float: right; font-size: 11.5px; color: var(--faint); }
#programSvg { width: 100%; min-width: 980px; height: 150px; display: block; margin: 8px 0 18px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 18px; }
.chips button { border-radius: 99px; font-size: 14px; }
.chips button.on { background: var(--gold); color: #120d08; border-color: var(--gold); }
.chips button small { opacity: .65; margin-left: .3em; }
.occ { display: grid; grid-template-columns: 210px 1fr; gap: 4px 14px; font-size: 16px; max-width: 980px; }
.occ .where { color: var(--faint); font-size: 13px; padding-top: 3px; }
.occ .txt { cursor: pointer; }
.occ .txt:hover { color: #fff; }

.fulltext { columns: 2 440px; column-gap: 56px; max-width: 1200px; }
.fulltext h3 { break-after: avoid; }
.fulltext .tl { font-size: 17px; line-height: 1.5; white-space: pre-wrap; cursor: pointer; }
.fulltext .tl:hover { color: #fff; background: rgba(239,229,207,.05); }
.fulltext .tl.cur { color: var(--gold); }
.fulltext .tg { height: .8em; }
.fulltext .hn { font-style: italic; color: var(--dim); font-size: 15px; white-space: normal; }
#textSearch { background: rgba(239,229,207,.06); border: 1px solid rgba(239,229,207,.2); color: var(--paper); font: inherit; padding: .35em .7em; width: min(420px, 100%); margin-bottom: 14px; }

.credits { max-width: 1100px; font-size: 15px; line-height: 1.45; }
.credits .row { display: grid; grid-template-columns: 1fr 1.2fr; gap: 14px; padding: 7px 0; border-bottom: 1px solid rgba(239,229,207,.07); }
.credits .row .lic { color: var(--faint); font-size: 13px; }
.credits .why { color: var(--dim); font-size: 14px; }

/* ---------- drawer ---------- */
#drawer { position: fixed; right: 0; top: 0; bottom: 58px; width: min(460px, 100vw); z-index: 12; background: rgba(12,10,8,.97); border-left: 1px solid rgba(239,229,207,.14); padding: 22px 26px 30px; overflow: auto; }
#closeDrawer { float: right; }
#drawerBody .k { font-size: 11.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); margin-top: .4em; }
#drawerBody h2 { font-family: var(--display); font-weight: 500; font-size: 30px; line-height: 1.1; margin: .3em 0 .5em; }
#drawerBody .anchor { font-style: italic; color: var(--dim); border-left: 2px solid var(--gold); padding-left: .8em; margin-bottom: 1em; }
#drawerBody p { line-height: 1.55; font-size: 17px; }
#drawerBody blockquote { margin: 1em 0; padding: .6em 1em; background: rgba(239,229,207,.05); font-style: italic; line-height: 1.5; }
#drawerBody ul { padding-left: 1.1em; line-height: 1.6; }
#drawerBody .go { margin-top: 1em; }

#why { position: fixed; left: 7vw; bottom: 104px; z-index: 8; max-width: min(520px, 86vw); background: rgba(12,10,8,.96); border: 1px solid rgba(239,229,207,.18); padding: 14px 16px; font-size: 15px; line-height: 1.5; }
#why .t { color: var(--gold); font-size: 12px; letter-spacing: .18em; text-transform: uppercase; margin-bottom: .4em; }

/* ---------- video mode ---------- */
body.video #bar, body.video #start, body.video #panel, body.video #drawer { display: none !important; }
body.video #nowplaying, body.video #caption { bottom: 34px; }
body.video .line { cursor: default; }
body.video #reader { -webkit-mask-image: linear-gradient(180deg, transparent 0%, transparent 11%, #000 25%, #000 84%, transparent 97%); mask-image: linear-gradient(180deg, transparent 0%, transparent 11%, #000 25%, #000 84%, transparent 97%); }

/* ---------- narrow screens ---------- */
@media (max-width: 760px) {
  #where { left: 16px; top: 14px; }
  #reader { left: 16px; right: 16px; width: auto; }
  #card { left: 16px; right: 16px; width: auto; }
  #glosses, #caption { display: none; }
  #nowplaying { left: 16px; max-width: calc(100vw - 32px); bottom: 104px; }
  #bar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  #scrub { order: 3; flex-basis: 100%; }
  #bar nav { flex-wrap: wrap; }
  #vol { display: none; }
  #panel { bottom: 96px; }
  .plate.portrait .fg { right: 0; width: 100vw; }
  #scrim { background: rgba(8,6,4,.6); }
}
body.video .line .dag { display: none; }

/* ---------- vertical Shorts (1080x1920, video mode) ---------- */
body.vertical .plate .fg, body.vertical .plate.portrait .fg { top: 7vh; left: 0; right: 0; width: 100%; height: 47vh; object-fit: contain; }
body.vertical .plate .bg { bottom: 40vh; }
body.vertical #scrim { background: linear-gradient(180deg, rgba(8,6,4,.92) 0%, rgba(8,6,4,.55) 6.5%, rgba(8,6,4,.1) 12%, rgba(8,6,4,.25) 44%, rgba(8,6,4,.9) 55%, rgba(8,6,4,.96) 100%); }
body.vertical #where { top: 2.6vh; left: 6vw; }
body.vertical #where .q { font-size: 1.6vh; letter-spacing: .16em; white-space: nowrap; }
body.vertical #where .meta { font-size: 1.5vh; }
body.vertical #reader { left: 6vw; right: 6vw; width: auto; top: 50vh; bottom: 5vh;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 86%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 12%, #000 86%, transparent 100%); }
body.vertical .line { font-size: 2.55vh; line-height: 1.42; }
body.vertical #numeral { display: none; }
body.vertical #glosses { display: none; }
body.vertical #card { left: 6vw; right: 6vw; width: auto; top: 70vh; }
body.vertical #card h1 { font-size: 6.4vh; }
body.vertical #card .kicker, body.vertical #card .facts { font-size: 1.6vh; }
body.vertical #nowplaying { left: 6vw; right: 6vw; max-width: none; bottom: 2vh; font-size: 1.25vh; }
body.vertical #caption { left: 6vw; right: 6vw; max-width: none; top: 51.6vh; bottom: auto; text-align: left; font-size: 1.1vh; }
