/* ================================================================
   FINAL RESPONSIVE QA OVERRIDES
   Load AFTER all page-specific CSS files.
   ================================================================ */

/* ---------------------------------------------------------------
   1. SAFE GLOBAL RULES
   --------------------------------------------------------------- */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

img,
picture,
video,
canvas,
svg {
    max-width: 100%;
}

img,
video {
    height: auto;
}

iframe {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
    font: inherit;
}

pre,
code {
    max-width: 100%;
    overflow-x: auto;
}

table {
    max-width: 100%;
}

a,
button,
input,
select,
textarea {
    -webkit-tap-highlight-color: transparent;
}

/* Prevent long API/content strings from breaking layout. */
p,
li,
a,
span,
strong,
small,
h1,
h2,
h3,
h4,
h5,
h6 {
    overflow-wrap: anywhere;
}

/* Shared containers */
.container,
.site-container,
.inquiry-container {
    width: min(
        calc(100% - 48px),
        1320px
    );
    margin-inline: auto;
}


/* ---------------------------------------------------------------
   2. RESPONSIVE MEDIA / EMBEDS
   --------------------------------------------------------------- */

.responsive-media,
.video-wrapper,
.map-wrapper,
.map-embed {
    position: relative;
    max-width: 100%;
    overflow: hidden;
}

.video-wrapper,
.responsive-media.is-video {
    aspect-ratio: 16 / 9;
}

.video-wrapper iframe,
.responsive-media iframe,
.map-wrapper iframe,
.map-embed iframe {
    width: 100%;
    height: 100%;
    border: 0;
}


/* ---------------------------------------------------------------
   3. BUTTONS
   --------------------------------------------------------------- */

button,
.btn,
.button,
.site-plan-button,
.inquiry-submit {
    min-height: 42px;
}

@media (hover: none) and (pointer: coarse) {
    button,
    .btn,
    .button,
    a.btn {
        min-height: 44px;
    }
}


/* ---------------------------------------------------------------
   4. FORMS
   --------------------------------------------------------------- */

input,
select,
textarea {
    font-size: 16px;
}

/* Prevent iPhone Safari zooming form controls */
@supports (-webkit-touch-callout: none) {
    input,
    select,
    textarea {
        font-size: 16px;
    }
}

textarea {
    resize: vertical;
}


/* ---------------------------------------------------------------
   5. VERY LARGE DESKTOP
   --------------------------------------------------------------- */

@media (min-width: 1600px) {

    .container,
    .site-container,
    .inquiry-container {
        width: min(
            calc(100% - 80px),
            1420px
        );
    }

}


/* ---------------------------------------------------------------
   6. LAPTOP / SMALL DESKTOP
   --------------------------------------------------------------- */

@media (max-width: 1180px) {

    .container,
    .site-container,
    .inquiry-container {
        width: min(
            calc(100% - 40px),
            1180px
        );
    }

    /* Avoid oversized sticky sidebars causing clipping */
    aside,
    .sidebar,
    .sticky-sidebar,
    .package-sidebar,
    .destination-sidebar {
        max-width: 100%;
    }

}


/* ---------------------------------------------------------------
   7. TABLET
   --------------------------------------------------------------- */

@media (max-width: 980px) {

    .container,
    .site-container,
    .inquiry-container {
        width: min(
            calc(100% - 32px),
            960px
        );
    }

    /* Generic two/three-column patterns */
    .two-column,
    .three-column,
    .content-sidebar,
    .detail-layout,
    .page-grid {
        grid-template-columns: 1fr !important;
    }

    /* Sticky sidebars should become normal flow */
    .sticky,
    .sticky-sidebar,
    .package-sidebar,
    .destination-sidebar,
    .inquiry-side {
        position: static !important;
        top: auto !important;
    }

    /* Common card grids */
    .card-grid,
    .package-grid,
    .destination-grid,
    .blog-grid,
    .gallery-grid,
    .search-results-grid {
        grid-template-columns:
            repeat(2, minmax(0, 1fr)) !important;
    }

}


/* ---------------------------------------------------------------
   8. MOBILE
   --------------------------------------------------------------- */

@media (max-width: 720px) {

    .container,
    .site-container,
    .inquiry-container {
        width: min(
            calc(100% - 28px),
            100%
        );
    }

    /* Typography */
    h1 {
        font-size:
            clamp(34px, 11vw, 52px);
        line-height: 1.05;
    }

    h2 {
        font-size:
            clamp(28px, 8vw, 40px);
        line-height: 1.1;
    }

    h3 {
        line-height: 1.2;
    }

    /* All common grids become one column */
    .card-grid,
    .package-grid,
    .destination-grid,
    .blog-grid,
    .gallery-grid,
    .search-results-grid,
    .form-row,
    .two-column,
    .three-column,
    .content-sidebar,
    .detail-layout,
    .page-grid {
        grid-template-columns:
            1fr !important;
    }

    /* Remove accidental fixed card widths */
    .card,
    .package-card,
    .destination-card,
    .blog-card,
    .gallery-card,
    .search-card {
        width: 100% !important;
        max-width: none !important;
    }

    /* Actions stack cleanly */
    .actions,
    .button-group,
    .hero-actions,
    .cta-actions,
    .form-actions {
        flex-wrap: wrap;
    }

    .actions > *,
    .button-group > *,
    .hero-actions > *,
    .form-actions > * {
        max-width: 100%;
    }

    /* Detail content */
    .content,
    .detail-content,
    .package-content,
    .destination-content,
    .blog-content {
        min-width: 0;
    }

    /* Tables */
    .table-wrapper {
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    /* Avoid fixed-width images/content */
    [style*="width: 30vw"],
    [style*="width:30vw"] {
        width: 100% !important;
    }

    /* Modal / lightbox */
    .modal,
    .lightbox,
    .gallery-lightbox {
        max-width: 100vw;
    }

}


/* ---------------------------------------------------------------
   9. SMALL MOBILE
   --------------------------------------------------------------- */

@media (max-width: 480px) {

    .container,
    .site-container,
    .inquiry-container {
        width: calc(100% - 24px);
    }

    /* Full-width primary CTAs */
    .mobile-full,
    .inquiry-submit {
        width: 100%;
    }

    /* Reduce common large paddings */
    .section-card,
    .form-card,
    .inquiry-form-card {
        padding-left: 18px !important;
        padding-right: 18px !important;
    }

    /* Search */
    .site-search-content {
        width: 100%;
    }

    .site-search-content form {
        width: 100%;
    }

}


/* ---------------------------------------------------------------
   10. ULTRA SMALL DEVICES
   --------------------------------------------------------------- */

@media (max-width: 360px) {

    .container,
    .site-container,
    .inquiry-container {
        width: calc(100% - 18px);
    }

    h1 {
        font-size: 34px;
    }

    h2 {
        font-size: 27px;
    }

}


/* ---------------------------------------------------------------
   11. REDUCED MOTION
   --------------------------------------------------------------- */

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

    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration:
            0.01ms !important;
        animation-iteration-count:
            1 !important;
        transition-duration:
            0.01ms !important;
    }

}


/* ---------------------------------------------------------------
   12. LANDSCAPE MOBILE
   --------------------------------------------------------------- */

@media (
    max-height: 520px
)
and (
    orientation: landscape
) {

    .site-mobile-menu {
        overflow-y: auto;
    }

    .site-search-overlay {
        overflow-y: auto;
        align-items: flex-start;
        padding-top: 60px;
    }

}
