
.tg-map { --tg-border: color-mix(in srgb, currentColor 18%, transparent); --tg-soft: color-mix(in srgb, currentColor 5%, transparent); --tg-soft-strong: color-mix(in srgb, currentColor 9%, transparent); --tg-accent: #3d7f52; display: grid; gap: 0.9rem; width: 100%; }
.tg-map__toolbar { display: grid; gap: 0.8rem; padding: 0.9rem; border: 1px solid var(--tg-border); border-radius: 0.7rem; background: var(--tg-soft); }
.tg-map__facilities { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tg-map__toggle { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.2rem; padding: 0.38rem 0.65rem; border: 1px solid var(--tg-border); border-radius: 999px; cursor: pointer; background: color-mix(in srgb, Canvas 88%, transparent); color: CanvasText; user-select: none; }
.tg-map__toggle:has(input:checked) { border-color: color-mix(in srgb, var(--tg-accent) 70%, currentColor); box-shadow: 0 0 0 1px color-mix(in srgb, var(--tg-accent) 35%, transparent) inset; }
.tg-map__toggle input { inline-size: 1rem; block-size: 1rem; margin: 0; }
.tg-map__route-symbol { inline-size: 1.4rem; block-size: 0.26rem; border-radius: 1rem; background: #e67e22; }
.tg-map__dot { inline-size: 0.72rem; block-size: 0.72rem; border-radius: 50%; background: #68737d; box-shadow: 0 0 0 2px color-mix(in srgb, currentColor 15%, transparent); }
.tg-map__dot--shelter { background: #33864b; }
.tg-map__dot--teltplads { background: #7a9b29; }
.tg-map__dot--toilet { background: #4169a1; }
.tg-map__dot--drikkevand { background: #168da4; }
.tg-map__length { display: grid; gap: 0.45rem; max-width: 42rem; }
.tg-map__length-head { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.tg-map__length-head span { opacity: 0.75; font-size: 0.9em; }
.tg-map__sliders { position: relative; min-height: 1.7rem; display: grid; align-items: center; }
.tg-map__sliders::before { content: ""; position: absolute; left: 0; right: 0; height: 0.35rem; border-radius: 1rem; background: var(--tg-soft-strong); }
.tg-map__sliders input[type="range"] { position: absolute; width: 100%; margin: 0; pointer-events: none; appearance: none; background: transparent; }
.tg-map__sliders input[type="range"]::-webkit-slider-thumb { appearance: none; width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--tg-accent); border: 2px solid Canvas; box-shadow: 0 0 0 1px var(--tg-border); pointer-events: auto; cursor: grab; }
.tg-map__sliders input[type="range"]::-moz-range-thumb { width: 1.15rem; height: 1.15rem; border-radius: 50%; background: var(--tg-accent); border: 2px solid Canvas; box-shadow: 0 0 0 1px var(--tg-border); pointer-events: auto; cursor: grab; }
.tg-map__sliders input[type="range"]::-moz-range-track { background: transparent; border: 0; }
.tg-map__length-inputs { display: flex; flex-wrap: wrap; gap: 0.8rem; }
.tg-map__length-inputs label { display: inline-flex; align-items: center; gap: 0.35rem; }
.tg-map__length-inputs input { width: 5.2rem; padding: 0.35rem 0.45rem; border: 1px solid var(--tg-border); border-radius: 0.35rem; background: Canvas; color: CanvasText; }
.tg-map__actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.tg-map__button { border: 1px solid var(--tg-border); border-radius: 0.45rem; padding: 0.45rem 0.7rem; background: Canvas; color: CanvasText; cursor: pointer; }
.tg-map__button:hover, .tg-map__button:focus-visible { background: var(--tg-soft-strong); }
.tg-map__canvas { width: 100%; min-height: 28rem; height: min(68vh, 46rem); border: 1px solid var(--tg-border); border-radius: 0.7rem; overflow: hidden; background: #dfe8dc; }
.tg-map__message { padding: 0.65rem 0.8rem; border: 1px solid #b4742c; border-radius: 0.5rem; background: color-mix(in srgb, #f0a83e 14%, Canvas); color: CanvasText; }
.tg-map .leaflet-container { font: inherit; }
/* Leaflet tile images must not inherit article/template image decoration. */
.tg-map .leaflet-tile,
.tg-map .leaflet-marker-icon,
.tg-map .leaflet-marker-shadow {
    max-width: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    filter: none !important;
}
.tg-map .leaflet-popup-content { min-width: 12rem; }
.tg-map .tg-popup__title { font-weight: 700; font-size: 1.04rem; margin-bottom: 0.25rem; }
.tg-map .tg-popup__meta { opacity: 0.78; }
.tg-map .tg-popup__types { margin-top: 0.25rem; }
@media (min-width: 900px) { .tg-map__toolbar { grid-template-columns: auto 1fr; align-items: start; } .tg-map__length, .tg-map__actions { grid-column: 1 / -1; } }
@media (max-width: 600px) { .tg-map__toolbar { padding: 0.7rem; } .tg-map__canvas { min-height: 24rem; height: 62vh; border-radius: 0.45rem; } .tg-map__toggle { font-size: 0.92rem; } .tg-map__length-head { align-items: flex-start; flex-direction: column; gap: 0.15rem; } }


/* Route map and native elevation profile */
.tg-map--route .tg-map__toolbar { grid-template-columns: 1fr; }
.tg-map--route .tg-map__facilities { align-items: center; }
.tg-elevation { color: inherit; border: 1px solid var(--tg-border); border-radius: 0.8rem; background: linear-gradient(180deg, var(--tg-soft), color-mix(in srgb, Canvas 96%, transparent)); overflow: hidden; }
.tg-elevation__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.95rem 1rem; border-bottom: 1px solid var(--tg-border); }
.tg-elevation__eyebrow { margin-bottom: 0.1rem; font-size: 0.76rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0.62; }
.tg-elevation__title { margin: 0; font-size: clamp(1.05rem, 2vw, 1.3rem); line-height: 1.2; }
.tg-elevation__body { display: grid; gap: 0.9rem; padding: 0.95rem 1rem 1rem; }
.tg-elevation.is-collapsed .tg-elevation__body { display: none; }
.tg-elevation.is-collapsed .tg-elevation__header { border-bottom: 0; }
.tg-elevation__stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.55rem; }
.tg-elevation__stat { min-width: 0; padding: 0.65rem 0.72rem; border: 1px solid var(--tg-border); border-radius: 0.62rem; background: color-mix(in srgb, Canvas 88%, transparent); }
.tg-elevation__stat span { display: block; margin-bottom: 0.15rem; font-size: 0.78rem; opacity: 0.66; }
.tg-elevation__stat strong { display: block; font-size: clamp(1rem, 2.4vw, 1.28rem); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tg-elevation__chart { position: relative; width: 100%; min-width: 0; border: 1px solid var(--tg-border); border-radius: 0.68rem; background: color-mix(in srgb, Canvas 90%, transparent); overflow: hidden; }
.tg-elevation__canvas { display: block; width: 100%; height: 260px; cursor: crosshair; touch-action: pan-y; }
.tg-elevation__tooltip { position: absolute; top: 0.7rem; z-index: 2; display: grid; gap: 0.05rem; min-width: 5.7rem; padding: 0.42rem 0.55rem; border: 1px solid var(--tg-border); border-radius: 0.48rem; background: color-mix(in srgb, Canvas 94%, transparent); color: CanvasText; box-shadow: 0 0.35rem 1rem rgba(0,0,0,.18); transform: translateX(-50%); pointer-events: none; font-variant-numeric: tabular-nums; }
.tg-elevation__tooltip.is-right { transform: translateX(-100%); }
.tg-elevation__tooltip strong { font-size: 0.86rem; }
.tg-elevation__tooltip span { font-size: 0.8rem; opacity: 0.7; }
.tg-elevation__missing { padding: 1rem; border: 1px dashed var(--tg-border); border-radius: 0.62rem; text-align: center; opacity: 0.78; }
.tg-elevation__hint { font-size: 0.82rem; opacity: 0.62; }
@media (max-width: 720px) {
    .tg-elevation__header { align-items: flex-start; }
    .tg-elevation__stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tg-elevation__canvas { height: 220px; }
    .tg-elevation__toggle { white-space: nowrap; }
}
@media (max-width: 420px) {
    .tg-elevation__header { flex-direction: column; align-items: stretch; }
    .tg-elevation__toggle { width: 100%; }
    .tg-elevation__body { padding-inline: 0.7rem; }
    .tg-elevation__canvas { height: 205px; }
}
.tg-map__preflight { margin-top: .5rem; padding: .55rem .7rem; border: 1px dashed var(--tg-border); border-radius: .45rem; font-size: .82rem; opacity: .8; overflow-wrap: anywhere; }

/* Optional multi-day route filter */
.tg-map__trip { display: grid; gap: 0.65rem; max-width: 42rem; padding: 0.75rem 0.8rem; border: 1px solid var(--tg-border); border-radius: 0.62rem; background: color-mix(in srgb, Canvas 86%, transparent); }
.tg-map__trip-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.tg-map__trip-head > div { display: grid; gap: 0.08rem; }
.tg-map__trip-head > div > span { font-size: 0.84rem; opacity: 0.68; }
.tg-map__trip-enable { display: inline-flex; align-items: center; gap: 0.45rem; cursor: pointer; white-space: nowrap; }
.tg-map__trip-enable input { inline-size: 1rem; block-size: 1rem; margin: 0; }
.tg-map__trip-controls { display: grid; gap: 0.8rem; transition: opacity .15s ease; }
.tg-map__trip-controls.is-disabled { opacity: 0.48; }
.tg-map__trip-group { display: grid; gap: 0.4rem; }
.tg-map__trip-label { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; }
.tg-map__trip-label span { font-size: 0.82rem; opacity: 0.66; }
.tg-map__trip-note { margin: 0; font-size: 0.8rem; line-height: 1.4; opacity: 0.64; }
.tg-popup__days { margin-top: 0.28rem; font-weight: 600; }
@media (min-width: 900px) { .tg-map__trip { grid-column: 1 / -1; } }
@media (max-width: 600px) {
    .tg-map__trip-head, .tg-map__trip-label { align-items: flex-start; flex-direction: column; gap: 0.2rem; }
    .tg-map__trip-enable { white-space: normal; }
}

/* 0.1.15 – use the available viewport instead of staying trapped in a narrow article column */
.tg-map {
    width: min(96vw, 1680px);
    max-width: none;
    margin-inline-start: 50%;
    margin-inline-end: 0;
    transform: translateX(-50%);
}

@media (min-width: 1100px) {
    .tg-map--overview,
    .tg-map--route {
        grid-template-columns: clamp(20rem, 24vw, 27rem) minmax(0, 1fr);
        grid-template-areas:
            "toolbar canvas"
            "message message";
        align-items: start;
        gap: 1rem;
    }

    .tg-map--route {
        grid-template-areas:
            "toolbar canvas"
            "message message"
            "elevation elevation";
    }

    .tg-map__toolbar {
        grid-area: toolbar;
        grid-template-columns: 1fr;
        align-content: start;
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        overflow: auto;
        scrollbar-gutter: stable;
    }

    .tg-map__toolbar > *,
    .tg-map__length,
    .tg-map__trip,
    .tg-map__actions {
        grid-column: auto;
        max-width: none;
        width: 100%;
    }

    .tg-map__facilities {
        align-items: flex-start;
    }

    .tg-map__canvas {
        grid-area: canvas;
        min-height: 38rem;
        height: min(76vh, 58rem);
    }

    .tg-map__message {
        grid-area: message;
    }

    .tg-elevation {
        grid-area: elevation;
    }
}

@media (min-width: 1500px) {
    .tg-map--overview,
    .tg-map--route {
        grid-template-columns: 27rem minmax(0, 1fr);
    }

    .tg-map__canvas {
        height: min(80vh, 62rem);
    }
}

@media (max-width: 1099px) {
    .tg-map {
        width: min(96vw, 72rem);
    }
}

/* Route difficulty */
.tg-map__toggle--route { flex-wrap: wrap; }
.tg-map__route-name { min-width: 0; }
.tg-difficulty {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    margin-inline-start: auto;
    color: CanvasText;
    font-size: .78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
.tg-popup__meta + .tg-difficulty,
.tg-popup__title ~ div .tg-difficulty { margin-top: .35rem; margin-inline-start: 0; }
.tg-difficulty__icon {
    display: inline-grid;
    place-items: center;
    width: 1.72rem;
    height: 1.95rem;
    flex: 0 0 auto;
}
.tg-difficulty__icon img {
    display: block;
    width: 1.72rem;
    height: 1.95rem;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    object-fit: contain;
}
@media (max-width: 520px) {
    .tg-map__toggle--route .tg-difficulty { width: 100%; margin-inline-start: 1.45rem; }
}


/* 0.1.23 – facility icons, labels, route distance control and map controls */
.tg-map__facility-toggle-icon {
    width: 1.35rem;
    height: 1.5rem;
    object-fit: contain;
    flex: 0 0 auto;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
}
.tg-map__display-options { display: flex; flex-wrap: wrap; gap: .45rem; }
.tg-map__label-symbol {
    display: inline-grid;
    place-items: center;
    min-width: 1.45rem;
    height: 1.2rem;
    padding-inline: .18rem;
    border-radius: .25rem;
    background: color-mix(in srgb, var(--tg-accent) 20%, Canvas);
    font-size: .68rem;
    font-weight: 800;
}
.tg-map__route-radius { display: grid; gap: .45rem; padding: .65rem .75rem; border: 1px solid var(--tg-border); border-radius: .58rem; background: color-mix(in srgb, Canvas 88%, transparent); }
.tg-map__route-radius-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; font-size: .9rem; }
.tg-map__route-radius-head > span { opacity: .72; white-space: nowrap; }
.tg-map__route-radius input[type="range"] { width: 100%; accent-color: var(--tg-accent); }
.tg-facility-divicon { background: transparent !important; border: 0 !important; }
.tg-facility-marker { width: 30px; height: 34px; transform-origin: 50% 100%; transition: transform .12s ease; filter: drop-shadow(0 2px 2px rgba(0,0,0,.28)); }
.tg-facility-marker img { display: block; width: 30px !important; height: 34px !important; max-width: none !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; box-shadow: none !important; object-fit: contain; }
.tg-facility-divicon:hover .tg-facility-marker { transform: scale(1.12); }
.tg-facility-marker--fallback { width: 18px; height: 18px; margin: 8px 6px; border: 2px solid white; border-radius: 50%; background: var(--tg-marker-color, #68737d); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
.tg-map .leaflet-tooltip.tg-place-label {
    margin: 0;
    padding: .26rem .48rem;
    border: 1px solid color-mix(in srgb, CanvasText 22%, transparent);
    border-radius: .34rem;
    background: color-mix(in srgb, Canvas 94%, transparent);
    color: CanvasText;
    box-shadow: 0 1px 5px rgba(0,0,0,.2);
    font: 600 .78rem/1.2 system-ui, sans-serif;
    white-space: nowrap;
}
.tg-map .leaflet-tooltip-right.tg-place-label::before { border-right-color: color-mix(in srgb, CanvasText 22%, transparent); }
.tg-map__leaflet-control button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; background: white; color: #222; cursor: pointer; }
.tg-map__leaflet-control button:hover, .tg-map__leaflet-control button:focus-visible { background: #f4f4f4; }
.tg-map__locate-control span { position: relative; display: block; width: 16px; height: 16px; border: 2px solid currentColor; border-radius: 50%; }
.tg-map__locate-control span::before, .tg-map__locate-control span::after { content: ""; position: absolute; background: currentColor; }
.tg-map__locate-control span::before { width: 2px; height: 22px; left: 5px; top: -5px; }
.tg-map__locate-control span::after { width: 22px; height: 2px; left: -5px; top: 5px; }
.tg-map .leaflet-control-layers { color: #222; }
.tg-map .leaflet-control-layers-expanded { min-width: 10rem; }
.tg-popup__difficulty { margin-top: .35rem !important; margin-inline-start: 0 !important; }
@media (max-width: 600px) {
    .tg-map__route-radius-head { align-items: flex-start; flex-direction: column; gap: .15rem; }
    .tg-map .leaflet-tooltip.tg-place-label { font-size: .72rem; }
}

/* Embedded/article and module maps follow their content container; only the standalone component may break wide. */
.dbtools-trailguide-embed .tg-map,
.dbtools-trailguide-module .tg-map {
    width: 100%;
    max-width: 100%;
    margin-inline: 0;
    transform: none;
}

/* 0.1.24 – native facility clustering (no external clustering library) */
.tg-map__cluster-symbol {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .12rem;
    width: 1.5rem;
    height: 1.2rem;
}
.tg-map__cluster-symbol span {
    display: block;
    width: .38rem;
    height: .38rem;
    border-radius: 50%;
    background: var(--tg-accent);
}
.tg-map__cluster-symbol span:nth-child(2) { transform: translateY(-.18rem); }
.tg-cluster-divicon { background: transparent !important; border: 0 !important; }
.tg-cluster-marker {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: color-mix(in srgb, var(--tg-accent) 86%, #111 14%);
    border: 3px solid color-mix(in srgb, Canvas 88%, transparent);
    box-shadow: 0 2px 8px rgba(0,0,0,.35);
    color: white;
    font-weight: 800;
    font-size: .92rem;
    line-height: 1;
    cursor: pointer;
}
.tg-cluster-marker:hover { transform: scale(1.08); }

/* 0.1.26 – redesigned elevation profile */
.tg-elevation__body {
    gap: 1rem;
}
.tg-elevation__stats {
    gap: .65rem;
}
.tg-elevation__stat {
    padding: .72rem .78rem;
    background: color-mix(in srgb, Canvas 92%, var(--tg-soft) 8%);
}
.tg-elevation__chart {
    border-radius: .78rem;
    background: color-mix(in srgb, Canvas 94%, var(--tg-soft) 6%);
    box-shadow: inset 0 1px 0 color-mix(in srgb, CanvasText 5%, transparent);
}
.tg-elevation__canvas {
    height: 290px;
}
.tg-elevation__tooltip {
    top: .7rem;
    display: grid;
    grid-template-columns: auto auto;
    align-items: baseline;
    gap: .1rem .65rem;
    min-width: 8.7rem;
    padding: .52rem .62rem;
    border-radius: .58rem;
    background: color-mix(in srgb, Canvas 96%, transparent);
    box-shadow: 0 .42rem 1.25rem rgba(0,0,0,.22);
    transform: translateX(0);
}
.tg-elevation__tooltip.is-right {
    transform: translateX(-100%);
}
.tg-elevation__tooltip span {
    font-size: .72rem;
    opacity: .62;
}
.tg-elevation__tooltip strong {
    justify-self: end;
    font-size: .84rem;
    font-variant-numeric: tabular-nums;
}
.tg-elevation__tooltip small {
    grid-column: 1 / -1;
    margin-top: .2rem;
    padding-top: .26rem;
    border-top: 1px solid color-mix(in srgb, CanvasText 12%, transparent);
    font-size: .69rem;
    font-weight: 650;
    opacity: .68;
}
.tg-elevation__hint {
    display: flex;
    align-items: center;
    gap: .42rem;
}
.tg-elevation__hint::before {
    content: "↔";
    display: inline-grid;
    place-items: center;
    width: 1.35rem;
    height: 1.35rem;
    border: 1px solid var(--tg-border);
    border-radius: 50%;
    font-weight: 800;
    opacity: .8;
}
@media (max-width: 720px) {
    .tg-elevation__canvas { height: 235px; }
}
@media (max-width: 420px) {
    .tg-elevation__canvas { height: 215px; }
    .tg-elevation__tooltip { min-width: 8rem; padding: .45rem .52rem; }
}

/* 0.1.27 – optional Joomla article links from route/place popups */
.tg-popup__link {
    display: inline-flex;
    align-items: center;
    margin-top: .55rem;
    padding: .4rem .65rem;
    border-radius: .45rem;
    background: rgba(38, 111, 73, .12);
    color: inherit;
    font-weight: 700;
    text-decoration: none;
}
.tg-popup__link:hover,
.tg-popup__link:focus-visible {
    background: rgba(38, 111, 73, .22);
    text-decoration: underline;
}

/* 0.1.36 – show every active facility type on a shared physical place. */
.tg-facility-marker--multi {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    width: auto;
    height: 30px;
    padding: 3px 5px;
    border: 1px solid rgba(0, 0, 0, .62);
    border-radius: 7px;
    background: rgba(255, 255, 255, .96);
    filter: drop-shadow(0 2px 2px rgba(0,0,0,.28));
    box-sizing: border-box;
}
.tg-facility-marker--multi::before,
.tg-facility-marker--multi::after {
    content: "";
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    pointer-events: none;
}
.tg-facility-marker--multi::before {
    bottom: -8px;
    border-left: 6px solid transparent;
    border-right: 6px solid transparent;
    border-top: 8px solid rgba(0, 0, 0, .62);
}
.tg-facility-marker--multi::after {
    bottom: -6px;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 7px solid rgba(255, 255, 255, .96);
}
.tg-facility-marker--multi img {
    display: block !important;
    width: 18px !important;
    height: 21px !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    object-fit: contain;
}
.tg-facility-marker__fallback-mini {
    display: block;
    width: 14px;
    height: 14px;
    border: 1px solid white;
    border-radius: 50%;
    background: var(--tg-marker-color, #68737d);
    box-shadow: 0 0 0 1px rgba(0,0,0,.35);
}
.tg-facility-marker__more {
    display: inline-grid;
    place-items: center;
    min-width: 18px;
    height: 18px;
    padding: 0 2px;
    border-radius: 999px;
    background: #222;
    color: #fff;
    font: 700 10px/1 system-ui, sans-serif;
}


/* 0.1.39: keep Leaflet inside TrailGuide's own stacking context.
   Site navigation remains the template's responsibility and can safely sit above it. */
.tg-map__canvas { position: relative; z-index: 0; isolation: isolate; }

/* 0.1.41 – route filters must stop before the elevation profile.
   Overview filters may remain sticky, but on a route map a sticky toolbar would
   continue through the full TrailGuide grid and visually cover the profile. */
@media (min-width: 1100px) {
    .tg-map--route .tg-map__toolbar {
        position: static;
        top: auto;
        max-height: none;
        overflow: visible;
        scrollbar-gutter: auto;
    }
}


/* 0.1.42 – live route progress and next overnight stop */
.tg-map .leaflet-tooltip.tg-route-progress-tooltip {
    margin-top: -0.5rem;
    padding: 0.55rem 0.65rem;
    border: 1px solid color-mix(in srgb, CanvasText 24%, transparent);
    border-radius: 0.58rem;
    background: color-mix(in srgb, Canvas 96%, transparent);
    color: CanvasText;
    box-shadow: 0 0.45rem 1.3rem rgba(0,0,0,.24);
    font: 500 0.82rem/1.3 system-ui, sans-serif;
    min-width: 13rem;
    max-width: min(22rem, 72vw);
    white-space: normal;
}
.tg-map .leaflet-tooltip.tg-route-progress-tooltip::before {
    border-top-color: color-mix(in srgb, Canvas 96%, transparent);
}
.tg-route-progress { display: grid; gap: .18rem; }
.tg-route-progress__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: .75rem;
    align-items: baseline;
}
.tg-route-progress__row span { opacity: .68; }
.tg-route-progress__row strong { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tg-route-progress__overnight {
    display: grid;
    gap: .04rem;
    margin-top: .28rem;
    padding-top: .38rem;
    border-top: 1px solid color-mix(in srgb, CanvasText 14%, transparent);
}
.tg-route-progress__overnight > span { font-size: .75rem; opacity: .66; }
.tg-route-progress__overnight > strong { font-size: .86rem; }
.tg-route-progress__overnight > small { opacity: .72; font-size: .76rem; }

/* 0.1.43 – filter controls are an overlay drawer instead of a permanent map column. */
.tg-map__stage {
    position: relative;
    min-width: 0;
    isolation: isolate;
    overflow: clip;
    border-radius: .7rem;
}

.tg-map__stage > .tg-map__canvas {
    width: 100%;
    margin: 0;
}

.tg-map__filter-shell {
    position: absolute;
    z-index: 1200;
    inset-block: 0;
    width: clamp(19rem, 30vw, 23rem);
    max-width: calc(100% - 3rem);
    transition: transform .22s ease;
    pointer-events: none;
}

.tg-map__filter-shell .tg-map__toolbar {
    position: static;
    top: auto;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: .72rem;
    width: 100%;
    height: 100%;
    max-height: none;
    padding: .85rem;
    overflow: auto;
    scrollbar-gutter: stable;
    border-radius: 0;
    border-block: 0;
    background: color-mix(in srgb, Canvas 94%, transparent);
    box-shadow: .45rem 0 1.35rem rgba(0,0,0,.22);
    backdrop-filter: blur(8px);
    pointer-events: auto;
}

.tg-map--panel-left .tg-map__filter-shell {
    left: 0;
    transform: translateX(-100%);
}
.tg-map--panel-right .tg-map__filter-shell {
    right: 0;
    transform: translateX(100%);
}
.tg-map--panel-right .tg-map__filter-shell .tg-map__toolbar {
    box-shadow: -.45rem 0 1.35rem rgba(0,0,0,.22);
}
.tg-map.is-filter-open .tg-map__filter-shell {
    transform: translateX(0);
}

.tg-map__filter-toggle {
    position: absolute;
    top: 50%;
    display: grid;
    place-items: center;
    width: 2.7rem;
    height: 4rem;
    padding: 0;
    border: 1px solid var(--tg-border);
    background: color-mix(in srgb, Canvas 96%, transparent);
    color: CanvasText;
    box-shadow: 0 .25rem .8rem rgba(0,0,0,.2);
    cursor: pointer;
    transform: translateY(-50%);
    pointer-events: auto;
}
.tg-map__filter-toggle:hover,
.tg-map__filter-toggle:focus-visible {
    background: color-mix(in srgb, Canvas 88%, var(--tg-accent) 12%);
}
.tg-map--panel-left .tg-map__filter-toggle {
    right: -2.7rem;
    border-left: 0;
    border-radius: 0 .55rem .55rem 0;
}
.tg-map--panel-right .tg-map__filter-toggle {
    left: -2.7rem;
    border-right: 0;
    border-radius: .55rem 0 0 .55rem;
}

.tg-map__filter-chevron {
    display: block;
    width: .66rem;
    height: .66rem;
    border-right: .13rem solid currentColor;
    border-bottom: .13rem solid currentColor;
    transition: transform .18s ease;
}
.tg-map--panel-left .tg-map__filter-chevron { transform: rotate(-45deg); }
.tg-map--panel-left.is-filter-open .tg-map__filter-chevron { transform: rotate(135deg); }
.tg-map--panel-right .tg-map__filter-chevron { transform: rotate(135deg); }
.tg-map--panel-right.is-filter-open .tg-map__filter-chevron { transform: rotate(-45deg); }

.tg-map__filter-shell .tg-map__toolbar > *,
.tg-map__filter-shell .tg-map__length,
.tg-map__filter-shell .tg-map__trip,
.tg-map__filter-shell .tg-map__actions {
    grid-column: auto;
    width: 100%;
    max-width: none;
}

.tg-map__direction {
    display: grid;
    gap: .42rem;
    min-width: 0;
    margin: 0;
    padding: .65rem .72rem;
    border: 1px solid var(--tg-border);
    border-radius: .58rem;
    background: color-mix(in srgb, Canvas 88%, transparent);
}
.tg-map__direction legend {
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    font-size: .9rem;
    font-weight: 700;
}
.tg-map__direction-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: .3rem;
}
.tg-map__direction-option {
    display: flex;
    align-items: center;
    gap: .45rem;
    min-width: 0;
    margin: 0;
    cursor: pointer;
    font-size: .86rem;
}
.tg-map__direction-option input {
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--tg-accent);
}

/* The stage now owns the full map width at every breakpoint. The old desktop
   two-column toolbar/map layout is intentionally overridden. */
@media (min-width: 1100px) {
    .tg-map--overview,
    .tg-map--route {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: none;
        align-items: start;
        gap: .9rem;
    }
    .tg-map__stage,
    .tg-map__message,
    .tg-elevation {
        grid-area: auto;
    }
    .tg-map--route .tg-map__toolbar,
    .tg-map--overview .tg-map__toolbar {
        position: static;
        top: auto;
        max-height: none;
        overflow: auto;
    }
}

@media (max-width: 600px) {
    .tg-map__stage { border-radius: .45rem; }
    .tg-map__filter-shell {
        width: min(21rem, calc(100% - 2.65rem));
        max-width: calc(100% - 2.65rem);
    }
    .tg-map__filter-toggle {
        width: 2.65rem;
        height: 3.6rem;
    }
    .tg-map--panel-left .tg-map__filter-toggle { right: -2.65rem; }
    .tg-map--panel-right .tg-map__filter-toggle { left: -2.65rem; }
    .tg-map__filter-shell .tg-map__toolbar { padding: .7rem; }
}

@media (prefers-reduced-motion: reduce) {
    .tg-map__filter-shell,
    .tg-map__filter-chevron { transition: none; }
}

/* 0.1.45 – elevation gain/loss filter */
.tg-map__elevation-filter { display:grid; gap:.65rem; max-width:42rem; padding:.75rem .8rem; border:1px solid var(--tg-border); border-radius:.62rem; background:color-mix(in srgb, Canvas 86%, transparent); }
.tg-map__filter-shell .tg-map__elevation-filter { grid-column:auto; width:100%; max-width:none; }
.tg-map__elevation-metric-label { display:grid; gap:.3rem; font-size:.86rem; font-weight:700; }
.tg-map__elevation-metric-label select { width:100%; padding:.42rem .5rem; border:1px solid var(--tg-border); border-radius:.4rem; background:Canvas; color:CanvasText; }

.tg-popup__badges{display:flex;flex-wrap:wrap;gap:.3rem;margin:.4rem 0}.tg-popup__badge{display:inline-block;border:1px solid currentColor;border-radius:999px;padding:.12rem .42rem;font-size:.76rem;font-weight:700;opacity:.9}.tg-popup__link{display:inline-block;margin:.35rem .6rem 0 0}

/* 0.1.51: TrailGuide owns Leaflet control contrast. Template-level dark-surface
   link colors must not make + / - disappear on Leaflet's white buttons. */
.tg-map .leaflet-control-zoom a,
.tg-map .leaflet-control-zoom a:hover,
.tg-map .leaflet-control-zoom a:focus {
    color: #111 !important;
    -webkit-text-fill-color: #111 !important;
    font-size: 21px !important;
    font-weight: 700 !important;
}

/* Route groups use the real route names. The primary/whole route is mutually
   exclusive with its sections; several sections may be shown together. */
.tg-map__route-groups { display:grid; gap:.55rem; }
.tg-map__route-group { margin:0; padding:.55rem .65rem .65rem; border:1px solid var(--tg-border); border-radius:.55rem; }
.tg-map__route-group legend { width:auto; margin:0 0 .35rem; padding:0 .2rem; font-size:.84rem; font-weight:700; color:inherit; }
.tg-map__route-group-options { display:grid; gap:.28rem; }
.tg-map__route-group-option { display:grid; grid-template-columns:auto 1rem minmax(0,1fr); align-items:center; gap:.4rem; cursor:pointer; font-size:.84rem; }
.tg-map__route-group-option input { margin:0; }
.tg-map__route-group-swatch { display:block; width:1rem; height:.22rem; border-radius:999px; background:var(--tg-route-group-color,#3388ff); }
.tg-map__route-group-option.is-primary { font-weight:700; }

.tg-popup__units { margin-top:.55rem; padding-top:.45rem; border-top:1px solid color-mix(in srgb,currentColor 20%,transparent); }
.tg-popup__unit { margin-top:.4rem; padding:.42rem .5rem; border:1px solid color-mix(in srgb,currentColor 18%,transparent); border-radius:.4rem; }
.tg-popup__unit-title { font-weight:700; }
