/* ==========================================================================
   The Manipur incident map. Sits on the investigation system (investigation.css)
   and reuses its theatre head, play button, rail and tooltip.
   ========================================================================== */

.mpmap {
  --d-hill: color-mix(in srgb, var(--land) 80%, var(--paper));
  --d-valley: color-mix(in srgb, var(--land) 50%, #e3dcc2);
  --mp-nbr: color-mix(in srgb, var(--land) 40%, var(--paper));
  --mp-line: color-mix(in srgb, var(--ink) 52%, transparent);
  --mp-dline: color-mix(in srgb, var(--ink) 20%, transparent);
  --k-v: var(--signal);
  --k-s: var(--blue);
  --k-p: var(--ink-3);
  font-family: var(--font-sans);
  margin-block: 0.5rem 2.5rem;
}
:root[data-theme="dark"] .mpmap {
  --d-hill: #141b14;
  --d-valley: #1d2217;
  --mp-nbr: #0d120e;
}

.mpmap-frame { aspect-ratio: 1 / 1; }
.mp-svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.mp-water { fill: var(--water); }
.mp-land { fill: var(--mp-nbr); stroke: none; }
.mp-nbr { fill: var(--mp-nbr); stroke: var(--mp-dline); stroke-width: 1; vector-effect: non-scaling-stroke; }
.mp-nation { fill: none; stroke: var(--mp-line); stroke-width: 1.1; stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.mp-dist {
  --h: 0;
  stroke: var(--mp-dline); stroke-width: 1; stroke-linejoin: round; vector-effect: non-scaling-stroke;
  transition: fill 0.6s var(--ease-out);
}
.mp-dist--hill { fill: color-mix(in srgb, var(--signal) calc(var(--h) * 48%), var(--d-hill)); }
.mp-dist--valley { fill: color-mix(in srgb, var(--signal) calc(var(--h) * 48%), var(--d-valley)); }
.mp-state { fill: none; stroke: var(--mp-line); stroke-width: 1.7; stroke-linejoin: round; vector-effect: non-scaling-stroke; pointer-events: none; }

.mp-lbl {
  font-family: var(--font-sans);
  font-size: 10px; font-weight: 650; letter-spacing: 0.26em;
  fill: var(--ink-3);
  opacity: 0.78;
  pointer-events: none;
  transform: none;
}
.mp-lbl--sm { font-size: 8.5px; letter-spacing: 0.2em; }
.mp-lbl--d { font-size: 8.6px; letter-spacing: 0.16em; fill: var(--ink-2); opacity: 0.62; paint-order: stroke; stroke: var(--d-hill); stroke-width: 2.6px; stroke-linejoin: round; }
.mp-lbl--valley { fill: color-mix(in srgb, var(--ink) 72%, var(--caution)); }
.mp-lbl--big { font-size: 9.6px; letter-spacing: 0.22em; opacity: 0.75; }

/* Pins: kind decides shape and colour, never colour alone. */
.mpin { --k: var(--k-v); cursor: pointer; transition: opacity 0.3s var(--ease-out); }
.mpin--s { --k: var(--k-s); }
.mpin--p { --k: var(--k-p); }
.key-glyph.mpin--v { --k: var(--k-v); }
.mpin-g { transform: scale(var(--u)); transition: transform 0.2s var(--ease-out); }
.key-glyph .mpin-g { transform: none; }
.mpin-ring { fill: var(--geo-halo); stroke: var(--k); stroke-width: 1.8; stroke-linejoin: round; }
.mpin-dot { fill: var(--k); }
.mpin-slash { stroke: var(--k); stroke-width: 1.5; stroke-linecap: round; fill: none; }
.mpin-pulse { fill: none; stroke: var(--k); stroke-width: 1.5; opacity: 0; transform-box: fill-box; transform-origin: center; pointer-events: none; }
.mpin-hit { fill: transparent; stroke: none; }
.mpin-label {
  font-family: var(--font-data); font-size: 10.5px;
  fill: var(--ink);
  paint-order: stroke; stroke: var(--geo-halo); stroke-width: 3.2px; stroke-linejoin: round;
  opacity: 0; transition: opacity 0.2s;
  pointer-events: none;
}
.mpin.is-live .mpin-label, .mpin.is-hot .mpin-label { opacity: 1; }
.mpin.is-live .mpin-ring { stroke-width: 2.6; }
.mpin.is-hot .mpin-g, .mpin.is-live .mpin-g { transform: scale(calc(var(--u) * 1.3)); }
.mpin:focus-visible { outline: none; }
.mpin:focus-visible .mpin-ring { stroke-width: 3; }

/* With the script running, pins appear as the story reaches them. */
.js .mpmap .mpin { opacity: 0; pointer-events: none; }
.js .mpmap .mpin.is-on { opacity: 1; pointer-events: auto; }
.js .mpmap .mpin.is-old { opacity: 0.42; }
.js .mpmap .mpin.is-old.is-hot { opacity: 1; }
.mpin.is-new .mpin-pulse { animation: mp-ping 1.5s var(--ease-out) 1; }
.mpin.is-new .mpin-g { animation: mp-pop 0.5s var(--ease-out) 1; }
@keyframes mp-ping { from { opacity: 0.85; transform: scale(0.35); } to { opacity: 0; transform: scale(3.6); } }
@keyframes mp-pop { from { transform: scale(calc(var(--u) * 0.2)); } to { transform: scale(var(--u)); } }

/* Running totals, bottom-left of the map */
.mp-counts {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.4rem; align-items: flex-end;
  margin: 0.55rem 0 0; padding: 0.1rem 0;
}
.mp-counts div { display: grid; gap: 0.1rem; }
.mp-counts dt { font-family: var(--font-data); font-size: 0.58rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-3); }
.mp-counts dt span { text-transform: none; letter-spacing: 0; }
.mp-counts dd { margin: 0; font-family: var(--font-data); font-size: 1.15rem; line-height: 1; color: var(--ink); font-variant-numeric: tabular-nums; }
.mp-count-toll dd { color: var(--signal); }
.mp-counts small { font-family: var(--font-data); font-size: 0.54rem; color: var(--ink-3); line-height: 1.2; max-width: 7.5rem; }

/* Timeline strip */
.mp-strip { position: relative; height: 4.3rem; margin-top: 0.8rem; border-bottom: 1px solid var(--rule-2); }
.mp-toll { position: absolute; inset: 0 0 1.2rem 0; width: 100%; height: calc(100% - 1.2rem); overflow: visible; }
.mp-toll-fill { fill: color-mix(in srgb, var(--signal) 9%, transparent); stroke: none; }
.mp-toll-line { fill: none; stroke: color-mix(in srgb, var(--signal) 70%, transparent); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.mp-ticks { position: absolute; inset: 0 0 1.2rem 0; }
.mp-tick {
  position: absolute; bottom: 0; width: 9px; height: 1.1rem; margin-left: -4.5px; padding: 0;
  background: none; border: 0; cursor: pointer;
}
.mp-tick::after {
  content: ""; position: absolute; left: 3.5px; bottom: 0; width: 2px; height: 0.7rem; border-radius: 1px;
  background: var(--k-p); opacity: 0.4; transition: opacity 0.2s, height 0.2s;
}
.mp-tick--v::after { background: var(--k-v); }
.mp-tick--s::after { background: var(--k-s); }
.mp-tick.is-on::after { opacity: 1; }
.mp-tick.is-live::after { height: 1.1rem; width: 3px; left: 3px; }
.mp-tick:hover::after { opacity: 1; height: 1rem; }
.mp-tick:focus-visible { outline: 2px solid var(--signal); outline-offset: 1px; }
.mp-head { position: absolute; top: 0; bottom: 1.2rem; width: 0; border-left: 1px dashed var(--ink-3); pointer-events: none; transition: left 0.5s var(--ease-out); }
.mp-head[hidden] { display: none; }
.mp-years { position: absolute; left: 0; right: 0; bottom: 0.2rem; height: 0.9rem; font-family: var(--font-data); font-size: 0.6rem; color: var(--ink-3); }
.mp-years span { position: absolute; transform: translateX(3px); }
.mp-years span::before { content: ""; position: absolute; left: -3px; top: -0.15rem; height: 0.6rem; border-left: 1px solid var(--rule-2); }

/* Chapters */
.mp-rail { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.mp-rail .rail-what { font-size: 0.74rem; }
.mp-rail .rail-when { font-size: 0.58rem; }

/* The entry for the live event */
.mp-card { margin-top: 0.85rem; min-height: 7.6rem; padding-top: 0.2rem; }
.mp-card-meta { display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; font-size: 0.7rem; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; }
.mp-card-kind--v { color: var(--k-v); }
.mp-card-kind--s { color: var(--k-s); }
.mp-card-title { margin-top: 0.2rem; font-size: 1.02rem; font-weight: 650; line-height: 1.25; color: var(--ink); text-wrap: balance; }
.mp-card-text { margin-top: 0.35rem; font-size: 0.86rem; line-height: 1.5; color: var(--ink-2); }
.mp-card-src { margin-top: 0.4rem; font-size: 0.64rem; color: var(--ink-3); }
.mp-card-src a { color: var(--ink-2); text-decoration: underline; text-decoration-color: var(--rule-2); text-underline-offset: 0.18em; }
.mp-card-src a:hover { color: var(--signal); }

.mp-key .key-note { display: inline-flex; align-items: center; gap: 0.35rem; }
.mp-swatch { display: inline-block; width: 0.8rem; height: 0.8rem; border: 1px solid var(--mp-dline); border-radius: 2px; }
.mp-swatch + .mp-swatch, .mp-key .mp-swatch:not(:first-child) { margin-left: 0.6rem; }
.mp-swatch--valley { background: var(--d-valley); }
.mp-swatch--hill { background: var(--d-hill); }

/* Wide screens: the shared sticky layout in investigation.css places .inv-map. */
@media (min-width: 1180px) {
  .mpmap { max-height: calc(100dvh - var(--map-top) - 0.6rem); overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-right: 0.15rem; }
  .mpmap-frame { aspect-ratio: auto; height: clamp(15rem, calc(100dvh - 33.5rem), 40rem); max-height: none; }
}
@media (min-width: 1180px) and (max-height: 860px) {
  .mp-key { display: none; }
  .mp-card { min-height: 6.4rem; }
}
@media (max-width: 1179.98px) {
  .mpmap-frame { aspect-ratio: 1 / 1; max-height: 78vh; }
}
@media (min-width: 760px) and (max-width: 1179.98px) {
  .mpmap-frame { aspect-ratio: 5 / 4; }
}
@media (max-width: 560px) {
  .mp-rail { grid-template-columns: repeat(3, minmax(0, 1fr)); row-gap: 0.6rem; }
  .mp-rail .rail-track { display: none; }
  .mp-counts { gap: 0.4rem 1rem; }
  .mp-counts dd { font-size: 1rem; }
  .mp-counts dt { font-size: 0.52rem; }
  .mp-card { min-height: 9rem; }
}

@media (prefers-reduced-motion: reduce) {
  .mpin, .mpin-g, .mp-dist, .mp-head, .mp-tick::after { transition: none; }
  .mpin.is-new .mpin-pulse, .mpin.is-new .mpin-g { animation: none; }
}
