/* ==========================================================================
   IATM — Flight FX layer
   Aviation motion system for the public website: flight-route arcs, planes
   in flight, contrails, boarding-pass cards, runway takeoffs, radar loader.
   Scoped to body.public-page. Loaded AFTER public-site.css.
   Every animation is disabled under prefers-reduced-motion.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. App loader — radar + plane on runway (public pages only)
   -------------------------------------------------------------------------- */
body.public-page .app-loader {
    background:
        radial-gradient(420px circle at 50% 46%, rgba(30, 58, 138, .07), transparent 70%),
        var(--public-canvas);
}

body.public-page .app-loader .loader-ring {
    display: none;
}

body.public-page .loader-flight {
    position: relative;
    width: 190px;
    display: grid;
    justify-items: center;
    gap: 0;
}

body.public-page .loader-flight .loader-plane {
    position: relative;
    z-index: 2;
    color: var(--public-accent);
    font-size: 22px;
    transform: rotate(45deg);
    filter: drop-shadow(0 6px 10px rgba(30, 58, 138, .28));
    animation: loaderPlaneTaxi 1.7s cubic-bezier(.5, 0, .35, 1) infinite;
}

body.public-page .loader-flight .loader-plane::after {
    content: "";
    position: absolute;
    top: 55%;
    right: 88%;
    width: 46px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(270deg, rgba(30, 58, 138, .55), transparent);
    transform: rotate(-45deg);
    transform-origin: right center;
}

body.public-page .loader-flight .loader-runway {
    position: relative;
    width: 150px;
    height: 2px;
    margin-top: 16px;
    border-radius: 999px;
    background: repeating-linear-gradient(
        90deg,
        var(--public-accent) 0 14px,
        transparent 14px 26px
    );
    background-size: 52px 100%;
    opacity: .45;
    animation: loaderRunwayRoll 1.1s linear infinite;
}

body.public-page .loader-flight .loader-runway::after {
    content: "";
    position: absolute;
    inset: -9px -18px;
    border-radius: 50%;
    border: 1.5px solid rgba(30, 58, 138, .18);
    animation: loaderRadar 1.7s ease-out infinite;
}

@keyframes loaderPlaneTaxi {
    0%   { transform: translate(-34px, 6px) rotate(45deg); opacity: 0; }
    18%  { opacity: 1; }
    82%  { opacity: 1; }
    100% { transform: translate(34px, -10px) rotate(45deg); opacity: 0; }
}

@keyframes loaderRunwayRoll {
    to { background-position: 52px 0; }
}

@keyframes loaderRadar {
    0%   { transform: scale(.35); opacity: .9; }
    100% { transform: scale(1.5); opacity: 0; }
}

/* --------------------------------------------------------------------------
   2. Scroll progress — flight path with a plane riding the tip
   -------------------------------------------------------------------------- */
body.public-page .public-scroll-progress {
    height: 3px;
}

body.public-page .public-scroll-progress > span {
    background: linear-gradient(90deg, var(--public-accent-on-dark), var(--public-accent));
}

