/* Fonts are served from static/fonts (see OFL.txt there); nothing is loaded from a CDN. */
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Barlow"; src: url("../fonts/barlow-700.woff2") format("woff2"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url("../fonts/barlow-semi-condensed-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }

/* Następny Bieg — colour tokens. Light is the default; the dark values are
   listed twice below: once for an explicit choice (data-theme="dark", set by
   js/theme.js) and once for visitors whose system asks for dark and who have
   not chosen. Keep the two dark blocks identical. */
:root {
  color-scheme: light;
  --bg: #F3F5F9;
  --surface: #FFFFFF;
  --surface-2: #F1F4F9;
  --hover: #EAEEF5;
  --ink: #111A2C;
  --ink-2: #3A4558;
  --muted: #566176;
  --line: #D9DEE8;
  --line-soft: #E4E8F0;
  --line-strong: #BCC4D2;
  --control-border: #A3ACBD;
  --amber-bg: #FDEFD2;
  --amber-ink: #6E3B00;
  --amber-line: #E3A947;
  --open-bg: #E3F3EA;
  --open-ink: #0B5A40;
  --open-line: #B4D7C4;
  --soon-bg: #EEEAFB;
  --soon-ink: #4A2F8F;
  --soon-line: #CFC4EE;
  --full-bg: #ECEEF2;
  --full-ink: #465064;
  --full-line: #CCD2DD;
  --neutral-bg: #EEF1F5;
  --neutral-line: #D3D9E3;
  --error: #9B1C1C;
  --accent: #1D4ED8;
  --accent-hover: #173EAD;
  --accent-fill: #1D4ED8;
  --accent-soft: #1D4ED81F;
  --focus: #1D4ED8;
  --on-accent: #FFFFFF;
  --radius-card: 12px;
  --radius-control: 8px;
  --pad: 32px;
  --control-h: 40px;

  /* Typeface. "Display" is the wordmark, H1 and big numbers; "heading" is the rest. */
  --font-fallback: "Helvetica Neue", Arial, sans-serif;
  --font-body: "Barlow", var(--font-fallback);
  --font-display: "Barlow Semi Condensed", "Barlow", var(--font-fallback);
  --display-weight: 600;
  --display-style: italic;
  --heading-weight: 600;
}

:root[data-theme="dark"] {
  --bg: #0E131C;
  --surface: #171D29;
  --surface-2: #1F2634;
  --hover: #232B3A;
  --ink: #E9EDF5;
  --ink-2: #B7C0D0;
  --muted: #94A0B5;
  --line: #2A3344;
  --line-soft: #242C3B;
  --line-strong: #3F4A5F;
  --control-border: #55607A;
  --amber-bg: #3A2A0A;
  --amber-ink: #F7C873;
  --amber-line: #7A5A16;
  --open-bg: #12301F;
  --open-ink: #8FD9AE;
  --open-line: #1F5236;
  --soon-bg: #261F45;
  --soon-ink: #C4B5FD;
  --soon-line: #41357A;
  --full-bg: #232A36;
  --full-ink: #AEB7C6;
  --full-line: #38414F;
  --neutral-bg: #222936;
  --neutral-line: #353E4D;
  --error: #FF8F8F;
  color-scheme: dark;
  --accent: #8AB0FF;
  --accent-hover: #B3CBFF;
  --accent-fill: #2F5FE0;
  --accent-soft: #8AB0FF29;
  --focus: #8AB0FF;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E131C;
    --surface: #171D29;
    --surface-2: #1F2634;
    --hover: #232B3A;
    --ink: #E9EDF5;
    --ink-2: #B7C0D0;
    --muted: #94A0B5;
    --line: #2A3344;
    --line-soft: #242C3B;
    --line-strong: #3F4A5F;
    --control-border: #55607A;
    --amber-bg: #3A2A0A;
    --amber-ink: #F7C873;
    --amber-line: #7A5A16;
    --open-bg: #12301F;
    --open-ink: #8FD9AE;
    --open-line: #1F5236;
    --soon-bg: #261F45;
    --soon-ink: #C4B5FD;
    --soon-line: #41357A;
    --full-bg: #232A36;
    --full-ink: #AEB7C6;
    --full-line: #38414F;
    --neutral-bg: #222936;
    --neutral-line: #353E4D;
    --error: #FF8F8F;
    color-scheme: dark;
    --accent: #8AB0FF;
    --accent-hover: #B3CBFF;
    --accent-fill: #2F5FE0;
    --accent-soft: #8AB0FF29;
    --focus: #8AB0FF;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
}

