/* RacesCanada - Race Detail Page
   TRAIL RUN MAGAZINE INSPIRED - Bold & Energetic
   Full-bleed hero imagery with golden accents
   ============================================================ */

/* ============================================================
   CSS VARIABLES - Trail Magazine Inspired
   ============================================================ */
:root {
    /* Light backgrounds - clean white */

    /* Text - rich dark */

    /* Borders */

    /* Accent - Trail Run Mag golden yellow */

    /* Distance badge colors - vibrant */

    /* Typography */

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.15);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
.race-detail-body {
    background: var(--rs-bg) !important;
    color: var(--rs-text) !important;
    font-family: var(--font-body) !important;
    overflow-x: clip !important;
}

/* Remove animated background from style.css — not used on race detail */
.race-detail-body::before {
    display: none !important;
}

.race-detail-body .container {
    background: transparent !important;
    max-width: none;
    padding: 0;
}

/* ============================================================
   HEADER - Fixed with frosted glass background
   ============================================================ */
.race-detail-body header {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    z-index: 100 !important;
    background: rgba(22, 22, 22, 0.96) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: none !important;
    border-bottom: 1px solid rgba(255,255,255,0.1) !important;
    padding: 0 48px !important;
    height: 70px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    overflow: visible !important;
}

.race-detail-body header::after {
    display: none !important;
}

.race-detail-body .header-content {
    max-width: none !important;
    margin: 0 !important;
    background: transparent !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    gap: 12px !important;
    justify-content: flex-start !important;
}

.race-detail-body .site-logo {
    filter: brightness(0) invert(1);
    height: 40px;
}

.race-detail-body .header-text .site-title {
    color: #fff !important;
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
}

.race-detail-body .header-text .site-title .highlight {
    color: var(--rs-accent-ink) !important;
    -webkit-text-fill-color: var(--rs-accent) !important;
}

.race-detail-body .subtitle {
    display: none;
}

/* ============================================================
   NAVIGATION - Fixed with same frosted glass
   ============================================================ */
.race-detail-body .nav-links {
    background: transparent !important;
    border: none !important;
    padding: 0 48px !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    height: 70px !important;
    z-index: 101 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    overflow: visible !important;
}

.race-detail-body .nav-links .nav-left {
    display: flex !important;
    align-items: center !important;
    gap: 32px !important;
    margin: 0 !important;
    position: absolute !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
}

.race-detail-body .nav-links .nav-right {
    display: flex !important;
    align-items: center !important;
    gap: 20px !important;
    margin: 0 !important;
    position: absolute !important;
    right: 48px !important;
}

.race-detail-body .nav-links a {
    color: rgba(255,255,255,0.9) !important;
    font-family: var(--font-body) !important;
    font-weight: 500 !important;
    font-size: 14px !important;
    pointer-events: auto !important;
    cursor: pointer !important;
    text-decoration: none !important;
    transition: color 0.15s ease !important;
    letter-spacing: 0.01em;
}

.race-detail-body .nav-links a:hover {
    color: var(--rs-accent-ink) !important;
}

.race-detail-body .nav-links a.active {
    color: var(--rs-accent-ink) !important;
    text-decoration: none !important;
}

/* Sign in button - frosted glass */
.race-detail-body .nav-sign-in {
    padding: 8px 18px !important;
    background: rgba(255, 255, 255, 0.12) !important;
    backdrop-filter: blur(8px) !important;
    -webkit-backdrop-filter: blur(8px) !important;
    color: white !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 8px !important;
    font-weight: 500 !important;
    font-size: 0.9rem !important;
    letter-spacing: 0.02em !important;
    transition: all 0.25s ease !important;
}

.race-detail-body .nav-sign-in:hover {
    background: rgba(255, 255, 255, 0.22) !important;
    border-color: rgba(255, 255, 255, 0.4) !important;
    transform: translateY(-1px) !important;
}

/* User dropdown */
.race-detail-body .nav-user-dropdown {
    background: transparent !important;
    color: #fff !important;
}

.race-detail-body .nav-user-dropdown .nav-user-btn {
    background: transparent !important;
    color: #fff !important;
}

.race-detail-body .nav-user-dropdown .nav-user-name {
    color: #fff !important;
}

.race-detail-body .nav-user-dropdown .nav-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

/* Dropdown menu */
.race-detail-body .nav-dropdown-menu {
    background: var(--rs-bg-card) !important;
    border: 1px solid var(--rs-border) !important;
    box-shadow: var(--shadow-lg) !important;
    border-radius: 12px !important;
}

.race-detail-body .nav-dropdown-menu a,
.race-detail-body .nav-dropdown-menu button {
    color: var(--rs-text-secondary) !important;
    text-shadow: none !important;
    background: transparent !important;
    font-family: var(--font-body) !important;
}

.race-detail-body .nav-dropdown-menu a:hover,
.race-detail-body .nav-dropdown-menu button:hover {
    background: var(--rs-bg-elevated) !important;
    color: var(--rs-text) !important;
}

.race-detail-body .nav-dropdown-menu hr {
    border-color: var(--rs-border) !important;
}

/* ============================================================
   PAGE LAYOUT
   ============================================================ */
.race-detail-page {
    min-height: 100vh;
}

.race-detail-layout {
    display: block;
    padding: 0;
    max-width: none;
    background: var(--rs-bg);
}

.race-detail-container {
    max-width: none;
    padding: 0;
}

/* Hidden old breadcrumb (SEO only) */
.breadcrumb {
    display: none;
}

/* ============================================================
   BREADCRUMB NAVIGATION - Consistent with race-search
   ============================================================ */
.breadcrumb-nav {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 8px 48px;
    background: transparent;
    font-family: var(--font-body);
    font-size: 0.85rem;
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
}

.breadcrumb-list li {
    display: flex;
    align-items: center;
}

.breadcrumb-list li:not(:last-child)::after {
    content: "›";
    margin-left: 8px;
    color: rgba(255,255,255,0.6);
}

.breadcrumb-list a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s ease;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}

.breadcrumb-list a:hover {
    color: #fff;
    text-decoration: underline;
}

.breadcrumb-list span[aria-current="page"] {
    color: #fff;
    font-weight: 500;
    text-shadow: 0 1px 3px rgba(0,0,0,0.3);
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 768px) {
    /* Three overlapping layers stack at the top of a mobile race page: the
       fixed header (0-50px), the fixed nav row below it, then the breadcrumb,
       which is position:absolute and so out of flow. Nothing reserved space
       for anything else, and the H1 rendered directly on top of the breadcrumb
       at 320px. These two values are what keep them clear of each other; the
       nav row is 44px of tap target plus its padding. */
    .race-detail-body {
        --mobile-chrome-height: 97px;
        --breadcrumb-height: 32px;
    }

    .breadcrumb-nav {
        top: var(--mobile-chrome-height);
        padding: 6px 16px;
        font-size: 0.8rem;
    }

    .breadcrumb-list span[aria-current="page"] {
        max-width: 180px;
    }

    /* Keep the trail on one line so its height stays predictable */
    .breadcrumb-list {
        flex-wrap: nowrap;
        white-space: nowrap;
        overflow: hidden;
    }

    /* Clear the nav row and the breadcrumb sitting on top of the hero */
    .race-hero .hero-content {
        padding-top: calc(var(--mobile-chrome-height) - 50px + var(--breadcrumb-height) + 8px);
    }
}

/* ============================================================
   HERO - Full Viewport Immersive
   ============================================================ */
.race-hero {
    position: relative;
    /* Content-driven height. This was a fixed `height: 60vh` with
       overflow:hidden and justify-content:flex-end, so a race name that wrapped
       to two lines overflowed the TOP of the box and had its first line clipped
       behind the sticky nav (reproduced at <=1440px wide). min-height keeps the
       original proportions while letting long titles grow the box instead. */
    /* Was clamp(420px, 60vh, 650px) — 540px at 1440x900, so 60% of the viewport
       was spent before the first fact and the first content sat at y=785. The
       hero carries a title, date, location and one button; this is enough for
       all of it and still leaves the top of the page showing actual content.
       Still min-height, so a long wrapped title grows the box rather than
       clipping behind the sticky nav (the bug the old comment describes). */
    min-height: clamp(300px, 40vh, 440px);
    margin: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.race-hero img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

/* Branded hero — race-supplied image (e.g. promo banner with white bg) */
.race-hero--branded {
    background: #1a1a2e;
    justify-content: flex-end;
}

.race-hero--branded img {
    object-fit: contain;
    object-position: center center;
    opacity: 0.92;
}

.race-hero--branded::before {
    background: linear-gradient(
        to bottom,
        rgba(10,10,20,0.15) 0%,
        rgba(10,10,20,0.25) 50%,
        rgba(10,10,20,0.75) 85%,
        rgba(10,10,20,0.88) 100%
    );
}

/* Gradient overlay - dark cinematic */
.race-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.25) 0%,
        rgba(0,0,0,0.35) 45%,
        rgba(0,0,0,0.62) 75%,
        rgba(0,0,0,0.78) 100%
    );
    z-index: 1;
    pointer-events: none;
}

