/* Ras Malé Public Monitor — stylesheet
   Direction: nautical chart / survey record. Cool paper, chart-ink navy,
   status colours that always pair with a shape so colour is never the only signal. */

:root {
  --paper: #eef2f0;
  --surface: #fbfcfa;
  --wash: #e3eae8;
  --ink: #102233;
  --ink-2: #4a5d6c;
  --line: #c9d4d2;
  --depth: #1f4e79;
  --on-depth: #ffffff;
  --link: #1f4e79;
  --focus: #2f8f88;
  --lagoon: #6fb7b0;
  --lagoon-wash: #dcefec;

  --doc: #2b7449;   --doc-wash: #dbeee2;
  --claim: #96600d; --claim-wash: #f5e7c9;
  --proj: #5a4790;  --proj-wash: #e7e2f4;
  --prop: #1f4e79;  --prop-wash: #dde8f3;
  --miss: #a8352a;  --miss-wash: #f5dcd7;

  --serif: "Newsreader", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --wrap: 74rem;
  --measure: 68ch;
  --r-s: 4px;
  --r-m: 10px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0e1922;
    --surface: #14222e;
    --wash: #1a2b38;
    --ink: #e5edf1;
    --ink-2: #9cb0bd;
    --line: #2a3d4b;
    --depth: #8cb8e6;
    --on-depth: #0e1922;
    --link: #9cc4ee;
    --focus: #6fd0c6;
    --lagoon: #3f8d86;
    --lagoon-wash: #15302f;

    --doc: #7fd19d;   --doc-wash: #173525;
    --claim: #f0c165; --claim-wash: #3a2d12;
    --proj: #c2b3f3;  --proj-wash: #2a2340;
    --prop: #9cc4ee;  --prop-wash: #1b2d42;
    --miss: #f2988c;  --miss-wash: #3d1d19;
    color-scheme: dark;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 6rem;
}

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a {
  color: var(--link);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

code {
  font-size: 0.9em;
  background: var(--wash);
  padding: 0.1em 0.35em;
  border-radius: var(--r-s);
}

.skip {
  position: absolute;
  left: -9999px;
}
.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 100;
  background: var(--surface);
  color: var(--ink);
  padding: 0.6rem 0.9rem;
  border-radius: var(--r-s);
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 clamp(1rem, 4vw, 2rem);
}

/* ---------- Type ---------- */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.012em;
  color: var(--ink);
}

h1 {
  font-size: clamp(2.1rem, 5.4vw, 3.6rem);
  font-variation-settings: "opsz" 72;
  margin: 0 0 1.1rem;
  max-width: 20ch;
  text-wrap: balance;
}

h2 {
  font-size: clamp(1.45rem, 2.6vw, 1.9rem);
  font-variation-settings: "opsz" 48;
  margin: 3.2rem 0 1rem;
  text-wrap: balance;
}

h3 {
  font-size: 1.25rem;
  margin: 0 0 0.5rem;
}

p { margin: 0 0 1rem; max-width: var(--measure); }

