/* Run Houston — race-morning paper
 *
 * Palette: paper #f2eee6, ink #1c1917, mute #6f6a64,
 * tyvek #fffcf7, line #ddd6cc, heat #c43c1a
 *
 * Typography: Barlow Condensed 800 for hero + race names only,
 * DM Sans 500/700 for UI
 */

@import url('https://fonts.googleapis.com/css2?family=Barlow+Condensed:wght@800&family=DM+Sans:wght@500;700&display=swap');

:root {
  --paper:  #f2eee6;
  --ink:    #1c1917;
  --mute:   #6f6a64;
  --tyvek:  #fffcf7;
  --line:   #ddd6cc;
  --heat:   #c43c1a;
  --trail:  #2e6b48;
  --road:   #3d6a8a;
  --track:  #b5812b;

  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body:    "DM Sans", -apple-system, system-ui, sans-serif;

  --radius: 8px;
  --max-w:  1140px;
}

* { box-sizing: border-box; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

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

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px; line-height: 1.6;
  color: var(--ink); background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Header ─────────────────────────────────────────────── */

.site-header {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 0 1.25rem;
  position: sticky; top: 0; z-index: 200;
}

.site-header-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: flex; align-items: center;
  justify-content: space-between;
  height: 58px; gap: 1rem;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.75rem; font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em; text-transform: uppercase; line-height: 1;
  flex-shrink: 0;
}
.brand:hover { text-decoration: none; }
.brand-mark { color: var(--heat); }

.site-nav {
  display: flex; gap: 0.5rem; flex-wrap: wrap;
}
.site-nav a {
  color: var(--ink);
  font-size: 0.8rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.5rem 0.75rem;
  transition: opacity 140ms;
}
.site-nav a:hover {
  opacity: 0.6;
  text-decoration: none;
}
.site-nav a[aria-current="page"] {
  text-decoration: underline;
}

@media (max-width: 640px) {
  .site-header { padding: 0 1rem; }
  .site-header-inner { flex-wrap: wrap; height: auto; padding: 0.75rem 0; }
  .brand { font-size: 1.5rem; }
  .site-nav { gap: 0.3rem; width: 100%; justify-content: flex-start; }
  .site-nav a {
    font-size: 0.7rem;
    padding: 0.4rem 0.55rem;
    letter-spacing: 0.05em;
  }
}

/* ─── Page Hero ──────────────────────────────────────────── */

.page-hero {
  background: var(--paper);
  padding: 2.5rem 1.25rem 2rem;
}

.page-hero__inner {
  max-width: var(--max-w); margin: 0 auto;
}

.page-hero__eyebrow {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--mute); margin: 0 0 0.5rem;
}

.page-hero__title {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 8vw, 4.5rem);
  font-weight: 800; line-height: 0.95;
  letter-spacing: -0.02em; text-transform: uppercase;
  margin: 0 0 0.75rem;
  color: var(--ink);
}
.page-hero__title em { font-style: normal; color: var(--heat); }

/* Clubs and reports pages use DM Sans for hero, not Barlow */
.page-hero__title.hero-dm {
  font-family: var(--font-body);
  font-weight: 700;
  letter-spacing: -0.03em;
}
.page-hero__title.hero-dm em { color: var(--ink); }

.page-title em { font-style: normal; color: var(--ink); }

.page-hero__stats {
  display: flex; flex-wrap: wrap;
  align-items: center; gap: 0.5rem;
  margin: 0; font-size: 0.8rem; font-weight: 700;
  color: var(--ink);
}
.page-hero__stats strong {
  color: var(--ink);
  font-weight: 700;
}
.page-hero__stats-sep { opacity: 0.4; }

@media (min-width: 640px) {
  .page-hero { padding: 3rem 1.5rem 2.5rem; }
}

/* ─── Main ───────────────────────────────────────────────── */

main {
  max-width: var(--max-w); margin: 0 auto;
  padding: 0 1.25rem 4rem;
}

.page-title {
  font-family: var(--font-body);
  font-size: 2.5rem; font-weight: 700;
  line-height: 1.1; margin: 1.5rem 0 0.5rem; color: var(--ink);
}

