:root {
    /* Colors - Rzain Premium Light Palette */
    --bg-void: #FFFFFF;
    --bg-surface: #F8FAFC;
    --bg-secondary: #F1F5F9; /* New: Soft Concrete Gray */
    --bg-raised: #E2E8F0;
    --brand: #1A56DB;
    --brand-muted: #1E40AF;
    --brand-glow: rgba(26, 86, 219, 0.1);
    --white: #FFFFFF;
    --text-main: #0F172A;
    --text-muted: #64748B;
    --border: rgba(15, 23, 42, 0.06);
    --border-rich: rgba(15, 23, 42, 0.12);
    
    /* Typography - Modular Scale (1.25x Major Third) */
    --font-arabic: 'Noto Kufi Arabic', sans-serif;
    --t-base: 1rem;      /* 16px */
    --t-lg: 1.125rem;    /* 18px */
    --t-xl: 1.25rem;     /* 20px */
    --t-2xl: 1.5rem;     /* 24px */
    --t-3xl: 2rem;       /* 32px */
    --t-4xl: 2.5rem;     /* 40px */
    --t-display: 4.5rem; /* 72px */
    
    /* Spacing - Golden Ratio Steps (Φ ≈ 1.618) & 8px Grid */
    --s-xs: 0.25rem;     /* 4px */
    --s-sm: 0.5rem;      /* 8px */
    --s-md: 1rem;       /* 16px */
    --s-lg: 1.5rem;     /* 24px */
    --s-xl: 2.5rem;     /* 40px */
    --s-2xl: 4rem;      /* 64px */
    --s-3xl: 6.5rem;    /* 104px */
    --s-4xl: 10.5rem;   /* 168px */

    --section-py: var(--s-3xl);
    --container-px: var(--s-lg);

    /* Radii */
    --r-sm: 8px;
    --r-md: 12px;
    --r-lg: 20px;
    --r-xl: 28px;
    --r-2xl: 36px;

    /* Depth & Shadows */
    --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
    --shadow-elevated: 0 20px 40px -4px rgba(0, 0, 0, 0.08);
    --shadow-brand: 0 10px 15px -3px rgba(26, 86, 219, 0.15);

    /* Blog Specific */
    --blog-content-max: 850px;
}

/* Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-void);
    color: var(--text-main);
    font-family: var(--font-arabic);
    line-height: 1.8;
    overflow-x: hidden;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--container-px);
    padding-right: var(--container-px);
}

/* Typography Utilities */
h1, h2, h3, h4 {
    font-family: var(--font-arabic);
    font-weight: 800;
    line-height: 1.25;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

h1 { font-size: var(--t-display); }
h2 { font-size: var(--t-4xl); }
h3 { font-size: var(--t-2xl); }
h4 { font-size: var(--t-xl); }

.text-brand { color: var(--brand); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.leading-relaxed { line-height: 1.618; }

/* Blocks */
.section {
    padding-top: var(--section-py);
    padding-bottom: var(--section-py);
    position: relative;
}

.bg-surface { background-color: var(--bg-surface); }
.bg-secondary { background-color: var(--bg-secondary); }

/* Textures & Backgrounds */
.bg-texture-dots {
    background-image: radial-gradient(var(--border-rich) 1px, transparent 1px);
    background-size: 24px 24px;
}

.bg-texture-grid {
    background-image: linear-gradient(var(--border) 1px, transparent 1px), linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 40px 40px;
}

.blueprint-grid {
    position: relative;
    overflow: hidden;
}

.blueprint-grid::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: 
        linear-gradient(var(--border) 1px, transparent 1px),
        linear-gradient(90deg, var(--border) 1px, transparent 1px);
    background-size: 50px 50px;
    mask-image: linear-gradient(to bottom, transparent, black 10%, black 90%, transparent);
    animation: blueprintScroll 60s linear infinite;
    pointer-events: none;
    opacity: 0.5;
}

@keyframes blueprintScroll {
    from { background-position: 0 0; }
    to { background-position: 500px 500px; }
}

.tactile-grain {
    position: relative;
}

.tactile-grain::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('data:image/svg+xml,<svg viewBox="0 0 200 200" xmlns="http://www.w3.org/2000/svg"><filter id="noiseFilter"><feTurbulence type="fractalNoise" baseFrequency="0.65" numOctaves="3" stitchTiles="stitch"/></filter><rect width="100%" height="100%" filter="url(%23noiseFilter)"/></svg>');
    opacity: 0.03;
    pointer-events: none;
    mix-blend-mode: multiply;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: var(--s-md) var(--s-xl);
    border-radius: var(--r-md);
    font-weight: 700;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    border: none;
    gap: var(--s-sm);
}

