/* ==========================================================================
   8m/s — "Dominion of Cold" / THE WALL
   A second take on the album page, carried over from the band's earlier
   attempt: the sleeve's back stands fixed behind everything and the lyrics are
   inscriptions cut into it, lit only as you reach them. Free order rather than
   a numbered tracklist — the full running order sits at the bottom.
   ========================================================================== */

/* The wall is a fixed layer under a scrolling page, so a rubber-band overscroll
   at either end drags the page off it and shows what is behind. Stop the bounce,
   and paint the root the same colour in case a browser bounces anyway. */
html:has(body.wall) { background: #010203; overscroll-behavior-y: none; }
body.wall {
  background: #010203;
  overscroll-behavior-y: none;
  /* The site's --ease is a hard ease-out: 60% of the way in the first fifth of
     the time. Right for a button, wrong for something meant to surface slowly —
     it made the carving legible almost at once. This one holds back at the
     start and settles at the end. */
  --ease-carve: cubic-bezier(.28, .62, .24, 1);
}

/* --- the stone ---------------------------------------------------------- */

.stone { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
.stone__face {
  /* Taller than the viewport so the wall itself can travel down to the water
     on a compositor transform. One image, one geometry — a second copy at a
     different crop is what made the monolith edges double up. */
  position: absolute; inset: 0 0 auto;
  /* 200% of the viewport, not 170%: the extra height is reserve, so a phone
     toolbar sliding back into place — which shrinks the viewport under a pan
     measured against the taller one — cannot lift the wall's bottom edge off
     the bottom of the screen. */
  /* 150%, not 200%. The taller the box, the harder `cover` has to scale a
     square sleeve to fill it, and on a phone that meant only 23% of the
     artwork's width was on screen — a narrow vertical slice. At 150% it is
     31%, and there is still 295px of travel down to the water.
     A pointer device has no toolbar sliding in and out, so it needs less
     reserve again — and at 2560 wide two layers of it cost hundreds of MB. */
  height: 150%;
  @media (hover: hover) { height: 135%; }
  background-position: center top; background-size: cover; background-repeat: no-repeat;
  transform-origin: 50% 0;
  will-change: transform, opacity;
}
/* You start in front of the sleeve and end up behind it: the front stands
   first, the back arrives over it about a third of the way down. */
.stone__face--front { background-image: url("assets/wall-front.webp"); }
.stone__face--back  {
  background-image: url("assets/wall-back.webp"); opacity: 0;
  /* its size and position are set from the front's, in wall.js */
}
/* the veil of depth: heaviest around three fifths down, lifting at the sea */
.stone__depth {
  position: absolute; inset: 0;
  background: #010203;
  opacity: 0;
  will-change: opacity;
}
/* slow cold breath over the stone */
.stone__fog {
  position: absolute; inset: -15%;
  background:
    radial-gradient(40% 26% at 28% 60%, rgba(46, 74, 100, .16), transparent 70%),
    radial-gradient(36% 24% at 74% 34%, rgba(36, 60, 84, .14), transparent 70%);
}
/* The drift used to run for ever on a full-screen gradient that was never
   promoted, so every frame of it repainted the sleeves underneath. The haze
   is worth keeping; the movement was not. */

.wall-stage { position: relative; z-index: 2; }

/* --- the nav keeps out of the reading -------------------------------------
   Going down the wall the bar withdraws; the first move back up brings it
   back. It never hides while the menu is open, and it always shows at the
   top of the page. */
body.wall .nav { transition: transform .45s var(--ease), background .45s var(--ease); }
/* No backdrop blur here. It only appears on the way back up, and a blurred
   backdrop over a wall that moves on every frame is re-blurred on every
   frame — the one cost that existed going up and not going down. A near-solid
   bar reads the same against the stone. */
body.wall .nav.is-stuck {
  backdrop-filter: none; -webkit-backdrop-filter: none;
  background: rgba(4, 6, 10, .92);
}
body.wall .nav.is-hidden { transform: translateY(-100%); }
body.wall.menu-open .nav { transform: none; }

/* --- the lintel --------------------------------------------------------- */

.lintel {
  min-height: 100vh; min-height: 100svh;
  display: grid; place-content: center; text-align: center;
  padding: 20vh var(--gut) 10vh;
}
.lintel h1 {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: clamp(1.4rem, 1rem + 2.6vw, 3rem);
  letter-spacing: .46em; text-indent: .46em;
  text-transform: uppercase;
  /* .62 sat the title straight across the brightest cloud on the sleeve and
     the letters went missing in the middle of the word. */
  color: rgba(214, 228, 238, .88);
  margin: 0;
  text-shadow:
    0 1px 0 rgba(0, 0, 0, .9), 0 2px 6px rgba(0, 0, 0, .7),
    0 -1px 1px rgba(222, 238, 248, .3), 0 0 30px rgba(1, 2, 3, .9);
}
/* a pool of dark behind the name, so it reads against the storm on any crop */
.lintel { position: relative; isolation: isolate; }
.lintel::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  left: 50%; top: 50%; width: min(100vw, 60rem); height: 60vh;
  transform: translate(-50%, -50%);
  background: radial-gradient(50% 50% at 50% 50%, rgba(1, 2, 3, .55), rgba(1, 2, 3, .28) 45%, transparent 100%);
}
/* A falling line under the title, and no word: a moving cue is the only thing
   that reads as "there is more below" on a phone with no scrollbar. The line
   is a faint rail with a glint that slides down it and out — the gradient is
   three times the rail's height, so the bright part starts above the rail and
   leaves below it, and each pass fades in and out of nothing. The earlier cue
   drew the line and then snapped back to zero, which read as a restart. */
.lintel__hint { margin: 2.6rem 0 0; display: grid; justify-items: center; }
.lintel__hint::after {
  content: ""; width: 2px; height: 84px; border-radius: 1px;
  background:
    linear-gradient(to bottom,
      transparent 0%, transparent 33%,
      rgba(143, 199, 220, .35) 41%, #f2fbff 50%, rgba(143, 199, 220, .35) 59%,
      transparent 67%, transparent 100%),
    linear-gradient(to bottom, transparent, rgba(143, 199, 220, .32) 30%, rgba(143, 199, 220, .32) 70%, transparent);
  background-size: 100% 300%, 100% 100%;
  background-repeat: no-repeat;
  background-position: 0 100%, 0 0;
  /* the glow follows the painted alpha, so only the glint carries a halo */
  filter: drop-shadow(0 0 5px rgba(196, 232, 246, .95)) drop-shadow(0 0 14px rgba(143, 199, 220, .6));
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 22%, #000 78%, transparent);
  animation: lintel-glint 3.2s cubic-bezier(.45, .05, .55, .95) infinite;
}
@keyframes lintel-glint {
  from { background-position: 0 100%, 0 0; }
  to   { background-position: 0 0%,   0 0; }
}

/* --- the inscriptions --------------------------------------------------- */

.inscription {
  /* Deliberately NOT content-visibility: auto. Tried, and the carvings are not
     all the same height, so no contain-intrinsic-size matches: the document
     height changed on 20 of 21 scroll samples and the page grew by 1440px. */
  min-height: 100vh; min-height: 92svh;
  display: grid; align-content: center;
  padding: 10vh clamp(1.4rem, 6vw, 5rem);
}
.inscription .block { max-width: 46rem; margin: 0; }
/* carvings sit at different reaches of the wall */
.inscription:nth-of-type(odd)  .block { margin-inline: auto; text-align: center; }
.inscription:nth-of-type(even) .block { margin-inline: min(10vw, 9rem) auto; text-align: left; }
.inscription:nth-of-type(4n)   .block { margin-inline: auto min(10vw, 9rem); text-align: right; }

.carved {
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-weight: 600;
  font-size: clamp(1.15rem, .85rem + 1.7vw, 2.15rem);
  line-height: 1.78; letter-spacing: .13em;
  text-transform: uppercase;
  color: rgba(206, 222, 234, .58);
  margin: 0;
  /* chiselled: a dark cut below, cold light catching the upper edge. One
     shadow for both states — transitioning text-shadow or colour repaints the
     whole block on every frame of the tween. Opacity does the dimming. */
  /* The halo was 36px. A wide-radius text-shadow is the most expensive thing
     to rasterise on the page, and it is paid again every time the block
     repaints; at 18px the cold light is still there for a fraction of it. */
  text-shadow:
    0 1px 0 rgba(0, 0, 0, .9),
    0 2px 4px rgba(0, 0, 0, .65),
    0 -1px 1px rgba(222, 238, 248, .34),
    0 0 18px rgba(120, 160, 196, .16);
  /* The carving surfaces out of the stone rather than fading up: the blur is
     tweened with everything else and leads the opacity slightly, so the shape
     is legible before the edges are. Long, because the whole point is that you
     watch it arrive. */
  transition:
    opacity .85s var(--ease-carve),
    transform 1s var(--ease-carve),
    filter .7s var(--ease-carve);
  /* The blur is the only thing on either page that drops frames, because an
     unpromoted text block repaints into the whole 11000px-tall stage layer.
     Hinting it cuts rasterisation from ~120ms to ~15ms per full scroll, and
     changes nothing visually. NOT translateZ(0) — measured, that makes
     rastering 7-10x worse, because the blur re-rasters the layer every frame.

     The hint is on .is-near, not here. Left on all eleven carvings for the
     life of the page it promoted the whole stage: 38 composited layers and
     56MB of layer memory, two of them the full 390x10510 page. A phone cannot
     hold that, so it evicts tiles and re-rasters them, which is the tearing
     you see on a fast scroll. */
}
/* The unlit state is the animation's first frame, so it only applies where the
   script that lights the stone can run. Without JS the words read plainly. */
@media (scripting: enabled) {
  /* 9px, down from 13: the blur's cost grows with its radius, and the
     four-line carving is the widest block on the page. The surfacing reads
     the same; the opacity does most of the work in the first frames anyway. */
  .carved { opacity: .05; transform: translateY(24px) scale(.978); filter: blur(9px); }
}
.carved[lang="bg"] {
  /* Cinzel has no Cyrillic. Oranienbaum does, but it is a thin condensed
     display face — beside the Latin carvings it read as a different, lighter
     inscription. EB Garamond at 600 carries the same stem weight and the same
     old-style serifs, so both languages look cut by the same hand. */
  font-family: "EB Garamond", "Cinzel", Georgia, serif;
  letter-spacing: .09em;
  font-size: clamp(1.25rem, .9rem + 1.9vw, 2.4rem);
}

.inscription.lit .carved { opacity: 1; transform: none; filter: blur(0); }
/* promoted only while it is anywhere near the screen */
.inscription.is-near .carved { will-change: filter, opacity, transform; }

.carve-hit {
  position: absolute; inset: -2.5rem -3rem; z-index: 3;
  appearance: none; -webkit-appearance: none;
  background: none; border: 0; padding: 0; margin: 0; cursor: pointer;
}
.block { position: relative; isolation: isolate; }
/* Each carving stands in its own shadow: a soft pool of dark behind the block
   that arrives with the light. Without it the first three inscriptions sat
   across the brightest part of the sleeve, and the Cinzel hairlines vanished
   into the cloud on a wide screen. */
.block::before {
  content: ""; position: absolute; z-index: -1; pointer-events: none;
  inset: -22% -14%;
  background: radial-gradient(50% 50% at 50% 50%, rgba(1, 2, 3, .58), rgba(1, 2, 3, .3) 50%, transparent 100%);
  opacity: 0; transition: opacity 1.1s var(--ease-carve);
}
.inscription.lit .block::before, .sea .block::before { opacity: 1; }
/* promoted with the carving, so its fade is composited rather than repainted */
.inscription.is-near .block::before { will-change: opacity; }
/* --- the carvings are worth pressing ------------------------------------ */
/* No label and no arrow: the signal has to be in the material. The mason's
   mark carries a hairline cut beneath it — the one typographic convention that
   reads as "this opens" without adding a word — and the carving itself
   answers to a press, which is the only discovery a touch screen allows. */
.mark {
  position: relative;
  padding-bottom: .55rem;
}
.mark::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0;
  height: 1px;
  background: linear-gradient(to right,
    transparent, rgba(158, 182, 202, .5) 18%, rgba(158, 182, 202, .5) 82%, transparent);
  opacity: 0; transform: scaleX(.4);
  transition: opacity .6s var(--ease-carve) .5s, transform .7s var(--ease-carve) .5s;
}
.inscription.lit .mark::after, .sea .mark::after { opacity: 1; transform: none; }
/* the mark sits under a centred carving on most rows, so the cut centres too */
.inscription:nth-of-type(odd) .mark::after { transform-origin: 50%; }

