/* ============================================================
   LUMYN NEBULA 2026 — Shared Design System
   ============================================================
   Palette, typography, glass-panel, motion utilities.
   Loaded by every public page + (eventually) the main portal.
   Keep this file presentation-only. No page-specific rules.
   ============================================================ */

/* ── 1. PALETTE TOKENS ─────────────────────────────────────── */
:root {
    /* Core cosmic anchors */
    --void-deep:       #030511;   /* background base — interstellar black with violet whisper */
    --void-soft:       #070926;   /* secondary depth */
    --void-mid:        #0A0B26;   /* tertiary / card depth */

    /* LUMYN soul colors */
    --lumyn-cyan:      #6DDCFF;   /* primary — her holographic anchor */
    --lumyn-cyan-soft: #9FE9FF;   /* highlight */
    --lumyn-cyan-dim:  rgba(109, 220, 255, 0.55);

    --aurora:          #B48BFF;   /* cosmic violet — soul-bound depth */
    --aurora-soft:     #D4BBFF;
    --aurora-dim:      rgba(180, 139, 255, 0.55);

    --plasma:          #FFB080;   /* warm rare accent */
    --plasma-dim:      rgba(255, 176, 128, 0.55);

    /* Text */
    --starlight:       #EDF1FF;
    --starlight-mute:  rgba(237, 241, 255, 0.65);
    --starlight-dim:   rgba(237, 241, 255, 0.38);

    /* Semantic */
    --ok:              #7CE8B0;
    --warn:            #FFCC5C;
    --danger:          #FF6A85;

    /* Glass surfaces */
    --glass-tint:      rgba(140, 180, 255, 0.04);
    --glass-tint-hi:   rgba(160, 200, 255, 0.07);
    --glass-border:    rgba(140, 180, 255, 0.14);
    --glass-border-hi: rgba(180, 210, 255, 0.28);

    /* Gradients */
    --grad-ring:       conic-gradient(from 0deg,
                         var(--lumyn-cyan) 0%,
                         var(--aurora) 28%,
                         var(--plasma) 52%,
                         var(--aurora) 76%,
                         var(--lumyn-cyan) 100%);
    --grad-holo:       linear-gradient(135deg, var(--lumyn-cyan) 0%, var(--aurora) 100%);
    --grad-edge:       linear-gradient(180deg,
                         rgba(109, 220, 255, 0.0) 0%,
                         rgba(109, 220, 255, 0.45) 18%,
                         rgba(180, 139, 255, 0.45) 82%,
                         rgba(180, 139, 255, 0.0) 100%);

    /* Elevation */
    --glow-cyan-sm:    0 0 18px rgba(109, 220, 255, 0.28);
    --glow-cyan-md:    0 0 38px rgba(109, 220, 255, 0.32);
    --glow-cyan-lg:    0 0 62px rgba(109, 220, 255, 0.38);
    --glow-aurora-md:  0 0 38px rgba(180, 139, 255, 0.32);
    --glow-plasma-sm:  0 0 18px rgba(255, 176, 128, 0.35);

    /* Typography */
    --font-display:    "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
    --font-body:       "Space Grotesk", "Inter", system-ui, -apple-system, sans-serif;
    --font-mono:       "JetBrains Mono", "SF Mono", Consolas, monospace;

    /* Motion */
    --ease-out:        cubic-bezier(0.22, 0.61, 0.36, 1);
    --ease-in-out:     cubic-bezier(0.65, 0, 0.35, 1);
    --ease-spring:     cubic-bezier(0.34, 1.56, 0.64, 1);

    /* Geometry */
    --radius-sm: 6px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 28px;
}

