/* Requiem — Res Wepfer
   One page, no dependencies. Dark like a church at dusk; the light is
   candlelight, and it grows a little as the music goes on (--dawn, 0..1,
   set by requiem.js from the playhead). */

:root {
  --night: #0d0c0b;
  --night-2: #151310;
  --night-3: #1d1a16;
  --hair: #2c2822;
  --bone: #ece5d8;
  --bone-2: #cfc6b7;
  --ash: #968d80;
  --wax: #e2b56e;
  --wax-deep: #a9803f;
  --ember: #c96a43;
  --frost: #9fb3c2;

  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --dawn: 0;
  --wrap: 980px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%,
      color-mix(in srgb, var(--wax) calc(4% + var(--dawn) * 10%), transparent), transparent 70%),
    var(--night);
  color: var(--bone);
  font-family: var(--font-body);
  font-size: 18px;
  line-height: 1.62;
}

a { color: var(--wax); text-underline-offset: 3px; }
button { font: inherit; color: inherit; }

/* ---------------- two languages ----------------
   Every phrase is written twice, de then en, as siblings.
   <html data-lang="de|en"> decides which shows. */
[data-lang="de"] [lang="en"]:not(html),
[data-lang="en"] [lang="de"]:not(html) { display: none !important; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding-inline: 20px; }

.eyebrow {
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ash); margin: 0 0 12px;
}

/* ---------------- header ---------------- */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-block: 18px; border-bottom: 1px solid var(--hair);
}
.top .mark { font-family: var(--font-display); font-size: 17px; letter-spacing: .02em; color: var(--bone-2); text-decoration: none; }
.top nav { display: flex; gap: 18px; flex-wrap: wrap; align-items: center; }
.top nav a { font-family: var(--font-mono); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ash); text-decoration: none; }
.top nav a:hover { color: var(--bone); }
.langs { display: inline-flex; border: 1px solid var(--hair); border-radius: 999px; overflow: hidden; }
.langs button {
  background: none; border: 0; padding: 4px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .08em; color: var(--ash);
}
.langs button[aria-pressed="true"] { background: var(--night-3); color: var(--wax); }
@media (max-width: 640px) { .top nav a { display: none; } }

/* ---------------- opening ---------------- */
.hero { padding-block: 72px 40px; text-align: center; }
.hero .dedication {
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--wax); margin: 0 0 28px;
}
.hero h1 {
  font-family: var(--font-display); font-weight: 400; margin: 0;
  font-size: clamp(54px, 12vw, 112px); line-height: .95; letter-spacing: .01em;
}
.hero .by { font-family: var(--font-display); font-size: clamp(20px, 3.2vw, 26px); margin: 18px 0 0; color: var(--bone-2); }
.hero .for { color: var(--ash); margin: 6px 0 0; font-style: italic; }
.facts {
  display: flex; justify-content: center; flex-wrap: wrap; gap: 10px 28px; margin: 34px 0 0; padding: 0;
  list-style: none; font-family: var(--font-mono); font-size: 12.5px; color: var(--ash); letter-spacing: .04em;
}
.facts b { color: var(--bone-2); font-weight: 500; }
.candle { display: block; margin: 0 auto 26px; width: 14px; height: 40px; }
.candle .flame { transform-origin: 7px 14px; animation: flicker 3.2s ease-in-out infinite; }
@keyframes flicker { 0%,100% { transform: scale(1,1); } 30% { transform: scale(.94,1.05); } 60% { transform: scale(1.04,.96); } }
@media (prefers-reduced-motion: reduce) { .candle .flame { animation: none; } }

.lead { max-width: 64ch; margin: 34px auto 0; font-size: 19px; color: var(--bone-2); text-align: left; }
.lead p { margin: 0 0 1em; }

/* ---------------- listening ---------------- */
section { padding-block: 56px; }
section > .wrap > h2, .h2 {
  font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 5vw, 42px);
  line-height: 1.1; margin: 0 0 10px;
}
.sub { color: var(--ash); margin: 0 0 26px; max-width: 64ch; }

