/*
 * ELBADIL Modern Design System v2.0
 * Responsive, accessible, RTL-first Arabic news theme styles
 * ─────────────────────────────────────────────────────────
 */

@import url("../../src/css/components/_home-builder.css");

/* ═══════════════════════════════════════════
   0. CSS VARIABLES — المتغيرات المفقودة (إصلاح #1)
═══════════════════════════════════════════ */
:root {
    /* Shadow Scale */
    --shadow-xs:  0 1px 2px rgba(15,23,42,.06);
    --shadow-sm:  0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.06);
    --shadow-md:  0 4px 16px rgba(15,23,42,.10), 0 1px 4px rgba(15,23,42,.06);
    --shadow-lg:  0 10px 40px rgba(15,23,42,.13), 0 2px 8px rgba(15,23,42,.07);

    /* Z-Index */
    --z-sticky: 90;

    /* Typography Scale */
    --font-size-xs:   0.75rem;
    --font-size-sm:   0.875rem;
    --font-size-md:   1rem;
    --font-size-base: 1rem;
    --font-size-lg:   1.125rem;
    --font-size-xl:   1.25rem;
    --font-size-2xl:  1.5rem;

    --font-weight-black: 900;
    --line-height-loose: 1.85;

    /* Transition */
    --glob-transition: all 0.25s ease;

    /* Heading Font */
    --site-font-heading: "Cairo", "Tajawal", system-ui, sans-serif;
    --site-font-mono:    "JetBrains Mono", "Fira Code", monospace;

    /* Content Width — responsive */
    --content-width: clamp(640px, 68vw, 860px);
}

/* aspect-ratio للصور حلقة المقالات لمنع Layout Shift (#15c) */
.post-loop-item .post-thumbnail img {
    aspect-ratio: 16 / 9;
    width: 100%;
    object-fit: cover;
    height: auto;
}

/* post-meta-date — Fix: تعريف موحد بدون !important */
.post-meta-date {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: var(--font-size-xs, 0.82rem);
    color: var(--meta-color, #777);
    margin-top: 5px;
}

/* Avatar — منع CLS (#4) */
.entry-author-avatar img {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

.post-meta-avatar img {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    aspect-ratio: 1 / 1;
}

/* iPhone notch — safe area inset (#12) */
#site-header {
    padding-top: env(safe-area-inset-top);
}

/* Breakpoint 480-767px للأجهزة المتوسطة (#15a) */
@media (min-width: 480px) and (max-width: 767px) {
    .primary-header-above h1 { font-size: 1.35rem; }
    .post-loop-item .post-title { font-size: var(--font-size-md); }
    .widget { margin-bottom: 1rem; }
}

/* Mobile padding for small screens (#5c) */
@media (max-width: 575px) {
    .primary-content-inner-4 { padding-inline: 1rem; }
    .entry-content { max-width: 100%; }
}

/* JS-disabled fallback for admin tabs (#10d) */
@media (scripting: none) {
    .bfm-tab { display: block !important; }
}


/* ═══════════════════════════════════════════
   1. GLOBAL RESET & BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; }

::selection {
    background-color: rgba(var(--site-color-rgb), .18);
    color: var(--body-color);
}

img { max-width: 100%; height: auto; display: block; }

a {
    text-decoration: none;
    transition: var(--glob-transition);
}

/* ═══════════════════════════════════════════
   2. SCROLLBAR (Webkit)
═══════════════════════════════════════════ */
::-webkit-scrollbar { width: 7px; height: 7px; }
::-webkit-scrollbar-track { background: var(--body-bg-color); }
::-webkit-scrollbar-thumb {
    background: rgba(var(--site-color-rgb), .4);
    border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(var(--site-color-rgb), .7);
}

/* ═══════════════════════════════════════════
   3. SITE HEADER — Modern sticky glass
═══════════════════════════════════════════ */
#site-header {
    border-top: 3px solid var(--site-color);
    background: rgba(255,255,255,.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: var(--wp-admin--admin-bar--height, 0);
    z-index: var(--z-sticky);
    transition: box-shadow var(--transition-base), transform var(--transition-base);
}

[data-theme^="dark"] #site-header {
    background: rgba(15, 23, 42, .97);
}

