/* ================================================================
   RESPONSIVE  — Phase 29 Comprehensive Mobile
   Breakpoints: 1200 / 992 / 768 / 480
   Sections: topbar · header · nav · breaking-bar · hero ·
             top-stories · editorial-grid · most-read · events ·
             article · media · modal · footer · ads
   ================================================================ */

/* ── Global: no element ever overflows the viewport ── */
* { max-width: 100%; }
img, video, iframe, table { max-width: 100%; }

/* ── Container: consistent horizontal padding on all screens ── */
.container {
    width: 100%;
    padding-inline: 1rem;
}
@media (min-width: 768px) {
    .container { padding-inline: 1.25rem; }
}
@media (min-width: 1024px) {
    .container { padding-inline: 1.5rem; }
}


/* ================================================================
   1200px — slight compression
   ================================================================ */
@media (max-width: 1200px) {
    .hdr-wing-name { font-size: 0.78rem; }
    .topbar-markets { gap: 1.25rem; }
}


/* ================================================================
   992px — tablet
   ================================================================ */
@media (max-width: 992px) {
    /* Header */
    .hdr-wing-name  { font-size: 0.74rem; }
    .hdr-wing-sup   { font-size: 0.6rem; }
    .hdr-logo-text  { font-size: 1.65rem; }
    .hdr-inner      { gap: 0.75rem; }

    /* Nav: tighter items */
    .nav-list li a  { padding: 0 0.7rem; font-size: 0.8rem; }

    /* Top stories: already handled via 992px in homepage.css */
}


/* ================================================================
   768px — mobile
   ================================================================ */
