
/* ============================================================
   Stadia / Leaflet: base stacking
   ============================================================ */

.map[data-map-provider="stadia"] .map__canvas {
    position: relative;
    overflow: hidden;
}

.map[data-map-provider="stadia"] .canvas {
    position: absolute;
    inset: 0;
    z-index: 1;
    isolation: isolate;
}

.map[data-map-provider="stadia"] .leaflet-container {
    width: 100%;
    height: 100%;
    z-index: 1;
}

.map[data-map-provider="stadia"] .leaflet-top,
.map[data-map-provider="stadia"] .leaflet-bottom {
    z-index: 900;
}

.map[data-map-provider="stadia"] .leaflet-control-layers {
    display: none !important;
}

.map[data-map-provider="stadia"] .leaflet-top.leaflet-right {
    z-index: 700;
}


/* ============================================================
   Stadia / Leaflet: custom attribution
   ============================================================ */

.map[data-map-provider="stadia"] .m24-stadia-attribution {
    position: absolute;
    right: 0;
    bottom: 0;
    z-index: 950;
    max-width: calc(100% - 1rem);
    padding: 2px 6px;
    background: rgba(255, 255, 255, .88);
    color: #333;
    font-size: 11px;
    line-height: 1.35;
    text-align: right;
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .m24-stadia-attribution a {
    color: #0677b8;
    text-decoration: none;
}

.map[data-map-provider="stadia"] .m24-stadia-attribution a:hover {
    text-decoration: underline;
}


/* ============================================================
   Stadia / Leaflet: fullscreen button
   ============================================================ */

.map[data-map-provider="stadia"] .map__nav {
    z-index: 1200;
}

.map[data-map-provider="stadia"] .map__nav .button,
.map[data-map-provider="stadia"] .map__nav [data-action] {
    pointer-events: all;
}

.map[data-map-provider="stadia"] .map__nav .nav-fullscreen {
    position: absolute;
    top: .5rem;
    right: .5rem;
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .map__nav .button--fullscreen {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: rgba(0, 0, 0, .55);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
}

.map[data-map-provider="stadia"] .map__nav .button--fullscreen:hover {
    background: rgba(0, 0, 0, .7);
}

.map[data-map-provider="stadia"] .map__nav .button--fullscreen .button__icon {
    background: transparent;
    color: inherit;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}


/* ============================================================
   Stadia / Leaflet: popup card
   ============================================================ */

.map[data-map-provider="stadia"] .map__sidebar {
    position: absolute;
    left: 50%;
    right: auto;
    bottom: 2.5rem;
    top: auto;
    transform: translateX(-50%);
    width: min(440px, calc(100% - 2rem));
    height: auto;
    max-height: calc(100% - 3.5rem);
    z-index: 1300;
    display: block;
    background: transparent;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.map[data-map-provider="stadia"] .map__sidebar[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .map__sidebar .module--map,
.map[data-map-provider="stadia"] .map__sidebar .module--map-popup {
    position: relative;
    background: #fff;
    color: #111;
    border-radius: .5rem;
    overflow: hidden;
    box-shadow: 0 10px 32px rgba(0, 0, 0, .22), 0 2px 8px rgba(0, 0, 0, .12);
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .map__sidebar .module--map .module__grid {
    position: relative;
    inset: auto;
    display: block;
    height: auto;
    max-height: min(280px, calc(100vh - 4rem));
    overflow-y: auto;
    background: #fff;
    color: #111;
}

.map[data-map-provider="stadia"] .map__sidebar .module__content {
    padding: 1.1rem 3rem 1.1rem 1.15rem;
    font-size: .95rem;
    line-height: 1.45;
}

.map[data-map-provider="stadia"] .map__sidebar .module__head h2 {
    margin: 0;
    font-size: 1rem;
    line-height: 1.25;
    font-weight: 700;
}

.map[data-map-provider="stadia"] .map__sidebar .module__body {
    margin-top: .55rem;
    color: #222;
}

.map[data-map-provider="stadia"] .map__sidebar address {
    margin: 0;
    font-style: normal;
}

.map[data-map-provider="stadia"] .map__sidebar .module__foot {
    margin-top: 1rem;
}

.map[data-map-provider="stadia"] .map__sidebar .module__body .button--directions {
    display: none;
}


/* ============================================================
   Stadia / Leaflet: popup buttons
   ============================================================ */

.map[data-map-provider="stadia"] .map__sidebar .module__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.25rem;
    padding: .55rem .9rem;
    border: 1px solid #111;
    border-radius: .125rem;
    background: #fff;
    color: #111;
    text-decoration: none;
    font-size: .875rem;
    line-height: 1.2;
}

.map[data-map-provider="stadia"] .map__sidebar .module__button:hover,
.map[data-map-provider="stadia"] .map__sidebar .module__button:focus {
    background: #f3f3f3;
}

.map[data-map-provider="stadia"] .map__sidebar .module__button .button__icon {
    display: none;
}

.map[data-map-provider="stadia"] .map__sidebar .module__nav {
    position: absolute;
    top: .7rem;
    right: .7rem;
    left: auto;
    bottom: auto;
    z-index: 20;
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse {
    position: static;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: #f5f5f5;
    color: #111;
    cursor: pointer;
    pointer-events: auto;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse:hover,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse:focus {
    background: #e8e8e8;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse .button__icon {
    position: relative;
    display: block;
    width: 2rem;
    height: 2rem;
    padding: 0;
    background: transparent;
    color: inherit;
    border-radius: 0;
    box-shadow: none;
    font-size: 0;
    line-height: 1;
    font-style: normal;
    pointer-events: none;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse .button__label {
    display: none;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-down:before,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-down:after,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-close:before,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-close:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: .75rem;
    height: 2px;
    background: currentColor;
    border-radius: 999px;
    transform-origin: center;
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-down:before,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-close:before {
    transform: translate(-50%, -50%) rotate(45deg);
}

.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-down:after,
.map[data-map-provider="stadia"] .map__sidebar .button--collapse .i-nav-close:after {
    transform: translate(-50%, -50%) rotate(-45deg);
}


/* ============================================================
   Stadia / Leaflet: mobile popup as bottom sheet
   ============================================================ */

@media screen and (max-width: 767px) {
    .map[data-map-provider="stadia"] .map__sidebar {
        left: 0;
        right: 0;
        bottom: 0;
        transform: none;
        width: 100%;
        max-height: 62%;
    }

    .map[data-map-provider="stadia"] .map__sidebar .module--map,
    .map[data-map-provider="stadia"] .map__sidebar .module--map-popup {
        border-radius: .75rem .75rem 0 0;
    }

    .map[data-map-provider="stadia"] .map__sidebar .module--map .module__grid {
        max-height: 62vh;
    }

    .map[data-map-provider="stadia"] .map__sidebar .module__content {
        padding: 1rem 3rem 1.25rem 1rem;
    }

    .map[data-map-provider="stadia"] .map__sidebar .module__button {
        width: 100%;
    }

    .map[data-map-provider="stadia"] .m24-stadia-attribution {
        max-width: 100%;
        font-size: 10px;
    }
}

/* ============================================================
   Stadia / Leaflet: popup fixes
   - keep "Les mer" button text legible on skinned cards (e.g. skin-dm,
     whose white link colour otherwise makes the button text invisible)
   - hide the media area when a marker has no image
   ============================================================ */

.map[data-map-provider="stadia"] .map__sidebar .module__button,
.map[data-map-provider="stadia"] .map__sidebar .module__button:link,
.map[data-map-provider="stadia"] .map__sidebar .module__button:visited,
.map[data-map-provider="stadia"] .map__sidebar .module__button:hover,
.map[data-map-provider="stadia"] .map__sidebar .module__button:focus {
    color: #111 !important;
}

.map[data-map-provider="stadia"] .map__sidebar .module--no-media .module__media {
    display: none;
}


/* ============================================================
   Stadia / Leaflet: "Vis vei" (directions) button in dynamic popup
   The eKultur token template puts .button--directions inside the head,
   where the base rule (.module--map .button--directions{position:absolute;
   top:0;right:.5em}) pinned it to the top corner, overlapping the close
   button. Render it as an inline link instead.
   ============================================================ */

.map[data-map-provider="stadia"] .map__sidebar .module__head .button--directions {
    position: static;
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-top: .5rem;
    padding: 0;
    background: none;
    box-shadow: none;
    color: #0677b8 !important;
    text-decoration: none;
    text-align: left;
}

.map[data-map-provider="stadia"] .map__sidebar .module__head .button--directions:hover,
.map[data-map-provider="stadia"] .map__sidebar .module__head .button--directions:focus {
    text-decoration: underline;
}

.map[data-map-provider="stadia"] .map__sidebar .module__head .button--directions .button__icon {
    background: none;
    color: inherit;
    border-radius: 0;
    padding: 0;
    width: auto;
    height: auto;
    box-shadow: none;
    font-size: 1em;
}

.map[data-map-provider="stadia"] .map__sidebar .module__head .button--directions .button__label {
    display: inline;
    font-weight: normal;
}


/* ============================================================
   Stadia / Leaflet: constrain DM/KP (eKultur) map size
   .ekultur .map{max-width:none} (top of this file) lets the Leaflet map
   fill the full page width, which made these maps much larger than the
   Google originals. Cap them to the content-column width and centre them.
   Adjust max-width to taste.
   ============================================================ */

.ekultur .map[data-map-provider="stadia"] {
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}