.lede {
  font-size: clamp(1.1rem, 1.6vw, 1.25rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 58ch;
}

.muted { color: var(--ink-2); }
.small { font-size: 0.9rem; }

/* ---------- Header ---------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 30;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  min-height: 4.4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
}

.brand-mark { width: 36px; height: 36px; flex: none; }

.brand-name {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.18rem;
  line-height: 1.1;
}

.brand-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--ink-2);
}

.site-nav { display: flex; gap: 0.2rem; }

.site-nav a {
  color: var(--ink-2);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 0.45rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}
.site-nav a:hover { color: var(--ink); background: var(--wash); }
.site-nav a[aria-current="page"] {
  color: var(--on-depth);
  background: var(--depth);
}

@media (max-width: 960px) {
  .site-header { position: static; }
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    padding: 0.8rem 0 0.6rem;
  }
  .site-nav {
    overflow-x: auto;
    scrollbar-width: none;
    padding: 0 0 0.15rem;
  }
  .site-nav::-webkit-scrollbar { display: none; }
  html { scroll-padding-top: 1rem; }
}

/* ---------- Page head ---------- */

.page-head {
  padding: clamp(1.25rem, 3vw, 2rem) 0 clamp(1.75rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line);
}

.page-meta {
  font-size: 0.9rem;
  color: var(--ink-2);
  margin: 0 0 1rem;
}

main { padding-bottom: 4rem; }

/* ---------- Home hero ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(16rem, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: end;
}

.deadline {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--miss);
  border-radius: var(--r-m);
  padding: 1.25rem 1.4rem 1.3rem;
}

.deadline-label { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 0.2rem; }

.deadline-date {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  margin: 0 0 0.9rem;
}

.deadline-count {
  font-family: var(--serif);
  font-size: clamp(2.6rem, 5vw, 3.4rem);
  font-weight: 600;
  line-height: 1;
  color: var(--miss);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.deadline-unit { font-size: 0.95rem; color: var(--ink-2); margin: 0.3rem 0 0; }

@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
}

/* ---------- Evidence strip (home) ---------- */

.evidence {
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 3vw, 1.9rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

.evidence h2 { margin: 0 0 0.4rem; }
.evidence > p { color: var(--ink-2); }

.strip {
  display: flex;
  gap: 4px;
  height: 64px;
  margin: 1.4rem 0 0.75rem;
}

.strip a {
  flex: 1 1 0;
  min-width: 6px;
  border-radius: 3px;
  background: var(--k);
  position: relative;
}
.strip a::after {
  /* shape cue inside each segment so colour is not the only signal */
  content: "";
  position: absolute;
  left: 50%;
  bottom: 8px;
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--surface);
  opacity: 0.85;
}
.strip a.k-reported::after   { border-radius: 50%; }
.strip a.k-claim::after      { border-radius: 50%; background: transparent; border: 2px solid var(--surface); }
.strip a.k-projection::after { border-radius: 50%; background: linear-gradient(90deg, var(--surface) 50%, transparent 50%); border: 1.5px solid var(--surface); }
.strip a.k-proposed::after   { transform: rotate(45deg); }
.strip a.k-open::after       { border-radius: 1px; }

.strip a:hover, .strip a:focus-visible, .strip a.is-active {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}

.strip-caption {
  min-height: 1.6em;
  font-size: 0.95rem;
  margin: 0 0 1.1rem;
}
.strip-caption strong { font-family: var(--serif); font-size: 1.05rem; }

.k-reported   { --k: var(--doc); }
.k-claim      { --k: var(--claim); }
.k-projection { --k: var(--proj); }
.k-proposed   { --k: var(--prop); }
.k-open       { --k: var(--miss); }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}
.legend li { display: flex; align-items: center; gap: 0.45rem; }
.legend b { font-variant-numeric: tabular-nums; }

.strip-fallback { color: var(--ink-2); font-size: 0.95rem; }

/* ---------- Fact sheet (home) ---------- */

.facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 2.5rem;
  margin: 0;
}

.fact {
  display: grid;
  grid-template-columns: minmax(9rem, 0.9fr) 1.1fr;
  gap: 1rem;
  padding: 1rem 0;
  border-top: 1px solid var(--line);
  align-items: baseline;
}

.fact dt { color: var(--ink-2); font-size: 0.95rem; }
.fact dd { margin: 0; font-weight: 500; }

