/*
 * mobile.css — La Casta Child Theme
 * All mobile-only overrides.
 * Breakpoint matches Flatsome: max-width: 849px
 *
 * Conventions:
 *  - New custom classes use mat- prefix
 *  - Do not override Flatsome classes outside @media blocks
 *  - Do not use display:none on main content (SEO risk)
 */

@media screen and (max-width: 849px) {

    /* =============================================
       HEADER
    ============================================= */

    /* Reduce header gradient so it doesn't obscure the hero image */
    header#header {
        background-image: linear-gradient(to bottom, rgba(39,19,13,0.85), transparent);
    }

    /* Disable sticky header on mobile — JS removes has-sticky, this is a CSS fallback */
    header#header .header-wrapper.stuck {
        position: static !important;
        top: auto !important;
    }

    #top-bar {
        display: none;
    }


    /* =============================================
       BOOKING FORM
       Fix: .d-grid 3 rigid columns → single column stack
    ============================================= */

    .d-grid {
        grid-template-columns: 1fr;
        grid-gap: 8px;
    }

    .row-check_available > .col {
        padding: 10px 12px;
    }

    .row-check_available h3 {
        font-size: 1.1rem;
    }


    /* =============================================
       CRUISE FEATURES LIST
       Fix: ul.cruise-features horizontal overflow → wrap 2 columns
    ============================================= */

    ul.cruise-features {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0;
    }

    ul.cruise-features li {
        width: 50%;
        justify-content: center;
        text-align: center;
        margin-bottom: 14px;
        flex-direction: column;
        align-items: center;
        gap: 6px;
    }

    ul.cruise-features li i {
        margin-right: 0;
        font-size: 1.4em;
    }


    /* =============================================
       GALLERY
       Fix: Flatsome [ux_gallery columns="4"] → 2 columns on mobile
    ============================================= */

    .section .ux-gallery .col {
        width: 50% !important;
    }


    /* =============================================
       CRUISE HEADER (Hero section)
    ============================================= */

    section.cruise-header {
        min-height: 50vh;
    }

    section.cruise-header .cruise-title {
        font-size: 1.6rem;
        letter-spacing: 0.1em;
    }


    /* =============================================
       CRUISE TABS
       Fix: long tab labels, hard to tap → wrap + shrink font
    ============================================= */

    .cruise-tabs-infor .nav.nav-size-large > li > a {
        padding: 10px 8px;
        font-size: 0.75rem;
        letter-spacing: 0;
    }

    .cruise-tabs-infor ul.nav.nav-center {
        flex-wrap: wrap;
    }

    .cruise-tabs-infor ul.nav.nav-center > li {
        flex: 1 0 45%;
        text-align: center;
    }


    /* =============================================
       ITINERARY HEADER
    ============================================= */

    .single-itinerary_header {
        min-height: 220px;
        background-position: center top;
    }


    /* =============================================
       LIST CRUISES (shortcode [list-cruises])
       4 columns → 1 column on mobile (Flatsome handles via
       small-12 but box-text hover needs adjustment)
    ============================================= */

    .box-text.show-on-hover {
        opacity: 1;
        transform: none;
    }


    /* =============================================
       LIST PACKAGES (shortcode [list-packages])
       3 columns → 1 column (Flatsome small-12 handles layout,
       only spacing needs fixing)
    ============================================= */

    .col.medium-4.small-12 .col-inner {
        margin-bottom: 0;
    }


    /* =============================================
       FOOTER
    ============================================= */

    footer .hotline a {
        font-size: 20px;
        letter-spacing: 2px;
    }

    footer ul.list-reservation {
        flex-wrap: wrap;
        gap: 12px;
    }

    footer ul.list-reservation li {
        width: 45%;
    }


    /* =============================================
       SMALL MOBILE (max 549px) — additional tweaks
    ============================================= */

}

    /* =============================================
       CONTACT FLOATING BOX
       Fix: tooltip hover → tap-friendly (always visible label)
    ============================================= */

    .contact-box-bottom {
        display: none;
    }

    /* Always show label on mobile, no hover required */
    .contact-box_icon > a > span {
        display: block;
        position: absolute;
        top: -10px;
        left: 45px;
        text-shadow: 1px 0 #fff, -1px 0 #fff, 0 1px #fff, 0 -1px #fff,
                     1px 1px #fff, -1px -1px #fff, 1px -1px #fff, -1px 1px #fff;
    }

}


