/* MUSÉE SONORE — responsive typography refinement.
   Loaded after page styles so it can normalise type across the archive,
   collection, search and listening-room layouts without changing structure. */

:root {
  --type-micro: clamp(8px, 0.58vw, 9px);
  --type-label: clamp(8px, 0.62vw, 9.5px);
  --type-body: clamp(14px, 1.05vw, 17px);
  --type-copy: clamp(15px, 1.25vw, 19px);
  --type-table: clamp(12px, 0.95vw, 14px);
  --type-nav: clamp(9px, 0.7vw, 10px);
}

html {
  text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  font-optical-sizing: auto;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: clip;
}

body {
  font-feature-settings: "kern" 1, "liga" 1;
  overflow-x: clip;
}

h1, h2, h3 {
  text-wrap: balance;
}

p,
li,
figcaption,
.dialog-note,
.album-description,
.hero-description,
.hires-description,
.discover-lead,
.artist-bio,
.artists-lead,
.collection-lead,
.archive-lead,
.player-lead {
  text-wrap: pretty;
}

.album-description,
.artist-bio {
  font-size: clamp(18px, 1.5vw, 23px);
  line-height: 1.7;
}

.discover-lead,
.artists-lead,
.collection-lead,
.archive-lead,
.player-lead {
  font-size: clamp(15px, 1.3vw, 20px);
  line-height: 1.72;
}

/* Core reading copy: fluid but never below 14px. */
.hero-description,
.about-statement,
.hires-description,
.album-not-found p:not(.eyebrow),
.archive-empty > p:not(.eyebrow),
.collection-empty > p:not(.eyebrow),
.library-empty > p:not(.eyebrow) {
  font-size: var(--type-copy);
  line-height: 1.72;
}

.discover-note > p,
.about-copy,
.hires-copy > p,
.dialog-note,
.album-pending,
.album-loading {
  font-size: clamp(12px, 0.95vw, 14px);
  line-height: 1.75;
}

/* Labels and microcopy: the old 6–7px sizes are too small on phones. */
.eyebrow,
.nav-link,
.language-toggle,
.search-trigger,
.collection-trigger,
.collection-count,
.album-breadcrumb,
.album-tag,
.album-section-note,
.album-collection-copy strong,
.preview-status,
.preview-legal,
.preview-external,
.album-sources-label,
.album-source-link,
.album-meta-row,
.album-fact,
.track-no,
.track-duration,
.track-disc,
.similar-meta,
.similar-fallback .fallback-brand,
.similar-fallback .fallback-foot,
.detail-pager-label,
.artist-type-line,
.relation-role,
.relation-meta,
.relation-action,
.work-action,
.artist-index-brand,
.artist-index-meta,
.artist-index-count,
.artist-index-action,
.archive-stat span,
.archive-search-label,
.archive-filter,
.archive-result-count,
.archive-group-head span,
.archive-show-all,
.archive-result-type,
.archive-result-meta,
.archive-result-action,
.collection-stat span,
.collection-filter,
.collection-sort,
.collection-sort select,
.collection-util,
.collection-cover-brand,
.collection-cover-meta,
.collection-saved,
.player-quality,
.player-track-copy span,
.player-icon,
.library-mode,
.player-page-body .site-footer,
.track-table th,
.track-table td.track-number,
.track-table td.track-year,
.track-table td.track-duration,
.queue-heading,
.queue-remove,
.eq-bands,
.library-sort,
.library-footer,
.import-status,
.sidebar-note,
.library-search input,
.library-sort select {
  font-size: var(--type-micro);
}

.album-meta-row,
.album-fact,
.artist-index-meta,
.archive-result-meta,
.player-track-copy span,
.dialog-note {
  line-height: 1.65;
}

/* Slightly larger functional labels and controls. */
.nav-link,
.language-toggle,
.search-trigger,
.collection-trigger,
.album-filter,
.archive-filter,
.collection-filter,
.library-mode,
.player-icon,
.track-preview,
.track-table th,
.track-table td.track-number,
.track-table td.track-year,
.track-table td.track-duration,
.preview-legal,
.preview-external,
.sidebar-note,
.import-status {
  font-size: var(--type-label);
}

.nav-link,
.language-toggle,
.search-trigger,
.collection-trigger,
.album-filter,
.archive-filter,
.collection-filter,
.library-mode,
.player-icon,
.track-preview,
.text-link,
.solid-button,
.ghost-button,
.add-audio-button,
.row-button,
.playlist-open,
.library-nav,
.queue-title,
.now-playlist {
  letter-spacing: .045em;
}