@media (max-width: 760px) {
  .facts { grid-template-columns: 1fr; }
  .fact { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* ---------- Callout ---------- */

.callout {
  margin: 2.5rem 0 0;
  padding: clamp(1.25rem, 3vw, 1.75rem) clamp(1.25rem, 3vw, 2rem);
  background: var(--lagoon-wash);
  border-left: 5px solid var(--depth);
  border-radius: 0 var(--r-m) var(--r-m) 0;
}
.callout h2, .callout h3 { margin: 0 0 0.6rem; font-size: 1.2rem; }
.callout p {
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.55;
  margin: 0;
  max-width: 70ch;
}

.next-links {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.next-links a {
  display: block;
  padding: 1.1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  text-decoration: none;
  color: var(--ink);
}
.next-links a:hover { border-color: var(--depth); }
.next-links strong { display: block; font-family: var(--serif); font-size: 1.15rem; color: var(--link); }
.next-links span { font-size: 0.92rem; color: var(--ink-2); }

/* ---------- Status tags ---------- */

.tag {
  --c: var(--ink-2);
  --w: var(--wash);
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.2rem 0.65rem 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.4;
  color: var(--c);
  background: var(--w);
  white-space: nowrap;
}
.tag::before {
  content: "";
  flex: none;
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: currentColor;
}

.tag.yes  { --c: var(--doc);   --w: var(--doc-wash); }
.tag.wait { --c: var(--claim); --w: var(--claim-wash); }
.tag.wait::before { background: transparent; border: 2px solid currentColor; }
.tag.proj { --c: var(--proj);  --w: var(--proj-wash); }
.tag.proj::before { background: linear-gradient(90deg, currentColor 50%, transparent 50%); border: 1.5px solid currentColor; }
.tag.prop { --c: var(--prop);  --w: var(--prop-wash); }
.tag.prop::before { border-radius: 1px; transform: rotate(45deg) scale(0.85); }
.tag.no, .tag.open { --c: var(--miss); --w: var(--miss-wash); }
.tag.no::before, .tag.open::before { border-radius: 1px; }

.swatch {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 2px;
  background: var(--k);
  flex: none;
}

/* ---------- Tables ---------- */

.table-wrap {
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--wash);
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 1.05rem 1rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }

.ledger td:first-child,
.rti td:nth-child(3) {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.06rem;
  line-height: 1.3;
}
.ledger td:first-child { width: 16%; min-width: 9rem; }
.ledger td:nth-child(2) { width: 42%; }
.ledger td:nth-child(3) { width: 12%; }
.ledger td:last-child { width: 26%; }
.ledger td:last-child { color: var(--ink-2); font-size: 0.9rem; }

.ledger tr:target td,
.ledger tr.is-target td { background: var(--claim-wash); }

.ledger tr[hidden] { display: none; }

@media (max-width: 760px) {
  .stack thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
  .stack, .stack tbody, .stack tr, .stack td { display: block; width: auto !important; }
  .stack tr { padding: 1.1rem 1.1rem 0.9rem; border-bottom: 1px solid var(--line); }
  .stack tbody tr:last-child { border-bottom: 0; }
  .stack td { padding: 0.2rem 0 0.55rem; border: 0; min-width: 0 !important; }
  .stack td[data-label]:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    font-family: var(--sans);
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 0.1rem;
  }
}

/* ---------- Ledger controls ---------- */

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.5rem;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1rem;
}

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.filter {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.42rem 0.9rem;
  cursor: pointer;
}
.filter:hover { border-color: var(--ink-2); }
.filter[aria-pressed="true"] {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.9rem;
  min-width: min(100%, 18rem);
}
.search:focus-within { border-color: var(--focus); }
.search svg { width: 16px; height: 16px; color: var(--ink-2); flex: none; }
.search input {
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  width: 100%;
  padding: 0.15rem 0;
}
.search input:focus { outline: none; }

 @media (max-width: 640px) { .search { width: 100%; } }

.result-count { font-size: 0.88rem; color: var(--ink-2); margin: 0 0 0.75rem; }

.empty-row td { text-align: center; color: var(--ink-2); padding: 2rem 1rem; }

/* ---------- Explainers ---------- */

.with-toc {
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 4rem);
  margin-top: 2.5rem;
}

.toc {
  position: sticky;
  top: 6.5rem;
  align-self: start;
  font-size: 0.92rem;
}
.toc h2 { font-size: 1rem; margin: 0 0 0.75rem; font-family: var(--sans); color: var(--ink-2); font-weight: 600; letter-spacing: 0; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--line); }
.toc a {
  display: block;
  padding: 0.38rem 0 0.38rem 1rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--ink-2);
  text-decoration: none;
  line-height: 1.35;
}
.toc a:hover { color: var(--ink); }
.toc a.is-current { color: var(--ink); border-left-color: var(--depth); font-weight: 600; }

.explainer {
  padding: 0 0 2.5rem;
  margin: 0 0 2.5rem;
  border-bottom: 1px solid var(--line);
}
.explainer:last-child { border-bottom: 0; margin-bottom: 0; }
.explainer h2 {
  margin: 0 0 1rem;
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  align-items: baseline;
}
.explainer .num {
  font-size: 0.8em;
  font-weight: 400;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.explainer p { margin-left: 2.2rem; }

.watch {
  margin: 1.25rem 0 0 2.2rem;
  padding: 1rem 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  max-width: var(--measure);
}
.watch h3 { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-2); margin: 0 0 0.4rem; }
.watch ul { margin: 0; padding-left: 1.1rem; }
.watch li { margin: 0.25rem 0; }

