/* Fedabase — slate navy + paper. Light/dark only; theme from localStorage. */
:root,
html[data-theme="light"] {
  --navy: #1b3a4b;
  --navy-deep: #0e1c24;
  --navy-mid: #2a5a70;
  --accent: #2a7f7a;
  --accent-hover: #3a9892;
  --accent-soft: #e6f3f2;
  --cream: #f4f1ea;
  --card: #ffffff;
  --ink: #1a1d1f;
  --ink-soft: #4a5358;
  --muted: #6e787e;
  --line: #ddd6c8;
  --ad-bg: #ece7de;
  --header-fg: #e8eef1;
  --footer-fg: #e8eef1;
  --footer-mute: #b4c2c8;
  --mark: #d8efe8;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(27, 58, 75, 0.08);
  --max: 1080px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", "Iowan Old Style", Iowan, Georgia, "Times New Roman", serif;
  color-scheme: light;
}
html[data-theme="dark"] {
  --navy: #2a5a70;
  --navy-deep: #0a1216;
  --navy-mid: #9ec4d4;
  --accent: #5dbeb8;
  --accent-hover: #7ad4ce;
  --accent-soft: #163330;
  --cream: #101418;
  --card: #1a2026;
  --ink: #eef2f4;
  --ink-soft: #c3ced4;
  --muted: #8a969c;
  --line: #2c3840;
  --ad-bg: #161b1f;
  --header-fg: #e8eef1;
  --footer-fg: #e8eef1;
  --footer-mute: #b4c2c8;
  --mark: #d8efe8;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  line-height: 1.65;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy-mid); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 12px; top: 12px; background: var(--card); color: var(--ink); padding: 8px 12px; z-index: 80; }

.site-header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 40; box-shadow: 0 2px 12px rgba(14, 28, 36, 0.35); }
.header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; color: #fff; text-decoration: none; order: 1; }
.logo span { color: var(--mark); background: rgba(0,0,0,0.22); padding: 2px 8px 3px; border-radius: 8px; }
.theme-toggle { order: 2; margin-left: auto; }
.nav { display: flex; flex-wrap: wrap; gap: 10px 14px; order: 3; flex: 1 1 100%; }
.nav a { color: var(--header-fg); text-decoration: none; font-weight: 500; border-bottom: 2px solid transparent; padding: 4px 0; }
.nav a[aria-current="page"] { border-bottom-color: var(--accent); }
.nav a[aria-current="page"], .nav a:hover { color: #fff; }
.search-wrap { flex: 1 1 100%; min-width: 0; max-width: none; order: 4; }
.search-wrap input {
  border: 0; border-radius: 999px; padding: 8px 14px; min-width: 0;
  font: inherit; background: var(--card); color: var(--ink); width: 100%;
}
.theme-toggle {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0;
  border: 0; border-radius: 999px;
  background: rgba(255,255,255,0.12); color: var(--mark);
  cursor: pointer;
}
.theme-toggle:hover, .theme-toggle:focus-visible { background: rgba(255,255,255,0.22); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.theme-toggle svg { display: block; }
.theme-toggle .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-moon { display: none; }
html[data-theme="dark"] .theme-toggle .theme-icon-sun { display: block; }

@media (min-width: 860px) {
  .header-inner { flex-wrap: nowrap; padding: 12px 20px; }
  .logo { order: 1; }
  .nav { order: 2; flex: 0 0 auto; }
  .search-wrap { order: 3; margin-left: auto; flex: 1 1 160px; min-width: 160px; max-width: 280px; }
  .theme-toggle { order: 4; margin-left: 0; }
}

.page { flex: 1; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 24px 16px 56px; }
@media (min-width: 640px) {
  .wrap { padding: 28px 20px 64px; }
}

.mast, .hero { margin-bottom: 8px; }
.mast h1, .hero h1, .article-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5vw, 2.6rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
  font-weight: 700;
}
.kicker { color: var(--accent); font-weight: 700; letter-spacing: 0.06em; font-size: 0.78rem; text-transform: uppercase; margin: 0 0 8px; }
.lede { color: var(--ink-soft); margin: 0 0 12px; max-width: 42rem; font-size: 1.05rem; }
.today-line { color: var(--muted); font-size: 0.92rem; }
.ad-slot { background: var(--ad-bg); color: var(--muted); text-align: center; padding: 28px; border-radius: var(--radius-sm); margin: 24px 0; border: 1px dashed var(--line); font-size: 0.85rem; letter-spacing: 0.04em; }
.section { margin-top: 36px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.section-head h2 { margin: 0; font-size: 1.25rem; font-family: var(--serif); }
.section-note { color: var(--muted); margin: 0; font-size: 0.9rem; }
.empty { color: var(--ink-soft); background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); padding: 20px 22px; }
.rich-empty ul { margin: 0.6em 0 0; padding-left: 1.2em; }
.rich-empty li { margin: 0.25em 0; }
.facts { display: grid; gap: 10px; margin: 20px 0; }
.facts div { display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr; gap: 8px; }
.facts dt { color: var(--muted); font-weight: 700; }
.facts dd { margin: 0; }
.crumb { font-size: 0.92rem; }
.prose, .article-body, .place-brief { max-width: 42rem; }
.prose h2, .article-body h2, .place-brief h2 { margin-top: 1.6em; font-family: var(--serif); }
.prose code, .article-body code, .cite code, .empty code, .footer-inner code { font-size: 0.9em; background: var(--accent-soft); padding: 1px 6px; border-radius: 6px; }
.place-brief { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 20px 0; }
.place-brief h2 { margin-top: 0; }
.cite { color: var(--muted); font-size: 0.9rem; max-width: 46rem; }

.brief-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.brief-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.brief-card h3 { font-family: var(--serif); margin: 0 0 8px; font-size: 1.25rem; }
.brief-card h3 a { color: inherit; text-decoration: none; }
.brief-card h3 a:hover { color: var(--accent); }
.brief-card p { margin: 0 0 8px; }
.brief-card .meta { color: var(--muted); font-size: 0.88rem; margin: 0; }

.rank-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
@media (min-width: 720px) {
  .rank-grid { grid-template-columns: 1fr 1fr; }
}
.rank-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.rank-card h3 { margin: 0 0 6px; font-family: var(--serif); }
.rank-card ol { margin: 12px 0; padding-left: 1.3em; }
.rank-card li { margin: 0.4em 0; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.rank-card .num { font-variant-numeric: tabular-nums; color: var(--ink-soft); }
.rank-switch { display: flex; flex-wrap: wrap; gap: 10px 16px; margin: 16px 0 0; }
.rank-switch a[aria-current="page"] { font-weight: 700; }

.search-page-form { margin: 20px 0 8px; max-width: 40rem; }
.search-page-form label { display: block; font-weight: 700; margin-bottom: 8px; }
.search-page-row { display: flex; flex-wrap: wrap; gap: 8px; }
.search-page-row input {
  flex: 1 1 200px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
  background: var(--card);
  color: var(--ink);
  min-width: 0;
}
.search-page-row button {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font: inherit;
  font-weight: 700;
  background: var(--navy);
  color: #fff;
  cursor: pointer;
}
.search-page-row button:hover { background: var(--accent); }

.article { max-width: 42rem; }
.article-head { margin-bottom: 8px; }
.article-body { font-family: var(--serif); font-size: 1.08rem; }
.article-body p { margin: 0 0 1em; }
.article-body ol { padding-left: 1.2em; }
.article-meta { color: var(--muted); font-size: 0.9rem; font-family: var(--sans); }
.article-related { margin-top: 1.5em; }

.site-footer { background: var(--navy-deep); color: var(--footer-fg); padding: 28px 20px; }
.footer-inner { max-width: var(--max); margin: 0 auto; }
.footer-brand { font-weight: 800; margin: 0 0 8px; }
.site-footer a { color: var(--accent); }
.footer-legal { color: var(--footer-mute); font-size: 0.85rem; }
.empty-search { display: none; padding: 24px; text-align: center; color: var(--muted); background: var(--card); border-radius: var(--radius); border: 1px dashed var(--line); }
.empty-search.is-visible { display: block; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.data-table { width: 100%; min-width: 28rem; border-collapse: collapse; font-size: 0.96rem; }
.data-table th, .data-table td { padding: 10px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.data-table th { font-size: 0.82rem; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tr:hover td { background: var(--accent-soft); }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.data-table a { font-weight: 700; text-decoration: none; color: inherit; }
.data-table a:hover { color: var(--accent); }
.btn-ghost {
  color: var(--navy); text-decoration: none; font-weight: 700;
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; background: var(--card);
  display: inline-block;
}
html[data-theme="dark"] .btn-ghost { color: var(--mark); }
.btn-ghost:hover { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (max-width: 640px) {
  .facts div { grid-template-columns: 1fr; }
}
.data-table tr.is-hidden { display: none; }
