/* ==========================================================================
   Musikdatenbank – Premium Stylesheet
   Helles, professionelles Designsystem (Apple Music / Linear.app inspired)
   --------------------------------------------------------------------------
   Aufbau:
     1.  Reset
     2.  Design Tokens (:root)
     3.  Base Typography & Elements
     4.  Helpers (.visually-hidden, .container, .btn)
     5.  Header (sticky, glassmorphism)
     6.  Main / Page Header / Section Title
     7.  Tabs
     8.  Grid
     9.  Cards (Track / Album / Artist / Playlist)
     10. Track List
     11. Artist Hero
     12. Album Hero
     13. Loading / Error / Empty / Skeleton
     14. Pagination
     15. Player Bar (fixed bottom, glassmorphism)
     16. Toasts
     17. Footer
     18. Stats Badge & Misc
     19. Responsive
     20. Accessibility (focus-visible, reduced motion)
     21. Scrollbars
   ========================================================================== */

/* ---------- 1. Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

* { margin: 0; padding: 0; }

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

body {
  font-family: var(--font-sans);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  color: var(--color-text);
  background: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-feature-settings: "cv11", "ss01", "ss03";
}

/* Reserve space at bottom when the player bar is shown. */
body:has(.player-bar:not([hidden])) {
  padding-bottom: var(--player-height);
}

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

button, input, select, textarea {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
button {
  cursor: pointer;
  border: none;
  background: none;
  -webkit-tap-highlight-color: transparent;
}
input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}
a {
  color: var(--color-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-primary-hover); }

ul, ol { list-style: none; }

h1, h2, h3, h4, h5, h6 {
  font-weight: var(--fw-bold);
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
}

/* ---------- 2. Design Tokens ---------- */
:root {
  /* --- Farbe: Surfaces --- */
  --color-bg: #ffffff;
  --color-bg-soft: #fafbfc;
  --color-bg-elevated: #ffffff;
  --color-bg-sunken: #f4f6f8;
  --color-surface-hover: #f2f4f7;

  /* --- Farbe: Lines --- */
  --color-border: #eceef1;
  --color-border-strong: #d8dde3;
  --color-border-subtle: #f3f5f7;

  /* --- Farbe: Text --- */
  --color-text: #0a0e14;
  --color-text-muted: #5a6473;
  --color-text-subtle: #8b94a3;
  --color-text-inverse: #ffffff;

  /* --- Farbe: Brand --- */
  --color-primary: #ef5466;
  --color-primary-hover: #d83f50;
  --color-primary-active: #c43242;
  --color-primary-soft: #fff0f2;
  --color-primary-text: #c4324a;
  --color-primary-ring: rgba(239, 84, 102, 0.18);

  --color-accent: #a855f7;            /* Lila, für Logo-Gradient & Akzente */
  --color-accent-soft: #f5edff;
  --color-gradient-brand: linear-gradient(135deg, #ef5466 0%, #a855f7 100%);

  /* --- Farbe: Feedback --- */
  --color-success: #12a150;
  --color-success-soft: #e8f7ee;
  --color-warning: #c47700;
  --color-warning-soft: #fdf3e0;
  --color-danger: #d63b3b;
  --color-danger-soft: #fdeaea;

  /* --- Schatten (mehrschichtig, sehr subtil) --- */
  --shadow-xs: 0 1px 2px rgba(10, 14, 20, 0.04);
  --shadow-sm: 0 1px 2px rgba(10, 14, 20, 0.04), 0 2px 6px rgba(10, 14, 20, 0.05);
  --shadow-md: 0 1px 2px rgba(10, 14, 20, 0.04), 0 4px 12px rgba(10, 14, 20, 0.06);
  --shadow-lg: 0 2px 4px rgba(10, 14, 20, 0.04), 0 12px 28px rgba(10, 14, 20, 0.08);
  --shadow-xl: 0 4px 8px rgba(10, 14, 20, 0.05), 0 24px 56px rgba(10, 14, 20, 0.14);
  --shadow-primary: 0 6px 20px rgba(239, 84, 102, 0.32);

  /* --- Radien --- */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  /* --- Spacing --- */
  --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;

  /* --- Typografie --- */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Noto Sans SC", sans-serif;
  --font-mono: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, Monaco, Consolas, monospace;

  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 17px;
  --fs-lg: 20px;
  --fs-xl: 24px;
  --fs-2xl: 32px;
  --fs-3xl: 44px;
  --fs-4xl: 56px;

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
  --fw-extrabold: 800;

  --lh-tight: 1.15;
  --lh-snug: 1.3;
  --lh-normal: 1.55;
  --lh-relaxed: 1.7;

  --tracking-tight: -0.02em;
  --tracking-tighter: -0.035em;
  --tracking-tightest: -0.045em;

  /* --- Layout --- */
  --container-max: 1280px;
  --header-height: 72px;
  --player-height: 88px;
  --content-pad-x: var(--space-8);

  /* --- Übergänge --- */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --transition-fast: 140ms var(--ease-out);
  --transition-base: 240ms var(--ease-out);
  --transition-slow: 420ms var(--ease-out);

  /* --- Glassmorphism --- */
  --glass-bg: rgba(255, 255, 255, 0.72);
  --glass-bg-strong: rgba(255, 255, 255, 0.85);
  --glass-blur: 16px;
  --glass-saturate: 180%;
}

/* ---------- 3. Base Typography & Elements ---------- */
::selection {
  background: var(--color-primary-soft);
  color: var(--color-primary-text);
}

p { line-height: var(--lh-normal); }

/* ---------- 4. Helpers ---------- */
.container {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  white-space: nowrap;
  transition: background var(--transition-fast), color var(--transition-fast),
    border-color var(--transition-fast), box-shadow var(--transition-fast),
    transform var(--transition-fast);
}
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-primary);
}

