/* ==========================================================================
   HOLON REGION ATLAS
   ========================================================================== */

:root {
    --holon-ink: #241e1a;
    --holon-ink-soft: #62564d;
    --holon-parchment: #efe0bd;
    --holon-parchment-light: #fff8e8;
    --holon-green: #486b5a;
    --holon-green-dark: #203d36;
    --holon-blue: #8ed9dc;
    --holon-gold: #d7a94c;
}

* {
    scrollbar-color: var(--holon-green) var(--holon-parchment);
}

.holon-page {
    min-height: 100vh;
    display: block;
    padding: 28px 24px 48px;
    color: var(--holon-ink);
    background:
        radial-gradient(circle at 12% 8%, rgba(255, 248, 232, 0.75), transparent 30%),
        linear-gradient(135deg, #d8c292 0%, #f1e3c0 48%, #c7d0b5 100%);
    font-family: "Martel", Georgia, serif;
}

.holon-shell {
    width: min(1240px, 100%);
    margin: 0 auto;
}

.holon-header {
    position: relative;
    max-width: 760px;
    margin: 0 auto 24px;
    text-align: center;
}

.holon-back-link {
    position: absolute;
    top: 0;
    left: 0;
    color: var(--holon-green-dark);
    font-size: 0.74rem;
    font-weight: 700;
    text-decoration: none;
}

.holon-back-link:hover,
.holon-back-link:focus-visible {
    color: #152b27;
    text-decoration: underline;
}

.holon-kicker {
    color: var(--holon-green);
    font-size: 0.7rem;
    font-weight: 900;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.holon-header .holon-kicker {
    text-transform: none;
}

.holon-header h1 {
    margin: 12px 0 4px;
    color: var(--holon-ink);
    font-size: clamp(2rem, 5vw, 3.4rem);
    font-style: normal;
    letter-spacing: -0.04em;
    text-shadow: 0 2px 0 rgba(255, 248, 232, 0.65);
}

.holon-header p {
    margin: 0;
    color: var(--holon-ink-soft);
    font-size: 0.9rem;
}

.holon-main {
    width: 100%;
}

.holon-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.holon-view-switcher,
.map-controls {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px;
    border: 1px solid rgba(36, 30, 26, 0.22);
    border-radius: 999px;
    background: rgba(255, 248, 232, 0.7);
    box-shadow: 0 5px 18px rgba(64, 49, 32, 0.1);
}

.view-toggle,
.map-controls button {
    border: 0;
    border-radius: 999px;
    padding: 8px 14px;
    color: var(--holon-ink-soft);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 0.74rem;
    font-weight: 700;
}

.view-toggle:hover,
.view-toggle:focus-visible,
.map-controls button:hover,
.map-controls button:focus-visible {
    color: var(--holon-ink);
    background: rgba(255, 255, 255, 0.65);
    outline: none;
}

.view-toggle.is-active {
    color: var(--holon-parchment-light);
    background: var(--holon-green-dark);
}

.map-controls button {
    min-width: 34px;
    padding-inline: 9px;
}

.map-controls #zoom-out,
.map-controls #zoom-in {
    color: var(--holon-green-dark);
    font-size: 1rem;
}

.map-controls[hidden] {
    display: none;
}

.map-controls .markers-toggle {
    padding-inline: 14px;
    color: var(--holon-green-dark);
}

.markers-layer[hidden] {
    display: none;
}

.holon-view[hidden] {
    display: none;
}

.map-experience {
    position: relative;
}

.map-viewport {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 3 / 2;
    border: 8px solid var(--holon-ink);
    border-radius: 6px;
    background: var(--holon-parchment);
    box-shadow:
        0 18px 44px rgba(55, 40, 24, 0.27),
        inset 0 0 0 2px rgba(255, 248, 232, 0.48);
    cursor: grab;
    touch-action: none;
    user-select: none;
}

.map-viewport.is-dragging {
    cursor: grabbing;
}

.map-stage {
    position: relative;
    width: 100%;
    height: 100%;
    transform: translate(0, 0) scale(1);
    transform-origin: center;
    transition: transform 220ms ease;
    will-change: transform;
}

.map-stage > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
}

.markers-layer {
    position: absolute;
    inset: 0;
}

.map-marker {
    position: absolute;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    color: var(--holon-parchment-light);
    background: transparent;
    cursor: pointer;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 2px 4px rgba(23, 33, 30, 0.75));
    transition: transform 160ms ease, filter 160ms ease;
}

