/* hamrovote.info - shared styles.
   Neutral, cross-party identity: charcoal/slate on warm off-white, hairline rules.
   No party hues as fields (no saturated green, blue or red), no flag crimson.
   Colour appears only inside charts, where it encodes magnitude. */
:root {
  --bg: #f6f4ef;
  --card: #fffdf9;
  --ink: #26292d;
  --muted: #5d6166;
  --faint: #898781;
  --rule: #d8d3c8;
  --accent: #3f464d;
  --accent-ink: #ffffff;
  --soft: #ebe7df;
  --radius: 10px;
  /* ordinal ramp for age bands (validated light vs #faf8f4) */
  --a1: #6da7ec; --a2: #3987e5; --a3: #256abf; --a4: #184f95; --a5: #0d366b;
  --bar: #4b535b;
  font-size: 17px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1d1f22; --card: #24272b; --ink: #ecebe7; --muted: #a9aaa6; --faint: #898781;
    --rule: #3a3e43; --accent: #d9d6cf; --accent-ink: #1d1f22; --soft: #2e3236;
    /* validated dark vs #1c1c1a */
    --a1: #b7d3f6; --a2: #86b6ef; --a3: #5598e7; --a4: #2a78d6; --a5: #1c5cab;
    --bar: #b9bab4;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); line-height: 1.55;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Devanagari", sans-serif;
}
:lang(ne) { font-family: "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: inherit; text-underline-offset: 3px; }
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 64px; }

/* header and nav */
.top { position: sticky; top: 0; z-index: 10; background: var(--bg); border-bottom: 1px solid var(--rule); }
.top-inner { max-width: 860px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.brand { font-weight: 700; letter-spacing: .01em; text-decoration: none; margin-right: auto; }
.brand small { font-weight: 400; color: var(--muted); margin-left: 6px; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; font-size: .92rem; }
.nav a { text-decoration: none; padding: 6px 10px; border-radius: 999px; color: var(--muted); }
.nav a:hover { color: var(--ink); background: var(--soft); }
.nav a[aria-current="page"] { color: var(--ink); font-weight: 600; background: var(--soft); }

/* type */
h1 { font-size: 1.7rem; line-height: 1.25; margin: 20px 0 8px; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 32px 0 8px; }
h3 { font-size: 1.05rem; margin: 20px 0 6px; }
.lead { font-size: 1.08rem; color: var(--ink); }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.status { border: 1px solid var(--rule); background: var(--card); border-radius: var(--radius); padding: 10px 14px; font-size: .92rem; margin: 12px 0; }
.toc { border-left: 2px solid var(--rule); padding: 2px 0 2px 14px; margin: 16px 0 8px; font-size: .95rem; }
.toc ol { margin: 4px 0; padding-left: 18px; }

/* cards (home) */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 20px 0; }
.card { display: block; text-decoration: none; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 16px; }
.card:hover { border-color: var(--muted); }
.card h3 { margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: .94rem; }
.card .tag { display: inline-block; font-size: .75rem; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border: 1px solid var(--rule); border-radius: 999px; padding: 1px 8px; margin-bottom: 8px; }
.card.primary { border-color: var(--ink); }
.card.soon { opacity: .7; pointer-events: none; }

/* figures and tables: table captions above, figure captions below */
figure { margin: 20px 0; }
figcaption, .caption { font-size: .92rem; margin: 8px 0; }
figcaption b, .caption b { font-weight: 700; }
.note { font-size: .85rem; color: var(--muted); margin: 4px 0 20px; }
.chart { background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); padding: 12px; position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .85rem; color: var(--muted); margin: 0 0 8px; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tip { position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: .82rem; padding: 6px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; transition: opacity .1s; z-index: 4; }
.view-toggle { font: inherit; font-size: .82rem; background: none; border: 1px solid var(--rule); border-radius: 999px; padding: 2px 10px; color: var(--muted); cursor: pointer; float: right; }

.tbl-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--rule); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: .88rem; font-variant-numeric: tabular-nums; }
th, td { padding: 7px 10px; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; }
thead th { font-weight: 600; color: var(--muted); vertical-align: bottom; }
thead th button { all: unset; cursor: pointer; }
thead th button:focus-visible { outline: 2px solid var(--ink); }
tbody tr:last-child td { border-bottom: 0; }
tr.ref td { font-weight: 600; background: var(--soft); }
.mini { display: inline-block; height: 8px; background: var(--bar); border-radius: 0 4px 4px 0; vertical-align: middle; margin-right: 6px; }

select { font: inherit; padding: 6px 10px; border: 1px solid var(--rule); border-radius: 8px; background: var(--card); color: var(--ink); min-height: 40px; }
.btn { display: inline-block; background: var(--accent); color: var(--accent-ink); text-decoration: none; padding: 10px 18px; border-radius: 999px; font-weight: 600; }

footer { border-top: 1px solid var(--rule); margin-top: 40px; padding-top: 12px; font-size: .85rem; color: var(--muted); }
@media (max-width: 520px) { h1 { font-size: 1.45rem; } .brand small { display: none; } }