body.public-page .public-scroll-progress::after {
    content: "\f072"; /* fa-plane glyph via icon font */
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
    position: absolute;
    top: 50%;
    left: calc(var(--scroll-progress, 0) * 100%);
    z-index: 1;
    color: var(--public-accent);
    font-size: 11px;
    line-height: 1;
    transform: translate(-50%, -50%) rotate(45deg);
    opacity: var(--scroll-progress, 0);
    transition: left .1s linear, opacity .2s ease;
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   3. Top utility bar — plane crossing (markup re-enabled, tuned)
   -------------------------------------------------------------------------- */
body.public-page .utility-flight-animation {
    animation-duration: 11s;
    opacity: .92;
}

body.public-page .utility-flight-animation i {
    font-size: .85rem;
}

/* --------------------------------------------------------------------------
   4. Hero — flight route arc, clouds, floating image
   -------------------------------------------------------------------------- */
body.public-page .hero-flight-layer {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

body.public-page .hero-flight-layer .hero-grid-z-guard {
    display: none;
}

/* Clouds */
body.public-page .hero-clouds {
    position: absolute;
    inset: 0;
}

body.public-page .hero-cloud {
    position: absolute;
    width: var(--cloud-w, 190px);
    height: calc(var(--cloud-w, 190px) * .34);
    border-radius: 999px;
    background:
        radial-gradient(closest-side at 30% 55%, #ffffff 0 58%, transparent 72%),
        radial-gradient(closest-side at 55% 40%, #ffffff 0 62%, transparent 78%),
        radial-gradient(closest-side at 74% 58%, #ffffff 0 55%, transparent 74%);
    filter: drop-shadow(0 14px 22px rgba(30, 58, 138, .10));
    opacity: var(--cloud-o, .8);
    animation: cloudDrift var(--cloud-d, 90s) linear infinite;
    animation-delay: var(--cloud-delay, 0s);
    will-change: transform;
}

@keyframes cloudDrift {
    from { transform: translate3d(-30vw, 0, 0); }
    to   { transform: translate3d(115vw, 0, 0); }
}

/* Route arc */
body.public-page .hero-route {
    position: absolute;
    top: clamp(8px, 2vw, 26px);
    right: clamp(4px, 3vw, 56px);
    width: clamp(300px, 34vw, 520px);
    color: var(--public-accent);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .9s ease .35s, transform .9s ease .35s;
}

body.public-page .hero-route.is-active,
body.public-page .flight-route.is-active {
    opacity: 1;
    transform: translateY(0);
}

body.public-page .flight-route svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

body.public-page .flight-route .route-base {
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-dasharray: 3 9;
    stroke-linecap: round;
    opacity: .45;
    animation: routeDashes 2.6s linear infinite;
}

@keyframes routeDashes {
    to { stroke-dashoffset: -24; }
}

body.public-page .flight-route .route-trail,
body.public-page .process-route .route-trail {
    fill: none;
    stroke-width: 2.4;
    stroke-linecap: round;
}

body.public-page .flight-route .route-dot {
    fill: var(--public-accent);
}

body.public-page .flight-route .route-dot-pulse {
    fill: none;
    stroke: var(--public-accent);
    stroke-width: 1.4;
    opacity: 0;
    transform-origin: center;
    transform-box: fill-box;
    animation: routePulse 2.8s ease-out infinite;
}

@keyframes routePulse {
    0%   { transform: scale(.3); opacity: .8; }
    70%  { transform: scale(2.1); opacity: 0; }
    100% { transform: scale(2.1); opacity: 0; }
}

body.public-page .flight-route .route-label {
    fill: var(--public-slate);
    font-family: var(--public-mono);
    font-size: 11px;
    letter-spacing: 2.5px;
    text-transform: uppercase;
}

body.public-page .flight-route .route-plane {
    color: var(--public-accent);
    filter: drop-shadow(0 4px 7px rgba(30, 58, 138, .32));
}

/* Hero image — stays put; only the caption lifts slightly on hover */
body.public-page .image-caption-box {
    transition: transform .35s ease;
}

body.public-page .framed-image-wrap:hover .image-caption-box {
    transform: translateY(-4px);
}

/* Accent circles breathe */
body.public-page .hero-image-panel::before {
    animation: accentBreathe 6s ease-in-out infinite;
}

body.public-page .hero-image-panel::after {
    animation: accentBreathe 7.5s ease-in-out 1.2s infinite;
}

@keyframes accentBreathe {
    0%, 100% { transform: scale(1) translateY(0); }
    50%      { transform: scale(1.09) translateY(-6px); }
}

/* --------------------------------------------------------------------------
   5. Admissions process — flight route connector across the step cards
   -------------------------------------------------------------------------- */
body.public-page .process-grid {
    position: relative;
}

body.public-page .process-route {
    position: absolute;
    top: -34px;
    left: 0;
    width: 100%;
    height: 150px;
    z-index: 0;
    pointer-events: none;
    color: var(--public-accent);
    opacity: 0;
    transition: opacity .8s ease;
}

body.public-page .process-route.is-active {
    opacity: 1;
}

body.public-page .process-route .route-trail {
    stroke-dasharray: 1;
    stroke-dashoffset: 1;
    transition: stroke-dashoffset 2.4s cubic-bezier(.55, .06, .35, 1) .25s;
}

body.public-page .process-route.is-drawn .route-trail {
    stroke-dashoffset: 0;
}

body.public-page .process-route svg {
    height: 100%;
}

body.public-page .process-card {
    z-index: 1;
}

body.public-page .process-card > i {
    position: relative;
}

body.public-page .process-card > i::after {
    content: "";
    position: absolute;
    inset: -5px;
    border-radius: 50%;
    border: 1.5px solid rgba(30, 58, 138, .35);
    opacity: 0;
    transform: scale(.6);
    transition: opacity .3s ease, transform .3s ease;
}

body.public-page .process-card:hover > i::after {
    opacity: 1;
    transform: scale(1);
}

/* --------------------------------------------------------------------------
   6. Programs — boarding-pass cards
   -------------------------------------------------------------------------- */
body.public-page .program-code {
    gap: 8px;
    transition: transform .3s ease, background-color .3s ease, color .3s ease;
}

body.public-page .program-code::after {
    content: "\f072";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
    font-size: 10px;
    line-height: 1;
    transform: translateX(0) rotate(45deg);
    transition: transform .35s ease;
}

body.public-page .program-card:hover .program-code {
    transform: translateY(-2px);
}

body.public-page .program-card:hover .program-code::after {
    transform: translateX(5px) rotate(45deg);
}

body.public-page .program-meta {
    position: relative;
    align-items: center;
    gap: 14px;
}

/* Punch-hole notches sitting on the perforation line */
body.public-page .program-meta::before,
body.public-page .program-meta::after {
    content: "";
    position: absolute;
    top: -11px;
    width: 21px;
    height: 21px;
    border-radius: 50%;
    background: var(--public-mist);
    box-shadow: inset 0 0 0 1.5px rgba(0, 0, 0, .06);
    transition: background-color .3s ease;
}

body.public-page .program-meta::before { left: -41px; }
body.public-page .program-meta::after  { right: -41px; }

body.public-page .program-card:hover .program-meta::before,
body.public-page .program-card:hover .program-meta::after {
    background: var(--public-mist);
}

/* Barcode stub */
body.public-page .boarding-barcode {
    display: inline-block;
    width: 52px;
    height: 26px;
    margin-left: auto;
    border-radius: 3px;
    background: repeating-linear-gradient(
        90deg,
        currentColor 0 2px,
        transparent 2px 4px,
        currentColor 4px 5px,
        transparent 5px 9px,
        currentColor 9px 12px,
        transparent 12px 14px,
        currentColor 14px 15px,
        transparent 15px 19px,
        currentColor 19px 21px,
        transparent 21px 24px
    );
    opacity: .55;
    transition: opacity .3s ease;
}

body.public-page .program-card:hover .boarding-barcode {
    opacity: .8;
}

/* --------------------------------------------------------------------------
   7. Stats band — drifting airways in the background
   -------------------------------------------------------------------------- */
body.public-page .stats-band {
    position: relative;
    overflow: hidden;
}

body.public-page .stats-band::before,
body.public-page .stats-band::after {
    content: "";
    position: absolute;
    left: -20%;
    width: 140%;
    height: 1.5px;
    background: repeating-linear-gradient(
        90deg,
        rgba(139, 176, 230, .5) 0 10px,
        transparent 10px 22px
    );
    background-size: 44px 100%;
    animation: airwayFlow 9s linear infinite;
    pointer-events: none;
}

body.public-page .stats-band::before {
    top: 26%;
    transform: rotate(-2.2deg);
}

body.public-page .stats-band::after {
    bottom: 22%;
    transform: rotate(1.8deg);
    animation-duration: 13s;
    animation-direction: reverse;
}

@keyframes airwayFlow {
    to { background-position: 44px 0; }
}

body.public-page .stat-item {
    position: relative;
}

body.public-page .stat-item::after {
    content: "\f072";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-style: normal;
    position: absolute;
    top: 18px;
    right: 24px;
    color: rgba(139, 176, 230, .5);
    font-size: 15px;
    line-height: 1;
    transform: rotate(45deg);
    transition: transform .4s ease, color .4s ease;
}

body.public-page .stat-item:hover::after {
    color: var(--public-accent-on-dark);
    transform: rotate(45deg) translate(4px, -4px);
}

/* --------------------------------------------------------------------------
   8. CTA panel — runway takeoff strip
   -------------------------------------------------------------------------- */
body.public-page .cta-panel .takeoff-strip {
    position: absolute;
    inset: auto 0 0 0;
    height: 58px;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

body.public-page .takeoff-strip .takeoff-runway {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 17px;
    height: 2px;
    background: repeating-linear-gradient(
        90deg,
        rgba(139, 176, 230, .75) 0 26px,
        transparent 26px 48px
    );
    background-size: 96px 100%;
    animation: runwayScroll 1.4s linear infinite;
    opacity: .55;
}

@keyframes runwayScroll {
    to { background-position: 96px 0; }
}

body.public-page .takeoff-strip .takeoff-plane {
    position: absolute;
    bottom: 24px;
    left: 0;
    color: var(--public-accent-on-dark);
    font-size: 21px;
    opacity: 0;
    filter: drop-shadow(0 5px 8px rgba(0, 0, 0, .4));
    animation: takeoffFlight 10s cubic-bezier(.45, 0, .6, 1) infinite;
    will-change: transform, opacity;
}

body.public-page .takeoff-strip .takeoff-plane::after {
    content: "";
    position: absolute;
    top: 52%;
    right: 92%;
    width: 54px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(270deg, rgba(139, 176, 230, .65), transparent);
}

@keyframes takeoffFlight {
    0% {
        transform: translateX(-80px) translateY(0) rotate(0deg);
        opacity: 0;
    }
    6% {
        opacity: .95;
    }
    30% {
        transform: translateX(24vw) translateY(0) rotate(0deg);
        opacity: .95;
    }
    44% {
        transform: translateX(46vw) translateY(-24px) rotate(-9deg);
        opacity: .95;
    }
    62% {
        transform: translateX(74vw) translateY(-78px) rotate(-15deg);
        opacity: .9;
    }
    78%, 100% {
        transform: translateX(104vw) translateY(-150px) rotate(-15deg);
        opacity: 0;
    }
}

/* --------------------------------------------------------------------------
   9. Contact panel — ambassador plane (fa-plane, same glyph as the routes)
   -------------------------------------------------------------------------- */
body.public-page .contact-action-panel::before {
    display: block;
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    opacity: .5;
    background:
        radial-gradient(300px circle at 88% 0%, rgba(30, 58, 138, .08), transparent 70%);
}

body.public-page #contact-plane {
    display: block;
    position: absolute;
    z-index: 2;
    top: 0;
    left: 0;
    width: 34px;
    height: 34px;
    pointer-events: none;
    opacity: 0;
    transform: translate(var(--pa-x, 24px), var(--pa-y, 24px));
    will-change: transform, opacity;
}

body.public-page #contact-plane.is-visible {
    opacity: 1;
}

body.public-page #contact-plane .pa-body {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--public-accent);
    font-size: 21px;
    filter: drop-shadow(0 5px 9px rgba(30, 58, 138, .3));
    transform: rotate(var(--pa-rot, 0deg)) scaleX(var(--pa-flip, 1));
}

body.public-page #contact-plane .pa-trail {
    position: absolute;
    top: 50%;
    right: 96%;
    width: 46px;
    height: 2px;
    border-radius: 999px;
    background: linear-gradient(270deg, rgba(30, 58, 138, .5), transparent);
    transform: scaleX(var(--pa-trail, 0));
    transform-origin: right center;
    transition: transform .28s ease;
}

/* Flying home (leftward): the plane mirrors and the contrail follows behind */
body.public-page #contact-plane.is-flipped .pa-trail {
    right: auto;
    left: 96%;
    background: linear-gradient(90deg, rgba(30, 58, 138, .5), transparent);
    transform-origin: left center;
}

/* --------------------------------------------------------------------------
   10. Footer — flight line above the lead block
   -------------------------------------------------------------------------- */
body.public-page .footer-flight-line {
    position: relative;
    height: 40px;
    margin-bottom: 8px;
    overflow: hidden;
    pointer-events: none;
}

body.public-page .footer-flight-line .ffl-dash {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1.5px;
    background: repeating-linear-gradient(
        90deg,
        rgba(139, 176, 230, .4) 0 9px,
        transparent 9px 20px
    );
    background-size: 40px 100%;
    animation: airwayFlow 7s linear infinite;
    opacity: .7;
}

body.public-page .footer-flight-line .ffl-plane {
    position: absolute;
    top: 50%;
    left: 0;
    color: var(--public-accent-on-dark);
    font-size: 15px;
    line-height: 1;
    opacity: 0;
    transform: translateY(-50%);
    animation: footerPlaneCross 13s cubic-bezier(.5, 0, .45, 1) infinite;
}

body.public-page .footer-flight-line .ffl-plane::after {
    content: "";
    position: absolute;
    top: 45%;
    right: 95%;
    width: 40px;
    height: 1.5px;
    background: linear-gradient(270deg, rgba(139, 176, 230, .6), transparent);
}

@keyframes footerPlaneCross {
    0%   { transform: translate(-60px, -50%); opacity: 0; }
    8%   { opacity: .95; }
    46%  { transform: translate(38vw, calc(-50% - 8px)); opacity: .95; }
    82%  { opacity: .95; }
    92%, 100% { transform: translate(calc(100vw - 20px), -50%); opacity: 0; }
}

/* Back to top — plane */
body.public-page .back-to-top .fa-arrow-up {
    display: none;
}

body.public-page .back-to-top .fa-plane {
    display: inline-block;
    transform: rotate(-45deg);
    transition: transform .3s ease;
}

body.public-page .back-to-top:hover .fa-plane {
    transform: rotate(-45deg) translate(2px, -2px);
}

/* --------------------------------------------------------------------------
   11. Register page — route arc in the hero
   -------------------------------------------------------------------------- */
body.public-page .registration-heading {
    position: relative;
}

body.public-page .reg-flight-route {
    position: absolute;
    top: -6px;
    right: 0;
    width: clamp(260px, 26vw, 420px);
    color: var(--public-accent);
    pointer-events: none;
}

/* --------------------------------------------------------------------------
   12. Principles page — compact route in the hero
   -------------------------------------------------------------------------- */
body.public-page .principles-hero {
    position: relative;
    overflow: hidden;
}

body.public-page .principles-flight-route {
    position: absolute;
    top: 30px;
    right: 2vw;
    width: clamp(240px, 24vw, 400px);
    color: var(--public-accent);
    pointer-events: none;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .9s ease .3s, transform .9s ease .3s;
}

/* --------------------------------------------------------------------------
   13. Selection & micro polish
   -------------------------------------------------------------------------- */
body.public-page ::selection {
    color: var(--public-white);
    background: var(--public-accent);
}

/* --------------------------------------------------------------------------
   14. Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 1199.98px) {
    body.public-page .hero-route {
        width: clamp(260px, 30vw, 420px);
        right: 2vw;
    }
}

@media (max-width: 991.98px) {
    body.public-page .hero-route,
    body.public-page .process-route,
    body.public-page .reg-flight-route,
    body.public-page .principles-flight-route {
        display: none;
    }

    body.public-page .hero-clouds {
        opacity: .55;
    }

    body.public-page .takeoff-strip .takeoff-plane {
        animation-duration: 8.5s;
    }
}

@media (max-width: 575.98px) {
    body.public-page .hero-cloud {
        --cloud-w: 120px;
    }

    body.public-page .loader-flight {
        width: 160px;
    }

    body.public-page .loader-flight .loader-runway {
        width: 120px;
    }

    body.public-page .public-scroll-progress::after {
        display: none;
    }
}

/* --------------------------------------------------------------------------
   14b. Low-power mode for touch/phone-class devices.
   `(any-pointer: coarse)` catches phones and tablets even in desktop-site
   mode; the width cap keeps larger touchscreens (iPads, Surface) on the
   full-fidelity path. These background flight-line/plane decorations are a
   handful of pixels wide at phone width and add nothing worth the paint
   cost, but they were animating forever on every page regardless — the
   kind of sustained work that turns into visible scroll jank on a cheap
   phone GPU. Same treatment as prefers-reduced-motion below.
   -------------------------------------------------------------------------- */
@media (max-width: 767.98px) and (any-pointer: coarse) {
    body.public-page .stats-band::before,
    body.public-page .stats-band::after,
    body.public-page .takeoff-strip .takeoff-runway,
    body.public-page .takeoff-strip .takeoff-plane,
    body.public-page .footer-flight-line .ffl-dash,
    body.public-page .footer-flight-line .ffl-plane,
    body.public-page .psb-airway,
    body.public-page .utility-flight-animation {
        animation: none !important;
    }

    body.public-page .takeoff-strip .takeoff-plane,
    body.public-page .footer-flight-line .ffl-plane,
    body.public-page .utility-flight-animation,
    body.public-page #contact-plane {
        display: none !important;
    }
}

/* --------------------------------------------------------------------------
   15. Reduced motion — park every plane
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    body.public-page .loader-flight .loader-plane,
    body.public-page .loader-flight .loader-runway,
    body.public-page .loader-flight .loader-runway::after,
    body.public-page .hero-cloud,
    body.public-page .flight-route .route-base,
    body.public-page .flight-route .route-dot-pulse,
    body.public-page .stats-band::before,
    body.public-page .stats-band::after,
    body.public-page .takeoff-strip .takeoff-runway,
    body.public-page .takeoff-strip .takeoff-plane,
    body.public-page .footer-flight-line .ffl-dash,
    body.public-page .footer-flight-line .ffl-plane,
    body.public-page .utility-flight-animation {
        animation: none !important;
    }

    body.public-page .takeoff-strip .takeoff-plane,
    body.public-page .footer-flight-line .ffl-plane,
    body.public-page .utility-flight-animation,
    body.public-page #contact-plane {
        display: none !important;
    }

    body.public-page .process-route .route-trail {
        stroke-dashoffset: 0 !important;
        transition: none !important;
    }

    body.public-page .public-scroll-progress::after {
        transition: none !important;
    }

    body.public-page .framed-image-wrap {
        transform: none !important;
    }
}