.page-subtitle {
  margin: 0.75rem 0 1.5rem; color: var(--mute);
  font-size: 1rem; line-height: 1.6; max-width: 600px;
}

/* ─── Unified filters toolbar ───────────────────────────── */

.filters {
  background: var(--paper);
  padding: 1.25rem 0;
  margin-bottom: 1.5rem;
}

.filters-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.75rem;
}

.filter-group { border: 0; padding: 0; margin: 0; min-width: 0; }

.filter-legend {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--mute); margin-bottom: 0.5rem; padding: 0;
}

.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.chip { position: relative; display: inline-flex; align-items: center; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip label {
  display: inline-flex; align-items: center;
  min-height: 36px; padding: 0.4rem 0.85rem;
  border: 1px solid var(--line); border-radius: 999px;
  font-size: 0.8rem; font-weight: 700;
  background: var(--paper); color: var(--mute);
  cursor: pointer; user-select: none;
  transition: background 140ms, border-color 140ms, color 140ms;
}
.chip label:hover { border-color: var(--ink); color: var(--ink); }
.chip input:checked + label {
  background: var(--ink); border-color: var(--ink);
  color: var(--paper);
}
.chip input:focus-visible + label {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

#race-search {
  font: inherit; font-weight: 500;
  color: var(--ink);
  padding: 0.6rem 0.85rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--tyvek); min-height: 40px;
  flex: 1 1 240px; min-width: 0; font-size: 0.95rem;
  transition: border-color 140ms;
}
#race-search:focus {
  outline: none;
  border-color: var(--ink);
}

.filter-dropdowns {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  flex: 0 0 auto;
}
.filter-dd { position: relative; }

.filter-dd-btn {
  appearance: none;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper);
  font-family: var(--font-body);
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--mute);
  padding: 0.5rem 0.9rem; min-height: 36px;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.35rem;
  transition: border-color 140ms, color 140ms;
}
.filter-dd-btn:hover { border-color: var(--ink); color: var(--ink); }
.filter-dd-btn[aria-expanded="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.filter-dd-btn.has-selection { color: var(--ink); border-color: var(--ink); }

.dd-arrow { font-size: 0.58rem; opacity: 0.5; }

.filter-dd-panel {
  position: absolute; top: calc(100% + 6px); left: 0;
  z-index: 10000;
  background: var(--tyvek);
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(28,25,23,.12);
  padding: 0.5rem; min-width: 180px;
}
.filter-dd-panel-wide { min-width: 280px; }

@media (max-width: 480px) {
  .filter-dd-panel {
    left: 0; right: auto;
    max-width: calc(100vw - 1.5rem);
    min-width: 0;
  }
}

.filter-dd-panel[hidden] { display: none; }

.filter-dd-option {
  display: block; padding: 0.45rem 0.65rem;
  font-size: 0.82rem; font-weight: 500; color: var(--ink);
  border-radius: 6px; cursor: pointer;
  transition: background 100ms;
}
.filter-dd-option:hover { background: rgba(28,25,23,.06); }
.filter-dd-option input[type="radio"] { margin-right: 0.5rem; }

.filter-dd-panel .chip-row { display: flex; flex-wrap: wrap; gap: 0.3rem; }

.filter-details { border: 0; margin: 0; padding: 0; }
.filter-details summary.filter-summary {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mute); cursor: pointer; padding: 0.2rem 0;
  list-style: none; display: flex; align-items: center; gap: 0.4rem;
}
.filter-details summary.filter-summary::after {
  content: '▾'; font-size: 0.65rem; opacity: 0.6;
}
.filter-details[open] summary.filter-summary::after { content: '▴'; }
.filter-details[open] .filter-details-body { margin-top: 0.75rem; }

.result-count {
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--mute); margin: 0;
}

.view-toggle {
  display: inline-flex;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); padding: 3px;
  flex: 0 0 auto;
  margin-left: auto;
}

