/* History of Latvia — overrides loaded after core/css/style.css: the inline
   SVG logo, five rulers-tab icons, ten At a Glance ages in one row, the
   heads of government and other rulers in "Who Was in Power", and the
   "Latvia Through Time" map layers (js/latvia-map.js), which reuse core's
   .cm-* map page. */

/* Inline SVG logo (partials/logo.php, site.php logo_partial) — sized like
   the image logo of the other sites. */
#app-logo.app-logo-svg { height:auto; overflow:visible; }

/* ════════════════════════════════════════
   Rulers page — Medieval Livonia (cross of the orders), Dukes of Courland
   (ducal coronet), Kings & Emperors (castle), Republic of Latvia (flag) and
   Occupations (barbed wire) tab
   icons; site.php gives those tabs icon 'none', so they are drawn here in
   the tab's text colour.
════════════════════════════════════════ */
.rp-tab[data-tab="medieval"]::before,
.rp-tab[data-tab="courland"]::before,
.rp-tab[data-tab="crowns"]::before,
.rp-tab[data-tab="republic"]::before,
.rp-tab[data-tab="occupation"]::before {
  content:''; flex-shrink:0; width:14px; height:14px;
  background-color:currentColor;
  -webkit-mask:var(--lv-tab-icon) center / contain no-repeat;
  mask:var(--lv-tab-icon) center / contain no-repeat;
}
.rp-tab[data-tab="medieval"] {
  --lv-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 1.5v13M3 5.5h10M8 1.5l-1.4 1.8M8 1.5l1.4 1.8M8 14.5l-1.4-1.8M8 14.5l1.4-1.8M3 5.5l1.8-1.4M3 5.5l1.8 1.4M13 5.5l-1.8-1.4M13 5.5l-1.8 1.4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="courland"] {
  --lv-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M2.5 12.5h11M3 12.5L2.2 6.5l3 2.2L8 4l2.8 4.7 3-2.2-.8 6M8 4V2.2M7 3h2' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="crowns"] {
  --lv-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3 14.2V5.5h2V7h1.5V5.5h3V7H11V5.5h2v8.7zM6.4 14.2v-2.6a1.6 1.6 0 0 1 3.2 0v2.6M1.8 14.2h12.4' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="republic"] {
  --lv-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M3.5 14.5V2M3.5 2.5h9.5v6.5H3.5M3.5 5.1h9.5M3.5 6.4h9.5' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}
.rp-tab[data-tab="occupation"] {
  --lv-tab-icon:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M1.5 6c2.2 0 2.2 4 4.3 4s2.1-4 4.3-4 2.2 4 4.4 4M4.2 6.6l1.6 2.8M5.8 6.6L4.2 9.4M10.2 6.6l1.6 2.8M11.8 6.6l-1.6 2.8M1.5 2v12M14.5 2v12' fill='none' stroke='%23000' stroke-width='1.3' stroke-linejoin='round' stroke-linecap='round'/%3E%3C/svg%3E");
}

/* ════════════════════════════════════════
   At a Glance — ten ages: one column per age, all in a single row (core
   lays out eight); bibliography in four columns.
════════════════════════════════════════ */
@media (min-width:901px) {
  .ag-era-list { grid-template-columns:none; grid-auto-flow:column; grid-auto-columns:minmax(0, 1fr); }
}
.bib-groups { grid-template-columns:repeat(4, minmax(0, 1fr)); }
@media (max-width:1100px) {
  .bib-groups { grid-template-columns:repeat(2, minmax(0, 1fr)); }
}

/* ════════════════════════════════════════
   "Who Was in Power" — the head of state beside the head of government and
   the rulers of other parts of Latvia (Dukes of Courland, Polish and
   Swedish kings, native leaders, the Archbishops of Riga, the Soviet first
   secretaries); the coloured line under each side card names
   the party, or the territory a ruler held. The columns stack once each
   would drop below ~200px.
════════════════════════════════════════ */
.em-power {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap:12px 20px;
  align-items:start;
}
.em-power > .em-power-heading { grid-column:1 / -1; margin-bottom:1px; }
a.em-power-card--pm { color:inherit; text-decoration:none; }
.em-power-party {
  display:flex; align-items:center; gap:6px;
  font-family:var(--f-ui); font-size:13px; line-height:1.3; color:var(--white-dim);
}
.em-power-party i { width:9px; height:9px; border-radius:50%; flex:none; }

/* ════════════════════════════════════════
   MAP — "Latvia Through Time" (js/latvia-map.js). Reuses core's .cm-*
   page, controls, panel and legend; these rules style the map layers (sea,
   graticule, land, one fading path per region, lakes, rivers, the outlines of
   modern and interwar Latvia and place labels)
   and the panel parts shared with the other country maps.
════════════════════════════════════════ */
.cm-tip-dates { margin-top:3px; font-variant-numeric:tabular-nums; color:var(--white-dim); }

/* Era buttons and track segments carry their era's colour from the data
   (--era-c, set by latvia-map.js), as in data/latvia-map.html. */
.cm-eras button .cm-era-name::before {
  content:''; display:inline-block; width:8px; height:8px; margin-right:7px;
  border-radius:50%; background:var(--era-c, var(--gold)); vertical-align:1px;
}
.cm-segs div { background:var(--era-c, rgba(255,255,255,0.15)); opacity:0.55; }
.cm-segs div.on { opacity:1; }

/* Chapter events: dates can be long ("29 August 1943"), so a wider,
   right-aligned year column with the day/month on a smaller line below. */
.cm-events .ag-event { grid-template-columns:78px 9px minmax(0, 1fr); column-gap:16px; }
.cm-events .ag-event::before { left:98px; }
.cm-events .ag-event-year { overflow-wrap:break-word; text-align:right; }
.cm-event-day {
  display:block; margin-top:2px;
  font-family:var(--f-ui); font-size:12px; line-height:1.3; letter-spacing:0.2px;
  color:rgba(255,255,255,0.45);
}
.cm-events-heading { margin:30px 0 6px; }

/* The chapter's states, in their map colours. */
.cm-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:12px; }
.cm-chips[hidden] { display:none; }
.cm-chip {
  display:inline-flex; align-items:center; gap:7px;
  padding:3px 10px;
  border:1px solid rgba(255,255,255,0.14); border-radius:999px;
  background:rgba(255,255,255,0.03);
  font-family:var(--f-ui); font-size:13px; line-height:1.35; color:var(--white);
}