/* =============================================
   MOBILE BOTTOM NAV + PANELS
   Hidden on desktop, visible on mobile only
============================================= */

.mat-sticky-cta,
.mat-nav-overlay,
.mat-nav-panel {
    display: none;
}

@media screen and (max-width: 849px) {

    /* ── Bottom nav bar ─────────────────────── */
    .mat-sticky-cta {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 10001;
        background: #fff;
        border-top: 1px solid #e8edf3;
        padding: 6px 8px;
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
        justify-content: space-around;
        align-items: stretch;
        box-shadow: 0 -4px 20px rgba(0,0,0,.08);
    }

    .mat-sticky-cta__btn {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        flex: 1;
        padding: 6px 4px;
        color: #94a3b8;
        text-decoration: none;
        font-size: 0.62rem;
        font-weight: 500;
        letter-spacing: 0.04em;
        text-transform: uppercase;
        border: none;
        background: none;
        border-radius: 8px;
        cursor: pointer;
        transition: color .15s, background .15s;
        -webkit-tap-highlight-color: transparent;
        min-height: 48px;
        margin-bottom: 0;
    }

    .mat-sticky-cta__btn svg {
        flex-shrink: 0;
        transition: stroke .15s;
    }

    .mat-sticky-cta__btn:hover,
    .mat-sticky-cta__btn.is-active {
        color: var(--primary-color);
        background: var(--gray-color);
    }

    .mat-sticky-cta__btn:focus {
        outline: none;
    }

    /* Push body up so nav doesn't overlap content */
    body {
        padding-bottom: calc(66px + env(safe-area-inset-bottom));
    }

    /* ── Overlay ────────────────────────────── */
    .mat-nav-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 10000;
        background: rgba(0,0,0,0);
        pointer-events: none;
        transition: background .25s;
    }

    .mat-nav-overlay.is-visible {
        background: rgba(0,0,0,.45);
        pointer-events: auto;
    }

    /* ── Panels ─────────────────────────────── */
    .mat-nav-panel {
        display: block;
        position: fixed;
        left: 0;
        right: 0;
        /* top set by JS at open time — avoids transform context that breaks iOS date picker */
        top: 100vh;
        bottom: auto;
        z-index: 10001;
        background: #fff;
        border-radius: 20px 20px 0 0;
        padding: 16px 20px 24px;
        box-shadow: 0 -8px 32px rgba(0,0,0,.12);
        transition: top .3s cubic-bezier(.32,.72,0,1);
        pointer-events: none;
    }

    .mat-nav-panel.is-open {
        pointer-events: auto;
        /* top value injected by JS */
    }

    .mat-nav-panel__handle {
        width: 36px;
        height: 4px;
        background: #e2e8f0;
        border-radius: 2px;
        margin: 0 auto 16px;
    }

    .mat-nav-panel__title {
        font-size: 0.95rem;
        font-weight: 700;
        color: var(--primary-color);
        letter-spacing: 0.06em;
        text-transform: uppercase;
        margin: 0 0 18px;
    }

    .mat-nav-panel form{
        margin-bottom: 0;
    }

    /* ── Booking form inside panel ───────────── */
    .mat-nav-field {
        margin-bottom: 14px;
    }

    .mat-nav-label {
        display: block;
        font-size: 0.72rem;
        font-weight: 600;
        color: #64748b;
        text-transform: uppercase;
        letter-spacing: 0.05em;
        margin-bottom: 6px;
    }

    .mat-nav-select,
    .mat-nav-input {
        width: 100%;
        padding: 8px 14px;
        border: 1px solid #e2e8f0;
        border-radius: 10px;
        font-size: 0.9rem;
        color: var(--primary-color);
        background: #fafafa;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
    }

    .mat-nav-select:focus,
    .mat-nav-input:focus {
        outline: none;
        border-color: var(--second-color);
        background: #fff;
    }

    .mat-nav-dates {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .mat-nav-submit {
        width: 100%;
        margin-top: 6px;
        padding: 13px;
        background: var(--primary-color);
        color: var(--second-color);
        border: none;
        border-radius: 12px;
        font-size: 0.88rem;
        font-weight: 700;
        letter-spacing: 0.05em;
        text-transform: uppercase;
        cursor: pointer;
        transition: opacity .15s;
    }

    .mat-nav-submit:active { opacity: .8; }

    /* ── Explorer panel links ────────────────── */
    .mat-nav-explorer-links {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-bottom: 20px;
    }

    .mat-nav-explorer-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        background: var(--gray-color);
        border-radius: 12px;
        text-decoration: none;
        color: var(--primary-color);
        transition: background .15s;
    }

    .mat-nav-explorer-item:hover,
    .mat-nav-explorer-item:active {
        background: #f0e8d4;
    }

    .mat-nav-explorer-item__icon {
        width: 40px;
        height: 40px;
        background: #fff;
        border-radius: 10px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
        color: var(--primary-color);
    }

    .mat-nav-explorer-item__label {
        flex: 1;
        font-size: 0.9rem;
        font-weight: 600;
    }

    .mat-nav-explorer-item__arrow {
        color: #94a3b8;
        flex-shrink: 0;
    }

    /* ── Contact panel links ─────────────────── */
    .mat-nav-contact-links {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding-bottom: 20px;
    }

    .mat-nav-contact-item {
        display: flex;
        align-items: center;
        gap: 14px;
        padding: 14px 16px;
        border-radius: 14px;
        text-decoration: none;
        transition: opacity .15s;
    }

    .mat-nav-contact-item:active { opacity: .75; }

    .mat-nav-contact-item--phone {
        background: #fff4f0;
        color: #c0392b;
    }

    .mat-nav-contact-item--zalo {
        background: #f0f7ff;
        color: #0068ff;
    }

    .mat-nav-contact-item--whatsapp {
        background: #f0fff4;
        color: #128c7e;
    }

    .mat-nav-contact-item__icon {
        width: 44px;
        height: 44px;
        border-radius: 12px;
        background: rgba(255,255,255,.7);
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }

    .mat-nav-contact-item__body {
        flex: 1;
    }

    .mat-nav-contact-item__name {
        display: block;
        font-size: 0.88rem;
        font-weight: 700;
    }

    .mat-nav-contact-item__value {
        display: block;
        font-size: 0.78rem;
        opacity: .7;
        margin-top: 2px;
    }

    .mat-nav-contact-item__arrow {
        flex-shrink: 0;
        opacity: .4;
    }

}


