/*
 * Public registration frontend — shared design system.
 *
 * Single source of truth for the visual tokens (colours, the "notched flag"
 * motif, typography, the full-bleed-background / constrained-content layout
 * convention and the alternating footer band cadence). Every public template
 * builds on these tokens rather than picking its own colours.
 *
 * Brand: Onest Bold (headings) / Onest Medium (body); DARK GREY #373737,
 * SALMON #FF3E4A, CLAY #B0ADA0. First pass — expect later tuning.
 */

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest/onest-latin-ext-wght-normal-4LwhyPZ.woff2") format("woff2-variations");
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: "Onest";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/onest/onest-latin-wght-normal-pOjVcyy.woff2") format("woff2-variations");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    /* Core palette */
    --c-dark: #373737;         /* dark grey — brand core: headings, links, dark bands */
    --c-dark-deep: #262626;
    --c-salmon: #FF3E4A;       /* salmon — CTA / active states (+ in-text rich-text links, via --c-salmon-dark) */
    --c-salmon-dark: #E0303B;
    --c-clay-light: #E4E2DB;   /* light clay tint — navbar + about/contact band */
    --c-clay: #B0ADA0;         /* clay — decorative accents */
    --c-charcoal: #2a2a2a;     /* body text, dark UI, bottom bar */
    --c-white: #ffffff;
    --c-offwhite: #f6f5f2;
    --c-border: rgba(55, 55, 55, .16);

    /* Semantic assignments */
    --bg-body: var(--c-white);
    --text: var(--c-charcoal);
    --text-muted: #6b6b6b;
    --link: var(--c-dark);
    --link-hover: var(--c-salmon);

    /* Typography */
    --font-sans: "Onest", "Helvetica Neue", Arial, sans-serif;
    --fw-body: 500;
    --fw-heading: 700;
    --font-display: var(--font-sans);
    --tracking-caps: .08em;

    /* Layout */
    --container: 1200px;
    --gutter: clamp(1rem, 4vw, 2.5rem);
    --radius: 4px;

    /* The notched-flag skew angle — shared by nav indicator and CTA buttons */
    --flag-skew: -12deg;

    /* Fixed header — offcanvas drawer below 900px, restored to a plain row
       above it (see the @media (min-width: 900px) block near the navbar). */
    --header-h: 60px;
    --z-header: 100;
    --shadow-header: 0 1px 10px rgba(55, 55, 55, .12);
    --shadow-drawer: -10px 0 28px rgba(38, 38, 38, .3);
    --drawer-w: min(320px, 84vw);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

html {
    /* Keeps in-page anchors and the drawer's close-and-scroll clear of the
       fixed header. */
    scroll-padding-top: var(--header-h);
    scrollbar-gutter: stable;
}

/* Locks page scroll while the offcanvas drawer is open (toggled by
   nav_controller.js on the <html> element, not <body> — Turbo Drive swaps
   <body> on navigation but keeps <html> attributes, and disconnect() clears
   this class so a mid-navigation close can never leave scrolling locked). */
html.nav-open { overflow: hidden; }

body {
    margin: 0;
    font-family: var(--font-sans);
    font-weight: var(--fw-body);
    line-height: 1.6;
    color: var(--text);
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    /* .site-header is fixed and out of flow — this reserves its height so
       page content (and the homepage hero, which is a sibling of <main>)
       never starts underneath it. */
    padding-top: var(--header-h);
}

img { max-width: 100%; height: auto; display: block; }

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); }

h1, h2, h3, h4 {
    font-family: var(--font-display);
    line-height: 1.15;
    color: var(--c-dark);
    margin: 0 0 .6em;
    font-weight: var(--fw-heading);
}

/* ---- Layout utilities: full-bleed background, constrained content ---- */

