/* ============================================
   SUB-PAGES — Responsive & Video Integration
   ============================================ */

/* Sub-page hero — compact, centered, elegant */
.hero--short {
    min-height: auto !important;
    padding: 90px 2rem 2.5rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    background: linear-gradient(160deg, #12161F 0%, #12161F 50%, #12161F 100%) !important;
    position: relative;
}
.hero--short::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(ellipse at 50% 40%, rgba(197,164,103,0.05) 0%, transparent 60%);
    pointer-events: none;
}
.hero--short .hero-content,
.hero--short > div {
    position: relative;
    z-index: 1;
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 auto !important;
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}
.hero--short .label,
.hero--short span[class="label"] {
    text-align: center !important;
    display: block !important;
    margin-bottom: 0.5rem !important;
}
.hero--short h1 {
    font-size: clamp(1.8rem, 3.5vw, 2.4rem) !important;
    letter-spacing: -0.02em;
    text-align: center !important;
    color: #fff !important;
    margin: 0 auto 0.75rem !important;
    width: auto !important;
}
.hero--short p {
    font-size: 0.95rem !important;
    max-width: 520px !important;
    margin: 0 auto !important;
    text-align: center !important;
    color: rgba(255,255,255,0.92) !important;
    line-height: 1.65 !important;
}

/* Force all inline grid layouts to stack on tablet */
@media (max-width: 900px) {
    [style*="grid-template-columns: 1fr 1fr"],
    [style*="grid-template-columns:1fr 1fr"],
    [style*="grid-template-columns: 1fr 1.2fr"],
    [style*="grid-template-columns:1fr 1.2fr"],
    [style*="grid-template-columns: repeat(2"],
    [style*="grid-template-columns:repeat(2"],
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr !important;
    }
    /* 2-col grids can go 2-col on tablet */
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr 1fr !important;
    }
    /* Gap reduction */
    [style*="gap:4rem"], [style*="gap: 4rem"] {
        gap: 2rem !important;
    }
    [style*="gap:3rem"], [style*="gap: 3rem"] {
        gap: 1.5rem !important;
    }
}

@media (max-width: 768px) {
    /* Fix hero padding on sub-pages */
    .hero--short, [style*="min-height:40vh"] {
        min-height: auto !important;
        padding: 100px 1.25rem 2.5rem !important;
    }
    /* Sub-page hero text */
    .hero--short h1, [style*="min-height:40vh"] h1 {
        font-size: 1.8rem !important;
    }
    /* Reduce section padding on mobile */
    [style*="padding:6rem 0"], [style*="padding: 6rem 0"] {
        padding: 3rem 0 !important;
    }
    [style*="padding:5rem 0"], [style*="padding: 5rem 0"] {
        padding: 2.5rem 0 !important;
    }
    /* Fix container padding */
    [style*="padding:0 2rem"], [style*="padding: 0 2rem"] {
        padding: 0 1.25rem !important;
    }
    /* Image placeholders smaller on mobile */
    [style*="min-height:350px"] {
        min-height: 200px !important;
    }
    /* Fix alternating image+text layouts */
    [style*="grid-template-columns: 1.1fr 1fr"],
    [style*="grid-template-columns:1.1fr 1fr"],
    [style*="grid-template-columns: 1fr 1.1fr"],
    [style*="grid-template-columns:1fr 1.1fr"] {
        grid-template-columns: 1fr !important;
    }
    /* All 3/4 col grids go single column */
    [style*="grid-template-columns: repeat(3"],
    [style*="grid-template-columns:repeat(3"],
    [style*="grid-template-columns: repeat(4"],
    [style*="grid-template-columns:repeat(4"] {
        grid-template-columns: 1fr !important;
    }
    /* Form step labels */
    [style*="font-size:1.75rem"] {
        font-size: 1.35rem !important;
    }
    /* Stat numbers */
    [style*="font-size:3rem"], [style*="font-size: 3rem"] {
        font-size: 2rem !important;
    }
}

