/* Chosen Ones. One stylesheet, no external fonts or scripts (the CSP allows
   only this site's own styles). Light and dark follow the system setting. */

:root {
  --bg: #f6f1e7;
  --surface: #fffcf6;
  --surface-2: #f0e9db;
  --ink: #1e1a14;
  --muted: #6e6558;
  --line: #e3dacb;
  --line-strong: #cfc3ad;
  --accent: #94461a;
  --gold: #c48f1c;
  --gold-ink: #6b4c06;
  --gold-soft: #f7e9c6;
  --gold-line: #e3c57d;
  --glow: rgba(214, 166, 52, 0.22);
  --no-soft: #ece5d8;
  --no-ink: #5d564b;
  --ok-soft: #e4efdc;
  --ok-ink: #2f5a26;
  --err-soft: #f8e1d9;
  --err-ink: #9b2c17;
  --shadow: 0 1px 2px rgba(60, 40, 10, 0.05), 0 8px 24px -16px rgba(60, 40, 10, 0.25);

  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  --radius: 14px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14120f;
    --surface: #1d1a16;
    --surface-2: #26221c;
    --ink: #f1ebdf;
    --muted: #a59c8d;
    --line: #322c24;
    --line-strong: #4a4135;
    --accent: #eaa56e;
    --gold: #e2b64a;
    --gold-ink: #f3d58a;
    --gold-soft: #3a2e12;
    --gold-line: #6b5420;
    --glow: rgba(226, 182, 74, 0.13);
    --no-soft: #2a261f;
    --no-ink: #b8ae9e;
    --ok-soft: #1f2d1c;
    --ok-ink: #b9dcae;
    --err-soft: #3b1f18;
    --err-ink: #ffb7a3;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -18px rgba(0, 0, 0, 0.8);
  }
}

/* ---- base ---- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body.home {
  background-image: radial-gradient(ellipse 80% 420px at 50% -60px, var(--glow), transparent 70%);
  background-repeat: no-repeat;
}

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 28px; padding-bottom: 72px; }
body.admin .wrap { max-width: 980px; }

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

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(1.9rem, 6vw, 2.5rem); margin: 0 0 8px; }
h2 { font-size: 1.3rem; margin: 0 0 12px; }
p { margin: 0 0 12px; }
code {
  font: 0.85em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2); padding: 1px 6px; border-radius: 5px;
}
small, .muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

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

.top { border-bottom: 1px solid var(--line); }
body.home .top { border-bottom-color: transparent; }
.top-inner { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; min-height: 60px; padding-top: 10px; padding-bottom: 10px; }
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--serif); font-size: 1.2rem; font-weight: 650; letter-spacing: -0.01em;
  color: var(--ink); text-decoration: none;
}
.star { fill: var(--gold); flex: none; }
.brand .star { width: 22px; height: 22px; }
.top nav { display: flex; gap: 6px 18px; align-items: center; flex-wrap: wrap; font-size: 0.95rem; }
.top nav a { color: var(--ink); text-decoration: none; }
.top nav a:hover { color: var(--accent); }

/* ---- controls ---- */

input, textarea, button, select { font: inherit; color: inherit; }
/* :where() keeps this rule easy to override (e.g. the search box padding). */
:where(input:not([type="radio"]):not([type="checkbox"]):not([type="file"]), textarea) {
  width: 100%; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
}
textarea { line-height: 1.45; resize: vertical; }
input[type="file"] { width: 100%; padding: 10px 0; }
input:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--gold); outline-offset: 2px;
}
input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 20px; border: 1px solid transparent; border-radius: 999px;
  background: var(--ink); color: var(--bg); cursor: pointer;
  font-weight: 600; text-decoration: none; white-space: nowrap;
}
button:hover, .button:hover { opacity: 0.88; }
.button.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.link { background: none; border: 0; color: var(--ink); padding: 0; font-weight: 400; }
button.link:hover { color: var(--accent); }
button.delete { background: var(--err-soft); color: var(--err-ink); }

/* ---- search ---- */

.search { position: relative; display: flex; gap: 8px; align-items: center; }
.search-icon {
  position: absolute; left: 14px; top: 50%; width: 20px; height: 20px; margin-top: -10px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search input {
  padding-left: 44px; font-size: 1.05rem; border-radius: 999px; min-height: 48px;
  box-shadow: var(--shadow);
}
.search button { min-height: 48px; }
.search.compact input { box-shadow: none; min-height: 44px; font-size: 1rem; }
.search.compact button { min-height: 44px; }
.page-search { margin-bottom: 28px; }

/* ---- home ---- */

.hero { text-align: center; padding: clamp(24px, 9vh, 88px) 0 40px; }
.hero h1 { font-size: clamp(2.7rem, 11vw, 4.5rem); letter-spacing: -0.025em; margin-bottom: 10px; }
.tagline { color: var(--muted); font-size: 1.1rem; max-width: 30em; margin: 0 auto 28px; }
.hero .search { max-width: 560px; margin: 0 auto; }
.hint { color: var(--muted); margin-top: 14px; }

.section-title {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted);
  margin: 36px 0 12px;
}
.chosen-list .section-title { text-align: center; }