.view-toggle-btn {
  appearance: none; border: 0; background: transparent;
  color: var(--mute); font: inherit;
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 0.45rem 0.9rem; min-height: 40px; border-radius: 999px;
  cursor: pointer; transition: background 140ms, color 140ms;
}
.view-toggle-btn:hover { color: var(--ink); }
.view-toggle-btn.is-active {
  background: var(--ink); color: var(--paper);
}
.view-toggle-btn:focus-visible {
  outline: 2px solid var(--ink); outline-offset: 2px;
}

@media (max-width: 880px) {
  .filters-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  #race-search {
    width: 100%;
    flex: 1 1 auto;
  }

  .filter-dropdowns {
    width: 100%;
    justify-content: space-between;
  }

  .view-toggle {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }

  .view-toggle-btn {
    flex: 1;
    min-height: 44px;
  }
}

/* ─── Map ────────────────────────────────────────────────── */

.rh-map {
  height: 520px; max-height: 70vh;
  border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden;
}
.map-note {
  margin: 0.65rem 0 0;
  font-size: 0.82rem; font-weight: 500; color: var(--mute); text-align: center;
}

.rh-popup {
  font-family: var(--font-body); font-size: 0.85rem;
  line-height: 1.5; min-width: 180px; max-width: 260px;
}
.rh-popup strong, .rh-popup strong a {
  color: var(--ink); font-size: 0.95rem; font-weight: 700;
}
.rh-popup strong a:hover { color: var(--ink); opacity: 0.6; }
.rh-popup .muted { color: var(--mute); }
.rh-popup ul { margin: 0.4rem 0 0; padding-left: 1rem; }
.rh-popup ul li { margin: 0.15rem 0; }
.rh-popup-link {
  display: inline-block; margin-top: 0.45rem;
  font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; font-size: 0.72rem;
}


@media (max-width: 480px) { .rh-map { height: 60vh; } }

/* ─── Mobile bottom sheet ────────────────────────────────── */

.race-map-sheet {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 2000; background: var(--tyvek);
  border-top: 1px solid var(--line);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 36px;
  box-shadow: 0 -6px 28px rgba(0,0,0,.15);
  transform: translateY(100%); transition: transform 220ms ease;
}
.race-map-sheet.open { transform: translateY(0); }

.sheet-close {
  position: absolute; top: 14px; right: 16px;
  appearance: none; border: none;
  background: var(--paper); border-radius: 50%;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.15rem; line-height: 1;
  color: var(--mute); cursor: pointer;
}
.sheet-close:hover { color: var(--ink); }

.sheet-race-name {
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 800;
  color: var(--ink); margin: 0 2rem 0.4rem 0; line-height: 1.1;
  text-decoration: none; display: block;
}
.sheet-race-name:hover {
  text-decoration: underline;
}
.sheet-meta { font-size: 0.82rem; color: var(--mute); margin-bottom: 0.6rem; }
.sheet-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 0.9rem; }
.sheet-actions { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; }
.sheet-detail-link {
  font-size: 0.78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink);
}

/* ─── Race Cards Grid ────────────────────────────────────── */

#race-cards {
  display: grid; gap: 1rem; grid-template-columns: 1fr;
}
#race-cards[hidden] { display: none; }

@media (min-width: 700px) {
  #race-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  #race-cards { grid-template-columns: repeat(3, 1fr); }
}

#club-cards, #report-list {
  display: grid; gap: 1rem; grid-template-columns: 1fr;
}
#club-cards[hidden], #report-list[hidden] { display: none; }

@media (min-width: 700px) {
  #club-cards, #report-list { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 960px) {
  #club-cards, #report-list { grid-template-columns: repeat(3, 1fr); }
}

#club-list { width: 100%; }
#club-list[hidden] { display: none; }

/* ─── Race Table ─────────────────────────────────────────── */

.race-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.race-table th {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mute); text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 2px solid var(--line); white-space: nowrap;
}
.race-table td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line); vertical-align: middle;
}
.race-table tr:hover { background: rgba(28,25,23,.03); }
.race-table a { color: var(--ink); font-weight: 700; }
.race-table a:hover { color: var(--ink); opacity: 0.6; }
.race-table .badges-cell { white-space: nowrap; }
.race-table .badges-cell .badge { font-size: 0.6rem; padding: 0.18rem 0.4rem; }

