.ld-block-home-locations {
    width: 100%;
    padding: 40px 8px;
    background: var(--cvi-color-light-blue);
    color: var(--cvi-color-primary, #002868);
    font-family: var(--cvi-font-body, "Geometria CVI", Arial, sans-serif);
}

.ld-block-home-locations *,
.ld-block-home-locations *::before,
.ld-block-home-locations *::after { box-sizing: border-box; }

.ld-block-home-locations [hidden] { display: none !important; }

.ld-block-home-locations__inner {
    width: 100%;
    max-width: var(--cvi-content-max-width);
    margin-inline: auto;
    padding-inline: 12px;
}

.ld-block-home-locations__header {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 40px;
    margin-bottom: 16px;
}

.ld-block-home-locations__heading {
    margin: 0;
    color: inherit;
    font-family: var(--cvi-font-heading, "Geometria CVI", Arial, sans-serif);
    font-size: 32px;
    font-weight: 400;
    line-height: 1.2;
}

.ld-block-home-locations__filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    width: fit-content;
    max-width: 100%;
    padding: 4px;
    border-radius: 50px;
    background: #001CA80F;
}

.ld-block-home-locations__filter {
    min-height: 36px;
    padding: 8px 16px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--cvi-color-primary, #002868);
    font: inherit;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    cursor: pointer;
    transition: background-color 180ms ease, color 180ms ease;
}