.btn-secondary {
  background: var(--color-bg);
  color: var(--color-text);
  border-color: var(--color-border-strong);
  box-shadow: var(--shadow-xs);
}
.btn-secondary:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-text-subtle);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}
.btn-ghost:hover {
  background: var(--color-surface-hover);
  color: var(--color-text);
}

/* ---------- 5. Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-height);
  background: var(--glass-bg);
  backdrop-filter: saturate(var(--glass-saturate)) blur(var(--glass-blur));
  -webkit-backdrop-filter: saturate(var(--glass-saturate)) blur(var(--glass-blur));
  border-bottom: 1px solid var(--color-border);
}

/* Subtle fade from header into page (helps glass effect read clean) */
.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--color-border) 12%,
    var(--color-border) 88%,
    transparent 100%);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: var(--space-6);
  height: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
}

/* Logo --------------------------------------------------------------------- */
.logo {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--color-text);
  font-weight: var(--fw-extrabold);
  font-size: var(--fs-lg);
  letter-spacing: var(--tracking-tight);
  flex-shrink: 0;            /* NEVER shrink the logo */
  transition: opacity var(--transition-fast);
}
.logo:hover { color: var(--color-text); opacity: 0.9; }

.logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  filter: drop-shadow(0 4px 10px rgba(239, 84, 102, 0.25));
}
.logo-mark svg { width: 100%; height: 100%; }

.logo-text {
  background: var(--color-gradient-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  /* Fallback for browsers without background-clip:text */
  @supports not ((-webkit-background-clip: text) or (background-clip: text)) {
    background: none;
    color: var(--color-text);
  }
}

/* Navigation --------------------------------------------------------------- */
.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex-shrink: 0;            /* NEVER shrink the nav */
}
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--color-text-muted);
  font-weight: var(--fw-medium);
  font-size: var(--fs-base);
  line-height: 1;
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast);
}
.nav-link svg { opacity: 0.85; }
.nav-link:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}
.nav-link.active {
  color: var(--color-primary-text);
  background: var(--color-primary-soft);
}
.nav-link.active svg { opacity: 1; }

