/* ==========================================================================
   Al Noor Institute — responsive.css
   Breakpoints: 1200 · 1024 · 900 · 768 · 560 · 380
   ========================================================================== */

/* ---------- Large desktop ------------------------------------------------- */
@media (min-width: 1600px) {
    :root { --container: 1280px; }
    body { font-size: 17px; }
}

/* ---------- Small desktop / large tablet ---------------------------------- */
@media (max-width: 1180px) {
    .nav__list { gap: 0; }
    .nav__link { padding-inline: 11px; font-size: .92rem; }
    .brand__sub { display: none; }
}

@media (max-width: 1024px) {
    :root { --space-9: 72px; --space-8: 52px; }

    .hero__grid { gap: var(--space-6); }
    .split { gap: var(--space-6); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .contact-grid { grid-template-columns: 1fr; }
    .footer__grid { grid-template-columns: 1fr 1fr; }
    .footer__brand { grid-column: 1 / -1; }
}

/* ---------- Tablet: switch to mobile navigation --------------------------- */
@media (max-width: 960px) {
    .nav { display: none; }
    .header__actions .btn--primary { display: none; }
    .hamburger { display: grid; }
    .header__inner { justify-content: space-between; }
    .header__actions { margin-inline-start: auto; }

    .hero__grid { grid-template-columns: 1fr; }
    .hero__media { order: -1; }
    .hero__badge { inset-inline-start: var(--space-4); inset-block-end: -18px; }
    .hero__lead { max-width: none; }

    .split,
    .split--reverse { grid-template-columns: 1fr; }
    .split--reverse .split__media { order: -1; }
    .split__media { order: -1; }

    .stats__grid { grid-template-columns: repeat(2, 1fr); }
    .stat:nth-child(3) { border-inline-start: 0; }
    .stat:nth-child(3),
    .stat:nth-child(4) { border-top: 1px solid var(--border); }

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

    /* Improved mobile navigation */
    .mobile-nav {
        padding: var(--space-6) var(--space-5);
        background: var(--white);
        box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    }
    .mobile-nav__link {
        padding: 16px var(--space-4);
        font-size: 1.1rem;
        border-radius: var(--radius);
        transition: all .2s var(--ease);
    }
    .mobile-nav__link:hover {
        background: var(--primary-100);
        color: var(--primary);
        transform: translateX(4px);
    }
    .mobile-nav__link[aria-current="page"] {
        background: var(--primary);
        color: var(--white);
        font-weight: 700;
    }
}

/* ---------- Tablet portrait ----------------------------------------------- */
@media (max-width: 768px) {
    :root { --space-9: 60px; --space-8: 44px; --header-h: 68px; }

    body { font-size: 15.5px; }

    .section-head { margin-bottom: var(--space-6); }

    .grid-2,
    .grid-3,
    .grid-4 { grid-template-columns: 1fr; }

    .form-grid { grid-template-columns: 1fr; gap: var(--space-4); }
    .form-card { padding: var(--space-5); }

    /* Stacked toolbar. `flex-wrap` must be cleared: kept together with
       `column`, it lets items spill into extra columns instead of stacking.
       `min-inline-size: 0` stops each item from being sized by its widest
       content (the seven category chips), which pushed the row past the
       viewport — hidden until now by `overflow-x: hidden` on <body>.
       `flex: none` is needed because the base `flex: 1 1 320px` becomes a
       320px *height* basis once the axis turns vertical. */
    .toolbar { flex-direction: column; align-items: stretch; flex-wrap: nowrap; }
    .search-field { max-inline-size: none; min-inline-size: 0; flex: none; }
    .chips { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; scrollbar-width: none; min-inline-size: 0; }
    .chips::-webkit-scrollbar { display: none; }
    .chip { flex: none; }

    .pill-list { grid-template-columns: 1fr; }

    /* Steps become a compact indicator row */
    .step__label { display: none; }
    .step__dot { inline-size: 36px; block-size: 36px; font-size: .9rem; }
    .step::before { inset-block-start: 18px; }

    .cta-band { padding: var(--space-7) var(--space-5); }

    .footer { margin-top: var(--space-8); }
    .footer__grid { grid-template-columns: 1fr; gap: var(--space-6); }
    .footer__bottom { flex-direction: column; align-items: flex-start; }

    .job-card__head { flex-direction: column; align-items: stretch; }
    .job-card__head .btn { align-self: flex-start; }

    .event-detail__meta { grid-template-columns: 1fr; gap: var(--space-3); }
    .event-detail__body { padding: var(--space-5); }

    /* New components responsive adjustments */
    .principal-message {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .principal-message__media {
        margin-bottom: var(--space-5);
    }
    .principal-message__signature {
        align-items: center;
    }

    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .team-card { padding: var(--space-5); }
    .team-card__avatar {
        inline-size: 70px;
        block-size: 70px;
    }

    .achievement-card { padding: var(--space-5); }
    .achievement-card__icon {
        inline-size: 56px;
        block-size: 56px;
    }

    .testimonial-card { padding: var(--space-5); }
    .testimonial-card__content::before {
        font-size: 3rem;
        inset-block-start: -12px;
    }

    .map-container iframe {
        height: 300px;
    }

    /* Topbar & Azhari components responsive */
    .topbar__quick { display: none; }
    .topbar__inner { justify-content: center; text-align: center; }

    .quran-band__grid { grid-template-columns: 1fr; gap: var(--space-6); }
    .quran-band { padding: var(--space-6); }
    .quran-features { grid-template-columns: 1fr; }

    .azhar-calc__grid { grid-template-columns: 1fr; gap: var(--space-5); }
    .azhar-calc { padding: var(--space-5); }
    .azhar-calc__inputs { grid-template-columns: 1fr; }

    .bus-routes-grid { grid-template-columns: 1fr; }

    .wa-widget {
        inset-block-end: calc(var(--space-4) + 50px);
        inset-inline-end: var(--space-4);
    }
    .wa-widget__card {
        inline-size: calc(100vw - 32px);
        inset-inline-end: -8px;
    }
}

/* ---------- Large phone --------------------------------------------------- */
@media (max-width: 560px) {
    :root { --space-9: 52px; --space-7: 36px; }

    .container { padding-inline: var(--space-4); }

    h1 { font-size: 1.95rem; line-height: 1.35; }
    h2 { font-size: 1.5rem; }

    .btn { padding: 12px 20px; font-size: .93rem; }
    .btn--lg { padding: 14px 24px; font-size: .97rem; }
    .btn-row .btn { flex: 1 1 100%; }

    .hero { padding-block: var(--space-7) var(--space-7); }
    .hero__badge {
        position: static;
        margin-top: var(--space-4);
        max-inline-size: none;
    }
    .hero__trust { gap: var(--space-3); flex-direction: column; align-items: flex-start; }

    .stats__grid { grid-template-columns: 1fr; }
    .stat { border-inline-start: 0; border-top: 1px solid var(--border); padding-block: var(--space-5); }
    .stat:first-child { border-top: 0; }

    .card,
    .job-card,
    .vm-card { padding: var(--space-5); }

    .summary-list div { flex-direction: column; gap: 2px; }
    .summary-list dd { text-align: start; }

    .form-nav { flex-direction: column-reverse; }
    .form-nav .btn { inline-size: 100%; }

    /* Full-screen sheet on phones — more readable than a floating card.
       The UA stylesheet caps <dialog> at calc(100% - 6px - 2em) and centres it
       with `margin: auto`, so both have to be overridden explicitly. */
    .event-detail {
        inline-size: 100%;
        max-inline-size: none;
        block-size: 100%;
        max-block-size: none;
        margin: 0;
        border-radius: 0;
    }
    .event-detail__media { aspect-ratio: 16 / 10; }
    .event-detail__foot .btn { inline-size: 100%; }

    .mobile-nav { padding-inline: var(--space-4); }
    .to-top { inline-size: 42px; block-size: 42px; inset-block-end: var(--space-4); inset-inline-end: var(--space-4); }

    /* New components for small phones */
    .grid-4 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }

    .principal-message { padding: var(--space-5); }
    .principal-message__avatar {
        inline-size: 100px;
        block-size: 100px;
    }

    .faq-question { padding: var(--space-4); font-size: .95rem; }
    .faq-answer { padding: 0 var(--space-4) var(--space-4); }
}

/* ---------- Small phone (320-428px) ---------------------------------------
   Raised from 380 to 430: common phones (iPhone 12-15 at 390px, most Android
   at 393-412px) were just above the old cutoff, so the header (logo + full
   brand name + language switch + hamburger) overflowed horizontally. ------ */
@media (max-width: 430px) {
    body { font-size: 15px; }
    .container { padding-inline: 14px; }
    .brand img { inline-size: 36px; block-size: 36px; }
    .brand__name { font-size: .95rem; }
    .lang-switch__btn { padding: 5px 10px; font-size: .8rem; }

    /* At 320px the logo + name + language switch + hamburger no longer fit on
       one row. Reclaim the name's width in the header only — hidden visually
       but kept in the accessibility tree, since it is the brand link's only
       accessible name (the logo <img> is decorative). The footer keeps it. */
    .header__inner { gap: var(--space-3); }
    .header .brand__name {
        position: absolute;
        inline-size: 1px;
        block-size: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    .form-card { padding: var(--space-4); }
    .step__dot { inline-size: 30px; block-size: 30px; font-size: .82rem; }
    .step::before { inset-block-start: 15px; }
    .success-panel__icon { inline-size: 68px; block-size: 68px; }
}

/* ---------- Print --------------------------------------------------------- */
@media print {
    .header, .footer, .to-top, .mobile-nav, .btn { display: none !important; }
    body { background: #fff; }
    .card, .form-card { box-shadow: none; }
}
