/* ============================================================
   lib/styles/responsive.css — Healthcare Migration Responsive Styles
   Consolidated Breakpoints: Mobile (<640px), Tablet (640-1023px), Desktop (1024px+)
   ============================================================ */

/* ==========================================================================
   TOUCH & MOBILE FALLBACKS (Applies to all touch devices & tablets)
   ========================================================================== */
@media screen and (max-width: 1023px), (hover: none) and (pointer: coarse) {
    /* Disable CSS 3D parallax to save battery and prevent iOS scroll jank */
    .parallax-wrapper {
        perspective: none !important;
        overflow-y: visible !important;
    }
    
    .parallax-bg {
        transform: none !important;
        background-attachment: scroll !important;
    }
}

/* ==========================================================================
   MOBILE (max-width: 639px)
   ========================================================================== */
@media screen and (max-width: 639px) {

    :root {
        --container-padding: 20px;
        --fs-h1: 28px;
        --fs-h2: 22px;
        --fs-h3: 18px;
        --fs-h4: 16px;
        --space-3xl: 48px; /* Tighter section spacing */
    }

    /* Typography */
    h1 { font-size: var(--fs-h1); letter-spacing: -0.01em; }
    h2 { font-size: var(--fs-h2); margin-top: var(--space-xl); }
    
    /* Navbar */
    .navbar__hamburger { 
        display: flex; 
        min-height: 44px; /* Touch target size */
        min-width: 44px;
        align-items: center;
        justify-content: center;
    }
    .navbar__links, .navbar__actions { display: none; }
    
    /* Touch Target Accessibility */
    .btn, button, a {
        min-height: 44px; /* Minimum touch target for iOS/Android */
        position: relative;
        z-index: 10; /* Prevent overlap from animated siblings */
    }

    /* Reduce AOS travel distance on mobile to prevent jarring motion & late triggers */
    [data-aos="fade-up"]:not(.aos-animate) { transform: translate3d(0, 20px, 0) !important; }
    [data-aos="fade-down"]:not(.aos-animate) { transform: translate3d(0, -20px, 0) !important; }
    [data-aos="fade-left"]:not(.aos-animate) { transform: translate3d(20px, 0, 0) !important; }
    [data-aos="fade-right"]:not(.aos-animate) { transform: translate3d(-20px, 0, 0) !important; }

    /* Hero Section */
    .hero-section {
        padding-top: calc(72px + var(--space-lg));
        padding-bottom: var(--space-xl);
        text-align: center;
    }
    .hero-section__inner { flex-direction: column; gap: var(--space-xl); }
    .hero-section__actions { flex-direction: column; align-items: stretch; }
    .hero-section__actions .btn { width: 100%; justify-content: center; }

    /* Trust & Partner Banners */
    .trust-banner__logos { gap: var(--space-md); flex-wrap: wrap; justify-content: center; }
    .trust-banner__logo-item img { height: 24px; }

    /* Grids (Persona, Features, Articles) - Single Column */
    .card-grid, .features-grid, .persona-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    /* Process Timeline (Vertical on Mobile) */
    .process-section__steps {
        display: flex;
        flex-direction: column;
        gap: var(--space-lg);
    }
    .process-step {
        display: flex;
        flex-direction: row;
        align-items: flex-start;
        gap: var(--space-md);
        text-align: left;
    }
    .process-step__number {
        width: 40px;
        height: 40px;
        font-size: 16px;
        flex-shrink: 0;
    }
    .process-step:not(:last-child)::after {
        content: '';
        position: absolute;
        left: 20px; /* Center of the number circle */
        top: 40px;
        bottom: calc(var(--space-lg) * -1);
        width: 2px;
        background-color: var(--color-soft-grey);
        opacity: 0.3;
    }

    /* Footer */
    .site-footer__top, .site-footer__nav-columns {
        grid-template-columns: 1fr;
        gap: var(--space-xl);
    }
    .site-footer__bottom {
        flex-direction: column;
        text-align: center;
        gap: var(--space-md);
    }

    /* Visibility Utilities */
    .hide-mobile { display: none !important; }
    .show-mobile { display: block !important; }
    .show-mobile-flex { display: flex !important; }
}

