/* ============================================================
   BeatWave — Shared Design System v4
   "Obsidian" — deep blue-black canvas, white type,
   single electric violet accent (#7c5cff). NO GRADIENTS.
   ============================================================ */

/* ============================================================
   1. Tokens — Dark (default)
   ============================================================ */
:root {
    /* Canvas — blue-black, never pure #000 */
    color-scheme: dark;
    --bg:            #05060b;
    --bg-deep:       #030408;
    --bg-raised:     #0c1020;
    --bg-card:       rgba(255, 255, 255, 0.05);
    --bg-card-hover: rgba(255, 255, 255, 0.08);
    --bg-glass:      rgba(8, 10, 20, 0.85);
    --bg-inset:      rgba(255, 255, 255, 0.03);

    /* Text */
    --text-hi:  #f5f6fb;
    --text-mid: #b3b8d2;
    --text-lo:  #6f7595;

    /* Lines / borders */
    --line:      rgba(255, 255, 255, 0.10);
    --line-soft: rgba(255, 255, 255, 0.055);
    --line-hi:   rgba(255, 255, 255, 0.22);

    /* Single signature accent — electric violet */
    --accent:       #8b7bff;
    --accent-soft:  rgba(139, 123, 255, 0.18);
    --accent-line:  rgba(139, 123, 255, 0.48);
    --accent-contrast: #ffffff;

    /* Legacy aliases — kept so existing rules keep resolving */
    --violet:       #7c5cff;
    --violet-soft:  #a78bfa;
    --violet-deep:  #5b3ff0;
    --cyan:         #22d3ee;
    --cyan-soft:    #67e8f9;
    --cyan-deep:    #0ea5c9;
    --green:        #34d399;
    --amber:        #fbbf24;
    --discord:      #5865f2;
    --pink:         #f472b6;

    /* Radii */
    --r-sm:   10px;
    --r-md:   14px;
    --r-lg:   18px;
    --r-xl:   24px;
    --r-2xl:  32px;
    --r-full: 999px;

    /* Elevation — cool-tinted, accent-aware */
    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 4px 14px rgba(0, 0, 0, 0.45);
    --shadow-md: 0 14px 38px -8px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -18px rgba(0, 0, 0, 0.85);
    --shadow-accent: 0 14px 44px -14px rgba(124, 92, 255, 0.55);
    --shadow-cyan:   0 14px 44px -14px rgba(34, 211, 238, 0.4);

    /* Inner hairline used by every glass surface */
    --inset-hair: inset 0 1px 0 rgba(255, 255, 255, 0.09);

    /* Motion */
    --ease:       cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-out:   cubic-bezier(0.16, 1, 0.3, 1);
    --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
    --t-fast: 0.18s var(--ease);
    --t-med:  0.34s var(--ease);
    --t-slow: 0.6s var(--ease);

    /* Type — display / text / mono trio (premium editorial pairing) */
    --font:         'Plus Jakarta Sans', 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-display: 'Instrument Serif', 'Plus Jakarta Sans', Georgia, serif;
    --font-body:    'Plus Jakarta Sans', 'Instrument Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mono:         'JetBrains Mono', ui-monospace, 'Cascadia Mono', Menlo, monospace;

    /* Fluid type scale */
    --fs-display: clamp(2.75rem, 6.6vw, 5rem);
    --fs-h1:      clamp(2.2rem, 4.8vw, 3.7rem);
    --fs-h2:      clamp(1.7rem, 3.2vw, 2.5rem);
    --fs-h3:      clamp(1.28rem, 2.1vw, 1.65rem);
    --fs-h4:      clamp(1.06rem, 1.5vw, 1.28rem);
    --fs-lead:    clamp(1.02rem, 1.3vw, 1.18rem);
    --fs-eyebrow: 0.72rem;

    --text-xs:   0.72rem;
    --text-sm:   0.84rem;
    --text-base: 1rem;
    --text-lg:   1.125rem;
    --text-xl:   1.25rem;

    /* Leading + tracking (tuned for a serif display face) */
    --lh-display: 1.06;
    --lh-head:    1.16;
    --lh-body:    1.75;
    --tr-display: -0.02em;
    --tr-head:    -0.012em;
    --tr-eyebrow:  0.16em;
    --tr-body:    -0.004em;

    /* Layout */
    --container: 1200px;
    --gutter: clamp(18px, 4.5vw, 40px);
}

