/* ── reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── tokens ── */
:root {
    --font-body:   'Georgia', 'Times New Roman', serif;
    --font-ui:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --c-bg:        #f7f6f3;
    --c-surface:   #ffffff;
    --c-border:    rgba(0,0,0,.09);
    --c-border-md: rgba(0,0,0,.15);
    --c-text:      #1a1915;
    --c-muted:     #5c5a54;
    --c-faint:     #9b9890;
    --c-accent:    #1D9E75;
    --radius-sm:   6px;
    --radius-md:   10px;
    --radius-lg:   14px;
    --img-h-leg:   200px;
    --img-w-leg:   240px;
}

body        { background: var(--c-bg); color: var(--c-text); font-family: var(--font-ui); line-height: 1.6; }
.r4r-route  { max-width: 860px; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; }

/* ── breadcrumb ──────────────────────────────────────────────────────────────*/
.r4r-breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--c-faint); margin-bottom: 1.75rem; flex-wrap: wrap; }
.r4r-breadcrumb a { color: var(--c-accent); text-decoration: none; }
.r4r-breadcrumb a:hover { text-decoration: underline; }
.r4r-breadcrumb .sep { opacity: .4; }

/* ── lang switcher ───────────────────────────────────────────────────────────*/
.r4r-lang-switcher { display: flex; gap: 8px; margin-bottom: 1rem; }
.r4r-lang-switcher a { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--c-border-md); color: var(--c-muted); text-decoration: none; }
.r4r-lang-switcher a.active { background: var(--c-accent); color: #fff; border-color: var(--c-accent); }

/* ── title ───────────────────────────────────────────────────────────────────*/
.r4r-title { font-family: var(--font-body); font-size: clamp(26px, 4vw, 36px); font-weight: normal; line-height: 1.25; margin-bottom: 1rem; letter-spacing: -.01em; }

/* ── attributes ──────────────────────────────────────────────────────────────*/
.r4r-attrs { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 1.75rem; }
.r4r-attr  { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 14px; border-radius: var(--radius-md); border: 0.5px solid var(--c-border); background: var(--c-surface); color: var(--c-muted); font-size: 11px; font-weight: 500; letter-spacing: .03em; text-align: center; white-space: nowrap; min-width: 72px; }
.r4r-attr img { width: 36px; height: 36px; object-fit: contain; }
/* attr-name: kept visually hidden as agreed */
.r4r-attr span.attr-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ── map — responsive height matching index page ─────────────────────────────*/
.r4r-map {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 0.5px solid var(--c-border);
    overflow: hidden;
    margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
    .r4r-map { height: 55vw; min-height: 240px; max-height: 360px; }
}
@media (min-width: 641px) {
    .r4r-map { height: 500px; }
}

/* ── stats ───────────────────────────────────────────────────────────────────*/
.r4r-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 2rem; }
@media (max-width: 540px) { .r4r-stats { grid-template-columns: repeat(2, 1fr); } }
.r4r-stat { background: var(--c-surface); border: 0.5px solid var(--c-border); border-radius: var(--radius-md); padding: 14px 16px; }
.r4r-stat-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--c-faint); margin-bottom: 4px; }
.r4r-stat-val   { font-size: 22px; font-weight: 600; line-height: 1; }
.r4r-stat-unit  { font-size: 13px; font-weight: 400; color: var(--c-muted); margin-left: 2px; }
/* Speed sits below the duration value, smaller and separate */
.r4r-stat-speed { display: block; font-size: 11px; font-weight: 400; color: var(--c-faint); margin-top: 4px; }

/* ── Inline stats (inside leg/startplace cards) ──────────────────────────────*/
.r4r-stats--inline { display: flex; flex-wrap: wrap; gap: 8px; margin: .5rem 0 .75rem; }
.r4r-stats--inline .r4r-stat { padding: 8px 10px; }
.r4r-stats--inline .r4r-stat-label { font-size: 9px; }
.r4r-stats--inline .r4r-stat-val   { font-size: 16px; }
.r4r-stats--inline .r4r-stat-unit  { font-size: 11px; }
.r4r-stats--inline .r4r-stat-speed { font-size: 10px; }