.ld-block-home-locations__filter:hover:not(.is-active),
.ld-block-home-locations__filter:focus-visible:not(.is-active) { background: #E7E7E7; }
.ld-block-home-locations__filter.is-active { background: var(--cvi-color-primary, #002868); color: #fff; }

.ld-block-home-locations__all {
    color: var(--cvi-color-action, #0035a3);
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    text-underline-offset: .2em;
    letter-spacing: -2%;
}
.ld-block-home-locations__all--desktop { white-space: nowrap; }
.ld-block-home-locations__all:hover,
.ld-block-home-locations__all:focus-visible { color: var(--cvi-color-action, #0035a3); text-decoration: underline; }
.ld-block-home-locations__all--mobile,
.ld-block-home-locations__mobile-filter { display: none; }

.ld-block-home-locations__layout {
    display: grid;
    grid-template-columns: minmax(260px, 35%) minmax(0, 1fr);
    gap: 16px;
    align-items: stretch;
}

.ld-block-home-locations__list {
    min-height: 350px;
    max-height: 440px;
    padding: 24px;
    border-radius: 12px;
    background: #001CA80F;
    overflow-y: auto;
    scrollbar-gutter: stable;
    scrollbar-width: thin;
    scrollbar-color: #769db2 transparent;
}
@supports selector(::-webkit-scrollbar) {
    .ld-block-home-locations__list { scrollbar-width: auto; scrollbar-color: auto; }
    .ld-block-home-locations__list::-webkit-scrollbar { width: 8px; }
    .ld-block-home-locations__list::-webkit-scrollbar-track {
        margin-block: 16px;
        border-radius: 999px;
        background: transparent;
    }
    .ld-block-home-locations__list::-webkit-scrollbar-thumb {
        min-height: 36px;
        border: 2px solid transparent;
        border-radius: 999px;
        background: #769db2;
        background-clip: padding-box;
    }
    .ld-block-home-locations__list::-webkit-scrollbar-thumb:hover { background-color: #4b7f9e; }
    .ld-block-home-locations__list::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
}

.ld-block-home-locations__city + .ld-block-home-locations__city { margin-top: 20px; }
.ld-block-home-locations__empty { margin: 0; font-size: 16px; }
.ld-block-home-locations__city h3 {
    margin: 0 0 12px;
    color: inherit;
    font-size: 24px;
    font-weight: 400;
    letter-spacing: -2%;
}
.ld-block-home-locations .ld-block-home-locations__city h3 {
    font-family: var(--cvi-font-heading, "Geometria CVI", Arial, sans-serif);
}

.ld-block-home-locations__city ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }
.ld-block-home-locations__city li { min-width: 0; }
.ld-block-home-locations__city a {
    display: inline-flex;
    align-items: baseline;
    gap: 4px;
    color: var(--cvi-color-action, #0035a3);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    text-decoration: none;
    text-underline-offset: .2em;
    letter-spacing: -2%;
}
.ld-block-home-locations__city a:hover span:last-child,
.ld-block-home-locations__city a:focus-visible span:last-child { text-decoration: underline; }

.ld-block-home-locations__pin-icon {
    flex: none;
    width: 16px;
    height: 16px;
    background: url('assets/map-pin.svg') center / contain no-repeat;
}

.ld-block-home-locations__map {
    z-index: 0;
    min-width: 0;
    min-height: 350px;
    height: 440px;
    border-radius: 12px;
    background: #e8f0ed;
    overflow: hidden;
}
.ld-block-home-locations__map .leaflet-control-attribution { font-size: 10px; }

.ld-block-home-locations__marker { background: none; border: 0; }
.ld-block-home-locations__marker::before {
    position: absolute;
    top: 9px;
    left: 3px;
    width: 26px;
    height: 26px;
    border-radius: 50% 50% 50% 0;
    background: #002868;
    box-shadow: 0 2px 8px rgb(0 40 104 / 24%);
    content: '';
    transform: rotate(-45deg);
}
.ld-block-home-locations__marker-mark {
    position: absolute;
    top: 15px;
    left: 9.5px;
    z-index: 1;
    width: 16px;
    height: 12px;
    background: url('assets/pin-mark.png') center / contain no-repeat;
}

.ld-block-home-locations__map .leaflet-popup-content-wrapper {
    border-radius: 13px;
    box-shadow: 0 8px 28px rgb(0 40 104 / 16%);
}
.ld-block-home-locations__map .leaflet-popup-content {
    width: min(330px, calc(100vw - 72px));
    max-width: calc(100vw - 72px);
    min-width: 0;
    margin: 17px 16px;
    color: var(--cvi-color-primary, #002868);
    font-family: var(--cvi-font-body, "Geometria CVI", Arial, sans-serif);
    font-size: 14px;
    line-height: 1.4;
}
.ld-block-home-locations__popup-title { display: block; margin-bottom: 10px; font-size: 17px; line-height: 1.25; }
.ld-block-home-locations__popup-line { margin: 4px 0 !important; white-space: pre-line; }
.ld-block-home-locations__popup-line span { font-weight: 500; }
.ld-block-home-locations__popup-services {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    margin-top: 7px;
}
.ld-block-home-locations__popup-service {
    max-width: 100%;
    padding: 2px 8px;
    border-radius: 999px;
    background: #edf1fa;
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}
.ld-block-home-locations__popup-more {
    padding: 2px 4px;
    border: 0;
    background: transparent;
    color: var(--cvi-color-action, #0035a3);
    font: inherit;
    font-size: 12px;
    line-height: 1.35;
    cursor: pointer;
}
.ld-block-home-locations__popup-more:hover,
.ld-block-home-locations__popup-more:focus-visible { text-decoration: underline; }
.ld-block-home-locations__popup-line a,
.ld-block-home-locations__popup-link { color: var(--cvi-color-action, #0035a3); }
.ld-block-home-locations__popup-link { display: inline-block; margin-top: 10px; font-weight: 500; text-decoration: none; }
.ld-block-home-locations__popup-link:hover { text-decoration: underline; }

@media (max-width: 1050px) {
    .ld-block-home-locations__header { display: flex; flex-wrap: wrap; }
    .ld-block-home-locations__all--desktop { margin-left: auto; }
}

@media (max-width: 767.98px) {
    .ld-block-home-locations { padding: 32px 16px; }
    .ld-block-home-locations__inner { padding-inline: 0; }
    .ld-block-home-locations__header { display: block; margin-bottom: 16px; }
    .ld-block-home-locations__heading { font-size: 28px; }
    .ld-block-home-locations__filters,
    .ld-block-home-locations__all--desktop { display: none; }

    .ld-block-home-locations__mobile-filter { position: relative; z-index: 1000; display: block; margin-bottom: 8px; }
    .ld-block-home-locations__select {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 16px;
        width: 100%;
        padding: 10px 24px;
        border: 1px solid #CACACA;
        border-radius: 999px;
        background: #FFFFFF80;
        color: var(--cvi-color-primary, #002868);
        box-shadow: 0 2px 7px rgb(0 40 104 / 5%);
        font: inherit;
        font-size: 16px;
        font-weight: 500;
        text-align: left;
        cursor: pointer;
        letter-spacing: -2%;
    }
    .ld-block-home-locations__chevron { width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); }
    .ld-block-home-locations__select[aria-expanded="true"] .ld-block-home-locations__chevron { transform: translateY(3px) rotate(225deg); }
    .ld-block-home-locations__options {
        position: absolute;
        top: calc(100% + 7px);
        right: 0;
        left: 0;
        display: grid;
        gap: 0;
        max-height: min(60vh, 420px);
        padding: 16px 24px;
        border-radius: 16px;
        background: #fff;
        box-shadow: 0 8px 22px rgb(0 40 104 / 10%);
        overflow-y: auto;
    }
    .ld-block-home-locations__option {
        width: 100%;
        margin-bottom: 8px;
        border: 0;
        background: transparent;
        color: var(--cvi-color-primary, #002868);
        font: inherit;
        font-size: 16px;
        text-align: left;
        cursor: pointer;
        min-height: 32px;
    }
    .ld-block-home-locations__option:hover,
    .ld-block-home-locations__option:focus-visible { background: #edf7fb; }
    .ld-block-home-locations__option[aria-current="true"] { font-weight: 700; }

    .ld-block-home-locations__layout { display: flex; flex-direction: column; gap: 0; }
    .ld-block-home-locations__map { order: 0; height: 295px; min-height: 295px; border-radius: 12px 12px 0 0; }
    .ld-block-home-locations__map .leaflet-popup-pane { z-index: 1001; }
    .ld-block-home-locations__map:has(.leaflet-popup) .leaflet-control-zoom {
    visibility: hidden;}
    .ld-block-home-locations__list { order: 1; min-height: 0; max-height: none; padding: 16px; border-radius: 0 0 12px 12px; background: #fff; overflow: visible; }
    .ld-block-home-locations__city h3 { font-size: 20px; }
    .ld-block-home-locations__city ul { gap: 12px; }
    .ld-block-home-locations__city a { font-size: 16px; }
    .ld-block-home-locations__all--mobile {
        display: flex;
        align-items: center;
        justify-content: center;
        margin-top: 32px;
        padding: 10px 24px;
        border: 1px solid var(--cvi-color-action, #0035a3);
        border-radius: 999px;
        text-align: center;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ld-block-home-locations__filter { transition: none; }
}


.ld-block-home-locations .ld-block-home-locations__city h3 {
    font-family: var(--cvi-font-heading, "Geometria CVI", Arial, sans-serif);
}

/* Tartu has its own map so the Harjumaa overview can be framed closely. */
.ld-block-home-locations__map-frame {
    position: relative;
    isolation: isolate;
    min-width: 0;
    height: 440px;
}
.ld-block-home-locations__map-frame > .ld-block-home-locations__map {
    width: 100%;
    height: 100%;
}
.ld-block-home-locations__tartu-inset {
    position: absolute;
    z-index: 500;
    right: 14px;
    bottom: 14px;
    width: min(300px, max(230px, 42%));
    height: 230px;
    padding: 6px;
    border: 2px solid #bfd9e7;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgb(0 40 104 / 18%);
}
.ld-block-home-locations__tartu-label {
    position: absolute;
    z-index: 500;
    top: 12px;
    left: 12px;
    padding: 4px 9px;
    border-radius: 6px;
    background: #fff;
    color: var(--cvi-color-primary, #002868);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
}
.ld-block-home-locations__map--tartu {
    width: 100%;
    height: 100%;
    min-height: 0;
    border-radius: 8px;
}
.ld-block-home-locations__tartu-inset.is-popup-open .ld-block-home-locations__tartu-label {
    visibility: hidden;
}
.ld-block-home-locations__map--tartu .leaflet-control-attribution {
    max-width: 100%;
    margin: 0;
    padding: 2px 5px;
    border-radius: 4px 0 0 0;
    background: #fff;
    color: #3c4c60;
    font: 10px/1.4 Arial, sans-serif;
    white-space: normal;
}
.ld-block-home-locations__map--tartu .leaflet-control-attribution a {
    color: var(--cvi-color-primary, #002868);
    text-decoration: underline;
}

@media (max-width: 767.98px) {
    .ld-block-home-locations__map-frame {
        order: 0;
        display: flex;
        flex-direction: column;
        height: auto;
    }
    .ld-block-home-locations__map-frame > .ld-block-home-locations__map {
        flex: none;
        height: 295px;
        min-height: 295px;
    }
    .ld-block-home-locations__tartu-inset {
        position: relative;
        right: auto;
        bottom: auto;
        width: 100%;
        height: 200px;
        padding: 6px;
        border-radius: 0;
        box-shadow: none;
    }
    .ld-block-home-locations__map--tartu {
        height: 100%;
        min-height: 0;
        border-radius: 0;
    }
}