@media (max-width: 480px) {
    .hero--short h1, [style*="min-height:40vh"] h1 {
        font-size: 1.5rem !important;
    }
    /* Even smaller padding */
    [style*="padding:0 2rem"], [style*="padding: 0 2rem"] {
        padding: 0 1rem !important;
    }
}

/* Video sections for sub-pages */
.page-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    overflow: hidden;
    border-radius: 8px;
}
.page-video video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.page-video--square {
    aspect-ratio: 1/1;
}
.page-video--portrait {
    aspect-ratio: 3/4;
    max-width: 400px;
}
.page-video-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(26,31,46,0.1) 0%, rgba(26,31,46,0.3) 100%);
    pointer-events: none;
}


/* ============================================
   COMPREHENSIVE MOBILE OPTIMIZATIONS
   ============================================ */

/* --- Hero video on mobile --- */
@media (max-width: 768px) {
    .hero.hero--short video,
    .hero--short video {
        height: 100% !important;
        min-height: 100%;
        object-fit: cover;
    }
    .hero.hero--short,
    .hero--short {
        min-height: 50vh !important;
        max-height: none !important;
    }
}

@media (max-width: 480px) {
    .hero.hero--short,
    .hero--short {
        min-height: 45vh !important;
        padding: 90px 1rem 2rem !important;
    }
    .hero--short h1 {
        font-size: clamp(1.4rem, 6vw, 1.8rem) !important;
    }
    .hero--short p {
        font-size: 0.85rem !important;
        max-width: 100% !important;
        padding: 0 0.5rem;
    }
}

/* --- AI Chat panel mobile --- */
@media (max-width: 520px) {
    .ai-panel {
        width: calc(100vw - 32px) !important;
        right: -8px !important;
        max-height: 70vh !important;
    }
    .ai-assistant {
        bottom: 16px !important;
        right: 16px !important;
    }
    .ai-toggle {
        width: 50px !important;
        height: 50px !important;
    }
    .ai-messages {
        min-height: 200px !important;
    }
}

/* --- Touch targets: minimum 44px for buttons & links --- */
@media (max-width: 768px) {
    .btn,
    .service-link,
    .svc-pill,
    .ai-option-btn,
    .form-option,
    .dropdown-link,
    [style*="display:inline-block"][style*="padding:0.85rem"],
    [style*="display:inline-block"][style*="padding:0.9rem"] {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    .btn {
        padding: 0.85rem 1.8rem !important;
        font-size: 0.68rem !important;
    }
    /* Ensure CTA buttons in hero have proper touch targets */
    .hero--short a[style*="display:inline-block"] {
        min-height: 44px !important;
        padding: 0.75rem 1.5rem !important;
        font-size: 0.7rem !important;
    }
    /* Navigation items in mobile menu */
    .main-nav .nav-link {
        min-height: 44px !important;
        padding: 0.75rem 0 !important;
    }
    .mobile-nav-cta {
        min-height: 44px !important;
    }
}

/* --- Font sizes: readable on mobile --- */
@media (max-width: 768px) {
    body {
        font-size: 16px !important;
        -webkit-text-size-adjust: 100%;
    }
    h2 {
        font-size: 3rem !important;
        color: #0D1018 !important;
    }
    h3 {
        font-size: clamp(1.2rem, 3.5vw, 1.5rem) !important;
        color: #0D1018 !important;
    }
    p, li, .service-card p, .patient-card p, .diagnostic-card p {
        font-size: 0.9rem !important;
        line-height: 1.7 !important;
    }
    .label {
        font-size: 0.62rem !important;
    }
    .section-header p {
        font-size: 0.92rem !important;
    }
}

/* --- Services pill navigation: horizontal scroll on mobile --- */
@media (max-width: 768px) {
    .services-overview-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch;
        scroll-snap-type: x proximity;
        padding-bottom: 0.5rem !important;
        gap: 0.5rem !important;
        scrollbar-width: none;
    }
    .services-overview-pills::-webkit-scrollbar {
        display: none;
    }
    .svc-pill {
        flex-shrink: 0 !important;
        scroll-snap-align: start;
        font-size: 0.65rem !important;
        padding: 0.45rem 0.9rem !important;
    }
}

