/* RacesCanada - Race Search Page
   TRAIL RUN MAGAZINE INSPIRED - Bold & Energetic Light Theme
   Matching race-detail.css aesthetic
   ============================================================ */

/* ============================================================
   CSS VARIABLES - Light Theme with Golden Accent
   ============================================================ */
.race-search-body {
    /* Backgrounds - clean white */

    /* Text - rich dark */

    /* Borders */

    /* Accent - Trail Run Mag golden yellow */

    /* Distance badge colors */

    /* Sport category colors */

    /* Typography */

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}

/* ============================================================
   BASE RESET
   ============================================================ */
html:has(.race-search-body),
.race-search-body {
    overflow-x: clip;
    overscroll-behavior-x: none;
}

.race-search-body {
    background: var(--rs-bg) !important;
    color: var(--rs-text) !important;
    font-family: var(--font-body) !important;
}

.race-search-body * {
    box-sizing: border-box;
}

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

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

.race-search-body header::after {
    display: none;
}

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

.race-search-body .site-logo {
    filter: brightness(0) invert(1);
    height: 40px;
    width: auto;
    animation: none;
}

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

.race-search-body .header-text .site-title .highlight {
    color: var(--rs-accent-ink);
    -webkit-text-fill-color: var(--rs-accent);
    background: none;
}

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

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

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

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

.race-search-body .nav-links .nav-left a {
    color: rgba(255,255,255,0.9);
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 14px;
    text-decoration: none;
    transition: color 0.15s ease;
    border: none;
    padding: 0;
}

.race-search-body .nav-links .nav-left a:hover {
    color: var(--rs-accent-ink);
}

.race-search-body .nav-links .nav-left a.active {
    color: var(--rs-accent-ink);
    border: none;
    text-decoration: none;
}

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

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

.race-search-body .nav-sign-in:active {
    transform: translateY(0);
}

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

.race-search-body .nav-user-btn {
    background: transparent;
    color: #fff;
}

.race-search-body .nav-user-name {
    color: #fff;
}

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

.race-search-body .nav-user-initials {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

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

.race-search-body .nav-dropdown-menu a,
.race-search-body .nav-dropdown-menu button {
    color: var(--rs-text-secondary);
    background: transparent;
    font-family: var(--font-body);
    border: none;
    padding: 10px 16px;
}

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

.race-search-body .nav-dropdown-menu hr {
    border-color: var(--rs-border);
    margin: 4px 0;
}

/* ============================================================
   HERO SECTION - Compact with Image
   ============================================================ */
.race-search-body .search-hero {
    position: relative;
    /* Browse is a task surface — enough hero to set the brand, not half the
       viewport before the first filter. */
    height: 34vh;
    min-height: 260px;
    max-height: 320px;
    margin-top: 70px;
    overflow: hidden;
}

.race-search-body .search-hero .hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 40%;
}

.race-search-body .search-hero .hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 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%
    );
}

.race-search-body .search-hero .hero-content {
    position: absolute;
    top: 45%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    text-align: center;
    padding: 0 24px;
}

.race-search-body .search-hero .hero-title {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 700;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0,0,0,0.4);
    margin: 0 0 12px 0;
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.race-search-body .search-hero .hero-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.race-search-body .search-hero .hero-description {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 0 1px 6px rgba(0,0,0,0.3);
    margin: 0 auto 12px;
    font-weight: 400;
    max-width: 500px;
}

/* State links integrated into hero — pill chip style */
.race-search-body .search-hero .hero-state-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 8px;
    margin-top: 10px;
}

.race-search-body .search-hero .hero-state-links a {
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 5px 14px;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
    letter-spacing: 0.03em;
}

.race-search-body .search-hero .hero-state-links a:hover {
    background: var(--rs-accent);
    border-color: var(--rs-accent);
    color: #000;
}

/* Title band (20 Oct 2026): /races, the hubs and the month/weekend pages open
   on a short dark band instead of the stock sunset photo. Left-aligned to the
   list below it; the hubs add a "Next up" strip of the first three races. */
.race-search-body .search-hero.search-hero--band {
    height: auto;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    background: var(--rs-text);
    color: #fff;
}
.race-search-body .search-hero.search-hero--band .hero-content {
    position: static;
    transform: none;
    text-align: left;
    max-width: none;
    margin: 0;
    /* Left edge on the breadcrumb's and the month sidebar's (20px); the top
       clears the absolutely-positioned breadcrumb (.breadcrumb-nav). */
    padding: 48px 20px 24px;
}
/* Month/weekend and results pages: the title starts on the PAGE FRAME edge
   (style.css, 8 Nov 2026), like the list and the month strip below it. */
.race-search-body .search-hero.search-hero--band.cal-hero .hero-content {
    max-width: calc(var(--frame-w, 1100px) + 64px);
    margin: 0 auto;
    padding-left: 32px;
    padding-right: 32px;
}
.race-search-body .search-hero--band .hero-title {
    font-size: clamp(1.75rem, 3.4vw, 2.75rem);
    text-shadow: none;
    margin-bottom: 8px;
    text-wrap: balance;
}
.race-search-body .search-hero--band .hero-subtitle,
.race-search-body .search-hero--band .hero-description {
    text-shadow: none;
    color: rgba(255, 255, 255, 0.78);
    margin-left: 0;
    max-width: 62ch;
}
.race-search-body .search-hero--band .hero-state-links {
    justify-content: flex-start;
    margin-top: 16px;
}
.race-search-body .search-hero--band .hero-state-links a {
    border-color: rgba(255, 255, 255, 0.28);
}
.race-search-body .search-hero--band .hero-state-links a:focus-visible,
.race-search-body .next-up-list a:focus-visible {
    outline: 2px solid var(--rs-accent);
    outline-offset: 2px;
}

.race-search-body .next-up {
    max-width: 1240px;
    margin: 0;
    padding: 0 20px 28px;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 16px;
}
.race-search-body .next-up-title {
    font-family: var(--font-body);
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.78);
    margin: 0;
    white-space: nowrap;
}
.race-search-body .next-up-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}
.race-search-body .next-up-list a {
    display: grid;
    gap: 2px;
    padding: 12px 16px;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 10px;
    color: #fff;
    text-decoration: none;
    transition: border-color 0.18s ease-out, background-color 0.18s ease-out;
}
.race-search-body .next-up-list a:hover {
    border-color: var(--rs-accent);
    background: rgba(255, 255, 255, 0.05);
}
.race-search-body .next-up-date {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--rs-accent-ink);
    font-variant-numeric: tabular-nums;
}
.race-search-body .next-up-name {
    font-weight: 600;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.race-search-body .next-up-place {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.72);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Band photo: contained on the right, fading into the black so the title and
   Next up sit on solid ground on the left. The overlay keeps any text that runs
   over the photo (long titles, the third Next-up card) at >= 4.5:1. */
.race-search-body .search-hero.search-hero--band {
    position: relative;
    isolation: isolate;
    /* The photo is 240px tall on phones; on the shorter month/weekend bands it
       spilled out and its overlay covered the month chips below (20 Oct 2026). */
    overflow: hidden;
}
.race-search-body .band-photo {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(58%, 960px);
    z-index: -1;
    pointer-events: none;
}
.race-search-body .band-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: right 45%;
    -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 42%);
            mask-image: linear-gradient(to right, transparent 0%, #000 42%);
}
.race-search-body .band-photo::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to right, rgba(22, 22, 22, 0.6) 0%, rgba(22, 22, 22, 0.35) 55%, rgba(22, 22, 22, 0.15) 100%),
                linear-gradient(to top, rgba(22, 22, 22, 0.55) 0%, rgba(22, 22, 22, 0) 45%);
}
.race-search-body .search-hero--band .hero-title,
.race-search-body .search-hero--band .hero-subtitle {
    text-shadow: 0 1px 12px rgba(0, 0, 0, 0.35);
}
.race-search-body .next-up-list a {
    background: rgba(22, 22, 22, 0.78);
    -webkit-backdrop-filter: blur(6px);
            backdrop-filter: blur(6px);
}
.race-search-body .next-up-list a:hover {
    background: rgba(22, 22, 22, 0.9);
}

@media (max-width: 768px) {
    .race-search-body .search-hero.search-hero--band { min-height: 0; }
    .race-search-body .search-hero.search-hero--band .hero-content,
    .race-search-body .search-hero.search-hero--band.cal-hero .hero-content {
        position: static;
        padding: 20px 20px 16px;
    }
    .race-search-body .search-hero--band .hero-subtitle { margin-bottom: 0; }
    /* Phones: the photo fills the band's top and darkens into the black, so the
       title reads over it and Next up sits on solid black. */
    .race-search-body .band-photo { width: 100%; bottom: auto; height: 240px; }
    .race-search-body .band-photo img {
        object-position: 78% 50%;
        -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
                mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
    }
    .race-search-body .band-photo::after {
        background: linear-gradient(to bottom, rgba(22, 22, 22, 0.45) 0%, rgba(22, 22, 22, 0.7) 60%, rgba(22, 22, 22, 0.95) 100%);
    }
    .race-search-body .search-hero--band .hero-title { font-size: 1.6rem !important; }
    /* The filter panel already picks the state on /races and the hubs; the
       month pages keep their chips (they are that page's navigation) as one
       scrolling row instead of two wrapped rows of big pills. */
    .race-search-body .search-hero--band:not(.cal-hero) .hero-state-links { display: none; }
    .race-search-body .search-hero--band.cal-hero .hero-state-links {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
        margin: 12px -20px 0;
        padding: 0 20px 4px;
        gap: 8px;
    }
    .race-search-body .search-hero--band.cal-hero .hero-state-links::-webkit-scrollbar { display: none; }
    .race-search-body .search-hero--band.cal-hero .hero-state-links a { flex: none; }
    .race-search-body .next-up {
        grid-template-columns: minmax(0, 1fr);
        gap: 8px;
        padding: 0 20px 20px;
    }
    .race-search-body .next-up-list { grid-template-columns: minmax(0, 1fr); gap: 8px; }
    .race-search-body .next-up-list a {
        grid-template-columns: 76px minmax(0, 1fr);
        column-gap: 12px;
        padding: 10px 12px;
        min-height: 44px;
    }
    .race-search-body .next-up-date { grid-row: span 2; align-self: center; }
}
@media (prefers-reduced-motion: reduce) {
    .race-search-body .next-up-list a { transition: none; }
}

/* ============================================================
   FILTER CONTROLS - Light Theme, Sticky
   ============================================================ */
