/* Center map page: chrome, tabs, 3D overview. 2D route styles live in map-2d.css */

.map-page .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.map-page {
    padding: 0 0 148px;
}

.map-page .map-breadcrumbs {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0;
    padding: 32px 60px 0;
    color: var(--color-text-secondary);
}

.map-page .map-breadcrumbs a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.map-page .map-breadcrumbs a:hover {
    border-bottom: 1px solid var(--color-text-secondary);
}

.map-page .map-breadcrumbs .breadcrumbs-sep {
    margin: 0 6px;
    display: inline-flex;
    align-items: center;
}

.map-page .map-breadcrumbs .breadcrumb-active {
    color: var(--color-text-primary);
    border-bottom: 1px solid var(--color-text-primary);
}

.map-page__content {
    width: 100%;
    max-width: 1800px;
    margin: 0 auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 24px;
}

.map-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin: 0 auto;
}

.map-page .map-page-title {
    margin: 0;
    text-transform: uppercase;
    color: var(--color-text-primary);
    align-self: center;
}

.map-hero-lead {
    margin: 0;
    color: var(--color-text-secondary);
}

.map-tabs {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    gap: 48px;
    margin-top: 24px;
}

.map-tabs__btn {
    appearance: none;
    border: 0;
    background: transparent;
    padding: 12px 24px;
    color: var(--color-text-secondary);
    cursor: pointer;
    position: relative;
}

.map-tabs__btn:hover {
    color: var(--color-text-primary);
}

.map-tabs__btn.is-active {
    color: var(--color-text-primary);
}

.map-tabs__btn.is-active::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 3px;
    background: var(--color-border-dark);
}

.map-mode.is-hidden,
.map-mode[hidden] {
    display: none !important;
}

.map-mode,
.map-overview,
.map-layout {
    width: 100%;
}

.map-page[data-mode="overview"] .map-route-fab {
    display: none !important;
}

/* 3D overview */
.map-overview {
    --map-line: #d4cec3;
    --map-muted: #827c73;
    --map-text: #26231f;
    --map-accent: #9C3327;
    --map-accent-hover: #76231B;
    --map-panel: #F6F3EE;
    color: var(--map-text);
}

.map-overview-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 375px;
    gap: 60px;
    align-items: stretch;
    min-height: min(72vh, 760px);
}

.map-overview .map-shell {
    position: relative;
    min-width: 0;
    min-height: min(78vh, 760px);
    overflow: hidden;
    background: #fbfaf7;
    cursor: grab;
    touch-action: none;
}

.map-overview .map-shell.is-dragging {
    cursor: grabbing;
}

.map-overview .map-stage {
    position: absolute;
    inset: 0;
    z-index: 10;
    padding-top: 56px;
}

.map-overview .map-loading {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--map-muted);
    font-size: 14px;
    background: #fbfaf7;
}

.map-overview .map {
    display: block;
    width: 100%;
    height: 100%;
    overflow: hidden;
    user-select: none;
    shape-rendering: geometricPrecision;
}

.map-overview .map * {
    pointer-events: none;
}

.map-overview .map .room {
    cursor: pointer;
    outline: none;
    pointer-events: auto;
    transition: fill 160ms ease, stroke 160ms ease, opacity 160ms ease, filter 160ms ease;
    stroke: transparent;
    stroke-width: 1.5;
    vector-effect: non-scaling-stroke;
}

.map-overview .map .room.is-hover,
.map-overview .map .room:focus-visible,
.map-overview .map .room.is-active {
    fill: #ba4336 !important;
    stroke: #71231c;
    stroke-width: 2;
    filter: drop-shadow(0 5px 7px rgb(93 32 25 / 28%));
}

.map-overview .map .room.is-vacant.is-hover,
.map-overview .map .room.is-vacant:focus-visible,
.map-overview .map .room.is-vacant.is-active {
    fill: #b8aa8c !important;
    stroke: #716750;
}

