/* ==========================================================================
   Enhancement layer: motion, parallax, polish and mobile tuning.
   Loaded AFTER custom.css. Nothing here changes layout, colours or type on
   desktop; it only adds motion and small interaction details.
   ========================================================================== */

:root {
    --fx-ease: cubic-bezier(.22, .61, .36, 1);
}

html {
    scroll-padding-top: 90px;
    -webkit-text-size-adjust: 100%;
}
body {
    overflow-x: clip;
    -webkit-tap-highlight-color: rgba(193, 172, 118, .25);
}
a, button, .btn {
    touch-action: manipulation;
}

/* ---------- Keyframes ---------- */
@keyframes fx-rise {
    from { opacity: 0; transform: translate3d(0, 28px, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes fx-fade-down {
    from { opacity: 0; transform: translate3d(0, -14px, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes fx-kb {
    from { transform: scale(1.12); }
    to   { transform: scale(1); }
}
@keyframes fx-drift {
    from { transform: translate3d(-3%, -2%, 0); }
    to   { transform: translate3d(3%, 2%, 0); }
}
@keyframes fx-menu {
    from { opacity: 0; transform: translate3d(0, 8px, 0); }
    to   { opacity: 1; transform: none; }
}
@keyframes fx-line {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

/* ---------- Page load: header + hero intro (pure CSS, no JS needed) ---------- */
header {
    z-index: 50; /* keeps the nav above the (now positioned) hero sections */
    animation: fx-fade-down .9s var(--fx-ease) .05s backwards;
}
.top_banner span,
.top_banner h1,
.top_banner_text span.page_parent,
.top_banner_text h1 {
    animation: fx-rise 1.1s var(--fx-ease) backwards;
}
.top_banner span,
.top_banner_text span.page_parent { animation-delay: .2s; }
.top_banner h1,
.top_banner_text h1               { animation-delay: .4s; }
.history-section__divider {
    animation: fx-rise 1.1s var(--fx-ease) .6s backwards;
}
.history-section__divider-line {
    animation: fx-line 1.2s var(--fx-ease) .8s backwards;
}
.history-section__divider-line:first-child { transform-origin: right center; }
.history-section__divider-line:last-child  { transform-origin: left center; }

/* ---------- Parallax layers (built by enhance.js) ---------- */
.fx-host {
    position: relative;
    isolation: isolate;
}
.fx-host > .container-fluid {
    position: relative;
    z-index: 2;
    will-change: transform, opacity;
}
.fx-layer {
    position: absolute;
    left: 0;
    right: 0;
    top: -12%;
    height: 124%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
    opacity: 0;
    transition: opacity 1.1s ease;
    will-change: transform;
    transform: translate3d(0, 0, 0);
}
.fx-layer.is-ready { opacity: 1; }
.fx-layer-img {
    position: absolute;
    inset: -3%;
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center center;
}
.fx-hero .fx-layer-img {
    animation: fx-kb 16s var(--fx-ease) both;
}

/* Soft drifting light over the home hero (decorative, very subtle) */
.home .top_banner.fx-host::after {
    content: "";
    position: absolute;
    inset: -20%;
    z-index: 1;
    pointer-events: none;
    background:
        radial-gradient(38% 34% at 28% 32%, rgba(193, 172, 118, .20), transparent 70%),
        radial-gradient(34% 30% at 76% 66%, rgba(255, 255, 255, .08), transparent 70%);
    animation: fx-drift 18s ease-in-out infinite alternate;
    will-change: transform;
}
.fx-off.top_banner::after { animation-play-state: paused; }

/* Elements nudged by parallax must not fight the global "transition: all" on img */
[data-fx-shift],
.bg_graphic {
    transition: none !important;
    will-change: transform;
}

/* ---------- Scroll reveal for elements that are not already using AOS ---------- */
.fx-pre {
    opacity: 0;
    transform: translate3d(0, 30px, 0);
}
.fx-pre.fx-zoom {
    transform: scale(.94);
}
.fx-pre,
.fx-pre.fx-in {
    transition: opacity .9s var(--fx-ease), transform .9s var(--fx-ease);
    transition-delay: var(--fx-d, 0s);
}
.fx-pre.fx-in {
    opacity: 1;
    transform: none;
}

/* ---------- Scroll progress bar ---------- */
.fx-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 2000;
    pointer-events: none;
    background: linear-gradient(90deg, var(--golden), #e8d9a6);
    transform: scaleX(0);
    transform-origin: 0 50%;
    will-change: transform;
}

/* ---------- Buttons: shine sweep + press feedback ---------- */
.btn_1 {
    position: relative;
    overflow: hidden;
}
.btn_1::before {
    content: "";
    position: absolute;
    top: 0;
    left: -80%;
    width: 50%;
    height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
    transform: skewX(-20deg);
    transition: left .7s var(--fx-ease);
    pointer-events: none;
}
.btn_1:active {
    transform: scale(.97);
}

/* ---------- Hover polish (real pointers only, so touch never gets "stuck" hovers) ---------- */
@media (hover: hover) and (pointer: fine) {
    .btn_1:hover::before { left: 130%; }

    .news-thumb::after { transition: transform .9s var(--fx-ease); }
    .news-card:hover .news-thumb::after { transform: scale(1.05); }
}

@media (hover: hover) and (pointer: fine) and (min-width: 992px) {
    .header-2 ul > li > a { position: relative; }
    .header-2 ul > li > a::after {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        bottom: -3px;
        height: 1px;
        background: var(--golden);
        transform: scaleX(0);
        transform-origin: left center;
        transition: transform .4s var(--fx-ease);
    }
    .header-2 ul > li:hover > a::after { transform: scaleX(1); }
    .header-2 ul > li > ul.sub-menu a::after { display: none; }
    .header-2 ul > li:hover > ul.sub-menu { animation: fx-menu .28s var(--fx-ease) both; }
}

/* ---------- Touch devices: no sticky hover states ---------- */
@media (hover: none) {
    .news-card:hover,
    .news-card:focus-within {
        transform: none;
        box-shadow: 0 2px 14px rgba(38, 32, 46, 0.10);
    }
}

/* ==========================================================================
   Mobile optimisation (phones and small tablets)
   ========================================================================== */
@media (max-width: 767.98px) {
    :root {
        --h2: clamp(28px, 7.5vw, 42px);
        --h3: clamp(22px, 5.6vw, 28px);
    }

    /* Tighter vertical rhythm so sections don't feel empty on small screens */
    .padding-top-240    { padding-top: 120px; }
    .padding-bottom-240 { padding-bottom: 120px; }
    .padding-top-120    { padding-top: 72px; }
    .padding-bottom-120 { padding-bottom: 72px; }
    .padding-top-90     { padding-top: 56px; }
    .padding-bottom-90  { padding-bottom: 56px; }
    .margin-bottom-60   { margin-bottom: 36px; }

    /* Hero: use the *small* viewport height so the browser toolbar doesn't cause a jump */
    .top_banner { min-height: 420px; }

    /* Cheaper blur on the news thumbnails */
    .news-thumb::before {
        inset: -14px;
        filter: blur(10px) brightness(.85);
    }

    /* Bigger, easier tap targets in the mobile menu */
    .mobile-navbar .navbar-toggler {
        min-width: 44px;
        min-height: 44px;
    }
    .mobile-nav-list li > a {
        display: block;
        padding: .45rem 0;
    }

    /* Calmer AOS travel on stacked columns (no sideways slide / overflow) */
    [data-aos="fade-right"]:not(.aos-animate),
    [data-aos="fade-left"]:not(.aos-animate),
    [data-aos="fade-up"]:not(.aos-animate) {
        transform: translate3d(0, 28px, 0);
    }

    /* Decorative drifting light is desktop-only (saves battery) */
    .home .top_banner.fx-host::after { display: none; }
    .fx-pre { transform: translate3d(0, 22px, 0); }
}

@supports (height: 1svh) {
    @media (max-width: 767.98px) {
        .top_banner { height: 83svh; }
        body:not(.home) .top_banner { height: 50svh; }
    }
}

/* ---------- Respect "reduce motion" ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
    .fx-layer { opacity: 1; }
    .fx-progress { display: none; }
}