/* Hero Content */
.hero-content {
    position: relative;
    z-index: 2;
    /* The hero is a bottom-anchored flex box with overflow:hidden, and two
       pieces of chrome float over its top: the 70px fixed header and the
       absolutely-positioned breadcrumb at 70-108px. With no top padding the
       content simply starts at y=0 whenever the hero is short — which it is on
       a wide-but-short window, where the title rendered underneath both. The
       old 420-650px min-height masked this by always leaving slack; reserving
       the chrome height fixes it at any viewport instead of by luck.
       Bottom padding trimmed from 72px to claw back what this costs. */
    padding: 120px 48px 40px;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

/* Laptops and short windows: the title is the tallest thing in the hero, and
   118px of reserved chrome plus a two-line 56px title fills a 600px viewport.
   Step it down so the hero stays under half the screen. */
@media (min-width: 769px) and (max-height: 760px) {
    .hero-title {
        font-size: clamp(1.9rem, 3vw, 2.6rem);
        margin-bottom: 14px;
    }

    .hero-content {
        padding-bottom: 32px;
    }
}

.hero-breadcrumb {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: rgba(255,255,255,0.85);
    margin-bottom: 16px;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.hero-breadcrumb a {
    color: rgba(255,255,255,0.85);
    text-decoration: none;
    transition: color 0.15s ease;
}

.hero-breadcrumb a:hover {
    color: var(--rs-accent-ink);
}

/* Sport Badge */
.hero-sport-badge {
    display: inline-block;
    padding: 8px 16px;
    margin-bottom: 16px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rs-accent-text);
    background: var(--rs-accent);
    border-radius: 20px;
}

.hero-title {
    font-family: var(--font-display);
    /* Was clamp(3rem, 8vw, 5rem) — 80px at 1440, which wrapped a typical race
       name to two lines and cost 168px of hero on its own. This still reads as
       the page's headline while leaving room for content above the fold. */
    font-size: clamp(2.25rem, 4.4vw, 3.5rem);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.01em;
    color: #fff;
    margin: 0 0 18px 0;
    max-width: 20ch;
    text-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Shown on races whose date has passed. Lives in .race-content, not in the hero:
   the hero is a fixed-height bottom-anchored flex box with overflow:hidden, so
   anything added inside it pushes the <h1> out of the top and clips it. */
.past-event-notice {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.5;
    color: #7a3f10;
    background: #fff6ed;
    border: 1px solid #ffd9b8;
    border-left: 4px solid var(--rs-accent);
    border-radius: 8px;
    padding: 14px 18px;
    margin: 0 0 28px 0;
}

.past-event-notice a {
    color: #b8460e;
    text-decoration: underline;
    font-weight: 600;
}

/* Past edition that carries results value — the "{race} {year} results" landing
   experience. On brand since 8 Nov 2026 (was a blue box with a blue button and a 4px
   blue side stripe): the same white card and black primary button as the race-day
   panel, so a race page has one results button style. */
.past-results-notice {
    font-family: var(--font-body);
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border, #ddd);
    border-radius: 14px;
    padding: 18px 20px;
    margin: 0 0 28px 0;
}

.past-results-notice__lead {
    font-size: 15px;
    line-height: 1.5;
    color: var(--rs-text, #161616);
    margin: 0;
}

.past-results-notice__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.past-results-btn {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: 10px;
    text-decoration: none;
    color: var(--rs-text, #161616);
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border, #ddd);
    transition: background 0.15s ease, border-color 0.15s ease;
}
.past-results-btn:hover { border-color: var(--rs-text, #161616); }

.past-results-btn--primary {
    color: #fff;
    background: var(--rs-text, #161616);
    border-color: var(--rs-text, #161616);
}
.past-results-btn--primary:hover { background: #000; }

.past-results-notice__prev {
    margin: 12px 0 0 0;
    font-size: 13px;
}

.past-results-notice__prev a {
    color: var(--rs-text, #161616);
    text-decoration: underline;
    text-decoration-color: var(--rs-accent);
    text-underline-offset: 2px;
}

/* Phones, once the hero leads with the results button: the card below it keeps its
   text, not a second copy of the same button (8 Nov 2026). */
@media (max-width: 1023px) {
    .results-dup-phone { display: none !important; }
}

/* Upcoming edition -> previous edition (the reverse of the results notice's
   "{year} edition" button). Same small-link treatment, sits under the hero. */
.edition-notice {
    margin: 0 0 24px; padding: 14px 18px; border-radius: 12px;
    background: var(--rs-accent-light); border: 1px solid rgba(229, 192, 13, 0.55); color: var(--rs-text);
}
.edition-notice p { margin: 0; }
.edition-notice p + p { margin-top: 4px; }
.edition-notice a { color: var(--rs-text); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.prev-edition-link {
    margin: 12px 0 0 0;
    font-size: 13px;
}

.prev-edition-link a {
    color: var(--rs-text, #161616);
    text-decoration: underline;
}

.hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 24px;
    margin-bottom: 28px;
}

.hero-meta-item {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    color: rgba(255,255,255,0.95);
    display: flex;
    align-items: center;
    gap: 8px;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.hero-meta-icon {
    width: 18px;
    height: 18px;
    opacity: 0.9;
}

.hero-meta-item a {
    color: inherit;
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.5);
}

.hero-meta-item a:hover {
    text-decoration-color: rgba(255,255,255,0.9);
}

/* CTA Button - Bold Golden */
.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 16px 32px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-decoration: none;
    border: none;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}

/* Results first on phones (8 Nov 2026): once the results link is live the hero
   leads with it there; the site button becomes an outline one beneath it.
   Desktop hides it (the race-day panel / results notice sits under the hero). */
.hero-results-cta { display: none; }
@media (max-width: 1023px) {
    .hero-results-cta {
        display: flex; align-items: center; justify-content: center;
        width: 100%; min-height: 52px; padding: 14px 24px; margin: 0 0 10px;
        background: var(--rs-accent); color: var(--rs-accent-text);
        font-family: var(--font-body); font-size: 16px; font-weight: 700; letter-spacing: 0.02em;
        text-decoration: none; border-radius: 30px; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
    }
    .hero-results-cta:active { background: var(--rs-accent-hover); }
    .race-hero a.hero-cta.hero-cta--after-results {
        background: transparent; color: #fff; box-shadow: none;
        border: 1.5px solid rgba(255, 255, 255, 0.7);
        padding-top: 11px; padding-bottom: 11px;
    }
}

.hero-cta:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

.hero-cta svg {
    width: 16px;
    height: 16px;
}

/* Affiliate disclosure under a Register Now button that carries a
   referral code (races.affiliate_url). */
.affiliate-note {
    font-family: var(--font-body);
    font-size: 12.5px;
    line-height: 1.45;
    margin: 10px 0 0;
    color: rgba(255,255,255,0.85);
}
/* Same note on a light background (end CTA card, under the race photo). */
.affiliate-note-dark {
    color: var(--rs-text-secondary);
    margin: 8px 0 0;
}

/* Share row under each Register button (partials/share_nudge.html, share.js).
   On the hero it sits on the photo, so light text; in the end card, dark. After
   a reader clicks Register and returns, .is-prompt asks them to tell their
   running group. */
.share-nudge {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 10px;
    margin-top: 14px;
    font-family: var(--font-body);
    font-size: 13px;
}
.share-nudge-label { color: rgba(255,255,255,0.85); }
.share-nudge-buttons { display: inline-flex; flex-wrap: wrap; gap: 6px; }
.share-chip {
    font: inherit;
    font-weight: 600;
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,0.45);
    background: rgba(0,0,0,0.25);
    color: #fff;
    cursor: pointer;
}
.share-chip:hover { background: rgba(0,0,0,0.45); border-color: #fff; }
.share-chip:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: 2px; }
.share-nudge--end { justify-content: center; margin-top: 18px; }
.share-nudge--end .share-nudge-label,
.share-nudge--raceday .share-nudge-label { color: var(--rs-text-secondary); }
.share-nudge--end .share-chip,
.share-nudge--raceday .share-chip {
    border-color: var(--rs-border);
    background: var(--rs-bg-card, #fff);
    color: var(--rs-text);
}
.share-nudge--end .share-chip:hover,
.share-nudge--raceday .share-chip:hover { border-color: var(--rs-text-muted); background: var(--rs-bg-elevated); }
.share-nudge.is-prompt .share-nudge-label { font-weight: 700; color: #fff; }
.share-nudge--end.is-prompt {
    background: var(--rs-bg-elevated);
    border-radius: 10px;
    padding: 12px;
}
.share-nudge--end.is-prompt .share-nudge-label { color: var(--rs-text); }
.share-section--edit-only { justify-content: flex-end; }
@media (max-width: 600px) {
    /* Three equal buttons on one row under the label (wrapped 2 + 1 before). */
    .share-nudge-buttons { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
    .share-chip { padding: 6px 4px; }
}

/* Second CTA, repeated after the article content — see race-detail.html
   for why. Flat gray box + big button reads as a native-ad unit next to
   the actual ad slots on this page, so this leans on the same "branded
   module" cues as the rest of the site instead: a white card, the accent
   top border every .enriched-section h2 already uses, and the site mark
   so it reads as us talking about this race, not a random ad. */
.rd-register {
    margin: 8px 0 40px;
    padding: 28px 24px 32px;
    text-align: center;
    background: #fff;
    border: 1px solid var(--rs-border);
    border-top: 4px solid var(--rs-accent);
    border-radius: 8px;
}

.end-cta-logo {
    display: block;
    height: 24px;
    width: auto;
    margin: 0 auto 14px;
}

.end-cta-lead {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 0 0 16px;
}

.rd-register .end-cta {
    box-shadow: none;
}

/* ============================================================
   CONTENT SECTION - Clean & Spacious
   ============================================================ */
.race-content {
    background: var(--rs-bg);
    padding: 72px 48px;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
}

/* Subtle shadow to soften the dark hero → white content transition */
.race-detail-layout::before {
    content: '';
    display: block;
    height: 32px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.18), transparent);
    position: relative;
    z-index: 1;
    margin-top: -32px;
    pointer-events: none;
}

/* ============================================================
   DISTANCES - Bold Cards
   ============================================================ */
.distances-section {
    margin-bottom: 32px;
    background: transparent;
    padding: 0;
    border: none;
}

.distances-section h2,
.section-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 0 0 8px 0;
}

.distances-section > p {
    display: block !important;
    font-family: var(--font-body) !important;
    font-size: 15px !important;
    color: var(--rs-text-muted) !important;
    margin-bottom: 24px !important;
}

.distance-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.distance-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 32px;
    min-width: 140px;
    background: var(--rs-bg-card);
    border: 2px solid var(--rs-border);
    border-radius: 30px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 15px;
    color: var(--rs-text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    /* Sponsor-named distances ("24km RUN - Progressive Physiotherapy Group +
       Hip Pocket Warragul Event") are wider than the rail: with nowrap the
       centred text spilled out both sides over the pill borders. */
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.3;
    max-width: 100%;
}

.distance-badge:hover {
    border-color: var(--rs-accent);
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Distance color variants */
.distance-badge.marathon {
    border-color: var(--rs-marathon);
    color: var(--rs-marathon);
}
.distance-badge.marathon:hover {
    background: var(--rs-marathon);
    color: #fff;
    border-color: var(--rs-marathon);
}

.distance-badge.half {
    border-color: var(--rs-half);
    color: var(--rs-half);
}
.distance-badge.half:hover {
    background: var(--rs-half);
    color: #fff;
    border-color: var(--rs-half);
}

.distance-badge.ten-k {
    border-color: var(--rs-10k);
    color: var(--rs-10k);
}
.distance-badge.ten-k:hover {
    background: var(--rs-10k);
    color: #fff;
    border-color: var(--rs-10k);
}

.distance-badge.five-k {
    border-color: var(--rs-5k);
    color: var(--rs-5k);
}
.distance-badge.five-k:hover {
    background: var(--rs-5k);
    color: #fff;
    border-color: var(--rs-5k);
}

.distance-badge.other {
    border-color: var(--rs-border-dark);
    color: var(--rs-text-secondary);
}
.distance-badge.other:hover {
    border-color: var(--rs-accent);
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

.distance-badge.added::after {
    content: ' ✓';
    margin-left: 6px;
}

/* ============================================================
   SCHEDULE TABLE
   ============================================================ */
.schedule-section {
    margin-bottom: 64px;
    background: transparent;
    padding: 0;
    border: none;
}

.schedule-section h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 0 0 24px 0;
    padding-bottom: 16px;
    border-bottom: 3px solid var(--rs-accent);
    display: inline-block;
}

.schedule-table {
    width: 100%;
}

.schedule-table table {
    width: 100%;
    border-collapse: collapse;
}

.schedule-table th {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    text-align: left;
    padding: 14px 0;
    border-bottom: 2px solid var(--rs-border);
}

.schedule-table td {
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--rs-text-secondary);
    padding: 18px 0;
    border-bottom: 1px solid var(--rs-border);
}

.schedule-table tr:last-child td {
    border-bottom: none;
}

.schedule-table tr:hover td {
    color: var(--rs-text);
}

.schedule-table .distance-name {
    font-weight: 600;
    color: var(--rs-text);
}

.schedule-table .leg-breakdown {
    display: block;
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-top: 4px;
}

/* ============================================================
   DESCRIPTION
   ============================================================ */
.description-section {
    margin-bottom: 32px;
    background: transparent;
    padding: 0;
    border: none;
}

.description-section h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 0 0 12px 0;
}

.description-section p {
    font-family: var(--font-body);
    font-size: 16px;
    /* Matched to .enriched-section p — the lead, the section prose and the FAQ
       answers were running at 1.8 / 1.65 / 1.7 on the same page. */
    line-height: 1.65;
    color: var(--rs-text-secondary);
    margin: 0;
}

/* First block under the hero — tighten the gap so the calendar widget below it
   still peeks above the fold and the page doesn't read as if it has ended. */
.description-section--lead {
    margin-bottom: 32px;
}

.description-section--lead p {
    font-size: 17px;
    color: var(--rs-text);
}

/* Hide redundant sections */
.details-section {
    display: none;
}

.organizer-section {
    display: none;
}

/* ============================================================
   SHARE SECTION
   ============================================================ */
.share-section {
    /* This has a border-top acting as a divider but had no margin above it, so
       the rule sat flush against whatever preceded it. That was invisible while
       this section lived between the FAQ and the guides; moving it to the end
       put it directly under the "View all NT races" buttons and the rule cut
       through their rounded corners. 48px is the divider spacing the guides and
       related-races sections already use. */
    margin-top: 48px;
    padding: 24px 0;
    border-top: 1px solid var(--rs-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.share-left {
    display: flex;
    align-items: center;
    gap: 12px;
    /* At 320px the label plus five share buttons ran 3px past the viewport and
       pushed the whole document sideways. Let the row wrap instead. */
    flex-wrap: wrap;
}

.share-label {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--rs-text-muted);
}

.share-buttons {
    display: inline-flex;
    gap: 16px;
    flex-wrap: wrap;
}

.share-btn {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    color: var(--rs-text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    /* Were 21px tall — the smallest tap targets on the page, against a 44px
       floor applied everywhere else. Padding, not height, so the row still
       reads as plain text links. */
    padding: 12px 10px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    transition: color 0.15s ease;
}

.share-btn:hover {
    color: var(--rs-accent-hover);
}

.share-btn.whatsapp:hover {
    color: #25D366;
}

.share-right {
    display: flex;
    align-items: center;
}

.suggest-edit-link {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--rs-text-muted);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 12px 4px;
    transition: color 0.15s ease;
}

.suggest-edit-link:hover {
    color: var(--rs-text);
}

/* On a phone the text links wrapped into a ragged 3+1 with big gaps and read
   as stray words. Two columns of outlined buttons read as one control. */
@media (max-width: 600px) {
    .share-section,
    .share-left {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .share-buttons {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .share-btn {
        justify-content: center;
        border: 1px solid var(--rs-border);
        border-radius: 10px;
        background: var(--rs-bg-card);
        padding: 10px;
    }

    .share-right {
        justify-content: center;
    }
}

/* ============================================================
   FOOTER
   ============================================================ */
.race-detail-body footer:not(.landing-footer) {
    background: var(--rs-text) !important;
    border-top: none !important;
    padding: 40px !important;
    text-align: center;
}

.race-detail-body footer:not(.landing-footer) p {
    font-family: var(--font-body);
    font-size: 14px;
    color: rgba(255,255,255,0.6) !important;
}

.race-detail-body footer:not(.landing-footer) a {
    color: rgba(255,255,255,0.8) !important;
    text-decoration: none;
}

.race-detail-body footer:not(.landing-footer) a:hover {
    color: var(--rs-accent-ink) !important;
}

/* ============================================================
   HIDE SIDEBAR
   ============================================================ */
.my-calendar-sidebar {
    display: none !important;
}

.race-header {
    display: none;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .hero-content {
        /* Keeps the reserved chrome height from the base rule — a `padding`
           shorthand here silently reset padding-top to 0 and put the title
           back under the header and breadcrumb at 769-1024px. */
        padding: 120px 32px 40px;
    }

    .race-content {
        padding: 56px 32px;
    }
}

@media (max-width: 768px) {
    /* The hero used to eat 50vh on top of the 68px fixed nav, pushing every word
       of actual race information below the fold. Mobile is the majority of organic
       traffic and only ~24% of those sessions reached 90% page depth (vs ~75% on
       desktop), so the first screen needs to show content, not just artwork. */
    .race-hero {
        /* Content-driven, same reasoning as the desktop rule above */
        min-height: clamp(260px, 38vh, 380px);
        height: auto;
        max-height: none;
    }

    .hero-content {
        padding: 0 20px 24px;
    }

    .hero-title {
        font-size: clamp(2rem, 9vw, 3rem);
    }

    .hero-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .hero-cta {
        width: 100%;
        justify-content: center;
        padding: 14px 24px;
    }

    .race-content {
        padding: 40px 20px;
    }

    /* Was a rigid 2-column grid: 19 distances became 10 rows and 678px of
       phone. Letting each badge size to its label packs 3-4 per row for the
       short ones and still gives "Half Marathon" a full row when it needs it. */
    .distance-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .distance-badge {
        padding: 12px 16px;
        font-size: 13px;
        min-width: 0;
        flex: 0 1 auto;
        border-radius: 25px;
    }

    /* Mobile schedule cards */
    .schedule-table table { display: block; }
    .schedule-table thead { display: none; }
    .schedule-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    .schedule-table tr {
        display: flex;
        flex-direction: column;
        padding: 18px;
        background: var(--rs-bg-elevated);
        border: 1px solid var(--rs-border);
        border-radius: 12px;
    }
    .schedule-table td {
        border: none;
        padding: 4px 0;
    }

    .race-detail-body header {
        padding: 0 16px !important;
        height: 50px !important;
        border-bottom: none !important;
        background: #0c0c0c !important;
    }

    .race-detail-body .site-logo {
        height: 28px !important;
    }

    .race-detail-body .header-text .site-title {
        font-size: 1.05rem !important;
    }

    .race-detail-body .nav-links {
        display: flex !important;
        top: 0 !important;
        padding: 0 16px !important;
        height: 50px !important;
        justify-content: flex-end !important;
    }

    .race-detail-body .nav-links .nav-left {
        display: none !important;
    }

    .race-detail-body .nav-links .nav-right {
        position: absolute !important;
        right: 16px !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
    }

    .race-detail-body .mobile-nav-bar {
        top: 50px !important;
        background: #0c0c0c !important;
        padding-top: 0 !important;
        padding-bottom: 3px !important;
    }

    .race-detail-body .race-hero {
        margin-top: 68px;
    }
}

@media (max-width: 480px) {
    .hero-title {
        font-size: 1.8rem;
    }

    .hero-meta-item {
        font-size: 13px;
    }
}

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
    .race-hero {
        height: auto;
        min-height: auto;
        max-height: none;
    }

    .race-hero::before {
        display: none;
    }

    .hero-cta,
    .share-section,
    .race-detail-body header,
    .race-detail-body .nav-links {
        display: none !important;
    }
}

/* ============================================================
   ENRICHED CONTENT SECTIONS
   Matching the clean, open design language of the site
   ============================================================ */
.enriched-section {
    /* Was 48px. Every gap on the page was the same generous 48px, which is what
       made short sections read as islands with more air than content. */
    margin-bottom: 32px;
    background: transparent;
    padding: 0;
    border: none;
}

.enriched-section h2 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--rs-text);
    /* 16px margin + 12px padding put 28px of air under every heading. */
    margin: 0 0 10px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--rs-accent);
    display: inline-block;
}

.enriched-section p {
    font-family: var(--font-body);
    font-size: 16px;
    /* 1.8 is a magazine measure; at 16px it added ~3px of leading to every
       line, which over a page of prose is most of a screen. */
    line-height: 1.65;
    color: var(--rs-text-secondary);
    margin: 0;
}

/* Quick Facts Grid - Card-based layout */
.quick-facts-section h2 {
    display: block;
    width: 100%;
    margin-bottom: 20px;
}

.quick-facts-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
}

/* A label and a short value in a bordered card, stacked, cost ~130px a row and
   7 facts filled 546px of phone. As a key/value row the same 7 facts take about
   half that and read as one table instead of seven cards. */
.fact-item {
    /* Label above value. The sidebar is ~300px; right-aligning a value that
       wraps to two lines ("Yes, with the 2km and 5km options") reads badly. */
    display: flex;
    flex-direction: column;
    gap: 3px;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 1px solid var(--rs-border-light, var(--rs-border));
    border-radius: 0;
}

.fact-item:first-child { padding-top: 0; }
.fact-item:last-child { border-bottom: none; padding-bottom: 0; }

.fact-value { text-align: left; }

/* No hover lift: these are rows in a list now, not cards, and nothing here is
   clickable. */

.fact-label {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}

.fact-value {
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    color: var(--rs-text);
    line-height: 1.4;
}

/* FAQ Accordion - Clean, interactive */
.faqs-section h2 {
    display: block;
    width: 100%;
    margin-bottom: 20px;
}

.faq-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.faq-item {
    background: var(--rs-bg);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    overflow: hidden;
    padding: 18px 20px;
}

.faq-question {
    margin: 0 0 8px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    color: var(--rs-text);
}

.faq-item p {
    margin: 0;
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.65;
    color: var(--rs-text-secondary);
}

/* Last Updated - Subtle footer element */
.last-updated {
    font-family: var(--font-body);
    font-size: 0.85rem;
    color: var(--rs-text-muted);
    text-align: left;
    margin: 32px 0 48px;
    padding-top: 16px;
    border-top: 1px solid var(--rs-border);
}

.last-updated::before {
    content: '✓ ';
    color: var(--rs-accent-ink);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .enriched-section {
        margin-bottom: 36px;
    }

    .enriched-section h2 {
        font-size: 1.15rem;
    }

    /* Key/value rows, same as the desktop rail — see .fact-item. The 2-column
       card grid stacked label over value and cost ~130px per fact. */
    .quick-facts-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .fact-label {
        font-size: 0.7rem;
    }

    .fact-value {
        font-size: 0.95rem;
    }

    .faq-item {
        padding: 16px;
    }

    .faq-question {
        font-size: 0.95rem;
    }

    .faq-item p {
        font-size: 14px;
    }
}

/* ===================================================
   RELATED GUIDES SECTION
   =================================================== */
/* parkruns near this race (parkrun.nearby_parkruns) */
.nearby-parkruns-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--rs-border);
}
.nearby-parkruns-section h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--rs-text);
    margin: 0 0 6px;
}
.nearby-parkruns-section p { margin: 0; color: var(--rs-text-secondary); max-width: 65ch; }
.nearby-parkruns { list-style: none; margin: 14px 0 0; padding: 0; display: grid; gap: 8px; }
.nearby-parkruns li {
    display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 12px;
    padding: 12px 16px; border-radius: 12px; background: var(--rs-bg-elevated);
}
.nearby-parkruns a { font-weight: 700; color: var(--rs-text); text-decoration: underline; text-decoration-color: var(--rs-border-dark); text-underline-offset: 3px; }
.nearby-parkruns a:hover { text-decoration-color: var(--rs-text); }
.nearby-parkruns span { font-size: 0.9rem; color: var(--rs-text-muted); font-variant-numeric: tabular-nums; }
a.nearby-parkruns-all { display: inline-block; margin-top: 12px; font-weight: 600; color: var(--rs-text); text-decoration: underline; text-underline-offset: 3px; }

.related-guides-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--rs-border);
}