.map-overview .map .room.is-dimmed {
    opacity: 0.12;
    pointer-events: none;
}

.map-overview .map .room.is-match {
    stroke: var(--map-accent);
    stroke-width: 2;
    filter: drop-shadow(0 3px 5px rgb(168 53 41 / 25%));
}

.map-overview-search {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 56px;
    width: 480px;
    padding: 0 14px;
    background: #fff;
    border: 1px solid var(--map-line);
    color: #a39d94;
}

.map-overview-search input {
    width: 100%;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--map-text);
    font: inherit;
}

.map-overview-search input::placeholder {
    color: #aaa49b;
}

.map-overview .map-hint {
    position: absolute;
    top: 80px;
    left: 0;
    z-index: 3;
    max-width: 385px;
    padding: 12px;
    background: var(--color-bg-warm-gray);
    color: var(--color-text-secondary);
    pointer-events: none;
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
}

.map-overview .map-hint svg {
    height: 32px;
    width: 32px;
    min-width: 32px;
}

.map-overview-controls {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 8px;
}

.map-overview-zoom,
.map-overview-reset {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 56px;
    border: 1px solid #8d877e;
    background: transparent;
    color: #575249;
    cursor: pointer;
    font: inherit;
}

.map-overview-zoom {
    width: 56px;
    height: 56px;
    border: 1px solid var(--color-text-secondary);
}

.map-overview-zoom:hover {
    border-color: var(--map-accent);
    background: #fff;
    color: var(--map-accent);
}

.map-overview-reset {
    gap: 10px;
    padding: 0 20px;
    border-color: var(--map-accent);
    background: var(--map-accent);
    color: #fff;
}

.map-overview-reset:hover {
    border-color: var(--map-accent-hover);
    background: var(--map-accent-hover);
}

.map-overview .popup {
    position: fixed;
    z-index: 30;
    width: 260px;
    overflow: hidden;
    border: 1px solid #ddd7cd;
    background: #f7f4ee;
    color: var(--map-text);
    box-shadow: 0 16px 38px rgb(57 45 34 / 22%);
    pointer-events: none;
}

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

.map-overview .popup__image,
.map-overview .details__image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    background: #ddd7cd;
}

.map-overview .popup__body {
    display: grid;
    gap: 6px;
    padding: 13px 15px 15px;
}

.map-overview .popup__category,
.map-overview .details__badge {
}

.map-overview .popup__title {
    font-family: var(--font-serif, Cormorant, Georgia, serif);
    font-size: 19px;
    font-weight: 400;
}

.map-overview .popup__location,
.map-overview .details__location {
}

.map-overview .empty-state {
    position: absolute;
    top: 74px;
    left: 50%;
    z-index: 4;
    padding: 10px 14px;
    border: 1px solid #ddd7cd;
    background: #f7f4ee;
    color: var(--map-muted);
    font-size: 12px;
    transform: translateX(-50%);
    box-shadow: 0 8px 24px rgb(57 45 34 / 12%);
}

.map-overview .empty-state[hidden] {
    display: none;
}

.map-overview .details {
    position: relative;
    display: flex;
    min-width: 0;
    padding: 24px;
    background: var(--color-bg-warm-gray);
    color: var(--color-text-secondary);
    border: 1px solid var(--color-border-light);
}

.map-overview .details__placeholder,
.map-overview .details__content {
    width: 100%;
}

.map-overview .details__content:not([hidden]) {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 20px;
    min-height: 100%;
}

.map-overview .details__placeholder {
    margin: auto 0;
    text-align: left;
}

.details__placeholder h3 {
    text-transform: uppercase;
    margin-bottom: 20px;
}

.map-overview .details__marker {
    position: relative;
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
}

.map-overview .details__marker span {
    position: absolute;
    inset: 0;
    border: 1px solid rgb(168 53 41 / 34%);
    border-radius: 50%;
}

