/* ==========================================================================
   CONSTANTINE — presentation.
   --------------------------------------------------------------------------
   Warm near-black ground, bone ink, hairline rules. One accent per
   arrangement. System serif stacks only — the work must live offline.
   All movement is transform-based; nothing here listens to the audio.
   ========================================================================== */

:root {
  color-scheme: dark;

  --bg: #000;
  --bg-raised: #000;
  --ink: #e9e1d2;
  --ink-dim: #9a9080;
  --ink-faint: #6e6656;
  --hairline: #2c271f;
  --accent: #e9e1d2;

  --font-display: "Didot", "Bodoni MT", "Playfair Display", "Georgia", "Times New Roman", serif;
  --font-body: "Palatino Linotype", "Palatino", "Book Antiqua", "Georgia", serif;
  --stage-font: clamp(64px, 13vmin, 170px);

  --ease-stage: cubic-bezier(0.22, 0.61, 0.21, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { height: 100%; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* candle-smoke grain + vignette — texture only, never a visualizer */
body::before {
  content: "";
  position: fixed; inset: 0;
  background: radial-gradient(120% 90% at 50% 18%, transparent 52%, rgba(0, 0, 0, 0.45));
  pointer-events: none;
  z-index: 80;
}
body::after {
  content: "";
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  opacity: 0.05;
  pointer-events: none;
  z-index: 90;
}

::selection { background: #4a3f2e; color: var(--ink); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 1px dashed var(--ink-dim);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: 16px; top: -48px;
  padding: 8px 14px; z-index: 200;
  background: var(--bg-raised); border: 1px solid var(--hairline);
  font-size: 0.8rem;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

.noscript { max-width: 46ch; margin: 4rem auto; padding: 0 24px; color: var(--ink-dim); font-style: italic; }

/* ------------------------------------------------------------------ */
/* shared voice                                                        */
/* ------------------------------------------------------------------ */

.kicker {
  font-size: 0.68rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.kicker a { color: var(--ink-dim); border-bottom: 1px solid var(--hairline); transition: color 0.3s ease, border-color 0.3s ease; }
.kicker a:hover { color: var(--ink); border-color: var(--ink-dim); }

.dim { color: var(--ink-dim); }

.lead { font-size: 1.32rem; line-height: 1.65; }

/* ------------------------------------------------------------------ */
/* masthead — the wordmark, the nav, and the eleven letters            */
/* ------------------------------------------------------------------ */

.masthead { padding: 0 24px; }

.masthead__bar {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
  padding: 20px 0 8px;
  border-bottom: 1px solid var(--hairline);
}

.wordmark {
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.42em;
  color: var(--ink-dim);
  transition: color 0.3s ease;
}
.wordmark:hover { color: var(--ink); }

.site-nav {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase;
}
.site-nav a { color: var(--ink-faint); transition: color 0.3s ease; padding: 4px 0; }
.site-nav a:hover { color: var(--ink); }

/* ------------------------------------------------------------------ */
/* the album's body environment — persistent, per arrangement          */
/* ------------------------------------------------------------------ */

.atmosphere {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}
.atmosphere__layer {
  position: absolute; inset: 0;
  opacity: 0;
  transition: opacity 1.6s ease;
}
.atmosphere__layer.is-active { opacity: 1; }

/* the figures — same plane as the atmosphere, above the color, below the work */
.figures {
  position: fixed; inset: 0;
  z-index: 0;
  pointer-events: none;
}

/* the album's figure — one statue per album, standing fixed in the room.
   Not a wallpaper: the room's occupant. Whatever image stands here is
   reduced to stone (grayscale, crushed), masked into the darkness, and
   held at a whisper of opacity, so it reads as a presence — or an
   absence — behind the interface. Cropping is done by the room's own
   edges and by the masks, never by a frame. It is still: it does not
   scroll, does not animate, does not listen to the music. */
.atmosphere__figure {
  position: absolute; inset: 0;
  background-repeat: no-repeat;
  /* gray stone; js/main.js deepens the sepia toward the album's hue as its
     tracks are played (same function list throughout, so the dye transitions).
     The photographs are dark-backed: brightness stays near unity and the black
     melts into the room — only the marble carries light. */
  filter: grayscale(1) sepia(0) hue-rotate(0deg) saturate(1) contrast(1.15) brightness(1);
  -webkit-mask-image: radial-gradient(90% 85% at 50% 78%, #000 55%, transparent 85%);
          mask-image: radial-gradient(90% 85% at 50% 78%, #000 55%, transparent 85%);
  opacity: 0;
  transition: opacity 2.8s ease, filter 3.5s ease;
}
.atmosphere__figure.is-active { opacity: var(--presence, 0.2); }

.masthead, .view { position: relative; z-index: 1; }

/* the letter stage -------------------------------------------------- */

.letter-stage,
.letter-measure {
  font-family: var(--font-display);
  font-size: var(--stage-font);
  font-weight: 500;
  line-height: 0.98;
  letter-spacing: 0.02em;
  white-space: pre;
}

.letter-stage {
  position: relative;
  width: 100%;
  height: 140px;
  margin: 3vh 0 0;
  transition: height 0.8s var(--ease-stage);
}

.letter-stage__glyph {
  position: absolute; left: 0; top: 0;
  transform-origin: 0 0;
  color: var(--ink);
  opacity: 0;
  will-change: transform, opacity;
  transition:
    transform 1.15s var(--ease-stage),
    opacity 0.9s ease;
  user-select: none;
}

.letter-stage--compact { margin-top: 1vh; }
.letter-stage--mid { margin-top: 2vh; }

.letter-stage--still .letter-stage__glyph { transition: none; }

/* in-title navigation ------------------------------------------------
   Two characters of the album title are the way to the other albums.
   They stay in place; they are set in the album's accent over a thin
   breathing underline, and their siblings step back on approach. */
.letter-stage__glyph--nav {
  color: var(--nav-accent, var(--accent));
  cursor: pointer;
}
.letter-stage__glyph--nav::after {
  content: "";
  position: absolute;
  left: 0.06em; right: 0.16em; bottom: 0.045em;
  height: 0.022em; min-height: 2px;
  background: currentColor;
  animation: navpulse 4.6s ease-in-out infinite;
}
.letter-stage__glyph--nav:hover,
.letter-stage__glyph--nav:focus-visible { filter: brightness(1.14); }
.letter-stage__glyph--nav:hover::after,
.letter-stage__glyph--nav:focus-visible::after { animation: none; opacity: 0.95; }

@keyframes navpulse {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.68; }
}

.letter-stage:has(.letter-stage__glyph--nav:hover) .letter-stage__glyph:not(.letter-stage__glyph--nav),
.letter-stage:has(.letter-stage__glyph--nav:focus-visible) .letter-stage__glyph:not(.letter-stage__glyph--nav) {
  /* glyphs carry inline opacity from the stage engine; dimming must win */
  opacity: 0.38 !important;
}

.letter-measure {
  position: absolute; top: -9999px; left: -9999px;
  visibility: hidden;
}

/* ------------------------------------------------------------------ */
/* the room below the masthead                                         */
/* ------------------------------------------------------------------ */

.view {
  max-width: 613px;   /* two-thirds of the former measure */
  margin: 0 auto;
  padding: 3.5rem 24px 7rem;
  outline: none;
}
body.has-plinth .view { padding-bottom: 11rem; }

.prologue, .album, .object, .appendix {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.9s ease, transform 0.9s var(--ease-stage);
}
.prologue.is-entered, .album.is-entered, .object.is-entered, .appendix.is-entered {
  opacity: 1; transform: none;
}

/* one work, re-arranged: the room leaves before the next configuration
   arrives (rules sit after .is-entered so they win the cascade) */
.view--leaving .prologue,
.view--leaving .album,
.view--leaving .object,
.view--leaving .appendix {
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

/* rise-in for the prologue's three movements */
.rise { opacity: 0; transform: translateY(12px); }
.is-entered .rise {
  opacity: 1; transform: none;
  transition: opacity 1.1s ease, transform 1.1s var(--ease-stage);
}
.is-entered .rise-1 { transition-delay: 0.15s; }
.is-entered .rise-2 { transition-delay: 0.5s; }
.is-entered .rise-3 { transition-delay: 0.85s; }

/* ------------------------------------------------------------------ */
/* threshold                                                           */
/* ------------------------------------------------------------------ */

.prologue__statement {
  max-width: 62ch;
  margin-top: 3.2rem;
  display: grid;
  gap: 1.5rem;
}

.prologue__prompt { margin-top: 4.5rem; }

/* three plates — rows, not cards; no streaming grid anywhere */
.plates {
  list-style: none;
  margin-top: 0.8rem;
  border-bottom: 1px solid var(--hairline);
}

.plate a {
  display: grid;
  grid-template-columns: 4.5rem 1fr auto;
  align-items: baseline;
  gap: 20px;
  padding: 30px 0;
  border-top: 1px solid var(--hairline);
}

.plate__numeral {
  font-size: 0.75rem; letter-spacing: 0.3em;
  color: var(--ink-faint);
  transition: color 0.35s ease;
}

.plate__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4.2vw, 2.6rem);
  letter-spacing: 0.12em;
  color: var(--ink);
  transition: color 0.35s ease, letter-spacing 0.5s var(--ease-stage);
  white-space: nowrap;
}

.plate__epigraph {
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.95rem;
  transition: color 0.35s ease;
}

.plate a:hover .plate__numeral,
.plate a:focus-visible .plate__numeral { color: var(--accent); }
.plate a:hover .plate__title,
.plate a:focus-visible .plate__title {
  color: var(--accent);
  letter-spacing: 0.16em;
}
.plate a:hover .plate__epigraph { color: var(--ink-dim); }

/* ------------------------------------------------------------------ */
/* album room                                                          */
/* ------------------------------------------------------------------ */

.album__epigraph {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4.5vw, 2.6rem);
  font-style: italic;
  line-height: 1.25;
  margin-top: 2.2rem;
  max-width: 24ch;
}

.album__note {
  max-width: 58ch;
  color: var(--ink-dim);
  margin-top: 1.6rem;
}

.tracks {
  list-style: none;
  margin-top: 3.5rem;
  border-bottom: 1px solid var(--hairline);
}

.track-row {
  display: grid;
  grid-template-columns: 3.2rem 1fr auto 4.5rem;
  align-items: baseline;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 19px 0;
  border-top: 1px solid var(--hairline);
  transition: border-color 0.4s ease;
}

.track-row__numeral {
  font-size: 0.72rem; letter-spacing: 0.2em;
  color: var(--ink-faint);
  transition: color 0.3s ease;
}

.track-row__title {
  font-family: var(--font-display);
  font-size: 1.28rem;
  letter-spacing: 0.06em;
  color: var(--ink-dim);
  transition: color 0.3s ease, transform 0.45s var(--ease-stage);
}

.track-row__state { position: relative; width: 9px; height: 9px; }
.track-row__state::before {
  content: "";
  position: absolute; inset: 0;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.track-row.is-current .track-row__state::before { opacity: 1; transform: scale(1); }
body.is-playing .track-row.is-current .track-row__state::before {
  animation: breathe 3.4s ease-in-out infinite; /* a slow clock, not the audio */
}
@keyframes breathe {
  0%, 100% { transform: scale(1); opacity: 0.9; }
  50% { transform: scale(0.55); opacity: 0.45; }
}

.track-row__dur {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.track-row:hover { border-top-color: var(--ink-faint); }
.track-row:hover .track-row__title { color: var(--accent); transform: translateX(6px); }
.track-row:hover .track-row__numeral { color: var(--accent); }
.track-row.is-current .track-row__numeral { color: var(--accent); }
.track-row.is-current .track-row__title { color: var(--ink); }

.album__foot { margin-top: 2rem; }

/* ------------------------------------------------------------------ */
/* the song object                                                     */
/* ------------------------------------------------------------------ */

.object { max-width: 760px; }

.object__crumb { margin-bottom: 3rem; }
.object__crumb a {
  font-size: 0.72rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--ink-faint);
  transition: color 0.3s ease;
}
.object__crumb a:hover { color: var(--accent); }

.object__kicker { margin-top: 0.4rem; }
.object__provenance { margin-top: 0.7rem; font-style: normal; }

.object__title {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 4.6rem);
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.05;
  margin: 1.2rem 0 3rem;
}

/* transport --------------------------------------------------------- */

.transport {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 12px 18px;
  border: 1px solid var(--hairline);
  background: var(--bg-raised);
}

.transport__play {
  width: 44px; height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-dim);
  transition: color 0.3s ease, border-color 0.3s ease, transform 0.2s ease;
}
.transport__play svg { width: 18px; height: 18px; }
.transport__play:hover { color: var(--accent); border-color: var(--accent); }
.transport__play:active { transform: scale(0.96); }

.icon-pause { display: none; }
body.is-playing #plinth-play .icon-play { display: none; }
body.is-playing #plinth-play .icon-pause { display: block; }
.transport__play.is-own-playing .icon-play { display: none; }
.transport__play.is-own-playing .icon-pause { display: block; }

.timeline { padding: 14px 0; cursor: pointer; }
.timeline__rail {
  height: 2px;
  background: var(--hairline);
  position: relative;
}
.timeline__fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%;
  background: var(--accent);
  transition: width 0.25s linear;
}

.transport__time {
  font-size: 0.78rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.time-sep { color: var(--hairline); }

.absent-note {
  margin-top: 1.1rem;
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.9rem;
}
.absent-dash { color: var(--hairline); }

/* the words --------------------------------------------------------- */

.words-block { margin-top: 3.2rem; }

.words-toggle {
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 4px;
  transition: color 0.3s ease, border-color 0.3s ease;
}
.words-toggle:hover { color: var(--accent); border-color: var(--accent); }

.words { margin-top: 2rem; }
.words p {
  max-width: 42ch;
  font-size: 1.18rem;
  line-height: 1.85;
  animation: wordsrise 0.9s var(--ease-stage) both;
}
/* each line stands alone so the song's own clock — duration ÷ line count —
   can turn them, one at a time, in the poem's own order. A turned line takes
   the album's accent and keeps it: by the song's end the poem wears it whole.
   A transformation of the display, never a reading of the sound. */
.words__line { display: block; transition: color 1.4s ease; }
.words__line:empty { height: 1.85em; }
.words__line.is-turned { color: var(--accent); }
.words p.words--absent {
  font-style: italic;
  color: var(--ink-faint);
  font-size: 0.95rem;
}
@keyframes wordsrise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.object__neighbors {
  margin-top: 4.5rem;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ */
/* appendices                                                          */
/* ------------------------------------------------------------------ */

.appendix { max-width: 62ch; }
.appendix__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 5vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  margin: 1rem 0 2rem;
}
.appendix > p { margin-bottom: 1.2rem; }

.reg-album { margin-top: 3rem; }
.reg-album h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  color: var(--ink-dim);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--hairline);
}

.reg-row {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.92rem;
}
.reg-row__track { color: var(--ink-dim); transition: color 0.3s ease; }
.reg-row__track:hover { color: var(--accent); }
.reg-row__src { color: var(--ink-faint); }
.reg-note { font-style: italic; }

.reg-outro {
  margin-top: 3.5rem;
  font-style: italic;
  color: var(--ink-dim);
}

.colophon__build { margin-top: 3rem; font-size: 0.85rem; }

/* ------------------------------------------------------------------ */
/* the plinth — the song follows the visitor through every room        */
/* ------------------------------------------------------------------ */

.plinth {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: auto minmax(12rem, 1fr) minmax(8rem, 1.4fr) auto;
  align-items: center;
  gap: 26px;
  padding: 14px 24px;
  background: rgba(18, 16, 13, 0.88);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--hairline);
}

