/* ════════════════════════════════════════
   MAP — "Poland Through Time" / "Lithuania Through Time"
   (js/poland-lithuania-map.js). Identical in poland/css/ and
   lithuania/css/; the partner colour comes from --hm-partner, set in each
   site's theme.css, loaded after this file (Poland: Lithuania green;
   Lithuania: Poland red).
   Reuses core's .cm-* page, controls, panel and legend; these rules style
   the map layers (sea, land, one fading path per region, the Commonwealth
   border, labels, cities, rivers and the modern outline) and the panel parts
   shared with the other country maps.
════════════════════════════════════════ */
:root {
  --hm-focus: #c9a844;
  --hm-partner: #5f9a6c;
  --hm-neighbor: #3a3646;
}

.cm-year-note {
  margin-top:4px;
  font-family:var(--f-ui); font-size:13px; color:var(--white-dim);
}
.cm-year-note:empty { display:none; }
.cm-tip-dates { margin-top:3px; font-variant-numeric:tabular-nums; color:var(--white-dim); }

/* Chapter text: an uncertainty / area note in small type under the text. */
.cm-chapter-note {
  margin:10px 0 0;
  font-family:var(--f-ui); font-size:13px; line-height:1.45; color:rgba(255,255,255,0.5);
}
.cm-chapter-note:empty { display:none; }

/* Chapter events: short dates, right-aligned. */
.cm-events .ag-event { grid-template-columns:62px 9px minmax(0, 1fr); column-gap:16px; }
.cm-events .ag-event::before { left:82px; }
.cm-events .ag-event-year { overflow-wrap:break-word; text-align:right; }
.cm-events-heading { margin:30px 0 6px; }

/* States shown in colour in the year drawn. */
.cm-chips { display:flex; flex-wrap:wrap; gap:6px; margin-top:14px; }
.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);
}
.cm-chip--more { color:var(--white-dim); }

/* "Who Was in Power" in the year shown: the event modal's .em-power card,
   compacted for the panel. */
.em-power.cm-power { display:block; margin-top:4px; }
.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; }

/* The union years (1385–1795), a thin band under the slider track. */
.cm-union-band {
  position:absolute; bottom:-6px; height:3px; border-radius:2px;
  background:linear-gradient(to right, var(--hm-focus), var(--hm-partner));
  opacity:0.75; pointer-events:auto;
}

