/* Mobile app-like polish — safe areas, touch targets, compact nav */

@supports (padding: env(safe-area-inset-bottom)) {
    .p4p-header { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
    .p4p-footer { padding-bottom: calc(2rem + env(safe-area-inset-bottom)); }
    body.p4p-home .p4p-next-indicator { bottom: calc(2rem + env(safe-area-inset-bottom)); }
}

@media (max-width: 900px) {
    .p4p-header__inner { gap: 0.75rem; }
    .p4p-btn, .p4p-btn-glow, .p4p-nav a, .p4p-lang-switcher__toggle {
        min-height: 44px;
    }
    .p4p-mobile-nav .p4p-lang-switcher { margin-top: 1rem; }
    .p4p-mobile-nav .p4p-lang-switcher__menu {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        background: transparent;
        border: none;
        padding: 0;
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.5rem;
        max-height: none;
    }
    .p4p-mobile-nav .p4p-lang-switcher__toggle { display: none; }
    .p4p-mobile-nav .p4p-lang-switcher__item {
        padding: 0.55rem 0.85rem;
        border-radius: 999px;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.08);
    }
    .p4p-section__shell { width: min(100% - 1.5rem, 100%); padding: 0 0.5rem; }
    body:not(.p4p-home) .p4p-tl-minimal { display: none; }
    .p4p-careers-wheel { max-height: none; }
    .p4p-csgo-stage { width: min(78vw, 300px); height: min(78vw, 300px); }
}

@media (max-width: 768px) {
    body.p4p-home { overflow-y: auto; overflow-x: hidden; touch-action: pan-y; -webkit-overflow-scrolling: touch; height: auto; }
    body.p4p-home.p4p-touch-scroll { scroll-behavior: smooth; }
    .p4p-home-main {
        height: auto;
        min-height: 100%;
        overflow: visible;
        perspective: none;
        transform: none !important;
        scroll-snap-type: y proximity;
    }
    .p4p-section {
        scroll-snap-align: start;
        scroll-snap-stop: normal;
        scroll-margin-top: calc(var(--p4p-header) + 0.5rem);
    }
    body.p4p-home.is-loaded .p4p-text-reveal-stagger,
    body.p4p-home.is-loaded .p4p-section .p4p-text-reveal-stagger {
        opacity: 1 !important;
        transform: none !important;
        visibility: visible !important;
    }
    body.p4p-home.is-loaded .p4p-section,
    body.p4p-home.is-loaded .p4p-section.is-past,
    body.p4p-home.is-loaded .p4p-section.is-future {
        opacity: 1 !important;
        visibility: visible !important;
    }
    body.p4p-home.is-loaded .p4p-section .p4p-section__shell {
        opacity: 1 !important;
        transform: none !important;
    }
    body.p4p-home.is-loaded .p4p-tl-minimal {
        display: flex !important;
    }
    .p4p-section__shell { max-height: none; overflow: visible; height: auto; }
    .p4p-section {
        position: relative !important;
        height: auto !important;
        min-height: 100svh;
        opacity: 1 !important;
        pointer-events: auto !important;
        transform: none !important;
        filter: none !important;
        padding: calc(var(--p4p-header) + 1.5rem) 0 calc(3.5rem + 56px + env(safe-area-inset-bottom, 0px));
    }
    .p4p-section__shell {
        max-height: none;
        overflow: visible;
        height: auto;
    }
    .p4p-studio-flow { border-radius: 16px; padding: 0.5rem; }
    .p4p-studio-flow__step { min-width: calc(50% - 0.35rem); font-size: 0.65rem; padding: 0.55rem 0.65rem; }
    .p4p-carousel-scene { min-height: 300px; max-height: none; height: auto; margin-bottom: 1rem; }
    .p4p-carousel-rotor.is-touch-flat,
    .p4p-carousel-rotor.is-touch-flat .p4p-carousel-card {
        transform: none !important;
        transform-style: flat !important;
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        margin: 0 auto;
    }
    .p4p-carousel-rotor.is-touch-flat .p4p-carousel-card:not(.is-mobile-active) {
        display: none !important;
    }
    .p4p-carousel-rotor { width: min(92vw, 320px); height: auto; min-height: 280px; transform-style: flat; }
    .p4p-service-card__quote { font-size: 0.68rem; -webkit-line-clamp: unset; display: block; }
    .p4p-section-mission { font-size: 0.72rem; padding: 0 0.5rem; }
    .p4p-footer {
        background: rgba(6, 6, 12, 0.72);
        backdrop-filter: blur(16px);
    }
    body.is-exiting,
    body.is-entering { overflow: hidden; }
}

/* Touch devices — global polish (home + inner pages) */
html.p4p-touch-device .p4p-fx-cursor,
html.p4p-touch-device .p4p-custom-cursor {
    display: none !important;
}

html.p4p-touch-device .p4p-home-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

html.p4p-touch-device .p4p-home-canvas .p4p-mesh {
    filter: brightness(1.1) contrast(1.03) saturate(1.04);
    opacity: 0.9;
}

html.p4p-touch-device .p4p-home-canvas .p4p-atmospheric {
    opacity: 0.65;
}

html.p4p-touch-device .p4p-next-indicator {
    bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 0.5rem);
    z-index: 4999;
}

html.p4p-touch-device .p4p-portal-door,
html.p4p-touch-device .p4p-wheel-card {
    transform: none !important;
}

html.p4p-touch-device .p4p-universe-bg__orb {
    opacity: 0.3;
}

html.p4p-touch-device .p4p-optical-flares {
    opacity: 0.4;
}

html.p4p-touch-device .p4p-page-transition--touch .p4p-page-transition__scanlines {
    opacity: 0.35;
}

html.p4p-touch-device .p4p-header {
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

html.p4p-touch-device body:not(.p4p-home) .p4p-section,
html.p4p-touch-device body:not(.p4p-home) .p4p-services-section {
    content-visibility: auto;
    contain-intrinsic-size: auto 80vh;
}

/* Home mobile v6 — clarity over spectacle */
@media (max-width: 768px) {
    body.p4p-home .p4p-section__title,
    body.p4p-home .p4p-section__lead,
    body.p4p-home .p4p-kicker,
    body.p4p-home .p4p-service-card__title,
    body.p4p-home .p4p-service-card__desc {
        text-shadow: 0 2px 16px rgba(0, 0, 0, 0.85);
    }

    body.p4p-home .p4p-section__shell {
        width: min(100% - 1.25rem, 100%);
    }

    body.p4p-home .p4p-btn-glow,
    body.p4p-home .p4p-btn {
        min-height: 48px;
    }

    .p4p-cap-studio__lead,
    .p4p-cap-studio__chip p {
        -webkit-line-clamp: unset;
        display: block;
        overflow: visible;
    }

    .p4p-carousel-card .p4p-service-card__title {
        white-space: normal;
        text-overflow: unset;
    }

    .p4p-carousel-card .p4p-service-card__quote,
    .p4p-carousel-card .p4p-service-card__desc {
        -webkit-line-clamp: unset;
        display: block;
        overflow: visible;
    }

    body.p4p-home .p4p-home-canvas .p4p-mesh {
        opacity: 0.88;
    }

    body.p4p-home .p4p-global-shader__readability {
        opacity: 0.92;
    }
}

html.p4p-standalone-hint body::before {
    content: none;
}

