/* =========================================================================
   /rig — hero storyboard (#rig-hero)
   Loaded after css/rig.css, which owns the base layout (sticky stage
   column, poster/canvas crossfade, progress dots). This file adds:
     - full mode: storyboard pacing, beat panels, the beat-3 callouts
       overlay (story-labels.js)
     - static mode (reduced motion, no WebGL 2, save-data, low-end, 3D
       failed, or no JavaScript): the six beats as a tidy set of cards
       under the poster instead of a long, mostly empty scroll
   ========================================================================= */

/* ---- Full mode: pacing ------------------------------------------------ */
/* Each beat panel is the scroll distance of one beat. Desktop: intro +
   6 beats ≈ 4.4 viewport heights of pinned scroll; phones a bit less. */
@media (min-width: 900px) {
  .rig-full .rig-beat { min-height: 70svh; }
}
@media (max-width: 899px) {
  .rig-full .rig-beat { min-height: 52svh; padding-top: 2.2rem; }
  .rig-full .rig-intro { padding-bottom: 1rem; }
}

/* Beat panels fade / slide with the scroll (inline styles from
   story-scroll.js). Keep them on their own layer while they move. */
.rig-full .rig-hero__copy > * { will-change: opacity, transform; }

/* A short amber rule before each beat number. */
.rig-full .rig-beat__num::before {
  content: "";
  display: inline-block;
  width: 1.6rem;
  height: 2px;
  margin-right: 0.6rem;
  vertical-align: middle;
  background: var(--accent);
  border-radius: 1px;
}

/* In full mode the 3D callouts carry the part names; the list in the copy
   becomes a quieter legend. */
.rig-full .rig-callouts li { background: transparent; }

/* ---- Beat-3 callouts over the canvas ---------------------------------- */
.rig-labels {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  visibility: hidden;
  overflow: hidden;
}
.rig-labels.is-on { visibility: visible; }
html:not(.rig-full) .rig-labels { display: none; }

.rig-labels__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* Daylight: ink leader lines and white pill labels with a yellow dot, as
   in the home page mockup's exploded stop. */
.rig-labels__lines line {
  stroke: rgba(21, 23, 26, 0.55);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}
.rig-labels__lines circle {
  fill: var(--accent);
  stroke: var(--text);
  stroke-width: 1.5;
}

.rig-label {
  position: absolute;
  left: 0;
  top: 0;
  opacity: 0;
  white-space: nowrap;
  font-family: var(--font-head);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text);
  padding: 0.32rem 0.7rem;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
@media (max-width: 899px) {
  .rig-label { font-size: 0.7rem; padding: 0.22rem 0.5rem; }
}

/* ---- Static mode: the beats as cards ---------------------------------- */
html:not(.rig-full) .rig-beat {
  position: relative;
  max-width: none;
  margin-top: 1rem;
  padding: 1.35rem 1.25rem 1.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
html:not(.rig-full) .rig-beat::before {
  /* yellow edge on the left of each card */
  content: "";
  position: absolute;
  left: -1px;
  top: 1.35rem;
  width: 3px;
  height: 1.6rem;
  border-radius: 0 2px 2px 0;
  background: var(--accent);
}
html:not(.rig-full) .rig-beat h2 { font-size: clamp(1.35rem, 4.6vw, 1.7rem); }
html:not(.rig-full) .rig-beat p { font-size: 0.98rem; }
html:not(.rig-full) .rig-intro { padding-bottom: 1rem; }
html:not(.rig-full) .rig-beat[data-beat="6"] {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(243, 196, 50, 0.14), rgba(243, 196, 50, 0) 60%),
    var(--surface);
  border-color: var(--accent-deep);
}
html:not(.rig-full) .rig-beat .product-card { background: var(--bg); }

/* Desktop static: poster and intro side by side, then the beats as a grid
   of cards across the full width (no sticky stage, no empty column). */
@media (min-width: 900px) {
  html:not(.rig-full) .rig-hero__grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    column-gap: 1.25rem;
    padding: 0 clamp(1.25rem, 3vw, 3rem) 4rem;
    align-items: start;
  }
  html:not(.rig-full) .rig-hero__stage-col {
    grid-column: 1 / 4;
    position: relative;
    top: auto;
    height: auto;
    align-self: center;
  }
  html:not(.rig-full) .rig-hero .rig-stage { aspect-ratio: 4 / 3; height: auto; }
  html:not(.rig-full) .rig-hero__copy { display: contents; }
  html:not(.rig-full) .rig-intro {
    grid-column: 4 / 7;
    min-height: 0;
    padding: 3.5rem 0 3rem clamp(0.5rem, 2vw, 2rem);
  }
  html:not(.rig-full) .rig-beat {
    grid-column: span 2;
    align-self: stretch;
    margin-top: 1.25rem;
    padding: 1.6rem 1.5rem 1.7rem;
  }
  html:not(.rig-full) .rig-beat::before { top: 1.6rem; }
  html:not(.rig-full) .rig-beat[data-beat="4"],
  html:not(.rig-full) .rig-beat[data-beat="5"] { grid-column: span 3; }
  /* Hand-off: full width, the product cards in a row beside the copy. */
  html:not(.rig-full) .rig-beat[data-beat="6"] {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    column-gap: 2.5rem;
    align-items: center;
  }
  html:not(.rig-full) .rig-beat[data-beat="6"] > .rig-beat__num,
  html:not(.rig-full) .rig-beat[data-beat="6"] > h2,
  html:not(.rig-full) .rig-beat[data-beat="6"] > p { grid-column: 1; }
  html:not(.rig-full) .rig-beat[data-beat="6"] > .product-cards {
    grid-column: 2;
    grid-row: 1 / span 3;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0;
  }
}

/* ---- Reduced motion / no JS: nothing moves ---------------------------- */
@media (prefers-reduced-motion: reduce) {
  .rig-full .rig-hero__copy > * { will-change: auto; }
}
