/**
 * Main Stylesheet - Coreiten
 * Modern, clean design with RTL support
 */


/* =========================================
   CSS Variables / Design Tokens
   ========================================= */
:root {
    /* Colors - Premium Gold/Amber (Primary) */
    --primary-50: #fffbeb;
    --primary-100: #fef3c7;
    --primary-200: #fde68a;
    --primary-300: #fcd34d;
    --primary-400: #fbbf24;
    --primary-500: #f59e0b;
    --primary-600: #d97706;
    --primary-700: #b45309;
    --primary-800: #92400e;
    --primary-900: #78350f;

    /* Secondary - Soft Warm Indigo/Gray */
    --secondary-500: var(--primary-500);
    --secondary-600: var(--primary-600);

    --success-500: #10b981;
    --error-500: #ef4444;
    --warning-500: #f59e0b;

    /* Neutrals - Warm Grays for better eye comfort */
    --gray-50: #fafaf9;
    --gray-100: #f5f5f4;
    --gray-200: #e7e5e4;
    --gray-300: #d6d3d1;
    --gray-400: #a8a29e;
    --gray-500: #78716c;
    --gray-600: #57534e;
    --gray-700: #44403c;
    --gray-800: #292524;
    --gray-900: #1c1917;

    /* Light Theme Colors (Comfortable & Premium) */
    --bg-primary: #ffffff;
    --bg-secondary: #fafaf9;
    /* Warm off-white */
    --bg-tertiary: #f5f5f4;
    --bg-card: #ffffff;

    --text-primary: #292524;
    --text-secondary: #57534e;
    --text-tertiary: #78716c;
    --text-inverse: #ffffff;

    --border-color: #e7e5e4;
    --border-hover: #d6d3d1;

    --border-700: #d97706;
    --border-600: #f59e0b;
    --border-500: #fbbf24;
    --border-400: #fcd34d;

    /* Gradients */
    --gradient-primary: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-secondary: linear-gradient(135deg, #292524 0%, #44403c 100%);
    --gradient-hero: linear-gradient(135deg, #fffbeb 0%, #fdfbf7 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

    /* Shadows - Softer and more diffused */
    --shadow-sm: 0 1px 2px 0 rgba(28, 25, 23, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(28, 25, 23, 0.05), 0 2px 4px -2px rgba(28, 25, 23, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(28, 25, 23, 0.05), 0 4px 6px -4px rgba(28, 25, 23, 0.025);
    --shadow-xl: 0 20px 25px -5px rgba(28, 25, 23, 0.05), 0 8px 10px -6px rgba(28, 25, 23, 0.025);
    --shadow-2xl: 0 25px 50px -12px rgba(28, 25, 23, 0.1);
    --shadow-card: 0 8px 30px rgba(28, 25, 23, 0.04);

    /* Border Radius */
    --radius-sm: 0.1875rem;
    --radius-md: 0.25rem;
    --radius-lg: 0.375rem;
    --radius-xl: 0.5rem;
    --radius-2xl: 0.625rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Typography */
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-arabic: 'Cairo', 'Inter', sans-serif;

    /* Spacing */
    --container-max: 1400px;
    --header-height: 62px;

    /* Semantic Interactions (Easily controllable degrees) */
    --hover-bg: var(--primary-50);
    --hover-text: var(--primary-600);
    --active-text: var(--primary-600);

    /* Layout */
    --header-bg: rgba(61, 57, 51, 0.9);
}

/* Dark Mode Overrides for Universal Best Practices */
:root.dark-mode {
    --bg-primary: #050505;
    --bg-secondary: #181818;
    /* Body background (very dark) */
    --bg-tertiary: #1f1f1f;
    --bg-card: #151515;
    /* Cards and sidebars (lighter than body) */

    /* Universal Header and Footer Colors */
    --gray-900: #0a0a0a;
    --header-bg: rgba(10, 10, 10, 0.9);

    --text-primary: #e0e0e0;
    /* High legibility off-white */
    --text-secondary: #a0a0a0;
    --text-tertiary: #757575;
    --text-inverse: #121212;

    --border-color: #333333;
    --border-hover: #4a4a4a;

    --gradient-hero: linear-gradient(135deg, #292724 0%, #0a0a0a 100%);

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.5), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
    --shadow-card: 0 8px 30px rgba(0, 0, 0, 0.4);

    /* Semantic Interactions (Easily controllable degrees) */
    --hover-bg: rgba(245, 158, 11, 0.15);
    /* Light primary tint for dark mode */
    --hover-text: var(--primary-400);
    /* Lighter, more readable primary in dark mode */
    --active-text: var(--primary-400);
}

/* Auto Internal Links
 *
 * Exactly ONE line, never two. `text-decoration: none` below loses to
 * `.article-body a { text-decoration: underline }`, so the dotted border-bottom
 * this rule used to add landed UNDER the inherited underline — two lines at rest
 * and a third weight change on hover.
 *
 * These links sit inside running prose, so unlike the "Read also" list they do
 * need a non-colour affordance (WCAG 1.4.1). A single underline pushed to a 5px
 * offset clears the dots and descenders Arabic hangs below the baseline
 * (ي ب ن ج …), which is what made the old style hard to read.
 */
.auto-internal-link {
    color: var(--primary-500);
    text-decoration: none;
    transition: background var(--transition-fast), text-decoration-thickness var(--transition-fast);
}

.article-body .auto-internal-link {
    border-bottom: 0;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 5px;
    padding: 0 1px;
    border-radius: 3px;
}

.article-body .auto-internal-link:hover,
.article-body .auto-internal-link:focus-visible {
    background: var(--hover-bg);
    text-decoration-thickness: 2px;
}

/* =========================================
   Base Styles
   ========================================= */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html {
    -webkit-text-size-adjust: 100%;
    background-color: var(--bg-secondary);
    /* clip prevents horizontal overflow without creating a scroll container,
       which lets position:sticky on .main-header work correctly */
    overflow-x: clip;
}

body {
    font-family: var(--font-sans);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    position: relative;
    overflow-x: clip;
    max-width: 100%;
}



body.rtl {
    font-family: var(--font-arabic);
    direction: rtl;
}

/* AdSense Container Protection */
.ad-slot-container {
    max-width: 100% !important;
    overflow: hidden !important;
    display: block !important;
    text-align: center !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0 !important;
    contain: layout paint;
}

.adsbygoogle {
    max-width: 100% !important;
    overflow: hidden !important;
    margin: 10px auto !important;
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

.ad-slot-container iframe,
.ad-slot-container ins {
    max-width: 100% !important;
}

/* Prevent full-width-responsive ads from breaking out of parent on mobile */
@media (max-width: 768px) {
    .ad-slot-container ins.adsbygoogle[data-full-width-responsive="true"] {
        margin-left: 0 !important;
        margin-right: 0 !important;
        max-width: 100% !important;
    }

    .ad-slot-container iframe,
    .ad-slot-container ins {
        max-width: 100% !important;
    }
}

/* Block Auto Ads inside Article Cards */
.article-card .google-auto-placed,
.article-card-mini .google-auto-placed,
.popular-item .google-auto-placed {
    display: none !important;
}

/* Targeted Overflow Protection */
.main-content,
.main-footer {
    overflow-x: hidden !important;
    width: 100%;
}

a {
    color: inherit;
    text-decoration: none;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

ul,
ol {
    list-style: none;
}

/* =========================================
   Utility Classes
   ========================================= */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem;
}

@media (max-width: 480px) {
    .container {
        padding: 0 1rem;
    }
}

.rtl-text {
    direction: rtl;
    text-align: right;
}

/* =========================================
   Header Styles
   ========================================= */
.main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--header-bg);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-color);
    height: var(--header-height);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-height);
    gap: 1rem;
}

/* Left group in LTR (burger + logo), becomes right group in RTL */
.header-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* Positioning context for the absolutely placed AI-summary header button */
    position: relative;
}

/* Burger button container */
.burger-btn-container {
    display: flex;
    align-items: center;
}



/* Logo */
.logo {
    display: flex;
    align-items: center;
    gap: 0.1rem;
    font-weight: 700;
    font-size: 1.5rem;
    color: #ffffff;
    transition: transform var(--transition-fast);
}


.logo:hover {
    transform: scale(1.02);
}

.logo-icon {
    font-size: 1.75rem;
}

.logo-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Navigation */
.main-nav {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.625rem 1rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    font-size: 0.9375rem;
    color: #e7e5e4;
    transition: all var(--transition-normal);
    position: relative;
}

.nav-link:hover {
    color: var(--hover-text);
}

.nav-link.active {
    color: var(--active-text);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 1rem;
    right: 1rem;
    height: 2px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform var(--transition-normal);
}

.nav-link:hover::after,
.nav-link.active::after {
    transform: scaleX(1);
}

.rtl .nav-link::after {
    transform-origin: right;
}

/* Dropdown Menus — see "Submenu Dropdown Styles" section below */

.submenu-item-wrapper {
    position: relative;
}

.nested-arrow {
    font-size: 0.875rem;
    opacity: 0.5;
    margin-left: auto;
    padding-left: 0.5rem;
}

.rtl .nested-arrow {
    margin-left: 0;
    margin-right: auto;
    padding-left: 0;
    padding-right: 0.5rem;
    transform: rotate(180deg);
}

/* Nested Submenu (Level 3+) */
.nested-submenu {
    position: absolute;
    left: 100%;
    top: 0;
    min-width: 180px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateX(-10px);
    transition: all var(--transition-normal);
    z-index: 51;
    padding: 0.5rem;
}

