/* ================================================================
   map.css — Conecta Bueno — Mapa Cultural
   Mesmo sistema visual da home (tokens verde/folha/terracota,
   Poppins/Inter, cartões com --shadow-card).
   ================================================================ */

/* ── Tokens (mesmos valores de home.css/auth.css) ────────────────── */
:root {
    --green-900: #0f2419;
    --green-800: #1a3a2e;
    --green-700: #2d5a3d;
    --green-600: #3d7a52;
    --green-500: #4a9060;
    --green-400: #6aad80;
    --green-300: #9dcfb0;
    --green-200: #c8e6d4;
    --green-100: #e8f5ee;
    --green-50: #f4faf7;

    --leaf-400: #4cc177;
    --leaf-500: #2f9e52;
    --leaf-700: #1f7a41;
    --leaf-900: #145c30;

    --clay-400: #e08a52;
    --clay-600: #c2703c;
    --clay-800: #96502a;

    --grey-100: #f3f4f6;
    --grey-200: #e5e7eb;
    --grey-300: #d1d5db;
    --grey-400: #9ca3af;
    --grey-500: #6b7280;
    --grey-600: #4b5563;
    --grey-700: #374151;
    --grey-900: #111827;

    --font-display: 'Poppins', 'Segoe UI', sans-serif;
    --font-body: 'Inter', 'Segoe UI', sans-serif;

    --shadow-soft: 0 10px 26px rgba(20, 45, 30, 0.12);
    --shadow-card: 0 20px 50px rgba(20, 45, 30, 0.14);

    --header-h: 70px;
}

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    overflow: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--grey-100);
    font-family: var(--font-body);
    color: var(--grey-900);
}

/* ================================================================
   LOADING OVERLAY
   ================================================================ */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, var(--green-900), var(--green-700));
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 10000;
    color: white;
}

.loading-spinner {
    width: 46px;
    height: 46px;
    border: 3px solid rgba(255, 255, 255, .2);
    border-top-color: white;
    border-radius: 50%;
    animation: spin .9s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-overlay p {
    margin: 0;
    font-size: calc(15px * var(--a11y-text-scale, 1));
    opacity: .9;
}

/* ================================================================
   HEADER — sem hero pra rolar por baixo, fica sempre "sólido"
   ================================================================ */
.site-header {
    background: rgba(15, 36, 25, .94) !important;
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .18);
    border-bottom: 1px solid rgba(255, 255, 255, .1);
    z-index: 900;
}

/* ================================================================
   LAYOUT PRINCIPAL
   ================================================================ */
.map-wrapper {
    position: relative;
    display: flex;
    width: 100%;
    height: calc(100vh - var(--header-h));
    min-height: 0;
    margin-top: var(--header-h);
    overflow: hidden;
}

/* ================================================================
   SIDEBAR
   ================================================================ */
.map-sidebar {
    position: absolute;
    inset: 0 auto 0 0;
    width: 360px;
    height: 100%;
    background: white;
    border-right: 1px solid var(--grey-200);
    box-shadow: 4px 0 20px rgba(15, 23, 42, .08);
    display: flex;
    flex-direction: column;
    transition: transform .3s cubic-bezier(.4, 0, .2, 1), box-shadow .3s ease;
    transform: translateX(-100%);
    z-index: 400;
}

.map-sidebar.active {
    transform: translateX(0);
}

.map-sidebar.sidebar-collapsed {
    transform: translateX(-100%) !important;
    box-shadow: none !important;
}

.sidebar-toggle-btn {
    position: absolute;
    top: 50%;
    right: -18px;
    transform: translateY(-50%);
    width: 30px;
    height: 52px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    color: white;
    box-shadow: 0 10px 22px rgba(20, 92, 48, .28);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: transform .25s ease, filter .2s ease;
}

.sidebar-toggle-btn:hover {
    transform: translateY(-50%) scale(1.07);
    filter: brightness(1.06);
}

.sidebar-toggle-btn span {
    font-size: calc(24px * var(--a11y-text-scale, 1));
    line-height: 1;
    transform: translateX(-1px);
}

.sidebar-toggle-btn.active span {
    transform: rotate(180deg) translateX(-1px);
}

.sidebar-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 0;
    overflow: hidden;
    transition: opacity .2s ease;
}

.map-sidebar.sidebar-collapsed .sidebar-content {
    opacity: 0;
    pointer-events: none;
}

/* ── Estatísticas rápidas ─────────────────────────────────────── */
.quick-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    flex-shrink: 0;
    margin-bottom: 18px;
}

.stat-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 14px;
    background: var(--green-50);
    border: 1px solid var(--green-100);
    border-radius: 14px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-soft);
}

.stat-icon {
    width: 38px;
    height: 38px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    color: white;
    border-radius: 10px;
}

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 1px;
    min-width: 0;
}

.stat-value {
    font-family: var(--font-display);
    font-size: calc(20px * var(--a11y-text-scale, 1));
    font-weight: 800;
    color: var(--grey-900);
    line-height: 1;
}