.race-search-body .controls {
    background: var(--rs-bg);
    border-bottom: 1px solid var(--rs-border);
    padding: 20px 32px;
    position: sticky;
    top: 70px;
    z-index: 99;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

/* Desktop: show all filters inline */
.race-search-body .controls-top-row {
    display: contents;
}

.race-search-body .filter-options {
    display: contents;
}

.race-search-body .mobile-filter-toggle {
    display: none;
}

.race-search-body .controls-row {
    max-width: 1600px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

/* Inputs, Selects, Date Pickers */
.race-search-body select,
.race-search-body input[type="text"],
.race-search-body input[type="date"],
.race-search-body .search-input {
    /* background-color, not the background shorthand: the shorthand resets
       background-image and would wipe the select chevron set in style.css */
    background-color: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    border-radius: 25px;
    color: var(--rs-text);
    font-family: var(--font-body);
    font-size: 16px; /* 16px min: prevents iOS zoom-on-focus */
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.race-search-body select:hover,
.race-search-body input[type="text"]:hover,
.race-search-body input[type="date"]:hover,
.race-search-body .search-input:hover {
    border-color: var(--rs-border-dark);
}

.race-search-body select:focus,
.race-search-body input[type="text"]:focus,
.race-search-body input[type="date"]:focus,
.race-search-body .search-input:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px var(--rs-accent-glow);
}

.race-search-body select option {
    background: var(--rs-bg-card);
    color: var(--rs-text);
}

.race-search-body .search-input {
    min-width: 280px;
    flex: 1 1 280px;
    max-width: 360px;
}

.race-search-body .search-input::placeholder {
    color: var(--rs-text-muted);
}

/* Multi-select dropdown */
.race-search-body .multi-select-btn {
    background: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    border-radius: 25px;
    color: var(--rs-text);
    font-family: var(--font-body);
    font-size: 14px;
    padding: 12px 18px;
    transition: all 0.2s ease;
}

.race-search-body .multi-select-btn:hover {
    border-color: var(--rs-border-dark);
}

.race-search-body .multi-select-btn:focus {
    border-color: var(--rs-accent);
    box-shadow: 0 0 0 3px var(--rs-accent-glow);
}

.race-search-body .dropdown-arrow {
    color: var(--rs-text-muted);
}

.race-search-body .multi-select-options {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
}

.race-search-body .multi-select-option {
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    padding: 12px 16px;
}

.race-search-body .multi-select-option:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
}

/* ============================================================
   MAIN LAYOUT - 3-Column Grid
   ============================================================ */
.race-search-body .main-layout {
    display: grid;
    grid-template-columns: 200px minmax(0, 1fr) var(--cal-col, 360px);
    min-height: calc(100vh - 200px);
    gap: 0;
    background: var(--rs-bg);
}

/* Third track = Journey's sidebar (20 Oct 2026, docs/journey-ads-best-practice.md):
   signed out, the short .guest-rail card; signed in, My Races. Static (Journey's
   sticky ad can't sit under a sticky sidebar), >= 300px inside, spanning the
   list's full height so the ad has room to run. Journey shows it from 1100px, so
   below that signed-out visitors get no third track at all. --cal-col is the one
   switch: every breakpoint below sizes the track through it. `logged-in` is
   server-rendered on index.html (anon HTML is the only thing edge-cached). */
.race-search-body:not(.logged-in) .main-layout { --cal-col: 340px; }
.race-search-body.logged-in .main-layout { --cal-col: 360px; }
@media (max-width: 1099px) {
    .race-search-body:not(.logged-in) .main-layout { --cal-col: 0px; }
}
.race-search-body:not(.logged-in) .my-calendar-sidebar { display: none; }
/* Desktop filter bar: full width and NOT sticky (8 Nov 2026, John: "the top
   thing all the way across"). On 20 Oct it stopped at the sidebar track, because
   a full-width sticky bar covered the top of Journey's sticky sidebar ad (which
   sticks under the 70px header) - but that left a notch beside the bar. It now
   scrolls away with the page; the month list on the left is the way around a
   long list. Phones keep their own sticky filter toggle. */
@media (min-width: 1100px) {
    .race-search-body .controls { position: static; box-shadow: none; }
    /* The month list no longer sits under a sticky bar: just the 70px header. */
    .race-search-body .main-layout > .month-nav-sidebar { top: 90px; max-height: calc(100vh - 110px); }
    .race-search-body .controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
    .race-search-body .controls .search-input { flex: 1 1 160px; min-width: 0; width: auto; }
    .race-search-body .controls select,
    .race-search-body .controls .multi-select-dropdown { flex: 0 1 auto; min-width: 110px; width: auto; }
    .race-search-body .controls .multi-select-btn { white-space: nowrap; width: 100%; }
    .race-search-body .controls input[type="date"] { flex: 0 0 156px; width: 156px; }
}
@media (min-width: 1440px) {
    .race-search-body .controls { flex-wrap: nowrap; }
}

.race-search-body .main-layout { grid-template-rows: auto 1fr; }
.race-search-body .main-layout > .month-nav-sidebar,
.race-search-body .main-layout > .main-content { grid-row: 1 / span 2; }
.race-search-body .main-layout > .journey-sidebar {
    grid-column: 3;
    grid-row: 1 / span 2;
    align-self: stretch;
}
.race-search-body .main-layout > .my-calendar-sidebar.journey-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    /* style.css gives .my-calendar-sidebar height: 100vh (from when it was a
       sticky panel), which beat align-self: stretch: the grey panel and its
       border stopped one screen down, mid-page, and Journey's sticky ad had
       ~100px to stick in (John, 4 Nov 2026). Let it run the column. */
    height: auto;
}
/* Sidebar ads under My Races / the sign-in card (static/ads.js, 11 Nov 2026): the column
   is a flex column so .rail-ads takes the height left under the panel's own content
   (the base rule's display:block otherwise left it 0px tall, so no ad was placed). */
@media (min-width: 1024px) {
    .race-search-body .main-layout > .journey-sidebar:has(> .rail-ads) { display: flex; flex-direction: column; }
    .race-search-body .main-layout > .journey-sidebar > .rail-ads { margin-top: 28px; }
}
.race-search-body .guest-rail .journey-rail-box { margin: 28px 0 0; }
/* Gutter to the window edge; 340 - 20 keeps 320px inside (Journey: >= 300). */
.race-search-body .main-layout > .guest-rail { width: auto; padding-right: 20px; }
.race-search-body .guest-rail-text {
    font-size: 0.92rem;
    line-height: 1.55;
    color: var(--rs-text-secondary);
    margin: 0 0 14px;
}
.race-search-body .guest-rail-btn {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
    padding: 0 18px;
    margin: 0 0 14px;
    border-radius: 999px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-weight: 700;
    font-size: 0.92rem;
    text-decoration: none;
}
.race-search-body .guest-rail-btn:hover { background: var(--rs-accent-hover); }
.race-search-body .guest-rail .journey-rail-link { display: block; }
/* Fallback if Journey ever adds its own rail beside the sidebar instead of in it. */
.race-search-body .main-layout > .mv-stacked-sidebar-rail { grid-column: 3; grid-row: 2; min-width: 0; }

/* ============================================================
   MONTH NAVIGATION SIDEBAR (Left)
   ============================================================ */
.race-search-body .month-nav-sidebar {
    background: var(--rs-bg-elevated);
    border-right: 1px solid var(--rs-border);
    padding: 28px 20px;
    position: sticky;
    top: 130px;
    align-self: start;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
}

.race-search-body .month-nav-sidebar h2 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--rs-border);
}

/* Year groups */
.race-search-body .year-group {
    margin-bottom: 8px;
}

.race-search-body .year-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.15s ease;
}

.race-search-body .year-header:hover {
    background: var(--rs-bg-card);
}

.race-search-body .year-toggle {
    font-size: 11px;
    color: var(--rs-text-muted);
    transition: transform 0.2s ease;
}

.race-search-body .year-group.expanded .year-toggle {
    transform: rotate(90deg);
}

.race-search-body .year-label {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .year-count {
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-left: auto;
}

.race-search-body .year-months {
    display: none;
    padding-left: 20px;
}

.race-search-body .year-group.expanded .year-months {
    display: block;
}

.race-search-body .month-nav-item {
    padding: 10px 14px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--rs-text-secondary);
    cursor: pointer;
    border-radius: 8px;
    border: none;
    transition: all 0.15s ease;
    margin-bottom: 4px;
}

.race-search-body .month-nav-item:hover {
    background: var(--rs-bg-card);
    color: var(--rs-text);
    transform: none;
}

.race-search-body .month-nav-item.active {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-weight: 600;
    box-shadow: none;
}

/* ============================================================
   MAIN CONTENT AREA (Center)
   ============================================================ */
.race-search-body .main-content {
    background: var(--rs-bg);
    padding: 32px 40px;
    position: relative;
}

/* Cap the reading column so a wide screen (or a guest with no calendar track)
   doesn't stretch list rows and in-feed ads far past the ~1160-1280px the desktop
   ad units were sampled at (see DESKTOP_IN_FEED_UNITS in app.js). */
.race-search-body .main-content > * {
    max-width: 1280px;
    margin-left: auto;
    margin-right: auto;
}

.race-search-body #races-container {
    max-width: 1280px;
}

/* Loading state - positioned absolutely to avoid CLS when hidden */
.race-search-body .loading {
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    padding: 48px;
    text-align: center;
    position: absolute;
    left: 0;
    right: 0;
    z-index: 1;
}

/* First-paint skeleton (templates/index.html). Replaces the old centred
   "Loading races..." text so the initial render shows structured content and
   real cards drop in with no layout shift. Every rule is scoped under
   .race-skeleton so it outranks the equal-specificity .race-card-thumbnail
   rule below (which sets `background` shorthand and would otherwise wipe the
   shimmer's background-image on the thumbnail box). */
.race-search-body .race-skeleton .race-card--skeleton {
    pointer-events: none;
}
.race-search-body .race-skeleton .race-card--skeleton:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
}
.race-search-body .race-skeleton .race-card-content {
    gap: 12px;
    justify-content: center;
}
.race-search-body .race-skeleton .skeleton-box,
.race-search-body .race-skeleton .skeleton-line {
    display: block;
    background-color: var(--rs-bg-elevated);
    background-image: linear-gradient(
        90deg,
        var(--rs-bg-elevated) 0%,
        var(--rs-border) 50%,
        var(--rs-bg-elevated) 100%
    );
    background-repeat: no-repeat;
    background-size: 200% 100%;
    animation: rs-skeleton-shimmer 1.4s ease-in-out infinite;
    border-radius: 6px;
}
/* .skeleton-box sits ON .race-card-thumbnail, so it keeps that element's
   305x234 (desktop) / 16:9 (mobile) box — only the fill changes. */
.race-search-body .race-skeleton .skeleton-line { height: 14px; border-radius: 4px; }
.race-search-body .race-skeleton .skeleton-line--sm { width: 30%; height: 11px; }
.race-search-body .race-skeleton .skeleton-line--lg { width: 75%; height: 20px; }
.race-search-body .race-skeleton .skeleton-line--md { width: 45%; }
.race-search-body .race-skeleton .skeleton-line--pills { width: 60%; height: 24px; border-radius: 12px; }

@keyframes rs-skeleton-shimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
    .race-search-body .race-skeleton .skeleton-box,
    .race-search-body .race-skeleton .skeleton-line {
        animation: none;
        background-image: none;
    }
}

/* Empty state */
.race-search-body .empty-state {
    text-align: center;
    padding: 64px 32px;
    color: var(--rs-text-secondary);
}

.race-search-body .empty-state-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.race-search-body .empty-state h2 {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 8px;
}

/* ============================================================
   MONTH SECTIONS & HEADERS
   ============================================================ */
.race-search-body .month-section {
    margin-bottom: 48px;
    animation: none;
}

.race-search-body .month-header {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--rs-text);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--rs-border);
    display: inline-block;
    letter-spacing: -0.01em;
}

.race-search-body .month-header::after {
    display: none;
}

/* ============================================================
   RACE TABLE - Light Theme Cards
   ============================================================ */
.race-search-body .races-table {
    width: 100%;
    border-collapse: collapse;
    background: transparent;
    border-radius: 0;
    box-shadow: none;
    margin-bottom: 0;
}

.race-search-body .races-table thead {
    background: var(--rs-bg-elevated);
}

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

.race-search-body .races-table td {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-secondary);
    padding: 16px;
    border-bottom: 1px solid var(--rs-border-light);
    vertical-align: middle;
}

.race-search-body .races-table tbody tr:last-child td {
    border-bottom: 1px solid var(--rs-border);
}

.race-search-body .race-row {
    transition: all 0.15s ease;
}

.race-search-body .race-row:hover {
    background: var(--rs-bg-elevated);
}

.race-search-body .race-row:hover td {
    color: var(--rs-text);
}

/* Featured race styles - light theme */

/* Date cell */
.race-search-body .race-date-cell {
    color: var(--rs-text-muted);
    font-weight: 600;
    white-space: nowrap;
    width: 80px;
}

/* Race name cell */
.race-search-body .race-name-cell {
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .race-name-cell .race-name-link {
    color: var(--rs-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .race-name-cell .race-name-link:hover {
    color: var(--rs-accent-hover);
    text-decoration: underline;
}

/* Sport badges - light theme */
.race-search-body .sport-badge {
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 12px;
    margin-left: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #fff;
}

.race-search-body .sport-badge-triathlon { background: var(--rs-triathlon); }
.race-search-body .sport-badge-duathlon { background: var(--rs-duathlon); }
.race-search-body .sport-badge-aquathon { background: var(--rs-aquathon); }
.race-search-body .sport-badge-multisport { background: var(--rs-multisport); }

/* Pale chip with dark text, same family as .series-badge - the old white on
   #14b8a6 was ~2.5:1 at 10px, the least legible text on a card. */
.race-search-body .terrain-badge-small {
    display: inline-block;
    background: #ccfbf1;
    color: #115e59;
    font-size: 12px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    margin-left: 8px;
    vertical-align: middle;
}

/* Recurring-series badge (card header + list row) */
.race-search-body .series-badge {
    background: #e0e7ff;
    color: #3730a3;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.race-search-body .race-name-cell .series-badge {
    margin-left: 8px;
}

/* Location cell */
.race-search-body .race-location-cell {
    color: var(--rs-text-muted);
}

/* ============================================================
   RACE CARD LIST - Horizontal cards with thumbnail
   ============================================================ */
.race-search-body .race-card-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
}

.race-search-body .race-card {
    display: flex;
    flex-direction: row;
    background: var(--rs-bg-card);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--rs-border-light);
}

.race-search-body .race-card-clickable {
    cursor: pointer;
}

.race-search-body .race-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .race-card-thumbnail {
    flex-shrink: 0;
    width: 305px;
    height: 234px;
    overflow: hidden;
    position: relative;
    background: var(--rs-bg-elevated);
}

.race-search-body .race-card-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: var(--rs-bg-elevated);
    transition: transform 0.3s ease;
}

.race-search-body .race-card:hover .race-card-thumbnail img {
    transform: scale(1.05);
}

.race-search-body .race-card-content {
    flex: 1;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Allow text truncation */
}

.race-search-body .race-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 4px;
}

.race-search-body .race-card-date {
    white-space: nowrap;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rs-text-muted);
}

.race-search-body .race-card-title {
    font-family: var(--font-body);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--rs-text);
    margin: 0 0 6px 0;
    line-height: 1.3;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}
/* Sport/terrain badges, aria-hidden so the heading reads as the race name. */
.race-search-body .race-card-tags {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
}

