/* Self-hosted fonts — latin only, font-display:optional avoids late-swap CLS */
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("/static/fonts/barlow-condensed-600.woff2") format("woff2");
}
@font-face {
  font-family: "Barlow Condensed";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("/static/fonts/barlow-condensed-700.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url("/static/fonts/source-sans-3.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 600;
  font-display: optional;
  src: url("/static/fonts/source-sans-3.woff2") format("woff2");
}
@font-face {
  font-family: "Source Sans 3";
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url("/static/fonts/source-sans-3.woff2") format("woff2");
}

:root {
  --page: #f7f5f1;
  --ink: #1a1a1a;
  --muted: #5c5c5c;
  --accent: #0b6e6a;
  --accent-soft: #e6f3f2;
  --peak: #d97706;
  --panel: #eef2f1;
  --rule: rgba(26, 26, 26, 0.12);
  --font-display: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--page);
  background-image:
    radial-gradient(rgba(26, 26, 26, 0.03) 0.6px, transparent 0.6px),
    linear-gradient(180deg, #faf8f4 0%, var(--page) 40%, #f3f0ea 100%);
  background-size: 4px 4px, auto;
  font-family: var(--font-body);
  line-height: 1.45;
}

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

.mb-3 {
  margin-bottom: 1rem;
}

.grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .grid-2 {
    grid-template-columns: 1fr 1fr;
  }
  .grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
  }
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

a:hover {
  color: #085652;
}

.site-shell {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

@media (min-width: 768px) {
  .site-shell {
    max-width: 52rem;
    padding: 2rem 1.5rem 4rem;
  }
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
  display: block;
  /* Reserve space before webfont loads (CLS) */
  min-height: 1.1em;
}

.brand:hover {
  color: var(--ink);
}

.tagline {
  margin: 0.4rem 0 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}

.search-wrap {
  position: relative;
}

.search-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  background: #fff;
  padding: 0.35rem 0.5rem;
  min-height: 2.75rem;
}

.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(11, 110, 106, 0.15);
}

.search-box .search-input,
.search-wrap .form-control.search-input {
  flex: 1 1 10rem;
  border: 0;
  box-shadow: none;
  padding: 0.35rem 0.4rem;
  min-width: 8rem;
  background: transparent;
}

.search-box .search-input:focus {
  box-shadow: none;
  outline: none;
}

.chips {
  display: contents;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  border: 1px solid rgba(11, 110, 106, 0.25);
  background: var(--accent-soft);
  color: var(--ink);
  border-radius: 0.3rem;
  padding: 0.2rem 0.45rem 0.2rem 0.55rem;
  font-size: 0.9rem;
  line-height: 1.2;
  cursor: pointer;
}

.chip span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 16rem;
}

.chip-x {
  color: var(--muted);
  font-size: 1.1rem;
  line-height: 1;
}

.chip:hover .chip-x {
  color: var(--ink);
}

.search-wrap .form-control {
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  background: #fff;
  padding: 0.7rem 0.9rem;
  font-size: 1rem;
  box-shadow: none;
}

.search-wrap .form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 0.2rem rgba(11, 110, 106, 0.15);
}

.typeahead {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  margin-top: 0.35rem;
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: 0.35rem;
  overflow: hidden;
  max-height: 20rem;
  overflow-y: auto;
}

.typeahead .group {
  padding: 0.45rem 0.9rem 0.2rem;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.typeahead a,
.typeahead .typeahead-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 0.45rem 0.9rem;
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  cursor: pointer;
}

.typeahead a:hover,
.typeahead a.active,
.typeahead .typeahead-item:hover,
.typeahead .typeahead-item.active {
  background: var(--accent-soft);
  color: var(--ink);
}

.page-kicker {
  margin: 1.25rem 0 0.35rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4.5vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  margin: 0 0 0.75rem;
  min-height: 1.2em;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  color: var(--muted);
  font-size: 0.98rem;
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--rule);
}

.facts strong {
  color: var(--ink);
  font-weight: 600;
}

.peak-text {
  color: var(--peak) !important;
}

.nav-weeks {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.nav-weeks-bottom {
  margin-top: 1.75rem;
  margin-bottom: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
}

.chart-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.chart-row {
  display: grid;
  grid-template-columns: 2.75rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.rank {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--muted);
}

.rank.is-peak {
  color: var(--peak);
}

.song-title {
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
}

.song-title:hover {
  color: var(--accent);
}

.song-artist {
  display: block;
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}

.song-artist:hover {
  color: var(--accent);
}

.song-meta {
  margin-top: 0.15rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.section-heading {
  margin: 2rem 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.section-note {
  color: var(--muted);
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

.simple-list {
  padding-left: 1.1rem;
  margin: 0;
}

.simple-list li {
  margin-bottom: 0.35rem;
}

.song-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.song-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.overlap-section {
  margin: 0.5rem 0 1.75rem;
}

.section-count {
  font-family: var(--font-body);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  font-size: 0.85em;
}

.overlap-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.overlap-list li {
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--rule);
}

.overlap-entry {
  display: inline;
}

.chart-section {
  margin-top: 0.5rem;
}

.chart-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.chart-filter {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
}

.chart-filter input {
  accent-color: var(--accent);
}

.chart-panel {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 0.4rem;
  padding: 1rem;
}

.year-links {
  line-height: 1.9;
}

.year-links-lg {
  font-size: 1.1rem;
}

.site-footer {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer p {
  margin-bottom: 0.4rem;
}
