:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --muted: #5f6672;
  --border: #e2e5ea;
  --accent: #1f5fbf;
  --accent-soft: #e6eefb;
  --track: #c4472d;
  --badge-bg: #fdeee9;
  --grid: #eceef2;
  --radius: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111418;
    --surface: #1a1e24;
    --text: #e8eaed;
    --muted: #9aa1ac;
    --border: #2c323a;
    --accent: #7fb0ff;
    --accent-soft: #1f2a3b;
    --track: #ff8a6b;
    --badge-bg: #3a2620;
    --grid: #262b33;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.75rem; line-height: 1.2; margin: 1.25rem 0 .25rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .75rem; }
h3 { font-size: 1rem; margin: 0 0 .5rem; }
.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.meta { color: var(--muted); margin: 0; }
.nowrap { white-space: nowrap; }
.strong { font-weight: 600; }

/* header */
.site-header { background: var(--surface); border-top: 3px solid var(--track); border-bottom: 1px solid var(--border); padding-bottom: 12px; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.1rem; letter-spacing: -.01em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 24px; height: 24px; flex: none; fill: var(--track); }
.brand-mark .lane { fill: none; stroke: #fff; stroke-width: 2.4; }
.brand-mark .inner { stroke-width: 1.6; opacity: .7; }
.nav { display: flex; align-items: center; gap: 4px; font-size: .95rem; }
.nav a { padding: 4px 8px; border-radius: 6px; color: var(--text); }
.nav a:hover { background: var(--accent-soft); text-decoration: none; }
.nav a[aria-current="page"] { color: var(--accent); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.nav a[aria-current="page"]:hover { border-radius: 6px 6px 0 0; }
.nav .lang { color: var(--muted); margin-left: 4px; border: 1px solid var(--border); font-size: .85rem; }
.nav .lang .short { display: none; }
@media (max-width: 480px) {
  .header-row { row-gap: 6px; }
  .nav { margin-left: -6px; }
  .brand { font-size: 1rem; white-space: nowrap; }
  .brand-mark { width: 22px; height: 22px; }
  .nav { gap: 0; font-size: .9rem; }
  .nav a { padding: 4px 6px; }
  .nav .lang .long { display: none; }
  .nav .lang .short { display: inline; }
}

/* search */
.search { position: relative; }
.search-icon {
  position: absolute; left: 12px; top: 50%; width: 18px; height: 18px; margin-top: -9px;
  fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; pointer-events: none;
}
.search input {
  width: 100%; padding: 10px 12px 10px 40px; font-size: 1rem;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  transition: border-color .15s, box-shadow .15s, background-color .15s;
}
.search input:hover { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.search input:focus { outline: none; background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search-results {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  list-style: none; margin: 0; padding: 4px 0; max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
}
.search-results li a, .search-results li.empty { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; color: var(--text); }
.search-results li a:hover, .search-results li a.active { background: var(--accent-soft); text-decoration: none; }
.search-results .sub { color: var(--muted); font-size: .85rem; white-space: nowrap; }

/* cards & lists */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.hero { padding: 1.5rem 0 .25rem; }
.lead { font-size: 1.1rem; margin: .25rem 0; }
.hero h1.lead { font-size: 1.35rem; font-weight: 600; line-height: 1.3; margin: 0 0 1rem; max-width: 34ch; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0; max-width: 520px; }
.stats div { display: flex; flex-direction: column-reverse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px; }
.stats dd { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stats dt { color: var(--muted); font-size: .85rem; }
@media (max-width: 480px) {
  .stats { gap: 8px; }
  .stats div { padding: 8px 10px; }
  .stats dd { font-size: 1.25rem; }
}
.meet-list { list-style: none; padding: 0; margin: 0; }
.meet-list li { padding: 8px 0; border-bottom: 1px solid var(--border); display: flex; flex-direction: column; }
.year-nav { display: flex; gap: 12px; margin: .5rem 0; }
.club-list { columns: 3 160px; padding: 0; list-style: none; }
.club-list li { padding: 3px 0; break-inside: avoid; }

/* tables */
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 5px 6px; vertical-align: baseline; }
thead th { font-size: .8rem; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--border); }
tbody tr + tr td, tbody tr + tr th { border-top: 1px solid var(--grid); }
tbody th { font-weight: 500; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.wind { color: var(--muted); font-size: .85rem; }
.wind abbr { color: var(--track); text-decoration: none; margin-left: 2px; }
.badge { display: inline-block; font-size: .7rem; font-weight: 700; color: var(--track); background: var(--badge-bg); border-radius: 4px; padding: 0 5px; vertical-align: 1px; }

/* athlete */
.pb-grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.card { overflow-x: auto; }
.pb th { white-space: nowrap; width: 1%; padding-right: 16px; }
.pb td:last-child { width: 100%; }
.chart-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr)); }
.chart-grid figure { margin: 0; }
.chart-grid figcaption { font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.legend { font-size: .85rem; margin-top: -.5rem; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 0 2px 0 8px; border: 2px solid var(--track); }
.dot.out { background: var(--track); }
.dot.diamond { border-radius: 0; width: 8px; height: 8px; transform: rotate(45deg); background: var(--track); }
.meet-block, .event-block { margin-bottom: 10px; }
.meet-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; margin-bottom: 4px; font-weight: 600; }
.meet-head .muted { font-weight: 400; font-size: .9rem; }
.event-title { margin: 0; font-size: 1.05rem; }
.event-block .small { margin: 0 0 6px; }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .yr { stroke: var(--border); stroke-dasharray: 2 3; }
.chart .tick { fill: var(--muted); font-size: 11px; }
.chart .line { fill: none; stroke: var(--track); stroke-width: 1.5; opacity: .45; }
.chart .pt { stroke: var(--track); stroke-width: 1.5; }
.chart .pt.out { fill: var(--track); }
.chart .pt.in { fill: var(--surface); }

/* rankings */
.rank-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); }
.rank-grid h3 { font-size: .95rem; }
.rank-grid .rank { width: 2.5em; }
.rank-grid th a { color: var(--text); }
.center { text-align: center; }
.chip { display: inline-block; padding: 2px 9px; margin: 2px 4px 2px 0; border-radius: 999px; border: 1px solid var(--border); font-size: .85rem; background: var(--surface); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--surface); font-weight: 600; }
.chip.off { color: var(--muted); opacity: .45; }
.switcher { display: grid; gap: 6px; margin: .75rem 0 1.25rem; }
.crumbs { margin: 1rem 0 0; font-size: .9rem; }
.crumbs + h1 { margin-top: .25rem; }
.ranking-index { margin-bottom: 12px; }
.ranking-index h2 { margin-top: 0; }
.ranking-index td, .ranking-index th { padding: 3px 4px; }
.ranking-index .chip { min-width: 2.6em; text-align: center; margin: 0; }
.ranking-index thead th.small { font-size: .75rem; font-weight: 500; }
details summary { cursor: pointer; color: var(--accent); font-size: .9rem; padding: 6px 0 2px; }
.show-sm { display: none; }

