:root {
  --ink: #0e1a24;
  --ink-soft: #1c2d3a;
  --muted: #5d7384;
  --line: #d5e0e8;
  --bg: #eef3f7;
  --surface: #ffffff;
  --accent: #0a7ea4;
  --accent-dark: #06607e;
  --accent-soft: #d9f0f7;
  --warn-bg: #fff7e6;
  --warn-border: #e6c97a;
  --warn-ink: #4a3b12;
  --tier-a: #0b6e4f;
  --tier-b: #1a5f9e;
  --tier-c: #8a5a00;
  --tier-d: #5c4d7a;
  --tier-h: #6b3d2e;
  --badge-public: #0f766e;
  --badge-intl: #1d4ed8;
  --badge-dom: #b45309;
  --badge-app: #0a7ea4;
  --badge-other: #475569;
  --ok: #0f6a4f;
  --ok-bg: #e3f2ec;
  --bad: #6b7280;
  --bad-bg: #eef0f2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(14, 26, 36, 0.05), 0 12px 32px rgba(14, 26, 36, 0.07);
  --font: "DM Sans", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1100px 480px at 8% -12%, rgba(10, 126, 164, 0.16), transparent 55%),
    radial-gradient(900px 420px at 100% 0%, rgba(14, 26, 36, 0.07), transparent 50%),
    linear-gradient(180deg, #f5f8fb 0%, var(--bg) 40%, #e8eef3 100%);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap, .page {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding-bottom: 4rem;
}

/* -- Shared chrome -- */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  backdrop-filter: blur(14px);
  background: rgba(245, 248, 251, 0.88);
  border-bottom: 1px solid rgba(213, 224, 232, 0.95);
}
.site-nav-inner {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.25rem;
  padding: 0.85rem 0;
}
.brand {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}
.brand:hover { text-decoration: none; }
.brand strong {
  font-family: var(--display);
  font-size: 1.12rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.brand span {
  font-size: 0.76rem;
  color: var(--muted);
}
.site-nav nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}
.site-nav nav a {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.42rem 0.78rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
}
.site-nav nav a:hover {
  background: #fff;
  border-color: var(--line);
  text-decoration: none;
}
.site-nav nav a.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.page-hero {
  padding: 2.1rem 0 1.35rem;
}
.eyebrow {
  margin: 0 0 0.55rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.page-hero h1 {
  font-family: var(--display);
  font-size: clamp(1.85rem, 3.8vw, 2.65rem);
  line-height: 1.12;
  letter-spacing: -0.03em;
  margin: 0 0 0.7rem;
  max-width: 18ch;
}
.page-hero .lede {
  margin: 0;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.02rem;
}
.meta-row, .stats, .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.15rem;
}
.chip, .stat, .meta > span {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
  box-shadow: 0 1px 0 rgba(255,255,255,0.7);
}
.chip b, .meta strong { color: var(--accent-dark); font-weight: 700; }

.caveat, .callout {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin: 0 0 1.25rem;
  font-size: 0.92rem;
  color: var(--warn-ink);
}
.callout {
  background: var(--surface);
  border-color: var(--line);
  border-left: 4px solid var(--accent);
  color: var(--ink-soft);
  box-shadow: var(--shadow);
}
.callout ul { margin: 0.5rem 0 0; padding-left: 1.2rem; }

.toolbar {
  position: sticky;
  top: 58px;
  z-index: 40;
  background: rgba(238, 243, 247, 0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  margin: 0 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  box-shadow: var(--shadow);
}
.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.toolbar input[type="search"],
#search, .search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--ink);
  outline: none;
}
.toolbar input[type="search"]:focus,
#search:focus, .search input:focus {
  border-color: rgba(10, 126, 164, 0.55);
  box-shadow: 0 0 0 3px rgba(10, 126, 164, 0.15);
}
.search { position: relative; }
.search input { padding-left: 2.6rem; box-shadow: var(--shadow); }
.search::before {
  content: "";
  position: absolute;
  left: 0.95rem;
  top: 50%;
  width: 0.95rem;
  height: 0.95rem;
  transform: translateY(-50%);
  border: 2px solid var(--muted);
  border-radius: 50%;
  opacity: 0.7;
}
.search::after {
  content: "";
  position: absolute;
  left: 1.7rem;
  top: calc(50% + 0.35rem);
  width: 0.45rem;
  height: 2px;
  background: var(--muted);
  transform: rotate(45deg);
  opacity: 0.7;
}
.filters, .chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.filters button, .chip.btn, button.chip {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.filters button:hover, button.chip:hover {
  border-color: #b8c4d1;
  color: var(--ink);
}
.filters button.active, button.chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.stats-bar, .count, .count-live {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  color: var(--muted);
  padding: 0 2px;
}
.count-live { margin-left: auto; grid-column: auto; }

.section, section, .block { margin-bottom: 2rem; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.section-head h2, section h2, .block h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.28rem;
  letter-spacing: -0.02em;
}
.section-head p, .section-note {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  max-width: 70ch;
}
.section-note { margin: 0 0 16px; }

.grid, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
}
.card.hidden, tr.hidden { display: none !important; }
.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.card h3 {
  margin: 0;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}