.related-guides-section h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: var(--rs-text);
    margin: 0 0 20px;
}

.related-guides-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.related-guide-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 0;
    border-bottom: 1px solid var(--rs-border);
    text-decoration: none;
    transition: background 0.15s ease;
    margin: 0 -12px;
    padding-left: 12px;
    padding-right: 12px;
    border-radius: 6px;
}

.related-guide-card:hover {
    background: var(--rs-bg-elevated);
}

.related-guide-card:hover .related-guide-arrow {
    transform: translateX(4px);
    color: var(--rs-text);
}

.related-guide-body {
    flex: 1;
    min-width: 0;
}

.related-guide-category {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-accent-ink);
    margin-bottom: 4px;
}

.related-guide-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1rem;
    color: var(--rs-text);
    line-height: 1.3;
    margin-bottom: 3px;
}

.related-guide-desc {
    font-size: 0.875rem;
    color: var(--rs-text-muted);
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.related-guide-arrow {
    font-size: 1.1rem;
    color: var(--rs-text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

/* ===================================================
   RELATED RACES SECTION
   =================================================== */
.related-races-section {
    margin-top: 48px;
    padding-top: 32px;
    border-top: 1px solid var(--rs-border);
}

.related-races-section h2 {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rs-text);
    margin-bottom: 20px;
}

.related-races-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.related-race-card {
    display: flex;
    flex-direction: column;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 10px;
    padding: 16px;
    text-decoration: none;
    transition: all 0.2s ease;
    overflow: hidden;
}

.related-race-card.has-thumb {
    padding: 0;
}

.related-race-card:hover {
    border-color: var(--rs-accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

/* Thumbnail image at top of card */
.related-race-thumb {
    width: 100%;
    aspect-ratio: 2 / 1;     /* the shape most race images arrive in */
    overflow: hidden;
    flex-shrink: 0;
    background: var(--rs-bg-elevated);
}
.related-race-thumb img.fit-contain { object-fit: contain; padding: 4%; box-sizing: border-box; }

.related-race-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}

.related-race-card:hover .related-race-thumb img {
    transform: scale(1.05);
}

/* Text body — same padding whether card has thumb or not */
.related-race-body {
    padding: 14px 16px 16px;
}

.related-race-card:not(.has-thumb) .related-race-body {
    padding: 0;
}

.related-race-date {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rs-accent-ink);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.related-race-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
    line-height: 1.3;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.related-race-location {
    font-size: 0.85rem;
    color: var(--rs-text-muted);
    margin-bottom: 8px;
}

.related-race-distances {
    font-size: 0.75rem;
    color: var(--rs-text-secondary);
    padding: 4px 8px;
    background: var(--rs-bg-elevated);
    border-radius: 4px;
    display: inline-block;
}

.related-races-cta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    /* Were inline-blocks with no row gap: on a phone the second button
       wrapped straight onto the first's bottom edge. */
    gap: 10px;
    margin-top: 16px;
}

.btn-view-all {
    display: inline-block;
    padding: 12px 24px;
    background: var(--rs-accent);
    color: #000;
    font-weight: 600;
    font-size: 0.9rem;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-view-all:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-1px);
}

.btn-view-alt {
    display: inline-block;
    padding: 8px 16px;
    background: transparent;
    color: var(--rs-accent-ink);
    font-weight: 500;
    font-size: 0.85rem;
    border: 1.5px solid var(--rs-accent);
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-view-alt:hover {
    background: var(--rs-accent);
    color: #000;
    transform: translateY(-1px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .related-races-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }

    .related-race-card {
        padding: 14px;
    }

    .related-race-card.has-thumb {
        padding: 0;
    }

    .related-race-card.has-thumb .related-race-body {
        padding: 12px 14px 14px;
    }

    .related-race-name {
        font-size: 0.9rem;
    }

    .related-race-location {
        font-size: 0.8rem;
    }
}

/* One column of 16:9-topped cards put six related races at ~332px each — 2000px
   of phone, a third of the whole page, for what is navigation rather than
   content. As rows with a small thumb the same six fit in about 550px and you
   can actually compare them. Matches the list view on race search. */
@media (max-width: 600px) {
    .related-races-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .related-race-card,
    .related-race-card.has-thumb {
        flex-direction: row;
        align-items: center;
        gap: 12px;
        padding: 10px;
    }

    .related-race-thumb {
        width: 84px;
        aspect-ratio: 4 / 3;
        border-radius: 8px;
        flex-shrink: 0;
    }

    .related-race-card.has-thumb .related-race-body,
    .related-race-body {
        min-width: 0;
        padding: 0;
    }

    /* Name and location identify the race, so one line each with an ellipsis
       keeps rows scannable. The distances are the thing people are actually
       comparing, so they wrap rather than truncate — an ellipsis there was
       hiding "Half Marathon" behind a "…". */
    .related-race-location {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* The name keeps the base 2-line clamp: with nowrap + ellipsis on a
       -webkit-box, iOS Safari cut it mid-word with no "…" ("Olivia's Walk and
       Run for Wellnes"). Two lines fit every name in the thumb row. */
    .related-race-name {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .related-race-distances {
        white-space: normal;
        line-height: 1.4;
    }
}

/* ===================================================
   LOGIN MODAL
   =================================================== */
.login-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.login-modal-content {
    position: relative;
    background: #fff;
    border-radius: 16px;
    width: 100%;
    max-width: 420px;
    padding: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-height: 90vh;
    overflow-y: auto;
}

.login-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 24px;
    color: #666;
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s;
}

.login-modal-close:hover {
    background: #f0f0f0;
    color: #333;
}

.login-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 24px;
    border-bottom: 2px solid #e5e5e5;
    padding-bottom: 0;
}

.login-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: none;
    font-size: 1rem;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: all 0.2s;
}

.login-tab:hover {
    color: #333;
}

.login-tab.active {
    color: var(--rs-accent-ink);
    border-bottom-color: var(--rs-accent);
}

.login-panel {
    display: none;
}

.login-panel.active {
    display: block;
}

.oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.oauth-buttons .btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
}

.btn-google {
    background: #fff;
    border: 1px solid #ddd;
    color: #333;
}

.btn-google:hover {
    background: #f8f8f8;
    border-color: #ccc;
}

.login-divider {
    display: flex;
    align-items: center;
    margin: 20px 0;
    color: #999;
    font-size: 0.85rem;
}

.login-divider::before,
.login-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #e5e5e5;
}

.login-divider span {
    padding: 0 16px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-weight: 500;
    color: #333;
    font-size: 0.9rem;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    outline: none;
    border-color: var(--rs-accent);
}

.form-error {
    display: none;
    background: #fee;
    color: #c00;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

.form-success {
    display: none;
    background: #d1fae5;
    color: #065f46;
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* .btn-full, .btn-primary and its :hover/:disabled states were redefined here,
   unscoped, so they applied to the whole page. They only ever styled the shared
   login modal, and they gave this page's modal button an 8px radius and its own
   padding where every other page used 12px. All four now come from style.css. */

/* Mobile responsive */
@media (max-width: 480px) {
    .login-modal-content {
        padding: 24px 20px;
        margin: 10px;
    }

    .login-tabs {
        gap: 4px;
    }

    .login-tab {
        padding: 10px 12px;
        font-size: 0.9rem;
    }
}

/* ============================================================
   SPONSOR SECTION — Gold/Diamond featured-listing perk (see /advertise)
   Styled standalone rather than relying on the desktop-only .rd-rail >
   section rule, since paid content should look intentional at every width,
   not just fall into the same plain-flow block as Quick Facts on mobile.
   ============================================================ */

@media (min-width: 1024px) {
    /* Inside the rail the generic .rd-rail > section rule would otherwise
       double the border/background - the card already provides its own. */

}

/* ============================================================
   RACE PHOTO — visible, not just in og:image (see race-detail.html
   for why this needs to actually render, not just live in a meta tag)
   ============================================================ */
.race-photo-section {
    border-radius: 14px;
    overflow: hidden;
    margin-bottom: 20px;
}

.race-photo-section a {
    display: block;
}

.race-photo-section img {
    display: block;
    width: 100%;
    /* Natural shape (23 Sep 2026): the old fixed 305/234 contain box put grey
       bars round every 2:1 image. A very tall flyer is capped, and then
       fitRaceImage() (utils.js) puts it on its own edge colour. */
    height: auto;
    max-height: 440px;
    object-fit: contain;
    transition: opacity 0.15s ease;
}
.race-photo-section img.fit-contain { padding: 3%; box-sizing: border-box; }
@media (max-width: 1023px) {
    /* Full-width on a phone, a square image would be ~350px tall; cap it and
       let fitRaceImage() centre it on its own edge colour. */
    .race-photo-section img { max-height: 260px; }
}

.race-photo-section a:hover img {
    opacity: 0.9;
}

/* ============================================================
   AD CONTAINERS
   ============================================================ */
.ad-container {
    text-align: center;
    overflow: hidden;
}

/* Ad containers. Google's data-ad-status doc: "If ad units aren't initially visible on
   the page, we may not execute the ad request" - and a height:0 /
   overflow:hidden box at push time counts as not visible. So: a small
   reserved band until AdSense answers (Google's own CLS advice), grow to
   the fill, and remove the container on a reported no-fill. */
.ad-race-detail {
    margin: 0;
    padding: 0;
    /* The reserve is a MIN height on the container and nothing on the <ins>:
       a responsive (format="auto") unit sizes its request to the box it's
       pushed into, and with height:100px here plus min-height:100px on the
       <ins> every phone request was 350x100 (280x60 on a 320px screen) - a
       sliver. Measured 23 Sep 2026: this shape requests 350x280 and still
       fires (the band keeps it "visible" for Google's request rule). */
    min-height: var(--ad-reserve);   /* see tokens.css */
    overflow: hidden;
}

.ad-race-detail:has(ins[data-ad-status="filled"]) {
    margin: 24px 0;
    height: auto;
    overflow: visible;
}

.ad-race-detail:has(ins[data-ad-status="unfilled"]) {
    display: none;
}

/* In-content units (mid-article + end-of-content). AdSense serves a responsive
   'auto' unit into whatever height the box allows, so an uncapped full-width
   box gets a half-page slab dropped into the middle of the article. Cap it to
   a large-leaderboard band and centre it on a reader-width measure. The markup
   also sets data-full-width-responsive="false" so Google picks a horizontal
   format rather than the tallest fill. (A filled-state max-height used to
   backstop that; it clipped real creatives, so it's gone - see below.)

   The width cap is applied UNCONDITIONALLY (not only once filled): AdSense
   measures the <ins> at request time, and when the box was still the full
   896-1304px column it picked a 970-wide creative that the post-fill 728px
   cap then clipped on the right. */
.ad-race-detail-incontent {
    max-width: 728px;
    margin-left: auto;
    margin-right: auto;
}
/* No height clip once filled (removed 23 Sep 2026): requests are now 280px
   tall at most (728x280 / 350x280 - see .ad-race-detail), and native
   creatives add a strip below that, so max-height:280px + overflow:hidden cut
   off the bottom of real ads (the advertiser's "Open" button) - which AdSense
   policy doesn't allow either. */
.ad-race-detail-incontent:has(ins[data-ad-status="filled"]) {
    overflow: visible;
    margin: 32px auto;
}

/* Rail unit. Only capped once the two-column grid engages: below 1024px the rail
   collapses inline and the unit should use the full column like any other mobile
   ad. On desktop the rail is 340-360px, so cap at a 300x250 rather than letting
   data-full-width-responsive pick a taller fill that would run past the dead
   space this slot exists to occupy (median 476px across live race pages). */
@media (min-width: 1024px) {
    /* Same measure-before-fill rule as .ad-race-detail-incontent: cap the
       width always, or a 336x280 picked for the 360px rail gets clipped. */
    .ad-rail {
        max-width: 300px;
        margin-left: auto;
        margin-right: auto;
    }
    .ad-rail:has(ins[data-ad-status="filled"]) {
        margin: 24px auto 0;
    }

    /* A hint, not a hard clip: the generic .ad-race-detail:has(filled) rule
       flips overflow back to visible, so a fill a little over 250 (a 300x250
       creative plus its attribution strip, ~287) shows in full rather than
       being cut. Kept because it still nudges AdSense's size selection. */
    .ad-rail ins {
        max-height: 250px;
    }
}

/* ============================================================
   TWO-COLUMN LAYOUT  (added in the density redesign)

   The page was one 804px column inside a 1440px viewport — 55% of the
   width, and 4.5 screens of scrolling to read it. Everything below is
   about putting the actions and the key facts beside the prose instead
   of two screens under it. Phones keep the single column.
   ============================================================ */
.rd-grid {
    display: block;   /* phones: plain flow, DOM order = rail then main */
}

/* .race-content caps at 900px with 48px padding, which is where the 804px
   measured column came from. That cap is right for a single prose column and
   too narrow for a column plus a rail, so it opens up only once the grid
   actually engages. Below 1024px nothing changes. */
@media (min-width: 1024px) {
    .race-content {
        max-width: 1240px;
        padding: 56px 48px;
    }
}

@media (min-width: 1440px) {
    .race-content { max-width: 1400px; }
}

/* Cap the reading measure. Full-bleed prose at 1240px is ~150 characters
   a line; this keeps the paragraphs readable while the rail uses the rest. */
.race-detail-body .description-section--lead p,
.rd-main .enriched-section p,
.rd-main .description-section p {
    max-width: 68ch;
}

@media (min-width: 1024px) {
    /* A floated rail rather than a grid (19 Oct 2026). Mediavine's sticky sidebar
       box is at least 1.6x the window height, so on a race with a short article
       the rail ran 500-1100px past it; in a grid that became a white band before
       the full-width sections. Floated, the rail can overhang: the CTA, FAQ,
       parkruns etc. sit beside the overhang (they're flow-root, below) and go
       full width once past it. The rail is first in the DOM so it starts level
       with "About This Event"; phones reorder by flex order further down. */
    .race-content { display: flow-root; }
    /* A grid again (24 Oct 2026): everything after the article is inside .rd-main now, so
       the rail's grid cell is the full height of the page's content from the first paint.
       Mediavine cuts its sticky sidebar into ~1,400px slots once, when it starts, from the
       sidebar's height then; the old float was stretched by a script after load, so
       Mediavine sometimes measured it short and made one slot for 7,000px (SMC Road Race). */
    /* grid-template-rows: the rail spans both rows and is far taller than the
       article (Mediavine's sidebar ads), and a spanning item's extra height is
       shared across all the auto rows it spans - row 1 ("About This Event")
       grew a ~250px blank band under it (Port Fairy, 28 Oct 2026). With row 2
       as 1fr, row 1 stays the height of About and row 2 takes all of it. */
    .rd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; grid-template-rows: auto auto 1fr; column-gap: 40px; align-items: stretch; }
    /* The rail runs from the top of the grid, beside the lead card (11 Nov 2026, John:
       sidebar ads right under the hero). Under Journey the lead band spanned both
       columns (8 Nov) and the sidebar started beside the events list. */
    .rd-rail { grid-column: 2; grid-row: 1 / span 3; width: auto; margin: 0; }
    .rd-grid > .rtop { grid-column: 1; grid-row: 1; min-width: 0; }
    .rd-lead { grid-column: 1; grid-row: 2; margin-right: 0; min-width: 0; }
    .rd-main { grid-column: 1; grid-row: 3; margin-right: 0; min-width: 0; }

    /* Deliberately NOT sticky. A sticky rail needs max-height + overflow-y to
       stay reachable, and on a race with 19 distances that put Quick Facts
       inside an inner scroll area where nothing hinted it existed — hiding
       data on a page whose whole purpose here is to show more of it. The rail
       scrolls with the page instead. */

    /* Rail sections are cards so the column reads as a unit, not as two
       stray headings floating beside the article. */
    .rd-rail > section {
        background: var(--rs-bg-card);
        border: 1px solid var(--rs-border);
        border-radius: 14px;
        padding: 20px;
        margin-bottom: 20px;
    }

    .rd-rail > section:last-child { margin-bottom: 0; }

    .rd-rail h2 {
        font-size: 1.05rem;
        margin: 0 0 14px;
    }

    /* Let badges size to their label so a 19-distance race packs 3 per row
       instead of 2, which is ~4 fewer rows of rail. */
    .rd-rail .distance-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
    }

    .rd-rail .distance-badge {
        flex: 0 1 auto;
        width: auto;
        min-width: 0;
        padding: 10px 14px;
        /* Still a tap target on a touch laptop, and consistent with the 44px
           floor applied to every other control on the site. */
        min-height: 44px;
        font-size: 0.85rem;
    }
}

