/* ============================================================
   BASE.CSS — Design Tokens, Reset, Typography
   Jefe de la M — Beat Maker Website
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Bebas+Neue&family=Barlow+Condensed:ital,wght@0,400;0,600;0,700;1,400&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;1,9..40,300&display=swap');

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  /* --- Dark mode (default) --- */
  --bg-primary:    #0D0D0D;
  --bg-secondary:  #181818;
  --bg-tertiary:   #222222;
  --bg-elevated:   #2C2C2C;
  --bg-card:       #191919;
  --bg-overlay:    rgba(0, 0, 0, 0.85);

  --text-primary:   #F5F5F5;
  --text-secondary: #AAAAAA;
  --text-muted:     #666666;
  --text-inverted:  #0D0D0D;

  --accent:        #D4A843;
  --accent-dark:   #B8962E;
  --accent-light:  #E8C067;
  --accent-rgb:    212, 168, 67;

  --border:        rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --border-accent: rgba(212, 168, 67, 0.3);

  --shadow-sm:  0 2px 8px  rgba(0, 0, 0, 0.5);
  --shadow-md:  0 4px 24px rgba(0, 0, 0, 0.6);
  --shadow-lg:  0 8px 48px rgba(0, 0, 0, 0.8);
  --shadow-xl:  0 16px 80px rgba(0, 0, 0, 0.9);
  --glow:       0 0 60px  rgba(212, 168, 67, 0.15);
  --glow-strong:0 0 120px rgba(212, 168, 67, 0.28);

  --logo-filter: invert(1);
  --scrollbar-thumb: #333;
  --scrollbar-track: #111;

  /* --- Typography --- */
  --font-display: 'Bebas Neue', 'Impact', sans-serif;
  --font-heading: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body:    'DM Sans', 'Segoe UI', system-ui, sans-serif;

  /* --- Fluid Type Scale --- */
  --text-xs:   clamp(0.70rem,  0.9vw,  0.80rem);
  --text-sm:   clamp(0.80rem,  1.1vw,  0.95rem);
  --text-base: clamp(0.95rem,  1.3vw,  1.05rem);
  --text-lg:   clamp(1.10rem,  1.8vw,  1.30rem);
  --text-xl:   clamp(1.30rem,  2.2vw,  1.60rem);
  --text-2xl:  clamp(1.60rem,  3.0vw,  2.10rem);
  --text-3xl:  clamp(2.00rem,  4.0vw,  2.80rem);
  --text-4xl:  clamp(2.80rem,  6.0vw,  4.20rem);
  --text-5xl:  clamp(4.00rem,  8.0vw,  6.50rem);
  --text-hero: clamp(5.00rem, 12.0vw, 10.00rem);

  /* --- Spacing --- */
  --space-section: clamp(5rem, 10vw, 9rem);
  --space-hero:    clamp(7rem, 14vw, 14rem);

  /* --- Borders & Radius --- */
  --radius-sm:  4px;
  --radius-md:  8px;
  --radius-lg:  12px;
  --radius-xl:  20px;
  --radius-full: 9999px;

  /* --- Transitions --- */
  --ease-premium: cubic-bezier(0.25, 0.46, 0.45, 0.94);
  --ease-spring:  cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast:   0.2s var(--ease-premium);
  --transition-base:   0.35s var(--ease-premium);
  --transition-slow:   0.6s  var(--ease-premium);

  /* --- Z-index layers --- */
  --z-base:    1;
  --z-card:    10;
  --z-player:  50;
  --z-nav:     100;
  --z-modal:   200;
  --z-overlay: 300;
  --z-toast:   400;
  --z-cookie:  500;
}