/* ============================================================
   2. Tokens — Light
   ============================================================ */
html.light-theme,
body.light-theme {
    color-scheme: light;
    --bg:            #f8f9fd;
    --bg-deep:       #eef1fa;
    --bg-raised:     #ffffff;
    --bg-card:       rgba(9, 10, 20, 0.035);
    --bg-card-hover: rgba(9, 10, 20, 0.055);
    --bg-glass:      rgba(255, 255, 255, 0.88);
    --bg-inset:      rgba(9, 10, 20, 0.025);

    --text-hi:  #0a0b14;
    --text-mid: #4d5165;
    --text-lo:  #767b93;

    --line:      rgba(9, 10, 20, 0.11);
    --line-soft: rgba(9, 10, 20, 0.06);
    --line-hi:   rgba(9, 10, 20, 0.24);

    --accent:       #7c5cff;
    --accent-soft:  rgba(124, 92, 255, 0.14);
    --accent-line:  rgba(124, 92, 255, 0.38);

    --violet:       #6d4dfb;
    --violet-soft:  #8b6dff;
    --violet-deep:  #5b3ff0;
    --cyan:         #0ea5c9;
    --cyan-soft:    #22b8db;
    --cyan-deep:    #0b7f9b;
    --green:        #059669;
    --amber:        #b45309;
    --discord:      #4f5bd5;

    --shadow-xs: 0 1px 2px rgba(16, 18, 34, 0.06);
    --shadow-sm: 0 2px 10px rgba(16, 18, 34, 0.06);
    --shadow-md: 0 12px 30px -10px rgba(16, 18, 34, 0.14);
    --shadow-lg: 0 24px 56px -20px rgba(16, 18, 34, 0.2);
    --shadow-accent: 0 12px 34px -14px rgba(109, 77, 251, 0.45);
    --shadow-cyan:   0 12px 34px -14px rgba(14, 165, 201, 0.4);

    --inset-hair: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ============================================================
   3. Global primitives
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 88px;
    /* Instrument Serif ships only weight 400 — never fake-bold the display face */
    font-synthesis-weight: none;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: var(--text-base);
    line-height: var(--lh-body);
    letter-spacing: var(--tr-body);
    background-color: var(--bg);
    color: var(--text-hi);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-optical-sizing: auto;
    font-variant-ligatures: contextual;
    transition: background-color var(--t-med), color var(--t-med);
}

img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, textarea, select { font-family: inherit; }
button { cursor: pointer; }

/* ---- Typographic roles ---- */
h1, h2, h3, h4, h5, h6 {
    margin: 0;
    font-family: var(--font-display);
    font-weight: 400;
    line-height: var(--lh-head);
    letter-spacing: var(--tr-head);
    color: var(--text-hi);
    text-wrap: balance;
}

h1 { font-size: var(--fs-h1); letter-spacing: var(--tr-display); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

/* Small headings drop to the sans face — serif is reserved for display scale */
h4, h5, h6 {
    font-family: var(--font);
    font-weight: 600;
    letter-spacing: -0.01em;
}
h4 { font-size: var(--fs-h4); }

p { text-wrap: pretty; }

b, strong { font-weight: 600; }

code, kbd, samp, pre { font-family: var(--mono); }

/* Display headline — the largest voice on any page */
.bw-display {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: var(--fs-display);
    line-height: var(--lh-display);
    letter-spacing: var(--tr-display);
}

/* Eyebrow / kicker — mono, tracked, quiet */
.bw-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--mono);
    font-size: var(--fs-eyebrow);
    font-weight: 600;
    letter-spacing: var(--tr-eyebrow);
    text-transform: uppercase;
    color: var(--text-lo);
}

