/*
 * 세계 지도(templates/_world-map.php) — 지역 모양 · 들림 효과 · 이름표. 점의 색은 game-map.css 의 것을 그대로 쓴다.
 * 색은 tokens.css 의 --map-* 이다(지도 그림은 테마와 관계없이 같다).
 */

/* 바다를 잘라 낸 범위(틀) — 틀은 그 범위의 비율이고(--crop-ratio), 지도는 틀보다 크게(--crop-width) 그려 왼쪽 · 위로 옮긴다.
   값은 _world-map.php 가 GameMap::crop() 의 범위로 셈해 style 에 넣는다 */
.world-map__frame {
    aspect-ratio: var(--crop-ratio);
    overflow: hidden;
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius);
    background: var(--map-halo);
}

.world-map__view {
    position: relative;
    width: var(--crop-width);
    margin-left: var(--crop-left);
    margin-top: var(--crop-top);
}

.world-map__image {
    display: block;
    width: 100%;
    height: auto;
}

.world-map__layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
}

/* 점을 잇는 선(lines — 이동 경로). 색 · 무늬는 game-map.css 의 .game-map__line 과 그 화면의 CSS */
.world-map__layer .game-map__line {
    fill: none;
    vector-effect: non-scaling-stroke;
    stroke-linecap: round;
    stroke-linejoin: round;
    pointer-events: none;
}

/* 지역 — 평소에는 오려 둔 조각을 감춘다. 모양(다각형)은 투명하게 칠해 두어 마우스가 그 지역 안에서만 닿는다 */
/* 키울 때의 가운데(transform-origin)는 _world-map.php 가 지역마다 무게 중심으로 style 에 넣는다(지도 좌표 — view-box 기준) */
.world-map__lift {
    opacity: 0;
    transform-box: view-box;
    transition: transform 0.16s ease, opacity 0.16s ease, filter 0.16s ease;
}

.world-map__edge {
    fill: transparent;
    stroke: none;
}

/* 들림 — 지역 조각을 위로 조금 옮기고 키워, 그림자와 밝기로 떠 보이게 한다. 목록 줄 · 이름표에 마우스가 가도 같다(is-active — game-map.js) */
.world-map__zone:hover .world-map__lift,
.world-map__zone:focus-visible .world-map__lift,
.world-map__zone.is-active .world-map__lift {
    opacity: 1;
    transform: translateY(-6px) scale(1.05);
    filter: drop-shadow(0 6px 4px rgba(0, 0, 0, 0.6)) brightness(1.12) saturate(1.1);
}

.world-map__zone:hover .world-map__edge,
.world-map__zone:focus-visible .world-map__edge,
.world-map__zone.is-active .world-map__edge {
    stroke: var(--map-label);
    stroke-width: 1.5px;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.world-map__zone:focus {
    outline: none;
}

/* 움직임을 줄이도록 설정한 사람에게는 옮기지 않고 밝게만 */
@media (prefers-reduced-motion: reduce) {
    .world-map__lift {
        transition: none;
    }

    .world-map__zone:hover .world-map__lift,
    .world-map__zone:focus-visible .world-map__lift,
    .world-map__zone.is-active .world-map__lift {
        transform: none;
    }
}

/* 이름표 — 지도의 좌표(화소)로 그려 지도와 함께 줄어든다. 어두운 꼬리표(.world-map__tag) 위에 쓴다.
   글자 크기(이름 9 · 작은 줄 8)는 _world-map.php 가 이름표 자리를 셈할 때 쓰는 값과 같아야 한다 — 바꾸면 거기도 바꾼다.
   태블릿 너비에서는 지도와 함께 줄어 작아진다(키우면 셈한 자리와 달라져 이름표가 덮인다) */
.world-map__label {
    cursor: pointer;
}

/* 꼬리표 — 이름표 뒤의 어두운 바탕. 그림 위에서도 글이 또렷하게 읽히고, 이름표끼리의 경계가 보인다 */
.world-map__tag {
    fill: var(--map-tag-bg);
    stroke: var(--map-tag-border);
    stroke-width: 0.6px;
    transition: fill 0.12s ease;
}

.world-map__label:hover .world-map__tag,
.world-map__label.is-active .world-map__tag {
    fill: var(--map-tag-active);
}

.world-map__name,
.world-map__sub {
    text-anchor: middle;
    pointer-events: auto;
}

.world-map__name {
    fill: var(--map-label);
    /* SVG 글자는 지도 좌표 단위다. 꼬리표 크기를 templates/_world-map.php 가 이 크기(이름 9 · 작은 줄 8)로 셈해 px 로 둔다 */
    font-size: 9px;
    font-weight: 700;
}

.world-map__sub {
    fill: var(--map-tag-sub);
    font-size: 8px;
}

.world-map__sub--xp {
    fill: var(--map-tag-xp);
    font-weight: 600;
}

.world-map__label:hover .world-map__sub--xp,
.world-map__label.is-active .world-map__sub--xp {
    fill: var(--map-label);
}

/* 이름표를 옮겼으면 지역 가운데(점)와 선으로 잇는다(_world-map.php · MapLabelLayout). 선 · 점은 모든 이름표 아래에 그린다.
   마우스를 받지 않는다 — 선 아래 지역에 마우스가 가야 한다. 그 지역이 들리면(is-active) 선을 짙게 한다 */
.world-map__pointer {
    pointer-events: none;
}

.world-map__leader {
    stroke: var(--map-label);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
    opacity: 0.85;
}

.world-map__pointer.is-active .world-map__leader {
    stroke-width: 2px;
    opacity: 1;
}

.world-map__anchor {
    fill: var(--map-label);
    stroke: var(--map-halo);
    stroke-width: 1px;
    vector-effect: non-scaling-stroke;
}

/* 좁은 화면에서는 이름표가 겹쳐 읽을 수 없다. 지역 모양은 그대로 눌러 고른다 */
@media (max-width: 47.9375em) {
    .world-map__labels {
        display: none;
    }
}