/* --- Footer grid stacking on mobile --- */
@media (max-width: 768px) {
    .footer-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: 1.5rem !important;
    }
}
@media (max-width: 480px) {
    .footer-grid {
        grid-template-columns: 1fr !important;
        gap: 1.25rem !important;
    }
    .footer-bottom {
        flex-direction: column !important;
        gap: 1rem !important;
        text-align: center !important;
    }
    .footer-legal {
        justify-content: center !important;
        flex-wrap: wrap !important;
    }
    .footer-social {
        justify-content: center !important;
    }
}

/* --- Additional inline grid patterns: 1fr 2fr, 2fr 1fr --- */
@media (max-width: 900px) {
    [style*="grid-template-columns:1fr 2fr"],
    [style*="grid-template-columns: 1fr 2fr"],
    [style*="grid-template-columns:2fr 1fr"],
    [style*="grid-template-columns: 2fr 1fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* --- Gap reduction at 768px for 2-col inline grids --- */
@media (max-width: 768px) {
    [style*="gap:5rem"], [style*="gap: 5rem"] {
        gap: 2rem !important;
    }
    [style*="gap:4rem"], [style*="gap: 4rem"] {
        gap: 1.5rem !important;
    }
    [style*="gap:3rem"], [style*="gap: 3rem"] {
        gap: 1.25rem !important;
    }
    [style*="gap:2.5rem"], [style*="gap: 2.5rem"] {
        gap: 1.25rem !important;
    }
}

/* --- Video elements: proper mobile sizing --- */
@media (max-width: 768px) {
    .page-video {
        border-radius: 4px !important;
    }
    .page-video--portrait {
        max-width: 100% !important;
        aspect-ratio: 4/5 !important;
    }
    /* Inline video placeholders */
    [style*="min-height:300px"][style*="background"],
    [style*="min-height:350px"][style*="background"],
    [style*="min-height:400px"][style*="background"] {
        min-height: 200px !important;
    }
    /* Ensure videos within grid sections scale properly */
    video {
        max-width: 100% !important;
    }
}

/* --- CTA section buttons stacking --- */
@media (max-width: 480px) {
    .cta-buttons {
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.75rem !important;
    }
    .cta-buttons .btn {
        width: 100% !important;
        max-width: 300px !important;
        justify-content: center !important;
        text-align: center !important;
    }
    .cta-section h2 {
        font-size: 1.6rem !important;
    }
    .cta-section p {
        font-size: 0.9rem !important;
    }
}

/* --- Health check package cards on mobile --- */
@media (max-width: 768px) {
    #packageGrid {
        grid-template-columns: 1fr !important;
        max-width: 500px;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* --- Form rows on mobile --- */
@media (max-width: 600px) {
    .form-steps {
        flex-wrap: wrap !important;
        gap: 0.5rem !important;
    }
    .form-step {
        font-size: 0.65rem !important;
    }
    .form-group input,
    .form-group textarea,
    .form-group select {
        font-size: 16px !important; /* Prevents iOS zoom on focus */
    }
}

/* --- Intro stats on mobile --- */
@media (max-width: 480px) {
    .intro-stats {
        flex-direction: column !important;
        gap: 1rem !important;
        align-items: center !important;
        text-align: center !important;
    }
    .intro-stat-num {
        font-size: 2rem !important;
    }
}

/* --- Ensure images don't overflow --- */
@media (max-width: 768px) {
    img, video, svg {
        max-width: 100%;
        height: auto;
    }
    /* Prevent horizontal overflow */
    .container {
        overflow-x: hidden;
    }
}

/* ============================================
   MOBILE-FIRST AUDIT FIXES (2026-03)
   ============================================ */

/* --- #concierge-intake callback form: stack on mobile --- */
@media (max-width: 768px) {
    #concierge-intake > .container > div[style*="grid-template-columns"],
    #concierge-intake [style*="grid-template-columns:1fr 1fr"],
    #concierge-intake [style*="grid-template-columns: 1fr 1fr"] {
        grid-template-columns: 1fr !important;
        gap: 2rem !important;
    }
    /* Callback form card padding */
    #concierge-intake [style*="padding:3rem"],
    #concierge-intake [style*="padding: 3rem"] {
        padding: 1.5rem !important;
    }
}

/* --- Callback form: keep time-block 2x2 grid even on mobile --- */
@media (max-width: 900px) {
    #concierge-intake [style*="display:grid"][style*="grid-template-columns:1fr 1fr"][style*="gap:0.5rem"] {
        grid-template-columns: 1fr 1fr !important; /* Keep 2x2 for time blocks */
    }
}