/* Search form -------------------------------------------------------------- */
/* Layout rule: logo + nav are flex-shrink:0, search takes remaining space
   with min-width:0 so it never pushes the layout, even while typing. */
.search-form {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-left: auto;            /* push to the right */
  flex: 1 1 auto;               /* grow + shrink, but capped by max-width */
  min-width: 0;                 /* allow shrinking below content size */
  max-width: 380px;
  height: 44px;
  padding: var(--space-1) var(--space-1) var(--space-1) var(--space-4);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    box-shadow var(--transition-fast);
}
.search-form:hover {
  border-color: var(--color-border-strong);
  background: var(--color-bg);
}
.search-form:focus-within {
  background: var(--color-bg);
  border-color: var(--color-primary);
  box-shadow: 0 0 0 4px var(--color-primary-ring);
}

.search-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-subtle);
  flex-shrink: 0;
  transition: color var(--transition-fast);
}
.search-form:focus-within .search-icon { color: var(--color-primary); }

.search-input {
  flex: 1 1 0;
  min-width: 0;                 /* critical: lets input shrink inside flex */
  max-width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  outline: none;                /* no inner outline – the parent .search-form shows the focus ring */
  font-size: var(--fs-base);
  font-family: inherit;
  color: var(--color-text);
  padding: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Explicitly suppress any focus styling on the input – the wrapping
   .search-form gets the focus ring via :focus-within. */
.search-input:focus,
.search-input:focus-visible {
  outline: none;
  box-shadow: none;
}
.search-input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search-input::placeholder { color: var(--color-text-subtle); }

.search-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  background: var(--color-gradient-brand);
  color: var(--color-text-inverse);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast),
    filter var(--transition-fast);
}
.search-submit:hover {
  transform: scale(1.05);
  box-shadow: var(--shadow-primary);
  filter: brightness(1.05);
}
.search-submit:active { transform: scale(0.98); }
.search-submit svg { display: block; }

/* ---------- 6. Main / Page Header / Section Title ---------- */
.main-content {
  flex: 1 1 auto;
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-10) var(--content-pad-x)
           calc(var(--space-16) + var(--space-8));
  min-width: 0;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-6);
  margin-bottom: var(--space-8);
  flex-wrap: wrap;
}
.page-title {
  font-size: var(--fs-2xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-tighter);
  line-height: var(--lh-tight);
  color: var(--color-text);
}
.page-subtitle {
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
  line-height: var(--lh-snug);
  max-width: 60ch;
}

.section-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-5);
  color: var(--color-text);
}
.section-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--color-gradient-brand);
  border-radius: var(--radius-pill);
  flex-shrink: 0;
}

/* ---------- 7. Tabs ---------- */
.tabs {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-1);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-pill);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
  white-space: nowrap;
  transition: color var(--transition-fast), background var(--transition-fast),
    box-shadow var(--transition-fast);
}
.tab:hover { color: var(--color-text); }
.tab.active {
  background: var(--color-bg);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
}

/* ---------- 8. Grid ---------- */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: var(--space-6);
}

.grid-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* ---------- 9. Cards ---------- */
.card {
  position: relative;
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: transform var(--transition-base), box-shadow var(--transition-base);
  will-change: transform;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card:active { transform: translateY(-2px); }

.card-cover {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--color-bg-soft);
  overflow: hidden;
  border-radius: var(--radius-md);
}
.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}
.card:hover .card-cover img { transform: scale(1.07); }

/* Subtle top-down gradient so the play button always has enough contrast */
.card-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
    transparent 0%,
    transparent 55%,
    rgba(10, 14, 20, 0.25) 100%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}
.card:hover .card-cover::after { opacity: 1; }

