/* assets/public-site.css — the public portal's white / red / blue shell
   (docs/superpowers/plans/2026-11-01-public-portal-DESIGN.md). Loaded after
   style.css on every page; it redefines the colour tokens that style.css
   consumes, so existing components pick the palette up without being rewritten.
   No external fonts or resources: Georgia for editorial headings, the system
   sans-serif for navigation, data and controls. */

:root,
:root.public,
:root:not(.public) {
  color-scheme: light;
  --canvas: #ffffff;
  --navy: #102c55;
  --ink: #142b4d;
  --muted: #4c6080;
  --blue: #164db5;
  --red: #c82635;
  --red-hover: #a91c2b;
  --pale: #edf3fd;
  --control: #778cab;
  --line: #d9e2f0;
  /* tokens style.css reads */
  --bg: var(--canvas);
  --card: var(--canvas);
  --accent: var(--blue);
  --accent-soft: var(--pale);
  --bad: var(--red);
  --bad-bg: #fbeaec;
  --bad-line: #ebb3b9;
  --radius: 8px;
  /* spacing scale 8/12/16/24/32/48/64/96 */
  --s1: 8px;
  --s2: 12px;
  --s3: 16px;
  --s4: 24px;
  --s5: 32px;
  --s6: 48px;
  --s7: 64px;
  --s8: 96px;
  --focus: 0 0 0 3px var(--blue);
  --serif: Georgia, "Times New Roman", Times, serif;
}

html {
  background: var(--canvas);
}

body {
  background: var(--canvas);
  color: var(--ink);
  caret-color: var(--blue);
  accent-color: var(--blue);
}

::selection {
  background: var(--pale);
  color: var(--ink);
}

a {
  color: var(--blue);
}

h1,
h2,
h3,
.brand {
  font-family: var(--serif);
  color: var(--navy);
  font-weight: 700;
}

h1 {
  font-size: 1.9rem;
  line-height: 1.2;
  margin: 0 0 var(--s2);
}

.pub h2 {
  font-size: 1.25rem;
  border-bottom: 1px solid var(--line);
}

.pub h3 {
  font-size: 1.05rem;
}

main,
.public main.pub {
  max-width: 1200px;
  padding: var(--s4) var(--s3) var(--s6);
}

.pub p,
.pub li {
  max-width: 72ch;
}

/* ---- header: wordmark, six destinations, Developer ---------------------- */

.site-header {
  gap: var(--s2) var(--s4);
  padding: var(--s3) var(--s4);
  border-bottom: 2px solid var(--navy);
  background: var(--canvas);
}

.site-header .brand,
.public .site-header .brand {
  display: inline-flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--navy);
  font-size: 1.15rem;
  line-height: 1.15;
}

.site-header .brand small,
.public .site-header .brand small {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  font-weight: 400;
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 2px;
}

.site-header nav {
  gap: var(--s1);
}

.site-header nav a,
.public .site-header nav a {
  color: var(--blue);
  font-weight: 600;
  padding: 10px 12px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  border-bottom: 3px solid transparent;
  background: none;
}

.site-header nav a:hover {
  background: var(--pale);
}

/* the current destination: weight and a red underline, not colour alone */
.site-header nav a[aria-current="page"],
.public .site-header nav a[aria-current="page"] {
  color: var(--navy);
  font-weight: 700;
  background: none;
  border-bottom-color: var(--red);
  border-radius: 6px 6px 0 0;
}

.site-header nav a.nav-dev {
  margin-left: var(--s3);
  color: var(--muted);
  font-weight: 500;
  border-left: 1px solid var(--line);
  border-radius: 0;
  padding-left: var(--s3);
}

.nav-toggle {
  display: none;
  min-height: 44px;
  padding: 0 var(--s3);
  font: inherit;
  font-weight: 600;
  color: var(--navy);
  background: var(--canvas);
  border: 1px solid var(--control);
  border-radius: 6px;
  cursor: pointer;
}

/* ---- footer ------------------------------------------------------------- */

.site-footer,
.public .site-footer {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--s4) var(--s3) var(--s6);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.site-footer .owner {
  flex-basis: 100%;
  font-family: var(--serif);
  color: var(--navy);
}

