/*
 * Neptune Oceanic — motion layer stylesheet
 * Pairs with assets/js/animations.js (Lenis + GSAP ScrollTrigger + SplitText).
 *
 * Organised by concern (scroll, pre-hide, reveal primitives, menus, hover),
 * not by page: page-section styles live in style.css, whose numbered table
 * of contents is mirrored by assets/js/main.js. See THEME-GUIDE.md.
 *
 * Everything that could hide content is gated behind a class that JavaScript
 * owns, so if a script fails to load or JS is off the site renders and scrolls
 * exactly as it did before this file existed.
 *
 *   html.nm-loading  — set by an inline script in header.php, removed by
 *                      animations.js (or a 2.5s failsafe). Gates the pre-hide.
 *   html.lenis       — added by Lenis itself once smooth scrolling is running.
 *   body.nm-anim     — added once the reveal layer is live. Gates hover polish.
 *
 * Nothing in here changes a colour, size, font or layout of the design. It only
 * adds transitions to states that already exist and the hooks the reveals need.
 */


/* ============================================================
   1. Lenis
   ============================================================
   Lenis keeps the browser's own scroll position and eases the value it scrolls
   to, rather than transforming the whole page inside a fixed wrapper. That is
   why there is nothing here touching the header: position:fixed, the
   .dark-menu position:relative nav, position:sticky and in-page anchors all
   keep working exactly as the theme wrote them.

   These are the rules from the Lenis stylesheet, inlined to save a request. */

html.lenis,
html.lenis body {
    height: auto;
}

/* How lenis.stop() locks the page for the mobile menu, popups and the lightbox. */
.lenis:not(.lenis-autoToggle).lenis-stopped {
    overflow: clip;
}

/* Keep the scrollbar's gutter while locked, so the page behind, the fixed header
   and a centred popup do not shift sideways by the scrollbar's width. Fancybox
   compensates for its own scrollbar, so it is left to it. */
.lenis.lenis-stopped:not(.with-fancybox) {
    scrollbar-gutter: stable;
}

/* Lets a scrollable overlay keep its own scroll (add data-lenis-prevent). */
.lenis [data-lenis-prevent],
.lenis [data-lenis-prevent-wheel],
.lenis [data-lenis-prevent-touch],
.lenis [data-lenis-prevent-vertical],
.lenis [data-lenis-prevent-horizontal] {
    overscroll-behavior: contain;
}

/* lenis-smooth is only present *while* a smooth scroll is in flight, so this
   stops an iframe swallowing the wheel mid-scroll without making the YouTube
   or lightbox players unclickable at rest. */
.lenis.lenis-smooth iframe {
    pointer-events: none;
}

.lenis.lenis-autoToggle {
    transition-property: overflow;
    transition-duration: 1ms;
    transition-behavior: allow-discrete;
}

/* Native smooth scrolling would fight the eased value Lenis writes each frame.
   The theme sets none, but a plugin could. */
html.lenis {
    scroll-behavior: auto !important;
}

/* The theme's own overflow-x:hidden on html and body is left exactly as it is:
   Lenis scrolls the window natively and needs no change there. */


/* ============================================================
   2. Pre-hide (anti-flash)
   ============================================================
   animations.js sets start states for everything it animates, but it runs from
   the footer, so anything already inside the first viewport would be painted
   once before being hidden. These are the above-the-fold targets only; the
   deliberately short list keeps the failure surface small.

   If a selector here is missing from the JS recipe table the element simply
   becomes visible when nm-loading is dropped. Safe in both directions. */

