/* ==========================================================================
   Macam Travel — motion

   Everything here is CSS. The CSP is `style-src 'self'` with no 'unsafe-inline',
   so nothing may be set through a style attribute: reveals are driven by a single
   class the observer toggles, stagger comes from :nth-child, and the hero parallax
   uses scroll-driven animations where the browser supports them.

   Every effect is switched off under prefers-reduced-motion at the end of the file.
   ========================================================================== */

:root {
    --ease-out: cubic-bezier(.16, .84, .44, 1);
    --ease-spring: cubic-bezier(.22, 1.2, .36, 1);
    --dur: .72s;
}

/* Smooth in-page jumps without a scroll library */
html { scroll-behavior: smooth; }

/* Cross-document page transitions, where supported. One declaration, big effect. */
@view-transition { navigation: auto; }

/* ── Scroll reveal ──────────────────────────────────────────────────────────
   The observer adds .is-in. Elements start slightly low, soft and small; they
   settle rather than slide, which reads as expensive rather than busy. */

.js .reveal {
    opacity: 0;
    transform: translate3d(0, 26px, 0) scale(.985);
    filter: blur(6px);
    transition:
        opacity var(--dur) var(--ease-out),
        transform var(--dur) var(--ease-out),
        filter var(--dur) var(--ease-out);
    will-change: opacity, transform;
}
.js .reveal.is-in { opacity: 1; transform: none; filter: none; }

.js .reveal-left  { transform: translate3d(-30px, 0, 0); }
.js .reveal-right { transform: translate3d(30px, 0, 0); }
.js .reveal-scale { transform: scale(.94); filter: blur(8px); }

/* Stagger children. Delay is per position, so no JS has to touch a style. */
.js .stagger > * { transition-delay: 0ms; }
.js .stagger.is-in > *:nth-child(1)  { transition-delay: 40ms; }
.js .stagger.is-in > *:nth-child(2)  { transition-delay: 110ms; }
.js .stagger.is-in > *:nth-child(3)  { transition-delay: 180ms; }
.js .stagger.is-in > *:nth-child(4)  { transition-delay: 250ms; }
.js .stagger.is-in > *:nth-child(5)  { transition-delay: 320ms; }
.js .stagger.is-in > *:nth-child(6)  { transition-delay: 390ms; }
.js .stagger.is-in > *:nth-child(7)  { transition-delay: 460ms; }
.js .stagger.is-in > *:nth-child(8)  { transition-delay: 530ms; }
.js .stagger.is-in > *:nth-child(9)  { transition-delay: 600ms; }
.js .stagger.is-in > *:nth-child(10) { transition-delay: 670ms; }
.js .stagger.is-in > *:nth-child(11) { transition-delay: 740ms; }
.js .stagger.is-in > *:nth-child(12) { transition-delay: 810ms; }

.js .stagger > * {
    opacity: 0;
    transform: translate3d(0, 24px, 0);
    transition: opacity .68s var(--ease-out), transform .68s var(--ease-out);
}
.js .stagger.is-in > * { opacity: 1; transform: none; }

/* ── Headline reveal ────────────────────────────────────────────────────────
   Each line is a block clipped by its wrapper, so the type rises out of nothing. */

.lines { display: block; }
.lines .line { display: block; overflow: hidden; padding-bottom: .06em; margin-bottom: -.06em; }
.js .lines .line > span {
    display: block;
    transform: translate3d(0, 108%, 0) rotate(2deg);
    transform-origin: left bottom;
    transition: transform 1.05s var(--ease-out);
}
.js .lines.is-in .line > span { transform: none; }
.js .lines.is-in .line:nth-child(2) > span { transition-delay: .1s; }
.js .lines.is-in .line:nth-child(3) > span { transition-delay: .2s; }

/* ── Hero ───────────────────────────────────────────────────────────────────
   Three depths: the scene drifts and scales, mist crawls across it, the copy
   lifts away faster than the picture. */

.hero-media img {
    transform-origin: 50% 60%;
    animation: heroDrift 26s ease-in-out infinite alternate;
}
@keyframes heroDrift {
    from { transform: scale(1.06) translate3d(-1.2%, 0, 0); }
    to   { transform: scale(1.14) translate3d(1.2%, -1.5%, 0); }
}

/* Mist layers over the hero — the thing Genting actually has */
.hero-mist {
    position: absolute; inset: auto 0 0 0; height: 62%;
    z-index: -2; pointer-events: none; overflow: hidden;
}
.hero-mist span {
    position: absolute; left: -25%; width: 150%; height: 42%;
    background: radial-gradient(ellipse at 50% 50%,
        rgba(207, 233, 223, .30) 0%, rgba(207, 233, 223, .10) 45%, transparent 72%);
    filter: blur(14px);
}
.hero-mist span:nth-child(1) { bottom: 4%;  animation: mistA 34s linear infinite; }
.hero-mist span:nth-child(2) { bottom: 22%; opacity: .7; animation: mistB 46s linear infinite; }
.hero-mist span:nth-child(3) { bottom: 40%; opacity: .45; animation: mistA 58s linear infinite reverse; }