a { color: var(--accent); }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, h4, p, ul, dl, dd { margin: 0; }
ul { padding: 0; list-style: none; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 100; padding: 8px 12px; background: var(--surface); }

.icon { width: 14px; height: 14px; flex: 0 0 auto; }
.caption {
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--muted);
}

/* Header */
.site-header { background: var(--surface); border-bottom: 1px solid var(--line); }
.site-header__inner {
  max-width: 1280px; margin: 0 auto; padding: 0 var(--pad); height: 68px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.wordmark { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.wordmark:hover { color: var(--ink); }
.wordmark__tile { color: var(--accent-fill); }
.wordmark__text { font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight); font-size: 19px; letter-spacing: -0.01em; white-space: nowrap; }
.site-nav { display: flex; align-items: center; gap: 4px; }
.theme-toggle { margin-left: 8px; font-family: inherit; cursor: pointer; }
.theme-toggle[hidden] { display: none; }
.site-nav a {
  padding: 10px 12px; border-radius: var(--radius-control);
  text-decoration: none; color: var(--ink); font-size: 15px;
}
.site-nav a[aria-current="page"] { font-weight: 700; box-shadow: inset 0 -2px 0 var(--accent); }

/* Intro: a compact track motif, drawn locally and shared by both themes. */
.intro { max-width: 1280px; margin: 0 auto; padding: 28px var(--pad) 28px; }
.intro__panel {
  position: relative; overflow: hidden; padding: 28px 32px;
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(110deg, var(--surface) 40%, var(--accent-soft));
}
.intro__copy { position: relative; z-index: 1; max-width: 72%; display: flex; flex-direction: column; gap: 10px; }
.intro__eyebrow { font-size: 12px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.intro h1 {
  font-size: 48px; line-height: 1.05; font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight);
  letter-spacing: -0.02em; text-wrap: balance;
}
.intro h1 span { color: var(--accent); }
.intro p { font-size: 17px; color: var(--ink-2); max-width: 56ch; }
.intro__track { position: absolute; width: 340px; right: -16px; top: -39px; transform: rotate(-22deg); stroke: var(--accent); stroke-width: 1.5; opacity: 0.28; }
.intro__start { stroke-width: 6; stroke-dasharray: 2 3; }
.intro__arrow { stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }
.intro__runner { fill: var(--accent); stroke: var(--surface); stroke-width: 3; }

/* Layout: filter sidebar beside the results */
.wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--pad) 56px; }
.layout { display: flex; gap: 24px; align-items: flex-start; }

/* Filters */
.filters { flex: 0 0 264px; }
.filters .filters__summary { display: none; } /* two classes: must beat .btn further down */
.filters__form {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 18px;
}
.filters__head { display: flex; align-items: center; justify-content: space-between; min-height: 32px; }
.filters__head h2 { font-size: 18px; font-weight: var(--heading-weight); }
.filters__head a { color: var(--ink); font-size: 14px; }
.filters .filters__close { display: none; }
#results { transition: opacity 0.15s; }
#results.htmx-request { opacity: 0.5; }
@media (prefers-reduced-motion: reduce) { #results { transition: none; } }
.js .sort .btn { display: none; } /* with JavaScript the sort applies on change */
.filters__submit { width: 100%; min-height: 44px; font-size: 15px; cursor: pointer; font-family: inherit; }
.field { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.field__label { padding: 0; font-weight: 700; font-size: 15px; }
legend.field__label { margin-bottom: 8px; }
.field__hint { font-size: 13px; color: var(--muted); }
.field__sublabel { font-size: 13.5px; color: var(--ink-2); margin-bottom: -4px; }
.field__error { font-size: 13.5px; font-weight: 700; color: var(--error); }
.field__error:empty { display: none; }
.field select, .field input[type="date"], .field input[type="number"], .field input[type="text"], .sort select {
  width: 100%; min-height: 44px; padding: 0 10px; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--control-border); border-radius: var(--radius-control); background: var(--surface);
}
.js .field--date:not(:has(input[value="custom"]:checked)) .field__pair--dates { display: none; }
.filters__advanced > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 44px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; list-style: none;
}
.filters__advanced > summary::-webkit-details-marker { display: none; }
.filters__advanced[open] > summary .details-chevron { transform: rotate(180deg); }
.filters__advanced-fields { display: flex; flex-direction: column; gap: 18px; margin-top: 16px; }
.field__pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.field__pair label { display: block; font-size: 13.5px; color: var(--ink-2); margin-bottom: 4px; }
.options { display: flex; flex-wrap: wrap; gap: 6px; }
.options--grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.options--column { flex-direction: column; }
.option {
  display: inline-flex; align-items: center; gap: 8px; min-height: var(--control-h); padding: 4px 12px 4px 10px;
  border: 1px solid var(--line-strong); border-radius: var(--radius-control); background: var(--surface);
  font-size: 14.5px; font-weight: 500; cursor: pointer;
}
.option:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); font-weight: 700; }
.option input { width: 18px; height: 18px; margin: 0; flex: 0 0 auto; accent-color: var(--accent-fill); }
.option span { display: flex; flex-direction: column; line-height: 1.2; }
.option small { font-size: 12.5px; font-weight: 400; color: var(--muted); }