/* Controls: 8.5–10px is the floor; inputs/table copy stay legible. */
.album-filter,
.archive-filter,
.collection-filter,
.solid-button,
.ghost-button,
.text-link,
.add-audio-button,
.library-nav,
.now-playlist,
.row-button,
.queue-remove,
.playlist-delete,
.archive-show-all {
  font-size: clamp(8.5px, 0.64vw, 10px);
}

.library-search input,
.library-sort select,
.artist-filter input,
.artist-filter select,
.collection-sort select,
.archive-search-wrap input,
.album-filter select,
.filter-group select,
.sort-wrap select {
  font-size: clamp(12px, 0.9vw, 14px);
}

/* Editorial body copy and tables scale with the viewport. */
.track-title,
.track-table td.track-title,
.track-table td {
  font-size: var(--type-table);
}

.track-table td {
  line-height: 1.45;
}

.track-title,
.track-table td.track-title {
  font-size: clamp(14px, 1vw, 16px);
}

/* Listening room: functional labels and controls need a larger floor than
   editorial microtype. */
.sidebar-heading {
  font-size: 9px;
  font-weight: 500;
  letter-spacing: .075em;
}

.library-nav {
  font-size: 10px;
}

.playlist-open {
  font-size: 10px;
}

.playlist-count {
  font-size: 8.5px;
}

.queue-heading {
  font-size: 9px;
}

.queue-title {
  font-size: 10px;
  line-height: 1.4;
}

.queue-remove {
  font-size: 12px;
}

.now-meta {
  font-size: 8.5px;
}

.now-card > p:not(.eyebrow) {
  font-size: 10px;
}

.eq-bands,
.eq-bands em {
  font-size: 8.5px;
}

.library-mode,
.library-player-bar .library-mode {
  font-size: 8px;
}

.player-icon {
  font-size: 12px;
}

.player-track-copy strong {
  font-size: 11px;
}

.player-track-copy span {
  font-size: 9px;
}

.player-quality,
.preview-player-bar .player-quality {
  font-size: 8px;
}

.library-footer,
.import-status {
  font-size: 8.5px;
}

.archive-result-title,
.relation-name,
.artist-card h3,
.similar-card h3,
.detail-pager-title,
.collection-title,
.queue-title,
.playlist-open {
  line-height: 1.3;
}

.archive-result-title {
  font-size: clamp(18px, 1.45vw, 21px);
}

/* Player typography: fixed-width times assist scanning. */
#currentTime,
#totalTime,
#libraryCurrent,
#libraryTotal,
#previewCurrent,
#previewTotal,
.player-quality,
.track-duration,
.track-table td.track-year {
  font-variant-numeric: tabular-nums;
}

.player-art,
.now-art {
  line-height: 1;
}

/* Chinese fallback: system CJK fonts render consistently on Windows/macOS. */
html[lang="zh-CN"] {
  --sans: "DM Sans", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --serif: "Playfair Display", "Noto Serif SC", "Source Han Serif SC", "Songti SC", "STSong", "SimSun", serif;
  --mono: "DM Mono", "Noto Sans SC", "Microsoft YaHei", "PingFang SC", monospace;
}

html[lang="zh-CN"] body,
html[lang="zh-CN"] .dialog-note,
html[lang="zh-CN"] .album-description,
html[lang="zh-CN"] .artist-bio,
html[lang="zh-CN"] .discover-lead,
html[lang="zh-CN"] .collection-lead,
html[lang="zh-CN"] .archive-lead,
html[lang="zh-CN"] .player-lead,
html[lang="zh-CN"] .track-title,
html[lang="zh-CN"] .track-table td,
html[lang="zh-CN"] .archive-result-title,
html[lang="zh-CN"] .collection-title {
  font-family: var(--sans);
  line-height: 1.85;
  letter-spacing: 0;
}

html[lang="zh-CN"] h1,
html[lang="zh-CN"] h2,
html[lang="zh-CN"] h3 {
  font-family: var(--serif);
  letter-spacing: -.035em;
}

/* Tablet: keep header/nav legible, lift the smallest metadata. */
@media (max-width: 1050px) {
  :root {
    --type-micro: 8.5px;
    --type-label: 9px;
    --type-body: 14.5px;
    --type-copy: 16px;
    --type-table: 13px;
    --type-nav: 9px;
  }

  .nav-link,
  .search-trigger,
  .language-toggle,
  .collection-trigger {
    font-size: 9px;
    letter-spacing: .035em;
  }

  .album-fact,
  .album-meta-row,
  .archive-result-meta,
  .artist-index-meta {
    font-size: 8.5px;
  }

  .track-title {
    font-size: 14px;
  }

  .archive-result-title {
    font-size: 18px;
  }
}

