/* ==========================================================================
   Azerothshop — design tokens, reset and primitives.

   Fonts are system stacks on purpose: the Content-Security-Policy allows no
   external origins, so there is no CDN font to block, nothing to FOUT, and
   nothing to load before the ledger renders.
   ========================================================================== */

:root {
    color-scheme: dark;

    /* Surfaces — obsidian, lit from above */
    --bg:            #080b12;
    --bg-glow-1:     rgba(232, 176, 75, 0.07);
    --bg-glow-2:     rgba(167, 139, 250, 0.07);
    --bg-glow-3:     rgba(45, 212, 191, 0.05);
    --surface:       #10141f;
    --surface-2:     #151a28;
    --surface-3:     #1b2132;
    --surface-input: #0d111b;

    --line:          rgba(255, 255, 255, 0.07);
    --line-strong:   rgba(255, 255, 255, 0.14);

    /* Ink */
    --text:          #e9edf5;
    --text-dim:      #9aa7bd;
    --text-faint:    #6b7891;

    /* Accents — gold leads, arcane and teal support */
    --gold:          #e8b04b;
    --gold-bright:   #f5c76a;
    --gold-dim:      rgba(232, 176, 75, 0.12);
    --arcane:        #a78bfa;
    --arcane-dim:    rgba(167, 139, 250, 0.12);
    --teal:          #2dd4bf;
    --teal-dim:      rgba(45, 212, 191, 0.12);
    --emerald:       #34d399;
    --emerald-dim:   rgba(52, 211, 153, 0.12);
    --rose:          #fb7185;
    --rose-dim:      rgba(251, 113, 133, 0.12);
    --amber:         #fbbf24;
    --amber-dim:     rgba(251, 191, 36, 0.12);

    --focus:         #60a5fa;

    /* Type */
    --font-display: 'Segoe UI Variable Display', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --font-body:    system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    'Cascadia Mono', 'SF Mono', 'Consolas', 'Liberation Mono', monospace;

    /* Geometry */
    --r-sm: 7px;
    --r-md: 10px;
    --r-lg: 14px;
    --r-xl: 20px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.28);
    --shadow-lg: 0 22px 60px rgba(0, 0, 0, 0.5);

    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

:root[data-theme='light'] {
    color-scheme: light;

    --bg:            #f4f5f8;
    --bg-glow-1:     rgba(202, 138, 4, 0.07);
    --bg-glow-2:     rgba(124, 58, 237, 0.06);
    --bg-glow-3:     rgba(13, 148, 136, 0.05);
    --surface:       #ffffff;
    --surface-2:     #fbfbfd;
    --surface-3:     #f1f2f6;
    --surface-input: #ffffff;

    --line:          rgba(15, 23, 42, 0.10);
    --line-strong:   rgba(15, 23, 42, 0.20);

    --text:          #131824;
    --text-dim:      #55617a;
    --text-faint:    #7c8799;

    --gold:          #a16207;
    --gold-bright:   #854d0e;
    --gold-dim:      rgba(161, 98, 7, 0.11);
    --arcane:        #7c3aed;
    --arcane-dim:    rgba(124, 58, 237, 0.10);
    --teal:          #0d9488;
    --teal-dim:      rgba(13, 148, 136, 0.10);
    --emerald:       #047857;
    --emerald-dim:   rgba(4, 120, 87, 0.10);
    --rose:          #be123c;
    --rose-dim:      rgba(190, 18, 60, 0.10);
    --amber:         #b45309;
    --amber-dim:     rgba(180, 83, 9, 0.11);

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 6px 20px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 22px 60px rgba(15, 23, 42, 0.16);
}

/* ── Reset ─────────────────────────────────────────────────────────────── */

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

* { margin: 0; padding: 0; }

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

body {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.55;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    min-height: 100vh;
}

/* The ambient glow that gives the dark theme depth. Fixed so it does not
   scroll away, and behind everything so it never intercepts clicks. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 50% at 12% -8%,  var(--bg-glow-1), transparent 60%),
        radial-gradient(ellipse 60% 45% at 88% 2%,   var(--bg-glow-2), transparent 58%),
        radial-gradient(ellipse 80% 40% at 50% 104%, var(--bg-glow-3), transparent 62%);
}

img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: none; cursor: pointer; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }

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

::selection { background: rgba(232, 176, 75, 0.28); color: var(--text); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 10px;
    border: 3px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ── Typographic primitives ────────────────────────────────────────────── */

.h1 { font-family: var(--font-display); font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.h2 { font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.01em; }
.h3 { font-family: var(--font-display); font-size: 14px; font-weight: 650; }

.label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-faint);
}