/* Wider still: give the prose a little more room before it stops growing. */
@media (min-width: 1440px) {
    .rd-grid { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 48px; }
}

/* ============================================================
   FAQ — two columns on wide screens

   The answers stay expanded on purpose: collapsing them made the page
   look thin, and the goal here is more information on screen at once,
   which an accordion works against. Two columns halves the block's
   height (~840px -> ~450px) without hiding a single answer.
   ============================================================ */
@media (min-width: 1024px) {
    .faqs-section .faq-list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 16px;
        align-items: start;
    }
}

/* ===========================================================================
   Organiser panel — the conversion point for race directors.
   Two mutually exclusive states rendered by race-detail.html: an owner
   management panel, or a claim pitch on an unclaimed race. Replaces a pair of
   small text links that sat next to "Suggest an edit" and were easy to miss.
   =========================================================================== */
.organiser-panel {
    margin: 32px 0 8px;
    padding: 24px 26px;
    border-radius: 14px;
    border: 1px solid var(--rs-border, var(--border));
    background: var(--rs-bg-card, var(--surface));
}

.organiser-panel h2 {
    margin: 0 0 10px;
    font-size: 1.15rem;
    color: var(--rs-text, var(--text-primary));
}

/* Claim state gets the accent edge — it's the one asking for an action from
   someone who has no relationship with the site yet. */
