/* Vigil – Dave Maric. Follows the printed text for the 2016 performance:
   white page, Helvetica, the text set where it sat on the page. */

:root {
  --paper: #fff;
  --ink: #111;
  --muted: #6b6b6b;
  --faint: #d9d9d9;
  --amber: #b5772a;        /* the glitch colour in movement 1 */
  --blue: #7c9cb8;         /* the brickworks tint in movement 3 */
  --wave-rest: #d6d6d6;
  --wave-played: #111;
  --fs: clamp(15px, 1.05vw + 6px, 18px);   /* poem text (12pt on the page) */
  --fs-h: clamp(22px, 1.6vw + 12px, 34px); /* movement titles (22pt) */
  --lh: 1.17;                               /* 14pt on 12pt, as printed */
  --measure: 52em;
  --pad: clamp(20px, 6vw, 96px);
}

* { box-sizing: border-box; }
html { background: var(--paper); color: var(--ink); scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body { margin: 0; font: 400 var(--fs)/var(--lh) "Helvetica Neue", Helvetica, Arial, sans-serif; }
a { color: inherit; }
i { font-style: italic; }
button { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.bar {
  position: fixed; inset: 0 0 auto 0; z-index: 20;
  display: flex; align-items: center; gap: 1.5em;
  padding: 14px var(--pad);
  font-size: 14px; letter-spacing: .02em;
  background: rgba(255,255,255,.92);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  transition: transform .35s ease, opacity .35s ease;
}
.bar.hide { transform: translateY(-100%); opacity: 0; }
.home { text-decoration: none; }
.mvnav { margin-left: auto; display: flex; gap: .2em; }
.mvnav a {
  display: inline-grid; place-items: center; width: 1.9em; height: 1.9em;
  text-decoration: none; color: var(--muted); border-radius: 50%;
  font-variant-numeric: tabular-nums;
}
.mvnav a:hover { color: var(--ink); }
.mvnav a.on { color: var(--paper); background: var(--ink); }
.mvnav a.has-audio::after { content: ""; }
.about-btn {
  background: none; border: 1px solid var(--ink); border-radius: 999px;
  padding: .35em 1em; cursor: pointer; color: var(--ink); text-decoration: none; font: inherit; font-size: inherit; line-height: inherit;
}
.about-btn:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 760px) {
  .mvnav { display: none; }
  .about-btn { margin-left: auto; }
}

/* ---------- cover (page 1) ---------- */
.cover {
  min-height: 100vh; min-height: 100svh;
  padding: calc(18vh + 40px) var(--pad) 48px;
  display: flex; flex-direction: column;
}
.cover-text { font-size: var(--fs-h); line-height: 1.18; }
.cover-text p { margin: 0 0 1.1em; }
.cover-text .yr { margin-top: 1.6em; }
.cover-note { margin: auto 0 0; max-width: 30em; color: var(--muted); }
.begin { margin-top: 1.2em; align-self: flex-start; text-decoration: none; border-bottom: 1px solid; padding-bottom: 2px; }

/* ---------- movements ---------- */
.mv {
  position: relative;
  min-height: 92vh;
  padding: 120px var(--pad) 140px;
  scroll-margin-top: 0;
}
.mv + .mv { border-top: 1px solid var(--faint); }
.mv h2 {
  font-weight: 400; font-size: var(--fs-h); line-height: 1.15;
  margin: 0 0 .9em;
}
.mv h2 .n { margin-right: .45em; }

/* player (built by vigil.js; only shown when an excerpt exists) */
.player {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center;
  gap: 4px 16px; max-width: 34em; margin: -.3em 0 3.2em;
}
.player[hidden] { display: none; }
.play {
  grid-row: span 2;
  width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid var(--ink); background: none; cursor: pointer;
  display: grid; place-items: center; padding: 0;
}
.play svg { width: 16px; height: 16px; fill: currentColor; }
.play .i-pause { display: none; }
.playing .play { background: var(--ink); color: var(--paper); }
.playing .play .i-play { display: none; }
.playing .play .i-pause { display: block; }
.p-label { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.p-time { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; grid-row: span 2; align-self: end; padding-bottom: 6px; }
.wave { height: 34px; width: 100%; display: block; cursor: pointer; touch-action: none; }
.wave:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

/* poems: lines kept as printed */
.poem { max-width: var(--measure); }
.poem p { margin: 0 0 calc(var(--lh) * 1em); white-space: pre-wrap; }
.poem .i, .poem span.i { padding-left: calc(var(--i) * 1em * var(--ind, 1)); }
.poem span.i { display: inline-block; }

/* 2. Late (1970s) – two columns */
.late { display: grid; grid-template-columns: 30.6em auto; max-width: none; }
.late p { margin-bottom: calc(var(--lh) * 1em * 1.43); }   /* the wider spacing on that page */
.late .why { display: inline-block; padding-left: 9em; }
@media (max-width: 760px) {
  .late { grid-template-columns: 1fr; }
  .late .col-b { order: -1; justify-self: end; margin-bottom: 1.5em; }
  .late .why { padding-left: 5.5em; }
}

/* 1. names */
.names-wrap { position: relative; max-width: 46em; container-type: inline-size; overflow-x: clip; --nf: clamp(12.5px, 2.75cqw, 30px); }
.names {
  margin: 0; font-size: var(--nf); line-height: 1.12;
  text-align: justify; text-align-last: left; hyphens: none;
  overflow-wrap: normal;
}
.names .w { position: relative; }
.names .w.torn { clip-path: inset(var(--t, 0) 0 var(--b, 0) 0); }
.names .w.gone { color: transparent; }
.names-glitch { position: absolute; inset: 0; pointer-events: none; }
.names-glitch span {
  position: absolute; white-space: pre; font-size: var(--nf); line-height: 1.12;
  will-change: transform;
}
.names-glitch .amb { color: var(--amber); }
.names-wrap noscript img { max-width: 100%; height: auto; }

/* 3. London Brick – words over the photograph */
.mv-brick { padding-left: 0; padding-right: 0; }
.mv-brick h2, .mv-brick .player { margin-left: var(--pad); margin-right: var(--pad); }
.plate { margin: 0; position: relative; container-type: inline-size; }
.plate img { display: block; width: 100%; height: auto; aspect-ratio: 842 / 595; object-fit: fill; }
.frags { position: absolute; inset: 0; }
.frags p {
  position: absolute; margin: 0; white-space: pre;
  left: calc(var(--x) / 842 * 100%); top: calc(var(--y) / 595 * 100%);
  font-size: 1.5cqw; line-height: 1.17;
}
@media (max-width: 760px) {
  .frags { position: static; padding: 2em var(--pad) 0; }
  .frags p { position: static; font-size: var(--fs); white-space: pre-wrap; margin: 0 0 1.3em; }
  .frags p[data-c="2"] { padding-left: 1.6em; }
  .frags p[data-c="3"] { padding-left: 3.2em; }
  .frags p span[style] { padding-left: 1.6em !important; }
}

/* 4. Sunday Lunch – we eat and we live */
.live { margin: 0 0 calc(var(--lh) * 1em); }
.loop { margin: 0 0 1.17em !important; overflow: hidden; white-space: nowrap !important; max-width: none; }
.loop span { display: inline-block; }
.lunch .live { margin-right: calc(-1 * var(--pad)); }
.playing .loop span { animation: drift 46s linear infinite; }
.playing .loop:nth-child(2) span { animation-duration: 52s; }
.playing .loop:nth-child(3) span { animation-duration: 58s; }
@keyframes drift { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .playing .loop span { animation: none; } }

/* 5. Anguish */
.cliff { max-width: 64em; }
.over { position: relative; height: 1.4em; margin: 2em 0 2.4em; }
.over span { position: absolute; left: calc((var(--x) - 72) / 764 * 100%); }
.score { display: block; width: 100%; height: auto; }
@media (max-width: 560px) { .cliff { overflow-x: auto; } .score { width: 600px; max-width: none; } }
.playing .over span { animation: apart 9s ease-in-out infinite alternate; }
.playing .over span:first-child { animation-name: apartL; }
.playing .over span:nth-child(2) { animation: none; }
@keyframes apart { to { transform: translateX(.8em); } }
@keyframes apartL { to { transform: translateX(-.8em); } }
@media (prefers-reduced-motion: reduce) { .playing .over span { animation: none !important; } }

/* 6. Turbofolk */
.turbo { max-width: none; }
.three { display: flex; margin: 0 0 calc(var(--lh) * 1em); }
.three p { margin: 0; width: 16.7em; flex: none; }
.turbo .end { margin-top: 2.4em; }
@media (max-width: 900px) {
  .turbo { --ind: .55; }
  .three { flex-direction: column; gap: 1.17em; }
  .three p { width: auto; }
  .three p:nth-child(2) { padding-left: 1.5em; }
  .three p:nth-child(3) { padding-left: 3em; }
}

/* 8. A Late Duet */
.duet .gap { margin-top: calc(var(--lh) * 2em); }
.duet .gap2 { margin-top: calc(var(--lh) * 3em); }
.duet p { margin-bottom: 0; }

/* current movement, quietly */
.mv .n { transition: color .3s; }
.mv.playing .n { color: var(--amber); }

/* ---------- about ---------- */
.about-end { padding: 120px var(--pad) 80px; border-top: 1px solid var(--ink); }
.about-end h2, .about-dlg h2 { font-weight: 400; font-size: var(--fs-h); margin: 0 0 1em; }
.facts { display: grid; grid-template-columns: 11em 1fr; gap: .55em 1.5em; margin: 0; max-width: 46em; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.facts dd a { text-decoration-thickness: 1px; text-underline-offset: 2px; }
.facts ol { margin: 0; padding: 0; list-style: none; }
.facts ol li { display: flex; gap: .6em; }
.facts ol li a { text-decoration: none; }
.facts ol li a:hover { text-decoration: underline; }
.facts .ex { color: var(--muted); font-size: .85em; }
.note { max-width: 38em; margin: 2em 0 0; }
.note p { margin: 0 0 1em; }
.links { display: flex; flex-wrap: wrap; gap: .6em; margin-top: 2em; }
.links a { text-decoration: none; border: 1px solid var(--ink); border-radius: 999px; padding: .4em 1.1em; }
.links a:hover { background: var(--ink); color: var(--paper); }
@media (max-width: 560px) {
  .facts { grid-template-columns: 1fr; gap: .15em; }
  .facts dd { margin-bottom: .8em; }
}

.about-dlg {
  border: none; padding: 56px 40px 40px; max-width: min(46em, calc(100vw - 24px));
  max-height: calc(100vh - 48px); overflow: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.18); color: var(--ink);
}
.about-dlg::backdrop { background: rgba(255,255,255,.75); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.about-dlg .close {
  position: absolute; top: 12px; right: 14px; width: 40px; height: 40px;
  border: none; background: none; font-size: 28px; line-height: 1; cursor: pointer;
}
@media (max-width: 560px) { .about-dlg { padding: 52px 22px 28px; } }

.foot { padding: 40px var(--pad) 60px; font-size: 13px; color: var(--muted); }
.foot p { margin: 0 0 .4em; }

/* ---------- scroll mode: sound control + begin choice ---------- */
.sound { display: inline-flex; align-items: center; gap: .5em; }
.snd {
  width: 2.3em; height: 2.3em; border-radius: 50%; border: 1px solid var(--ink);
  background: none; cursor: pointer; display: grid; place-items: center; padding: 0;
}
.snd svg { width: 18px; height: 18px; }
.snd .spk { fill: currentColor; }
.snd .wv { display: none; }
.sound-on .snd { background: var(--ink); color: var(--paper); }
.sound-on .snd .wv { display: block; }
.sound-on .snd .x { display: none; }
.vol { width: 0; opacity: 0; transition: width .3s, opacity .3s; accent-color: var(--ink); margin: 0; }
.sound-on .vol { width: 84px; opacity: 1; }
@media (max-width: 760px) { .vol { display: none; } .sound { margin-left: auto; } .about-btn { margin-left: 0; } }
.begin-choice { margin: 1.2em 0 0; display: flex; flex-wrap: wrap; gap: .8em 1.4em; align-items: center; }
.begin-snd { background: var(--ink); color: var(--paper); border: 1px solid var(--ink); border-radius: 999px; padding: .5em 1.3em; cursor: pointer; }
.begin-snd:hover { background: none; color: var(--ink); }
.begin-quiet { color: var(--muted); text-decoration: none; border-bottom: 1px solid; padding-bottom: 1px; }
.begin-quiet:hover { color: var(--ink); }

/* ---------- settling in (v8) ---------- */
.js .begin, .js .begin-choice { opacity: 0; transition: opacity .6s ease; }
.js.begin-ready .begin, .js.begin-ready .begin-choice { opacity: 1; }
.js .names-wrap { opacity: 0; transition: opacity .9s ease; }
.js .names-wrap.ready { opacity: 1; }
@keyframes soundwait { 50% { opacity: .35; } }
.sound-loading .snd { animation: soundwait 1.3s ease-in-out infinite; }
.mv.loading .n { color: var(--amber); animation: soundwait 1.3s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) {
  .sound-loading .snd, .mv.loading .n { animation: none; }
  .js .begin, .js .begin-choice, .js .names-wrap { transition: none; }
}

/* ---------- moving on (v9–v10) ---------- */
.mv { padding-bottom: 72px; }
.next {
  display: grid; place-items: center start; width: 44px; height: 44px; margin: 64px 0 0 -2px;
  color: var(--muted); transition: color .2s;
}
.next svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.next:hover, .next:focus-visible { color: var(--ink); outline: none; }
.mv-brick .next { margin-left: calc(var(--pad) - 2px); }
.cover { position: relative; }
.cover-next { position: absolute; left: var(--pad); bottom: 28px; margin: 0 0 0 -2px; }
.cover-next svg { animation: hintdrop 2.2s ease-in-out infinite; }
@media (prefers-reduced-motion: reduce) { .cover-next svg { animation: none; } }
.scroll-hint {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 8px); z-index: 15;
  font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  background: rgba(255,255,255,.9); padding: .45em 1em; border-radius: 999px;
  opacity: 0; pointer-events: none; transition: opacity .8s ease, transform .8s ease;
}
.scroll-hint.on { opacity: 1; transform: translate(-50%, 0); }
.scroll-hint span { display: inline-block; animation: hintdrop 1.8s ease-in-out infinite; }
@keyframes hintdrop { 50% { transform: translateY(3px); } }
@media (prefers-reduced-motion: reduce) { .scroll-hint span { animation: none; } .scroll-hint { transition: opacity .3s; } }
.js .cover { padding-bottom: 108px; }

/* ---------- programme note: prose, after the last movement ---------- */
.pnote { padding: 120px var(--pad) 140px; border-top: 1px solid var(--faint); }
.pnote h2 { font-weight: 400; font-size: var(--fs-h); margin: 0 0 1.4em; }
.pnote-body { max-width: 34em; line-height: 1.55; }
.pnote-body p { margin: 0 0 1.05em; hyphens: manual; }
.pnote-body .sig { margin-top: 2em; color: var(--muted); }
.pnote .next { margin-top: 56px; }

/* his voice: a quiet line within the note */
.voice { margin: 1.6em 0 1.9em; display: grid; grid-template-columns: 36px 1fr; column-gap: 14px; align-items: center; }
.v-play { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ink); border-radius: 50%; background: none; color: var(--ink); cursor: pointer; transition: background .2s, color .2s; }
.v-play svg { width: 14px; height: 14px; fill: currentColor; }
.v-play .pa, .voice.on .v-play .pl { display: none; }
.voice.on .v-play .pa { display: inline; }
.voice.on .v-play { background: var(--ink); color: var(--paper); }
.voice figcaption { display: grid; grid-template-columns: 1fr auto; row-gap: 7px; font-size: .85em; color: var(--muted); }
.v-time { font-variant-numeric: tabular-nums; }
.v-bar { grid-column: 1 / -1; height: 1px; background: var(--faint); }
.v-bar i { display: block; height: 1px; width: 0; background: var(--ink); }
.v-words { grid-column: 2; margin-top: .9em; font-size: .9em; }
.v-words summary { cursor: pointer; color: var(--muted); list-style: none; }
.v-words summary::-webkit-details-marker { display: none; }
.v-words summary::before { content: "+ "; }
.v-words[open] summary::before { content: "– "; }
.v-words p { margin: .7em 0 0; }
.v-words .v-tr { color: var(--muted); }
.pnote-pdf { margin-top: 2.6em; }

/* hear an excerpt again: appears beside the title once it has played out */
.again { display: inline-grid; place-items: center; width: 1.1em; height: 1.1em; margin-left: .35em; padding: 0; vertical-align: -.12em;
  background: none; border: 0; color: var(--muted); cursor: pointer; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s .8s, color .2s; }
.again svg { width: .74em; height: .74em; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.again:hover, .again:focus-visible { color: var(--ink); outline: none; }
.sound-on .mv.done .again { opacity: 1; visibility: visible; transition: opacity .8s ease, visibility 0s, color .2s; }

/* About › Movements as a player (scroll mode) */
.facts ol.lp li { display: grid; grid-template-columns: 26px auto 1fr auto; column-gap: .6em; row-gap: 5px; align-items: center; margin: 0 0 .7em; max-width: 30em; }
.lp-play { width: 26px; height: 26px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ink); border-radius: 50%; background: none; color: var(--ink); cursor: pointer; transition: background .2s, color .2s; }
.lp-play svg { width: 10px; height: 10px; fill: currentColor; }
.lp-play .i-stop, .lp-on .lp-play .i-play { display: none; }
.lp-on .lp-play .i-stop { display: block; }
.lp-on .lp-play, .lp-play:hover { background: var(--ink); color: var(--paper); }
.lp-time { font-size: .8em; color: var(--muted); font-variant-numeric: tabular-nums; }
.lp-wave { grid-column: 2 / -1; width: 100%; height: 14px; display: block; cursor: pointer; touch-action: manipulation; }
.lp-all { margin: .6em 0 0 calc(26px + .6em); background: none; border: 1px solid var(--ink); border-radius: 999px; padding: .35em 1.1em; font: inherit; font-size: .9em; color: var(--ink); cursor: pointer; }
.lp-all:hover { background: var(--ink); color: var(--paper); }
.facts ol.lp li.lp-on > a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
.lp-all.lp-stop { background: var(--ink); color: var(--paper); }
.lp-all.lp-stop:hover { background: none; color: var(--ink); }
.facts ol.lp li:not(:has(.lp-play)) { padding-left: calc(26px + .6em); grid-template-columns: auto 1fr; }
