/*
 * ╔══════════════════════════════════════════════════════════════════╗
 * ║  TREASURE TROVE — base.css  v4.2                                 ║
 * ║  Foundation: CSS Variables, Reset, Typography, Scrollbar          ║
 * ║  Fonts: Exo 2 (display) + Nunito (body)                          ║
 * ║  Fluid scale via clamp() — works from 375px to 8K+               ║
 * ╚══════════════════════════════════════════════════════════════════╝
 */

/* ─── Google Fonts ───────────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Exo+2:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,400&family=Nunito:wght@300;400;500;600;700&display=swap');


/* ═══════════════════════════════════════════════════════════════════ */
/*  CSS CUSTOM PROPERTIES                                               */
/* ═══════════════════════════════════════════════════════════════════ */
:root {

  /* ── Brand Colors ────────────────────────────────────────────── */
  --primary:         #6C63FF;
  --primary-dark:    #4B44CC;
  --primary-light:   #9D97FF;
  --primary-xlight:  #C8C5FF;
  --accent:          #FFD700;
  --accent-dark:     #E6BE00;
  --accent-light:    #FFE566;
  --success:         #00C853;
  --success-dark:    #009624;
  --danger:          #FF1744;
  --danger-dark:     #C4001A;
  --warning:         #FF9800;
  --info:            #00B0FF;

  /* ── Backgrounds ─────────────────────────────────────────────── */
  --bg:              #0F0E17;
  --bg-card:         #1A1A2E;
  --bg-card-2:       #16213E;
  --bg-card-3:       #0D0D1A;
  --bg-overlay:      rgba(15, 14, 23, 0.88);

  /* ── Text ────────────────────────────────────────────────────── */
  --text:            #C8C8DC;
  --text-muted:      #6B6B8A;
  --text-bright:     #F0F0FF;
  --text-inv:        #0F0E17;

  /* ── Borders ─────────────────────────────────────────────────── */
  --border:          #2D2B55;
  --border-light:    #3D3B65;
  --border-bright:   #5A57AA;

  /* ── Shadows & Glows ─────────────────────────────────────────── */
  --shadow-xs:    0 1px 4px rgba(0, 0, 0, 0.45);
  --shadow-sm:    0 2px 10px rgba(0, 0, 0, 0.55), 0 0 8px rgba(108, 99, 255, 0.07);
  --shadow:       0 4px 22px rgba(0, 0, 0, 0.65), 0 0 20px rgba(108, 99, 255, 0.1);
  --shadow-lg:    0 8px 44px rgba(0, 0, 0, 0.72), 0 0 44px rgba(108, 99, 255, 0.18);
  --shadow-accent: 0 4px 26px rgba(255, 215, 0, 0.22);
  --glow-sm:      0 0 14px rgba(108, 99, 255, 0.38);
  --glow:         0 0 28px rgba(108, 99, 255, 0.48);
  --glow-lg:      0 0 52px rgba(108, 99, 255, 0.58);
  --glow-accent:  0 0 28px rgba(255, 215, 0, 0.48);

  /* ── Gradients ───────────────────────────────────────────────── */
  --gradient-primary: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  --gradient-accent:  linear-gradient(135deg, var(--accent-light) 0%, var(--accent-dark) 100%);
  --gradient-success: linear-gradient(135deg, #00C853 0%, #009624 100%);
  --gradient-danger:  linear-gradient(135deg, #FF1744 0%, #C4001A 100%);
  --gradient-card:    linear-gradient(145deg, var(--bg-card) 0%, var(--bg-card-2) 100%);
  --gradient-hero:    linear-gradient(160deg, #0F0E17 0%, #16213E 55%, #1A1A2E 100%);
  --gradient-text:    linear-gradient(135deg, var(--primary-light) 0%, var(--accent) 100%);
  /* Ambient mesh — applied on body::before for subtle depth */
  --gradient-mesh:
    radial-gradient(ellipse at 15% 40%,  rgba(108, 99, 255, 0.11) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 15%,  rgba(255, 215,   0, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 88%,  rgba(108, 99, 255, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse at 72% 62%,  rgba(  0, 176, 255, 0.04) 0%, transparent 40%);

  /* ── Typography ──────────────────────────────────────────────── */
  --font-display: 'Exo 2', sans-serif;
  --font-body:    'Nunito', sans-serif;

  /* ── Fluid Font Scale ────────────────────────────────────────── */
  /* Format: clamp(min, calc(base + vw), max)                       */
  /* Smooth fluid scaling from 375px → 8K+, no breakpoints needed   */
  --text-xs:   clamp(0.625rem, calc(0.55rem  + 0.30vw), 0.75rem);
  --text-sm:   clamp(0.75rem,  calc(0.65rem  + 0.44vw), 0.90rem);
  --text-base: clamp(0.875rem, calc(0.75rem  + 0.54vw), 1.0625rem);
  --text-lg:   clamp(1.0rem,   calc(0.85rem  + 0.64vw), 1.25rem);
  --text-xl:   clamp(1.125rem, calc(0.90rem  + 0.90vw), 1.5rem);
  --text-2xl:  clamp(1.375rem, calc(1.0rem   + 1.50vw), 2.0rem);
  --text-3xl:  clamp(1.75rem,  calc(1.20rem  + 2.30vw), 2.75rem);
  --text-4xl:  clamp(2.0rem,   calc(1.40rem  + 3.50vw), 4.0rem);
  --text-5xl:  clamp(2.5rem,   calc(1.60rem  + 5.00vw), 6.0rem);
  --text-hero: clamp(3.0rem,   calc(1.80rem  + 7.00vw), 9.0rem);

  /* ── Fluid Spacing Scale ─────────────────────────────────────── */
  --space-1:  clamp(0.25rem,  calc(0.15rem + 0.25vw), 0.40rem);
  --space-2:  clamp(0.50rem,  calc(0.30rem + 0.44vw), 0.75rem);
  --space-3:  clamp(0.75rem,  calc(0.45rem + 0.70vw), 1.25rem);
  --space-4:  clamp(1.0rem,   calc(0.60rem + 1.00vw), 1.75rem);
  --space-5:  clamp(1.5rem,   calc(0.85rem + 1.75vw), 2.75rem);
  --space-6:  clamp(2.0rem,   calc(1.0rem  + 2.50vw), 4.0rem);
  --space-7:  clamp(2.5rem,   calc(1.20rem + 4.00vw), 6.0rem);
  --space-8:  clamp(3.0rem,   calc(1.20rem + 6.00vw), 8.5rem);
  --space-9:  clamp(4.0rem,   calc(1.50rem + 8.50vw), 12rem);
  --space-10: clamp(5.0rem,   calc(1.50rem + 12.0vw), 16rem);

  /* ── Border Radius ───────────────────────────────────────────── */
  --radius-xs:  clamp(3px,  calc(2px + 0.20vw), 5px);
  --radius-sm:  clamp(5px,  calc(3px + 0.30vw), 8px);
  --radius:     clamp(8px,  calc(5px + 0.50vw), 14px);
  --radius-lg:  clamp(12px, calc(8px + 0.80vw), 20px);
  --radius-xl:  clamp(16px, calc(10px + 1.20vw), 28px);
  --radius-2xl: clamp(20px, calc(12px + 1.80vw), 40px);
  --radius-full: 9999px;

  /* ── Transitions ─────────────────────────────────────────────── */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-in:     cubic-bezier(0.4, 0, 1, 1);
  --t-fast:   100ms var(--ease-smooth);
  --t:        220ms var(--ease-smooth);
  --t-slow:   380ms var(--ease-smooth);
  --t-spring: 340ms var(--ease-spring);

  /* ── Z-Index Layers ──────────────────────────────────────────── */
  --z-below:    -1;
  --z-base:      1;
  --z-raised:   10;
  --z-dropdown: 100;
  --z-sticky:   150;
  --z-sidebar:  200;
  --z-modal:    300;
  --z-toast:    400;
  --z-tooltip:  500;

  /* ── Layout Tokens ───────────────────────────────────────────── */
  /* Sidebar grows slightly with viewport but caps at 280px         */
  --sidebar-width: 260px;
  --topbar-height: clamp(56px,  calc(44px + 2vw),  76px);
}


/* ═══════════════════════════════════════════════════════════════════ */
/*  CSS RESET                                                           */
/* ═══════════════════════════════════════════════════════════════════ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: 400;
  color: var(--text);
  background-color: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  position: relative;
}

/* Global ambient depth on every page — subtle purple+gold mesh */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--gradient-mesh);
  pointer-events: none;
  z-index: var(--z-below);
}


/* ═══════════════════════════════════════════════════════════════════ */
/*  TYPOGRAPHY                                                          */
/* ═══════════════════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: var(--text-bright);
}

h1 { font-size: var(--text-4xl);  letter-spacing: -0.035em; }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 {
  font-size: var(--text-sm);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
}

p {
  color: var(--text);
  line-height: 1.75;
  font-size: var(--text-base);
}

a {
  color: var(--primary-light);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover { color: var(--accent); }

strong, b { font-weight: 700; color: var(--text-bright); }
em, i     { font-style: italic; }
small     { font-size: var(--text-xs); }

ul, ol { list-style: none; }

ul.list-disc {
  list-style: disc;
  padding-left: var(--space-5);
  color: var(--text);
}

ul.list-disc li { margin-bottom: var(--space-1); }

ol.list-decimal {
  list-style: decimal;
  padding-left: var(--space-5);
  color: var(--text);
}

blockquote {
  border-left: 3px solid var(--primary);
  padding: var(--space-3) var(--space-4);
  margin: var(--space-5) 0;
  background: rgba(108, 99, 255, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
  color: var(--text-muted);
  font-style: italic;
}

code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.9em;
  background: rgba(108, 99, 255, 0.1);
  color: var(--primary-light);
  padding: 0.12em 0.38em;
  border-radius: var(--radius-xs);
  border: 1px solid rgba(108, 99, 255, 0.2);
}

pre {
  background: var(--bg-card-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-5);
  overflow-x: auto;
  font-size: var(--text-sm);
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}

hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: var(--space-6) 0;
}


/* ═══════════════════════════════════════════════════════════════════ */
/*  MEDIA ELEMENTS                                                       */
/* ═══════════════════════════════════════════════════════════════════ */

img, svg, video, canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
  object-fit: cover;
}

svg { overflow: visible; }


/* ═══════════════════════════════════════════════════════════════════ */
/*  FORM ELEMENT RESET                                                  */
/* ═══════════════════════════════════════════════════════════════════ */

input, button, textarea, select, optgroup {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
  color: inherit;
}

button,
[type="button"],
[type="reset"],
[type="submit"] {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-appearance: none;
  appearance: none;
}

input, textarea, select {
  border: none;
  outline: none;
  background: transparent;
}

textarea { resize: vertical; }

table { border-collapse: collapse; width: 100%; }

details summary { cursor: pointer; user-select: none; }

[hidden] { display: none !important; }

/* Disabled state */
[disabled],
[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.5;
  pointer-events: none;
}

/* Number input — remove spinners */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; appearance: textfield; }


/* ═══════════════════════════════════════════════════════════════════ */
/*  CUSTOM SCROLLBAR                                                     */
/* ═══════════════════════════════════════════════════════════════════ */

::-webkit-scrollbar {
  width: clamp(4px, 0.4vw, 7px);
  height: clamp(4px, 0.4vw, 7px);
}

::-webkit-scrollbar-track {
  background: var(--bg-card-3);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
  border: 1px solid var(--bg-card-3);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary);
}


/* ═══════════════════════════════════════════════════════════════════ */
/*  SELECTION & FOCUS                                                    */
/* ═══════════════════════════════════════════════════════════════════ */

::selection {
  background: rgba(108, 99, 255, 0.32);
  color: var(--text-bright);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: var(--radius-sm);
}

:focus:not(:focus-visible) { outline: none; }


/* ═══════════════════════════════════════════════════════════════════ */
/*  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;
  }
}