@keyframes mistA {
    from { transform: translate3d(-12%, 0, 0); }
    to   { transform: translate3d(12%, 0, 0); }
}
@keyframes mistB {
    from { transform: translate3d(10%, 0, 0) scaleY(1); }
    to   { transform: translate3d(-10%, 0, 0) scaleY(1.25); }
}

/* Copy and picture separate as you scroll, where the browser can do it natively */
@supports (animation-timeline: scroll()) {
    .hero-inner {
        animation: heroLift linear both;
        animation-timeline: scroll(root);
        animation-range: 0 90vh;
    }
    @keyframes heroLift {
        to { transform: translate3d(0, 12%, 0); opacity: .25; }
    }

    .hero-media {
        animation: heroSink linear both;
        animation-timeline: scroll(root);
        animation-range: 0 90vh;
    }
    @keyframes heroSink {
        to { transform: translate3d(0, 8%, 0); }
    }
}

/* Scroll cue */
.scroll-cue {
    position: absolute; left: 50%; bottom: 22px; z-index: 2;
    width: 22px; height: 36px; margin-left: -11px;
    border: 1.5px solid rgba(255, 255, 255, .5); border-radius: 999px;
}
.scroll-cue::after {
    content: ""; position: absolute; left: 50%; top: 7px;
    width: 3px; height: 7px; margin-left: -1.5px; border-radius: 2px;
    background: #fff; animation: cue 1.9s var(--ease-out) infinite;
}
@keyframes cue {
    0%   { opacity: 0; transform: translateY(0); }
    35%  { opacity: 1; }
    100% { opacity: 0; transform: translateY(12px); }
}

/* ── Eyebrow with a live dot ────────────────────────────────────────────── */

.eyebrow .dot {
    width: 7px; height: 7px; border-radius: 50%; background: currentColor;
    box-shadow: 0 0 0 0 currentColor; animation: pulse 2.4s ease-out infinite;
}
@keyframes pulse {
    0%   { box-shadow: 0 0 0 0 rgba(94, 212, 179, .7); }
    70%  { box-shadow: 0 0 0 9px rgba(94, 212, 179, 0); }
    100% { box-shadow: 0 0 0 0 rgba(94, 212, 179, 0); }
}

/* ── Cards ──────────────────────────────────────────────────────────────── */

.card { position: relative; }

.card .card-media::after {
    /* A slow highlight that sweeps the image on hover */
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.22) 50%, transparent 65%);
    transform: translateX(-120%);
    transition: transform .9s var(--ease-out);
}
.card:hover .card-media::after { transform: translateX(120%); }

.card::after {
    /* Hairline that warms to the brand gradient on hover */
    content: ""; position: absolute; inset: 0; border-radius: var(--mt-r);
    padding: 1px; pointer-events: none; opacity: 0;
    background: linear-gradient(135deg, var(--mt-mint), var(--mt-amber));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    transition: opacity .35s var(--ease-out);
}
.card:hover::after { opacity: .9; }

.card:hover { transform: translateY(-6px); }
.card .card-media img { transition: transform .85s var(--ease-out); }
.card:hover .card-media img { transform: scale(1.07); }

.card-title a { background-image: linear-gradient(var(--mt-green), var(--mt-green));
    background-size: 0% 1.5px; background-position: 0 100%; background-repeat: no-repeat;
    transition: background-size .4s var(--ease-out), color .25s ease; }
.card:hover .card-title a { background-size: 100% 1.5px; }

.card-badges .pill { animation: badgeIn .5s var(--ease-spring) both; }
@keyframes badgeIn {
    from { opacity: 0; transform: translateY(-6px) scale(.9); }
    to   { opacity: 1; transform: none; }
}

/* ── Plan cards ─────────────────────────────────────────────────────────── */

.plancard img { transition: transform 1s var(--ease-out); }
.plancard:hover img { transform: scale(1.08); }
.plancard .pc-body { transition: transform .5s var(--ease-out); }
.plancard:hover .pc-body { transform: translateY(-6px); }
.plancard .pc-cta { transition: gap .3s var(--ease-out); gap: 6px; }
.plancard:hover .pc-cta { gap: 12px; }

/* ── Buttons ────────────────────────────────────────────────────────────── */

.btn { position: relative; overflow: hidden; }
.btn-primary::before, .btn-ink::before, .btn-gold::before {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(105deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
    transform: translateX(-130%);
    transition: transform .8s var(--ease-out);
}
.btn-primary:hover::before, .btn-ink:hover::before, .btn-gold:hover::before { transform: translateX(130%); }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.more { display: inline-flex; align-items: center; gap: 5px; transition: gap .3s var(--ease-out); }
.more:hover { gap: 11px; text-decoration: none; }

/* ── Nav ────────────────────────────────────────────────────────────────── */

.site-header { transition: box-shadow .35s ease, background-color .35s ease; }
.site-header .bar { transition: height .35s var(--ease-out); }
.site-header.is-scrolled { box-shadow: 0 1px 0 rgba(18,53,43,.07), 0 10px 30px -22px rgba(18,53,43,.5); }
.site-header.is-scrolled .bar { height: 58px; }

.nav-links a { position: relative; }
.nav-links a::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
    background: linear-gradient(90deg, var(--mt-mint), var(--mt-amber));
    border-radius: 2px; transform: scaleX(0); transform-origin: left;
    transition: transform .38s var(--ease-out);
}
.nav-links a:hover::after, .nav-links a[aria-current="page"]::after { transform: scaleX(1); }
.nav-links a:hover { text-decoration: none; }