.map-overview .details__marker span:nth-child(2) {
    inset: 9px;
}

.map-overview .details__marker span:nth-child(3) {
    inset: 21px;
    border: 0;
    background: var(--map-accent);
}

.map-overview .details__image {
    height: 220px;
    object-fit: cover;
}

.details__meta {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 8px;
}

.map-overview .details h2 {
    color: var(--color-text-primary);
}

.map-overview .details p {
    color: var(--color-text-secondary);
}

.map-overview .details__tag {
    width: fit-content;
    padding: 6px 12px;
    border: 1px solid var(--color-border-medium);
    background: #00000008;
}

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

.map-overview .details__actions {
    display: grid;
    gap: 12px;
    margin-top: auto;
    width: 100%;
}

.map-overview .details__button {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    padding: 12px 48px;
    height: 48px;
    border: 1px solid var(--map-accent);
    background: var(--map-accent);
    text-transform: none;
    color: #fff;
    text-decoration: none;
    text-align: center;
    transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.map-overview .details__button svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    flex-shrink: 0;
}

.map-overview .details__button span {
    text-align: center;
}

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

.map-overview .details__button--primary:hover {
    border-color: var(--map-accent-hover);
    background: var(--map-accent-hover);
    color: #fff;
}

.map-overview .details__button--secondary {
    border-color: var(--color-bg-dark);
    background: transparent;
    color: var(--color-bg-dark);
}

.map-overview .details__button--secondary:hover {
    border-color: var(--color-bg-dark);
    background: rgba(22, 20, 18, 0.06);
    color: var(--color-bg-dark);
}

.map-overview .details__button--secondary:hover svg path {
    stroke: currentColor;
}

.map-overview .details__close {
    display: none;
    position: absolute;
    top: 14px;
    right: 14px;
    width: 34px;
    height: 34px;
    border: 1px solid var(--map-line);
    background: #f7f4ee;
    color: var(--map-text);
    cursor: pointer;
}

@media (max-width: 1800px) {
    .map-page__content {
        max-width: calc(100svw - 32px);
        padding: 0 32px;
    }
}

@media (max-width: 1024px) {
    .map-page .map-breadcrumbs,
    .map-page__content {
        padding-left: 20px;
        padding-right: 20px;
    }

    .map-overview-workspace {
        grid-template-columns: 1fr;
        min-height: 0;
    }

    .map-overview .map-shell {
        min-height: 68vh;
    }

    .map-overview-search {
        width: min(240px, calc(100% - 200px));
    }

    .map-overview .details {
        min-height: 230px;
    }
}

@media (max-width: 900px) {
    .map-overview .details {
        position: fixed;
        right: 12px;
        bottom: 12px;
        left: 12px;
        z-index: 30;
        display: none;
        box-shadow: 0 18px 55px rgb(57 45 34 / 25%);
    }

    .map-overview .details.has-selection {
        display: flex;
    }

    .map-overview .details__close {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}

@media (max-width: 768px) {
    body.site-body:has(.map-page[data-mode="overview"]) {
        overflow: auto;
        height: auto;
    }

    body.site-body:has(.map-page[data-mode="overview"]) .site-footer {
        display: block;
    }

    .map-page[data-mode="overview"] {
        height: auto;
        max-height: none;
        overflow: visible;
        padding-bottom: 48px;
    }

    .map-tabs {
        gap: 20px;
    }

    .map-overview-search {
        width: calc(100% - 32px);
        max-width: none;
    }

    .map-overview-controls {
        top: auto;
        bottom: 16px;
        right: 16px;
    }

    .map-overview .map-hint {
        max-width: calc(100% - 32px);
    }
}

@media (max-width: 560px) {
    .map-overview-reset span {
        display: none;
    }

    .map-overview-reset {
        width: 46px;
        padding: 0;
    }

    .map-overview .popup {
        width: min(250px, calc(100vw - 24px));
    }
}
