/* =====================================================
   Kirifuri Interactive Map — フロントエンドCSS
   ===================================================== */

/* ─── ラッパー ──────────────────────────────────────── */
.kim-wrap {
    width: 100%;
    font-family: 'Hiragino Sans', 'Meiryo', 'Yu Gothic', sans-serif;
}

.kim-title {
    font-size: 1.25rem;
    color: #3a2a1a;
    margin: 0 0 12px;
    text-align: center;
}

/* ─── ビューポート ──────────────────────────────────── */
.kim-viewport {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.22);
    cursor: grab;
    touch-action: none;
    background: #c8e6c0;
    user-select: none;
}

.kim-viewport.is-grabbing { cursor: grabbing; }

/* ─── インナー（変形対象） ──────────────────────────── */
.kim-inner {
    position: relative;
    transform-origin: 0 0;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
}

/* ─── 背景画像 ──────────────────────────────────────── */
.kim-bg {
    display: block;
    width: 100%;
    height: auto;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    -webkit-user-select: none;
}

/* ─── 画像未設定 ────────────────────────────────────── */
.kim-no-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    color: #888;
    font-size: .95rem;
    gap: 8px;
}

.kim-no-image a {
    color: #4285F4;
    text-decoration: none;
}

/* ─── ピン ──────────────────────────────────────────── */
.kim-pin {
    position: absolute;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    transform: translate(-50%, -100%);
    z-index: 10;
    line-height: 1;
    /* ピンのスケール変換の基点を下端に（ピンが動かないよう） */
    transform-origin: center bottom;
}

.kim-pin-label {
    display: block;
    background: rgba(255, 255, 255, 0.93);
    color: #3a2a1a;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    padding: 2px 7px;
    border-radius: 4px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
    margin-bottom: 3px;
    pointer-events: none;
    text-align: center;
}

.kim-pin-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 3px solid #fff;
    border-radius: 50% 50% 50% 0;
    transform: rotate(-45deg);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.32);
    transition: transform 0.15s ease;
    margin: 0 auto;
}

.kim-pin-icon > span {
    transform: rotate(45deg);
    font-size: 15px;
    display: block;
    line-height: 1;
}

.kim-pin:hover .kim-pin-icon,
.kim-pin:focus .kim-pin-icon {
    transform: rotate(-45deg) scale(1.22);
}

.kim-pin:focus { outline: none; }

/* ─── ズームコントロール ────────────────────────────── */
.kim-zoom-controls {
    position: absolute;
    bottom: 14px;
    right: 14px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    z-index: 20;
}

.kim-zoom-btn {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.92);
    border: none;
    border-radius: 8px;
    font-size: 1.2rem;
    line-height: 1;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
    padding: 0;
}

.kim-zoom-btn:hover { background: #fff; }

/* ─── ヒント ────────────────────────────────────────── */
.kim-hint {
    font-size: .75rem;
    color: #999;
    margin: 8px 0 0;
    text-align: center;
    line-height: 1.6;
}

/* ─── 凡例 ──────────────────────────────────────────── */
.kim-legend {
    margin-top: 14px;
    background: #fff;
    border-radius: 10px;
    padding: 12px 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    font-size: .84rem;
    color: #555;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    align-items: center;
}

.kim-legend strong {
    color: #3a2a1a;
    width: 100%;
    margin-bottom: 2px;
    font-size: .8rem;
    letter-spacing: .04em;
}

.kim-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 3px 6px;
    border-radius: 5px;
    cursor: pointer;
    font-family: inherit;
    font-size: .84rem;
    color: #555;
    transition: background 0.12s;
}

.kim-legend-item:hover {
    background: #f5f0e8;
    color: #3a2a1a;
}

.kim-legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.28);
    flex-shrink: 0;
}

/* ─── ポップアップ オーバーレイ ─────────────────────── */
.kim-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.42);
    z-index: 999999;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.kim-overlay.is-active { display: flex; }

/* ─── ポップアップ本体 ──────────────────────────────── */
.kim-popup {
    position: relative;
    background: #fff;
    border-radius: 14px;
    max-width: 420px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.28);
    animation: kimPopIn .18s ease;
}

@keyframes kimPopIn {
    from { opacity: 0; transform: scale(.92); }
    to   { opacity: 1; transform: scale(1); }
}

.kim-popup-close {
    position: absolute;
    top: 10px;
    right: 11px;
    background: rgba(0, 0, 0, 0.48);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: background .15s;
    padding: 0;
    line-height: 1;
}

.kim-popup-close:hover { background: rgba(0, 0, 0, 0.72); }

.kim-popup-photo {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: 14px 14px 0 0;
    display: block;
}

.kim-popup-body {
    padding: 16px 20px 20px;
}

.kim-popup-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: #3a2a1a;
    margin-bottom: 8px;
    line-height: 1.4;
}

.kim-popup-desc {
    font-size: .88rem;
    color: #555;
    line-height: 1.68;
    margin-bottom: 16px;
}

.kim-popup-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.kim-btn-maps {
    flex: 1;
    min-width: 160px;
    background: #4285F4;
    color: #fff !important;
    border: none;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: .88rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    transition: background .15s;
    line-height: 1.4;
}

.kim-btn-maps:hover { background: #3367d6; }

.kim-btn-close-inner {
    background: #eee;
    color: #333;
    border: none;
    border-radius: 8px;
    padding: 10px 18px;
    font-size: .88rem;
    cursor: pointer;
    transition: background .15s;
}

.kim-btn-close-inner:hover { background: #ddd; }

/* ─── レスポンシブ ──────────────────────────────────── */
@media (max-width: 600px) {
    .kim-title { font-size: 1.1rem; }

    .kim-popup { border-radius: 10px; }

    .kim-popup-photo { height: 160px; border-radius: 10px 10px 0 0; }

    .kim-legend { font-size: .8rem; gap: 5px 12px; }

    .kim-btn-maps { min-width: 0; }

    .kim-hint { font-size: .72rem; }
}
