:root {
    --brand-brown: #7a1f12;
    --header-brown: #731702;
    --header-wordmark: #ffedd1;
    --header-accent: #ffd89e;
    --brand-cream: #fff8ef;
    --surface: #fffdf8;
    --text: #241f1c;
    --muted: #6d655f;
    --focus: #1f67b1;
    --border: #d8cec3;
    --header-height: clamp(7rem, 20vw, 11rem);
    --shadow: 0 0.5rem 1.5rem rgb(54 35 25 / 18%);
    --map-control-bg: rgb(255 248 239 / 96%);
    --map-control-border: rgb(122 31 18 / 22%);
    --map-control-shadow: 0 0.3rem 0.9rem rgb(70 45 35 / 18%);
    --font-ui: "Outfit", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

html,
body {
    height: 100%;
    margin: 0;
}

body {
    background: var(--brand-cream);
    color: var(--text);
    font-family: var(--font-ui);
    overflow: hidden;
    overflow-x: hidden;
}

body.menu-open {
    overflow: hidden;
}

button,
select,
a {
    font: inherit;
}

.visually-hidden {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.skip-link {
    background: var(--surface);
    color: var(--text);
    left: 0.5rem;
    padding: 0.6rem 0.8rem;
    position: fixed;
    top: 0.5rem;
    transform: translateY(-200%);
    z-index: 100;
}

.skip-link:focus-visible {
    transform: translateY(0);
}

.map-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    min-height: 100vh;
}

@supports (height: 100dvh) {
    .map-shell {
        height: 100dvh;
        min-height: 100dvh;
    }
}

.site-header {
    align-items: flex-end;
    background: var(--header-brown);
    box-sizing: border-box;
    display: flex;
    flex: none;
    min-height: var(--header-height);
    overflow: hidden;
    padding: max(0.35rem, env(safe-area-inset-top)) 0 0;
    position: relative;
    z-index: 30;
}

.brand-wordmark {
    align-items: center;
    box-sizing: border-box;
    display: inline-flex;
    flex: none;
    height: auto;
    justify-content: center;
    padding: 0;
    text-decoration: none;
}

.site-header > .brand-wordmark {
    align-self: flex-end;
    line-height: 0;
    margin: 0 auto;
    max-width: min(96%, 40rem);
    width: min(96%, 40rem);
}

.brand-logo {
    display: block;
    height: auto;
    max-width: none;
    object-fit: contain;
    width: 100%;
}

.brand-wordmark--menu {
    grid-column: auto;
    grid-row: auto;
    max-width: min(58vw, 12rem);
    width: min(58vw, 12rem);
}

.menu-toggle,
.menu-close,
.locate-fab {
    align-items: center;
    border: 0;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
    min-height: 44px;
    min-width: 44px;
}

.menu-toggle {
    background: transparent;
    flex-direction: column;
    gap: 4px;
    position: absolute;
    right: 0.75rem;
    top: max(0.35rem, env(safe-area-inset-top));
    z-index: 2;
    padding: 0;
}

.menu-toggle span {
    background: var(--header-wordmark);
    border-radius: 999px;
    display: block;
    height: 2px;
    width: 22px;
}

.menu-close {
    background: transparent;
    color: var(--brand-brown);
    font-size: 2rem;
    line-height: 1;
}

.menu-backdrop {
    background: rgb(24 16 12 / 46%);
    inset: 0;
    position: fixed;
    z-index: 40;
}

.mobile-menu {
    background: var(--surface);
    box-shadow: var(--shadow);
    box-sizing: border-box;
    height: 100%;
    max-width: 22rem;
    overflow-y: auto;
    padding: max(0.5rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    top: 0;
    width: min(88vw, 22rem);
    z-index: 50;
}

.mobile-menu[hidden],
.menu-backdrop[hidden] {
    display: none;
}

.mobile-menu-header {
    align-items: center;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    min-height: 3.25rem;
}

.mobile-nav {
    display: grid;
    gap: 0.25rem;
    padding: 1rem 0;
}

.mobile-nav a,
.mobile-nav button {
    background: transparent;
    border: 0;
    border-radius: 0.5rem;
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    min-height: 44px;
    padding: 0.75rem;
    text-align: left;
    text-decoration: none;
}

.mobile-nav a:hover,
.mobile-nav button:hover {
    background: #f4ece4;
}

.mobile-nav-account-form {
    margin: 0;
}

.mobile-nav-account-form button {
    width: 100%;
}

.map-toolbar {
    border-top: 1px solid var(--border);
    display: grid;
    gap: 0.85rem;
    padding-top: 1rem;
}

.monument-advanced-filters,
.transport-advanced-filters {
    border-top: 1px solid var(--border);
    display: grid;
    gap: 0.85rem;
    padding-top: 0.85rem;
}

.monument-advanced-filters[hidden],
.transport-advanced-filters[hidden] {
    display: none;
}

.map-toolbar-subtitle {
    color: var(--text);
    font-size: 0.78rem;
    font-weight: 750;
    margin: 0;
}

.map-toolbar label {
    color: var(--muted);
    display: grid;
    font-size: 0.8rem;
    gap: 0.3rem;
}

.map-toolbar select,
.map-toolbar button {
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    box-sizing: border-box;
    min-height: 44px;
    padding: 0.55rem 0.7rem;
    width: 100%;
}

.map-toolbar select {
    background: #fff;
    color: var(--text);
}

.map-toolbar button {
    background: var(--brand-brown);
    color: #fff;
    cursor: pointer;
    font-weight: 700;
}

.map-stage {
    flex: 1;
    min-height: 0;
    position: relative;
}

.poi-search {
    left: 0.65rem;
    max-width: calc(100% - 1.3rem);
    position: absolute;
    right: 0.65rem;
    top: 0.65rem;
    z-index: 8;
}

.poi-search-input {
    background: var(--surface);
    border: 1px solid var(--map-control-border);
    border-radius: 0.7rem;
    box-shadow: var(--map-control-shadow);
    box-sizing: border-box;
    color: var(--text);
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    width: 100%;
}

.poi-search-input:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.poi-search-results {
    background: var(--surface);
    border: 1px solid var(--map-control-border);
    border-radius: 0.7rem;
    box-shadow: var(--shadow);
    margin-top: 0.35rem;
    max-height: min(50vh, 22rem);
    overflow-y: auto;
}

.quick-filter-bar {
    display: grid;
    gap: 0.45rem;
    isolation: isolate;
    pointer-events: auto;
    position: absolute;
    right: 0.75rem;
    top: 0.75rem;
    width: 3.25rem;
    z-index: 7;
}

.quick-filter {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    display: grid;
    justify-content: center;
    height: 3.15rem;
    justify-self: center;
    overflow: hidden;
    padding: 0;
    pointer-events: auto;
    touch-action: manipulation;
    width: 3.15rem;
}

.quick-filter img {
    height: 2.7rem;
    pointer-events: none;
    width: 2.7rem;
}

.quick-filter span {
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    white-space: nowrap;
    width: 1px;
}

.quick-filter.is-active {
    transform: scale(1.08);
}

.quick-filter--bus {
    /* MAP-UI-03: the 2px border stays inside the shared button size, like the other quick filters */
    box-sizing: border-box;
    background: #f2c94c;
    border: 2px solid #765000;
    border-radius: 50%;
    box-shadow: 0 0.25rem 0.65rem rgb(54 35 25 / 28%);
}

.quick-filter--bus:hover,
.quick-filter--bus.is-active {
    background: #e6b936;
}

.quick-filter--bus img {
    filter: brightness(0) saturate(100%);
}

.quick-filter:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.poi-search-option {
    align-items: flex-start;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-height: 44px;
    padding: 0.65rem 0.8rem;
    text-align: left;
    width: 100%;
}

.poi-search-option:last-child {
    border-bottom: 0;
}

.poi-search-option:hover,
.poi-search-option.is-active,
.poi-search-option[aria-selected="true"] {
    background: #f4ece4;
}

.poi-search-category {
    color: var(--muted);
    font-size: 0.76rem;
}

.poi-search-empty {
    color: var(--muted);
    padding: 0.8rem;
}

.map-container {
    height: 100%;
    min-height: 0;
    position: relative;
    width: 100%;
}

.locate-fab {
    background: var(--surface);
    border: 2px solid var(--brand-brown);
    border-radius: 50%;
    bottom: calc(4.4rem + env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
    color: var(--brand-brown);
    font-size: 1.35rem;
    position: absolute;
    right: 0.9rem;
    z-index: 6;
}

.locate-fab:disabled {
    cursor: wait;
    opacity: 0.6;
}

.poi-results {
    background: rgb(255 253 248 / 96%);
    border: 1px solid rgb(122 31 18 / 16%);
    border-radius: 0.75rem;
    bottom: calc(0.65rem + env(safe-area-inset-bottom));
    box-shadow: var(--shadow);
    left: 0.65rem;
    max-height: min(45vh, 22rem);
    overflow: auto;
    position: absolute;
    right: 4.4rem;
    z-index: 5;
}

.poi-list-view {
    background: var(--brand-cream);
    box-sizing: border-box;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 1rem max(1rem, env(safe-area-inset-left)) max(1.25rem, env(safe-area-inset-bottom));
}

.poi-list-view[hidden],
.poi-list-load-more[hidden],
.poi-list-error[hidden] {
    display: none;
}

.poi-list-header {
    align-items: flex-start;
    display: flex;
    gap: 0.75rem;
    margin: 0 auto 0.9rem;
    max-width: 48rem;
}

.poi-list-header h1 {
    color: var(--brand-brown);
    font-size: 1.35rem;
    line-height: 1.15;
    margin: 0;
}

.poi-list-back,
.poi-list-load-more,
.poi-list-retry {
    border: 1px solid var(--border);
    border-radius: 0.6rem;
    cursor: pointer;
    min-height: 44px;
    padding: 0.55rem 0.75rem;
}

.poi-list-back {
    background: transparent;
    color: var(--brand-brown);
    font-weight: 750;
}

.poi-list-summary {
    color: var(--muted);
    font-size: 0.82rem;
    margin: 0.25rem 0 0;
}

.poi-list-search-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 700;
    margin: 0 auto 0.35rem;
    max-width: 48rem;
}

.poi-list-search-input {
    background: var(--surface);
    border: 1px solid var(--map-control-border);
    border-radius: 0.7rem;
    box-sizing: border-box;
    display: block;
    min-height: 44px;
    margin: 0 auto 0.9rem;
    max-width: 48rem;
    padding: 0.65rem 0.8rem;
    width: 100%;
}

.poi-list-items {
    display: grid;
    gap: 0.8rem;
    list-style: none;
    margin: 0 auto;
    max-width: 48rem;
    padding: 0;
}

.poi-list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.85rem;
    box-shadow: 0 0.2rem 0.75rem rgb(44 31 25 / 8%);
    display: grid;
    grid-template-columns: 6.25rem minmax(0, 1fr);
    overflow: hidden;
}

.poi-list-card-media {
    align-items: center;
    aspect-ratio: 1;
    background: #eadbd3;
    color: var(--muted);
    display: flex;
    font-size: 0.7rem;
    justify-content: center;
    line-height: 1.2;
    min-height: 6.25rem;
    overflow: hidden;
    padding: 0.35rem;
    text-align: center;
}

.poi-list-card-media img {
    height: 100%;
    object-fit: contain;
    width: 100%;
}

.poi-list-card-body {
    display: grid;
    gap: 0.35rem;
    min-width: 0;
    padding: 0.75rem 0.8rem;
}

.poi-list-card-title {
    color: var(--brand-brown);
    font-size: 1rem;
    line-height: 1.2;
    margin: 0;
}

.poi-list-card-intro {
    display: -webkit-box;
    font-size: 0.82rem;
    line-height: 1.35;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
}

.poi-list-card-actions {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.1rem;
}

.poi-list-action {
    align-items: center;
    border: 1px solid var(--brand-brown);
    border-radius: 0.5rem;
    display: inline-flex;
    font-size: 0.78rem;
    font-weight: 750;
    justify-content: center;
    min-height: 40px;
    padding: 0.35rem 0.6rem;
    text-decoration: none;
}

.poi-list-action--map {
    background: var(--brand-brown);
    color: #fff;
    cursor: pointer;
}

.poi-list-action--map:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.poi-list-action--detail {
    background: transparent;
    color: var(--brand-brown);
}

.poi-list-load-more {
    background: var(--brand-brown);
    color: #fff;
    display: block;
    font-weight: 750;
    margin: 1rem auto 0;
}

.poi-list-error {
    color: #742012;
    font-weight: 700;
    margin: 1rem auto;
    max-width: 48rem;
}

.poi-list-retry {
    background: var(--surface);
    color: var(--brand-brown);
    font-weight: 750;
}

.poi-results summary {
    cursor: pointer;
    font-weight: 750;
    min-height: 44px;
    padding: 0.75rem 0.9rem;
}

#poi-results-list {
    margin: 0;
    padding: 0 1rem 0.9rem 2rem;
}

