/* ==========================================================================
   Premium AI Finance Aesthetic - Dr. Ali Alrawi (Mobile-First)
   ========================================================================== */

/* --- CSS Variables & Theming --- */
:root {
    /* 1. Base Colors (Light Mode) */
    --bg-base: #FFFFFF;
    --bg-surface: #F8FAFC;
    --bg-surface-elevated: #F1F5F9;
    
    --text-primary: #0F172A;
    --text-secondary: #475569;
    --text-tertiary: #94A3B8;
    
    --border-subtle: rgba(15, 23, 42, 0.08);
    --border-strong: rgba(15, 23, 42, 0.15);

    /* 2. Brand Accents */
    --brand-gold-light: #F0E6D2;
    --brand-gold: #C9A456;
    --brand-gold-dark: #A6833E;
    --brand-gold-glow: rgba(201, 164, 86, 0.15);
    
    /* 3. Glassmorphism (Light) */
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(255, 255, 255, 0.4);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
    
    /* 4. Typography */
    --font-heading: 'Tajawal', sans-serif;
    --font-ui: 'Cairo', sans-serif;
    
    /* 5. Metrics & Spacing */
    --radius-sm: 8px;
    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-full: 9999px;
    
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    --transition-bounce: 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    
    --z-nav: 100;
    --z-modal: 1000;
}

/* Dark Mode Theme */
[data-theme="dark"] {
    --bg-base: #050505;
    --bg-surface: #0A0A0A;
    --bg-surface-elevated: #121212;
    
    --text-primary: #F8FAFC;
    --text-secondary: #94A3B8;
    --text-tertiary: #475569;
    
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-strong: rgba(255, 255, 255, 0.1);
    
    --brand-gold-glow: rgba(201, 164, 86, 0.1);
    
    --glass-bg: rgba(10, 10, 10, 0.65);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* --- Resets & Base --- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    font-size: 16px; /* Base for rem */
}

body {
    font-family: var(--font-ui);
    background-color: var(--bg-base);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color var(--transition-smooth), color var(--transition-smooth);
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    line-height: 1.2;
    color: var(--text-primary);
    margin-bottom: 0.5em;
    letter-spacing: -0.02em;
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

ul, ol {
    list-style: none;
}

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

button, input, textarea, select {
    font-family: inherit;
    color: inherit;
    background: none;
    border: none;
    outline: none;
}

button {
    cursor: pointer;
}

/* --- Typography System --- */
.h-mega { font-size: clamp(3rem, 8vw, 5rem); line-height: 1.1; letter-spacing: -0.03em; }
.h-display { font-size: clamp(2.5rem, 5vw, 4rem); line-height: 1.15; }
.h-title { font-size: clamp(2rem, 4vw, 3rem); }
.h-section { font-size: clamp(1.75rem, 3vw, 2.5rem); }
.text-lead { font-size: clamp(1.1rem, 2vw, 1.25rem); line-height: 1.8; color: var(--text-secondary); }
.text-gold { color: var(--brand-gold); }

/* --- Layout & Utilities --- */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.section {
    padding: 100px 0;
}

@media (max-width: 768px) {
    .section { padding: 60px 0; }
}

.text-center { text-align: center; }
.flex-center { display: flex; justify-content: center; align-items: center; }
.grid-responsive {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 32px;
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-shadow);
    border-radius: var(--radius-lg);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 28px;
    font-weight: 600;
    border-radius: var(--radius-full);
    transition: all var(--transition-bounce);
    font-size: 1.05rem;
}

.btn-primary {
    background: var(--text-primary);
    color: var(--bg-base);
    border: 1px solid transparent;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
    background: var(--brand-gold);
}

[data-theme="dark"] .btn-primary:hover {
    box-shadow: 0 10px 20px rgba(201, 164, 86, 0.2);
}