.btn-brand {
    background: var(--brand);
    color: var(--white);
    box-shadow: 0 4px 14px 0 rgba(26, 86, 219, 0.39);
}

.btn-brand:hover {
    transform: translateY(-2px);
    background: var(--brand-muted);
    box-shadow: 0 6px 20px rgba(26, 86, 219, 0.23);
}

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

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

/* Components */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    padding: var(--s-xl);
    border-radius: var(--r-xl);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.card:hover {
    border-color: var(--brand);
    transform: translateY(-8px);
    box-shadow: var(--shadow-elevated);
}

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Header Tweaks */
.glass-nav {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.07);
}

.site-header {
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: transparent;
}

.site-header.scrolled {
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.site-header.scrolled .nav-container {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 99px;
    margin-top: 0.5rem;
    padding: 0.5rem 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

/* Grid Utilities */
.grid-2 { display: grid; grid-template-columns: repeat(1, 1fr); gap: 2rem; }
.grid-3 { display: grid; grid-template-columns: repeat(1, 1fr); gap: 2rem; }
.grid-4 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }

@media (min-width: 768px) {
    .grid-2 { grid-template-columns: repeat(2, 1fr); }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* Layout Utilities (Adaptive & Easy to Read) */
.flex { display: flex; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.flex-col { flex-direction: column; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; line-height: 2; }
.text-xl { font-size: 1.25rem; line-height: 2; }
.text-2xl { font-size: 1.5rem; }
.text-4xl { font-size: 2.25rem; }
.text-5xl { font-size: 3rem; }
.text-7xl { font-size: 4.5rem; }
.font-bold { font-weight: 700; }
.mb-4 { margin-bottom: 1rem; }
.mb-8 { margin-bottom: 2rem; }
.mb-12 { margin-bottom: 3rem; }
.mx-auto { margin-left: auto; margin-right: auto; }
.text-center { text-align: center; }
.max-w-3xl { max-width: 48rem; }
.max-w-4xl { max-width: 56rem; }

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 1.5rem;
}
@media (min-width: 768px) {
    .bento-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: minmax(200px, auto);
    }
    .bento-large { grid-column: span 2; grid-row: span 2; }
    .bento-tall { grid-row: span 2; }
}

.bento-item {
    background: var(--white);
    border: 1px solid var(--border);
    padding: var(--s-xl);
    border-radius: var(--r-xl);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
}

.bento-item:hover {
    border-color: var(--brand);
    transform: translateY(-6px);
    box-shadow: var(--shadow-elevated);
}

/* Modules Section */
.module-card {
    background: var(--white);
    border: 1px solid var(--border);
    padding: 2.5rem;
    border-radius: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.module-card:hover {
    transform: translateY(-8px);
    border-color: var(--brand);
    box-shadow: 0 20px 40px rgba(0,0,0,0.05);
}
.module-icon {
    width: 60px;
    height: 60px;
    background: var(--bg-raised);
    color: var(--brand);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    font-size: 1.75rem;
    margin-bottom: 1.5rem;
}

/* AI Section */
.ai-feature {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: 30px;
    padding: 4rem;
    display: flex;
    flex-direction: column;
    gap: 2rem;
    position: relative;
    overflow: hidden;
}
.ai-badge {
    display: inline-flex;
    padding: 0.5rem 1.25rem;
    background: var(--brand);
    color: var(--white);
    font-weight: 800;
    font-size: 0.75rem;
    border-radius: 99px;
    width: fit-content;
}

/* Results Section */
.result-card {
    border-bottom: 4px solid transparent;
    transition: all 0.3s ease;
    background: var(--white);
    padding: 2rem;
    border-radius: 12px;
}
.result-card:hover {
    border-bottom-color: var(--brand);
    background: var(--bg-raised);
}

/* Process Timeline */
.process-step {
    position: relative;
    padding-bottom: 4rem;
    padding-right: 4rem;
    border-right: 2px solid var(--border);
}
.process-step::before {
    content: '';
    position: absolute;
    right: -11px;
    top: 0;
    width: 20px;
    height: 20px;
    background: var(--brand);
    border: 4px solid var(--white);
    border-radius: 50%;
    box-shadow: 0 0 0 4px var(--bg-raised);
}
.process-step:last-child {
    border-right-color: transparent;
}

/* Final CTA & Footer Backgrounds */
.final-cta {
    background: linear-gradient(135deg, var(--bg-surface) 0%, var(--bg-raised) 100%);
    border-top: 1px solid var(--border);
}

.footer-architectural {
    background: var(--bg-void);
    position: relative;
    overflow: hidden;
}

.footer-watermark {
    position: absolute;
    bottom: -10%;
    right: -5%;
    font-size: 25vw;
    font-weight: 900;
    color: rgba(0, 0, 0, 0.02);
    pointer-events: none;
    line-height: 1;
    white-space: nowrap;
    z-index: 0;
}

/* Blog Listing & Details */
.blog-card-img {
    aspect-ratio: 16/9;
    width: 100%;
    object-fit: cover;
    border-radius: var(--r-md);
    transition: transform 0.5s ease;
}
.blog-card:hover .blog-card-img {
    transform: scale(1.05);
}

.blog-toc {
    position: sticky;
    top: 8rem;
    padding: var(--s-lg);
    border-radius: var(--r-xl);
    border: 1px solid var(--border);
    background-color: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(8px);
    display: none;
}
@media (min-width: 1024px) {
    .blog-toc { display: block; }
}

.blog-toc-mobile {
    padding: var(--s-md);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    background-color: var(--bg-raised);
    margin-bottom: var(--s-lg);
}
@media (min-width: 1024px) {
    .blog-toc-mobile { display: none; }
}

.article-content h2 { margin-top: var(--s-2xl); margin-bottom: var(--s-md); font-size: var(--t-2xl); }
.article-content h3 { margin-top: var(--s-xl); margin-bottom: var(--s-sm); font-size: var(--t-xl); }
.article-content p { margin-bottom: var(--s-md); color: var(--text-main); opacity: 0.8; line-height: 1.618; }
.article-content ul { list-style-type: disc; list-style-position: inside; margin-bottom: var(--s-md); padding-right: var(--s-md); }
.article-content ol { list-style-type: decimal; list-style-position: inside; margin-bottom: var(--s-md); padding-right: var(--s-md); }

.tip-box {
    padding: var(--s-lg);
    border-radius: var(--r-xl);
    background-color: rgba(26, 86, 219, 0.05);
    border-right: 4px solid var(--brand);
    margin-bottom: var(--s-xl);
}

/* FAQ Accordion */
.faq-item {
    border-bottom: 1px solid var(--border);
    padding: var(--s-md) 0;
}
.faq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    text-align: right;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
}
.faq-answer {
    overflow: hidden;
    transition: all 0.3s ease;
    max-height: 0;
    opacity: 0;
}
.faq-item.active .faq-answer {
    max-height: 400px;
    opacity: 1;
    margin-top: var(--s-sm);
    color: var(--text-muted);
}
.faq-icon {
    transition: transform 0.3s ease;
}
.faq-item.active .faq-icon {
    transform: rotate(180deg);
}

/* RTL Helpers */
[dir="rtl"] .ml-auto { margin-right: auto; margin-left: 0; }
[dir="rtl"] .mr-auto { margin-left: auto; margin-right: 0; }