#poi-results-list li {
    margin: 0.55rem 0;
}

#poi-results-list a {
    color: var(--brand-brown);
    font-weight: 700;
}

.maplibregl-ctrl-top-right {
    top: 3.25rem;
}

.maplibregl-ctrl-group button {
    height: 44px;
    width: 44px;
}

.menu-toggle:focus-visible,
.menu-close:focus-visible,
.mobile-nav a:focus-visible,
.mobile-nav button:focus-visible,
.map-toolbar button:focus-visible,
.map-toolbar select:focus-visible,
.locate-fab:focus-visible,
a:focus-visible,
summary:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.noscript-message {
    background: var(--surface);
    margin: 0;
    padding: 1rem 1.25rem;
}

@media (min-width: 700px) {
    .site-header {
        padding-left: 0;
        padding-right: 0;
    }

    .site-header > .brand-wordmark {
        max-width: min(96%, 40rem);
    }

    .poi-search {
        left: 1rem;
        max-width: 28rem;
        right: auto;
        top: 1rem;
        width: calc(100% - 2rem);
    }

    .poi-results {
        left: 1rem;
        right: auto;
        width: min(26rem, 42vw);
    }

    .locate-fab {
        bottom: 1rem;
        right: 1rem;
    }
}

@media (max-width: 600px) {
    .map-shell {
        height: 100vh;
        min-height: 100vh;
    }

    @supports (height: 100dvh) {
        .map-shell {
            height: 100dvh;
            min-height: 100dvh;
        }
    }

    .site-header {
        min-height: var(--header-height);
    }

    .map-stage,
    .map-container {
        min-height: 0;
    }

    .poi-results {
        display: none;
    }

    .poi-list-view {
        display: block;
    }

    .poi-list-view {
        padding: 0 max(0.65rem, env(safe-area-inset-left)) max(1rem, env(safe-area-inset-bottom));
    }

    .poi-list-header {
        align-items: center;
        background: var(--brand-cream);
        border-bottom: 1px solid var(--border);
        gap: 0.55rem;
        margin: 0 auto 0.7rem;
        padding: 0.55rem 0 0.65rem;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    .poi-list-header h1 { font-size: 1.12rem; }
    .poi-list-back { flex: 0 0 auto; padding-inline: 0.62rem; }
    .poi-list-summary { font-size: 0.76rem; line-height: 1.3; }
    .poi-list-search-input { margin-bottom: 0.7rem; }
    .poi-list-items { gap: 0.65rem; }

    .poi-list-card {
        grid-template-columns: clamp(6.5rem, 28vw, 7rem) minmax(0, 1fr);
    }

    .poi-list-card-media {
        align-self: stretch;
        aspect-ratio: auto;
        min-height: 100%;
        padding: 0;
    }

    .poi-list-card-media img {
        object-fit: cover;
        object-position: center;
    }

    .poi-list-card-body {
        gap: 0.28rem;
        grid-template-rows: auto 1fr auto;
        min-height: 7rem;
        padding: 0.68rem 0.7rem 0.7rem;
    }

    .poi-list-card-body--no-intro .poi-list-card-actions {
        align-self: end;
    }

    .poi-list-card-title {
        display: -webkit-box;
        font-size: 0.96rem;
        font-weight: 700;
        line-height: 1.2;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow-wrap: anywhere;
    }

    .poi-list-card-intro {
        color: var(--text);
        font-size: 0.78rem;
        line-height: 1.4;
    }

    .poi-list-card-actions {
        flex-wrap: nowrap;
        gap: 0.4rem;
        margin-top: auto;
    }

    .poi-list-action {
        flex: 1 1 0;
        font-size: 0.75rem;
        min-height: 44px;
        min-width: 0;
        overflow: hidden;
        padding: 0.3rem 0.35rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .maplibregl-ctrl-top-right {
        top: 2.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}


.maplibregl-popup-content {
    background: var(--surface);
    border: 1px solid rgb(122 31 18 / 18%);
    border-radius: 0.75rem;
    box-shadow: var(--shadow);
    color: var(--text);
    line-height: 1.35;
    max-width: min(16rem, 72vw);
    padding: 0.8rem 2rem 0.8rem 0.9rem;
}

.maplibregl-popup-content strong {
    color: var(--brand-brown);
    display: inline-block;
    font-size: 0.95rem;
    margin-bottom: 0.2rem;
}

.maplibregl-popup-content a {
    color: var(--brand-brown);
    display: inline-block;
    font-weight: 750;
    margin-top: 0.35rem;
}

.maplibregl-popup-close-button {
    color: var(--brand-brown);
    font-size: 1.25rem;
    min-height: 32px;
    min-width: 32px;
}

.maplibregl-popup-tip {
    border-top-color: var(--surface);
}


/* PATCH-020C — cartography/control refinement */

.poi-results {
    backdrop-filter: blur(6px);
    border-color: rgb(122 31 18 / 14%);
    border-radius: 1rem;
}

.poi-results summary {
    align-items: center;
    display: flex;
    font-size: 0.9rem;
    gap: 0.35rem;
}

.maplibregl-ctrl-top-right {
    right: 5rem;
}

.maplibregl-ctrl-group {
    background: var(--map-control-bg);
    border: 1px solid var(--map-control-border);
    border-radius: 999px;
    box-shadow: var(--map-control-shadow);
    overflow: hidden;
}

.maplibregl-ctrl-group:not(:empty) {
    margin: 0 0 0.65rem;
}

.maplibregl-ctrl-group button {
    background-color: transparent;
    transition: background-color 120ms ease, transform 120ms ease;
}

.maplibregl-ctrl-group button + button {
    border-top-color: rgb(122 31 18 / 14%);
}

.maplibregl-ctrl-group button:hover {
    background-color: rgb(122 31 18 / 7%);
}

.maplibregl-ctrl-group button:active,
.locate-fab:active,
.menu-toggle:active,
.menu-close:active,
.mobile-nav a:active,
.mobile-nav button:active,
.map-toolbar button:active {
    transform: scale(0.94);
}

.locate-fab {
    background: var(--map-control-bg);
    border-color: var(--brand-brown);
    box-shadow: var(--map-control-shadow);
    transition: transform 120ms ease, box-shadow 120ms ease;
}

.locate-fab:hover {
    box-shadow: 0 0.4rem 1rem rgb(70 45 35 / 24%);
}

.maplibregl-popup-content {
    backdrop-filter: blur(6px);
}

.maplibregl-popup-close-button:active {
    transform: scale(0.9);
}

@media (max-width: 600px) {
    .maplibregl-ctrl-top-right {
        right: 5rem;
        top: 4.5rem;
    }

    .maplibregl-ctrl-group button {
        height: 44px;
        min-height: 44px;
        min-width: 44px;
        width: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .maplibregl-ctrl-group button,
    .locate-fab,
    .menu-toggle,
    .menu-close,
    .mobile-nav a,
    .mobile-nav button,
    .map-toolbar button {
        transition: none !important;
    }
}


/* PATCH-021 - rich POI preview card */

.maplibregl-popup-content {
    max-width: min(19rem, 82vw);
    overflow: hidden;
    padding: 0;
}

.maplibregl-popup-close-button {
    background: rgb(255 248 239 / 92%);
    border-radius: 999px;
    color: var(--brand-brown);
    margin: 0.35rem;
    min-height: 34px;
    min-width: 34px;
    z-index: 3;
}

.poi-preview-card {
    display: grid;
    max-width: min(19rem, 82vw);
    width: 18rem;
}

.poi-preview-media {
    align-items: center;
    background: #eadbd3;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    position: relative;
    width: 100%;
}

.poi-preview-gallery-viewport {
    aspect-ratio: 1 / 1;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    scroll-snap-type: x mandatory;
    touch-action: pan-x;
    width: 100%;
}

.poi-preview-gallery-viewport::-webkit-scrollbar { display: none; }

.poi-preview-gallery-track {
    display: flex;
    height: 100%;
    width: 100%;
}

.poi-preview-gallery-slide {
    align-items: center;
    display: flex;
    flex: 0 0 100%;
    justify-content: center;
    min-width: 0;
    position: relative;
    scroll-snap-align: start;
}

.poi-preview-image {
    display: block;
    height: 100%;
    object-fit: contain;
    object-position: center;
    width: 100%;
}

.poi-preview-gallery-count {
    background: rgb(255 248 239 / 92%);
    border-radius: 999px;
    color: var(--brand-brown);
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 1;
    margin: 0.4rem;
    padding: 0.3rem 0.45rem;
    pointer-events: none;
    position: absolute;
    right: 0;
    top: 0;
}

.poi-preview-media-fallback {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 650;
    padding: 1rem;
    text-align: center;
}

.poi-preview-body {
    display: grid;
    gap: 0.42rem;
    padding: 0.85rem 0.9rem 0.95rem;
}

/* PATCH-063.1 — same hierarchy as the POI page heading (PATCH-063): the typology first, as smaller
   coloured text without background, badge or border, then the POI name as the card heading.
   --poi-preview-type-color is the marker colour from poi_heading_type_v1.js (AA on --surface). */
.poi-preview-header {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
    padding-right: 1.9rem;
}

.poi-preview-type {
    background: none;
    border: 0;
    color: var(--poi-preview-type-color, var(--muted));
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.08em;
    line-height: 1.3;
    margin: 0;
    overflow-wrap: anywhere;
    padding: 0;
    text-transform: uppercase;
}

.poi-preview-title {
    color: var(--brand-brown);
    font-size: 1rem;
    font-weight: 800;
    hyphens: auto;
    line-height: 1.2;
    margin: 0;
    overflow-wrap: anywhere;
}

.poi-preview-intro {
    color: var(--text);
    display: -webkit-box;
    font-size: 0.84rem;
    line-height: 1.42;
    margin: 0.12rem 0 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 4;
}

.poi-preview-distance {
    color: var(--muted);
    font-size: 0.76rem;
}

/* PATCH-070.B1 — credit for the coordinates (OpenStreetMap, ODbL) when the POI declares that provenance */
.poi-preview-attribution {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
    margin: 0;
}

.poi-preview-attribution a {
    color: inherit;
}

/* PHARMACY-INFO-02 — compact verified hours and phone of a pharmacy, before the map actions */
.poi-preview-pharmacy {
    background: var(--brand-cream);
    border-radius: 0.55rem;
    display: grid;
    gap: 0.22rem;
    min-width: 0;
    padding: 0.45rem 0.55rem;
}

.poi-preview-pharmacy-label {
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    margin: 0;
    text-transform: uppercase;
}

.poi-preview-hours {
    column-gap: 0.5rem;
    display: grid;
    font-size: 0.78rem;
    grid-template-columns: max-content minmax(0, 1fr);
    line-height: 1.3;
    margin: 0;
    row-gap: 0.08rem;
}

.poi-preview-hours dt { color: var(--text); font-weight: 700; }
.poi-preview-hours dd { color: var(--text); margin: 0; overflow-wrap: anywhere; }

.poi-preview-pharmacy-note {
    color: var(--muted);
    font-size: 0.7rem;
    line-height: 1.3;
    margin: 0;
}

.poi-preview-phone {
    align-items: center;
    align-self: start;
    color: var(--brand-brown);
    display: inline-flex;
    font-size: 0.86rem;
    font-weight: 800;
    gap: 0.35rem;
    min-height: 40px;
    text-decoration: none;
    width: max-content;
}

.poi-preview-phone-number { text-decoration: underline; text-underline-offset: 0.15em; }
.poi-preview-phone:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.poi-preview-pharmacy-credit {
    color: var(--muted);
    font-size: 0.72rem;
    line-height: 1.35;
    margin: 0;
}

.poi-preview-pharmacy-credit a { color: inherit; }

.poi-preview-actions {
    display: grid;
    gap: 0.35rem;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 0.1rem;
}

.poi-preview-actions[hidden] { display: none; }
.poi-preview-actions[data-action-count="1"] { grid-template-columns: 1fr; }
.poi-preview-actions[data-action-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.poi-preview-action {
    align-items: center;
    background: var(--surface);
    border: 1px solid var(--brand-brown);
    border-radius: 0.55rem;
    box-sizing: border-box;
    color: var(--brand-brown);
    display: flex;
    flex-direction: column;
    font-size: 0.62rem;
    font-weight: 800;
    gap: 0.2rem;
    justify-content: center;
    min-height: 44px;
    min-width: 0;
    padding: 0.3rem 0.2rem;
    text-align: center;
    text-decoration: none;
    width: 100%;
}

.poi-preview-action--3d { background: var(--brand-cream); }
.poi-preview-action--italyart { background: var(--brand-brown); color: #fff; }
.poi-preview-action .poi-action-icon { font-size: 0.95rem; line-height: 1; }
.poi-preview-action .poi-action-label { line-height: 1.1; overflow-wrap: anywhere; }
.poi-preview-action:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.poi-preview-link {
    align-items: center;
    align-self: start;
    color: var(--brand-brown);
    display: inline-flex;
    font-weight: 800;
    margin-top: 0.15rem;
    max-width: 100%;
    min-height: 40px;
    overflow-wrap: anywhere;
    width: max-content;
}

.poi-preview-link:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.poi-mobile-preview {
    display: none;
}

.poi-mobile-preview[hidden] {
    display: none !important;
}

.poi-mobile-preview-scroll-hint[hidden] {
    display: none !important;
}

@media (max-width: 699px) {
    :root {
        --header-height: clamp(5.25rem, 21vw, 5.625rem);
    }

    .site-header > .brand-wordmark {
        max-width: min(88%, 22rem);
        width: min(88%, 22rem);
    }

    .quick-filter-bar {
        position: absolute;
        right: 0.55rem;
        top: calc(4.25rem + env(safe-area-inset-top));
    }

    .poi-search {
        left: 0.65rem;
        max-width: calc(100% - 4.9rem);
        right: 4.25rem;
    }

    .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in,
    .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out {
        display: none;
    }

    .poi-mobile-preview:not([hidden]) {
        background: var(--surface);
        border: 1px solid rgb(48 43 40 / 16%);
        border-radius: 1rem;
        bottom: max(0.65rem, env(safe-area-inset-bottom));
        box-shadow: var(--shadow);
        display: flex;
        flex-direction: column;
        /* PATCH-063.1: no fixed height, the sheet is as tall as its content up to the old limit;
           beyond it only the content scrolls (vh first for browsers without dynamic units) */
        height: auto;
        left: 0.65rem;
        max-height: min(65vh, 34rem, calc(100vh - var(--header-height) - env(safe-area-inset-top) - 1.3rem));
        max-height: min(65dvh, 34rem, calc(100dvh - var(--header-height) - env(safe-area-inset-top) - 1.3rem));
        min-height: 0;
        overflow: hidden;
        position: absolute;
        right: 0.65rem;
        z-index: 12;
    }

    .poi-mobile-preview-close {
        align-items: center;
        background: var(--brand-cream);
        border: 0;
        border-radius: 50%;
        color: var(--brand-brown);
        cursor: pointer;
        display: inline-flex;
        font-size: 1.5rem;
        height: 44px;
        justify-content: center;
        line-height: 1;
        position: absolute;
        right: 0.4rem;
        top: 0.4rem;
        width: 44px;
        z-index: 2;
    }

    .poi-mobile-preview-content {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .poi-mobile-preview-scroll-hint {
        align-items: center;
        background: var(--brand-cream);
        border: 0;
        border-top: 1px solid rgb(48 43 40 / 14%);
        color: var(--brand-brown);
        cursor: pointer;
        display: flex;
        flex: 0 0 44px;
        font-size: 0.78rem;
        font-weight: 800;
        gap: 0.45rem;
        justify-content: center;
        min-height: 44px;
        padding: 0.35rem 0.75rem;
        width: 100%;
    }

    .poi-mobile-preview-scroll-hint span:first-child {
        font-size: 1.2rem;
        line-height: 1;
    }

    .poi-mobile-preview .poi-preview-card {
        max-width: none;
        width: 100%;
    }

    .poi-mobile-preview .poi-preview-media {
        aspect-ratio: 16 / 9;
        max-height: 40vh;
        max-height: 40dvh;
        width: 100%;
    }

    .poi-mobile-preview .poi-preview-gallery-viewport {
        aspect-ratio: 16 / 9;
        max-height: 40vh;
        max-height: 40dvh;
    }

    .poi-mobile-preview .poi-preview-image {
        object-fit: cover;
    }

    .poi-mobile-preview .poi-preview-body {
        padding: 0.75rem 0.9rem;
    }

    .poi-mobile-preview .poi-preview-header {
        padding-right: 2.8rem;
    }

    /* --poi-mobile-preview-height: the measured height of the open sheet (map.js) */
    .locate-fab.poi-mobile-preview-open {
        bottom: calc(var(--poi-mobile-preview-height, min(65dvh, 34rem)) + 1.25rem + env(safe-area-inset-bottom));
    }
}

/* PATCH-063.1 — desktop popup: as tall as its content, at most the visible map minus room for the
   marker and the tip (map.js pans the map when it does not fit). Only the card scrolls, so the close
   button of the popup frame never scrolls away and there is a single scrollbar. */
@media (min-width: 700px) {
    .poi-preview-popup .maplibregl-popup-content {
        display: flex;
        flex-direction: column;
        max-height: min(34rem, calc(100vh - var(--header-height) - 4rem));
        max-height: min(34rem, calc(100dvh - var(--header-height) - 4rem));
        overflow: hidden;
    }

    /* rows keep their natural height: without it the grid squashes the image row (overflow: hidden)
       to fit the limit instead of letting the card scroll */
    .poi-preview-popup .poi-preview-card {
        grid-auto-rows: max-content;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
    }

    /* a bounded image box (4:3, never more than a third of the screen): the text stays in view and
       an image that arrives late or is very tall cannot stretch the popup */
    .poi-preview-popup .poi-preview-gallery-viewport {
        aspect-ratio: 4 / 3;
        max-height: min(13.5rem, 32vh);
        max-height: min(13.5rem, 32dvh);
    }
}

@media (max-width: 360px) {
    .poi-list-card { grid-template-columns: 6.5rem minmax(0, 1fr); }
    .poi-list-action { font-size: 0.7rem; padding-inline: 0.25rem; }

    .poi-preview-card,
    .maplibregl-popup-content {
        max-width: min(18rem, 78vw);
    }

    .poi-preview-card {
        width: min(18rem, 78vw);
    }

    .poi-preview-body {
        padding: 0.72rem 0.78rem 0.82rem;
    }

    .poi-preview-intro {
        font-size: 0.8rem;
        -webkit-line-clamp: 3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .poi-preview-card,
    .poi-preview-image {
        transition: none !important;
    }
}

/* PATCH-069.2 — touch devices zoom with two fingers: the «+»/«−» buttons are hidden on any device whose
   primary pointer is touch (phones in landscape and tablets too, wider than the 699px rule above). The
   compass stays; desktops and hybrid laptops (fine primary pointer) keep the buttons; map gestures are
   unchanged because only the controls are hidden. */
@media (hover: none) and (pointer: coarse) {
    .maplibregl-ctrl-group .maplibregl-ctrl-zoom-in,
    .maplibregl-ctrl-group .maplibregl-ctrl-zoom-out {
        display: none;
    }
}

/* PATCH-069 / PATCH-069.1 — «3 km dal Campidoglio»: the first control of the filters panel, one compact
   row «label · i · switch». A real switch (role=switch + aria-checked; the On/Off words stay for assistive
   technology only) whose state is drawn by colour AND thumb position; the explanation opens from «i». */
.scope-switch-row {
    align-items: center;
    border-bottom: 1px solid var(--border);
    column-gap: 0.25rem;
    display: flex;
    min-width: 0;
    padding-bottom: 0.35rem;
    position: relative;
}

.scope-switch-label {
    color: var(--text);
    flex: 0 1 auto;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.25;
    min-width: 0;
    overflow-wrap: anywhere;
}

.map-toolbar .scope-info,
.map-toolbar .scope-switch {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 999px;
    color: inherit;
    display: inline-flex;
    flex: 0 0 auto;
    justify-content: center;
    min-height: 44px;
    padding: 0;
    width: auto;
}

.map-toolbar .scope-info {
    min-width: 44px;
}

.scope-info img {
    display: block;
    height: 20px;
    width: 20px;
}

.map-toolbar .scope-switch {
    margin-left: auto;
    min-width: 52px;
}

.map-toolbar .scope-info:focus-visible,
.map-toolbar .scope-switch:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
}

.scope-switch[hidden],
.scope-info-popover[hidden],
.poi-results-scope[hidden] {
    display: none;
}

.scope-switch-control {
    align-items: center;
    display: inline-flex;
}

.scope-switch-track {
    background: #8a817a;
    border-radius: 999px;
    box-sizing: border-box;
    display: inline-block;
    height: 1.5rem;
    position: relative;
    width: 2.6rem;
}

.scope-switch-thumb {
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 2px rgb(0 0 0 / 30%);
    height: 1.1rem;
    left: 0.2rem;
    position: absolute;
    top: 0.2rem;
    transition: transform 120ms ease;
    width: 1.1rem;
}

.scope-switch[data-state="on"] .scope-switch-track {
    background: var(--brand-brown);
}

.scope-switch[data-state="on"] .scope-switch-thumb {
    transform: translateX(1.1rem);
}

/* the explanation: a small card under the row, as wide as the panel, never a full-screen modal */
.scope-info-popover {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 0.55rem;
    box-shadow: var(--shadow);
    box-sizing: border-box;
    color: var(--text);
    font-size: 0.85rem;
    left: 0;
    line-height: 1.4;
    margin: 0;
    padding: 0.6rem 0.75rem;
    position: absolute;
    right: 0;
    top: calc(100% + 0.25rem);
    z-index: 2;
}

/* not enough room below the row in the visible panel (e.g. 320×568): open above it (set by map.js) */
.scope-info-popover[data-placement="top"] {
    bottom: calc(100% + 0.25rem);
    top: auto;
}

.map-toolbar .map-toolbar-secondary {
    background: #fff;
    color: var(--brand-brown);
    border-color: var(--brand-brown);
}

.poi-results summary {
    flex-wrap: wrap;
}

.poi-results-scope {
    color: var(--muted);
    font-size: 0.8rem;
    font-weight: 600;
}

@media (prefers-reduced-motion: reduce) {
    .scope-switch-thumb {
        transition: none;
    }
}

/* PATCH-068 — monument groups flyout: a compact row attached to the LEFT of «Monumenti» (which stays
   visible), with the four groups and a close arrow. Opening and selection are separate states. The
   slide is a CSS transition of transform/opacity only: repeated clicks reverse it from where it is,
   so no intermediate state can stick. Closed, the flyout is inert (map.js) and visibility: hidden. */
.monument-groups {
    display: grid;
    justify-items: center;
    position: relative;
}

.monument-groups-flyout {
    --monument-group-size: 2.75rem;
    align-items: center;
    backdrop-filter: blur(6px);
    background: var(--map-control-bg);
    border: 1px solid var(--map-control-border);
    border-radius: 1rem;
    box-shadow: var(--map-control-shadow);
    box-sizing: border-box;
    display: grid;
    gap: 0.25rem;
    grid-auto-columns: var(--monument-group-size);
    grid-auto-flow: column;
    padding: 0.25rem;
    position: absolute;
    right: calc(100% + 0.3rem);
    top: 0;
    transform-origin: right center;
    transition: opacity 180ms ease, transform 220ms ease, visibility 0s linear 0s;
    z-index: 1;
}

.monument-groups-flyout[data-state="closed"] {
    opacity: 0;
    pointer-events: none;
    transform: translateX(1.5rem) scaleX(0.5);
    transition: opacity 160ms ease, transform 200ms ease, visibility 0s linear 200ms;
    visibility: hidden;
}

.monument-group,
.monument-groups-close {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 0.75rem;
    color: var(--brand-brown);
    cursor: pointer;
    display: grid;
    height: var(--monument-group-size);
    justify-items: center;
    padding: 0;
    position: relative;
    touch-action: manipulation;
    width: var(--monument-group-size);
}

.monument-group img {
    height: 2.3rem;
    pointer-events: none;
    width: 2.3rem;
}

.monument-group:hover,
.monument-groups-close:hover {
    background: rgb(122 31 18 / 8%);
}

/* selected: a ring and a check badge, not only a colour */
.monument-group[aria-pressed="true"] {
    background: rgb(122 31 18 / 12%);
    box-shadow: inset 0 0 0 2px var(--brand-brown);
}

.monument-group[aria-pressed="true"]::after {
    align-items: center;
    background: var(--brand-brown);
    border: 2px solid var(--surface);
    border-radius: 50%;
    color: #fff;
    content: "\2713";
    content: "\2713" / "";
    display: grid;
    font-size: 0.62rem;
    font-weight: 800;
    height: 0.95rem;
    justify-items: center;
    line-height: 1;
    position: absolute;
    right: -0.15rem;
    top: -0.15rem;
    width: 0.95rem;
}

.monument-group:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

.monument-group:focus-visible,
.monument-groups-close:focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 1px;
}

.monument-groups-close {
    border-left: 1px solid rgb(122 31 18 / 14%);
    border-radius: 0 0.75rem 0.75rem 0;
}

/* the map controls next to the toolbar (zoom, compass) move below the open flyout */
.maplibregl-ctrl-top-right {
    transition: top 200ms ease;
}

.map-stage[data-monument-groups="open"] .maplibregl-ctrl-top-right {
    top: 4.65rem;
}

@media (min-width: 700px) {
    /* tablets: the search box never reaches the flyout */
    .poi-search {
        max-width: min(28rem, calc(100% - 22rem));
    }
}

@media (max-width: 699px) {
    .map-stage[data-monument-groups="open"] .maplibregl-ctrl-top-right {
        top: calc(8.15rem + env(safe-area-inset-top));
    }
}

/* narrow phones: two rows of groups, the close arrow spans both */
@media (max-width: 359px) {
    .monument-groups-flyout {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, var(--monument-group-size));
    }

    .monument-groups-close {
        align-self: stretch;
        grid-column: 3;
        grid-row: 1 / span 2;
        height: auto;
    }

    .map-stage[data-monument-groups="open"] .maplibregl-ctrl-top-right {
        top: calc(11.15rem + env(safe-area-inset-top));
    }
}

@media (prefers-reduced-motion: reduce) {
    .monument-groups-flyout,
    .monument-groups-flyout[data-state="closed"],
    .maplibregl-ctrl-top-right {
        transition: none !important;
    }
}

/* PATCH-061 — POI loading message: a discreet overlay anchored at the bottom centre of the map,
   above the attribution, the POI list summary and the locate button, never under the map. */
.map-load-status {
    align-items: center;
    backdrop-filter: blur(5px);
    background: rgb(255 253 248 / 94%);
    border: 1px solid rgb(122 31 18 / 14%);
    border-radius: 999px;
    bottom: calc(5.5rem + env(safe-area-inset-bottom));
    box-shadow: 0 0.16rem 0.6rem rgb(44 31 25 / 12%);
    box-sizing: border-box;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    justify-content: center;
    left: 50%;
    max-width: min(24rem, calc(100% - 10rem));
    opacity: 1;
    padding: 0.35rem 0.75rem;
    pointer-events: none;
    position: absolute;
    transform: translateX(-50%);
    transition: opacity 400ms ease;
    width: max-content;
    z-index: 6;
}

.map-load-status-text {
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.3;
    margin: 0;
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: center;
}

/* visual-only loaded/remaining counter; tabular figures keep the pill from jittering */
.map-load-status-progress {
    color: var(--muted);
    font-size: 0.74rem;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    text-align: center;
}

.map-load-status-progress[hidden] {
    display: none;
}

.map-load-status[data-state="error"],
.map-load-status[data-state="warning"] {
    background: rgb(255 246 242 / 97%);
    border-color: rgb(116 32 18 / 38%);
    border-radius: 1rem;
    padding: 0.35rem 0.4rem 0.35rem 0.75rem;
}

.map-load-status-text[data-state="error"],
.map-load-status-text[data-state="warning"] {
    color: #742012;
    font-weight: 700;
}

.map-load-status-retry,
.map-load-status-dismiss {
    background: var(--surface);
    border: 1px solid rgb(116 32 18 / 38%);
    border-radius: 999px;
    color: #742012;
    cursor: pointer;
    flex: 0 0 auto;
    font: inherit;
    font-size: 0.76rem;
    font-weight: 700;
    min-height: 2rem;
    pointer-events: auto;
}

.map-load-status-retry {
    padding: 0.2rem 0.65rem;
}

.map-load-status-dismiss {
    align-items: center;
    display: inline-flex;
    font-size: 1rem;
    justify-content: center;
    line-height: 1;
    min-width: 2rem;
    padding: 0;
}

.map-load-status-retry[hidden],
.map-load-status-dismiss[hidden] {
    display: none;
}

.map-load-status-retry:focus-visible,
.map-load-status-dismiss:focus-visible {
    outline: 3px solid var(--brand-brown);
    outline-offset: 2px;
}

.map-load-status[data-phase="fading"] {
    opacity: 0;
}

/* gone: no box, no space, no clicks; the empty live region stays in the accessibility tree */
.map-load-status[data-phase="hidden"] {
    backdrop-filter: none;
    border: 0;
    box-shadow: none;
    clip-path: inset(50%);
    height: 1px;
    opacity: 0;
    overflow: hidden;
    padding: 0;
    pointer-events: none;
    width: 1px;
}

@media (max-width: 600px) {
    .map-load-status {
        bottom: calc(4.25rem + env(safe-area-inset-bottom));
        max-width: calc(100% - 10rem);
    }
}

@media (prefers-reduced-motion: reduce) {
    .map-load-status {
        transition: none !important;
    }
}

/* MAP-VIEW-01 — 2D/3D camera toggle: its own pill in the top-right control stack, right under the
   navigation group (compass, and zoom on fine pointers), so it follows the same responsive placement
   (toolbar offset, PATCH-068 flyout, phones). The label names the view the button switches to. */
.map-view-mode-control .map-view-mode-toggle {
    color: var(--brand-brown);
    font: 800 0.92rem/1 system-ui, -apple-system, "Segoe UI", sans-serif;
    letter-spacing: 0.02em;
    min-height: 44px;
    min-width: 44px;
    touch-action: manipulation;
}

.map-view-mode-control .map-view-mode-toggle:focus-visible {
    box-shadow: inset 0 0 0 3px var(--brand-brown);
    outline: 2px solid #fff;
    outline-offset: -5px;
}

/* From 700px the expanded bus explorer panel sits in the top-right corner (bus_stops.css: right 1rem,
   width min(25rem, 100% - 2rem)). It used to cover the whole control column there: compass, zoom and,
   since MAP-VIEW-01, the 2D/3D toggle. While the panel is shown the column moves just left of it.
   Phones are unaffected: there the panel is a bottom sheet. */
@media (min-width: 700px) {
    .map-stage:has(#bus-explorer-panel:not([hidden])) .maplibregl-ctrl-top-right {
        right: calc(min(25rem, 100% - 2rem) + 1.75rem);
    }
}

/* MAP-UI-02 — compact toolbar. One column on every screen, in this order: Monumenti, Info, Servizi,
   Autobus, compass, 2D/3D (then, on fine pointers only, the zoom buttons). Salute, Acqua and WC are the
   same quick filters as before, grouped in the «Servizi» flyout, which reuses the PATCH-068 flyout look
   and transition (class monument-groups-flyout) and opens to the LEFT of its button. The compass, the
   2D/3D toggle and the zoom are the MapLibre/MAP-VIEW-01 controls themselves, mounted by map.js in
   #map-camera-controls instead of the map's top-right corner. */
.service-groups {
    display: grid;
    justify-items: center;
    position: relative;
}

.quick-filter svg {
    height: 2.7rem;
    pointer-events: none;
    width: 2.7rem;
}

/* a service filter stays visible while the flyout is closed: the same check badge as the groups */
.quick-filter--services {
    position: relative;
}

.quick-filter--services.has-active-service::after,
.service-groups-flyout .quick-filter[aria-pressed="true"]::after {
    align-items: center;
    background: var(--brand-brown);
    border: 2px solid var(--surface);
    border-radius: 50%;
    color: #fff;
    content: "\2713";
    content: "\2713" / "";
    display: grid;
    font-size: 0.62rem;
    font-weight: 800;
    height: 0.95rem;
    justify-items: center;
    line-height: 1;
    position: absolute;
    right: 0;
    top: 0;
    width: 0.95rem;
}

/* inside the flyout the three filters take the size and selected style of the monument groups */
.service-groups-flyout .quick-filter {
    border-radius: 0.75rem;
    height: var(--monument-group-size);
    overflow: visible;
    position: relative;
    width: var(--monument-group-size);
}

.service-groups-flyout .quick-filter img {
    height: 2.3rem;
    width: 2.3rem;
}

.service-groups-flyout .quick-filter:hover {
    background: rgb(122 31 18 / 8%);
}

.service-groups-flyout .quick-filter.is-active {
    background: rgb(122 31 18 / 12%);
    box-shadow: inset 0 0 0 2px var(--brand-brown);
    transform: none;
}

.service-groups-flyout .quick-filter[aria-pressed="true"]::after {
    right: -0.15rem;
    top: -0.15rem;
}

.service-groups-flyout .quick-filter:focus-visible {
    outline-offset: 1px;
}

/* camera controls: centred in the column, 44 px round targets, no corner margins */
.map-camera-controls {
    display: grid;
    gap: 0.45rem;
    justify-items: center;
}

.map-camera-controls:empty {
    display: none;
}

.map-camera-controls .maplibregl-ctrl,
.map-camera-controls .maplibregl-ctrl-group:not(:empty) {
    float: none;
    margin: 0;
}

.map-camera-controls .map-compass-control,
.map-camera-controls .map-view-mode-control {
    border-radius: 50%;
}

/* zoom «+»/«−» only where PATCH-069.2 keeps them (fine primary pointer, 700px and up): elsewhere the
   whole group goes, so no empty pill is left in the column */
@media (max-width: 699px), (hover: none) and (pointer: coarse) {
    .map-camera-controls .map-zoom-control {
        display: none;
    }
}

/* phones: 44 px targets and tighter gaps, so the six controls end well above «La mia posizione» */
@media (max-width: 699px) {
    .quick-filter-bar,
    .map-camera-controls {
        gap: 0.3rem;
    }

    .monument-groups > .quick-filter,
    .service-groups > .quick-filter,
    .quick-filter-bar > .quick-filter {
        height: 2.75rem;
        width: 2.75rem;
    }

    .monument-groups > .quick-filter img,
    .service-groups > .quick-filter svg,
    .quick-filter-bar > .quick-filter img {
        height: 2.45rem;
        width: 2.45rem;
    }
}

/* short phone screens: the column starts just under the search box */
@media (max-width: 699px) and (max-height: 640px) {
    .quick-filter-bar {
        top: calc(3.75rem + env(safe-area-inset-top));
    }

    .quick-filter-bar,
    .map-camera-controls {
        gap: 0.2rem;
    }
}

/* 320px: the «Servizi» flyout keeps one row (it is narrower than the monument one) */
@media (max-width: 359px) {
    .service-groups-flyout {
        grid-auto-flow: column;
        grid-template-columns: none;
    }

    .service-groups-flyout .monument-groups-close {
        align-self: auto;
        grid-column: auto;
        grid-row: auto;
        height: var(--monument-group-size);
    }
}

/* From 700px the expanded bus explorer panel takes the top-right corner (MAP-VIEW-01 note above): the
   whole column, compass and 2D/3D included, moves just left of it and below the search box, so neither
   the panel nor an open flyout covers a control. Phones are unaffected (bottom sheet). */
@media (min-width: 700px) {
    .map-stage:has(#bus-explorer-panel:not([hidden])) .quick-filter-bar {
        right: calc(min(25rem, 100% - 2rem) + 1.75rem);
        top: 4.5rem;
    }
}

/* MAP-UI-02.REVIEW.1 — 700-767px with the bus panel open: the column sits 30rem from the right edge,
   so the one-row monument flyout (~15.4rem) would cross the left edge below ~740px. There it takes the
   two-row layout of narrow phones (~9.4rem wide, close arrow spanning both rows). The «Servizi» flyout
   (~12.4rem, still fits) and the camera controls are unchanged. */
@media (min-width: 700px) and (max-width: 767px) {
    .map-stage:has(#bus-explorer-panel:not([hidden])) .monument-groups > .monument-groups-flyout {
        grid-auto-flow: row;
        grid-template-columns: repeat(3, var(--monument-group-size));
    }

    .map-stage:has(#bus-explorer-panel:not([hidden])) .monument-groups > .monument-groups-flyout .monument-groups-close {
        align-self: stretch;
        grid-column: 3;
        grid-row: 1 / span 2;
        height: auto;
    }
}

/* MAP-UI-02.1 — short desktop/tablet windows: the toolbar column (and the zoom buttons that end it on fine
   pointers) reaches the bottom-right corner below ~680px of height, where «La mia posizione» sits.
   There the locate button moves just left of the column; column, zoom and their order are unchanged. */
@media (min-width: 700px) and (max-height: 700px) {
    .locate-fab {
        right: 4.5rem;
    }
}

/* POI-DEFAULT-01 — label on a category's illustrative image (overlay: no change to card or media sizes) */
.poi-list-card-media--default {
    position: relative;
}

.poi-list-card-media-label,
.poi-preview-media-label {
    background: rgb(36 31 28 / 72%);
    border-radius: 0.25rem;
    bottom: 0.3rem;
    color: #fff;
    font-size: 0.62rem;
    font-weight: 600;
    left: 0.3rem;
    line-height: 1.2;
    padding: 0.1rem 0.35rem;
    pointer-events: none;
    position: absolute;
}