.btn-outline {
    background: transparent;
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-outline:hover {
    border-color: var(--brand-gold);
    color: var(--brand-gold);
    background: var(--brand-gold-glow);
}

/* --- Navbar (Premium Glass) --- */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 80px;
    z-index: var(--z-nav);
    transition: all var(--transition-smooth);
    background: transparent;
}

.navbar.scrolled {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--glass-border);
    height: 70px;
}

.navbar .container {
    height: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--text-primary);
    position: relative;
    z-index: calc(var(--z-nav) + 2);
}

.nav-links {
    display: flex;
    gap: 32px;
}

.nav-links li a {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-secondary);
    position: relative;
    padding: 8px 0;
}

.nav-links li a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0%;
    height: 2px;
    background: var(--brand-gold);
    transition: width var(--transition-smooth);
    border-radius: 2px;
}

.nav-links li a:hover,
.nav-links li a.active {
    color: var(--text-primary);
}

.nav-links li a:hover::after,
.nav-links li a.active::after {
    width: 100%;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    z-index: calc(var(--z-nav) + 2);
}

.icon-btn {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition-fast);
    font-size: 1.1rem;
}

.icon-btn:hover {
    background: var(--brand-gold-glow);
    color: var(--brand-gold);
    border-color: var(--brand-gold);
}

.menu-toggle {
    display: none;
}

/* Mobile Navbar */
@media (max-width: 768px) {
    .menu-toggle {
        display: flex;
    }
    
    .nav-links {
        position: fixed;
        top: 0;
        right: -100%;
        width: 100%;
        height: 100vh;
        background: var(--glass-bg);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        gap: 30px;
        transition: right var(--transition-smooth);
        z-index: calc(var(--z-nav) + 1);
    }
    
    .nav-links.active {
        right: 0;
    }
    
    .nav-links li a {
        font-size: 1.5rem;
    }
}

/* --- Hero Section --- */
.hero {
    min-height: 100vh;
    padding-top: 120px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

/* Animated Glow Background */
.hero-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--brand-gold-glow) 0%, transparent 70%);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 0;
    animation: pulseGlow 8s infinite alternate;
    pointer-events: none;
}

@keyframes pulseGlow {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.5; }
    100% { transform: translate(-50%, -50%) scale(1.2); opacity: 1; }
}

.hero .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: center;
    position: relative;
    z-index: 1;
}


.hero-subtitle {
    display: inline-block;
    padding: 6px 16px;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--brand-gold);
    margin-bottom: 24px;
    letter-spacing: 0.05em;
}

.hero-actions {
    display: flex;
    gap: 16px;
    margin-top: 40px;
}

.hero-image-wrapper {
    position: relative;
    border-radius: var(--radius-lg);
    padding: 16px;
}

.hero-image-wrapper::before {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid var(--border-strong);
    border-radius: var(--radius-lg);
    transform: translate(20px, 20px);
    z-index: -1;
    transition: transform var(--transition-smooth);
}

.hero-image-wrapper:hover::before {
    transform: translate(10px, 10px);
}

.hero-image {
    width: 100%;
    aspect-ratio: 3/4;
    object-fit: cover;
    border-radius: calc(var(--radius-lg) - 8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.1);
}

[data-theme="dark"] .hero-image {
    box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}

@media (max-width: 992px) {
    .hero .container {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 40px;
    }
    
    .hero-actions {
        justify-content: center;
    }
    
    .hero-image-wrapper {
        max-width: 80%;
        margin: 0 auto;
    }
}

/* --- Content Cards (Blog/Courses) --- */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all var(--transition-bounce);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.06);
    border-color: var(--border-strong);
}

[data-theme="dark"] .card:hover {
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
}

.card-img-wrap {
    position: relative;
    padding-top: 60%; /* Aspect Ratio */
    overflow: hidden;
}

.card-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.card:hover .card-img {
    transform: scale(1.05);
}

