/* ===================================================================
   Afiablee Healthcare Solutions — Responsive layer
   MEDIA QUERIES ONLY. Loaded after style.css.
   Breakpoints:  1200 · 992 (tablet / mobile-nav) · 768 · 560 · 400
   =================================================================== */

/* -------------------------------------------------------------------
   Large desktop down — 1200px
   ------------------------------------------------------------------- */
@media (max-width: 1200px) {
    :root {
        --container: 1080px;
    }

    .drop--wide {
        min-width: 480px;
    }

    /* tighter mega menu on smaller desktops */
    .drop--mega {
        gap: 0 1.2rem;
        padding: 1.4rem 1.5rem;
    }
}

/* -------------------------------------------------------------------
   Tablet & mobile nav — 992px
   (nav collapses here so the 7-item bar never overflows on tablets)
   ------------------------------------------------------------------- */
@media (max-width: 992px) {

    /* --- Layout: two-column splits stack --- */
    .hero-grid,
    .split,
    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2.4rem;
    }

    .hero-visual {
        max-width: 420px;
        margin-inline: auto;
    }

    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .grid-4,
    .ind-grid,
    .process-grid,
    .team-grid,
    .bento {
        grid-template-columns: repeat(2, 1fr);
    }

    /* --- New home layout: stack on tablet --- */
    .why-split {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    /* blog article: TOC moves above the text, no longer sticky */
    .article-layout {
        grid-template-columns: 1fr;
        gap: 1.8rem;
    }

    .toc {
        position: static;
    }

    .why-split__lead {
        position: static;
    }

    .metric-strip {
        grid-template-columns: repeat(3, 1fr);
    }

    .metric:nth-child(3) {
        border-right: 0;
    }

    .timeline {
        grid-template-columns: repeat(2, 1fr);
        gap: 2.4rem 1.2rem;
    }

    .timeline::before {
        display: none;
    }

    .bento-feat {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 1.2rem;
    }

    .bento-feat__icon {
        margin-inline: auto;
    }

    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
    }

    /* process connector arrows make no sense once wrapped */
    .step:not(:last-child)::after {
        display: none;
    }

    /* ============ MOBILE NAVIGATION ============ */
    .nav-toggle {
        display: flex;
    }

    /* IMPORTANT: backdrop-filter makes the header a containing block for its
       fixed children, which would shrink the fixed .nav-links drawer to the
       header's height on scroll. Use a solid bg on mobile instead. */
    .site-header.scrolled {
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        background: rgba(255, 255, 255, .96);
    }

    /* Drawer = a viewport; submenus are panels that slide across it. */
    .nav-links {
        position: fixed;
        inset: 0 0 0 auto;
        width: min(86%, 360px);
        flex-direction: column;
        align-items: stretch;
        background: var(--white);
        padding: 1.3rem 1.6rem 2rem;
        gap: .2rem;
        box-shadow: var(--shadow-lg);
        transform: translateX(100%);
        transition: transform .45s var(--ease);
        overflow-x: hidden;
        overflow-y: auto;
        z-index: 99;
    }

    /* logo + close, pinned at the top of the sidebar */
    .nav-drawer-top {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        padding: .1rem .1rem 1rem;
        margin-bottom: .6rem;
        border-bottom: 1px solid #eef3f6;
    }

    .nav-drawer-brand {
        display: flex;
        align-items: center;
    }

    .nav-drawer-brand img {
        height: 46px;
        width: auto;
    }

    .nav-close {
        flex: none;
        width: 42px;
        height: 42px;
        border: 0;
        border-radius: 50%;
        background: var(--teal-50);
        color: var(--ink-800);
        font-size: 1.15rem;
        display: grid;
        place-items: center;
        cursor: pointer;
        transition: background .25s, transform .35s var(--ease);
    }

    .nav-close:hover {
        background: var(--teal-100);
        transform: rotate(90deg);
    }

    /* dark X so it stays visible on the white drawer */
    .nav-toggle.open span {
        background: var(--ink-800) !important;
    }

    .nav-links.open {
        transform: translateX(0);
    }

    .nav-links>a:not(.btn) {
        color: var(--ink-700) !important;
        font-size: 1.1rem;
        padding: .7rem .2rem;
        border-bottom: 1px solid #f1f5f8;
    }

    /* static (not relative) so each submenu panel anchors to the whole drawer
       (.nav-links), not to the little toggle row — that's what makes the
       submenu take over as a full-screen slide. */
    .has-drop {
        position: static;
        width: 100%;
    }

    .drop-toggle {
        color: var(--ink-700) !important;
        font-size: 1.1rem;
        width: 100%;
        justify-content: space-between;
        padding: .7rem .2rem;
        border-bottom: 1px solid #f1f5f8;
    }

    .drop-toggle::after {
        display: none;
    }

    /* chevron points right — tapping opens a NEW slide */
    .drop-toggle i {
        transform: rotate(-90deg);
        font-size: .8rem;
    }

    /* Each submenu is a full panel that slides in from the right, OVER its
       parent. Absolute to .nav-links, so nested submenus stack to any depth. */
    .drop,
    .has-drop:hover .drop {
        position: absolute;
        inset: 0;
        left: auto;
        width: 100%;
        transform: translateX(100%);
        transition: transform .38s var(--ease);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: block;
        grid-template-columns: 1fr;
        background: #fff;
        border: 0;
        box-shadow: none;
        min-width: 0;
        margin: 0;
        padding: 4.7rem 1.4rem 2rem;
        overflow-y: auto;
        z-index: 5;
    }

    .drop::before {
        display: none;
    }

    .drop--wide {
        display: block;
    }

    /* mega menu collapses to stacked sections in the slide drawer */
    .drop--mega,
    .has-drop:hover .drop--mega {
        display: block;
        width: 100%;
        padding: 0;
        right: auto;
        transform: translateX(110%);
    }

    .drop--mega.slide-open,
    .has-drop:hover .drop--mega.slide-open {
        transform: translateX(0);
    }

    .mega-col {
        display: block;
        margin-bottom: .4rem;
    }

    /* no vertical dividers when stacked */
    .mega-col + .mega-col::before {
        display: none;
    }

    .mega-h {
        padding: .9rem .25rem .4rem;
        margin-bottom: 0;
        border-bottom: 1px solid #eef3f6;
    }

    .mega-col a {
        padding: .75rem .25rem;
        border-bottom: 1px solid #f1f5f8;
    }

    .mega-col a:hover {
        transform: none;
        background: transparent;
    }

    /* featured panel sits at the bottom of the drawer section */
    .mega-feat {
        margin: .6rem 0 .3rem;
    }

    .mega-feat:hover {
        transform: none;
    }

    .drop.slide-open,
    .has-drop:hover .drop.slide-open {
        transform: translateX(0);
    }

    /* back row injected by JS */
    .drop-back {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        height: 3.9rem;
        display: flex;
        align-items: center;
        gap: .6rem;
        padding: 0 1.2rem;
        font-family: var(--font-head);
        font-weight: 700;
        font-size: 1.05rem;
        color: var(--ink-900);
        background: #fff;
        border: 0;
        border-bottom: 1px solid #eef3f6;
        cursor: pointer;
        width: 100%;
    }

    .drop-back i {
        color: var(--teal-600);
        font-size: .95rem;
    }

    .drop a {
        padding: .75rem .25rem;
        gap: .85rem;
        border-bottom: 1px solid #f1f5f8;
    }

    .drop a:hover {
        transform: none;
        background: transparent;
    }

    .drop .di {
        width: 38px;
        height: 38px;
        font-size: .9rem;
    }

    /* descriptions are useful on the roomy slide panel */
    .drop small {
        display: block;
        font-size: .76rem;
        color: var(--slate-600);
    }

    .drop-head {
        order: 0;
        background: var(--teal-50);
        border: 0;
        border-radius: var(--r-sm);
        margin-bottom: .3rem;
    }

    .drop-toggle:focus,
    .drop-toggle:focus-visible {
        outline: none;
    }

    .nav-cta {
        width: 100%;
        justify-content: center;
        margin-top: .6rem;
    }

    .nav-toggle.open span:nth-child(1) {
        transform: translateY(7.5px) rotate(45deg);
    }

    .nav-toggle.open span:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.open span:nth-child(3) {
        transform: translateY(-7.5px) rotate(-45deg);
    }

    .site-header:not(.scrolled) .nav-toggle span {
        background: #fff;
    }
}