/* --- Callback form date input & time blocks mobile --- */
@media (max-width: 768px) {
    #concierge-intake input[type="date"] {
        min-width: 0 !important;
        min-height: 44px !important;
        font-size: 16px !important; /* Prevent iOS zoom */
    }
    #concierge-intake button[onclick*="selectTimeBlock"] {
        min-height: 44px !important;
    }
    #concierge-intake button[onclick*="setCallbackToday"],
    #concierge-intake button[type="button"] {
        min-height: 44px !important;
    }
    #concierge-intake input[type="text"],
    #concierge-intake input[type="tel"],
    #concierge-intake input[type="email"],
    #concierge-intake textarea {
        font-size: 16px !important; /* Prevent iOS zoom */
        min-height: 44px !important;
    }
    #concierge-intake select {
        font-size: 16px !important;
        min-height: 44px !important;
    }
    /* Submit button */
    #concierge-intake button[onclick*="submitToNetlify"] {
        min-height: 48px !important;
        font-size: 0.78rem !important;
    }
}

@media (max-width: 480px) {
    /* Date row: stack Today button above date input */
    #concierge-intake [style*="display:flex"][style*="gap:0.5rem"][style*="align-items:center"] {
        flex-wrap: wrap !important;
    }
    #concierge-intake input[type="date"] {
        width: 100% !important;
        flex: 1 1 100% !important;
    }
}

/* --- Inline CTA buttons: proper touch targets on mobile --- */
@media (max-width: 768px) {
    a[style*="display:inline-block"][style*="padding:0.9rem"],
    a[style*="display:inline-block"][style*="padding:0.85rem"],
    a[style*="display:inline-block"][style*="padding:1rem"] {
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        text-align: center !important;
    }
    /* Full-width CTA buttons on small mobile */
    [style*="display:flex"][style*="justify-content:center"] > a[style*="display:inline-block"] {
        flex: 1 1 100% !important;
        max-width: 320px !important;
    }
}

/* --- Services page pill nav: force horizontal scroll, override inline flex-wrap --- */
@media (max-width: 768px) {
    .services-overview-pills {
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        -webkit-overflow-scrolling: touch !important;
        scroll-snap-type: x proximity !important;
        padding-bottom: 0.75rem !important;
        gap: 0.5rem !important;
        scrollbar-width: none !important;
    }
    .services-overview-pills::-webkit-scrollbar {
        display: none !important;
    }
    .svc-pill {
        flex-shrink: 0 !important;
        scroll-snap-align: start !important;
        min-height: 44px !important;
        display: inline-flex !important;
        align-items: center !important;
    }
    /* The "Jump to:" label */
    .services-overview-pills > span {
        flex-shrink: 0 !important;
    }
}

/* --- Global video overflow prevention --- */
video {
    max-width: 100%;
}
@media (max-width: 768px) {
    .hero video,
    .hero--short video {
        max-width: none; /* hero videos should cover, not constrain */
    }
}