/* Results */
.results { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 22px; }
.results__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.results__title { display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.sort select { width: auto; min-height: var(--control-h); font-size: 14.5px; }
.sort .btn { cursor: pointer; font-family: inherit; }
.quick-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.quick-filters__label { font-size: 13px; color: var(--muted); margin-right: 4px; }
.quick-filter {
  position: relative; display: inline-flex; align-items: center; gap: 4px; min-height: 40px; padding: 6px 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--ink-2); font-size: 14px; font-weight: 600; text-decoration: none;
}
.quick-filter:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.quick-filter.is-active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.quick-filter--open { border-color: var(--accent); color: var(--accent); }
.deadlines__head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; min-height: 32px; cursor: pointer; list-style: none; }
.deadlines__head::-webkit-details-marker { display: none; }
.deadlines[open] > summary .details-chevron { transform: rotate(180deg); }
.deadlines__count { font-weight: 400; color: var(--muted); }
.deadlines__head > .icon { margin-left: auto; }
.deadlines__head h3 { font-size: 17px; font-weight: 600; }
.deadlines__head > span { color: var(--muted); font-size: 12px; }
.deadlines__mobile-note { display: none; }
.deadlines__grid { margin-top: 12px; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr)); gap: 10px; }
.deadline-card {
  display: flex; flex-direction: column; gap: 6px; padding: 16px;
  border: 1px solid var(--line); border-top: 3px solid var(--amber-line); border-radius: 12px;
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.deadline-card:hover { border-color: var(--amber-line); background: var(--surface-2); color: var(--ink); }
.deadline-card__kind { display: flex; align-items: center; gap: 6px; color: var(--amber-ink); font-size: 12px; font-weight: 600; }
.deadline-card__name { font-size: 16px; line-height: 1.25; font-weight: 600; }
.deadline-card__action { font-size: 13px; font-weight: 600; }
.deadline-card__meta { font-size: 12px; color: var(--muted); }
.deadline-card__link { margin-top: auto; padding-top: 6px; font-size: 12px; font-weight: 600; color: var(--accent); }
/* Pagination */
.pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px; padding-top: 8px; }
.pagination__pages { display: flex; align-items: center; gap: 6px; margin: 0; padding: 0; list-style: none; }
.pagination .btn { min-width: var(--control-h); }
/* Two classes: .btn is defined further down and would win otherwise. */
.pagination .pagination__current, .pagination .pagination__current:hover { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.pagination__off { opacity: 0.45; }
.pagination__gap { color: var(--muted); }
.pagination__status { display: none; font-size: 14px; color: var(--ink-2); }
@media (max-width: 599px) {
  /* Phones: previous, "page 2 of 5", next. The numbers would not fit as 44 px targets. */
  .pagination__pages { display: none; }
  .pagination__status { display: inline; }
  .pagination { justify-content: space-between; }
}

/* List / map switch */
.view-switch { display: inline-flex; border: 1px solid var(--control-border); border-radius: var(--radius-control); overflow: hidden; }
.view-switch a {
  display: inline-flex; align-items: center; gap: 6px; min-height: var(--control-h); padding: 0 12px;
  background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px; text-decoration: none;
}
.view-switch a:hover { background: var(--hover); }
.view-switch a[aria-current] { background: var(--ink); color: var(--surface); }

/* Map view */
.map-panel { display: flex; flex-direction: column; gap: 8px; }
.map {
  height: min(62vh, 520px); min-height: 320px; border: 1px solid var(--line);
  border-radius: var(--radius-card); background: var(--surface-2); z-index: 0;
}
.map-panel__note { font-size: 13px; color: var(--muted); }
.map-pin-wrap { width: 0; height: 0; }
.map-pin {
  position: absolute; left: 0; bottom: 0; transform: translateX(-8px); white-space: nowrap;
  padding: 3px 9px; border-radius: 10px 10px 10px 2px; font: 700 13px/1.4 var(--font-body);
  font-variant-numeric: tabular-nums; background: #FFFFFF; color: #111A2C;
  border: 2px solid var(--accent-fill); box-shadow: 0 2px 6px rgba(10, 14, 22, 0.25);
}
.map-pin--many { background: var(--accent-fill); color: var(--on-accent); }
.leaflet-marker-icon:focus-visible .map-pin { outline: 3px solid var(--focus); outline-offset: 2px; }
/* Two classes, to win over leaflet.css, which loads after this file. */
.map.leaflet-container { font-family: var(--font-body); }
.map .leaflet-popup-content-wrapper, .map .leaflet-popup-tip { background: var(--surface); color: var(--ink); }
.leaflet-popup-content { margin: 12px 14px; }
.map-popup { display: flex; flex-direction: column; gap: 10px; max-height: 260px; overflow-y: auto; font-size: 13.5px; }
.map-popup__event { display: flex; flex-direction: column; gap: 2px; }
.map-popup__event + .map-popup__event { border-top: 1px solid var(--line-soft); padding-top: 10px; }
.map-popup__event strong { font-size: 15px; }
.map-popup__event span { color: var(--ink-2); }
.map .map-popup__event a { color: var(--accent); font-weight: 700; }
.leaflet-container a.leaflet-popup-close-button { color: var(--ink-2); }
/* Dim and cool the light map tiles in the dark theme (both dark selectors, as for the tokens). */
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(0.9) contrast(0.9) saturate(0.6); }
}