@media (max-width: 640px) {
  .race-table .col-city, .race-table .col-surface { display: none; }
  .race-table { table-layout: fixed; }
  .race-table .badges-cell { white-space: normal; }
}

/* ─── Race Card (bib style) ──────────────────────────────── */

.race-card {
  background: var(--tyvek);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem 1.3rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto auto auto;
  gap: 0.75rem 1rem;
  text-decoration: none;
  position: relative;
}
.race-card::before {
  content: '';
  position: absolute; top: 0; left: 0; bottom: 0;
  width: 3px;
  background: var(--ink);
}
.race-card.race-card--road::before  { background: var(--road); }
.race-card.race-card--trail::before { background: var(--trail); }
.race-card.race-card--track::before { background: var(--track); }

.race-card__bib {
  grid-column: 1;
  grid-row: 1 / 4;
  display: flex; flex-direction: column; gap: 0.15rem;
  align-self: start;
}
.race-card__day {
  font-size: 2rem; font-weight: 700;
  line-height: 1; color: var(--ink);
}
.race-card__month {
  font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--mute);
}

.race-card__name {
  grid-column: 2;
  grid-row: 1;
  font-family: var(--font-display);
  font-size: 1.35rem; font-weight: 800;
  line-height: 1.1;
  color: var(--ink);
  margin: 0;
}
.race-card__name a {
  color: var(--ink);
}
.race-card__name a:hover {
  color: var(--ink);
  text-decoration: underline;
}

.club-card__name {
  font-family: var(--font-body);
  font-size: 1.35rem; font-weight: 700;
  line-height: 1.1; color: var(--ink);
  margin: 0.5rem 0 0.4rem;
}

.race-card__meta {
  grid-column: 2;
  grid-row: 2;
  font-size: 0.8rem; color: var(--mute);
  display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center;
}

.race-card__badges {
  grid-column: 2;
  grid-row: 3;
  display: flex; gap: 0.35rem; flex-wrap: wrap;
  /* The card grid stretches this row to the tallest card in the grid row;
     without these, flex's default stretch made the pills tall ovals. */
  align-items: flex-start; align-content: flex-start;
}
.race-card__badges .badge { white-space: nowrap; }

.badge {
  font-size: 0.66rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 0.25rem 0.6rem; border-radius: 999px;
  background: transparent; color: var(--mute); border: 1px solid var(--line);
}
.badge.distance { }
.badge.surface-road  { border-color: var(--road);  color: var(--road); }
.badge.surface-trail { border-color: var(--trail); color: var(--trail); }
.badge.surface-track { border-color: var(--track); color: var(--track); }
.badge.kid-run { border-color: var(--mute); color: var(--mute); }

.race-card__actions {
  grid-column: 3;
  grid-row: 1 / 4;
  align-self: center;
}

.btn-register {
  display: inline-block; padding: 0.55rem 1.2rem;
  background: var(--heat); color: #fff !important;
  font-family: var(--font-body); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: var(--radius); text-decoration: none !important;
  transition: opacity 140ms;
  white-space: nowrap;
}
.btn-register:hover {
  opacity: 0.85; color: #fff !important;
}

.race-card__actions.muted {
  color: var(--mute); font-style: italic;
  font-weight: 500; font-size: 0.8rem;
}

@media (max-width: 699px) {
  .race-card {
    display: flex; flex-direction: column;
  }
  .race-card__bib {
    align-self: flex-start;
  }
  .race-card__actions {
    grid-column: unset;
    grid-row: unset;
    align-self: stretch;
    width: 100%;
  }
  .btn-register {
    display: block; width: 100%; text-align: center;
  }
}

/* ─── States ─────────────────────────────────────────────── */