.tiles { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.tile {
  display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 2px; align-items: start;
  height: 100%; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--gold-line); border-radius: var(--radius);
  color: var(--ink); text-decoration: none; box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
}
.tile:hover { transform: translateY(-2px); border-color: var(--gold); }
.tile .star { width: 18px; height: 18px; margin-top: 3px; grid-row: span 2; }
.tile-name { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; line-height: 1.3; }
.tile-desc { color: var(--muted); font-size: 0.86rem; line-height: 1.4; }

/* ---- name and person pages ---- */

.page-head { margin-bottom: 20px; }
.lede { font-size: 1.08rem; color: var(--muted); }
.page-head .lede { margin-bottom: 4px; }
.aka { color: var(--muted); font-size: 0.92rem; font-style: italic; }

.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.card.is-yes { border-color: var(--gold-line); }
.card-list li.best .card { box-shadow: var(--shadow); border-width: 1px 1px 1px 4px; border-left-color: var(--ink); padding: 20px 20px 18px; }
.card-list li.best .card.is-yes { border-left-color: var(--gold); }
.card-list li.best .hit h3 { font-size: 1.45rem; }

.hit-head { display: flex; align-items: baseline; justify-content: space-between; gap: 6px 12px; flex-wrap: wrap; }
.hit h3 { margin: 0; font-size: 1.2rem; }
.hit h3 a { color: var(--ink); text-decoration: none; }
.hit h3 a:hover { color: var(--accent); text-decoration: underline; }
.hit p { margin: 4px 0 0; }
.hit .aka { font-size: 0.88rem; }
.links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 0.9rem; margin-top: 8px !important; }
.links a { text-decoration: none; }
.links a:hover { text-decoration: underline; }

/* the chosen_one status, as a pill */
.chosen {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 10px; border-radius: 999px; border: 1px solid transparent;
  font: 600 0.75rem/1.6 var(--sans); letter-spacing: 0.02em; white-space: nowrap;
}
.chosen.is-yes { background: var(--gold-soft); color: var(--gold-ink); border-color: var(--gold-line); }
.chosen.is-yes::before { content: "★"; color: var(--gold); }
.chosen.is-no { background: var(--no-soft); color: var(--no-ink); }
.chosen.is-unknown { color: var(--muted); border: 1px dashed var(--line-strong); }