/* ==========================================================================
   TABLET (min-width: 640px and max-width: 1023px)
   ========================================================================== */
@media screen and (min-width: 640px) and (max-width: 1023px) {

    :root {
        --container-padding: 32px;
        --fs-h1: 32px;
        --fs-h2: 24px;
        --space-3xl: 56px;
    }

    /* Navbar */
    .navbar__hamburger { display: flex; }
    .navbar__links, .navbar__actions { display: none; }

    /* Hero Section */
    .hero-section {
        padding-top: calc(72px + var(--space-2xl));
        padding-bottom: var(--space-2xl);
    }
    .hero-section__inner {
        flex-direction: row;
        align-items: center;
        text-align: left;
    }
    .hero-section__actions { flex-direction: row; }

    /* Grids - Two Columns */
    .card-grid, .features-grid, .persona-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg);
    }

    /* Center the last odd item in a 2-col grid if needed */
    .persona-grid > *:last-child:nth-child(odd) {
        grid-column: 1 / -1;
        max-width: 50%;
        margin: 0 auto;
    }

    /* Forms */
    .form-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
    .form-grid__full { grid-column: 1 / -1; }

    /* Footer */
    .site-footer__top, .site-footer__nav-columns {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-xl);
    }
    .site-footer__bottom {
        flex-direction: row;
        justify-content: space-between;
    }

    /* Visibility Utilities */
    .show-mobile, .show-mobile-flex { display: none !important; }
    .hide-tablet { display: none !important; }
    .show-tablet { display: block !important; }
}

/* ==========================================================================
   DESKTOP (min-width: 1024px)
   ========================================================================== */
@media screen and (min-width: 1024px) {

    :root {
        --container-padding: 48px;
        --fs-h1: 40px;  /* Calm, controlled sizing per healthcare specs */
        --fs-h2: 32px;
        --space-3xl: 80px; /* Generous whitespace */
    }

    /* Navbar */
    .navbar__hamburger { display: none !important; }
    .navbar__links, .navbar__actions { display: flex !important; }

    /* Hero Section */
    .hero-section {
        min-height: 500px;
        padding-top: calc(80px + var(--space-3xl));
        padding-bottom: var(--space-3xl);
    }
    .hero-section__inner {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }
    
    /* Trust Banner */
    .trust-banner__logos {
        gap: var(--space-2xl);
        flex-wrap: nowrap;
        justify-content: space-between;
    }

    /* Grids - Three/Four Columns */
    .card-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-xl); }
    .persona-grid { grid-template-columns: repeat(4, 1fr); gap: var(--space-lg); }

    /* Process Timeline (Horizontal on Desktop) */
    .process-section__steps {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: var(--space-md);
        position: relative;
        text-align: center;
    }
    /* Horizontal connector line */
    .process-section__steps::before {
        content: '';
        position: absolute;
        top: 24px; /* Center of 48px number circle */
        left: calc(12.5%); /* Center of first col */
        right: calc(12.5%); /* Center of last col */
        height: 2px;
        background-color: var(--color-calm-teal);
        opacity: 0.3;
        z-index: 0;
    }
    .process-step {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: var(--space-md);
    }
    .process-step__number {
        width: 48px;
        height: 48px;
        font-size: 18px;
        position: relative;
        z-index: 1;
        background-color: var(--color-white);
        border: 2px solid var(--color-calm-teal);
        color: var(--color-calm-teal);
    }
    .process-step:not(:last-child)::after { display: none; }

    /* Footer */
    .site-footer__top {
        grid-template-columns: 320px 1fr;
        gap: var(--space-3xl);
    }
    .site-footer__nav-columns {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Visibility Utilities */
    .show-mobile, .show-mobile-flex, .show-tablet, .show-tablet-flex { display: none !important; }
    .hide-mobile, .hide-tablet { display: block !important; }
    .show-desktop { display: block !important; }
    .show-desktop-flex { display: flex !important; }
}

/* ==========================================================================
   LARGE DESKTOP (min-width: 1440px)
   ========================================================================== */
@media screen and (min-width: 1440px) {
    :root {
        --container-padding: 64px;
        /* Width is capped at 1200px in global.css, extra padding prevents edge-hugging */
    }
    .hero-section { min-height: 600px; }
}