body.scroll-down #site-header {
    transform: translateY(-100%);
}

/* site logo */
.site-logo img {
    min-width: 110px;
    max-width: 170px !important;
    transition: opacity var(--transition-fast);
}
.site-logo img:hover { opacity: .85; }
.site-logo .title {
    font-family: var(--site-font-heading);
    font-weight: var(--font-weight-black);
    font-size: var(--font-size-xl);
}

/* ═══════════════════════════════════════════
   4. NAVIGATION MENU
═══════════════════════════════════════════ */
.nav-menu a {
    font-family: var(--site-font-heading);
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    letter-spacing: 0.01em;
    border-radius: var(--glob-border-radius-sm);
    padding: .5em .9em;
    transition: background var(--transition-fast), color var(--transition-fast);
}
.nav-menu li:hover > a,
.nav-menu li.current-menu-item > a,
.nav-menu li.current-menu-ancestor > a {
    background: rgba(var(--site-color-rgb), .08);
    color: var(--site-color) !important;
}

/* ═══════════════════════════════════════════
   5. POST / ARTICLE CARDS
═══════════════════════════════════════════ */
.post-loop-item {
    background: var(--light-bg);
    border-radius: var(--glob-border-radius);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
    box-shadow: var(--shadow-xs);
}

.post-loop-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Post thumbnail */
.post-loop-item .post-thumbnail {
    overflow: hidden;
    border-radius: var(--glob-border-radius) var(--glob-border-radius) 0 0;
}

.post-loop-item .post-thumbnail img {
    transition: transform var(--transition-slow);
    width: 100%;
    object-fit: cover;
}
.post-loop-item:hover .post-thumbnail img {
    transform: scale(1.05);
}

/* Post title */
.post-loop-item .post-title,
.post-loop-item h2,
.post-loop-item h3 {
    font-family: var(--site-font-heading);
    font-weight: var(--font-weight-bold);
    line-height: 1.4;
    margin-bottom: .5em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-loop-item .post-title a:hover {
    color: var(--site-color);
}

/* Category badge on cards */
.post-loop-item .term-badge,
.post-loop-item .category-badge {
    display: inline-block;
    background: var(--site-color);
    color: #fff !important;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    padding: 2px 10px;
    border-radius: var(--glob-border-radius-pill);
    letter-spacing: .03em;
    transition: background var(--transition-fast);
}
.post-loop-item .term-badge:hover { background: var(--site-color-darker-1); }

/* Meta row */
.post-meta,
.post-meta-items {
    font-size: var(--font-size-xs);
    color: var(--meta-color);
    display: flex;
    flex-wrap: wrap;
    gap: .4em .8em;
    align-items: center;
}

.post-meta a:hover { color: var(--site-color); }

/* ═══════════════════════════════════════════
   6. SINGLE POST / ARTICLE
═══════════════════════════════════════════ */
.entry-content {
    font-size: var(--font-size-md);
    line-height: var(--line-height-loose);
    color: var(--body-color);
    max-width: var(--content-width);
    margin-inline: auto;
}

.entry-content p { margin-bottom: 1.35em; }

.entry-content h2,
.entry-content h3 {
    font-family: var(--site-font-heading);
    font-weight: var(--font-weight-bold);
    margin-top: 2em;
    margin-bottom: .6em;
    line-height: 1.3;
}

/* Blockquote */
.entry-content blockquote {
    border-right: 4px solid var(--site-color);
    background: rgba(var(--site-color-rgb), .05);
    padding: 1.2em 1.5em;
    border-radius: 0 var(--glob-border-radius) var(--glob-border-radius) 0;
    margin: 1.5em 0;
    font-style: normal;
    font-weight: var(--font-weight-medium);
    color: var(--body-color);
    font-size: var(--font-size-lg);
}

.ltr .entry-content blockquote {
    border-left: 4px solid var(--site-color);
    border-right: none;
    border-radius: var(--glob-border-radius) 0 0 var(--glob-border-radius);
}

/* Tables */
.entry-content table {
    width: 100%;
    border-collapse: collapse;
    border-radius: var(--glob-border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.entry-content th {
    background: var(--site-color);
    color: #fff;
    padding: .8em 1em;
    text-align: right;
    font-weight: var(--font-weight-bold);
}
.entry-content td {
    padding: .7em 1em;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,.06));
}
.entry-content tr:nth-child(even) td { background: rgba(0,0,0,.025); }

/* Code */
.entry-content code {
    background: rgba(var(--site-color-rgb), .08);
    color: var(--site-color);
    padding: .15em .4em;
    border-radius: 4px;
    font-size: .9em;
}

/* ═══════════════════════════════════════════
   7. SIDEBAR WIDGETS
═══════════════════════════════════════════ */
.widget {
    background: var(--light-bg);
    border-radius: var(--glob-border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--post-gap);
    transition: box-shadow var(--transition-base);
}
.widget:hover { box-shadow: var(--shadow-md); }

.widget-title,
.widget > h3 {
    font-family: var(--site-font-heading);
    font-weight: var(--font-weight-bold);
    font-size: var(--font-size-base);
    padding: .85em 1.2em;
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,.06));
    margin: 0;
    display: flex;
    align-items: center;
    gap: .5em;
}

