/* ═══════════════════════════════════════════════════════════════
   DELIMITATION BILL EXPLAINER — DataChutney
   Multi-page, full-width layout
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f0e8;
  --bg-alt: #ece5d8;
  --bg-card: #ffffff;
  --text: #1a1a2e;
  --text-2: #4a4a5a;
  --text-3: #6b6b7b;
  --navy: #1a1a2e;
  --navy-l: #2d2d4a;
  --red: #8b0000;
  --red-l: #a52a2a;
  --gold: #b8860b;
  --gold-l: #daa520;
  --green: #2d6a4f;
  --blue: #2980b9;
  --border: #c5baa6;
  --border-l: #d8cfbe;
  --highlight: #fff8dc;
  --note-bg: #e8e2d6;
  --rn: #c0392b; --rs: #2980b9; --re: #27ae60; --rw: #e67e22; --rne: #8e44ad; --rut: #7f8c8d;
}

html { font-size: 17px; scroll-behavior: smooth; }

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* ── Full-width + readable prose ────────────────────────────── */
.full { width: 100%; padding: 0 3vw; }
.prose { max-width: 720px; margin: 0 auto; }
.wide { max-width: 1200px; margin: 0 auto; }

a { color: var(--red); }
strong { color: var(--navy); }
p { margin-bottom: 1rem; }

/* ── Site Nav ───────────────────────────────────────────────── */
.site-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--navy);
  border-bottom: 2px solid var(--gold);
  padding: .5rem 3vw;
  display: flex; align-items: center; gap: 1.5rem;
  font-family: 'Courier New', monospace;
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  overflow-x: auto;
  white-space: nowrap;
}
.site-nav a {
  color: #999; text-decoration: none; padding: .3rem 0;
  border-bottom: 2px solid transparent; transition: all .15s;
}
.site-nav a:hover, .site-nav a.active { color: #fff; border-bottom-color: var(--gold); }
.nav-brand { color: var(--gold-l); font-weight: 700; margin-right: auto; font-size: .65rem; }

/* ── Hero (landing page only) ───────────────────────────────── */
.hero {
  background: var(--navy);
  color: #fff;
  min-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  padding: 4rem 3vw;
  border-bottom: 4px solid var(--red);
}
.hero h1 { font-size: clamp(2rem, 5vw, 3.5rem); font-weight: 700; line-height: 1.15; margin-bottom: .75rem; }
.hero h1 .thin { font-weight: 400; opacity: .7; }
.hero .sub {
  font-size: clamp(.9rem, 1.5vw, 1.15rem);
  color: #b0b0c8; font-style: italic;
  max-width: 640px; margin: 0 auto 1.5rem; line-height: 1.55;
}
.hero .meta {
  font-family: 'Courier New', monospace; font-size: .6rem;
  color: #888; letter-spacing: .05em;
}

/* ── Nav Cards (landing page) ───────────────────────────────── */
.nav-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  padding: 2.5rem 3vw;
  max-width: 1200px;
  margin: 0 auto;
}
.nav-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.5rem;
  text-decoration: none;
  color: var(--text);
  transition: all .2s;
  display: block;
}
.nav-card:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.nav-card-num {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .15em;
  color: var(--gold); font-weight: 700; margin-bottom: .5rem;
}
.nav-card h2 { font-size: 1.1rem; margin-bottom: .4rem; line-height: 1.3; }
.nav-card p { font-size: .8rem; color: var(--text-2); margin: 0; line-height: 1.5; }