/* ── description row ─────────────────────────────────────────────────────────*/
.r4r-description-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin-bottom: 2.5rem; }
@media (max-width: 600px) { .r4r-description-row { grid-template-columns: 1fr; } }
.r4r-route-image { position: relative; border-radius: var(--radius-md); overflow: hidden; }
.r4r-route-image img { width: 100%; height: auto; object-fit: cover; display: block; }
/* Prevent route image collapsing too small on mobile */
@media (max-width: 600px) {
    .r4r-route-image { min-height: 200px; }
    .r4r-route-image img { height: 200px; object-fit: cover; }
}
.r4r-description { font-family: var(--font-body); font-size: 16px; line-height: 1.85; color: var(--c-muted); }

/* ── cards shared ────────────────────────────────────────────────────────────*/
.r4r-img-wrapper { position: relative; overflow: hidden; }
.r4r-img-wrapper img { display: block; width: 100%; height: 100%; object-fit: cover; }
.r4r-img-copyright { position: absolute; bottom: 0; left: 0; width: 100%; background: rgba(0,0,0,.45); color: #fff; font-size: 9px; text-align: center; padding: 2px 4px; }
.r4r-img-placeholder { display: flex; align-items: center; justify-content: center; background: var(--c-bg); color: var(--c-faint); font-size: 13px; min-height: var(--img-h-leg); }

/* ── leg cards ───────────────────────────────────────────────────────────────*/
.r4r-leg-card { display: grid; grid-template-columns: var(--img-w-leg) 1fr; background: var(--c-surface); border: 0.5px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1rem; transition: box-shadow .2s; }
.r4r-leg-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); }
@media (max-width: 600px) {
    .r4r-leg-card { grid-template-columns: 1fr; }
    .r4r-leg-img { height: 200px; }
    .r4r-leg-img img { height: 200px; }
}
.r4r-leg-body { padding: 1.25rem; }
.r4r-leg-num  { font-size: 12px; font-weight: 600; text-transform: uppercase; color: var(--c-muted); margin-bottom: .4rem; }
.r4r-leg-title { font-size: 15px; font-weight: 600; margin-bottom: .4rem; }
.r4r-leg-desc  { font-size: 13px; line-height: 1.7; color: var(--c-muted); margin-bottom: .6rem; }
.r4r-leg-instruction { font-size: 12px; line-height: 1.65; color: var(--c-faint); border-left: 2px solid var(--c-border-md); padding-left: 8px; }
.r4r-leg-img  { min-height: var(--img-h-leg); }

/* ── waypoint cards ──────────────────────────────────────────────────────────*/
.r4r-waypoint-card { display: grid; grid-template-columns: 1fr var(--img-w-leg); background: #f5f0e6; border: 0.5px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1rem; transition: box-shadow .2s; }
.r4r-waypoint-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); }
@media (max-width: 600px) {
    .r4r-waypoint-card { grid-template-columns: 1fr; }
    .r4r-waypoint-img { height: 200px; order: -1; }
    .r4r-waypoint-img img { height: 200px; }
}
.r4r-waypoint-body { padding: 1.25rem; }
.r4r-waypoint-title { font-size: 17px; font-weight: 700; margin-bottom: .4rem; }
.r4r-waypoint-desc  { font-size: 13px; line-height: 1.7; color: var(--c-muted); margin-bottom: .6rem; }
.r4r-waypoint-instruction { font-size: 12px; line-height: 1.65; color: var(--c-faint); border-left: 2px solid var(--c-border-md); padding-left: 8px; }
.r4r-waypoint-img { min-height: var(--img-h-leg); }