.race-search-body .race-card-title .race-name-link {
    color: var(--rs-text);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .race-card-title .race-name-link:hover {
    color: var(--rs-accent-hover);
}

.race-search-body .race-card-location {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-muted);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.race-search-body .race-card-location::before {
    content: '📍';
    font-size: 12px;
}

.race-search-body .race-card-description {
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    color: var(--rs-text-secondary);
    margin: 0 0 12px 0;
}

.race-search-body .race-card-distances {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
}

.race-search-body .race-card-distances .distance-badge {
    font-size: 12px;
    padding: 4px 10px;
}

/* Distance labels on race cards (card review, 30 Oct 2026): runner terms,
   three at most + "+N more". Facts, not buttons, so no pill border or hover;
   saving is the bookmark in the card header. */
.race-search-body .card-label {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    background: var(--rs-bg-elevated);
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    white-space: nowrap;
}
.race-search-body .card-label--more {
    background: none;
    padding-left: 2px;
    color: var(--rs-text-muted);
}

/* Bookmark: one save per card, opening a list of the organiser's entries. */
.race-search-body .save-icon-wrapper {
    position: relative;
    margin-left: auto;
}
.race-search-body .save-icon-wrapper + .share-icon-wrapper {
    margin-left: 0;
}
.race-search-body .save-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--rs-bg-elevated);
    color: var(--rs-text-muted);
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}
.race-search-body .save-icon-btn:hover,
.race-search-body .save-icon-btn[aria-expanded="true"] {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}
.race-search-body .save-icon-btn.is-saved {
    color: var(--rs-text);
}
.race-search-body .save-popup {
    position: fixed;
    width: max-content;
    min-width: 200px;
    max-width: min(300px, calc(100vw - 32px));
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    cursor: default;
}
.race-search-body .save-popup--sheet {
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-width: none;
    border-radius: 14px 14px 0 0;
    border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
    animation: save-sheet-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.race-search-body .save-popup--sheet .save-popup-head {
    padding: 16px 16px 12px;
    font-size: 14px;
    color: var(--rs-text);
}
.race-search-body .save-popup--sheet .save-popup-list {
    max-height: 60vh;
}
.race-search-body .save-popup-scrim {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 0.35);
    z-index: 999;
}
@keyframes save-sheet-in {
    from { transform: translateY(24px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .race-search-body .save-popup--sheet { animation: none; }
}
.race-search-body .save-popup-head {
    padding: 10px 14px 8px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    color: var(--rs-text-muted);
    border-bottom: 1px solid var(--rs-border-light);
}
.race-search-body .save-popup-list {
    max-height: 296px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px 0;
}
.race-search-body .save-popup-item {
    display: block;
    width: 100%;
    padding: 9px 14px;
    border: none;
    background: none;
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.35;
    color: var(--rs-text);
    text-align: left;
    cursor: pointer;
}
.race-search-body .save-popup-item:hover,
.race-search-body .save-popup-item:focus-visible {
    background: var(--rs-bg-elevated);
    outline: none;
}
.race-search-body .save-popup-item.is-saved {
    color: var(--rs-text-muted);
    cursor: default;
}
.race-search-body .save-popup-item.is-saved::after {
    content: ' \2014  saved';
    font-size: 12px;
}
@media (max-width: 768px) {
    .race-search-body .save-icon-btn,
    .race-search-body .share-icon-btn {
        width: 40px;
        height: 40px;
    }
    .race-search-body .save-popup-item {
        padding: 13px 16px;
        font-size: 15px;
    }
    .race-search-body .race-card-header {
        gap: 8px;
    }
}

.race-search-body .race-card-distances .tba {
    font-size: 13px;
    color: var(--rs-text-muted);
    font-style: italic;
}

/* ============================================================
   SHARE BUTTON ON RACE CARDS
   ============================================================ */
.race-search-body .share-icon-wrapper {
    position: relative;
    margin-left: auto;
}

.race-search-body .share-icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--rs-bg-elevated);
    border-radius: 50%;
    color: var(--rs-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    padding: 0;
}

.race-search-body .share-icon-btn:hover {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
}

.race-search-body .share-popup {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 6px;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    z-index: 50;
    min-width: 140px;
    overflow: hidden;
}

.race-search-body .share-popup.active {
    display: block;
}

.race-search-body .share-popup-item {
    display: block;
    width: 100%;
    padding: 10px 16px;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    color: var(--rs-text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    transition: background 0.1s ease, color 0.1s ease;
}

.race-search-body .share-popup-item:hover {
    background: var(--rs-bg-elevated);
    color: var(--rs-text);
}

.race-search-body .share-popup-item:not(:last-child) {
    border-bottom: 1px solid var(--rs-border-light);
}

/* Calendar hint for logged-out users */
.race-search-body .calendar-hint {
    font-size: 12px;
    color: var(--rs-text-muted);
    margin-top: 8px;
    opacity: 0.8;
}

/* Hide hint when logged in */
.race-search-body.logged-in .calendar-hint {
    display: none;
}

/* Featured banner section — above all month sections */
.race-search-body .featured-banner-section {
    margin-bottom: 40px;
}

.race-search-body .featured-banner-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--rs-text-muted);
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--rs-accent);
    display: inline-block;
}

/* Unsold Gold/Diamond banner slot - a house ad for the placement itself.
   Same footprint as the real banner section so layout doesn't jump between
   states, deliberately quieter than a sponsor card (dashed border, no
   image) so it reads as "this space available", not as a race listing. */

/* Base (desktop): the fuller call to action. The short variant is revealed
   in the mobile block below - declared here first so source order lets the
   media query win, since both selectors have the same specificity. */
.race-search-body .house-ad-cta-short { display: none; }

/* Small print under the "Races worth entering" slot when it's showing
   affiliate/partner races instead of paid Diamond inventory. */
.race-search-body .featured-slot-note {
    margin: 0.75rem 0 0;
    font-size: 0.82rem;
    color: var(--rs-text-secondary);
}
.race-search-body .featured-slot-note a { font-weight: 600; white-space: nowrap; }

/* On a phone the two-sentence pitch wraps onto four or five lines and the
   flex row breaks, so this house ad ends up taller than the race cards it
   sits above - a lot of screen for unsold inventory. Drop to the hook alone
   on one line, keep the CTA inline, and tighten the padding. The full pitch
   still reads on desktop, where there's room for it. */
@media (max-width: 640px) {

    /* The second sentence is the expendable half of the pitch. */

    .race-search-body .house-ad-cta-long { display: none; }
    .race-search-body .house-ad-cta-short { display: inline; }
}

/* Featured card styling */

/* Ad slot in card list. TEMP 2026-09-17: this used to set an explicit
   height: var(--ad-reserve) (0px) here, same pattern as .ad-race-detail. That
   was fine for the old "auto" Display unit, but AdSense's own in-feed
   placement doc (support.google.com/adsense/answer/9189560) is explicit for
   this ad type: the parent container needs "variable height, not fixed" -
   "Failure to meet these requirements prevents ads from displaying or causes
   distortion." An explicit height:0 is a fixed height, not a variable one -
   dropped it. An empty display:block <ins> with nothing in it already
   collapses to 0 height on its own, so this looks identical while unfilled;
   overflow:hidden stays as a backstop for the brief moment a fill is
   resizing in. */
.race-search-body .race-card-ad {
    padding: 0;
    overflow: hidden;
}

/* TEMP 2026-09-17: these units are staying pending indefinitely (no fill, no
   unfill - see the fill investigation) rather than resolving either way in a
   reasonable time, so the earlier 400px cap was leaving every one of them
   sitting open as a permanent blank gap instead of the brief loading flash it
   was sized for. Collapsed to 0 while pending instead - still a max-height,
   not a fixed height (AdSense's in-feed doc wants "variable, not fixed"), it
   just happens to bound at 0 by default and only grows once
   :has(...="filled") below overrides it. Real ads: 400px -> 0.
   Unfilled is removed entirely by the rule after. */
.race-search-body .race-card-ad .adsbygoogle:not([data-ad-status]) {
    max-height: 0;
}

.race-search-body .race-card-ad:has(.adsbygoogle[data-ad-status="filled"]) {
    padding: 16px 0;
    height: auto;
    overflow: visible;
}

.race-search-body .race-card-ad:has(.adsbygoogle[data-ad-status="unfilled"]) {
    display: none;
}

/* In-feed ad row on /race-results — same shape as .race-card-ad above (fluid
   in-feed unit, variable height not fixed, pending state collapses via
   max-height not a hard height:0). rr-row match on filled so it reads as
   another row in the list rather than a separate block. */
.race-search-body .rr-row-ad {
    padding: 0;
    overflow: hidden;
}

.race-search-body .rr-row-ad .adsbygoogle:not([data-ad-status]) {
    max-height: 0;
}

.race-search-body .rr-row-ad:has(.adsbygoogle[data-ad-status="filled"]) {
    padding: 14px 2px;
    border-bottom: 1px solid #e6e6e6;
    height: auto;
    overflow: visible;
}

.race-search-body .rr-row-ad:has(.adsbygoogle[data-ad-status="unfilled"]) {
    display: none;
}

/* Infinite scroll load indicator */
.race-search-body .load-more-indicator {
    text-align: center;
    padding: 32px 16px;
    color: var(--rs-text-muted);
    font-size: 14px;
}

.race-search-body .load-more-indicator .loading-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--rs-border);
    border-top-color: var(--rs-accent);
    border-radius: 50%;
    margin: 12px auto 0;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Responsive - stack vertically on mobile */
@media (max-width: 768px) {
    /* Stays a flex column: as display: block, Journey put an ad after every
       card on phones (tried 30 Oct 2026, reverted). */
    .race-search-body .race-card {
        flex-direction: column;
    }

    .race-search-body .race-card-thumbnail {
        width: 100%;
        /* 16:9 matches the shape of the photos we scrape. A fixed 200px height
           made the box ~1.95:1 at 390px, so every photo letterboxed against
           --rs-bg-elevated. object-fit stays `contain` so logo-style images
           (e.g. club roundels) are never cropped. */
        aspect-ratio: 16 / 9;
        height: auto;
    }

    .race-search-body .race-card-content {
        padding: 14px;
    }

    .race-search-body .race-card-title {
        font-size: 1rem;
    }
}

/* ============================================================
   DISTANCE BADGES - Light Theme with Color Borders
   ============================================================ */
.race-search-body .race-distances-cell .distance-badge,
.race-search-body .distance-badge {
    background: var(--rs-bg-card);
    border: 2px solid var(--rs-border);
    border-radius: 20px;
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 6px 14px;
    cursor: pointer;
    transition: all 0.15s ease;
    box-shadow: none;
    white-space: normal;
    max-width: 180px;
    text-align: center;
    line-height: 1.3;
}

/* Long distance names - use normal case for readability */
/* Organiser text as written on every pill (was: CSS-uppercased short names
   beside mixed-case long ones - "10KM" next to "1KM Kids Fun Run"), matching
   the race detail page. Long sponsor-named distances stay on one line and
   truncate; the full name is in the title tooltip. */
.race-search-body .distance-badge {
    text-transform: none;
}
.race-search-body .distance-badge.long-name {
    display: inline-block;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.race-search-body .race-distances-cell .distance-badge::before,
.race-search-body .distance-badge::before {
    display: none;
}

.race-search-body .distance-badge:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.race-search-body .distance-badge:active {
    transform: scale(0.98);
}

/* Distance badge color variants */
.race-search-body .distance-badge.marathon,
.race-search-body .distance-badge[data-distance*="marathon"] {
    border-color: var(--rs-marathon);
    color: var(--rs-marathon);
}
.race-search-body .distance-badge.marathon:hover {
    background: var(--rs-marathon);
    color: #fff;
}

.race-search-body .distance-badge.half,
.race-search-body .distance-badge[data-distance*="half"] {
    border-color: var(--rs-half);
    color: var(--rs-half);
}
.race-search-body .distance-badge.half:hover {
    background: var(--rs-half);
    color: #fff;
}

.race-search-body .distance-badge.ten-k,
.race-search-body .distance-badge[data-distance*="10k"] {
    border-color: var(--rs-10k);
    color: var(--rs-10k);
}
.race-search-body .distance-badge.ten-k:hover {
    background: var(--rs-10k);
    color: #fff;
}

.race-search-body .distance-badge.five-k,
.race-search-body .distance-badge[data-distance*="5k"] {
    border-color: var(--rs-5k);
    color: var(--rs-5k);
}
.race-search-body .distance-badge.five-k:hover {
    background: var(--rs-5k);
    color: #fff;
}

/* Added state */
.race-search-body .distance-badge.added {
    background: var(--rs-5k);
    border-color: var(--rs-5k);
    color: #fff;
}

.race-search-body .distance-badge.added::after {
    content: ' ✓';
    margin-left: 4px;
}

.race-search-body .race-distances-cell .tba {
    color: var(--rs-text-muted);
    font-style: italic;
}

/* ============================================================
   MY CALENDAR SIDEBAR (Right)
   ============================================================ */
.race-search-body .my-calendar-sidebar {
    background: var(--rs-bg-elevated);
    border-left: 1px solid var(--rs-border);
    padding: 28px 24px;
    position: sticky;
    top: 130px;
    align-self: start;
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    display: block;
}

.race-search-body .calendar-header-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}
.race-search-body .calendar-header h2 a {
    color: inherit;
    text-decoration: none;
}
.race-search-body .calendar-header h2 a:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.race-search-body .calendar-open-link {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--rs-text);
    text-decoration: underline;
    text-decoration-color: var(--rs-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    white-space: nowrap;
}
.race-search-body .calendar-header h2 {
    font-family: var(--font-body);
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--rs-text);
    margin-bottom: 4px;
}

.race-search-body .calendar-subtitle {
    font-family: var(--font-body);
    font-size: 14px;
    color: var(--rs-text-muted);
    margin-bottom: 20px;
}