/* ── Page Header (inner pages) ──────────────────────────────── */
.page-header {
  background: var(--navy);
  color: #fff;
  padding: 3rem 3vw 2rem;
  border-bottom: 3px solid var(--gold);
}
.page-header .section-num {
  font-family: 'Courier New', monospace; font-size: .6rem;
  text-transform: uppercase; letter-spacing: .2em; color: var(--gold);
}
.page-header h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); margin-top: .5rem; line-height: 1.2; }
.page-header .page-sub { color: #b0b0c8; font-size: .9rem; margin-top: .5rem; font-style: italic; }

/* ── Page Content ───────────────────────────────────────────── */
.page-body { padding: 2rem 3vw 3rem; }

/* ── Stat Boxes ─────────────────────────────────────────────── */
.stat-row { display: flex; gap: .75rem; margin: 1.5rem 0; flex-wrap: wrap; }
.stat-box {
  flex: 1; min-width: 100px;
  background: var(--navy); color: #fff;
  padding: .85rem; border-radius: 4px; text-align: center;
}
.stat-number { font-family: 'Courier New', monospace; font-size: 1.6rem; font-weight: 700; display: block; line-height: 1; margin-bottom: .25rem; }
.stat-label { font-size: .5rem; text-transform: uppercase; letter-spacing: .1em; opacity: .7; }

/* ── Bill Quote ─────────────────────────────────────────────── */
.bill-quote {
  background: #f0ebe0;
  border-left: 4px solid var(--red);
  padding: 1.1rem 1.4rem;
  margin: 1.5rem 0;
  font-style: italic; font-size: .88rem; line-height: 1.65;
}
.bill-quote .source {
  display: block; font-style: normal; font-size: .6rem;
  color: var(--text-3); margin-top: .5rem;
  font-family: 'Courier New', monospace;
}

/* ── Sidenote / Danger ──────────────────────────────────────── */
.sidenote {
  background: var(--note-bg);
  border-left: 3px solid var(--gold);
  padding: .75rem 1rem; margin: 1.25rem 0;
  font-size: .8rem; line-height: 1.6; color: var(--text-2);
  border-radius: 0 4px 4px 0;
}
.sidenote-label, .danger-label {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .1em;
  display: block; margin-bottom: .25rem; font-weight: 700;
}
.sidenote-label { color: var(--gold); }
.danger {
  background: #fef2f2; border-left: 3px solid var(--red);
  padding: .75rem 1rem; margin: 1.25rem 0;
  font-size: .8rem; line-height: 1.6; border-radius: 0 4px 4px 0;
}
.danger-label { color: var(--red); }

/* ── Clause Cards ───────────────────────────────────────────── */
.clause-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; margin-bottom: .75rem; overflow: hidden;
}
.clause-header {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; cursor: pointer;
  transition: background .15s;
}
.clause-header:hover { background: var(--highlight); }
.clause-article {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--red); font-weight: 700; flex-shrink: 0;
}
.clause-title { font-weight: 700; font-size: .85rem; flex: 1; }
.clause-chevron { font-size: .75rem; color: var(--text-3); transition: transform .2s; }
.clause-card.open .clause-chevron { transform: rotate(180deg); }
.clause-body { max-height: 0; overflow: hidden; transition: max-height .35s ease; }
.clause-card.open .clause-body { max-height: 2000px; }
.clause-comparison { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border-l); }
.clause-before, .clause-after { padding: .85rem 1rem; font-size: .78rem; line-height: 1.6; }
.clause-before { background: #f8f7f4; border-right: 1px solid var(--border-l); }
.clause-after { background: #fef8f0; }
.clause-col-label {
  font-family: 'Courier New', monospace; font-size: .5rem;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700;
  display: block; margin-bottom: .3rem;
}
.clause-before .clause-col-label { color: var(--text-3); }
.clause-after .clause-col-label { color: var(--red); }
.clause-risk {
  padding: .6rem 1rem; background: #fef2f2;
  border-top: 1px solid var(--border-l);
  font-size: .7rem; color: var(--red);
  font-family: 'Courier New', monospace; line-height: 1.5;
}

/* ── Timeline ───────────────────────────────────────────────── */
.timeline { position: relative; margin: 1.5rem 0; padding-left: 2.5rem; }
.timeline::before {
  content: ''; position: absolute; left: 8px; top: 0; bottom: 0;
  width: 2px; background: var(--border);
}
.tl-item { position: relative; margin-bottom: 1.25rem; padding-left: .75rem; }
.tl-dot {
  position: absolute; left: -2.5rem; top: .3rem;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--border);
}
.tl-item.major .tl-dot { background: var(--red); border-color: var(--red); width: 14px; height: 14px; left: calc(-2.5rem - 1px); }
.tl-item.warning .tl-dot { background: var(--gold); border-color: var(--gold); }
.tl-item.danger .tl-dot { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 4px rgba(139,0,0,.15); }
.tl-year { font-family: 'Courier New', monospace; font-size: .55rem; color: var(--text-3); letter-spacing: .05em; }
.tl-title { font-weight: 700; font-size: .85rem; margin-bottom: .15rem; color: var(--navy); }
.tl-desc { font-size: .75rem; color: var(--text-2); line-height: 1.55; }

/* ── Simulator ──────────────────────────────────────────────── */
.sim-controls {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: 1.25rem; margin-bottom: 1rem;
}
.sim-row { display: flex; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.sim-row:last-child { margin-bottom: 0; }
.sim-label {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-3); min-width: 90px; font-weight: 700;
}
.sim-slider {
  flex: 1; min-width: 150px; -webkit-appearance: none;
  height: 4px; background: var(--border); border-radius: 2px; outline: none;
}
.sim-slider::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px;
  border-radius: 50%; background: var(--navy); cursor: pointer; border: 2px solid var(--gold);
}
.sim-value {
  font-family: 'Courier New', monospace; font-size: 1rem; font-weight: 700;
  color: var(--navy); min-width: 45px; text-align: right;
}
.sim-toggle-group { display: flex; gap: .3rem; flex-wrap: wrap; }
.sim-toggle {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .05em;
  padding: .25rem .6rem; border: 1px solid var(--border);
  border-radius: 3px; background: transparent; cursor: pointer;
  color: var(--text-2); transition: all .15s;
}
.sim-toggle.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* ── Simulator Dashboard Layout ─────────────────────────────── */
.sim-dashboard {
  display: grid;
  grid-template-columns: minmax(350px, 1fr) minmax(0, 1.5fr);
  gap: 1rem;
  margin-top: 1rem;
  align-items: start;
}
.sim-map-panel {
  position: sticky; top: 60px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: .75rem;
  min-height: 400px;
}
.sim-map-panel svg { width: 100%; height: auto; }
.sim-table-panel { overflow-x: auto; }

