.page-shell {
    max-width: 1440px;
    margin-inline: auto;
    padding-inline: clamp(1rem, 3vw, 2.5rem);
}

.route-list-thumb-wrapper {
    width: 100%;
    height: 140px;
    /* Fluid block cover height style on mobile viewports */
}

@media (min-width: 768px) {
    .route-list-thumb-wrapper {
        width: 80px;
        /* Compact square thumbnail shape layout on standard desk views */
        height: 80px;
    }
}

.object-fit-cover {
    object-fit: cover;
}

.gallery-item,
.map-container-link {
    height: 150px;
    object-fit: cover;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease-in-out;
}

.gallery-item:hover,
.map-container-link:hover {
    opacity: 0.85;
}

.overlay-box {
    background-color: rgba(0, 0, 0, 0.6);
    color: #fff;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.25rem;
    height: 150px;
    text-decoration: none;
}


/* Force absolute black void canvas cover */
.viewer-backdrop {
    background-color: #000000 !important;
}

/* Style the native Close Button to be a circular translucent badge (Top Right) */
.viewer-button {
    position: fixed !important;
    top: 25px !important;
    right: 25px !important;
    z-index: 2050 !important;

    /* Perfect flex alignment variables */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    background-color: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    width: 50px !important;
    height: 50px !important;

    /* Center the internal cross vector vector icon */
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 18px !important;

    transition: background-color 0.2s ease, transform 0.15s ease !important;
}

/* Remove default library absolute padding offsets that push the icon out of center */
.viewer-button::before {
    display: block !important;
    position: relative !important;
    /* Changes from absolute to relative */
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    right: 0 !important;
    margin: 0 !important;

    /* Scale the cross icon size slightly to match our 50px badge size footprint */
    transform: scale(0.95) !important;
}

.viewer-button:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    transform: scale(1.05);
}

/* EXTRACT NEXT & PREV FROM FOOTER AND FLOATING ON SIDES */
.viewer-prev,
.viewer-next {
    position: fixed !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 2050 !important;

    /* Perfect flex alignment variables */
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;

    background-color: rgba(255, 255, 255, 0.12) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 50% !important;
    width: 55px !important;
    height: 55px !important;

    /* FIX: Force background icon image to center within the container instead of stretching */
    background-repeat: no-repeat !important;
    background-position: center center !important;
    background-size: 20px !important;

    transition: background-color 0.2s ease, transform 0.15s ease !important;
}

/* Adjust left/right spacing from device margins */
.viewer-prev {
    left: 25px !important;
}

.viewer-next {
    right: 25px !important;
}

/* Keep hover transformations synchronized while preserving vertical layout */
.viewer-prev:hover,
.viewer-next:hover {
    background-color: rgba(255, 255, 255, 0.25) !important;
    transform: translateY(-50%) scale(1.05) !important;
}

/* Clean up bottom navigation bar to only show zoom tools */
.viewer-footer {
    background-color: rgba(0, 0, 0, 0.8) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    padding: 15px 0 !important;
}

.viewer-title {
    color: #ffffff !important;
    font-size: 0.9rem !important;
    font-weight: 600;
    margin-bottom: 10px !important;
}

.tagify {
    --tags-border-color: #dee2e6;
    --tags-hover-border-color: #86b7fe;
    --tags-focus-border-color: #86b7fe;
    border-radius: 0.375rem;
    padding: 0.175rem 0.375rem;
}

.tagify__tag {
    --tag-bg: #e9ecef;
    --tag-text-color: #212529;
    --tag-border-radius: 4px;
}

.route-fullscreen-map {
    width: 100vw;
    height: 600px;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
    z-index: 1;
}

.route-map-canvas {
    height: 500px;
    overflow: hidden;
}

.map-layer-controls {
    left: 50%;
    width: 100vw;
    align-items: flex-end;
    padding-right: 1rem;
    box-sizing: border-box;
    transform: translateX(-50%);
    pointer-events: none;
    z-index: 1100;
}

.map-layer-controls > .dropdown {
    pointer-events: auto;
}