.active-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.active-filters__chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 10px 0 12px;
  border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface);
  color: var(--ink); font-weight: 600; text-decoration: none;
}
.active-filters__chip:hover { background: var(--hover); color: var(--ink); }
.active-filters__clear { color: var(--ink); font-weight: 700; }
.results__count { font-size: 24px; font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight); font-variant-numeric: tabular-nums; }
.results__sub { font-size: 14px; color: var(--muted); }

.group { display: flex; flex-direction: column; gap: 10px; }
.group__heading {
  display: flex; align-items: center; gap: 12px;
  font-size: 16px; font-weight: var(--heading-weight); padding: 4px 0 8px;
}
.group__label { display: flex; flex-direction: column; gap: 2px; }
.group__relative { font-size: 13px; font-weight: 500; color: var(--muted); }
.calendar-block {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 52px; min-height: 58px; flex: 0 0 52px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent);
}
.calendar-block__day { font: italic 600 28px/1 var(--font-display); }
.calendar-block__month { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; }

.empty {
  background: var(--surface); border: 1.5px dashed var(--control-border);
  border-radius: var(--radius-card); padding: 28px 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.empty h3 { font-size: 19px; font-weight: var(--heading-weight); }
.empty p { color: var(--ink-2); max-width: 60ch; }

/* Event card */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card);
  padding: 22px; display: flex; flex-direction: column; gap: 16px; scroll-margin-top: 16px;
  transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