.card-play-overlay {
  position: absolute;
  bottom: var(--space-3);
  right: var(--space-3);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-text-inverse);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(10px) scale(0.9);
  transition: opacity var(--transition-base), transform var(--transition-base),
    background var(--transition-fast);
  z-index: 1;
}
.card:hover .card-play-overlay {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.card-play-overlay:hover {
  background: var(--color-primary-hover);
  transform: scale(1.08);
  box-shadow: var(--shadow-primary);
}
.card-play-overlay:active { transform: scale(0.96); }
.card-play-overlay svg { display: block; }

.card-body {
  padding: var(--space-3) var(--space-2) var(--space-4);
}
.card-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  line-height: var(--lh-snug);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
  letter-spacing: var(--tracking-tight);
}
.card-subtitle {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Round cards (Artists) ---------------------------------------------------- */
.card.card-round .card-cover {
  border-radius: 50%;
  margin: var(--space-3);
  aspect-ratio: 1 / 1;
}
.card.card-round .card-cover::after { display: none; }
.card.card-round .card-play-overlay {
  inset: 0;
  margin: auto;
  bottom: auto;
  right: auto;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  opacity: 0;
  background: rgba(10, 14, 20, 0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  width: 56px;
  height: 56px;
}
.card.card-round:hover .card-play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}
.card.card-round .card-play-overlay:hover {
  background: var(--color-primary);
  transform: translate(-50%, -50%) scale(1.06);
}
.card.card-round .card-body {
  text-align: center;
  padding: 0 var(--space-3) var(--space-4);
}
.card.card-round .card-title { text-align: center; }
.card.card-round .card-subtitle { text-align: center; }

/* ---------- 10. Track List ---------- */
.track-list {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-xs);
}

.track-item {
  display: grid;
  grid-template-columns: 40px 48px 1fr auto auto;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-2) var(--space-4);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-subtle);
  transition: background var(--transition-fast);
}
.track-item:last-child { border-bottom: none; }
.track-item:hover { background: var(--color-surface-hover); }
.track-item.playing {
  background: var(--color-primary-soft);
}
.track-item.playing .track-number { color: var(--color-primary); }

.track-number {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0 auto;
  color: var(--color-text-subtle);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  font-variant-numeric: tabular-nums;
}
.track-number-text { display: inline; }
.track-play-icon {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
}
.track-item:hover .track-number-text { display: none; }
.track-item:hover .track-play-icon { display: flex; }
.track-item.playing:hover .track-play-icon { color: var(--color-primary); }

/* Equalizer bars when a track is playing (decorative, optional) */
.track-item.playing .track-number-text::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  /* placeholder for potential JS-injected equalizer; kept stable here */
}

.track-cover {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  background: var(--color-bg-soft);
  flex-shrink: 0;
}

.track-info { min-width: 0; }
.track-title {
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: var(--tracking-tight);
}
.track-item.playing .track-title {
  color: var(--color-primary);
  font-weight: var(--fw-semibold);
}
.track-artist {
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.track-duration {
  font-size: var(--fs-sm);
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.track-item:hover .track-actions { opacity: 1; }
.track-item.playing .track-actions { opacity: 1; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: var(--color-text-muted);
  transition: background var(--transition-fast), color var(--transition-fast),
    transform var(--transition-fast);
}
.icon-btn:hover {
  background: rgba(10, 14, 20, 0.06);
  color: var(--color-text);
}
.icon-btn:active { transform: scale(0.92); }
.icon-btn.icon-btn-primary:hover {
  color: var(--color-primary);
  background: var(--color-primary-soft);
}

/* ---------- 11. Artist Hero ---------- */
.artist-hero {
  display: flex;
  align-items: flex-end;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
  padding: var(--space-8) 0 var(--space-6);
  flex-wrap: wrap;
  position: relative;
}
.artist-hero-image {
  width: 220px;
  height: 220px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--color-bg-soft);
  box-shadow: var(--shadow-xl);
  flex-shrink: 0;
  border: 4px solid var(--color-bg);
}
.artist-hero-info {
  flex: 1 1 280px;
  min-width: 0;
}
.artist-hero-name {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-tightest);
  line-height: var(--lh-tight);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  overflow-wrap: break-word;
}
.artist-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
  flex-wrap: wrap;
}
.artist-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.artist-hero-meta svg { color: var(--color-text-subtle); }