.stat-label {
    font-size: calc(11px * var(--a11y-text-scale, 1));
    font-weight: 600;
    color: var(--grey-500);
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* ── Busca ─────────────────────────────────────────────────────── */
.search-section {
    flex-shrink: 0;
    margin-bottom: 16px;
}

.search-box {
    position: relative;
    display: flex;
    align-items: center;
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
    border-radius: 999px;
    transition: border-color .2s ease, background .2s ease;
}

.search-box:focus-within {
    background: white;
    border-color: var(--leaf-500);
    box-shadow: 0 0 0 3px rgba(47, 158, 82, .12);
}

.search-icon {
    position: absolute;
    left: 15px;
    color: var(--grey-400);
    pointer-events: none;
}

.search-input {
    width: 100%;
    padding: 12px 44px 12px 44px;
    border: none;
    border-radius: 999px;
    background: transparent;
    font: inherit;
    font-size: calc(14px * var(--a11y-text-scale, 1));
    color: var(--grey-900);
}

.search-input:focus {
    outline: none;
}

.search-input::placeholder {
    color: var(--grey-400);
}

.search-clear {
    position: absolute;
    right: 8px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--green-100);
    border: none;
    color: var(--leaf-700);
    border-radius: 50%;
    cursor: pointer;
    transition: background .2s ease;
}

.search-clear:hover {
    background: var(--green-200);
}

/* ── Filtros de categoria ─────────────────────────────────────── */
.filters-section {
    flex-shrink: 0;
    margin-bottom: 16px;
}

.filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.filters-header h3,
.results-header h3 {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: calc(12px * var(--a11y-text-scale, 1));
    font-weight: 800;
    color: var(--grey-700);
    text-transform: uppercase;
    letter-spacing: .6px;
}

.filters-header h3 svg,
.results-header h3 svg {
    color: var(--leaf-700);
}

.btn-clear-filters {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: var(--grey-100);
    border: none;
    color: var(--grey-500);
    border-radius: 8px;
    cursor: pointer;
    transition: background .2s ease, color .2s ease;
}

.btn-clear-filters:hover {
    background: var(--green-100);
    color: var(--leaf-700);
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.filter-btn {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    background: var(--grey-100);
    border: 1px solid var(--grey-200);
    border-radius: 999px;
    color: var(--grey-700);
    font: inherit;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 600;
    cursor: pointer;
    transition: all .2s ease;
}

.filter-btn svg {
    color: var(--grey-400);
    flex-shrink: 0;
}

.filter-btn:hover {
    background: var(--green-50);
    border-color: var(--leaf-500);
    color: var(--leaf-900);
}

.filter-btn:hover svg {
    color: var(--leaf-700);
}

.filter-btn.active {
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    border-color: var(--leaf-900);
    color: white;
    box-shadow: 0 6px 16px rgba(20, 92, 48, .24);
}

.filter-btn.active svg {
    color: white;
}

/* ── Lista de resultados (rola por dentro, resto fica fixo) ──────── */
.results-section {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
    flex-shrink: 0;
}

.sort-select-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.sort-select {
    appearance: none;
    padding: 6px 26px 6px 10px;
    border: 1px solid var(--grey-200);
    border-radius: 8px;
    background: var(--grey-100);
    color: var(--grey-700);
    font: inherit;
    font-size: calc(11.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: border-color .2s ease;
}

.sort-select:hover,
.sort-select:focus {
    border-color: var(--leaf-500);
    outline: none;
}

.sort-select-icon {
    position: absolute;
    right: 8px;
    color: var(--grey-500);
    pointer-events: none;
}

.results-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 12px;
    margin-right: -6px;
    padding-right: 6px;
}

.space-card {
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 11px 13px;
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

.space-card:hover {
    border-color: var(--leaf-500);
    box-shadow: var(--shadow-soft);
    transform: translateX(3px);
}

.space-card.space-card-active {
    background: var(--green-50);
    border-color: var(--leaf-500);
}

.space-card-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.space-card .category {
    font-size: calc(10.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--clay-600);
    text-transform: uppercase;
    letter-spacing: .4px;
}

.space-card-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    flex-shrink: 0;
    margin: -5px -5px 0 0;
    padding: 0;
    background: none;
    border: none;
    border-radius: 8px;
    color: var(--grey-400);
    cursor: pointer;
    transition: background .16s ease, color .16s ease;
}

.space-card-fav svg {
    width: 15px;
    height: 15px;
}

.space-card-fav:hover {
    background: var(--grey-100);
    color: var(--danger-color, #ef4444);
}

.space-card-fav.is-fav {
    color: var(--danger-color, #ef4444);
}

.space-card-fav:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

.space-card h4 {
    margin: 0;
    font-family: var(--font-display);
    font-size: calc(14.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-900);
    line-height: 1.3;
}

.space-card .address {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    font-size: calc(12px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
    line-height: 1.4;
}

.space-card .address svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--grey-400);
}

.results-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 32px 16px;
    color: var(--grey-400);
    text-align: center;
}

.results-empty svg {
    color: var(--grey-300);
}

.results-empty p {
    margin: 0;
    font-size: calc(13px * var(--a11y-text-scale, 1));
    font-weight: 600;
    color: var(--grey-500);
}

/* Scrollbar da lista */
.results-list::-webkit-scrollbar {
    width: 6px;
}

.results-list::-webkit-scrollbar-track {
    background: transparent;
}

.results-list::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 3px;
}

.results-list::-webkit-scrollbar-thumb:hover {
    background: var(--grey-400);
}

/* ── Resumo de resultados (rodapé fixo da sidebar) ────────────────── */
.results-summary {
    flex-shrink: 0;
    padding: 12px 4px;
    border-top: 1px solid var(--grey-200);
}