.card-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--glass-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-primary);
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.card-content {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.card-meta {
    font-size: 0.85rem;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.card-title {
    font-size: 1.25rem;
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-excerpt {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 24px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    flex-grow: 1;
}

.card-action {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    color: var(--brand-gold);
    font-size: 0.95rem;
    margin-top: auto;
    transition: gap var(--transition-fast);
}

.card:hover .card-action {
    gap: 12px;
}

/* --- Quote/Vision Block --- */
.vision-block {
    position: relative;
    padding: 60px;
    text-align: center;
    margin: 40px auto;
    max-width: 900px;
}

.vision-block::before, .vision-block::after {
    content: '"';
    position: absolute;
    font-family: var(--font-heading);
    font-size: 8rem;
    color: var(--brand-gold-glow);
    line-height: 1;
    z-index: -1;
}

.vision-block::before { top: 0; right: 20px; }
.vision-block::after { bottom: -40px; left: 20px; }

.vision-text {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
    line-height: 1.8;
    font-weight: 300;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .vision-block { padding: 40px 20px; }
}

/* --- Minimal Footer --- */
.footer {
    background: var(--bg-surface-elevated);
    border-top: 1px solid var(--border-subtle);
    padding: 60px 0 30px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 30px;
    margin-bottom: 40px;
}

.footer-brand {
    font-size: 1.5rem;
    font-weight: 800;
    font-family: var(--font-heading);
}

.footer-contact {
    display: flex;
    gap: 32px;
    flex-wrap: wrap;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.contact-item i {
    color: var(--brand-gold);
    font-size: 1.2rem;
    background: var(--brand-gold-glow);
    padding: 10px;
    border-radius: var(--radius-full);
}

.footer-bottom {
    text-align: center;
    padding-top: 30px;
    border-top: 1px solid var(--border-subtle);
    color: var(--text-tertiary);
    font-size: 0.9rem;
}

/* Social Icons */
.footer-social {
    display: flex;
    gap: 12px;
    align-items: center;
}

.social-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    background: var(--bg-surface-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    transition: all var(--transition-bounce);
}

.social-icon:hover {
    transform: translateY(-4px);
    background: var(--brand-gold-glow);
    color: var(--brand-gold);
    border-color: var(--brand-gold);
    box-shadow: 0 8px 20px var(--brand-gold-glow);
}

@media (max-width: 768px) {
    .footer-content { flex-direction: column; text-align: center; justify-content: center; }
    .footer-contact { justify-content: center; }
}

/* --- Utility Animations --- */
.reveal {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.reveal.active {
    opacity: 1;
    transform: translateY(0);
}

/* Skeleton Loaders */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-elevated) 25%, var(--border-subtle) 50%, var(--bg-surface-elevated) 75%);
    background-size: 200% 100%;
    animation: skeletonLoading 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeletonLoading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Article Reading View */
.article-wrapper {
    padding: 140px 0 80px;
}

.article-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 60px;
}

.article-category {
    color: var(--brand-gold);
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 16px;
    display: block;
}

.article-hero-img {
    width: 100%;
    border-radius: var(--radius-lg);
    aspect-ratio: 21/9;
    object-fit: cover;
    margin-bottom: 60px;
}

.article-content {
    max-width: 720px;
    margin: 0 auto;
    font-size: 1.15rem;
    line-height: 1.9;
    color: var(--text-secondary);
}

.article-content h2 {
    font-size: 2rem;
    margin: 2em 0 1em;
    color: var(--text-primary);
}

.article-content img {
    border-radius: var(--radius-md);
    margin: 2em 0;
}

.article-content blockquote {
    border-right: 4px solid var(--brand-gold);
    padding: 20px 30px;
    margin: 2em 0;
    background: var(--bg-surface-elevated);
    border-radius: var(--radius-md) 0 0 var(--radius-md);
    font-style: italic;
    color: var(--text-primary);
}

/* Back button */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--text-tertiary);
    font-weight: 600;
    margin-bottom: 40px;
    transition: color var(--transition-fast);
}

.btn-back:hover {
    color: var(--text-primary);
}