/* Sign-in prompt shown to logged-out users in sidebar */
.race-search-body .sidebar-signin-prompt {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

.race-search-body .sidebar-prompt-text {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--rs-text-secondary);
    line-height: 1.5;
    margin: 0 0 14px 0;
}

.race-search-body .sidebar-signin-btn {
    display: block;
    width: 100%;
    background: var(--rs-accent);
    color: #000;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 700;
    text-decoration: none;
    padding: 11px 16px;
    border-radius: 999px;
    transition: background 0.18s ease, transform 0.1s ease;
    text-align: center;
}

.race-search-body .sidebar-signin-btn:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-1px);
}

/* Guest sign-in prompt above the race list — stands in for the sidebar prompt,
   which guests no longer see now the sidebar is hidden for them. */
.race-search-body .guest-signin-prompt {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px 16px;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
}

.race-search-body .guest-signin-prompt .sidebar-prompt-text {
    margin: 0;
}

.race-search-body .guest-signin-prompt .sidebar-signin-btn {
    display: inline-block;
    width: auto;
    padding: 8px 18px;
    flex-shrink: 0;
}

.race-search-body.logged-in .guest-signin-prompt {
    display: none;
}

/* Stats box */
.race-search-body .calendar-stats {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .stat-box {
    text-align: center;
}

.race-search-body .stat-number {
    font-family: var(--font-display);
    font-size: 3rem;
    font-weight: 400;
    color: var(--rs-accent-hover);
    background: none;
    -webkit-text-fill-color: var(--rs-accent-hover);
    line-height: 1;
}

.race-search-body .stat-label {
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-top: 8px;
    display: block;
}

/* Summary section */
.race-search-body .sidebar-summary {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--rs-border-light);
    font-family: var(--font-body);
    font-size: 14px;
}

.race-search-body .summary-item:last-child {
    border-bottom: none;
}

.race-search-body .summary-item span:first-child {
    color: var(--rs-text-muted);
}

.race-search-body .summary-item span:last-child {
    color: var(--rs-text);
    font-weight: 600;
}

/* Parkrun section */
.race-search-body .parkrun-section {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.race-search-body .parkrun-section h3 {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 400;
    color: var(--rs-text);
    margin-bottom: 12px;
}

.race-search-body .parkrun-section input,
.race-search-body .parkrun-section select {
    width: 100%;
    margin-bottom: 8px;
}

.race-search-body .parkrun-section .hint {
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-top: 8px;
}

/* Calendar event cards */
.race-search-body .calendar-event-card {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-left: 4px solid var(--rs-accent);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    animation: none;
    box-shadow: var(--shadow-sm);
}

.race-search-body .calendar-event-card:hover {
    background: var(--rs-bg-elevated);
    transform: none;
    box-shadow: var(--shadow-md);
}

.race-search-body .event-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 8px;
}

.race-search-body .event-name {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--rs-text);
    line-height: 1.3;
}

.race-search-body .event-date {
    font-size: 13px;
    color: var(--rs-text-muted);
    white-space: nowrap;
}

.race-search-body .event-distance {
    display: inline-block;
    background: var(--rs-bg-elevated);
    border: 1px solid var(--rs-border);
    color: var(--rs-text-secondary);
    padding: 4px 12px;
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.race-search-body .event-time-until {
    background: var(--rs-bg-elevated);
    border-left: 3px solid var(--rs-accent);
    color: var(--rs-text-secondary);
    font-size: 13px;
    padding: 10px 12px;
    border-radius: 0 8px 8px 0;
    margin-top: 12px;
}

.race-search-body .event-time-until.event-today {
    border-left-color: #f59e0b;
    background: rgba(245, 158, 11, 0.1);
    color: #b45309;
    font-weight: 600;
}

.race-search-body .event-gap {
    border-top: 1px solid var(--rs-border-light);
    font-size: 12px;
    color: var(--rs-text-muted);
}

.race-search-body .gap-badge {
    background: var(--rs-bg-elevated);
    color: var(--rs-text-secondary);
    padding: 4px 10px;
    border-radius: 12px;
}

.race-search-body .gap-warning {
    color: #dc2626;
}

.race-search-body .gap-good {
    color: var(--rs-5k);
}

/* Course profile badge (measured climb on the longest course). */
.course-badge {
    display: inline-block;
    margin-left: 8px;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1.6;
    white-space: nowrap;
    background: #e5e7eb;
    color: #374151;
}
.course-badge--flat { background: #dcfce7; color: #166534; }
.course-badge--rolling { background: #e0f2fe; color: #075985; }
.course-badge--hilly { background: #fef3c7; color: #92400e; }
.course-badge--mountain { background: #fee2e2; color: #991b1b; }

/* Saved races in the sidebar (30 Oct 2026): one panel of plain rows with the
   race photo, replacing the boxed .calendar-event-card look. */
.race-search-body #my-calendar-events:has(.cal-race) {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    padding: 4px 16px;
    box-shadow: var(--shadow-sm);
}
.race-search-body .cal-race {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
}
.race-search-body .cal-race + .cal-race,
.race-search-body .cal-gap { border-top: 1px solid var(--rs-border-light); }
.race-search-body .cal-race-thumb {
    width: 56px;
    height: 56px;
    border-radius: 8px;
    overflow: hidden;
    background: var(--rs-bg-elevated);
    display: block;
}
.race-search-body .cal-race-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.race-search-body .cal-race-thumb img.fit-contain { object-fit: contain; }
.race-search-body .cal-race-name {
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--rs-text);
    text-decoration: none;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.race-search-body a.cal-race-name:hover { text-decoration: underline; }
.race-search-body .cal-race-meta {
    font-size: 13px;
    color: var(--rs-text-muted);
    margin-top: 2px;
}
.race-search-body .cal-race-when {
    font-size: 12px;
    font-weight: 600;
    color: var(--rs-text-secondary);
    margin-top: 2px;
}
.race-search-body .cal-race-remove {
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--rs-text-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}
.race-search-body .cal-race-remove:hover { background: var(--rs-bg-elevated); color: #b91c1c; }
.race-search-body .cal-race-remove:focus-visible { outline: 2px solid var(--rs-accent); outline-offset: 2px; }
.race-search-body .cal-gap {
    font-size: 12px;
    color: var(--rs-text-muted);
    padding: 6px 0 6px 68px;
}
.race-search-body .cal-gap + .cal-race { border-top: 0; }
.race-search-body .cal-gap--tight { color: #b45309; }

/* Empty calendar */
.race-search-body .empty-calendar {
    text-align: center;
    padding: 32px 16px;
    color: var(--rs-text-muted);
}

.race-search-body .empty-calendar p {
    font-size: 14px;
    margin-bottom: 4px;
}

.race-search-body .empty-calendar .hint,
.race-search-body .empty-calendar .help-text {
    font-size: 13px;
    color: var(--rs-text-muted);
}

/* ============================================================
   BUTTONS - Golden Accent, Rounded
   ============================================================ */
.race-search-body .btn {
    font-family: var(--font-body);
    font-weight: 600;
    padding: 12px 24px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.race-search-body .btn-remove {
    background: transparent;
    color: #dc2626;
    border: 1px solid #dc2626;
    border-radius: 20px;
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 14px;
    margin-top: 12px;
}

.race-search-body .btn-remove:hover {
    background: #dc2626;
    color: #fff;
}

/* ============================================================
   HOMEPAGE CONTENT SECTION
   ============================================================ */
.race-search-body .homepage-content {
    background: var(--rs-bg-elevated);
    border-top: 1px solid var(--rs-border);
    padding: 64px 32px;
}

.race-search-body .homepage-content-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.race-search-body .homepage-content h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--rs-text);
    margin-bottom: 1rem;
    text-align: center;
}

.race-search-body .homepage-intro {
    font-size: 1.05rem;
    line-height: 1.7;
    color: var(--rs-text-secondary);
    text-align: center;
    max-width: 720px;
    margin: 0 auto 2.5rem;
}

.race-search-body .feature-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    margin-bottom: 3rem;
}

.race-search-body .feature-card {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    padding: 1.5rem;
    text-align: center;
}

.race-search-body .feature-icon {
    font-size: 2rem;
    margin-bottom: 0.75rem;
}

.race-search-body .feature-card h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--rs-text);
    margin-bottom: 0.5rem;
}

.race-search-body .feature-card p {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--rs-text-muted);
    margin: 0;
}

.race-search-body .homepage-guides {
    margin-bottom: 2.5rem;
}

.race-search-body .homepage-guides h3,
.race-search-body .homepage-states h3 {
    font-family: var(--font-display);
    font-size: 1.3rem;
    color: var(--rs-text);
    margin-bottom: 0.5rem;
}

.race-search-body .homepage-guides > p {
    color: var(--rs-text-secondary);
    margin-bottom: 1rem;
    line-height: 1.6;
}

.race-search-body .guide-links,
.race-search-body .state-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.race-search-body .guide-links a,
.race-search-body .state-links a {
    display: inline-block;
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--rs-text-secondary);
    text-decoration: none;
    transition: all 0.15s ease;
}

.race-search-body .guide-links a:hover,
.race-search-body .state-links a:hover {
    border-color: var(--rs-accent);
    color: var(--rs-text);
    background: #fff;
}

@media (max-width: 768px) {
    .race-search-body .homepage-content { padding: 40px 16px; }
    .race-search-body .feature-cards { grid-template-columns: 1fr; gap: 16px; }
    .race-search-body .homepage-content h2 { font-size: 1.4rem; }
}

/* ============================================================
   FOOTER - Dark Theme (Contrasting)
   ============================================================ */
.race-search-body footer:not(.landing-footer) {
    background: #161616;
    border-top: none;
    padding: 48px 32px;
    text-align: center;
}

.race-search-body footer:not(.landing-footer) p {
    font-family: var(--font-body);
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    margin-bottom: 8px;
}

.race-search-body footer:not(.landing-footer) a {
    color: rgba(255,255,255,0.8);
    text-decoration: none;
    transition: color 0.15s ease;
}

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

.race-search-body .footer-links {
    margin-top: 8px;
}

/* Popular searches section in footer */
.race-search-body .popular-searches {
    margin: 32px 0;
    padding: 24px 0;
    border-top: 1px solid rgba(255,255,255,0.1);
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.race-search-body .popular-searches h4 {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: rgba(255,255,255,0.4);
    margin-bottom: 16px;
}

.race-search-body .search-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 20px;
}

.race-search-body .search-links a {
    font-size: 14px;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    transition: color 0.15s ease;
}

.race-search-body .search-links a:hover {
    color: var(--rs-accent-ink);
}

/* ============================================================
   LOGIN MODAL - Light Theme
   ============================================================ */
.race-search-body .modal {
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}

.race-search-body .modal-content,
.race-search-body .login-modal-content {
    background: var(--rs-bg-card);
    border: 1px solid var(--rs-border);
    border-radius: 16px;
    color: var(--rs-text);
    box-shadow: var(--shadow-lg);
}

.race-search-body .modal-title {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--rs-text);
}

.race-search-body .modal-close {
    color: var(--rs-text-muted);
}

.race-search-body .modal-close:hover {
    color: var(--rs-text);
}

.race-search-body .login-tabs {
    border-bottom: 1px solid var(--rs-border);
}

.race-search-body .login-tab {
    color: var(--rs-text-secondary);
    background: transparent;
    border: none;
}

.race-search-body .login-tab.active {
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    border-bottom: 2px solid var(--rs-accent);
}

.race-search-body .auth-form label {
    color: var(--rs-text-secondary);
}

