/* ═══════════════════════════════════════════
   GOVERNMENTS — the three interactive tools (world map, power diagrams,
   regime timelines). Ported from the design mockups, restyled with the
   sites' tokens (see governments.css). Scoped: .gvm map · .gvp power ·
   .gvt timeline.
═══════════════════════════════════════════ */

/* ── shared tool bits ── */
.gvm-card, .gvp-card, .gvt-card { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; }
.gvm-btn {
  padding: 8px 14px; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 4px; font-family: var(--f-ui);
  font-size: 14px; font-weight: 500; color: rgba(255, 255, 255, 0.78); background: transparent;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
.gvm-btn:hover { color: #fff; border-color: rgba(255, 255, 255, 0.45); }
.gvm-btn[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #0a0712; font-weight: 600; }

/* ═══════ MAP ═══════ */
.gvm-hero { padding: 48px 0 8px; }
.gvm-hero h1 { font-size: clamp(34px, 5vw, 60px); line-height: 1.05; margin-top: 4px; }
.gvm-hero .gv-lead { max-width: 820px; margin-top: 12px; }
.gvm-body { padding-top: 18px; padding-bottom: 20px; }
.gvm-modes { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.gvm-layout { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.gvm-mapcard { position: relative; overflow: hidden; }
#map { display: block; width: 100%; height: auto; background: #0a0814; cursor: grab; touch-action: none; border-radius: 6px 6px 0 0; }
#map.drag { cursor: grabbing; }
#map path { stroke: #0a0814; stroke-width: 0.6; vector-effect: non-scaling-stroke; transition: fill 0.25s, opacity 0.25s; }
#map .c { cursor: pointer; }
#map .c:hover { stroke: #fff; stroke-width: 1.4; }
#map circle { stroke: #0a0814; stroke-width: 0.8; vector-effect: non-scaling-stroke; cursor: pointer; transition: fill 0.25s, opacity 0.25s; }
#map circle:hover { stroke: #fff; stroke-width: 1.6; }
#map .sel { stroke: var(--gold) !important; stroke-width: 2 !important; }
#map .dim { opacity: 0.16; }
.gvm-zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.gvm-zoom .gvm-btn { width: 34px; height: 34px; padding: 0; font-size: 18px; line-height: 1; background: rgba(10, 8, 20, 0.85); }
.gvm-under { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; padding: 12px 14px; border-top: 1px solid var(--border); }
.gvm-under .gv-search { flex: 1; min-width: 200px; }
#timebar { display: none; flex: 1 1 100%; align-items: center; gap: 12px; }
#timebar.on { display: flex; }
#year { flex: 1; accent-color: var(--gold); }
#yearlab { font-family: var(--f-heading); font-size: 32px; font-weight: 700; min-width: 80px; color: #fff; font-variant-numeric: lining-nums tabular-nums; }
.gvm #tally { font-size: 13.5px; color: var(--soft); flex: 1 1 100%; line-height: 1.55; }
.gvm #tally b { color: #fff; }
.gvm-legend { padding: 18px 16px; position: sticky; top: calc(var(--nav-h) + 14px); max-height: calc(100vh - var(--nav-h) - 28px); overflow-y: auto; scrollbar-color: var(--line) transparent; }
.gvm-legend h2 { font-size: 22px; margin: 6px 0 4px; letter-spacing: 0; }
.gvm-legend p { margin: 0 0 10px; color: var(--soft); font-size: 13.5px; line-height: 1.55; }
.gvm-legend ul { list-style: none; }
.gvm-legend li button { display: flex; gap: 10px; align-items: center; width: 100%; padding: 6px 8px; border-radius: 4px; font-size: 14px; text-align: left; color: rgba(255, 255, 255, 0.85); }
.gvm-legend li button:hover { background: rgba(255, 255, 255, 0.06); }
.gvm-legend li button[aria-pressed="true"] { background: rgba(201, 168, 68, 0.16); color: #fff; font-weight: 600; }
.gvm-legend .gv-sw { border-radius: 3px; width: 12px; height: 12px; }
.gvm-legend .n { margin-left: auto; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; font-weight: 400; }
.gvm-detail { padding: 20px; margin-top: 18px; }
.gvm-detail h2 { font-size: 30px; line-height: 1.1; letter-spacing: 0; }
.gvm-st { color: var(--muted); font-size: 13px; margin-bottom: 12px; }
.gvm-chip { display: inline-flex; gap: 8px; align-items: center; padding: 4px 11px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); font-size: 13px; font-weight: 500; margin: 0 6px 6px 0; }
.gvm-detail dl { margin: 10px 0 0; display: grid; grid-template-columns: 130px 1fr; gap: 9px 12px; font-size: 14.5px; }
.gvm-detail dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
.gvm-detail dd { margin: 0; color: rgba(255, 255, 255, 0.9); }
.gvm-note { margin: 14px 0 0; padding: 10px 13px; border-left: 3px solid var(--gold); background: rgba(201, 168, 68, 0.07); font-size: 14px; line-height: 1.55; border-radius: 0 4px 4px 0; color: rgba(255, 255, 255, 0.9); }
.gvm-note.flag::before { content: "Recently changed or contested. "; font-weight: 700; color: var(--gold); }
.gvm-links { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; font-size: 14.5px; }
.gvm-src { margin-top: 12px; font-size: 12.5px; color: var(--muted); }
.gvm-src a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.gvm-empty { color: var(--soft); font-size: 15px; }
.gvm-foot { margin-top: 22px; }

/* ═══════ POWER DIAGRAMS ═══════ */
.gvp-body { padding: 8px 0 20px; }
.gvp-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 18px; align-items: start; }
.gvp-list { padding: 12px; position: sticky; top: calc(var(--nav-h) + 14px); max-height: calc(100vh - var(--nav-h) - 28px); overflow-y: auto; scrollbar-color: var(--line) transparent; }
.gvp-list h3 { margin: 12px 8px 6px; font-family: var(--f-ui); font-size: 11.5px; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); }
.gvp-list h3:first-child { margin-top: 4px; }
.gvp-list button { display: block; width: 100%; padding: 8px 10px; border-radius: 4px; font-size: 14.5px; line-height: 1.3; text-align: left; color: rgba(255, 255, 255, 0.85); }
.gvp-list button small { display: block; color: var(--muted); font-size: 12px; margin-top: 1px; }
.gvp-list button:hover { background: rgba(255, 255, 255, 0.06); }
.gvp-list button[aria-current="true"] { background: var(--gold); color: #0a0712; font-weight: 600; }
.gvp-list button[aria-current="true"] small { color: rgba(10, 7, 18, 0.7); }
.gvp-stage { padding: 22px 24px 24px; }
.gvp-stage h2 { font-size: clamp(28px, 3vw, 38px); margin: 6px 0 4px; letter-spacing: 0; }
.gvp-tag { font-family: var(--f-heading); font-style: italic; font-size: 19px; color: var(--gold); margin: 0 0 10px; }
.gvp-sum { max-width: 78ch; margin: 0 0 6px; color: var(--soft); line-height: 1.65; }
.gvp-scroll { overflow-x: auto; margin: 12px -4px 0; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); }
#chart { display: block; width: 100%; min-width: 760px; height: auto; }
#chart text { font-family: var(--f-body); }
#chart .node { cursor: default; }
#chart .edge, #chart .node { transition: opacity 0.2s; }
#chart .off { opacity: 0.12; }
.gvp-keys { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.gvp-keys button { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; padding: 5px 12px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.16); color: rgba(255, 255, 255, 0.8); }
.gvp-keys button:hover { border-color: rgba(255, 255, 255, 0.45); }
.gvp-keys button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: #0a0712; }
.gvp-keys i { display: inline-block; width: 20px; height: 0; border-top: 3px solid; }
.gvp-insight { margin: 18px 0 0; padding: 13px 16px; border-left: 3px solid var(--gold); background: rgba(201, 168, 68, 0.07); border-radius: 0 4px 4px 0; max-width: 78ch; line-height: 1.6; color: #fff; }
.gvp-insight b { font-family: var(--f-ui); font-size: 11.5px; letter-spacing: 2px; text-transform: uppercase; color: var(--gold); display: block; margin-bottom: 3px; font-weight: 600; }
.gvp-src { margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.gvp-src a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.gvp-kinds { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 12.5px; color: var(--soft); margin-top: 12px; }
.gvp-kinds span { display: inline-flex; align-items: center; gap: 7px; }
.gvp-kinds i { display: inline-block; width: 22px; height: 13px; border-radius: 3px; }
.gvp-links { margin-top: 14px; font-size: 14.5px; display: flex; flex-wrap: wrap; gap: 6px 22px; }

/* ═══════ TIMELINES ═══════ */
.gvt-body { padding-top: 6px; padding-bottom: 10px; }
.gvt-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.gvt-bar .sp { flex: 1; }
.gvt-bar .gv-eyebrow { margin-right: 4px; }
.gvt-panel { padding: 18px 20px; }
.gvt-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--soft); margin: 0 0 14px; }
.gvt-legend span { display: inline-flex; align-items: center; gap: 6px; }
.gvt-legend .gv-sw { border-radius: 3px; }
.gvt-grid { display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 12px; }
.gvt-lab { font-size: 14px; font-weight: 500; display: flex; align-items: center; min-height: 28px; }
.gvt-lab button { display: flex; align-items: center; gap: 6px; width: 100%; text-align: left; color: rgba(255, 255, 255, 0.88); }
.gvt-lab button:hover { color: var(--gold); }
.gvt-lab button::before { content: "▸"; font-size: 10px; color: var(--muted); transition: transform 0.15s; }
.gvt-row.open .gvt-lab button::before { transform: rotate(90deg); }
.gvt-row { display: contents; }
.gvt-track { position: relative; height: 22px; margin: 3px 0; background: var(--land); border-radius: 3px; overflow: hidden; }
.gvt-seg { position: absolute; top: 0; bottom: 0; border-right: 1.5px solid var(--surface); cursor: pointer; }
.gvt-seg:hover { filter: brightness(1.2); }
.gvt-more { grid-column: 1 / -1; display: none; margin: 4px 0 14px; padding: 12px 16px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; font-size: 14px; }
.gvt-row.open .gvt-more { display: block; }
.gvt-more table { border-collapse: collapse; width: 100%; }
.gvt-more td { padding: 6px 12px 6px 0; vertical-align: top; border-top: 1px solid var(--border); color: rgba(255, 255, 255, 0.86); }
.gvt-more tr:first-child td { border-top: 0; }
.gvt-more td:first-child { white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; font-weight: 600; width: 1%; color: #fff; }
.gvt-more td:nth-child(2) { white-space: nowrap; width: 1%; }
.gvt-axis { position: relative; height: 28px; font-size: 12px; color: var(--muted); font-variant-numeric: lining-nums tabular-nums; }
.gvt-axis span { position: absolute; top: 9px; transform: translateX(-50%); }
.gvt-axis span::before { content: ""; position: absolute; left: 50%; top: -8px; height: 6px; border-left: 1px solid var(--muted); }
.gvt-sticky { position: sticky; top: var(--nav-h); z-index: 5; background: var(--surface); grid-column: 1 / -1; display: grid; grid-template-columns: 160px minmax(0, 1fr); column-gap: 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; padding-top: 4px; }
#tally2 svg { display: block; width: 100%; height: 90px; }
.gvt-tl { font-size: 13px; color: var(--soft); display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.gvt-tl b { font-family: var(--f-heading); font-size: 26px; color: #fff; line-height: 1; font-variant-numeric: lining-nums tabular-nums; }
.gvt-ms { position: relative; height: 16px; }
.gvt-ms i { position: absolute; top: 2px; width: 10px; height: 10px; margin-left: -5px; background: var(--gold); transform: rotate(45deg); cursor: help; border: 1.5px solid var(--surface); }
#cursor { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px dashed var(--gold); pointer-events: none; display: none; z-index: 4; }
.gvt-rel { position: relative; }
.gvt-foot { margin-top: 20px; }

/* ── tool responsive ── */
@media (max-width: 1000px) {
  .gvm-layout { grid-template-columns: minmax(0, 1fr); }
  .gvm-legend { position: static; max-height: none; }
  .gvp-layout { grid-template-columns: minmax(0, 1fr); }
  .gvp-list { position: static; max-height: none; display: flex; flex-wrap: wrap; gap: 6px; }
  .gvp-list h3 { flex: 1 1 100%; }
  .gvp-list button { width: auto; border: 1px solid rgba(255, 255, 255, 0.14); }
  .gvp-list button small { display: none; }
}
@media (max-width: 640px) {
  .gvt-grid, .gvt-sticky { grid-template-columns: 100px minmax(0, 1fr); }
  .gvt-lab { font-size: 12.5px; }
  .gvm-detail dl { grid-template-columns: 1fr; gap: 2px 0; }
  .gvm-detail dd { margin-bottom: 8px; }
}