.rtl .nested-submenu {
    left: auto;
    right: 100%;
    transform: translateX(10px);
}

.submenu-item-wrapper:hover .nested-submenu {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.nested-link {
    display: block;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.8125rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.nested-link:hover {
    background: var(--hover-bg);
    color: var(--hover-text);
}

/* Header Actions */
.header-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* Language Switcher */
.language-switcher {
    position: relative;
}

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.25rem;
    background: transparent;
    font-size: 0.875rem;
    font-weight: 500;
    color: #e7e5e4;
    transition: color var(--transition-fast);
}

.lang-toggle:hover {
    color: var(--primary-500);
}

.lang-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 140px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 50;
}

.rtl .lang-dropdown {
    right: auto;
    left: 0;
}

.language-switcher:hover .lang-dropdown,
.language-switcher.active .lang-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.lang-option {
    display: block;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-fast);
}

.lang-option:first-child {
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.lang-option:last-child {
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

.lang-option:hover {
    background: var(--hover-bg);
    color: var(--hover-text);
}

.lang-option.active {
    background: var(--hover-bg);
    color: var(--hover-text);
    font-weight: 600;
}

/* Theme Toggle */
.theme-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    padding: 4px;
    color: #e7e5e4;
    transition: color var(--transition-fast);
    cursor: pointer;
}

.theme-toggle:hover {
    color: var(--primary-500);
}

.theme-toggle svg {
    display: block;
    transition: color var(--transition-fast);
}

.theme-toggle .moon-icon {
    display: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
    display: none;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border-radius: var(--radius-lg);
}

.mobile-menu-toggle span {
    width: 20px;
    height: 2px;
    background: var(--primary-500);
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

/* Mobile Navigation */
.mobile-nav {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    padding: 1rem;
    z-index: 99;
    flex-direction: column;
    gap: 0.25rem;
}

.mobile-nav.active {
    display: flex;
}

.mobile-nav-link {
    padding: 0.875rem 1rem;
    border-radius: var(--radius-lg);
    font-weight: 500;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.mobile-nav-link:hover {
    background: var(--hover-bg);
    color: var(--hover-text);
}

/* =========================================
   Articles Section
   ========================================= */
.articles-section {
    padding-bottom: 3rem;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
}

.section-line {
    flex: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--border-600) 0%, transparent 100%);
    border-radius: var(--radius-full);
}

.rtl .section-line {
    background: linear-gradient(-90deg, var(--border-600) 0%, transparent 100%);
}

/* Articles Grid */
.articles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Recent Articles List (Sidebar & Related) */
.recent-articles-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    min-height: 250px;
    /* Prevent layout collapse during AJAX load */
}

/* Article Card */
.article-card {
    background: var(--bg-card);
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-normal);
    border: 1px solid var(--border-color);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.article-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-xl);
    border-color: var(--primary-400);
}

.article-image {
    position: relative;
    aspect-ratio: 16/10;
    overflow: hidden;
    background: var(--bg-tertiary);
}

.article-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.article-card:hover .article-image img {
    transform: scale(1.1);
}

.article-category {
    position: absolute;
    top: 1rem;
    left: 1rem;
    padding: 0.4rem 0.8rem;
    background: rgba(30, 30, 30, 0.85);
    /* Dark surface matching the #1e1e1e theme */
    backdrop-filter: blur(8px);
    color: #e0e0e0;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: var(--radius-sm);
    text-transform: uppercase;
    letter-spacing: 1px;
    z-index: 2;
}

.rtl .article-category {
    left: auto;
    right: 1rem;
}

.article-content {
    padding: 1.25rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.article-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-700);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

/* MINI CARD meta styling */
.article-card-mini .article-meta {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    opacity: 0.8;
    font-size: 0.75rem;
    display: flex;
    gap: 0.75rem;
    color: var(--text-tertiary);
}

.article-title {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.5;
    margin-bottom: 0.85rem;
}

.article-title a {
    color: var(--text-primary);
    transition: color var(--transition-fast);
}

.article-title a:hover {
    color: var(--primary-600);
}

.dark-mode .article-title a:hover {
    color: var(--hover-text);
}

.article-excerpt {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 1.25rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.read-more {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--primary-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.read-more .arrow {
    transition: transform var(--transition-normal);
}

.read-more:hover .arrow {
    transform: translateX(4px);
}

.rtl .read-more:hover .arrow {
    transform: translateX(-4px);
}

/* =========================================
   Pagination
   ========================================= */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border-color);
}

.page-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-weight: 500;
    font-size: 0.875rem;
    color: var(--text-secondary);
    transition: all var(--transition-normal);
}

.page-link:hover {
    background: var(--primary-50);
    border-color: var(--primary-200);
    color: var(--primary-600);
}

.page-link.number {
    padding: 0.75rem 1rem;
}

.page-link.active {
    background: var(--gradient-primary);
    border-color: transparent;
    color: white;
}

.page-link.active:hover {
    background: var(--gradient-primary);
    color: white;
}

.page-numbers {
    display: flex;
    gap: 0.25rem;
}

/* =========================================
   Single Article Page
   ========================================= */
.single-article {
    max-width: 800px;
    margin: 0 auto 3rem;
}

.article-header {
    text-align: center;
    margin-bottom: 2rem;
}

.article-category-badge {
    display: inline-block;
    padding: 0.5rem 1.25rem;
    background: var(--gradient-primary);
    color: white;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 1.25rem;
}

.single-article .article-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.single-article .article-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem 1.25rem;
    border-top: 1.5px solid var(--border-700);
    /* Row gap, Col gap */
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-top: 1rem;
}

.meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
    position: relative;
}

/* Add separator dot after items, except the last one */
.single-article .meta-item:not(:last-child)::after {
    content: "\2022";
    position: absolute;
    right: -0.8rem;
    /* Use right for LTR, we'll fix for RTL */
    color: var(--text-tertiary);
    opacity: 0.5;
    font-size: 0.8em;
}

/* RTL Support for separator */
.rtl .single-article .meta-item:not(:last-child)::after {
    right: auto;
    left: -0.8rem;
}

/* Article Page Layout (Two-Column) */
.article-layout-container {
    display: flex;
    flex-wrap: wrap;
    gap: 40px;
    margin-top: 20px;
}

.article-main-col {
    flex: 1;
    min-width: 0;
    max-width: 100%;
}

.article-sidebar-col {
    width: 340px;
    flex-shrink: 0;
}

@media (max-width: 992px) {
    .article-layout-container {
        flex-direction: column;
    }

    .article-sidebar-col {
        width: 100%;
    }
}

/* =========================================
   Shared breadcrumbs
   (article, category and news templates)
   ========================================= */