.race-search-body .auth-form input {
    background: var(--rs-bg-input);
    border: 1px solid var(--rs-border);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body .form-hint {
    color: var(--rs-text-muted);
}

.race-search-body .form-footer a {
    color: var(--rs-accent-hover);
}

.race-search-body .divider span {
    background: var(--rs-bg-card);
    color: var(--rs-text-muted);
}

.race-search-body .oauth-buttons .btn-login {
    background: var(--rs-bg-elevated);
    border: 1px solid var(--rs-border);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body .oauth-buttons .btn-login:hover {
    background: var(--rs-bg-card);
    border-color: var(--rs-border-dark);
}

/* ============================================================
   RESPONSIVE - Tablet
   ============================================================ */
/* style.css hides the month list at 1200px and below, so the grid drops its 180px
   track there too. Until 11 Nov 2026 it kept three tracks down to 1025px and the
   race list fell into the 180px one (cards 100px wide, 1025-1200px screens). */
@media (max-width: 1200px) {
    .race-search-body .main-layout {
        grid-template-columns: minmax(0, 1fr) var(--cal-col, 320px);
    }
    .race-search-body .main-layout > .journey-sidebar,
    .race-search-body .main-layout > .my-calendar-sidebar {
        grid-column: 2;
    }
}

@media (max-width: 1024px) {
    .race-search-body .main-layout {
        grid-template-columns: minmax(0, 1fr) var(--cal-col, 300px);
    }

    .race-search-body .month-nav-sidebar {
        display: none;
    }

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

    /* Show hamburger menu when nav is hidden */
    .race-search-body .hamburger-menu {
        display: flex !important;
    }
}

/* ============================================================
   RESPONSIVE - Mobile
   ============================================================ */
@media (max-width: 768px) {
    /* Hide scrollbar on mobile — meaningless with infinite scroll */
    .race-search-body { scrollbar-width: none !important; }
    .race-search-body::-webkit-scrollbar { display: none !important; }

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

    .race-search-body .nav-links {
        height: 50px !important;
        padding: 0 16px !important;
    }

    .race-search-body .nav-links .nav-right {
        right: 16px !important;
    }

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

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

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

    .race-search-body .search-hero {
        /* Flow to content on mobile. A fixed vh height + overflow:hidden was
           clipping the second row of state pills ("TAS ACT NT") once the
           title wrapped to two lines. */
        height: auto;
        min-height: 250px;
        /* 50px fixed header + 47px fixed .mobile-nav-bar below it — was 68px,
           leaving ~29px of the hero (including part of the title) hidden
           under the opaque nav bar. */
        margin-top: 97px;
    }

    .race-search-body .search-hero .hero-title {
        font-size: 1.8rem !important;
    }

    .race-search-body .search-hero .hero-subtitle {
        font-size: 0.95rem !important;
    }

    .race-search-body .search-hero .hero-description {
        font-size: 0.85rem;
    }

    .race-search-body .search-hero .hero-state-links {
        gap: 4px 14px;
    }

    .race-search-body .search-hero .hero-state-links a {
        font-size: 0.85rem;
    }

    .race-search-body .search-hero .hero-content {
        /* In-flow so it defines the hero's height instead of overflowing a
           fixed-height box. position:relative + z-index keeps it above the
           absolutely-positioned .hero-image / .hero-overlay. */
        position: relative;
        z-index: 1;
        transform: none;
        top: auto;
        bottom: auto;
        padding: 28px 20px;
    }

    .race-search-body .controls {
        padding: 12px 16px !important;
        top: 56px;
    }

    /* Mobile filter layout */
    .race-search-body .controls-top-row {
        display: flex;
        gap: 10px;
        align-items: center;
    }

    .race-search-body .controls-top-row .search-input {
        flex: 1;
        min-width: 0 !important;
    }

    .race-search-body .mobile-filter-toggle {
        display: flex !important;
        align-items: center;
        gap: 6px;
        padding: 10px 14px;
        background: var(--rs-bg-input);
        border: 1px solid var(--rs-border);
        border-radius: 8px;
        color: var(--rs-text-secondary);
        font-size: 14px;
        font-weight: 500;
        cursor: pointer;
        white-space: nowrap;
    }

    .race-search-body .mobile-filter-toggle:hover {
        background: var(--rs-bg-elevated);
    }

    .race-search-body .mobile-filter-toggle[aria-expanded="true"] {
        background: var(--rs-accent);
        color: white;
        border-color: var(--rs-accent);
    }

    .race-search-body .filter-options {
        display: none;
        flex-wrap: wrap;
        gap: 10px;
        margin-top: 12px;
        padding-top: 12px;
        border-top: 1px solid var(--rs-border);
    }

    .race-search-body .filter-options.expanded {
        display: flex;
    }

    .race-search-body .filter-options select,
    .race-search-body .filter-options input[type="date"],
    .race-search-body .filter-options .multi-select-dropdown {
        flex: 1 1 calc(50% - 5px);
        min-width: 120px;
    }

    .race-search-body .controls-row {
        flex-direction: column;
        align-items: stretch;
    }

    .race-search-body .search-input {
        min-width: 100% !important;
    }

    /* Scroll-aware header - hide on scroll down, show on scroll up */
    .race-search-body .site-header {
        transition: transform 0.3s ease;
    }

    .race-search-body .site-header.header-hidden {
        transform: translateY(-100%);
    }

    .race-search-body .mobile-nav-bar {
        transition: transform 0.3s ease;
    }

    .race-search-body .mobile-nav-bar.nav-hidden {
        transform: translateY(-100%);
    }

    /* Adjust controls position when header is hidden */
    .race-search-body .controls {
        transition: top 0.3s ease;
    }

    .race-search-body .site-header.header-hidden ~ .controls,
    .race-search-body .site-header.header-hidden ~ * .controls {
        top: 0 !important;
    }

    .race-search-body .main-layout {
        grid-template-columns: minmax(0, 1fr);
        grid-template-rows: auto;
    }
    .race-search-body .main-layout > .main-content,
    .race-search-body .main-layout > .mv-stacked-sidebar-rail {
        grid-column: 1;
        grid-row: auto;
    }

    .race-search-body .my-calendar-sidebar {
        display: none !important;
    }

    .race-search-body .main-content {
        padding: 24px 20px !important;
    }

    .race-search-body .month-header {
        font-size: 1.3rem !important;
    }

    /* Mobile table cards */
    .race-search-body .races-table {
        display: block !important;
    }

    .race-search-body .races-table thead {
        display: none !important;
    }

    .race-search-body .races-table tbody {
        display: flex;
        flex-direction: column;
        gap: 12px;
    }

    .race-search-body .race-row {
        display: flex !important;
        flex-direction: column !important;
        background: var(--rs-bg-card) !important;
        border: 1px solid var(--rs-border) !important;
        border-radius: 12px !important;
        padding: 16px !important;
        box-shadow: var(--shadow-sm) !important;
    }

    .race-search-body .races-table td {
        display: block !important;
        padding: 4px 0 !important;
        border: none !important;
        width: 100% !important;
    }

    .race-search-body .race-date-cell {
        font-size: 12px !important;
        color: var(--rs-text-muted) !important;
        margin-bottom: 4px !important;
    }

    .race-search-body .race-name-cell {
        font-size: 16px !important;
        margin-bottom: 10px !important;
    }

    .race-search-body .race-distances-cell {
        margin-bottom: 10px !important;
    }

    .race-search-body .race-distances-cell .distance-badges-wrapper {
        gap: 8px !important;
    }

    .race-search-body .distance-badge {
        max-width: 100% !important;
    }

    /* Long sponsor-named distances wrap at full size on phones (were forced
       to 10px and ellipsised - there's no title tooltip on touch). Flex keeps
       them centred in the 44px pill like the short ones. */
    .race-search-body .distance-badge.long-name {
        display: flex;
        text-align: center;
        white-space: normal;
        overflow-wrap: anywhere;
        line-height: 1.3;
    }

    .race-search-body .race-location-cell {
        font-size: 13px !important;
    }

    /* :not() - the structured footer pads its own rows, and this !important
       stacked a second 32px band above and below them on phones. */
    .race-search-body footer:not(.landing-footer) {
        padding: 32px 20px !important;
    }
}

@media (max-width: 480px) {
    .race-search-body .header-text .site-title {
        font-size: 1rem !important;
    }

    .race-search-body .search-hero {
        height: auto;
        min-height: 200px;
    }

    .race-search-body .search-hero .hero-title {
        font-size: 1.5rem !important;
    }

    .race-search-body .search-hero .hero-subtitle {
        font-size: 0.85rem !important;
    }

    .race-search-body .search-hero .hero-description {
        font-size: 0.75rem;
    }

    .race-search-body .search-hero .hero-state-links {
        gap: 2px 10px;
    }

    .race-search-body .search-hero .hero-state-links a {
        font-size: 0.75rem;
    }
}

/* ============================================================
   ANIMATIONS - Keep subtle transitions
   ============================================================ */
.race-search-body * {
    animation-duration: 0s !important;
}

/* Re-enable specific transitions */
.race-search-body .distance-badge {
    transition: all 0.15s ease;
}

.race-search-body .race-row {
    transition: all 0.15s ease;
}

.race-search-body .btn {
    transition: all 0.2s ease;
}

/* ============================================================
   SCROLLBAR - Light Theme
   ============================================================ */
.race-search-body ::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.race-search-body ::-webkit-scrollbar-track {
    background: var(--rs-bg-elevated);
}

.race-search-body ::-webkit-scrollbar-thumb {
    background: var(--rs-border-dark);
    border-radius: 4px;
}

.race-search-body ::-webkit-scrollbar-thumb:hover {
    background: var(--rs-text-muted);
}

/* ============================================================
   NOSCRIPT - Light Theme
   ============================================================ */
.race-search-body noscript > div {
    background: var(--rs-bg-card);
    border: 2px solid var(--rs-accent);
    color: var(--rs-text);
    border-radius: 12px;
}

.race-search-body noscript h2 {
    color: var(--rs-text);
}

.race-search-body noscript p {
    color: var(--rs-text-secondary);
}

/* ============================================================
   EXAMPLE DASHBOARD - Logged Out User Preview
   ============================================================ */
.race-search-body .example-dashboard {
    margin-top: 70px; /* Account for fixed header */
}

/* Remove top margin when dashboard follows search hero (landing page) */
.race-search-body .search-hero + .example-dashboard {
    margin-top: 0;
}

/* ---- Two-column split layout ---- */
.race-search-body .dashboard-split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    min-height: 480px;
}

/* Left: dark pitch column */
.race-search-body .dashboard-pitch {
    background: #161616;
    padding: 64px 48px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0;
}

.race-search-body .dashboard-eyebrow {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rs-accent-ink);
    margin-bottom: 16px;
}

.race-search-body .dashboard-heading {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    font-weight: 800;
    color: #fff;
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin: 0 0 20px;
}

.race-search-body .dashboard-body {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    color: rgba(255,255,255,0.65);
    margin: 0 0 24px;
}

.race-search-body .dashboard-checklist {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 32px;
}

.race-search-body .dashboard-checklist span {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: rgba(255,255,255,0.8);
}

.race-search-body .dashboard-checklist span::before {
    content: '';
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--rs-accent);
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none'%3E%3Cpath d='M3.5 8l3 3 6-6' stroke='%23161616' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-size: cover;
}

.race-search-body .btn-dashboard-signin {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 13px 22px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    margin-bottom: 12px;
    transition: background 0.15s ease, transform 0.15s ease;
    align-self: flex-start;
}

.race-search-body .btn-dashboard-signin:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-1px);
}

.race-search-body .btn-dashboard-browse {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: rgba(255,255,255,0.45);
    text-decoration: none;
    transition: color 0.15s ease;
    align-self: flex-start;
}

.race-search-body .btn-dashboard-browse:hover {
    color: rgba(255,255,255,0.75);
}

/* Right: white preview column */
.race-search-body .dashboard-preview {
    background: var(--rs-bg-elevated);
    padding: 40px 36px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border-left: 1px solid var(--rs-border);
}

.race-search-body .preview-label {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-bottom: 12px;
}

/* Mobile: stack vertically */
@media (max-width: 900px) {
    .race-search-body .dashboard-split {
        grid-template-columns: minmax(0, 1fr);
    }

    .race-search-body .dashboard-pitch {
        padding: 48px 24px;
    }

    .race-search-body .dashboard-preview {
        padding: 32px 24px;
        border-left: none;
        border-top: 1px solid var(--rs-border);
    }

    .race-search-body .btn-dashboard-signin,
    .race-search-body .btn-dashboard-browse {
        align-self: stretch;
        justify-content: center;
    }

    .race-search-body .example-pb-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .race-search-body .dashboard-pitch {
        padding: 40px 20px;
    }

    .race-search-body .dashboard-preview {
        padding: 28px 20px;
    }
}

/* Hero Section */
.race-search-body .example-hero {
    position: relative;
    height: 50vh;
    min-height: 400px;
    max-height: 500px;
    overflow: hidden;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.race-search-body .example-hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 30%;
}

.race-search-body .example-hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to bottom,
        rgba(0,0,0,0.4) 0%,
        rgba(0,0,0,0.2) 30%,
        rgba(0,0,0,0.4) 60%,
        rgba(248,248,246,1) 100%
    );
}

.race-search-body .example-hero-content {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 50px;
    text-align: center;
}

.race-search-body .example-avatar-wrapper {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    padding: 4px;
    background: linear-gradient(135deg, var(--rs-accent) 0%, #B3241A 100%);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    margin-bottom: 16px;
}

.race-search-body .example-avatar {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--rs-bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.race-search-body .example-avatar .avatar-emoji {
    font-size: 3.5rem;
}

.race-search-body .example-name {
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    font-weight: 400;
    color: #fff;
    text-shadow: 0 2px 16px rgba(0,0,0,0.5);
    margin: 0 0 8px 0;
}

.race-search-body .example-subtitle {
    font-family: var(--font-body);
    font-size: 1.1rem;
    color: rgba(255,255,255,0.95);
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
    margin: 0;
}

/* Preview Section */
.race-search-body .example-preview {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 24px 40px;
    background: var(--rs-bg-elevated);
}

.race-search-body .example-section {
    margin-bottom: 32px;
}

.race-search-body .example-section-title {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--rs-text);
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--rs-accent);
    display: inline-block;
}

