/* ===============================
   Responsive CSS
   Breakpoints: 1440, 1200, 992, 768, 576
   =============================== */

@media (max-width: 1440px) {
    :root {
        --container: 1180px;
    }

    .primary-nav ul {
        gap: 24px;
    }

    .brand-text strong {
        font-size: 30px;
    }

    .hero {
        min-height: 650px;
    }

    .hero-logo {
        width: 240px;
        height: 240px;
    }

    .impact-item {
        padding: 0 24px;
    }

    .academy-stats {
        grid-template-columns: repeat(3, 1fr);
    }

    .mission-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 1200px) {
    .post-hero-logo {
        position: static;
        display: block;
        width: 220px;
        height: auto;
        margin: 0 auto 20px;
        transform: none;
    }
}

@media (max-width: 1200px) {
    .container {
        width: min(calc(100% - 56px), var(--container));
    }

    .header-inner {
        gap: 22px;
    }

    .primary-nav ul {
        gap: 16px;
    }

    .primary-nav a {
        font-size: 13px;
    }

    .brand-logo,
    .brand img {
        width: 60px;
        height: 60px;
    }

    .brand-text strong {
        font-size: 26px;
    }

    .brand-text span {
        letter-spacing: 4px;
    }

    .header-actions {
        gap: 14px;
    }

    .organization-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .impact-grid {
        gap: 0;
    }

    .impact-item strong {
        font-size: 43px;
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

    .latest-news {
        padding-left: 0;
        border-left: 0;
    }

    [dir="rtl"] .latest-news {
        padding-right: 0;
        border-right: 0;
    }

    .footer-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    /* Academy page */
    .academy-section-nav {
        top: 84px;
    }

    .academy-card-grid,
    .academy-contact-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mission-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .academy-pill-grid,
    .academy-infographic {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* Bakhtar International Post: responsive layout */
@media (max-width: 992px) {
    .post-hero { min-height: 650px; }
    .post-hero-logo { right: 32px; width: min(29vw, 250px); }
    [dir="rtl"] .post-hero-logo { right: auto; left: 32px; }
    .post-split, .post-network-inner, .post-cargo-layout { grid-template-columns: 1fr; gap: 38px; }
    .post-service-grid, .post-why-grid { grid-template-columns: repeat(2, 1fr); }
    .post-cargo-image { height: 310px; }
    .post-partner-grid { grid-template-columns: repeat(3, 1fr); }
    .post-stats-grid { grid-template-columns: repeat(2, 1fr); gap: 35px 15px; }
}

@media (max-width: 576px) {
    .post-hero-content { padding-top: 125px; }
    .post-hero-logo { position: static; display: block; width: 155px; margin: 0 auto 20px; transform: none; }
    .post-hero h1 { font-size: 3.4rem; }
    .post-service-grid, .post-why-grid { grid-template-columns: 1fr; }
    .post-map { order: -1; }
    .post-button { width: 100%; justify-content: center; }
    .post-intro, .post-services, .post-network, .post-why, .post-partners, .post-cargo { padding: 70px 0; }
}

@media (max-width: 992px) {
    html,
    body {
        width: 100%;
        max-width: 100%;
        overflow-x: hidden;
    }

    main {
        width: 100%;
        max-width: 100%;
        overflow-x: clip;
    }

    /* A clipping ancestor prevents the Academy's section menu from sticking. */
    .academy-page {
        overflow: visible;
    }

    html.academy-page-root,
    body.academy-page-body {
        overflow-x: clip;
    }

    .landing-media-inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 30px;
        min-width: 0;
    }

    .landing-media-copy,
    .landing-media-player,
    .landing-media-placeholder {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .site-header {
        padding: 16px 0;
    }

    .header-inner {
        display: flex;
        justify-content: space-between;
        gap: 12px;
    }

    .nav-toggle {
        display: block;
        order: 3;
        flex: 0 0 auto;
    }

    .primary-nav {
        position: absolute;
        top: calc(100% + 12px);
        right: 28px;
        left: 28px;
        display: none;
        z-index: 1001;
        padding: 18px;
        background: rgba(3, 8, 36, .97);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 12px;
        box-shadow: var(--shadow-strong);
    }

    .site-header.nav-open .primary-nav {
        display: block;
    }

    .primary-nav ul {
        display: grid;
        gap: 8px;
    }

    .primary-nav a {
        width: 100%;
        padding: 10px 4px;
    }

    .nav-dropdown-control {
        display: grid;
        grid-template-columns: 1fr auto;
    }

    .nav-dropdown-toggle {
        display: none;
    }

    .primary-nav .nav-dropdown-menu {
        position: static;
        display: grid;
        min-width: 0;
        margin: 2px 0 6px 12px;
        padding: 4px 0 4px 12px;
        visibility: visible;
        opacity: 1;
        background: transparent;
        border: 0;
        border-left: 1px solid rgba(212, 175, 55, .42);
        border-radius: 0;
        box-shadow: none;
        transform: none;
        transition: none;
    }

    .nav-dropdown:hover .nav-dropdown-menu,
    .nav-dropdown:focus-within .nav-dropdown-menu {
        display: grid;
        transform: none;
    }

    .nav-dropdown.is-open .nav-dropdown-menu,
    .nav-dropdown.is-open:hover .nav-dropdown-menu,
    .nav-dropdown.is-open:focus-within .nav-dropdown-menu {
        display: grid;
    }

    .primary-nav .nav-dropdown-menu a {
        padding: 9px 10px;
        white-space: normal;
    }

    .header-actions {
        order: 2;
        margin-left: auto;
        justify-content: flex-end;
        gap: 12px;
    }

    .hero {
        min-height: 620px;
        padding-top: 70px;
    }

    .hero-logo {
        width: 205px;
        height: 205px;
    }

    .hero-subtitle {
        font-size: 23px;
    }

    .organization-grid,
    .project-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .impact-grid {
        grid-template-columns: repeat(2, 1fr);
        row-gap: 28px;
    }

    .impact-item:nth-child(2) {
        border-right: 0;
    }

    .cta-inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .cta p {
        margin-right: auto;
        margin-left: auto;
    }

    .cta-actions {
        justify-content: center;
    }

    /* Contact page */
    .contact-layout {
        grid-template-columns: 1fr;
    }

    /* Academy page */
    .academy-hero {
        min-height: 640px;
        padding-top: 172px;
    }

    .academy-two-column,
    .academy-profile-layout {
        grid-template-columns: 1fr;
    }

    .academy-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    .academy-card-grid,
    .academy-contact-grid,
    .mission-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .academy-timeline::before {
        left: 16px;
    }

    .timeline-item,
    .timeline-item:nth-child(even),
    .timeline-item:nth-child(odd) {
        width: calc(100% - 48px);
        justify-self: end;
    }

    .timeline-item:nth-child(even)::after,
    .timeline-item:nth-child(odd)::after {
        left: -39px;
        right: auto;
    }

    [dir="rtl"] .academy-timeline::before {
        right: 16px;
        left: auto;
    }

    [dir="rtl"] .timeline-item,
    [dir="rtl"] .timeline-item:nth-child(even),
    [dir="rtl"] .timeline-item:nth-child(odd) {
        justify-self: start;
    }

    [dir="rtl"] .timeline-item:nth-child(even)::after,
    [dir="rtl"] .timeline-item:nth-child(odd)::after {
        right: -39px;
        left: auto;
    }
}

@media (max-width: 768px) {
    .foundation-hero-bg {
        background-position: center, center, right center, center;
    }

    .container {
        width: min(calc(100% - 36px), var(--container));
    }

    .brand-text {
        display: none;
    }

    .header-actions {
        justify-content: space-between;
    }

    .hero {
        min-height: 590px;
        padding-top: 158px;
    }

    .hero h1 {
        font-size: 70px;
    }

    .hero-subtitle {
        max-width: 520px;
        margin-right: auto;
        margin-left: auto;
    }

    .hero-subtitle span {
        margin-right: 6px;
        margin-left: 6px;
    }

    .hero-copy {
        font-size: 17px;
    }

    .section-heading h2 {
        font-size: 27px;
    }

    .organization-grid,
    .project-grid,
    .impact-grid {
        grid-template-columns: 1fr;
    }

    .timeline-list { grid-template-columns: 1fr; }
    .about#about-foundation { padding: 62px 0; }

    .impact-item,
    .impact-item:nth-child(2) {
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, .2);
        padding: 0 12px 24px;
    }

    .impact-item:last-child {
        border-bottom: 0;
        padding-bottom: 0;
    }

    .featured-news {
        grid-template-columns: 1fr;
        padding: 0 0 18px;
    }

    .featured-news div {
        padding: 0 16px;
    }

    .news-card {
        grid-template-columns: 112px 1fr;
    }

    .dynamic-news-card { grid-template-columns: 180px 1fr; }
    .news-directory, .news-detail-layout { grid-template-columns: 1fr; }
    .media-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .media-featured-card { grid-template-columns: 1fr; }
    .media-skeleton-feature { grid-template-columns: 1fr; }
    .media-skeleton-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .landing-media-inner { grid-template-columns: 1fr; gap: 30px; }
    .about-split, .about-purpose-grid { grid-template-columns: 1fr; gap: 36px; }
    .about-leadership-grid, .about-history-inner { grid-template-columns: 1fr; gap: 36px; }
    .about-work-grid, .about-values-grid { grid-template-columns: repeat(2, 1fr); }
    .organizations-intro-grid { grid-template-columns: 1fr; gap: 35px; }
    .organization-feature-card, .organization-feature-card:first-child { grid-template-columns: 112px 1fr; }
    .organization-principles-grid { grid-template-columns: 1fr; }

    .cta-actions,
    .hero-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .footer-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-bottom {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Contact page */
    .page-hero {
        padding: 160px 0 68px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    /* Academy page */
    .academy-section {
        padding: 10px 0;
    }

    .academy-hero p,
    .academy-centered p,
    .academy-future-content p {
        font-size: 18px;
    }

    .academy-large-card {
        padding: 28px;
    }

    .academy-large-card p {
        font-size: 25px;
    }

    .academy-pill-grid,
    .academy-infographic {
        grid-template-columns: repeat(2, 1fr);
    }

    .academy-profile-image {
        min-height: 360px;
    }
}

@media (max-width: 576px) {
    .foundation-hero-bg {
        background-position: center, center, right center, center;
        background-size: cover, cover, auto 62%, cover;
    }

    .site-header {
        padding: 12px 0;
    }

    .brand-logo,
    .brand img {
        width: 52px;
        height: 52px;
    }

    .header-inner,
    .header-actions {
        gap: 8px;
    }

    .donate-btn {
        min-height: 40px;
        padding: 0 10px;
        gap: 6px;
        font-size: 14px;
    }

    .language-select select {
        min-width: 68px;
        min-height: 40px;
        padding: 0 8px;
    }

    .nav-toggle {
        width: 40px;
        height: 40px;
    }

    .primary-nav {
        top: calc(100% + 8px);
        right: 18px;
        left: 18px;
        max-height: calc(100vh - 92px);
        overflow-y: auto;
    }

    .landing-media-inner {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 24px;
        min-width: 0;
    }

    .landing-media-copy,
    .landing-media-player,
    .landing-media-placeholder {
        width: 100%;
        min-width: 0;
        max-width: 100%;
    }

    .landing-media-copy h2 {
        font-size: clamp(32px, 10vw, 42px);
    }

    .landing-media-copy > p:not(.eyebrow) {
        font-size: 16px;
        overflow-wrap: anywhere;
    }

    .landing-media-placeholder {
        min-height: 230px;
        aspect-ratio: auto;
    }

    .hero {
        min-height: 620px;
        padding-top: 80px;
    }

    .hero-logo {
        width: 220px;
        height: 220px;
    }

    .hero h1 {
        font-size: 52px;
    }

    .hero-subtitle {
        font-size: 20px;
    }

    .hero-divider {
        width: 220px;
    }

    .organizations,
    .projects-news {
        padding-top: 28px;
    }

    .org-card {
        min-height: auto;
    }

    .news-card {
        grid-template-columns: 1fr;
    }

    .news-card img {
        width: 100%;
    }

    .dynamic-news-card { grid-template-columns: 1fr; gap: 14px; }
    .dynamic-news-detail { padding: 22px; }
    .news-article-navigation { grid-template-columns: 1fr; }
    .news-article-navigation__empty { display: none; }
    .media-section { padding: 54px 0 68px; }
    .media-featured { padding: 14px; }
    .media-grid { grid-template-columns: 1fr; }
    .media-skeleton-grid { grid-template-columns: 1fr; }
    .news-skeleton-card { grid-template-columns: 1fr; gap: 14px; }
    .media-filters { flex-wrap: nowrap; padding-bottom: 5px; overflow-x: auto; }
    .media-filters button { flex: 0 0 auto; }
    .video-close { top: -12px; right: -6px; }
    .landing-media { padding: 64px 0; }
    .about-intro, .about-work, .about-values { padding: 64px 0; }
    .about-leadership, .about-history { padding: 64px 0; }
    .about-purpose { padding: 64px 0; }
    .about-purpose article:last-child { padding: 24px 0 0; border-top: 1px solid rgba(212,175,55,.6); border-left: 0; }
    .about-history-inner > p { padding: 24px 0 0; border-top: 1px solid rgba(212,175,55,.58); border-left: 0; }
    .about-intro[id], .about-purpose article[id], .about-leadership[id], .about-history[id] { scroll-margin-top: 92px; }
    .about-work-grid, .about-values-grid { grid-template-columns: 1fr; }
    .organizations-intro, .organization-principles, .organization-cta { padding: 64px 0; }
    .organization-directory { padding: 10px 0 64px; }
    .organization-directory-grid { grid-template-columns: 1fr; }
    .organization-feature-card, .organization-feature-card:first-child { grid-column: auto; grid-template-columns: 82px 1fr; min-height: auto; gap: 17px; padding: 27px 19px; }
    .organization-feature-card img, .organization-feature-card:first-child img { max-height: 90px; }
    .organization-feature-card:first-child h3 { font-size: 34px; }
    .organization-card-number { right: 17px; font-size: 48px; }

    .partner-carousel::before,
    .partner-carousel::after {
        width: 54px;
    }

    .partner-track {
        --partner-gap: 42px;
    }

    .partner-track img {
        width: 126px;
    }

    .cta h2 {
        font-size: 29px;
    }

    .footer-grid {
        grid-template-columns: 1fr;
    }

    .footer-bottom nav {
        flex-wrap: wrap;
        gap: 14px;
    }

    .back-to-top {
        right: 18px;
        bottom: 18px;
    }

    /* Contact page */
    .contact-info-card,
    .contact-form-card {
        padding: 24px;
    }

    .contact-info-list article {
        grid-template-columns: 1fr;
    }

    [dir="rtl"] .contact-info-list article {
        grid-template-columns: 1fr;
    }

    [dir="rtl"] .contact-info-list article > span {
        grid-column: auto;
        grid-row: auto;
    }

    .contact-form button {
        width: 100%;
    }

    /* Academy page */
    .academy-hero {
        min-height: 620px;
        padding: 150px 0 70px;
    }

    .academy-registration strong {
        font-size: 34px;
    }

    .academy-stats,
    .academy-card-grid,
    .academy-contact-grid,
    .mission-grid,
    .academy-pill-grid,
    .academy-infographic {
        grid-template-columns: 1fr;
    }

    .academy-stat-card {
        min-height: 96px;
    }

    .academy-section-nav {
        top: 76px;
    }

    .academy-section-nav a {
        font-size: 12px;
    }

    .academy-illustration-card,
    .academy-info-panel {
        min-height: auto;
        padding: 24px;
    }

    .academy-illustration-card img {
        width: 160px;
        height: 160px;
    }

    .academy-hierarchy div {
        font-size: 22px;
    }

    .academy-profile-content h3 {
        font-size: 38px;
    }

    .academy-map-placeholder {
        min-height: 240px;
    }
}