.map-marker::before,
.map-marker::after {
    position: absolute;
    content: "";
    border-radius: 50%;
}

.map-marker::before {
    width: 29px;
    height: 29px;
    border: 2px solid var(--holon-parchment-light);
    background: var(--holon-green-dark);
    box-shadow:
        0 0 0 3px rgba(32, 61, 54, 0.55),
        inset 0 0 0 2px rgba(215, 169, 76, 0.8);
}

.map-marker::after {
    width: 7px;
    height: 7px;
    background: var(--holon-gold);
    transform: rotate(45deg);
}

.map-marker span {
    position: relative;
    z-index: 1;
    width: 7px;
    height: 7px;
}

.map-marker:hover,
.map-marker:focus-visible,
.map-marker.is-selected {
    z-index: 2;
    filter: drop-shadow(0 3px 8px rgba(23, 33, 30, 0.9));
    transform: translate(-50%, -50%) scale(1.18);
    outline: none;
}

.map-marker.is-selected::before {
    background: #315f52;
    box-shadow:
        0 0 0 5px rgba(142, 217, 220, 0.55),
        inset 0 0 0 2px var(--holon-gold);
}

.map-coordinates {
    position: absolute;
    z-index: 3;
    right: 12px;
    bottom: 12px;
    padding: 5px 8px;
    border: 1px solid rgba(36, 30, 26, 0.42);
    border-radius: 3px;
    color: var(--holon-parchment-light);
    background: rgba(32, 61, 54, 0.88);
    box-shadow: 0 3px 8px rgba(36, 30, 26, 0.26);
    font-family: Georgia, serif;
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.03em;
    pointer-events: none;
}

.map-caption {
    margin: 10px 2px 0;
    color: var(--holon-ink-soft);
    font-size: 0.72rem;
    font-style: italic;
}

.lore-panel {
    position: fixed;
    z-index: 5;
    top: 50%;
    left: 50%;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(220px, 0.9fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 24px;
    row-gap: 5px;
    width: min(900px, calc(100vw - 40px));
    aspect-ratio: 16 / 10;
    max-height: min(560px, calc(100vh - 40px));
    overflow: hidden;
    padding: 26px 28px 22px;
    border: 2px solid var(--holon-ink);
    border-radius: 5px;
    color: var(--holon-ink);
    background:
        linear-gradient(rgba(255, 248, 232, 0.94), rgba(239, 224, 189, 0.96)),
        var(--holon-parchment-light);
    box-shadow: 0 14px 30px rgba(36, 30, 26, 0.3);
    transform: translate(-50%, -50%);
}

.lore-panel[hidden] {
    display: none;
}

.panel-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    color: var(--holon-ink-soft);
    background: transparent;
    cursor: pointer;
    font: inherit;
    font-size: 1.5rem;
    line-height: 1;
}

.panel-close:hover,
.panel-close:focus-visible {
    color: var(--holon-ink);
    background: rgba(72, 107, 90, 0.12);
    outline: none;
}