@media (hover: hover) {
  .card:hover { border-color: var(--line-strong); box-shadow: 0 6px 20px var(--accent-soft); transform: translateY(-2px); }
}
.card--cancelled .card__name { text-decoration: line-through; }
.card__main { display: grid; grid-template-columns: minmax(0, 1fr) 180px 190px; gap: 22px; align-items: start; }
.card__decision { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.card__info { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.card__name { font-size: 23px; line-height: 1.25; font-weight: var(--heading-weight); text-wrap: balance; }
.card__where { margin-top: 6px; font-size: 14px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.card__when { font-weight: 500; color: var(--ink-2); }
.card__facts { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13.5px; color: var(--muted); }
.card__facts strong { color: var(--ink); }

.chips__more-mobile { display: none; }
.chip { text-decoration: none; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--control-border);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 14px; font-weight: 700;
}
button.chip { cursor: pointer; }
button.chip:hover { background: var(--hover); }
button.chip--selected:hover { background: var(--ink); }
.chip__label { max-width: 28ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip--more { border-style: dashed; color: var(--ink-2); }
.chip--selected { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.price { min-width: 0; padding-left: 18px; border-left: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 5px; }
.price__main {
  font-size: 32px; font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight); line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.price__main--text { font-family: var(--font-body); font-style: normal; font-size: 17px; font-weight: var(--heading-weight); line-height: 1.25; }
.price__line { font-size: 13.5px; color: var(--ink-2); }
.price__line--strong { font-size: 14px; font-weight: 600; color: var(--ink); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; margin-top: 4px;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: var(--neutral-bg); color: var(--ink-2); border: 1px solid var(--neutral-line);
}
.pill--amber { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); font-weight: 700; }

.registration { display: flex; flex-direction: column; gap: 6px; }
.registration__deadline { font-size: 14px; color: var(--ink-2); }
.registration__deadline--urgent { font-weight: 700; color: var(--amber-ink); }

.tag {
  display: inline-flex; align-items: center; gap: 6px; align-self: flex-start;
  padding: 4px 10px; border-radius: 6px; font-size: 13.5px; font-weight: 700; line-height: 1.3;
  background: var(--neutral-bg); color: var(--ink-2); border: 1px solid var(--neutral-line);
}
.tag--open { background: var(--open-bg); color: var(--open-ink); border-color: var(--open-line); }
.tag--soon { background: var(--soon-bg); color: var(--soon-ink); border-color: var(--soon-line); }
.tag--full { background: var(--full-bg); color: var(--full-ink); border-color: var(--full-line); }
.tag--amber { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber-line); }

.card__actions { display: flex; flex-direction: column; gap: 8px; }
.btn {
  min-height: var(--control-h); padding: 0 14px; border-radius: var(--radius-control);
  border: 1px solid var(--control-border); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: 14.5px; text-decoration: none; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { background: var(--hover); color: var(--ink); }
.btn--primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-fill); color: var(--on-accent); filter: brightness(0.9); }

@media (min-width: 960px) and (max-width: 1150px) {
  .card__main { grid-template-columns: minmax(0, 1fr) minmax(0, 0.85fr); gap: 16px; }
  .card__info { grid-column: 1; grid-row: 1 / span 2; }
  .price, .card__decision { grid-column: 2; }
  .price { padding-left: 0; border-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .card { transition: none; }
  .card:hover { transform: none; }
}

/* Card details */
.card__details > summary {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px;
  cursor: pointer; font-weight: 700; font-size: 14.5px; border-radius: 4px;
}
.details-chevron { transition: transform 0.18s; }
.card__details[open] .details-chevron { transform: rotate(180deg); }
@media (prefers-reduced-motion: reduce) { .details-chevron { transition: none; } }
.details {
  margin-top: 10px; border-top: 1px solid var(--line-soft); padding-top: 14px;
  display: flex; flex-direction: column; gap: 14px;
}
.details__grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr));
  gap: 12px 24px; font-size: 14.5px;
}
.details__grid dd { font-weight: 600; }
.details__payment-line { display: block; margin-top: 3px; font-size: 13px; font-weight: 400; color: var(--ink-2); }
.price-rows { margin-top: 6px; border: 1px solid var(--line-soft); border-radius: 8px; overflow: hidden; }
.price-rows li {
  display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 10px 12px;
  border-bottom: 1px solid var(--line-soft); font-size: 14px;
}
.price-rows li:last-child { border-bottom: 0; }
.price-rows li.is-selected { background: var(--surface-2); }
.price-rows__label { flex: 1 1 180px; font-weight: 700; }
.price-rows__tag {
  display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 12px; font-weight: 600;
  background: var(--neutral-bg); color: var(--ink-2); border: 1px solid var(--neutral-line);
}
.price-rows__now { flex: 1 1 150px; font-weight: 600; }
.price-rows__then { flex: 1 1 210px; color: var(--ink-2); }
.price-rows__meta { color: var(--muted); }
.details__source { font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 14px; }
.details__source a { color: var(--ink-2); }

