/* "Pressure" — the theme for /plumbing/.
 *
 * Everything here is scoped to body.theme-plumbing so it cannot reach another
 * page. The footage behind the copy is decorative: the backdrop is aria-hidden,
 * every word over it is in the DOM at load, and each beat carries a still with
 * real alt text for crawlers and for anyone whose frames never arrive.
 *
 * Layout: the footage is a tall column on the right at desktop widths, because
 * the source is portrait and cropping it into a 16:9 background would throw
 * away about 70% of the frame. Below 900px it goes full-bleed behind the text,
 * where the aspect ratio matches the screen.
 */

.theme-plumbing {
  --t-black: #0E0B09;
  --t-ink: #F4F0EB;
  --t-mut: #B5ABA2;
  --t-amber: #FFB020;
  --t-line: rgba(244, 240, 235, .16);
  --t-col: 42vw;                     /* footage column width at desktop */
  --t-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---- the themed region ------------------------------------------------- */
.theme-plumbing .theme { position: relative; background: var(--t-black); color: var(--t-ink); }

/* The backdrop sticks for the length of the themed region, and the hero is
 * pulled back over it so it costs no layout space. The pull has to be on the
 * hero rather than a negative bottom margin on the backdrop itself: sticky
 * keeps an element inside its container by measuring the MARGIN box, so a
 * -100vh bottom margin collapses that box to nothing and the canvas carries on
 * painting over whatever follows the themed region.
 */
.theme-plumbing .theme-bg {
  position: sticky; top: 0; z-index: 0; overflow: hidden;
  height: 100vh;
  background: var(--t-black) url("/assets/pressure/w540/f001.webp") center / cover no-repeat;
}
.theme-plumbing .theme > .hero { margin-top: -100vh; }
@supports (height: 100svh) {
  .theme-plumbing .theme-bg { height: 100svh; }
  .theme-plumbing .theme > .hero { margin-top: -100svh; }
}
.theme-plumbing .theme-bg > * { position: absolute; inset: 0; }
.theme-plumbing #theme-canvas { display: block; width: 100%; height: 100%; }
.theme-plumbing .theme-dim { background: var(--t-black); opacity: .52; }
.theme-plumbing .theme-scrim {
  background: linear-gradient(to top,
    rgba(14, 11, 9, .96) 0%, rgba(14, 11, 9, .3) 44%, rgba(14, 11, 9, 0) 72%);
}

/* Frame loading shows as a hairline, not a percentage: a number invites you to
 * watch it. The word inside is for markup only and is visually hidden. */
.theme-plumbing .theme-load {
  inset: auto 0 0 0; height: 2px; margin: 0;
  font-size: 0; line-height: 0; color: transparent;
  background: rgba(244, 240, 235, .14);
  transition: opacity .4s ease;
}
.theme-plumbing .theme-load::after {
  content: ""; display: block; height: 100%; width: var(--p, 0%);
  background: var(--t-amber); transition: width .25s linear;
}
.theme-plumbing.frames-ready .theme-load { opacity: 0; }

/* ---- hero over the footage --------------------------------------------- */
.theme-plumbing .theme .hero {
  background: none; padding: 0; overflow: visible;
  min-height: 100vh; display: grid; align-items: center;
}
@supports (height: 100svh) { .theme-plumbing .theme .hero { min-height: 100svh; } }
.theme-plumbing .theme .hero::before,
.theme-plumbing .theme .hero::after { content: none; }
.theme-plumbing .theme .hero .wrap {
  grid-template-columns: 1fr; gap: 36px; padding-block: 108px 72px;
}
.theme-plumbing .theme .hero .sub { color: var(--t-mut); }
.theme-plumbing .theme .hero-note { color: var(--t-mut); }
.theme-plumbing .theme .dash { transform: none; max-width: 560px; }

/* ---- beats -------------------------------------------------------------- */
.theme-plumbing .beats { position: relative; z-index: 1; }
.theme-plumbing .beat {
  min-height: 100vh; display: grid; align-items: center;
}
@supports (height: 100svh) { .theme-plumbing .beat { min-height: 100svh; } }
.theme-plumbing .beat .wrap {
  display: grid; gap: 16px; justify-items: start; padding-block: 80px;
}
.theme-plumbing .beat .label {
  margin: 0; font-family: var(--t-mono); font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--t-amber);
}
.theme-plumbing .beat h2 {
  margin: 0; font-size: clamp(32px, 5vw, 58px); line-height: 1.08;
  max-width: 15ch; text-wrap: balance;
}
.theme-plumbing .beat .body {
  margin: 0; font-size: clamp(16px, 1.4vw, 19px); color: var(--t-mut); max-width: 46ch;
}
.theme-plumbing .beat .still {
  width: 100%; max-width: 380px; height: auto; margin-top: 6px;
  border: 1px solid var(--t-line);
}

/* Both columns at desktop: copy on the left, footage pinned right. The left
 * edge lines up with the rest of the site's content on a wide screen. */
@media (min-width: 900px) {
  .theme-plumbing .theme-bg { width: var(--t-col); margin-left: auto; }
  .theme-plumbing .theme-dim { opacity: .22; }
  .theme-plumbing .theme-scrim {
    background: linear-gradient(to right, rgba(14, 11, 9, 1) 0%, rgba(14, 11, 9, 0) 20%);
  }
  .theme-plumbing .theme .wrap {
    max-width: none; width: 100%;
    padding-left: max(40px, calc((100vw - var(--max)) / 2));
    padding-right: calc(var(--t-col) + 56px);
  }
}

/* ---- progressive enhancement -------------------------------------------
 * Without JS, with reduced motion, or if the canvas never starts: the stills
 * stay on the page and every beat reads at full opacity. That is also what a
 * crawler gets, so it is the version that has to make sense on its own.
 */
.theme-plumbing.is-live .beat .still { display: none; }
.theme-plumbing.is-live .beat .wrap > * {
  opacity: 0; transform: translateY(14px);
  transition: opacity .6s ease, transform .6s ease;
}
.theme-plumbing.is-live .beat.in .wrap > * { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .theme-plumbing .beat .wrap > * { opacity: 1; transform: none; transition: none; }
  .theme-plumbing .theme-load { display: none; }
}
