:root {
    --map-bg: #fbf6ee;
    --map-paper: #fffdf9;
    --map-ink: #211711;
    --map-muted: #6f6258;
    --map-line: rgba(33, 23, 17, 0.12);
    --map-clay: #bf6430;
    --map-clay-dark: #91451e;
    --map-teal: #1f6f78;
    --map-header-h: 0px;
    --map-nav-h: 0px;
}

html.map-document,
html.map-document body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

.map-page {
    min-height: 100%;
    background: var(--map-bg);
    color: var(--map-ink);
    overflow: hidden;
}

.map-page::before {
    display: none;
}

.map-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 900;
    display: flex;
    align-items: center;
    min-height: 78px;
    padding: 18px clamp(18px, 4vw, 52px);
    background: transparent;
    pointer-events: none;
}

.map-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--map-clay-dark);
    font-weight: 800;
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 10px 26px rgba(33, 23, 17, 0.12);
    pointer-events: auto;
}

.map-brand img {
    width: 31px;
    height: 31px;
    object-fit: contain;
}

.map-layout {
    position: fixed;
    inset: 0;
    z-index: 0;
    display: block;
    width: 100vw;
    height: 100dvh;
    padding: 0;
    overflow: hidden;
}

.map-shell {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 0;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: var(--map-paper);
    box-shadow: none;
}

#jordanMap,
.jordan-map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    min-height: 0;
    z-index: 0;
    overflow: hidden;
}

#jordanMap:-webkit-full-screen,
#jordanMap:fullscreen,
.jordan-map:-webkit-full-screen,
.jordan-map:fullscreen {
    height: 100% !important;
}

.map-filter-panel {
    position: absolute;
    top: 96px;
    left: 16px;
    z-index: 4;
    width: min(286px, calc(100vw - 74px));
    max-height: calc(100% - 112px);
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 8px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 18px 44px rgba(33, 23, 17, 0.16);
    backdrop-filter: blur(16px);
    transform: translateX(0);
    transition: transform 180ms ease;
}

.map-filter-panel.is-collapsed {
    transform: translateX(calc(-100% - 16px));
}

.map-filter-toggle {
    position: absolute;
    top: 18px;
    right: -42px;
    width: 42px;
    height: 48px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: rgba(255, 253, 249, 0.98);
    color: var(--map-clay-dark);
    box-shadow: 10px 14px 26px rgba(33, 23, 17, 0.12);
    cursor: pointer;
}

.map-filter-toggle span {
    display: block;
    font-size: 29px;
    font-weight: 900;
    line-height: 1;
    transform: translateX(-1px);
}

.map-filter-panel.is-collapsed .map-filter-toggle span {
    transform: translateX(1px) rotate(180deg);
}

.map-filter-content {
    max-height: calc(100vh - 206px);
    overflow-y: auto;
    padding: 16px 16px 18px;
}

.map-filter-title {
    color: var(--map-clay-dark);
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.map-filter-all,
.map-subcategory-filter {
    width: 100%;
    min-height: 38px;
    margin-top: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid rgba(33, 23, 17, 0.1);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.86);
    color: var(--map-clay-dark);
    padding: 8px 10px;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    text-align: start;
    cursor: pointer;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.map-filter-all:hover,
.map-subcategory-filter:hover {
    border-color: rgba(191, 100, 48, 0.34);
    background: rgba(191, 100, 48, 0.08);
}

.map-filter-all.is-active,
.map-subcategory-filter.is-active {
    border-color: var(--map-clay);
    background: var(--map-clay);
    color: #fff;
}

.map-filter-category {
    margin-top: 18px;
}

.map-filter-category-title {
    color: var(--map-teal);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.map-filter-count {
    color: var(--map-muted);
    font-size: 11px;
    font-weight: 800;
    flex: 0 0 auto;
}

.map-subcategory-filter.is-active .map-filter-count {
    color: rgba(255, 255, 255, 0.86);
}

.jordan-map .ol-zoom {
    top: auto;
    left: auto;
    right: 18px;
    bottom: 104px;
    z-index: 8;
}

.jordan-map .ol-zoom .ol-zoom-in,
.jordan-map .ol-zoom .ol-zoom-out {
    width: 40px;
    height: 40px;
    font-size: 22px;
    font-weight: 900;
    border-radius: 8px;
}

.map-layer-switcher {
    position: absolute;
    right: 18px;
    bottom: 194px;
    z-index: 8;
    display: grid;
    gap: 6px;
    width: 40px;
}

.map-layer-btn {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(255, 253, 249, 0.94);
    color: var(--map-clay-dark);
    box-shadow: 0 10px 24px rgba(33, 23, 17, 0.13);
    cursor: pointer;
    font: inherit;
    font-weight: 900;
    padding: 0;
    backdrop-filter: blur(16px);
}

.map-layer-btn .material-icons {
    font-size: 20px;
    line-height: 1;
}

.map-layer-btn:hover {
    background: rgba(255, 246, 236, 0.98);
}

.map-layer-btn.is-active {
    border-color: var(--map-clay);
    background: var(--map-clay);
    color: #fff;
}

.jordan-map .ol-viewport,
.jordan-map .ol-layers,
.jordan-map .ol-layer {
    width: 100% !important;
    height: 100% !important;
    overflow: hidden !important;
}

.map-popup {
    min-width: 180px;
    max-width: 230px;
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid rgba(33, 23, 17, 0.12);
    border-radius: 8px;
    background: rgba(255, 253, 249, 0.96);
    box-shadow: 0 18px 40px rgba(33, 23, 17, 0.18);
    color: var(--map-ink);
    font-size: 13px;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.96);
    transform-origin: bottom center;
    visibility: hidden;
    transition: opacity 170ms ease, transform 170ms ease, visibility 170ms ease;
}

.map-popup img {
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: 6px;
    background: #f2e5d7;
}

.map-popup.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    visibility: visible;
}