.loading, .empty, .error {
  text-align: center; padding: 3rem 1.25rem;
  color: var(--mute); font-weight: 500;
  background: var(--tyvek);
  border: 1px dashed var(--line); border-radius: var(--radius);
  grid-column: 1 / -1;
}
.error {
  color: var(--heat); border-color: var(--heat);
  background: rgba(196,60,26,.06); font-weight: 700;
}

/* ─── Long-form prose ────────────────────────────────────── */

.prose, #report-article {
  max-width: 720px; margin: 0 auto;
  background: var(--tyvek); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 2rem 1.75rem 2.25rem;
}

#race-article {
  max-width: 720px; margin: 0 auto;
  padding: 0;
}

.prose h1, #report-article h1 {
  margin-top: 0; font-family: var(--font-body);
  font-weight: 700; font-size: 2rem;
}
.prose h2, .report-body h2 {
  margin-top: 2rem; font-family: var(--font-body);
  font-size: 1.4rem; font-weight: 700;
}
.prose h3, .report-body h3 {
  margin-top: 1.75rem; font-family: var(--font-body);
  font-size: 1.15rem; font-weight: 700;
}
.prose p, .report-body p { font-size: 1rem; line-height: 1.7; }
.prose ul, .report-body ul { font-size: 1rem; line-height: 1.7; }
.prose code, .report-body code {
  background: var(--paper); border: 1px solid var(--line);
  border-radius: 4px; padding: 0.07em 0.32em;
  font-size: 0.87em; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

.report-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.25rem; margin-bottom: 1.25rem;
}
.report-race { margin: 0.5rem 0 0; color: var(--mute); font-size: 0.9rem; font-weight: 500; }

.report-photos {
  display: grid; gap: 0.75rem;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  margin-top: 1.75rem;
}
.report-photos img {
  width: 100%; height: auto;
  border-radius: var(--radius); border: 1px solid var(--line);
}

/* ─── Single Race Detail ─────────────────────────────────── */

.race-detail-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.25rem; margin-bottom: 1.5rem;
  display: flex; flex-wrap: wrap;
  justify-content: space-between; align-items: flex-start;
  gap: 1.5rem;
}
.race-detail-header h1 {
  margin: 0 0 0.6rem; font-family: var(--font-display);
  font-size: 2.5rem; font-weight: 800;
  line-height: 1.05; letter-spacing: -0.01em;
  flex: 1 1 400px;
}

.race-detail-header-left {
  flex: 1 1 400px;
}

.race-detail-header-right {
  flex: 0 0 auto;
  align-self: flex-start;
}

@media (max-width: 640px) {
  .race-detail-header {
    display: block;
  }
  .race-detail-header-right {
    display: none;
  }
}
.race-detail-subtitle { margin: 0 0 0.85rem; color: var(--mute); font-size: 1rem; }
.race-detail-subtitle strong { color: var(--ink); font-weight: 700; }
.race-description-full { font-size: 1.05rem; line-height: 1.65; margin: 0 0 1.75rem; }

.race-detail-sticky-register {
  display: none;
}

@media (max-width: 640px) {
  .race-detail-sticky-register {
    display: block;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1000;
    height: 56px;
  }
  .race-detail-sticky-register .btn-primary {
    display: block; width: 100%; text-align: center;
    background: var(--heat); color: #fff;
    margin: 0; border-radius: 0;
    padding: 0;
    height: 56px;
    line-height: 56px;
    box-shadow: 0 -2px 12px rgba(0,0,0,.15);
  }
  .race-detail-sticky-register .btn-primary:hover {
    background: var(--heat); opacity: 0.9;
  }
  body.has-sticky-register {
    padding-bottom: 56px;
  }
}

.race-detail-grid {
  margin: 0 0 1.75rem;
  display: grid; grid-template-columns: max-content 1fr;
  gap: 0.6rem 1.25rem; font-size: 0.95rem;
}
.race-detail-grid dt {
  font-weight: 700; color: var(--mute); text-transform: uppercase;
  font-size: 0.7rem; letter-spacing: 0.08em; align-self: center;
}
.race-detail-grid dd { margin: 0; color: var(--ink); line-height: 1.5; }