.breadcrumbs {
    margin-bottom: 20px;
    font-size: 0.95rem;
    color: var(--text-secondary);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.breadcrumb-item {
    display: inline-flex;
    align-items: center;
}

.breadcrumb-separator {
    margin: 0 5px;
    opacity: 0.5;
    font-size: 0.8em;
}

.breadcrumb-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-link:hover {
    color: var(--primary-color, var(--primary-600));
}

.breadcrumb-current {
    color: var(--text-primary, #292524);
    font-weight: 500;
    opacity: 0.8;
}

/* =========================================
   Article body — featured image and prose
   ========================================= */
.article-featured-image {
    margin-bottom: 2rem;
    border-radius: var(--radius-xl);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.article-featured-image img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

.article-body {
    font-size: 1.5rem;
    line-height: 1.8;
    color: var(--text-primary);
    font-family: var(--font-sans);
}

.rtl .article-body {
    font-family: var(--font-arabic);
    line-height: 2.1;
    word-spacing: 0.08em;
}



.article-body p {
    margin-bottom: 1.5rem;
}

/* Fix Lists Integration */
.article-body ul,
.article-body ol {
    margin: 1.5rem 0;
    padding-right: 2rem;
    padding-left: 2rem;
    list-style-position: outside;
}

.rtl .article-body ul,
.rtl .article-body ol {
    padding-left: 0;
    padding-right: 2rem;
}

.article-body ul {
    list-style-type: disc;
}

.article-body ol {
    list-style-type: decimal;
    counter-reset: step-counter;
}

.article-body ol>li {
    margin-bottom: 1rem;
    padding-left: 0.75rem;
}

.rtl .article-body ol>li {
    padding-left: 0;
    padding-right: 0.75rem;
}

.article-body ol>li strong:first-child {
    color: var(--primary-600, #d97706);
    font-size: 1.05em;
}

.dark-mode .article-body ol>li strong:first-child {
    color: var(--primary-400, var(--primary-400));
}

/* Sub-step Explanations (AI output wraps these in EM) */
.article-body ol>li em,
.article-body ul>li em {
    display: block;
    margin-top: 0.6rem;
    margin-bottom: 0.5rem;
    font-size: 0.9em;
    color: #334155;
    /* Deeper, high-contrast slate-700 manually set for light mode */
    font-style: normal;
    /* Keeps long paragraphs readable */
    line-height: 1.6;
    padding-inline-start: 1rem;
    border-inline-start: 2px solid var(--border-color, #e7e5e4);
}

.dark-mode .article-body ol>li em,
.dark-mode .article-body ul>li em {
    color: var(--text-secondary);
    /* Brighter, glowing slate for dark mode (but below primary white) */
    border-color: rgba(255, 255, 255, 0.15);
}

.article-body li {
    margin-bottom: 0.75rem;
    padding-left: 0.5rem;
}

.rtl .article-body li {
    padding-left: 0;
    padding-right: 0.5rem;
}

/* Article Headings - Centered & Premium */
.article-body h2,
.article-body h3 {
    text-align: center;
    margin: 2.5rem 0 1.5rem;
    font-weight: 800;
    line-height: 1.3;
    color: var(--text-primary);
    position: relative;
    scroll-margin-top: 0 !important;
}

/* Sub-headings (H4) - Left/Right aligned dynamically */
.article-body h4 {
    text-align: start;
    margin: 2.5rem 0 1.25rem;
    font-size: 1.65rem;
    /* Larger than 1.45rem body text */
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    scroll-margin-top: 0 !important;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color, #e7e5e4);
    position: relative;
    display: flex;
    align-items: center;
}

.dark-mode .article-body h4 {
    border-color: rgba(255, 255, 255, 0.1);
}

.article-body h4::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 1.1em;
    background: var(--gradient-primary, var(--primary-500));
    border-radius: 2px;
    margin-inline-end: 0.75rem;
}

/* Anchor Hack Removed - Handled by JS */

/* Normalized Container for Headings (Legacy Fix) */
.article-section-header {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 1.5rem;
    margin: 2rem 0 2rem;
    text-align: center;
    box-shadow: var(--shadow-md);
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

.article-section-header:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-300);
    transform: translateY(-2px);
}

/* Modern accent line inside container */
.article-section-header::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: var(--radius-full) var(--radius-full) 0 0;
}

.article-section-header h2,
.article-section-header h3,
.article-section-header h4 {
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
    background: none !important;
    border: none !important;
    color: inherit !important;
    scroll-margin-top: 0 !important;
}

/* Dark Mode Overrides for Headers */
.dark-mode .article-section-header {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

/* Fix: Make links inside article content visible */
.article-body a {
    color: var(--primary-500);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 4px;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.article-body a:hover {
    color: var(--primary-700);
    text-decoration-thickness: 2px;
}

.article-share {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem;
    background: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    margin-top: 2rem;
    /* border: 1.5px solid var(--accent-color, var(--primary-500)); */
}

.share-label {
    font-weight: 600;
    color: var(--text-primary);
}

.share-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.share-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: white;
    transition: filter var(--transition-normal);
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

.share-btn:hover,
.share-btn:focus,
.share-btn:active {
    filter: brightness(0.85);
    transform: none !important;
    box-shadow: none !important;
}

.share-btn.twitter {
    background: #000;
}

.share-btn.facebook {
    background: #1877f2;
}

.share-btn.linkedin {
    background: #0a66c2;
}

.share-btn.whatsapp {
    background: #25D366;
}

.share-btn.telegram {
    background: #0088cc;
}

.share-btn.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
}

/* =========================================
   Sidebar
   (article AND listing pages — do not fold
   this back into the article section above)
   ========================================= */
.article-sidebar {
    position: sticky;
    top: calc(var(--header-height) + 2rem);
}

.sidebar-widget {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

/* Table of Contents Heading */
.toc-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    margin-bottom: 0;
    color: var(--text-primary);
}

.widget-title {
    font-size: 1.125rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.recent-article-item {
    display: flex;
    gap: 1rem;
    padding: 1rem 0;
    margin: 0;
    border-bottom: 1px solid var(--border-color);
    transition: background var(--transition-normal);
}

.recent-article-item:last-child {
    border-bottom: none;
}

.recent-article-item:hover .recent-article-info h4,
.recent-article-item:hover .recent-article-info .recent-article-title {
    color: var(--primary-600);
}

.dark-mode .recent-article-item:hover .recent-article-info h4,
.dark-mode .recent-article-item:hover .recent-article-info .recent-article-title {
    color: var(--hover-text);
}

.recent-article-thumb {
    width: 70px;
    height: 50px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.recent-article-thumb.placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    font-size: 1.25rem;
}

.recent-article-info h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.recent-article-date {
    font-size: 0.75rem;
    color: var(--text-tertiary);
}

.categories-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0;
    margin: 0;
    list-style: none;
}

.categories-list li a {
    display: block;
    padding: 0.625rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: all var(--transition-normal);
}

.categories-list li a:hover {
    color: var(--primary-600);
}

/* =========================================
   Footer
   ========================================= */
.main-footer {
    background: var(--gray-900);
    color: var(--gray-300);
    padding: 4rem 0 0;
    margin-top: 4rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    padding-bottom: 3rem;
    border-bottom: 1px solid var(--gray-800);
}

.footer-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 1rem;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.footer-desc {
    font-size: 0.9375rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

/* Arabic-only brand alias/slogan shown under the footer logo. Kept as real,
   visible, crawlable text (never display:none) so the site stays findable when
   users search the Arabic name. */
.footer-brand-alt {
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0.25rem 0 1rem;
    opacity: 0.85;
    letter-spacing: 0.2px;
}

.footer-section h4 {
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 1rem;
}

.footer-links {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.footer-links a {
    font-size: 0.9375rem;
    color: var(--gray-400);
    transition: color var(--transition-fast);
}

.footer-links a:hover {
    color: var(--primary-400);
}

.footer-bottom {
    padding: 1.5rem 0;
    text-align: center;
    font-size: 0.875rem;
    color: var(--gray-500);
}

.footer-legal-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.footer-legal-links a,
.footer-legal-links button {
    color: var(--gray-400);
    transition: color var(--transition-fast);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
}

.footer-legal-links a:hover,
.footer-legal-links button:hover {
    color: var(--primary-400);
}

/* =========================================
   Buttons
   ========================================= */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--gradient-primary);
    color: white;
    font-weight: 600;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-normal);
    border: none;
    cursor: pointer;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(245, 158, 11, 0.35);
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    background: var(--bg-card);
    color: var(--text-primary);
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-normal);
    cursor: pointer;
}

.btn-secondary:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-hover);
}

/* Hide mobile-only sections on desktop by default */
.mobile-only {
    display: none;
}

/* =========================================
   Responsive Design
   ========================================= */
@media (max-width: 1200px) {
    .main-nav {
        display: none;
    }

    .mobile-menu-toggle {
        display: flex;
    }

    .mobile-only {
        display: block;
    }
}

@media (max-width: 768px) {
    .hero-section {
        padding: 3rem 1rem;
        margin-bottom: 2rem;
    }

    .hero-title {
        font-size: 1.75rem;
    }

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

    .single-article .article-title {
        font-size: 1.5rem;
    }

    .article-body {
        font-size: 1.35rem;
    }

    .article-share {
        flex-direction: column;
        text-align: center;
    }

    .footer-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .pagination {
        flex-wrap: wrap;
    }
}

@media (max-width: 480px) {
    .article-content {
        padding: 1rem;
    }

    .breadcrumbs {
        font-size: 0.8rem;
        gap: 4px;
    }

    .single-article .article-title {
        font-size: 1.4rem;
    }

    .single-article .article-meta {
        font-size: 0.9rem;
        gap: 0.4rem 0.8rem;
    }
}

/* =========================================
   Submenu Dropdown Styles
   ========================================= */
.nav-item-wrapper {
    position: relative;
}

.nav-item-wrapper .nav-link {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.dropdown-arrow {
    font-size: 0.625rem;
    margin-left: 0.25rem;
    transition: transform var(--transition-normal);
    opacity: 0.6;
}

.rtl .dropdown-arrow {
    margin-left: 0;
    margin-right: 0.25rem;
}

.nav-item-wrapper:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.submenu-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    z-index: 60;
}

.rtl .submenu-dropdown {
    left: auto;
    right: 0;
}

.nav-item-wrapper:hover .submenu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.submenu-link:hover {
    color: var(--primary-600);
}

/* =========================================
   Burger Menu Styles
   ========================================= */
.burger-menu-toggle {
    display: flex;
    width: 44px;
    height: 44px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.burger-menu-toggle span {
    width: 20px;
    height: 2px;
    background: #d7d7d7;
    border-radius: var(--radius-full);
    transition: all var(--transition-normal);
}

/* .burger-menu-toggle:hover {
    background: var(--primary-50);
}

.dark-mode .burger-menu-toggle:hover {
    background: rgba(245, 158, 11, 0.15);
} */

.burger-menu-toggle:hover span {
    background: var(--primary-600);
    filter: brightness(1.1);
}

.burger-menu-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.burger-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.burger-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(5px, -5px);
}

.burger-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 320px;
    height: 100vh;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform var(--transition-normal);
    will-change: transform;
}

.rtl .burger-menu {
    left: auto;
    right: 0;
    transform: translateX(100%);
}

.burger-menu.active {
    transform: translateX(0);
}

.rtl .burger-menu.active {
    transform: translateX(0);
}

.burger-menu-content {
    position: relative;
    z-index: 2;
    width: 100%;
    height: 100%;
    background: var(--bg-card);
    box-shadow: var(--shadow-2xl);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.burger-menu-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.burger-menu-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-primary);
}

.burger-menu-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border-radius: var(--radius-md);
    color: #cbcbcb;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.burger-menu-close:hover {
    color: var(--primary-600);
}

.burger-nav {
    flex: 1;
    padding: 1rem;
    padding-bottom: 110px;
    /* Clear elevated mobile bottom nav pill */
    overflow-y: auto;
}

.burger-section {
    margin-bottom: 1.5rem;
}

.burger-section-title {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    padding: 0.5rem 1rem;
    margin-bottom: 0.5rem;
}

