/* =========================================================
   ELARIS — PERF + MOTION + PALETTE LAYER
   Load AFTER main.css:
   <link rel="stylesheet" href="<?= ASSETS_URL ?>/css/elaris-perf.css">
   Pure additive. Delete this file = site returns to old state.

   Sections
     A. Palette lock (cream / burgundy / gold — navbar colors)
     B. Typography (optional font swap)
     C. GPU fixes (all devices)
     D. Tier rules (perf-mid / perf-lite, set by elaris-motion.js)
     E. Fade-up reveal system (.rv)
     F. Scroll progress bar
     G. Reduced motion
   ========================================================= */


/* =========================================================
   A. PALETTE LOCK
   Only 3 families: cream (page), burgundy (--deep*), gold.
   Coral #E07856, amber #F2A968, brown #4A2410, plum #8A3E5A
   are removed. Green live-dot stays (status color).
   ========================================================= */
:root {
    --cream:      #FDFAF4;   /* navbar bg */
    --cream-2:    #FAF4E9;
    --wine-950:   #22040E;   /* darkest burgundy, replaces near-black */
    --wine-lift:  #7A1E34;   /* lighter burgundy, replaces plum/coral */
}

/* Dark sections: one burgundy gradient family */
.why,
.fp,
.test,
.ctaband,
.ax-numbers {
    background: linear-gradient(180deg, var(--wine-950) 0%, var(--deep-3) 55%, var(--wine-950) 100%);
}
.site-footer {
    background: linear-gradient(180deg, var(--wine-950) 0%, var(--deep-3) 50%, var(--wine-950) 100%);
}
.ax-hero {
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, var(--deep-2) 0%, transparent 60%),
        linear-gradient(180deg, var(--wine-950) 0%, var(--deep-3) 50%, var(--wine-950) 100%);
}