.site-footer a,
.public .site-footer a {
  color: var(--blue);
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.site-footer a:hover,
.public .site-footer a:hover {
  color: var(--navy);
  text-decoration: underline;
}

/* ---- controls: red primary, blue focus, 44px touch targets -------------- */

.public .btn,
.public .filters button,
.public .tabs button,
.public .pager button,
.public .pub-toggle button,
.public button.pub-sha {
  min-height: 44px;
  border-radius: 6px;
  font: inherit;
  font-size: 0.95rem;
  padding: 0 var(--s3);
}

.public .btn,
.public .filters button {
  background: var(--red);
  border: 1px solid var(--red);
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.public .btn:hover,
.public .filters button:hover {
  background: var(--red-hover);
  border-color: var(--red-hover);
}

.public .btn.secondary {
  background: var(--canvas);
  color: var(--blue);
  border-color: var(--control);
}

.public .btn.secondary:hover {
  background: var(--pale);
  color: var(--navy);
}

.public .tabs button,
.public .pager button,
.public .pub-toggle button {
  background: var(--canvas);
  color: var(--blue);
  border: 1px solid var(--control);
}

.public .tabs button[aria-pressed="true"],
.public .pub-toggle button[aria-pressed="true"] {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}

.public .filters input,
.public .filters select,
.public input[type="search"],
.public input[type="date"],
.public select {
  border: 1px solid var(--control);
  border-radius: 6px;
  min-height: 44px;
  color: var(--ink);
  background: var(--canvas);
}

.public .pipe a.on {
  background: var(--pale);
  border-bottom: 3px solid var(--red);
}

.pub-err,
.public .pub-err {
  color: var(--red-hover);
}

/* ---- focus: 3px blue, white separation on red actions ------------------- */

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

.public .btn:focus-visible,
.public .filters button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px #ffffff, 0 0 0 5px var(--blue);
}

/* ---- tables stay inside their box ---------------------------------------- */

.pub table,
.public table {
  display: block;
  overflow-x: auto;
  max-width: 100%;
}

.pub table.meta,
.public table.meta {
  display: table;
}

/* ---- responsive: nav collapses at 1050px, layout at 980/760/680 ---------- */

@media (max-width: 1050px) {
  .js .nav-toggle {
    display: inline-flex;
    align-items: center;
  }
  .js .site-header nav {
    display: none;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding-top: var(--s1);
  }
  .js .site-header nav.open {
    display: flex;
  }
  .js .site-header nav a,
  .js .site-header nav a.nav-dev {
    margin-left: 0;
    border-left: none;
    border-radius: 6px;
    padding-left: 12px;
  }
  .js .site-header nav a[aria-current="page"] {
    border-bottom-color: var(--red);
  }
}

@media (max-width: 980px) {
  main,
  .public main.pub {
    padding: var(--s3) var(--s3) var(--s5);
  }
}

@media (max-width: 760px) {
  h1 {
    font-size: 1.5rem;
  }
  .site-header {
    padding: var(--s2) var(--s3);
  }
}

@media (max-width: 680px) {
  .site-footer,
  .public .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
  }
}

/* ---- motion ------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Home (plan 2026-11-01 Task 6) ---------------------------------------- */

.home-top {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: var(--s5);
  align-items: center;
  padding: var(--s4) 0 var(--s5);
}

.home-intro h1 {
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 var(--s3);
  max-width: 14ch;
}

.home-intro h1 .accent {
  color: var(--blue);
}

.home-intro .lede {
  font-size: 1.1rem;
  max-width: 48ch;
}

.home-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin: var(--s3) 0 var(--s2);
}

.home-figure {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: var(--s2) var(--s3) var(--s3);
  background: var(--canvas);
}

.home-figure figcaption {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  margin-bottom: var(--s1);
}

.sahel-map {
  width: 100%;
  height: auto;
  display: block;
}

.sahel-map .region {
  fill: var(--pale);
  stroke: #ffffff;
  stroke-width: 1;
}

