:root {
  --bg: #fdfdfc;
  --fg: #1d1d1b;
  --muted: #6b6b66;
  --accent: #5b4636;
  --rule: #e6e4df;
  --code-bg: #f3f1ec;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --fg: #e8e6df;
    --muted: #908b7f;
    --accent: #cdb18b;
    --rule: #2a2823;
    --code-bg: #1d1c18;
  }
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: ui-serif, Georgia, Cambria, "Times New Roman", Times, serif;
  font-size: 18px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

main {
  max-width: 38rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

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

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

h1, h2, h3, h4 {
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.25;
  margin: 2.25rem 0 0.75rem;
}

h1 { font-size: 1.85rem; margin-top: 0; }
h2 { font-size: 1.25rem; border-bottom: 1px solid var(--rule); padding-bottom: 0.35rem; }
h3 { font-size: 1.05rem; }
h3 .ref { font-weight: 400; color: var(--muted); font-size: 0.82rem; }

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

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

hr {
  border: 0;
  border-top: 1px solid var(--rule);
  margin: 2rem 0;
}

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}

code {
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--code-bg);
  padding: 0.85rem 1rem;
  border-radius: 4px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code { background: transparent; padding: 0; }

blockquote {
  border-left: 2px solid var(--rule);
  margin: 1rem 0;
  padding: 0.25rem 0 0.25rem 1rem;
  color: var(--muted);
}

img { max-width: 100%; height: auto; }

/* Site header */
.site-header { margin-bottom: 2.5rem; }
.tagline { color: var(--muted); margin-top: -0.25rem; }

/* Post lists */
.post-list { list-style: none; padding: 0; }
.post-list li { margin-bottom: 1.5rem; }
.post-list a,
.post-list .title {
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
}
.post-list time {
  display: inline-block;
  margin-left: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.post-list .role {
  display: inline-block;
  margin-left: 0.5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-list p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.see-all { font-size: 0.9rem; }
.see-all a { font-family: ui-sans-serif, system-ui, sans-serif; }

/* Flag grid — compact country cards (politics on the home page) */
.flag-grid {
  list-style: none;
  padding: 0;
  margin: 0 0 0.75rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 0.6rem;
}
.flag-grid li { margin: 0; }
.flag-grid a {
  display: block;
  height: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--rule);
  border-radius: 6px;
  text-decoration: none;
  color: var(--fg);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.flag-grid a:hover {
  border-color: var(--accent);
  background: var(--code-bg);
}
.flag-grid .name {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.2;
}
.flag-grid .flag { font-size: 1.4rem; line-height: 1; flex: none; }
.flag-grid .blurb {
  margin: 0.3rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.4;
}

/* Table of contents (long-form pages) */
.toc {
  margin: 1.75rem 0 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 4px;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}
.toc h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  border: 0;
  margin: 0 0 0.6rem;
  padding: 0;
}
.toc ol { margin: 0; padding-left: 1.4rem; }
.toc li { margin: 0.25rem 0; }

/* Article */
article header { margin-bottom: 2rem; }
article header time {
  color: var(--muted);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.site-footer a { color: var(--muted); }

/* Back link */
.back {
  display: inline-block;
  margin-bottom: 1.5rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Spec tables (hardware) */
.table-wrap { overflow-x: auto; margin: 0 0 1.5rem; -webkit-overflow-scrolling: touch; }
table.specs {
  border-collapse: collapse;
  width: 100%;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.82rem;
  line-height: 1.4;
}
table.specs th, table.specs td {
  text-align: left;
  padding: 0.5rem 0.7rem 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
table.specs th { font-weight: 600; color: var(--fg); white-space: nowrap; }
table.specs td:first-child { font-weight: 600; white-space: nowrap; }
table.specs td .chip {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
}
table.specs td:nth-child(4), table.specs td:nth-child(5) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
table.specs td .spec { color: var(--muted); white-space: normal; min-width: 12rem; display: block; }
.snapshot { color: var(--muted); font-size: 0.9rem; }

/* AI-assisted data disclaimer — shown at the foot of pages whose charts or
   tables were compiled with AI help, so a hallucinated figure can't be read
   as a vouched-for fact. */
.ai-disclaimer {
  margin: 2.5rem 0 0;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.5;
  font-family: ui-sans-serif, system-ui, sans-serif;
}
.ai-disclaimer + .site-footer { margin-top: 1.5rem; }

/* Gently highlight a verse row (.v) when it is linked directly via a #chNvK
   anchor. scroll-margin-top keeps it clear of the sticky column header. */
.v { scroll-margin-top: 4rem; }
.v:target {
  background: var(--code-bg);
  box-shadow: 0 0 0 0.5rem var(--code-bg);
  border-radius: 2px;
  animation: verse-flash 1.8s ease-out;
}
@keyframes verse-flash {
  from { background: var(--rule); box-shadow: 0 0 0 0.5rem var(--rule); }
  to   { background: var(--code-bg); box-shadow: 0 0 0 0.5rem var(--code-bg); }
}
@media (prefers-reduced-motion: reduce) {
  .v:target { animation: none; }
}
