/* ============================================================
   Mobile Property Page Redesign — Plum Guide style
   - Stays listing: vertical full-width cards (replaces horizontal carousel)
   - Property detail overlay: edge-to-edge gallery, refined typography
   Loaded AFTER style.css → wins at equal specificity.
   ============================================================ */

/* ─── Mobile Hero: show more of the landscape image ─────────
   Base style uses height:100vh + background-size:cover, which on a
   portrait phone crops the sides of landscape villa photos so hard
   that only a narrow center strip is visible. Fix: shorten the
   hero a little AND re-anchor the focal point closer to the
   natural subject (usually the villa / pool area in upper-mid).
   ============================================================ */
@media (max-width: 768px) {
    .hero-visual {
        height: 82vh !important;
        min-height: 540px;
    }

    .hero-slide {
        background-size: cover !important;
        background-position: center 42% !important;
        background-repeat: no-repeat;
    }

    /* Softer vignette so the image reads more cleanly on small screens */
    .hero-visual::before {
        background: linear-gradient(
            180deg,
            rgba(0, 0, 0, 0.1) 0%,
            rgba(0, 0, 0, 0.05) 40%,
            rgba(0, 0, 0, 0.55) 100%
        ) !important;
    }
}

/* ─── Home Sticky Bottom CTA ────────────────────────────────
   Nobu-hotel style fixed bottom bar on the home page.
   Desktop: hidden. Mobile: always-visible shortcut to /stays.
   ============================================================ */
.home-sticky-cta {
    display: none;
}

@media (max-width: 768px) {
    .home-sticky-cta {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 5500;
        align-items: center;
        justify-content: center;
        width: 100%;
        margin: 0;
        padding: 1.05rem 1.5rem calc(1.05rem + env(safe-area-inset-bottom, 0px)) 1.5rem;
        background: #2C2C2C;
        color: #F4F1EB;
        font-family: var(--font-sans, 'Inter', sans-serif);
        font-size: 0.82rem;
        font-weight: 500;
        letter-spacing: 0.22em;
        text-transform: uppercase;
        text-decoration: none;
        border: none;
        border-top: 1px solid rgba(244, 241, 235, 0.08);
        box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.18);
        transition: background 0.25s ease;
    }

    .home-sticky-cta::after {
        content: '→';
        margin-left: 0.9rem;
        font-size: 1.05rem;
        letter-spacing: 0;
        transition: transform 0.25s ease;
    }

    .home-sticky-cta:hover,
    .home-sticky-cta:active {
        background: #1a1a1a;
        color: #F4F1EB;
    }

    .home-sticky-cta:hover::after,
    .home-sticky-cta:active::after {
        transform: translateX(4px);
    }

    /* Leave room so the footer / last section isn't hidden behind the bar */
    body:has(.home-sticky-cta) footer {
        padding-bottom: calc(4rem + env(safe-area-inset-bottom, 0px));
    }

    /* Hide the sticky CTA while a property detail overlay is open —
       the detail view already has its own booking bar and the CTA would overlap it. */
    body:has(.detail-overlay.active) .home-sticky-cta {
        display: none !important;
    }
}

