/* =========================================================
   AERO — Motion layer
   Scroll-linked & reversible. Content defaults to fully visible
   (--p: 1) so nothing is hidden if JS or timelines are unavailable.
   ========================================================= */

[data-reveal], [data-mask] { --p: 1; }

/* ---- Fallback path (JS writes --p from scroll position) ---- */
.no-sda [data-reveal] {
  opacity: var(--p);
  transform: translate3d(0, calc((1 - var(--p)) * var(--reveal-dist)), 0);
  will-change: opacity, transform;
}

/* ---- Native CSS scroll-driven animations ---- */
@keyframes aero-reveal {
  from { opacity: 0; transform: translate3d(0, var(--reveal-dist), 0); }
  to { opacity: 1; transform: none; }
}
@supports (animation-timeline: view()) {
  .sda [data-reveal] {
    animation: aero-reveal linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 30%;
  }
  .sda [data-reveal-delay="1"] { animation-range: entry 4% cover 33%; }
  .sda [data-reveal-delay="2"] { animation-range: entry 8% cover 36%; }
  .sda [data-reveal-delay="3"] { animation-range: entry 12% cover 39%; }
  .sda [data-reveal-delay="4"] { animation-range: entry 16% cover 42%; }
  .sda [data-reveal-delay="5"] { animation-range: entry 20% cover 45%; }
}

/* ---- Cinematic image mask reveal ---- */
[data-mask] {
  clip-path: inset(calc((1 - var(--p)) * 16%) calc((1 - var(--p)) * 9%) calc((1 - var(--p)) * 16%) calc((1 - var(--p)) * 9%) round var(--radius-lg));
}
[data-mask] > .mask-inner { transform: scale(calc(1.14 - var(--p) * 0.14)); transform-origin: 50% 60%; }

/* ---- Parallax ---- */
[data-parallax] { transform: translate3d(0, var(--py, 0px), 0); will-change: transform; }

/* ---- Route line draw ---- */
[data-draw] { transition: none; }

/* ---- Hero (driven by --hero-p from motion.js) ---- */
[data-hero] { --hero-p: 0; }
[data-hero] .hero-media { transform: translate3d(0, calc(var(--hero-p) * 18vh), 0) scale(calc(1.02 + var(--hero-p) * 0.08)); will-change: transform; }
[data-hero] .hero-shade { opacity: calc(0.62 + var(--hero-p) * 0.3); }
[data-hero] .hero-content { transform: translate3d(0, calc(var(--hero-p) * -10vh), 0); opacity: calc(1 - var(--hero-p) * 1.5); }

/* ---- Hero title word reveal (load-time) ---- */
.ht-line { display: block; }
.ht-word { display: inline-block; overflow: hidden; vertical-align: bottom; padding: 0.04em 0.02em 0.2em; margin-bottom: -0.2em; }
.ht-word > span { display: inline-block; transform: translate3d(0, 108%, 0); transition: transform 1.2s var(--ease) calc(var(--i) * 80ms + 250ms); }
.is-in .ht-word > span { transform: none; }

.load-fade { opacity: 0; transform: translate3d(0, 14px, 0); transition: opacity 1s var(--ease), transform 1s var(--ease); }
.is-loaded .load-fade { opacity: 1; transform: none; }
.is-loaded .load-fade.d1 { transition-delay: 0.7s; }
.is-loaded .load-fade.d2 { transition-delay: 0.9s; }
.is-loaded .load-fade.d3 { transition-delay: 1.1s; }

/* ---- Hover refinements ---- */
.zoom { overflow: hidden; }
.zoom .zoom-target { transition: transform 0.9s var(--ease); }
.zoom:hover .zoom-target, .zoom:focus-within .zoom-target { transform: scale(1.04); }

.accent-line { position: relative; }
.accent-line::after {
  content: ""; position: absolute; left: 0; bottom: -6px; height: 1px; width: 100%;
  background: var(--gold); transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease);
}
.accent-line:hover::after, .accent-line:focus-visible::after, a:hover > .accent-line::after { transform: scaleX(1); }

.light-shift { position: relative; isolation: isolate; }
.light-shift::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1;
  background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), rgba(201,167,106,0.10), transparent 40%);
  opacity: 0; transition: opacity 0.5s var(--ease);
}
.light-shift:hover::before { opacity: 1; }

/* Operational pages: never animate data tables, modal contents or inputs */
.platform table, .platform input, .platform select, .platform textarea, .modal-body, .drawer-body { animation: none !important; }

/* ---- Reduced motion: show everything immediately ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
  [data-reveal], [data-mask] { opacity: 1 !important; transform: none !important; clip-path: none !important; animation: none !important; }
  [data-mask] > .mask-inner, [data-parallax], [data-hero] .hero-media, [data-hero] .hero-content { transform: none !important; }
  [data-hero] .hero-content { opacity: 1 !important; }
  .ht-word > span, .load-fade { transform: none !important; opacity: 1 !important; }
  .zoom:hover .zoom-target { transform: none; }
}
