/* 摄影：2D 地图 + 地名 + 照片墙 + 大图 */

.map-card {
    --map-land: var(--paper-2);
    --map-land-context: var(--paper);
    --map-border: var(--line-strong);
    --map-border-context: var(--line);
    position: relative;
    margin: 0;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--r-l);
    background: var(--surface);
}
.map-stage { position: relative; min-height: 240px; }
.map-stage svg { display: block; width: 100%; height: auto; max-height: 72vh; }
.map-status { display: grid; place-items: center; min-height: 240px; margin: 0; color: var(--muted); font-size: 14px; }
.map-status.error { color: var(--danger); }

.map-land {
    fill: var(--map-land);
    stroke: var(--map-border);
    stroke-width: 0.6;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}
.map-context .map-land { fill: var(--map-land-context); stroke: var(--map-border-context); }
.as-country .map-land.has-photos { stroke: var(--surface); stroke-width: 0.3; }
.as-country:hover .map-land.has-photos,
.as-country:focus-within .map-land.has-photos { fill-opacity: 1; }
.as-country .map-land.has-photos:hover,
.as-country .map-land.has-photos:focus-visible { stroke: var(--surface); stroke-width: 0.3; }
html[data-theme="dark"] .map-card {
    --map-land: #262B35;
    --map-land-context: #20242C;
    --map-border: #3A414D;
    --map-border-context: #2C323C;
}
.map-land.has-photos { cursor: pointer; fill: var(--accent); stroke: var(--surface); stroke-width: 0.8; }
.map-land.lv1 { fill-opacity: 0.28; }
.map-land.lv2 { fill-opacity: 0.48; }
.map-land.lv3 { fill-opacity: 0.68; }
.map-land.lv4 { fill-opacity: 0.88; }
.map-land.has-photos:hover,
.map-land.has-photos:focus-visible { fill-opacity: 1; stroke: var(--ink); stroke-width: 1.2; outline: none; }
.map-land.selected { fill: var(--accent-ink); fill-opacity: 1; stroke: var(--ink); stroke-width: 1.4; }
html[data-theme="dark"] .map-land.selected { fill: var(--accent-ink); }

.map-tooltip {
    position: absolute;
    z-index: 5;
    padding: 6px 10px;
    border-radius: var(--r-s);
    background: var(--ink);
    color: var(--paper);
    font-size: 13px;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    transform: translate(-50%, calc(-100% - 12px));
}
.map-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 8px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}
.legend-scale { display: inline-flex; gap: 2px; }
.legend-scale i { width: 18px; height: 8px; border-radius: 2px; background: var(--accent); }
.legend-scale .lv1 { opacity: 0.28; }
.legend-scale .lv2 { opacity: 0.48; }
.legend-scale .lv3 { opacity: 0.68; }
.legend-scale .lv4 { opacity: 0.88; }

.places { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; }
.places .pill .n { margin-left: 2px; }

.gallery { margin-top: 40px; padding-top: 24px; border-top: 1px solid var(--line); }
.gallery-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-bottom: 18px; }
.gallery-title { margin: 0; color: var(--ink); font-size: 24px; font-weight: 600; line-height: 1.35; }

/* 照片墙：按列排布，保留照片原本的长宽比 */
.gallery-grid { columns: 3 260px; column-gap: 12px; }
.photo-card {
    display: block;
    width: 100%;
    margin: 0 0 12px;
    padding: 0;
    border: 0;
    border-radius: var(--r-m);
    background: var(--paper-2);
    color: inherit;
    text-align: left;
    overflow: hidden;
    cursor: zoom-in;
    break-inside: avoid;
}
.photo-card figure { position: relative; margin: 0; }
.photo-card img { display: block; width: 100%; height: auto; }
.photo-card figcaption {
    position: absolute;
    inset: auto 0 0 0;
    padding: 28px 12px 10px;
    background: linear-gradient(rgba(10, 13, 18, 0), rgba(10, 13, 18, 0.6));
    color: #FFFFFF;
    font-size: 14px;
    line-height: 1.4;
    opacity: 0;
    transition: opacity 0.18s var(--ease);
}
.photo-card figcaption span { display: block; margin-top: 2px; font-size: 12px; opacity: 0.85; }
.photo-card:hover figcaption,
.photo-card:focus-visible figcaption { opacity: 1; }
@media (hover: none) { .photo-card figcaption { opacity: 1; } }
.gallery-more { display: flex; justify-content: center; margin-top: 12px; }

/* 大图：暗房一样的深色底，两种主题都一样 */
.lightbox {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(10, 12, 16, 0.96);
    color: #EEF1F5;
}
.lightbox::backdrop { background: rgba(10, 12, 16, 0.96); }
.lightbox[open] { display: grid; grid-template-columns: 64px minmax(0, 1fr) 64px; align-items: center; }
.lightbox-figure { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 0; padding: 56px 0 24px; min-height: 0; }
.lightbox-figure img { max-width: 100%; max-height: calc(100dvh - 150px); object-fit: contain; border-radius: 4px; }
.lightbox-figure figcaption { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 14px; font-size: 14px; text-align: center; }
.lightbox-figure figcaption span { color: #A9B0BC; }
.lightbox-btn {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 1px solid rgba(238, 241, 245, 0.2);
    border-radius: 999px;
    background: rgba(238, 241, 245, 0.06);
    color: #EEF1F5;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}
.lightbox-btn:hover { background: rgba(238, 241, 245, 0.16); }
.lightbox-btn:focus-visible { outline-color: #EEF1F5; }
.lightbox-prev { grid-column: 1; justify-self: center; }
.lightbox-next { grid-column: 3; justify-self: center; }
.lightbox-close { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: max(12px, env(safe-area-inset-right, 0px)); }

@media (max-width: 640px) {
    .map-card { padding: 6px; }
    .gallery-grid { columns: 2 150px; column-gap: 8px; }
    .photo-card { margin-bottom: 8px; }
    .lightbox[open] { grid-template-columns: 1fr 1fr; grid-template-rows: minmax(0, 1fr) auto; }
    .lightbox-figure { grid-column: 1 / -1; grid-row: 1; padding: 56px 12px 8px; }
    .lightbox-prev, .lightbox-next { grid-row: 2; margin-bottom: calc(16px + env(safe-area-inset-bottom, 0px)); }
    .lightbox-prev { grid-column: 1; }
    .lightbox-next { grid-column: 2; }
}
