/* ═══════════════════════════════════════════
        MAIN DESIGN SYSTEM: CHARIINFO
    موقع إخباري عالمي شامل — Design System
═══════════════════════════════════════════ */

/* ══ SECTION 1 : CSS CUSTOM PROPERTIES (VARIABLES) ══ */
:root {
    /* 🎨 COULEURS PRINCIPALES (BRAND) */
    --color-primary: #C0152A;
    /* rouge cramoisi */
    --color-primary-dark: #8B0000;
    /* rouge foncé */
    --color-primary-light: #E8354A;
    /* rouge clair */
    --color-primary-glow: rgba(192, 21, 42, 0.12);
    --color-gold: #D4A843;
    /* or */
    --color-gold-light: #F2C96E;
    /* or clair */
    --color-gold-dark: #B8922A;
    /* or foncé */

    /* ⚪ COULEURS NEUTRES */
    --color-ink: #0D0D0D;
    /* noir profond */
    --color-ink-soft: #1C1C1C;
    /* noir doux */
    --color-ink-muted: #2E2E2E;
    /* gris très foncé */
    --color-slate: #4A4A5A;
    /* ardoise */
    --color-silver: #6A6A7A;
    /* argent — passes 4.5:1 on pearl and white */
    --color-smoke: #C8C8D0;
    /* fumée */
    --color-pearl: #F0EFE8;
    /* perle */
    --color-white: #FAFAF8;
    /* blanc chaud */

    /* 📂 COULEURS CATÉGORIES */
    --cat-politics: #C0152A;
    /* سياسة */
    --cat-economy: #1a6e3c;
    /* اقتصاد */
    --cat-health: #1565C0;
    /* صحة */
    --cat-culture: #6A1B9A;
    /* ثقافة */
    --cat-sport: #E65100;
    /* رياضة */
    --cat-world: #37474F;
    /* دولي */
    --cat-urgent: #FF1A3A;
    /* عاجل */

    /* ✍️ TYPOGRAPHIE */
    --font-display: 'Amiri', Georgia, serif;
    --font-body: 'Noto Kufi Arabic', 'Segoe UI', sans-serif;
    --font-mono: 'Courier New', monospace;

    /* 📏 TAILLES DE POLICE */
    --text-xs: 11px;
    --text-sm: 13px;
    --text-base: 15px;
    --text-md: 17px;
    --text-lg: 20px;
    --text-xl: 24px;
    --text-2xl: 30px;
    --text-3xl: 38px;
    --text-4xl: 48px;

    /* 📐 LINE-HEIGHT */
    --leading-tight: 1.3;
    --leading-normal: 1.6;
    --leading-relaxed: 1.8;
    --leading-loose: 2.0;

    /* 🛰️ ESPACEMENT (4px system) */
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-7: 28px;
    --space-8: 32px;
    --space-9: 36px;
    --space-10: 40px;
    --space-12: 48px;
    --space-16: 64px;

    /* 🔘 BORDER RADIUS */
    --radius-sm: 3px;
    --radius-md: 6px;
    --radius-lg: 12px;
    --radius-xl: 20px;
    --radius-full: 9999px;

    /* 🌌 OMBRES */
    --shadow-xs: 0 1px 3px rgba(0, 0, 0, .06);
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, .08);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, .12);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, .18);
    --shadow-xl: 0 16px 48px rgba(0, 0, 0, .24);

    /* ⚡ TRANSITIONS */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-snap: 0.3s cubic-bezier(0.16, 1, 0.3, 1);

    /* 🛑 Z-INDEX */
    --z-base: 1;
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-overlay: 300;
    --z-modal: 400;
    --z-toast: 500;

    /* 🔲 BORDERS */
    --color-border: #E8E6E0;
    --color-border-strong: #E0DDD6;

    /* 🃏 SURFACES */
    --color-surface: var(--color-white);
    --color-surface-raised: #FFFFFF;
}

/* ══ SECTION 2 : RESET & BASE ══ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    -webkit-text-size-adjust: 100%;
    overflow-x: hidden;
    max-width: 100%;
}

body {
    font-family: var(--font-body);
    background: var(--color-white);
    color: var(--color-ink);
    font-size: var(--text-base);
    line-height: var(--leading-relaxed);
    overflow-x: hidden;
    max-width: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* RTL direction - frontend only, never admin */
body:not(.wp-admin) {
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
    transition: var(--transition-base);
}

img {
    display: block;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

ul,
ol {
    list-style: none;
}

button {
    cursor: pointer;
    font-family: inherit;
    background: none;
    border: none;
}

/* RTL for form elements - frontend only */
body:not(.wp-admin) input,
body:not(.wp-admin) textarea,
body:not(.wp-admin) select {
    font-family: inherit;
    direction: rtl;
}

/* Focus indicators — visible for keyboard, hidden for pointer */
:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-display);
    line-height: var(--leading-tight);
    font-weight: 700;
}

h1 {
    font-size: var(--text-3xl);
}

h2 {
    font-size: var(--text-2xl);
}

h3 {
    font-size: var(--text-xl);
}

h4 {
    font-size: var(--text-lg);
}

h5 {
    font-size: var(--text-md);
}

h6 {
    font-size: var(--text-base);
}

p {
    margin-bottom: var(--space-4);
    line-height: var(--leading-relaxed);
}

strong {
    font-weight: 700;
}

