:root {
  --bg: #faf8f5;
  --surface: #ffffff;
  --ink: #1d2330;
  --muted: #595f6b;
  --accent: #906312;   /* #a06e14 read at 4.18:1 as link text (core#122) */
  --accent-dark: #6b4a10;
  --accent-soft: #f6ecd8;
  --line: #e4e0d8;
  --maxw: 920px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 1.25rem; }

/* Header */
.site-header {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
  color: #fff;
  padding: 3rem 0 2.25rem;
}
.site-header h1 { margin: 0 0 .25rem; font-size: 2.1rem; letter-spacing: -.5px; }
.site-header .subtitle { margin: 0 0 1rem; font-size: 1.1rem; opacity: .92; }
.site-header .lead { margin: 0 0 1rem; max-width: 64ch; opacity: .95; }
.site-header .updated { margin: 0; font-size: .85rem; opacity: .8; }
.viz-chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .9rem 0 0; }
.viz-chips a { display: inline-block; background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.35); color: #fff; text-decoration: none; font-size: .82rem; font-weight: 600; padding: .3rem .75rem; border-radius: 999px; white-space: nowrap; }
.viz-chips a:hover { background: rgba(255,255,255,.28); }

/* Nav */
.site-nav { position: sticky; top: 0; z-index: 10; background: #2a2f3a; box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.site-nav .wrap { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .5rem 1.25rem; }
.site-nav a { color: #e8e6e1; text-decoration: none; font-size: .85rem; font-weight: 600; padding: .15rem 0; white-space: nowrap; }
.site-nav a:hover { color: #fff; border-bottom: 2px solid var(--accent); }

/* Sections */
main { padding: 2rem 1.25rem 3rem; }
section { margin: 2.5rem 0; }
h2 {
  font-size: 1.5rem;
  border-bottom: 2px solid var(--accent-soft);
  padding-bottom: .4rem;
  margin-bottom: 1rem;
}
h3 { font-size: 1.1rem; margin: 1.5rem 0 .5rem; }
.section-intro { color: var(--muted); max-width: 70ch; }

/* Notice */
.notice {
  background: var(--accent-soft);
  border-left: 4px solid var(--accent);
  padding: .85rem 1rem;
  border-radius: 4px;
  font-size: .92rem;
}
.notice-attribution { background: #fff7e6; border-left-color: #c47f17; margin-bottom: 1rem; }

/* Facts list */
.facts { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
.facts dt { font-weight: 600; color: var(--accent); }
.facts dd { margin: 0; }

/* Chronology table */
.table-scroll { overflow-x: auto; }
table.meetings { width: 100%; border-collapse: collapse; font-size: .92rem; background: var(--surface); }
table.meetings th, table.meetings td { text-align: left; padding: .55rem .65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.meetings thead th { background: #2a2f3a; color: #fff; position: sticky; top: 0; }
table.meetings tbody tr:nth-child(even) { background: #fbfaf8; }
tr.decade-row th { background: var(--accent-soft); color: var(--accent-dark); font-variant: small-caps; letter-spacing: .06em; }
td.year { font-weight: 700; white-space: nowrap; }
.muted { color: var(--muted); }
.flag { color: var(--accent); font-weight: 700; cursor: help; }

/* Card grids (figures, organizations, disambiguation) */
.party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.party-card { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 1rem; }
.party-card h3 { margin: 0 0 .35rem; font-size: 1.02rem; }
.party-card .country { margin: 0 0 .5rem; font-size: .9rem; color: var(--muted); }
.party-card .figures, .party-card .party-notes { margin: .35rem 0 0; font-size: .85rem; color: var(--muted); }

.related-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 1rem; }
.related-card h3 { margin: 0 0 .25rem; font-size: 1.05rem; }
.related-card p { margin: .4rem 0; font-size: .9rem; }
.related-meta { color: var(--muted); font-size: .82rem !important; }
.related-link a { color: var(--accent); font-size: .82rem; word-break: break-all; }

.cp-card { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid #c47f17; border-radius: 6px; padding: 1rem; }
.cp-card h3 { margin: 0 0 .25rem; font-size: 1.02rem; }
.cp-card p { margin: .4rem 0; font-size: .9rem; }

/* Citations */
sup.cite { font-size: .68rem; line-height: 0; margin-left: .12rem; }
sup.cite a { color: var(--accent); text-decoration: none; font-weight: 700; }
sup.cite a:hover { text-decoration: underline; }
ol.references li:target { background: var(--accent-soft); border-radius: 4px; padding: .2rem .35rem; }

/* References */
ol.references { padding-left: 1.25rem; }
ol.references li { margin-bottom: .6rem; }
ol.references a { color: var(--accent); text-decoration: none; font-weight: 600; }
ol.references a:hover { text-decoration: underline; }
.ref-meta { display: block; color: var(--muted); font-size: .8rem; }
.archive-link { color: var(--muted); font-weight: 600; text-decoration: none; }
.archive-link:hover { color: var(--accent); text-decoration: underline; }

/* Footer */
.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: .85rem; }
.site-footer code { background: #efece6; padding: .1rem .35rem; border-radius: 3px; }

@media (max-width: 560px) {
  .site-header { padding: 1.4rem 0 1.1rem; }
  .site-header h1 { font-size: 1.5rem; }
  .site-header .subtitle { font-size: .95rem; margin-bottom: .5rem; }
  .site-header .lead { display: none; }
  .site-header .updated { font-size: .78rem; }
  .site-nav .wrap { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; gap: 1rem; padding: .55rem 1rem; }
  .site-nav .wrap::-webkit-scrollbar { display: none; }
  .site-nav a { font-size: .82rem; }
  .facts { grid-template-columns: 1fr; gap: .1rem; }
  .facts dt { margin-top: .5rem; }
}

/* Glossary */
.index { display: flex; flex-wrap: wrap; gap: .35rem .9rem; margin: 1.25rem 0 2rem; font-size: .9rem; }
.index a { color: var(--accent); text-decoration: none; font-weight: 600; }
.index a:hover { text-decoration: underline; }
.term { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 6px; padding: 1rem 1.2rem; margin: 0 0 1rem; }
.term h3 { margin: 0 0 .2rem; font-size: 1.1rem; }
.term .anchor { color: var(--muted); text-decoration: none; margin-right: .4rem; font-weight: 400; }
.term .anchor:hover { color: var(--accent); }
.term:target { border-left-color: var(--accent-dark); background: var(--accent-soft); }
.variants { margin: 0 0 .4rem; font-size: .82rem; color: var(--muted); font-style: italic; }
.def { margin: 0 0 .5rem; max-width: 75ch; }
.term .meta { margin: 0; font-size: .8rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; }
.proj { font-weight: 700; text-decoration: none; border: 1px solid var(--line); border-radius: 999px; padding: .05rem .55rem; }
.proj-fsp { color: #b8252b; } .proj-fsspx { color: #1e4f8f; } .proj-tl { color: #1b7a3d; }
.rel a { color: var(--accent); }

/* Dedicated term pages */
.term-link { color: var(--ink); text-decoration: none; }
.term-link:hover { color: var(--accent); text-decoration: underline; }
.term-meta { font-size: .85rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: .3rem .8rem; align-items: center; margin-top: 1rem; }

/* Language switcher (i18n) — adopted verbatim from the cronologia/core template */
.lang-switch { float: right; display: flex; gap: .35rem; align-items: center; font-size: .8rem; font-weight: 700; }
.lang-switch a { color: var(--muted); text-decoration: none; padding: .1rem .3rem; border-radius: 3px; }
.lang-switch a:hover { color: var(--accent); background: var(--accent-soft); }
.lang-switch .lang-current { color: var(--accent-dark); background: var(--accent-soft); padding: .1rem .3rem; border-radius: 3px; }

/* Machine-translation disclaimer (non-English pages) */
.i18n-disclaimer {
  background: #fff8e6; border-bottom: 1px solid #f0e2b8; color: #6b5a17;
  font-size: .82rem; text-align: center; padding: .45rem 1rem;
}

/* ---------------------------------------------------------------------------
   Glossary dark rules (core#122): what the shared dark block cannot know -
   the term pages' plain links and the per-project chips' own colours.
   --------------------------------------------------------------------------- */
@media screen and (prefers-color-scheme: dark) {
  main a:not(.proj):not(.archive-link) { color: color-mix(in srgb, var(--accent) 45%, #fff); }
  .proj-fsp { color: #f08a8e; } .proj-fsspx { color: #8ab4ec; } .proj-tl { color: #6fcf8f; }
}

/* ---------------------------------------------------------------------------
   Dark mode (core#113): follows the reader's system setting; the light page
   is untouched. A self-contained block, appended last, so it layers over any
   site's copy of the stylesheet: it redefines the base tokens and restates
   only the rules that hard-code a light colour. The site accent is a dark
   hue, so wherever it is TEXT it is lifted to --accent-hi; where it is a fill
   it stays the accent. Screen only: print keeps the light page.
   --------------------------------------------------------------------------- */
@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121418; --surface: #1a1d23; --ink: #e4e6ea; --muted: #9ba2ae; --line: #2d313a;
    --accent-hi: color-mix(in srgb, var(--accent) 45%, #ffffff);
    --accent-soft: color-mix(in srgb, var(--accent) 26%, #1a1d23);
    --accent-dark: var(--accent-hi);
    --card: var(--surface);
  }
  .site-header { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, #000000), var(--accent)); }
  .site-nav { background: #0d0f13; box-shadow: 0 1px 0 var(--line); }
  a { color: var(--accent-hi); }
  .site-nav a { color: #e8e6e1; }
  .facts dt, .flag, .related-link a, sup.cite a, ol.references a, .archive-link:hover,
  .lang-switch a:hover, .lang-switch .lang-current, .party-link a { color: var(--accent-hi); }
  .glossary-link { color: var(--accent-hi); border-bottom-color: var(--accent-hi); }
  .notice-attribution { background: #2a2416; }
  .i18n-disclaimer { background: #2a2416; border-bottom-color: #4a3d1f; color: #e3cf8f; }
  table.meetings thead th { background: #0d0f13; }
  table.meetings tbody tr:nth-child(even) { background: #16191e; }
  .site-footer code { background: #262a31; }
  .lineage-branch.lineage-separate { background: #211d14; }
  .lineage-separate .tree-status { color: #e7c58a; background: #3a2f18; }
  .tree-edge-label { background: #23262d; }
  .nc-track { background: #262a31; }
  .latam-bg { fill: #2a2e36; stroke: #121418; }
  .latam-c { fill: #353a44; stroke: #121418; }
  .latam-c.map-t1, .atlas-swatch.map-t1 { fill: color-mix(in srgb, var(--accent) 70%, #2a2e36); background: color-mix(in srgb, var(--accent) 70%, #2a2e36); }
  .latam-c.map-t2, .atlas-swatch.map-t2 { fill: color-mix(in srgb, var(--accent) 45%, #2a2e36); background: color-mix(in srgb, var(--accent) 45%, #2a2e36); }
  .latam-c.map-t3, .atlas-swatch.map-t3 { fill: color-mix(in srgb, var(--accent) 25%, #2a2e36); background: color-mix(in srgb, var(--accent) 25%, #2a2e36); }
  .atlas-swatch { background: #353a44; }
  .sw-has-unverified { background-image: repeating-linear-gradient(45deg, rgba(18,20,24,.55) 0 3px, transparent 3px 6px); }
  .al-tab[aria-selected="true"] { color: #121418; }
  .al-favourable .al-node-status, .al-favourable .al-status { color: #7fd1a0; }
  .al-negative .al-node-status, .al-negative .al-status { color: #f0a0ab; }
  .al-inconclusive .al-node-status, .al-inconclusive .al-status,
  .al-reported-undocumented .al-node-status, .al-reported-undocumented .al-status { color: #e3c77a; }
  .al-pending .al-node-status, .al-pending .al-status { color: #8cc8e6; }
  .al-adjacent .al-node-status, .al-adjacent .al-status { color: #c3a9e8; }
  .rv-l0 { --c: var(--accent-hi); }
  .rv-lanes .rv-l0 { --c: #9d93ff; }
  /* The light scheme's solid heat steps would sink into the dark page; the
     translucent steps keep the scale reading dark-to-bright. */
  .sw-i3 { background: color-mix(in srgb, var(--accent) 46%, transparent); }
  .sw-i4 { background: color-mix(in srgb, var(--accent) 64%, transparent); }
  .rv-span .rv-ct { background: var(--accent-hi); }
  .rv-span .rv-cr { border-color: var(--accent-hi); background: color-mix(in srgb, var(--accent-hi) 35%, transparent); }
  .rv-span b { border-color: var(--accent-hi); }
  .rv-l1 { --c: #4fc4b5; } .rv-l2 { --c: #e3a24f; } .rv-l3 { --c: #f07aa8; }
  .rv-l4 { --c: #6fb4e8; } .rv-l5 { --c: #a8c25a; } .rv-l6 { --c: #d49a7e; } .rv-l7 { --c: #a3adbb; }
  .rv-win { fill: var(--accent-hi); stroke: var(--accent-hi); }
}
