/*
 * Homepage motion layer: load sequence, scroll reveals, hover micro-interactions,
 * scroll progress and light parallax. Everything is scoped under html.mx, which the
 * inline head script only adds when the visitor has not asked for reduced motion,
 * so with motion off (or no JS) the page renders exactly as before.
 */

/* prod2's own fade-up is replaced by the richer reveals below */
html.mx .animate-on-scroll { opacity: 1 !important; transform: none !important; transition: none !important; }

/* ---------- Load sequence ---------- */
html.mx .top-thin-nav { animation: mx-drop .8s cubic-bezier(.2, .8, .2, 1) both; }
html.mx .main-nav { animation: mx-fade-down .9s .12s cubic-bezier(.2, .8, .2, 1) both; }
html.mx .nav-logo img { animation: mx-logo 1.1s .25s cubic-bezier(.34, 1.56, .64, 1) both; }
html.mx .nav-left .nav-dropdown, html.mx .nav-right > * { animation: mx-fade-down .7s cubic-bezier(.2, .8, .2, 1) both; }
html.mx .nav-left .nav-dropdown:nth-child(1), html.mx .nav-right > :nth-child(1) { animation-delay: .35s; }
html.mx .nav-left .nav-dropdown:nth-child(2), html.mx .nav-right > :nth-child(2) { animation-delay: .43s; }
html.mx .nav-left .nav-dropdown:nth-child(3), html.mx .nav-right > :nth-child(3) { animation-delay: .51s; }

@keyframes mx-drop { from { translate: 0 -100%; } to { translate: 0 0; } }
@keyframes mx-fade-down { from { opacity: 0; translate: 0 -14px; } to { opacity: 1; translate: 0 0; } }
@keyframes mx-logo { 0% { opacity: 0; scale: .4; rotate: -20deg; } 100% { opacity: 1; scale: 1; rotate: 0deg; } }

/* hero: slow Ken Burns on the active slide, words rise in */
html.mx .hero-section .carousel-item img { transform-origin: 60% 40%; }
html.mx .hero-section .carousel-item.active img { animation: mx-kenburns 9s ease-out both; }
@keyframes mx-kenburns { from { scale: 1.14; } to { scale: 1; } }

html.mx:not(.mx-ready) .hero-title,
html.mx:not(.mx-ready) .hero-buttons { opacity: 0; }
html.mx .hero-title .mx-w { display: inline-block; opacity: 0; translate: 0 .6em; rotate: 2deg; filter: blur(10px); }
html.mx.mx-ready .hero-title .mx-w { animation: mx-word 1s cubic-bezier(.2, .8, .2, 1) forwards; animation-delay: calc(.45s + var(--i) * .09s); }
@keyframes mx-word { to { opacity: 1; translate: 0 0; rotate: 0deg; filter: blur(0); } }
html.mx.mx-ready .hero-buttons > * { animation: mx-up .9s cubic-bezier(.2, .8, .2, 1) backwards; }
html.mx.mx-ready .hero-buttons > :nth-child(1) { animation-delay: 1.15s; }
html.mx.mx-ready .hero-buttons > :nth-child(2) { animation-delay: 1.28s; }
html.mx.mx-ready .hero-slide-controls button { animation: mx-fade 1s 1.4s both; }

html.mx.mx-ready .announcement-inner { animation: mx-slide-r 1s 1.2s cubic-bezier(.2, .8, .2, 1) backwards; }
html.mx .announcement-text i { display: inline-block; transform-origin: 30% 60%; animation: mx-wiggle 3.2s 2.4s ease-in-out infinite; }
@keyframes mx-wiggle { 0%, 82%, 100% { rotate: 0deg; scale: 1; } 86% { rotate: -14deg; scale: 1.15; } 90% { rotate: 10deg; scale: 1.15; } 94% { rotate: -6deg; scale: 1; } }

/* ---------- Scroll reveals ---------- */
html.mx .mx-wait { opacity: 0; }
html.mx .mx-in[data-mx] { animation-duration: 1s; animation-timing-function: cubic-bezier(.2, .8, .2, 1); animation-fill-mode: backwards; animation-delay: var(--mx-d, 0s); animation-iteration-count: 1; animation-direction: normal; animation-play-state: running; }
html.mx .mx-in[data-mx="up"]    { animation-name: mx-up; }
html.mx .mx-in[data-mx="left"]  { animation-name: mx-slide-r; }
html.mx .mx-in[data-mx="right"] { animation-name: mx-slide-l; }
html.mx .mx-in[data-mx="zoom"]  { animation-name: mx-zoom; animation-duration: 1.1s; }
html.mx .mx-in[data-mx="pop"]   { animation-name: mx-pop; animation-duration: .9s; animation-timing-function: cubic-bezier(.34, 1.56, .64, 1); }
html.mx .mx-in[data-mx="wipe"]  { animation-name: mx-wipe; animation-duration: 1.4s; animation-timing-function: cubic-bezier(.77, 0, .18, 1); }
html.mx .mx-in[data-mx="title"] { animation-name: mx-title; animation-duration: 1.2s; }

