:root {
  --ink: #17231f;
  --forest: #173c32;
  --pine: #285a49;
  --cream: #f4f0e6;
  --paper: #fffdf7;
  --rust: #c45735;
  --gold: #d6a74e;
  --line: rgba(23, 35, 31, 0.16);
  --muted: #68736e;
  --shadow: 0 24px 70px rgba(18, 45, 37, 0.12);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 18%, rgba(214, 167, 78, 0.12), transparent 24rem),
    var(--cream);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button, input, select { font: inherit; }

.shell {
  width: min(1180px, calc(100% - 40px));
  margin-inline: auto;
}

.hero {
  position: relative;
  min-height: 510px;
  overflow: hidden;
  color: var(--paper);
  background:
    linear-gradient(112deg, rgba(14, 43, 35, 0.96), rgba(23, 60, 50, 0.82)),
    repeating-radial-gradient(ellipse at 82% 16%, transparent 0 32px, rgba(255, 255, 255, 0.06) 33px 34px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 9px;
  background: var(--rust);
}

.hero__content {
  position: relative;
  z-index: 2;
  padding-top: 86px;
}

.eyebrow, .section-label {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1, h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  line-height: 0.92;
}

h1 {
  max-width: 700px;
  font-size: clamp(4rem, 9vw, 7.8rem);
  letter-spacing: -0.055em;
}

h1 em { color: #e3bd6f; font-weight: 400; }

.hero__meta {
  display: flex;
  gap: 42px;
  margin-top: 36px;
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.hero__meta p { margin: 0; }

.hero__ridge {
  position: absolute;
  right: -5%;
  bottom: 8px;
  width: min(62vw, 850px);
  height: 78%;
  opacity: 0.42;
  background: linear-gradient(140deg, transparent 0 32%, #6c8b77 32.2% 33%, transparent 33.2% 42%, #86a08e 42.2% 43%, transparent 43.2%), linear-gradient(35deg, transparent 0 46%, rgba(244, 240, 230, 0.3) 46.2% 47%, transparent 47.2%);
  clip-path: polygon(0 100%, 13% 76%, 24% 80%, 39% 44%, 49% 59%, 63% 23%, 71% 36%, 82% 10%, 100% 46%, 100% 100%);
  background-color: rgba(132, 158, 140, 0.46);
}

.main-content { padding-block: 78px 96px; }

.intro {
  display: grid;
  grid-template-columns: 1fr minmax(300px, 0.72fr);
  gap: 60px;
  align-items: end;
  margin-bottom: 42px;
}

h2 {
  font-size: clamp(2.7rem, 5vw, 5rem);
  letter-spacing: -0.045em;
}

.intro__copy {
  margin: 0;
  color: var(--muted);
  font-size: 1.02rem;
}

.filter-panel {
  display: grid;
  grid-template-columns: 0.7fr 1.35fr 1.05fr 0.8fr auto;
  gap: 14px;
  align-items: end;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.84);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.field { min-width: 0; }

label {
  display: block;
  margin: 0 0 7px 2px;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

input, select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(23, 35, 31, 0.2);
  border-radius: 10px;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

input:focus, select:focus {
  border-color: var(--pine);
  box-shadow: 0 0 0 3px rgba(40, 90, 73, 0.13);
}

.clear-button, .load-more, .empty-state button {
  height: 48px;
  border: 0;
  border-radius: 10px;
  color: white;
  background: var(--forest);
  font-weight: 750;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.clear-button { padding-inline: 18px; white-space: nowrap; }
.clear-button:hover, .load-more:hover, .empty-state button:hover { background: var(--pine); transform: translateY(-1px); }

.summary {
  display: flex;
  gap: 38px;
  padding: 34px 4px 24px;
}

.summary div { display: flex; align-items: baseline; gap: 8px; }
.summary span { font-family: Georgia, serif; font-size: 1.75rem; font-variant-numeric: tabular-nums; }
.summary small { color: var(--muted); font-size: 0.74rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }

.results-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  box-shadow: 0 12px 38px rgba(23, 35, 31, 0.07);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }

th {
  padding: 16px 18px;
  color: rgba(255, 255, 255, 0.75);
  background: var(--forest);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-align: left;
  text-transform: uppercase;
}

td {
  padding: 18px;
  border-bottom: 1px solid rgba(23, 35, 31, 0.09);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(214, 167, 78, 0.08); }

.year-cell, .stage-cell, .place-cell {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 750;
}

.course-cell { max-width: 460px; font-family: Georgia, serif; font-size: 1rem; line-height: 1.35; }
.runner-cell { min-width: 210px; font-weight: 700; }
.time-cell { color: var(--rust); font-family: ui-monospace, "SFMono-Regular", Consolas, monospace; font-size: 1rem; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.time-column { text-align: left; }

.empty-state { padding: 72px 20px; text-align: center; }
.empty-state p { margin: 0 0 16px; font-family: Georgia, serif; font-size: 1.8rem; }
.empty-state button { padding-inline: 20px; }

.load-more {
  display: block;
  margin: 22px auto;
  padding-inline: 26px;
}

footer { color: rgba(255, 255, 255, 0.68); background: var(--ink); }
.footer__content { display: flex; justify-content: space-between; gap: 24px; padding-block: 30px; font-size: 0.78rem; }
.footer__content p { margin: 0; }

@media (max-width: 980px) {
  .filter-panel { grid-template-columns: 1fr 1fr; }
  .clear-button { width: max-content; }
  .hero__ridge { width: 82vw; opacity: 0.28; }
}

@media (max-width: 700px) {
  .shell { width: min(100% - 24px, 1180px); }
  .hero { min-height: 420px; }
  .hero__content { padding-top: 66px; }
  h1 { font-size: clamp(3.4rem, 18vw, 5rem); }
  .hero__meta { flex-direction: column; gap: 7px; margin-top: 28px; }
  .main-content { padding-block: 56px 72px; }
  .intro { grid-template-columns: 1fr; gap: 22px; }
  .filter-panel { grid-template-columns: 1fr; padding: 16px; }
  .clear-button { width: 100%; }
  .summary { justify-content: space-between; gap: 12px; }
  .summary div { flex-direction: column; gap: 0; }
  .summary span { font-size: 1.45rem; }
  .results-section { border-radius: 14px; }
  table, tbody { display: block; }
  thead { display: none; }
  tbody { padding: 6px 16px; }
  tbody tr { display: grid; grid-template-columns: auto auto 1fr; gap: 7px 12px; padding: 18px 0; border-bottom: 1px solid var(--line); }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 0; border: 0; }
  .course-cell, .runner-cell { grid-column: 1 / -1; max-width: none; min-width: 0; }
  .course-cell { padding-top: 3px; }
  .runner-cell { font-size: 0.9rem; }
  .place-cell::before { content: "Place "; }
  .time-cell { grid-column: 3; grid-row: 1; justify-self: end; }
  .footer__content { flex-direction: column; gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