.burger-nav-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    color: var(--text-secondary);
    border-radius: var(--radius-lg);
    font-weight: 500;
    transition: all var(--transition-fast);
}

.burger-nav-link:hover {
    color: var(--primary-600);
}

.dark-mode .burger-nav-link:hover {
    color: var(--hover-text);
}

.burger-submenu {
    padding-left: 2rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.rtl .burger-submenu {
    padding-left: 1rem;
    padding-right: 2rem;
}

.burger-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1;
    opacity: 0;
    visibility: hidden;
    transition: opacity 250ms ease, visibility 250ms ease;
}

.burger-menu.active .burger-menu-overlay {
    opacity: 1;
    visibility: visible;
}



/* =========================================
   Article Reactions (Like/Dislike)
   ========================================= */
.article-reactions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    padding: 2rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    margin-top: 2rem;
    text-align: center;
    border-inline-start: 4px solid var(--primary-500);
    /* border: 1.5px solid var(--accent-color, var(--primary-500)); */
}

.reactions-label {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
}

.reactions-buttons {
    display: flex;
    gap: 1rem;
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.reaction-btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.reaction-btn.like-btn:hover,
.reaction-btn.like-btn.active {
    background: #dcfce7;
    border-color: #22c55e;
    color: #16a34a;
}

.reaction-btn.dislike-btn:hover,
.reaction-btn.dislike-btn.active {
    background: #fee2e2;
    border-color: #ef4444;
    color: #dc2626;
}

.reaction-icon {
    font-size: 1.25rem;
}

.reaction-count {
    font-weight: 700;
}

/* =========================================
   Article Author Box
   ========================================= */
.article-author-box {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    padding: 1.5rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-xl);
    margin-top: 2rem;
    border-inline-start: 4px solid var(--primary-500);
}

.author-box-avatar img {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--primary-200);
    flex-shrink: 0;
}

.author-box-placeholder {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-500), var(--secondary-500));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    text-decoration: none;
    flex-shrink: 0;
}

.author-box-info {
    flex: 1;
    min-width: 0;
}

.author-box-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-tertiary);
    font-weight: 600;
}

.author-box-name {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    margin: 0.15rem 0 0.4rem;
    transition: color 0.2s;
}

.author-box-name:hover {
    color: var(--primary-600);
}

.author-box-bio {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--text-secondary);
    margin: 0;
}

.author-meta-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.author-meta-link:hover {
    color: var(--primary-600);
}

@media (max-width: 576px) {
    .article-author-box {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem;
        border-inline-start: none;
        border-top: 4px solid var(--primary-500);
    }

    .article-reactions {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 1.25rem;
        border-inline-start: none;
        border-bottom: 4px solid var(--primary-500);
    }
}

/* Views counter styling */
.meta-views {
    /* background: var(--bg-tertiary); */
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-weight: 500;
}

/* =========================================
   Breaking News Ticker (Refined)
   ========================================= */
.news-ticker {
    background: transparent;
    border-bottom: 1px solid var(--border-color);
    height: 44px;
    display: flex;
    align-items: center;
    position: relative;
    z-index: 90;
}

.ticker-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    overflow: hidden;
}

.ticker-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.ticker-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    line-height: 1;
}

.ticker-wrapper {
    flex: 1;
    min-width: 0;
    position: relative;
    display: flex;
    align-items: center;
}

.ticker-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.2s;
    display: inline-block;
    max-width: 100%;
}

.ticker-title:hover {
    color: var(--primary-600);
}

/* Typing Cursor Effect */
.ticker-title::after {
    content: '';
    display: inline-block;
    width: 2px;
    height: 1em;
    background-color: var(--primary-500);
    margin-inline-start: 4px;
    vertical-align: middle;
    animation: ticker-blink 0.8s infinite;
}

@keyframes ticker-blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0;
    }
}

.ticker-nav {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.ticker-nav-btn {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    background: var(--gray-100);
    color: var(--text-secondary);
    transition: all 0.2s;
    cursor: pointer;
    border: none;
}

.ticker-nav-btn svg {
    width: 16px;
    height: 16px;
}

.dark-mode .ticker-nav-btn {
    background: rgba(255, 255, 255, 0.05);
}

.ticker-nav-btn:hover {
    background: var(--primary-500);
    color: white;
}

.rtl .ticker-nav-btn svg {
    transform: rotate(180deg);
}

/* Mobile responsive ellipsis tweak */
@media (max-width: 768px) {
    .news-ticker {
        height: 48px;
    }

    .ticker-container {
        padding: 0 1rem;
    }

    .ticker-title {
        font-size: 0.85rem;
    }

    /* Enforce ellipsis on mobile to show three dots before arrows */
    .ticker-wrapper {
        margin-inline-end: 0.5rem;
    }
}

/* Additional Layout Tweaks */
.main-content {
    padding-top: 2rem;
}

/* Section Styling — defined above in section-header block */

/* =========================================
   Premium Newsletter UI
   ========================================= */
.newsletter-premium {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    isolation: isolate;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
}

.newsletter-premium:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-300);
}

.dark-mode .newsletter-premium:hover {
    border-color: var(--primary-500);
}

/* Glow Effect for Tactile Maximalism */
.newsletter-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(217, 119, 6, 0.15) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
    transition: opacity 0.4s ease;
}

.dark-mode .newsletter-glow {
    background: radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.25) 0%, transparent 60%),
        radial-gradient(circle at 0% 100%, rgba(217, 119, 6, 0.25) 0%, transparent 60%);
}

.newsletter-premium:hover .newsletter-glow {
    opacity: 1;
}

/* Sidebar Mode (Vertical) */
.newsletter-sidebar {
    padding: 2rem 1.5rem;
    text-align: center;
}

.newsletter-sidebar .newsletter-header {
    margin-bottom: 1.5rem;
}

.newsletter-sidebar .newsletter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    background: var(--primary-100);
    color: var(--primary-600);
    border-radius: var(--radius-xl);
    margin-bottom: 1rem;
}

.dark-mode .newsletter-sidebar .newsletter-icon {
    background: rgba(245, 158, 11, 0.2);
    color: var(--primary-400);
}

.newsletter-sidebar .newsletter-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.newsletter-sidebar .newsletter-subtitle {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.newsletter-sidebar .input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Inline Mode (Horizontal Bento) */
.newsletter-inline {
    padding: 2.5rem;
    margin: 3rem 0;
}

.newsletter-inline .newsletter-content {
    display: flex;
    align-items: center;
    gap: 3rem;
    width: 100%;
}

.newsletter-inline .newsletter-header {
    flex: 1;
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
}

.newsletter-inline .newsletter-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--primary-100);
    color: var(--primary-600);
    border-radius: var(--radius-xl);
    flex-shrink: 0;
}

.dark-mode .newsletter-inline .newsletter-icon {
    background: var(--hover-bg);
    color: var(--primary-400);
}

.newsletter-inline .newsletter-text {
    flex: 1;
}

.newsletter-inline .newsletter-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.newsletter-inline .newsletter-subtitle {
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

.newsletter-inline .newsletter-premium-form {
    flex: 1;
    max-width: 400px;
    width: 100%;
}

.newsletter-inline .input-group {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-primary);
    padding: 0.35rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-color);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.02);
}

.dark-mode .newsletter-inline .input-group {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.newsletter-inline .newsletter-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 0.75rem 1rem;
}

.newsletter-inline .btn-subscribe {
    flex-shrink: 0;
    padding: 0.75rem 1.5rem;
}

/* Shared Form Elements */
.newsletter-premium-form {
    position: relative;
    z-index: 2;
}

.newsletter-input {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.newsletter-input:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.btn-subscribe {
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 0.95rem;
    border: none;
    padding: 0.85rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
}

.btn-subscribe:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.btn-subscribe:active:not(:disabled) {
    transform: translateY(0);
}

.btn-subscribe:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-loader {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
    position: absolute;
}

.newsletter-msg {
    margin-top: 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    text-align: center;
}

.newsletter-msg.success {
    color: #10b981;
}

.newsletter-msg.error {
    color: #ef4444;
}

.dark-mode .newsletter-msg.success {
    color: #34d399;
}

.dark-mode .newsletter-msg.error {
    color: #f87171;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Rules for Newsletter */
@media (max-width: 900px) {
    .newsletter-inline {
        padding: 2rem;
        text-align: left;
    }

    .newsletter-inline .newsletter-content {
        flex-direction: column;
        gap: 1.5rem;
        align-items: stretch;
    }

    .rtl .newsletter-inline {
        text-align: right;
    }

    .newsletter-inline .newsletter-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .newsletter-inline .newsletter-premium-form {
        max-width: 100%;
    }
}

@media (max-width: 500px) {
    .newsletter-inline .input-group {
        flex-direction: column;
        background: transparent;
        padding: 0;
        border: none;
        box-shadow: none;
        gap: 0.75rem;
    }

    .newsletter-inline .newsletter-input {
        border: 1px solid var(--border-color);
        background: var(--bg-primary);
    }

    .newsletter-inline .btn-subscribe {
        width: 100%;
    }

    .newsletter-sidebar {
        padding: 1.5rem;
    }
}

/* =========================================
   Premium Contact Form UI
   ========================================= */
.contact-premium {
    position: relative;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    overflow: hidden;
    isolation: isolate;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow-sm);
    padding: 2.5rem;
    margin-top: 2rem;
}

.contact-premium:hover {
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-300);
}