.site-footer { color: var(--muted); font-size: .85rem; padding-top: 2rem; padding-bottom: 2rem; }

@media (max-width: 560px) {
  .hide-sm { display: none; }
  h1 { font-size: 1.45rem; }
  .card { padding: 10px; }
  th, td { padding: 5px 4px; }
  .pb th, .pb .nowrap { white-space: normal; }
  .pb th { width: auto; padding-right: 4px; }
  .show-sm { display: inline; }
  .ranking-index .chip { padding: 1px 4px; font-size: .75rem; min-width: 2.2em; }
  .ranking-index thead th.small { font-size: .65rem; }
}
@media (max-width: 760px) {
  .hide-md { display: none; }
}

/* club logo next to the page title (athlete and club pages) */
.page-head { display: flex; align-items: center; gap: 14px; margin: 1.25rem 0 1rem; }
.page-head h1 { margin-top: 0; }
.club-logo { flex: none; width: 64px; height: 64px; display: block; overflow: hidden;
  background: #fff; border-radius: 12px; padding: 6px; box-sizing: border-box; }
.club-logo img { width: 100%; height: 100%; object-fit: contain; display: block; }
@media (max-width: 480px) { .club-logo { width: 52px; height: 52px; } }

/* feedback form */
.feedback-link { font-weight: 600; }
.feedback-form { display: grid; gap: 6px; max-width: 640px; overflow: visible; }
.feedback-form label { font-weight: 600; font-size: .9rem; margin-top: 8px; }
.feedback-form textarea, .feedback-form input[type=email] {
  width: 100%; padding: 9px 11px; font: inherit; color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius);
}
.feedback-form textarea { resize: vertical; min-height: 8rem; }
.feedback-form textarea:focus, .feedback-form input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.feedback-form .field-hint { margin: 0; }
.feedback-form .cf-turnstile { margin-top: 10px; min-height: 65px; }
.feedback-form button {
  justify-self: start; padding: 9px 22px; font: inherit; font-weight: 600; cursor: pointer;
  color: #fff; background: var(--accent); border: 0; border-radius: var(--radius);
}
@media (prefers-color-scheme: dark) { .feedback-form button { color: #111418; } }
.feedback-form button:disabled { opacity: .6; cursor: default; }
.feedback-error { color: var(--track); font-weight: 600; margin: 4px 0 0; }
.feedback-about { margin: 0; }
.feedback-done { max-width: 640px; }
.feedback-done h2 { margin-top: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
