/* ==========================================================================
   HA Smart Pips Academy — Design Tokens
   One source of truth for colour, type, space, depth and motion.
   Dark is the primary experience; light is designed, not inverted.
   ========================================================================== */

:root {
    /* --- Surfaces -------------------------------------------------------
       Layered graphite rather than pure black. Pure #000 smears on OLED and
       kills the sense of depth that the glass panels depend on. */
    --bg-base:        #05080D;
    --bg-primary:     #070B12;
    --bg-secondary:   #0A0F18;
    --bg-elevated:    #0E141F;

    --surface-1:      rgba(255, 255, 255, 0.026);
    --surface-2:      rgba(255, 255, 255, 0.045);
    --surface-3:      rgba(255, 255, 255, 0.070);
    --surface-glass:  rgba(13, 19, 29, 0.72);
    --surface-solid:  #111927;

    /* --- Text ---------------------------------------------------------- */
    --text-primary:   #EEF3FA;
    --text-secondary: #A9B8CC;
    --text-muted:     #6E7F96;
    --text-inverse:   #05080D;

    /* --- Borders ------------------------------------------------------- */
    --border-soft:    rgba(255, 255, 255, 0.070);
    --border-medium:  rgba(255, 255, 255, 0.120);
    --border-strong:  rgba(255, 255, 255, 0.190);

    /* --- Brand accents --------------------------------------------------
       Emerald carries the brand, gold marks achievement, blue marks data.
       Used sparingly: accents earn attention only if they stay rare. */
    --accent:         #12D6A0;
    --accent-soft:    #1FEFB4;
    --accent-deep:    #0A8F6B;
    --accent-ink:     #04120C;

    --gold:           #E8B65A;
    --gold-soft:      #F5D08A;
    --blue:           #4C8DFF;
    --blue-soft:      #7EAEFF;
    --violet:         #8B7BFF;

    --success:        #12D6A0;
    --warning:        #E8B65A;
    --danger:         #FF6B6B;

    /* --- Accent washes (tint backgrounds without opacity on the element) */
    --accent-wash:    rgba(18, 214, 160, 0.10);
    --gold-wash:      rgba(232, 182, 90, 0.10);
    --blue-wash:      rgba(76, 141, 255, 0.10);
    --danger-wash:    rgba(255, 107, 107, 0.10);

    /* --- Ambient light --------------------------------------------------
       Large, slow, low-opacity radials that give the page atmosphere. */
    --glow-accent:    rgba(18, 214, 160, 0.16);
    --glow-blue:      rgba(76, 141, 255, 0.14);
    --glow-gold:      rgba(232, 182, 90, 0.10);
    --grid-line:      rgba(255, 255, 255, 0.030);

    /* --- Typography ------------------------------------------------------
       Arabic leads. IBM Plex Sans Arabic is a genuine Arabic design, not a
       Latin face with Arabic bolted on, and it pairs cleanly with Inter. */
    --font-ar: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
    --font-en: 'Inter', 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'JetBrains Mono', 'IBM Plex Sans Arabic', ui-monospace, 'SF Mono', monospace;
    --font-body: var(--font-ar);

    /* Fluid scale — clamp keeps 390px readable and 1920px cinematic. */
    --fs-hero:    clamp(2.35rem, 1.30rem + 4.4vw, 5.00rem);
    --fs-h1:      clamp(2.00rem, 1.30rem + 2.9vw, 3.60rem);
    --fs-h2:      clamp(1.60rem, 1.15rem + 1.9vw, 2.70rem);
    --fs-h3:      clamp(1.20rem, 1.02rem + 0.8vw, 1.60rem);
    --fs-lead:    clamp(1.02rem, 0.94rem + 0.4vw, 1.22rem);
    --fs-body:    1rem;
    --fs-sm:      0.9rem;
    --fs-xs:      0.8rem;
    --fs-metric:  clamp(1.9rem, 1.3rem + 2.4vw, 3.1rem);

    --lh-tight:   1.14;
    --lh-snug:    1.35;
    --lh-body:    1.75;

    --ls-label:   0.16em;
    --ls-tight:   -0.02em;

    /* --- Space (density 4/10 — marketing page, room to breathe) --------- */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;
    --space-10: 8rem;
    --section-y: clamp(3rem, 2.2rem + 2.8vw, 5rem);

    /* --- Radius -------------------------------------------------------- */
    --radius-xs: 6px;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --radius-pill: 999px;

    /* --- Depth ---------------------------------------------------------- */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.30);
    --shadow-md: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
    --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.70);
    --shadow-xl: 0 40px 110px -30px rgba(0, 0, 0, 0.80);
    --shadow-glow: 0 0 0 1px rgba(18, 214, 160, 0.22), 0 18px 60px -20px rgba(18, 214, 160, 0.32);

    /* --- Motion ---------------------------------------------------------
       Expo-out is the house easing: fast departure, soft landing. */
    --ease-out: cubic-bezier(0.16, 1, 0.30, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --dur-fast: 160ms;
    --dur-base: 260ms;
    --dur-slow: 520ms;
    --dur-reveal: 900ms;

    --container: 1240px;
    --container-narrow: 820px;
    --header-h: 76px;
}