.product, .tagline {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.company {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

.badge, .pill, .type {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.badge { color: #fff; }
.badge.a { background: var(--tier-a); }
.badge.b { background: var(--tier-b); }
.badge.c { background: var(--tier-c); }
.badge.d { background: var(--tier-d); }
.badge.h { background: var(--tier-h); }
.badge.public, .type.public { background: var(--badge-public); color: #fff; }
.badge.intl, .type.intl { background: var(--badge-intl); color: #fff; }
.badge.dom, .type.dom { background: var(--badge-dom); color: #fff; }
.badge.app, .type.app { background: var(--badge-app); color: #fff; }
.badge.other, .type.other { background: var(--badge-other); color: #fff; }
.pill {
  background: var(--accent-soft);
  color: var(--accent-dark);
}
.pill-independent { background: #eaf0ff; color: #27408b; }
.pill-province { background: #fff0e6; color: #9a4a12; }
.pill-incoming { background: #e8f4f8; color: #06607e; }
.pill-defunct { background: var(--bad-bg); color: var(--bad); }
.pill-mega { background: var(--accent-soft); color: var(--accent-dark); }
.badge-verified { background: var(--ok-bg); color: var(--ok); padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-partial { background: var(--warn-bg); color: var(--warn-ink); padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.badge-unknown { background: var(--bad-bg); color: var(--bad); padding: 2px 7px; border-radius: 999px; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }

dl { margin: 0; display: grid; gap: 8px; }
.row {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 8px;
  font-size: 13px;
}
.row dt, dt {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-top: 2px;
}
.row dd, dd { margin: 0; word-break: break-word; font-size: 14px; }
.links { display: flex; flex-wrap: wrap; gap: 6px 10px; }
.stack { display: grid; gap: 2px; }
.notes {
  margin: 0;
  font-size: 12.5px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: auto;
  box-shadow: var(--shadow);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  background: #f5f8fb;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
}
tr:last-child td { border-bottom: none; }
.evidence { color: var(--muted); font-size: 12px; }

.empty {
  display: none;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 28px;
  text-align: center;
  color: var(--muted);
  margin-bottom: 20px;
}
.empty.show { display: block; }

footer, .site-footer {
  margin-top: 2rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  display: grid;
  gap: 6px;
}
footer a, .site-footer a { font-weight: 600; }

/* Hide old per-page sticky headers once unified nav is injected */
header.site { display: none !important; }

/* Hub */
.hub {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 4rem;
}
.hub-hero h1 {
  font-family: var(--display);
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  margin: 0 0 0.85rem;
  max-width: 14ch;
}
.hub-hero p {
  margin: 0;
  max-width: 52ch;
  color: var(--muted);
  font-size: 1.08rem;
}
.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-top: 2.4rem;
}
.hub-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.4rem 1.35rem 1.25rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  min-height: 220px;
}
.hub-card:hover {
  transform: translateY(-3px);
  border-color: rgba(10, 126, 164, 0.35);
  box-shadow: 0 10px 36px rgba(14, 26, 36, 0.12);
  text-decoration: none;
}
.hub-card .kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-dark);
}
.hub-card h2 {
  font-family: var(--display);
  font-size: 1.45rem;
  margin: 0;
  letter-spacing: -0.02em;
}
.hub-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  flex: 1;
}
.hub-card .cta {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-dark);
}

@media (max-width: 900px) {
  .hub-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .toolbar { grid-template-columns: 1fr; top: 96px; }
  .row { grid-template-columns: 1fr; gap: 2px; }
  .page-hero h1 { max-width: none; }
  .site-nav nav { width: 100%; }
}

@media print {
  body { background: #fff; }
  .site-nav, .toolbar, .filters { display: none !important; }
  .card, .table-wrap { box-shadow: none; break-inside: avoid; }
  a { color: inherit; text-decoration: none; }
}
