/* Opus, Nov 9: Build Your Box heading variants 1-3 (preview only).
   Same font, same words, same colors. Behaviour lives in /js/r3-byb-opus.js.

   REPORT
   1  Letterpress: the letters of "Build Your Box." rise into place one by one with a
      slight hand-set tilt, then the gold rule draws out from the center, then the subline
      fades up. Replays when re-selected and each time the heading scrolls back into view.
   2  Gilded rule: the title fades and rises softly, the rule draws from the center, then a
      slow light glint (honey-gold-light into cream, existing tokens) travels along the gold
      every 8 s, only where the gold is. Plays once per selection; glint pauses off screen.
   3  Editorial mask: the headline slides up through an invisible slot (overflow mask, pure
      transform), the rule wipes in left to right, the subline settles. Desktop only: the
      title and subline sit ~14px / 10px apart below the fold and gather into the normal
      spacing as the block reaches mid-screen (never closer than normal). No parallax on
      phones or touch, per TASTE.md. Plays once per selection.
   Still state: with no JS, reduced motion, or html.glz-static, every variant renders exactly
   like variant 0 (final layout), no shimmer, no parallax.
   Issues / notes:
   - Neither this file nor the JS is linked from index.html yet (not mine to edit). Load
     after css/r3-byb-switcher.css and js/r3-byb-switcher.js.
   - Variant 1 splits the title into letter spans while animating (h2 gets aria-label), then
     puts the plain text back so the font's kerning returns. Variant 3 wraps the text in a
     mask span while active. Both restore the original text when you switch away, and only
     if their own markup is still there, so Sol's 4-6 are not touched.
   - The page forces .reveal static on phones and sets transition-delay 0s !important on
     .reveal, so the title/subline rules below use !important inside #bybHeading only.
   - The variant 2 glint loops slowly while on screen. If Matt wants it calmer, cap it by
     changing "infinite" to 3 in the animation below. */

/* ── Shared: final still state (also the no-JS / reduced-motion state) ── */
html:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading .section-title,
html:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading .section-subtitle {
  opacity: 1 !important;
  transform: none !important;
  transition: none !important;
}
html:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading .gold-rule {
  transform: scaleX(1);
  transition: none;
}

/* ════════ 1 · Letterpress ════════ */
html[data-v-byb="1"] #bybHeading .byb-o-w { display: inline-block; white-space: nowrap; }
html[data-v-byb="1"] #bybHeading .byb-o-ch { display: inline-block; transform-origin: 0 100%; }

html[data-v-byb="1"] #bybHeading.byb-o-pre .byb-o-ch {
  opacity: 0;
  transform: translate3d(0, 0.5em, 0) rotate(5deg);
  transition: none;
}
html[data-v-byb="1"] #bybHeading.byb-o-in .byb-o-ch {
  opacity: 1;
  transform: none;
  transition: opacity 0.7s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: calc(var(--byb-o-i, 0) * 38ms + 60ms);
}
html[data-v-byb="1"] #bybHeading.byb-o-pre .gold-rule { transform: scaleX(0); transition: none; }
html[data-v-byb="1"] #bybHeading.byb-o-in .gold-rule {
  transform: scaleX(1);
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.6s;
}
html[data-v-byb="1"] #bybHeading.byb-o-pre .section-subtitle {
  opacity: 0 !important;
  transform: translate3d(0, 12px, 0) !important;
  transition: none !important;
}
html[data-v-byb="1"] #bybHeading.byb-o-in .section-subtitle {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transition-delay: 0.95s !important;
}

/* ════════ 2 · Gilded rule ════════ */
html[data-v-byb="2"] #bybHeading.byb-o-pre .section-title {
  opacity: 0 !important;
  transform: translate3d(0, 14px, 0) !important;
  transition: none !important;
}
html[data-v-byb="2"] #bybHeading.byb-o-in .section-title {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1), transform 0.9s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transition-delay: 0s !important;
}
html[data-v-byb="2"] #bybHeading .gold-rule { position: relative; overflow: hidden; }
html[data-v-byb="2"] #bybHeading.byb-o-pre .gold-rule { transform: scaleX(0); transition: none; }
html[data-v-byb="2"] #bybHeading.byb-o-in .gold-rule {
  transform: scaleX(1);
  transition: transform 1.2s cubic-bezier(0.65, 0, 0.35, 1) 0.35s;
}
html[data-v-byb="2"] #bybHeading.byb-o-pre .section-subtitle {
  opacity: 0 !important;
  transform: translate3d(0, 10px, 0) !important;
  transition: none !important;
}
html[data-v-byb="2"] #bybHeading.byb-o-in .section-subtitle {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transition-delay: 0.8s !important;
}
/* The glint: a short band of light that only shows where the gold is,
   because the rule's own ends fade to transparent and the rule clips it. */
