/* ========================================
   CRITICAL CSS - Above-the-fold styles
   Inlined for faster First Contentful Paint
======================================== */

/* Local Fonts - Preload in HTML for critical rendering */
@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/cairo-v31-arabic_latin/cairo-v31-arabic_latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Cairo';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/cairo-v31-arabic_latin/cairo-v31-arabic_latin-700.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('./fonts/inter-v20-latin/inter-v20-latin-regular.woff2') format('woff2');
}

@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('./fonts/playfair-display-v40-latin/playfair-display-v40-latin-700.woff2') format('woff2');
}

/* CSS Variables */
:root {
    --color-bg: #FCFAf7;
    --color-surface: #FFFFFF;
    --color-text-primary: #1E293B;
    --color-text-secondary: #64748B;
    --color-accent: #ea580c;
    --color-accent-hover: #c2410c;
    --color-border: #E2E8F0;
    --radius-sm: 8px;
    --radius-md: 12px;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --font-arabic: 'Cairo', sans-serif;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

[data-theme="dark"] {
    --color-bg: #0F172A;
    --color-surface: #1E293B;
    --color-text-primary: #F8FAFC;
    --color-text-secondary: #94A3B8;
    --color-accent: #F59E0B;
    --color-accent-hover: #D97706;
    --color-border: #334155;
}

/* Global Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg);
    color: var(--color-text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

[dir="rtl"] {
    font-family: var(--font-arabic) !important;
}

h1,
h2,
h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3 {
    font-family: var(--font-arabic);
}

a {
    text-decoration: none;
    color: inherit;
}

ul {
    list-style: none;
}

button {
    border: none;
    background: none;
    cursor: pointer;
    font-family: inherit;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background: transparent;
    /* Default Transparent */
    backdrop-filter: none;
    /* No blur initially for performance/clarity */
    border-bottom: 1px solid transparent;
    transition: all var(--transition-smooth);
    color: white;
    /* Default White Text */
}

/* Scrolled State */
.navbar.scrolled {
    background: rgba(252, 250, 247, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--color-border);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    color: var(--color-text-primary);
    /* Switch to dark text */
}

[data-theme="dark"] .navbar.scrolled {
    background: rgba(15, 23, 42, 0.9);
    border-bottom-color: var(--color-border);
}

.nav-content {
    height: 80px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-family: var(--font-heading);
    font-size: 1.75rem;
    font-weight: 700;
    color: inherit;
    /* Inherit from navbar */
}

[dir="rtl"] .logo {
    font-family: var(--font-arabic);
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Update controls to inherit color */
.lang-btn,
.icon-btn {
    color: inherit;
    border-color: rgba(255, 255, 255, 0.3);
    /* Subtle border on transparent */
}

.navbar.scrolled .lang-btn,
.navbar.scrolled .icon-btn {
    border-color: var(--color-border);
}

/* Mobile Navbar tweak */
@media (max-width: 768px) {
    .navbar {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6) 0%, transparent 100%);
        /* Readability gradient */
    }

    .navbar.scrolled {
        background: rgba(252, 250, 247, 0.98);
        /* Higher opacity on mobile scroll */
    }

    [data-theme="dark"] .navbar.scrolled {
        background: rgba(15, 23, 42, 0.98);
    }
}

/* ... existing styles ... */

.lang-btn {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 8px 12px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-sm);
    background: transparent;
}

.icon-btn {
    padding: 8px;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ... */

/* Hero Gradient Overlay */
.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    /* Improved Gradient: Clear top, Darker bottom */
    background: linear-gradient(to bottom,
            rgba(0, 0, 0, 0.1) 0%,
            rgba(0, 0, 0, 0.2) 40%,
            rgba(0, 0, 0, 0.7) 100%);
    z-index: 0;
}

.hero-content {
    z-index: 1;
    max-width: 800px;
    color: white;
}

.hero h1,
.hero p {
    color: white;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.hero h1 {
    font-size: clamp(3rem, 8vw, 5rem);
    margin-bottom: 24px;
}

.hero p {
    font-size: 1.125rem;
    margin-bottom: 40px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.subtitle {
    display: inline-block;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    margin-bottom: 16px;
    font-weight: 600;
}

.hero-actions-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.hero-main-btns {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    /* Fixed height for consistency */
    padding: 0 32px;
    border-radius: 50px;
    font-weight: 700;
    transition: all var(--transition-smooth);
    border: 2px solid transparent;
}

.btn-primary,
.primary-btn {
    background-color: var(--color-accent);
    color: white;
}

.btn-secondary,
.outline-btn {
    background-color: transparent;
    border-color: rgba(255, 255, 255, 0.8);
    color: white;
}

.btn-link {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    font-size: 0.95rem;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 4px;
    margin-top: -4px;
}

/* Skeleton UI (Above-the-fold) - CLS-safe dimensions */
.skeleton-card {
    background: var(--color-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.skeleton-card .item-img-container {
    aspect-ratio: 4 / 3;
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

.skeleton-card .item-content {
    padding: 24px;
    min-height: 120px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 10px;
    background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface) 50%, var(--color-border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}

.skeleton-title {
    height: 20px;
    width: 70%;
    margin-bottom: 12px;
}

.skeleton-text {
    width: 100%;
}

.skeleton-text-short {
    width: 50%;
}

@keyframes shimmer {
    100% {
        background-position: -200% 0;
    }
}

.hidden-skeleton {
    display: none !important;
}