/* ── Results Table ──────────────────────────────────────────── */
.sim-table { width: 100%; border-collapse: collapse; font-size: .75rem; }
.sim-table th {
  background: var(--navy); color: #fff;
  font-family: 'Courier New', monospace; font-size: .5rem;
  text-transform: uppercase; letter-spacing: .06em;
  padding: .5rem .6rem; text-align: left;
  cursor: pointer; user-select: none; white-space: nowrap;
  position: sticky; top: 58px; z-index: 5;
}
.sim-table th:hover { background: var(--navy-l); }
.sim-table td { padding: .4rem .6rem; border-bottom: 1px solid var(--border-l); white-space: nowrap; }
.sim-table tr:hover { background: var(--highlight); }
.change-pos { color: var(--green); font-weight: 700; }
.change-neg { color: var(--red); font-weight: 700; }
.change-zero { color: var(--text-3); }
.region-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .35rem; vertical-align: middle; }

/* ── Region Cards ───────────────────────────────────────────── */
.region-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem; margin: 1rem 0;
}
.region-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; padding: .85rem;
}
.region-name {
  font-family: 'Courier New', monospace; font-size: .55rem;
  text-transform: uppercase; letter-spacing: .1em; font-weight: 700; margin-bottom: .35rem;
}
.region-stat { font-family: 'Courier New', monospace; font-size: 1.2rem; font-weight: 700; line-height: 1; margin-bottom: .2rem; }
.region-detail { font-size: .65rem; color: var(--text-2); line-height: 1.45; }

/* ── Map Legend & Tooltip ───────────────────────────────────── */
.map-legend {
  display: flex; justify-content: center; gap: 1rem; margin-top: .5rem;
  font-size: .55rem; font-family: 'Courier New', monospace; color: var(--text-2);
}
.legend-item { display: flex; align-items: center; gap: .25rem; }
.legend-swatch { width: 12px; height: 12px; border-radius: 2px; border: 1px solid rgba(0,0,0,.1); }
.map-tooltip {
  position: absolute; background: var(--navy); color: #fff;
  padding: .4rem .65rem; border-radius: 4px; font-size: .65rem;
  font-family: 'Courier New', monospace; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 10; max-width: 220px; line-height: 1.4;
}

/* ── Perspective Cards ──────────────────────────────────────── */
.perspective {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 4px; margin-bottom: .75rem; overflow: hidden;
}
.perspective summary {
  display: flex; align-items: center; gap: .75rem;
  padding: .85rem 1.1rem; cursor: pointer; user-select: none;
  font-weight: 700; font-size: .9rem; list-style: none; transition: background .15s;
}
.perspective summary::-webkit-details-marker { display: none; }
.perspective summary::after {
  content: '+'; margin-left: auto; font-family: 'Courier New', monospace;
  font-size: 1rem; color: var(--text-3);
}
.perspective[open] summary::after { content: '\2212'; }
.perspective summary:hover { background: var(--highlight); }
.perspective-num {
  font-family: 'Courier New', monospace; font-size: .6rem; font-weight: 700;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.perspective-body {
  padding: .5rem 1.1rem 1.1rem; font-size: .85rem; line-height: 1.7;
  border-top: 1px solid var(--border-l);
}

/* ── Page Nav (bottom) ──────────────────────────────────────── */
.page-nav {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: 2rem 0; border-top: 1px solid var(--border-l); margin-top: 2rem;
}
.page-nav a {
  font-family: 'Courier New', monospace; font-size: .65rem;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--navy); text-decoration: none;
  padding: .5rem 1rem; border: 1px solid var(--border);
  border-radius: 4px; transition: all .15s;
}
.page-nav a:hover { border-color: var(--gold); background: var(--highlight); }

/* ── Footer ─────────────────────────────────────────────────── */
footer {
  background: var(--navy); color: #888;
  padding: 2rem 3vw; font-size: .65rem; text-align: center;
  font-family: 'Courier New', monospace; letter-spacing: .03em; line-height: 1.7;
}
footer a { color: var(--gold-l); text-decoration: none; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sim-dashboard { grid-template-columns: 1fr; }
  .sim-map-panel { position: static; }
}
@media (max-width: 600px) {
  html { font-size: 15px; }
  .full { padding: 0 1rem; }
  .site-nav { padding: .5rem 1rem; gap: 1rem; }
  .clause-comparison { grid-template-columns: 1fr; }
  .clause-before { border-right: 0; border-bottom: 1px solid var(--border-l); }
  .nav-cards { grid-template-columns: 1fr; padding: 1.5rem 1rem; }
  .sim-row { flex-direction: column; align-items: flex-start; }
  .region-grid { grid-template-columns: 1fr 1fr; }
  .page-header { padding: 2rem 1rem 1.5rem; }
  .page-body { padding: 1.5rem 1rem 2rem; }
}