.carve-hit { cursor: pointer; }
/* Colour and text-shadow are deliberately NOT transitioned on the carving.
   A change to either repaints the whole block — with its glow — on every
   frame of the tween, and on a desktop the pointer is resting somewhere on
   the page while you scroll, so every carving that passes under it starts
   one. The four-line carving is the widest block on the page, and that is
   where the scroll was seen to stutter. */

/* pressed: the cut deepens and the stone catches more light */
.block:active .carved {
  color: rgba(232, 244, 252, .92);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, .95),
    0 2px 6px rgba(0, 0, 0, .8),
    0 -1px 1px rgba(232, 244, 252, .5),
    0 0 22px rgba(140, 184, 216, .3);
}
.block:active .mark::after { background: linear-gradient(to right,
  transparent, rgba(206, 230, 246, .9) 18%, rgba(206, 230, 246, .9) 82%, transparent); }

@media (hover: hover) {
  /* the carving itself does not change under the pointer — see above */
  .inscription.lit:hover .mark, .sea:hover .mark { color: rgba(206, 226, 240, .95); }
  .inscription.lit:hover .mark::after, .sea:hover .mark::after {
    background: linear-gradient(to right,
      transparent, rgba(196, 222, 240, .85) 18%, rgba(196, 222, 240, .85) 82%, transparent);
  }
}