.results-count {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-600);
}

.results-count svg {
    color: var(--leaf-700);
}

/* ================================================================
   ABAS DA SIDEBAR — Explorar / Meu roteiro
   ================================================================ */
.sb-tabs {
    flex-shrink: 0;
    display: flex;
    gap: 6px;
    padding: 0 4px 12px;
}

.sb-tab {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 10px;
    border: 1.5px solid var(--grey-200);
    border-radius: 10px;
    background: #fff;
    color: var(--grey-600);
    font: inherit;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: background .16s ease, border-color .16s ease, color .16s ease;
}

.sb-tab:hover { border-color: var(--leaf-400); }

.sb-tab.active {
    background: var(--leaf-900);
    border-color: var(--leaf-900);
    color: #fff;
}

.sb-tab:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

.sb-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--clay-600);
    color: #fff;
    font-size: calc(10.5px * var(--a11y-text-scale, 1));
    font-weight: 800;
}

.sb-tab.active .sb-tab-count { background: #fff; color: var(--leaf-900); }
.sb-tab-count[hidden] { display: none; }

.sb-panel { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.sb-panel[hidden] { display: none; }

/* ================================================================
   MEU ROTEIRO — planejador de passeio (localStorage, prefixo .rt-*)
   ================================================================ */
.rt-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 40px 12px;
    color: var(--grey-500);
}

.rt-empty__icon { font-size: 34px; opacity: .7; }

.rt-empty__title {
    margin: 0;
    font-family: var(--font-display);
    font-size: calc(14px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-700);
}

.rt-empty__hint {
    margin: 0;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    line-height: 1.5;
    max-width: 220px;
}

.rt-summary {
    flex-shrink: 0;
    margin: 0 4px 10px;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-700);
}

.rt-summary__note { font-weight: 500; color: var(--grey-400); }

.rt-list {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    margin: 0;
    padding: 0 4px;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.rt-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--grey-200);
    border-radius: 10px;
    background: #fff;
}

.rt-item__order {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--green-100);
    color: var(--leaf-900);
    font-size: calc(10.5px * var(--a11y-text-scale, 1));
    font-weight: 800;
}

.rt-item__icon { flex-shrink: 0; font-size: 15px; }

.rt-item__name {
    flex: 1;
    min-width: 0;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 600;
    color: var(--grey-900);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rt-item__actions { flex-shrink: 0; display: flex; gap: 2px; }

.rt-item__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: var(--grey-500);
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.rt-item__btn:hover { background: var(--green-50); color: var(--leaf-900); }
.rt-item__btn:disabled { opacity: .3; cursor: not-allowed; }
.rt-item__btn:disabled:hover { background: transparent; color: var(--grey-500); }
.rt-item__btn--danger:hover { background: #fdecea; color: #b3261e; }
.rt-item__btn:focus-visible { outline: 2px solid var(--leaf-400); outline-offset: 1px; }

.rt-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 4px 4px;
    margin-top: 8px;
    border-top: 1px solid var(--grey-200);
}

.rt-clear {
    padding: 6px;
    border: none;
    background: none;
    color: var(--grey-500);
    font: inherit;
    font-size: calc(12px * var(--a11y-text-scale, 1));
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.rt-clear:hover { color: #b3261e; }

/* Aviso no canto livre do mapa (topo-esquerda) quando a pessoa quer
   voltar pro roteiro sem procurar a aba — único canto sem disputa com
   controles/legenda/a11y/VLibras, que vivem embaixo. */
.rt-badge {
    position: absolute;
    top: 24px;
    left: 24px;
    z-index: 900;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: none;
    border-radius: 999px;
    background: var(--leaf-900);
    color: #fff;
    box-shadow: var(--shadow-soft);
    font: inherit;
    font-size: calc(12px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, box-shadow .18s ease;
}

/* Sem isto, "display:inline-flex" acima (mesma especificidade do
   seletor de atributo [hidden]) venceria por ordem de declaração e o
   botão continuaria visível mesmo com o atributo hidden presente. */
.rt-badge[hidden] { display: none; }

.rt-badge:hover { transform: translateY(-1px); box-shadow: var(--shadow-card); }
.rt-badge:focus-visible { outline: 3px solid var(--leaf-400); outline-offset: 2px; }

.rt-badge__count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--clay-600);
    font-size: calc(10.5px * var(--a11y-text-scale, 1));
    font-weight: 800;
}

/* ================================================================
   MAPA
   ================================================================ */
.map-container {
    position: relative;
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    margin-left: 0;
    transition: margin-left .3s ease, width .3s ease;
    z-index: 1;
}

@media (min-width: 1025px) {
    .map-container {
        margin-left: 360px;
        width: calc(100% - 360px);
    }

    .map-wrapper:has(.map-sidebar:not(.active)) .map-container {
        margin-left: 0;
        width: 100%;
    }
}

@media (max-width: 1024px) {
    .map-container {
        margin-left: 0;
        width: 100%;
    }
}

#map {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background: var(--green-50);
}

/* ── Controles do mapa ─────────────────────────────────────────── */
.map-controls {
    position: absolute;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 500;
}

.map-control-btn {
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid var(--grey-200);
    border-radius: 12px;
    color: var(--grey-600);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-soft);
    transition: all .2s ease;
}

.map-control-btn:hover {
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    color: white;
    border-color: var(--leaf-900);
    transform: translateY(-1px);
}