.lore-subtitle {
    grid-column: 1;
    grid-row: 1;
    padding-right: 25px;
    color: var(--holon-green);
    font-size: 0.68rem;
    font-weight: 900;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.lore-panel h2 {
    grid-column: 1;
    grid-row: 2;
    margin: 5px 0 10px;
    color: var(--holon-ink);
    font-family: "Martel", Georgia, serif;
    font-size: 1.35rem;
    line-height: 1.2;
}

.lore-copy {
    grid-column: 1;
    grid-row: 3;
    min-height: 0;
    overflow: auto;
    margin: 0;
    color: var(--holon-ink-soft);
    font-family: Georgia, serif;
    font-size: 0.9rem;
    line-height: 1.6;
    white-space: pre-line;
}

.lore-card-viewer {
    grid-column: 2;
    grid-row: 1 / 4;
    display: grid;
    grid-template-columns: 32px 1fr 32px;
    align-items: center;
    gap: 8px;
    min-width: 0;
    margin: 0;
}

.card-nav {
    width: 32px;
    height: 32px;
    border: 1px solid rgba(36, 30, 26, 0.3);
    border-radius: 50%;
    color: var(--holon-green-dark);
    background: rgba(255, 255, 255, 0.45);
    cursor: pointer;
    font: inherit;
    font-size: 1rem;
}

.card-nav:hover,
.card-nav:focus-visible {
    border-color: var(--holon-green);
    background: #fff8e8;
    outline: none;
}

.card-nav:disabled {
    cursor: default;
    opacity: 0.35;
}

.lore-card-frame {
    display: grid;
    place-items: center;
    min-height: 0;
}

.card-image-button {
    display: grid;
    place-items: center;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.lore-card-frame img {
    display: block;
    width: min(220px, 100%);
    max-height: 310px;
    aspect-ratio: 2.5 / 3.5;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(36, 30, 26, 0.24);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.card-image-button:hover img,
.card-image-button:focus-visible img {
    transform: translateY(-2px);
    box-shadow: 0 11px 20px rgba(36, 30, 26, 0.3);
}

.card-image-button:focus-visible {
    outline: 2px solid var(--holon-green-dark);
    outline-offset: 5px;
}

.lore-card-meta {
    grid-column: 2;
    grid-row: 4;
    min-width: 0;
    margin-top: 4px;
    text-align: center;
}

.lore-card-meta strong {
    display: block;
    font-size: 0.9rem;
}

.lore-card-count {
    display: block;
    margin-top: 2px;
    color: var(--holon-green);
    font-size: 0.68rem;
    font-weight: 700;
}

.lore-card-meta p {
    max-width: 340px;
    margin: 9px auto 0;
    color: var(--holon-ink-soft);
    font-family: Georgia, serif;
    font-size: 0.8rem;
    line-height: 1.55;
}

.gallery-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 16px;
    padding: 0 4px;
}

.gallery-heading h2 {
    margin: 5px 0 0;
    color: var(--holon-ink);
    font-family: "Martel", Georgia, serif;
    font-size: 1.7rem;
}

.gallery-heading p {
    max-width: 300px;
    margin: 0;
    color: var(--holon-ink-soft);
    font-size: 0.78rem;
    text-align: right;
}

.card-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
    gap: 16px;
}

.gallery-section + .gallery-section {
    margin-top: 34px;
    padding-top: 28px;
    border-top: 1px solid rgba(36, 30, 26, 0.22);
}

.gallery-section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 14px;
    padding: 0 4px;
}

.gallery-section-heading h3 {
    margin: 5px 0 0;
    color: var(--holon-ink);
    font-family: "Martel", Georgia, serif;
    font-size: 1.3rem;
}

.gallery-section-intro {
    max-width: 760px;
    margin: 0 4px 18px;
    color: var(--holon-ink-soft);
    font-family: Georgia, serif;
    font-size: 0.84rem;
    line-height: 1.6;
}

.gallery-section-intro a {
    color: var(--holon-green-dark);
    text-underline-offset: 2px;
}

.gallery-section-intro a:hover,
.gallery-section-intro a:focus-visible {
    color: var(--holon-green);
}

.gallery-empty {
    margin: 16px 4px 0;
    padding: 16px;
    border: 1px dashed rgba(36, 30, 26, 0.3);
    border-radius: 5px;
    color: var(--holon-ink-soft);
    background: rgba(255, 248, 232, 0.42);
    font-family: Georgia, serif;
    font-size: 0.8rem;
    text-align: center;
}

.gallery-empty[hidden] {
    display: none;
}

.gallery-empty code {
    color: var(--holon-green-dark);
    font-family: inherit;
    font-weight: 700;
}

.gallery-card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px;
    border: 1px solid rgba(36, 30, 26, 0.25);
    border-radius: 6px;
    background: rgba(255, 248, 232, 0.72);
    box-shadow: 0 8px 20px rgba(64, 49, 32, 0.1);
}

.gallery-card img {
    width: 100%;
    aspect-ratio: 2.5 / 3.5;
    object-fit: contain;
    border-radius: 5px;
    box-shadow: 0 5px 12px rgba(36, 30, 26, 0.18);
}

.gallery-card-image-button {
    display: block;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: zoom-in;
}

.gallery-card-image-button:focus-visible {
    outline: 2px solid var(--holon-green-dark);
    outline-offset: 4px;
}