@media (max-width: 768px) {

    /* ─── TOPBAR ─── */
    .topbar { height: auto; overflow: visible; }
    .topbar-inner {
        height: var(--topbar-h);
        gap: 0.5rem;
        overflow: hidden;
    }
    .topbar-ticker-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
        flex: 1;
        min-width: 0;
    }
    .topbar-ticker-wrap::-webkit-scrollbar { display: none; }
    .topbar-markets { gap: 0.85rem; padding-inline-end: 0.5rem; white-space: nowrap; }
    .topbar-date    { display: none; }
    .topbar-sep     { display: none; }

    /* ─── HEADER ─── */
    .hdr-wing   { display: none; }
    .hdr-inner  {
        grid-template-columns: 1fr;
        justify-items: center;
        min-height: 52px;
        gap: 0;
        padding: 0.35rem 0;
    }
    .hdr-logo-text  { font-size: 1.65rem; }
    .hdr-brand      { padding: 0; }
    .hdr-brand-divider { width: 28px; margin: 0.28rem auto; }

    /* ─── NAV: hamburger ─── */
    .nav-toggle { display: flex; }
    .nav-list {
        display: none;
        position: absolute;
        top: var(--nav-h);
        inset-inline-start: 0;
        inset-inline-end: 0;
        background: var(--navy);
        flex-direction: column;
        align-items: stretch;
        z-index: 200;
        border-top: 1px solid rgba(255,255,255,.08);
        box-shadow: 0 4px 20px rgba(0,0,0,.35);
        max-height: calc(100vh - var(--topbar-h) - var(--header-h) - var(--nav-h));
        overflow-y: auto;
    }
    .nav-list.is-open { display: flex; }
    .nav-list li a {
        height: auto;
        padding: 0.85rem 1.25rem;
        font-size: 0.9rem;
        border-bottom: 1px solid rgba(255,255,255,.05);
        border-bottom-color: rgba(255,255,255,.05) !important;
    }
    .nav-list li a.is-active {
        background: rgba(201,162,74,.08);
        color: var(--gold);
    }
    /* Hamburger X animation */
    .nav-toggle.is-open span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .nav-toggle.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
    .nav-toggle.is-open span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

    /* Search icon: keep accessible */
    body.lang-ar .nav-search { left: 3rem; right: auto; }
    body.lang-en .nav-search { right: 3rem; left: auto; }

    /* ─── BREAKING BAR ─── */
    .breaking-bar {
        height: 36px;
        font-size: 0.72rem;
    }
    .brk-label { padding: 0 0.6rem; font-size: 0.54rem; }
    .brk-item  { font-size: 0.72rem; padding: 0 0.75rem; }

    /* ─── HERO SLIDER ─── */
    .hero-slider  { height: 340px; }
    .hero-side    { display: none; }
    .hero-main    { flex: 0 0 100%; }
    .hero-title   { font-size: 1.35rem; line-height: 1.25; }
    .hero-excerpt { font-size: 0.82rem; -webkit-line-clamp: 2; }
    .hero-content { padding: 1.25rem 1.25rem; }
    .hero-prev    { left: 0.6rem; }
    .hero-next    { left: auto; right: 0.6rem; }
    .hero-dots    { left: 50%; transform: translateX(-50%); }
    .hero-arrow   { width: 30px; height: 30px; }
    body.lang-ar .hero-dots { transform: translateX(50%); }

    /* ─── TOP STORIES ─── */
    .ts-digest { grid-template-columns: 1fr !important; }
    .ts-col--side:last-child { display: block; }
    .ts-col {
        padding: 0;
        border-inline-end: none;
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.85rem;
        margin-bottom: 0.85rem;
    }
    .ts-col:last-child { border-bottom: none; padding-bottom: 0; margin-bottom: 0; }
    .ts-col--center { padding: 0; }
    .ts-feat-img { aspect-ratio: 16/9; }

    /* ─── EDITORIAL GRID ─── */
    .eg-section     { padding: 1.25rem 0; }
    .eg-fm-layout   { grid-template-columns: 1fr; }
    .eg-macro-layout { grid-template-columns: 1fr; }
    .eg-card-horiz  { flex-direction: column; }
    .eg-thumb       { width: 100% !important; height: auto !important; aspect-ratio: 16/9; }
    .eg-row-3       { grid-template-columns: repeat(2, 1fr); }
    .eg-grid-2x2    { grid-template-columns: repeat(2, 1fr); }

    /* Override inline height on editorial-grid card images */
    .eg-card-img[style*="height"] {
        height: auto !important;
        aspect-ratio: 16/9;
    }
    .eg-feature .eg-card-img,
    .eg-feature-lg .eg-card-img { height: auto !important; aspect-ratio: 16/9; }

    /* ─── MOST READ ─── */
    .mr-list { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
    .mr-item { padding: 0 0; border-inline-end: none; }
    .mr-num  { font-size: 1.5rem; }

    /* ─── EVENTS SLIDER ─── */
    .ev-slider-inner { height: 260px; }
    .ev-title   { font-size: 1.3rem; }
    .ev-subtitle { display: none; }

    /* ─── ARTICLE PAGE ─── */
    .np-art-header  { padding: 1.75rem 0 1.5rem; }
    .np-art-title   { font-size: 1.55rem !important; letter-spacing: -.02em; }
    .np-art-subtitle { font-size: 0.92rem; }
    .np-art-figure img { max-height: 240px; }
    .np-art-layout  { grid-template-columns: 1fr !important; padding-top: 1.25rem; }
    .np-art-sidebar { position: static; }
    .np-art-body    { font-size: 0.96rem; line-height: 1.72; }
    .np-art-body h2 { font-size: 1.15rem; }
    .np-art-body h3 { font-size: 0.98rem; }
    .np-art-related-grid { grid-template-columns: 1fr 1fr; }
    .np-art-share   { flex-wrap: wrap; gap: 0.5rem; }

    /* ─── MEDIA / VIDEO / PODCAST ─── */
    .media-section-grid { grid-template-columns: 1fr; }
    .media-section  { padding: 1.25rem 0; }
    .fv-block       { padding: 1.25rem 0; }
    .fv-layout      { grid-template-columns: 1fr !important; }
    .fv-featured    { min-height: 220px !important; max-height: 300px !important; }
    .fv-play-ring svg { width: 52px !important; height: 52px !important; }
    .fv-stack       { flex-direction: column; overflow-y: visible; max-height: none; }
    .fv-stack-item  { flex: 1 1 100%; }
    .pod-layout     { grid-template-columns: 1fr !important; }
    .pod-grid-2     { flex-direction: column; }
    .pod-thumb      { flex: 0 0 60px; width: 60px; height: 60px; }

    /* ─── YOUTUBE MODAL ─── */
    .yt-modal       { padding: 0.5rem; align-items: flex-end; }
    .yt-modal-inner { max-width: 100%; border-radius: 8px 8px 0 0; }
    .yt-modal.is-pip .yt-modal-inner { width: 220px !important; }

    /* ─── FOOTER ─── */
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 1.25rem;
        padding: 1.75rem 0 1.25rem;
    }
    .footer-brand { grid-column: 1 / -1; }
    .footer-brand p { max-width: 100%; }

    /* ─── ADS ─── */
    .ad-rail-inner  { flex-direction: column; }
    .ad-rail-tiles  { flex-direction: row; }
    .ad-row-3-inner { flex-direction: column; gap: 0.5rem; }
    .ad-wrap--banner img,
    .ad-wrap--leaderboard img { max-height: 90px !important; }

    /* ─── PAGE INTRO ─── */
    .page-intro   { padding: 2rem 0 1.5rem; }
    .page-intro h1 { font-size: 1.25rem; }
    .np-index-grid { grid-template-columns: 1fr !important; }
}


