/* Shared responsive improvements, loaded after each page's stylesheet. */
:root { color-scheme: dark; }
html { scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
input, select, textarea { max-width: 100%; }
.search-bar input, .filter-search input,
.listing__main, .legal-content, .song-item > *, .mini-timeline__body,
.new-data-card, .tl-card, .sd-work-card, .wd-hero__meta > div, .sd-hero__meta > div { min-width: 0; }
.breadcrumb { flex-wrap: wrap; }
.breadcrumb > *, .work-row__title, .work-row__songs, .song-item__title,
.song-item__note, .sd-hero__title, .wd-hero__title, .sd-work-card,
.new-data-card, .tl-card, .mini-timeline__body, .legal-content, .chip { overflow-wrap: anywhere; }
.sd-hero__badges, .wd-hero__badges { flex-wrap: wrap; }
.filter-close, .filter-results { display: none; }
.preview-btn:focus-visible { opacity: 1; background: rgba(8,11,20,.65); }

@media (max-width: 900px) {
  /* Inline disclosure keeps the close control and search results reachable. */
  .filter-sidebar {
    display: none; position: static; inset: auto; z-index: auto;
    transform: none; transition: none; max-height: none; overflow: visible;
    padding: 20px; border-radius: var(--radius-md); background: var(--surface-solid);
  }
  .filter-sidebar.is-open { display: block; transform: none; box-shadow: none; }
  .filter-sidebar__head { gap: 12px; flex-wrap: wrap; }
  .filter-sidebar__head h2 { flex: 1; }
  .filter-close { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; border: 1px solid var(--border-strong); border-radius: 8px; }
  .filter-results { display: flex; width: 100%; justify-content: center; }
  .filter-checklist { max-height: none; overflow: visible; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
  .filter-check { min-height: 44px; }
  .filter-search input, .listing__sort select { font-size: 16px; min-width: 0; min-height: 44px; }
  .filter-clear { min-height: 44px; }
  .chip { max-width: 100%; }
  .chip button { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; flex-shrink: 0; }
}

@media (max-width: 768px) {
  :root { --text-dim: #939eb8; --text-muted: #aab4ca; }
  .container { padding-left: max(16px,env(safe-area-inset-left)); padding-right: max(16px,env(safe-area-inset-right)); }
  .site-header__inner { gap: 8px; }
  .logo { gap: 8px; min-width: 0; }
  .logo__mark { flex-shrink: 0; }
  .logo__text { font-size: clamp(.95rem,4.3vw,1.15rem); }
  .nav-toggle { width: 44px; height: 44px; flex-shrink: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .site-nav { visibility: hidden; max-height: calc(100dvh - 68px); overflow-y: auto; padding-bottom: max(20px,env(safe-area-inset-bottom)); }
  .site-nav.is-open { visibility: visible; }
  .site-nav a, .btn, .section__more { min-height: 44px; }
  a.badge { display: inline-flex; align-items: center; min-height: 44px; }
  #resultCount, #workList { scroll-margin-top: 88px; }
  .search-bar input, .form-field input, .form-field textarea, .form-field select, .tl-decade-select select { font-size: 16px; min-width: 0; }
  .form-field input, .form-field select { min-height: 48px; }
  .form-field textarea { min-height: 160px; }
  .form-field .form-hint, .form-note { font-size: .8125rem; }
  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { width: 100%; }
  .form-error, .form-success { scroll-margin-top: 88px; }
  .home-hero { padding-block: 48px 40px; }
  .home-hero::before, .home-hero::after { display: none; }
  .home-hero__waves { filter: none; }
  .home-hero__desc { font-size: .9375rem; }
  .home-hero__inner .search-bar { margin-top: 24px; }
  .home-hero__stats { gap: 24px; margin-top: 30px; }
  .search-bar { padding: 6px 6px 6px 12px; gap: 6px; }
  .search-bar .btn { padding-inline: 16px; flex-shrink: 0; }
  .home-hero__actions { width: 100%; gap: 10px; }
  .home-hero__actions .btn { flex: 1; padding-inline: 12px; }
  .section { padding-block: 40px; }
  .section__head { flex-wrap: wrap; gap: 12px; }
  .section__title { font-size: 1.4rem; }
  .listing-hero, .wd-hero, .sd-hero { padding-block: 28px 24px; }
  .listing, .timeline-page, .legal-page, .wd-body, .sd-body { padding-block: 24px 56px; }
  .listing__grid { gap: 20px; }
  .listing__toolbar { flex-direction: row; align-items: center; }
  .listing__sort { gap: 8px; flex-wrap: wrap; }
  .work-row { gap: 12px; padding: 14px 12px; }
  .work-row__title, .new-data-card__song { line-height: 1.6; }
  .song-item { grid-template-columns: 56px minmax(0,1fr); gap: 10px 14px; align-items: start; padding: 16px; }
  .song-item > .artwork { grid-column: 1; grid-row: 1; }
  .song-item__year { grid-column: 1; grid-row: 2; font-size: .8125rem; }
  .song-item > :last-child { grid-column: 2; grid-row: 1 / 3; }
  .song-item__links { gap: 8px; }
  .song-item__links a { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 8px 12px; font-size: .8125rem; }
  .song-item__title { font-size: 1rem; }
  .song-item__type { display: inline-block; margin-bottom: 4px; }
  .sd-hero__body { flex-direction: column; gap: 18px; }
  .sd-hero__info { width: 100%; }
  .artwork--lg { width: 112px; height: 112px; }
  .sd-hero__meta, .wd-hero__meta { gap: 16px 24px; }
  .sd-work-card { padding: 18px; }
  .tl-controls { align-items: stretch; }
  .tl-genre-tabs { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); border-radius: 16px; width: 100%; }
  .tl-genre-tabs button { min-height: 44px; padding: 8px; font-size: .8125rem; }
  .tl-decade-select { width: 100%; justify-content: space-between; }
  .tl-decade-select select { flex: 1; min-height: 44px; }
  .tl-count { margin-bottom: 20px; }
  .tl-card { padding: 14px; }
  .tl-year-heading { top: 76px; }
  .tl-row .tl-dot { grid-row: 1; }
  .tl-row .tl-card { grid-row: 1; }
  .legal-layout { gap: 24px; }
  .legal-toc a, .footer__col a { min-height: 44px; display: flex; align-items: center; }
  .legal-toc ol { gap: 0; }
  .info-table th { width: 30%; }
  .info-table th, .info-table td { padding: 12px 8px; }
  .site-footer { padding-bottom: max(24px,env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .timeline::before { left: 9px; }
  .tl-row { grid-template-columns: 18px minmax(0,1fr); gap: 10px; }
  .tl-row.is-left .tl-card, .tl-row.is-right .tl-card { margin: 0; }
}
@media (max-width: 359px) {
  .home-hero__actions { flex-direction: column; }
  .filter-checklist { grid-template-columns: 1fr; }
  .mini-timeline__row { grid-template-columns: 1fr; gap: 6px; }
  .song-item { grid-template-columns: 48px minmax(0,1fr); padding: 12px; gap: 8px; }
  .song-item .artwork--sm { width: 48px; height: 48px; }
}