/* Footer */
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.site-footer__inner {
  max-width: 1280px; margin: 0 auto; padding: 24px var(--pad);
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 28px;
}
.site-footer__name { font-family: var(--font-display); font-style: var(--display-style); font-weight: var(--display-weight); font-size: 16px; }
.site-footer p { font-size: 13.5px; color: var(--muted); flex: 1 1 320px; }

/* Compact layout: phones and tablets use the filter sheet. */
@media (max-width: 959px) {
  :root { --pad: 16px; --control-h: 48px; }
  .site-header__inner { height: 60px; }
  .site-nav a { white-space: nowrap; }
  /* Icon-only on narrow screens; the label stays for screen readers. */
  .theme-toggle { min-height: 44px; width: 44px; padding: 0; }
  .theme-toggle [data-theme-label] { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .theme-toggle .icon { width: 18px; height: 18px; }
  .intro { padding-top: 16px; padding-bottom: 20px; }
  .intro__panel { padding: 18px 18px; border-radius: 16px; }
  .intro__copy { max-width: 100%; gap: 8px; }
  .intro h1 { font-size: 32px; }
  .intro p { font-size: 15px; }
  .intro__eyebrow { font-size: 10px; }
  .intro__track { width: 210px; right: -105px; top: -84px; opacity: 0.12; }
  .wrap { padding-bottom: 40px; }
  .layout { flex-direction: column; align-items: stretch; gap: 12px; }
  .filters { flex: 0 0 auto; }
  .filters .filters__summary { display: flex; min-height: 44px; background: var(--surface); color: var(--ink); border-color: var(--line-strong); cursor: pointer; list-style: none; }
  .filters__summary::-webkit-details-marker { display: none; }
  .filters[open] .filters__summary { margin-bottom: 12px; }
  .filters__head h2 { display: none; }
  .option { min-height: 44px; }
  /* With JavaScript the filter panel is a bottom sheet over a backdrop. */
  .js .filters[open]::before { content: ""; position: fixed; inset: 0; z-index: 40; background: rgba(10, 14, 22, 0.55); }
  body.filters-open { overflow: hidden; }
  .js .filters[open] .filters__form {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 88vh; overflow-y: auto;
    border-radius: 16px 16px 0 0; border-width: 1px 0 0; padding: 0 16px;
    box-shadow: 0 -10px 40px rgba(10, 14, 22, 0.3);
  }
  .js .filters__head {
    position: sticky; top: 0; z-index: 1; background: var(--surface);
    padding: 12px 0 10px; border-bottom: 1px solid var(--line-soft); gap: 12px;
  }
  .js .filters__head h2 { display: block; margin-right: auto; }
  .js .filters .filters__close { display: inline-flex; width: 44px; min-height: 44px; padding: 0; cursor: pointer; }
  .js .filters__submit-bar {
    position: sticky; bottom: 0; background: var(--surface);
    padding: 12px 0 16px; border-top: 1px solid var(--line-soft);
  }
  .results { gap: 16px; }
  .results__head { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .results__title { flex-direction: column; align-items: flex-start; gap: 2px; }
  .results__count { font-size: 22px; }
  .results__sub { font-size: 12px; }
  .sort { width: auto; }
  .sort label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .sort select { width: 132px; min-height: 44px; padding: 0 8px; font-size: 13px; }
  .quick-filters { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
  .quick-filters::-webkit-scrollbar { display: none; }
  .quick-filters__label { display: none; }
  .quick-filter { flex: 0 0 auto; min-height: 44px; padding: 6px 12px; }
  .quick-filter--open { order: -1; }
  .deadlines__head { min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
  .deadlines__head h3 { font-size: 15px; }
  .deadlines__freshness { display: none; }
  .deadlines__grid { grid-template-columns: minmax(0, 1fr); }
  .deadlines__mobile-note { display: block; margin-top: 12px; color: var(--muted); font-size: 12px; }
  .calendar-block { width: 44px; flex-basis: 44px; min-height: 50px; border-radius: 10px; }
  .calendar-block__day { font-size: 25px; }
  .group__heading { font-size: 15px; padding-bottom: 4px; }
  .card { padding: 14px; gap: 8px; }
  .card__main { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 12px; }
  .card__info { grid-column: 1 / -1; gap: 8px; }
  .card__name { font-size: 20px; line-height: 1.2; }
  .card__where { margin-top: 4px; font-size: 13px; gap: 2px; }
  .card__facts { font-size: 12px; }
  .chips__extra, .chips__more-desktop { display: none; }
  .chips__more-mobile { display: list-item; }
  .chip { min-height: 44px; padding: 0 10px; font-size: 13px; }
  .chip__label { max-width: 23ch; }
  .price { padding: 0; border-left: 0; background: none; gap: 3px; }
  .price .caption { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 10px; }
  .price__main { font-size: 26px; }
  .price__main--text { font-size: 15px; }
  .price > .price__line, .price > .pill:not(.pill--amber) { display: none; }
  .price > .price__line--notice { display: block; font-size: 11px; color: var(--muted); }
  .price > .pill { padding: 3px 6px; font-size: 11px; }
  .card__decision { grid-column: 2; gap: 8px; }
  .card__main:not(:has(.price)) .card__decision { grid-column: 1 / -1; }
  .registration { gap: 4px; }
  .registration .tag { font-size: 11px; padding: 4px 6px; }
  .registration__deadline { display: none; }
  .registration__deadline--urgent { display: block; font-size: 11px; }
  .card__actions { flex-direction: column; gap: 6px; }
  .card__actions .btn { min-height: 44px; font-size: 13px; padding: 0 8px; }
  .card__details > summary { min-height: 44px; font-size: 13px; }
}

@media (max-width: 380px) {
  .site-header__inner { gap: 8px; }
  .wordmark { gap: 8px; }
  .wordmark__text { font-size: 18px; }
  .site-nav { gap: 0; }
  .site-nav a { padding: 10px 8px; font-size: 14px; }
  .theme-toggle { margin-left: 4px; }
}

/* Phones: the count gets its own line; the list/map switch and sort share the next one. */
@media (max-width: 599px) {
  .results__head { grid-template-columns: minmax(0, 1fr); }
  .results__title { flex-direction: row; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
  .sort { width: 100%; justify-content: space-between; }
  .view-switch a { min-height: 44px; }
  .map { height: 56vh; }
}

/* Phones: the wordmark already leads home, so the header keeps only the account link and the theme toggle. */
@media (max-width: 599px) {
  .site-nav .site-nav__home { display: none; }
  .site-nav a { padding: 10px 8px; }
}

/* Links from the calendar to race pages and notifications */
.card__name a { color: inherit; text-decoration: none; }
.card__name a:hover { color: var(--accent); text-decoration: underline; }
.card__follow .icon { width: 16px; height: 16px; }
.save-search {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 14px 16px;
  background: var(--surface); border: 1.5px solid var(--accent); border-radius: var(--radius-card);
}
.save-search__icon {
  flex: 0 0 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.save-search__icon .icon { width: 20px; height: 20px; }
.save-search__text { flex: 1 1 280px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.save-search__text span { font-size: 14px; color: var(--ink-2); }
@media (max-width: 599px) {
  .save-search .btn { flex: 1 1 100%; min-height: 44px; }
  .save-search__icon { display: none; } /* the button already says what this is; save the height */
}

/* Paid listing tiers: always labelled as such */
.featured-label {
  display: inline-block; align-self: flex-start; padding: 2px 8px; border-radius: 4px; margin-bottom: 4px;
  font-size: 12px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent);
}
.card--featured { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent-fill); }
.promoted { display: flex; flex-direction: column; gap: 8px; }
.promoted__title { font-size: 16px; font-weight: var(--heading-weight); }
.promoted__title span { margin-left: 6px; font-size: 12.5px; font-weight: 400; color: var(--muted); }
.promoted__list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 10px; }
.promoted__item {
  display: flex; flex-direction: column; gap: 2px; height: 100%; padding: 12px 14px; text-decoration: none;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--accent); border-radius: var(--radius-card);
}
.promoted__item:hover { background: var(--hover); color: var(--ink); }
.promoted__item span { font-size: 14px; color: var(--ink-2); }
.site-footer__links { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; }
.site-footer__links a { color: var(--ink); }
.site-footer__links { flex: 1 1 auto; }