html.nm-loading .nav-inner > .nav-links-left,
html.nm-loading .nav-inner > .nav-logo,
html.nm-loading .nav-inner > .nav-links-right,
html.nm-loading .nav-inner > .nav-hamburger,
html.nm-loading .homepage-banner-slide-title,
html.nm-loading .homepage-banner-slide-discover,
html.nm-loading .about-us-hero-title,
html.nm-loading .blogs-herobanner-title,
html.nm-loading .blogs-herobanner-breadcrumb,
html.nm-loading .ays-title,
html.nm-loading .ays-yacht-name,
html.nm-loading .ays-desc,
html.nm-loading .all-share-title,
html.nm-loading .all-share-eyebrow,
html.nm-loading .all-location-hero-title,
html.nm-loading .all-location-hero-desc,
html.nm-loading .all-location-breadcrumb-text,
html.nm-loading .exp-overview-title,
html.nm-loading .exp-overview-desc,
html.nm-loading .contact-hero-content,
html.nm-loading .aboutus-exp-title,
html.nm-loading .ays-actions,
html.nm-loading .exp-overview-speak,
html.nm-loading .blogs-btnss,
html.nm-loading .homepage-banner-sidebar-dash,
html.nm-loading .all-location-hero-img-wrap img,
html.nm-loading .all-share-hero-image-wrap img,
html.nm-loading .about-us-hero-content .yofb-sublabel,
html.nm-loading .location-inners-main-title {
    opacity: 0;
}


/* ============================================================
   3. Reveal primitives
   ============================================================ */

/* Masked line reveal. SplitText wraps each line in a mask named after the
   lines class (with -mask appended to every word of it, hence the single-word
   class) and clips it inline. The headings in this design sit at
   line-height 100%, where descenders (y, g, p) hang below the line box, so a
   plain clip would shave them while the line is animating. The extra bottom
   padding gives the clip room for descenders; the matching negative margin
   hands that space straight back, so the heading's height never changes and
   nothing below it moves. Only the bottom is padded: adjacent block margins
   collapse, so padding both edges would grow the heading during the reveal. */
.nmline-mask {
    display: block;
    overflow: clip;
    padding-bottom: 0.2em;
    margin-bottom: -0.2em;
}

.nmline {
    display: block;
    will-change: transform;
}

/* The banner copy carries a broad CSS transition. Split lines are driven
   frame by frame by GSAP, and a transition on top would re-ease every frame
   into a smear. */
.nmline,
.nmline-mask {
    transition: none !important;
    animation: none !important;
}

/* Hairline rules and dividers draw from the left. */
.nm-rule {
    transform-origin: left center;
}


/* ============================================================
   4. Optional: sticky "how it works" progression
   ============================================================
   Off by default (MOTION.pinHowItWorks in animations.js) because it changes how
   that section scrolls. These rules only engage if it is switched on. */

body.nm-pin-yofb .nm-sticky-wrap {
    position: relative;
}

body.nm-pin-yofb .yofb-section {
    position: sticky;
    top: var(--nm-header-h, 0px);
}

body.nm-pin-yofb .yofb-panel {
    transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

body.nm-pin-yofb .yofb-topbar-col {
    transition: opacity 0.4s ease, color 0.4s ease;
}

.nm-yofb-progress {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 2px;
    width: 100%;
    background: rgba(255, 255, 255, 0.18);
    overflow: hidden;
    pointer-events: none;
    z-index: 3;
}

.nm-yofb-progress-bar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 100%;
    background: #ffffff;
    transform: scaleX(0);
    transform-origin: left center;
}


/* ============================================================
   5. Marquee
   ============================================================
   animations.js drives .hpm-track with GSAP so it can be slowed on hover and
   parked while off screen. The CSS keyframe animation is handed off only once
   JS has taken over, otherwise the marquee would stop dead if a script failed.

   Below 768px the theme collapses the marquee to a single static chunk; the
   script leaves that layout alone and never adds this class there. */

body.nm-marquee-js .hpm-track {
    animation: none;
    /* GSAP writes the transform every frame; a transition on top would re-ease
       each write into a smear. */
    transition: none !important;
}


/* ============================================================
   6. Desktop mega menu
   ============================================================
   style.css opens the panel by flipping `display: none` to `display: block` on
   hover. Nothing can transition a display change, which is why it appeared and
   vanished instantly.

   These rules keep it laid out at all times and hide it with opacity,
   visibility and a small offset instead, so the same hover can be animated. The
   selectors carry one extra class (body.nm-anim) purely to outrank the nested
   rules in style.css, and they are gated on that class so the menu still works
   as originally written if the motion layer never loads.

   Everything here is compositor-only: opacity and transform. The inner links
   are staggered from animations.js, which needs to replay on each open. */

