/* Styling for the generated word and index pages (scripts/build-seo.mjs).
   These live outside the SPA bundle, so the tokens are duplicated here — kept
   in sync with src/styles.css, including the per-theme tone ramps, so tone
   colouring means the same thing everywhere. */

:root {
  --bg: #ffffff;
  --fg: #1a1a1a;
  --muted: #6b7280;
  --card-bg: #ffffff;
  --border: #e5e7eb;
  --link: #c1272d;
  --tone-1: #c62828;
  --tone-2: #2e7d32;
  --tone-3: #1565c0;
  --tone-4: #7b1fa2;
  --tone-5: #5f6368;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --fg: #f3f4f6;
    --muted: #9ca3af;
    --card-bg: #171a21;
    --border: #262b36;
    --link: #ff6b6b;
    --tone-1: #ff8a80;
    --tone-2: #81c784;
    --tone-3: #7cb7f0;
    --tone-4: #ce93d8;
    --tone-5: #bdc1c6;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 1.25rem 1rem 3rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans SC", sans-serif;
  line-height: 1.6;
  background: var(--bg);
  color: var(--fg);
}

main,
.masthead,
footer {
  max-width: 44rem;
  margin-inline: auto;
}

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

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

.masthead {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.wordmark {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
}

.crumbs {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 1.25rem 0 0;
}

h1 {
  font-size: 3.5rem;
  line-height: 1.1;
  margin: 0.5rem 0 0.25rem;
}

.pinyin {
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.meta {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 1rem;
}

h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 2rem 0 0.5rem;
}

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

.senses li + li {
  color: var(--muted);
  font-size: 0.95rem;
}

audio {
  width: 100%;
  max-width: 20rem;
  margin: 0.5rem 0;
}

.example {
  border-left: 3px solid var(--border);
  padding-left: 0.9rem;
}

.example-hanzi {
  font-size: 1.5rem;
  margin: 0;
}

.example-pinyin {
  color: var(--muted);
  margin: 0.15rem 0;
}

.example-english {
  margin: 0.15rem 0;
}

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

.wordlinks li {
  border-bottom: 1px solid var(--border);
}

.wordlinks a {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.5rem 0.25rem;
  color: inherit;
  text-decoration: none;
}

.wordlinks a:hover {
  background: color-mix(in srgb, var(--link) 8%, transparent);
}

.wordlinks a span {
  font-size: 1.35rem;
  min-width: 3.5rem;
}

.wordlinks a em {
  font-style: normal;
  font-weight: 600;
  color: var(--link);
}

/* Long level lists read better in columns on wide screens. */
.columns {
  columns: 2 18rem;
  column-gap: 2rem;
}

.columns li {
  break-inside: avoid;
}

.levels {
  list-style: none;
  padding: 0;
}

.levels a {
  display: block;
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card-bg);
  color: inherit;
  text-decoration: none;
}

.cta {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-weight: 600;
}

footer {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.85rem;
}

footer a {
  color: var(--muted);
}