@media (max-width: 900px) {
  .with-toc { grid-template-columns: 1fr; gap: 1.5rem; }
  .toc { position: static; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 1rem 1.2rem; }
  .explainer p, .watch { margin-left: 0; }
  .explainer h2 { grid-template-columns: 1.9rem 1fr; }
}

/* ---------- Other projects ---------- */

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem;
  margin-top: 1.25rem;
}

.project {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.project.wide { grid-column: 1 / -1; }

.project-art {
  aspect-ratio: 16 / 6;
  background: var(--lagoon-wash);
  color: var(--lagoon);
  border-bottom: 1px solid var(--line);
}
.project-art { margin: 0; position: relative; }
.project-art svg { width: 100%; height: 100%; }
.project-art.has-photo { aspect-ratio: 16 / 9; }
.project-art.has-photo img { width: 100%; height: 100%; object-fit: cover; }
.project-art.has-photo svg { display: none; }
/* If the remote image fails to load, fall back to the chart drawing */
.project-art.no-photo { aspect-ratio: 16 / 6; }
.project-art.no-photo img { display: none; }
.project-art.no-photo svg { display: block; }

.project-body { padding: 1.3rem 1.5rem 1.6rem; }
.project-where { font-size: 0.9rem; color: var(--ink-2); margin: 0 0 0.35rem; }
.project-body h3 { font-size: 1.5rem; margin: 0 0 0.75rem; }
.project-body .tag { margin-bottom: 1rem; }

.keyfacts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1.25rem;
  margin: 0 0 1rem;
  font-size: 0.95rem;
}
.keyfacts dt { color: var(--ink-2); }
.keyfacts dd { margin: 0; font-variant-numeric: tabular-nums; }

.caption { font-size: 0.84rem; color: var(--ink-2); margin: 0; }

@media (max-width: 820px) {
  .project-grid { grid-template-columns: 1fr; }
}

.timeline {
  list-style: none;
  margin: 1.25rem 0 0 0.4rem;
  padding: 0;
  border-left: 2px solid var(--line);
  max-width: 52rem;
}
.timeline li {
  position: relative;
  padding: 0 0 1.6rem 1.75rem;
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 0.25rem 1.5rem;
}
.timeline li::before {
  content: "";
  position: absolute;
  left: -7px;
  top: 0.45rem;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--depth);
}
.timeline li.now::before { background: var(--miss); border-color: var(--miss); }
.tl-when { font-family: var(--serif); font-weight: 600; font-size: 1.1rem; }
.tl-who { display: block; font-size: 0.85rem; color: var(--ink-2); margin-bottom: 0.15rem; }
.tl-what { margin: 0; }

@media (max-width: 640px) {
  .timeline li { grid-template-columns: 1fr; }
}

.terms {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 0;
  margin: 1.25rem 0 0;
  border-top: 1px solid var(--line);
}
.terms div { padding: 0.9rem 1.25rem 0.9rem 0; border-bottom: 1px solid var(--line); }
.terms dt { font-size: 0.88rem; color: var(--ink-2); }
.terms dd { margin: 0.1rem 0 0; font-weight: 500; }

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.5rem 3rem;
}
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; } }

.clean-list { padding-left: 1.15rem; margin: 0; max-width: var(--measure); }
.clean-list li { margin: 0.45rem 0; }

/* ---------- Documents / About ---------- */

.empty-state {
  margin-top: 1rem;
  padding: 1.5rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-m);
  color: var(--ink-2);
}
.empty-state p { margin: 0; }

.principles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.principle {
  padding: 1.2rem 1.3rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.principle h3 { font-size: 1.15rem; }
.principle p { margin: 0; font-size: 0.97rem; color: var(--ink-2); }

.placeholder {
  background: var(--claim-wash);
  color: var(--claim);
  padding: 0.85rem 1rem;
  border-radius: var(--r-s);
  font-size: 0.95rem;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 3rem;
  font-size: 0.9rem;
  color: var(--ink-2);
}
.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem 3rem;
}
.footer-name { font-family: var(--serif); font-size: 1.15rem; font-weight: 600; color: var(--ink); margin: 0 0 0.3rem; }
.site-footer p { margin: 0 0 0.4rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.1rem; justify-content: flex-end; align-content: start; }
.footer-nav a { color: var(--ink-2); }

