:root {
    --bg-primary: #0B0E1D;
    --text-primary: #FFFFFF;
    --accent-primary: #2563EA;
    --accent-secondary: #7c3aed; /* Added secondary accent for gradients */
    --card-bg: rgba(255, 255, 255, 0.03); /* Slightly more transparent */
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-bg: rgba(255, 255, 255, 0.06);
    --glow-color: rgba(37, 99, 234, 0.15);
}

html {
    font-size: 100%;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: 100px; /* Header height + buffer */
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: 'Vazirmatn', sans-serif;
    font-size: clamp(15px, 1vw + 12px, 18px);
    line-height: 1.7; /* Increased line-height */
    background-image: 
        radial-gradient(circle at 15% 50%, rgba(37, 99, 234, 0.08) 0%, transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(124, 58, 237, 0.08) 0%, transparent 25%);
    background-attachment: fixed;
}

img {
    max-width: 100%;
    height: auto;
}

.brand-mark {
    display: inline-flex;
    align-items: baseline;
    white-space: pre;
}

.brand-mark [data-part="fade"],
.brand-mark [data-part="fade-space"] {
    will-change: opacity;
}

.brand-mark [data-part="dex"],
.brand-mark [data-part="aca"] {
    display: inline-block;
    will-change: transform;
}

/* Per-character spans created at runtime for swipe fade */
.brand-mark [data-char] {
    display: inline-block;
    will-change: opacity, transform;
    transition: opacity 220ms linear;
}
.brand-mark [data-char="space"] {
    /* keep natural spacing using non-breaking space char */
    display: inline-block;
}

/* Splash overlay styles */
#splashOverlay.splash-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-primary);
    z-index: 9999;
    pointer-events: auto;
}
.splash-center {
    text-align: center;
    padding: 2rem;
}
.splash-brand {
    position: relative;
    display: inline-block;
}
.splash-brand-bg {
    position: absolute;
    inset: -6px;
    border-radius: 1rem;
    background: var(--bg-primary);
    z-index: -1;
}
.splash-brand-inner {
    display: inline-flex;
    align-items: baseline;
    gap: 0; /* keep ACA and DEX tight when middle collapses */
    font-weight: 900;
    font-size: clamp(2rem, 6.5vw, 4rem);
    line-height: 1;
    position: relative;
}

/* Initial positions for converge animation */
.splash-aca,
.splash-dex {
    display: inline-block;
    position: relative;
    z-index: 3; /* sit above middle characters so they can "swipe" them */
    will-change: transform, opacity;
    transition: opacity 600ms ease; /* JS will animate transform via Web Animations API */
}
    .splash-aca { transform: none; }
    .splash-dex { transform: none; }
.splash-fade { transition: opacity 300ms ease; display: inline-block; transform-origin: center; will-change: opacity; position: relative; z-index: 2; }
.splash-fade-space { display: inline-block; position: relative; z-index: 2; }

/* Per-character spans for splash specifically */
[data-splash-char] {
    display: inline-block;
    transition: opacity 160ms linear;
    opacity: 1;
}

/* When fade parts collapse we remove their layout footprint so ACA and DEX meet */
    .splash-animate .splash-fade,
    .splash-animate .splash-fade-space {
        /* fade slightly after ACA/DEX start moving so it appears they're swiping the text away */
        opacity: 0;
        pointer-events: none;
        transition: opacity 300ms ease 240ms;
        display: inline-block;
    }

    /* ACA/DEX transforms are handled in JS to avoid CSS conflicts and precise pixel control */

/* Logo initial */
.splash-logo {
    margin-bottom: 1.5rem;
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
    transition: transform 900ms cubic-bezier(.22,.9,.3,1), opacity 700ms ease;
}
.splash-logo-svg { width: clamp(80px, 16vw, 160px); height: auto; display: block; margin: 0 auto; }
.splash-logo-svg * { fill: #ffffff !important; stroke: none !important; }

/* Active animation states */
#splashOverlay.splash-animate .splash-fade { opacity: 0; }

/* Reduce focus ring on header link unless keyboard-used */
#brandMark:focus { outline: none; }
#brandMark:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; border-radius: 8px; }

#splashOverlay.splash-logo-up .splash-logo { opacity: 1; transform: translateY(0) scale(1); }

/* Fade out overlay */
.splash-fade-out { transition: opacity 700ms ease, transform 700ms ease; opacity: 0; transform: scale(0.995); pointer-events: none; }

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
    .splash-aca, .splash-dex, .splash-fade, .splash-logo { transition: none !important; transform: none !important; opacity: 1 !important; }
    #splashOverlay { display: none !important; }
}

