/* Palette & type match TaleBricks_Africa_Style_Guide.html exactly, so the
   real app renders consistently with the approved Stage 4 design system. */
:root {
  --bg: #FAF6F0;
  --surface: #FFFFFF;
  --surface-2: #F2EFE9;
  --text: #2B2118;
  --text-2: #6B5D4F;
  --terracotta: #C7742D;
  --terracotta-text: #7A4419;
  --green: #1F3B2C;
  --green-text: #1F3B2C;
  --border: #E0D5C7;
  --map-outline: #4A2612;
}
[data-theme="dark"] {
  --bg: #1A1512;
  --surface: #241D18;
  --surface-2: #2C241D;
  --text: #F5EDE3;
  --text-2: #C2B4A3;
  --terracotta: #E08A44;
  --terracotta-text: #E08A44;
  --green: #4A7A5E;
  --green-text: #8FBFA4;
  --border: #3A2F27;
  /* Same hue family as the light-mode outline, lightened for contrast
     against the dark background: 6.8:1 vs --bg (#1A1512), well past the
     WCAG 1.4.11 graphical-object minimum of 3:1 (was 1.36:1 at the old
     fixed #4A2612). Reuses the dark theme's own --terracotta value rather
     than a one-off color. */
  --map-outline: #E08A44;
}
* { box-sizing: border-box; }
body {
  font-family: 'Work Sans', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
}
h1, h2, h3 { font-family: 'Fraunces', Georgia, serif; font-weight: 600; margin: 0 0 8px; }
a { color: var(--terracotta-text); }

.site-header {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.logo { display: inline-flex; align-items: center; gap: 8px; font-family: 'Fraunces', serif; font-weight: 600; font-size: 18px; color: var(--terracotta-text); text-decoration: none; }
.logo-mark { display: block; flex-shrink: 0; }
.logo-word-africa { color: var(--text-2); }
.search-form { position: relative; flex: 1; min-width: 200px; }
.search-input {
  width: 100%; padding: 8px 12px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: inherit;
}
.search-results {
  position: absolute; top: 40px; left: 0; right: 0; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; display: none; z-index: 10;
  max-height: 320px; overflow-y: auto;
}
.search-results.open { display: block; }
.search-results a { display: block; padding: 8px 12px; text-decoration: none; color: var(--text); }
.search-results a:hover { background: var(--surface-2); }

.site-nav { display: flex; align-items: center; gap: 14px; font-size: 14px; }
.site-nav a { text-decoration: none; color: var(--text-2); }
.user-chip { color: var(--green-text); font-weight: 500; }
.inline-form { display: inline; }
.inline-form button, #themeBtn, .site-nav button {
  font-family: inherit; background: none; border: 1px solid var(--border); border-radius: 16px;
  padding: 4px 10px; cursor: pointer; color: var(--text);
}

.content { max-width: 900px; margin: 0 auto; padding: 28px 20px 60px; }
.site-footer {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; color: var(--text-2); font-size: 13px;
}
.footer-logo-mark { display: block; flex-shrink: 0; opacity: 0.85; }