@media (max-width: 700px) {
  .footer-inner { grid-template-columns: 1fr; }
  .footer-nav { justify-content: flex-start; }
}

@media print {
  .site-header, .site-footer, .controls, .toc, .strip { display: none; }
  body { background: #fff; color: #000; }
  .table-wrap { border: 0; }
}

/* Wide cards show the whole image instead of cropping it */
.project.wide .project-art.has-photo:not(.no-photo) { aspect-ratio: auto; }
.project.wide .project-art.has-photo:not(.no-photo) img { height: auto; }

/* ---------- Volunteer band (home) and contact ---------- */

.volunteer {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(14rem, 1fr);
  gap: 1.5rem 3rem;
  align-items: center;
  margin: 2.5rem 0 0;
  padding: clamp(1.4rem, 3vw, 2rem);
  background: var(--depth);
  color: var(--on-depth);
  border-radius: var(--r-m);
}
.volunteer h2 { color: var(--on-depth); margin: 0 0 0.6rem; }
.volunteer p { margin: 0; opacity: 0.92; }
.volunteer a { color: var(--on-depth); }
.volunteer .muted { color: var(--on-depth); opacity: 0.85; margin-top: 0.7rem; word-break: break-all; }

.button {
  display: inline-block;
  font-weight: 600;
  text-decoration: none;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  background: var(--surface);
  color: var(--depth) !important;
}
.button:hover { background: var(--lagoon-wash); }

.contact-line {
  font-family: var(--serif);
  font-size: 1.35rem;
  word-break: break-word;
}

@media (max-width: 760px) {
  .volunteer { grid-template-columns: 1fr; }
}

/* ---------- Risks ---------- */
.risk-list { max-width: 52rem; margin-top: 2.5rem; }
.risk-list .explainer h2 { font-size: clamp(1.3rem, 2.3vw, 1.65rem); }

/* ---------- Other projects: locator map ---------- */
.atlas {
  display: grid;
  grid-template-columns: minmax(14rem, 20rem) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: center;
  margin-top: 2.5rem;
}
.atlas h2 { margin-top: 0; }
.atlas-map {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 1rem 0.5rem 0.75rem;
}
.atlas-map svg { width: 100%; height: auto; max-height: 560px; }
.atlas-map figcaption { font-size: 0.8rem; color: var(--ink-2); text-align: center; margin-top: 0.4rem; }
.atolls ellipse { fill: var(--lagoon-wash); stroke: var(--lagoon); stroke-width: 1.5; }
.pin circle { fill: var(--k); stroke: var(--surface); stroke-width: 3; }
.pin text { paint-order: stroke; stroke: var(--surface); stroke-width: 4px; stroke-linejoin: round; }
.pin text { font-family: var(--serif); font-size: 21px; font-weight: 600; fill: var(--ink); }
.pin text.sub { font-family: var(--sans); font-size: 14px; font-weight: 400; fill: var(--ink-2); }
.pin:hover circle, .pin:focus-visible circle { stroke: var(--ink); }
.pin:focus-visible { outline: none; }
.legend-col { flex-direction: column; gap: 0.5rem; margin-top: 1rem; }
@media (max-width: 760px) {
  .atlas { grid-template-columns: 1fr; }
  .atlas-map { max-width: 22rem; }
}

/* ---------- Other projects: comparison table ---------- */
.compare { min-width: 56rem; font-size: 0.9rem; }
.compare th[scope="row"] {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--wash);
  color: var(--ink-2);
  font-size: 0.82rem;
  white-space: normal;
  width: 9rem;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid var(--line);
}
.compare thead th:first-child { position: sticky; left: 0; z-index: 2; }
.compare thead th { font-family: var(--serif); font-size: 1rem; color: var(--ink); }
.compare td { padding: 0.8rem 1rem; }
.compare .is-focus { background: var(--lagoon-wash); }
.compare thead th.is-focus { background: var(--depth); color: var(--on-depth); }
.compare .tag { white-space: normal; }