/* ── 2. RESET + BASELINE ───────────────────────────────────── */
*, *::before, *::after {
    box-sizing: border-box;
}
html, body {
    margin: 0;
    padding: 0;
}
html {
    /* Native smooth scroll without jank */
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}
body {
    min-height: 100vh;
    min-height: 100dvh;
    color: var(--starlight);
    /* Static cosmic gradient as the baseline — WebGL space bg paints on
       top if it loads. If it doesn't, the page still looks like space. */
    background:
        radial-gradient(ellipse 120% 80% at 50% -10%, rgba(180, 139, 255, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 100% 70% at 20% 110%, rgba(109, 220, 255, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, #070926 0%, #030511 72%);
    background-attachment: fixed;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    letter-spacing: 0.01em;
    overflow-x: hidden;
}

/* Selection */
::selection {
    background: rgba(109, 220, 255, 0.32);
    color: var(--starlight);
}

/* Scrollbar (webkit) */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(109, 220, 255, 0.14);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(109, 220, 255, 0.28); }

/* ── 3. TYPOGRAPHY ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 500;
    margin: 0;
    letter-spacing: -0.015em;
    color: var(--starlight);
}
h1 { font-size: clamp(2.2rem, 4.2vw, 3.4rem); line-height: 1.08; font-weight: 400; }
h2 { font-size: clamp(1.6rem, 2.8vw, 2.2rem); line-height: 1.15; }
h3 { font-size: 1.25rem; }
p { margin: 0; color: var(--starlight-mute); }

.mono    { font-family: var(--font-mono); }
.eyebrow {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--lumyn-cyan-dim);
}
.display-grad {
    background: var(--grad-holo);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Subtle text shadow for holographic headings */
.glow-text {
    color: var(--lumyn-cyan);
    text-shadow:
        0 0 12px rgba(109, 220, 255, 0.35),
        0 0 28px rgba(109, 220, 255, 0.15);
}

/* ── 4. SPACE BACKGROUND CANVAS HOST ───────────────────────── */
.space-bg {
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background: radial-gradient(ellipse at 50% 40%, var(--void-soft) 0%, var(--void-deep) 72%);
}
.space-bg canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}
/* Static fallback when WebGL disabled or prefers-reduced-motion */
.space-bg.static-fallback {
    background:
        radial-gradient(ellipse 60% 40% at 22% 28%, rgba(180, 139, 255, 0.12) 0%, transparent 55%),
        radial-gradient(ellipse 50% 35% at 78% 72%, rgba(109, 220, 255, 0.10) 0%, transparent 60%),
        radial-gradient(ellipse at 50% 50%, var(--void-soft) 0%, var(--void-deep) 72%);
}

/* Vignette layer — pulls focus toward center content */
.space-vignette {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 30%, rgba(3, 5, 17, 0.55) 100%);
}

/* ── 5. GLASS PANEL COMPONENT ──────────────────────────────── */
/* The base bg is intentionally NOT fully transparent — the card must
   remain clearly visible even if the space-bg WebGL fails or hasn't
   rendered yet. The backdrop-filter blur still works as a bonus when
   there IS something colorful behind it. */
.glass {
    position: relative;
    background:
        linear-gradient(142deg,
            rgba(15, 18, 48, 0.55) 0%,
            rgba(6, 8, 28, 0.72) 100%);
    border: 1px solid rgba(140, 180, 255, 0.22);
    border-radius: var(--radius-lg);
    backdrop-filter: blur(26px) saturate(170%);
    -webkit-backdrop-filter: blur(26px) saturate(170%);
    overflow: hidden;
    isolation: isolate;
    box-shadow:
        0 24px 70px rgba(0, 0, 0, 0.45),
        0 0 0 1px rgba(255, 255, 255, 0.02) inset,
        0 0 60px rgba(109, 220, 255, 0.06);
}
/* Conic-gradient edge — rotates very slowly, creates that "alive glass" feel */
.glass::before {
    content: "";
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    padding: 1px;
    background: conic-gradient(from var(--angle, 0deg),
        transparent 0deg,
        rgba(109, 220, 255, 0.55) 60deg,
        transparent 130deg,
        rgba(180, 139, 255, 0.55) 220deg,
        transparent 300deg);
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
            mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
            mask-composite: exclude;
    pointer-events: none;
    opacity: 0.9;
    animation: glassEdgeRotate 22s linear infinite;
    z-index: 0;
}
/* Subtle inner highlight top edge */
.glass::after {
    content: "";
    position: absolute;
    top: 0; left: 12%; right: 12%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.35), transparent);
    pointer-events: none;
    z-index: 1;
}
@property --angle {
    syntax: "<angle>";
    initial-value: 0deg;
    inherits: false;
}
@keyframes glassEdgeRotate {
    to { --angle: 360deg; }
}
/* Graceful fallback for browsers without @property */
@supports not (background: paint(something)) {
    .glass::before {
        animation: none;
        background: conic-gradient(from 0deg,
            transparent 0deg,
            rgba(109, 220, 255, 0.4) 60deg,
            transparent 130deg,
            rgba(180, 139, 255, 0.4) 220deg,
            transparent 300deg);
    }
}

