/*
 * SongLens legal site — single stylesheet, no external requests.
 *
 * Every colour pair in here is checked against WCAG 2.1 AA by
 * `scripts/check_contrast.py`. Do not add a colour without adding it to that
 * script's pair list: the whole point of this site is that it is the one part
 * of SongLens that demonstrably passes.
 *
 * Deliberately absent: web fonts, analytics, embeds, cookies, JavaScript.
 * The cookie policy this site publishes says the site sets no cookies and
 * loads nothing from third parties. That claim is only true as long as this
 * file stays free of them.
 */

:root {
  color-scheme: light dark;

  /* Brand, unchanged — used only where it passes contrast (large text, dark mode). */
  --brand-blue: #38b6ff;
  --brand-purple: #5e1898;

  /* Light theme. --accent is the brand blue darkened until it clears 4.5:1 on
     both page backgrounds; #38b6ff itself manages only 2.02:1 and cannot be
     used for text or controls here. */
  --bg: #ffffff;
  --bg-muted: #f5f0ff;
  --surface: #ffffff;
  --text: #1a0a2e;
  --text-secondary: #4a3a5e;
  --accent: #0b5f8f;
  --accent-text: #ffffff;
  --border: #6b7280;
  --border-subtle: #d9d2e6;
  --note-bg: #f5f0ff;
  --focus: #0b5f8f;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1a0a2e;
    --bg-muted: #261545;
    --surface: #261545;
    --text: #f5f0ff;
    --text-secondary: #cdb8ff;
    --accent: #38b6ff; /* 8.26:1 on --bg — the brand blue is fine on dark */
    --accent-text: #1a0a2e;
    --border: #8a8f98;
    --border-subtle: #3a1f5e;
    --note-bg: #261545;
    --focus: #38b6ff;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
  /* 1.125rem, not px: respects the reader's browser font size. */
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-text-size-adjust: 100%;
}

/* Skip link: visible the moment it takes focus, off-screen otherwise. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.wrap {
  max-width: 46rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header ---------- */

.site-header {
  border-bottom: 1px solid var(--border-subtle);
  background: var(--bg-muted);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.5rem;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.wordmark {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.wordmark:hover {
  text-decoration: underline;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  color: var(--accent);
  /* Tap target: 44px min height per WCAG 2.5.5, without visually bloating the row. */
  display: inline-block;
  padding: 0.6rem 0;
  min-height: 44px;
}

/* The current page is marked with aria-current, so the styling has something
   real to hang off rather than a class that lies to a screen reader. */
.site-nav a[aria-current="page"] {
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  border-bottom: 2px solid var(--accent);
}

/* ---------- content ---------- */

main {
  padding: 2.5rem 0 4rem;
}

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.375rem;
  line-height: 1.3;
  margin: 2.5rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-subtle);
}

h3 {
  font-size: 1.125rem;
  margin: 1.75rem 0 0.5rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

ul,
ol {
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.4rem;
}

a {
  color: var(--accent);
}

a:hover {
  text-decoration-thickness: 2px;
}

strong {
  font-weight: 700;
}

.lede {
  font-size: 1.1875rem;
  color: var(--text-secondary);
}

.updated {
  color: var(--text-secondary);
  font-size: 0.9375rem;
  margin-bottom: 2rem;
}

/* ---------- callouts ---------- */

.note {
  background: var(--note-bg);
  border: 1px solid var(--border-subtle);
  border-left: 4px solid var(--accent);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
  border-radius: 4px;
}

.note > :last-child {
  margin-bottom: 0;
}

.note h2,
.note h3 {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

/* ---------- tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 32rem;
  font-size: 0.9375rem;
}

caption {
  text-align: left;
  color: var(--text-secondary);
  padding-bottom: 0.5rem;
  font-size: 0.9375rem;
}

th,
td {
  text-align: left;
  vertical-align: top;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-subtle);
}

thead th {
  background: var(--bg-muted);
}

/* ---------- index page cards ---------- */

.doc-list {
  list-style: none;
  padding: 0;
  margin: 2rem 0;
  display: grid;
  gap: 1rem;
}

.doc-list li {
  margin: 0;
}

.doc-list a {
  display: block;
  padding: 1.25rem;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  background: var(--surface);
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 1.0625rem;
}

.doc-list a:hover {
  border-color: var(--accent);
  text-decoration: underline;
}

.doc-list .doc-desc {
  display: block;
  margin-top: 0.35rem;
  color: var(--text-secondary);
  font-weight: 400;
  font-size: 0.9375rem;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-muted);
  padding: 2rem 0;
  font-size: 0.9375rem;
  color: var(--text-secondary);
}

.site-footer p {
  margin: 0 0 0.5rem;
}

.site-footer a {
  color: var(--accent);
}

/* ---------- vendor-exported policy body (privacy) ---------- */

/* The privacy policy is a Termly export. Its inline colours and font sizes are
   stripped at build time (see scripts/build_site.py) so it inherits the rules
   above instead of shipping its own hardcoded #595959-on-white palette, which
   is unreadable in dark mode. These rules tidy what the strip leaves behind. */

.vendor-doc h1 {
  font-size: 2rem;
}

.vendor-doc ul {
  padding-left: 1.5rem;
}

.vendor-doc div {
  margin-bottom: 0.35rem;
}

.vendor-doc br + br {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .site-nav,
  .skip-link {
    display: none;
  }

  body {
    background: #fff;
    color: #000;
  }
}
