/* =====================================================================
   LRH motion layer. Loaded after styles.css, driven by assets/js/motion.js.
   Everything here is decoration: styles.css and app.js keep working on their
   own, and the page reads the same without this file.

   Parts: 1 setup            2 floating background    3 hero
          4 cursor + ripple  5 cards: glow + tilt     6 buttons
          7 text + reveals   8 small hovers           9 modes (data saver,
                                                        reduced motion, print)

   Rules that hide something until JavaScript shows it are scoped under
   html.fx, a class motion.js adds only after it has started.
   Individual transform properties (translate / rotate / scale) are used on
   purpose: they stack on top of the `transform` the base styles already use
   for hover lifts and entrance animations instead of fighting with it.
   ===================================================================== */

:root { --spring: cubic-bezier(.34, 1.56, .64, 1); }

/* ---------- 1. setup ---------- */
.hero-art { perspective: 900px; isolation: isolate; }
.cards, .pubs, .options, .path-grid { perspective: 1100px; }
/* light sections become their own stacking context so the floating layer can sit
   above the section colour and below the content */
.about, .programs, .research, .contact { isolation: isolate; }
.pub, .opt, .path, .info-card, .stat { position: relative; }
.btn, .tab, .chip, .lens-tab, .preset, .seg button { position: relative; overflow: hidden; }

/* ---------- 2. floating background ---------- */
.fx-ambient { position: absolute; top: 0; left: 0; right: 0; bottom: 0; z-index: -1; overflow: hidden; pointer-events: none; contain: layout paint style; --mx: 0; --my: 0; --sp: 0; }
.fx-ambient.fx-off { display: none; }

/* soft colour orbs that drift, and lean away from the pointer / scroll */
.fx-orb { position: absolute; left: var(--l); top: var(--t); width: var(--w); height: var(--w); margin: calc(var(--w) / -2) 0 0 calc(var(--w) / -2); border-radius: 50%;
  background: radial-gradient(circle, var(--c) 0%, transparent 66%);
  translate: calc(var(--mx) * var(--ox, 0) * 1px) calc(var(--my) * var(--oy, 0) * 1px + var(--sp) * var(--os, 0) * 1px);
  animation: fx-orb var(--dur, 30s) ease-in-out infinite alternate; animation-delay: var(--del, 0s); }
.fx-orb.o1 { --w: clamp(320px, 46vw, 720px); --ox: 46; --oy: 34; --os: -80; --dur: 31s; --del: -6s; }
.fx-orb.o2 { --w: clamp(280px, 38vw, 600px); --ox: -58; --oy: -40; --os: 70; --dur: 37s; --del: -17s; }
.fx-orb.o3 { --w: clamp(220px, 28vw, 440px); --ox: 28; --oy: -22; --os: -40; --dur: 26s; --del: -11s; }
.fx-dark .o1 { --c: rgba(16,185,129,.30); }
.fx-dark .o2 { --c: rgba(245,158,11,.20); }
.fx-dark .o3 { --c: rgba(52,211,153,.15); }
.fx-light .o1 { --c: rgba(16,185,129,.11); }
.fx-light .o2 { --c: rgba(245,158,11,.12); }
@keyframes fx-orb {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  50%  { transform: translate3d(5vw, -4vh, 0) scale(1.14); }
  100% { transform: translate3d(-4vw, 5vh, 0) scale(.92); }
}