.front-hero { text-align: center; }
.front-tagline { color: var(--text-2); margin-bottom: 12px; }
.africa-map { width: 100%; max-width: 420px; height: auto; overflow: visible; }
.africa-continent { stroke: var(--map-outline); stroke-width: 1.4; stroke-linejoin: round; }
[data-theme="dark"] .africa-continent { stroke-width: 1.7; }
.mvp-country { fill: #FFD24C; stroke: #3B2412; stroke-width: 1.2; cursor: pointer; transition: filter .15s, transform .15s; transform-origin: center; }
.mvp-country:hover { filter: brightness(1.14) saturate(1.1); transform: scale(1.03); }
.country-label { font-family: 'Work Sans', sans-serif; font-weight: 600; font-size: 13px; fill: #2B2118; paint-order: stroke; stroke: #FAF6F0; stroke-width: 3px; }
.country-dot { fill: #3B2412; pointer-events: none; }

.pill-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.pill {
  font-size: 13px; padding: 7px 16px; border-radius: 16px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-2); text-decoration: none;
}
.pill.active { background: var(--terracotta); color: #fff; border-color: var(--terracotta); }

.content-card {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 14px 16px; margin-bottom: 10px; text-decoration: none; color: var(--text);
}
.content-card:hover { border-color: var(--terracotta); }

.attribution { font-size: 13px; color: var(--text-2); border-top: 1px solid var(--border); padding-top: 10px; }
.section-divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.body-text { line-height: 1.6; }
.body-text p { margin: 0 0 14px; }
.body-text a.autolink { text-decoration-style: dotted; }
.dates { color: var(--text-2); font-size: 14px; }
.breadcrumb { font-size: 13px; color: var(--text-2); margin-bottom: 4px; }
.plain-list { list-style: none; padding: 0; }
.plain-list li { border-top: 1px solid var(--border); padding: 8px 0; }
.plain-list li:first-child { border-top: none; }

.comments { margin-top: 32px; }
.comment-list { list-style: none; padding: 0; }
.comment-list li { border-top: 1px solid var(--border); padding: 10px 0; }
.comment-list .meta { color: var(--text-2); font-size: 12px; }
#commentForm textarea { width: 100%; min-height: 70px; font-family: inherit; padding: 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); }
#commentForm button, .btn-social, .signin-panel button {
  font-family: inherit; font-size: 14px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--terracotta); background: var(--terracotta); color: #fff; margin-top: 8px;
}
.signin-prompt { color: var(--text-2); }

.signin-panel { max-width: 360px; margin: 0 auto; text-align: center; }
.btn-social { display: block; margin: 8px 0; padding: 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text); text-decoration: none; }
.divider { margin: 16px 0; color: var(--text-2); }
.signin-panel input { width: 100%; padding: 9px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font-family: inherit; margin-bottom: 8px; }

.feed-card, .timeline-list li { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.timeline-list { list-style: none; padding: 0; }
.hint { color: var(--text-2); }

.curator-list { list-style: none; padding: 0; }
.curator-type-badge { display: inline-block; margin-bottom: 6px; cursor: default; }
.btn-curator-action {
  font-family: inherit; font-size: 14px; padding: 9px 16px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--terracotta); background: var(--terracotta); color: #fff; margin-top: 8px;
}
.btn-curator-action:disabled { opacity: 0.6; cursor: default; }

/* ============================================================
   Responsive breakpoints — Stage 7
   Reference widths per TaleBricks_Africa_Test_Plan.md §1:
   Mobile ≤767px · Tablet 768–1023px · Desktop ≥1024px.
   Structure follows the Stage 3 wireframes (TaleBricks_Africa_Wireframes.html)
   and Stage 4 mockups (TaleBricks_Africa_Screen_Mockups.html): the map
   scales up as the primary navigation surface on larger screens, tabs
   scroll horizontally on touch-primary widths, and the Daily Feed grid
   goes 1 → 2 → 3 columns from mobile to desktop.
   ============================================================ */

/* Touch-target sizing — Mobile and Tablet are both touch-primary per the
   Stage 3 wireframes. WCAG 2.5.5 minimum target size is 44x44px. */
@media (max-width: 1023px) {
  .pill-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 4px; }
  .pill { flex: 0 0 auto; display: flex; align-items: center; justify-content: center; min-height: 44px; }
  #commentForm button, .btn-social, .signin-panel button,
  .inline-form button, #themeBtn, .site-nav button, .search-input,
  .btn-curator-action {
    min-height: 44px;
  }
}

/* Mobile (≤767px) */
@media (max-width: 767px) {
  .site-header { padding: 10px 14px; gap: 10px; }
  .logo { font-size: 16px; gap: 6px; }
  .logo-mark { width: 28px; height: 28px; }
  .site-nav { gap: 8px; font-size: 13px; }
  .content { padding: 18px 14px 40px; }
  .africa-map { max-width: 340px; }
  .feed-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
}

