/* ============================================================
   HyaPak — immersive.css   (motion layer v2)
   Mobile-first · accessible · lightweight.
   Pairs with immersive.js.
   ----------------------------------------------------------
   PRINCIPLES
   • No content is ever hidden unless motion is ALLOWED. Hidden
     reveal states live behind <body class="im-ready">, which JS
     adds only when motion is on. No-JS / reduced-motion / Calm
     => everything is fully visible immediately.
   • "Calm mode" (html[data-calm]) is a one-tap, persisted user
     choice for motion-sensitive / autistic visitors. It freezes
     ALL looping motion site-wide, disables parallax, and makes
     reveals instant — while keeping the page fully usable.
   • prefers-reduced-motion is honoured as the DEFAULT for Calm,
     but visitors can opt back into full motion if they enjoy it.
============================================================ */

/* ============================================================
   0. CALM MODE  —  the accessibility backbone
   Set pre-paint by a tiny inline <head> script => no flash.
   Mirrors the site's own reduced-motion guard so every loop,
   marquee and ambient gradient stops at once.
============================================================ */
.im-motion-toggle{display:none!important;}
html[data-calm] *,
html[data-calm] *::before,
html[data-calm] *::after {
  animation-duration: .001ms !important;
  animation-delay: 0s !important;
  animation-iteration-count: 1 !important;
  transition-duration: .001ms !important;
  transition-delay: 0s !important;
  scroll-behavior: auto !important;
}
/* Guarantee all content is visible in Calm (nothing waits on a reveal) */
html[data-calm] .reveal,
html[data-calm] .m-reveal,
html[data-calm] .im-reveal,
html[data-calm] .im-line,
html[data-calm] [data-im-split] .im-word,
html[data-calm] .hero-title--statement .line {
  opacity: 1 !important;
  transform: none !important;
  filter: none !important;
}
/* Decorative animated backdrops become a calm, static painting */
html[data-calm] .im-subhero-bg *,
html[data-calm] .im-progress,
html[data-calm] .im-ticker { animation: none !important; }
html[data-calm] .im-progress { display: none !important; }

/* Same guarantees under OS-level reduced motion */
@media (prefers-reduced-motion: reduce) {
  .im-ready .im-line,
  .im-ready .im-reveal,
  .im-ready [data-im-split] .im-word { opacity: 1 !important; transform: none !important; filter: none !important; }
  .im-subhero-bg * { animation: none !important; }
}