.deck {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--night) 92%, transparent);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-block: 1px solid var(--hair);
}
.deck .wrap { display: flex; align-items: center; gap: 14px; padding-block: 12px; }
.play {
  flex: none; width: 46px; height: 46px; border-radius: 50%; cursor: pointer;
  border: 1px solid var(--wax-deep); background: none; color: var(--wax);
  display: grid; place-items: center;
}
.play:hover { background: color-mix(in srgb, var(--wax) 12%, transparent); }
.play svg { width: 16px; height: 16px; }
.now { flex: 1; min-width: 0; }
.now .mv { font-family: var(--font-display); font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.now .where { font-family: var(--font-mono); font-size: 12px; color: var(--ash); letter-spacing: .04em; }
.now .where .letter {
  display: inline-block; min-width: 1.6em; text-align: center; border: 1px solid var(--wax-deep);
  color: var(--wax); border-radius: 3px; padding: 0 4px; margin-right: 6px;
}
.views { display: inline-flex; border: 1px solid var(--hair); border-radius: 6px; overflow: hidden; flex: none; }
.views button { background: none; border: 0; padding: 6px 10px; cursor: pointer; font-family: var(--font-mono); font-size: 11.5px; color: var(--ash); }
.views button[aria-pressed="true"] { background: var(--night-3); color: var(--bone); }
.views button:disabled { opacity: .45; cursor: not-allowed; }
@media (max-width: 640px) { .views { display: none; } }

/* the overview: the whole hour on one line */
.overview { display: block; width: 100%; height: 66px; cursor: pointer; margin-top: 2px; touch-action: none; }

.stage { position: relative; background: var(--night-2); border-bottom: 1px solid var(--hair); }
.stage canvas { display: block; width: 100%; height: clamp(420px, 66vh, 640px); cursor: grab; touch-action: pan-y; }
.stage canvas:active { cursor: grabbing; }
.stage canvas[hidden] { display: none; }

/* the score view: Res's pages, the one sounding now on the left, the next beside it */
.pages { display: flex; justify-content: center; align-items: center; gap: 18px;
  height: clamp(520px, calc(100vh - var(--deck-h, 170px)), 1180px); padding: 16px 56px 30px; box-sizing: border-box; position: relative; }
.pages[hidden] { display: none; }
.page { margin: 0; height: 100%; aspect-ratio: 1240 / 1754; position: relative; flex: none;
  background: #f4efe4; border-radius: 2px; box-shadow: 0 8px 30px rgba(0,0,0,.45); cursor: pointer;
  outline: 1px solid transparent; outline-offset: 4px; transition: outline-color .3s, opacity .3s; }
.page img { display: block; width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply;
  filter: brightness(.96); user-select: none; -webkit-user-drag: none; }
.page.now { outline-color: color-mix(in srgb, var(--wax) 40%, transparent); }
.page.later { opacity: .9; }
.page figcaption { position: absolute; left: 0; right: 0; top: 100%; margin-top: 6px; text-align: center;
  font-family: var(--font-mono); font-size: 11px; color: var(--ash); letter-spacing: .04em; white-space: nowrap; }
/* where the music is: the bar it is in, lightly gilded, and a line through the system */
.page .bar-lit, .page .cursor { position: absolute; pointer-events: none; }
.page .bar-lit { background: color-mix(in srgb, var(--wax) 22%, transparent); mix-blend-mode: multiply; border-radius: 2px; }
.page .cursor { width: 2px; margin-left: -1px; background: var(--wax-deep); border-radius: 1px;
  box-shadow: 0 0 6px color-mix(in srgb, var(--wax) 70%, transparent); opacity: .9; }
.page .bar-lit[hidden], .page .cursor[hidden] { display: none; }
.pages .turn { position: absolute; top: 50%; transform: translateY(-50%); width: 36px; height: 64px;
  background: none; border: 1px solid var(--hair); border-radius: 6px; color: var(--ash);
  font-size: 24px; line-height: 1; cursor: pointer; }
.pages .turn:hover { color: var(--bone); border-color: var(--wax-deep); }
.pages #page-prev { left: 10px; } .pages #page-next { right: 10px; }
.page[hidden] { display: none; }
.stage .notice {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 11.5px; color: var(--ash);
  background: color-mix(in srgb, var(--night) 85%, transparent); border: 1px solid var(--hair);
  padding: 5px 10px; border-radius: 999px; white-space: nowrap; pointer-events: none;
}

.chapters { list-style: none; margin: 0; padding: 18px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 6px 18px; }
.chapters button {
  width: 100%; text-align: left; background: none; border: 0; border-left: 2px solid var(--hair);
  padding: 6px 10px; cursor: pointer; color: var(--bone-2); font-family: var(--font-display); font-size: 16px; line-height: 1.3;
}
.chapters button small { display: block; font-family: var(--font-mono); font-size: 11px; color: var(--ash); letter-spacing: .04em; }
.chapters .attacca { font-family: var(--font-body); font-size: 12px; color: var(--wax-deep); letter-spacing: 0; }
.chapters button:hover { border-left-color: var(--wax-deep); color: var(--bone); }
.chapters button[aria-current="true"] { border-left-color: var(--wax); color: var(--wax); }
/* III. Sequentia: one row of its own, its six parts indented under it */
.chapters .group { grid-column: 1 / -1; }
.chapters .group ol { list-style: none; margin: 2px 0 0 14px; padding: 0; display: grid;
  grid-template-columns: repeat(auto-fill, minmax(196px, 1fr)); gap: 6px 18px; }
.chapters .group-head.within { border-left-color: var(--wax-deep); color: var(--bone); }

.honest { font-size: 15px; color: var(--ash); max-width: 70ch; margin: 22px 0 0; }

/* ---------------- insights ---------------- */
.insights { display: grid; gap: 22px; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
.insight {
  border: 1px solid var(--hair); border-radius: 10px; padding: 22px 22px 18px;
  background: linear-gradient(180deg, var(--night-2), var(--night));
}
.insight .num { font-family: var(--font-mono); font-size: 11.5px; color: var(--wax-deep); letter-spacing: .12em; }
.insight h3 { font-family: var(--font-display); font-weight: 400; font-size: 25px; line-height: 1.15; margin: 6px 0 10px; }
.insight p { margin: 0 0 .8em; font-size: 16.5px; color: var(--bone-2); }
.insight .measure { font-family: var(--font-mono); font-size: 12px; color: var(--ash); }
.insight .reading { border-left: 2px solid var(--wax-deep); padding-left: 12px; font-style: italic; }
.listen { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.listen button {
  background: none; border: 1px solid var(--hair); border-radius: 999px; padding: 5px 12px 5px 10px; cursor: pointer;
  font-family: var(--font-mono); font-size: 11.5px; color: var(--bone-2); letter-spacing: .03em;
}
.listen button::before { content: "▸ "; color: var(--wax); }
.listen button:hover { border-color: var(--wax-deep); color: var(--bone); }

/* ---------------- the text ---------------- */
.mvt { border-top: 1px solid var(--hair); padding-block: 26px; }
.mvt h3 { font-family: var(--font-display); font-weight: 400; font-size: 24px; margin: 0 0 4px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.mvt h3 button { margin-left: auto; }
.lines { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 30px; margin-top: 12px; }
.lines .la { font-style: italic; color: var(--bone); }
.lines .tr { color: var(--ash); }
.lines .gap { grid-column: 1 / -1; height: 10px; }
.omitted { font-size: 14.5px; color: var(--ash); margin: 14px 0 0; }
.omitted s { text-decoration-color: color-mix(in srgb, var(--ember) 70%, transparent); }
@media (max-width: 640px) { .lines { grid-template-columns: 1fr; } .lines .tr { margin-bottom: 8px; } }

/* ---------------- res, notes, footer ---------------- */
.prose { max-width: 66ch; }
.prose p { margin: 0 0 1em; color: var(--bone-2); }
.credits { font-family: var(--font-mono); font-size: 12.5px; color: var(--ash); line-height: 1.8; }
footer { padding-block: 40px 70px; border-top: 1px solid var(--hair); text-align: center; color: var(--ash); font-size: 14px; }