/* Zoom +/- como um par colado, no padrão de controle de mapa */
.map-control-group {
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.map-control-group .map-control-btn {
    border-radius: 0;
    box-shadow: none;
    transform: none;
}

.map-control-group .map-control-btn:first-child {
    border-bottom: none;
}

.map-control-group .map-control-btn:hover {
    transform: none;
}

/* Em tela cheia o container vira a tela toda — o mapa precisa acompanhar */
.map-container:fullscreen {
    width: 100%;
    height: 100%;
    margin-left: 0;
}

/* ── Legenda de categorias ─────────────────────────────────────── */
.map-legend {
    position: absolute;
    bottom: 24px;
    left: 24px;
    z-index: 500;
    background: white;
    border-radius: 14px;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
    max-width: 230px;
}

.legend-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 11px 14px;
    background: none;
    border: none;
    color: var(--grey-700);
    font: inherit;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
}

.legend-toggle svg:first-child {
    color: var(--leaf-700);
    flex-shrink: 0;
}

.legend-toggle span {
    flex: 1;
    text-align: left;
}

.legend-chevron {
    color: var(--grey-400);
    transition: transform .25s ease;
    flex-shrink: 0;
}

.legend-toggle[aria-expanded="true"] .legend-chevron {
    transform: rotate(180deg);
}

.legend-content {
    padding: 0 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    border-top: 1px solid var(--grey-100);
    padding-top: 10px;
}

.legend-content[hidden] {
    display: none;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 9px;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    color: var(--grey-700);
}

.legend-dot {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px white, 0 0 0 3px rgba(0, 0, 0, .06);
}

/* ================================================================
   MARCADORES PERSONALIZADOS
   ================================================================ */
.custom-marker {
    background: transparent !important;
    border: none !important;
}

.marker-pin {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
    border: 3px solid white;
    transition: transform .2s ease, box-shadow .2s ease;
    animation: markerPop .35s cubic-bezier(.34, 1.56, .64, 1) both;
}

.custom-marker:hover .marker-pin {
    transform: scale(1.12);
    box-shadow: 0 6px 16px rgba(0, 0, 0, .32);
}

.marker-icon {
    font-size: calc(17px * var(--a11y-text-scale, 1));
    line-height: 1;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .2));
}

@keyframes markerPop {
    from { transform: scale(0); }
    to { transform: scale(1); }
}

.user-location-marker {
    animation: markerPop .3s ease both;
}

/* Clusters (plugin leaflet.markercluster) — reskin com a paleta do site */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(47, 158, 82, .22);
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    color: white;
}

.marker-cluster span {
    font-family: var(--font-display);
    font-weight: 700;
}

/* ================================================================
   CARTÃO IMERSIVO DO PONTO TURÍSTICO
   Componente próprio, prefixo .ic-*, estética editorial.
   ================================================================ */

/* ── Casca do painel de detalhes (ver bloco .sd-* mais abaixo) ──── */

/* ── Estrutura do card ────────────────────────────────────────── */
.ic-card {
    display: flex;
    flex-direction: column;
    background: #fff;
    color: var(--grey-900);
    flex: 1;
    min-height: 0;
    height: 100%;
}

/* ── Capa: sempre presente (com ou sem foto) — é onde a categoria
   e o nome vivem agora, como manchete de revista sobre a imagem. ── */
.ic-hero {
    position: relative;
    margin: 0;
    height: 240px;
    flex-shrink: 0;
    overflow: hidden;
    background: linear-gradient(160deg, var(--green-100), var(--green-50) 65%);
    display: flex;
    align-items: flex-end;
}

.ic-hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Sem foto (ou foto quebrada): textura discreta em vez de vazio —
   ícone da categoria sangrando pelo canto, bem apagado (textura,
   não "sticker" central). */
.ic-hero--noimg::before {
    content: attr(data-icon);
    position: absolute;
    right: -14px;
    bottom: -22px;
    font-size: 128px;
    line-height: 1;
    opacity: .16;
    filter: grayscale(.35);
}

/* Véu: garante contraste do título e do botão de fechar sobre
   qualquer foto, clara ou escura. */
.ic-hero__scrim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(8, 20, 13, 0) 38%, rgba(6, 16, 11, .78) 100%);
    pointer-events: none;
}