/* ================================================================
   480px — small mobile
   ================================================================ */
@media (max-width: 480px) {

    /* ─── TOPBAR ─── */
    .topbar-inner   { height: 32px; }
    .mkt-item       { font-size: 0.67rem; gap: 0.18rem; }
    .mkt-val        { font-size: 0.67rem; }
    .mkt-chg        { display: none; }

    /* ─── HEADER ─── */
    .hdr-inner      { min-height: 46px; }
    .hdr-logo-text  { font-size: 1.45rem; }
    .hdr-newsroom   { font-size: 0.57rem; letter-spacing: .07em; }
    .hdr-brand-divider { width: 24px; }

    /* ─── HERO ─── */
    .hero-slider    { height: 300px; }
    .hero-title     { font-size: 1.2rem; }
    .hero-excerpt   { display: none; }
    .hero-content   { padding: 0.9rem 1rem; }
    .hero-badge     { font-size: 0.6rem; }
    .hero-meta      { font-size: 0.68rem; }

    /* ─── EDITORIAL GRID ─── */
    .eg-row-4       { grid-template-columns: 1fr; }
    .eg-grid-2x2    { grid-template-columns: 1fr; }
    .eg-row-3       { grid-template-columns: 1fr; }
    .eg-fm-layout   { gap: 0.85rem; }

    /* ─── MOST READ ─── */
    .mr-list        { grid-template-columns: 1fr; }

    /* ─── EVENTS ─── */
    .ev-slider-inner { height: 220px; }
    .ev-title       { font-size: 1.05rem; }
    .ev-label       { font-size: 0.6rem; }
    .ev-cta         { padding: 0.5rem 1rem; font-size: 0.8rem; }
    .ev-arrow       { width: 28px; height: 28px; }

    /* ─── ARTICLE ─── */
    .np-art-title   { font-size: 1.35rem !important; }
    .np-art-related-grid { grid-template-columns: 1fr; }
    .np-art-share   { flex-wrap: wrap; }

    /* ─── MODAL ─── */
    .yt-modal.is-pip .yt-modal-inner { width: 180px !important; }

    /* ─── FOOTER ─── */
    .footer-grid    { grid-template-columns: 1fr; }
    .footer-brand   { grid-column: 1; }

    /* ─── ADS ─── */
    .ad-rail-tiles  { flex-direction: column; }
    .ad-wrap--banner img,
    .ad-wrap--leaderboard img { max-height: 75px !important; }
}


/* ================================================================
   RTL overrides — mobile nav
   ================================================================ */
body.lang-ar .nav-list {
    inset-inline-start: 0;
    inset-inline-end: 0;
}
body.lang-ar .nav-toggle { right: 1.25rem; left: auto; }
body.lang-en .nav-toggle { left: 1.25rem; right: auto; }

/* ─── RTL hero dots ─── */
body.lang-ar .hero-dots  { left: auto; inset-inline-start: 50%; }