/* --------------------------------------------------------------------------
   Light theme — a premium financial publication, not an inverted dark theme.
   Warmer paper tones, deeper accents so contrast stays above 4.5:1 on white.
   -------------------------------------------------------------------------- */
[data-theme="light"] {
    --bg-base:        #F6F8FB;
    --bg-primary:     #FFFFFF;
    --bg-secondary:   #F2F5F9;
    --bg-elevated:    #FFFFFF;

    --surface-1:      rgba(11, 22, 40, 0.020);
    --surface-2:      rgba(11, 22, 40, 0.038);
    --surface-3:      rgba(11, 22, 40, 0.060);
    --surface-glass:  rgba(255, 255, 255, 0.82);
    --surface-solid:  #FFFFFF;

    --text-primary:   #0B1424;
    --text-secondary: #43536B;
    --text-muted:     #6B7B92;
    --text-inverse:   #FFFFFF;

    --border-soft:    rgba(11, 22, 40, 0.085);
    --border-medium:  rgba(11, 22, 40, 0.140);
    --border-strong:  rgba(11, 22, 40, 0.230);

    /* Deepened so accent text and thin strokes stay legible on paper. */
    --accent:         #06976F;
    --accent-soft:    #0BB98A;
    --accent-deep:    #046B4E;
    --accent-ink:     #FFFFFF;

    --gold:           #A97614;
    --gold-soft:      #C89A34;
    --blue:           #2563EB;
    --blue-soft:      #4C8DFF;
    --violet:         #6D5CE0;

    --success:        #06976F;
    --warning:        #A97614;
    --danger:         #D1483F;

    --accent-wash:    rgba(6, 151, 111, 0.09);
    --gold-wash:      rgba(169, 118, 20, 0.10);
    --blue-wash:      rgba(37, 99, 235, 0.08);
    --danger-wash:    rgba(209, 72, 63, 0.08);

    --glow-accent:    rgba(6, 151, 111, 0.10);
    --glow-blue:      rgba(37, 99, 235, 0.09);
    --glow-gold:      rgba(169, 118, 20, 0.07);
    --grid-line:      rgba(11, 22, 40, 0.045);

    --shadow-sm: 0 1px 2px rgba(16, 32, 56, 0.06);
    --shadow-md: 0 10px 28px -12px rgba(16, 32, 56, 0.18);
    --shadow-lg: 0 28px 64px -24px rgba(16, 32, 56, 0.22);
    --shadow-xl: 0 44px 110px -34px rgba(16, 32, 56, 0.26);
    --shadow-glow: 0 0 0 1px rgba(6, 151, 111, 0.22), 0 18px 50px -22px rgba(6, 151, 111, 0.28);
}

html[dir="ltr"] { --font-body: var(--font-en); }

/* ==========================================================================
   Reset + base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    transition: background-color var(--dur-slow) var(--ease-out), color var(--dur-slow) var(--ease-out);
}

h1, h2, h3, h4 {
    margin: 0;
    line-height: var(--lh-tight);
    letter-spacing: var(--ls-tight);
    font-weight: 700;
}
p { margin: 0; }
img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* Focus is never removed — only restyled. Keyboard users need to see it. */
:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: var(--accent-ink); }

.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.skip-link {
    position: fixed; inset-inline-start: 50%; top: -100px;
    transform: translateX(-50%);
    z-index: 999;
    padding: 0.7rem 1.4rem;
    background: var(--accent); color: var(--accent-ink);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    font-weight: 600;
    transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus { top: 0; }

/* ==========================================================================
   Layout primitives
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: clamp(1.1rem, 0.6rem + 2.4vw, 2.5rem);
}
.container--narrow { max-width: var(--container-narrow); }

.section { position: relative; padding-block: var(--section-y); }
.section--tight { padding-block: calc(var(--section-y) * 0.62); }

/* ==========================================================================
   Type utilities
   ========================================================================== */

.eyebrow {
    display: inline-flex; align-items: center; gap: 0.6rem;
    font-family: var(--font-mono);
    font-size: var(--fs-xs);
    letter-spacing: var(--ls-label);
    text-transform: uppercase;
    color: var(--accent);
    margin: 0 0 var(--space-4);
}
.eyebrow::before {
    content: ""; width: 26px; height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent));
}