.dark-mode .contact-premium:hover {
    border-color: var(--primary-500);
}

.contact-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 100% 0%, rgba(245, 158, 11, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 0% 100%, rgba(217, 119, 6, 0.1) 0%, transparent 50%);
    z-index: -1;
    pointer-events: none;
    opacity: 0.8;
}

.contact-premium-form {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    position: relative;
    z-index: 2;
}

.contact-form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.contact-form-group.full-width {
    grid-column: 1 / -1;
}

.contact-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
}

.contact-input,
.contact-textarea {
    width: 100%;
    padding: 0.85rem 1.25rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    background: var(--bg-primary);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.contact-textarea {
    resize: vertical;
    min-height: 150px;
    line-height: 1.6;
}

.contact-input:focus,
.contact-textarea:focus {
    border-color: var(--primary-500);
    box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.1);
}

.contact-submit-btn {
    grid-column: 1 / -1;
    background: var(--gradient-primary);
    color: white;
    font-weight: 700;
    font-size: 1.05rem;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
}

.contact-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.contact-submit-btn:active:not(:disabled) {
    transform: translateY(0);
}

.contact-submit-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Honeypot field - hidden from users but visible to bots scanning HTML */
.contact-bait {
    display: none !important;
    position: absolute;
    left: -9999px;
}

.contact-msg {
    grid-column: 1 / -1;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    display: none;
}

.contact-msg.success {
    display: block;
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.contact-msg.error {
    display: block;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.dark-mode .contact-msg.success {
    color: #34d399;
}

.dark-mode .contact-msg.error {
    color: #f87171;
}

@media (max-width: 600px) {
    .contact-premium {
        padding: 1.5rem;
    }

    .contact-premium-form {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .contact-form-group {
        grid-column: 1 / -1;
    }
}

/* RESPONSIVE */
@media (max-width: 1024px) {
    .home-container {
        grid-template-columns: minmax(0, 1000px);
        margin-top: 0;
        justify-content: center;
    }

    .home-sidebar {
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }
}

@media (max-width: 900px) {
    .articles-grid-3 {
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
    }
}

@media (max-width: 600px) {

    .articles-grid-3,
    .articles-grid-3-mini {
        grid-template-columns: 1fr;
    }

    .sidebar-block {
        padding: 1.5rem;
        text-align: center;
    }

    .sidebar-title {
        text-align: center;
    }

    .categories-list {
        align-items: center;
    }

    .popular-list {
        align-items: center;
    }

    .popular-item {
        gap: 0.75rem;
        justify-content: center;
        text-align: left;
        /* Keep text left-aligned within the centered container for readability */
    }

    .rtl .popular-item {
        text-align: right;
    }

    .rank-number {
        font-size: 1.5rem;
        min-width: 1.2rem;
    }

    .tech-card {
        text-align: center;
    }

    .newsletter-form {
        align-items: center;
    }

    .newsletter-form input {
        width: 100%;
        text-align: center;
    }

    .newsletter-form .btn-primary {
        width: 100%;
    }
}

/* =========================================
   Dark Mode Styles (Instant - No Flash)
   ========================================= */
/* Removed redundant .dark-mode block to prevent variable conflicts */


.dark-mode .theme-toggle .sun-icon {
    display: none;
}

.dark-mode .theme-toggle .moon-icon {
    display: block;
}

.dark-mode .article-card:hover {
    border-color: var(--primary-400);
}



.dark-mode .form-input,
.dark-mode .form-select,
.dark-mode .form-textarea {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.dark-mode .btn-secondary {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
    color: var(--text-primary);
}

.dark-mode .nav-link:hover,
.dark-mode .nav-link.active {
    color: var(--hover-text);
}

.dark-mode .submenu-link:hover {
    color: var(--hover-text);
}

.dark-mode .article-body a {
    color: var(--primary-400) !important;
}

.dark-mode .article-body a:hover {
    color: var(--hover-text) !important;
}

.dark-mode .categories-list li a:hover {
    color: var(--hover-text);
}

.dark-mode .lang-dropdown {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.dark-mode .page-link {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.dark-mode .sidebar-widget {
    background: var(--bg-card);
    border-color: var(--border-color);
}

.dark-mode .mobile-nav {
    background: var(--bg-card);
}

/* Scrollbar — light mode */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gray-400);
}

/* Scrollbar — dark mode overrides */
.dark-mode ::-webkit-scrollbar-track {
    background: transparent;
}

.dark-mode ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-full);
}

.dark-mode ::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Selection colors */
::selection {
    background: rgba(245, 158, 11, 0.2);
    color: var(--text-primary);
}

.dark-mode ::selection {
    background: rgba(245, 158, 11, 0.3);
    color: #fff;
}

/* =========================================
   Rich Article Content (Tables, Code, Embeds)
   ========================================= */

/* Tables */
.article-body table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
    font-size: 1.15rem;
}

.article-body th,
.article-body td {
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    text-align: inherit;
}

.article-body th {
    background-color: var(--bg-tertiary);
    font-weight: 600;
}

.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    border-radius: 4px;
    /* border: 1px solid var(--border-color); */
}

/* Code Blocks (Prism.js overrides) */
.article-body pre {
    position: relative;
    border-radius: 4px;
    margin: 1.5rem 0;
    padding: 1.25rem 1.5rem !important;
    /* Default padding for plain pre */
    background-color: #1e1e1e !important;
    border: 1px solid #2d2d2d;
    direction: ltr !important;
    text-align: left !important;
    max-width: 100%;
    overflow-x: auto;
    /* Prevent breaking layout */
}

/* Remove padding if the pre contains a code block (handled by .code-block-header & code) */
.article-body pre:has(code) {
    padding: 0 !important;
}

/* Sticky header bar with lang label and copy button */
.code-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 1rem;
    background: #252526;
    border-bottom: 1px solid #2d2d2d;
    border-radius: 4px 4px 0 0;
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Remove the old pseudo-element header */
.article-body pre::before {
    display: none;
}

/* Scrollable code area */
.article-body pre code {
    display: block;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    white-space: pre;
}

.article-body code,
.article-body code[class*="language-"],
.article-body pre[class*="language-"] code {
    font-family: 'Fira Code', 'Consolas', 'Monaco', monospace !important;
    font-size: 1rem !important;
    line-height: 1.7 !important;
    direction: ltr !important;
}

