@font-face {
    font-family: "lato";
    src: url("https://ttomasz.github.io/ttursm/fonts/Lato-Regular.woff2") format('woff2');
    font-display: swap;
}

@font-face {
    font-family: "lato";
    src: url("https://ttomasz.github.io/ttursm/fonts/Lato-Bold.woff2") format('woff2');
    font-weight: bold;
    font-display: swap;
}

@font-face {
    font-family: "lato";
    src: url("https://ttomasz.github.io/ttursm/fonts/Lato-BoldItalic.woff2") format('woff2');
    font-weight: bold;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: "lato";
    src: url("https://ttomasz.github.io/ttursm/fonts/Lato-Italic.woff2") format('woff2');
    font-style: italic;
    font-display: swap;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; padding: 0; font-family: lato; }
#map { position: absolute; top: 0; bottom: 0; width: 100%; }

.legend {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(255, 255, 255, 0.95);
    padding: 8px 10px;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.25);
    font-size: 0.875rem;
    color: #111;
    line-height: 1.4;
    min-width: 120px;
    max-width: 260px;
    /* keep legend from growing taller than viewport, allow scrolling */
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    overscroll-behavior: contain;
}
.legend-title { font-weight: bold; font-size: 1rem; }
.legend h4 { margin: 0 0 6px 0; font-size: 1rem; }
.legend ul { list-style: none; margin: 0; padding: 0; }
.legend ul ul { padding-left: 20px; margin-top: 2px; }
.legend ul ul li { display: list-item; }
.legend li { margin: 4px 0; }

/* foldable nested lists using details/summary */
.legend details { margin: 4px 0; }
.legend summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
    user-select: none;
}
.legend summary::-webkit-details-marker { display: none; }

/* add custom arrow indicator */
.legend summary::after {
    content: "➕";
    display: inline-block;
    margin-left: 0.7em;
}
.legend details[open] > summary::after {
    content: "➖";
}

/* legend-level toggle: move the fold icon to the right */
.legend > details > summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}
.legend > details > summary::after {
    margin-left: auto;
}
.legend span.swatch,
.legend span.swatch-poi {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    border-radius: 3px;
    vertical-align: middle;
}
.legend img.icon-poi {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 8px;
    vertical-align: middle;
}
.legend img.icons-poi {
    display: inline-block;
    width: 16px;
    height: 16px;
    margin-right: 2px;
    vertical-align: middle;
}
.legend div.icons-poi {
    display: inline-block;
    margin-right: 6px;
    vertical-align: middle;
}
.legend input[type="checkbox"],
.legend input[type="radio"] {
    vertical-align: middle;
    width: 1.2em;
    height: 1.2em;
    margin: 0.3em 0.3em 0.3em 0;
    cursor: pointer;
}

.popup-logo {
    max-width: 60px;
    max-height: 40px;
    float: right;
    margin: 4px 0 4px 8px; /* push away from text */
}

/* popup close button override – increase clickable area and icon size */
.maplibregl-popup-close-button {
    width: 40px;
    height: 40px;
    font-size: 40px;
    line-height: 40px;
    margin-top: 4px;
    margin-right: 2px;
}

/* object type badge inside popups */
.popup-label {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: bold;
    /* text-transform: capitalize; */
    /* default text colour; will be overridden if needed for contrast */
    color: #fff;
    margin-right: 40px;
    margin-bottom: 4px;
}

.popup-place-name {
    margin-top: 2px;
    margin-bottom: 2px;
}

.kategoria-medyczne { background: #aa0a0a; }
.kategoria-gastronomia { background: #964c06; }
.kategoria-sklep { background: #0d4d07; }
.kategoria-usluga { background: #790888; }
.kategoria-pusty { background: #242424; }
.kategoria-zlikwidowany { background: #242424; }

/* mobile: legend takes full width, reduced padding */
@media (max-width: 480px) {
    .legend {
        left: 8px;
        right: 56px;
        top: 8px;
        max-width: none;
        font-size: 0.8125rem;
        padding: 6px 8px;
        max-height: calc(100vh - 16px);
    }
}