/* PB Grid */
.race-search-body .example-pb-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.race-search-body .example-pb-card {
    background: var(--rs-bg-card);
    border-radius: 12px;
    padding: 20px 16px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--rs-border);
    border-top: 4px solid var(--rs-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.race-search-body .example-pb-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .example-pb-card.pb-5k { border-top-color: var(--rs-5k); }
.race-search-body .example-pb-card.pb-10k { border-top-color: var(--rs-10k); }
.race-search-body .example-pb-card.pb-half { border-top-color: var(--rs-half); }
.race-search-body .example-pb-card.pb-marathon { border-top-color: var(--rs-marathon); }

.race-search-body .example-pb-card .pb-distance {
    display: block;
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--rs-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.race-search-body .example-pb-card .pb-time {
    display: block;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--rs-text);
    margin-bottom: 6px;
}

.race-search-body .example-pb-card .pb-event {
    display: block;
    font-size: 0.75rem;
    color: var(--rs-text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Upcoming Races */
.race-search-body .example-upcoming {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.race-search-body .example-race-card {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--rs-bg-card);
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--rs-border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.race-search-body .example-race-card:hover {
    transform: translateX(4px);
    box-shadow: var(--shadow-md);
}

.race-search-body .example-race-card.highlight {
    border: 2px solid var(--rs-accent);
    background: rgba(213,43,30,0.05);
}

.race-search-body .example-race-card .race-date {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: var(--rs-bg-elevated);
    border-radius: 10px;
    flex-shrink: 0;
}

.race-search-body .example-race-card .race-date.goal {
    background: var(--rs-accent);
}

.race-search-body .example-race-card .date-month {
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    letter-spacing: 0.5px;
}

.race-search-body .example-race-card .race-date.goal .date-month {
    color: var(--rs-accent-text);
}

.race-search-body .example-race-card .date-day {
    font-family: var(--font-display);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--rs-text);
    line-height: 1;
}

.race-search-body .example-race-card .race-date.goal .date-day {
    color: var(--rs-accent-text);
}

.race-search-body .example-race-card .race-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.race-search-body .example-race-card .race-name {
    font-family: var(--font-display);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
}

.race-search-body .example-race-card .race-distance {
    font-size: 0.85rem;
    color: var(--rs-text-muted);
}

.race-search-body .example-race-card .goal-race {
    color: var(--rs-marathon);
    font-weight: 600;
}

.race-search-body .example-race-card .race-countdown {
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--rs-text-muted);
    white-space: nowrap;
}

/* CTA Section */
.race-search-body .example-cta {
    background: linear-gradient(135deg, var(--rs-text) 0%, #2d2d2d 100%);
    border-radius: 16px;
    padding: 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    align-items: center;
    margin-top: 16px;
}

.race-search-body .cta-content h3 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    font-weight: 400;
    color: #fff;
    margin: 0 0 12px 0;
}

.race-search-body .cta-content p {
    font-size: 1rem;
    color: rgba(255,255,255,0.8);
    margin: 0 0 24px 0;
    line-height: 1.6;
}

.race-search-body .cta-buttons {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.race-search-body .btn-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    padding: 14px 28px;
    border-radius: 30px;
    text-decoration: none;
    transition: all 0.2s;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
}

.race-search-body .btn-cta-primary:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
}

.race-search-body .btn-cta-secondary {
    display: inline-flex;
    align-items: center;
    color: rgba(255,255,255,0.9);
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 500;
    padding: 14px 24px;
    text-decoration: none;
    transition: color 0.2s;
}

.race-search-body .btn-cta-secondary:hover {
    color: var(--rs-accent-ink);
}

.race-search-body .cta-features {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.race-search-body .cta-features .feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,0.9);
    font-size: 0.95rem;
}

.race-search-body .cta-features .feature-icon {
    font-size: 1.5rem;
}

/* Divider */
.race-search-body .example-dashboard + .controls {
    border-top: 1px solid var(--rs-border);
    padding-top: 24px;
    margin-top: 0;
}

/* Hide example dashboard for logged-in users */
.race-search-body.logged-in .example-dashboard {
    display: none;
}

/* Landing Hero Search */
.race-search-body .landing-hero-search {
    position: relative;
    max-width: 560px;
    margin: 20px auto 0;
}

.race-search-body .landing-hero-search input {
    width: 100%;
    background: rgba(255,255,255,0.95);
    border: 2px solid rgba(255,255,255,0.6);
    border-radius: 30px;
    color: var(--rs-text);
    font-family: var(--font-body);
    font-size: 1rem;
    padding: 14px 52px 14px 22px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
    transition: all 0.2s ease;
}

.race-search-body .landing-hero-search input::placeholder {
    color: var(--rs-text-muted);
}

.race-search-body .landing-hero-search input:focus {
    outline: none;
    border-color: var(--rs-accent);
    box-shadow: 0 4px 24px rgba(0,0,0,0.15), 0 0 0 3px var(--rs-accent-glow);
}

.race-search-body .landing-hero-search button {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--rs-accent);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.race-search-body .landing-hero-search button:hover {
    background: var(--rs-accent-hover);
}

.race-search-body .landing-hero-search button svg {
    width: 18px;
    height: 18px;
    stroke: var(--rs-accent-text);
    fill: none;
    stroke-width: 2.5;
}

/* Example avatar with real photo */
.race-search-body .example-avatar img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
}

/* Dashboard preview lead-in text */
.race-search-body .example-lead-in {
    text-align: center;
    margin-bottom: 32px;
    padding-top: 16px;
}

.race-search-body .example-lead-in h2 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    color: var(--rs-text);
    margin: 0 0 12px;
}

.race-search-body .example-lead-in p {
    color: var(--rs-text-muted);
    font-size: 1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Compact inline athlete identity */
.race-search-body .example-athlete-inline {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}

.race-search-body .example-athlete-inline .example-avatar-wrapper {
    width: 56px;
    height: 56px;
    margin-bottom: 0;
    flex-shrink: 0;
}

.race-search-body .example-athlete-name {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--rs-text);
    display: block;
}

.race-search-body .example-athlete-detail {
    font-size: 0.9rem;
    color: var(--rs-text-muted);
}

@media (max-width: 600px) {
    .race-search-body .landing-hero-search {
        max-width: 100%;
        margin: 16px 16px 0;
    }

    .race-search-body .landing-hero-search input {
        padding: 12px 48px 12px 18px;
    }
}

/* ============================================================
   EXAMPLE DASHBOARD - MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 900px) {
    .race-search-body .example-pb-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .race-search-body .example-cta {
        grid-template-columns: 1fr;
        gap: 32px;
        padding: 32px 24px;
    }

    .race-search-body .cta-features {
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
    }

    .race-search-body .cta-features .feature {
        flex-direction: column;
        text-align: center;
        gap: 6px;
        font-size: 0.8rem;
    }
}

@media (max-width: 600px) {
    .race-search-body .example-dashboard {
        margin-top: 56px;
    }

    .race-search-body .example-hero {
        min-height: 320px;
        max-height: 380px;
    }

    .race-search-body .example-avatar-wrapper {
        width: 90px;
        height: 90px;
    }

    .race-search-body .example-avatar .avatar-emoji {
        font-size: 2.5rem;
    }

    .race-search-body .example-preview {
        padding: 0 16px 32px;
    }

    .race-search-body .example-pb-card {
        padding: 14px 12px;
    }

    .race-search-body .example-pb-card .pb-time {
        font-size: 1.3rem;
    }

    .race-search-body .example-race-card {
        padding: 14px 16px;
        gap: 12px;
    }

    .race-search-body .example-race-card .race-date {
        width: 48px;
        height: 48px;
    }

    .race-search-body .example-race-card .date-day {
        font-size: 1.2rem;
    }

    .race-search-body .cta-buttons {
        flex-direction: column;
    }

    .race-search-body .btn-cta-primary,
    .race-search-body .btn-cta-secondary {
        width: 100%;
        justify-content: center;
    }

    .race-search-body .cta-features {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   STATE INTRO SECTION - Only shown on state landing pages
   Clean, minimal bridge from hero to filters
   ============================================================ */
.race-search-intro.state-intro {
    max-width: 900px;
    margin: 0 auto;
    padding: 24px 24px 20px;
    text-align: center;
    background: var(--rs-bg);
    border: none;
    border-bottom: 1px solid var(--rs-border-light);
}

.race-search-intro p {
    color: var(--rs-text-muted);
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.6;
    margin: 0 0 16px;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* State page heading */
.race-search-intro .state-heading {
    font-family: var(--font-display);
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--rs-text);
    margin: 0 0 8px;
}

/* State Quick Links - Compact inline style */
.state-quick-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 4px 12px;
}

.state-quick-links a {
    display: inline-block;
    padding: 4px 8px;
    background: transparent;
    color: var(--rs-text-secondary);
    text-decoration: none;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    border: none;
    transition: color 0.2s ease;
}

.state-quick-links a:hover {
    color: var(--rs-accent-hover);
}

/* "Other states:" label */
.state-quick-links .label {
    color: var(--rs-text-muted);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 768px) {
    .race-search-intro.state-intro {
        padding: 20px 16px 16px;
    }

    .race-search-intro p {
        font-size: 0.88rem;
        margin-bottom: 12px;
    }

    .race-search-intro .state-heading {
        font-size: 1.15rem;
    }

    .state-quick-links {
        gap: 2px 8px;
    }

    .state-quick-links a {
        padding: 3px 6px;
        font-size: 0.8rem;
    }

    .state-quick-links .label {
        width: 100%;
        text-align: center;
        margin-bottom: 6px;
    }
}

/* ============================================================
   BREADCRUMB NAVIGATION (SEO + UX)
   ============================================================ */
.breadcrumb-nav {
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    z-index: 50;
    padding: 8px 20px;
    background: transparent;
    border-bottom: none;
    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: var(--rs-text-muted);
}

.breadcrumb-list li:not(:last-child)::after {
    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);
}

@media (max-width: 768px) {
    .breadcrumb-nav {
        top: 68px;
        padding: 6px 16px;
        font-size: 0.8rem;
    }
}

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

.ad-in-list {
    padding: 0;
    margin: 0;
}

.ad-in-list:empty,
.ad-in-list ins[data-ad-status="unfilled"] {
    display: none;
}

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

.ad-row td {
    padding: 0;
    border: none;
}

/* Landing footer: moved to style.css as the one site footer (20 Oct 2026). */

/* ============================================================
   GUIDES SECTION — card grid + optional numbered list fallback
   ============================================================ */
/* Editorial section — below articles, above footer */
.race-search-body .editorial-section {
    background: var(--rs-bg);
    border-top: 1px solid var(--rs-border);
    padding: 56px 32px;
}

.race-search-body .editorial-inner {
    max-width: 760px;
    margin: 0 auto;
}

.race-search-body .editorial-inner h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--rs-text);
    margin-bottom: 20px;
}

.race-search-body .editorial-inner p {
    font-size: 15px;
    line-height: 1.75;
    color: var(--rs-text-muted);
    margin-bottom: 16px;
}

.race-search-body .editorial-inner a {
    color: var(--rs-accent-dark, #b45309);
    text-decoration: underline;
}

.race-search-body .guides-section {
    background: var(--rs-bg-elevated);
    border-top: 1px solid var(--rs-border);
    padding: 40px 32px 64px;
}

/* Featured-races section falls back to a single-line house ad when there's
   no paying Diamond race (see /advertise) - the full 64px padding tuned for
   a 3-card image grid reads as a lot of empty space around one line, and
   was pushing the What's On banner below the fold on desktop. */

.race-search-body .guides-inner {
    max-width: 1100px;
    margin: 0 auto;
}

/* Landing page: 3-column card grid */
.race-search-body .landing-guide-cards {
    margin-bottom: 24px;
}

.race-search-body .landing-guide-cards .guide-card {
    color: inherit;
}

.race-search-body .landing-guide-cards .guide-card h3 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--rs-text);
    margin: 0 0 0.4rem;
}

.race-search-body .landing-guide-cards .guide-card p {
    font-size: 0.9rem;
    color: var(--rs-text-muted);
    line-height: 1.5;
    margin: 0;
}

/* "See all guides" link */
.race-search-body .guides-see-all {
    display: inline-block;
    margin-bottom: 40px;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rs-accent-dark, var(--rs-text));
    text-decoration: none;
    border-bottom: 2px solid var(--rs-accent);
    padding-bottom: 1px;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.race-search-body .guides-see-all:hover {
    color: var(--rs-text);
    border-color: var(--rs-text);
}

.race-search-body .guides-eyebrow {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-bottom: 24px;
}

/* Numbered guide entries */
.race-search-body .guides-list {
    border-top: 1px solid var(--rs-border);
    margin-bottom: 48px;
}

.race-search-body .guide-entry {
    display: grid;
    grid-template-columns: 36px 1fr 24px;
    align-items: start;
    gap: 16px;
    padding: 22px 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: 4px;
}

.race-search-body .guide-entry:hover {
    background: var(--rs-bg-card);
}

.race-search-body .guide-entry:hover .guide-arrow {
    transform: translateX(4px);
    color: var(--rs-text);
}

.race-search-body .guide-num {
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--rs-text-muted);
    letter-spacing: 0.04em;
    padding-top: 2px;
}

.race-search-body .guide-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.race-search-body .guide-text strong {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 600;
    color: var(--rs-text);
    line-height: 1.3;
}

.race-search-body .guide-text span {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: var(--rs-text-muted);
    line-height: 1.5;
}

.race-search-body .guide-arrow {
    font-size: 1.1rem;
    color: var(--rs-text-muted);
    transition: transform 0.15s ease, color 0.15s ease;
    padding-top: 2px;
    justify-self: end;
}

/* State pills — compact, same language as hero */
.race-search-body .guides-states {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding-top: 4px;
}

.race-search-body .guides-states-label {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-right: 4px;
    white-space: nowrap;
}

.race-search-body .guides-states a {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    border: 1px solid var(--rs-border);
    border-radius: 50px;
    background: var(--rs-bg-card);
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease;
}