.plinth__play {
  width: 44px; height: 44px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid; place-items: center;
  color: var(--ink-dim);
  transition: color 0.3s ease, border-color 0.3s ease;
}
.plinth__play:hover { color: var(--accent); border-color: var(--accent); }

.plinth__meta {
  display: flex; align-items: baseline; gap: 12px;
  min-width: 0;
}
.plinth__numeral {
  font-size: 0.65rem; letter-spacing: 0.2em;
  color: var(--ink-faint);
  white-space: nowrap;
}
.plinth__title {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.plinth__album {
  font-size: 0.72rem;
  color: var(--ink-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.plinth__time {
  font-size: 0.75rem;
  color: var(--ink-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.plinth__absent {
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-faint);
}

/* ------------------------------------------------------------------ */
/* narrow rooms                                                        */
/* ------------------------------------------------------------------ */

/* ------------------------------------------------------------------ */
/* tall narrow rooms — portrait tablets and phones                     */
/*                                                                     */
/* There are no margins to keep, so the figure concedes the room and   */
/* stands behind the page itself: centered on the reading column,      */
/* sized to the layout's full height so scrolling down reveals more    */
/* of it, dissolved at head and foot, and quiet enough that the        */
/* column stays legible. (js/main.js sizes the layer to the layout.)   */
/* ------------------------------------------------------------------ */

@media (max-width: 1024px) and (orientation: portrait) {
  .figures {
    position: absolute; top: 0; left: 0; right: 0; bottom: auto;
    height: 100%;   /* replaced with the layout height by js/main.js */
  }
  .atmosphere__figure.is-active { opacity: calc(var(--presence, 0.2) * 0.65); }
  .atmosphere__figure {
    -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 82%, transparent 100%);
            mask-image: linear-gradient(to bottom, transparent 0, #000 10%, #000 82%, transparent 100%);
  }
}

/* ------------------------------------------------------------------ */
/* narrow rooms                                                        */
/* ------------------------------------------------------------------ */

@media (max-width: 700px) {
  .view { padding: 2.5rem 18px 6rem; }
  .masthead { padding: 0 18px; }

  .plate a {
    grid-template-columns: 3rem 1fr;
    row-gap: 6px;
    padding: 24px 0;
  }
  .plate__epigraph { grid-column: 2; }

  .track-row { grid-template-columns: 2.2rem 1fr auto 3.4rem; gap: 10px; }

  .transport { grid-template-columns: auto 1fr; gap: 14px; padding: 10px 14px; }
  .transport__time { grid-column: 2; justify-self: end; }

  .plinth {
    grid-template-columns: auto 1fr auto;
    gap: 14px;
    padding: 12px 18px;
  }
  .plinth__timeline { grid-column: 1 / -1; order: 3; }
  .plinth__album { display: none; }

  .reg-row { grid-template-columns: 1fr; gap: 4px; }
}

/* ------------------------------------------------------------------ */
/* stillness                                                           */
/* ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .rise { opacity: 1; transform: none; }
}