/* =============================================
   HOMEPAGE MOBILE SECTIONS
   S1–S5: only rendered when wp_is_mobile() is true
   template-parts/home/sections/
============================================= */

/* --- Shared helpers --- */
.mat-section-header {
    padding: 28px 20px 12px;
}
.mat-section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary-color);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

/* --- S1: Banner Slideshow --- */
.mat-s1-banner {
    position: relative;
    overflow: hidden;
}
.mat-s1-track {
    display: flex;
    overflow: hidden; /* JS controls scrollLeft directly, no native scroll */
    scrollbar-width: none;
    -ms-overflow-style: none;
}
.mat-s1-track::-webkit-scrollbar { display: none; }
.mat-s1-slide {
    flex: 0 0 100%;
    position: relative;
}
.mat-s1-slide svg,
.mat-s1-slide img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 4;
    object-fit: cover;
}
.mat-s1-caption {
    position: absolute;
    bottom: 56px; /* above dots */
    left: 0;
    right: 0;
    padding: 0 20px;
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-align: center;
    text-shadow: 0 2px 12px rgba(0,0,0,.5);
    opacity: 0;
    transform: translateY(16px);
    transition: opacity .45s ease, transform .45s ease;
    pointer-events: none;
}
.mat-s1-slide.is-active .mat-s1-caption {
    opacity: 1;
    transform: translateY(0);
}