/* Inline code (not inside pre blocks) */
.article-body :not(pre)>code {
    background: var(--bg-tertiary, #f5f5f4);
    padding: 0.15em 0.4em;
    border-radius: 2px;
    font-size: 0.85em;
    color: #e11d48;
    border: 1px solid var(--border-color, #e7e5e4);
}

.dark-mode .article-body :not(pre)>code {
    background: rgba(255, 255, 255, 0.1);
    color: #fb7185;
    border-color: rgba(255, 255, 255, 0.15);
}

/* Language Label — now inside .code-block-header */
.code-lang-label {
    font-size: 0.75rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
    user-select: none;
    pointer-events: none;
    padding: 0.15rem 0.6rem;
    border-radius: 2px;
}

/* Language-specific colors */
.code-lang-label {
    color: #9ca3af;
    background: rgba(255, 255, 255, 0.06);
}

.code-lang-label[data-lang="javascript"],
.code-lang-label[data-lang="js"] {
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
}

.code-lang-label[data-lang="typescript"],
.code-lang-label[data-lang="ts"] {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.code-lang-label[data-lang="python"] {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

.code-lang-label[data-lang="html"] {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.code-lang-label[data-lang="css"] {
    color: var(--primary-400);
    background: rgba(251, 191, 36, 0.1);
}

.code-lang-label[data-lang="bash"],
.code-lang-label[data-lang="shell"] {
    color: #22c55e;
    background: rgba(34, 197, 94, 0.1);
}

.code-lang-label[data-lang="json"] {
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
}

.code-lang-label[data-lang="php"] {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.1);
}

.code-lang-label[data-lang="sql"] {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.1);
}

.code-lang-label[data-lang="java"] {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.code-lang-label[data-lang="csharp"],
.code-lang-label[data-lang="c#"] {
    color: #a855f7;
    background: rgba(168, 85, 247, 0.1);
}

.code-lang-label[data-lang="ruby"] {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

.code-lang-label[data-lang="go"] {
    color: #06b6d4;
    background: rgba(6, 182, 212, 0.1);
}

.code-lang-label[data-lang="rust"] {
    color: #f97316;
    background: rgba(249, 115, 22, 0.1);
}

.code-lang-label[data-lang="yaml"],
.code-lang-label[data-lang="yml"] {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.1);
}

.code-lang-label[data-lang="xml"] {
    color: #22d3ee;
    background: rgba(34, 211, 238, 0.1);
}

.code-lang-label[data-lang="dax"] {
    color: #facc15;
    background: rgba(250, 204, 21, 0.1);
}

.code-lang-label[data-lang="powershell"] {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.1);
}

/* Copy Button — now inside .code-block-header */
.code-copy-btn {
    background: transparent;
    border: 1px solid #444;
    color: #9ca3af;
    padding: 0.25rem 0.75rem;
    border-radius: 2px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.code-copy-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #e5e7eb;
    border-color: #666;
}

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

/* Embeds (YouTube) */
.embed-responsive {
    position: relative;
    padding-bottom: 56.25%;
    /* 16:9 */
    height: 0;
    overflow: hidden;
    margin: 1.5rem 0;
    border-radius: 4px;
    background: #000;
}

.embed-responsive iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Blockquotes */
.article-body blockquote {
    margin: 1.5rem 0;
    padding: 1rem 1.5rem;
    border-left: 4px solid var(--primary-500);
    background: var(--primary-50);
    border-radius: 2px;
    font-style: italic;
}

.rtl .article-body blockquote {
    border-left: none;
    border-right: 4px solid var(--primary-500);
}

/* =========================================
   Dark Mode Content Fixes (Override Inline Styles)
   ========================================= */
.dark-mode .article-body h1,
.dark-mode .article-body h2,
.dark-mode .article-body h3,
.dark-mode .article-body h4,
.dark-mode .article-body h5,
.dark-mode .article-body h6,
.dark-mode .article-body p,
.dark-mode .article-body p>span,
.dark-mode .article-body strong {
    background-color: transparent !important;
    color: var(--text-primary) !important;
}

.dark-mode .article-body a *,
.dark-mode .article-body a strong,
.dark-mode .article-body a span {
    color: var(--primary-400) !important;
}

.dark-mode .article-body a:hover *,
.dark-mode .article-body a:hover strong,
.dark-mode .article-body a:hover span {
    color: var(--hover-text) !important;
}

/* Fix Blockquotes in Dark Mode */
.dark-mode .article-body blockquote {
    background-color: var(--bg-tertiary) !important;
    /* Dark box instead of white */
    color: var(--text-primary) !important;
    border-color: var(--primary-500) !important;
}

/* Fix Tables in Dark Mode */
.dark-mode .article-body table,
.dark-mode .article-body tr,
.dark-mode .article-body td {
    background-color: transparent !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

.dark-mode .article-body th {
    background-color: var(--bg-tertiary) !important;
    color: var(--text-primary) !important;
    border-color: var(--border-color) !important;
}

/* =========================================
   Contextual Search (Knowledge Key)
   ========================================= */
.knowledge-tooltip {
    position: absolute;
    z-index: 1000;
    max-width: 350px;
    top: 0;
    left: 0;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    padding: 0;
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.2s ease, transform 0.2s ease;
    visibility: hidden;
    overflow: hidden;
    font-family: var(--font-sans);
    direction: rtl;
    /* Default for Arabic */
}

/* Fix for LTR pages if checks context */
body:not(.rtl) .knowledge-tooltip {
    direction: ltr;
}

.knowledge-tooltip.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.knowledge-tooltip-header {
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.knowledge-term {
    font-weight: 700;
    color: var(--primary-600);
    font-size: 0.95rem;
}

.knowledge-close {
    cursor: pointer;
    color: var(--text-tertiary);
    font-size: 1.25rem;
    line-height: 1;
}

.knowledge-close:hover {
    color: var(--error-500);
}

.knowledge-results {
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.knowledge-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: var(--radius-lg);
    transition: background 0.2s ease;
    text-decoration: none;
    color: inherit;
}

.knowledge-item:hover {
    background: none;
}

.knowledge-item:hover .knowledge-item-title {
    color: var(--primary-600);
}

.knowledge-item img {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    object-fit: cover;
    flex-shrink: 0;
}

.knowledge-item-content {
    flex: 1;
    min-width: 0;
}

.knowledge-item-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.1rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.knowledge-item-title:hover {
    color: var(--primary-600);
}

.knowledge-loading {
    padding: 1.5rem;
    text-align: center;
    color: var(--text-tertiary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.knowledge-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--primary-200);
    border-top-color: var(--primary-600);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

/* Dark Mode Support */
.dark-mode .knowledge-tooltip {
    background: color-mix(in srgb, var(--bg-card) 95%, transparent);
    border-color: var(--border-color);
}

.dark-mode .knowledge-tooltip-header {
    background: color-mix(in srgb, var(--bg-primary) 50%, transparent);
    border-color: var(--border-color);
}

.dark-mode .knowledge-item:hover {
    background: none;
}

.dark-mode .knowledge-item:hover .knowledge-item-title {
    color: var(--hover-text);
}

.dark-mode .knowledge-item-title {
    color: var(--text-primary);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* استهداف العنصر بناءً على النص الداخلي والخصائص */
div[aria-label="Privacy and cookie settings"],
div[title="Privacy and cookie settings"],
div.fc-consent-revocation,
.google-revocation-link-placeholder {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
    z-index: -99999 !important;
    height: 0 !important;
    width: 0 !important;
    position: fixed !important;
    bottom: -500px !important;
}

/* في حالة كان داخل عنصر يحمل هذا المعرف */
#fc-consent-revocation {
    display: none !important;
}

/* =========================================
   Search Toggle & Overlay Styles
   ========================================= */

/* Header Search Toggle Button */
.search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #e7e5e4;
    transition: color var(--transition-fast);
    cursor: pointer;
}

.search-toggle:hover {
    color: var(--primary-500);
}

@media (max-width: 768px) {
    .search-toggle {
        display: none;
    }
}

/* Fullscreen Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(17, 24, 39, 0.95);
    /* Deep dark with opacity */
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-overlay.active {
    opacity: 1;
    visibility: visible;
}

.search-overlay-close {
    position: absolute;
    top: 2rem;
    right: 2rem;
    background: none;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    transition: all 0.2s;
    padding: 0.5rem;
    border-radius: 50%;
}

.rtl .search-overlay-close {
    right: auto;
    left: 2rem;
}

.search-overlay-close:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(90deg);
}

.search-overlay-content {
    width: 100%;
    max-width: 800px;
    padding: 0 1.5rem;
    transform: translateY(20px);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.1s;
}

.search-overlay.active .search-overlay-content {
    transform: translateY(0);
    opacity: 1;
}

/* Search Form Input */
.search-overlay-form {
    width: 100%;
}

.search-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-2xl);
    padding: 0.5rem;
    transition: all 0.3s;
}

.search-input-wrapper:focus-within {
    background: var(--bg-primary);
    border-color: var(--primary-400);
    box-shadow: 0 0 0 4px rgba(245, 158, 11, 0.15);
}

.search-input-icon {
    color: var(--text-secondary);
    margin-left: 1.5rem;
    margin-right: 1rem;
}

.search-input-wrapper input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    font-size: 1rem;
    padding: 1rem 0;
    outline: none;
}

.search-input-wrapper input::placeholder {
    color: var(--text-tertiary);
}

.search-overlay-submit {
    background: var(--gradient-primary);
    color: #fff;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 1.125rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    /* transition: all 0.2s; */
    margin-right: 0.5rem;
}

.rtl .search-overlay-submit {
    margin-right: 0;
    margin-left: 0.5rem;
}

.search-overlay-submit:hover {
    /* transform: scale(1.05); */
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.4);
}

/* Popular Suggestions */
.search-suggestions {
    margin-top: 3rem;
    text-align: center;
}