.fluid-h1 {
    font-size: clamp(1.85rem, 5.2vw, 3.15rem);
    line-height: 1.15;
}

.fluid-h2 {
    font-size: clamp(1.5rem, 4.2vw, 2.25rem);
    line-height: 1.2;
}

.fluid-h3 {
    font-size: clamp(1.125rem, 2.4vw, 1.5rem);
    line-height: 1.25;
}

.fluid-lead {
    font-size: clamp(1rem, 1.4vw + 0.75rem, 1.125rem);
    line-height: 1.8;
}

.chart-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
}

.chart-container--hero {
    height: clamp(220px, 72vw, 360px);
}

.chart-container--curve {
    height: clamp(260px, 80vw, 380px);
}

.chart-container--radar {
    height: clamp(240px, 70vw, 320px);
}

@media (min-width: 768px) {
    .chart-container--hero {
        height: 350px;
    }
    .chart-container--curve {
        height: 350px;
    }
    .chart-container--radar {
        height: 300px;
    }
}

@media (min-width: 1024px) {
    .chart-container--hero {
        height: 350px;
    }
    .chart-container--curve {
        height: 360px;
    }
    .chart-container--radar {
        height: 300px;
    }
}

.glass-card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--card-border);
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px -10px rgba(37, 99, 234, 0.15);
    border-color: rgba(255, 255, 255, 0.2);
    background: var(--card-hover-bg);
}

/* Gradient Text Utility */
.text-gradient {
    background: linear-gradient(135deg, #FFFFFF 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.text-gradient-accent {
    background: linear-gradient(135deg, #60a5fa 0%, #a78bfa 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Ambient Glow */
.ambient-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--accent-primary) 0%, transparent 70%);
    filter: blur(80px);
    opacity: 0.15;
    z-index: -1;
    pointer-events: none;
    border-radius: 50%;
}

.active-filter {
    background-color: var(--accent-primary) !important;
    color: white !important;
}

.persona-active {
    border-color: var(--accent-primary) !important;
    background-color: rgba(37, 99, 234, 0.1) !important;
}

.filter-btn,
.curve-btn,
.persona-item,
.btn-bazar,
.nav-toggle {
    min-height: 44px;
}

.filter-btn,
.nav-link {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 10px;
}

.nav-link {
    display: inline-flex;
    align-items: center;
}

.filter-btn:focus-visible,
.curve-btn:focus-visible,
.persona-item:focus-visible,
.nav-link:focus-visible,
.btn-bazar:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
    border-radius: 12px;
}

.nav-toggle {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(255, 255, 255, 0.03);
}

.nav-toggle:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.nav-toggle-lines {
    width: 18px;
    height: 14px;
    display: inline-flex;
    flex-direction: column;
    justify-content: space-between;
}

.nav-toggle-lines span {
    display: block;
    height: 2px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.85);
    transform-origin: center;
    transition: transform 180ms ease, opacity 180ms ease;
}

.nav-toggle.is-open .nav-toggle-lines span:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
}

.nav-toggle.is-open .nav-toggle-lines span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.is-open .nav-toggle-lines span:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
}

/* Custom Bazar Button */
.btn-bazar {
    display: inline-block;
    width: 150px; /* Adjust based on typical app store badge size */
    height: 50px; 
    background-image: url('../assets/images/bazar.png');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    text-indent: -9999px; /* Hide text */
    border: none;
    background-color: transparent;
    cursor: pointer;
    transition: transform 0.2s;
}

.btn-bazar:hover {
    transform: scale(1.05);
}

/* Scrollbar customization for dark theme */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Range Slider Styling */
input[type=range] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 10px rgba(37, 99, 234, 0.5);
}

input[type=range]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

input[type=range]:focus {
    outline: none;
}