@keyframes mx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mx-up { from { opacity: 0; translate: 0 46px; filter: blur(6px); } to { opacity: 1; translate: 0 0; filter: blur(0); } }
@keyframes mx-slide-r { from { opacity: 0; translate: -60px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes mx-slide-l { from { opacity: 0; translate: 60px 0; } to { opacity: 1; translate: 0 0; } }
@keyframes mx-zoom { from { opacity: 0; scale: .86; translate: 0 30px; filter: blur(8px); } to { opacity: 1; scale: 1; translate: 0 0; filter: blur(0); } }
@keyframes mx-pop { from { opacity: 0; scale: .4; rotate: -12deg; } to { opacity: 1; scale: 1; rotate: 0deg; } }
@keyframes mx-wipe { from { clip-path: inset(0 0 0 100%); scale: 1.12; } to { clip-path: inset(0 0 0 0); scale: 1; } }
@keyframes mx-title { from { opacity: 0; letter-spacing: .18em; filter: blur(10px); translate: 0 18px; } to { opacity: 1; letter-spacing: normal; filter: blur(0); translate: 0 0; } }

/* gold rule that draws under section headings once they appear */
html.mx .mx-rule { position: relative; }
html.mx .mx-rule::after {
    content: ''; position: absolute; left: 50%; bottom: -14px; width: 84px; height: 2px; margin-left: -42px;
    background: linear-gradient(90deg, transparent, #c5a55a 20%, #c5a55a 80%, transparent);
    transform: scaleX(0); transition: transform 1.1s .5s cubic-bezier(.77, 0, .18, 1);
}
html.mx .mx-rule.mx-drawn::after { transform: scaleX(1); }

/* campus film eases out of a slight zoom as it comes into view */
html.mx .campus-video-section video { transition: scale 1.8s cubic-bezier(.2, .8, .2, 1), filter 1.8s; }
html.mx .campus-video-section.mx-pre video { scale: 1.12; filter: saturate(.6) brightness(.8); }

/* ---------- Hover micro-interactions ---------- */
/* light sweep across buttons */
html.mx :is(.btn-cta, .tour-btn, .explore-btn, .home-houses-link, .announcement-btn, .about-left .btn, .footer-btn, .home-action-links a) {
    background-image: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
    background-size: 260% 100%; background-position: 130% 0; background-repeat: no-repeat;
    transition: background-position .8s cubic-bezier(.2, .8, .2, 1), translate .35s cubic-bezier(.2, .8, .2, 1), box-shadow .35s, color .3s, background-color .3s, border-color .3s;
}
html.mx :is(.btn-cta, .tour-btn, .explore-btn, .home-houses-link, .announcement-btn, .about-left .btn, .footer-btn, .home-action-links a):hover {
    background-position: -30% 0; translate: 0 -3px; box-shadow: 0 12px 26px -10px rgba(10, 37, 64, .55);
}
html.mx :is(.btn-cta, .tour-btn, .explore-btn, .home-houses-link, .announcement-btn, .about-left .btn, .footer-btn, .home-action-links a):active { translate: 0 0; }

/* 3D tilt + glare on photo cards (transform set inline by JS) */
html.mx .mx-tilt { position: relative; transform-style: preserve-3d; will-change: transform; }
html.mx .mx-glare {
    position: absolute; inset: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity .4s;
    background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 50%), rgba(255, 255, 255, .28), transparent 45%);
    mix-blend-mode: soft-light;
}
html.mx .mx-tilt:hover .mx-glare { opacity: 1; }
html.mx .experience-card .card-image img, html.mx .op-card img, html.mx .alumni-photo { transition: transform .9s cubic-bezier(.2, .8, .2, 1), filter .6s; }
html.mx .testimonial-card:hover .alumni-photo { transform: scale(1.06); }
html.mx .op-card:hover img { filter: saturate(1.15); }

/* house crests: idle float, lift and glow on hover */
html.mx .home-houses-grid img { transition: transform .5s cubic-bezier(.34, 1.56, .64, 1), filter .5s; animation: mx-float 5.5s ease-in-out infinite; }
html.mx .home-houses-grid img:nth-child(2) { animation-delay: -1.4s; }
html.mx .home-houses-grid img:nth-child(3) { animation-delay: -2.8s; }
html.mx .home-houses-grid img:nth-child(4) { animation-delay: -4.2s; }
html.mx .home-houses-grid img:hover { transform: scale(1.1) rotate(-4deg); filter: drop-shadow(0 14px 22px rgba(197, 165, 90, .55)); animation-play-state: paused; }
@keyframes mx-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }

/* partner logos: calm until hovered */
html.mx .about-membership-logo { transition: translate .4s cubic-bezier(.2, .8, .2, 1), box-shadow .4s, border-color .4s; }
html.mx .about-membership-logo img { transition: transform .5s cubic-bezier(.34, 1.56, .64, 1); }   /* logos always in full colour */
html.mx .about-membership-logo:hover { translate: 0 -6px; box-shadow: 0 18px 34px -16px rgba(10, 37, 64, .45); }
html.mx .about-membership-logo:hover img { transform: scale(1.06); }

/* stats: gold glow pulse when the counters land */
html.mx .stat-number.mx-landed { animation: mx-glow 1.4s ease-out; }
@keyframes mx-glow { 0% { text-shadow: 0 0 0 rgba(197, 165, 90, 0); } 30% { text-shadow: 0 0 22px rgba(197, 165, 90, .9); } 100% { text-shadow: 0 0 0 rgba(197, 165, 90, 0); } }

/* ---------- Scroll progress ---------- */
.mx-progress { position: fixed; left: 0; top: 0; z-index: 1002; width: 100%; height: 3px; pointer-events: none; transform-origin: 0 50%; transform: scaleX(0);
    background: linear-gradient(90deg, #c5a55a, #e8d39a 55%, #c5a55a); box-shadow: 0 0 10px rgba(197, 165, 90, .7); }

@media (hover: none) {
    html.mx .mx-glare { display: none; }
}
@media print {
    .mx-progress { display: none; }
}

/* keep the sticky header's slide-in (the load fade-down above would otherwise win) */
html.mx .main-nav.scrolled { animation: ibs-nav-in .45s cubic-bezier(.2, .8, .2, 1); }

/* the Ken Burns hero zoom and the campus-film zoom start oversized: keep them inside their sections */
html.mx .hero-section, html.mx .campus-video-section { overflow: clip; }