.section-title { font-size: var(--fs-h2); margin-bottom: var(--space-4); }
.section-lead {
    font-size: var(--fs-lead);
    color: var(--text-secondary);
    max-width: 62ch;
    line-height: var(--lh-body);
}
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-accent { color: var(--accent); }
.text-center { text-align: center; }
.mono { font-family: var(--font-mono); font-feature-settings: "tnum"; }

/* Gradient headline treatment — used once or twice per page, never everywhere. */
.text-gradient {
    background: linear-gradient(100deg, var(--text-primary) 20%, var(--accent) 65%, var(--gold) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center; gap: 0.6rem;
    padding: 0.85rem 1.6rem;
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-weight: 600;
    font-size: var(--fs-sm);
    white-space: nowrap;
    min-height: 46px;
    transition: transform var(--dur-fast) var(--ease-out),
                background-color var(--dur-base) var(--ease-out),
                border-color var(--dur-base) var(--ease-out),
                box-shadow var(--dur-base) var(--ease-out),
                color var(--dur-base) var(--ease-out);
}
.btn:active { transform: scale(0.97); }
.btn .icon { width: 17px; height: 17px; transition: transform var(--dur-base) var(--ease-out); }
.btn:hover .icon--arrow { transform: translateX(calc(var(--dir-flip, 1) * 4px)); }

.btn--primary {
    background: linear-gradient(135deg, var(--accent-soft), var(--accent));
    color: var(--accent-ink);
    box-shadow: 0 10px 30px -12px var(--glow-accent), inset 0 1px 0 rgba(255,255,255,0.28);
}
.btn--primary:hover {
    box-shadow: 0 16px 44px -12px rgba(18, 214, 160, 0.45), inset 0 1px 0 rgba(255,255,255,0.35);
    transform: translateY(-2px);
}

.btn--ghost {
    background: var(--surface-2);
    border-color: var(--border-medium);
    color: var(--text-primary);
    backdrop-filter: blur(10px);
}
.btn--ghost:hover { background: var(--surface-3); border-color: var(--border-strong); transform: translateY(-2px); }

.btn--quiet { background: transparent; color: var(--text-secondary); }
.btn--quiet:hover { color: var(--text-primary); background: var(--surface-2); }

.btn--lg { padding: 1.05rem 2.1rem; font-size: var(--fs-body); min-height: 54px; }
.btn--sm { padding: 0.55rem 1.05rem; font-size: var(--fs-xs); min-height: 38px; }
.btn--block { display: flex; width: 100%; }

.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; }

/* ==========================================================================
   Surfaces
   ========================================================================== */

.panel {
    background: var(--surface-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(14px);
}

.glass {
    background: var(--surface-glass);
    border: 1px solid var(--border-soft);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
}

.chip {
    display: inline-flex; align-items: center; gap: 0.4rem;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-pill);
    background: var(--surface-2);
    border: 1px solid var(--border-soft);
    font-size: var(--fs-xs);
    color: var(--text-secondary);
    white-space: nowrap;
}
.chip--accent { background: var(--accent-wash); border-color: rgba(18,214,160,0.28); color: var(--accent); }
.chip--gold { background: var(--gold-wash); border-color: rgba(232,182,90,0.28); color: var(--gold); }

/* ==========================================================================
   Motion utilities — the reveal engine's vocabulary
   ========================================================================== */

[data-reveal] {
    opacity: 0;
    transition: opacity var(--dur-reveal) var(--ease-out),
                transform var(--dur-reveal) var(--ease-out),
                filter var(--dur-reveal) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
    will-change: opacity, transform;
}
[data-reveal="up"]      { transform: translateY(28px); }
[data-reveal="fade"]    { transform: none; }
[data-reveal="blur"]    { filter: blur(12px); transform: translateY(14px); }
[data-reveal="scale"]   { transform: scale(0.94); }
[data-reveal="side"]    { transform: translateX(calc(var(--dir-flip, 1) * -34px)); }
[data-reveal="clip"]    { clip-path: inset(0 0 100% 0); transform: none; }

[data-reveal].is-revealed {
    opacity: 1;
    transform: none;
    filter: none;
    clip-path: inset(0 0 0 0);
    will-change: auto;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    [data-reveal] { opacity: 1 !important; transform: none !important; filter: none !important; clip-path: none !important; }
}