/* ---------- 12. Album Hero ---------- */
.album-hero {
  display: flex;
  align-items: flex-end;
  gap: var(--space-8);
  margin-bottom: var(--space-10);
  padding: var(--space-8) 0 var(--space-6);
  flex-wrap: wrap;
}
.album-hero-cover {
  width: 220px;
  height: 220px;
  border-radius: var(--radius-lg);
  object-fit: cover;
  background: var(--color-bg-soft);
  box-shadow: var(--shadow-xl);
  flex-shrink: 0;
}
.album-hero-info {
  flex: 1 1 280px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.album-hero-label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  color: var(--color-text-subtle);
  margin-bottom: var(--space-2);
}
.album-hero-title {
  font-size: var(--fs-3xl);
  font-weight: var(--fw-extrabold);
  letter-spacing: var(--tracking-tightest);
  line-height: var(--lh-tight);
  color: var(--color-text);
  margin-bottom: var(--space-3);
  overflow-wrap: break-word;
}
.album-hero-meta {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--fs-md);
  flex-wrap: wrap;
}
.album-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.album-hero-meta svg { color: var(--color-text-subtle); }
.album-hero-meta .dot {
  display: inline-block;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-subtle);
  flex-shrink: 0;
}

/* ---------- 13. Loading / Error / Empty / Skeleton ---------- */
.loading-state,
.error-state,
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-24) var(--space-6);
  text-align: center;
  color: var(--color-text-muted);
}
.error-state { color: var(--color-danger); }
.error-state svg,
.empty-state svg {
  color: var(--color-text-subtle);
  opacity: 0.6;
}
.error-state h2,
.empty-state h2 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-bold);
  color: var(--color-text);
  letter-spacing: var(--tracking-tight);
}
.loading-state p,
.error-state p,
.empty-state p { color: var(--color-text-muted); max-width: 48ch; }

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer --------------------------------------------------------- */
.skeleton-card {
  background: var(--color-bg-elevated);
  border-radius: var(--radius-lg);
  overflow: hidden;
  position: relative;
}
.skeleton-cover {
  aspect-ratio: 1 / 1;
  background: linear-gradient(
    100deg,
    var(--color-bg-soft) 30%,
    var(--color-surface-hover) 50%,
    var(--color-bg-soft) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-line {
  height: 12px;
  margin: var(--space-2) var(--space-2) 0;
  border-radius: var(--radius-sm);
  background: linear-gradient(
    100deg,
    var(--color-bg-soft) 30%,
    var(--color-surface-hover) 50%,
    var(--color-bg-soft) 70%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}
.skeleton-line.short { width: 55%; }
.skeleton-line:last-child { margin-bottom: var(--space-4); }

@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- 14. Pagination ---------- */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-10);
  padding-top: var(--space-6);
}
.pagination-btn {
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-strong);
  background: var(--color-bg);
  color: var(--color-text);
  font-weight: var(--fw-medium);
  font-size: var(--fs-sm);
  box-shadow: var(--shadow-xs);
  transition: background var(--transition-fast), border-color var(--transition-fast),
    transform var(--transition-fast), box-shadow var(--transition-fast);
}
.pagination-btn:hover:not(:disabled) {
  background: var(--color-surface-hover);
  border-color: var(--color-text-subtle);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.pagination-btn:active:not(:disabled) { transform: translateY(0); }
.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  box-shadow: none;
}
.pagination-info {
  padding: 0 var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- 15. Player Bar ---------- */
.player-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--player-height);
  padding: var(--space-3) 0;
  background: var(--glass-bg-strong);
  backdrop-filter: saturate(var(--glass-saturate)) blur(24px);
  -webkit-backdrop-filter: saturate(var(--glass-saturate)) blur(24px);
  border-top: 1px solid var(--color-border);
  box-shadow: 0 -8px 28px rgba(10, 14, 20, 0.06);
}
.player-bar[hidden] { display: none; }