/* small shapes and code glyphs that rise slowly and fade */
.fx-bit { position: absolute; left: var(--l); top: var(--t); display: block; width: var(--sz); height: var(--sz); color: var(--bc, #34D399); opacity: 0;
  translate: calc(var(--mx) * var(--p, 12) * 1px) calc(var(--my) * var(--p, 12) * 1px + var(--sp) * var(--p, 12) * -1.6px);
  animation: fx-bit var(--dur, 24s) ease-in-out infinite; animation-delay: var(--del, 0s); }
.fx-dark .fx-bit { --o: .30; }
.fx-light .fx-bit { --o: .26; }
.fx-bit.c-e { --bc: #34D399; }
.fx-bit.c-a { --bc: #F59E0B; }
.fx-light .fx-bit.c-e { --bc: #059669; }
.fx-light .fx-bit.c-a { --bc: #D97706; }
.b-ring { border: 2px solid currentColor; border-radius: 50%; }
.b-sq { border: 2px solid currentColor; border-radius: 28%; }
.b-dia { background: currentColor; clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.b-dot { width: calc(var(--sz) * .34); height: calc(var(--sz) * .34); border-radius: 50%; background: currentColor; }
.b-plus { background: linear-gradient(currentColor, currentColor) center / 100% 2px no-repeat, linear-gradient(currentColor, currentColor) center / 2px 100% no-repeat; }
.b-tx { width: auto; height: auto; font: 700 var(--sz) / 1 var(--mono); letter-spacing: -.02em; white-space: nowrap; }
@keyframes fx-bit {
  0%   { transform: translate3d(0, 0, 0) rotate(var(--r0, 0deg)); opacity: 0; }
  14%  { opacity: var(--o, .3); }
  86%  { opacity: var(--o, .3); }
  100% { transform: translate3d(var(--drift, 24px), calc(var(--rise, 140px) * -1), 0) rotate(var(--r1, 90deg)); opacity: 0; }
}
@media (max-width: 700px) { .fx-bit.b-lo { display: none; } }

/* a pool of light that follows the pointer across the dark sections */
.fx-spot { position: absolute; left: 0; top: 0; width: 560px; height: 560px; margin: -280px 0 0 -280px; border-radius: 50%;
  background: radial-gradient(circle, rgba(252,211,77,.17) 0%, rgba(16,185,129,.07) 45%, transparent 70%); opacity: 0; transition: opacity .5s; }
.fx-spot.on { opacity: 1; }

/* the interactive network drawn by motion.js (hero + get involved) */
.fx-net { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; }

/* ---------- 3. hero ---------- */
/* the artwork and its chips shift with the pointer and slide slower than the page */
.hero-art { translate: calc(var(--hx, 0) * -12px) calc(var(--hy, 0) * -9px + var(--hs, 0) * 1px); }
.hero-art .f1 { translate: calc(var(--hx, 0) * 30px) calc(var(--hy, 0) * 24px); }
.hero-art .f2 { translate: calc(var(--hx, 0) * -24px) calc(var(--hy, 0) * 20px); }
.hero-art .f3 { translate: calc(var(--hx, 0) * 38px) calc(var(--hy, 0) * -22px); }
/* two rings that expand behind the artwork like a sonar pulse */
.hero-art::before, .hero-art::after { content: ''; position: absolute; z-index: -1; left: 6%; right: 6%; top: 4%; bottom: 4%; border-radius: 50%; border: 1.5px solid rgba(52,211,153,.34); pointer-events: none; animation: fx-ring 7s ease-out infinite; }
.hero-art::after { border-color: rgba(245,158,11,.30); animation-delay: -3.5s; }
@keyframes fx-ring {
  0%   { transform: scale(.72); opacity: 0; }
  18%  { opacity: 1; }
  100% { transform: scale(1.38); opacity: 0; }
}

/* ---------- 4. cursor ring + click ripple ---------- */
.fx-cursor, .fx-dot { position: fixed; left: 0; top: 0; z-index: 400; pointer-events: none; opacity: 0; transition: opacity .25s; }
.fx-cursor { width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 1.5px solid rgba(245,158,11,.9); scale: 1;
  transition: opacity .25s, scale .28s var(--ease), background-color .25s, border-color .25s; }
.fx-dot { width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: var(--amber); }
.fx-cursor.on, .fx-dot.on { opacity: 1; }
.fx-cursor.link { scale: 1.75; background: rgba(245,158,11,.14); border-color: rgba(245,158,11,.5); }
.fx-cursor.down { scale: .72; }
.fx-cursor.text, .fx-dot.text { opacity: 0; }

.fx-ripple { position: absolute; border-radius: 50%; background: currentColor; opacity: .26; pointer-events: none; transform: scale(0); animation: fx-ripple .65s ease-out forwards; }
@keyframes fx-ripple { to { transform: scale(1); opacity: 0; } }

/* ---------- 5. cards: pointer glow + 3D tilt ---------- */
/* motion.js writes --mx / --my (pointer position inside the card) and, for tilt cards, `rotate` */
.card::after, .pub::after, .opt::after, .path::after, .info-card::after, .stat::after, .hub-card::after, .shot::after {
  content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity .35s;
  background: radial-gradient(300px circle at var(--mx, 50%) var(--my, 50%), var(--glow, rgba(16,185,129,.12)), transparent 70%); }
.card:hover::after, .pub:hover::after, .opt:hover::after, .path:hover::after, .info-card:hover::after, .stat:hover::after, .hub-card:hover::after, .shot:hover::after { opacity: 1; }
.opt, .path, .hub-card { --glow: rgba(252,211,77,.18); }
.shot { --glow: rgba(255,255,255,.24); }
.cards[data-pillar="teens"] .card { --glow: rgba(245,158,11,.14); }

/* base styles use a fill-mode of `both`, which would freeze `transform` and silently
   cancel the hover lift on these cards; `backwards` keeps the entrance and frees the hover */
.card, .pub { animation-fill-mode: backwards; transition: transform .3s var(--ease), rotate .15s ease-out, scale .3s var(--ease), box-shadow .3s var(--ease), border-color .3s; }
.card { animation-delay: min(calc(var(--i, 0) * 60ms), .36s); }
.pub { animation-delay: min(calc(var(--i, 0) * 40ms), .28s); }
.opt, .path { transition: transform .3s var(--ease), rotate .15s ease-out, scale .3s var(--ease), background-color .3s, border-color .3s, box-shadow .3s; }
.card:hover, .pub:hover, .opt:hover, .path:hover { scale: 1.012; }

/* blocks that also carry .reveal (options, info cards, photos, hub card) get the slow
   entrance transition from `.js .reveal`, which outranks their own hover transitions.
   Once the entrance has finished motion.js adds .fx-settled and the quick set takes over. */
.js .reveal.fx-settled { transition: transform .3s var(--ease), rotate .15s ease-out, translate .45s var(--ease), scale .3s var(--ease), box-shadow .3s var(--ease), background-color .3s, border-color .3s, opacity .3s; transition-delay: 0s; }

/* icons spring when their card is hovered */
.card-ico, .opt-ico, .info-ico, .stat-ico { transition: rotate .35s var(--spring), scale .35s var(--spring), background-color .25s, color .25s; }
.card:hover .card-ico { rotate: -8deg; scale: 1.12; }
.opt:hover .opt-ico { rotate: 8deg; scale: 1.12; }
.info-card:hover .info-ico { rotate: -8deg; scale: 1.1; }
.stat:hover .stat-ico { rotate: 10deg; scale: 1.12; }

/* the mosaic photos: the tilted collage look from styles.css was lost under the reveal
   transform, so it is restored with individual properties; hover straightens + lifts */
@media (min-width: 760px) {
  .s1 { rotate: -1.6deg; }
  .s2 { translate: 0 18px; }
  .s3 { rotate: 1.6deg; }
  .shot:hover { rotate: 0deg; scale: 1.035; z-index: 2; box-shadow: 0 26px 60px rgba(15,23,42,.28); }
}

/* ---------- 6. buttons ---------- */
.btn { transition: transform .2s var(--ease), scale .2s var(--ease), box-shadow .2s var(--ease), background-color .2s, border-color .2s, color .2s; }
.btn:active { scale: .97; }
.btn > svg { transition: translate .25s var(--ease); }
.btn:hover > svg:last-child:not(:first-child) { translate: 4px 0; }
/* a glint that sweeps across solid buttons on hover; the hero button repeats it now and then */
.btn-primary::before, .btn-accent::before { content: ''; position: absolute; top: 0; bottom: 0; left: 0; width: 48%; background: linear-gradient(100deg, transparent, rgba(255,255,255,.6), transparent); transform: skewX(-22deg); translate: -170% 0; pointer-events: none; }
.btn-primary:hover::before, .btn-accent:hover::before { translate: 340% 0; transition: translate .75s var(--ease); }
.hero-cta .btn-accent::before { animation: fx-glint 6.5s ease-in-out 2.2s infinite; }
@keyframes fx-glint { 0%, 62% { translate: -170% 0; } 100% { translate: 340% 0; } }

.progress span { box-shadow: 0 0 12px rgba(245,158,11,.7); }
.fab-wa::after { content: ''; position: absolute; top: 0; left: 0; right: 0; bottom: 0; border-radius: inherit; border: 2px solid #16A34A; pointer-events: none; animation: fx-fab 3.6s ease-out 2s infinite; }
@keyframes fx-fab { 0% { transform: scale(1); opacity: .7; } 70%, 100% { transform: scale(1.5); opacity: 0; } }

/* ---------- 7. text + reveals ---------- */
/* headline words rise into place (motion.js wraps each word and adds .fx-in when it is on screen) */
.fx .fx-split .fx-w { display: inline-block; overflow: hidden; vertical-align: top; padding: 0 .02em .14em; margin: 0 -.02em -.14em; }
.fx .fx-split .fx-w > span { display: inline-block; transform: translateY(105%); transition: transform .8s var(--ease); transition-delay: calc(var(--i, 0) * 55ms + var(--base, 0s)); }
.fx .fx-split.fx-in .fx-w > span { transform: none; }
/* the amber highlighter under the key words draws itself */
.fx .hl { background-repeat: no-repeat; animation: fx-mark 1s var(--ease) .9s backwards; }
@keyframes fx-mark { from { background-size: 0% 100%; } to { background-size: 100% 100%; } }
/* section titles get a small underline that grows in */
.fx .sec-head h2::after { content: ''; display: block; width: 0; height: 4px; margin-top: .8rem; border-radius: 4px; background: linear-gradient(90deg, var(--amber), var(--em-500)); transition: width .9s var(--ease) .35s; }
.fx .sec-head.center h2::after { margin-left: auto; margin-right: auto; }
.fx .sec-head h2.fx-in::after, .fx .sec-head.in h2::after { width: 72px; }
/* the little diamond before each eyebrow turns now and then */
.fx .eyebrow::before { animation: fx-diamond 6s var(--ease) infinite; }
@keyframes fx-diamond { 0%, 62% { rotate: 0deg; } 100% { rotate: 360deg; } }

/* reveal directions: styles.css fades everything up; these blocks come in from the side or zoom */
.fx .reveal.fx-left:not(.in) { transform: translate3d(-42px, 0, 0); }
.fx .reveal.fx-right:not(.in) { transform: translate3d(42px, 0, 0); }
.fx .reveal.fx-zoom:not(.in) { transform: translate3d(0, 26px, 0) scale(.94); }

/* ---------- 8. small hovers ---------- */
.brand img { transition: rotate .35s var(--spring), scale .35s var(--spring); }
.brand:hover img { rotate: -7deg; scale: 1.07; }
@media (min-width: 1200px) { .links a:not([aria-current="true"]):hover::after { width: 12px; } }
.chips li { transition: transform .25s var(--ease), background-color .25s, border-color .25s; }
.chips li:hover { transform: translateY(-3px); background: rgba(255,255,255,.13); border-color: rgba(252,211,77,.5); }
.tags li { transition: transform .2s var(--ease), background-color .2s; }
.tags li:hover { transform: translateY(-2px); background: var(--em-100); }
.hub-points li { transition: transform .3s var(--ease), background-color .3s, border-color .3s; }
.hub-points li:hover { transform: translateX(8px); background: rgba(255,255,255,.14); border-color: rgba(252,211,77,.45); }
.ticks li { transition: transform .25s var(--ease); }
.ticks li:hover { transform: translateX(6px); }
.lens-tab:hover { transform: translateX(3px); }
.chip { transition: background-color .2s, border-color .2s, color .2s, transform .2s var(--ease); }
.chip:hover { transform: translateY(-2px); }
.preset:hover { transform: translateY(-2px); }
.foot-links a { display: inline-block; transition: transform .2s var(--ease), color .2s; }
.foot-links a:hover { transform: translateX(4px); }
.to-top:hover svg { animation: fx-nudge .6s var(--ease); }
@keyframes fx-nudge { 40% { transform: translateY(-4px); } }

/* ---------- 9. modes ---------- */
/* data saver: no floating layer, no cursor, no extra effects (the base rules already stop all animation) */
html.lite .fx-ambient, html.lite .fx-cursor, html.lite .fx-dot, html.lite .fx-ripple { display: none !important; }
html.lite .hero-art::before, html.lite .hero-art::after, html.lite .fab-wa::after, html.lite .btn-primary::before, html.lite .btn-accent::before { display: none; }
html.lite .hero-art, html.lite .hero-art .float { translate: none; }
html.lite .fx .fx-split .fx-w { overflow: visible; }
html.lite .fx .fx-split .fx-w > span { transform: none !important; }
html.lite .fx .sec-head h2::after { width: 72px; }
html.lite .reveal[class*="fx-"] { transform: none !important; }
html.lite .card:hover, html.lite .pub:hover, html.lite .opt:hover, html.lite .path:hover { scale: 1; }

@media (prefers-reduced-motion: reduce) {
  .fx-bit, .fx-net, .fx-spot, .fx-cursor, .fx-dot, .fx-ripple { display: none !important; }
  .fx-orb { animation: none !important; translate: none !important; }
  .hero-art, .hero-art .float { translate: none; }
  .hero-art::before, .hero-art::after, .fab-wa::after, .btn-primary::before, .btn-accent::before { display: none; }
  .fx .fx-split .fx-w { overflow: visible; }
  .fx .fx-split .fx-w > span { transform: none !important; }
  .fx .sec-head h2::after { width: 72px; }
  .reveal[class*="fx-"] { transform: none !important; }
  .card, .pub { animation-delay: 0s; }
  .card:hover, .pub:hover, .opt:hover, .path:hover { scale: 1; }
  .card:hover .card-ico, .opt:hover .opt-ico, .info-card:hover .info-ico, .stat:hover .stat-ico { rotate: none; scale: 1; }
}
@media print { .fx-ambient, .fx-cursor, .fx-dot, .fx-ripple { display: none !important; } }