/* the chosen_one status, as a panel on the person page */
.verdict {
  display: flex; align-items: center; gap: 16px;
  margin: 8px 0 28px; padding: 16px 20px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
}
.verdict .star { width: 42px; height: 42px; fill: none; stroke: var(--line-strong); stroke-width: 1.4; stroke-linejoin: round; }
.verdict p { margin: 0; }
.verdict-label { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.verdict-value { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.2; }
.verdict.is-yes { background: var(--gold-soft); border-color: var(--gold-line); box-shadow: var(--shadow); }
.verdict.is-yes .star { fill: var(--gold); stroke: var(--gold); }
.verdict.is-yes .verdict-value { color: var(--gold-ink); }
.verdict.is-unknown { border-style: dashed; }
.verdict.is-unknown .verdict-value, .verdict.is-no .verdict-value { color: var(--muted); }

.bio { margin-bottom: 28px; }
.bio .section-title { margin-top: 0; }
.bio p {
  font-family: var(--serif); font-size: 1.14rem; line-height: 1.7;
  max-width: 66ch; margin: 0 0 14px; white-space: pre-line;
}

.link-list { list-style: none; margin: 0 0 20px; padding: 0; border-top: 1px solid var(--line); }
.link-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.link-list a { font-weight: 600; text-decoration: none; }
.link-list a:hover { text-decoration: underline; }
.url { color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.id, .meta { color: var(--muted); font-size: 0.85rem; }
.empty { color: var(--muted); }

/* ---- browsing ---- */

.browse-more { text-align: center; margin-top: 32px; color: var(--muted); }
.crumbs { margin: 0 0 4px; font-size: 0.9rem; }
.list-tile { grid-template-columns: 1fr; border-color: var(--line); }
.list-tile:hover { border-color: var(--accent); }

.on-lists { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; color: var(--muted); font-size: 0.92rem; margin: 0 0 20px; }
.list-chip {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong);
  color: var(--ink); text-decoration: none; font-weight: 550;
}
.list-chip:hover { border-color: var(--accent); color: var(--accent); }

.az { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 24px; }
.az a {
  min-width: 36px; padding: 6px 8px; text-align: center; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 600;
}
.az a:hover { border-color: var(--accent); }
.letter { scroll-margin-top: 16px; }
.letter h2 { font-size: 1.6rem; margin: 24px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.directory { list-style: none; margin: 0; padding: 0; columns: 2 280px; column-gap: 32px; }
.directory li { break-inside: avoid; padding: 6px 0; line-height: 1.35; }
.directory a { font-weight: 600; text-decoration: none; color: var(--ink); }
.directory a:hover { color: var(--accent); text-decoration: underline; }
.directory .chosen { margin-left: 4px; vertical-align: 1px; }
.dir-desc { display: block; color: var(--muted); font-size: 0.85rem; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 32px; color: var(--muted); }

/* ---- admin ---- */

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px 16px; flex-wrap: wrap; }
.row.start { justify-content: flex-start; }
.row h1 { margin: 0; }
body.admin main > .row:first-child { margin-bottom: 18px; }
body.admin .search { margin-bottom: 20px; }
body.admin h1 { font-size: 1.9rem; margin-bottom: 14px; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 24px;
}
.narrow { max-width: 400px; margin: 24px auto; }
.stack { display: grid; gap: 18px; }
.stack label { display: grid; gap: 6px; font-weight: 600; }
.stack small { font-weight: 400; }
.inline { display: inline; margin: 0; }

fieldset.choice { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
fieldset.choice legend { font-weight: 600; padding: 0; margin-bottom: 6px; width: 100%; }
fieldset.choice label {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 500;
  padding: 8px 14px; border: 1px solid var(--line-strong); border-radius: 999px; cursor: pointer;
}
fieldset.choice label:has(input:checked) { border-color: var(--ink); background: var(--surface-2); }

.notice { background: var(--ok-soft); color: var(--ok-ink); padding: 11px 15px; border-radius: 10px; }
.error { background: var(--err-soft); color: var(--err-ink); padding: 11px 15px; border-radius: 10px; }
.bad { color: var(--err-ink); }
.danger { margin-top: 8px; }

.table-wrap { overflow-x: auto; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; font-weight: 650; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); white-space: nowrap; }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
table.plan .chosen { margin-top: 4px; }
table.plan tr.is-error td { background: var(--err-soft); }
table.plan tr.is-error td:first-child { border-radius: 8px 0 0 8px; }
table.plan tr.is-error td:last-child { border-radius: 0 8px 8px 0; }

button.small, .button.small { padding: 6px 14px; font-size: 0.88rem; }
button.small.secondary { background: transparent; color: var(--ink); border-color: var(--line-strong); }
button.small.link { padding: 6px 4px; }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; margin: 0; }

.member-list { list-style: none; margin: 0; padding: 0; }
.member-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.member-list li:first-child { border-top: 0; }
.member-list small { display: block; }

.tabs { display: flex; gap: 8px; margin: 0 0 16px; }
.tabs a { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-strong); text-decoration: none; color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.term-list { list-style: none; margin: 0; padding: 0; }
.term-list .panel { margin-bottom: 12px; padding: 16px 18px; }
.term-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 16px; }
.term-head h2 { margin: 0; font-size: 1.3rem; }
.counts { margin: 0; color: var(--muted); font-size: 0.88rem; }
.counts strong { color: var(--ink); }
.term-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.term-actions form { max-width: 100%; }
.term-actions button { white-space: normal; text-align: left; line-height: 1.3; border-radius: 12px; }
.id-alias { display: inline-flex; gap: 6px; align-items: center; }
.id-alias input { width: 7.5em !important; padding: 6px 10px !important; font-size: 0.88rem; }

.help { color: var(--ink); }
.help dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0 0 16px; }
.help dt { margin: 0; }
.help dd { margin: 0; color: var(--muted); }
.help .button { margin-right: 8px; }

@media (max-width: 600px) {
  .hide-narrow { display: none; }
  .help dl { grid-template-columns: 1fr; gap: 2px; }
  .help dd { margin-bottom: 8px; }
  .search button { padding: 11px 16px; }
  .panel { padding: 16px; }
  table.plan th { white-space: normal; }
  table.plan th, table.plan td { padding: 10px 5px; }
}
