/* ============================================================
   SNACKIT — MOBILE EXPERIENCE LAYER
   Loaded after style.css + pages.css. Touch-first polish:
   · immersive full-screen menu with staggered choreography
   · tablet nav fix (721–1024px had no menu at all)
   · press-state micro-interactions (native-app feel)
   · scroll-reveal system (compositor-only transforms)
   · scroll progress bar, dock/CTA collision fix
   All effects respect prefers-reduced-motion.
   ============================================================ */

/* ------------------------------------------------------------
   1 · NAV & DRAWER — available on ALL viewports ≤ 1024px
   (previously the burger only existed ≤ 720px, leaving
   tablets with no navigation besides the logo)
   ------------------------------------------------------------ */
@media (max-width: 1024px) {

    .nav__burger {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        justify-content: center;
        width: 46px;
        height: 46px;
        border-radius: 14px;
        border: 1px solid rgba(212, 175, 55, 0.22);
        background: rgba(20, 18, 14, 0.55);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        padding: 0 11px;
        margin: 0;
        transition: background .35s var(--ease), border-color .35s var(--ease);
    }
    .nav__burger span { width: 22px; }
    .nav__burger span:nth-child(2) { width: 15px; }
    .nav.is-open .nav__burger {
        background: rgba(212, 175, 55, 0.14);
        border-color: rgba(212, 175, 55, 0.45);
    }
    .nav.is-open .nav__burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); width: 22px; }
    .nav.is-open .nav__burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); width: 22px; }

    /* overlay — deeper, cinematic */
    .nav__overlay {
        background: rgba(6, 5, 4, 0.6);
        backdrop-filter: blur(14px) saturate(120%);
        -webkit-backdrop-filter: blur(14px) saturate(120%);
    }

    /* ---------- drawer shell ---------- */
    .nav__mobile {
        width: min(100vw, 440px);
        background:
            radial-gradient(120% 45% at 100% 0%, rgba(212, 175, 55, 0.10), transparent 60%),
            linear-gradient(165deg, #131109 0%, #0b0a08 55%, #0a0a0a 100%);
        border-left: 1px solid rgba(212, 175, 55, 0.16);
        box-shadow: -30px 0 80px rgba(0, 0, 0, 0.55);
        padding-top: calc(env(safe-area-inset-top, 0px) + 6.25rem);
        gap: 1.6rem;
        transition: transform .65s cubic-bezier(0.76, 0, 0.24, 1);
        will-change: transform;
    }

    /* faint oversized wordmark behind the links */
    .nav__mobile::after {
        content: 'SNACKIT';
        position: absolute;
        bottom: 4.5rem;
        left: 50%;
        transform: translateX(-50%) rotate(-90deg);
        transform-origin: center;
        font-family: var(--font-display);
        font-weight: 800;
        font-size: clamp(4rem, 24vw, 7rem);
        letter-spacing: 0.04em;
        color: transparent;
        -webkit-text-stroke: 1px rgba(212, 175, 55, 0.07);
        pointer-events: none;
        white-space: nowrap;
        z-index: 0;
    }
    .nav__mobile > * { position: relative; z-index: 1; }

    /* ---------- primary links: numbered, editorial ---------- */
    .nav__mobile-links { counter-reset: navlink; }
    .nav__mobile-links a {
        counter-increment: navlink;
        display: flex;
        align-items: baseline;
        gap: .9rem;
        font-size: clamp(1.9rem, 8vw, 2.35rem);
        font-weight: 700;
        letter-spacing: -0.02em;
        line-height: 1.1;
        padding: 1.05rem 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }
    .nav__mobile-links a::before {
        content: counter(navlink, decimal-leading-zero);
        font-family: var(--font-body);
        font-size: .66rem;
        font-weight: 600;
        letter-spacing: .18em;
        color: var(--gold);
        opacity: .75;
    }
    .nav__mobile-links a.is-active { color: var(--gold-bright); }

    /* ---------- grouped links ---------- */
    .navm__groups { gap: 1.6rem; padding-top: .35rem; }
    .navm__group-k {
        display: flex;
        align-items: center;
        gap: .7rem;
        color: var(--gold);
        font-size: .75rem;
        letter-spacing: .18em;
        margin-bottom: .2rem;
    }
    .navm__group-k::after {
        content: '';
        flex: 1;
        height: 1px;
        background: linear-gradient(90deg, rgba(212, 175, 55, 0.35), transparent);
    }

    /* ---------- CTA ---------- */
    .nav__mobile-cta {
        box-shadow: 0 14px 40px rgba(212, 175, 55, 0.35);
        font-size: 0.98rem;
        min-height: 54px;
        letter-spacing: .01em;
        gap: 0.65rem;
        padding-inline: 1.35rem 1.2rem;
        overflow: hidden;
    }
    .nav__mobile-cta span {
        min-width: 0;
        line-height: 1.2;
        flex: 0 1 auto;
    }
    .nav__mobile-cta svg {
        width: 20px !important;
        height: 20px !important;
        min-width: 20px;
        min-height: 20px;
        max-width: 20px;
        max-height: 20px;
        flex: none;
        display: block;
        overflow: visible;
    }

    /* drawer contact footer (injected by js/mobile.js) */
    .navm-foot {
        display: grid;
        gap: .8rem;
        padding-top: 1.1rem;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .navm-foot__row { display: flex; gap: .6rem; }
    .navm-foot__link {
        flex: 1;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: .5rem;
        min-height: 48px;
        padding: .65rem .8rem;
        border-radius: 14px;
        border: 1px solid rgba(255, 255, 255, 0.12);
        background: rgba(255, 255, 255, 0.04);
        font-size: .84rem;
        font-weight: 600;
        color: var(--text);
        transition: background .3s, border-color .3s;
    }
    .navm-foot__link svg { width: 17px; height: 17px; flex-shrink: 0; }
    .navm-foot__link--wa { color: #4be284; border-color: rgba(75, 226, 132, 0.28); }
    .navm-foot__tag {
        font-size: .68rem;
        letter-spacing: .14em;
        text-transform: uppercase;
        color: var(--muted);
        text-align: center;
    }

    /* ---------- staggered entrance choreography ---------- */
    .nav__mobile-links a,
    .navm__group,
    .nav__mobile-cta,
    .navm-foot {
        opacity: 0;
        transform: translateY(26px);
        transition: opacity .5s var(--ease), transform .65s var(--ease-expo);
    }
    .nav__mobile.is-open .nav__mobile-links a,
    .nav__mobile.is-open .navm__group,
    .nav__mobile.is-open .nav__mobile-cta,
    .nav__mobile.is-open .navm-foot {
        opacity: 1;
        transform: none;
    }
    .nav__mobile.is-open .nav__mobile-links a:nth-child(1) { transition-delay: .16s; }
    .nav__mobile.is-open .nav__mobile-links a:nth-child(2) { transition-delay: .22s; }
    .nav__mobile.is-open .navm__group:nth-child(1) { transition-delay: .3s; }
    .nav__mobile.is-open .navm__group:nth-child(2) { transition-delay: .37s; }
    .nav__mobile.is-open .navm__group:nth-child(3) { transition-delay: .44s; }
    .nav__mobile.is-open .nav__mobile-cta { transition-delay: .52s; }
    .nav__mobile.is-open .navm-foot { transition-delay: .58s; }
}

/* tablet-only: keep the pill CTA next to the burger */
@media (max-width: 1024px) and (min-width: 721px) {
    .nav__cta { display: inline-flex; margin-left: auto; margin-right: .9rem; }
}

/* ------------------------------------------------------------
   2 · SCROLL PROGRESS BAR  (element injected by js/mobile.js)
   ------------------------------------------------------------ */
.m-progress {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    z-index: 1000;
    background: linear-gradient(90deg, var(--gold-deep), var(--gold-bright));
    transform-origin: 0 50%;
    transform: scaleX(0);
    pointer-events: none;
}
@media (max-width: 1024px) {
    .m-progress { display: block; }
}

/* ------------------------------------------------------------
   3 · SCROLL-REVEAL SYSTEM  (classes applied by js/mobile.js)
   Compositor-only: opacity + transform. Elements already
   animated by GSAP are never given these classes.
   ------------------------------------------------------------ */
/* ------------------------------------------------------------
   3 · MOBILE SCROLL FIX
   No staggered reveals. Frame scroll keeps pinned scrub on touch
   (see frame-home-mobile.css); .is-static only for reduced-motion.
   ------------------------------------------------------------ */
@media (max-width: 900px), (hover: none) {
    /* Content visible on load — staggered IO reveals felt janky while scrolling */
    [data-fade], [data-quote],
    .fcard, [data-step], .pcard, .stitle__inner,
    .solutions__title-inner, .about__title-inner {
        opacity: 1 !important;
        transform: none !important;
    }
    .m-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* ---- Frame scroll (home): static stacked layout, no pin trap ---- */
    .frame-scroll.is-static {
        min-height: 0 !important;
    }
    .frame-scroll.is-static .frame-scroll__pin {
        min-height: 0 !important;
        height: auto !important;
        position: relative !important;
        transform: none !important;
    }
    .frame-scroll.is-static .frame-scroll__stage {
        display: flex;
        flex-direction: column;
        height: auto !important;
        min-height: 0;
        overflow: visible;
    }
    .frame-scroll.is-static .frame-scroll__media {
        position: relative !important;
        top: auto !important;
        left: auto !important;
        bottom: auto !important;
        flex: none;
        width: 100% !important;
        height: min(42svh, 280px) !important;
        max-height: min(42svh, 280px);
        border-radius: 0 0 16px 16px;
        border-bottom: 1px solid rgba(212, 175, 55, 0.28);
    }
    .frame-scroll.is-static .frame-scroll__overlay {
        display: none !important;
    }
    .frame-scroll.is-static .frame-scroll__finale {
        position: relative !important;
        top: auto !important;
        right: auto !important;
        bottom: auto !important;
        left: auto !important;
        flex: none;
        width: 100% !important;
        height: auto !important;
        transform: none !important;
        visibility: visible !important;
        opacity: 1 !important;
        overflow: visible;
        padding: 1rem var(--pad) 1.35rem;
        padding-bottom: calc(1.35rem + env(safe-area-inset-bottom, 0px));
        background: var(--bg);
        pointer-events: auto !important;
    }
    .frame-scroll.is-static .frame-scroll__finale-copy {
        max-width: none;
        padding: 1rem 1.05rem;
        border-radius: 16px;
        border: 1px solid rgba(212, 175, 55, 0.25);
        background: linear-gradient(165deg, rgba(18, 16, 12, 0.97) 0%, rgba(10, 10, 10, 0.94) 100%);
        box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
    }
    .frame-scroll.is-static .frame-scroll__loader,
    .frame-scroll.is-static .frame-scroll__progress,
    .frame-scroll.is-static .frame-scroll__hint {
        display: none !important;
    }

    /* ---- Machine unfold (vending): static story cards, no pin ---- */
    .machine-unfold.is-static .machine-unfold__pin {
        min-height: 0 !important;
        height: auto !important;
        display: block;
        position: relative !important;
        transform: none !important;
    }
    .machine-unfold.is-static .machine-unfold__stage {
        height: auto !important;
        min-height: 0;
        overflow: visible;
        display: flex;
        flex-direction: column;
    }
    .machine-unfold.is-static .machine-unfold__media {
        position: relative !important;
        inset: auto !important;
        width: 100%;
        height: min(48svh, 320px);
        flex: none;
    }
    .machine-unfold.is-static .machine-unfold__canvas,
    .machine-unfold.is-static .machine-unfold__vignette {
        position: absolute;
        inset: 0;
    }
    .machine-unfold.is-static .machine-unfold__story-ui,
    .machine-unfold.is-static .machine-unfold__chapters,
    .machine-unfold.is-static .machine-unfold__progress,
    .machine-unfold.is-static .machine-unfold__loader,
    .machine-unfold.is-static .machine-unfold__topbar,
    .machine-unfold.is-static .machine-unfold__hint {
        display: none !important;
    }
    .machine-unfold.is-static .machine-unfold__captions {
        position: relative !important;
        inset: auto !important;
        z-index: 2;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
        padding: 1rem var(--pad) 1.5rem;
        pointer-events: auto;
    }
    .machine-unfold.is-static .machine-unfold__caption {
        position: relative !important;
        left: auto !important;
        right: auto !important;
        top: auto !important;
        bottom: auto !important;
        max-width: none !important;
        width: 100%;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        pointer-events: auto !important;
    }
    .machine-unfold.is-static .machine-unfold__caption-inner {
        transform: none !important;
        filter: none !important;
        padding: 1rem 1.05rem;
        border-radius: 16px;
        border: 1px solid rgba(212, 175, 55, 0.22);
        background: linear-gradient(165deg, rgba(18, 16, 12, 0.96) 0%, rgba(10, 10, 10, 0.94) 100%);
    }
    .machine-unfold.is-static .machine-unfold__caption-inner::before {
        display: none;
    }
    .machine-unfold.is-static .machine-unfold__caption-title {
        font-size: clamp(1.25rem, 5.5vw, 1.65rem) !important;
    }
    .machine-unfold.is-static .machine-unfold__caption-lead {
        font-size: 0.9rem;
        margin-bottom: 0.75rem;
    }
    .machine-unfold.is-static .machine-unfold__caption-btn {
        width: 100%;
        justify-content: center;
    }
}

/* ------------------------------------------------------------
   4 · PHONE POLISH  (≤ 720px)
   ------------------------------------------------------------ */
@media (max-width: 720px) {

    /* Serif accents — gold gradient sheen on dark backgrounds only */
    .hero__title em,
    .quotes .section-head__title em,
    .showcase__title em,
    .how .stitle em,
    .solutions__title em,
    .delivers-home .delivers__headline em,
    .proof__title em,
    .presence-home__title em,
    .partnership__title em {
        background: linear-gradient(105deg, var(--gold-bright) 15%, #fff2cf 50%, var(--gold) 85%);
        -webkit-background-clip: text;
        background-clip: text;
        -webkit-text-fill-color: transparent;
        color: transparent;
    }

    /* Light sections — solid deep gold so accents stay readable */
    .section--light .about__title em,
    .section--light .stitle em,
    .section--light .section-head__title em {
        background: none;
        -webkit-background-clip: unset;
        background-clip: unset;
        -webkit-text-fill-color: currentColor;
        color: var(--gold-deep);
    }

    /* primary CTA — periodic light sweep */
    .hero__btn--primary,
    .nav__mobile-cta,
    .mobile-cta {
        position: relative;
        overflow: hidden;
        isolation: isolate;
    }
    .hero__btn--primary::after,
    .nav__mobile-cta::after,
    .mobile-cta::after {
        content: '';
        position: absolute;
        inset: 0;
        z-index: 1;
        background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.45) 50%, transparent 70%);
        transform: translateX(-110%);
        animation: m-sheen 4.5s var(--ease) infinite;
        pointer-events: none;
    }
    .hero__btn--primary > *,
    .nav__mobile-cta > *,
    .mobile-cta > * { position: relative; z-index: 2; }

    /* sticky CTA — glassy depth */
    .mobile-cta {
        backdrop-filter: blur(6px);
        box-shadow:
            0 18px 44px rgba(212, 175, 55, 0.4),
            0 2px 0 rgba(255, 255, 255, 0.28) inset,
            0 0 0 1px rgba(255, 255, 255, 0.14);
    }

    /* form fields ≥16px so iOS never auto-zooms; nicer focus */
    .contact__form input,
    .contact__form select,
    .contact__form textarea,
    .chat__input-wrap input {
        font-size: 16px;
    }

    /* horizontal scrollers — viewport is the touch scroll container */
    .gallery { overflow: visible; }
    .gallery__pin { overflow: visible; }
    .gallery__viewport {
        position: relative;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    .gallery__track {
        touch-action: pan-x pan-y;
    }

    /* footer giant wordmark — keep it dramatic but contained */
    .footer__giant { letter-spacing: -0.01em; }

    /* dock lifts out of the way while the sticky CTA is visible */
    .dock {
        transition: translate .45s var(--ease-expo);
    }
    body.m-cta-visible .dock {
        translate: 0 calc(-52px - 1.6rem);
    }

    /* footer content never hides under the sticky CTA pill */
    .footer {
        padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 5.5rem);
    }

    /* full-bleed pseudo-elements must not cause horizontal scroll */
    .scard::before { left: 0; right: 0; }

    /* Page-level sideways scroll lock — keep intentional carousels
       (gallery / pills) scrollable inside their own overflow-x:auto. */
    html, body {
        overflow-x: hidden;
        overflow-x: clip;
        overscroll-behavior-x: none;
        max-width: 100%;
    }
    .sectors,
    .proof,
    .brands,
    .frame-scroll,
    .press-orbit,
    .press-wall,
    .awards-flip,
    .products,
    .footer {
        max-width: 100%;
        overflow-x: hidden;
        overflow-x: clip;
    }
    .gallery__viewport,
    .about__pills {
        overscroll-behavior-x: contain;
    }
}

@keyframes m-sheen {
    0%       { transform: translateX(-110%); }
    38%, 100% { transform: translateX(110%); }
}

/* ------------------------------------------------------------
   5 · TOUCH ERGONOMICS — press states on every tappable thing
   Uses the standalone `scale` property so it never fights
   GSAP's inline `transform` values.
   ------------------------------------------------------------ */
@media (hover: none), (pointer: coarse) {

    .hero__btn,
    .nav__cta,
    .nav__mobile-cta,
    .mobile-cta,
    .about__cta,
    .footer__band-btn,
    .dock__btn,
    .chat__send,
    .chat__welcome-card,
    .hero__ctrl,
    .showcase__explore,
    .contact__form button,
    .pfilter button {
        transition: scale .18s var(--ease), opacity .18s;
    }
    .hero__btn:active,
    .nav__cta:active,
    .nav__mobile-cta:active,
    .mobile-cta:active,
    .about__cta:active,
    .footer__band-btn:active,
    .chat__send:active,
    .chat__welcome-card:active,
    .showcase__explore:active,
    .contact__form button:active,
    .pfilter button:active { scale: 0.96; }

    .dock__btn:active,
    .hero__ctrl:active { scale: 0.9; }

    .dcard:active,
    .pcard:active,
    .about__card:active,
    .principle:active,
    .scard:active,
    .icard:active,
    .usecase:active,
    .helpcard:active,
    .supcard:active,
    .gslide:active,
    .award:active { scale: 0.985; }

    .dcard, .pcard, .about__card, .principle, .scard,
    .icard, .usecase, .helpcard, .supcard, .gslide, .award {
        transition: scale .22s var(--ease);
    }

    /* visible focus for keyboard / switch users */
    a:focus-visible,
    button:focus-visible,
    input:focus-visible {
        outline: 2px solid var(--gold-bright);
        outline-offset: 3px;
        border-radius: 4px;
    }
}

/* ------------------------------------------------------------
   6 · REDUCED MOTION — every effect in this layer opts out
   ------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
    .nav__mobile { transition-duration: .01s; }
    .nav__mobile-links a,
    .navm__group,
    .nav__mobile-cta,
    .navm-foot {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .m-reveal {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }
    .hero__btn--primary::after,
    .nav__mobile-cta::after,
    .mobile-cta::after { animation: none; }
    .m-progress { display: none !important; }
}