/* ---------- Other projects: card sections and owner panel ---------- */
.project.wide { margin-top: 1.5rem; }
.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: 1.5rem 2.5rem;
  margin-top: 0.25rem;
}
.project-body h4 {
  font-family: var(--sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--ink-2);
  margin: 1rem 0 0.4rem;
}
.project-body .card-grid > div > h4:first-child { margin-top: 0; }
.owner {
  background: var(--wash);
  border-left: 4px solid var(--depth);
  border-radius: 0 var(--r-m) var(--r-m) 0;
  padding: 1rem 1.2rem 1.1rem;
  align-self: start;
}
.owner h4 { margin-top: 0 !important; color: var(--ink) !important; font-size: 0.95rem !important; }
.owner dl { margin: 0; font-size: 0.92rem; }
.owner dt { font-weight: 600; color: var(--ink-2); font-size: 0.8rem; margin-top: 0.65rem; }
.owner dt:first-child { margin-top: 0.2rem; }
.owner dd { margin: 0.1rem 0 0; }
.relevance {
  margin: 1.4rem 0 0.9rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  font-family: var(--serif);
  font-size: 1.08rem;
}
@media (max-width: 820px) { .card-grid { grid-template-columns: 1fr; } }

/* ---------- Other projects: lease end ---------- */
.lease-end {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
.lease-end > div {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: 1.1rem 1.25rem 1.2rem;
}
.lease-end > div.is-focus { border: 2px solid var(--depth); }
.lease-end h3 { font-size: 1.15rem; }
.lease-end p { font-size: 0.95rem; }
@media (max-width: 820px) { .lease-end { grid-template-columns: 1fr; } }
.terms-h { margin-top: 2.5rem; }

/* ---------- Other projects: timeline by government ---------- */
.gov-timeline { margin-top: 1.25rem; display: grid; gap: 0.75rem; max-width: 56rem; }
.gov {
  display: grid;
  grid-template-columns: 8rem minmax(0, 1fr);
  gap: 0.5rem 1.5rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 5px solid var(--lagoon);
  border-radius: 0 var(--r-m) var(--r-m) 0;
}
.gov.is-now { border-left-color: var(--miss); }
.gov h3 { margin: 0.1rem 0 0; font-size: 1.15rem; }
.gov ol { list-style: none; margin: 0; padding: 0; }
.gov li {
  display: grid;
  grid-template-columns: 5.5rem 4.6rem minmax(0, 1fr);
  gap: 0.75rem;
  align-items: baseline;
  padding: 0.35rem 0;
}
.gov li + li { border-top: 1px dashed var(--line); }
.gov li p { margin: 0; }
.gov .tl-when { font-size: 1rem; }
.tl-kind {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  text-align: center;
}
.tl-kind.law  { background: var(--prop-wash); color: var(--prop); }
.tl-kind.proj { background: var(--claim-wash); color: var(--claim); }
@media (max-width: 700px) {
  .gov { grid-template-columns: 1fr; }
  .gov li { grid-template-columns: 4.8rem 1fr; }
  .gov li p { grid-column: 1 / -1; }
}

.ras-male-anchor {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-m);
}
.ras-male-anchor p { margin: 0; }

/* ---------- Other projects: residency section ---------- */
.residency {
  margin-top: 3rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 5px solid var(--proj);
  border-radius: var(--r-m);
}
.residency h2 { margin-top: 0; }
.residency h4 {
  font-family: var(--sans); font-size: 0.82rem; font-weight: 700;
  color: var(--ink-2); margin: 0 0 0.4rem;
}
.residency .owner { border-left-color: var(--proj); }
.residency-sub { margin-top: 1.5rem !important; }
.residency .clean-list li { margin: 0.6rem 0; }
.residency .caption { margin-top: 1rem; }

/* ---------- Risk assessment ---------- */
:root {
  --crit: var(--miss);  --crit-wash: var(--miss-wash);
  --high: var(--claim); --high-wash: var(--claim-wash);
  --med:  var(--prop);  --med-wash:  var(--prop-wash);
  --low:  var(--doc);   --low-wash:  var(--doc-wash);
}

