/* FORMA · карта маршрутів (#geography). Лише токени з assets/forma.css.
   Кінцевий стан це базовий стиль: без JS, без руху і при prefers-reduced-motion карта вже домальована.
   map.js ставить .is-armed лише на час до прокреслення і веде рух через Web Animations з fill: backwards. */

.fmap {
  --u: 1;                         /* одиниць SVG на 1 px; ставить map.js */
  --fmap-ratio: 1.618;            /* пропорція кадру; map.js бере її з viewBox */
  position: relative;
  margin: 0;
  aspect-ratio: var(--fmap-ratio);
  color: var(--fg);
  border: var(--hairline) solid var(--line-strong);
  overflow: hidden;
  isolation: isolate;
}

.fmap__sheet,
.fmap__leaders {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.fmap__leaders { overflow: visible; pointer-events: none; z-index: 1; }

.fmap__sheet path { vector-effect: non-scaling-stroke; }
.fmap__graticule { fill: none; stroke: var(--tech); stroke-width: .5; opacity: .5; }
.fmap__land { fill: var(--bg-tint); stroke: var(--fg-3); stroke-width: .6; stroke-linejoin: round; }
.fmap__work { fill: var(--line); stroke: none; }
.fmap__border { fill: none; stroke: var(--line-strong); stroke-width: .6; stroke-linejoin: round; }

/* Маршрути: усі п'ять однакові. Без non-scaling-stroke, щоб pathLength=1 лишався в одиницях шляху. */
.fmap__sheet .fmap__route {
  vector-effect: none;
  fill: none;
  stroke: var(--accent-text);
  stroke-width: calc(1.25 * var(--u));
  stroke-linecap: butt;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 0;
}

/* Точки: місце на карті як нульова точка, від якої відкладено виноску */
.fmap__place { position: absolute; width: 0; height: 0; z-index: 2; }
.fmap__mark {
  position: absolute;
  left: -3px; top: -3px;
  width: 6px; height: 6px;
  background: var(--accent-text);
}
.fmap__place--origin .fmap__mark {
  left: -5.5px; top: -5.5px;
  width: 11px; height: 11px;
  background: var(--bg);
  border: var(--hairline) solid var(--fg);
}
.fmap__place--origin .fmap__mark::after {
  content: "";
  position: absolute;
  left: 3px; top: 3px;
  width: 3px; height: 3px;
  background: var(--fg);
}

/* Підпис стоїть на поличці виноски, як напис на кресленні */
.fmap__label {
  position: absolute;
  left: 10px;
  bottom: 6px;
  font: 500 var(--text-label) / 1 var(--font-sans);
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--fg);
  white-space: nowrap;
  font-variant-numeric: lining-nums;
  /* «ореол» паперу: підпис читається поверх берегової лінії */
  text-shadow: 0 0 2px var(--bg), 0 0 4px var(--bg);
}
.fmap.is-placed .fmap__label { bottom: auto; }

.fmap__leader { fill: none; stroke: var(--tech-text); stroke-width: 1; stroke-dasharray: 1 1; stroke-dashoffset: 0; }

/* Масштабна лінійка за мотивом .dim */
.fmap__scale {
  position: absolute;
  left: var(--space-4);
  bottom: var(--space-4);
  z-index: 2;
  width: var(--scale, 12%);
  display: grid;
  gap: 6px;
  color: var(--tech-text);
  font: 500 var(--text-label) / 1 var(--font-sans);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums lining-nums;
}
.fmap__scale-bar { position: relative; height: 1px; background: var(--tech-text); }
.fmap__scale-bar::before,
.fmap__scale-bar::after,
.fmap__scale-bar > i { content: ""; position: absolute; top: -4px; width: 1px; height: 9px; background: var(--tech-text); }
.fmap__scale-bar::before { left: 0; }
.fmap__scale-bar::after { right: 0; }
.fmap__scale-bar > i { left: 50%; top: -2px; height: 5px; }
.fmap__scale-text { position: relative; height: 1em; white-space: nowrap; }
.fmap__scale-text > span { position: absolute; top: 0; transform: translateX(-50%); }
.fmap__scale-text > span:nth-child(1) { left: 0; }
.fmap__scale-text > span:nth-child(2) { left: 50%; }
.fmap__scale-text > span:nth-child(3) { left: 100%; transform: translateX(-1.2em); }
.fmap__scale--short .fmap__scale-text > span:nth-child(2) { display: none; }

/* До прокреслення (лише з JS і без reduced-motion) */
.fmap.is-armed .fmap__route,
.fmap.is-armed .fmap__leader { stroke-dashoffset: 1; }
.fmap.is-armed .fmap__mark,
.fmap.is-armed .fmap__label { opacity: 0; }

@media (max-width: 40em) {
  .fmap__label { letter-spacing: .1em; }
  .fmap__scale { left: var(--space-3); bottom: var(--space-3); }
}