.race-search-body .guides-states a:hover {
    border-color: var(--rs-text);
    color: var(--rs-text);
}

@media (max-width: 768px) {
    .race-search-body .guides-section {
        padding: 48px 16px;
    }

    .race-search-body .guide-entry {
        margin: 0 -4px;
        padding-left: 4px;
        padding-right: 4px;
        gap: 12px;
    }

    .race-search-body .guides-states-label {
        width: 100%;
        margin-bottom: 4px;
    }

    .race-search-body .landing-guide-cards {
        grid-template-columns: 1fr;
    }
}

/* ============================================================
   COVERAGE SECTION — replaces emoji feature cards
   ============================================================ */
.race-search-body .coverage-section {
    background: var(--rs-bg);
    border-top: 1px solid var(--rs-border);
    padding: 72px 32px;
}

.race-search-body .coverage-inner {
    max-width: 820px;
    margin: 0 auto;
    text-align: center;
}

.race-search-body .coverage-eyebrow {
    display: block;
    font-family: var(--font-body);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin-bottom: 12px;
}

.race-search-body .coverage-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    color: var(--rs-text);
    line-height: 1.1;
    letter-spacing: -0.025em;
    margin: 0 0 48px;
}

/* Stats grid — bordered table treatment, editorial feel */
.race-search-body .coverage-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border: 1px solid var(--rs-border);
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 40px;
}