/* Light sections: same cream as navbar */
.prog {
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, #fff 0%, transparent 60%),
        linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 100%);
}
.prefoot {
    background:
        radial-gradient(ellipse 90% 70% at 50% -10%, #fff 0%, transparent 55%),
        linear-gradient(180deg, var(--cream) 0%, var(--cream-2) 100%);
}

/* Second program card: gold-soft instead of amber/brown */
.board:nth-child(2) {
    --card-accent: #F2D06B;
    --card-accent-soft: rgba(242,208,107,0.14);
    --card-accent-line: rgba(242,208,107,0.32);
    --card-accent-glow: rgba(242,208,107,0.45);
    --card-bg-from: #3A0713;
    --card-bg-to: #2A0E16;
}

/* Force one accent everywhere (beats inline style="--pa:#...") */
.pillar { --pa: #E5B22C !important; }
.step   { --sa: #E5B22C !important; }
.course { --ca: #E5B22C !important; --ca-soft: rgba(229,178,44,0.14) !important; }

/* Bottom / left blooms: plum + coral -> burgundy lift */
[class*="bloom--br"],
[class*="glow--br"],
[class*="glow--bl"] {
    background: radial-gradient(circle, var(--wine-lift) 0%, transparent 68%) !important;
    opacity: 0.34;
}
.reach [class*="bloom--br"],
.hiw   [class*="bloom--br"],
.news  [class*="bloom--br"],
.faq   [class*="bloom--br"],
.prefoot [class*="bloom--br"] { opacity: 0.12; }

/* Star CTA gradient: gold -> burgundy only */
.why__cta {
    background-image:
        linear-gradient(transparent, transparent),
        linear-gradient(137deg, #E5B22C 8%, #F2D06B 28%, #7A1E34 56%, #5C0F1F 74%, #E5B22C 92%);
}
.why__cta-circle:nth-of-type(2) { background: rgba(122,30,52,0.75); }


/* =========================================================
   B. TYPOGRAPHY (optional)
   Add to <head> (once, replaces old Playfair/Inter link):
   <link rel="preconnect" href="https://fonts.googleapis.com">
   <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
   <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:ital,wght@0,500;0,600;0,700;1,500&display=swap">
   Delete this block to keep Playfair Display.
   ========================================================= */



/* =========================================================
   C. GPU FIXES — all devices
   ========================================================= */

/* C1. Blur on animated blobs = biggest GPU cost. Gradients are already
   soft, so blur is removed with almost no visual change. */
[class*="__bloom"],
[class*="__glow"],
.hero__aurora::before,
.hero__aurora::after,
.board__aurora,
.brand--footer::before,
.feature__media-glow,
.story__media-glow,
.pillar__halo {
    filter: none !important;
}

/* C2. Animations that moved margin/left/top = layout every frame.
   Rewritten with the independent `translate` property (compositor only). */
@keyframes bookFloat {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -18px; }
}
@keyframes heroFloat {
    0%, 100% { translate: 0 0; }
    50%      { translate: 0 -14px; }
}
.hero__book, .doodle { margin-top: 0 !important; }

.board__shine { left: 0; mix-blend-mode: normal; background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,0.08) 50%, transparent 100%); }
@keyframes boardShine {
    0%, 100% { translate: -100% 0; opacity: 0; }
    20%      { opacity: 1; }
    60%      { translate: 300% 0; opacity: 0; }
}
.board__rule::before { left: 0; }
@keyframes boardRuleTravel {
    0%   { translate: -100% 0; }
    100% { translate: 433% 0; }
}
.hero__aside-line::after { top: 0; }
@keyframes heroScroll {
    0%   { translate: 0 -100%; opacity: 0; }
    40%  { opacity: 1; }
    100% { translate: 0 250%; opacity: 0; }
}

/* C3. Blur filters inside keyframes = repaint each frame. Opacity + move only. */
@keyframes heroRise {
    from { opacity: 0; transform: translate3d(0, 24px, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes heroChar {
    to { opacity: 1; transform: none; }
}
.hero--split .hero__c { filter: none; will-change: auto; }
.hero__rotate-word,
.hero__rotate-word.is-leaving { filter: none !important; }

/* C4. will-change left on forever = hundreds of GPU layers.
   Browser promotes on its own during transition. */
.board, .pillar, .course, .step, .feature, .story, .rail-card, .city,
.prefoot__card, .ax-belief, .ax-step, .ax-stat, .nws-feat, .nws-card,
.fee-card, .struct-card, .nav-link__icon, .nav-panel__icon, .btn-apply,
.btn-portal, .faq-item__num, .faq-item__toggle, .hero-btn, .ctaband__btn,
.footer-news__field button, .footer-social a, .footer-seal, .brand__mark,
.jnode, .nav-panel__link, .test__flank, .faq__note-cta,
.brand--footer .brand__mark, .brand--footer .brand__img,
.feature__media img, .story__media img, .nws-card__media img,
.faq .reveal, .faq-item__a p, .mobile-nav__item {
    will-change: auto;
}

/* C5. Skip rendering of sections far off screen. */
main > section:not(:first-child),
.ax-page > section:not(:first-child),
.site-footer {
    content-visibility: auto;
    contain-intrinsic-size: auto 900px;
}

/* C6. Pause infinite animations when section is off screen or tab hidden.
   Class set by elaris-motion.js */
.is-offscreen,
.is-offscreen *,
.is-offscreen *::before,
.is-offscreen *::after,
html.tab-hidden *,
html.tab-hidden *::before,
html.tab-hidden *::after {
    animation-play-state: paused !important;
}


/* =========================================================
   D. TIERS  (html.perf-high / perf-mid / perf-lite)
   Set before first paint, then lowered if FPS probe is bad.
   ========================================================= */

/* ---- mid + lite: kill the expensive stuff ---- */
html.perf-mid *,  html.perf-mid *::before,  html.perf-mid *::after,
html.perf-lite *, html.perf-lite *::before, html.perf-lite *::after {
    -webkit-backdrop-filter: none !important;
            backdrop-filter: none !important;
}
.perf-mid .elaris-loader__panel::before,
.perf-lite .elaris-loader__panel::before,
.perf-mid .hero__bg-overlay::after,
.perf-lite .hero__bg-overlay::after,
.perf-mid .ctaband__panel::before,
.perf-lite .ctaband__panel::before { content: none; }

.perf-mid .hero__spotlight,
.perf-mid .board__aurora,
.perf-mid .reach__map-sweep { display: none !important; }

.perf-mid .why__cta-stars-inner::after,
.perf-mid .brand--footer .brand__img { animation: none !important; }

.perf-mid .hero__bg-tint { mix-blend-mode: normal; }

/* ---- lite: strip decoration, keep content + reveals ---- */
.perf-lite .hero__aurora,
.perf-lite .hero__stars,
.perf-lite .hero__spotlight,
.perf-lite .hero__bg-tint,
.perf-lite .doodle,
.perf-lite [class*="__bloom"],
.perf-lite [class*="__glow"],
.perf-lite .board__aurora,
.perf-lite .board__shine,
.perf-lite .ctaband__sweep,
.perf-lite .ctaband__stars,
.perf-lite .reach__map-sweep,
.perf-lite .why__cta-stars,
.perf-lite .why__cta-glow,
.perf-lite .elaris-loader__particles,
.perf-lite .elaris-particles { display: none !important; }

.perf-lite .hero__bg { transform: none !important; }
.perf-lite .hero__book { animation: none !important; }
.perf-lite .hero__bg-image { animation-duration: 1ms !important; }

/* infinite loops play once, then stop (ticker excepted) */
html.perf-lite *, html.perf-lite *::before, html.perf-lite *::after {
    animation-iteration-count: 1 !important;
}
html.perf-lite .prog__ticker-track { animation-iteration-count: infinite !important; }

/* gradient-text shimmer repaints text each frame */
.perf-lite .hero__title em,
.perf-lite .elaris-loader__name-inner,
.perf-lite .why__cta { animation: none !important; }
.perf-lite .elaris-loader__name-inner {
    background: none;
    -webkit-text-fill-color: #fff;
    color: #fff;
    transform: none;
}


/* =========================================================
   E. FADE-UP REVEAL SYSTEM
   JS adds .rv to blocks, then .rv-in when they enter view,
   then removes both after finish (original hover transitions
   come back untouched). Uses `translate` + `opacity` only:
   no conflict with card hover `transform`.
   ========================================================= */
html .rv {
    opacity: 0;
    translate: 0 var(--rv-y, 26px);
    transition:
        opacity   720ms cubic-bezier(0.16, 1, 0.3, 1) var(--rd, 0ms),
        translate 900ms cubic-bezier(0.16, 1, 0.3, 1) var(--rd, 0ms);
    will-change: opacity, translate;
}
html .rv[data-rv="zoom"] { scale: 0.975; transition-property: opacity, translate, scale; }
html .rv.rv-in,
html .rv[data-rv].rv-in {
    opacity: 1;
    translate: 0 0;
    scale: 1;
}

.perf-lite .rv { --rv-y: 14px; }
.perf-lite .rv,
.perf-lite .rv.rv-in {
    transition-duration: 480ms, 560ms;
}


/* =========================================================
   F. SCROLL PROGRESS BAR (compositor driven, no JS per scroll)
   Only works in browsers with scroll-driven animations;
   JS adds the element only if supported.
   ========================================================= */
.elaris-progress {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: calc(var(--z-header) + 1);
    background: linear-gradient(90deg, var(--gold), var(--gold-soft));
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
}
@keyframes elarisProgress {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

@supports (animation-timeline: scroll()) {
    .elaris-progress {
        animation-name: elarisProgress;
        animation-duration: 1ms;          /* required by some browsers, ignored by scroll timeline */
        animation-timing-function: linear;
        animation-fill-mode: both;
        animation-timeline: scroll(root block);
    }
}


/* =========================================================
   G. REDUCED MOTION
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
    html .rv {
        opacity: 1 !important;
        translate: none !important;
        scale: none !important;
        transition: none !important;
    }
    .elaris-progress { display: none; }
}