.widget-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 1.1em;
    background: var(--site-color);
    border-radius: 99px;
    flex-shrink: 0;
}

/* ═══════════════════════════════════════════
   8. BUTTONS
═══════════════════════════════════════════ */
.btn {
    font-family: var(--site-font-heading);
    font-weight: var(--font-weight-bold);
    border-radius: var(--glob-border-radius-sm);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
    letter-spacing: .02em;
}

.btn-primary {
    background: var(--site-color);
    border-color: var(--site-color);
    box-shadow: 0 2px 8px rgba(var(--site-color-rgb), .3);
}

.btn-primary:hover,
.btn-primary:focus {
    background: var(--site-color-darker-1);
    border-color: var(--site-color-darker-1);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(var(--site-color-rgb), .4);
}

.btn:active { transform: translateY(0); }

/* ═══════════════════════════════════════════
   9. SITE FOOTER
═══════════════════════════════════════════ */
#site-footer {
    border-top: 3px solid var(--site-color);
    border-bottom: none !important;
    font-size: var(--font-size-sm);
    line-height: var(--line-height-base);
}

#site-footer a { transition: color var(--transition-fast); }
#site-footer a:hover { color: var(--site-color); }

/* ═══════════════════════════════════════════
   10. SEARCH BOX
═══════════════════════════════════════════ */
.search-field {
    border-radius: var(--glob-border-radius-pill);
    padding-inline-end: 2.5em;
    border: 2px solid rgba(var(--site-color-rgb), .2);
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}
.search-field:focus {
    border-color: var(--site-color);
    box-shadow: 0 0 0 3px rgba(var(--site-color-rgb), .15);
    outline: none;
}
.search-submit {
    border-radius: var(--glob-border-radius-pill);
}

/* ═══════════════════════════════════════════
   11. BADGES & LABELS
═══════════════════════════════════════════ */
.badge-breaking {
    background: #ef4444;
    color: #fff;
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-bold);
    padding: 2px 10px;
    border-radius: var(--glob-border-radius-pill);
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { opacity: 1; }
    50%       { opacity: .7; }
}

/* ═══════════════════════════════════════════
   12. READING PROGRESS BAR
═══════════════════════════════════════════ */
/* Fix #9: reading-progress — unified RTL-safe definition */
#reading-progress {
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    width: 0%;
    height: 3px;
    background: linear-gradient(90deg, var(--site-color), var(--site-color-lighter-1));
    z-index: calc(var(--z-sticky) + 5);
    transition: width .1s linear;
}