@media (prefers-reduced-motion: no-preference) {
  html[data-v-byb="2"]:not(.glz-static) #bybHeading.byb-o-in .gold-rule::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 30%;
    background: linear-gradient(90deg,
      transparent 0%,
      var(--honey-gold-light, #E5BE5E) 28%,
      var(--cream, #FDF8F0) 50%,
      var(--honey-gold-light, #E5BE5E) 72%,
      transparent 100%);
    opacity: 0;
    transform: translate3d(-100%, 0, 0);
    animation: bybOGlint 8s ease-in-out 2.2s infinite;
    pointer-events: none;
  }
  html[data-v-byb="2"] #bybHeading.byb-o-in:not(.byb-o-vis) .gold-rule::after { animation-play-state: paused; }
}
@keyframes bybOGlint {
  0%   { transform: translate3d(-100%, 0, 0); opacity: 0; }
  6%   { opacity: 0.95; }
  40%  { opacity: 0.95; }
  46%  { transform: translate3d(340%, 0, 0); opacity: 0; }
  100% { transform: translate3d(340%, 0, 0); opacity: 0; }
}

/* ════════ 3 · Editorial mask + gentle parallax ════════ */
html[data-v-byb="3"] #bybHeading .byb-o-mask {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
  /* room for ascenders and the y descender inside the clip */
  padding: 0.12em 0.06em 0.2em;
  margin: -0.12em -0.06em -0.2em;
}
html[data-v-byb="3"] #bybHeading .byb-o-line { display: inline-block; }
html[data-v-byb="3"] #bybHeading.byb-o-pre .byb-o-line {
  transform: translate3d(0, 130%, 0);
  transition: none;
}
html[data-v-byb="3"] #bybHeading.byb-o-in .byb-o-line {
  transform: none;
  transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}
html[data-v-byb="3"] #bybHeading .gold-rule { transform-origin: 0 50%; }
html[data-v-byb="3"] #bybHeading.byb-o-pre .gold-rule { transform: scaleX(0); transition: none; }
html[data-v-byb="3"] #bybHeading.byb-o-in .gold-rule {
  transform: scaleX(1);
  transition: transform 0.9s cubic-bezier(0.65, 0, 0.35, 1) 0.4s;
}
html[data-v-byb="3"] #bybHeading.byb-o-pre .section-subtitle {
  opacity: 0 !important;
  transform: translate3d(0, 8px, 0) !important;
  transition: none !important;
}
html[data-v-byb="3"] #bybHeading.byb-o-in .section-subtitle {
  opacity: 1 !important;
  transform: none !important;
  transition: opacity 0.8s cubic-bezier(0.22, 1, 0.36, 1), transform 0.8s cubic-bezier(0.22, 1, 0.36, 1) !important;
  transition-delay: 0.65s !important;
}
/* Parallax uses the separate `translate` property so it composes with the
   reveal transforms. --byb-o-p (0..1) is only ever set by JS on desktop. */
html[data-v-byb="3"] #bybHeading .section-title { translate: 0 calc(var(--byb-o-p, 0) * -14px); }
html[data-v-byb="3"] #bybHeading .section-subtitle { translate: 0 calc(var(--byb-o-p, 0) * 10px); }

/* ── Still-state guard: reduced motion or static mode always wins (kept last) ── */
@media (prefers-reduced-motion: reduce) {
  html:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading:not(.byb-o-zz) :is(.section-title, .section-subtitle, .byb-o-ch, .byb-o-line) {
    opacity: 1 !important;
    transform: none !important;
    translate: none !important;
    transition: none !important;
  }
  html:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading:not(.byb-o-zz) .gold-rule {
    transform: scaleX(1) !important;
    transition: none !important;
  }
  html[data-v-byb="2"] #bybHeading:not(.byb-o-zz) .gold-rule::after { display: none !important; }
}
html.glz-static:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading:not(.byb-o-zz) :is(.section-title, .section-subtitle, .byb-o-ch, .byb-o-line) {
  opacity: 1 !important;
  transform: none !important;
  translate: none !important;
  transition: none !important;
}
html.glz-static:is([data-v-byb="1"], [data-v-byb="2"], [data-v-byb="3"]) #bybHeading:not(.byb-o-zz) .gold-rule {
  transform: scaleX(1) !important;
  transition: none !important;
}
html.glz-static[data-v-byb="2"] #bybHeading:not(.byb-o-zz) .gold-rule::after { display: none !important; }
