:root {
  --bg: #f7f8f7;
  --surface: #ffffff;
  --text: #15201e;
  --muted: #5b6b68;
  --line: #e2e7e5;
  --brand: #0f766e;
  --brand-ink: #ffffff;
  --brand-soft: #e6f4f2;
  --ph-a: #dfece9;
  --ph-b: #c9dfdb;
  --warn-bg: #fff6db;
  --warn-text: #6b4e00;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 22, .06), 0 4px 14px rgba(16, 24, 22, .05);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1413;
    --surface: #161e1d;
    --text: #e7eeec;
    --muted: #93a3a0;
    --line: #26322f;
    --brand: #2dd4bf;
    --brand-ink: #062320;
    --brand-soft: #123330;
    --ph-a: #18302c;
    --ph-b: #1f3d38;
    --warn-bg: #3a2f0b;
    --warn-text: #f5dc8a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
a { color: var(--brand); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.7rem, 4vw, 2.6rem); letter-spacing: -.02em; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.05rem; }
.muted { color: var(--muted); }
.wrap { max-width: 1160px; margin: 0 auto; padding: 0 16px; }

/* header / footer */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.logo { color: var(--text); text-decoration: none; display: inline-flex; align-items: center; gap: .55rem; }
.logo-svg { width: 34px; height: 34px; flex: none; }
.logo-word { font-size: 1.2rem; font-weight: 600; letter-spacing: -.02em; }
.logo-word b { font-weight: 800; }
.logo-tld { color: var(--brand); font-weight: 700; }
.site-header nav { display: flex; gap: 1.1rem; }
.site-header nav a { text-decoration: none; font-weight: 500; }
.footer-top { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; }
.footer-top p { margin: 0; color: var(--muted); }
.agent-cta { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin: 1.2rem 0; padding: 16px 18px; border-radius: var(--radius); background: var(--brand-soft); }
.btn { display: inline-block; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 600; padding: 10px 16px; border-radius: 10px; overflow-wrap: anywhere; }
.hero-fig { margin: 1rem 0; }
.hero-fig .ph-img { margin: 0; }
.hero-fig figcaption { font-size: .8rem; color: var(--muted); margin-top: 6px; }
.site-footer { margin-top: 4rem; padding: 2rem 0; border-top: 1px solid var(--line); background: var(--surface); font-size: .9rem; }
.banner { background: var(--warn-bg); color: var(--warn-text); padding: 10px 16px; text-align: center; font-size: .92rem; }

/* hero */
.hero { padding: 3rem 0 2rem; }
.lede { font-size: 1.12rem; color: var(--muted); max-width: 46rem; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 1.5rem; }
.stats > div { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; color: var(--muted); font-size: .88rem; }
.stats span { display: block; color: var(--text); font-size: 1.3rem; font-weight: 700; }
@media (max-width: 720px) { .stats { grid-template-columns: repeat(2, 1fr); } }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; margin-top: 1rem; }
.toolbar h2 { margin: 0; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; }
.controls input, .controls select {
  font: inherit; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); color: var(--text); min-width: 0;
}
.controls input { width: 240px; max-width: 100%; }
@media (max-width: 560px) { .controls, .controls input, .controls select { width: 100%; } }

/* grid + cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; margin-top: 1rem; }
.card {
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; color: inherit; text-decoration: none; box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--brand); }
.card[hidden] { display: none; }
.card-body { padding: 14px 16px 16px; }
.card-body p { margin: 0 0 .7rem; font-size: .88rem; }
.mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 0; }
.mini dt { font-size: .75rem; color: var(--muted); }
.mini dd { margin: 0; font-weight: 600; font-size: .95rem; }
.empty { text-align: center; padding: 2rem; color: var(--muted); }

/* image placeholders (V2: real images replace these) */
.ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  background: linear-gradient(135deg, var(--ph-a), var(--ph-b)); color: var(--brand); aspect-ratio: 16 / 9; width: 100%;
}
.ph-mark { font-size: 2rem; font-weight: 800; letter-spacing: .06em; opacity: .8; }
.ph-note { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.ph.big .ph-mark { font-size: 3.4rem; }
.ph-img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: cover; height: auto; }
.ph.big, .ph-img.big { border-radius: var(--radius); margin: 1rem 0; }

/* project page */
.crumbs { font-size: .88rem; color: var(--muted); margin: 1.2rem 0; }
.crumbs a { text-decoration: none; }
.proj-head p { margin: 0; }
.tag { font-size: .8rem; vertical-align: middle; background: var(--brand-soft); color: var(--brand); padding: 3px 8px; border-radius: 999px; font-weight: 700; }
.stats-proj { margin-top: 0; }

.chart { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 1.5rem 0 0; }
.chart figcaption { font-weight: 600; margin-bottom: 6px; }
.chart svg { width: 100%; height: auto; display: block; }
.chart .gridline { stroke: var(--line); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--brand); stroke-width: 2.5; stroke-linejoin: round; }
.chart .dot { fill: var(--surface); stroke: var(--brand); stroke-width: 2; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table.tx { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.tx th, .tx td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tx th:first-child, .tx td:first-child, .tx th:last-child, .tx td:last-child { text-align: left; }
.tx th { position: sticky; top: 0; background: var(--surface); cursor: pointer; user-select: none; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tx th[aria-sort="ascending"]::after { content: " ▲"; color: var(--brand); }
.tx th[aria-sort="descending"]::after { content: " ▼"; color: var(--brand); }
.tx tbody tr:hover { background: var(--brand-soft); }
.tx tbody tr:last-child td { border-bottom: 0; }

.prose { max-width: 760px; }
.prose p { color: var(--muted); }

/* MOP & privatisation */
.milestones { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 1.5rem 0 0; }
.milestones h2 { margin: 0 0 .7rem; font-size: 1.1rem; }
.milestones p { margin: .7rem 0 0; font-size: .9rem; }
.ms-grid { max-width: 520px; }
.ms-pill { display: inline-block; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; vertical-align: middle; margin-left: .3rem; }
.ms-pre-mop { background: #fef3c7; color: #92400e; }
.ms-mop { background: #dcfce7; color: #166534; }
.ms-privatised { background: #e0e7ff; color: #3730a3; }
@media (prefers-color-scheme: dark) {
  .ms-pre-mop { background: #3a2f0b; color: #fcd34d; }
  .ms-mop { background: #12351f; color: #86efac; }
  .ms-privatised { background: #1e1b4b; color: #c7d2fe; }
}
.ms-table td.basis { white-space: normal; min-width: 260px; text-align: left; color: var(--muted); font-size: .82rem; }
.ms-table th:first-child, .ms-table td:first-child { text-align: left; }
.ms-table td:nth-child(2), .ms-table td:nth-child(3), .ms-table th:nth-child(2), .ms-table th:nth-child(3) { text-align: left; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips a { text-decoration: none; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; font-size: .9rem; }
.chips a:hover { border-color: var(--brand); }
.stats span { overflow-wrap: anywhere; }
.header-inner { gap: 12px; }
.site-header nav a { white-space: nowrap; }
@media (max-width: 480px) { .site-header nav { gap: .8rem; font-size: .92rem; } .site-header nav a:first-child { display: none; } .logo-word { font-size: 1.08rem; } .logo-svg { width: 30px; height: 30px; } }