/* --- Ensure all inline-styled grids with various ratio patterns stack --- */
@media (max-width: 768px) {
    [style*="grid-template-columns: 1.2fr 1fr"],
    [style*="grid-template-columns:1.2fr 1fr"],
    [style*="grid-template-columns: 1fr 1.2fr"],
    [style*="grid-template-columns:1fr 1.2fr"],
    [style*="grid-template-columns: 1.5fr 1fr"],
    [style*="grid-template-columns:1.5fr 1fr"],
    [style*="grid-template-columns: 1fr 1.5fr"],
    [style*="grid-template-columns:1fr 1.5fr"] {
        grid-template-columns: 1fr !important;
    }
}

/* --- Enquiry form textarea on mobile --- */
@media (max-width: 768px) {
    #concierge-intake textarea {
        min-height: 100px !important;
        font-size: 16px !important;
    }
    #concierge-intake select {
        min-height: 44px !important;
        font-size: 16px !important;
    }
}

/* ============================================
   BRIGHT TEXT ON DARK BACKGROUNDS — Site-wide
   ============================================ */
/* Any section with dark navy/charcoal background gets bright text */
section[style*="background:#12161F"] h1,
section[style*="background:#12161F"] h2,
section[style*="background:#12161F"] h3,
section[style*="background:#12161F"] h1,
section[style*="background:#12161F"] h2,
section[style*="background:#12161F"] h3,
section[style*="background:var(--navy"] h1,
section[style*="background:var(--navy"] h2,
section[style*="background:var(--navy"] h3,
[style*="background:#12161F"] h1,
[style*="background:#12161F"] h2,
[style*="background:#12161F"] h3,
[style*="background:#12161F"] h1,
[style*="background:#12161F"] h2,
[style*="background:#12161F"] h3 {
    color: #FFFFFF !important;
}

section[style*="background:#12161F"] p,
section[style*="background:#12161F"] li,
section[style*="background:#12161F"] span:not(.label),
section[style*="background:#12161F"] p,
section[style*="background:#12161F"] li,
section[style*="background:#12161F"] span:not(.label),
section[style*="background:var(--navy"] p,
section[style*="background:var(--navy"] li,
section[style*="background:var(--navy"] span:not(.label),
[style*="background:#12161F"] p,
[style*="background:#12161F"] li,
[style*="background:#12161F"] p,
[style*="background:#12161F"] li {
    color: rgba(255,255,255,0.92) !important;
}

/* Gold labels stay gold on dark backgrounds */
section[style*="background:#12161F"] .label,
section[style*="background:#12161F"] .label,
section[style*="background:var(--navy"] .label,
[style*="background:#12161F"] .label,
[style*="background:#12161F"] .label,
[style*="background:#12161F"] span[style*="color:#B4975A"],
[style*="background:#12161F"] span[style*="color:var(--gold"],
[style*="background:#12161F"] span[style*="color:#B4975A"],
[style*="background:#12161F"] span[style*="color:var(--gold"] {
    color: #B4975A !important;
}

/* Checkmarks and feature text on dark backgrounds */
[style*="background:#12161F"] [style*="color:#42424A"],
[style*="background:#12161F"] [style*="color:#3D3D3F"],
[style*="background:#12161F"] [style*="color:#42424A"],
[style*="background:#12161F"] [style*="color:#3D3D3F"] {
    color: rgba(255,255,255,0.85) !important;
}

/* Dark div cards inside any section */
div[style*="background:#12161F"] h2,
div[style*="background:#12161F"] h3,
div[style*="background:#12161F"] h4 {
    color: #FFFFFF !important;
}
div[style*="background:#12161F"] p,
div[style*="background:#12161F"] li,
div[style*="background:#12161F"] span:not(.label) {
    color: rgba(255,255,255,0.9) !important;
}