/* ─── Stays Listing: Vertical Stacked Cards ─────────────────── */
@media (max-width: 768px) {
    /* Override the horizontal carousel layout from style.css */
    .property-list {
        display: flex !important;
        flex-direction: column !important;
        overflow-x: visible !important;
        scroll-snap-type: none !important;
        gap: 2.75rem !important;
        padding: 1.25rem 1.25rem 3rem !important;
        width: 100% !important;
    }

    .property-list::-webkit-scrollbar {
        display: none;
    }

    /* Each card: full width, borderless, transparent (image-led) */
    .property-list-item {
        display: flex !important;
        flex-direction: column !important;
        min-width: 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        background: transparent !important;
        overflow: visible !important;
        scroll-snap-align: none !important;
        flex: none !important;
        gap: 0 !important;
    }

    .property-list-item:hover {
        transform: none !important;
        box-shadow: none !important;
        border-color: transparent !important;
    }

    /* Image: full-width, 4:3 aspect, rounded corners */
    .property-list-item .list-img-wrapper {
        position: relative !important;
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
        aspect-ratio: 4 / 3 !important;
        border-radius: 14px !important;
        overflow: hidden !important;
        margin-bottom: 0 !important;
        line-height: 0;
        background: rgba(44, 44, 44, 0.04);
    }

    .property-list-item .list-img-wrapper img,
    .property-list-item .list-img {
        width: 100% !important;
        height: 100% !important;
        object-fit: cover !important;
        border-radius: 14px !important;
        display: block;
    }

    /* Hide carousel arrows on mobile (touch users swipe; we use a single hero image) */
    .property-list-item .carousel-btn {
        display: none !important;
    }

    /* Property cards (new layout): the base .carousel-btn rule sets
       opacity:0 and only reveals on .property-card:hover — there is no
       hover on mobile, so the buttons end up invisible. Force them
       visible and shrink slightly so they don't dominate the photo. */
    .property-card .carousel-btn {
        opacity: 1 !important;
        width: 34px !important;
        height: 34px !important;
        background: rgba(0, 0, 0, 0.45) !important;
    }
    .property-card .carousel-btn.prev {
        left: 10px !important;
    }
    .property-card .carousel-btn.next {
        right: 10px !important;
    }

    /* Availability badge: refine sizing */
    .property-list-item .availability-badge {
        top: 14px !important;
        right: 14px !important;
        font-size: 0.68rem !important;
        padding: 6px 10px !important;
        border-radius: 6px !important;
    }

    /* Content below image: minimal padding, generous typography */
    .property-list-item .list-content {
        background: transparent !important;
        padding: 1.1rem 0.25rem 0 !important;
        margin-top: 0 !important;
        text-align: left;
        width: 100% !important;
        z-index: 2;
        position: relative;
    }

    .property-list-item .list-region {
        font-size: 0.7rem !important;
        letter-spacing: 0.18em !important;
        color: var(--gold-accent) !important;
        margin-bottom: 0.6rem !important;
        font-weight: 600 !important;
        text-transform: uppercase;
        line-height: 1;
        display: block;
    }

    .property-list-item .list-title {
        font-family: var(--font-display) !important;
        font-size: 1.65rem !important;
        font-weight: 400 !important;
        line-height: 1.15 !important;
        margin: 0 0 0.65rem 0 !important;
        color: #2C2C2C !important;
        display: flex;
        align-items: center;
        gap: 0.5rem;
    }

    .property-list-item .list-content h3 {
        font-size: 1.65rem !important;
    }

    .property-list-item .list-desc {
        font-size: 0.92rem !important;
        line-height: 1.55 !important;
        margin-bottom: 0.95rem !important;
        color: rgba(44, 44, 44, 0.78) !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        font-weight: 300;
    }

    .property-list-item .card-stats {
        font-size: 0.82rem !important;
        gap: 1.3rem !important;
        flex-wrap: wrap;
        margin-top: 0 !important;
        opacity: 0.95 !important;
    }

    .property-list-item .card-stats > span {
        gap: 0.4rem !important;
    }

    .property-list-item .insta-btn svg {
        width: 22px;
        height: 22px;
    }

    /* Filter bar: tighter on mobile */
    .filter-bar {
        gap: 0.6rem !important;
        margin-bottom: 2rem !important;
    }

    .filter-btn {
        padding: 0.65rem 1.4rem !important;
        font-size: 0.8rem !important;
    }
}

/* Hide the global site header whenever a property detail panel is open.
   Applies to both mobile (panel is full-screen — header would collide
   with the ✕ button) and desktop (header z-index 6000 sits above the
   5000 detail-overlay, bleeding the nav tabs through the panel image).
   Outside the mobile media query so it covers desktop too. */
body:has(.detail-overlay.active) header {
    display: none !important;
}