.mat-s1-dots {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 5px;
    align-items: center;
}
.mat-s1-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,0.6);
    background: transparent;
    padding: 0;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.mat-s1-dot.is-active {
    background: var(--second-color);
    border-color: var(--second-color);
}

/* --- S2: Cruise Cards --- */
.mat-s2-cruises {
    background: var(--gray-color);
    border-radius: 25px 25px 0 0;
    margin-top: -20px;
    position: relative;
    z-index: 1;
}
.mat-s2-track {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 20px 20px 20px;
    scroll-padding-left: 20px;
    gap: 12px;
}
.mat-s2-track::-webkit-scrollbar { display: none; }
.mat-s2-card {
    flex: 0 0 180px;
    scroll-snap-align: start;
    border-radius: 10px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    display: block;
}
.mat-s2-card__img svg,
.mat-s2-card__img img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 5;
    border-radius: 8px;
    object-fit: cover;
}
.mat-s2-card__info {
    padding: 10px 10px 12px;
}
.mat-s2-card__stars {
    display: flex;
    gap: 2px;
    margin-bottom: 5px;
}
.mat-star polygon {
    fill: #ccc;
}
.mat-star.is-filled polygon {
    fill: var(--second-color);
}
.mat-s2-card__name {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    color: var(--primary-color);
    line-height: 1.3;
}

/* --- S3: Itineraries Tabs --- */
.mat-s3-itineraries {
    background: #fff;
    padding-bottom: 20px;
}
.mat-s3-tabs {
    display: flex;
    padding: 0 20px;
    gap: 8px;
    margin-bottom: 16px;
    border-bottom: 1px solid rgba(39,19,13,0.1);
}
.mat-s3-tab {
    flex: 1;
    padding: 10px 4px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    font-size: 0.75rem;
    font-weight: 600;
    color: #888;
    letter-spacing: 0.03em;
    cursor: pointer;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
    -webkit-tap-highlight-color: transparent;
    margin-bottom: -1px;
}
.mat-s3-tab.is-active {
    color: var(--primary-color);
    border-bottom-color: var(--second-color);
}
.mat-s3-panel {
    display: none;
}
.mat-s3-panel.is-active {
    display: block;
}
.mat-s3-track {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 8px 20px 16px 20px;
    scroll-padding-left: 20px;
    gap: 12px;
}
.mat-s3-track::-webkit-scrollbar { display: none; }
.mat-s3-card {
    flex: 0 0 200px;
    scroll-snap-align: start;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    text-decoration: none;
    color: inherit;
    display: block;
}
.mat-s3-card__img svg,
.mat-s3-card__img img {
    display: block;
    width: 100%;
    aspect-ratio: 10 / 7;
    object-fit: cover;
}
.mat-s3-card__info {
    padding: 8px 10px 10px;
}
.mat-s3-card__tag {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--primary-color);
    background: var(--second-color);
    border-radius: 3px;
    padding: 2px 6px;
    margin-bottom: 5px;
}
.mat-s3-card__name {
    font-size: 0.8rem;
    font-weight: 600;
    margin: 0;
    color: var(--primary-color);
    line-height: 1.35;
}