.band-tag {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.78rem; font-weight: 700; line-height: 1.4;
  padding: 0.18rem 0.6rem 0.18rem 0.5rem; border-radius: 999px; white-space: nowrap;
}
.band-tag::before { content: ""; width: 0.6rem; height: 0.6rem; background: currentColor; flex: none; }
.band-critical { color: var(--crit); background: var(--crit-wash); }
.band-critical::before { clip-path: polygon(50% 0, 100% 100%, 0 100%); }       /* triangle */
.band-high     { color: var(--high); background: var(--high-wash); }
.band-high::before { border-radius: 1px; }                                       /* square */
.band-medium   { color: var(--med);  background: var(--med-wash); }
.band-medium::before { transform: rotate(45deg) scale(0.8); border-radius: 1px; } /* diamond */
.band-low      { color: var(--low);  background: var(--low-wash); }
.band-low::before { border-radius: 50%; }                                         /* dot */

/* Summary */
.risk-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 26rem);
  gap: clamp(1.5rem, 4vw, 3rem);
  margin-top: 2.5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
}
.risk-summary h2 { margin-top: 0; }
#summary-line { font-family: var(--serif); font-size: 1.2rem; }
.band-counts {
  list-style: none; margin: 1rem 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.6rem;
}
.band-counts li {
  display: flex; flex-direction: column; align-items: flex-start; gap: 0.35rem;
  padding: 0.75rem 0.85rem; border: 1px solid var(--line); border-radius: var(--r-s);
}
.band-counts b { font-family: var(--serif); font-size: 2rem; line-height: 1; font-variant-numeric: tabular-nums; }
.top-h { font-family: var(--sans); font-size: 0.9rem; color: var(--ink-2); margin: 1.6rem 0 0.5rem; }
.top-risks { list-style: none; margin: 0; padding: 0; }
.top-risks li {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  padding: 0.5rem 0; border-top: 1px solid var(--line);
}
.top-risks a { display: flex; gap: 0.75rem; color: var(--ink); text-decoration: none; font-weight: 500; }
.top-risks a:hover span:last-child { text-decoration: underline; }
.top-score { font-family: var(--serif); font-weight: 600; font-variant-numeric: tabular-nums; }
.risk-id {
  font-family: var(--sans); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.02em;
  color: var(--depth); font-variant-numeric: tabular-nums; flex: none;
}
@media (max-width: 900px) {
  .risk-summary { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  .band-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Matrix */
.heatmap-wrap { margin: 0; }
.heatmap {
  display: grid;
  grid-template-columns: 1.4rem 1.2rem repeat(5, minmax(0, 1fr));
  grid-auto-rows: minmax(3.4rem, auto);
  gap: 3px;
  position: relative;
  max-width: 26rem;
}
.heatmap .hm-axis.hm-y {
  grid-column: 1; grid-row: 1 / span 5;
  writing-mode: vertical-rl; transform: rotate(180deg);
  text-align: center; font-size: 0.8rem; color: var(--ink-2); font-weight: 600;
}
.heatmap .hm-label { display: grid; place-items: center; font-size: 0.8rem; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.heatmap .hm-row { grid-column: 2; }
.heatmap .hm-axis.hm-x { grid-column: 3 / -1; text-align: center; font-size: 0.8rem; color: var(--ink-2); font-weight: 600; min-height: 0; }
.heatmap > span:nth-last-child(7) { grid-column: 2; }
.hm-cell {
  border-radius: 4px; padding: 3px;
  display: flex; flex-wrap: wrap; align-content: center; justify-content: center; gap: 3px;
}
.cell-low      { background: var(--low-wash); }
.cell-medium   { background: var(--med-wash); }
.cell-high     { background: var(--high-wash); }
.cell-critical { background: var(--crit-wash); }
.hm-cell a {
  font-size: 0.66rem; font-weight: 700; text-decoration: none; line-height: 1.3;
  color: var(--surface); padding: 0.08rem 0.22rem; border-radius: 3px;
  font-variant-numeric: tabular-nums;
}
.cell-low a { background: var(--low); }
.cell-medium a { background: var(--med); }
.cell-high a { background: var(--high); }
.cell-critical a { background: var(--crit); }
.hm-cell a:hover, .hm-cell a:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.heatmap-wrap figcaption { font-size: 0.82rem; color: var(--ink-2); margin-top: 0.75rem; }

/* Method */
.method { margin-top: 1rem; }
.method-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 3rem; }
.scale { font-size: 0.9rem; margin-top: 0.5rem; }
.scale caption { text-align: left; font-weight: 600; font-size: 0.9rem; padding-bottom: 0.4rem; color: var(--ink); }
.scale th { width: 2.2rem; text-align: center; font-family: var(--serif); font-size: 1rem; color: var(--ink); background: var(--wash); white-space: nowrap; }
.scale td { padding: 0.45rem 0.8rem; }
.scale th, .scale td { border-bottom: 1px solid var(--line); }
.band-key { list-style: none; padding: 0; margin: 1.1rem 0 0; display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; font-size: 0.88rem; }
.band-key li { display: flex; align-items: center; gap: 0.45rem; }
.limits {
  margin-top: 1.5rem; padding: 1rem 1.25rem;
  border-left: 4px solid var(--line); background: var(--surface); border-radius: 0 var(--r-m) var(--r-m) 0;
}
.limits h3 { font-family: var(--sans); font-size: 0.95rem; margin: 0 0 0.4rem; }
.limits p { margin: 0; font-size: 0.95rem; color: var(--ink-2); max-width: 80ch; }
@media (max-width: 760px) { .method-grid { grid-template-columns: 1fr; } }

/* Register table */
.register td:nth-child(2) a { color: var(--ink); text-decoration: none; font-weight: 500; }
.register td:nth-child(2) a:hover { text-decoration: underline; }
.register td:nth-child(n+4):nth-child(-n+6) { text-align: center; font-variant-numeric: tabular-nums; width: 5.5rem; }
.register th:nth-child(n+4):nth-child(-n+6) { text-align: center; }
.register td:nth-child(3) { color: var(--ink-2); font-size: 0.9rem; }
.register a.risk-id { text-decoration: none; }

/* Risk cards */
.risk-list { max-width: none; margin-top: 0.5rem; display: grid; gap: 1rem; }
.risk {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-m);
  padding: clamp(1.1rem, 2.5vw, 1.5rem) clamp(1.1rem, 2.5vw, 1.75rem);
}
.risk[hidden] { display: none; }
.risk:target { border-color: var(--depth); box-shadow: 0 0 0 3px var(--lagoon-wash); }
.risk-head {
  display: grid;
  grid-template-columns: 3rem minmax(0, 1fr) auto;
  gap: 0.25rem 1rem;
  align-items: start;
}
.risk-head .risk-id { font-size: 0.85rem; padding-top: 0.3rem; }
.risk-title h3 { font-size: 1.3rem; margin: 0 0 0.2rem; }
.risk-cat { font-size: 0.85rem; color: var(--ink-2); margin: 0; }
.risk-new { margin-left: 0.5rem; font-size: 0.75rem; font-weight: 600; color: var(--depth); }
.risk-rating { display: flex; flex-direction: column; align-items: flex-end; gap: 0.35rem; }
.risk-score { font-size: 0.82rem; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.risk-score b { color: var(--ink); font-size: 0.95rem; }
.risk-desc { margin: 1rem 0 1rem 4rem; max-width: 75ch; }
.risk-detail {
  margin: 0 0 0 4rem;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem 2rem;
  padding-top: 1rem; border-top: 1px dashed var(--line);
}
.risk-detail dt { font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.risk-detail dd { margin: 0.15rem 0 0; font-size: 0.94rem; }
@media (max-width: 760px) {
  .risk-head { grid-template-columns: minmax(0, 1fr); }
  .risk-head .risk-id { padding-top: 0; }
  .risk-rating { flex-direction: row; align-items: center; justify-content: flex-start; gap: 0.75rem; }
  .risk-desc, .risk-detail { margin-left: 0; }
  .risk-detail { grid-template-columns: 1fr; }
}

.changelog { list-style: none; padding: 0; margin: 0; max-width: 56rem; }
.changelog li { display: grid; grid-template-columns: 8rem 1fr; gap: 1rem; padding: 0.6rem 0; border-top: 1px solid var(--line); }
.changelog p { margin: 0; }
@media (max-width: 640px) { .changelog li { grid-template-columns: 1fr; gap: 0.2rem; } }
