/* The light-path page skeleton for project pages. One beam in the page's own wavelength runs across the top, the
   live instrument sits in the hero inside a frame of the same colour, and the measured result reads off beside it.
   Colours are LP.rgb(nm) from lp-core.js, written out here so the page is right before any script runs and with
   none at all. Home groups: Roots 405, Build 633, Frontier 1064, Use 532, Play 580. */
.nm-405 { --beam: rgb(140, 105, 191); }
.nm-532 { --beam: rgb(96, 217, 96); }
.nm-580 { --beam: rgb(214, 171, 93); }
.nm-633 { --beam: rgb(191, 100, 100); }
.nm-1064 { --beam: rgb(211, 208, 218); }
.lp-page { --beam-soft: color-mix(in srgb, var(--beam) 12%, transparent); --beam-line: color-mix(in srgb, var(--beam) 38%, var(--rule)); }

/* the ruler carries the page's colour */
.lp-page .ruler-mark { background: var(--beam); transition: transform var(--t-panel, 240ms) var(--ease-out, ease), background-color 600ms ease; }
.lp-page .ruler-read { color: var(--beam); }

/* ---------- the top: beam, words, instrument, readout ---------- */
.lp-top { --gap: clamp(20px, 3.4vw, 48px); display: grid; gap: 0 var(--gap); grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "beam" "copy" "stage" "readout"; padding-bottom: 40px; }
.lp-beamline { grid-area: beam; position: relative; height: 2px; margin-top: 12px; background: var(--beam-line); }
.lp-beamline::before { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, var(--beam) 0, var(--beam) 55%, transparent); transform-origin: 0 50%; animation: lp-beam-in 720ms cubic-bezier(.2, .8, .2, 1) both; }
@keyframes lp-beam-in { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.lp-top .lp-copy { grid-area: copy; padding-block: 28px 24px; gap: 14px; max-width: none; align-content: start; }
.lp-top .lp-copy h1 { font-size: clamp(2rem, 4.6vw, 3.1rem); line-height: 1.04; letter-spacing: -0.035em; margin: 0; text-wrap: balance; }
.lp-top .lp-copy .lede { font-size: var(--step-0); line-height: 1.5; max-width: 46ch; margin: 0; }
.lp-kick { margin: 0; display: flex; flex-wrap: wrap; gap: 2px 12px; align-items: baseline; }
.lp-kick b { font-weight: 500; color: var(--beam); }
.lp-kick .lp-nm { color: var(--beam); font-variant-numeric: tabular-nums; }
.lp-kick .lp-meta { flex-basis: 100%; }

.lp-stage.block { grid-area: stage; align-self: start; display: block; padding: 0; border: 0; position: relative; min-width: 0; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--rule); border-top: 2px solid var(--beam); }
.lp-stage.block::before { content: ""; position: absolute; inset: 0 0 auto; height: 140px; pointer-events: none; background: linear-gradient(180deg, var(--beam-soft), transparent); }
.lp-stage > .side { position: relative; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 2px 16px; padding: 12px 16px 10px; border-bottom: 1px solid var(--rule); }
.lp-stage > .side .label { color: var(--beam); margin: 0; }
.lp-stage > .side .mono { margin: 0; }
.lp-stage > .main { position: relative; padding: 16px; max-width: none; gap: 16px; }
.lp-stage .panel { background: transparent; }

.lp-top .lp-readout { grid-area: readout; background: none; border: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px 28px; margin: 16px 0 0; }
.lp-top .lp-readout > div { background: none; padding: 10px 0 0; border-top: 1px solid var(--rule-2); gap: 4px; }
.lp-top .lp-readout > div:has(.result) { border-top-color: var(--beam); }
.lp-top .lp-readout .value { font-family: var(--font-display); font-weight: 400; font-size: clamp(1.5rem, 2.6vw, 2rem); letter-spacing: -0.02em; white-space: normal; }
.lp-top .lp-readout .result { color: var(--beam); }
.lp-top .lp-readout .value .mono { font-size: var(--step--2); }