.sahel-map .country[data-country="mali"] .region { fill: #dbe6fa; }
.sahel-map .country[data-country="niger"] .region { fill: #e6eefb; }
.sahel-map .country[data-country="burkina-faso"] .region { fill: #cfdcf6; }

.sahel-map .region:hover {
  fill: var(--blue);
  fill-opacity: 0.35;
}

.sahel-map .country-label {
  font: 700 14px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  fill: var(--navy);
}

.sahel-map .capital {
  fill: var(--red);
  stroke: #ffffff;
  stroke-width: 1.5;
}

.sahel-map .capital-label {
  font: 11px -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  fill: var(--ink);
}

.home-countries {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  margin: var(--s2) 0 0;
}

.public .home-counters {
  grid-template-columns: repeat(7, 1fr);
}

.home-shelves {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s4);
  margin-top: var(--s4);
}

.shelf h2 {
  border-bottom: 0;
  margin-top: 0;
}

.shelf h2 a {
  text-decoration: none;
  color: var(--navy);
}

.shelf h2 a::after {
  content: " →";
  color: var(--blue);
}

.shelf-list li {
  margin-bottom: 6px;
}

.pipe-stages {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--s2);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s1);
}

.pipe-stages li {
  border: 1px solid var(--line);
  border-top: 3px solid var(--control);
  border-radius: 6px;
  padding: var(--s1) var(--s2);
  font-size: 0.85rem;
}

.pipe-stages li:nth-child(2) { border-top-color: var(--blue); }
.pipe-stages li:nth-child(3) { border-top-color: var(--red); }

.pipe-stages li b {
  display: block;
  font-family: var(--serif);
  color: var(--navy);
}

.pipe-stages li span {
  color: var(--muted);
}

/* ---- Data catalogue and dataset pages ---------------------------------------- */

.avail {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--canvas);
}

.avail.ok { border-color: var(--blue); color: var(--blue); }
.avail.warn { border-color: var(--control); background: var(--pale); }
.avail.off { color: var(--red-hover); border-color: var(--red-hover); }

.dataset-family h2 {
  margin-top: var(--s4);
}

.pub table.datasets td,
.pub table.files td {
  vertical-align: middle;
}

.guidance {
  border-left: 3px solid var(--blue);
  padding: var(--s1) var(--s2);
  background: var(--pale);
  font-size: 0.9rem;
  max-width: 72ch;
}

.pub .dataset-meta {
  margin: var(--s2) 0 var(--s3);
}

button.pub-sha {
  font: 12px ui-monospace, SFMono-Regular, Menlo, monospace;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--canvas);
  color: var(--ink);
  cursor: pointer;
}

button.pub-sha:hover {
  border-color: var(--blue);
  color: var(--blue);
}

@media (max-width: 980px) {
  .home-top { grid-template-columns: 1fr; }
  .home-intro h1 { max-width: none; font-size: 2.1rem; }
  .public .home-counters { grid-template-columns: repeat(4, 1fr); }
  .home-shelves { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
  .public .home-counters { grid-template-columns: repeat(2, 1fr); }
  .pipe-stages { grid-template-columns: 1fr; }
}

/* ---- map: the table alternative (Task 7) ------------------------------------ */

.conflict-table-wrap {
  max-width: 1200px;
  margin: var(--s3) auto 0;
  padding: 0 var(--s3);
}

.conflict-table-wrap summary {
  cursor: pointer;
  color: var(--blue);
  font-weight: 600;
  min-height: 44px;
  display: flex;
  align-items: center;
}

table.conflict-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

table.conflict-table td,
table.conflict-table th {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

table.conflict-table td.num,
table.conflict-table th.num {
  text-align: right;
  white-space: nowrap;
}

/* ---- Publications and Releases (Task 11) ------------------------------------ */

.pub-group h2 {
  margin-top: var(--s4);
}

.pub-entry {
  border-bottom: 1px solid var(--line);
  padding: var(--s2) 0 var(--s3);
}

.pub-entry h3 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.pub table.releases tr.planned td {
  color: var(--muted);
}

/* ---- Public status (Task 12) ------------------------------------------------- */

.stage-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--s3);
  margin: var(--s3) 0;
}

.stage-card {
  border: 1px solid var(--line);
  border-top: 4px solid var(--control);
  border-radius: 8px;
  padding: var(--s2) var(--s3);
}

.stage-card.ok { border-top-color: var(--blue); }
.stage-card.warn { border-top-color: var(--control); }
.stage-card.off { border-top-color: var(--red); }

.stage-card h3 {
  margin: 0 0 var(--s1);
}

.stage-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px var(--s2);
  font-size: 0.85rem;
  margin: 0;
}

.stage-facts dt { color: var(--muted); }
.stage-facts dd { margin: 0; }

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