.muted { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.num  { font-variant-numeric: tabular-nums; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.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;
}

/* ── Buttons ───────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 15px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface-2);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
                transform 0.16s var(--ease), box-shadow 0.16s var(--ease), opacity 0.16s;
}
.btn:hover:not(:disabled) { background: var(--surface-3); border-color: var(--line-strong); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
    background: linear-gradient(160deg, var(--gold-bright), var(--gold));
    border-color: transparent;
    color: #1a1206;
    box-shadow: 0 4px 14px rgba(232, 176, 75, 0.22);
}
.btn-primary:hover:not(:disabled) {
    background: linear-gradient(160deg, var(--gold-bright), var(--gold-bright));
    box-shadow: 0 7px 20px rgba(232, 176, 75, 0.32);
}
:root[data-theme='light'] .btn-primary { color: #fffdf7; }

.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-3); color: var(--text); border-color: transparent; }

.btn-danger { color: var(--rose); border-color: var(--rose-dim); background: var(--rose-dim); }
.btn-danger:hover:not(:disabled) { background: var(--rose); color: #fff; border-color: transparent; }

.btn-success { color: var(--emerald); border-color: var(--emerald-dim); background: var(--emerald-dim); }
.btn-success:hover:not(:disabled) { background: var(--emerald); color: #04211a; border-color: transparent; }

.btn-sm { padding: 6px 11px; font-size: 12px; border-radius: var(--r-sm); gap: 5px; }
.btn-icon { padding: 7px; width: 32px; height: 32px; }
.btn-block { width: 100%; }

/* ── Form controls ─────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }

.input, .select, .textarea {
    width: 100%;
    padding: 9px 12px;
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--surface-input);
    color: var(--text);
    font-size: 13.5px;
    transition: border-color 0.16s, box-shadow 0.16s, background 0.16s;
}
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:hover, .select:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px var(--gold-dim);
}
.input[aria-invalid='true'] { border-color: var(--rose); box-shadow: 0 0 0 3px var(--rose-dim); }
.input:disabled, .select:disabled { opacity: 0.55; cursor: not-allowed; }

.textarea { resize: vertical; min-height: 66px; line-height: 1.5; }

.select {
    appearance: none;
    padding-right: 34px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238e9bb3' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
}

.field-error { font-size: 12px; color: var(--rose); font-weight: 500; }
.field-hint  { font-size: 12px; color: var(--text-faint); }

/* Switch */
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track {
    width: 38px; height: 22px; flex: none;
    border-radius: 999px;
    background: var(--surface-3);
    border: 1px solid var(--line);
    position: relative;
    transition: background 0.18s var(--ease), border-color 0.18s;
}
.switch-track::after {
    content: '';
    position: absolute; top: 2px; left: 2px;
    width: 16px; height: 16px; border-radius: 50%;
    background: var(--text-faint);
    transition: transform 0.18s var(--ease), background 0.18s;
}
.switch input:checked + .switch-track { background: var(--emerald-dim); border-color: var(--emerald); }
.switch input:checked + .switch-track::after { transform: translateX(16px); background: var(--emerald); }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ── Surfaces ──────────────────────────────────────────────────────────── */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-sm);
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 650;
    white-space: nowrap;
    border: 1px solid transparent;
}
.badge-gold    { background: var(--gold-dim);    color: var(--gold);    border-color: var(--gold-dim); }
.badge-arcane  { background: var(--arcane-dim);  color: var(--arcane);  border-color: var(--arcane-dim); }
.badge-teal    { background: var(--teal-dim);    color: var(--teal);    border-color: var(--teal-dim); }
.badge-emerald { background: var(--emerald-dim); color: var(--emerald); border-color: var(--emerald-dim); }
.badge-rose    { background: var(--rose-dim);    color: var(--rose);    border-color: var(--rose-dim); }
.badge-amber   { background: var(--amber-dim);   color: var(--amber);   border-color: var(--amber-dim); }
.badge-neutral { background: var(--surface-3);   color: var(--text-dim); border-color: var(--line); }

/* ── Motion ────────────────────────────────────────────────────────────── */

@keyframes fade-up {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
@keyframes pop-in {
    from { opacity: 0; transform: scale(0.96) translateY(8px); }
    to   { opacity: 1; transform: none; }
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer {
    from { background-position: -420px 0; }
    to   { background-position: 420px 0; }
}

.spinner {
    width: 15px; height: 15px; flex: none;
    border: 2px solid var(--line-strong);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.62s linear infinite;
}

.skeleton {
    border-radius: var(--r-md);
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
    background-size: 840px 100%;
    animation: shimmer 1.35s linear infinite;
}

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