@media (min-width: 1040px) {
  .lp-top { grid-template-columns: minmax(280px, 0.36fr) minmax(0, 0.64fr); grid-template-rows: auto auto 1fr;
    grid-template-areas: "beam beam" "copy stage" "readout stage"; padding-bottom: 56px; }
  .lp-top .lp-copy { padding-top: 36px; }
  .lp-top .lp-readout { grid-template-columns: 1fr; align-self: start; margin-top: 4px; gap: 10px; }
  .lp-top .lp-readout > div { grid-template-columns: minmax(0, 1fr) auto; column-gap: 16px; align-items: baseline; padding-top: 8px; }
  .lp-top .lp-readout .value { grid-column: 2; grid-row: 1 / span 2; text-align: right; white-space: nowrap; font-size: 1.6rem; }
  .lp-top .lp-readout .label, .lp-top .lp-readout .note { grid-column: 1; }
  .lp-stage.block { margin-top: 28px; }
}
@media (max-width: 640px) {
  .lp-stage > .main { padding: 12px; }
  .lp-stage > .side { padding: 10px 12px 8px; }
}

/* the rest of the page keeps its content and takes the colour */
.lp-page .intro { border-left-color: var(--beam); }
.lp-page .intro-where a { color: var(--ink); }
.lp-page .block > .side .label { color: var(--ink-2); }

/* a recorded loop where a live demo is too heavy for the hero */
.lp-loop { position: relative; margin: 0; background: #000; }
.lp-loop video, .lp-loop img { display: block; width: 100%; height: auto; }
.lp-loop video { aspect-ratio: var(--ratio, 16 / 9); object-fit: cover; }
.lp-loop figcaption { position: relative; padding: 10px 16px; border-top: 1px solid var(--rule); font-family: var(--font-data); font-size: var(--step--2); color: var(--muted); }
.lp-loop .lp-still { display: none; }
@media (prefers-reduced-motion: reduce) { .lp-loop video { display: none; } .lp-loop .lp-still { display: block; } .lp-beamline::before { animation: none; } }

/* the ncm race */
.race { display: grid; gap: 14px; padding: 8px 0; }
.race-row { display: grid; grid-template-columns: minmax(96px, 150px) minmax(0, 1fr) 4.5em; gap: 12px; align-items: center; font-family: var(--font-data); font-size: var(--step--1); }
.race-name { color: var(--ink-2); }
.race-bar { display: block; height: 14px; background: var(--rule); overflow: hidden; }
.race-bar i { display: block; height: 100%; background: var(--muted); transform-origin: 0 50%; transform: scaleX(1); }
.race-row:first-child .race-bar i { background: var(--beam); }
.race-t { text-align: right; color: var(--ink); font-variant-numeric: tabular-nums; }
.race-row:first-child .race-t { color: var(--beam); }
@media (max-width: 520px) { .race-row { grid-template-columns: 1fr 4.5em; } .race-name { grid-column: 1 / -1; } }

/* a picture or film as the stage */
.lp-flush figure { margin: 0; position: relative; }
.lp-flush img, .lp-flush video { display: block; width: 100%; height: auto; }
.lp-flush figcaption { padding: 10px 16px; border-top: 1px solid var(--rule); }

/* a stage that needs the whole width (the board and its move list) */
@media (min-width: 1040px) {
  .lp-top.lp-wide { grid-template-columns: minmax(0, 1fr) minmax(280px, 0.42fr); grid-template-rows: auto auto auto;
    grid-template-areas: "beam beam" "copy readout" "stage stage"; }
  .lp-top.lp-wide .lp-readout { align-self: end; padding-bottom: 24px; }
  .lp-top.lp-wide .lp-stage.block { margin-top: 0; }
}
.lp-loop video, .lp-loop .lp-still { width: auto; max-width: 100%; max-height: min(66vh, 560px); margin-inline: auto; }