.race-search-body .coverage-stat {
    padding: 28px 16px;
    border-right: 1px solid var(--rs-border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.race-search-body .coverage-stat:last-child {
    border-right: none;
}

.race-search-body .stat-num {
    font-family: var(--font-display);
    font-size: 2.4rem;
    font-weight: 800;
    color: var(--rs-text);
    line-height: 1;
    letter-spacing: -0.03em;
}

.race-search-body .stat-label {
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--rs-text-muted);
}

/* Discipline pills — clickable, shows breadth of calendar */
.race-search-body .coverage-disciplines {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.race-search-body .coverage-disciplines a {
    display: inline-flex;
    align-items: center;
    padding: 7px 16px;
    border: 1px solid var(--rs-border);
    border-radius: 50px;
    background: var(--rs-bg-elevated);
    color: var(--rs-text-secondary);
    font-family: var(--font-body);
    font-size: 0.88rem;
    font-weight: 500;
    text-decoration: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.race-search-body .coverage-disciplines a:hover {
    border-color: var(--rs-text);
    color: var(--rs-text);
    background: #fff;
}

.race-search-body .coverage-note {
    font-size: 0.87rem;
    color: var(--rs-text-muted);
    margin: 0 0 24px;
}

.race-search-body .coverage-cta {
    display: inline-flex;
    align-items: center;
    padding: 12px 28px;
    background: var(--rs-accent);
    color: var(--rs-accent-text);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, transform 0.15s ease;
}

.race-search-body .coverage-cta:hover {
    background: var(--rs-accent-hover);
    transform: translateY(-1px);
}

/* Mobile */
@media (max-width: 768px) {
    .race-search-body .coverage-section {
        padding: 48px 16px;
    }

    .race-search-body .coverage-stats {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Fix right border on 2nd column */
    .race-search-body .coverage-stat:nth-child(2) {
        border-right: none;
    }

    /* Add bottom border to top row */
    .race-search-body .coverage-stat:nth-child(1),
    .race-search-body .coverage-stat:nth-child(2) {
        border-bottom: 1px solid var(--rs-border);
    }

    .race-search-body .stat-num {
        font-size: 1.9rem;
    }

    .race-search-body .coverage-heading {
        margin-bottom: 32px;
    }
}

@media (max-width: 480px) {
    .race-search-body .coverage-heading {
        font-size: 1.8rem;
    }
}

/* ============================================================
   LANDING PAGE HERO — distinct from race search hero
   ============================================================ */

/* Taller, more impact */
.race-search-body .search-hero.landing-hero {
    height: 58vh;
    min-height: 440px;
    max-height: 580px;
}

/* Dark cinematic overlay — no white fade destroying the photo */
.race-search-body .search-hero.landing-hero .hero-overlay {
    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%
    );
}

/* Bottom-anchored — sits in the darkest, highest-contrast zone */
.race-search-body .landing-hero .hero-content {
    top: auto;
    bottom: 0;
    transform: none;
    padding: 0 24px 48px;
    text-align: center;
}

/* Eyebrow — brand positioning above the emotive headline */
.race-search-body .landing-hero .hero-eyebrow {
    display: block;
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--rs-accent-ink);
    margin-bottom: 12px;
}

/* Title - display face at 800 */
.race-search-body .landing-hero .hero-title {
    font-family: var(--font-display);
    font-size: clamp(2.8rem, 6.5vw, 5rem);
    font-weight: 800;
    color: #fff;
    text-shadow: 0 2px 20px rgba(0,0,0,0.25);
    margin: 0 0 14px;
    line-height: 1.0;
    letter-spacing: -0.025em;
}

/* Yellow accent line */
.race-search-body .landing-hero .hero-title-accent {
    color: var(--rs-accent-ink);
}

/* Subtitle */
.race-search-body .landing-hero .hero-subtitle {
    font-size: 1rem;
    font-weight: 400;
    color: rgba(255,255,255,0.78);
    text-shadow: 0 1px 8px rgba(0,0,0,0.35);
    margin: 0 0 22px;
}

/* Search box — wider */
.race-search-body .landing-hero .landing-hero-search {
    max-width: 600px;
    margin: 0 auto 20px;
}

/* State pills — proper clickable chips, not plain links */
.race-search-body .landing-hero .hero-state-pills {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

.race-search-body .landing-hero .hero-state-label {
    font-size: 0.72rem;
    font-weight: 500;
    color: rgba(255,255,255,0.4);
    letter-spacing: 0.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.race-search-body .landing-hero .hero-state-pills a {
    display: inline-flex;
    align-items: center;
    padding: 5px 16px;
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 50px;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    color: rgba(255,255,255,0.82);
    font-family: var(--font-body);
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-shadow: none;
    transition: background 0.15s ease, border-color 0.15s ease,
                color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.race-search-body .landing-hero .hero-state-pills a:hover,
.race-search-body .landing-hero .hero-state-pills a:focus-visible {
    background: var(--rs-accent);
    border-color: var(--rs-accent);
    color: var(--rs-accent-text);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.16);
}

/* Mobile */
@media (max-width: 768px) {
    .race-search-body .search-hero.landing-hero {
        height: 52vh;
        min-height: 380px;
    }

    .race-search-body .landing-hero .hero-content {
        padding: 0 16px 36px;
    }

    .race-search-body .landing-hero .hero-title {
        font-size: 2.4rem;
        letter-spacing: -0.02em;
    }

    .race-search-body .landing-hero .hero-subtitle {
        font-size: 0.9rem;
    }

    .race-search-body .landing-hero .hero-state-pills {
        gap: 6px;
    }

    .race-search-body .landing-hero .hero-state-label {
        width: 100%;
        text-align: center;
        margin-bottom: 2px;
    }

    .race-search-body .landing-hero .hero-state-pills a {
        padding: 5px 13px;
        font-size: 0.78rem;
    }
}

@media (max-width: 480px) {
    .race-search-body .search-hero.landing-hero {
        height: 48vh;
        min-height: 340px;
    }

    .race-search-body .landing-hero .hero-title {
        font-size: 2.1rem;
    }

    .race-search-body .landing-hero .hero-eyebrow {
        font-size: 0.65rem;
        letter-spacing: 0.14em;
    }
}

/* Category/hub page factual intro + FAQ (build_hub_seo_block). Unique per page,
   built from the actual race list — helps the hub rank for "{distance} {event}
   {state}" head terms. */
.hub-seo-intro {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-secondary, #555);
    max-width: none;
    margin: 0 0 20px;
}
.hub-seo-faq {
    margin: 32px 0 8px;
    padding-top: 20px;
    border-top: 1px solid var(--border, #e6e6e6);
}
.hub-seo-faq h2 { font-size: 20px; margin: 0 0 12px; }
.hub-seo-faq h3 { font-size: 15px; margin: 16px 0 4px; }
.hub-seo-faq p { font-size: 14px; line-height: 1.6; color: var(--text-secondary, #555); margin: 0; max-width: 70ch; }

/* A filled in-feed slot sits in the list like a race card - same radius,
   border and ground - instead of a bare block between cards.
   The side padding and a (transparent) border are there from the start, not
   added on fill: AdSense sizes a fluid unit to the <ins> width at push time,
   so a frame that gained 16px+1px each side only after filling left the
   creative ~34px wider than it and hanging off the right edge (23 Sep 2026).
   Invisible while pending - the slot is 0 tall until it fills. */
.race-search-body .race-card-ad .ad-in-list {
    border: 1px solid transparent;
    border-radius: 16px;
    padding: 0 16px;
}
.race-search-body .race-card-ad:has(.adsbygoogle[data-ad-status="filled"]) .ad-in-list {
    background: var(--rs-bg-card);
    border-color: var(--rs-border);
    padding: 12px 16px 16px;
}

/* List slots collapse to 0 while pending (see above), so a label there would
   float alone between cards; show it only once the slot has actually filled. */
.race-search-body .race-card-ad:not(:has(.adsbygoogle[data-ad-status="filled"])) .ad-container::before,
.race-search-body .rr-row-ad:not(:has(.adsbygoogle[data-ad-status="filled"]))::before {
    display: none;
}

/* Contrast (23 Sep 2026 review): brand yellow as TEXT on white is ~1.6:1.
   Links use the site's own pattern instead - ink text, yellow underline. */
.race-search-body .guides-see-all { color: var(--rs-text); }
.race-search-body .editorial-inner a {
    color: var(--rs-text);
    text-decoration: underline;
    text-decoration-color: var(--rs-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
}
.race-search-body .editorial-inner a:hover { text-decoration-color: var(--rs-text); }
/* Every other homepage heading is the display face; this one inherited Inter. */
.race-search-body .editorial-inner h2 { font-family: var(--font-display); }

/* The 70px top margin exists to clear the fixed header when the dashboard is
   the first block; after another section it just exposed a bare cream band. */
.race-search-body section + .example-dashboard { margin-top: 0; }

/* The homepage preview is sample data - say so, so its dates and times don't
   read as someone's real dashboard. */
.race-search-body .preview-example-tag {
    display: inline-block;
    font: 600 11px/1 var(--font-body);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rs-text-secondary);
    border: 1px solid var(--rs-border-dark);
    border-radius: 999px;
    padding: 5px 10px;
    margin-bottom: 14px;
}

/* Filter bar consistency: the race-type button was 14px beside 16px selects,
   and the selects' 18px right padding sat under the chevron (style.css draws
   it 14px from the right edge), so "All States" ran into its own arrow. */
.race-search-body select { padding-right: 40px; }
.race-search-body .multi-select-btn {
    font-size: 16px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

/* Card images (23 Sep 2026). 88% of race images are 2:1 Running Calendar tiles,
   so the box is 2:1 at every width: those fill it exactly - no grey bars, no
   crop. Anything clearly another shape (square/portrait logos) is detected on
   load by fitRaceImage() in utils.js and shown whole on its own edge colour. */
.race-search-body .race-card-thumbnail {
    height: auto;
    aspect-ratio: 2 / 1;
    background: var(--rs-bg-elevated);
}
@media (min-width: 769px) {
    /* Desktop list row: a 2:1 image beside the text, centred in the row. */
    .race-search-body .race-card-thumbnail {
        width: 320px;
        align-self: center;
        margin: 16px 0 16px 16px;
        border-radius: 10px;
    }
}
.race-search-body .race-card-thumbnail img {
    object-fit: cover;
    background: transparent;
}
.race-search-body .race-card-thumbnail img.fit-contain {
    object-fit: contain;
    padding: 4%;
    box-sizing: border-box;
}
.race-search-body .race-card:hover .race-card-thumbnail img.fit-contain { transform: none; }

/* "My races" chip - phones, signed in only (the desktop sidebar does this job). */
.race-search-body .my-races-chip { display: none; }
@media (max-width: 768px) {
    .race-search-body.logged-in .my-races-chip {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        flex-shrink: 0;
        font: 600 14px/1 var(--font-body);
        color: var(--rs-text);
        background: var(--rs-bg-card);
        border: 1px solid var(--rs-border);
        border-radius: 999px;
        padding: 10px 14px;
        cursor: pointer;
    }
    .race-search-body.logged-in .my-races-chip[aria-pressed="true"] {
        background: var(--rs-accent);
        border-color: var(--rs-accent);
        color: var(--rs-accent-text);
    }
    .race-search-body .my-races-chip-count {
        font-variant-numeric: tabular-nums;
        background: var(--rs-bg-elevated);
        border-radius: 999px;
        padding: 3px 7px;
        font-size: 12px;
    }
}

@media (max-width: 768px) {
    /* One row, always: a second row of buttons doubled the sticky bar and,
       with the fixed header, covered ~40% of an iPhone SE while scrolling. */
    .race-search-body.logged-in .my-races-chip { gap: 6px; }
}
@media (max-width: 440px) {
    /* Narrow phones: icon-only buttons (label kept for screen readers). */
    .race-search-body .controls-top-row .btn-label {
        position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
        overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
    }
    .race-search-body .controls-top-row .mobile-filter-toggle,
    .race-search-body.logged-in .controls-top-row .my-races-chip {
        min-width: 44px; min-height: 44px; padding: 10px 12px; justify-content: center;
    }
}
.race-search-body .preview-example-tag { align-self: flex-start; justify-self: start; width: fit-content; }
@media (max-width: 768px) {
    /* Same pill shape as the My races button beside it. */
    .race-search-body .mobile-filter-toggle { border-radius: 999px; }
}

/* The list column is minmax(0, 1fr), never plain 1fr: a 1fr track grows to
   its widest unbreakable content, and a long one-line distance pill (whose
   max-width is a percentage on phones) widened the whole column past the
   screen - cards and ads cut off on the right, growing as infinite scroll
   added cards. */
.race-search-body .main-content { min-width: 0; }

/* Hub intro (region blurb + SEO intro): the full paragraph pushed the first race
   to screen three on a phone, and on desktop it was one of four blocks above the
   list (20 Oct 2026). Clamped from first paint (is-clamped is in the HTML) to
   three lines on phones and two on desktop, with a toggle; the text stays in
   the DOM, so nothing changes for search engines. */
.race-search-body .hub-seo-intro.is-clamped {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}
.race-search-body .hub-intro-toggle {
    display: inline-block;
    background: none;
    border: 0;
    padding: 8px 0;
    margin: 0 0 14px;
    min-height: 44px;
    font: 600 14px/1 var(--font-body);
    color: var(--rs-text);
    text-decoration: underline;
    text-decoration-color: var(--rs-accent);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    cursor: pointer;
}
@media (max-width: 768px) {
    .race-search-body .hub-seo-intro.is-clamped { -webkit-line-clamp: 3; }
}

/* ---- Calendar homepage (HOMEPAGE_V2 / ?preview=home2, Sep 2026) ---------- */
.race-search-body .home-cal,
.race-search-body .home-browse {
    background: var(--rs-bg-card);
    border-top: 1px solid var(--rs-border);
    padding: 40px 32px 48px;
}
.race-search-body .home-browse { background: var(--rs-bg-elevated); }
.race-search-body .home-cal-inner { max-width: 1100px; margin: 0 auto; }
.race-search-body .home-cal-head {
    display: flex; align-items: baseline; justify-content: space-between; gap: 16px;
}
.race-search-body .home-cal h2,
.race-search-body .home-browse h2 {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--rs-text);
    margin: 0 0 8px;
}
.race-search-body .home-cal-all,
.race-search-body .home-cal-more {
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--rs-text);
    text-decoration: none;
    border-bottom: 2px solid var(--rs-accent);
    white-space: nowrap;
}
.race-search-body .home-cal-more { display: inline-block; margin-top: 24px; }
.race-search-body .home-cal-month {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin: 28px 0 4px;
}
.race-search-body .home-cal-list { list-style: none; margin: 0; padding: 0; }
.race-search-body .home-cal-list li {
    display: grid;
    grid-template-columns: 4.5rem 1fr;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid var(--rs-border);
    font-family: var(--font-body);
}
.race-search-body .home-cal-day {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--rs-text);
    font-variant-numeric: tabular-nums;
}
.race-search-body .home-cal-race { min-width: 0; }
.race-search-body .home-cal-race a {
    color: var(--rs-text);
    font-weight: 600;
    text-decoration: none;
}
.race-search-body .home-cal-race a:hover { text-decoration: underline; }
.race-search-body .home-cal-meta {
    display: block;
    font-size: 0.82rem;
    color: var(--rs-text-muted);
    margin-top: 2px;
}
.race-search-body .home-browse-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 32px;
    margin-top: 16px;
}
.race-search-body .home-browse h3 {
    font-family: var(--font-body);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--rs-text-muted);
    margin: 0 0 8px;
}
.race-search-body .home-browse ul { list-style: none; margin: 0; padding: 0; }
.race-search-body .home-browse li {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rs-border);
    font-family: var(--font-body);
    font-size: 0.92rem;
}
.race-search-body .home-browse li a { color: var(--rs-text); text-decoration: none; font-weight: 500; }
.race-search-body .home-browse li a:hover { text-decoration: underline; }
.race-search-body .home-browse li span {
    color: var(--rs-text-muted);
    font-variant-numeric: tabular-nums;
}
.race-search-body .home-faq h3 {
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 700;
    color: var(--rs-text);
    margin: 20px 0 4px;
}
.race-search-body .home-faq p {
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--rs-text-secondary);
    max-width: 70ch;
    margin: 0;
}
@media (max-width: 760px) {
    .race-search-body .home-cal,
    .race-search-body .home-browse { padding: 32px 16px 40px; }
    .race-search-body .home-browse-grid { grid-template-columns: 1fr; gap: 24px; }
    .race-search-body .home-cal-list li { grid-template-columns: 3.75rem 1fr; gap: 10px; }
}

/* "Training for a half?" band on running distance hubs (admin preview; app._hub_training_band) */
.hub-training-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 16px; margin: 0 0 16px; padding: 14px 18px; border-radius: 14px; background: #fbf7ec; border: 1px solid #efe5c9; color: #2b2925; text-decoration: none; transition: border-color 0.15s ease; }
.hub-training-band strong { color: #2b2925; }
.hub-training-band span { color: #57524a; font-size: 0.92rem; }
.hub-training-band .hub-training-go { color: #2b2925; font-weight: 700; white-space: nowrap; text-decoration: underline; text-decoration-color: #D52B1E; text-underline-offset: 3px; }
.hub-training-band:hover { border-color: #D52B1E; }
.hub-training-band:focus-visible { outline: 3px solid #2b2925; outline-offset: 2px; }

/* The What's On teaser and sign-in prompt follow the first races (renderRaces in
   app.js repeats them inside the list) rather than pushing the list down: on
   phones from 20 Oct 2026, on desktop too after the follow-up review the same day
   (four blocks sat above the first race). The server-rendered copies stay in the
   HTML for no-JS visitors and crawlers. */
.race-search-body #main-content > .races-article-teaser,
.race-search-body #main-content > .guest-signin-prompt { display: none; }
.race-search-body .in-list-promo > * { margin: 4px 0; }

/* Filters keeps its word on narrow phones (an unlabelled funnel beside the
   compact icon read as two menus) and shows how many filters are set. */
.race-search-body .filter-count {
    display: inline-grid;
    place-items: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--rs-text);
    color: #fff;
    font: 700 0.75rem/1 var(--font-body);
    font-variant-numeric: tabular-nums;
}
.race-search-body .filter-count[hidden] { display: none; }
.race-search-body .mobile-filter-toggle[aria-expanded="true"] .filter-count {
    background: var(--rs-accent-text);
}
@media (max-width: 768px) {
    .race-search-body .mobile-filter-toggle[aria-expanded="true"] {
        color: var(--rs-accent-text);
    }
}
@media (max-width: 440px) {
    .race-search-body .controls-top-row .btn-label.btn-label--keep {
        position: static; width: auto; height: auto; margin: 0;
        overflow: visible; clip: auto;
    }
}

/* Flat race list (20 Oct 2026): #races-container is Journey's .journey-content,
   so month headings, race cards and in-list promos are its direct children
   (no per-month wrapper) and Journey can place in-content ads between cards.
   It takes over .race-card-grid's column layout; .month-section's 48px gap is
   now the heading's top margin. */
.race-search-body .race-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
/* .race-list-lead: the shelf + first heading + first 4 cards as one Journey
   child (no ad inside it). display: block, not flex: Journey puts no ad next to
   a flex child (docs/journey-ads-best-practice.md 6b), and a flex lead left
   /races with no in-content ad at all (30 Oct 2026). Margin-top rebuilds the
   list's 10px gap (measured against the flex version: same positions). */
.race-search-body .race-list-lead { display: block; }
.race-search-body .race-list-lead > * + * { margin-top: 10px; }
.race-search-body .race-list-lead > .race-card + * { margin-top: 26px; } /* its 16px margin-bottom collapses into this */
.race-search-body .race-list-lead > .featured-banner-section + .month-header { margin-top: 48px; }
@media (max-width: 768px) {
    .race-search-body .race-list-lead > .featured-banner-section + .month-header { margin-top: 38px; }
}
.race-search-body .race-list > .month-header,
.race-search-body .race-list-lead > .month-header {
    align-self: flex-start;
    margin: 38px 0 10px;
}
.race-search-body .race-list > .month-header:first-child,
.race-search-body .race-list-lead > .month-header:first-child { margin-top: 0; }
.race-search-body .race-list > .featured-banner-section,
.race-search-body .race-list-lead > .featured-banner-section { margin-bottom: 12px; }
@media (max-width: 768px) {
    .race-search-body .race-list > .month-header,
    .race-search-body .race-list-lead > .month-header { margin-top: 28px; }
}

/* "Recently run" above the race search results (12 Nov 2026): matching races
   from the last 120 days, with a results link and next year's edition. */
.recent-races { margin: 0 0 20px; padding: 14px 16px; border: 1px solid var(--rs-border, #e5e5e5); border-radius: 12px; background: var(--rs-bg-elevated, #f7f7f5); }
.recent-races[hidden] { display: none; }
.recent-races-title { margin: 0 0 8px; font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--rs-text-muted, #6b6b6b); }
.recent-races-list { list-style: none; margin: 0; padding: 0; }
.recent-races-list li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 8px 0; }
.recent-races-list li + li { border-top: 1px solid var(--rs-border, #e5e5e5); }
.recent-race-name { font-weight: 700; color: var(--rs-text, #161616); text-decoration: none; }
.recent-race-name:hover { text-decoration: underline; }
.recent-race-meta { font-size: 0.88rem; color: var(--rs-text-secondary, #3d3d3d); }
.recent-race-links { display: inline-flex; gap: 14px; margin-left: auto; font-size: 0.88rem; font-weight: 600; }
.recent-race-links a { color: var(--rs-text, #161616); }
@media (max-width: 560px) { .recent-race-links { margin-left: 0; flex-basis: 100%; } }


/* ============================================================
   Filter bar (13 Nov 2026 critique, .impeccable/critique/*templates-index-html.md).
   White controls on a white bar on a white page read as faint outlines, and the race
   type menu opened behind the race cards. The bar sits on the band colour, controls
   are white with a boundary that reads (3:1+), every control shares the ink chevron,
   10px corners and an ink focus ring (yellow stays on dark surfaces, DESIGN.md).
   ============================================================ */
.race-search-body .controls {
    background: #f7f7f5;
    /* style.css's leftover blur (from when the bar stuck) made the bar a stacking context; with
       the bar static from 1100px its z-index did nothing, so the race type menu's z-index 1000
       was trapped and .main-content / .race-card painted over it. */
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    border-bottom: 1px solid #e2e0da;
}
@media (min-width: 1100px) {
    /* top: 0 - the sticky rule's top: 70px would shift a relative bar down 70px (13 Nov 2026). */
    .race-search-body .controls { position: relative; top: 0; z-index: 20; }
}
.race-search-body .controls select,
.race-search-body .controls input[type="text"],
.race-search-body .controls input[type="date"],
.race-search-body .controls .search-input,
.race-search-body .controls .multi-select-btn {
    background-color: #fff;
    border: 1px solid #8f8f8f;
    border-radius: 10px;
    height: 46px;
    transition: border-color 0.15s ease-out;
}
.race-search-body .controls select:hover,
.race-search-body .controls input[type="text"]:hover,
.race-search-body .controls input[type="date"]:hover,
.race-search-body .controls .search-input:hover,
.race-search-body .controls .multi-select-btn:hover { border-color: #161616; }
.race-search-body .controls select:focus-visible,
.race-search-body .controls input:focus-visible,
.race-search-body .controls .multi-select-btn:focus-visible {
    outline: 2px solid #161616;
    outline-offset: 2px;
    border-color: #161616;
    box-shadow: none;
}
.race-search-body .controls select:focus:not(:focus-visible),
.race-search-body .controls .multi-select-btn:focus:not(:focus-visible) { box-shadow: none; border-color: #161616; }
/* Search leads: a magnifier inside the box, and the most room in the row. */
.race-search-body .controls .search-input {
    padding-left: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Ccircle cx='8.5' cy='8.5' r='5.75' fill='none' stroke='%23161616' stroke-width='2'/%3E%3Cpath d='m13 13 4.5 4.5' stroke='%23161616' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 15px center;
    background-size: 18px 18px;
}
@media (min-width: 1100px) {
    .race-search-body .controls .search-input { flex: 2 1 240px; }
}
/* Race type: the same ink chevron as the selects (the old ▾ text glyph isn't in Inter's subset,
   so it fell back to a 10px grey dot), turned over while the menu is open. */
.race-search-body .controls .multi-select-btn { appearance: none; -webkit-appearance: none; padding-right: 14px; }
.race-search-body .dropdown-arrow { flex: none; color: #161616; transition: transform 0.15s ease-out; }
.race-search-body .multi-select-dropdown.open .dropdown-arrow { transform: rotate(180deg); }
.race-search-body .multi-select-options { z-index: 30; border-radius: 10px; }
.race-search-body .multi-select-option input[type="checkbox"] { accent-color: #161616; }
@media (prefers-reduced-motion: reduce) { .race-search-body .dropdown-arrow { transition: none; } }
.race-search-body .controls .mobile-filter-toggle { border-radius: 10px; border-color: #8f8f8f; }