.player-inner {
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  align-items: center;
  gap: var(--space-6);
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
  height: 100%;
}

/* Left: track info -------------------------------------------------------- */
.player-track-info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.player-cover-wrap {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-bg-soft);
  box-shadow: var(--shadow-sm);
}
.player-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.player-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.player-title {
  display: block;
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: var(--tracking-tight);
}
.player-artist {
  display: block;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Center: controls -------------------------------------------------------- */
.player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.player-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: color var(--transition-fast), background var(--transition-fast),
    transform var(--transition-fast);
}
.player-btn:hover {
  color: var(--color-text);
  background: var(--color-surface-hover);
}
.player-btn:active { transform: scale(0.94); }

.player-play-btn {
  width: 44px;
  height: 44px;
  background: var(--color-text);
  color: var(--color-text-inverse);
  box-shadow: var(--shadow-sm);
}
.player-play-btn:hover {
  background: var(--color-primary);
  color: var(--color-text-inverse);
  transform: scale(1.05);
  box-shadow: var(--shadow-primary);
}

.player-progress {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}
.player-progress-bar {
  position: relative;
  flex: 1 1 auto;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  cursor: pointer;
  overflow: visible;
  min-width: 0;
}
.player-progress-fill {
  position: absolute;
  inset: 0;
  height: 100%;
  width: 0%;
  background: var(--color-primary);
  border-radius: var(--radius-pill);
  transition: width 100ms linear;
}
.player-progress-bar:hover .player-progress-fill { background: var(--color-primary-hover); }
/* Hover knob */
.player-progress-bar::after {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--progress-pct, 0%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: var(--shadow-sm);
  transform: translate(-50%, -50%) scale(0);
  transition: transform var(--transition-fast);
  pointer-events: none;
}
.player-progress-bar:hover::after { transform: translate(-50%, -50%) scale(1); }

.player-time {
  font-size: var(--fs-xs);
  color: var(--color-text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 78px;
  text-align: right;
  flex-shrink: 0;
}

/* Right: volume ----------------------------------------------------------- */
.player-volume {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  justify-content: flex-end;
  min-width: 0;
}
.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 90px;
  height: 4px;
  background: var(--color-border);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}
.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-fast);
}
.volume-slider::-webkit-slider-thumb:hover { transform: scale(1.25); }
.volume-slider::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border: none;
  border-radius: 50%;
  background: var(--color-primary);
  cursor: pointer;
  box-shadow: var(--shadow-xs);
}

/* ---------- 16. Toasts ---------- */
.toast-container {
  position: fixed;
  bottom: calc(var(--player-height) + var(--space-4));
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  pointer-events: none;
}
.toast {
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  animation: toastIn 280ms var(--ease-spring);
}
.toast.toast-leaving {
  animation: toastOut 200ms var(--ease-in-out) forwards;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes toastOut {
  to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* ---------- 17. Footer ---------- */
.site-footer {
  background: var(--color-bg-soft);
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) 0;
  margin-top: auto;
}
.footer-inner {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 var(--content-pad-x);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--color-text-muted);
}
.footer-inner a {
  color: var(--color-text);
  font-weight: var(--fw-medium);
  text-decoration: underline;
  text-decoration-color: var(--color-border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color var(--transition-fast);
}
.footer-inner a:hover { text-decoration-color: var(--color-primary); }
.footer-disclaimer {
  color: var(--color-text-subtle);
  font-size: var(--fs-xs);
}

/* ---------- 18. Stats Badge & Misc ---------- */
.stats-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-2);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  font-size: var(--fs-xs);
  font-weight: var(--fw-medium);
  color: var(--color-text-muted);
}

/* ---------- 19. Responsive ---------- */
/* Tablet landscape & smaller */
@media (max-width: 1024px) {
  :root { --content-pad-x: var(--space-6); }
  .grid-cards { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-5); }
}

