/* ============================================================
   BASE.CSS — Reset, variables, typography, layout utilities
   ============================================================ */

/* ── Custom properties ── */
:root {
  /* Colors */
  --bg:         #080808;
  --surface:    #111111;
  --surface-2:  #1a1a1a;
  --surface-3:  #222222;
  --border:     #222222;
  --border-2:   #2e2e2e;
  --text:       #ffffff;
  --text-2:     #aaaaaa;
  --text-3:     #555555;
  --accent:     #4cc9f0;
  --accent-dim: rgba(76, 201, 240, 0.12);
  --accent-alt: #f72585;
  --accent-alt-dim: rgba(247, 37, 133, 0.12);

  /* Fonts */
  --font-display: 'Bebas Neue', 'Arial Narrow', sans-serif;
  --font-heading: 'Syne', sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --nav-h: 68px;
  --max-w: 1200px;
  --gutter: clamp(1.25rem, 4vw, 2rem);
  --section-py: clamp(4rem, 8vw, 7rem);

  /* Radii */
  --r-sm:   4px;
  --r-md:   8px;
  --r-lg:   16px;

  /* Easing */
  --ease-out:     cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out:  cubic-bezier(0.77, 0, 0.175, 1);
  --ease-spring:  cubic-bezier(0.16, 1, 0.3, 1);

  /* Shadows */
  --shadow-card:  0 4px 24px rgba(0,0,0,0.6);
  --shadow-hover: 0 12px 40px rgba(0,0,0,0.7);
  --shadow-glow:  0 0 32px rgba(76, 201, 240, 0.25);
}

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

html {
  overflow-x: clip;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  font-weight: 400;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ── Selection ── */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ── Typography ── */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.1;
  font-weight: 800;
}

p { max-width: 65ch; }

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

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

ul, ol { list-style: none; }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Layout ── */
.container {
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

/* ── Section label ── */
.section-label {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.5rem;
}

.section-label::before {
  content: '';
  display: block;
  width: 28px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

/* ── Section heading ── */
.section-heading {
  font-family: var(--font-heading);
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.75em 1.75em;
  border-radius: var(--r-sm);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: none;
  transition:
    transform 160ms var(--ease-out),
    box-shadow 200ms var(--ease-out),
    background 200ms ease,
    color 200ms ease;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
}

.btn-primary:hover {
  background: #fff;
  box-shadow: 0 0 24px rgba(76,201,240,0.4);
  transform: translateY(-2px);
}

.btn-primary:active { transform: scale(0.97); }

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.25);
}

.btn-ghost:hover {
  border-color: rgba(255,255,255,0.6);
  background: rgba(255,255,255,0.05);
  transform: translateY(-2px);
}

.btn-ghost:active { transform: scale(0.97); }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.2em 0.55em;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-bpm {
  background: rgba(76,201,240,0.12);
  color: var(--accent);
  border: 1px solid rgba(76,201,240,0.25);
}

.badge-key {
  background: rgba(255,255,255,0.06);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.badge-genre {
  background: rgba(247,37,133,0.1);
  color: var(--accent-alt);
  border: 1px solid rgba(247,37,133,0.2);
}

/* ── Touch target ── */
.touch-target {
  min-height: 44px;
  min-width: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

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

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  border: none;
  margin-block: 0;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(0);
  background: var(--surface-2);
  border: 1px solid var(--border-2);
  color: var(--text);
  padding: 0.6em 1.2em;
  border-radius: var(--r-sm);
  font-size: 0.85rem;
  font-weight: 500;
  z-index: 9999;
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 300ms ease, transform 300ms var(--ease-out);
}

.toast.toast-hidden {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* ── YouTube lite embed ── */
.yt-embed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
  cursor: pointer;
}

.yt-embed__thumb {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms var(--ease-out), filter 400ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .yt-embed:hover .yt-embed__thumb {
    transform: scale(1.03);
    filter: brightness(0.75);
  }
}

.yt-embed__play {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.yt-embed__play-icon {
  width: 68px;
  height: 68px;
  background: rgba(0,0,0,0.7);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,0.25);
  transition: transform 220ms var(--ease-out), background 220ms ease, border-color 220ms ease;
  backdrop-filter: blur(4px);
}

.yt-embed__play-icon svg {
  width: 26px;
  height: 26px;
  fill: white;
  margin-left: 4px;
}

@media (hover: hover) and (pointer: fine) {
  .yt-embed:hover .yt-embed__play-icon {
    transform: scale(1.1);
    background: rgba(76,201,240,0.25);
    border-color: var(--accent);
  }
}

/* ── Beat card (shared: homepage teaser + store) ── */
.beat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: default;
  display: flex;
  flex-direction: column;
}

.beat-card__art {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface-2);
}

.beat-card__art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 500ms var(--ease-out), filter 400ms ease;
}

@media (hover: hover) and (pointer: fine) {
  .beat-card:hover .beat-card__art img {
    transform: scale(1.06);
    filter: brightness(0.75);
  }
}

.beat-card__play-btn {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 220ms ease;
  -webkit-tap-highlight-color: transparent;
  z-index: 2;
}

@media (hover: hover) and (pointer: fine) {
  .beat-card:hover .beat-card__play-btn { opacity: 1; }
}

@media (hover: none) {
  .beat-card__play-btn { opacity: 0.85; }
}

.beat-card__play-btn.is-playing { opacity: 1; }

.beat-card__play-circle {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(76,201,240,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 220ms var(--ease-out);
}

.beat-card__play-btn:active .beat-card__play-circle {
  transform: scale(0.92);
}

.beat-card__play-circle svg {
  width: 20px;
  height: 20px;
  fill: var(--bg);
  margin-left: 3px;
}

.beat-card__play-btn.is-playing .beat-card__play-circle {
  background: rgba(247,37,133,0.9);
}

.beat-card__info { padding: 1rem 1rem 1.1rem; flex: 1; display: flex; flex-direction: column; }

.beat-card__name {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.beat-card__badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.beat-card__pricing {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: auto;
}

.beat-card__price { font-size: 0.8rem; color: var(--text-2); }
.beat-card__price strong { color: var(--accent-alt); font-weight: 600; }

.beat-card__buy-btn {
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.45em 0.9em;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  min-height: 32px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 180ms ease, transform 160ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .beat-card__buy-btn:hover { background: #fff; }
}
.beat-card__buy-btn:active { transform: scale(0.96); }

/* ── Hide floating cart toggle on mobile (nav cart button is used instead) ── */
@media (max-width: 768px) {
  .me-cart-toggle { display: none !important; }
}

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