/* ── Marquee ────────────────────────────────────────────────────────────── */

.marquee {
    overflow: hidden; white-space: nowrap;
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
    mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent);
}
.marquee-track { display: inline-flex; gap: 34px; animation: marquee 34s linear infinite; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-track span {
    font-family: var(--mt-display); font-size: clamp(1.5rem, 3.4vw, 2.6rem);
    font-weight: 600; letter-spacing: -.02em; color: rgba(255,255,255,.22);
    display: inline-flex; align-items: center; gap: 34px;
}
.marquee-track span em { font-style: normal; color: var(--mt-mint); }
@keyframes marquee {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ── Stats strip ────────────────────────────────────────────────────────── */

.stats {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 26px; margin-top: 34px;
}
.stats .stat-item { border-left: 2px solid rgba(94,212,179,.45); padding-left: 16px; }
.stats .stat-num {
    font-family: var(--mt-display); font-size: clamp(1.9rem, 3.6vw, 2.9rem);
    font-weight: 600; letter-spacing: -.03em; line-height: 1;
    background: linear-gradient(120deg, var(--mt-mint), var(--mt-amber));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stats .stat-cap {
    font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
    color: var(--ob-muted); margin-top: 8px;
}
.section.forest .stats .stat-cap { color: rgba(255,255,255,.6); }

/* ── Section flourishes ─────────────────────────────────────────────────── */

.section.forest { position: relative; overflow: hidden; }
.section.forest::before {
    content: ""; position: absolute; width: 60vw; height: 60vw; max-width: 780px; max-height: 780px;
    right: -18%; top: -35%; pointer-events: none;
    background: radial-gradient(circle, rgba(94,212,179,.20) 0%, transparent 62%);
    animation: bloom 18s ease-in-out infinite alternate;
}
@keyframes bloom {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-6%, 6%, 0) scale(1.18); }
}

.hl {
    background: linear-gradient(120deg, var(--mt-green), var(--mt-mint) 55%, var(--mt-amber));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.section.forest .hl {
    background: linear-gradient(120deg, var(--mt-mint), var(--mt-amber));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ── Filter chips ───────────────────────────────────────────────────────── */

.chip { transition: transform .3s var(--ease-spring), background-color .25s ease,
                    color .25s ease, border-color .25s ease; }
.chip:hover { transform: translateY(-2px); }
.chip[aria-current="true"] { animation: chipPop .4s var(--ease-spring); }
@keyframes chipPop {
    0%   { transform: scale(.9); }
    60%  { transform: scale(1.06); }
    100% { transform: scale(1); }
}

/* ── Search card ────────────────────────────────────────────────────────── */

.searchcard { animation: cardRise 1s var(--ease-out) .35s both; }
@keyframes cardRise {
    from { opacity: 0; transform: translate3d(0, 34px, 0) scale(.97); }
    to   { opacity: 1; transform: none; }
}
.searchcard .tab { transition: background-color .3s var(--ease-out), color .3s var(--ease-out); }
.searchcard input:focus, .searchcard select:focus {
    border-color: var(--mt-green);
    box-shadow: 0 0 0 3px rgba(30, 106, 84, .12);
}

/* ── Detail gallery ─────────────────────────────────────────────────────── */

.gallery > * { overflow: hidden; }
.gallery img { transition: transform 1.1s var(--ease-out); }
.gallery > *:hover img { transform: scale(1.06); }

/* ── Trip items ─────────────────────────────────────────────────────────── */

.trip-item { transition: transform .3s var(--ease-out), box-shadow .3s var(--ease-out); }
.trip-item:hover { transform: translateX(4px); box-shadow: var(--mt-shadow); }

/* ── Reduced motion — everything above goes quiet ───────────────────────── */

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }

    .reveal, .stagger > *, .lines .line > span {
        opacity: 1 !important; transform: none !important; filter: none !important;
        transition: none !important;
    }

    .hero-media img,
    .hero-mist span,
    .scroll-cue::after,
    .eyebrow .dot,
    .marquee-track,
    .section.forest::before,
    .searchcard,
    .card-badges .pill {
        animation: none !important;
    }

    .card:hover, .btn:hover, .chip:hover, .trip-item:hover,
    .plancard:hover img, .card:hover .card-media img, .gallery > *:hover img {
        transform: none !important;
    }

    .card .card-media::after, .btn::before { display: none; }
}