/* Tablet (768–1023px) */
@media (min-width: 768px) and (max-width: 1023px) {
  .africa-map { max-width: 480px; }
  .feed-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
}

/* Desktop (≥1024px) — the map is called out in the Workflow Guide and PRD
   as the single most important interaction in the app and is meant to
   dominate the viewport, so it gets more room than the shared content
   column would give it by default. */
@media (min-width: 1024px) {
  .content { padding: 36px 24px 72px; }
  .site-header { padding: 16px 32px; }
  .africa-map { max-width: 640px; }
  .feed-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

/* ============================================================
   Shared helpers
   ============================================================ */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 0; background: var(--surface); padding: 8px 12px; z-index: 50; }
.skip-link:focus { left: 8px; top: 8px; }
.site-footer { flex-direction: column; gap: 6px; text-align: center; }
.site-footer p { margin: 0; max-width: 900px; }
.footer-credit { display: flex; align-items: center; justify-content: center; gap: 8px; color: var(--text); }
.footer-licence { font-size: 12px; line-height: 1.5; }
.wiki-credit { font-size: 13px; color: var(--text-2); line-height: 1.5; border-top: 1px solid var(--border); padding-top: 8px; margin-top: 10px; }
.wiki-updated { white-space: nowrap; }
.media-credit { font-size: 12px; color: var(--text-2); }

/* ============================================================
   Front page — interactive map of Africa (front-page spec §1–§5)
   Colours follow the Wikipedia map in the brief; the label blue and water
   teal are a shade darker than Wikipedia's #3366CC / teal so the text passes
   WCAG AA (4.5:1) on the grey land fill and the white sea.
   ============================================================ */
:root {
  --map-sea: #FFFFFF;
  --map-land: #D3D3D3;
  --map-border: #5E5E5E;
  --map-label: #24529E;      /* 5.05:1 on #D3D3D3, 7.6:1 on white */
  --map-water: #1E7374;      /* 5.6:1 on white */
  --map-hot: #C7742D;        /* TaleBricks terracotta (brand accent) */
  --map-hot-label: #2B2118;  /* 4.5:1 on terracotta */
}
.africa-layout {
  max-width: 1440px; margin: 0 auto; padding: 20px 24px 56px;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "map" "side" "list"; gap: 12px 32px;
}
.africa-sidebar { grid-area: side; }
.africa-map-section { grid-area: map; min-width: 0; }
.states-list { grid-area: list; min-width: 0; }
.region-accordions { grid-area: list; display: none; }
.africa-map-section h1 { font-size: 28px; margin-bottom: 4px; }
.lead { color: var(--text-2); margin: 0 0 12px; max-width: 760px; line-height: 1.5; }