/* ─── Property Detail Overlay (#detail-view) ────────────────── */
@media (max-width: 768px) {
    /* Full-screen overlay (covers header) for immersive view.
       Uses 100dvh (dynamic viewport height) so it tracks the iOS Safari
       URL bar collapse — otherwise opening a property from near the top
       of the page (e.g. the first card on stays.html) leaves a gap at
       the bottom when the URL bar later hides. */
    .detail-overlay {
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        height: 100vh !important;
        height: 100dvh !important;
    }

    .detail-scroll-container {
        top: 0 !important;
        padding-top: 0 !important;
        border-radius: 0 !important;
    }

    .detail-scroll-container:has(.pd-new-wrapper) {
        top: 0 !important;
    }

    /* Floating close button */
    .detail-overlay .btn-close {
        top: 1rem !important;
        left: 1rem !important;
        width: 42px !important;
        height: 42px !important;
        background: rgba(255, 255, 255, 0.95) !important;
        border-color: rgba(44, 44, 44, 0.12) !important;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18) !important;
        font-size: 1.4rem !important;
    }

    /* Edge-to-edge gallery */
    .pd-new-wrapper {
        padding-bottom: 2rem;
    }

    .pd-gallery {
        margin: 0 !important;
        padding: 0 !important;
        gap: 0 !important;
        max-width: 100% !important;
    }

    .pd-gallery__item--main {
        border-radius: 0 !important;
        aspect-ratio: 4 / 3 !important;
    }

    .pd-gallery__item--main img {
        border-radius: 0 !important;
    }

    /* Hide secondary overlay UI on the property-detail slider on mobile:
       counter and "See all" button are removed for a cleaner Nobu/Earthboat
       style. Prev/next buttons are kept visible — swipe is the primary
       interaction but the buttons are an explicit affordance for users
       who don't realize the gallery is swipeable. */
    .pd-slider__counter,
    .pd-slider .pd-gallery__all,
    .pd-gallery__all {
        display: none !important;
    }

    /* Property-detail slider: shrink the prev/next buttons slightly for
       mobile (was 42px → 36px) so they don't dominate the photo. */
    .pd-slider__btn {
        width: 36px !important;
        height: 36px !important;
    }

    /* Container: tighter horizontal padding */
    .pd-container {
        padding: 0 1.25rem !important;
    }

    /* Header: refined hierarchy */
    .pd-header {
        padding: 1.75rem 0 1.5rem !important;
    }

    .pd-region {
        font-size: 0.7rem !important;
        letter-spacing: 0.18em !important;
        margin-bottom: 0.7rem !important;
    }

    .pd-title {
        font-size: 2.1rem !important;
        line-height: 1.12 !important;
        margin: 0 0 0.85rem 0 !important;
    }

    .pd-tagline {
        font-size: 0.96rem !important;
        line-height: 1.7 !important;
        margin: 0 0 1.4rem 0 !important;
    }

    .pd-facts {
        gap: 0.9rem 1.4rem !important;
        font-size: 0.85rem !important;
    }

    .pd-facts__item {
        gap: 0.5rem !important;
    }

    /* Single-column layout */
    .pd-layout {
        grid-template-columns: 1fr !important;
        gap: 1.5rem !important;
        padding: 1.5rem 0 2.5rem !important;
    }

    .pd-section {
        padding: 1.75rem 0 !important;
    }

    .pd-section h2 {
        font-size: 1.35rem !important;
        margin-bottom: 1rem !important;
    }

    .pd-section p {
        font-size: 0.95rem !important;
        line-height: 1.85 !important;
    }

    .pd-amenities-grid {
        /* Two columns on mobile — single-column was hard to scan and felt
           empty when an amenity list grew past 5 items. Tightened gap and
           font-size keeps the longer items (e.g. "コンディショナー") on one line. */
        grid-template-columns: 1fr 1fr !important;
        gap: 0.4rem 1rem !important;
        font-size: 0.88rem !important;
    }

    .pd-amenities-grid li {
        padding: 0.4rem 0 !important;
    }

    .pd-map {
        height: 280px !important;
        border-radius: 10px !important;
    }

    /* Booking bar: sticky to the bottom of the viewport (Earthboat style).
       Collapses the card into a compact price + CTA row, hides the inline
       date inputs (the CTA opens the full calendar modal).
       IMPORTANT: base .pd-booking uses position:sticky; top:2rem. We must
       reset `top` to auto here — otherwise `fixed + top:2rem + bottom:0`
       stretches the container full-height and the card anchors to the top
       of the viewport instead of the bottom. */
    .pd-booking {
        position: fixed !important;
        top: auto !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        z-index: 5500;
    }

    .pd-booking__card {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 1rem !important;
        background: #ffffff !important;
        border-radius: 0 !important;
        border: none !important;
        border-top: 1px solid rgba(44, 44, 44, 0.08) !important;
        padding: 0.95rem 1.1rem calc(0.95rem + env(safe-area-inset-bottom, 0px)) 1.1rem !important;
        box-shadow: 0 -6px 24px rgba(44, 44, 44, 0.1) !important;
    }

    .pd-booking__price {
        flex: 1;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        display: flex;
        align-items: baseline;
        gap: 0.25rem;
    }

    .pd-booking__amount {
        font-size: 1.4rem !important;
        font-weight: 600;
    }

    .pd-booking__unit {
        font-size: 0.82rem;
        color: rgba(44, 44, 44, 0.65);
    }

    /* Hide inline date inputs + note on mobile — the CTA opens the full calendar */
    .pd-booking__inputs,
    .pd-booking__note {
        display: none !important;
    }

    .pd-booking__cta {
        width: auto !important;
        padding: 0.95rem 1.75rem !important;
        font-size: 0.78rem !important;
        letter-spacing: 0.14em !important;
        border-radius: 999px !important;
        white-space: nowrap;
        flex-shrink: 0;
        margin: 0 !important;
    }

    /* Leave space at the bottom of the page so the last section isn't
       hidden behind the sticky bar */
    .pd-layout {
        padding-bottom: 6rem !important;
    }
}