@media (max-width: 480px) {
  .race-detail-grid { grid-template-columns: 1fr; gap: 0.15rem 0; }
  .race-detail-grid dt { margin-top: 0.75rem; }
  .race-detail-grid dt:first-child { margin-top: 0; }
}

.calendar-links { margin: 0 0 1.25rem; font-size: 0.83rem; color: var(--mute); }
.calendar-links-label {
  font-weight: 700; text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.08em;
}
.calendar-links a { font-weight: 700; }
.calendar-links-sep { color: var(--line); }

.race-detail-actions {
  display: flex; align-items: center;
  justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.25rem;
}
.race-detail-actions .race-badges { flex: 1 1 auto; }

.race-badges { display: flex; flex-wrap: wrap; gap: 0.35rem; }

.btn-share {
  appearance: none; border: 1px solid var(--line); border-radius: 999px;
  background: var(--paper); color: var(--ink); font: inherit;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; padding: 0.45rem 1rem; min-height: 36px;
  cursor: pointer; display: inline-flex; align-items: center; gap: 0.4rem;
  transition: border-color 140ms;
}
.btn-share:hover { border-color: var(--ink); }
.btn-share.is-copied { background: rgba(46,107,72,.1); border-color: var(--trail); color: var(--trail); }
.btn-share:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

.race-website-cta { display: none; }

/* ─── 404 ────────────────────────────────────────────────── */

.not-found {
  max-width: 640px; margin: 2rem auto 3rem;
  padding: 2rem 1.25rem; text-align: center;
}
.not-found-number {
  font-family: var(--font-body); font-size: 7rem; font-weight: 700;
  line-height: 0.9; color: var(--ink); margin: 0;
}
.not-found-title {
  font-family: var(--font-body); font-size: 2rem; font-weight: 700;
  line-height: 1.1; margin: 0.75rem 0 0; color: var(--ink);
}
.not-found-lede {
  margin: 1rem auto 2rem; max-width: 440px;
  color: var(--mute); font-size: 1.05rem; line-height: 1.6;
}

@media (min-width: 640px) {
  .not-found { margin-top: 3rem; }
  .not-found-number { font-size: 9rem; }
  .not-found-title { font-size: 2.5rem; }
}

/* ─── Primary CTA Button ─────────────────────────────────── */

.btn-primary {
  display: inline-block; padding: 0.95rem 2rem;
  background: var(--heat); color: #fff; border-radius: 999px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.9rem;
  text-transform: uppercase; letter-spacing: 0.08em; text-decoration: none;
  transition: opacity 140ms;
}
.btn-primary:hover {
  opacity: 0.85; text-decoration: none; color: #fff;
}
.btn-primary:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ─── Back Link ──────────────────────────────────────────── */

.back-link {
  max-width: 720px; margin: 0 auto 1rem;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.back-link a { color: var(--mute); }
.back-link a:hover { color: var(--ink); }

/* ─── Footer ─────────────────────────────────────────────── */

.site-footer {
  padding: 3rem 1.25rem 3.5rem; margin-top: 4rem;
  font-size: 0.8rem; font-weight: 500;
  color: var(--mute); background: var(--paper);
  border-top: 1px solid var(--line);
}

.site-footer-inner {
  max-width: var(--max-w); margin: 0 auto;
  display: grid; grid-template-columns: 1fr; gap: 1.75rem;
}

@media (min-width: 640px) {
  .site-footer-inner { grid-template-columns: repeat(3, 1fr); gap: 2.5rem; }
}

.site-footer h3 {
  font-family: var(--font-body); font-size: 0.7rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink); margin: 0 0 0.65rem;
}
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer ul li { margin: 0.3rem 0; }
.site-footer a { color: var(--mute); transition: color 140ms; }
.site-footer a:hover { color: var(--ink); text-decoration: none; }

.site-footer-bottom {
  grid-column: 1 / -1; text-align: center;
  padding-top: 1.5rem; border-top: 1px solid var(--line);
  color: var(--mute); font-size: 0.76rem;
}

/* ─── Link-style button ──────────────────────────────────── */