.toc { display: none; }
.toc-title { font-family: 'Work Sans', sans-serif; font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.toc li a { display: block; padding: 6px 0; color: var(--map-label); text-decoration: none; font-size: 15px; }
[data-theme="dark"] .toc li a { color: #9DB8F0; }
.toc li a:hover { text-decoration: underline; }
.toc-count { color: var(--text-2); font-size: 13px; }

.list-tools { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.tools-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; padding: 0; }
.filter-input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; min-height: 44px; }
.region-filter { border: 0; margin: 12px 0 0; padding: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font: inherit; font-size: 13px; padding: 6px 12px; min-height: 36px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; }
.chip.is-on { background: var(--terracotta-text); border-color: var(--terracotta-text); color: #fff; }
[data-theme="dark"] .chip.is-on { background: var(--terracotta); border-color: var(--terracotta); color: #1A1512; }
.filter-status { margin: 10px 0 0; font-size: 13px; color: var(--text-2); }

.map-frame { position: relative; margin: 0 auto; max-width: 1040px; background: var(--map-sea); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.africa-svg { display: block; width: 100%; height: auto; max-height: calc(100vh - 140px); min-height: 320px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.africa-svg.is-zoomed { touch-action: none; }
.africa-svg .shapes path { fill: var(--map-land); stroke: var(--map-border); stroke-width: calc(0.7px / var(--z, 1)); stroke-linejoin: round; vector-effect: non-scaling-stroke; transition: fill .12s; }
.africa-svg a.ent { cursor: pointer; outline: none; }
.africa-svg a.ent.is-disputed path { fill: url(#hatch); stroke-dasharray: 4 2; }
.africa-svg .hatch-bg { fill: #E2E2E2; }
.africa-svg .hatch-line { stroke: #9A9A9A; stroke-width: 1.6; }
.africa-svg .marker { fill: var(--map-label); stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.africa-svg .marker-hit { fill: transparent; }
.africa-svg a.ent.is-hot path, .africa-svg a.ent:focus-visible path { fill: var(--map-hot); stroke: #5A2E0F; }
.africa-svg a.ent.is-hot .marker, .africa-svg a.ent:focus-visible .marker { fill: var(--map-hot); r: 6; }
.africa-svg a.ent:focus-visible path, .africa-svg a.ent:focus-visible .marker { stroke: #2B2118; stroke-width: 2.5; }
.africa-svg .labels text { font-family: 'Work Sans', Arial, sans-serif; font-size: 14px; fill: var(--map-label); pointer-events: auto; }
.africa-svg .labels a { cursor: pointer; }
.africa-svg .labels a.is-hot text { fill: var(--map-hot-label); font-weight: 600; }
.africa-svg .labels a.lbl-marker.is-hot text { fill: #7A4419; }
.africa-svg .leader { stroke: var(--map-label); stroke-width: 0.8; }
.africa-svg .water-labels text { font-family: 'Work Sans', Arial, sans-serif; font-style: italic; font-size: 15px; fill: var(--map-water); }
.africa-svg .scale-bar line { stroke: #2B2118; stroke-width: 1.2; }
.africa-svg .scale-bar .sb-text { font: 600 11px 'Work Sans', Arial, sans-serif; fill: #2B2118; }
.africa-svg .is-dim { opacity: .25; }
.africa-svg .labels .is-dim { opacity: .2; }

.map-controls { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 3; }
.map-controls button { width: 40px; height: 40px; border-radius: 8px; border: 1px solid #BDBDBD; background: #fff; color: #2B2118; font-size: 20px; line-height: 1; cursor: pointer; }
.map-controls button:focus-visible { outline: 3px solid var(--map-hot); }
.map-tooltip { position: absolute; z-index: 4; max-width: 260px; padding: 10px 12px; border-radius: 10px; background: #2B2118; color: #FAF6F0; font-size: 14px; line-height: 1.4; box-shadow: 0 6px 18px rgba(0,0,0,.25); pointer-events: none; }
.map-tooltip strong { display: block; font-size: 15px; }
.map-tooltip span { display: block; }
.map-tooltip .tt-note { color: #E8C9A6; font-size: 13px; margin-top: 2px; }
.map-tooltip .tt-go { display: inline-block; margin-top: 8px; padding: 8px 14px; border-radius: 8px; background: var(--map-hot); color: #1A1512; font-weight: 600; text-decoration: none; pointer-events: auto; min-height: 36px; }
.map-tooltip .tt-go[hidden] { display: none; }
.map-caption { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 10px; border-top: 1px solid #E5E5E5; background: #FAFAFA; color: #4D4D4D; font-size: 12.5px; }
.key-hatch { display: inline-block; width: 14px; height: 10px; vertical-align: -1px; background: repeating-linear-gradient(45deg, #E2E2E2 0 3px, #9A9A9A 3px 4.5px); border: 1px dashed #5E5E5E; }

.state-group { margin-top: 22px; }
.state-group h2 { font-size: 22px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.group-count { color: var(--text-2); font-family: 'Work Sans', sans-serif; font-size: 16px; font-weight: 400; }
.group-blurb { color: var(--text-2); font-size: 14px; margin: 4px 0 10px; }
.state-columns { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 24px; }
.state-columns li { break-inside: avoid; padding: 5px 6px; border-radius: 6px; font-size: 15px; }
.state-columns li.is-hot, .region-acc li.is-hot { background: #F6E3D2; }
[data-theme="dark"] .state-columns li.is-hot, [data-theme="dark"] .region-acc li.is-hot { background: #3A2A1E; }
.state-columns a, .region-acc a { color: var(--map-label); text-decoration: none; }
[data-theme="dark"] .state-columns a, [data-theme="dark"] .region-acc a { color: #9DB8F0; }
.state-columns a:hover, .state-columns a:focus-visible, .region-acc a:hover { text-decoration: underline; }
.asterisk { margin-left: 1px; }
.ruler { color: var(--text-2); font-size: 13px; }
.badge-disputed { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; border: 1px dashed var(--text-2); color: var(--text-2); margin-left: 4px; }
.empty-filter { color: var(--text-2); }

.region-acc { border: 1px solid var(--border); border-radius: 10px; background: var(--surface); margin-bottom: 8px; }
.region-acc summary { list-style: none; cursor: pointer; padding: 12px 14px; min-height: 48px; display: flex; align-items: center; justify-content: space-between; font-weight: 600; }
.region-acc summary::-webkit-details-marker { display: none; }
.region-acc summary::after { content: "▾"; color: var(--text-2); margin-left: 8px; }
.region-acc[open] summary::after { content: "▴"; }
.acc-count { margin-left: auto; color: var(--text-2); font-weight: 400; font-size: 14px; }
.region-acc ul { list-style: none; margin: 0; padding: 0 8px 10px; }
.region-acc li { padding: 0; border-radius: 6px; }
.region-acc li a { display: inline-block; padding: 10px 6px; min-height: 44px; }

/* Mobile ≤767: map full width, list as region accordions, minor labels
   appear once the map is zoomed in */
@media (max-width: 767px) {
  .africa-layout { padding: 12px 12px 40px; }
  .africa-map-section h1 { font-size: 22px; }
  .lead { font-size: 14px; }
  .map-frame { margin: 0 -12px; border-radius: 0; border-left: 0; border-right: 0; }
  .africa-svg .labels text { font-size: 20px; }
  .africa-svg .labels .lbl-minor, .africa-svg .labels .lbl-marker { display: none; }
  .africa-svg.is-zoomed .labels .lbl-minor, .africa-svg.is-zoomed .labels .lbl-marker { display: inline; }
  .africa-svg.is-zoomed .labels text { font-size: calc(20px / var(--z, 1) * 1.6); }
  .africa-svg .water-labels text { font-size: 20px; }
  .africa-svg .marker { r: 6; }
  .africa-svg .scale-bar { transform: translate(40px, 900px) scale(1.5); }
  .states-list { display: none; }
  .region-accordions { display: block; }
}
/* Tablet 768–1023: map full width, list in two columns */
@media (min-width: 768px) and (max-width: 1023px) {
  .africa-svg .labels text { font-size: 15px; }
  .africa-svg .labels .lbl-marker text { font-size: 13px; }
  .list-tools { display: grid; grid-template-columns: 1fr 1.4fr; gap: 0 18px; align-items: end; }
  .region-filter { margin: 0; }
  .filter-status { grid-column: 1 / -1; }
}
/* Desktop ≥1024: sticky contents sidebar beside a large, centred map */
@media (min-width: 1024px) {
  .africa-layout { grid-template-columns: 240px minmax(0, 1fr); grid-template-areas: "side map" "side list"; }
  .africa-sidebar { align-self: start; position: sticky; top: 16px; }
  .toc { display: block; margin-bottom: 16px; }
  .state-columns { columns: 3; }
}
@media (min-width: 1280px) { .state-columns { columns: 4; } }

/* ============================================================
   Country / territory pages
   ============================================================ */
.country-page { max-width: 1100px; }
.country-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; }
.country-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.country-title h1 { font-size: 34px; margin: 0; }
.flag-figure { margin: 0; }
.flag-figure img { display: block; height: 52px; width: auto; border: 1px solid var(--border); background: #fff; }
.flag-figure figcaption { margin-top: 4px; max-width: 360px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 14px 0 0; font-size: 15px; }
.facts dt { color: var(--text-2); }
.facts dd { margin: 0; }
.status-note { background: var(--surface); border: 1px dashed var(--text-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin: 12px 0 0; }
.locator { margin: 0; background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 8px; }
.locator-map { display: block; width: 100%; max-width: 260px; height: auto; margin: 0 auto; }
.locator-map path { fill: #DADADA; stroke: #8A8A8A; stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.locator-map path.loc-focus { fill: var(--map-hot); stroke: #5A2E0F; }
.locator-map .loc-ring { fill: none; stroke: var(--map-hot); stroke-width: 4; }
.locator-map .loc-dot { fill: var(--map-hot); stroke: #5A2E0F; stroke-width: 2; }
.locator figcaption { text-align: center; font-size: 12px; color: #4D4D4D; }
.summary-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; margin-top: 22px; }
.summary-card h2 { font-size: 20px; }
.summary-thumb { float: right; margin: 0 0 10px 16px; max-width: 220px; }
.summary-thumb img { width: 100%; height: auto; border-radius: 8px; display: block; }
.summary-thumb figcaption { margin-top: 4px; }
.summary-extract { line-height: 1.65; }
.summary-card::after { content: ""; display: block; clear: both; }
.read-more { display: inline-block; margin-top: 4px; font-weight: 600; }
.tabs { margin-top: 28px; }
.tab-list { display: flex; gap: 8px; border-bottom: 1px solid var(--border); }
.tab-list button { font: inherit; font-weight: 600; font-size: 16px; padding: 10px 18px; min-height: 44px; border: 1px solid var(--border); border-bottom: 0; border-radius: 10px 10px 0 0; background: var(--surface-2); color: var(--text-2); cursor: pointer; margin-bottom: -1px; }
.tab-list button[aria-selected="true"] { background: var(--surface); color: var(--text); border-bottom: 1px solid var(--surface); }
.tab-panel { padding: 16px 0; }
.tab-panel[hidden] { display: none; }
.lead-article { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 16px; }
.lead-article h3 { font-size: 18px; }
.lead-article::after { content: ""; display: block; clear: both; }
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.category-card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.category-card h3 { font-family: 'Work Sans', sans-serif; font-size: 15px; font-weight: 600; margin: 0 0 6px; }
.category-card ul { margin: 0; padding-left: 18px; }
.category-card li { margin: 3px 0; }
.coming-soon { color: var(--text-2); font-size: 14px; margin: 0; }
.coming-soon-banner { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; color: var(--text-2); margin: 16px 0 0; }
@media (min-width: 768px) {
  .country-head { grid-template-columns: minmax(0, 1fr) 260px; align-items: start; }
}
@media (max-width: 767px) {
  .country-title h1 { font-size: 26px; }
  .summary-thumb { float: none; margin: 0 0 10px; max-width: 100%; }
}

/* About / error pages */
.prose { max-width: 760px; line-height: 1.6; }
.prose h2 { margin-top: 26px; }
.error-page { text-align: center; padding: 40px 0; }
.error-page .big { font-family: 'Fraunces', serif; font-size: 64px; color: var(--terracotta-text); margin: 0; }
.btn-primary { display: inline-block; padding: 10px 18px; border-radius: 8px; background: var(--terracotta-text); color: #fff; text-decoration: none; font-weight: 600; min-height: 44px; }
[data-theme="dark"] .btn-primary { color: #1b1410; }
.sync-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.sync-table th, .sync-table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }

/* ============================================================
   Full Wikipedia articles (front-page "Africa", /wiki/ pages)
   TaleBricks typography and palette — deliberately not Wikipedia's look.
   ============================================================ */
.africa-layout { grid-template-areas: "map" "side" "list" "article"; }
.africa-article { grid-area: article; min-width: 0; margin-top: 36px; }
.africa-article-title { font-size: 34px; margin: 0 0 4px; padding-top: 20px; border-top: 3px solid var(--terracotta); }
.art-desc { color: var(--text-2); margin: 0 0 12px; font-size: 17px; }
.sidebar-article-toc { display: none; }
@media (min-width: 1024px) {
  .africa-layout { grid-template-areas: "side map" "side list" "side article"; }
  .africa-sidebar .sidebar-inner { max-height: calc(100vh - 32px); overflow-y: auto; padding-right: 4px; }
  .sidebar-article-toc { display: block; margin-top: 18px; }
}
.wp-attribution { background: var(--surface); border: 1px solid var(--border); border-left: 4px solid var(--green); border-radius: 10px;
  padding: 10px 14px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); margin: 14px 0; }
.wp-attribution p { margin: 0; }
.wp-attribution a { color: var(--green-text); }

.art-toc ol { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--border); }
.art-toc li a { display: block; padding: 5px 6px; color: var(--map-label); text-decoration: none; font-size: 14px; border-radius: 6px; }
[data-theme="dark"] .art-toc li a { color: #9DB8F0; }
.art-toc li.toc-l3 a { padding-left: 18px; font-size: 13px; color: var(--text-2); }
.art-toc li a:hover, .art-toc li a:focus-visible { background: var(--surface-2); text-decoration: underline; }
.art-toc li a.is-current { background: #F6E3D2; color: var(--terracotta-text); font-weight: 600; }
[data-theme="dark"] .art-toc li a.is-current { background: #3A2A1E; color: var(--terracotta); }

.art-body { font-size: 16.5px; line-height: 1.7; color: var(--text); max-width: 1000px; }
.art-body p { margin: 0 0 14px; }
.art-body a { color: var(--terracotta-text); text-decoration-thickness: 1px; text-underline-offset: 2px; }
.art-body a[data-tb-link="country"] { font-weight: 600; }
.art-body a[data-tb-link="external"] { color: var(--text-2); }
.art-body .tb-ext-icon { font-size: 0.75em; margin-left: 2px; vertical-align: super; text-decoration: none; display: inline-block; }
.art-body .tb-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.art-body h3 { font-size: 21px; margin: 26px 0 8px; }
.art-body h4 { font-family: 'Work Sans', sans-serif; font-size: 17px; font-weight: 600; margin: 20px 0 6px; }
.art-body ul, .art-body ol { padding-left: 24px; margin: 0 0 14px; }
.art-body blockquote { border-left: 3px solid var(--terracotta); margin: 14px 0; padding: 4px 16px; color: var(--text-2); }
.art-body img { max-width: 100%; height: auto; }
.art-sec { border-top: 1px solid var(--border); margin-top: 22px; }
.art-h2 { margin: 18px 0 10px; font-size: 26px; }
.art-toggle { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: default; width: 100%; }
.art-loading { color: var(--text-2); font-style: italic; }
.tb-hatnote { font-style: italic; color: var(--text-2); padding-left: 14px; margin-bottom: 10px; }
.tb-figure { margin: 6px 0 16px 20px; float: right; clear: right; max-width: min(320px, 45%); background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; padding: 8px; font-size: 13.5px; line-height: 1.45; }
.tb-figure img { display: block; margin: 0 auto 6px; border-radius: 6px; }
.tb-figure figcaption { color: var(--text-2); }
.tb-credit { display: block; margin-top: 4px; font-size: 12px; }
.art-sec-body::after, .art-lead::after { content: ""; display: block; clear: both; }
.tb-infobox { float: right; clear: right; margin: 0 0 16px 20px; max-width: 340px; font-size: 13.5px; line-height: 1.45;
  border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.tb-infobox th, .tb-infobox td { padding: 5px 8px; border-top: 1px solid var(--border); vertical-align: top; text-align: left; }
.tb-infobox-title, .tb-infobox caption { font-family: 'Fraunces', serif; font-size: 18px; padding: 8px; text-align: center; }
.tb-table-scroll { overflow-x: auto; max-width: 100%; margin: 0 0 18px; border-radius: 10px; -webkit-overflow-scrolling: touch; }
.tb-table-scroll:focus-visible { outline: 3px solid var(--terracotta); }
.tb-table-scroll > .tb-infobox { float: none; margin: 0; }
.tb-table { border-collapse: collapse; font-size: 14px; line-height: 1.4; background: var(--surface); min-width: 100%; }
.tb-table caption { font-weight: 600; text-align: left; padding: 6px 0; }
.tb-table th { background: var(--surface-2); text-align: left; }
.tb-table th, .tb-table td { border: 1px solid var(--border); padding: 6px 9px; vertical-align: top; }
.tb-gallery { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; clear: both; }
.tb-gallery-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; font-size: 13px; }
.tb-img-withheld { display: inline-block; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); border: 1px dashed var(--border);
  border-radius: 8px; padding: 6px 9px; margin: 4px 0; line-height: 1.4; }
.tb-mapnote { clear: both; margin: 12px 0 18px; padding: 14px 16px; background: #F6E3D2; border-radius: 12px; font-weight: 600; }
[data-theme="dark"] .tb-mapnote { background: #3A2A1E; }
.tb-mapnote a::before { content: "↑ "; }
.tb-ref { font-size: 0.72em; line-height: 0; }
.tb-ref a { text-decoration: none; }
.tb-refs { font-size: 14px; line-height: 1.5; columns: 2 320px; column-gap: 32px; }
.tb-refs li { break-inside: avoid; margin-bottom: 6px; }
.tb-refs :target, .art-body li:target { background: #F6E3D2; border-radius: 4px; }
[data-theme="dark"] .tb-refs :target, [data-theme="dark"] .art-body li:target { background: #3A2A1E; }
.tb-hlist ul, .tb-plainlist ul { list-style: none; padding: 0; }
.tb-hlist li { display: inline; }
.tb-hlist li:not(:last-child)::after { content: " · "; }
.art-credits { margin: 24px 0; font-size: 13.5px; color: var(--text-2); }
.art-credits summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* /wiki/ pages */
.article-layout { max-width: 1320px; margin: 0 auto; padding: 20px 24px 56px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 32px; }
.art-sidebar { display: none; }
.art-main h1 { font-size: 36px; margin: 6px 0 2px; }
.art-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 12px 0; }
@media (min-width: 1024px) {
  .article-layout { grid-template-columns: 250px minmax(0, 1fr); }
  .art-sidebar { display: block; align-self: start; position: sticky; top: 16px; }
  .art-sidebar .sidebar-inner { max-height: calc(100vh - 32px); overflow-y: auto; }
}
/* Tablet & mobile: collapsible sections, lead open */
@media (max-width: 1023px) {
  .art-toggle { cursor: pointer; display: flex; justify-content: space-between; align-items: center; min-height: 44px; }
  .art-toggle::after { content: "▾"; font-size: 18px; color: var(--text-2); margin-left: 10px; }
  .art-sec.is-collapsed .art-toggle::after { content: "▸"; }
  .art-sec.is-collapsed .art-sec-body { display: none; }
  .art-h2 { font-size: 22px; margin: 8px 0; }
  .art-sec { margin-top: 0; }
}
@media (max-width: 767px) {
  .art-body { font-size: 16px; }
  .tb-figure, .tb-infobox { float: none; margin: 10px 0 16px; max-width: 100%; }
  .tb-infobox { width: 100%; table-layout: fixed; }
  .tb-infobox th, .tb-infobox td { overflow-wrap: anywhere; word-break: break-word; }
  .tb-infobox img, .tb-infobox-image div { max-width: 100% !important; height: auto; }
  .tb-infobox-title > div, .tb-infobox td > div { max-width: 100%; }
  .africa-article-title, .art-main h1 { font-size: 28px; }
  .article-layout { padding: 12px 14px 40px; }
}