.gallery-card-image-button img {
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.gallery-card-image-button:hover img,
.gallery-card-image-button:focus-visible img {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(36, 30, 26, 0.25);
}

.gallery-card h3 {
    margin: 10px 0 2px;
    color: var(--holon-ink);
    font-size: 0.86rem;
}

.gallery-card-location {
    color: var(--holon-green);
    font-size: 0.68rem;
    font-weight: 700;
}

.gallery-card-description {
    margin: 8px 0 12px;
    color: var(--holon-ink-soft);
    font-family: Georgia, serif;
    font-size: 0.73rem;
    line-height: 1.45;
}

.gallery-card-map-button {
    width: 100%;
    margin-top: auto;
    padding: 8px 10px;
    border: 1px solid rgba(36, 30, 26, 0.26);
    border-radius: 999px;
    color: var(--holon-parchment-light);
    background: var(--holon-green-dark);
    cursor: pointer;
    font: inherit;
    font-size: 0.7rem;
    font-weight: 700;
}

.gallery-card-map-button:hover,
.gallery-card-map-button:focus-visible {
    background: var(--holon-green);
    outline: none;
}

.card-lightbox {
    position: fixed;
    z-index: 30;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(20, 25, 23, 0.84);
}

.card-lightbox[hidden] {
    display: none;
}

.lightbox-content {
    display: flex;
    align-items: center;
    flex-direction: column;
    max-width: min(560px, 92vw);
    max-height: calc(100vh - 48px);
    padding: 22px;
    border: 2px solid var(--holon-parchment-light);
    border-radius: 6px;
    background: var(--holon-parchment-light);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.42);
}

.lightbox-card-image {
    display: block;
    width: auto;
    max-width: min(440px, 82vw);
    max-height: min(76vh, 700px);
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 10px 24px rgba(36, 30, 26, 0.3);
}

.lightbox-caption {
    display: flex;
    align-items: center;
    flex-direction: column;
    gap: 3px;
    margin-top: 12px;
    color: var(--holon-ink);
    text-align: center;
}

.lightbox-caption strong {
    font-size: 0.98rem;
}

.lightbox-caption span {
    color: var(--holon-green);
    font-size: 0.72rem;
    font-weight: 700;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 22px;
    width: 40px;
    height: 40px;
    border: 1px solid rgba(255, 248, 232, 0.7);
    border-radius: 50%;
    color: var(--holon-parchment-light);
    background: rgba(32, 61, 54, 0.9);
    cursor: pointer;
    font: inherit;
    font-size: 1.8rem;
    line-height: 1;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
    background: var(--holon-green);
    outline: none;
}

@media (max-width: 800px) {
    .holon-page {
        padding: 16px 14px 34px;
    }

    .holon-header {
        padding-top: 34px;
    }

    .holon-back-link {
        right: 0;
        left: auto;
    }

    .holon-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .holon-view-switcher,
    .map-controls {
        justify-content: center;
    }

    .map-viewport {
        border-width: 5px;
    }

    .lore-panel {
        grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
        grid-template-rows: auto auto minmax(0, 1fr);
        column-gap: 10px;
        width: min(640px, calc(100vw - 24px));
        aspect-ratio: 4 / 3;
        max-height: calc(100vh - 24px);
        padding: 16px 12px;
    }

    .lore-card-viewer {
        grid-template-columns: 24px minmax(0, 1fr) 24px;
        grid-row: 1 / 3;
        gap: 4px;
    }

    .lore-card-meta {
        grid-row: 3;
        align-self: start;
    }

    .lore-card-viewer .card-nav {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }

    .lore-subtitle {
        font-size: 0.55rem;
        letter-spacing: 0.06em;
    }

    .lore-card-frame {
        min-height: 0;
    }

    .lore-card-frame img {
        width: min(150px, 100%);
        max-height: 190px;
    }

    .lore-panel h2 {
        margin: 3px 0 5px;
        font-size: 0.95rem;
    }

    .lore-copy {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    .lore-card-meta p {
        max-height: 40px;
        overflow: auto;
        font-size: 0.66rem;
        line-height: 1.3;
    }

    .lore-card-meta strong {
        font-size: 0.72rem;
    }

    .gallery-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .gallery-heading p {
        max-width: none;
        text-align: left;
    }

    .gallery-section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
    }

    .map-coordinates {
        right: 8px;
        bottom: 8px;
        font-size: 0.6rem;
    }

    .card-lightbox {
        padding: 14px;
    }

    .lightbox-content {
        max-width: 94vw;
        padding: 14px;
    }

    .lightbox-card-image {
        max-width: 82vw;
        max-height: 72vh;
    }

    .lightbox-close {
        top: 12px;
        right: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-stage,
    .map-marker {
        transition: none;
    }
}