/* ============================================================
   REGION MAP — template-parts/region-map.php

   A component stylesheet rather than a per-template one, which is
   the exception here: the map is built to sit on the front page and
   on /lokatsia/ once that archive is resolved, and duplicating it
   into two template files is exactly what base.css exists to avoid.
   It is loaded from inc/enqueue.php next to the template that uses it.

   Two renderings of the same links share this file — the SVG figure
   and the plain list. Below 768px the figure is display:none and the
   list carries the section on its own, so nothing here may put
   meaning in the map that the list does not also say.
   ============================================================ */

.region-map {
    padding-bottom: clamp(32px, 5vw, 64px);
}

.region-map__intro {
    max-width: 1480px;
    margin: 0 auto;
    padding: 12px clamp(20px, 4vw, 56px) 0;
    font-size: 0.95rem;
    color: var(--c-ink-faint);
}

.region-map__layout {
    max-width: 1480px;
    margin: 0 auto;
    padding: clamp(20px, 3vw, 32px) clamp(20px, 4vw, 56px) 0;
    display: grid;
    gap: clamp(20px, 3vw, 40px);
    grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 768px) {
    .region-map__layout {
        grid-template-columns: minmax(0, 1fr) 300px;
        align-items: center;
    }
}

/* ------------------------------------------------------------
   The figure
   ------------------------------------------------------------ */
.region-map__figure {
    display: none;
    margin: 0;
}

@media (min-width: 768px) {
    .region-map__figure {
        display: block;
    }
}

.region-map__svg {
    display: block;
    width: 100%;
    height: auto;
    overflow: visible;
}

.region-map__outline {
    fill: var(--c-surface);
    stroke: var(--c-border-strong);
    /* User units, and the SVG renders around 0.85px per unit at the widest
       the column ever gets — so this is a hairline on screen, not 3px. */
    stroke-width: 3;
    stroke-linejoin: round;
}

.region-map__credit {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--c-ink-faint);
}

.region-map__credit a {
    color: inherit;
}

/* ------------------------------------------------------------
   Pins
   ------------------------------------------------------------ */
.region-pin {
    cursor: pointer;
}

.region-pin.is-empty {
    cursor: default;
}

.region-pin__halo {
    fill: var(--c-accent);
    opacity: 0;
    transform-box: fill-box;
    transform-origin: center;
    transform: scale(0.4);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.region-pin__dot {
    fill: var(--c-accent);
    stroke: var(--c-surface);
    stroke-width: 3;
    transition: r 0.18s ease;
}

.region-pin__label {
    font-family: var(--font-display);
    font-size: 26px;
    font-weight: 700;
    fill: var(--c-ink);
    text-anchor: middle;
    /* The label sits over the outline stroke at several pins. Painting the
       stroke first turns the surface color into a knockout behind the
       glyphs instead of a box that would cover the border. */
    paint-order: stroke;
    stroke: var(--c-surface);
    stroke-width: 5;
    stroke-linejoin: round;
}

.region-pin.is-empty .region-pin__dot {
    fill: var(--c-border-strong);
}

.region-pin.is-empty .region-pin__label {
    fill: var(--c-ink-faint);
}

/* Hover on the pin itself, and the same state driven from the list by
   assets/js/region-map.js — one rule, so the two can never drift. */
.region-pin:not(.is-empty):hover .region-pin__halo,
.region-pin.is-active .region-pin__halo {
    opacity: 0.18;
    transform: scale(1);
}

.region-pin:not(.is-empty):hover .region-pin__dot,
.region-pin.is-active .region-pin__dot {
    r: 12;
}

/* ------------------------------------------------------------
   The list — the accessible and mobile rendering
   ------------------------------------------------------------ */
.region-map__list {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

@media (min-width: 480px) and (max-width: 767.98px) {
    .region-map__list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.region-item__link {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 11px 14px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-md);
    background: var(--c-surface);
    color: var(--c-ink);
    text-decoration: none;
    transition: border-color 0.18s ease, transform 0.18s ease;
}

a.region-item__link:hover,
a.region-item__link:focus-visible {
    border-color: var(--c-accent);
    transform: translateX(3px);
}

.region-item.is-empty .region-item__link {
    background: transparent;
    border-style: dashed;
    color: var(--c-ink-faint);
}

.region-item__name {
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 600;
}

.region-item__count {
    flex: none;
    font-size: 0.74rem;
    font-weight: 600;
    color: var(--c-ink-faint);
}

@media (prefers-reduced-motion: reduce) {
    .region-pin__halo,
    .region-pin__dot,
    .region-item__link {
        transition: none;
    }

    a.region-item__link:hover,
    a.region-item__link:focus-visible {
        transform: none;
    }
}