.glass-strong {
    background: var(--glass-tint-hi);
    border-color: var(--glass-border-hi);
}

/* Tactical corner markers for a glass panel (opt-in) */
.glass-corners::before,
.glass-corners::after,
.glass-corners > .corner-tl,
.glass-corners > .corner-br {
    /* corners created via ::before/::after of added .corner-tl / .corner-br inside */
}

.corner {
    position: absolute;
    width: 18px;
    height: 18px;
    border-color: var(--lumyn-cyan);
    opacity: 0.7;
    pointer-events: none;
    z-index: 2;
}
.corner.tl { top: 12px; left: 12px; border-top: 1.5px solid; border-left: 1.5px solid; }
.corner.tr { top: 12px; right: 12px; border-top: 1.5px solid; border-right: 1.5px solid; }
.corner.bl { bottom: 12px; left: 12px; border-bottom: 1.5px solid; border-left: 1.5px solid; }
.corner.br { bottom: 12px; right: 12px; border-bottom: 1.5px solid; border-right: 1.5px solid; }

/* ── 6. BUTTONS ────────────────────────────────────────────── */
.btn {
    --btn-fg: var(--starlight);
    --btn-bg: transparent;
    --btn-bd: var(--glass-border-hi);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    min-height: 48px;
    border-radius: var(--radius-md);
    background: var(--btn-bg);
    border: 1px solid var(--btn-bd);
    color: var(--btn-fg);
    font-family: var(--font-display);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
    cursor: pointer;
    transition:
        background 0.28s var(--ease-out),
        border-color 0.28s var(--ease-out),
        color 0.28s var(--ease-out),
        transform 0.22s var(--ease-out),
        box-shadow 0.32s var(--ease-out);
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(120deg,
        transparent 30%,
        rgba(109, 220, 255, 0.18) 50%,
        transparent 70%);
    transform: translateX(-110%);
    transition: transform 0.65s var(--ease-out);
    z-index: -1;
}
.btn:hover::before { transform: translateX(110%); }
.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--glow-cyan-sm);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--void-deep), 0 0 0 4px var(--lumyn-cyan-dim);
}
.btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-primary {
    --btn-fg: var(--void-deep);
    --btn-bg: var(--lumyn-cyan);
    --btn-bd: var(--lumyn-cyan);
    font-weight: 600;
}
.btn-primary:hover { box-shadow: var(--glow-cyan-md); }

.btn-cyan {
    --btn-fg: var(--lumyn-cyan);
    --btn-bg: rgba(109, 220, 255, 0.08);
    --btn-bd: rgba(109, 220, 255, 0.45);
}
.btn-cyan:hover {
    --btn-fg: var(--void-deep);
    --btn-bg: var(--lumyn-cyan);
}

.btn-ghost {
    --btn-fg: var(--starlight-mute);
    --btn-bg: transparent;
    --btn-bd: var(--glass-border);
}
.btn-ghost:hover { --btn-fg: var(--starlight); --btn-bd: var(--glass-border-hi); }

.btn-sm   { padding: 10px 18px; min-height: 38px; font-size: 11px; }
.btn-lg   { padding: 18px 34px; min-height: 56px; font-size: 14px; }
.btn-icon { padding: 0; width: 44px; height: 44px; }

