/*
 * tourism/route_map widget. Plain CSS so it works the same in every theme (bebras, its
 * subthemes, moletai). Colours are CSS variables with the "Ežerų Lietuva" defaults as
 * fallbacks - a theme or the admin CSS vars override them on :root (bebras sets them from
 * the $route-single-* SCSS vars, see scss/lib/_leaflet.scss):
 *   --route-single-line-color      track line
 *   --route-single-line-halo       halo under the track
 *   --route-single-marker-color    object marker border / tail
 *   --route-map-object-selected    selected object marker
 *   --route-map-selected-halo      soft ring around the selected marker
 *   --route-map-title-color        widget title (the widget's "title colour" setting sets it inline)
 *   --route-map-title-weight       widget title font-weight (default 700)
 *   --route-map-primary            active filter, buttons
 *   --route-map-icon               summary icons
 *   --route-map-secondary          card links
 *   --route-map-radius             filter chips and buttons
 */

.route-map-widget {
    --route-map-chip-radius: var(--route-map-radius, 8px);
    position: relative;
}

.route-map-widget.route-map-theme-moletai {
    --route-map-chip-radius: var(--route-map-radius, 3px);
    padding: 30px 0 40px;
}

/* bebras "fixed width" with a background colour: the content stays in the .box column, the
   colour runs the full page width (a spread shadow, clipped to the widget's own height - no
   layout change and no horizontal scroll) */
.route-map-widget.box.has-bg:not(.route-map-theme-moletai) {
    padding-top: 40px;
    box-shadow: 0 0 0 100vmax var(--route-map-bg);
    clip-path: inset(0 -100vmax);
}

/* "fixed width": moletai has no .box rule (bebras), its fixed widgets use the 1200px .framed-cont column */
.route-map-widget.route-map-theme-moletai.box {
    box-sizing: border-box;
    width: 1200px;
    max-width: 100%;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
}

/* icons only - Leaflet draws the tracks into an <svg> of its own */
.route-map-widget .route-map-header svg,
.route-map-widget .route-map-card svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
    flex-shrink: 0;
}

/* ---------- header ---------- */

/* title on its own row: the summary width changes with the mode and must not move the map */
.route-map-widget .route-map-header {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 0 0 24px;
}

/* the title sits in a .framed-cont only to get the theme's widget title size; drop the box
   that class paints in some themes (moletai: 1200px wide, white) */
.route-map-widget .route-map-title-wrap.framed-cont {
    width: auto;
    max-width: none;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
}

/* font size and family come from the theme */
.route-map-widget .route-map-title,
.route-map-widget h2.this-title.route-map-title {
    margin: 0;
    padding: 0;
    color: var(--route-map-title-color, #04728D);
    font-weight: var(--route-map-title-weight, 700);
}

.route-map-widget .route-map-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
}

.route-map-widget .route-map-modes {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
}