.map-popup strong {
    color: var(--map-clay-dark);
    font-size: 16px;
}

.map-popup span {
    color: var(--map-muted);
}

.map-popup p {
    margin: 2px 0 0;
    color: var(--map-muted);
    line-height: 1.5;
}

.map-place-panel {
    position: absolute;
    top: 92px;
    right: 16px;
    bottom: 92px;
    z-index: 12;
    width: min(360px, calc(100vw - 32px));
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.74);
    border-radius: 8px;
    background: #fffdf9;
    box-shadow: 0 24px 60px rgba(33, 23, 17, 0.2);
    backdrop-filter: blur(18px);
    opacity: 0;
    pointer-events: none;
    transform: translateX(calc(100% + 24px));
    transition: transform 220ms ease, opacity 220ms ease;
}

.map-place-panel.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.map-place-close {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 8px;
    background: rgba(255, 253, 249, 0.94);
    color: var(--map-clay-dark);
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(33, 23, 17, 0.12);
}

.map-place-close .material-icons {
    font-size: 20px;
}

.map-place-panel > img {
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    background: #f2e5d7;
}

.map-place-body {
    overflow-y: auto;
    padding: 18px;
}

.map-place-body h2 {
    margin: 0 0 10px;
    color: var(--map-teal);
    font-size: clamp(1.7rem, 4vw, 2.6rem);
    line-height: 0.98;
}

.map-place-body p {
    color: var(--map-muted);
    line-height: 1.6;
}

.map-place-meta {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}

.map-place-meta span {
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    border-radius: 999px;
    background: rgba(31, 111, 120, 0.09);
    color: var(--map-teal);
    padding: 4px 9px;
    font-size: 12px;
    font-weight: 900;
}

.ol-control button {
    background-color: var(--map-clay);
}

.ol-control button:hover,
.ol-control button:focus {
    background-color: var(--map-clay-dark);
}

.map-floating-nav {
    position: fixed;
    left: 50%;
    right: auto;
    bottom: 18px;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(184, 132, 77, 0.08);
    backdrop-filter: blur(20px);
}

.map-nav-btn {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: 999px;
    color: #b8844d;
    font-size: 13px;
    font-weight: 800;
    text-decoration: none;
    transition: transform 180ms ease, background 180ms ease;
}

.map-nav-btn:hover {
    transform: translateY(-1px);
    background: rgba(184, 132, 77, 0.1);
}

.map-nav-btn.is-active {
    color: #fff;
    background: linear-gradient(135deg, #b8844d, #8b6f47);
}

.map-nav-btn .material-icons {
    font-size: 18px;
}

.map-nav-separator {
    width: 1px;
    height: 20px;
    background: rgba(184, 132, 77, 0.2);
}

@media (max-width: 980px) {
    .map-layout {
        padding-top: 0;
    }

    .map-shell,
    .jordan-map {
        min-height: 0;
    }
}

@media (max-width: 620px) {
    .map-layout {
        padding-inline: 0;
        padding-bottom: 0;
    }

    .map-header {
        padding-inline: 14px;
    }

    .map-shell,
    .jordan-map {
        min-height: 0;
    }

    .map-filter-panel {
        top: 88px;
        left: 12px;
        width: min(268px, calc(100vw - 66px));
        max-height: calc(100vh - 184px);
    }

    .map-filter-content {
        max-height: min(55vh, 430px);
        padding: 14px;
    }

    .map-filter-toggle {
        right: -38px;
        width: 38px;
        height: 44px;
    }

    .jordan-map .ol-zoom {
        top: auto;
        left: auto;
        right: 12px;
        bottom: 104px;
    }

    .map-layer-switcher {
        right: 12px;
        bottom: 194px;
        width: 40px;
    }

    .map-place-panel {
        top: 84px;
        right: 10px;
        bottom: 94px;
        width: min(330px, calc(100vw - 20px));
    }

    .map-floating-nav {
        left: 50%;
        max-width: calc(100vw - 20px);
        overflow-x: auto;
    }

    .map-nav-btn {
        padding-inline: 11px;
        white-space: nowrap;
    }
}