.map-navigation-toolbar {
    position: fixed;
    left: 50%;
    bottom: calc(1rem + env(safe-area-inset-bottom));
    z-index: 1080;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: calc(100vw - 2rem);
    flex-wrap: wrap;
    justify-content: center;
    transform: translateX(-50%);
}

.map-navigation-help {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 0.75rem;
    max-width: min(55vw, 24rem);
}

.map-navigation-help #map-navigation-status {
    min-width: 0;
}

.map-navigation-help-close {
    flex: 0 0 auto;
}

.map-navigation-sidebar {
    left: 50%;
    width: 100vw;
    box-sizing: border-box;
    padding-left: 1rem;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    z-index: 1000;
}

.map-navigation-sidebar > .map-navigation-details {
    width: min(22rem, calc(100vw - 2rem));
}

.map-navigation-sidebar > #map-navigation-toggle {
    width: auto;
}

.map-navigation-details {
    max-height: min(65vh, 34rem);
    overflow-y: auto;
}

.map-navigation-details.is-collapsed {
    max-height: none;
}

.map-navigation-details-header {
    border-bottom: 0;
}

.map-navigation-details-header .btn {
    flex: 0 0 auto;
}

.map-navigation-details-header #map-navigation-details-title {
    min-width: 0;
}

.map-navigation-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

.map-navigation-metrics dt {
    color: #6c757d;
    font-size: 0.75rem;
    font-weight: 400;
}

.map-navigation-metrics dd {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.map-navigation-elevation-profile {
    display: block;
    width: 100%;
    height: 6.25rem;
    overflow: visible;
}

.map-navigation-elevation-area {
    fill: rgba(13, 110, 253, 0.16);
    stroke: none;
}

.map-navigation-elevation-line {
    fill: none;
    stroke: #0d6efd;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

@media (max-width: 767.98px) {
    .route-map-page {
        width: 100vw;
        margin-inline: calc(50% - 50vw);
        padding: 0 !important;
    }

    .route-map-canvas {
        height: 60vh;
        height: 60dvh;
        min-height: 320px;
    }

    .map-navigation-toolbar {
        width: calc(100vw - 1rem);
        max-width: calc(100vw - 1rem);
        gap: 0.35rem;
    }

    .map-navigation-toolbar .map-navigation-help {
        flex: 1 0 100%;
        order: -1;
        max-width: none;
        justify-content: center;
    }

    .map-navigation-toolbar > button {
        padding-inline: 0.6rem;
    }

    .route-popup-overlay {
        display: block !important;
        position: fixed !important;
        top: auto !important;
        right: 0 !important;
        bottom: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        transform: none !important;
        pointer-events: none;
        z-index: 1050;
    }

    #map-route-popup {
        width: 100% !important;
        max-height: min(45dvh, 320px);
        overflow-y: auto;
        border-radius: 1rem 1rem 0 0;
        padding-bottom: env(safe-area-inset-bottom);
        pointer-events: auto;
    }
}

#wpImageCarousel .carousel-item img {
    width: 100%;
    height: 160px; /* Enforces a strict, unshifting vertical design format */
    object-fit: cover; /* Native center-cropping algorithm */
    cursor: pointer;
}

/* Slide control layouts styling */
#wpImageCarousel .carousel-control-prev, 
#wpImageCarousel .carousel-control-next {
    width: 30px;
    background: linear-gradient(to right, rgba(0,0,0,0.3), rgba(0,0,0,0));
}
#wpImageCarousel .carousel-control-next {
    background: linear-gradient(to left, rgba(0,0,0,0.3), rgba(0,0,0,0));
}

#tagFilterDropdown, #btnLayerChooser {
    max-width: 180px;      /* Prevents the button from expanding indefinitely across the screen */
    display: inline-flex;  /* Keeps the text and arrow aligned correctly */
    align-items: center;
    justify-content: space-between;
}

#tagFilterDropdown span, #difficultyLabel {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis; /* Safely clips exceptionally long words with a clean '...' */
}