.link-btn {
  appearance: none; border: none; background: none; padding: 0;
  font: inherit; color: var(--ink); cursor: pointer;
  text-decoration: underline; font-weight: 700;
}
.link-btn:hover { opacity: 0.7; }

/* ─── News cards ─────────────────────────────────────────── */

.news-list {
  display: grid; grid-template-columns: 1fr; gap: 1.5rem;
  max-width: 920px; margin: 0 auto;
}

@media (min-width: 640px) {
  .news-list { grid-template-columns: repeat(2, 1fr); gap: 1.75rem; }
}

@media (min-width: 960px) {
  .news-list { grid-template-columns: repeat(3, 1fr); gap: 2rem; }
}

.news-card {
  background: var(--tyvek); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem;
  transition: border-color 140ms;
}

.news-card:hover {
  border-color: var(--ink);
}

.news-card__meta {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 0.65rem; gap: 0.75rem;
}

.news-card__source {
  display: inline-block; padding: 0.25rem 0.6rem;
  background: var(--heat); color: #fff;
  font-size: 0.65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}

.news-card__date {
  font-size: 0.75rem; font-weight: 700; color: var(--mute);
  white-space: nowrap;
}

.news-card__title {
  font-family: var(--font-body); font-size: 1.05rem; font-weight: 700;
  line-height: 1.3; margin: 0 0 0.75rem; color: var(--ink);
}

.news-card__summary {
  font-size: 0.85rem; line-height: 1.5; color: var(--mute);
  margin: 0 0 1rem;
}

.news-card__link {
  display: inline-block; font-size: 0.8rem; font-weight: 700;
  color: var(--ink); text-decoration: none;
  transition: opacity 140ms;
}

.news-card__link:hover {
  opacity: 0.7; text-decoration: none;
}

/* ─── Desktop breakpoints ────────────────────────────────── */

@media (min-width: 640px) {
  main { padding: 0 1.5rem 5rem; }
  .brand { font-size: 1.9rem; }
  .page-title { font-size: 3rem; }
  .race-detail-header h1 { font-size: 3rem; }
  .filters { padding: 1.5rem 0; }
  .prose, #report-article, #race-article { padding: 2.5rem 2.5rem 3rem; }
}

@media (min-width: 960px) {
  .page-title { font-size: 3.5rem; }
  .race-detail-header h1 { font-size: 3.5rem; }
}

/* ─── Calendar page (calendar.html) ──────────────────────── */

.calendar-main {
  max-width: 920px; margin: 0 auto;
  padding: 0 1rem 3rem;
}

.calendar-intro {
  margin: 0 0 2.5rem;
  padding: 1.25rem 1.5rem;
  background: var(--tyvek);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.calendar-intro p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--mute);
}

.cal-month {
  margin-bottom: 3rem;
}

.cal-month-title {
  font-family: var(--font-body);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--line);
}

.cal-month-races {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cal-race-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  background: var(--tyvek);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 140ms;
}

.cal-race-row:hover {
  border-color: var(--ink);
}

.cal-race-date {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--mute);
  white-space: nowrap;
  min-width: 90px;
}

.cal-race-info {
  min-width: 0;
}

.cal-race-name {
  margin: 0 0 0.25rem;
}

.cal-race-name a {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  transition: opacity 140ms;
}

.cal-race-name a:hover {
  opacity: 0.7;
  text-decoration: none;
}

.cal-race-meta {
  font-size: 0.85rem;
  color: var(--mute);
}

.cal-race-action {
  text-align: right;
}

.cal-race-register {
  display: inline-block;
  padding: 0.5rem 1rem;
  background: var(--ink);
  color: var(--paper);
  font-size: 0.85rem;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
  transition: opacity 140ms;
  white-space: nowrap;
}

.cal-race-register:hover {
  opacity: 0.85;
  color: var(--paper);
  text-decoration: none;
}