/* -------------------------------------------------------------------
   Small tablet / large phone — 768px
   ------------------------------------------------------------------- */
@media (max-width: 768px) {

    section {
        padding: clamp(3rem, 9vw, 5rem) 0;
    }

    .container {
        width: min(100% - 2rem, var(--container));
    }

    .grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }

    /* let the service-detail image breathe instead of forcing tall frames */
    .img-frame {
        min-height: 260px;
    }

    .footer-grid {
        gap: 1.6rem 2rem;
    }

    .footer-bottom {
        justify-content: center;
        text-align: center;
    }
}

/* -------------------------------------------------------------------
   Phone — 560px
   ------------------------------------------------------------------- */
@media (max-width: 560px) {

    .grid-3,
    .grid-4,
    .ind-grid,
    .process-grid,
    .team-grid,
    .media-grid,
    .form-row,
    .bento,
    .timeline {
        grid-template-columns: 1fr;
    }

    .stats-grid,
    .metric-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .metric {
        border-right: 0;
        border-bottom: 1px solid #ece4d3;
    }

    .metric:nth-child(odd) {
        border-right: 1px solid #ece4d3;
    }

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

    /* trim popup header text to keep the form above the fold */
    .consult-modal__dialog .eyebrow,
    .consult-modal__lead {
        display: none;
    }

    /* full-width stacked CTAs read better on a narrow screen */
    .hero-actions {
        gap: .8rem;
    }

    .hero-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .hero-trust {
        gap: 1.4rem;
        text-align: center;
        margin-bottom: 20px;
    }

    /* hide "22 Days in AR" stat on phones */


    /* keep floating hero chips from spilling off-canvas */
    .hero-chip {
        font-size: .8rem;
        padding: .55rem .8rem;
    }

    .hero-chip.c1 {
        top: -14px;
        left: -8px;
    }

    .hero-chip.c2 {
        bottom: -16px;
        right: -6px;
    }

    .page-hero-icon {
        width: 60px;
        height: 60px;
        font-size: 1.4rem;
    }

    .to-top {
        right: 1rem;
        bottom: 1rem;
        width: 44px;
        height: 44px;
    }
}

/* -------------------------------------------------------------------
   Very small phone — 400px
   ------------------------------------------------------------------- */
@media (max-width: 400px) {

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* keep the two stats side-by-side in one centered row */
    .hero-trust {
        flex-direction: row;
        flex-wrap: nowrap;
        justify-content: center;
        gap: 1.2rem;
    }

    .card,
    .why-card,
    .feature,
    .step {
        padding: 1.5rem 1.3rem;
    }
}

/* -------------------------------------------------------------------
   Motion preferences
   ------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    [data-reveal] {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .hero-orb,
    .hero-chip {
        animation: none;
    }

    html {
        scroll-behavior: auto;
    }
}