/* --- S4: Activities --- */
.mat-s4-activities {
    background: var(--gray-color);
}
.mat-s4-track {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 20px 20px 20px;
    scroll-padding-left: 20px;
    gap: 12px;
}
.mat-s4-track::-webkit-scrollbar { display: none; }
.mat-s4-card {
    flex: 0 0 180px;
    scroll-snap-align: start;
}
.mat-s4-card__img svg,
.mat-s4-card__img img {
    display: block;
    width: 100%;
    border-radius: 8px;
    aspect-ratio: 4 / 5;
    object-fit: cover;
}
.mat-s4-card__title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 8px 0 0;
    text-align: center;
}

/* --- S5: Explorer --- */
.mat-s5-explorer {
    background: #fff;
    padding-bottom: 20px;
}
.mat-s5-block {
    margin-bottom: 8px;
}
.mat-s5-block__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 8px;
}
.mat-s5-block__title {
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--primary-color);
    margin: 0;
}
.mat-s5-block__more {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--link-color);
    text-decoration: none;
    white-space: nowrap;
    border-bottom: 1px solid currentColor;
    line-height: 1;
}
.mat-s5-track {
    display: flex;
    overflow-x: scroll;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    padding: 0 20px 4px 20px;
    scroll-padding-left: 20px;
    gap: 12px;
}
.mat-s5-track::-webkit-scrollbar { display: none; }
.mat-s5-card {
    flex: 0 0 220px;
    scroll-snap-align: start;
    border-radius: 8px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 2px 6px rgba(0,0,0,0.09);
}
.mat-s5-card--guide .mat-s5-card__img svg,
.mat-s5-card--guide .mat-s5-card__img img {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
}
.mat-s5-card__body {
    padding: 8px 12px 12px;
}
.mat-s5-card__tag {
    display: inline-block;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--link-color);
    margin-bottom: 4px;
}
.mat-s5-card__title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0;
    line-height: 1.35;
}

/* Review card */
.mat-s5-card--review {
    flex: 0 0 260px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.mat-s5-review__stars {
    display: flex;
    gap: 2px;
}
.mat-s5-review__text {
    font-size: 0.8rem;
    color: #444;
    line-height: 1.5;
    margin: 0;
    flex: 1;
}
.mat-s5-review__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.mat-s5-review__author {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-color);
}
.mat-s5-review__source {
    font-size: 0.7rem;
    color: #94a3b8;
    font-style: italic;
}

/* --- S6: Reviews --- */
.mat-s6-reviews {
    background: var(--primary-color);
    padding: 36px 0 40px;
}
.mat-s6-reviews .mat-section-title {
    color: var(--second-color);
}
.mat-s6-track {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding: 4px 20px 16px;
    scroll-padding-left: 20px;
}
.mat-s6-track::-webkit-scrollbar { display: none; }
.mat-s6-card {
    flex: 0 0 80%;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(248, 225, 125, 0.2);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mat-s6-card__stars {
    display: flex;
    gap: 3px;
}
.mat-s6-card__stars .mat-star polygon {
    fill: rgba(255,255,255,0.2);
}
.mat-s6-card__stars .mat-star.is-filled polygon {
    fill: var(--second-color);
}
.mat-s6-card__text {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.88);
    line-height: 1.6;
    margin: 0;
    flex: 1;
    font-style: italic;
}
.mat-s6-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 4px;
}
.mat-s6-card__author {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--second-color);
}
.mat-s6-card__source {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.45);
    font-style: italic;
}

/* =============================================
   SMALL MOBILE (max 549px)
============================================= */

@media screen and (max-width: 549px) {

    section.cruise-header .cruise-title {
        font-size: 1.3rem;
    }

    ul.cruise-features li {
        width: 50%;
    }

    .cruise-tabs-infor ul.nav.nav-center > li {
        flex: 1 0 48%;
    }

    .mat-sticky-cta__btn {
        font-size: 0.65rem;
    }

}