@media (max-width: 640px) {
  .calendar-main {
    padding: 0 0.75rem 2rem;
  }

  .calendar-intro {
    padding: 1rem;
  }

  .cal-month-title {
    font-size: 1.5rem;
  }

  .cal-race-row {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
  }

  .cal-race-date {
    font-size: 0.75rem;
    min-width: auto;
  }

  .cal-race-name a {
    font-size: 0.95rem;
  }

  .cal-race-meta {
    font-size: 0.8rem;
  }

  .cal-race-action {
    text-align: left;
  }

  .cal-race-register {
    font-size: 0.8rem;
    padding: 0.45rem 0.875rem;
  }
}

/* ─── Newsletter signup / unsubscribe ────────────────────── */

/* Home only: the newsletter box ends <main>, so main's bottom padding plus
   the footer's 4rem top margin left ~130-145px of empty space. */
.main--home { padding-bottom: 0; }
.main--home + .site-footer { margin-top: 1.75rem; }
@media (min-width: 640px) {
  .main--home + .site-footer { margin-top: 2.5rem; }
}

/* Clear the sticky header on a plain (no-JS) #newsletter anchor jump;
   the header wraps to two rows on narrow screens. */
#newsletter { scroll-margin-top: 9rem; }
@media (min-width: 640px) { #newsletter { scroll-margin-top: 5.5rem; } }

.newsletter--home {
  margin: 2.5rem auto 0; max-width: 560px;
  padding: 1.5rem 1.25rem;
  background: var(--tyvek);
  border: 1px solid var(--line); border-radius: var(--radius);
}
.newsletter-title {
  font-family: var(--font-body); font-size: 1.15rem; font-weight: 700;
  line-height: 1.25; margin: 0 0 0.25rem; color: var(--ink);
}
.newsletter-lede { margin: 0 0 1rem; color: var(--mute); font-size: 0.92rem; }
.newsletter-label {
  display: block; margin: 0 0 0.35rem;
  font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink);
}
.newsletter-row { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.newsletter-input {
  font: inherit; font-weight: 500; font-size: 0.95rem;
  color: var(--ink); background: var(--tyvek);
  padding: 0.6rem 0.85rem; min-height: 44px;
  border: 1px solid var(--line); border-radius: var(--radius);
  flex: 1 1 200px; min-width: 0;
  transition: border-color 140ms;
}
.newsletter-input:focus { outline: none; border-color: var(--ink); }
.newsletter-input:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.newsletter-input[readonly] { background: var(--paper); }
.newsletter-btn {
  appearance: none; border: none; cursor: pointer;
  min-height: 44px; padding: 0 1.25rem;
  background: var(--heat); color: #fff; border-radius: 999px;
  font-family: var(--font-body); font-weight: 700; font-size: 0.8rem;
  text-transform: uppercase; letter-spacing: 0.08em;
  transition: opacity 140ms; flex: 0 0 auto;
}
.newsletter-btn:hover { opacity: 0.85; }
.newsletter-btn:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.newsletter-btn:disabled { opacity: 0.6; cursor: wait; }
.newsletter-status { margin: 0.5rem 0 0; font-size: 0.88rem; font-weight: 700; min-height: 1.4em; }
.newsletter-status.is-ok { color: var(--trail); }
.newsletter-status.is-error { color: var(--heat); }
.newsletter-privacy { margin: 0.25rem 0 0; font-size: 0.78rem; color: var(--mute); }
.newsletter-privacy a { color: inherit; text-decoration: underline; }

/* Honeypot: off-screen, not display:none, so simple bots still fill it. */
.newsletter-hp {
  position: absolute; left: -10000px; top: auto;
  width: 1px; height: 1px; overflow: hidden;
}


.unsub { max-width: 560px; margin: 2rem auto 0; padding: 1rem 0 0; }
.unsub-title {
  font-family: var(--font-body); font-size: 2rem; font-weight: 700;
  line-height: 1.1; margin: 0 0 0.75rem; color: var(--ink);
}
.unsub-lede { margin: 0 0 1rem; color: var(--mute); overflow-wrap: anywhere; }
.unsub-lede strong { color: var(--ink); }
.unsub-alt { margin: 1.5rem 0 0; font-size: 0.88rem; color: var(--mute); }
.unsub-alt a { text-decoration: underline; }