blockquote {
    border-top: 2px solid var(--color-primary);
    border-bottom: 1px solid var(--color-border);
    padding: var(--space-4) var(--space-5);
    margin: var(--space-6) 0;
    background: var(--color-primary-glow);
    border-radius: var(--radius-md);
    color: var(--color-slate);
    font-style: italic;
    font-family: var(--font-display);
    font-size: var(--text-lg);
}

/* ══ SECTION 3 : LAYOUT UTILITIES ══ */
.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-sm {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.container-lg {
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 var(--space-6);
}

.site-grid {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: var(--space-8);
    align-items: start;
}

.site-main {
    padding: var(--space-8) 0;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.flex-start {
    display: flex;
    align-items: center;
    justify-content: flex-start;
}

.gap-1 {
    gap: var(--space-1);
}

.gap-2 {
    gap: var(--space-2);
}

.gap-4 {
    gap: var(--space-4);
}

.gap-6 {
    gap: var(--space-6);
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.text-muted {
    color: var(--color-silver);
}

.text-primary {
    color: var(--color-primary);
}

.text-gold {
    color: var(--color-gold);
}

.truncate-2 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.truncate-3 {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

.hidden {
    display: none !important;
}

/* ══ SECTION 4 : TYPOGRAPHIE ARABE ══ */
.arabic-body {
    font-family: var(--font-body);
    font-size: var(--text-base);
    line-height: var(--leading-loose);
    word-spacing: 0.05em;
    letter-spacing: 0;
}

.arabic-headline {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: var(--leading-tight);
}

.arabic-caption {
    font-family: var(--font-body);
    font-size: var(--text-xs);
    font-weight: 500;
    letter-spacing: 0.04em;
}

.article-body {
    font-size: var(--text-md);
    line-height: var(--leading-loose);
    color: var(--color-ink);
    max-width: 72ch;
    margin: 0 auto;
}

.article-body p {
    margin-bottom: var(--space-5);
}

.article-body h2 {
    font-size: var(--text-xl);
    color: var(--color-primary);
    margin: var(--space-8) 0 var(--space-4);
    font-family: var(--font-display);
}

.article-body h3 {
    font-size: var(--text-lg);
    margin: var(--space-6) 0 var(--space-3);
    font-family: var(--font-display);
}

.article-body a {
    color: var(--color-primary);
    border-bottom: 1px solid var(--color-primary);
}

.article-body a:hover {
    opacity: 0.8;
}

.article-body img {
    border-radius: var(--radius-md);
    margin: var(--space-6) auto;
    box-shadow: var(--shadow-sm);
}

.article-body ul {
    list-style: disc;
    padding-right: var(--space-6);
    margin-bottom: var(--space-4);
}

.article-body ul li {
    margin-bottom: var(--space-2);
}

/* ══ SECTION 5 : ANIMATIONS GLOBALES ══ */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeRight {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideDown {
    from {
        transform: translateY(-10px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

@keyframes pulseDot {

    0%,
    100% {
        opacity: 1;
        transform: scale(1);
    }

    50% {
        opacity: .4;
        transform: scale(1.4);
    }
}

@keyframes tickerRTL {
    from {
        transform: translateX(100%);
    }

    to {
        transform: translateX(-100%);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }

    100% {
        background-position: 200% 0;
    }
}

@keyframes urgentBlink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: .6;
    }
}

@keyframes spin {
    from {
        transform: rotate(0);
    }

    to {
        transform: rotate(360deg);
    }
}

.animate-fade-up {
    animation: fadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.animate-fade-in {
    animation: fadeIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stagger-1 {
    animation-delay: 0.1s;
}

.stagger-2 {
    animation-delay: 0.2s;
}

.stagger-3 {
    animation-delay: 0.3s;
}

.stagger-4 {
    animation-delay: 0.4s;
}

.stagger-5 {
    animation-delay: 0.5s;
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ══ SECTION 6 : SKELETON LOADING ══ */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-md);
    display: block;
}

.skeleton-title {
    height: 24px;
    width: 80%;
    margin-bottom: var(--space-2);
}

.skeleton-text {
    height: 16px;
    width: 100%;
    margin-bottom: var(--space-2);
}

.skeleton-thumb {
    height: 200px;
    width: 100%;
}

.skeleton-avatar {
    height: 40px;
    width: 40px;
    border-radius: var(--radius-full);
}

/* ══ SECTION 7 : DARK MODE ══ */
@media (prefers-color-scheme: dark) {
    :root {
        --color-white: #111113;
        --color-pearl: #1A1A1C;
        --color-smoke: #2A2A30;
        --color-border: #2A2A30;
        --color-border-strong: #38383F;
        --color-ink: #F0F0F0;
        --color-ink-soft: #D8D8DC;
        --color-ink-muted: #B0B0B8;
        --color-slate: #8A8A9A;
        /* Raised from #707080 — passes 4.5:1 on #111113 */
        --color-silver: #9A9AAA;
        --color-surface: #18181B;
        --color-surface-raised: #1F1F23;
    }

    body {
        background: var(--color-white);
        color: var(--color-ink);
    }

    .site-header {
        background: var(--color-surface);
        border-bottom-color: var(--color-border);
    }

    .news-card {
        background: var(--color-surface);
        border-color: var(--color-border);
    }

    .news-card:hover {
        background: var(--color-surface-raised);
    }

    .skeleton {
        background: linear-gradient(90deg, #1a1a1a 25%, #252525 50%, #1a1a1a 75%);
    }
}