.ic-hero__caption {
    position: relative;
    z-index: 1;
    padding: 18px 50px 16px 18px;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.ic-eyebrow {
    display: inline-flex;
    align-self: flex-start;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: var(--grey-900);
    font-size: calc(10.5px * var(--a11y-text-scale, 1));
    font-weight: 800;
    letter-spacing: .5px;
    text-transform: uppercase;
    white-space: nowrap;
}

.ic-title {
    margin: 0;
    font-family: var(--font-display);
    font-size: calc(25px * var(--a11y-text-scale, 1));
    font-weight: 800;
    line-height: 1.12;
    letter-spacing: -.015em;
    color: #fff;
}

/* ── Corpo ────────────────────────────────────────────────────── */
.ic-body {
    padding: 16px 18px 18px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.ic-body::-webkit-scrollbar {
    width: 6px;
}

.ic-body::-webkit-scrollbar-thumb {
    background: var(--grey-300);
    border-radius: 3px;
}

/* Ponto de extensão: cada seção nova do cartão (curiosidades,
   comunidade, ...) usa este bloco genérico — herda alto contraste
   automaticamente via ".ic-card *" mais abaixo, sem CSS próprio. */
.ic-section {
    padding-top: 14px;
    margin-top: 2px;
    border-top: 1px solid var(--grey-200);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.ic-section__title {
    margin: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display);
    font-size: calc(12px * var(--a11y-text-scale, 1));
    font-weight: 700;
    letter-spacing: .3px;
    text-transform: uppercase;
    color: var(--leaf-700);
}

/* Comunidade: acento terracota + fundo levemente diferente, pra
   separar visualmente de conteúdo oficial (curiosidades, descrição)
   sem precisar de mais texto explicando a diferença. */
.ic-section--comunidade {
    margin-left: -18px;
    margin-right: -18px;
    padding-left: 18px;
    padding-right: 18px;
    border-top: 1px solid var(--clay-400);
    background: var(--green-50);
}

.ic-section--comunidade .ic-section__title {
    color: var(--clay-800);
}

.cm-tip {
    padding: 10px 0;
    border-bottom: 1px solid var(--grey-200);
}

.cm-tip:last-of-type {
    border-bottom: none;
}

.cm-tip__text {
    margin: 0 0 4px;
    font-size: calc(13px * var(--a11y-text-scale, 1));
    line-height: 1.5;
    color: var(--grey-900);
}

.cm-tip__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cm-tip__author {
    margin: 0;
    font-size: calc(11px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--grey-500);
}

/* Só aparece na própria dica (checagem de autoria em buildDicasHTML) —
   discreto até o hover, para não competir com o texto da dica. */
.cm-tip__delete {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 8px;
    background: none;
    color: var(--grey-400);
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.cm-tip__delete .pc-icon {
    width: 14px;
    height: 14px;
}

.cm-tip__delete:hover {
    background: rgba(198, 40, 40, .1);
    color: #c62828;
}

.cm-tip__delete:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

.cm-empty {
    margin: 4px 0 12px;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    color: var(--grey-500);
}

.cm-composer {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-top: 10px;
}

.cm-composer__input {
    width: 100%;
    min-height: 60px;
    padding: 10px 12px;
    border: 1.5px solid var(--grey-300);
    border-radius: 10px;
    background: #fff;
    color: var(--grey-900);
    font: inherit;
    font-size: calc(13px * var(--a11y-text-scale, 1));
    resize: vertical;
}

.cm-composer__input:focus-visible {
    outline: none;
    border-color: var(--clay-400);
}

/* Ações secundárias (favoritar, roteiro, ouvir, compartilhar): grid
   fixo de 2 colunas — com flex-wrap, 3 ou 4 botões de larguras
   variadas "sobravam" um item sozinho numa linha própria, torto em
   relação ao resto; o grid sempre fecha em pares (2x2 ou 2x1). */
.ic-actions-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.ic-actions-row > * {
    min-width: 0;
}

/* Check-in do passaporte cultural — estilo reservado aqui, botão
   entra no cartão na Fase 4. Acento terracota (--clay-*), a mesma
   cor já reservada em todo o site para "identidade da cidade"/selos,
   pra não competir visualmente com o verde das rotas. */
.ic-checkin {
    display: inline-flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1.5px solid var(--clay-800);
    background: linear-gradient(135deg, var(--clay-400), var(--clay-800));
    color: #fff;
    font: inherit;
    font-size: calc(13px * var(--a11y-text-scale, 1));
    font-weight: 700;
    cursor: pointer;
    transition: transform .18s ease, filter .18s ease, box-shadow .18s ease;
    box-shadow: 0 6px 16px rgba(150, 80, 42, .24);
}

/* Sem estas duas regras o ícone SVG (sem width/height próprio) cai no
   tamanho intrínseco padrão do navegador e o texto quebra em duas
   linhas — o botão "infla" e desalinha do resto de .pc-actions. */
.ic-checkin .pc-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.ic-checkin span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ic-checkin:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

.ic-checkin.is-visited {
    background: var(--green-50);
    border-color: var(--leaf-700);
    color: var(--leaf-900);
    box-shadow: none;
}

.ic-checkin:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

/* Confirmação cosmética de proximidade — nunca bloqueia o check-in
   manual, só aparece quando faz sentido (ver createImmersiveCard). */
.ic-nearby-hint {
    margin: 0 0 6px;
    font-size: calc(11.5px * var(--a11y-text-scale, 1));
    font-weight: 700;
    color: var(--leaf-700);
}

.pc-fav {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 600;
    color: var(--grey-500);
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.pc-fav .pc-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

/* Nunca quebra em duas linhas dentro da célula do grid — encurta com
   reticências se faltar espaço (mesmo tratamento de .pc-btn span). */
.pc-fav span,
.pc-share span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-fav:hover {
    background: var(--green-50);
    color: var(--leaf-900);
}

.pc-fav.is-fav {
    color: var(--leaf-700);
}

.pc-fav:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

/* Categoria e nome agora vivem em .ic-eyebrow/.ic-title, dentro da
   capa (.ic-hero__caption) — mostrar de novo aqui seria repetir a
   mesma informação logo abaixo da manchete. */

/* ── Tags livres ──────────────────────────────────────────────── */
.pc-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.pc-tag {
    padding: 4px 10px;
    border-radius: 999px;
    background: var(--green-50);
    border: 1px solid var(--green-100);
    color: var(--leaf-700);
    font-size: calc(11.5px * var(--a11y-text-scale, 1));
    font-weight: 600;
}

.pc-desc {
    margin: 0;
    font-size: calc(13.5px * var(--a11y-text-scale, 1));
    line-height: 1.6;
    color: var(--grey-500);
}

/* ── Lista de informações ─────────────────────────────────────── */
.pc-info {
    margin: 4px 0 0;
    padding: 0;
    list-style: none;
    border-top: 1px solid var(--grey-200);
}

.pc-info__item {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    padding: 10px 0;
    font-size: calc(13.5px * var(--a11y-text-scale, 1));
    line-height: 1.45;
    color: var(--grey-600);
    border-bottom: 1px solid var(--grey-100);
}

.pc-info__item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.pc-info__item .pc-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    margin-top: 1px;
    color: var(--leaf-700);
}

.pc-info__item--free { color: var(--leaf-700); font-weight: 600; }
.pc-info__item--free .pc-icon { color: var(--leaf-700); }
.pc-info__item--paid { color: var(--clay-800); font-weight: 600; }
.pc-info__item--paid .pc-icon { color: var(--clay-600); }

.pc-info__item--accessible { color: var(--leaf-700); font-weight: 600; }
.pc-info__item--accessible .pc-icon { color: var(--leaf-700); }
.pc-info__item--partial { color: var(--clay-800); font-weight: 600; }
.pc-info__item--partial .pc-icon { color: var(--clay-600); }
.pc-info__item--not-accessible { color: var(--grey-500); }
.pc-info__item--not-accessible .pc-icon { color: var(--grey-500); }

/* ── Ações ────────────────────────────────────────────────────── */
.pc-actions {
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 14px 18px 16px;
    background: var(--grey-100);
    border-top: 1px solid var(--grey-200);
}

/* Google Maps + Waze lado a lado — mesmo tratamento de .pc-links,
   poupando altura pro conteúdo de informações acima no corpo do
   cartão. routesHTML só é gerado com os dois juntos (ver
   createImmersiveCard em map.js), então não precisa de :has(). */
.pc-routes {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 8px;
}

/* Apoio: ocupa a linha inteira quando é um só, divide quando são dois.
   Flexbox em vez de grid + :has() — cada botão já divide o espaço
   igualmente sozinho, sem depender de suporte a :has() (inconsistente
   em navegadores/WebViews mais antigos, incluindo alguns Android). */
.pc-links {
    display: flex;
    gap: 8px;
}

.pc-links > * {
    flex: 1 1 0;
    min-width: 0;
}

.pc-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 0;
    min-height: 44px;          /* alvo de toque */
    padding: 10px 12px;
    border-radius: 12px;
    border: 1.5px solid transparent;
    font: inherit;
    font-size: calc(13px * var(--a11y-text-scale, 1));
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform .18s ease, background .18s ease,
                border-color .18s ease, box-shadow .18s ease, filter .18s ease;
}

/* Nunca quebra em duas linhas: encurta com reticências se faltar espaço */
.pc-btn span {
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pc-btn .pc-icon {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
}

.pc-btn--primary {
    background: linear-gradient(135deg, var(--leaf-500), var(--leaf-900));
    border-color: var(--leaf-900);
    box-shadow: 0 6px 16px rgba(20, 92, 48, .24);
}

.pc-btn--primary:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
    box-shadow: 0 9px 22px rgba(20, 92, 48, .3);
}

.pc-btn--secondary {
    background: #fff;
    border-color: var(--grey-200);
}

.pc-btn--secondary:hover {
    border-color: var(--leaf-500);
    background: var(--green-50);
    transform: translateY(-1px);
}

/* Apoio: contorno mais leve, para não competir com as rotas */
.pc-btn--outline {
    background: transparent;
    border-color: var(--grey-300);
    font-weight: 600;
}

.pc-btn--outline:hover {
    background: #fff;
    border-color: var(--leaf-500);
}

/* Compartilhar: texto + ícone, sem peso de botão */
.pc-share {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 44px;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: 10px;
    font: inherit;
    font-size: calc(12.5px * var(--a11y-text-scale, 1));
    font-weight: 600;
    cursor: pointer;
    transition: background .18s ease, color .18s ease;
}

.pc-share .pc-icon {
    width: 15px;
    height: 15px;
    flex-shrink: 0;
}

.pc-share:hover {
    background: var(--green-50);
}

/* O global.css define `a { color: var(--primary-color) }` — a
   reafirmação abaixo (mesma especificidade, sem !important) garante que
   os botões/links do card usem a paleta própria do componente. */
.pc-btn--primary,
.pc-btn--primary:hover {
    color: #fff;
}

.pc-btn--secondary {
    color: var(--grey-700);
}

.pc-btn--secondary:hover {
    color: var(--leaf-900);
}

.pc-btn--secondary .pc-icon {
    color: var(--leaf-700);
}

.pc-btn--outline {
    color: var(--grey-600);
}

.pc-btn--outline:hover {
    color: var(--leaf-900);
}

.pc-share {
    color: var(--grey-500);
}

.pc-share:hover {
    color: var(--leaf-900);
}

.pc-info__item a {
    color: var(--leaf-700);
    font-weight: 600;
    text-decoration: none;
}

.pc-info__item a:hover {
    text-decoration: underline;
}

/* Foco visível e consistente em todos os controles do card */
.pc-btn:focus-visible,
.pc-share:focus-visible,
.pc-info__item a:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

/* ================================================================
   PAINEL DE DETALHES (substitui o popup do Leaflet)
   Desacoplado do marcador: gaveta (bottom sheet) no mobile, painel
   lateral no desktop. Reaproveita o .ic-card por dentro.
   ================================================================ */
.sd-backdrop {
    position: fixed;
    inset: 0;
    top: var(--header-h);
    background: rgba(6, 15, 10, 0);
    z-index: 1050;
    transition: background .3s ease;
}

.sd-backdrop.is-visible {
    background: rgba(6, 15, 10, .4);
}

.sd-panel {
    position: fixed;
    background: #fff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 1060;
    transition: transform .34s cubic-bezier(.16, 1, .3, 1);
}

.sd-panel:not(.is-open) {
    pointer-events: none;
}

/* Alça: só faz sentido visualmente no modo gaveta (mobile) */
.sd-handle {
    display: none;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, .7);
    z-index: 5;
}

/* Botão de fechar: mesmo desenho translúcido que o antigo botão do
   Leaflet, agora em fluxo normal no canto do painel. */
.sd-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 50%;
    background: rgba(14, 30, 20, .46);
    backdrop-filter: blur(8px) saturate(140%);
    -webkit-backdrop-filter: blur(8px) saturate(140%);
    border: 1px solid rgba(255, 255, 255, .3);
    cursor: pointer;
    z-index: 5;
    transition: background .2s ease, transform .2s ease;
}