/* ═══════════════════════════════════════════
   13. BACK TO TOP BUTTON
═══════════════════════════════════════════ */
#back-to-top {
    position: fixed;
    bottom: 28px;
    inset-inline-start: 24px; /* RTL fix #3 */
    width: 44px;
    height: 44px;
    background: var(--site-color);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .3s, visibility .3s, transform .3s, background .2s;
    z-index: var(--z-overlay);
    box-shadow: var(--shadow-md);
    font-size: 1.1rem;
}
#back-to-top.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#back-to-top:hover {
    background: var(--site-color-darker-1);
    transform: translateY(-3px);
}

/* ═══════════════════════════════════════════
   14. DARK MODE OVERRIDES
═══════════════════════════════════════════ */
[data-theme^="dark"] {
    --light-bg: #1e293b;
    --light-bg-alt: #0f172a;
    --light-border-color: rgba(255,255,255,.07);
}

[data-theme^="dark"] .post-loop-item,
[data-theme^="dark"] .widget {
    background: #1e293b;
    border: 1px solid rgba(255,255,255,.06);
}

[data-theme^="dark"] .entry-content code {
    background: rgba(255,255,255,.08);
}

/* Fix #11: Removed duplicate #dark-mode-toggle definition.
   The full definition is kept below (lines ~734+) */

/* ═══════════════════════════════════════════
   15. RESPONSIVE UTILITIES
═══════════════════════════════════════════ */
@media (max-width: 575px) {
    body { font-size: var(--font-size-base); }
    .entry-content { font-size: var(--font-size-base); }
    .widget-title { font-size: var(--font-size-sm); }
    #site-header .content-layout-row-inner { --row-padding: .6rem; }
    .site-logo img { min-width: 90px; max-width: 130px !important; }
}

@media (min-width: 576px) and (max-width: 767px) {
    .post-loop-item:hover { transform: translateY(-3px); }
}

@media (min-width: 992px) {
    .post-loop-item:hover { transform: translateY(-6px); }
}

/* ═══════════════════════════════════════════
   16. ANIMATIONS & MICRO-INTERACTIONS
═══════════════════════════════════════════ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes shimmer {
    from { background-position: -200% 0; }
    to   { background-position: 200% 0; }
}

/* Skeleton loader */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--glob-border-radius-sm);
}

/* Entrance animation for article cards */
.post-loop-item {
    animation: fadeInUp .4s ease both;
}

