/* ═══════════════════════════════════════
   Aether Design System — Base
   "Mission Control" tokens, reset, shared
   console utilities (panel / label / led /
   readout), focus, reduced motion.
   Linked by EVERY document incl. index.html.
   ═══════════════════════════════════════ */

:root {
    /* ── Surfaces (OLED stack, darkest → lightest) ── */
    --bg-base:        #05070d;
    --bg-inset:       #02040a;
    --bg-panel:       #0a101b;
    --bg-panel-2:     #0e1624;
    --bg-overlay:     rgba(6, 10, 17, 0.88);

    /* ── Text ── */
    --text-primary:   #e9eff8;
    --text-secondary: #9db0c6;
    --text-muted:     #5f7187;   /* decorative micro-labels only */

    /* ── Signal + semantics ── */
    --signal:         #00e5ff;
    --signal-dim:     rgba(0, 229, 255, 0.55);
    --signal-bg:      rgba(0, 229, 255, 0.07);
    --ok:             #2bd576;
    --ok-bg:          rgba(43, 213, 118, 0.08);
    --warn:           #ffb000;
    --warn-bg:        rgba(255, 176, 0, 0.08);
    --err:            #ff5257;
    --err-bg:         rgba(255, 82, 87, 0.08);

    /* ── Hairlines ── */
    --line:           rgba(150, 172, 199, 0.13);
    --line-strong:    rgba(150, 172, 199, 0.30);
    --line-signal:    rgba(0, 229, 255, 0.50);

    /* ── Typography ── */
    --font-ui:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono:  'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
    --ls-label:   0.14em;
    --fs-micro:   0.6875rem;   /* 11px — mono labels, badges */
    --fs-data:    0.8125rem;   /* 13px — mono readouts */
    --fs-body:    0.9375rem;
    --fs-h2:      1.125rem;
    --fs-h1:      clamp(1.4rem, 3.5vw, 2.1rem);

    /* ── Spacing (4px base) ── */
    --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
    --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px;

    /* ── Radii (near-square = instrument) ── */
    --radius: 4px;
    --radius-sm: 2px;

    /* ── Glow / depth (static, swapped via class — never animated) ── */
    --glow-signal: 0 0 2px rgba(0, 229, 255, 0.6), 0 0 14px rgba(0, 229, 255, 0.22);
    --glow-ok:     0 0 2px rgba(43, 213, 118, 0.6), 0 0 10px rgba(43, 213, 118, 0.25);
    --shadow-panel: inset 0 1px 0 rgba(255, 255, 255, 0.03), 0 10px 30px rgba(0, 0, 0, 0.55);

    /* ── Motion ── */
    --t-fast: 120ms;
    --t-med: 220ms;
    --ease: cubic-bezier(0.2, 0, 0.2, 1);

    /* ── Transitional aliases (legacy names → new tokens) ── */
    --accent-cyan: var(--signal);
    --bg-surface: var(--bg-panel);
    --bg-card: var(--bg-panel);
    --bg-glass: var(--bg-panel);
    --bg-glass-hover: var(--bg-panel-2);
    --border-glass: var(--line);
    --border-active: var(--line-signal);
    --accent-glow: var(--glow-signal);
    --accent-gradient: linear-gradient(135deg, var(--signal), var(--signal));
    --font: var(--font-ui);
    --transition: var(--t-med) var(--ease);
}

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

body {
    font-family: var(--font-ui);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
}

/* scrollbar */
::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
    background: var(--text-muted);
    border-radius: 3px;
}

/* ── Console utilities ── */

/* Static scanline texture — opt-in via <body class="scanlines"> */
body.scanlines::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9998;
    background: repeating-linear-gradient(0deg,
        rgba(255, 255, 255, 0.015) 0 1px,
        transparent 1px 3px);
}

.panel {
    background: var(--bg-panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-panel);
}

/* Corner brackets via two pseudo-elements (top-left/bottom-right pair each) */
.panel--brackets {
    position: relative;
}

.panel--brackets::before,
.panel--brackets::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    pointer-events: none;
    transition: border-color var(--t-med) var(--ease);
}

.panel--brackets::before {
    top: -1px;
    left: -1px;
    border-top: 1px solid var(--line-strong);
    border-left: 1px solid var(--line-strong);
}

.panel--brackets::after {
    bottom: -1px;
    right: -1px;
    border-bottom: 1px solid var(--line-strong);
    border-right: 1px solid var(--line-strong);
}

.label {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    text-transform: uppercase;
    letter-spacing: var(--ls-label);
    color: var(--text-muted);
}

.led {
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 1px;
    background: var(--text-muted);
    flex-shrink: 0;
}

.led--ok     { background: var(--ok); box-shadow: 0 0 4px var(--ok); }
.led--warn   { background: var(--warn); box-shadow: 0 0 4px var(--warn); }
.led--err    { background: var(--err); box-shadow: 0 0 4px var(--err); }
.led--signal { background: var(--signal); box-shadow: 0 0 4px var(--signal); }

.led--live {
    animation: led-blink 1.2s steps(2, start) infinite;
}

@keyframes led-blink {
    50% { opacity: 0.35; }
}

.readout {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: var(--fs-data);
    background: var(--bg-inset);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 2px 6px;
    color: var(--text-secondary);
}

/* ── Accessibility ── */
.skip-link {
    position: absolute;
    top: -100px;
    left: 0;
    background: var(--signal);
    color: var(--bg-base);
    padding: 0.5rem 1rem;
    font-weight: 700;
    font-size: 0.9rem;
    z-index: 9999;
    transition: top 0.2s;
    border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
    top: 0;
}

*:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
}

input:focus-visible,
select:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 0;
}

a {
    color: var(--signal);
    text-decoration: none;
    transition: opacity var(--t-med) var(--ease);
}

a:hover {
    opacity: 0.8;
}

audio {
    display: none;
}

/* Touch targets */
button,
.btn-play,
.btn-fav,
.btn-ctrl,
.filter-select {
    min-height: 48px;
    touch-action: manipulation;
}

.btn-fav {
    min-width: 48px;
}

/* Padding for master player bar (reset by shell.css in index.html) */
body {
    padding-bottom: 80px;
}

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

    .eq-bar {
        transform: none !important;
    }

    .led--live {
        animation: none;
        opacity: 1;
    }
}