.mark {
  display: block; margin-top: 2.4rem;
  font-family: var(--f-mono); font-style: normal;
  font-size: .6rem; letter-spacing: .42em; text-indent: .42em;
  text-transform: uppercase;
  color: rgba(158, 182, 202, .72);
  opacity: .35;
  transition: opacity .7s var(--ease-carve) .35s;   /* the mason's mark lights last */
}
.inscription.lit .mark { opacity: 1; }


/* --- the sea ------------------------------------------------------------ */

.sea {
  position: relative;
  min-height: 100vh; min-height: 108svh;
  display: grid; place-content: center; text-align: center;
  padding: 22vh var(--gut) 16vh;
}
/* the fixed wall gives way to the sea itself — the same artwork faded in from
   its own bottom edge, so no seam can ever show */
/* The sea is simply where the wall has got to by the end — no second image,
   so the track list rises out of the same water it was already standing in. */
.tide { position: relative; }
.sea .carved {
  opacity: 1; transform: none; filter: none;
  color: rgba(222, 236, 246, .88);
  font-size: clamp(1.35rem, .95rem + 2.2vw, 2.7rem);
  text-shadow:
    0 1px 0 rgba(0, 0, 0, .9),
    0 2px 6px rgba(0, 0, 0, .7),
    0 -1px 1px rgba(230, 244, 252, .4),
  /* The glow was 0 0 60px. On display type that size it is the single most
     expensive thing on the page to rasterise, and it sits at the bottom where
     it is re-drawn on every scroll frame: measured, it alone accounted for
     2400ms of the bottom quarter's 3000ms of raster work. At 26px the halo is
     still there and the cost is a quarter. Clipping it with contain:paint was
     cheaper still, but it cuts the halo off at the text's own box. */
    0 0 26px rgba(140, 184, 216, .26);
}
.sea .mark { opacity: 1; color: rgba(196, 216, 230, .85); text-shadow: 0 1px 10px rgba(1, 2, 3, .95); }

