
:root {
  --yellow: #FFD000;
  --yellow-dark: #CCA600;
  --black: #1a1a1a;
  --bg: #fdfaf2;
  --card: #ffffff;
  --text: #1e2521;
  --muted: #6b7570;
  --border: #ece3c4;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.logo-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: #ffffff; border-radius: 50%; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}
header {
  background: var(--black); color: var(--yellow); padding: 24px 20px; text-align: center;
  display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap;
}
header .logo-badge { width: 72px; height: 72px; padding: 4px; }
header img.logo { width: 64px; height: 64px; }
header .header-text { text-align: left; }
header h1 { margin: 0; font-size: 28px; line-height: 1.2; color: var(--yellow); }
header .subtitle { margin: 4px 0 0; color: #ffffff; opacity: 0.75; }
/* The title is long, so it wraps on narrow screens. Shrink it and centre the
   block under the logo rather than letting it break mid-word next to it. */
@media (max-width: 560px) {
  header h1 { font-size: 21px; }
  header .header-text { text-align: center; }
}

nav.tabs {
  display: flex; justify-content: center; gap: 24px; padding: 14px; flex-wrap: wrap;
  background: var(--black); border-top: 1px solid #333; position: sticky; top: 0; z-index: 10;
}
nav.tabs a { color: var(--yellow); text-decoration: none; font-weight: 600; padding-bottom: 2px; }
nav.tabs a:hover { text-decoration: underline; }
nav.tabs a.active { border-bottom: 2px solid var(--yellow); }

section { max-width: 900px; margin: 32px auto; padding: 0 20px; }
section h2 { color: var(--black); border-bottom: 3px solid var(--yellow); padding-bottom: 6px; }
.hint { color: var(--muted); font-size: 14px; margin-top: -6px; }

table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 8px; overflow: hidden; }
table.leaderboard, table.race-table { box-shadow: 0 1px 3px rgba(0,0,0,0.08); }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 14px; }
th { background: var(--yellow); color: var(--black); font-weight: 700; }
tr:last-child td { border-bottom: none; }
tr.bot-row { color: var(--muted); font-style: italic; }
table.leaderboard td.medal { text-align: center; font-size: 16px; padding-left: 4px; padding-right: 4px; }
tr.rank-1 td { background: #fff3c4; }
tr.rank-2 td { background: #f1f1f1; }
tr.rank-3 td { background: #f7e2cf; }
tr.rank-1 { font-weight: 600; }
tr.anon-row td { font-style: italic; }

.view-toggle { margin: 12px 0; display: flex; gap: 8px; }
.view-toggle button {
  padding: 6px 14px; border: 1px solid var(--yellow-dark); background: white; color: var(--black);
  border-radius: 999px; cursor: pointer; font-size: 14px;
}
.view-toggle button.active { background: var(--yellow); color: var(--black); font-weight: 700; border-color: var(--yellow); }

/* Collapsible race blocks on the Results page. */
.race { background: var(--card); border-radius: 8px; margin: 0 0 12px; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,0.08); max-width: none; overflow: hidden; }
.race summary {
  cursor: pointer; padding: 14px 16px; list-style: none;
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px;
  border-left: 4px solid transparent;
}
.race summary:hover { background: #faf6e4; }
.race details[open] > summary { border-left-color: var(--yellow); border-bottom: 1px solid var(--border); }
/* Replace the default disclosure marker with our own, so it looks the same
   in Safari (which ignores ::marker on summary) as in Chrome and Firefox. */
.race summary::-webkit-details-marker { display: none; }
.race summary::before {
  content: "\25B8"; color: var(--yellow-dark); font-size: 13px;
  transition: transform 0.15s ease; display: inline-block;
}
.race details[open] > summary::before { transform: rotate(90deg); }
.race-title { font-weight: 700; color: var(--black); font-size: 16px; }
.race-date { color: var(--muted); font-size: 14px; }
.event-id { color: var(--muted); font-weight: 400; font-size: 13px; margin-left: auto; }
.race-body { padding: 12px 16px 16px; }
.toggle { font-size: 14px; color: var(--muted); display: inline-block; margin-bottom: 10px; }
@media (max-width: 600px) { .event-id { margin-left: 0; flex-basis: 100%; } }

footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; }
footer p { margin: 4px 0; }
footer a { color: var(--muted); text-decoration: underline; }
footer a:hover { color: var(--black); }
.footer-gilles { margin-top: 12px !important; font-weight: 700; color: var(--black); }
.footer-gilles .heart { font-style: normal; font-size: 14px; vertical-align: -1px; }

#points h3 { color: var(--black); margin-top: 24px; margin-bottom: 6px; }
#points p { line-height: 1.5; }
#points table.scale-table { max-width: 320px; margin: 10px 0 20px; }
#points ul.example-list { line-height: 1.6; padding-left: 20px; }

.home-intro { text-align: center; }
.home-intro .logo-badge { width: 120px; height: 120px; padding: 6px; margin-bottom: 12px; }
.home-intro img.logo { width: 108px; height: 108px; }
.cal-heading { border-bottom: none; margin-bottom: 4px; }
.cal-wrap { margin-top: 8px; }
.cal-list { list-style: none; margin: 0; padding: 0; }
.cal-row {
  display: flex; align-items: center; gap: 16px; background: var(--card);
  border-radius: 10px; padding: 14px 18px; margin-bottom: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-left: 5px solid var(--yellow);
}
.cal-date {
  flex: 0 0 62px; text-align: center; line-height: 1.1; color: var(--black);
}
.cal-date .cal-wd { display: block; font-size: 11px; text-transform: uppercase; color: var(--muted); letter-spacing: 0.5px; }
.cal-date .cal-dd { display: block; font-size: 26px; font-weight: 800; }
.cal-date .cal-mon { display: block; font-size: 12px; text-transform: uppercase; color: var(--muted); }
.cal-body { flex: 1 1 auto; min-width: 0; }
.cal-title { margin: 0; font-size: 16px; color: var(--black); }
.cal-time { font-size: 13px; color: var(--muted); }
.cal-meta { margin: 3px 0 0; font-size: 13px; color: var(--muted); }
.cal-meta .cal-route { font-weight: 600; color: var(--text); }
.cal-meta .cal-sep { opacity: 0.5; }
.cal-note { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.cal-action { flex: 0 0 auto; }
.cal-btn {
  display: inline-block; padding: 8px 16px; background: var(--yellow); color: var(--black);
  border-radius: 999px; text-decoration: none; font-weight: 700; font-size: 14px; white-space: nowrap;
}
.cal-btn:hover { background: var(--yellow-dark); }
.cal-btn-ghost { background: var(--black); color: var(--yellow); }
.cal-btn-ghost:hover { background: #333; }
.cal-btn-results { background: var(--black); color: var(--yellow); }
.cal-btn-results:hover { background: #333; }
.cal-soon { font-size: 13px; color: var(--muted); font-style: italic; white-space: nowrap; }
.cal-pending { display: none; font-size: 13px; color: var(--muted); font-style: italic; white-space: nowrap; }
.cal-badge {
  display: none; font-size: 11px; font-weight: 700; text-transform: uppercase;
  background: var(--black); color: var(--yellow); padding: 2px 8px; border-radius: 999px;
  vertical-align: middle; margin-left: 6px; letter-spacing: 0.5px;
}
.cal-row.is-next { border-left-color: var(--black); box-shadow: 0 2px 10px rgba(0,0,0,0.16); }
.cal-row.is-next .cal-badge { display: inline-block; }
.cal-row.is-past { opacity: 0.45; }
/* A finished race must never keep showing a signup button. Once the date has
   passed, hide the signup action and show "Results coming soon" instead.
   A real Results button (.cal-btn-results) is exempt and stays visible, and
   its row keeps full opacity so published results still stand out. */
.cal-row.is-past .cal-btn:not(.cal-btn-results),
.cal-row.is-past .cal-soon { display: none; }
.cal-row.is-past .cal-pending { display: inline; }
.cal-row.is-past:has(.cal-btn-results) { opacity: 1; }
.cal-row.is-past:has(.cal-btn-results) .cal-date .cal-dd { color: var(--muted); }
.race:target { outline: 3px solid var(--yellow); outline-offset: 4px; }
.cal-special { border-left-color: var(--muted); background: #fffbe9; }
.cal-special .cal-date .cal-dd { color: var(--muted); }
.cal-foot { text-align: center; margin-top: 16px; }
@media (max-width: 560px) {
  .cal-row { flex-wrap: wrap; }
  .cal-action { flex-basis: 100%; }
}

.home-stats { display: flex; justify-content: center; gap: 32px; margin: 20px 0 32px; flex-wrap: wrap; }
.home-stats .stat { text-align: center; }
.home-stats .stat .num { font-size: 32px; font-weight: 800; color: var(--black); }
.home-stats .stat .label { color: var(--muted); font-size: 13px; }
.home-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.home-cards a.card {
  display: block; background: var(--card); border-radius: 10px; padding: 20px; text-decoration: none;
  color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,0.08); border-top: 4px solid var(--yellow);
}
.home-cards a.card:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.15); }
.home-cards a.card h3 { margin: 0 0 6px; color: var(--black); }
.home-cards a.card p { margin: 0; color: var(--muted); font-size: 14px; }