/* ═══════════════════════════════════════════
   17. PRINT STYLES
═══════════════════════════════════════════ */
@media print {
    #site-header, #site-footer, #side-menu,
    #news-ticker, #back-to-top, .share-buttons,
    .widget, .ad-container { display: none !important; }
    body { font-size: 12pt; color: #000; background: #fff; }
    .entry-content { max-width: 100%; }
    a::after { content: " (" attr(href) ")"; font-size: 10pt; color: #666; }
}

/* ============================================================
   ELBADIL � ENHANCED COLOR SCALE (from design audit)
   10-shade palette per color for rich UI components
   ============================================================ */
:root {
    /* Primary scale (matches default --site-color: #1d4ed8) */
    --color-primary-50:    #eff6ff;
    --color-primary-100:   #dbeafe;
    --color-primary-200:   #bfdbfe;
    --color-primary-300:   #93c5fd;
    --color-primary-400:   #60a5fa;
    --color-primary-500:   #3b82f6;
    --color-primary-600:   #2563eb;
    --color-primary-700:   #1d4ed8;
    --color-primary-800:   #1e40af;
    --color-primary-900:   #1e3a8a;

    /* Success */
    --color-success-500:   #10b981;
    --color-success-600:   #059669;

    /* Warning */
    --color-warning-500:   #f59e0b;
    --color-warning-600:   #d97706;

    /* Danger / Breaking */
    --color-danger-500:    #ef4444;
    --color-danger-600:    #dc2626;

    /* Info */
    --color-info-500:      #0ea5e9;
    --color-info-600:      #0284c7;

    /* Neutral */
    --color-neutral-50:    #f8fafc;
    --color-neutral-100:   #f1f5f9;
    --color-neutral-200:   #e2e8f0;
    --color-neutral-300:   #cbd5e1;
    --color-neutral-400:   #94a3b8;
    --color-neutral-500:   #64748b;
    --color-neutral-600:   #475569;
    --color-neutral-700:   #334155;
    --color-neutral-800:   #1e293b;
    --color-neutral-900:   #0f172a;

    /* Spacing tokens */
    --space-xs:  0.25rem;
    --space-sm:  0.5rem;
    --space-md:  1rem;
    --space-lg:  1.5rem;
    --space-xl:  2rem;
    --space-2xl: 3rem;
}

/* ============================================================
   Admin-side toggle switch (reused from design system)
   ============================================================ */
.toggle-switch {
    display: inline-block;
    position: relative;
    width: 50px;
    height: 28px;
}
.toggle-switch input { display: none; }
.toggle-switch input + label {
    display: block;
    position: absolute;
    inset: 0;
    background-color: var(--color-neutral-300);
    border-radius: 999px;
    cursor: pointer;
    transition: background-color 0.25s;
}
.toggle-switch input + label::before {
    content: '';
    position: absolute;
    top: 2px; left: 2px;
    width: 24px; height: 24px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-switch input:checked + label {
    background-color: var(--site-color, var(--color-primary-700));
}
.toggle-switch input:checked + label::before {
    transform: translateX(22px);
}

/* ============================================================
   Accessibility: reduce-motion + high-contrast + focus
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus indicators for keyboard navigation */
:focus-visible {
    outline: 3px solid var(--site-color, #1d4ed8);
    outline-offset: 3px;
    border-radius: 4px;
}

/* === Fix: Tablet Breakpoint (768px - 991px) === */
@media (min-width: 768px) and (max-width: 991px) {
    .post-loop-item:hover { transform: translateY(-4px); }
    .entry-content { font-size: 1rem; }
    .site-logo img { max-width: 150px !important; }
    .widget-title { font-size: 1rem; }
    .post-loop-grid { grid-template-columns: repeat(2, 1fr); }
}

/* === Fix: Small Mobile Breakpoint (max-width 374px) === */
@media (max-width: 374px) {
    .site-logo img { min-width: 70px; max-width: 110px !important; }
    #site-header .content-layout-row-inner { --row-padding: .4rem; }
    .nav-menu a { padding: .4em .6em; font-size: var(--font-size-xs, 0.8rem); }
}

/* === Fix 15a: Missing Breakpoint 480px-767px === */
@media (min-width: 480px) and (max-width: 767px) {
    .primary-header-above h1 { font-size: 1.35rem; }
    .post-loop-item .post-title { font-size: var(--font-size-md, 1rem); }
    .widget { margin-bottom: 1rem; }
}
/* ═══════════════════════════════════════════
   POST IMAGE ABOVE — Caption style
═══════════════════════════════════════════ */
.post-image-above-caption {
    position: absolute;
    bottom: 0;
    inset-inline-start: 0;
    inset-inline-end: 0;
    padding: 0.4em 1em;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: var(--font-size-sm);
    text-align: center;
}
figure.post-image-above { position: relative; }

/* ═══════════════════════════════════════════
   Dark Mode Toggle — improved button style
═══════════════════════════════════════════ */
#dark-mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4em;
    padding: 0.35em 0.9em;
    background: none;
    border: 2px solid rgba(var(--site-color-rgb, 29,78,216), 0.3);
    color: var(--body-color);
    border-radius: var(--glob-border-radius-pill);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-family: var(--site-font);
    transition: var(--glob-transition);
    white-space: nowrap;
}
#dark-mode-toggle:hover {
    border-color: var(--site-color);
    background: rgba(var(--site-color-rgb, 29,78,216), 0.08);
}
#dark-mode-toggle svg { flex-shrink: 0; }
#dark-mode-toggle span { display: none; }
@media (min-width: 768px) {
    #dark-mode-toggle span { display: inline; }
}

/* ═══════════════════════════════════════════
   All 4 Post Header Design Modes — Fixes
═══════════════════════════════════════════ */

/* Mode: top (default) — image as header background */
.post-header-design-top .primary-header,
body:not([class*="post-header-design"]) .primary-header {
    min-height: 280px;
}
@media (max-width: 767px) {
    .post-header-design-top .primary-header,
    body:not([class*="post-header-design"]) .primary-header {
        min-height: 200px;
    }
}

/* Mode: overlay — dark overlay with text on top */
.post-header-design-overlay .primary-header {
    min-height: 420px;
}
.post-header-design-overlay .primary-header-inner::after {
    background-image:
        linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%),
        linear-gradient(to right, rgba(0,0,0,0.4) 0%, rgba(0,0,0,0) 60%);
}

/* Mode: inside — image inside article body */
.post-header-design-inside .entry-image {
    margin-bottom: 1.5rem;
}
.post-header-design-inside .entry-image img {
    width: 100%;
    height: clamp(220px, 40vw, 480px);
    object-fit: cover;
    object-position: center;
    border-radius: var(--glob-border-radius);
}

/* Fix #9: reading-progress for 'above' mode — use inset-inline-start */
.post-header-design-above #reading-progress {
    background: var(--site-color);
    height: 3px;
    position: fixed;
    top: 0;
    inset-inline-start: 0;
    z-index: 9999;
    transition: width 0.1s linear;
    width: 0%;
}



