/* =============================================================================
   イラストマップ ビューア
   既存の .leaflet-modal と同じデザイン言語（暗幕・白文字・ピル型ボタン）に揃える。
   ============================================================================= */

.map-modal {
    position: fixed;
    inset: 0;
    z-index: 3000;
    display: none;
}
.map-modal.is-open { display: block; }
body.map-modal-open { overflow: hidden; }

.map-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 15, 10, 0.94);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 1;
    cursor: pointer;
}

.map-modal__inner {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    flex-direction: column;
    padding: 14px clamp(10px, 3vw, 28px) 12px;
    box-sizing: border-box;
}

/* --- ヘッダー --- */
.map-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 2px 10px;
    color: #fff;
    flex-shrink: 0;
}
.map-modal__title {
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: 0.05em;
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.map-modal__dl {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.15s;
    flex-shrink: 0;
}
.map-modal__dl:hover,
.map-modal__dl:focus-visible { background: rgba(255, 255, 255, 0.28); }

.map-modal__close {
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.15s;
    flex-shrink: 0;
    padding: 0;
}
.map-modal__close:hover,
.map-modal__close:focus-visible { background: rgba(255, 255, 255, 0.28); }

/* --- 画像ステージ --- */
.map-modal__stage {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 8px;
    background: #fff;
    touch-action: none;             /* ピンチ・ドラッグを自前で処理 */
    cursor: grab;
}
.map-modal__stage.is-panning { cursor: grabbing; }

.map-modal__img {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: 0 0;
    will-change: transform;
    user-select: none;
    -webkit-user-drag: none;
    max-width: none;                /* 既定の max-width:100% を打ち消す */
}
/* 高解像度版が読み込まれるまでは軽量版を表示 */
.map-modal__img--full { opacity: 0; transition: opacity 0.25s ease; }
.map-modal__img--full.is-ready { opacity: 1; }

.map-modal__loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #7a6a58;
    font-size: 0.85rem;
    pointer-events: none;
}
.map-modal__loading.is-hidden { display: none; }

/* --- 操作バー --- */
.map-modal__controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding-top: 10px;
    color: #fff;
    flex-shrink: 0;
    flex-wrap: wrap;
}
.map-modal__zoom {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: #fff;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s;
    padding: 0;
}
.map-modal__zoom:hover:not(:disabled),
.map-modal__zoom:focus-visible { background: rgba(255, 255, 255, 0.28); }
.map-modal__zoom:disabled { opacity: 0.35; cursor: default; }

.map-modal__reset {
    padding: 9px 16px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 999px;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.map-modal__reset:hover,
.map-modal__reset:focus-visible { background: rgba(255, 255, 255, 0.28); }

.map-modal__hint {
    width: 100%;
    text-align: center;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.65);
    margin-top: 2px;
}
.map-modal__hint .is-touch-only { display: none; }

/* キーボード操作時のフォーカスを明示 */
.map-modal :focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

@media (hover: none) {
    .map-modal__hint .is-mouse-only { display: none; }
    .map-modal__hint .is-touch-only { display: inline; }
}

@media (max-width: 640px) {
    .map-modal__inner { padding: 10px 10px 10px; }
    .map-modal__title { font-size: 0.9rem; }
    .map-modal__dl span { display: none; }   /* アイコンのみに */
    .map-modal__dl { padding: 8px 11px; }
}

@media (prefers-reduced-motion: reduce) {
    .map-modal__img--full { transition: none; }
}