/* ============================================================
   1. MOTION TOGGLE  —  persistent, accessible control
   Bottom-LEFT (back-to-top owns bottom-right). Real <button>,
   44px touch target, visible focus, readable label.
============================================================ */
.im-motion-toggle {
  position: fixed;
  left: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 320;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px; padding: 9px 14px 9px 12px;
  border-radius: 999px; cursor: pointer;
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 11px; letter-spacing: .04em; line-height: 1;
  color: var(--fg, #2a2a26);
  background: color-mix(in srgb, var(--bg, #fff) 86%, transparent);
  border: 1px solid var(--c-line, rgba(0,0,0,.14));
  box-shadow: 0 6px 18px -10px rgba(0,0,0,.4);
  backdrop-filter: saturate(1.1) blur(8px);
  -webkit-backdrop-filter: saturate(1.1) blur(8px);
  -webkit-tap-highlight-color: transparent;
  transition: opacity .25s ease, transform .25s ease, background .25s ease;
  opacity: .55;
}
.im-motion-toggle:hover,
.im-motion-toggle:focus-visible { opacity: 1; transform: translateY(-1px); }
.im-motion-toggle:focus-visible {
  outline: 2px solid var(--c-clay, #d88746);
  outline-offset: 2px;
}
.im-motion-toggle .imt-ico {
  width: 16px; height: 16px; flex: 0 0 auto; display: block;
}
.im-motion-toggle .imt-ico .wv { transform-box: fill-box; transform-origin: center; }
html:not([data-calm]) .im-motion-toggle .imt-ico .wv {
  animation: imWave 2.4s ease-in-out infinite;
}
.im-motion-toggle .imt-ico .w2 { animation-delay: .2s; }
.im-motion-toggle .imt-ico .w3 { animation-delay: .4s; }
@keyframes imWave { 0%,100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }
.im-motion-toggle .imt-label b { font-weight: 600; }
.im-motion-toggle .imt-label .imt-state { color: var(--c-clay, #d88746); font-weight: 600; }
/* Calm state look */
html[data-calm] .im-motion-toggle .imt-label .imt-state { color: var(--fg-mute, #6b6b63); }
/* Hide while a screen reader-only context isn't needed — keep visible by default */
@media print { .im-motion-toggle { display: none !important; } }

/* ============================================================
   2. READING PROGRESS  —  long-form posts ONLY (calm, no glow)
   Evidence on generic progress bars is weak/mixed, and a
   perpetually-moving bar conflicts with a calm reading mode,
   so it appears only where length-uncertainty is real: posts.
============================================================ */
.im-progress {
  position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 1200;
  background: transparent; pointer-events: none;
}
.im-progress > i {
  display: block; height: 100%; width: 0%;
  background: var(--c-clay, #d88746);
  transform-origin: 0 50%;
}

/* Section ticker — quiet vertical index, desktop + full-motion only */
.im-ticker {
  position: fixed; right: clamp(14px, 2.2vw, 30px); top: 50%;
  transform: translateY(-50%);
  display: flex; flex-direction: column; gap: 14px;
  z-index: 320; pointer-events: auto;
}
.im-ticker button {
  --d: 7px; width: var(--d); height: var(--d); padding: 0; border: 0;
  border-radius: 50%; cursor: pointer; position: relative;
  background: color-mix(in srgb, var(--fg, #333) 22%, transparent);
  transition: transform .35s cubic-bezier(.22,1,.36,1), background .3s;
}
.im-ticker button::after {
  content: attr(data-label);
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%) translateX(6px);
  font-family: var(--f-mono, monospace); font-size: 10px; letter-spacing: .08em; text-transform: uppercase;
  white-space: nowrap; color: var(--fg-mute, #6b6b63);
  background: color-mix(in srgb, var(--bg, #fff) 88%, transparent);
  padding: 3px 8px; border-radius: 20px; border: 1px solid var(--c-line, rgba(0,0,0,.12));
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.im-ticker button:hover::after,
.im-ticker button:focus-visible::after { opacity: 1; transform: translateY(-50%) translateX(0); }
.im-ticker button.active { background: var(--c-clay, #d88746); transform: scale(1.5); }
.im-ticker button:hover { background: var(--c-violet, #6f6a9c); }
.im-ticker button:focus-visible { outline: 2px solid var(--c-clay, #d88746); outline-offset: 3px; }
@media (max-width: 1100px) { .im-ticker { display: none; } }

/* ============================================================
   3. SUBPAGE-HERO BACKDROP  (interior heroes were blank)
   Calm/organic drift. Frozen to a static painting in Calm.
============================================================ */
.subpage-hero { position: relative; overflow: clip; }
.im-subhero-bg { position: absolute; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.subpage-hero-inner { position: relative; z-index: 1; }
.im-subhero-bg svg { width: 100%; height: 100%; display: block; }
.im-subhero-bg .imleaf { transform-box: fill-box; transform-origin: center;
  animation: imDrift 16s ease-in-out infinite; will-change: transform; }
.im-subhero-bg .imdot  { animation: imBob 7s ease-in-out infinite; will-change: transform; }
.im-subhero-bg .l2 { animation-delay: -4s; animation-duration: 19s; }
.im-subhero-bg .l3 { animation-delay: -7s; animation-duration: 18s; }
.im-subhero-bg .l4 { animation-delay: -2s; animation-duration: 21s; }
.im-subhero-bg .l5 { animation-delay: -5s; }
.im-subhero-bg .d2 { animation-delay: -2s; }
.im-subhero-bg .d3 { animation-delay: -4s; }
.im-subhero-bg .d4 { animation-delay: -3s; }
.im-subhero-bg .imripple { transform-box: fill-box; transform-origin: center;
  animation: imRipple 11s ease-out infinite; }
.im-subhero-bg .r2 { animation-delay: -3.6s; }
.im-subhero-bg .r3 { animation-delay: -7.2s; }
@keyframes imDrift {
  0%,100% { transform: translate(0,0) rotate(0); }
  33%     { transform: translate(12px,-14px) rotate(4deg); }
  66%     { transform: translate(-10px,8px) rotate(-3deg); }
}
@keyframes imBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-7px); } }
@keyframes imRipple { 0% { transform: scale(.7); opacity: .45; } 100% { transform: scale(1.4); opacity: 0; } }
/* Lite phones / data-motion subtle => freeze loops, keep the picture */
[data-motion="subtle"] .im-subhero-bg *,
.lite .im-subhero-bg * { animation: none !important; }

/* ============================================================
   4. HEADING LINE REVEAL  (mask + rise, staggered)
============================================================ */
.im-line-wrap { display: block; overflow: hidden; }
.im-ready .im-line {
  display: block; transform: translateY(102%); opacity: 0;
  transition: transform .85s cubic-bezier(.22,1,.36,1), opacity .85s ease;
  transition-delay: var(--im-d, 0ms); will-change: transform, opacity;
}
.im-ready .im-in .im-line,
.im-ready .im-line.im-in { transform: translateY(0); opacity: 1; }

/* word-split ledes */
.im-ready [data-im-split] .im-word {
  display: inline-block; opacity: 0; transform: translateY(12px);
  transition: transform .55s cubic-bezier(.22,1,.36,1), opacity .55s ease;
  transition-delay: var(--im-d, 0ms); will-change: transform, opacity;
}
.im-ready [data-im-split].im-in .im-word { opacity: 1; transform: none; }

/* ============================================================
   5. SCROLL REVEAL FOR CARDS / BLOCKS  (stagger via --im-d)
============================================================ */
.im-ready .im-reveal {
  opacity: 0; transform: translateY(30px) scale(.99);
  transition: transform .9s cubic-bezier(.22,1,.36,1), opacity .75s ease;
  transition-delay: var(--im-d, 0ms); will-change: transform, opacity;
}
.im-ready .im-reveal.im-in { opacity: 1; transform: none; }

/* eyebrow underline sweep */
.im-eyebrow-line { position: relative; }
.im-eyebrow-line::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 2px; width: 100%;
  background: var(--c-clay, #d88746); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .8s cubic-bezier(.22,1,.36,1) .1s;
}
.im-eyebrow-line.im-in::after { transform: scaleX(1); }

/* ============================================================
   6. PARALLAX  (JS-driven; off in Calm/lite)
============================================================ */
[data-im-parallax] { will-change: transform; }

/* ============================================================
   7. MOBILE TAP FEEDBACK
============================================================ */
@media (hover: none) {
  .im-ready .product:active,
  .im-ready .award:active,
  .im-ready .values-grid li:active,
  .im-ready .about-how-list li:active {
    transform: scale(.99); transition: transform .18s ease;
  }
}