/* ╔═══════════════════════════════════════════════════════════╗
   ║   POST META — TERMS / CATEGORIES FIX                    ║
   ╚═══════════════════════════════════════════════════════════╝ */

/* Terms item in post meta */
.post-meta-terms {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0 0.3em;
}
.post-meta-terms .post-meta-item-label {
    display: inline;
    font-weight: var(--font-weight-medium);
    color: var(--meta-color);
}
.post-meta-terms .post-meta-item-content {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.1em 0.3em;
}
.post-meta-terms .term-name a {
    color: var(--site-color) !important;
    font-weight: var(--font-weight-medium);
    transition: opacity var(--transition-fast);
    white-space: nowrap;
}
.post-meta-terms .term-name a:hover {
    opacity: 0.75;
    text-decoration: underline !important;
}
.post-meta-terms .term-sep {
    color: var(--meta-color);
    opacity: 0.5;
}
/* Term color dot (when --term-color is set) */
.post-meta-terms .term-name[style*="--term-color"]::before {
    content: "";
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--term-color);
    margin-inline-end: 4px;
    vertical-align: middle;
}

/* ╔═══════════════════════════════════════════════════════════╗
   ║   MODE: SPLIT — نمط المجلة الصحفية                      ║
   ║   صورة 55% | محتوى 45% — خلفية فاتحة، خط ملون           ║
   ╚═══════════════════════════════════════════════════════════╝ */