.route-map-widget .route-map-mode {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 8px 16px;
    border: 1px solid var(--route-map-primary, #04728D);
    border-radius: var(--route-map-chip-radius);
    background: #fff;
    color: var(--route-map-primary, #04728D);
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    cursor: pointer;
    transition: background-color .2s, color .2s;
}

.route-map-widget .route-map-mode:hover {
    background: rgba(4, 114, 141, .08);
}

.route-map-widget .route-map-mode:focus {
    outline: none;
}

.route-map-widget .route-map-mode:focus-visible {
    outline: 2px solid var(--route-map-primary, #04728D);
    outline-offset: 2px;
}

.route-map-widget .route-map-mode.active {
    background: var(--route-map-primary, #04728D);
    color: #fff;
}

.route-map-widget .route-map-summary-mode {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
}

.route-map-widget .route-map-summary-mode[hidden] {
    display: none;
}

/* distance / time / objects sit on white chips, like the filter buttons */
.route-map-widget .route-map-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1px solid #fff;
    border-radius: var(--route-map-chip-radius);
    background: #fff;
    color: #1F1C1C;
    white-space: nowrap;
}

.route-map-widget .route-map-stat svg {
    color: var(--route-map-icon, #35A9BC);
}

/* filled button, same height as the filter buttons */
.route-map-widget a.route-map-gpx,
.route-map-widget a.route-map-view {
    display: inline-block;
    padding: 8px 16px;
    border: 1px solid var(--route-map-primary, #04728D);
    border-radius: var(--route-map-chip-radius);
    background: var(--route-map-primary, #04728D);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-decoration: none;
    white-space: nowrap;
}

.route-map-widget a.route-map-gpx:hover,
.route-map-widget a.route-map-gpx:focus,
.route-map-widget a.route-map-view:hover,
.route-map-widget a.route-map-view:focus {
    background: var(--route-map-secondary, #078989);
    border-color: var(--route-map-secondary, #078989);
    color: #fff;
}

/* ---------- map ---------- */

.route-map-widget .route-map-holder {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
}

.route-map-widget .route-map-canvas {
    width: 100%;
    height: 680px;
    z-index: 0;
}

/* leafletMap.js / leaflet-custom-style.css stretch this for the full-page maps */
.route-map-widget .leaflet-control-container {
    height: auto;
}

/* colours only: widths come from leafletMap.js, and the invisible wide click target
   (touch helper) shares the line's class, so a stroke-width here would shrink it */
.route-map-widget path.route-map-line {
    stroke: var(--route-single-line-color, #168FA3);
}

.route-map-widget path.route-map-halo {
    stroke: var(--route-single-line-halo, #DAF7F7);
}

/* object photo bubbles - same shape as the all-routes map (bebras lib/_leaflet.scss) */
.route-map-widget .map-object-photo-wrap {
    top: -45px;
    left: -18px;
    background: none;
    border: none !important;
    margin: 0 !important;
    box-shadow: none;
    width: auto !important;
    height: auto !important;
}

.route-map-widget .map-object-photo {
    position: relative;
    box-sizing: border-box;
    width: 34px !important;
    height: 34px !important;
    overflow: hidden !important;
    border: 2px solid var(--route-single-marker-color, #35A9BC) !important;
    border-radius: 50% !important;
    background: #fff;
}

.route-map-widget .map-object-photo img {
    display: block;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
}

.route-map-widget .map-object-photo.selected {
    border: 4px solid var(--route-map-object-selected, #04728D) !important;
    box-shadow: 0 0 0 5px var(--route-map-selected-halo, #B3DEEA);
    overflow: visible !important;
}

.route-map-widget .map-object-photo.selected img {
    border-radius: 50%;
}

.route-map-widget .triangle-down {
    position: absolute;
    bottom: -8px;
    left: 9px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid var(--route-single-marker-color, #35A9BC);
}

.route-map-widget .triangle-down.selected {
    border-top-color: var(--route-map-object-selected, #04728D);
}

/* ---------- object card ---------- */

/* .all-routes-cards keeps the all-routes map look in bebras; everything it needs is set here */
.route-map-widget .route-map-card.all-routes-cards {
    position: absolute;
    left: 50% !important;
    bottom: 35px;
    z-index: 1000;
    box-sizing: border-box;
    width: 560px;
    max-width: calc(100% - 32px);
    height: 250px;
    overflow: hidden;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 6px 24px rgba(0, 0, 0, .18);
    color: #1F1C1C !important;
    font-family: inherit;
    opacity: 0;
    visibility: hidden;
    transform: translateX(-50%);
    transition: opacity .25s, visibility 0s .25s;
}

.route-map-widget .route-map-card.all-routes-cards.is-open {
    opacity: 1;
    visibility: visible;
    transition: opacity .25s;
}

.route-map-widget .route-map-close,
.route-map-widget .route-map-arrow {
    position: absolute;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
    color: var(--route-map-primary, #04728D);
    cursor: pointer;
}

.route-map-widget .route-map-close {
    top: 12px;
    right: 12px;
    width: 24px;
    height: 24px;
}

.route-map-widget .route-map-arrow {
    top: 50%;
    width: 32px;
    height: 48px;
    margin-top: -24px;
}

.route-map-widget .route-map-arrow svg {
    width: 32px;
    height: 32px;
}

.route-map-widget .route-map-prev {
    left: 0;
}

.route-map-widget .route-map-next {
    right: 0;
}

.route-map-widget .route-map-card .obj-counter {
    position: absolute;
    top: 16px;
    right: 48px;
    font-size: 12px;
    line-height: 16px;
}

.route-map-widget .route-map-card .map-object-slide {
    display: flex;
    gap: 20px;
    box-sizing: border-box;
    height: 250px;
    padding: 35px 36px;
    text-align: left;
}

.route-map-widget .route-map-card-photo.map-object-slide-photo {
    flex: 0 0 135px;
    width: 135px;
    height: 180px;
    overflow: hidden;
    border-radius: 10px;
}

.route-map-widget .route-map-card-photo a,
.route-map-widget .route-map-card-photo img {
    display: block !important;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.route-map-widget .route-map-card-text {
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    min-width: 0;
}

.route-map-widget .route-map-card .route-name,
.route-map-widget .route-map-card .category-name {
    font-size: 10px;
    font-style: italic;
    line-height: 14px;
    opacity: .7;
}

.route-map-widget .route-map-card .object-name {
    margin: 2px 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 22px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.route-map-widget .route-map-card .contact-wrapper {
    padding-top: 10px;
}

.route-map-widget .route-map-card .contact-row {
    overflow: hidden;
    font-size: 13px;
    line-height: 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.route-map-widget .route-map-card .object-contact {
    font-style: italic;
    font-weight: 700;
}

.route-map-widget .route-map-card a.object-link {
    display: inline !important;
    color: var(--route-map-secondary, #078989);
    text-decoration: none;
}

.route-map-widget .route-map-card a.object-link:hover {
    text-decoration: underline;
}

.route-map-widget a.route-map-more {
    display: block !important;
    margin-top: auto;
    padding: 10px 16px;
    border-radius: var(--route-map-chip-radius);
    background: var(--route-map-primary, #04728D);
    color: #fff !important;
    font-size: 14px;
    font-weight: 600;
    line-height: 20px;
    text-align: center;
    text-decoration: none;
}

.route-map-widget a.route-map-more:hover {
    opacity: .9;
}

/* ---------- phones ---------- */

@media (max-width: 767px) {
    .route-map-widget .route-map-header {
        align-items: flex-start;
        flex-direction: column;
    }

    .route-map-widget .route-map-controls,
    .route-map-widget .route-map-modes {
        width: 100%;
    }

    /* the three filter buttons share one row */
    .route-map-widget .route-map-modes {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;
    }

    .route-map-widget .route-map-mode {
        flex: 1 1 0;
        justify-content: center;
        min-width: 0;
        gap: 4px;
        padding: 8px 4px;
        font-size: 13px;
    }

    .route-map-widget .route-map-mode span {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .route-map-widget .route-map-holder {
        border-radius: 12px;
    }

    .route-map-widget .route-map-canvas {
        height: 520px;
    }

    .route-map-widget .route-map-card.all-routes-cards {
        left: 0 !important;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: auto;
        border-radius: 20px 20px 0 0;
        transform: none;
    }

    .route-map-widget .route-map-card .map-object-slide {
        height: auto;
        padding: 36px 32px 20px;
    }

    .route-map-widget .route-map-card-photo.map-object-slide-photo {
        flex-basis: 110px;
        width: 110px;
        height: 140px;
    }

    .route-map-widget .route-map-card .contact-wrapper {
        display: none;
    }

    .route-map-widget a.route-map-more {
        margin-top: 12px;
    }
}
