/* route page layout (routes/display/route.php + routes/blocks/*), loaded only on pages that use it, so page-level selectors stay unscoped */

#tabs_wrapper { position: sticky; top: 0; z-index: 20; background: #fff; }

/* header: eyebrow and badges use core .tf-eyebrow / .tf-pill */
.tf-route-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 20px; margin-top: 14px; }
.tf-route-head__main { flex: 999 1 560px; min-width: 0; }
.tf-route-head__titlerow { display: flex; align-items: center; gap: 16px; }
.tf-route-head__logo { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 96px; height: 64px; box-sizing: border-box; padding: 4px; border: 1px solid #e3e7e1; border-radius: 10px; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .04); overflow: hidden; }
.tf-route-head__logo img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.tf-route-head__title { margin: 0; min-width: 0; font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif; font-weight: 800; font-size: 38px; line-height: 1.12; letter-spacing: -.01em; color: #1c1d1f; }
.tf-route-head__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-top: 12px; font-size: 14px; color: #666; }
.tf-route-head__diff { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: #000; }
.tf-route-head__dot { color: #999; }
.tf-route-head__rating .star-rating { display: inline-block; vertical-align: middle; }
.tf-route-head__acts { margin: 0; }
.tf-route-head__acts .tf-actcounts__chip { font-size: 14px; }
.tf-route-head__act--more { display: none; }
.tf-route-head__acts--open .tf-route-head__act--more { display: inline-flex; }
.tf-route-head__actstoggle { height: 29px; padding: 0 10px; border: 1px solid #999; border-radius: 4px; background: #fff; color: #212121; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tf-route-head__badges { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.tf-route-head__actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.tf-route-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.tf-route-actions .button1 { margin: 0; }
.tf-route-actions [data-icon] { margin-right: 5px; }

/* cards: hero, elevation, sidebar blocks and the Trail Outlook snippet */
.tf-route-card,
.tf-route-side > .tf-rw { border: 1px solid #e3e7e1; border-radius: 16px; background: #fff; }
.tf-route-card--muted { background: #f8f8f8; }

/* map hero; isolated so map controls can't sit above the sticky tabs or the Add / Edit menu */
.tf-route-hero { overflow: hidden; isolation: isolate; }
.tf-route-hero__map { position: relative; }
.tf-route-hero__map #trail_map_container,
.tf-route-hero__map .mapcontainer,
.tf-route-hero__map .map { margin: 0; }
/* the region label repeats the header location, Open in Map repeats View larger map */
#trailAssociationLogo,
.tf-route-hero #mapRegionHint,
.tf-route-hero .tf-mapctl__openmap,
.tf-route-hero .tf-mapctl__menu li:has(> [data-tfmapctl-openmap]) { display: none !important; }
.tf-route-hero__map .tf-surface-toggle { position: absolute; left: 196px; bottom: 16px; z-index: 2; max-width: calc(100% - 520px); margin: 0; padding: 6px 12px; border-radius: 12px; background: #fff; box-shadow: 1px 1px 4px rgba(0, 0, 0, .25); }
.tf-route-hero__hidden { margin: 0; padding: 40px 24px; text-align: center; }
.tf-route-hero__photo { position: absolute; left: 16px; bottom: 16px; z-index: 2; display: block; width: 168px; height: 112px; border: 3px solid #fff; border-radius: 14px; overflow: hidden; background: #f3f3f3; box-shadow: 1px 1px 4px rgba(0, 0, 0, .25); }
.tf-route-hero__photo img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s ease; }
.tf-route-hero__photo:hover img { transform: scale(1.04); }
.tf-route-hero__photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 7px; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); color: #fff; font-size: 13px; font-weight: 700; }
.tf-route-hero__buttons { position: absolute; right: 16px; bottom: 16px; z-index: 2; display: flex; gap: 8px; }
.tf-route-hero__buttons .button1 { margin: 0; box-shadow: 1px 1px 4px rgba(0, 0, 0, .25); }
.tf-route-hero__buttons .svgicon,
.tf-route-mbar__btn .svgicon,
.tf-route-hit__btn .svgicon { width: 16px; height: 16px; margin-right: 5px; vertical-align: -3px; }
.tf-route-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); border-bottom: 1px solid #e3e7e1; }
.tf-route-stats__item { padding: 16px 20px; border-right: 1px solid #e3e7e1; }
.tf-route-stats__item:last-child { border-right: 0; }
.tf-route-stats__value { font-size: 26px; font-weight: 700; line-height: 1.15; color: #1c1d1f; white-space: nowrap; }
.tf-route-stats__label { margin-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #666; }
.tf-route-stats__note { padding: 0 20px 12px; font-size: 12px; color: #666; }
/* clip: the chart's last x-axis label pokes past the edge and widens the page on phones, pushing the fixed bar off screen */
.tf-route-elevation { margin-top: 20px; padding: 16px 24px; overflow-x: clip; }

/* body columns */
.tf-route-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 32px; margin-top: 32px; }
.tf-route-main { flex: 999 1 600px; min-width: 0; display: flex; flex-direction: column; gap: 40px; }
.tf-route-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }

/* sections; legacy .block/.boxtitle content inside them loses its box */
.tf-route-section h2,
.tf-route-section h2.h3,
.tf-route-section .boxtitle h2 { margin: 0 0 12px; font-size: 22px; font-weight: 700; line-height: 1.3; color: #1c1d1f; }
.tf-route-section .boxtitle { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border: 0; background: none; padding: 0; }
.tf-route-section .boxtitle .title,
.tf-route-section .boxtitle .more { float: none; }
.tf-route-section__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 12px; }
.tf-route-section__head h2 { margin: 0; }
.tf-route-section__head a { font-size: 14px; font-weight: 600; }
.tf-route-section__count { font-weight: 400; color: #666; }
.tf-route-section__aside { font-size: 13px; color: #666; }
.tf-route-section:empty,
.tf-route-links:empty { display: none; }
.tf-route-section .tf-diffbar { margin-bottom: 14px; }

/* about */
.tf-route-warning { margin-bottom: 16px; padding: 14px 16px; border: 1px solid #f1dc8c; border-radius: 12px; background: #fff8dc; color: #1e1500; font-size: 14px; }
.tf-route-warning--red { border-color: #f3b8b8; background: #fdeeee; color: #8a0010; }
.tf-route-desc { font-size: 16px; line-height: 1.65; color: #212121; max-width: 72ch; }
.tf-route-linkbtn { display: inline-block; margin-top: 8px; padding: 0; border: 0; background: none; color: #006784; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.tf-route-linkbtn:hover { color: #006699; text-decoration: underline; }
.tf-route-links .block { margin: 18px 0 0; }
.tf-route-links h4 { margin: 0 0 6px; font-size: 15px; font-weight: 700; color: #1c1d1f; }
.tf-route-links li { padding: 3px 0; overflow-wrap: anywhere; }
.tf-route-tags { margin-top: 18px; padding-top: 16px; border-top: 1px solid #f5f5f5; }

/* stages */
.tf-route-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.tf-route-stage { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 16px; border: 1px solid #e3e7e1; border-radius: 12px; background: #fff; transition: box-shadow .2s ease, transform .2s ease; }
/* beats the legacy #routeSectionList li span padding */
#routeSectionList.tf-route-stages li > span { padding-right: 0; }
.tf-route-stage--active { border-color: #366b2d; box-shadow: inset 0 0 0 1px #366b2d; }
.tf-route-stage:hover { box-shadow: 0 20px 40px -18px rgba(12, 26, 11, .3); transform: translateY(-2px); }
.tf-route-stage__num { flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px; color: #fff; display: flex; align-items: center; justify-content: center; box-sizing: border-box; padding: 0; line-height: 1; font-weight: 800; font-size: 16px; text-shadow: 0 0 2px rgba(0, 0, 0, .4); }
.tf-route-stage__name { flex: 1 1 200px; min-width: 0; font-size: 15px; font-weight: 700; color: #1c1d1f; }
.tf-route-stage__stats { display: flex; gap: 20px; text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #666; }
.tf-route-stage__stats b { display: block; font-size: 15px; text-transform: none; letter-spacing: 0; color: #000; font-variant-numeric: tabular-nums; }
.tf-route-stage__map { flex-shrink: 0; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 50%; background: #edf5eb; color: #366b2d; }
.tf-route-stage__map .svgicon { width: 18px; height: 18px; }
.tf-route-stage:hover .tf-route-stage__map,
.tf-route-stage--active .tf-route-stage__map { background: #366b2d; color: #fff; }

/* trail and POI rows */
.tf-route-list { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); column-gap: 24px; border-top: 1px solid #f5f5f5; }
.tf-route-list li { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 9px 6px; border-bottom: 1px solid #f5f5f5; }
.tf-route-list li:hover { background: #f8f8f8; }
.tf-route-list__icon { flex-shrink: 0; display: flex; width: 24px; justify-content: center; }
.tf-route-list__icon img,
.tf-route-list__icon svg { max-width: 24px; max-height: 24px; }
.tf-route-list__name { flex-grow: 1; min-width: 0; color: #212121; font-weight: 600; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.tf-route-list__name:hover { color: #006784; }
.tf-route-list__meta { flex-shrink: 0; min-width: 52px; max-width: 45%; font-size: 13px; color: #666; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.tf-route-list .tf-rw-label { flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: #5f6b5c; }

.tf-route-stage:focus-visible,
.tf-route-dock__open:focus-visible,
.tf-route-dock__close:focus-visible,
.tf-route-list__name:focus-visible { outline: 2px solid #366b2d; outline-offset: 2px; }

/* stages, trails and POI docked beside the map (tfRouteDock in route.php); a row click docks and zooms where there is a map */
@media (min-width: 768px) {
    .tf-route:not(.tf-route--nomap) .tf-route-stage,
    .tf-route:not(.tf-route--nomap) .tf-route-list li { cursor: pointer; }
}
.tf-route-dock__open { display: inline-flex; align-items: center; gap: 5px; margin-left: auto; }
.tf-route-dock__open .svgicon { width: 15px; height: 15px; }
.tf-route-dock__close { display: none; align-items: center; justify-content: center; flex-shrink: 0; width: 32px; height: 32px; margin-left: auto; padding: 0; border: 1px solid #ccc; border-radius: 8px; background: #fff; cursor: pointer; }
.tf-route-dock__close:hover { background: #f3f3f3; }
.tf-route-dock__arrow { width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid #212121; border-bottom: 2px solid #212121; transform: rotate(45deg); }
.tf-route--nomap .tf-route-stage__map,
.tf-route--nomap .tf-route-dock__open { display: none; }
.tf-route-hero__map--dock { padding-right: 380px; }
.tf-route-hero__map--dock .tf-route-hero__buttons { right: 396px; }
.tf-route-hero__map--dock .tf-surface-toggle { max-width: calc(100% - 900px); }
.tf-route-dock--docked { position: absolute; top: 0; right: 0; bottom: 0; z-index: 3; width: 380px; box-sizing: border-box; overflow-y: auto; padding: 14px; border-left: 1px solid #e3e7e1; background: #fafbf9; }
.tf-route-dock--docked .tf-route-section__head { flex-wrap: nowrap; align-items: center; }
.tf-route-dock--docked .tf-route-section__head h2 { font-size: 17px; }
.tf-route-dock--docked .tf-route-section__aside,
.tf-route-dock--docked .tf-route-dock__open,
.tf-route-dock--docked .tf-diffbar { display: none; }
.tf-route-dock--docked .tf-route-dock__close { display: inline-flex; }
.tf-route-dock--docked .tf-route-stages { gap: 8px; }
.tf-route-dock--docked .tf-route-stage { gap: 6px 10px; padding: 10px 12px; }
.tf-route-dock--docked .tf-route-stage:hover { transform: none; box-shadow: 0 8px 20px -12px rgba(12, 26, 11, .4); }
.tf-route-dock--docked .tf-route-stage__num { width: 30px; height: 30px; font-size: 14px; }
.tf-route-dock--docked .tf-route-stage__name { flex: 1 1 150px; font-size: 14px; }
.tf-route-dock--docked .tf-route-stage__map { width: 30px; height: 30px; }
.tf-route-dock--docked .tf-route-stage__stats { order: 1; width: 100%; justify-content: flex-start; gap: 14px; padding-left: 40px; text-align: left; }
.tf-route-dock--docked .tf-route-list { grid-template-columns: minmax(0, 1fr); }
.tf-route-dock--docked #routeTrailLegend { max-height: none; overflow: visible; }
.tf-route-dock--docked .tf-route-list li { background: #fff; }
.tf-route-dock--docked .tf-route-list li:hover,
.tf-route-dock--docked .tf-route-list li.tf-route-dock__row--active { background: #edf5eb; }
.tf-route-dock--docked .tf-route-list li.tf-route-dock__row--active { box-shadow: inset 0 0 0 1px #366b2d; }

/* reports, photos, videos: existing blocks inside the new sections */
.tf-route-reports .boxcontent { border: 1px solid #e3e7e1; border-radius: 12px; overflow: hidden; }
.tf-route-reports table.table1 { width: 100%; margin: 0; }
.tf-route-reports table.table1 tbody tr td.highlight { background-color: transparent; }
.tf-route-reports .more { display: inline-block; margin: 10px 16px; font-weight: 600; }
.tf-route-media .photogrid .inElm { max-width: 360px; }

/* sidebar */
.tf-route-side > .tf-route-card,
.tf-route-side > .tf-rw { margin: 0; padding: 16px 18px; }
.tf-route-side .tf-route-card h2,
.tf-route-side .tf-route-card h3,
.tf-route-side .tf-route-card h4,
.tf-route-side .tf-route-card h5 { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: #1c1d1f; }
.tf-route-side .tf-route-card .block,
.tf-route-side #route_trail_status { margin: 0; }
.tf-route-side .makecols2,
.tf-route-side .makecols3 { grid-template-columns: 1fr; columns: auto; }

.tf-route-hit { padding: 20px !important; border: 0; background: #1f4a19; color: #edfaeb; }
.tf-route-side .tf-route-hit .tf-route-hit__title { margin: 0 0 4px; font-family: 'Montserrat', 'Helvetica Neue', Arial, sans-serif; font-weight: 800; font-size: 20px; color: #fff; }
.tf-route-hit__sub { margin: 0 0 14px; font-size: 13px; color: #cfe6c9; }
.tf-route-hit__buttons { display: flex; flex-direction: column; gap: 8px; }
.tf-route-hit__btn { display: flex; align-items: center; justify-content: center; box-sizing: border-box; width: 100%; min-height: 40px; padding: 8px 14px; border: 1px solid #fff; border-radius: 8px; background: #fff; color: #2a2a2a; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
.tf-route-hit__btn:hover { background: #f3f3f3; }
.tf-route-hit__btn--primary { border-color: #fec200; background: #fec200; color: #1e1500; }
.tf-route-hit__btn--primary:hover { background: #f2c200; }

/* label / value rows: the legacy details list and the extra stats dl */
.tf-route-details #routedetails_display { margin: 0; padding: 0; border: 0; background: none; columns: auto; }
.tf-route-details #routedetails_display li::after { display: none; }
.tf-route-details #routedetails_display li,
.tf-route-dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; float: none; width: auto; padding: 7px 0; border-bottom: 1px solid #f5f5f5; }
.tf-route-details #routedetails_display li.greybox { padding: 8px 12px; border-radius: 8px; }
.tf-route-details #routedetails_display .term,
.tf-route-dl dt { float: none; width: auto; font-size: 13px; color: #666; }
.tf-route-details #routedetails_display .definition,
.tf-route-dl dd { float: none; margin: 0; font-size: 14px; font-weight: 600; color: #212121; text-align: right; }
.tf-route-dl { margin: 0; }

.tf-route-foot { padding: 4px 4px 0; font-size: 12px; line-height: 1.7; color: #666; }

/* jQuery UI dialogs and their overlay sit above the site header (.tfnh is 1000, core .ui-front is 900) */
body .ui-front { z-index: 1010; }
/* centred in CSS so dialogs that grow after their content loads (Save, Open in app QR) stay centred */
body .ui-dialog { position: fixed !important; top: 50% !important; left: 50% !important; max-width: calc(100vw - 16px); transform: translate(-50%, -50%); }
/* !important: jQuery UI writes an inline max-height: none */
body .ui-dialog .ui-dialog-content { max-height: calc(100vh - 80px) !important; max-height: calc(100dvh - 80px) !important; overflow-x: hidden; overflow-y: auto; }

/* mobile sticky action bar */
.tf-route-mbar { display: none; }

@media (max-width: 900px) {
    .tf-route-hero__map--dock { padding-right: 0; }
    .tf-route-hero__map--dock .tf-route-hero__buttons,
    .tf-route-hero__map--dock .tf-route-hero__photo,
    .tf-route-hero__map--dock .tf-surface-toggle { display: none; }
    .tf-route-dock--docked { position: static; width: auto; max-height: 360px; border-left: 0; border-top: 1px solid #e3e7e1; }
}

@media (max-width: 767px) {
    .tf-route-head__title { font-size: 26px; }
    .tf-route-head__logo { width: 64px; height: 44px; }
    .tf-route-head__actions { align-items: stretch; width: 100%; }
    .tf-route-actions { display: grid; grid-template-columns: repeat(2, 1fr); }
    /* the bottom bar already has Save */
    .tf-route-actions #saveRoute, .tf-route-actions .checkinbutton { display: none; }
    .tf-route-actions .button1 { width: 100%; padding-left: 4px; padding-right: 4px; text-align: center; }
    .tf-route-hero { border-radius: 0; border-left: 0; border-right: 0; }
    .tf-route-hero__photo { width: 112px; height: 76px; left: 10px; bottom: 10px; }
    .tf-route-hero__buttons { right: 10px; bottom: 10px; }
    .tf-route-hero__buttons .button1:first-child { display: none; }
    .tf-route-hero__map .tf-surface-toggle { left: 10px; top: 56px; bottom: auto; max-width: calc(100% - 80px); }
    .tf-route-stats { grid-template-columns: repeat(3, 1fr); }
    .tf-route-stats__item { padding: 12px 14px; border-bottom: 1px solid #e3e7e1; }
    .tf-route-stats__value { font-size: 20px; }
    .tf-route-elevation { padding: 16px; }
    .tf-route-main { gap: 32px; }
    .tf-route-stage__stats { order: 1; width: 100%; justify-content: flex-start; text-align: left; padding-left: 52px; }
    .tf-route-dock__open,
    .tf-route-stage__map { display: none !important; }

    /* reports: one card per row, icon | trail + date | condition + text */
    .tf-route-reports table.responsive_reports tbody tr { display: grid; grid-template-columns: 24px auto minmax(0, 1fr) auto; grid-template-areas: "s t t d" "s c x x"; align-items: center; gap: 6px 10px; margin: 0; padding: 12px 14px; border-bottom: 1px solid #f0f0f0; background: #fff; }
    .tf-route-reports table.responsive_reports tbody tr:last-child { border-bottom: 0; }
    .tf-route-reports table.responsive_reports tbody td { display: block; width: auto; max-width: none !important; padding: 0; border: 0; }
    .tf-route-reports table.responsive_reports tbody td:nth-child(1) { grid-area: s; align-self: start; }
    .tf-route-reports table.responsive_reports tbody td:nth-child(2) { grid-area: t; min-width: 0; font-weight: 600; }
    .tf-route-reports table.responsive_reports tbody td:nth-child(3) { grid-area: d; font-size: 13px; color: #666; }
    .tf-route-reports table.responsive_reports tbody td:nth-child(4) { grid-area: c; }
    .tf-route-reports table.responsive_reports tbody td:nth-child(5) { grid-area: x; min-width: 0; font-size: 14px; line-height: 1.45; }

    /* photos and videos: one full-width tile per row */
    .tf-route-media .photogrid .inElm { float: none; width: 100%; max-width: none; margin: 0 0 16px; }
    .tf-route-media .photogrid .inElm > a,
    .tf-route-media .photogrid .inElm > a img { display: block; width: 100%; height: auto; }

    .tf-route-side { padding-bottom: 72px; }
    .tf-route-side .tf-route-hit { display: none; }
    .tf-route-mbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; display: flex; gap: 8px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid #e3e7e1; box-shadow: 0 -4px 12px rgba(0, 0, 0, .08); }
    .tf-route-mbar__btn { flex: 1 1 0; display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 8px; border: 1px solid #999; border-radius: 8px; background: #fff; color: #2a2a2a; font: inherit; font-size: 14px; font-weight: 700; text-decoration: none; cursor: pointer; }
    .tf-route-mbar__btn--primary { border-color: #366b2d; background: #366b2d; color: #fff; }
    .tf-route-mbar__btn [data-icon] { margin-right: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .tf-route-stage,
    .tf-route-hero__photo img { transition: none; }
    .tf-route-stage:hover { transform: none; }
}