.search-suggestions h4 {
    color: var(--text-secondary);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

.suggestion-tags {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
}

.suggestion-tags a {
    color: var(--text-primary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-full);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.suggestion-tags a:hover {
    background: var(--primary-600);
    border-color: var(--primary-500);
    color: white;
    transform: translateY(-2px);
}

/* Mobile Responsive Overlay */
@media (max-width: 768px) {
    .search-overlay {
        padding-top: 4rem;
    }

    .search-input-wrapper {
        flex-direction: column;
        background: transparent;
        border: none;
        padding: 0;
        gap: 1rem;
    }

    .search-input-wrapper input {
        width: 100%;
        background: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: var(--radius-2xl);
        font-size: 1.25rem;
        padding: 1rem 1.5rem !important;
        font-family: var(--font-arabic);
        text-align: center;
    }

    .search-overlay-submit {
        width: 100%;
        justify-content: center;
        padding: 1rem;
        font-size: 1.1rem;
        font-family: var(--font-arabic);
        margin: 0 !important;
        border-radius: var(--radius-xl);
    }

    .search-input-icon {
        display: none;
    }
}

/* View Icon styles */
.view-icon {
    display: inline-block;
    vertical-align: middle;
    margin-right: 4px;
    opacity: 0.8;
}

.rtl .view-icon {
    margin-right: 0;
    margin-left: 4px;
}

/* Inline Code Element Styles */
code:not(pre code) {
    background-color: var(--primary-50, #fffbeb);
    color: var(--primary-700, #b45309);
    padding: 0.15em 0.4em;
    border-radius: 0.25rem;
    font-family: Consolas, Monaco, "Courier New", monospace;
    font-size: 0.85em;
    font-weight: 500;
    word-break: break-word;
    border: 1px solid var(--primary-100, #fef3c7);
}

.dark-mode code:not(pre code) {
    background-color: var(--hover-bg);
    color: var(--primary-400);
    border-color: rgba(245, 158, 11, 0.2);
}

/* =========================================
   Mobile Header — Fixed Position
   Decouples from Chrome Android URL-bar animation so the header never slides away
   ========================================= */
@media (max-width: 992px) {
    .article-sidebar-col .ad-slot-container.ad-slot-sidebar {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .main-header {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
    }

    body {
        padding-top: var(--header-height);
        padding-bottom: 70px;
    }

    .main-footer {
        padding-bottom: 90px;
    }

    .ticker-content,
    .rtl .ticker-content {
        animation-duration: 15s !important;
    }

    /* Small screen header tightening */
    @media (max-width: 490px) {

        .header-content,
        .header-left,
        .header-actions {
            gap: 0.4rem;
        }

        .lang-toggle {
            padding: 0.4rem 0.5rem;
            font-weight: 600;
            font-size: 0.75rem;
            display: flex;
            align-items: center;
            gap: 4px;
        }

        .lang-icon {
            display: inline-block;
            font-size: 0.9rem;
        }

        .lang-text {
            display: inline-block;
        }

        .theme-toggle,
        .burger-menu-toggle {
            width: 36px;
            height: 36px;
        }

        .logo-text {
            display: none;
        }

        .logo-img {
            width: 130px;
            height: 28px;
            object-fit: contain;
        }
    }
}

/* =========================================
   Mobile Bottom Navigation (Floating Pill)
   ========================================= */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        position: fixed;
        bottom: calc(1rem + env(safe-area-inset-bottom));
        left: 1rem;
        right: 1rem;
        width: auto;
        height: 65px;
        background: color-mix(in srgb, var(--bg-card) 85%, transparent);
        border: 1px solid var(--border-color);
        border-radius: 100px;
        display: flex;
        justify-content: space-around;
        align-items: center;
        z-index: 999;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
        backdrop-filter: blur(12px);
        -webkit-backdrop-filter: blur(12px);
        transition: transform 0.3s ease;
    }

    .bottom-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: var(--text-secondary);
        font-size: 0.7rem;
        width: 100%;
        height: 100%;
        gap: 4px;
        transition: all 0.2s;
        border: none;
        background: none;
        cursor: pointer;
    }

    #mobile-menu-trigger .icon {
        color: var(--primary-500);
    }

    .bottom-nav-item .icon {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-bottom: 2px;
    }

    .bottom-nav-item .icon svg {
        width: 22px;
        height: 22px;
        display: block;
    }

    .dark-mode .sun-icon-mobile {
        display: block !important;
    }

    .dark-mode .theme-moon {
        display: none !important;
    }

    .bottom-nav-item.active,
    .bottom-nav-item:hover {
        color: var(--primary-500);
    }

    .bottom-nav-item.active .icon {
        transform: translateY(-2px);
    }

    .share-buttons {
        gap: 0.5rem;
    }
}

@media (min-width: 769px) {
    .mobile-bottom-nav {
        display: none;
    }
}

/* =========================================
   Share Button (Native)
   ========================================= */
.share-btn.native-share {
    background: var(--text-primary);
    color: var(--bg-card);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-weight: 600;
    margin-right: 0.5rem;
    cursor: pointer;
    border: none;
    transition: transform 0.2s;
}

.share-btn.native-share:hover {
    transform: scale(1.1);
}

/* =========================================
   Scroll-to-Top Button
   ========================================= */
.scroll-to-top {
    position: fixed;
    bottom: 105px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 998;
    border: none;
}

.scroll-to-top.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.scroll-to-top:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 10px 20px rgba(245, 158, 11, 0.3);
}

.scroll-to-top:active {
    transform: scale(0.95);
}

.rtl .scroll-to-top {
    right: auto;
    left: 20px;
}

@media (min-width: 769px) {
    .scroll-to-top {
        bottom: 30px;
        width: 50px;
        height: 50px;
    }
}

/* =========================================
   Reading Progress Bar
   ========================================= */
.reading-progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1001;
    pointer-events: none;
}

.reading-progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 100%;
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.1s linear;
    box-shadow: 0 0 10px rgba(245, 158, 11, 0.5);
    will-change: transform;
}

body.rtl .reading-progress-bar {
    transform-origin: right;
}

/* =========================================
   Table of Contents
   ========================================= */
.article-toc {
    background: var(--bg-secondary, #ffffff);
    border: 1px solid var(--border-color, #e7e5e4);
    border-radius: 6px;
    padding: 1.5rem 2rem;
    margin-bottom: 2.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
}

.dark-mode .article-toc {
    background: var(--bg-card);
    border-color: var(--border-color);
    box-shadow: var(--shadow-card);
    backdrop-filter: blur(10px);
}

.article-toc::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-500, #f59e0b), var(--primary-400, #fbbf24), var(--primary-300, #fcd34d));
}

.toc-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color, #e7e5e4);
}

.dark-mode .toc-header {
    border-color: rgba(255, 255, 255, 0.1);
}

.toc-header h2 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary, #292524);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toc-header h2::before {
    content: '📑';
    font-size: 1.1em;
}

.dark-mode .toc-header h2 {
    color: var(--text-primary);
}

