/**
 * Amazing Sri Lanka Tours - Comprehensive Responsive Stylesheet
 * Optimized for Desktop, Laptop, Tablet, Mobile (all screen sizes down to 320px)
 */

/* ==========================================================================
   0. Global Universal Mobile Constraints & Viewport Safety
   ========================================================================== */
html, body {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
}

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

main, section, header, footer,
.container, .container-narrow, .container-wide,
.hero-section, .inner-hero {
    max-width: 100% !important;
    overflow-x: clip;
}

img, video, iframe, svg {
    max-width: 100%;
    height: auto;
}

/* ==========================================================================
   1. Large Desktop & Medium Desktop (max-width: 1200px)
   ========================================================================== */
@media (max-width: 1200px) {
    .footer-grid {
        grid-template-columns: 1.8fr 1fr 1.2fr 1.4fr;
        gap: 32px;
    }

    .tour-cards-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 24px;
    }

    .intro-grid {
        gap: 40px;
    }

    .destinations-mosaic-grid {
        gap: 36px;
    }
}

/* ==========================================================================
   2. Tablet Viewport (max-width: 992px)
   ========================================================================== */
@media (max-width: 992px) {
    :root {
        --header-height: 72px;
    }

    /* Switch to Mobile Navigation Drawer */
    .desktop-nav {
        display: none !important;
    }

    .mobile-toggle-btn {
        display: flex !important;
    }

    .header-actions .btn-book-tour {
        display: none !important; /* Accessible inside mobile drawer */
    }

    /* Section Spacing */
    .section {
        padding-top: 72px;
        padding-bottom: 72px;
    }

    .section-lg {
        padding-top: 84px;
        padding-bottom: 84px;
    }

    /* Intro Section Redesign on Tablet */
    .intro-top-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .intro-showcase-side {
        max-width: 480px;
        margin: 0 auto;
        width: 100%;
    }

    .intro-pillars-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 18px;
    }

    .destinations-mosaic-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .experience-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .experience-box {
        padding: 32px 24px;
    }

    .exp-inclusions-strip {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .about-story-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .guide-profile-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .guide-avatar-wrap {
        max-width: 280px;
        margin: 0 auto;
    }

    .guide-profile-card {
        padding: 32px 24px;
    }

    .comparison-grid {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .contact-layout-grid {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .package-detail-layout {
        grid-template-columns: 1fr;
        gap: 36px;
    }

    .booking-sidebar {
        position: static;
    }

    .detail-highlights-list,
    .inclusions-list-grid {
        grid-template-columns: 1fr;
    }

    .photo-gallery-mosaic {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 200px;
    }

    .gallery-tile.tile-wide {
        grid-column: span 1;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 36px;
    }

    .footer-col-brand {
        grid-column: span 2;
    }

    .diamond-frame {
        width: 150px;
        height: 150px;
        margin: 8px;
    }
}

/* ==========================================================================
   3. Mobile Viewport (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
    :root {
        --header-height: 68px;
    }

    /* Container Gutters */
    .container,
    .container-narrow,
    .container-wide {
        padding-left: 18px;
        padding-right: 18px;
        width: 100%;
        max-width: 100%;
    }

    /* Header Compact */
    .header-container {
        padding: 0 16px;
    }

    .brand-logo-svg {
        height: 38px;
    }

    .brand-logo-img {
        height: 44px;
        width: 44px;
    }

    .brand-title {
        font-size: 1.02rem;
    }

    .brand-subtitle {
        font-size: 0.58rem;
    }

    .site-header.navbar-scrolled .brand-logo-svg {
        height: 34px;
    }

    .site-header.navbar-scrolled .brand-logo-img {
        height: 38px;
        width: 38px;
    }

    .site-header.navbar-scrolled .brand-title {
        font-size: 0.94rem;
    }

    .header-actions {
        gap: 10px;
    }

    .btn-whatsapp-header .btn-text {
        display: none;
    }

    .btn-whatsapp-header {
        padding: 8px 10px;
        font-size: 1.15rem;
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
        border-radius: var(--radius-full);
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .mobile-toggle-btn {
        min-width: 40px;
        min-height: 40px;
        width: 40px;
        height: 40px;
        padding: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Hero Section Mobile Adaptation */
    .hero-section {
        min-height: 85vh;
        padding-top: calc(var(--header-height) + 24px);
        padding-bottom: 80px;
    }

    .hero-inner {
        padding: 0 14px;
        text-align: center;
        align-items: center;
    }

    .hero-content {
        max-width: 100%;
    }

    .hero-title {
        font-size: clamp(2.1rem, 7vw, 3rem);
        line-height: 1.18;
        margin-bottom: 18px;
        word-break: break-word;
    }

    .hero-subtitle {
        font-size: 0.98rem;
        line-height: 1.65;
        margin-bottom: 28px;
        padding: 0 4px;
    }

    .hero-badge-pill {
        font-size: 0.74rem;
        padding: 6px 14px;
        margin-bottom: 18px;
        max-width: 100%;
        text-align: center;
    }

    .hero-cta-group {
        flex-direction: column;
        width: 100%;
        max-width: 340px;
        gap: 12px;
        margin: 0 auto;
    }

    .hero-cta-group .btn {
        width: 100%;
        justify-content: center;
        padding: 13px 22px;
        font-size: 0.96rem;
    }

    .hero-slider-nav-btn {
        display: none !important;
    }

    .hero-slider-pagination {
        bottom: 20px;
    }

    /* Section Typography & Spacing */
    .section {
        padding-top: 56px;
        padding-bottom: 56px;
    }

    .section-header {
        margin-bottom: 34px;
        text-align: center;
    }

    .section-title {
        font-size: clamp(1.8rem, 6vw, 2.3rem);
        line-height: 1.25;
        word-break: break-word;
    }

    .section-subtitle {
        font-size: 0.94rem;
        line-height: 1.6;
        padding: 0 4px;
    }

    /* Trust Pillars Grid (Personalized, Cultural, Private, Flexible) */
    .trust-pillars-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }

    .pillar-box {
        padding: 20px 18px;
    }

    .intro-pillars-grid {
        grid-template-columns: 1fr !important;
        gap: 14px;
    }

    .pillar-card {
        padding: 20px 18px;
    }

    .intro-guide-trust-bar {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px 14px;
    }

    .showcase-main-frame {
        height: 220px;
    }

    .showcase-sub-frame {
        width: 145px;
        height: 115px;
        bottom: -10px;
        right: 0px;
    }

    /* Staggered Cards Gallery Mobile */
    .staggered-card-gallery {
        min-height: 260px;
        overflow: hidden;
        max-width: 100%;
        margin: 10px auto;
    }

    .gallery-card-item {
        width: 130px;
        height: 195px;
    }

    .gallery-card-item.card-1 {
        transform: translateX(-52px) rotate(-5deg) scale(0.92);
    }

    .gallery-card-item.card-2 {
        transform: translateX(0px) rotate(0deg) scale(1);
    }

    .gallery-card-item.card-3 {
        transform: translateX(52px) rotate(5deg) scale(0.92);
    }

    /* Diamond Mosaic Mobile */
    .diamond-composition {
        flex-direction: row;
        justify-content: center;
        gap: 8px;
        padding: 20px 0;
        overflow: hidden;
        max-width: 100%;
    }

    .diamond-frame {
        width: 110px;
        height: 110px;
        margin: 4px;
        border-radius: 12px;
    }

    /* Hide large watermark that spills horizontally */
    .compass-watermark-bg {
        display: none !important;
    }

    /* Tour Cards Grid */
    .tour-cards-grid {
        grid-template-columns: 1fr;
        max-width: 480px;
        margin-left: auto;
        margin-right: auto;
        gap: 24px;
    }

    .tour-card-body {
        padding: 20px 18px;
    }

    .tour-card-actions {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    /* Day Tours Grid */
    .day-tours-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .day-tour-actions {
        grid-template-columns: 1fr 1fr;
        gap: 8px;
    }

    /* Why Us & Reviews Preview Grids */
    .why-cards-grid,
    .reviews-preview-grid {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }

    .why-feature-card,
    .review-preview-card {
        padding: 22px 18px;
    }

    /* Reviews Page Grid */
    .reviews-page-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 32px;
    }

    .review-card-full {
        padding: 24px 18px;
    }

    /* Forms */
    .form-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .form-group.col-full {
        grid-column: span 1;
    }

    .form-control,
    select.form-control,
    textarea.form-control {
        font-size: 16px; /* Prevents auto-zoom on iOS Safari */
    }

    .contact-form-card {
        padding: 24px 18px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
        border-radius: var(--radius-lg) !important;
    }

    .submit-booking-btn {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        padding: 13px 16px !important;
        font-size: 0.92rem !important;
        gap: 8px !important;
        white-space: normal !important;
        word-break: break-word !important;
        line-height: 1.35 !important;
        text-align: center !important;
    }

    .submit-booking-btn i {
        font-size: 1.25rem !important;
        flex-shrink: 0 !important;
    }

    .tripadvisor-gateway-card,
    .review-form-card {
        padding: 28px 18px !important;
        max-width: 100% !important;
        overflow: hidden !important;
    }

    /* Contact Channel Cards */
    .contact-channel-card {
        padding: 18px 16px;
        gap: 14px;
    }

    .channel-val {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .channel-val a {
        word-break: break-all;
        overflow-wrap: anywhere;
    }

    /* Inner Hero */
    .inner-hero {
        padding-top: calc(var(--header-height) + 30px);
        padding-bottom: 56px;
        min-height: 280px;
    }

    .inner-hero-title {
        font-size: clamp(1.85rem, 6.2vw, 2.4rem);
        line-height: 1.22;
        word-break: break-word;
    }

    .inner-hero-subtitle {
        font-size: 0.94rem;
        line-height: 1.55;
    }

    .breadcrumbs {
        font-size: 0.8rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    /* Itinerary Timeline Mobile Adjustment */
    .itinerary-timeline {
        padding-left: 24px;
    }

    .itinerary-timeline::before {
        left: 6px;
    }

    .itinerary-marker-dot {
        left: -24px;
        width: 14px;
        height: 14px;
    }

    .itinerary-day-card {
        padding: 20px 16px;
    }

    /* Footer Mobile */
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .footer-col-brand {
        grid-column: span 1;
    }

    .footer-container {
        padding: 50px 18px 24px 18px;
    }

    .footer-bottom-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .footer-contact-list a {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    /* Floating Action Buttons */
    .floating-review-btn {
        bottom: 14px;
        right: 14px;
        padding: 9px 15px;
        font-size: 0.82rem;
        gap: 7px;
        z-index: 998;
    }

    .back-to-top-btn {
        bottom: 64px;
        right: 14px;
        width: 40px;
        height: 40px;
        font-size: 0.92rem;
        z-index: 997;
    }
}

/* ==========================================================================
   4. Small Mobile (max-width: 480px)
   ========================================================================== */
@media (max-width: 480px) {
    :root {
        --header-height: 64px;
    }

    .header-container {
        padding: 0 12px;
    }

    .brand-logo-link {
        gap: 8px;
    }

    .brand-logo-svg {
        height: 32px;
    }

    .brand-logo-img {
        height: 38px;
        width: 38px;
    }

    .brand-title {
        font-size: 0.88rem;
        letter-spacing: 0.03em;
    }

    .brand-subtitle {
        font-size: 0.52rem;
        letter-spacing: 0.16em;
    }

    .site-header.navbar-scrolled .brand-logo-svg {
        height: 30px;
    }

    .site-header.navbar-scrolled .brand-logo-img {
        height: 34px;
        width: 34px;
    }

    .site-header.navbar-scrolled .brand-title {
        font-size: 0.82rem;
    }

    .header-actions {
        gap: 8px;
    }

    .btn-whatsapp-header {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1.05rem;
    }

    .mobile-toggle-btn {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
    }

    .hamburger-bar {
        width: 19px;
    }

    /* Hero Text & Buttons */
    .hero-title {
        font-size: clamp(1.8rem, 7.8vw, 2.35rem);
        line-height: 1.2;
    }

    .hero-subtitle {
        font-size: 0.92rem;
    }

    .hero-badge-pill {
        font-size: 0.7rem;
        padding: 5px 12px;
        letter-spacing: 0.08em;
    }

    /* Full-width block buttons on small screens */
    .hero-cta-group .btn,
    .cta-banner-actions .btn,
    .tour-card-actions .btn,
    .day-tour-actions .btn,
    .form-group .btn,
    .booking-actions .btn,
    .btn-block-mobile {
        width: 100% !important;
        min-height: 44px;
        justify-content: center;
    }

    .tour-card-actions,
    .day-tour-actions {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .tour-card-header {
        flex-direction: column;
        gap: 8px;
    }

    .tour-card-price-block {
        text-align: left;
    }

    /* Staggered Cards Gallery on Small Screens */
    .staggered-card-gallery {
        min-height: 220px;
    }

    .gallery-card-item {
        width: 110px;
        height: 165px;
    }

    .gallery-card-item.card-1 {
        transform: translateX(-40px) rotate(-5deg) scale(0.92);
    }

    .gallery-card-item.card-3 {
        transform: translateX(40px) rotate(5deg) scale(0.92);
    }

    /* Diamond Mosaic on Small Screens */
    .diamond-composition {
        gap: 6px;
        padding: 14px 0;
    }

    .diamond-frame {
        width: 90px;
        height: 90px;
        margin: 3px;
        border-radius: 10px;
    }

    /* Off-Canvas Drawer on Small Mobile */
    .drawer-panel {
        width: 90%;
        max-width: 320px;
        padding: 20px 16px;
    }

    /* Guide Specs Grid */
    .guide-specs-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px;
    }

    .detail-overview-box,
    .inclusions-card,
    .booking-card {
        padding: 20px 16px;
    }

    .itinerary-timeline {
        padding-left: 18px;
    }

    .itinerary-timeline::before {
        left: 4px;
    }

    .itinerary-marker-dot {
        left: -18px;
        width: 12px;
        height: 12px;
    }

    .itinerary-day-card {
        padding: 16px 12px;
    }

    .itinerary-day-title {
        font-size: 1.12rem;
    }

    /* Packages Catalog Filters */
    .packages-filter-bar {
        padding: 16px 14px;
    }

    .filter-bar-grid {
        gap: 12px;
    }

    .filter-search-box {
        flex: 1 1 100%;
        max-width: 100%;
    }

    .filter-category-pills {
        gap: 6px;
    }

    .filter-pill {
        padding: 7px 14px;
        font-size: 0.8rem;
    }

    .filter-duration-select {
        width: 100%;
    }

    /* Photo Gallery Mosaic */
    .photo-gallery-mosaic {
        grid-template-columns: 1fr;
        grid-auto-rows: 210px;
    }

    .gallery-tile.tile-tall {
        grid-row: span 1;
    }

    .contact-form-card {
        padding: 18px 12px !important;
    }

    .submit-booking-btn {
        padding: 12px 10px !important;
        font-size: 0.86rem !important;
    }

    /* Review Modal */
    .review-modal-dialog {
        padding: 22px 14px;
        margin: 8px;
        max-height: 88vh;
        width: calc(100% - 16px);
    }

    .modal-form-grid {
        grid-template-columns: 1fr;
    }

    /* Floating Buttons */
    .floating-review-btn {
        bottom: 12px;
        right: 12px;
        padding: 8px 13px;
        font-size: 0.78rem;
        gap: 6px;
    }

    .back-to-top-btn {
        bottom: 58px;
        right: 12px;
        width: 36px;
        height: 36px;
        font-size: 0.86rem;
    }
}

/* ==========================================================================
   5. Ultra Small Mobile (max-width: 360px - e.g. 320px screen width)
   ========================================================================== */
@media (max-width: 360px) {
    :root {
        --header-height: 60px;
    }

    .container,
    .container-narrow,
    .container-wide {
        padding-left: 12px;
        padding-right: 12px;
    }

    .header-container {
        padding: 0 10px;
    }

    .brand-logo-link {
        gap: 6px;
    }

    .brand-logo-svg {
        height: 28px;
    }

    .brand-logo-img {
        height: 34px;
        width: 34px;
    }

    .brand-title {
        font-size: 0.78rem;
    }

    .brand-subtitle {
        display: none;
    }

    .site-header.navbar-scrolled .brand-logo-svg {
        height: 26px;
    }

    .site-header.navbar-scrolled .brand-logo-img {
        height: 30px;
        width: 30px;
    }

    .site-header.navbar-scrolled .brand-title {
        font-size: 0.74rem;
    }

    .hero-title {
        font-size: 1.65rem;
    }

    .hero-subtitle {
        font-size: 0.88rem;
    }

    .hero-badge-pill {
        font-size: 0.68rem;
        padding: 4px 10px;
    }

    .tour-card-body {
        padding: 14px 12px;
    }

    .why-feature-card,
    .review-preview-card,
    .contact-channel-card,
    .pillar-box {
        padding: 16px 12px;
    }

    .staggered-card-gallery {
        min-height: 190px;
    }

    .gallery-card-item {
        width: 95px;
        height: 145px;
    }

    .gallery-card-item.card-1 {
        transform: translateX(-34px) rotate(-4deg) scale(0.92);
    }

    .gallery-card-item.card-3 {
        transform: translateX(34px) rotate(4deg) scale(0.92);
    }

    .diamond-frame {
        width: 78px;
        height: 78px;
        margin: 2px;
    }

    .floating-review-btn {
        padding: 7px 11px;
        font-size: 0.74rem;
    }

    .back-to-top-btn {
        width: 34px;
        height: 34px;
        font-size: 0.8rem;
        bottom: 54px;
        right: 10px;
    }
}