/* ── Map layers ── */
.hm-sea { fill:#0a0f1a; }
.hm-land { fill:#1b1f2a; }
.hm-lakes { fill:#0f1a2a; stroke:#26344a; stroke-width:0.6; vector-effect:non-scaling-stroke; pointer-events:none; }
.hm-rivers { fill:none; stroke:#2c4a66; stroke-width:1; vector-effect:non-scaling-stroke; opacity:0.75; pointer-events:none; }
/* Each region path is shown (display) by the map script, then faded in with
   .is-on; a fading-out path no longer takes the pointer. */
.hm-regions path, .hm-outlines path {
  opacity:0; pointer-events:none;
  transition:opacity 0.45s ease, fill 0.6s ease, filter 0.15s ease;
}
.hm-regions path {
  stroke:#08060f; stroke-width:0.7; stroke-linejoin:round;
  vector-effect:non-scaling-stroke; cursor:pointer;
}
.hm-regions path.is-on { opacity:1; pointer-events:auto; }
.hm-regions.is-instant path { transition:none; }
.hm-regions path:hover { filter:brightness(1.25); stroke:var(--gold); stroke-width:1.4; }
.hm-focus { fill:var(--hm-focus); }
.hm-partner { fill:var(--hm-partner); }
.hm-dep { fill:url(#hm-hatch-dep); }
.hm-fief { fill:url(#hm-hatch-fief); }
.hm-tribe, .hm-culture { fill:#9c8250; fill-opacity:0.85; }
.hm-culture { fill-opacity:0.6; }
.hm-kin { fill:#6e6a52; }
.hm-claim { fill:url(#hm-hatch-claim); stroke:var(--hm-focus) !important; stroke-dasharray:4 3; stroke-width:1.2 !important; }
.hm-context { fill:url(#hm-hatch-context); }
.hm-neighbor { fill:var(--hm-neighbor); fill-opacity:0.92; }
.hm-hatch-bg--dep { fill:#5c4d27; }
.hm-hatch-fg--dep { fill:var(--hm-focus); }
.hm-hatch-bg--fief { fill:#3f3a35; }
.hm-hatch-fg--fief { fill:#a48d58; }
.hm-hatch-fg--claim { fill:var(--hm-focus); opacity:0.55; }
.hm-hatch-bg--context { fill:var(--hm-neighbor); }
.hm-hatch-fg--context { fill:#6c6578; }
/* Polish–Lithuanian Commonwealth, 1569–1795: the outer border of the union. */
.hm-outlines path {
  fill:none; stroke:#fff6dc; stroke-width:3; stroke-linejoin:round;
  vector-effect:non-scaling-stroke;
  filter:drop-shadow(0 0 1.5px rgba(0,0,0,0.95)) drop-shadow(0 0 4px rgba(255,240,200,0.35));
}
.hm-outlines path.is-on { opacity:1; }
/* Inside the Commonwealth: the border between the Crown and the Grand Duchy
   (dotted: the outer border is the one solid line, and the dashed line is
   the modern country). */
.hm-inner { pointer-events:none; }
.hm-inner path {
  fill:none; stroke:#fff6dc; stroke-width:3.2; stroke-dasharray:0.1 6.5; stroke-linecap:round; stroke-linejoin:round;
  vector-effect:non-scaling-stroke; opacity:1;
  filter:drop-shadow(0 0 1.2px rgba(0,0,0,0.95));
}
.hm-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.3; stroke-dasharray:5 4;
  vector-effect:non-scaling-stroke; opacity:0.7; pointer-events:none;
}
/* Names of the own country and the partner; sized by the script. */
.hm-labels { pointer-events:none; }
.hm-label {
  font-family:var(--f-heading); font-weight:700; letter-spacing:0.03em;
  text-anchor:middle; dominant-baseline:middle;
  fill:#1b1406; paint-order:stroke; stroke:rgba(244,226,170,0.55); stroke-linejoin:round;
}
.hm-label--partner { fill:#0c1a10; stroke:rgba(214,238,214,0.5); }
.hm-label--dep { fill:#f4e2aa; stroke:rgba(10,8,4,0.75); }
/* The Commonwealth's title, between the two states' names. */
.hm-label--union {
  font-family:var(--f-heading); font-weight:700; text-transform:uppercase; letter-spacing:0.14em;
  fill:#fff6dc; stroke:rgba(8,6,15,0.85);
}
/* Cities: rank 1 always, rank 2 at medium zoom, rank 3 close up. */
.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-stage[data-zoom="far"] .hm-city--r2,
.hm-stage[data-zoom="far"] .hm-city--r3,
.hm-stage[data-zoom="mid"] .hm-city--r3 { display:none; }
.hm-city circle { fill:#f4ecd6; stroke:#08060f; stroke-width:1.2; vector-effect:non-scaling-stroke; }
.hm-city--battle path { stroke:#e9c46a; stroke-width:2; vector-effect:non-scaling-stroke; }
.hm-city text {
  font-family:var(--f-heading); font-weight:600; fill:var(--white);
  paint-order:stroke; stroke:#08060f; stroke-linejoin:round;
}
.hm-city--battle text { font-style:italic; fill:#e9c46a; }
@media (prefers-reduced-motion: reduce) {
  .hm-regions path, .hm-outlines path, .hm-city { transition:none; }
}

/* Legend and tooltip swatches */
.hm-sw { display:inline-block; width:11px; height:11px; flex:none; }
.hm-sw--focus { background:var(--hm-focus); }
.hm-sw--partner { background:var(--hm-partner); }
.hm-sw--dep { background:repeating-linear-gradient(45deg, var(--hm-focus) 0 2px, #5c4d27 2px 5px); }
.hm-sw--fief { background:repeating-linear-gradient(-45deg, #a48d58 0 2px, #3f3a35 2px 4px); }
.hm-sw--tribe, .hm-sw--culture { background:#9c8250; }
.hm-sw--kin { background:#6e6a52; }
.hm-sw--claim { background:repeating-linear-gradient(45deg, rgba(201,168,68,0.6) 0 1px, transparent 1px 5px); box-shadow:inset 0 0 0 1px var(--hm-focus); }
.hm-sw--context { background:repeating-linear-gradient(-45deg, #6c6578 0 1px, var(--hm-neighbor) 1px 4px); }
.hm-sw--neighbor { background:var(--hm-neighbor); box-shadow:inset 0 0 0 1px rgba(255,255,255,0.18); }
.cm-lg i.hm-sw--ref, .cm-lg i.hm-sw--outline { width:18px; height:0; background:none; }
.hm-sw--ref { border-top:2px dashed #f1e6cf; }
.hm-sw--outline { border-top:3px solid #fff6dc; }
.cm-lg i.hm-sw--inner { width:18px; height:0; background:none; }
.hm-sw--inner { border-top:3px dotted #fff6dc; }

/* 20–40 keyframes on a stretched scale: the script 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; }
.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 the script; wrap to rows here. */
  .cm-eras { grid-template-columns:repeat(3, minmax(0, 1fr)) !important; }
}

/* Event modal / timeline map cards: the borders of the year. */
.em-map-thumb .hm-thumb-land { fill:#2a2633; }
.em-map-thumb .hm-thumb-focus { fill:var(--hm-focus); filter:drop-shadow(0 0 6px rgba(201,168,68,0.6)); }
.em-map-thumb .hm-thumb-partner { fill:var(--hm-partner); }
.em-map-thumb .hm-thumb-dep,
.em-map-thumb .hm-thumb-tribe,
.em-map-thumb .hm-thumb-culture { fill:#8a7a4a; }
.em-map-thumb .hm-thumb-fief { fill:#5f5640; }
.em-map-thumb .hm-thumb-claim { fill:none; stroke:var(--hm-focus); stroke-dasharray:3 2; vector-effect:non-scaling-stroke; }
.em-map-thumb .hm-thumb-inner { fill:none; stroke:#fff6dc; stroke-width:1.6; stroke-dasharray:0.1 3; stroke-linecap:round; vector-effect:non-scaling-stroke; }
.em-map-thumb .hm-thumb-outline { fill:none; stroke:#f6ecd2; stroke-width:1.4; vector-effect:non-scaling-stroke; }
.em-map-thumb .hm-thumb-ref {
  fill:none; stroke:#f1e6cf; stroke-width:1.2; stroke-dasharray:3 3;
  vector-effect:non-scaling-stroke; opacity:0.6;
}