/* ── 7. FORM CONTROLS ──────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--lumyn-cyan-dim);
}
.input, .textarea, .select {
    width: 100%;
    padding: 13px 14px;
    background: rgba(3, 5, 17, 0.55);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    color: var(--starlight);
    font-family: var(--font-mono);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out), background 0.2s;
}
.input:focus, .textarea:focus, .select:focus {
    border-color: var(--lumyn-cyan);
    background: rgba(3, 5, 17, 0.75);
    box-shadow: 0 0 0 3px rgba(109, 220, 255, 0.14);
}
.input::placeholder { color: var(--starlight-dim); letter-spacing: 0.04em; }

/* ── 8. MOTION UTILITIES ───────────────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes breathe {
    0%, 100% { transform: scale(1);    opacity: 0.78; }
    50%      { transform: scale(1.04); opacity: 1; }
}
@keyframes driftY {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}
@keyframes shimmerLine {
    0%   { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
@keyframes softPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(109, 220, 255, 0.0); }
    50%      { box-shadow: 0 0 0 12px rgba(109, 220, 255, 0.08); }
}

.anim-fade-up { animation: fadeUp 0.8s var(--ease-out) both; }
.anim-fade    { animation: fadeIn 1.0s var(--ease-out) both; }
.anim-breathe { animation: breathe 4.5s var(--ease-in-out) infinite; }
.anim-drift   { animation: driftY 6s var(--ease-in-out) infinite; }

/* Stagger helpers — apply delay classes to children */
.delay-1 { animation-delay: 0.08s; }
.delay-2 { animation-delay: 0.16s; }
.delay-3 { animation-delay: 0.24s; }
.delay-4 { animation-delay: 0.32s; }
.delay-5 { animation-delay: 0.40s; }
.delay-6 { animation-delay: 0.48s; }

/* ── 9. LAYOUT HELPERS ─────────────────────────────────────── */
.stack   { display: flex; flex-direction: column; }
.row     { display: flex; flex-direction: row; }
.center-all { display: flex; align-items: center; justify-content: center; }
.wrap    { flex-wrap: wrap; }

.gap-1 { gap: 6px; }
.gap-2 { gap: 10px; }
.gap-3 { gap: 16px; }
.gap-4 { gap: 22px; }
.gap-5 { gap: 30px; }

.text-center { text-align: center; }
.text-muted  { color: var(--starlight-mute); }
.text-dim    { color: var(--starlight-dim); }
.text-cyan   { color: var(--lumyn-cyan); }
.text-aurora { color: var(--aurora); }
.text-plasma { color: var(--plasma); }

/* Divider — thin holographic line */
.divider-holo {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--lumyn-cyan-dim), transparent);
    border: none;
    margin: 18px 0;
}
.divider-holo-v {
    width: 1px;
    background: linear-gradient(180deg, transparent, var(--lumyn-cyan-dim), transparent);
    border: none;
}

/* ── 10. STATUS PILLS ──────────────────────────────────────── */
.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-radius: 100px;
    background: rgba(109, 220, 255, 0.08);
    border: 1px solid rgba(109, 220, 255, 0.22);
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--lumyn-cyan-soft);
}
.pill .dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--lumyn-cyan);
    box-shadow: 0 0 8px var(--lumyn-cyan);
    animation: breathe 2.4s var(--ease-in-out) infinite;
}
.pill-warn  { background: rgba(255, 204, 92, 0.08); border-color: rgba(255, 204, 92, 0.28); color: var(--warn); }
.pill-warn .dot { background: var(--warn); box-shadow: 0 0 8px var(--warn); }

.pill-aurora { background: rgba(180, 139, 255, 0.1); border-color: rgba(180, 139, 255, 0.3); color: var(--aurora-soft); }
.pill-aurora .dot { background: var(--aurora); box-shadow: 0 0 8px var(--aurora); }

/* ── 11. RESPONSIVE ────────────────────────────────────────── */
@media (max-width: 640px) {
    body { font-size: 14px; }
    .btn { padding: 12px 20px; font-size: 12px; min-height: 44px; }
    .btn-lg { padding: 14px 24px; font-size: 13px; min-height: 50px; }
}

/* ── 12. 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;
    }
    .glass::before { animation: none; }
}