/* A full-width band; put a `.container` inside for constrained content. */
.band { width: 100%; }
.band--white     { background: var(--c-white);    color: var(--text); }
.band--offwhite  { background: var(--c-offwhite);  color: var(--text); }
.band--dark     { background: var(--c-dark);     color: #f1f0ec; }
.band--clay  { background: var(--c-clay-light);  color: var(--c-charcoal); }
.band--charcoal  { background: var(--c-charcoal);  color: #e2e1dc; }
.band--dark h2, .band--charcoal h2 { color: #fff; }

.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }

/* ---- Signature "notched flag" tag ---- */

/* Shared skewed base. The inner content is counter-skewed so text stays upright. */
.flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: .6em 1.4em;
    font-weight: var(--fw-heading);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: .82rem;
    line-height: 1;
    transform: skewX(var(--flag-skew));
    transition: background-color .25s ease, color .25s ease, border-color .25s ease;
    cursor: pointer;
    border: 2px solid transparent;
    background: transparent;
}
.flag > * { transform: skewX(calc(-1 * var(--flag-skew))); display: inline-block; }

/* Filled variant — used for the active nav indicator. */
.flag--filled { background: var(--c-salmon); color: #fff; border-color: var(--c-salmon); }

/* Outlined variant — used for CTA buttons; fills on hover. */
.flag--outline { border-color: var(--c-salmon); color: var(--c-salmon); background: transparent; }
.flag--outline:hover,
.flag--outline:focus-visible { background: var(--c-salmon); color: #fff; }

/* Green outline CTA (on light backgrounds where red is too loud). */
.flag--outline-dark { border-color: var(--c-dark); color: var(--c-dark); }
.flag--outline-dark:hover,
.flag--outline-dark:focus-visible { background: var(--c-dark); color: #fff; }

/* ---- Navbar ---- */

.site-header {
    position: fixed;
    top: 0;
    inset-inline: 0;
    z-index: var(--z-header);
    background: var(--c-clay-light);
    border-bottom: 1px solid var(--c-border);
    box-shadow: var(--shadow-header);
}
.site-header .container {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    min-height: var(--header-h);
}
.brand { display: inline-flex; align-items: center; white-space: nowrap; }
.brand img { height: 60px; width: auto; }
@media (min-width: 900px) {
    .brand img { height: 68px; }
}

/* ---- Hamburger toggle (below 900px only — hidden again in the desktop
   query further down) ---- */
.nav-toggle {
    margin-inline-start: auto;
    padding: 0;
    width: 46px;
    height: 40px;
    flex: 0 0 auto;
}
.nav-toggle__bars { position: relative; display: block; width: 22px; height: 14px; }
.nav-toggle__bars > span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: transform .3s ease, opacity .2s ease;
}
.nav-toggle__bars > span:nth-child(1) { top: 0; }
.nav-toggle__bars > span:nth-child(2) { top: 6px; }
.nav-toggle__bars > span:nth-child(3) { top: 12px; }

/* Open state: bars morph into an X and the button takes the "active" red. */
.site-header.is-open .nav-toggle { background: var(--c-salmon); border-color: var(--c-salmon); color: #fff; }
.site-header.is-open .nav-toggle__bars > span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-header.is-open .nav-toggle__bars > span:nth-child(2) { opacity: 0; }
.site-header.is-open .nav-toggle__bars > span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ---- Backdrop, shown behind the drawer while it's open ---- */
.nav-backdrop {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    z-index: 1;
    background: rgba(38, 38, 38, .45);
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s;
}
.site-header.is-open .nav-backdrop { opacity: 1; visibility: visible; }

/* ---- Offcanvas drawer (below 900px). One markup block for both layouts —
   the desktop query further down resets it back to a plain row. ---- */
.nav-drawer {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    z-index: 2;
    width: var(--drawer-w);
    display: flex;
    flex-direction: column;
    padding: 1.25rem var(--gutter) 2rem;
    background: var(--c-dark);
    box-shadow: var(--shadow-drawer);
    overflow-y: auto;
    visibility: hidden;
    transform: translateX(100%);
    transition: transform .32s cubic-bezier(.4, 0, .2, 1), visibility .32s;
}
.site-header.is-open .nav-drawer { visibility: visible; transform: none; }

.main-nav ul { display: flex; flex-direction: column; gap: .15rem; list-style: none; margin: 0; padding: 0; }
.main-nav a {
    display: block;
    padding: .85rem .9rem;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-weight: 700;
    font-size: 1rem;
    color: #f1f0ec;
}
.main-nav a:hover { color: #fff; }
/* Active item gets the filled notched-flag treatment. The skew lives on a
   decorative ::before so the label text stays upright (no counter-skew needed). */
.main-nav .current > a,
.main-nav .current-ancestor > a {
    position: relative;
    color: #fff;
    z-index: 0;
}
.main-nav .current > a::before,
.main-nav .current-ancestor > a::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--c-salmon);
    transform: skewX(var(--flag-skew));
    z-index: -1;
}

.nav-aux {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: .9rem;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(255, 255, 255, .18);
}

/* Auth control — visually distinct from menu items. On the green drawer the
   login/logout flag needs a white outline (the green/red outline variants
   are tuned for the light clay bar and would be invisible or clash here). */
.auth-control a { font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: var(--tracking-caps); }
.nav-drawer .auth-control .flag {
    width: 100%;
    border-color: #fff;
    color: #fff;
    background: transparent;
}
.nav-drawer .auth-control .flag:hover,
.nav-drawer .auth-control .flag:focus-visible { background: var(--c-salmon); border-color: var(--c-salmon); }

/* Language switcher */
.lang-switch { display: inline-flex; gap: .25rem; align-items: center; font-size: .78rem; }
.lang-switch a { color: var(--text-muted); font-weight: 700; text-transform: uppercase; padding: .2rem .35rem; }
.lang-switch a.active { color: var(--c-salmon); text-decoration: underline; }
.nav-drawer .lang-switch { justify-content: center; }
.nav-drawer .lang-switch a { color: rgba(234, 241, 238, .72); }
.nav-drawer .lang-switch a.active { color: #fff; }

/* Staggered entrance for the drawer's own children, once it's open. */
@keyframes nav-item-in {
    from { opacity: 0; transform: translateX(1.25rem); }
    to { opacity: 1; transform: none; }
}
.site-header.is-open .nav-drawer .main-nav li,
.site-header.is-open .nav-drawer .nav-aux {
    animation: nav-item-in .35s ease both;
}
.site-header.is-open .nav-drawer .main-nav li:nth-child(1) { animation-delay: .10s; }
.site-header.is-open .nav-drawer .main-nav li:nth-child(2) { animation-delay: .15s; }
.site-header.is-open .nav-drawer .main-nav li:nth-child(3) { animation-delay: .20s; }
.site-header.is-open .nav-drawer .main-nav li:nth-child(4) { animation-delay: .25s; }
.site-header.is-open .nav-drawer .nav-aux { animation-delay: .30s; }

@media (prefers-reduced-motion: reduce) {
    .nav-toggle__bars > span,
    .nav-backdrop,
    .nav-drawer { transition-duration: .01ms; }
    .site-header.is-open .nav-drawer .main-nav li,
    .site-header.is-open .nav-drawer .nav-aux { animation: none; }
}

/* ---- Desktop: restore the plain horizontal row, hide the offcanvas UI ---- */
@media (min-width: 900px) {
    :root { --header-h: 68px; }

    .nav-toggle, .nav-backdrop { display: none; }

    .nav-drawer {
        position: static;
        z-index: auto;
        width: auto;
        margin-inline-start: auto;
        flex-direction: row;
        align-items: center;
        gap: 1.5rem;
        padding: 0;
        background: none;
        box-shadow: none;
        overflow: visible;
        visibility: visible;
        transform: none;
        transition: none;
    }

    .main-nav ul { flex-direction: row; gap: .35rem; }
    .main-nav a {
        display: inline-block;
        padding: .55rem .95rem;
        font-size: .82rem;
        color: var(--c-dark);
    }
    .main-nav a:hover { color: var(--c-salmon); }
    /* The active item is a filled salmon flag, so hover must keep its white label
       (the plain hover colour above is salmon and would vanish on the fill). */
    .main-nav .current > a:hover,
    .main-nav .current-ancestor > a:hover { color: #fff; }

    .nav-aux { flex-direction: row; align-items: center; gap: 1rem; margin: 0; padding: 0; border-top: none; }
    /* Undo the drawer's forced white-outline treatment (including its
       higher-specificity hover/focus rule) so the login/logout flag goes
       back to its normal salmon/dark outline-fill behaviour on the clay bar. */
    .nav-drawer .auth-control .flag { width: auto; border-color: var(--c-salmon); color: var(--c-salmon); background: transparent; }
    .nav-drawer .auth-control .flag:hover,
    .nav-drawer .auth-control .flag:focus-visible { background: var(--c-salmon); color: #fff; border-color: var(--c-salmon); }
    .nav-drawer .auth-control .flag--outline-dark { border-color: var(--c-dark); color: var(--c-dark); }
    .nav-drawer .auth-control .flag--outline-dark:hover,
    .nav-drawer .auth-control .flag--outline-dark:focus-visible { background: var(--c-dark); color: #fff; border-color: var(--c-dark); }
    .nav-drawer .lang-switch a { color: var(--text-muted); }
    .nav-drawer .lang-switch a.active { color: var(--c-salmon); }

    .site-header.is-open .nav-drawer .main-nav li,
    .site-header.is-open .nav-drawer .nav-aux { animation: none; }
}

/* ---- Hero (homepage only) ---- */

.hero {
    position: relative;
    min-height: clamp(320px, 46vh, 560px);
    background: var(--c-dark-deep) center/cover no-repeat;
}

/* ---- Homepage announcement + reserved sidebar ---- */

/* Grid leaves room for a future promo sidebar (see ROADMAP C0 item 9) without
   an awkward retrofit; the sidebar column simply isn't rendered yet. */
.announce-grid { display: grid; gap: clamp(1.5rem, 4vw, 3rem); grid-template-columns: 1fr; }
@media (min-width: 900px) {
    .announce-grid--with-aside { grid-template-columns: minmax(0, 1fr) 300px; }
    .announce-grid__aside { border-left: 1px solid var(--c-border); padding-left: clamp(1rem, 3vw, 2rem); }
}

.promo-box { background: var(--c-offwhite); border-top: 4px solid var(--c-salmon); padding: 1.25rem; display: flex; flex-direction: column; gap: .75rem; align-items: flex-start; }
.promo-box__title { margin: 0; font-size: 1.25rem; color: var(--c-dark); }
.promo-box p { margin: 0; }

.save-the-date { text-align: center; padding: clamp(1rem, 4vw, 3rem) 0; }
.save-the-date__title { margin: 0 0 .75rem; font-size: clamp(2rem, 6vw, 3.5rem); color: var(--c-dark); }
.save-the-date__text { margin: 0; font-size: 1.1rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); }

/* ---- Entries (distance listing) ---- */

.entries-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 1.5rem; }
.distance-card {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 1.4rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
}
.distance-card__main { display: flex; align-items: center; gap: .9rem; flex-wrap: wrap; }
.distance-card__name { font-weight: var(--fw-heading); font-size: 1.1rem; color: var(--c-dark); }
.distance-card__type {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 999px;
    background: var(--c-clay-light);
    color: var(--c-charcoal);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: .72rem;
    font-weight: 700;
}
.distance-card__side { display: flex; align-items: center; gap: 1.2rem; }
.distance-card__price { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.distance-card__closed { font-size: .82rem; font-style: italic; }

/* ---- Status pill (dashboard, ROADMAP C7) ---- */
.status-pill {
    display: inline-block;
    padding: .2em .65em;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    white-space: nowrap;
}
.status-pill--draft          { background: var(--c-clay-light); color: var(--c-charcoal); }
.status-pill--pending-payment { background: #ffe9ea; color: var(--c-salmon-dark); }
.status-pill--confirmed      { background: #e6f2ec; color: var(--c-dark); }
.status-pill--cancelled      { background: var(--c-offwhite); color: var(--text-muted); }

/* ---- Icon button + confirm dialog (dashboard draft delete) ---- */
.distance-card__delete-form { margin: 0; display: flex; }
.icon-button {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0;
    border: 0; border-radius: var(--radius); background: transparent;
    color: var(--text-muted); cursor: pointer;
}
.icon-button--danger:hover,
.icon-button--danger:focus-visible { color: var(--c-salmon-dark); background: #ffe9ea; outline: 2px solid var(--c-salmon-dark); outline-offset: 0; }
.confirm-dialog {
    border: 0; border-radius: var(--radius); padding: 1.5rem;
    max-width: min(28rem, calc(100vw - 2rem));
    box-shadow: 0 10px 40px rgba(0, 0, 0, .25);
}
.confirm-dialog::backdrop { background: rgba(0, 0, 0, .5); }
.confirm-dialog__title { margin: 0 0 .75rem; }
.confirm-dialog__actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1.25rem; }

/* ---- Results (per-distance table) ---- */

.results-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin: 1.5rem 0;
}
.results-filters input[type="search"],
.results-filters select {
    padding: .55rem .8rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--c-white);
}
.results-filters input[type="search"] { flex: 1 1 220px; }
.results-filters__reset { font-size: .85rem; color: var(--text-muted); text-decoration: underline; }
.results-filters__reset:hover { color: var(--link-hover); }

.results-table-wrap { overflow-x: auto; }
.results-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.results-table th, .results-table td { padding: .6em .85em; text-align: left; white-space: nowrap; }
.results-table thead th {
    background: var(--c-dark);
    color: #fff;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: .78rem;
}
.results-table tbody tr:nth-child(even) { background: var(--c-offwhite); }
.results-table tbody tr:hover { background: var(--c-clay-light); }

.results-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1.5rem;
    font-weight: 700;
}
.results-pager__status { color: var(--text-muted); font-weight: var(--fw-body); }

/* ---- Rendered EditorJS content ---- */
.rich-text { font-size: 1.05rem; }
.rich-text h2, .rich-text h3, .rich-text h4 { margin-top: 1.4em; }
.rich-text p { margin: 0 0 1em; }
.rich-text a {
    color: var(--c-salmon-dark);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: .15em;
}
.rich-text a:hover,
.rich-text a:focus-visible { color: var(--c-dark); }
.rich-text figure { margin: 1.5em 0; }
.rich-text figure img { border-radius: var(--radius); }
.rich-text figure.rich-text__bordered img { border: 1px solid var(--c-border); }
.rich-text figcaption { font-size: .85rem; color: var(--text-muted); margin-top: .5em; text-align: center; }
.rich-text blockquote {
    margin: 1.5em 0;
    padding: .4em 0 .4em 1.2em;
    border-left: 4px solid var(--c-salmon);
    font-style: italic;
    color: var(--c-dark);
}
.rich-text blockquote cite { display: block; font-style: normal; font-size: .85rem; color: var(--text-muted); margin-top: .4em; }
.rich-text table { width: 100%; border-collapse: collapse; margin: 1.5em 0; }
.rich-text table.rich-text__table--headed tr:first-child { background: var(--c-dark); color: #fff; font-weight: 700; }
.rich-text th, .rich-text td { border: 1px solid var(--c-border); padding: .5em .75em; text-align: left; }
.rich-text hr { border: 0; height: 3px; width: 60px; background: var(--c-salmon); margin: 2em auto; }
.rich-text .align-center { text-align: center; }
.rich-text .align-right  { text-align: right; }
.rich-text .align-left   { text-align: left; }

/* ---- Sponsors ---- */

.container--sponsors {
    /* Wide enough for 5 × 200px tiles + 4 × 50px gaps (1200px) plus the gutters. */
    max-width: calc(1200px + 2 * var(--gutter));
}

.sponsor-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: clamp(1.5rem, 5vw, 3.5rem);
}
.sponsor-logo {
    max-height: 70px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter .3s ease, transform .2s ease, opacity .2s ease;
}
/* Every footer logo sits in a 200px square, 50px apart. */
.sponsor-logo img { max-height: 70px; width: auto; }
.sponsor-group .sponsor-row { gap: 50px; }
.sponsor-group .sponsor-logo {
    width: 200px;
    height: 200px;
    max-height: none;
    flex: 0 0 200px;
}
.sponsor-group .sponsor-logo img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}
.sponsor-group .sponsor-logo span { text-align: center; }

/* Header sponsor strip: 170px tall (10px light-clay border top and bottom included), logos
   share the width equally on one line with padding around them; below 900px they
   wrap into two rows (4 columns each) and the strip grows to 280px. */
.band--sponsors-header {
    height: 170px;
    border-block: 10px solid var(--c-clay-light);
    display: flex;
    align-items: center;
}
.band--sponsors-header .container { height: 100%; }
.sponsor-row--header {
    height: 100%;
    flex-wrap: nowrap;
    gap: clamp(.75rem, 2vw, 2rem);
    padding-block: clamp(1rem, 2.5vw, 1.5rem);
}
.sponsor-row--header .sponsor-logo {
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    max-height: none;
    padding: .25rem .5rem;
}
.sponsor-row--header .sponsor-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}
@media (max-width: 899px) {
    /* Taller strip so each of the two rows is about as tall as the desktop one. */
    .band--sponsors-header { height: 280px; }
    .sponsor-row--header {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        grid-template-rows: repeat(2, minmax(0, 1fr));
        gap: 1rem clamp(.5rem, 2vw, 1rem);
        padding-block: 1rem;
    }
    .sponsor-row--header .sponsor-logo { height: 100%; }
    .sponsor-row--header .sponsor-logo img { max-height: 100%; }
}

/* Grayscale by default, colour on hover — but ONLY where hover exists (desktop).
   On touch devices there's no hover to reverse it, so logos stay full colour. */
@media (hover: hover) {
    .sponsor-logo { filter: grayscale(100%); }
    .sponsor-logo:hover { filter: grayscale(0%); }
}

/* Header sponsors always show their original colours. */
.sponsor-row--header .sponsor-logo,
.sponsor-row--header .sponsor-logo:hover { filter: none; }

/* Dark bands: logos are inverted to flat white (always, hover just dims). */
.band--charcoal .sponsor-logo,
.band--charcoal .sponsor-logo:hover { filter: brightness(0) invert(1); }
.band--charcoal .sponsor-logo:hover { opacity: .75; }
.band--charcoal .sponsor-logo { color: #fff; }

.sponsor-group { margin-block: clamp(1.5rem, 4vw, 2.5rem); }
.sponsor-group__title {
    text-align: left;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: .95rem;
    margin-bottom: 1.5rem;
}

/* Featured sponsor: label left, logo right; stacked below the nav breakpoint. */
.sponsor-featured {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
    text-align: center;
}
.sponsor-featured__label {
    margin: 0;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: 1.1rem;
    font-weight: var(--fw-heading);
}
.sponsor-featured .sponsor-logo { max-height: none; }
.sponsor-featured .sponsor-logo img { max-height: 110px; max-width: 100%; width: auto; }
@media (min-width: 900px) {
    .sponsor-featured {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
}

/* ---- Footer ---- */

.site-footer { margin-top: auto; }
/* Mobile: logo, about, contact stacked and centered; desktop: about (right-aligned) | logo | contact (left-aligned). */
.footer-cols { display: grid; gap: 2rem; grid-template-columns: 1fr; text-align: center; }
.footer-logo { order: 1; text-align: center; }
.footer-about { order: 2; }
.footer-contact { order: 3; }
.footer-logo img { max-width: 100%; height: auto; }
@media (min-width: 720px) {
    .footer-cols { grid-template-columns: 1fr auto 1fr; align-items: start; }
    .footer-logo, .footer-about, .footer-contact { order: 0; }
    .footer-logo { padding-inline: 2rem; }
    .footer-about { text-align: right; }
    .footer-contact { text-align: left; }
}
.footer-cols h3 { color: var(--c-dark); text-transform: uppercase; letter-spacing: var(--tracking-caps); font-size: 1rem; }
.footer-contact__subtitle { font-weight: 700; color: var(--c-charcoal); margin-bottom: .4rem; }
.footer-social, .footer-menu ul {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    list-style: none;
    margin: 0;
    padding: 0;
}
.footer-social { gap: 1.25rem; margin-top: 2rem; }
.footer-social a { color: var(--c-dark); display: inline-flex; }
.footer-social a:hover { opacity: .65; }
.footer-menu { margin-top: 1.5rem; }
.footer-menu ul { gap: .5rem 1.5rem; }
.footer-menu a {
    color: var(--c-dark);
    text-transform: uppercase;
    letter-spacing: var(--tracking-caps);
    font-size: .8rem;
}
.footer-bottom {
    background: var(--c-charcoal);
    color: #b8b6ac;
    font-size: .8rem;
    text-align: center;
    padding-block: 1rem;
}

/* ---- Forms (security + registration) ---- */

.form-card {
    max-width: 460px;
    margin-inline: auto;
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    padding: clamp(1.5rem, 4vw, 2.5rem);
}
.form-card--wide { max-width: 640px; }

/* Registration page: summary sidebar (distance + live price) beside the form.
   Aside comes first in the DOM so it sits above the form on phones. */
.register-layout { display: grid; gap: clamp(1rem, 3vw, 2rem); grid-template-columns: 1fr; align-items: start; }
.register-layout .form-card--wide { width: 100%; }
@media (min-width: 900px) {
    .register-layout { grid-template-columns: minmax(0, 640px) 300px; justify-content: center; }
    .register-layout .form-card--wide { grid-column: 1; grid-row: 1; margin-inline: 0; }
    .register-summary { grid-column: 2; grid-row: 1; position: sticky; top: calc(var(--header-h) + 1.5rem); }
}
.register-summary { background: var(--c-offwhite); border-top: 4px solid var(--c-salmon); padding: 1.25rem; }
.register-summary p { margin: 0; }
.register-summary__eyebrow { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: var(--tracking-caps); color: var(--text-muted); }
.register-summary__race { font-size: 1.15rem; font-weight: 700; color: var(--c-dark); margin-bottom: 1rem !important; }
.register-summary__list { margin: 0 0 .75rem; }
.register-summary__list dt { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); }
.register-summary__list dd { margin: 0 0 .75rem; font-weight: 700; color: var(--c-dark); }
.register-summary__price {
    display: inline-block;
    font-size: 2rem;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
    transform-origin: left center;
}
.register-summary__category { font-size: .9rem; color: var(--text-muted); margin-bottom: .75rem !important; }
.register-summary__category[hidden] { display: none; }
.register-summary__deadline { font-size: .85rem; border-top: 1px solid var(--c-border); padding-top: .75rem; }

@keyframes price-pulse-down {
    0%, 100% { transform: scale(1); color: var(--c-dark); }
    35% { transform: scale(1.08); color: #1f8a4c; }
}
@keyframes price-pulse-up {
    0%, 100% { transform: scale(1); color: var(--c-dark); }
    35% { transform: scale(1.08); color: var(--c-salmon); }
}
.register-summary__price.is-price-down { animation: price-pulse-down .6s ease-out; }
.register-summary__price.is-price-up { animation: price-pulse-up .6s ease-out; }
@media (prefers-reduced-motion: reduce) {
    .register-summary__price.is-price-down,
    .register-summary__price.is-price-up { animation: none; }
}
/* h1-h4 have their top margin zeroed globally (see reset above), so a heading
   right after a table/form block would otherwise sit flush against it. */
.form-card h2 { margin-top: 1.8rem; }
.form-card h2:first-child { margin-top: 0; }
.results-table + .results-table { margin-top: 1rem; }
.form-row { margin-bottom: 1.1rem; }
.form-row label { display: block; font-weight: 700; font-size: .85rem; margin-bottom: .35rem; text-transform: uppercase; letter-spacing: .03em; }
.form-row input:not([type="checkbox"]):not([type="radio"]),
.form-row select,
.form-row textarea {
    width: 100%;
    padding: .7rem .85rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--c-white);
}
.form-row input:focus,
.form-row select:focus,
.form-row textarea:focus { outline: 2px solid var(--c-dark); outline-offset: 1px; }
.form-help { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }
.form-error { color: var(--c-salmon); font-size: .82rem; margin-top: .3rem; }
.form-actions { margin-top: 1.5rem; }

/* Designed replacement for the native HTML5 validation bubble: a red border
   on the offending field, paired with the .form-error message above. */
.form-row input.is-invalid:not([type="checkbox"]):not([type="radio"]),
.form-row select.is-invalid,
.form-row textarea.is-invalid { border-color: var(--c-salmon); }
.form-row input.is-invalid:focus,
.form-row select.is-invalid:focus,
.form-row textarea.is-invalid:focus { outline-color: var(--c-salmon); }

/* slim-select (slim_select_controller.js) replaces the native <select> on the
   registration form; make its box look like the other .form-row controls. */
.form-row .ss-main {
    width: 100%;
    min-height: 0;
    padding: .7rem .85rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font: inherit;
    background: var(--c-white);
}
.form-row .ss-main:focus { outline: 2px solid var(--c-dark); outline-offset: 1px; box-shadow: none; }
.form-row .ss-main.is-invalid { border-color: var(--c-salmon); }
.form-row .ss-main.is-invalid:focus { outline-color: var(--c-salmon); }
.ss-content { font: inherit; }

/* Checkbox / radio rows: the label sits beside the box, not stacked above it
   like a text-field label, and the box never stretches to the row's width. */
.form-row input[type="checkbox"],
.form-row input[type="radio"] {
    width: 1.15rem;
    height: 1.15rem;
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--c-dark);
}
.checkbox-row {
    display: flex;
    align-items: center;
    gap: .6rem;
}
.form-row .checkbox-row label {
    display: inline;
    margin-bottom: 0;
    font-weight: var(--fw-body);
    font-size: .95rem;
    text-transform: none;
    letter-spacing: normal;
}
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: .6rem;
}

/* Button element sharing the notched-flag look. */
button.flag, .btn { font-family: inherit; }

/* ---- Flash messages ---- */
.flash { padding: .9rem 1.1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid transparent; }
.flash--success { background: #e6f2ec; border-color: #b7d9c6; color: #1e5a3c; }
.flash--error   { background: #ffe9ea; border-color: #ffc2c6; color: #c4222d; }
.flash--info    { background: #eaf1f4; border-color: #bcd2dc; color: #2c4a58; }

/* ---- Misc ---- */
.page-title { text-transform: uppercase; }
.text-center { text-align: center; }
.muted { color: var(--text-muted); }
.stack > * + * { margin-top: 1rem; }

/* ---- Error pages ---- */
.error-page { max-width: 640px; margin-inline: auto; text-align: center; }
.error-page__code {
    font-size: clamp(5rem, 18vw, 9rem);
    font-weight: var(--fw-heading);
    line-height: 1;
    color: var(--c-salmon);
    transform: skewX(var(--flag-skew));
    margin-bottom: 1rem;
}
.error-page .form-actions { display: flex; gap: .75rem; justify-content: center; flex-wrap: wrap; }