/* "Who Was in Power" in the year shown: the event modal's .em-power cards,
   compacted for the panel. */
.em-power.cm-power { display:block; margin-top:4px; } /* beats .em-power's grid; the cards grid below */
.em-power.cm-power[hidden] { display:none; }
.em-power.cm-power > .em-power-heading { margin:26px 0 10px; }
.cm-power-cards {
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 190px), 1fr));
  gap:10px 16px;
}
.cm-power .em-power-card { padding:6px 8px 6px 6px; border:1px solid rgba(255,255,255,0.1); border-radius:4px; gap:12px; }
.cm-power .em-power-portrait { width:42px; height:48px; }
.cm-power .em-power-name { font-size:16px; }
.cm-power .em-power-title,
.cm-power .em-power-reign { margin-top:2px; }
.cm-power .cm-power-static { cursor:default; }
.cm-power .cm-power-static:hover { border-color:rgba(255,255,255,0.1); background:none; }

.hm-sea { fill:#0b1220; }
.hm-land { fill:#1a1c22; stroke:#2b2e36; stroke-width:0.6; vector-effect:non-scaling-stroke; }
/* Each region path is shown (display) by latvia-map.js, then faded in
   with .is-on; a fading-out path no longer takes the pointer. Every
   region gets its polity's colour inline. */
.hm-regions path {
  stroke-linejoin:round; vector-effect:non-scaling-stroke; cursor:pointer;
  opacity:0; pointer-events:none;
  transition:opacity 0.45s ease, filter 0.15s ease;
}
.hm-regions path.is-on { pointer-events:auto; }
.hm-regions.is-instant path { transition:none; }
/* Neighbouring states keep their own colour, dimmed (as in the prototype);
   the polities of the Latvian lands are brighter, with a light edge. */
.hm-neighbor { stroke:#0d0f14; stroke-width:0.6; }
.hm-regions path.hm-neighbor.is-on { opacity:0.42; }
.hm-lv { stroke:rgba(255,240,236,0.75); stroke-width:1; }
.hm-regions path.hm-lv.is-on { opacity:0.86; }
.hm-grat { fill:none; stroke:rgba(120,160,200,0.14); stroke-width:0.5; vector-effect:non-scaling-stroke; pointer-events:none; }
.hm-lakes { fill:#0b1220; stroke:#2b2e36; stroke-width:0.4; vector-effect:non-scaling-stroke; pointer-events:none; }
.hm-rivers path { fill:none; stroke:#3f6f92; stroke-width:1.3; stroke-linecap:round; vector-effect:non-scaling-stroke; opacity:0.85; pointer-events:none; }
/* Region names on the larger regions, shown with their region. */
.hm-labels { pointer-events:none; }
.hm-labels text {
  font-family:var(--f-ui); font-weight:600; letter-spacing:0.3px; text-anchor:middle;
  fill:#fff; paint-order:stroke; stroke:rgba(0,0,0,0.55); stroke-linejoin:round;
  opacity:0; transition:opacity 0.45s ease;
}
.hm-labels text.is-on { opacity:0.9; }
.hm-regions path:hover { filter:brightness(1.25); stroke:var(--gold); stroke-width:1.4; }
.hm-ref, .hm-ref2 {
  fill:none; stroke:var(--gold); stroke-width:1.2; stroke-dasharray:5 4;
  vector-effect:non-scaling-stroke; pointer-events:none;
  opacity:0; transition:opacity 0.5s ease;
}
.hm-ref.is-on, .hm-ref2.is-on { opacity:0.85; }
@media (prefers-reduced-motion: reduce) {
  .hm-regions path, .hm-ref, .hm-ref2 { transition:none; }
}

/* Places: radius, font size and halo are set in map units by
   latvia-map.js so they read at a constant screen size at every zoom; a
   place shows while it existed and when its rank fits the zoom (.is-on). */
.hm-cities { pointer-events:none; }
.hm-city { opacity:0; visibility:hidden; transition:opacity 0.4s ease, visibility 0s linear 0.4s; }
.hm-city.is-on { opacity:1; visibility:visible; transition:opacity 0.4s ease; }
.hm-city circle { fill:var(--gold); stroke:#1a1508; stroke-width:1.2; vector-effect:non-scaling-stroke; }
.hm-city text {
  font-family:var(--f-heading); font-weight:600; fill:#f4ead0;
  paint-order:stroke; stroke:#08070b; stroke-linejoin:round;
}
@media (prefers-reduced-motion: reduce) {
  .hm-city { transition:none; }
}

/* Legend and tooltip swatches */
.hm-sw { display:inline-block; width:11px; height:11px; flex:none; }
.hm-sw--neighbor { opacity:0.55; }
.cm-lg i.hm-sw--ref { width:18px; height:0; background:none; }
.hm-sw--ref { border-top:2px dashed var(--gold); }
.cm-lg i.hm-sw--city, .cm-chip i.hm-sw--city { width:7px; height:7px; margin:0 2px; border-radius:50%; background:var(--gold); box-shadow:0 0 0 1.5px #1a1508; }

/* 26 keyframes: latvia-map.js marks the labels that would collide at the
   track's width (the current one always shows). */
.cm-tick-labels button.hm-minor:not(.cur) { display:none; }
/* Keep the first and last keyframe years inside the track. */
.cm-tick-labels button:first-child { transform:none; }
.cm-tick-labels button:last-child { transform:translateX(-100%); }
@media (max-width:900px) {
  /* The era count is set inline by latvia-map.js; wrap to rows here. */
  .cm-eras { grid-template-columns:repeat(2, minmax(0, 1fr)) !important; }
}

/* Event modal / timeline map cards: the borders of the year. Every
   region gets its polity's colour inline. */
.em-map-thumb .hm-thumb-land { fill:#2a2633; }
.em-map-thumb .hm-thumb-neighbor { fill-opacity:0.4; stroke:#4a4656; stroke-width:0.6; vector-effect:non-scaling-stroke; }
.em-map-thumb .hm-thumb-lv { fill-opacity:0.9; stroke:#ffd9d4; stroke-width:0.8; vector-effect:non-scaling-stroke; filter:drop-shadow(0 0 5px rgba(158,48,57,0.5)); }

/* Eight era buttons (set inline by latvia-map.js). */
.cm-eras button { padding-left:4px; padding-right:4px; }
.em-map-thumb .hm-thumb-ref { fill:none; stroke:rgba(255,255,255,0.7); stroke-width:1; stroke-dasharray:4 3; vector-effect:non-scaling-stroke; }