body.nm-anim .nav-links-left ul .hasSubmenu .submenuList,
body.nm-anim .nav-links-right ul .hasSubmenu .submenuList {
    display: block;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(-10px);
    /* visibility flips only after the fade has finished, so the panel does not
       disappear mid-animation on the way out. */
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0.38s;
}

body.nm-anim .nav-links-left ul .hasSubmenu:hover .submenuList,
body.nm-anim .nav-links-right ul .hasSubmenu:hover .submenuList {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
    transition: opacity 0.38s cubic-bezier(0.22, 1, 0.36, 1),
                transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                visibility 0s linear 0s;
}

/* The header goes white and dims the other links while a panel is open, and
   picks up a blurred backdrop once scrolled. Both were instant. */
body.nm-anim .nav-wrap {
    transition: background-color 0.38s ease;
}

body.nm-anim .nav-links-left ul li a,
body.nm-anim .nav-links-right ul li:not(:last-child) a:not(.nav-contact-btn) {
    transition: opacity 0.35s ease, color 0.35s ease;
}

/* The panel swaps this image as you move between its links. Fading it stops the
   swap reading as a flicker; animations.js drives the opacity around the load. */
body.nm-anim .dynamicImg img {
    transition: opacity 0.3s ease;
}


/* ============================================================
   7. Hover polish
   ============================================================
   The only hover behaviour added: cards that had no hover response get a soft
   lift, and the yacht card's picture creeps forward. Buttons, links and every
   card whose hover the theme already designs are left exactly as designed.
   Delete this section to remove the lift. */

.yc-card,
.coll-card,
.all-share-card,
.resources-hub-card {
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                box-shadow 0.45s cubic-bezier(0.22, 1, 0.36, 1),
                opacity 0.4s ease;
}

body.nm-anim .yc-card:hover,
body.nm-anim .coll-card:hover,
body.nm-anim .all-share-card:hover,
body.nm-anim .resources-hub-card:hover {
    transform: translateY(-3px);
}

body.nm-anim .yc-card-img {
    transition: transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}

body.nm-anim .yc-card:hover .yc-card-img {
    transform: scale(1.035);
}



   ============================================================
   header.php never sets nm-loading for these users and animations.js skips the
   smoother and every reveal; the rules below strip the CSS-side motion to
   match, so the pre-hide can never apply either. */

@media (prefers-reduced-motion: reduce) {

    html.nm-loading .nav-inner > .nav-links-left,
    html.nm-loading .nav-inner > .nav-logo,
    html.nm-loading .nav-inner > .nav-links-right,
    html.nm-loading .nav-inner > .nav-hamburger,
    html.nm-loading .homepage-banner-slide-title,
    html.nm-loading .homepage-banner-slide-discover,
    html.nm-loading .about-us-hero-title,
    html.nm-loading .blogs-herobanner-title,
    html.nm-loading .blogs-herobanner-breadcrumb,
    html.nm-loading .ays-title,
    html.nm-loading .ays-yacht-name,
    html.nm-loading .ays-desc,
    html.nm-loading .all-share-title,
    html.nm-loading .all-share-eyebrow,
    html.nm-loading .all-location-hero-title,
    html.nm-loading .all-location-hero-desc,
    html.nm-loading .all-location-breadcrumb-text,
    html.nm-loading .exp-overview-title,
    html.nm-loading .exp-overview-desc,
    html.nm-loading .contact-hero-content,
    html.nm-loading .aboutus-exp-title,
    html.nm-loading .ays-actions,
    html.nm-loading .exp-overview-speak,
    html.nm-loading .blogs-btnss,
    html.nm-loading .homepage-banner-sidebar-dash,
    html.nm-loading .all-location-hero-img-wrap img,
    html.nm-loading .all-share-hero-image-wrap img,
    html.nm-loading .about-us-hero-content .yofb-sublabel,
    html.nm-loading .location-inners-main-title {
        opacity: 1;
    }

    .yc-card,
    .coll-card,
    .all-share-card,
    .resources-hub-card,
    body.nm-anim .yc-card-img {
        transition: none;
    }

    body.nm-anim .yc-card:hover,
    body.nm-anim .coll-card:hover,
    body.nm-anim .all-share-card:hover,
    body.nm-anim .resources-hub-card:hover,
    body.nm-anim .yc-card:hover .yc-card-img {
        transform: none;
    }
}