/* Wrapper: flex row, no viewport breakout needed */
.post-header-design-split .post-header-split {
    display: flex;
    flex-direction: row;
    min-height: clamp(360px, 45vw, 540px);
    overflow: hidden;
    background: var(--body-bg-color, #ffffff);
    border-bottom: 1px solid var(--border-color, rgba(0,0,0,0.08));
}

/* IMAGE PANEL — 58% width, full-height */
.post-header-split-image {
    flex: 0 0 58%;
    position: relative;
    overflow: hidden;
    background: var(--dark-bg-color, #0f172a);
}
.post-header-split-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform 0.7s cubic-bezier(0.25,0.46,0.45,0.94);
}
.post-header-design-split .post-header-split:hover .post-header-split-image img {
    transform: scale(1.04);
}
/* Fade edge toward content panel */
.post-header-split-image::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 80px;
    background: linear-gradient(to var(--split-fade-dir, left), rgba(255,255,255,0.92) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}
/* LTR: fade on right edge of image */
html:not([dir="rtl"]) .post-header-split-image::after { right: 0; left: auto; --split-fade-dir: left; }
/* RTL: fade on left edge of image */
html[dir="rtl"] .post-header-split-image::after      { left: 0; right: auto; --split-fade-dir: right; }

/* CONTENT PANEL — 42% width, editorial style */
.post-header-split-content {
    flex: 0 0 42%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(1.25rem, 3vw, 2.5rem) clamp(1.5rem, 3.5vw, 3rem);
    background: var(--body-bg-color, #ffffff);
    position: relative;
    /* Vertical colored bar on the inner edge */
    border-inline-start: 4px solid var(--site-color);
}
/* Decorative category-style top tag */
.post-header-split-content::before {
    content: attr(data-category);
    display: block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--site-color);
    text-transform: uppercase;
    margin-bottom: 0.85rem;
}
.post-header-split-content h1,
.post-header-split-content .entry-title {
    font-size: clamp(1.2rem, 2vw, 1.85rem);
    line-height: 1.45;
    font-weight: 700;
    color: var(--heading-color, #1e293b);
    margin-bottom: 1rem;
}
.post-header-split-content .post-meta {
    --meta-color: var(--secondary-color, #64748b);
}
/* Subtle bottom quote line */
.post-header-split-content::after {
    content: "";
    position: absolute;
    bottom: 1.5rem;
    inset-inline-start: 1.5rem;
    inset-inline-end: 1.5rem;
    height: 1px;
    background: var(--border-color, rgba(0,0,0,0.07));
}

/* Fix #3: In RTL flex layout, the FIRST element (image) already goes to the RIGHT
   naturally (flex items flow right-to-left in RTL). Adding row-reverse would
   incorrectly move the image to the LEFT. So we remove this rule entirely.
   RTL: image (first in DOM) = RIGHT side ✅ — content (second) = LEFT side ✅ */
/* html[dir="rtl"] rule removed — default RTL flex behavior is already correct */

/* MOBILE: stack vertically */
@media (max-width: 767px) {
    .post-header-design-split .post-header-split {
        flex-direction: column;
        min-height: unset;
    }
    .post-header-split-image {
        flex: 0 0 auto;
        height: clamp(200px, 52vw, 300px);
    }
    .post-header-split-image::after { display: none; }
    .post-header-split-content {
        flex: 1;
        border-inline-start: none;
        border-top: 4px solid var(--site-color);
        padding: 1.25rem;
    }
    .post-header-split-content::after { display: none; }
}
@media (min-width: 768px) and (max-width: 1024px) {
    .post-header-design-split .post-header-split {
        min-height: 320px;
    }
    .post-header-split-content h1,
    .post-header-split-content .entry-title { font-size: 1.3rem; }
}


/* ╔═══════════════════════════════════════════════════════════╗
   ║   MODE: CINEMATIC — النمط السينمائي الغامر              ║
   ║   صورة كاملة العرض + عنوان ومعلومات فوقها في الأسفل     ║
   ║   (مختلف تمامًا عن Split: داكن، غامر، عريض)            ║
   ╚═══════════════════════════════════════════════════════════╝ */

/* Container: 100% width (article IS full-width, no vw trick needed) */
.post-header-design-cinematic .post-header-cinematic {
    position: relative;
    width: 100%;
    height: clamp(380px, 55vh, 680px);
    overflow: hidden;
    display: flex;
    align-items: flex-end;  /* content pinned to bottom */
    background: #0a0a0f;
    /* No margin-inline-start hack — article container is already full-width */
}

/* Background image — covers entire container */
.post-header-cinematic-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}
.post-header-cinematic-bg img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 25%;
    display: block;
    filter: brightness(0.88) saturate(1.1);
    transform-origin: center;
}
/* Hover: subtle zoom on article hover — scroll-triggered via JS if available */
.post-header-design-cinematic:hover .post-header-cinematic-bg img {
    transform: scale(1.02);
    transition: transform 8s ease;
}

/* Cinematic multi-layer gradient (top vignette + heavy bottom curtain) */
.post-header-cinematic-overlay {
    position: absolute;
    inset: 0;
    z-index: 1;
    background:
        linear-gradient(170deg, rgba(0,0,0,0.25) 0%, transparent 35%),
        linear-gradient(to top,
            rgba(5,5,15,0.96) 0%,
            rgba(5,5,15,0.85) 25%,
            rgba(5,5,15,0.5) 50%,
            rgba(5,5,15,0.15) 70%,
            transparent 100%
        );
}

/* Content area — pinned at bottom with horizontal padding */
.post-header-cinematic-content {
    position: relative;
    z-index: 2;
    width: 100%;
    padding: 0 0 clamp(1.75rem, 4vw, 3rem) 0;
}
.post-header-cinematic-content .container {
    /* Inherits normal container max-width */
}
.post-header-cinematic-content .glob-container {
    /* Accent bar on content block */
    padding-inline-start: 1.25rem;
    border-inline-start: 5px solid var(--site-color);
    /* Slight glass shimmer behind text */
    background: rgba(255,255,255,0.03);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 0 var(--glob-border-radius, 4px) var(--glob-border-radius, 4px) 0;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    padding-inline-end: 1rem;
}
.post-header-cinematic-content h1,
.post-header-cinematic-content .entry-title {
    color: #ffffff !important;
    font-size: clamp(1.4rem, 3vw, 2.6rem);
    line-height: 1.3;
    font-weight: 800;
    text-shadow: 0 2px 16px rgba(0,0,0,0.6), 0 1px 4px rgba(0,0,0,0.8);
    margin-bottom: 0.6rem;
    letter-spacing: -0.01em;
}
.post-header-cinematic-content .post-meta {
    --meta-color: rgba(255,255,255,0.75);
    --link-color: rgba(255,255,255,0.9);
    --link-color-hover: #ffffff;
    font-size: 0.82rem;
    text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}
/* Category badge in cinematic */
.post-header-cinematic-content .post-meta-terms .term-name a {
    background: var(--site-color) !important;
    color: #fff !important;
    padding: 0.15em 0.5em;
    border-radius: 3px;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none !important;
}
.post-header-cinematic-content .post-meta-terms .term-name a:hover {
    opacity: 0.85;
}

/* Responsive */
@media (max-width: 767px) {
    .post-header-design-cinematic .post-header-cinematic {
        height: clamp(260px, 58vw, 380px);
    }
    .post-header-cinematic-content h1,
    .post-header-cinematic-content .entry-title {
        font-size: clamp(1.1rem, 4.5vw, 1.6rem);
        font-weight: 700;
    }
    .post-header-cinematic-content .glob-container {
        padding-inline-start: 0.85rem;
    }
}
@media (min-width: 1400px) {
    .post-header-design-cinematic .post-header-cinematic {
        height: min(58vh, 720px);
    }
}


/* ═══════════════════════════════════════════════════════════
   SPLIT + CINEMATIC: Force article container to be edge-to-edge
   The article (.primary.entry-outer) is always 100% of #site-main.
   Ensure no inherited padding/margin clips our new modes.
═══════════════════════════════════════════════════════════ */

/* Remove top margin from entry-outer in new modes */
.post-header-design-split .primary.entry-outer,
.post-header-design-cinematic .primary.entry-outer {
    margin-top: 0 !important;
}
/* Fix #15: margin-inline: 0 !important was unnecessary (no margin was defined on these elements)
   Keeping the rule without !important for clarity */
.post-header-design-split .post-header-split,
.post-header-design-cinematic .post-header-cinematic {
    margin-inline: 0;
}
/* Ensure no horizontal scroll caused by these modes */
.post-header-design-split,
.post-header-design-cinematic {
    overflow-x: hidden;
}

/* VISUAL COMPARISON: make the two modes clearly different at a glance
   SPLIT: bright, editorial, light background (like The National newspaper)
   CINEMATIC: dark, dramatic, immersive (like The Guardian feature articles) */

/* Split mode accent: colored underline on h1 */
.post-header-split-content .entry-title::after {
    content: "";
    display: block;
    width: 3rem;
    height: 3px;
    background: var(--site-color);
    margin-top: 0.6rem;
    border-radius: 2px;
}
/* Cinematic mode: pulsing category badge */
/* Fix #10: Replace box-shadow animation with transform for GPU-accelerated performance.
   box-shadow causes continuous repaint — transform runs on the compositor thread. */
@keyframes bfm-badge-pulse {
    0%, 100% { transform: scale(1);   opacity: 1; }
    50%       { transform: scale(1.08); opacity: 0.85; }
}
.post-header-cinematic-content .post-meta-terms .term-name a {
    animation: bfm-badge-pulse 2.5s ease infinite;
    will-change: transform;
}