/* Tablet portrait / mobile-ish */
@media (max-width: 900px) {
  .main-nav { display: none; }              /* hide nav, keep logo + search */
  .player-inner {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "info controls";
  }
  .player-track-info { grid-area: info; }
  .player-controls { grid-area: controls; justify-content: flex-end; }
  .player-volume { display: none; }
  .player-time { min-width: 0; }
  .player-progress-bar { max-width: 220px; }
}

/* Phone */
@media (max-width: 768px) {
  :root {
    --header-height: 64px;
    --player-height: 72px;
    --content-pad-x: var(--space-4);
  }
  .header-inner { gap: var(--space-3); }

  .search-form {
    height: 40px;
    padding-left: var(--space-3);
  }
  .search-submit { width: 32px; height: 32px; }

  .main-content {
    padding: var(--space-6) var(--content-pad-x) calc(var(--space-12) + var(--space-8));
  }

  .page-title { font-size: var(--fs-xl); }
  .page-subtitle { font-size: var(--fs-base); }

  .artist-hero,
  .album-hero {
    gap: var(--space-4);
    padding: var(--space-4) 0;
  }
  .artist-hero-image,
  .album-hero-cover {
    width: 132px;
    height: 132px;
  }
  .artist-hero-name,
  .album-hero-title {
    font-size: var(--fs-2xl);
    letter-spacing: var(--tracking-tighter);
  }
  .artist-hero-meta,
  .album-hero-meta { font-size: var(--fs-base); gap: var(--space-3); }

  .grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: var(--space-4);
  }
  .card-play-overlay { width: 42px; height: 42px; }

  .track-item {
    grid-template-columns: 28px 40px 1fr auto;
    gap: var(--space-2);
    padding: var(--space-2);
  }
  .track-actions { display: none; }
  .track-cover { width: 40px; height: 40px; }
  .track-title { font-size: var(--fs-sm); }
  .track-artist { font-size: var(--fs-xs); }
  .track-duration { font-size: var(--fs-xs); }

  .tabs { margin-bottom: var(--space-5); }
  .tab { padding: var(--space-2) var(--space-4); }

  /* Compact player on phones */
  .player-bar { padding: var(--space-2) 0; }
  .player-progress-bar { max-width: 140px; }
  .player-time { display: none; }
  .player-cover-wrap { width: 44px; height: 44px; }
  .player-play-btn { width: 40px; height: 40px; }
  .player-btn { width: 32px; height: 32px; }
}

/* Very small phones */
@media (max-width: 380px) {
  .logo-text { display: none; }             /* keep mark + search only */
  .player-progress-bar { display: none; }
  .player-controls { gap: var(--space-1); }
}

/* ---------- 20. Accessibility ---------- */
/* Global focus ring – but NOT for inputs whose parent shows its own ring */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Remove the global outline for inputs inside .search-form – the parent
   .search-form renders its own focus ring via :focus-within (box-shadow).
   Without this we get a double ring (outer shadow + inner outline). */
.search-input:focus-visible,
.search-form .search-input:focus-visible {
  outline: none;
}
/* Remove default outline only when focus is visible (mouse users) */
:focus:not(:focus-visible) { outline: none; }

/* Honor user preference: no 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;
  }
  .spinner { animation-duration: 1.2s !important; }
}

/* Dark-mode users on systems that prefer it are NOT flipped automatically
   (the brief specifies a bright design). Keep light theme. */

/* ---------- 21. Scrollbars ---------- */
/* WebKit (Chrome, Safari, Edge) */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--color-border-strong);
  border-radius: var(--radius-pill);
  border: 3px solid var(--color-bg);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-subtle);
}
::-webkit-scrollbar-corner { background: transparent; }

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border-strong) transparent;
}

/* Thin scrollbars inside specific scroll areas (e.g. tabs) */
.tabs,
.scroll-thin {
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar,
.scroll-thin::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}
