/* assets/css/tracks.css
   Layout mechanics only -- no colors/typography here on purpose,
   that's Oskar's design pass. Deliberately not width-capped like
   feed.css -- a map benefits from the extra space, unlike a text feed. */

html, body {
    height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    /* The map tiles are slightly transparent -- base.css's pink
       --color-bg was showing through them, so override to white here. */
    background: #fff;
}

/* Nav keeps its natural height; the map fills whatever's left below it,
   so it can grow to fill the rest of the screen instead of being capped
   to a fixed vh number. */
.site-header {
    flex-shrink: 0;
}

.tracks-map-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}

.tracks-map {
    width: 100%;
    height: 100%;
}

.activity-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    vertical-align: middle;
}

/* The filter controls, cloned by tracks-map.js into a real MapLibre
   control -- maplibregl-ctrl-group supplies the box/shadow/radius chrome,
   this just adds the padding/spacing that chrome doesn't assume for
   arbitrary (non-button) content. */
.tracks-controls {
    padding: 0.6rem 0.8rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-width: min(90vw, 20rem);
}

.tracks-filter-group label {
    margin-right: 0.75rem;
    white-space: nowrap;
}

.tracks-filter-label {
    margin-bottom: 0.15rem;
}

.tracks-activity-list {
    display: flex;
    flex-direction: column;
}

/* Collapsed-to-a-button state, mobile only -- like a Leaflet layers
   control: the filter groups hide behind a small icon button until
   tapped open, instead of permanently covering a chunk of the map. */
/* Specificity needs to beat maplibre-gl.css's own
   ".maplibregl-ctrl-group > button" rule, hence the extra qualifying
   selector rather than plain ".tracks-controls-toggle". */
.tracks-controls-toggle.tracks-controls-toggle {
    display: none;
}

@media (max-width: 40rem) {
    .tracks-controls {
        padding: 0;
    }

    .tracks-controls-toggle.tracks-controls-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        border: 0;
        background: none;
        cursor: pointer;
    }

    .tracks-controls-toggle svg {
        width: 1.25rem;
        height: 1.25rem;
    }

    .tracks-controls .tracks-filter-group {
        display: none;
    }

    .tracks-controls.is-open {
        padding: 0.6rem 0.8rem;
    }

    .tracks-controls.is-open .tracks-controls-toggle {
        margin-bottom: 0.4rem;
    }

    .tracks-controls.is-open .tracks-filter-group {
        display: flex;
    }
}

/* Overlaid on the map's own corner instead of stacked below it, so the
   attribution line doesn't push the page taller than the viewport. */
.tracks-map-wrap .map-attribution {
    position: absolute;
    bottom: 0.5rem;
    right: 0.5rem;
    margin: 0;
    padding: 0.1rem 0.4rem;
    background: rgba(255, 255, 255, 0.75);
    z-index: 1;
}

/* Same #photoLightbox markup/behaviour as trip.css (shared photo-lightbox.js
   drives both), but positioned over the whole map here -- this page has no
   split content pane like the trip page's .lightbox is scoped to. */
.lightbox {
    position: absolute;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.9);
}

.lightbox:not([hidden]) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
}

.lightbox-caption {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    color: white;
    margin: 0;
}

.lightbox-close,
.lightbox-nav {
    position: absolute;
    background: none;
    border: none;
    color: white;
    font-size: 2.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0.5rem;
}

.lightbox-close {
    top: 0.5rem;
    right: 0.5rem;
}

.lightbox-prev {
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}

.lightbox-next {
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
}
