/**
 * Ariva — cross-device responsive layer
 * Phone · tablet · laptop · ultrawide · TV (65–75" / 4K)
 */

:root {
    --ariva-gutter: clamp(1rem, 2.5vw, 2.5rem);
    --ariva-content-max: 80rem;
    --ariva-tv-zoom: 0.8;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: 5.5rem;
}

body {
    overflow-x: clip;
    -webkit-tap-highlight-color: transparent;
}

/* Dynamic viewport — iOS Safari, Android Chrome, in-app browsers */
#hero {
    height: 100svh;
    height: 100dvh;
    min-height: max(640px, 100svh);
    min-height: max(640px, 100dvh);
}

.hero-shell {
    min-height: calc(100svh - 5rem);
    min-height: calc(100dvh - 5rem);
}

@supports not (height: 100dvh) {
    #hero {
        height: 100vh;
        min-height: max(640px, 100vh);
    }
    .hero-shell {
        min-height: calc(100vh - 5rem);
    }
}

/* Shared content width — all main sections */
.page-curtain .max-w-7xl.mx-auto,
#footer-inner.max-w-\[1400px\],
.footer-rera.max-w-\[1400px\],
.footer-copyright {
    width: 100%;
    padding-left: var(--ariva-gutter);
    padding-right: var(--ariva-gutter);
}

.page-curtain .max-w-7xl.mx-auto {
    max-width: var(--ariva-content-max);
}

#footer-inner.max-w-\[1400px\],
.footer-rera.max-w-\[1400px\] {
    max-width: min(100%, 87.5rem);
}

/* ── Small phones (320–479px) ── */
@media (max-width: 479px) {
    #hero {
        min-height: max(680px, 100svh);
        min-height: max(680px, 100dvh);
        padding-top: 4.75rem;
    }

    .hero-tagline {
        right: max(0.75rem, env(safe-area-inset-right, 0px));
        bottom: max(4.5rem, calc(env(safe-area-inset-bottom, 0px) + 3.5rem));
        font-size: clamp(0.75rem, 3.4vw, 0.875rem) !important;
        max-width: calc(100vw - 1.5rem);
    }

    .hero-scroll-hint {
        bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }

    .ariva-float-stack {
        bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    }
}

/* ── Phones landscape / short viewports ── */
@media (max-height: 520px) and (orientation: landscape) {
    #hero {
        min-height: auto;
        height: auto;
        padding-top: 4.5rem;
        padding-bottom: 2rem;
    }

    .hero-shell {
        min-height: auto;
        padding-bottom: 2rem !important;
    }

    .hero-tagline,
    .hero-scroll-hint {
        display: none;
    }

    .hero-logo {
        width: min(55vw, 18rem) !important;
    }

    .hero-stats {
        flex-wrap: wrap;
    }
}

/* ── Tablets portrait (768–1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .page-curtain .max-w-7xl.mx-auto {
        max-width: min(94vw, 56rem);
    }

    #hero .hero-content {
        max-width: min(92vw, 40rem);
    }

    .hero-tagline {
        font-size: clamp(1.75rem, 4.5vw, 2.75rem) !important;
        max-width: min(52vw, 28rem);
    }
}

/* ── Laptops / desktop (1024–1919px) ── */
@media (min-width: 1024px) and (max-width: 1919px) {
    .hero-tagline {
        font-size: clamp(2.25rem, 3.2vw, 3.5rem) !important;
    }
}

/* ── Large screens (1920px+) — overflow guard, no upscaling ── */
@media (min-width: 1920px) {
    .page-curtain {
        max-width: 100vw;
        overflow-x: clip;
    }

    .page-curtain .max-w-7xl.mx-auto {
        max-width: min(94vw, var(--ariva-content-max));
    }

    #footer-inner.max-w-\[1400px\],
    .footer-rera.max-w-\[1400px\] {
        max-width: min(94vw, 87.5rem);
    }

    .hero-logo {
        width: min(100%, 42rem) !important;
    }

    .hero-tagline {
        font-size: clamp(2.25rem, 2.2vw, 3.25rem) !important;
        max-width: min(42vw, 36rem);
    }

    #amenity-slider-track {
        height: clamp(600px, 38vh, 750px) !important;
    }

    #about-visual {
        height: clamp(520px, 34vh, 580px) !important;
    }

    .ariva-film__logo-stage {
        width: min(90vw, 56rem) !important;
    }

    .gallery-lightbox__figure {
        max-width: min(92vw, 1400px) !important;
    }

    .layout-plan-lightbox__figure {
        width: min(94vw, 1500px) !important;
    }
}

/*
 * Smart TV (Samsung 65–75" etc.) at 100% browser zoom
 * User-confirmed 80% browser zoom looks perfect → apply 0.8 scale at 100% zoom.
 * Targets: Tizen/Samsung UA, coarse pointer, or no hover on large screens.
 */
@media (min-width: 1920px) and (hover: none) {
    html {
        zoom: var(--ariva-tv-zoom);
    }
}

html.ariva-tv-viewport {
    zoom: var(--ariva-tv-zoom);
}

@supports not (zoom: 0.8) {
    html.ariva-tv-viewport {
        font-size: 80%;
    }
}

/* ── Touch / coarse pointer (phones, tablets, TV remotes) ── */
@media (hover: none), (pointer: coarse) {
    .nav-link,
    .nav-cta,
    .hero-cta-row a,
    .hero-cta-row button,
    .footer-link,
    .layout-tab-btn,
    .ariva-float-btn,
    .ariva-gps-btn,
    .ariva-film__skip.is-ready {
        min-height: 44px;
        min-width: 44px;
    }

    .gallery-item:hover img {
        transform: none;
    }
}

/* ── Fine pointer (mouse/trackpad) — keep hover polish ── */
@media (hover: hover) and (pointer: fine) {
    .hero-cta-row a:hover,
    .hero-cta-row button:hover {
        transform: translateY(-2px);
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    #hero,
    .hero-shell {
        height: auto;
        min-height: 640px;
    }
}