/* ── badges ──────────────────────────────────────────────────────────────────*/
.waypoint-badge { display: inline-flex; align-items: center; justify-content: center; padding: 4px 12px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; margin-bottom: 6px; }
.waypoint-badge--start  { background: #0F6E56; color: #fff; }
.waypoint-badge--middle { background: #FFA500; color: #fff; }
.waypoint-badge--end    { background: #993C1D; color: #fff; }

/* ── image copyright on route image ─────────────────────────────────────────*/
.r4r-image-copyright { position: absolute; bottom: 0; width: 100%; background: rgba(0,0,0,.55); color: #fff; font-size: 10px; text-align: center; padding: 2px 0; letter-spacing: .5px; }

/* ── section labels / headings ───────────────────────────────────────────────*/
.r4r-section-label { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: var(--c-faint); margin-bottom: .85rem; }
.r4r-section-heading { font-family: var(--font-body); font-size: clamp(20px, 3vw, 26px); font-weight: normal; margin: 2.5rem 0 1rem; border-bottom: 1px solid var(--c-border); padding-bottom: .5rem; }

/* ── ranked cards ────────────────────────────────────────────────────────────*/
.r4r-leg-card--ranked { position: relative; }
.r4r-rank-number { position: absolute; top: 12px; left: 12px; font-size: 28px; font-weight: 800; color: var(--c-accent); line-height: 1; z-index: 1; background: rgba(255,255,255,.85); padding: 4px 8px; border-radius: var(--radius-sm); }

/* ── CTA ─────────────────────────────────────────────────────────────────────*/
.r4r-cta { margin-top: 2.5rem; padding: 2rem; background: var(--c-surface); border: 0.5px solid var(--c-border); border-radius: var(--radius-lg); text-align: center; }
@media (max-width: 600px) {
    .r4r-cta { padding: 1.25rem 1rem; margin-top: 1.5rem; }
}
.r4r-cta-pretext { font-size: 15px; color: var(--c-muted); margin-bottom: 1.25rem; }

/* ── buttons ─────────────────────────────────────────────────────────────────*/
.r4r-btn { display: inline-block; padding: 12px 28px; border-radius: 999px; font-size: 15px; font-weight: 600; text-decoration: none; transition: opacity .2s; }
.r4r-btn--primary { background: var(--c-accent); color: #fff !important; }
.r4r-btn--primary:hover { opacity: .85; }
.r4r-btn--secondary { background: transparent; color: var(--c-accent); border: 1.5px solid var(--c-accent); margin-top: .5rem; display: inline-block; padding: 8px 20px; border-radius: 999px; font-size: 13px; font-weight: 600; width: fit-content; }

/* ── start place cards (subregion page) ──────────────────────────────────────*/
.r4r-startplace-card { display: grid; grid-template-columns: var(--img-w-leg) 1fr; background: var(--c-surface); border: 0.5px solid var(--c-border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 1rem; text-decoration: none; color: var(--c-text); transition: box-shadow .2s; }
.r4r-startplace-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.07); }
@media (max-width: 600px) { .r4r-startplace-card { grid-template-columns: 1fr; } }
.r4r-startplace-img { min-height: var(--img-h-leg); }
.r4r-startplace-body { padding: 1.25rem; display: flex; flex-direction: column; justify-content: center; gap: .5rem; }
.r4r-startplace-name { font-size: 18px; font-weight: 700; }
.r4r-startplace-count { font-size: 13px; color: var(--c-muted); }
.r4r-startplace-card:hover .r4r-btn--secondary { background: var(--c-accent); color: #fff; }

/* ── map popups ──────────────────────────────────────────────────────────────*/
.r4r-map-popup { padding: 4px 2px; min-width: 160px; }
.r4r-map-popup-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.r4r-map-popup-count { font-size: 12px; color: var(--c-muted); margin-bottom: 8px; }
.r4r-map-popup-link { display: inline-block; padding: 5px 14px; background: var(--c-accent); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 600; text-decoration: none; }
.r4r-map-popup-link:hover { opacity: .85; }
.leaflet-popup-content-wrapper .r4r-map-popup { color: #1a1915; }
.leaflet-popup-content-wrapper .r4r-map-popup-name { font-weight: 700; font-size: 14px; margin-bottom: 4px; color: #1a1915; }
.leaflet-popup-content-wrapper .r4r-map-popup-count { font-size: 12px; color: #5c5a54; margin-bottom: 8px; }
.leaflet-popup-content-wrapper a.r4r-map-popup-link { color: #fff; }
.leaflet-popup-content-wrapper a.r4r-map-popup-link:hover { color: #fff; opacity: .85; }

/* ── Top heading (route_page_heading) ────────────────────────────────────────*/
.r4r-top-heading {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .07em;
    color: var(--c-faint);
    margin-bottom: .75rem;
}

/* ── Avada theme overrides ───────────────────────────────────────────────────*/
.r4r-single-route { margin-top: -100px; }

@media (max-width: 768px) {
    .r4r-single-route {
        width: 100vw;
        position: relative;
        left: 50%;
        transform: translateX(-50%);
        padding-left: 16px;
        padding-right: 16px;
        box-sizing: border-box;
    }
}