@media (max-width: 760px) {
  /* every carving centres, and the tracking eases off so the lines break
     where the poem breaks rather than mid-phrase */
  .inscription:nth-of-type(even) .block,
  .inscription:nth-of-type(4n) .block { margin-inline: auto; text-align: center; }
  .carved { letter-spacing: .075em; font-size: clamp(1rem, .82rem + 1.5vw, 2.15rem); text-wrap: balance; }
  .carved[lang="bg"] { letter-spacing: .05em; font-size: clamp(1.05rem, .85rem + 1.7vw, 2.4rem); }
  .lintel h1 { letter-spacing: .26em; text-indent: .26em; }
  .mark { letter-spacing: .3em; text-indent: .3em; }
  /* the closing line ran to seven lines and off the bottom of a phone */
  .sea .carved { font-size: clamp(1.1rem, .9rem + 1.6vw, 1.8rem); line-height: 1.7; }
  .block::before { inset: -18% -10%; }
}

@media (prefers-reduced-motion: reduce) {
  .stone__fog { animation: none; }
  .lintel__hint::after { animation: none; background-position: 0 50%, 0 0; }
  .carved, .mark { transition: none; }
  .inscription .carved { opacity: 1; transform: none; filter: none; }
}

/* ── the two ways out, at the bottom of the wall ─────────────────────────
   Down here the page is at its darkest, and the site's filled ice button
   read as a light switched on. "Dig a little deeper" turns dark instead,
   so it belongs to the depth, and stays the thing to press through its ice
   rim, ice lettering and the same slow breath of light. "Back to the
   surface" stays a plain way out (see album.css), only lighter. */
.ledger__ctas .btn--call {
  background: var(--void); border-color: var(--ice); color: var(--ice);
}
.ledger__ctas .btn--call:hover, .ledger__ctas .btn--call:focus-visible {
  background: var(--slate); border-color: #b5e0ef; color: #b5e0ef;
}
.ledger__ctas .btn--ghost { color: rgba(232, 241, 245, .9); }
.ledger__ctas .btn--ghost:hover, .ledger__ctas .btn--ghost:focus-visible { color: #fff; }

/* --- the running order stands inside the portal ---------------------------
   At 560px the list was wider than the dark column on a laptop, so the track
   numbers sat right on its edge. It now takes the portal's width (set in
   wall.js as --portal-w) less a margin either side, and never more than 560. */
.ledger .tracklist { width: min(560px, 100%, calc(var(--portal-w, 620px) - 3.5rem)); }