/* Phone: readable labels, comfortable line length, larger tap metadata. */
@media (max-width: 760px) {
  :root {
    --type-micro: 9px;
    --type-label: 9.5px;
    --type-body: 15px;
    --type-copy: 16px;
    --type-table: 13px;
    --type-nav: 12.5px;
  }

  body {
    font-size: 15px;
    line-height: 1.7;
  }

  .nav-link {
    font-size: 12.5px;
    letter-spacing: .03em;
  }

  .eyebrow,
  .album-breadcrumb,
  .album-section-note,
  .preview-status,
  .preview-legal,
  .preview-external,
  .album-sources-label,
  .artist-type-line,
  .relation-role,
  .artist-index-brand,
  .artist-index-meta,
  .artist-index-count,
  .artist-index-action,
  .archive-stat span,
  .archive-search-label,
  .archive-group-head span,
  .archive-result-type,
  .collection-stat span,
  .collection-cover-brand,
  .collection-cover-meta,
  .collection-saved,
  .queue-heading,
  .library-footer,
  .sidebar-note,
  .import-status {
    font-size: 9px;
  }

  .album-meta-row,
  .album-fact,
  .artist-index-meta,
  .archive-result-meta,
  .collection-sort,
  .collection-sort select,
  .archive-filter,
  .collection-filter,
  .library-mode,
  .track-table th,
  .track-table td.track-number,
  .track-table td.track-year,
  .track-table td.track-duration {
    font-size: 9.5px;
  }

  .archive-filter,
  .collection-filter,
  .album-filter,
  .track-preview {
    min-height: 28px;
  }

  .track-title {
    font-size: 14.5px;
    line-height: 1.5;
  }

  .archive-result-title {
    font-size: 18.5px;
    line-height: 1.35;
  }

  .hero-description,
  .about-statement,
  .hires-description,
  .discover-lead,
  .album-description,
  .artist-bio,
  .artists-lead,
  .collection-lead,
  .archive-lead,
  .player-lead {
    font-size: 16px;
    line-height: 1.8;
  }

  .track-table td {
    font-size: 13px;
    padding-top: 11px;
    padding-bottom: 11px;
  }

  .track-table th {
    letter-spacing: .06em;
  }

  .library-search input,
  .library-sort select,
  .artist-filter input,
  .artist-filter select {
    font-size: 13px;
  }

  /* Listening-room-specific legibility. */
  .sidebar-heading {
    font-size: 9.5px;
  }

  .library-nav {
    font-size: 10.5px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .playlist-open {
    font-size: 11px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .playlist-count {
    font-size: 9px;
  }

  .now-card > p:not(.eyebrow) {
    font-size: 10.5px;
  }

  .now-meta {
    font-size: 9.5px;
  }

  .now-playlist {
    font-size: 9.5px;
    padding: 9px;
  }

  .queue-heading {
    font-size: 10px;
  }

  .queue-title {
    font-size: 11px;
    padding: 4px 0;
  }

  .queue-remove {
    font-size: 14px;
  }

  .eq-bands,
  .eq-bands em {
    font-size: 9.5px;
  }

  .library-mode,
  .library-player-bar .library-mode {
    font-size: 8.5px;
    padding: 5px 6px;
  }

  .player-icon {
    font-size: 13px;
  }

  .player-track-copy strong {
    font-size: 11.5px;
  }

  .player-track-copy span {
    font-size: 9.5px;
  }

  .player-quality,
  .preview-player-bar .player-quality {
    font-size: 8.5px;
    letter-spacing: .04em;
  }

  .site-footer,
  .footer-wordmark {
    font-size: 9px;
  }

  .album-fact {
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 10px;
  }

  .preview-legal,
  .preview-external {
    line-height: 1.8;
  }
}

/* Very narrow phones: avoid 6px anything, reflow metadata labels. */
@media (max-width: 420px) {
  :root {
    --type-micro: 8.5px;
    --type-label: 9px;
    --type-copy: 15.5px;
  }

  .eyebrow,
  .album-breadcrumb,
  .album-section-note,
  .preview-status,
  .preview-legal,
  .preview-external,
  .archive-result-meta,
  .collection-stat span,
  .archive-stat span,
  .artist-index-meta,
  .collection-saved {
    font-size: 9px;
  }

  .album-meta-row,
  .album-fact {
    font-size: 9px;
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .album-fact strong {
    overflow-wrap: anywhere;
  }

  .track-title {
    font-size: 14px;
  }

  .archive-result-title {
    font-size: 18px;
  }

  .nav-link {
    font-size: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