.sd-close:hover {
    background: rgba(14, 30, 20, .68);
    transform: scale(1.06);
}

.sd-close:focus-visible {
    outline: 3px solid var(--leaf-400);
    outline-offset: 2px;
}

@media (pointer: coarse) {
    .sd-close {
        width: 44px;
        height: 44px;
    }
}

.sd-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Desktop: painel desliza pela lateral direita, sobreposto ao mapa
   (não redimensiona o #map — sem necessidade de invalidateSize). */
@media (min-width: 1025px) {
    .sd-panel {
        top: var(--header-h);
        right: 0;
        bottom: 0;
        width: min(420px, 92vw);
        border-radius: 0;
        box-shadow: -12px 0 40px rgba(12, 32, 20, .18);
        transform: translateX(100%);
    }

    .sd-panel.is-open {
        transform: translateX(0);
    }
}

/* Mobile/tablet: gaveta que sobe da base da tela. */
@media (max-width: 1024px) {
    .sd-panel {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 90vh;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px rgba(12, 32, 20, .22);
        transform: translateY(100%);
    }

    .sd-panel.is-open {
        transform: translateY(0);
    }

    .sd-handle {
        display: block;
    }

    /* A gaveta tem altura limitada e cada botão empilhado no rodapé
       rouba espaço da área rolável de informações (.ic-body) — o
       rodapé ganha respiro mais enxuto. Ainda dentro do alvo de
       toque de 44px. */
    .pc-actions {
        gap: 6px;
        padding: 12px 16px 14px;
    }

    .ic-body {
        gap: 8px;
        padding: 14px 16px 16px;
    }
}

/* Marcador com o painel de detalhes aberto: destaque visual, já que
   não existe mais uma seta de popup apontando para ele. */
.marker-selected .marker-pin {
    transform: scale(1.22);
    box-shadow: 0 0 0 5px rgba(47, 158, 82, .32), 0 8px 20px rgba(0, 0, 0, .38);
}

/* ================================================================
   TOAST
   ================================================================ */
.toast-container {
    position: fixed;
    top: calc(var(--header-h) + 14px);
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 300px;
    padding: 14px 18px;
    background: white;
    border-radius: 12px;
    box-shadow: var(--shadow-card);
    animation: slideInRight .25s ease;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.toast.success { border-left: 4px solid var(--leaf-500); }
.toast.error { border-left: 4px solid #dc4545; }
.toast.info { border-left: 4px solid #3b82f6; }

.toast-icon {
    font-size: calc(18px * var(--a11y-text-scale, 1));
}

.toast-message {
    flex: 1;
    font-size: calc(13.5px * var(--a11y-text-scale, 1));
    color: var(--grey-700);
    font-weight: 600;
}

/* ================================================================
   RESPONSIVO
   ================================================================ */
@media (max-width: 1024px) {
    .map-sidebar {
        position: fixed;
        top: var(--header-h);
        height: calc(100vh - var(--header-h));
        width: min(360px, 88vw);
        z-index: 999;
        box-shadow: 6px 0 24px rgba(0, 0, 0, .18);
    }

    .sidebar-overlay-backdrop {
        position: fixed;
        inset: 0;
        top: var(--header-h);
        background: rgba(6, 15, 10, 0);
        z-index: 998;
        transition: background .25s ease;
    }

    .sidebar-overlay-backdrop.is-visible {
        background: rgba(6, 15, 10, .5);
    }
}

@media (max-width: 900px) {
    .map-legend {
        max-width: 190px;
    }
}

@media (max-width: 768px) {
    .toast-container {
        left: 16px;
        right: 16px;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }

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

    .map-legend {
        bottom: 16px;
        left: 16px;
        max-width: 170px;
    }

    .ic-hero {
        height: 190px;
    }
}

@media (max-width: 480px) {
    .map-sidebar {
        width: 100vw;
    }

    .sidebar-content {
        padding: 14px 14px 0;
    }

    .quick-stats {
        gap: 8px;
        margin-bottom: 14px;
    }

    .stat-card {
        padding: 11px;
    }

    .stat-value {
        font-size: calc(18px * var(--a11y-text-scale, 1));
    }

    .map-controls {
        flex-direction: row;
        align-items: flex-end;
    }

    .map-control-group {
        flex-direction: row;
    }

    .map-control-group .map-control-btn:first-child {
        border-bottom: 1px solid var(--grey-200);
        border-right: none;
    }

    /* Nesta largura os controles ocupam a faixa inteira de baixo, então a
       legenda sobe para cima deles em vez de disputar o mesmo espaço. */
    .map-legend {
        bottom: 70px;
        max-width: calc(100vw - 32px);
    }

    .legend-content {
        max-height: 160px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* ================================================================
   ACESSIBILIDADE — ajustes específicos do mapa
   ================================================================ */

/* O botão de acessibilidade fica no canto inferior direito, mas o
   mapa já usa esse canto para os controles de zoom/localização —
   sobe o widget para não sobrepor. */
.a11y-tools { bottom: 132px; }
@media (max-width: 540px) {
    .a11y-tools { bottom: 128px; }
}

/* No desktop, com o painel de detalhes aberto, ele é uma faixa fixa
   de 420px na borda direita, do topo até o rodapé da tela (ver
   .sd-panel mais abaixo) — sem isto, o botão de acessibilidade fica
   embaixo do rodapé de ações do cartão (rotas/links/favoritar)
   sempre que o conteúdo é longo o bastante pra empurrar o rodapé até
   a base da tela. Só desloca enquanto o painel está de fato aberto
   (classe somada pelo JS em openSpaceDetail/closeSpaceDetail, tanto
   no <body> quanto no <html> — mesmo motivo do padrão já usado em
   accessibility.js: o próprio .a11y-tools é candidato a ser
   realocado pra fora do <body> quando o filtro de daltonismo está
   ativo, então o seletor não pode depender só do <body> carregar a
   classe). Do contrário o botão fica deslocado à toa com o painel
   fechado. */
@media (min-width: 1025px) {
    .sd-panel-open .a11y-tools { right: calc(min(420px, 92vw) + 18px); }
}

.a11y-focus .map-legend { opacity: .5; }
.a11y-focus .sd-panel { border-color: var(--leaf-400, #4caf50); }

.a11y-high-contrast { background: #fff; }
/* Cartões escuros/coloridos com texto claro viram invisíveis se só o
   fundo ou só o texto for forçado. Zera os dois em cascata para todo
   mundo dentro dos contêineres principais — não uma lista fixa de
   seletores, que sempre fica incompleta. */
.a11y-high-contrast .map-sidebar,
.a11y-high-contrast .stat-card,
.a11y-high-contrast .space-card,
.a11y-high-contrast .map-legend,
.a11y-high-contrast .sd-panel,
.a11y-high-contrast .ic-card,
.a11y-high-contrast .rt-badge,
.a11y-high-contrast #passportModal {
    background: #fff !important;
    background-image: none !important;
    color: #111827 !important;
    border-color: #000 !important;
}
.a11y-high-contrast .map-sidebar *,
.a11y-high-contrast .stat-card *,
.a11y-high-contrast .space-card *,
.a11y-high-contrast .map-legend *,
.a11y-high-contrast .sd-panel *,
.a11y-high-contrast .ic-card *,
.a11y-high-contrast .rt-badge *,
.a11y-high-contrast #passportModal * {
    color: inherit !important;
    background: transparent !important;
    background-image: none !important;
    text-shadow: none !important;
}
.a11y-high-contrast .search-input,
.a11y-high-contrast .map-control-btn { border-color: #000 !important; }

/* A foto de capa continua visível em alto contraste — nenhuma foto real
   deve sumir só porque o modo está ligado. O véu escuro (.ic-hero__scrim)
   já garante contraste pro texto por cima; só reforçamos com borda na
   capa (pra não se perder no fundo branco dos outros cartões) e
   text-shadow no título/eyebrow (pra continuar legível em cima de
   qualquer foto, não só das mais escuras). Sem foto, cai no fundo
   sólido de sempre — não há o que preservar ali. */
.a11y-high-contrast .ic-hero { border: 1px solid #000; }
.a11y-high-contrast .ic-hero--noimg { background: #fff !important; }
.a11y-high-contrast .ic-hero--noimg::before { display: none !important; }
/* .ic-hero__scrim, .ic-title e .ic-eyebrow também caem na cascata
   ".ic-card *"/".sd-panel *" acima (mesma especificidade, então quem
   vale é a ordem no arquivo) — por isso essas 3 regras precisam vir
   depois dela, não antes, senão a cascata acima ganha e apaga o véu/
   texto de novo. */
.a11y-high-contrast .ic-hero__scrim {
    background: linear-gradient(180deg, rgba(8, 20, 13, 0) 30%, rgba(6, 16, 11, .92) 100%) !important;
}
.a11y-high-contrast .ic-title {
    color: #fff !important;
    text-shadow: 0 1px 4px rgba(0,0,0,.9), 0 0 14px rgba(0,0,0,.6) !important;
}
.a11y-high-contrast .ic-eyebrow {
    background: rgba(255, 255, 255, .95) !important;
    color: #000 !important;
    border: 1px solid #000 !important;
}

.a11y-large-cursor .marker-pin { cursor: inherit; }