/* Light mode overrides */
[data-theme="light"] {
  --bg-primary:    #F5F5F0;
  --bg-secondary:  #EAEAE6;
  --bg-tertiary:   #E0E0DC;
  --bg-elevated:   #D6D6D2;
  --bg-card:       #EFEFEB;
  --bg-overlay:    rgba(245, 245, 240, 0.92);

  --text-primary:   #111111;
  --text-secondary: #555555;
  --text-muted:     #888888;
  --text-inverted:  #F5F5F5;

  --accent:        #B8962E;
  --accent-dark:   #9A7D20;
  --accent-light:  #D4A843;
  --accent-rgb:    184, 150, 46;

  --border:        rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.13);
  --border-accent: rgba(184, 150, 46, 0.3);

  --shadow-sm:   0 2px 8px  rgba(0, 0, 0, 0.07);
  --shadow-md:   0 4px 24px rgba(0, 0, 0, 0.10);
  --shadow-lg:   0 8px 48px rgba(0, 0, 0, 0.13);
  --shadow-xl:   0 16px 80px rgba(0, 0, 0, 0.16);
  --glow:        none;
  --glow-strong: none;

  --logo-filter: none;
  --scrollbar-thumb: #bbb;
  --scrollbar-track: #e5e5e5;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: auto; /* Lenis gestiona el smooth scroll — no usar 'smooth' aquí o conflicto doble */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  overflow-x: hidden;
  transition: background-color var(--transition-slow), color var(--transition-slow);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track  { background: var(--scrollbar-track); }
::-webkit-scrollbar-thumb  { background: var(--scrollbar-thumb); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.1;
  color: var(--text-primary);
  letter-spacing: 0.02em;
}

h1 { font-size: var(--text-5xl); }
h2 { font-size: var(--text-4xl); }
h3 { font-size: var(--text-3xl); }
h4 { font-size: var(--text-2xl); }
h5 { font-size: var(--text-xl); }
h6 { font-size: var(--text-lg); }

.font-display { font-family: var(--font-display); }

p { color: var(--text-secondary); line-height: 1.75; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--accent-light); }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }

img, video {
  max-width: 100%;
  height: auto;
  display: block;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  font-size: inherit;
}
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); }

input, textarea, select {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

ul, ol { list-style: none; }

/* ── Layout utilities ─────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 5vw, 3rem);
}

.container--narrow {
  max-width: 860px;
}

.container--wide {
  max-width: 1440px;
}

.section {
  padding-block: var(--space-section);
}

.section__header {
  margin-bottom: clamp(2.5rem, 5vw, 4rem);
}

.section__label {
  font-family: var(--font-heading);
  font-size: var(--text-sm);
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  display: block;
  margin-bottom: 0.5rem;
}

.section__title {
  font-family: var(--font-display);
  font-size: var(--text-4xl);
  color: var(--text-primary);
  line-height: 1.05;
  letter-spacing: 0.03em;
}

.section__subtitle {
  font-size: var(--text-lg);
  color: var(--text-secondary);
  margin-top: 0.75rem;
  max-width: 56ch;
}

/* ── Accent line ──────────────────────────────────────────── */
.accent-line {
  display: inline-block;
  width: 48px;
  height: 2px;
  background: var(--accent);
  vertical-align: middle;
  margin-right: 0.75rem;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-sm);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.75em 1.8em;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition-base);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1;
}

.btn-primary {
  background: var(--accent);
  color: #0D0D0D;
  border-color: var(--accent);
}
.btn-primary:hover {
  background: var(--accent-light);
  border-color: var(--accent-light);
  color: #0D0D0D;
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}
.btn-outline:hover {
  background: var(--accent);
  color: #0D0D0D;
  transform: translateY(-2px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 0.5em 0.75em;
}
.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.btn-sm {
  font-size: var(--text-xs);
  padding: 0.55em 1.2em;
}

.btn-lg {
  font-size: var(--text-base);
  padding: 0.9em 2.4em;
}

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.2em 0.65em;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}

.badge--gold    { background: var(--accent); color: #0D0D0D; }
.badge--new     { background: #16a34a; color: #fff; }
.badge--sold    { background: var(--bg-elevated); color: var(--text-muted); }
.badge--genre   { background: var(--bg-elevated); color: var(--text-secondary); border: 1px solid var(--border); }

/* ── Visually hidden (accessibility) ─────────────────────── */
.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;
}

/* ── Skip link ────────────────────────────────────────────── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  background: var(--accent);
  color: #0D0D0D;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-heading);
  font-weight: 700;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  text-decoration: none;
  transition: top 0.2s;
}
.skip-link:focus { top: 0; }

/* ── Noise texture overlay ────────────────────────────────── */
.noise-overlay {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: var(--z-overlay);
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
}
[data-theme="light"] .noise-overlay { opacity: 0.018; }

/* ── 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;
  }
}

/* ── Safe areas (iOS notch / Dynamic Island) ──────────────── */
@supports (padding: env(safe-area-inset-top)) {
  body {
    padding-left:  env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}