.toc-toggle {
    background: var(--bg-tertiary, #f5f5f4);
    border: none;
    color: var(--text-secondary, #57534e);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 4px;
    font-weight: 600;
}

.dark-mode .toc-toggle {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
}

.toc-toggle:hover {
    background: var(--primary-500, #f59e0b);
    color: white;
}

.article-toc.hidden .toc-list {
    display: none;
}

.article-toc .toc-list {
    list-style: none !important;
    padding: 0 !important;
    margin: 0;
    margin-inline-start: 4px !important;
    border-inline-start: 2px solid var(--border-color, #e7e5e4);
}

.dark-mode .article-toc .toc-list {
    border-color: rgba(255, 255, 255, 0.1);
}

.article-body .article-toc ul li,
.article-toc .toc-item {
    list-style: none !important;
    margin: 0 0 2px 0 !important;
    padding: 0 !important;
    position: relative;
    line-height: 1.5;
}

.article-body .article-toc ul li::before,
.article-toc .toc-item::before {
    display: none !important;
}

.article-toc .toc-item a {
    color: var(--text-secondary, #57534e);
    text-decoration: none;
    font-size: 1rem;
    display: block;
    transition: all 0.2s ease;
    padding: 6px 16px;
    border-radius: 0 4px 4px 0;
    position: relative;
}

.rtl .article-toc .toc-item a {
    border-radius: 4px 0 0 4px;
}

.dark-mode .article-toc .toc-item a {
    color: var(--text-secondary) !important;
}

.article-toc .toc-item a::after {
    content: '';
    position: absolute;
    inset-inline-start: -2px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: transparent;
    transition: all 0.2s ease;
}

.article-toc .toc-item a:hover {
    color: var(--hover-text, #d97706) !important;
    background: var(--hover-bg, rgba(245, 158, 11, 0.05)) !important;
}

.dark-mode .article-toc .toc-item a:hover {
    background: var(--hover-bg, rgba(245, 158, 11, 0.15)) !important;
}

.article-toc .toc-item a:hover::after {
    background: var(--hover-text, #f59e0b);
}

.article-toc .toc-level-2 a {
    font-weight: 600;
    color: var(--text-primary, #292524) !important;
    padding-inline-start: 1.25rem;
}

.dark-mode .article-toc .toc-level-2 a {
    color: var(--text-primary) !important;
}

.article-toc .toc-level-3 a {
    padding-inline-start: 2.25rem;
    font-size: 0.95rem;
}

.article-toc .toc-level-4 a {
    padding-inline-start: 3.25rem;
    font-size: 0.9rem;
    color: var(--text-tertiary, #78716c) !important;
}

.article-toc .toc-level-5 a {
    padding-inline-start: 4.25rem;
    font-size: 0.85rem;
    color: var(--text-tertiary, #a8a29e) !important;
}

/* =========================================
   Article Source / References
   ========================================= */
.article-source {
    margin-top: 3rem;
    padding: 1.5rem;
    background: var(--bg-tertiary, #f5f5f4);
    border-radius: 4px;
    border-left: 4px solid var(--primary-500, #f59e0b);
    font-size: 0.95rem;
}

.dark-mode .article-source {
    background: rgba(255, 255, 255, 0.03);
}

.dark-mode .article-share {
    background: rgba(255, 255, 255, 0.03);
}

.rtl .article-source {
    border-left: none;
    border-right: 4px solid var(--primary-500, #f59e0b);
}

.source-label {
    font-weight: 700;
    color: var(--text-primary, #292524);
    margin-inline-end: 0.5rem;
}

.dark-mode .source-label {
    color: #fff;
}

.source-link {
    color: var(--hover-text, #d97706);
    text-decoration: none;
    font-weight: 500;
}

.source-link:hover {
    text-decoration: underline;
}

.source-text {
    color: var(--text-secondary, #57534e);
}

/* =========================================
   Logo
   ========================================= */
.logo-img {
    width: 178px;
    height: 38px;
    object-fit: contain;
}

.footer-logo-container {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1rem;
}

.footer-logo-img {
    height: 40px;
    width: auto;
}

/* =========================================
   Article Page — Meta & Featured Image
   ========================================= */
.article-meta .meta-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.article-meta .meta-item svg {
    flex-shrink: 0;
}

.recent-article-date {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.article-featured-image {
    position: relative;
    border-radius: 5px;
    overflow: hidden;
}

.ai-image-label {
    position: absolute;
    bottom: 16px;
    inset-inline-start: 16px;
    background: rgba(20, 20, 20, 0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f8f9fa;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 10;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    animation: floatIn 0.8s ease-out forwards;
}

.ai-image-label svg {
    color: #d4af37;
}

@keyframes floatIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =========================================
   Firefox Scrollbar
   ========================================= */
:root {
    scrollbar-width: thin;
    scrollbar-color: var(--gray-300, #d1d5db) transparent;
}

.dark-mode {
    scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

/* =========================================
   AI Article Summarizer
   ========================================= */

/* Header Button — hidden by default, appears when logo hides */
.ai-summary-header-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 12px;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
    /* border-radius: var(--radius-sm); */
    border: none;
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transform: translateY(4px) scale(0.9);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease, box-shadow 0.2s ease, background 0.3s ease;
    position: absolute;
    /* Position it over the logo area. Logo is after burger (48px) */
    inset-inline-start: 48px;
    white-space: nowrap;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.25);
    z-index: 5;
}

.ai-summary-header-btn svg {
    flex-shrink: 0;
}

.ai-summary-header-btn.ai-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.ai-summary-header-btn:hover {
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    /* transform: translateY(-1px) scale(1.03); */
}

.ai-summary-header-btn.ai-active {
    background: var(--gradient-accent);
}

/* Logo hide animation when summarizer button shows */
.logo {
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
}

.logo.ai-hidden {
    opacity: 0;
    visibility: hidden;
    transform: translateY(-4px) scale(0.95);
    pointer-events: none;
}

/* Summary Panel — slides down below header */
.ai-summary-panel {
    position: sticky;
    top: var(--header-height);
    z-index: 99;
    background: var(--header-bg);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.1);
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.5s cubic-bezier(0.16, 1, 0.3, 1),
        opacity 0.4s ease;
}

.ai-summary-panel.ai-panel-open {
    max-height: 85vh;
    opacity: 1;
    overflow-y: auto;
}

/* Custom Scrollbar for the AI Panel */
.ai-summary-panel::-webkit-scrollbar {
    width: 6px;
}

.ai-summary-panel::-webkit-scrollbar-track {
    background: transparent;
}

.ai-summary-panel::-webkit-scrollbar-thumb {
    background: var(--gray-300);
    border-radius: var(--radius-full);
}

:root.dark-mode .ai-summary-panel::-webkit-scrollbar-thumb {
    background: var(--gray-700);
}

.ai-summary-panel::-webkit-scrollbar-thumb:hover {
    background: var(--primary-500);
}

.ai-summary-panel-inner {
    padding: 1.25rem 0;
    max-width: 720px;
}

.ai-summary-panel-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}

.ai-summary-panel-titles h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.ai-summary-subtitle {
    font-size: 0.8125rem;
    color: var(--text-tertiary);
    display: block;
    margin-top: 2px;
}

.ai-summary-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: var(--radius-full);
    color: var(--text-tertiary);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    background: var(--bg-tertiary);
}

.ai-summary-close:hover {
    color: var(--error-500);
    background: rgba(239, 68, 68, 0.1);
}

/* Summary Content */
.ai-summary-content {
    min-height: 60px;
}

.ai-summary-text {
    color: var(--text-primary);
    font-size: 1.0625rem;
    line-height: 1.75;
}

.ai-summary-text p {
    margin-bottom: 0.75rem;
}

.ai-summary-text strong {
    color: var(--primary-600);
}

:root.dark-mode .ai-summary-text strong {
    color: var(--primary-400);
}

.ai-summary-text ol.ai-key-points {
    list-style: none;
    counter-reset: ai-points;
    padding: 0;
    margin: 0.75rem 0;
}

.ai-summary-text ol.ai-key-points li {
    counter-increment: ai-points;
    padding: 0.6rem 0.85rem;
    padding-inline-start: 2.6rem;
    position: relative;
    border-radius: var(--radius-md);
    margin-bottom: 0.375rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    font-size: 1rem;
    line-height: 1.65;
    transition: background 0.2s ease;
}

.ai-summary-text ol.ai-key-points li:hover {
    background: var(--hover-bg);
}

.ai-summary-text ol.ai-key-points li::before {
    content: counter(ai-points);
    position: absolute;
    inset-inline-start: 0.75rem;
    top: 0.5rem;
    width: 22px;
    height: 22px;
    background: var(--gradient-primary);
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.7rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* Loading Animation */
.ai-summary-loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 0;
    color: var(--text-tertiary);
    font-size: 0.875rem;
}

.ai-pulse-dots {
    display: flex;
    gap: 4px;
}

.ai-pulse-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-500);
    animation: aiPulse 1.4s infinite ease-in-out;
}

.ai-pulse-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-pulse-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes aiPulse {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.4;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Error State */
.ai-summary-error {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-secondary);
}

.ai-summary-error p {
    margin-bottom: 0.75rem;
    font-size: 0.875rem;
}

.ai-retry-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 1.25rem;
    background: var(--gradient-primary);
    color: #fff;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: var(--radius-full);
    border: none;
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.ai-retry-btn:hover {
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
    transform: translateY(-1px);
}

/* Footer Badge */
.ai-summary-footer {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border-color);
}

.ai-powered-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 0.6875rem;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 500;
}

.ai-powered-badge svg {
    color: var(--primary-500);
}

/* Fade-in Animation */
.ai-fade-in {
    animation: aiFadeIn 0.5s ease-out forwards;
}

@keyframes aiFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .ai-summary-header-btn {
        font-size: 0.75rem;
        padding: 5px 10px;
        /* border-radius: var(--radius-sm); */
    }

    .ai-summary-header-btn svg {
        width: 16px;
        height: 16px;
    }

    .ai-summary-panel.ai-panel-open {
        max-height: 70vh;
        overflow-y: auto;
    }

    .ai-summary-panel-inner {
        padding: 1rem 0;
    }

    .ai-summary-text ol.ai-key-points li {
        font-size: 0.95rem;
        padding: 0.55rem 0.7rem;
        padding-inline-start: 2.25rem;
    }
}

/* =========================================
   In-content "Read also" box
   ========================================= */
/* Injected at the article midpoint by ContentProcessor. */
.read-also {
    margin: 2rem 0;
    padding: 1.15rem 1.35rem;
    background: var(--bg-secondary);
    border-inline-start: 3px solid var(--primary-500);
    border-radius: var(--radius-lg);
}

/* No uppercase and no letter-spacing: both are meaningless for Arabic, and
   letter-spacing visually pulls apart cursive Arabic joins. */
.read-also-label {
    margin: 0 0 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Scoped under .article-body to beat `.article-body ul { list-style-type: disc }`
   and its 2rem side padding. The bullets and that indent were still winning, so
   the markers sat outside the hoverable row and collided with its padding. Each
   row is a full-width hover target now, which is the clearer affordance. */
.article-body .read-also-list,
.read-also-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.rtl .article-body .read-also-list {
    padding-right: 0;
    padding-left: 0;
}

.read-also-list li + li {
    margin-top: 0.15rem;
}

/*
 * Links here are NOT underlined, and the rules are scoped under .article-body so
 * they outrank `.article-body a { text-decoration: underline }`.
 *
 * Two reasons this box is a special case:
 *  1. Every item in the list is a link, so an underline distinguishes nothing —
 *     it is pure noise (WCAG 1.4.1 is about links sitting INSIDE running text).
 *  2. Arabic sits its dots and descenders below the baseline (ي ب ن ج …), and a
 *     4px-offset underline runs straight through them, which is what makes a
 *     block of Arabic links tiring to read.
 * Affordance comes from weight, the bulleted list, and a full-row hover instead.
 */
.article-body .read-also-link,
.read-also-link {
    display: block;
    padding: 0.45rem 0.55rem;
    margin-inline-start: -0.55rem;
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-weight: 600;
    line-height: 1.6;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast);
}

/* Hover tints the whole row. The previous border-bottom was the SECOND line that
   appeared on hover on top of the inherited underline. */
.article-body .read-also-link:hover,
.article-body .read-also-link:focus-visible,
.read-also-link:hover,
.read-also-link:focus-visible {
    background: var(--hover-bg);
    color: var(--hover-text);
    text-decoration: none;
}

.dark-mode .read-also {
    background: var(--bg-tertiary);
}

/* !important only to beat `.dark-mode .article-body a { color: ... !important }`,
   which would otherwise force these to low-contrast amber. */
.dark-mode .article-body .read-also-link {
    color: var(--text-primary) !important;
}

.dark-mode .article-body .read-also-link:hover,
.dark-mode .article-body .read-also-link:focus-visible {
    color: var(--hover-text) !important;
}

@media (max-width: 640px) {
    .read-also {
        padding: 0.9rem 1.05rem;
    }

    .article-body .read-also-link,
    .read-also-link {
        min-height: 44px;
        padding-top: 0.65rem;
        padding-bottom: 0.65rem;
    }
}

/* =========================================
   Topic hubs
   ========================================= */
/* Chips under an article, and the breadcrumb on /topic/{slug}. */
.article-topics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin: 2rem 0 1rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.article-topics-label {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
}

/* Pill shape already reads as interactive, so no underline here either. */
.article-body .article-topic-chip,
.article-topic-chip {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0.35rem 0.8rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.article-body .article-topic-chip:hover,
.article-body .article-topic-chip:focus-visible,
.article-topic-chip:hover,
.article-topic-chip:focus-visible {
    background: var(--hover-bg);
    border-color: var(--border-500);
    color: var(--hover-text);
    text-decoration: none;
}

.dark-mode .article-topic-chip {
    background: var(--bg-tertiary);
}

.dark-mode .article-body .article-topic-chip {
    color: var(--text-secondary) !important;
}

.dark-mode .article-body .article-topic-chip:hover,
.dark-mode .article-body .article-topic-chip:focus-visible {
    color: var(--hover-text) !important;
}

.topic-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-tertiary);
}

.topic-breadcrumb a {
    color: inherit;
    text-decoration: none;
}

.topic-breadcrumb a:hover,
.topic-breadcrumb a:focus-visible {
    color: var(--hover-text);
}

@media (max-width: 640px) {
    /* 44px tap targets on mobile per the UI standards. */
    .article-body .article-topic-chip,
    .article-topic-chip {
        min-height: 44px;
        padding: 0.55rem 1rem;
    }
}
