/* ==========================================================================
   Meowsic Design Tokens — "Obsidian Studio & Editorial Hi-Fi"
   ========================================================================== */

:root {
  color-scheme: dark;

  /* Surfaces (Obsidian Studio Dark — default) */
  --bg: #0b0d10;
  --bg-elevated: #0f1318;
  --surface: #131820;
  --surface-2: #181f2a;
  --surface-hover: rgba(255, 255, 255, 0.06);
  --surface-glass: rgba(19, 24, 32, 0.78);

  /* Ink */
  --text: #eef2f6;
  --text-secondary: #c5cedb;
  --muted: #919db1;

  /* Hairlines */
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.17);

  /* Dynamic Song-Synced Accent (Emerald Jade default) */
  --accent: #34c77b;
  --accent-rgb: 52, 199, 123;
  --accent-soft: rgba(var(--accent-rgb), 0.12);
  --accent-dim: rgba(var(--accent-rgb), 0.22);
  --accent-glow: rgba(var(--accent-rgb), 0.34);
  --accent-contrast: #06150d;

  /* Meowsic PRE (Warm Brushed Gold) */
  --pre-gold: #e5b869;
  --pre-gold-rgb: 229, 184, 105;
  --pre-soft: rgba(var(--pre-gold-rgb), 0.10);
  --pre-border: rgba(var(--pre-gold-rgb), 0.30);
  --pre-contrast: #1b1305;

  /* Semantic Status */
  --danger: #ef6b6b;
  --danger-soft: rgba(239, 107, 107, 0.11);
  --warning: #f0b45b;
  --success: #34c77b;

  /* Typography */
  --font-sans: 'Be Vietnam Pro', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Type Scale */
  --text-xs: 0.78rem;
  --text-sm: 0.88rem;
  --text-base: 1rem;
  --text-lg: 1.15rem;
  --text-xl: 1.38rem;
  --text-2xl: clamp(1.55rem, 1.2rem + 1.4vw, 2.1rem);
  --text-3xl: clamp(1.95rem, 1.4rem + 2.2vw, 2.85rem);
  --text-hero: clamp(2.35rem, 1.6rem + 3.2vw, 3.85rem);

  /* Spacing (4/8px scale) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;
  --space-24: 96px;

  /* Radii */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-pill: 999px;

  /* Elevation Shadows */
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.42);
  --shadow-stage: 0 24px 64px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.06);

  /* Motion */
  --dur-fast: 150ms;
  --dur-base: 260ms;
  --dur-slow: 420ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);

  /* Layout */
  --container-max: 1240px;
  --header-h: 68px;
}

/* Light Mode — Warm Parchment Studio */
[data-theme="light"] {
  color-scheme: light;

  --bg: #f6f4ef;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #edeae2;
  --surface-hover: rgba(15, 19, 24, 0.05);
  --surface-glass: rgba(246, 244, 239, 0.85);

  --text: #14181f;
  --text-secondary: #2d3542;
  --muted: #525d6d;

  --border: rgba(20, 24, 31, 0.11);
  --border-strong: rgba(20, 24, 31, 0.22);

  --accent: #15804a;
  --accent-rgb: 21, 128, 74;
  --accent-contrast: #ffffff;

  --pre-gold: #744c08;
  --pre-gold-rgb: 116, 76, 8;
  --pre-soft: rgba(var(--pre-gold-rgb), 0.09);
  --pre-border: rgba(var(--pre-gold-rgb), 0.28);
  --pre-contrast: #ffffff;

  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --warning: #b45309;
  --success: #15804a;

  --shadow-sm: 0 2px 10px rgba(20, 24, 31, 0.06);
  --shadow-md: 0 12px 32px rgba(20, 24, 31, 0.10);
  --shadow-stage: 0 24px 56px rgba(20, 24, 31, 0.14), 0 0 0 1px rgba(20, 24, 31, 0.08);
}

/* ==========================================================================
   Base Reset & Accessibility Primitives
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + var(--space-4));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

img,
picture,
svg,
video,
canvas {
  display: block;
  max-width: 100%;
}

img {
  height: auto;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  background: none;
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3,
h4,
p,
figure,
blockquote,
ul,
ol,
dl,
dd {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

[hidden] {
  display: none !important;
}

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

@media (prefers-reduced-motion: reduce) {
  :root {
    --dur-fast: 0.01ms;
    --dur-base: 0.01ms;
    --dur-slow: 0.01ms;
  }

  html {
    scroll-behavior: auto;
  }
}