/* Lead paragraph under a headline */
.bw-lead {
    font-size: var(--fs-lead);
    line-height: 1.6;
    font-weight: 400;
    color: var(--text-mid);
    letter-spacing: -0.004em;
    text-wrap: pretty;
}

/* Numerals that should not dance */
.bw-tnum { font-variant-numeric: tabular-nums; letter-spacing: 0; }

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

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 8px;
}

/* ============================================================
   4. Ambient field — shared aurora backdrop
   Opt-in: any page can add <div class="bw-aurora"> for the
   layered accent wash behind content.
   ============================================================ */
.bw-aurora {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    opacity: 0.55;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(124, 92, 255, 0.18) 0%, transparent 70%),
        radial-gradient(ellipse 60% 50% at 100% 100%, rgba(124, 92, 255, 0.10) 0%, transparent 70%);
}
@media (prefers-reduced-motion: reduce) {
    .bw-aurora { opacity: 0.25; }
}

/* Subtle grid overlay for texture */
.bw-grid {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.035;
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
    background-size: 80px 80px;
    mask-image: radial-gradient(70% 55% at 50% 0%, #000 0%, transparent 78%);
    -webkit-mask-image: radial-gradient(70% 55% at 50% 0%, #000 0%, transparent 78%);
}

/* ============================================================
   5. Buttons — solid accent, no gradients
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 28px;
    font-family: var(--font);
    font-size: var(--text-sm);
    font-weight: 600;
    letter-spacing: -0.005em;
    border-radius: var(--r-full);
    border: 1px solid transparent;
    text-decoration: none;
    white-space: nowrap;
    transition: transform var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast), border-color var(--t-fast), color var(--t-fast);
}

.btn-primary {
    background: var(--accent);
    color: var(--accent-contrast);
    border-color: var(--accent);
    box-shadow: 0 4px 18px -6px rgba(124, 92, 255, 0.45);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 28px -8px rgba(124, 92, 255, 0.55);
}
.btn-primary:active { transform: translateY(0) scale(0.98); }

.btn-ghost {
    background: transparent;
    color: var(--text-hi);
    border-color: var(--line);
}
.btn-ghost:hover {
    background: var(--bg-card);
    border-color: var(--line-hi);
}
.btn-ghost:active { background: var(--bg-raised); }

.btn-outline {
    background: transparent;
    color: var(--accent);
    border-color: var(--accent);
}
.btn-outline:hover {
    background: var(--accent-soft);
    border-color: var(--accent);
}
.btn-outline:active { background: rgba(124, 92, 255, 0.24); }

.btn-sm { padding: 10px 20px; font-size: var(--text-xs); }
.btn-lg { padding: 18px 36px; font-size: var(--text-base); }

/* ============================================================
   6. Form controls
   ============================================================ */
.field {
    display: grid;
    gap: 6px;
}
.field label {
    font-size: var(--text-xs);
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-mid);
}
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 12px 14px;
    font-size: var(--text-base);
    font-family: var(--font);
    color: var(--text-hi);
    background: var(--bg-raised);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transition: border-color var(--t-fast), box-shadow var(--t-fast), background-color var(--t-fast);
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-lo); }

/* ============================================================
   7. Cards / glass surfaces
   ============================================================ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background-color var(--t-med), border-color var(--t-med), box-shadow var(--t-med);
}
.card:hover {
    background: var(--bg-card-hover);
    border-color: var(--line-hi);
}
.card-glow {
    background: var(--bg-card);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--inset-hair), var(--shadow-md);
}

/* ============================================================
   8. Utility
   ============================================================ */
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(60px, 10vw, 120px); }
.section-tight { padding-block: clamp(32px, 6vw, 72px); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}