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

:root {
  --brand:       #7c3aed;
  --brand-light: #a78bfa;
  --brand-dark:  #5b21b6;
  --accent:      #ec4899;
  --gold:        #f59e0b;
  --silver:      #9ca3af;
  --bronze:      #d97706;

  --bg:          #f5f3ff;
  --surface:     #ffffff;
  --border:      #e5e7eb;
  --text:        #1a1a2e;
  --muted:       #6b7280;

  --radius:      0.75rem;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow-md:   0 4px 12px rgba(0,0,0,.10);

  --font-sans: system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ── Base ─────────────────────────────────────────────────── */
html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

main.container { flex: 1; padding-block: 2rem; }

/* ── Header ───────────────────────────────────────────────── */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 1rem;
}

.logo {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--brand);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.logo:hover { text-decoration: none; }
.logo-bubble {
  font-size: 0.6em;
  color: var(--accent);
  vertical-align: middle;
  line-height: 1;
}

.site-nav { display: flex; gap: 1.5rem; }
.site-nav a {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.15s;
}
.site-nav a:hover { color: var(--brand); text-decoration: none; }

/* ── Hero ─────────────────────────────────────────────────── */
.hero { margin-bottom: 2rem; }

.hero h1 {
  font-size: clamp(1.5rem, 4vw, 2.1rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero-sub {
  color: var(--muted);
  font-size: 1rem;
}

/* ── Search ───────────────────────────────────────────────── */
.search-section { margin-bottom: 2rem; }

.search-form {
  display: flex;
  gap: 0;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-form:focus-within {
  border-color: var(--brand-light);
  box-shadow: 0 0 0 3px rgba(124,58,237,.12);
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text);
}
.search-input::placeholder { color: var(--muted); }

.search-btn {
  border: none;
  background: transparent;
  padding: 0 1rem;
  cursor: pointer;
  color: var(--muted);
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.search-btn:hover { color: var(--brand); }

/* ── Chart ────────────────────────────────────────────────── */
.chart-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.chart-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.chart-meta {
  font-size: 0.8rem;
  color: var(--muted);
}

.chart-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

/* ── Lyric card ───────────────────────────────────────────── */
.lyric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, border-color 0.15s;
  animation: cardIn 0.2s ease both;
}
.lyric-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-light);
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rank {
  font-size: 1.1rem;
  font-weight: 800;
  min-width: 2rem;
  text-align: center;
  flex-shrink: 0;
}
.rank-1 { color: var(--gold); }
.rank-2 { color: var(--silver); }
.rank-3 { color: var(--bronze); }
.rank-other { color: var(--muted); font-size: 0.9rem; }

.lyric-body { flex: 1; min-width: 0; }

.lyric-text {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 0.25rem;
  /* Render the lyric in a subtle quote style */
  position: relative;
}
.lyric-text::before {
  content: '\201C';
  color: var(--brand-light);
  margin-right: 0.1em;
}
.lyric-text::after {
  content: '\201D';
  color: var(--brand-light);
  margin-left: 0.1em;
}

.lyric-meta {
  font-size: 0.82rem;
  color: var(--muted);
}
.lyric-meta strong { color: var(--text); font-weight: 600; }

/* ── Vote button ──────────────────────────────────────────── */
.vote-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 0.625rem;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
  color: var(--muted);
  min-width: 3.5rem;
}
.vote-btn:hover:not(:disabled) {
  background: #f5f3ff;
  border-color: var(--brand-light);
  color: var(--brand);
}
.vote-btn.voted {
  background: #f5f3ff;
  border-color: var(--brand);
  color: var(--brand);
}
.vote-btn:disabled {
  cursor: default;
  opacity: 0.55;
}

.vote-icon { font-size: 1.1rem; line-height: 1; }
.vote-count { font-size: 0.78rem; font-weight: 700; }

/* ── Empty state ──────────────────────────────────────────── */
.no-results {
  text-align: center;
  color: var(--muted);
  padding: 3rem 1rem;
}
.hidden { display: none; }

/* ── Footer ───────────────────────────────────────────────── */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 1.5rem;
  margin-top: 2rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  text-align: center;
}

.footer-inner p { font-size: 0.875rem; color: var(--muted); }
.footer-inner a { color: var(--brand); }

.footer-note { font-size: 0.8rem !important; }

/* ── About page ───────────────────────────────────────────── */
.about-content { max-width: 560px; }
.about-content h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1rem;
  letter-spacing: -0.03em;
}
.about-content h2 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
}
.about-content p { color: var(--muted); margin-bottom: 0.75rem; line-height: 1.7; }
.about-content p a { font-weight: 500; }
.back-link { display: inline-flex; align-items: center; gap: 0.3rem; margin-bottom: 2rem; font-weight: 500; font-size: 0.9rem; color: var(--muted); }
.back-link:hover { color: var(--brand); text-decoration: none; }

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 480px) {
  .lyric-text { font-size: 0.93rem; }
  .vote-btn { min-width: 3rem; padding-inline: 0.5rem; }
}