.organiser-panel-claim {
    border: 1.5px dashed var(--rs-accent, #D52B1E);
}

.organiser-panel-owner {
    border-left: 4px solid var(--rs-accent, #D52B1E);
}

.organiser-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.organiser-panel-head h2 { margin: 0; }

.organiser-panel-lead {
    margin: 0 0 14px;
    font-size: 0.94rem;
    line-height: 1.55;
    color: var(--rs-text-secondary, var(--text-secondary));
}

.organiser-benefits {
    list-style: none;
    padding: 0;
    margin: 0 0 18px;
}

.organiser-benefits li {
    position: relative;
    padding: 4px 0 4px 22px;
    font-size: 0.9rem;
    line-height: 1.45;
    color: var(--rs-text-secondary, var(--text-secondary));
}

.organiser-benefits li::before {
    content: '✓';
    position: absolute;
    left: 0;
    font-weight: 700;
    color: var(--rs-accent, #D52B1E);
}

.organiser-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.organiser-btn {
    display: inline-block;
    padding: 10px 18px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none !important;
    border: 1px solid var(--rs-border, var(--border));
    background: var(--rs-bg-elevated, var(--background));
    color: var(--rs-text, var(--text-primary)) !important;
}

.organiser-btn:hover { border-color: var(--rs-accent, #D52B1E); }

.organiser-btn-primary {
    background: var(--rs-accent, #D52B1E);
    color: #0A2540 !important;
    border-color: transparent;
}

.organiser-btn-quiet {
    background: transparent;
    border-color: transparent;
    color: var(--rs-text-muted, var(--text-muted)) !important;
    padding-left: 6px;
    padding-right: 6px;
}

@media (max-width: 640px) {
    .organiser-panel { padding: 18px 16px; margin: 24px 0 8px; }
    .organiser-panel h2 { font-size: 1.05rem; }
    /* Full-width stacked buttons beat a cramped wrapped row on a phone. */
    .organiser-actions { flex-direction: column; align-items: stretch; }
    .organiser-btn { text-align: center; }
}

/* ============================================================
   READING ORDER + AD SPACING (23 Sep 2026 review)

   Phones/tablets: the rail used to stack above the article, so the schedule
   table people came for sat ~3 screens down, behind the photo, the calendar
   buttons, seven Quick Facts rows and an ad. display:contents lets the rail's
   and main column's sections join one flex column and be ordered directly:
   About -> Schedule & fees -> Add to calendar -> everything else in DOM order.
   Sections only carry margin-bottom, so flex's non-collapsing margins don't
   double any gaps.

   Desktop: Mediavine's sidebar ads follow Add to Your Calendar in the rail.
   ============================================================ */
@media (max-width: 1023px) {
    .rd-grid { display: flex; flex-direction: column; }
    .rd-rail, .rd-main { display: contents; }
    .rd-grid > .rtop { order: -4; }
    .rd-lead { order: -3; }
    /* .rd-top (photo + calendar card, schedule, facts) right after About; inside
       it the schedule leads on a phone, as before. */
    .rd-grid .rd-top { order: -2; display: flex; flex-direction: column; }
    .rd-top .schedule-section { order: -1; }

    /* The 250x250 rail square is inline-block; centre it rather than leave it
       hugging the left edge of a 390px screen. */
    .ad-rail { margin-left: auto; margin-right: auto; text-align: center; }

    /* In a flex column an item with auto side margins shrinks to its content
       instead of stretching - the in-content units (empty until filled) came
       out 106px wide, too narrow for AdSense to request anything. Give them
       the full column (their max-width still caps them at 728px). */
    .rd-grid .ad-race-detail-incontent { width: 100%; }
}

@media (min-width: 1024px) {
    /* The rail holds only a sponsor card, if any; Mediavine appends its sidebar
       ads after it, so they start level with the article (20 Oct 2026). */
    /* A plain block like .journey-rail (24 Oct 2026): as a flex column Mediavine built one
       sidebar slot for the whole page (SMC Road Race) where the guides got one per ~1,400px */
    .rd-rail { display: block; min-height: 1px; }
}

/* Events & entry (29 Oct 2026): one row per distance - name, day and start,
   fee, Save - replacing the "Save this race" pills and the schedule table that
   repeated them. The race photo sits on its own above it; the old photo-beside-
   pills grid left ~340px empty under the photo on a 9-event race. */
/* Lead card (9 Nov 2026, John): About This Event and the race image in one
   bordered card spanning the page above the article and the rail. Desktop: image
   panel on the left, About on the right. Phones: image on top, About below (John,
   9 Nov 2026). DOM order stays text then photo; both layouts reorder visually.
   The image is absolutely placed so the text, not the image's own height, sets the
   card's height; fitRaceImage() paints a logo's edge colour on its parent. */
.rd-lead {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 10px 28px -14px rgba(0, 0, 0, 0.14);
}
.rd-lead-text { padding: 22px 20px 24px; }
.rd-lead-text h2 { margin-bottom: 10px; }
.rd-lead-text p { max-width: 68ch; }
.rd-lead--photo { display: flex; flex-direction: column; }
.rd-lead--photo .race-photo-section {
    order: -1;
    margin: 0;
    border-radius: 0;
    border-bottom: 1px solid var(--rs-border);
    background: var(--rs-bg-elevated);
}
@media (min-width: 1024px) {
    .rd-lead--photo {
        display: grid;
        grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
        grid-template-areas: "photo text";
        align-items: stretch;
    }
    .rd-lead-text { padding: 36px 44px 38px; }
    .rd-lead--photo .rd-lead-text { grid-area: text; align-self: center; }
    .rd-lead--photo .race-photo-section {
        grid-area: photo;
        position: relative;
        min-height: 280px;
        border-bottom: 0;
        border-right: 1px solid var(--rs-border);
    }
    .rd-lead--photo .race-photo-section a { position: absolute; inset: 0; }
    .rd-lead--photo .race-photo-section img {
        position: absolute; inset: 0;
        width: 100%; height: 100%; max-height: none;
        object-fit: cover;
    }
    .rd-lead--photo .race-photo-section img.fit-contain { object-fit: contain; padding: 7%; }
    /* Whole photo, never cropped; the bands around it are the same photo,
       blurred (set as --rd-photo on the panel; logos don't get one). */
    .rd-lead--photo .race-photo-section { overflow: hidden; }
    .rd-lead--photo .race-photo-section::before {
        content: ''; position: absolute; inset: -40px;
        background: var(--rd-photo, none) center / cover no-repeat;
        filter: blur(24px) saturate(1.1) brightness(0.92);
    }
    .rd-lead--photo .race-photo-section img:not(.fit-contain) { object-fit: contain; }
}
.rd-top > .race-photo-section { margin: 0 0 28px; }
/* A photo fills the column as a 12:5 banner; a logo or poster keeps its fitted,
   uncropped shape (fitRaceImage paints its edge colour), just shorter. */
.rd-top > .race-photo-section img { max-height: 360px; }
.rd-top > .race-photo-section img[data-kind="photo"]:not(.fit-contain) { aspect-ratio: 12 / 5; height: auto; max-height: none; object-fit: cover; }
.events-section { margin-bottom: 48px; }
.events-head { margin-bottom: 12px; }
.events-section .events-head h2 { margin-bottom: 6px; }
.events-note { margin: 10px 0 0; font-size: 0.9rem; color: var(--rs-text-muted); }
.events-series-note { margin: 0 0 10px; color: var(--rs-text-secondary); }
.series-rounds { margin: 0 0 16px; }
.series-rounds label { display: block; font-weight: 600; margin-bottom: 6px; }
.series-rounds select {
    min-height: 44px; min-width: 14rem; padding: 8px 10px;
    border: 1px solid var(--rs-border-dark); border-radius: 8px;
    background: var(--rs-bg-input); color: var(--rs-text); font: inherit;
}
.series-rounds details { margin-top: 10px; }
.series-rounds summary { cursor: pointer; }
.series-rounds ul { margin: 8px 0 0; padding-left: 1.2rem; }
.series-rounds li.is-past { color: var(--rs-text-muted); }

.events-list { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--rs-border); }
.events-day {
    margin: 22px 0 8px; font-family: var(--font-body, Inter, system-ui, sans-serif);
    font-size: 0.95rem; font-weight: 700; color: var(--rs-text); letter-spacing: 0.01em;
}
.events-days > .events-day:first-child { margin-top: 4px; }
.event-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 10.5rem 4.5rem auto;
    grid-template-areas: "name when fee save";
    align-items: center;
    column-gap: 20px;
    padding: 14px 10px;
    border-bottom: 1px solid var(--rs-border);
    transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.events-list--nofee .event-row { grid-template-columns: minmax(0, 1fr) 10.5rem auto; grid-template-areas: "name when save"; }
.events-list--past .event-row { grid-template-columns: minmax(0, 1fr) 10.5rem 4.5rem; grid-template-areas: "name when fee"; }
.events-list--past.events-list--nofee .event-row { grid-template-columns: minmax(0, 1fr) 10.5rem; grid-template-areas: "name when"; }
.event-name { grid-area: name; min-width: 0; }
.event-short { display: block; font-weight: 700; font-size: 1rem; color: var(--rs-text); line-height: 1.3; }
.event-tag {
    display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px;
    font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; line-height: 1.4; vertical-align: 2px;
    background: var(--rs-accent-light); color: #6b5300; border: 1px solid rgba(229, 192, 13, 0.55);
}
.event-full { display: block; margin-top: 2px; font-size: 0.85rem; font-weight: 500; color: var(--rs-text-muted); line-height: 1.35; overflow-wrap: anywhere; }
.event-when { grid-area: when; display: flex; flex-wrap: wrap; column-gap: 6px; font-size: 0.92rem; color: var(--rs-text-secondary); font-variant-numeric: tabular-nums; }
.event-when span + span::before { content: '\00b7'; margin-right: 6px; color: var(--rs-text-muted); }
.event-fee { grid-area: fee; font-weight: 700; color: var(--rs-text); text-align: right; font-variant-numeric: tabular-nums; }
.event-tba { font-weight: 500; color: var(--rs-text-muted); }
.events-empty { color: var(--rs-text-secondary); }
.events-fee-note { margin: 14px 0 0; font-size: 0.85rem; color: var(--rs-text-muted); }
.events-fee-note a { color: var(--rs-text); text-decoration: underline; text-underline-offset: 2px; }

.event-save {
    grid-area: save;
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px; padding: 0 14px;
    border: 1px solid var(--rs-border-dark); border-radius: 999px;
    background: var(--rs-bg-card); color: var(--rs-text);
    font: 600 0.88rem/1 var(--font-body, Inter, system-ui, sans-serif);
    cursor: pointer;
    transition: background-color 0.2s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.event-save:hover { border-color: var(--rs-text); }
.event-save:focus-visible { outline: 3px solid var(--rs-accent); outline-offset: 2px; }
.event-save[aria-pressed="true"] {
    --save-fill: var(--rs-accent-text);
    background: var(--rs-accent); border-color: var(--rs-accent-dark); color: var(--rs-accent-text);
}
.event-row.is-saved { background: var(--rs-accent-light); }
.event-save-icon { flex: none; }

/* Phones: the name (and its sponsor line) on top, then "start · fee" on one
   line, Save on the right across both. */
@media (max-width: 699px) {
    .rd-top > .race-photo-section { margin-bottom: 20px; }
    .event-row,
    .events-list--nofee .event-row {
        grid-template-columns: max-content minmax(0, 1fr) auto;
        grid-template-areas: "name name save" "when fee save";
        column-gap: 0; row-gap: 4px;
        padding: 12px 4px;
    }
    .events-list--nofee .event-row { grid-template-areas: "name name save" "when when save"; }
    .events-list--past .event-row,
    .events-list--past.events-list--nofee .event-row { grid-template-columns: max-content minmax(0, 1fr); grid-template-areas: "name name" "when fee"; }
    .event-name { padding-right: 12px; }
    .event-when { font-size: 0.9rem; }
    .event-fee { text-align: left; font-weight: 600; font-size: 0.9rem; color: var(--rs-text-secondary); }
    .event-fee::before { content: '\00b7'; margin: 0 6px; color: var(--rs-text-muted); font-weight: 400; }
    .event-save { padding: 0 12px; margin-left: 4px; }
    .event-tag { white-space: nowrap; }
}
@media (max-width: 380px) {
    .event-save { width: 44px; padding: 0; justify-content: center; }
    .event-save-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (prefers-reduced-motion: reduce) {
    .event-row, .event-save { transition: none; }
}

/* Target of the hero's "Where to stay" link: clear the sticky nav. */
.race-detail-body #where-to-stay {
    scroll-margin-top: 96px;
}

/* Stay22 accommodation map (destination races only, see stay22.py). Fixed
   height so the lazy iframe reserves its space and nothing shifts on load. */
.race-detail-body .stay22-frame {
    position: relative;
    margin: 12px 0 8px;
    border-radius: var(--radius-md, 8px);
    background: var(--rs-bg-elevated, #f8f8f8);
    overflow: hidden;
}
/* Shown until Stay22 paints over it: a blank ~440px box read as broken. */
.race-detail-body .stay22-frame::before {
    content: "Loading places to stay\2026";
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    color: var(--rs-text-muted, #6b6b6b);
    font-size: 0.9rem;
}
.race-detail-body .stay22-map {
    position: relative;
    display: block;
    width: 100%;
    height: 380px;
    border: 0;
}

@media (max-width: 600px) {
    /* Stay22's own buttons take ~90px of the embed on phones; 320px left
       ~210px of map with price pins under the attribution bar. */
    .race-detail-body .stay22-map {
        height: 440px;
    }
}

/* Race-day panel (rebuilt 30 Oct 2026 after the panel review): the next race
   day leads, then where + Directions / Add to calendar, then one-line facts.
   After the race, results lead. */
.raceday-panel {
    margin: 0 0 32px;
    padding: 20px 24px 12px;
    border: 1px solid var(--rs-border, #e5e5e5);
    border-radius: 12px;
    background: var(--rs-bg-card, #fff);
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
}
.raceday-panel h2 { margin: 0 0 14px; font-size: 1.35rem; line-height: 1.25; }
.raceday-panel a { color: var(--rs-text, #161616); text-decoration: underline; text-decoration-color: var(--rs-accent, #C02619); text-decoration-thickness: 2px; text-underline-offset: 3px; font-weight: 600; }
.raceday-label {
    display: inline-block; min-width: 7.5em; margin-right: 6px;
    font-size: 0.78rem; font-weight: 600; color: var(--rs-text-muted, #6b6b6b);
}
.raceday-lead { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-start; margin-bottom: 16px; }
.raceday-day { min-width: 0; }
.raceday-day-label { margin: 0 0 2px; font-size: 0.85rem; font-weight: 600; color: var(--rs-text-muted, #6b6b6b); }
.raceday-day--next .raceday-day-label { color: var(--rs-text, #161616); }
.raceday-gun { margin: 0; font-size: 1.05rem; line-height: 1.3; }
.raceday-gun strong { font-size: 1.9rem; font-weight: 700; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; margin-right: 6px; }
.raceday-more { margin: 4px 0 0; font-size: 0.92rem; line-height: 1.45; color: var(--rs-text-secondary, #3d3d3d); font-variant-numeric: tabular-nums; }
.raceday-starts { list-style: none; margin: 6px 0 0; padding: 0; font-size: 0.92rem; line-height: 1.5; color: var(--rs-text-secondary, #3d3d3d); }
.raceday-starts li { display: flex; gap: 10px; }
.raceday-start-time { flex: none; min-width: 4.5em; font-weight: 600; color: var(--rs-text, #161616); font-variant-numeric: tabular-nums; }
.raceday-where { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
    padding: 14px 0; border-top: 1px solid var(--rs-border-light, #eee); }
.raceday-place { margin: 0; font-size: 0.98rem; line-height: 1.45; flex: 1 1 280px; }
.raceday-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.raceday-panel a.raceday-btn {
    display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
    border: 1px solid var(--rs-border, #ddd); border-radius: 10px; background: var(--rs-bg-card, #fff);
    text-decoration: none; font-size: 0.95rem; white-space: nowrap;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.raceday-panel a.raceday-btn:hover { border-color: var(--rs-text, #161616); }
.raceday-panel a.raceday-btn--primary { background: var(--rs-text, #161616); border-color: var(--rs-text, #161616); color: #fff; }
.raceday-panel a.raceday-btn--primary:hover { background: #000; }
.raceday-facts { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rs-border-light, #eee); }
.raceday-facts li { padding: 10px 0; font-size: 0.93rem; line-height: 1.45; border-bottom: 1px solid var(--rs-border-light, #eee); }
.raceday-facts li:last-child { border-bottom: none; }
.raceday-facts a { margin-left: 4px; white-space: nowrap; }
.raceday-note { margin: 0; font-size: 0.95rem; line-height: 1.5; max-width: 60ch; }
.raceday-panel--after .raceday-lead { align-items: center; }
.raceday-panel .share-nudge { margin: 4px 0 6px; }
/* Jump links land below the fixed header, not under it. */
#schedule, #getting-there, #weather, #course-map, #race-day-weather { scroll-margin-top: 88px; }
@media (max-width: 768px) {
    .raceday-panel { padding: 16px 16px 8px; }
    .raceday-panel h2 { font-size: 1.15rem; }
    .raceday-gun strong { font-size: 1.6rem; }
    .raceday-actions { width: 100%; }
    .raceday-actions .raceday-btn { flex: 1 1 0; justify-content: center; }
    .raceday-label { display: block; min-width: 0; margin: 0 0 2px; }
    .raceday-facts a { display: inline-flex; align-items: center; min-height: 36px; }
}

/* ---- Review fixes (26 Sep 2026) ----------------------------------------- */
/* Yellow (#D52B1E) text on white is 1.45:1: keep yellow for fills/underlines. */
.race-detail-body .related-race-date,
.race-detail-body .related-guide-category { color: var(--rs-text-muted, #6b6b6b) !important; }
.race-detail-body .btn-view-alt { color: var(--rs-text, #161616) !important; border-color: var(--rs-border, #ddd) !important; }

@media (max-width: 768px) {
    /* Schedule: one compact row per distance (was a ~175px card each). */
    .race-detail-body .schedule-table tbody { gap: 0; }
    .race-detail-body .schedule-table tr {
        display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 12px; row-gap: 2px;
        padding: 12px 0; background: none; border: 0; border-radius: 0;
        border-bottom: 1px solid var(--rs-border, #e5e5e5);
    }
    .race-detail-body .schedule-table td { padding: 0; }
    .race-detail-body .schedule-table td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 600; }
    .race-detail-body .schedule-table td:nth-child(2) { grid-column: 1; grid-row: 2; font-size: 0.85rem; color: var(--rs-text-muted, #6b6b6b); }
    .race-detail-body .schedule-table td:nth-child(3) { grid-column: 2; grid-row: 1; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
    .race-detail-body .schedule-table td:nth-child(4) { grid-column: 2; grid-row: 2; text-align: right; font-size: 0.85rem; }
    .race-detail-body .breadcrumb a,
    .race-detail-body .back-link { display: inline-flex; align-items: center; min-height: 44px; }
}
.race-detail-body::before { animation: none; } /* invisible at 3%, composites every frame on iOS */

@media (max-width: 768px) { .race-detail-body .fact-item--dup { display: none; } }

/* Distance chips: neutral text and border with a coloured dot, instead of
   coloured text (cyan 'Half Marathon' was 2.74:1, green '5km' 3.30:1). */
.race-detail-body .distance-badge.marathon,
.race-detail-body .distance-badge.half,
.race-detail-body .distance-badge.ten-k,
.race-detail-body .distance-badge.five-k,
.race-detail-body .distance-badge.other { color: var(--rs-text); border-color: var(--rs-border-dark, #bdbdbd); min-height: 44px; }
.race-detail-body .distance-badge.marathon::before,
.race-detail-body .distance-badge.half::before,
.race-detail-body .distance-badge.ten-k::before,
.race-detail-body .distance-badge.five-k::before {
    content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 6px; vertical-align: 1px; background: currentColor;
}
.race-detail-body .distance-badge.marathon::before { background: var(--rs-marathon); }
.race-detail-body .distance-badge.half::before { background: var(--rs-half); }
.race-detail-body .distance-badge.ten-k::before { background: var(--rs-10k); }
.race-detail-body .distance-badge.five-k::before { background: var(--rs-5k); }
/* "More races" cards match the calendar pages' type (sans name, muted date). */
.race-detail-body .related-race-name { font-family: var(--font-body, Inter, system-ui, sans-serif); font-weight: 700; }
.race-detail-body .related-race-date { text-transform: none; letter-spacing: 0.02em; font-weight: 600; }
.race-detail-body footer:not(.landing-footer) .footer-cal { max-width: 900px; margin: 16px auto 0; font-size: 0.85rem; line-height: 2; }
.race-detail-body footer:not(.landing-footer) .footer-cal a { margin: 0 6px; white-space: nowrap; }
.race-detail-body footer:not(.landing-footer) .footer-cal strong { margin-right: 4px; }

/* "Training for this race?" (admin preview until the Training section launches) */
.rd-training { margin: 32px 0; padding: 24px; border-radius: 16px; background: #fbf7ec; border: 1px solid #efe5c9; color: #2b2925; }
.rd-training-kicker { margin: 0 0 6px; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: #9a7a0a; }
.rd-training h2 { margin: 0 0 14px; color: #2b2925; }
.rd-training-lead { margin: -6px 0 18px; color: #57524a; }
.rd-training-say { margin: 0 0 10px; font-size: 0.9rem; color: #57524a; }
.rd-training-plans { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px; }
.rd-training-plans small { font-weight: 400; font-size: 0.8rem; color: #57524a; }
.rd-training-plans .rd-training-price { color: #7a5f00; font-weight: 600; }
.rd-training-plans a { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center; padding: 12px 14px; border-radius: 12px; background: #fff; border: 1px solid #efe5c9; color: #2b2925; text-decoration: none; transition: border-color 0.15s ease; }
.rd-training-plans a:hover { border-color: #D52B1E; }
.rd-training-plans a:focus-visible { outline: 2px solid #2b2925; outline-offset: 2px; }
.rd-training-plans strong { grid-column: 1; }
.rd-training-plans span { grid-column: 1; font-size: 0.85rem; color: #57524a; }
.rd-training-plans i { grid-column: 2; grid-row: 1 / span 3; font-style: normal; font-size: 1.2rem; color: #B3241A; }
.rd-training-note { margin: 12px 0 0; font-size: 0.82rem; color: #57524a; }
.rd-training-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 10px; }
.rd-training-btn { display: inline-block; text-decoration: none; padding: 10px 16px; border-radius: 10px; border: 1px solid #D52B1E; background: #D52B1E; color: #111; font-family: inherit; font-size: 0.92rem; font-weight: 600; line-height: 1.2; cursor: pointer; }
.rd-training-btn:hover { background: #E04A3F; }
.rd-training-note { margin: 0; font-size: 0.85rem; color: #57524a; }

/* ============================================================
   JOURNEY ADS LAYOUT (20 Oct 2026, docs/journey-ads-best-practice.md)
   The rail (.journey-sidebar) holds only the race photo and Add to Your
   Calendar, so Journey's sticky sidebar ad starts ~400px sooner; Quick Facts
   moved into the main column (.journey-content) after the schedule. Prose is
   18px / 1.65 (Journey: 18-22px, 1.6-1.8), which also makes the column the ad
   runs beside taller.
   ============================================================ */
.race-detail-body .rd-main .quick-facts-section .quick-facts-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 0 24px;
}
.race-detail-body .rd-main .quick-facts-section .fact-item,
.race-detail-body .rd-main .quick-facts-section .fact-item:first-child {
    padding: 10px 0;
}
.race-detail-body .rd-main .quick-facts-section .fact-item:last-child {
    border-bottom: 1px solid var(--rs-border-light, var(--rs-border));
}
.race-detail-body .description-section p,
.race-detail-body .enriched-section p,
.race-detail-body .faq-item p {
    font-size: 18px;
    line-height: 1.65;
}
@media (max-width: 768px) {
    .race-detail-body .rd-main .quick-facts-section .quick-facts-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0 16px;
    }
}

/* ---------------------------------------------------------------------------
   Race feature (templates/partials/race_feature.html): the long-form story,
   numbers, winners/records, runners' words, course guide and gallery that the
   race-feature skill writes for selected (affiliate) races. Same section shell
   and heading rule as the other .enriched-section blocks.
   --------------------------------------------------------------------------- */
.rf-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
    margin: 4px 0 18px;
}
.rf-stat {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border-light);
    border-radius: 12px;
    padding: 14px 16px;
    display: flex;
    flex-direction: column-reverse;   /* value reads first, label under it */
    gap: 2px;
}
.rf-stat dd {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--rs-accent-text, var(--rs-accent));
    font-variant-numeric: tabular-nums;
}
.rf-stat dt {
    font-size: 0.82rem;
    color: var(--rs-text-muted);
    line-height: 1.3;
}

.rf-timeline {
    list-style: none;
    margin: 16px 0 0;
    padding: 0 0 0 18px;
    border-left: 2px solid var(--rs-border);
}
.rf-timeline li {
    position: relative;
    padding: 0 0 14px 14px;
    display: grid;
    grid-template-columns: 4.2rem 1fr;
    gap: 10px;
    align-items: baseline;
}
.rf-timeline li::before {
    content: "";
    position: absolute;
    left: -25px;
    top: 0.45em;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--rs-accent);
    box-shadow: 0 0 0 3px var(--rs-bg-page, var(--rs-bg));
}
.rf-timeline-year {
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--rs-text);
    font-variant-numeric: tabular-nums;
}
.rf-timeline-text { color: var(--rs-text-secondary); line-height: 1.55; }

.rf-course-list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: rf-course;
}
.rf-course-list li {
    counter-increment: rf-course;
    position: relative;
    padding: 0 0 14px 44px;
}
.rf-course-list li::before {
    content: counter(rf-course);
    position: absolute;
    left: 0;
    top: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--rs-accent);
    color: #1a1a1a;   /* the accent is yellow: white numbers were unreadable */
    font-weight: 800;
    font-size: 0.9rem;
    display: grid;
    place-items: center;
}
.rf-course-label { display: block; font-weight: 700; color: var(--rs-text); margin-bottom: 2px; }
.rf-course-list p { margin: 0; }

.rf-results h3 {
    font-family: var(--font-display);
    font-size: 1.02rem;
    margin: 14px 0 8px;
    color: var(--rs-text);
}
.rf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.rf-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.rf-table th {
    text-align: left;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--rs-text-muted);
    font-weight: 700;
    padding: 6px 10px 6px 0;
    border-bottom: 1px solid var(--rs-border);
}
.rf-table td {
    padding: 9px 10px 9px 0;
    border-bottom: 1px solid var(--rs-border-light);
    color: var(--rs-text);
    vertical-align: top;
}
.rf-time { font-variant-numeric: tabular-nums; font-weight: 700; white-space: nowrap; }
.rf-note { font-size: 0.88rem; color: var(--rs-text-muted); margin: 8px 0 0; }

.rf-quote-list { display: grid; gap: 14px; }
.rf-quote {
    margin: 0;
    padding: 16px 18px 14px 20px;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border-light);
    border-left: 4px solid var(--rs-accent);
    border-radius: 0 12px 12px 0;
}
.rf-quote blockquote { margin: 0; }
.rf-quote blockquote p {
    margin: 0 0 10px;
    font-size: 1.05rem;
    line-height: 1.55;
    color: var(--rs-text);
}
.rf-quote blockquote p::before { content: "\201C"; }
.rf-quote blockquote p::after { content: "\201D"; }
.rf-quote figcaption { font-size: 0.86rem; color: var(--rs-text-muted); }
.rf-quote figcaption strong { color: var(--rs-text-secondary); }
.rf-quote-src { margin-left: 6px; white-space: nowrap; }

.rf-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.rf-photo { margin: 0; }
/* Photos placed through the article (not only in a gallery). */
.rf-story .rf-photo,
.rf-more > .rf-photo, .rf-photo.rf-more-part { margin: 16px 0 20px; }
.rf-more > .rf-photo, .rf-photo.rf-more-part { margin-top: -8px; }
.rf-course-body--photo {
    display: grid;
    grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
    gap: 20px;
    align-items: start;
}
.rf-course-body--photo .rf-photo img { aspect-ratio: 3 / 4; }
/* The photo beside the course sections stays in view while they scroll past (12 Nov 2026,
   John). Only side by side and where the window fits it under the header (92px, as the
   affiliate rail card); in a short window it scrolls normally. */
@media (min-width: 721px) and (min-height: 760px) {
    .rf-course-body--photo > .rf-photo { position: sticky; top: 92px; }
}
.rf-photo--wide { grid-column: 1 / -1; }
.rf-photo img {
    width: 100%;
    aspect-ratio: 3 / 2;
    object-fit: cover;
    border-radius: 10px;
    display: block;
    background: var(--rs-bg-elevated);
}
.rf-photo--wide img { aspect-ratio: 16 / 9; }
.rf-photo figcaption { font-size: 0.78rem; color: var(--rs-text-muted); margin-top: 5px; line-height: 1.35; }
.rf-credit a { color: inherit; }

/* Obstacles (fun-run features, 30 Oct 2026): numbered cards, photo on top
   when the organiser allows one. Video: a 16:9 youtube-nocookie frame. */
.rf-obstacle-grid {
    list-style: none;
    margin: 16px 0 8px;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.rf-obstacle {
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    overflow: hidden;
}
.rf-obstacle-photo { margin: 0; }
/* 7:3 is the shape of the organiser's obstacle tiles (350x150), so they show whole. */
.rf-obstacle-photo img { width: 100%; aspect-ratio: 7 / 3; object-fit: cover; display: block; background: var(--rs-bg-elevated); }
.rf-obstacle-photo figcaption { font-size: 0.72rem; color: var(--rs-text-muted); padding: 4px 14px 0; }
.rf-obstacle-body { position: relative; padding: 14px 16px 16px 60px; }
.rf-obstacle-num {
    position: absolute;
    left: 16px;
    top: 14px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--rs-accent);
    color: var(--rs-accent-text, #1a1a1a);
    font-weight: 800;
    font-size: 15px;
    display: grid;
    place-items: center;
}
.rf-obstacle-name { font-size: 1.02rem; margin: 4px 0 4px; line-height: 1.3; }
.rf-obstacle-body p { margin: 0; font-size: 0.95rem; line-height: 1.55; }
/* Course maps (race_course.py): map image, SVG elevation profile, facts. */
.rf-course-map { border: 1px solid var(--rs-border); border-radius: 12px; margin: 14px 0; overflow: hidden; background: var(--rs-bg-card, #fff); }
/* Course rows (critique, 12 Nov 2026). Several courses start closed; each
   closed row is a comparison line - official km, climb, high point, start and
   final cut-off - with a labelled "Map & profile" control and a chevron. The
   stats sit in fixed columns on wide screens so they line up down the rows. */
.rf-courses-intro { color: var(--rs-text-secondary); margin: 4px 0 10px; }
.rf-course-map > summary {
    cursor: pointer; list-style: none; display: flex; align-items: center; gap: 14px;
    min-height: 56px; padding: 12px 16px; transition: background-color 150ms ease-out;
}
.rf-course-map > summary::-webkit-details-marker { display: none; }
.rf-course-map > summary:hover { background: var(--rs-bg-elevated); }
/* The box clips overflow (rounded corners), which hid the old outset ring;
   an inset dark ring shows and passes contrast on white. */
.rf-course-map > summary:focus-visible { outline: 3px solid var(--rs-text); outline-offset: -3px; border-radius: 12px; }
.rf-course-sum { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rf-course-map-label { font-weight: 700; font-size: 1.05rem; color: var(--rs-text); }
.rf-course-map-stats {
    display: flex; flex-wrap: wrap; gap: 2px 16px; font-size: 0.9rem; color: var(--rs-text-secondary);
    font-variant-numeric: tabular-nums;
}
.rf-course-map-stats b { font-weight: 700; color: var(--rs-text); }
.rf-cstat { white-space: nowrap; }
.rf-cstat--wide { flex-basis: 100%; white-space: normal; }
@media (min-width: 760px) {
    .rf-course-map-stats { display: grid; grid-template-columns: 7.5rem 9.5rem 7.5rem minmax(0, 1fr); gap: 2px 0; }
}
.rf-course-toggle {
    flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px 0 14px;
    border: 1px solid var(--rs-border); border-radius: 999px; background: var(--rs-bg-card, #fff);
    font-size: 0.85rem; font-weight: 600; color: var(--rs-text); white-space: nowrap;
    transition: border-color 150ms ease-out;
}
.rf-course-map > summary:hover .rf-course-toggle { border-color: var(--rs-text); }
.rf-course-toggle svg { transition: transform 200ms cubic-bezier(0.22, 1, 0.36, 1); }
.rf-course-map[open] .rf-course-toggle svg { transform: rotate(180deg); }
.rf-course-map .rf-when-open, .rf-course-map[open] .rf-when-closed { display: none; }
.rf-course-map[open] .rf-when-open { display: inline; }
.rf-course-map[open] > summary { border-bottom: 1px solid var(--rs-border-light, var(--rs-border)); }
@media (max-width: 560px) {
    .rf-course-map > summary { align-items: flex-start; gap: 10px; padding: 12px 12px 12px 14px; }
    .rf-course-toggle { width: 36px; height: 36px; min-height: 0; padding: 0; justify-content: center; }
    .rf-course-toggle-text { display: none !important; }
}
@media (prefers-reduced-motion: reduce) {
    .rf-course-toggle svg, .rf-course-map > summary, .rf-course-toggle { transition: none; }
}
.rf-course-facts dd small { display: block; font-weight: 500; font-size: 0.75rem; color: var(--rs-text-muted); }
.rf-profile-hint { margin: 4px 0 0; font-size: 0.78rem; color: var(--rs-text-muted); }
@media (hover: none) { .rf-profile-hint { font-size: 0.75rem; } }
.rf-stages .rf-note { font-size: 0.8rem; margin-left: 0; margin-right: 0; }
.rf-stages .rf-table-wrap { position: relative; }
.rf-stages .rf-table-wrap.is-clipped { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent); }
.rf-map-stack { width: fit-content; min-width: min(100%, 520px); max-width: 100%; margin: 0 auto; }
/* The profile takes the stack's width (set by the map) and never widens it. */
.rf-map-stack > .rf-profile { width: 0; min-width: 100%; box-sizing: border-box; }
.rf-map-wrap { position: relative; width: fit-content; max-width: 100%; margin: 0 auto; }
/* The map keeps its own shape (race_course.py frames it on the route), capped
   in height so a north-south course isn't a scroll of its own. */
.rf-course-map-img { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; background: var(--rs-bg-elevated); }
/* Desktop: the map, profile and facts of one course fit on one screen
   (John, 30 Oct 2026: couldn't see both at once). The map gives way to the
   ~420px the summary, profile, facts and note need. */
@media (min-width: 900px) {
    .rf-course-map-img { max-height: max(320px, calc(100vh - 380px)); }
    .rf-course-facts { margin-top: 6px; }
    .rf-course-facts div { padding: 6px 10px; }
}
.rf-map-dot { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
              background: #fff; border: 4px solid #2563eb; box-shadow: 0 1px 4px rgba(0,0,0,.4); pointer-events: none; }
.rf-profile { cursor: crosshair; touch-action: pan-y; }
.rf-profile { display: block; padding: 10px 16px 0; outline: none; }
.rf-profile:focus-visible .rf-profile-plot { outline: 2px solid var(--rs-accent); outline-offset: 2px; }
.rf-profile-plot { position: relative; height: clamp(96px, 14vw, 150px); cursor: crosshair; touch-action: pan-y; }
.rf-profile-plot svg { display: block; width: 100%; height: 100%; }
.rf-profile-area { fill: color-mix(in srgb, #e11d48 16%, transparent); }
.rf-profile-line { fill: none; stroke: #e11d48; stroke-width: 2; vector-effect: non-scaling-stroke; }
.rf-profile-axis { stroke: var(--rs-border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.rf-profile-cursor { stroke: #2563eb; stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.rf-profile-max { position: absolute; left: 4px; top: 2px; font: 12px var(--font-body, system-ui); color: var(--rs-text-muted); }
.rf-profile-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%;
                  background: #fff; border: 3px solid #2563eb; box-sizing: border-box; pointer-events: none; }
.rf-profile-readout { position: absolute; top: 4px; font: 700 13px var(--font-body, system-ui); color: var(--rs-text);
                      background: var(--rs-bg-card, #fff); padding: 1px 6px; border-radius: 4px; white-space: nowrap; pointer-events: none;
                      box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.rf-profile-scale { display: flex; justify-content: space-between; font: 12px var(--font-body, system-ui); color: var(--rs-text-muted); margin-top: 3px; }
.rf-course-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 16px 6px; }
.rf-course-facts div { background: var(--rs-bg-elevated); border-radius: 8px; padding: 8px 10px; }
.rf-course-facts dt { font-size: 0.72rem; color: var(--rs-text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rf-course-facts dd { margin: 2px 0 0; font-weight: 700; }
.rf-course-map .rf-note { margin: 6px 16px 14px; font-size: 0.8rem; }
@media (max-width: 640px) { .rf-course-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rf-embeds { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; margin-top: 12px; }
.rf-embed { margin: 0; min-width: 0; }
.rf-embed .instagram-media { min-width: 0 !important; width: 100% !important; margin: 0 !important; }

/* Race-day weather history (race_weather.py). */
.rf-weather-table th[scope="row"] { white-space: nowrap; font-weight: 600; }
.rf-weather-table td { white-space: nowrap; }
.rf-wx-hot td, .rf-wx-hot th { background: color-mix(in srgb, #f97316 10%, transparent); }
.rf-wx-wet td, .rf-wx-wet th { background: color-mix(in srgb, #0ea5e9 10%, transparent); }

/* Story paragraphs had no space between them on every feature page (a reset
   zeroes p margins here); found 30 Oct 2026. */
.rf-story > p { margin: 0 0 1em; }
/* Foam-run colours for the obstacle numbers, in turn. */
.rf-obstacle:nth-child(4n+2) .rf-obstacle-num { background: #ec4899; color: #fff; }
.rf-obstacle:nth-child(4n+3) .rf-obstacle-num { background: #0ea5e9; color: #fff; }
.rf-obstacle:nth-child(4n+4) .rf-obstacle-num { background: #22c55e; color: #fff; }
.rf-video { margin: 24px 0 8px; }
.rf-video-frame { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; }
.rf-video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* Floating player (12 Nov 2026): .rf-video-inner fills the frame; once the
   reader has pressed play and the frame scrolls away, it is fixed bottom right
   (race_feature.html script). The frame keeps its height, so nothing shifts. */
.rf-video-inner { position: absolute; inset: 0; }
.rf-video-inner.is-floating { position: fixed; inset: auto 16px 16px auto; width: min(340px, 62vw); aspect-ratio: 16 / 9; z-index: 900; border-radius: 10px; overflow: hidden; background: #000; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
.rf-video-inner.is-floating.is-small { width: min(240px, 50vw); }
.rf-video-close { position: absolute; top: 6px; right: 6px; z-index: 1; width: 28px; height: 28px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, 0.7); color: #fff; font-size: 18px; line-height: 28px; text-align: center; cursor: pointer; }
.rf-video-close[hidden] { display: none; }
.rf-video-close:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.rf-video figcaption { font-size: 0.78rem; color: var(--rs-text-muted); margin-top: 6px; }
@media (max-width: 640px) {
    .rf-obstacle-grid { grid-template-columns: 1fr; }
}

.rf-sources { margin: -12px 0 32px; font-size: 0.85rem; color: var(--rs-text-muted); }
.rf-sources summary { cursor: pointer; }
.rf-sources ul { margin: 8px 0 0; padding-left: 18px; }
.rf-sources li { margin: 2px 0; }

@media (max-width: 720px) {
    .rf-course-body--photo { grid-template-columns: 1fr; }
    .rf-course-body--photo .rf-photo img { aspect-ratio: 3 / 2; }
}
@media (max-width: 600px) {
    .rf-gallery-grid { grid-template-columns: 1fr; }
    .rf-stat dd { font-size: 1.35rem; }
    .rf-timeline li { grid-template-columns: 3.6rem 1fr; }
}

/* Stages block (course stations): numbered pins on the profile and map, and the
   aid-station table under each course. Aid = rose (the profile's colour), water
   stop = sky, start/finish = ink. */
.rf-profile-station { stroke: var(--rs-border); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.rf-stn-pin { position: absolute; bottom: 0; transform: translate(-50%, 50%); z-index: 1;
    min-width: 18px; height: 18px; padding: 0 3px; box-sizing: border-box; border-radius: 9px;
    background: #e11d48; color: #fff; font: 700 10px/18px var(--font-body, system-ui); text-align: center;
    box-shadow: 0 0 0 2px var(--rs-bg-card, #fff); pointer-events: none; }
.rf-stn-pin--water { background: #0284c7; }
.rf-stn-pin--start, .rf-stn-pin--finish { background: #1f2937; }
.rf-stn-pin--map { bottom: auto; transform: translate(-50%, -50%); }
.rf-stn-pin--static { position: static; display: inline-block; transform: none; }
.rf-profile-plot { margin-bottom: 9px; }
.rf-stages { margin: 4px 16px 10px; }
.rf-stages-heading { font-size: 1rem; margin: 14px 0 6px; }
.rf-stages-table td, .rf-stages-table th { white-space: nowrap; }
.rf-stages-table th[scope="row"] { font-weight: 600; white-space: normal; min-width: 150px; }
.rf-stage-tag { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 6px; font-size: 0.7rem; font-weight: 600;
    background: var(--rs-bg-elevated); color: var(--rs-text-secondary); vertical-align: 1px; }
.rf-stage-tag--timed { background: color-mix(in srgb, #2563eb 12%, transparent); color: #1d4ed8; }
.rf-stage-note { display: block; font-weight: 400; font-size: 0.78rem; color: var(--rs-text-muted); }
.rf-stage--start th, .rf-stage--finish th { font-weight: 700; }
.rf-stn-pin--turnaround { background: #7c3aed; }
/* Start / finish labels over the course map. The flag's point sits on the
   route's first/last point. */
.rf-map-flag { position: absolute; z-index: 2; transform: translate(-50%, calc(-100% - 9px)); white-space: nowrap;
    padding: 3px 8px; border-radius: 6px; font: 700 12px/1.2 var(--font-body, system-ui); color: #fff;
    background: #15803d; box-shadow: 0 1px 4px rgba(0,0,0,.35); pointer-events: none; }
.rf-map-flag::after { content: ''; position: absolute; left: 50%; top: 100%; margin-left: -6px;
    border: 6px solid transparent; border-top-color: #15803d; }
.rf-map-flag--finish { background: #111827; }
.rf-map-flag--finish::after { border-top-color: #111827; }
.rf-map-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 8px 16px 0; font-size: 0.8rem; color: var(--rs-text-secondary); }
.rf-map-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.rf-map-legend > span:last-child { color: var(--rs-text-muted); }
.rf-map-flag--below { transform: translate(-50%, 9px); }
.rf-map-flag--below::after { top: auto; bottom: 100%; border-top-color: transparent; border-bottom-color: #15803d; }
.rf-map-flag--finish.rf-map-flag--below::after { border-top-color: transparent; border-bottom-color: #111827; }
.rf-stages-table th[scope="row"] { text-transform: none; letter-spacing: normal; font-size: 0.9rem; color: var(--rs-text); }
.rf-stages-table .rf-stage-tag { text-transform: none; letter-spacing: normal; }

/* The race page's prose rule (.race-detail-body .enriched-section p: 18px,
   its own margins) out-ranks the course block's small print, so the legend,
   notes and hint rendered at body size and the legend sat flush on the card
   edge (critique, 12 Nov 2026). Scoped to the courses section to win. */
.race-detail-body .rf-courses .rf-courses-intro { font-size: 1rem; line-height: 1.5; margin: 4px 0 10px; color: var(--rs-text-secondary); max-width: none; }
.race-detail-body .rf-courses .rf-map-legend { font-size: 0.8rem; line-height: 1.4; margin: 8px 16px 0; max-width: none; }
.race-detail-body .rf-courses .rf-course-map .rf-note { font-size: 0.8rem; line-height: 1.5; margin: 6px 16px 14px; max-width: none; }
.race-detail-body .rf-courses .rf-stages .rf-note { margin: 8px 0 0; }
.race-detail-body .rf-courses .rf-profile-hint { font-size: 0.78rem; line-height: 1.4; margin: 4px 0 0; color: var(--rs-text-muted); max-width: none; }
.rf-nowrap { white-space: nowrap; }

/* Race top panel (.rtp, 13 Nov 2026 redesign, John: "each one thought through"): the one card under
   the hero for race week, race day, the fortnight after and past results. Same anatomy in every
   state: a title saying where the race is at, one line of context, the main action as the black
   button, then secondary links or the race-day details. The free affiliate spot is the card's
   right-hand column on desktop (a hairline apart, inside the card) and its last section on phones.
   Applies to both .raceday-panel and .past-results-notice. */
.rtp {
    margin: 0 0 32px;
    padding: 22px 24px 18px;
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border, #e5e5e5);
    border-radius: 14px;
    box-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
}
.rtp-main { min-width: 0; }
.rtp .rtp-title {
    margin: 0;
    font-family: var(--font-display, var(--font-body));
    font-size: 1.55rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.01em;
    text-wrap: balance;
}
.rtp-sub { margin: 6px 0 18px; font-size: 0.98rem; line-height: 1.5; color: var(--rs-text-secondary, #3d3d3d); max-width: 62ch; }
.rtp-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.rtp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    padding: 0 18px;
    font-size: 0.97rem;
    font-weight: 600;
    color: var(--rs-text, #161616);
    text-decoration: none;
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border, #ddd);
    border-radius: 10px;
    transition: background-color 0.15s ease-out, border-color 0.15s ease-out;
}
.rtp-btn:hover { border-color: var(--rs-text, #161616); }
.rtp-btn--primary { color: #fff; background: var(--rs-text, #161616); border-color: var(--rs-text, #161616); }
.rtp-btn--primary:hover { background: #000; }
.rtp-btn:focus-visible { outline: 2px solid var(--rs-accent, #C02619); outline-offset: 2px; }
.rtp-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 16px 0 0; font-size: 0.9rem; }
.rtp .rtp-links a {
    color: var(--rs-text, #161616);
    font-weight: 500;
    text-decoration: underline;
    text-decoration-color: var(--rs-accent, #C02619);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
.raceday-panel.rtp .raceday-lead { margin-bottom: 14px; }
.raceday-panel--after.rtp .raceday-lead { margin-bottom: 0; }
.raceday-panel.rtp .share-nudge { margin: 14px 0 0; }
.raceday-panel.rtp .raceday-facts { margin-bottom: -6px; }
.raceday-panel.rtp .raceday-place { display: grid; grid-template-columns: calc(7.5em + 6px) minmax(0, 1fr); align-items: baseline; }
.raceday-panel.rtp .raceday-place .raceday-label { min-width: 0; margin: 0; }
.rtp-aff { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--rs-border-light, #eee); }

@media (max-width: 1023px) {
    .rtp { padding: 18px 16px 16px; border-radius: 12px; }
    .rtp .rtp-title { font-size: 1.3rem; }
    .rtp-sub { margin-bottom: 16px; font-size: 0.95rem; }
    /* One main action, full width, thumb-sized; the secondary one under it. */
    .rtp-actions, .raceday-panel--after .raceday-lead { flex-direction: column; align-items: stretch; gap: 8px; }
    .rtp-actions .rtp-btn, .raceday-panel--after .raceday-lead .raceday-btn { width: 100%; justify-content: center; min-height: 48px; }
    .raceday-panel.rtp a.raceday-btn--live { width: 100%; justify-content: center; min-height: 48px; }
    .rtp-links { flex-direction: column; gap: 0; margin-top: 10px; }
    .rtp-links a { display: flex; align-items: center; min-height: 40px; }
    .raceday-panel.rtp .raceday-place { display: block; }
    .rtp-aff { margin: 18px -16px -16px; padding: 16px; border-top: 1px solid var(--rs-border-light, #eee); background: var(--rs-bg, #fafaf8); border-radius: 0 0 12px 12px; }
}

@media (min-width: 1024px) {
    .rtp--aff {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 440px;
        column-gap: 28px;
        align-items: stretch;
    }
    .rtp--aff > .rtp-aff {
        display: flex;
        align-items: stretch;                    /* the partner fills the column (John, 13 Nov 2026) */
        margin: 0;
        padding: 0 0 0 28px;
        border-top: 0;
        border-left: 1px solid var(--rs-border-light, #eee);
    }
    .rtp--aff > .rtp-aff > .rd-aff { width: 100%; }
}

/* ============================================================
   RACE TOP (13 Nov 2026 redesign; .impeccable/surfaces/templates-race-detail-html.md):
   the race card, then the board (.rtp) for the race's state, on a light band that runs
   the full width. Replaced the full-bleed photo hero, whose text sat over light or logo
   images, and the breadcrumb that floated over it.
   ============================================================ */
.race-detail-body .breadcrumb-nav { display: none; }
.race-detail-body .race-content { padding-top: 0; }
.rtop {
    position: relative;
    padding: 88px 0 30px;                        /* clears the 70px fixed header */
    margin-bottom: 36px;
    background: #f7f7f5;
    box-shadow: 0 0 0 100vmax #f7f7f5;          /* full-bleed band */
    clip-path: inset(0 -100vmax);
}
.rtop > * + * { margin-top: 18px; }
.rtop .rtp, .rtop .edition-notice, .rtop .prev-edition-link { margin-bottom: 0; }

.rcard {
    background: #fff;
    border: 1px solid var(--rs-border, #e5e5e5);
    border-radius: 16px;
    padding: 16px 20px 20px;
}
.rcard-crumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 2px 8px;
    margin: 0 0 14px;
    padding: 0;
    list-style: none;
    font-size: 13px;
    color: var(--rs-text-muted, #6b6b6b);
}
.rcard-crumbs li:not(:last-child)::after { content: "›"; margin-left: 8px; }
.rcard-crumbs a { color: inherit; text-decoration: none; }
.rcard-crumbs a:hover { color: var(--rs-text, #161616); text-decoration: underline; }
.rcard-body { display: grid; grid-template-columns: minmax(0, 520px) minmax(0, 1fr); gap: 32px; align-items: center; }
.rcard-img {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: #eef0ec;
    isolation: isolate;
}
/* The whole image, contained on its own edge colour (image_meta.py image_bg; a flat
   neutral when it hasn't been measured). */
.rcard-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.rcard-img--logo img { padding: 6%; }
.rcard .rcard-title {
    margin: 0 0 14px;
    font-family: var(--font-display, var(--font-body));
    font-size: clamp(1.9rem, 1.2rem + 1.6vw, 2.9rem);
    font-weight: 700;
    line-height: 1.06;
    letter-spacing: -0.015em;
    text-wrap: balance;
}
.rcard-facts { display: grid; gap: 0; margin: 0; }
.rcard-facts > div { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr); gap: 12px; padding: 6px 0; }
.rcard-facts dt { font-size: 0.8rem; font-weight: 600; color: var(--rs-text-muted, #6b6b6b); padding-top: 2px; }
.rcard-facts dd { margin: 0; font-size: 0.98rem; line-height: 1.45; }
.rcard-facts a, .rcard-links a {
    color: var(--rs-text, #161616);
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--rs-accent, #D52B1E);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
.rcard-links { display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 12px 0 0; font-size: 0.95rem; }
.rcard .share-nudge { margin-top: 14px; }

/* The board for a race a while away, and one long past: the same anatomy as the others. */
.rtp-facts { display: grid; margin: 18px 0 0; border-top: 1px solid var(--rs-border-light, #eee); }
.rtp-facts > div { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rs-border-light, #eee); }
.rtp-facts > div:last-child { border-bottom: 0; }
.rtp-facts dt { font-size: 0.8rem; font-weight: 600; color: var(--rs-text-muted, #6b6b6b); padding-top: 2px; }
.rtp-facts dd { margin: 0; font-size: 0.95rem; }
.rtp-facts a {
    color: var(--rs-text, #161616); font-weight: 600; text-decoration: underline;
    text-decoration-color: var(--rs-accent, #D52B1E); text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.rtp-note { margin: 10px 0 0; font-size: 0.82rem; color: var(--rs-text-muted, #6b6b6b); }

@media (max-width: 1023px) {
    .rtop { padding: 82px 0 22px; margin-bottom: 24px; }
    .rcard { padding: 12px 14px 16px; border-radius: 12px; }
    .rcard-crumbs { margin-bottom: 10px; font-size: 12.5px; }
    .rcard-body { grid-template-columns: 1fr; gap: 14px; }
    .rcard .rcard-title { font-size: clamp(1.7rem, 7vw, 2.2rem); margin-bottom: 10px; }
    .rcard-facts > div { grid-template-columns: 5.5rem minmax(0, 1fr); padding: 4px 0; }
    .rtp-facts > div { grid-template-columns: 6.5rem minmax(0, 1fr); }
}

@media (max-width: 768px) {
    .rtop { padding-top: 105px; }                /* phones: logo bar + link row, 97px */
}
/* The share row on the white card: dark on light, like the board's. */
.rcard .share-nudge-label { color: var(--rs-text-secondary); }
.rcard .share-chip {
    color: var(--rs-text, #161616);
    background: var(--rs-bg-card, #fff);
    border: 1px solid var(--rs-border, #ddd);
    text-shadow: none;
}
.rcard .share-chip:hover { border-color: var(--rs-text-muted); background: var(--rs-bg-elevated, #fafafa); }
/* Phones: the board's answer (results, start times) inside the first screen. The card keeps
   the image, name, when, where and distances; the share row is at the page's end and the
   organiser is in Quick Facts. */
@media (max-width: 768px) {
    .rcard-img { aspect-ratio: 2 / 1; }
    .rcard .share-nudge, .rcard-facts > .rcard-org, .rcard-facts > .rcard-dists { display: none; }
    .rcard-links { margin-top: 8px; }
}
@media (max-width: 768px) {
    /* The last crumb repeats the name right under it; the results boards' "was held on"
       line repeats the card's When and Where. */
    .rcard-crumbs li:last-child { display: none; }
    .rcard-crumbs li:nth-last-child(2)::after { content: none; }
    .raceday-panel--after .rtp-sub, .past-results-notice .rtp-sub { display: none; }
    .raceday-panel--after .rtp-title, .past-results-notice .rtp-title { margin-bottom: 12px; }
}

/* 1024-1099px: the partner column narrows so the board keeps its room (finish review). */
@media (min-width: 1024px) and (max-width: 1099px) {
    .rtp--aff { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 22px; }
    .rtp--aff > .rtp-aff { padding-left: 22px; }
}

/* Race pages' header at 769-1099px: the centred links ran into the logo and "Free
   training" wrapped (finish review, 13 Nov 2026). Right-aligned beside Sign In, tighter,
   one line. */
@media (min-width: 769px) and (max-width: 1099px) {
    .race-detail-body .nav-links .nav-left {
        left: auto !important;
        right: 150px !important;
        transform: none !important;
        gap: 14px !important;
    }
    .race-detail-body .nav-links .nav-left a { font-size: 13.5px !important; white-space: nowrap; }
}
@media (min-width: 769px) and (max-width: 859px) {
    .race-detail-body .nav-links .nav-left { gap: 10px !important; right: 140px !important; }
    .race-detail-body .nav-links .nav-left a { font-size: 13px !important; }
}

/* About This Event (13 Nov 2026, John): with the race image in the race card it is no longer a
   card; it reads as the first section of the article. */
.rd-lead { background: none; border: 0; border-radius: 0; box-shadow: none; overflow: visible; }
.rd-lead-text { padding: 0; }
.rd-lead-text h2 { margin-bottom: 12px; }

/* ============================================================
   ONE PAGE (13 Nov 2026 whole-page critique; John chose: yellow on dark surfaces only,
   one page on one grid, trim Quick Facts. impeccable layout + colorize + distill + typeset
   + polish in one pass; .impeccable/critique/2026-11-13T07-52-31Z__templates-race-detail-html.md).
   ============================================================ */

/* Colour: inside the page's content the accent is ink. Yellow stays where it's on dark:
   the header and footer (outside <main>) and nothing else. Ink rules, a warm hairline,
   links underlined in faint ink that darkens on hover. */
main.race-detail-page {
    --rs-accent: #161616;
    --rs-accent-hover: #000;
    --rs-accent-dark: #000;
    --rs-accent-text: #fff;
    --rs-accent-light: #f3f2ef;
    --rule: #161616;
    --hair: #e2e0da;
    --link-line: rgba(22, 22, 22, 0.32);
}
main.race-detail-page a:not([class]),
main.race-detail-page .rcard-facts a,
main.race-detail-page .rcard-links a,
main.race-detail-page .rtp .rtp-links a,
main.race-detail-page .rtp-facts a,
main.race-detail-page .raceday-panel a:not(.raceday-btn):not(.rtp-btn):not(.rtp-aff *),
main.race-detail-page .stay-link {
    color: var(--rs-text, #161616);
    text-decoration: underline;
    text-decoration-color: var(--link-line);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    font-weight: inherit;
}
main.race-detail-page .rcard-links a, main.race-detail-page .rtp .rtp-links a { font-weight: 600; }
main.race-detail-page a:not([class]):hover,
main.race-detail-page .rcard-facts a:hover, main.race-detail-page .rcard-links a:hover,
main.race-detail-page .rtp .rtp-links a:hover, main.race-detail-page .rtp-facts a:hover,
main.race-detail-page .raceday-panel a:not(.raceday-btn):not(.rtp-btn):not(.rtp-aff *):hover {
    text-decoration-color: currentColor;
    text-decoration-thickness: 2px;
}

/* Layout: one page on one grid. No band, no card borders: the race card, the board, the
   article and the sidebar share the page's left edge, and the board's partner column is the
   sidebar's track (same width and gap as .rd-grid), the partner centred in it like the ads. */
main.race-detail-page .rtop { background: none; box-shadow: none; clip-path: none; margin-bottom: 0; padding-bottom: 0; }
main.race-detail-page .rcard { background: none; border: 0; border-radius: 0; padding: 0; }
main.race-detail-page .rtop .rtp {
    margin: 32px 0 0;
    padding: 24px 0 0;
    background: none;
    border: 0;
    border-top: 1px solid var(--rule);
    border-radius: 0;
    box-shadow: none;
}
main.race-detail-page .rtop .edition-notice { background: var(--rs-accent-light); border-color: var(--hair); }
@media (min-width: 1024px) {
    main.race-detail-page .rtop .rtp--aff { grid-template-columns: minmax(0, 1fr) 340px; column-gap: 40px; }
    main.race-detail-page .rtp--aff > .rtp-aff { padding: 0; border: 0; justify-content: center; }
    main.race-detail-page .rtp--aff > .rtp-aff > .rd-aff { width: 300px; max-width: 300px; flex: none; }
}
@media (min-width: 1440px) {
    main.race-detail-page .rtop .rtp--aff { grid-template-columns: minmax(0, 1fr) 360px; column-gap: 48px; }
}
@media (max-width: 1023px) {
    main.race-detail-page .rtop .rtp { margin-top: 24px; padding-top: 20px; }
    main.race-detail-page .rtp-aff { margin: 20px 0 0; padding: 20px 0 0; background: none; border-radius: 0; border-top: 1px solid var(--hair); }
}
@media (max-width: 768px) {
    /* Race week and race day on phones: a shorter picture so the board's answer is higher. */
    .rcard--day .rcard-img { aspect-ratio: 3 / 1; }
}

/* Type: the name lighter and larger-feeling; one section heading for the whole article, a
   hairline of ink above it, sentence case, no bar underneath. */
main.race-detail-page .rcard .rcard-title { font-weight: 600; letter-spacing: -0.01em; }
main.race-detail-page .rtp .rtp-title { font-weight: 600; }
main.race-detail-page .rd-lead h2,
main.race-detail-page .rd-main h2:not([class]),
main.race-detail-page .rd-main h2[id]:not(.rtp-title),
main.race-detail-page .faq-section h2,
main.race-detail-page .related-guides-section h2,
main.race-detail-page .related-races-section h2,
main.race-detail-page section > h2[id$="parkruns-heading"] {
    display: block;
    margin: 48px 0 14px;
    padding: 16px 0 0;
    font-family: var(--font-display);
    font-size: 1.45rem;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.005em;
    border: 0;
    border-top: 1px solid var(--rule);
}
main.race-detail-page .rd-lead h2 { margin-top: 40px; }
/* A readable measure: 68ch rendered ~90 characters a line; 36em is ~72. */
main.race-detail-page .rd-lead p,
main.race-detail-page .rd-main .enriched-section p,
main.race-detail-page .rd-main .description-section p,
main.race-detail-page .faq-item p { max-width: 36em; text-wrap: pretty; }
main.race-detail-page .faq-question { text-wrap: balance; }
/* No uppercase micro-labels in the content: sentence case, small, muted. ("Advertisement",
   the ads' own label, is outside these and stays.) */
main.race-detail-page .schedule-table th,
main.race-detail-page .rf-table th,
main.race-detail-page .rf-course-facts dt,
main.race-detail-page .fact-label,
main.race-detail-page .rd-training-kicker,
main.race-detail-page .related-guide-category,
main.race-detail-page .related-race-date,
main.race-detail-page .event-tag,
main.race-detail-page .weather-table th {
    text-transform: none;
    letter-spacing: 0;
}
main.race-detail-page .schedule-table th, main.race-detail-page .rf-table th, main.race-detail-page .weather-table th { font-size: 13px; font-weight: 600; }
main.race-detail-page .related-guide-category, main.race-detail-page .related-race-date { color: var(--rs-text-muted, #6b6b6b); }
main.race-detail-page .event-tag { color: var(--rs-text-secondary, #3d3d3d); border-color: var(--hair); }

/* The traits Quick Facts kept (partials/race_traits.html): the card's label/value grid. */
.rd-traits { display: grid; margin: 16px 0 0; max-width: 36em; }
.rd-traits > div { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 12px; padding: 8px 0; border-top: 1px solid var(--hair, #e2e0da); }
.rd-traits dt { font-size: 0.82rem; font-weight: 600; color: var(--rs-text-muted, #6b6b6b); padding-top: 2px; }
.rd-traits dd { margin: 0; font-size: 0.97rem; line-height: 1.5; }
@media (max-width: 768px) { .rd-traits > div { grid-template-columns: 1fr; gap: 2px; } }

/* Polish: one button. Black rectangles with a 10px corner everywhere in the content; the
   secondary is white with a hairline. No yellow pills, no cream card, no dashed box. */
main.race-detail-page .hero-cta,
main.race-detail-page .btn-view-all,
main.race-detail-page .organiser-btn-primary,
main.race-detail-page .rd-training-btn {
    border-radius: 10px;
    background: #161616;
    color: #fff;
    border-color: #161616;
    box-shadow: none;
    transform: none;
}
main.race-detail-page .hero-cta:hover, main.race-detail-page .btn-view-all:hover,
main.race-detail-page .organiser-btn-primary:hover, main.race-detail-page .rd-training-btn:hover { background: #000; transform: none; }
main.race-detail-page .btn-view-alt, main.race-detail-page .organiser-btn:not(.organiser-btn-primary) {
    border-radius: 10px; background: #fff; color: #161616; border: 1px solid var(--rs-border, #ddd);
}
main.race-detail-page .rd-register {
    border: 1px solid var(--hair);
    border-top: 1px solid var(--hair);
    border-radius: 12px;
    background: #fff;
}
main.race-detail-page .rd-training { background: #fff; border: 1px solid var(--hair); border-radius: 12px; color: var(--rs-text, #161616); }
main.race-detail-page .rd-training-kicker { color: var(--rs-text-muted, #6b6b6b); font-weight: 600; font-size: 0.85rem; }
main.race-detail-page .rd-training-plans a { border-color: var(--hair); }
main.race-detail-page .rd-training-plans .rd-training-price { color: var(--rs-text, #161616); }
main.race-detail-page .organiser-panel-claim { border: 1px solid var(--hair); border-left: 1px solid var(--hair); }
main.race-detail-page .rf-quote, main.race-detail-page .past-event-notice { border-left-width: 1px; border-left-color: var(--hair); }
main.race-detail-page .rcard-crumbs a { text-decoration: none; color: inherit; }
main.race-detail-page .rcard-crumbs a:hover { text-decoration: underline; text-decoration-thickness: 1px; }

/* The claim and owner panels keep their own box: no section rule over their heading, and the
   primary button's white text beats the old yellow button's !important navy. */
main.race-detail-page .rd-main .organiser-panel h2 { margin: 0 0 8px; padding: 0; border-top: 0; font-size: 1.3rem; }
main.race-detail-page .organiser-btn-primary { color: #fff !important; }
main.race-detail-page .organiser-btn:not(.organiser-btn-primary):hover { border-color: #161616; }

/* The race top in the grid (13 Nov 2026, John): on desktop the header clearance moves from the
   race top to the page, so the sidebar starts level with the breadcrumbs. The board has no
   affiliate column there any more: the free spot is the sidebar's first stretch. */
main.race-detail-page .rd-grid > .rtop { padding-top: 0; }
main.race-detail-page .rtop:not(.rtop--board) { padding-bottom: 0; }
/* The gap sits above the grid, so the sidebar's top lines up with the board's rule. */
main.race-detail-page .rtop--board > .rtp:first-child, main.race-detail-page .rtop--board > :first-child { margin-top: 0; }
/* The divider runs the full width (John): the board and the sidebar's first card start under it. */
main.race-detail-page .rtop + .rd-grid { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--rule); }
main.race-detail-page .rtop--board > .rtp:first-child { border-top: 0; padding-top: 0; }
@media (max-width: 1023px) { main.race-detail-page .rtop + .rd-grid { margin-top: 24px; padding-top: 20px; } }
@media (min-width: 1024px) {
    main.race-detail-page .rtop .rtp--aff { grid-template-columns: minmax(0, 1fr); }
    main.race-detail-page .rtop .rtp--aff > .rtp-aff { display: none; }
}

/* Dividers (13 Nov 2026 check): one rule per section, the heading's. The old section borders
   above Guides and More races doubled it; the last-updated and edit rows don't need one. */
main.race-detail-page .related-guides-section,
main.race-detail-page .related-races-section,
main.race-detail-page .share-section,
main.race-detail-page .last-updated { border-top: 0; }

/* Phone white space (13 Nov 2026, John: "a lot when scrolling on iPhone"). Under 1024px .rd-grid
   is a flex column, where margins add instead of collapsing: a section's 32-36px bottom plus a
   heading's 48px top left ~90px above every section rule, and Guides / More races added their
   own 48px margin + 32px padding (~180px). A heading that opens a section takes 16px, so the
   rule sits ~50px under the content above, as on desktop. */
@media (max-width: 1023px) {
    main.race-detail-page .rd-main h2:not([class]):first-child,
    main.race-detail-page .rd-main h2[id]:not(.rtp-title):first-child,
    main.race-detail-page .faq-section h2:first-child,
    main.race-detail-page .related-guides-section h2,
    main.race-detail-page .related-races-section h2,
    main.race-detail-page section > h2[id$="parkruns-heading"]:first-child { margin-top: 16px; }
    /* Events kept 48px under it where every other section has 36px. */
    main.race-detail-page .rd-top .schedule-section { margin-bottom: 36px; }
    /* An ad already sits under a section's 36px bottom margin: 12px more, not 28. */
    main.race-detail-page .rd-main > .mrh-ad--incontent { margin-top: 12px; }
}

/* Desktop white space (13 Nov 2026, the phone pass's twin). The heading's 48px is the gap
   between sections everywhere; these added to it: Guides / More races' old 48px margin and
   32px padding (~145px), About's 32px bottom (About and the article are separate grid
   cells, so margins don't collapse: 88px), and the register box's 40px bottom. */
main.race-detail-page .related-guides-section,
main.race-detail-page .related-races-section { margin-top: 0; padding-top: 0; }
@media (min-width: 1024px) {
    main.race-detail-page .rd-grid > .rd-lead { margin-bottom: 0; }
    main.race-detail-page .rd-register { margin-bottom: 0; }
}
