:root {
  --bg: #f5f8fb;
  --panel: #ffffff;
  --panel-soft: #eaf2f9;
  --ink: #142033;
  --muted: #5c6b7d;
  --blue: #0b4f8a;
  --blue-dark: #07385f;
  --gold: #d69a24;
  --silver: #a9b0bd;
  --bronze: #b36b38;
  --line: #d9e3ec;
  --shadow: 0 18px 45px rgba(15, 46, 75, 0.12);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: var(--blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  background: #e4edf6;
  border-radius: 5px;
  padding: 0.12rem 0.34rem;
}

.site-header {
  background:
    linear-gradient(135deg, rgba(7, 56, 95, 0.97), rgba(11, 79, 138, 0.94)),
    radial-gradient(circle at top right, rgba(214, 154, 36, 0.28), transparent 34%);
  color: #ffffff;
}

.site-header.compact {
  background: linear-gradient(135deg, var(--blue-dark), var(--blue));
}

.topbar,
.hero,
.section,
.page-title,
.site-footer {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: #ffffff;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.12rem;
  letter-spacing: 0.02em;
}

.brand small {
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.82rem;
}

.main-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.main-nav a {
  border-radius: 999px;
  color: rgba(255, 255, 255, 0.88);
  padding: 8px 12px;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: rgba(255, 255, 255, 0.13);
  color: #ffffff;
  text-decoration: none;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 40px;
  padding: 72px 0 88px;
}

.hero h1,
.page-title h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 1.05;
}

.hero p,
.page-title p {
  max-width: 650px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
}

.eyebrow,
.feature-kicker {
  margin: 0 0 10px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  font-weight: 750;
  padding: 10px 18px;
}

.button.primary {
  background: var(--gold);
  color: #231600;
}

.button.secondary {
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #ffffff;
}

.inline-button {
  margin-top: 10px;
}

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.hero-panel,
.summary-strip {
  display: grid;
  gap: 12px;
}

.hero-panel {
  align-self: end;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.1);
  padding: 20px;
  backdrop-filter: blur(8px);
}

.hero-panel div,
.summary-strip div {
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.13);
  padding: 16px;
}

.stat-number {
  display: block;
  color: #ffffff;
  font-size: 2.1rem;
  font-weight: 850;
  line-height: 1;
}

.stat-number.small {
  color: var(--blue-dark);
  font-size: 1.65rem;
}

.stat-number.gold {
  color: var(--gold);
}

.stat-number.silver {
  color: #7d8795;
}

.stat-number.bronze {
  color: var(--bronze);
}

.stat-label {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.88rem;
}

.summary-strip .stat-label {
  color: var(--muted);
}

.section {
  padding: 56px 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card,
.csv-preview,
.results-shell,
.event-card,
.content-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.feature-card {
  padding: 24px;
}

.content-panel {
  margin: 0 auto;
  max-width: 920px;
  padding: 28px;
}

.content-panel h2 {
  margin: 28px 0 10px;
}

.content-panel p {
  color: var(--muted);
}

.link-panel {
  text-align: center;
}

.text-list {
  color: var(--muted);
  line-height: 1.8;
  padding-left: 1.2rem;
}

.compact-grid {
  margin: 20px 0 10px;
}

.feature-card h2,
.two-column h2,
.contact-band h2 {
  margin: 0 0 10px;
  line-height: 1.15;
}

.feature-card p {
  color: var(--muted);
}

.section-heading {
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 0;
}

.achievements {
  padding-top: 12px;
}

.achievement-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.achievement-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  padding: 20px;
}

.achievement-grid strong {
  display: block;
  color: var(--blue);
  font-size: 1.8rem;
  line-height: 1;
}

.achievement-grid span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 28px;
  align-items: center;
}

.two-column .eyebrow,
.contact-band .eyebrow {
  color: var(--blue);
}

.csv-preview {
  overflow: hidden;
}

.club-note {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.club-note h3 {
  margin: 0 0 14px;
}

.club-note a {
  display: block;
  border-top: 1px solid var(--line);
  color: var(--blue-dark);
  font-weight: 750;
  padding: 13px 0;
}

.club-note a:first-of-type {
  border-top: 0;
}

.csv-row {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr 1fr 0.7fr;
  gap: 1px;
  background: var(--line);
}

.csv-row span {
  min-width: 0;
  background: #ffffff;
  padding: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-head span {
  background: var(--blue-dark);
  color: #ffffff;
  font-weight: 750;
}

.contact-band {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid var(--line);
}

.contact-band .button.secondary {
  border-color: var(--blue);
  color: var(--blue);
}

.page-title {
  padding: 42px 0 56px;
}

.results-shell {
  padding: 22px;
}

.source-note {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.94rem;
}

.filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.filters select,
.filters input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
}

.summary-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
}

.summary-strip div {
  background: var(--panel-soft);
}

.event-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}

.event-card {
  box-shadow: none;
  padding: 18px;
}

.event-card h3 {
  margin: 0 0 8px;
  font-size: 0.98rem;
  font-weight: 500;
  line-height: 1.2;
}

.event-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.medals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.pill,
.medal {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 750;
  padding: 5px 9px;
}

.pill {
  background: var(--panel-soft);
  color: var(--blue-dark);
}

.medal.gold {
  background: #fff2cf;
  color: #775000;
}

.medal.silver {
  background: #eef1f5;
  color: #515967;
}

.medal.bronze {
  background: #f7e2d4;
  color: #743a16;
}

.medal.none {
  background: #edf3f8;
  color: var(--muted);
}

.table-wrap {
  overflow-x: auto;
}

.table-tools {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin: 4px 0 12px;
}

.table-tools label {
  display: grid;
  width: min(360px, 100%);
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.table-tools input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  padding: 10px 12px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}

caption {
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 700;
  text-align: left;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f0f5fa;
  color: var(--blue-dark);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

th button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  letter-spacing: inherit;
  padding: 0;
  text-align: left;
  text-transform: inherit;
}

th button::after {
  color: var(--muted);
  content: "sort";
  font-size: 0.62rem;
  letter-spacing: 0;
  text-transform: lowercase;
}

th button[data-direction="asc"]::after {
  content: "asc";
}

th button[data-direction="desc"]::after {
  content: "desc";
}

tbody tr:hover {
  background: #f8fbfd;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  padding: 28px 0 40px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.gallery-card {
  display: block;
  min-height: 230px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(7, 56, 95, 0.08), rgba(7, 56, 95, 0.02)),
    var(--panel);
  color: inherit;
  padding: 22px;
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.gallery-card:hover {
  border-color: rgba(11, 79, 138, 0.45);
  box-shadow: 0 16px 34px rgba(15, 46, 75, 0.13);
  text-decoration: none;
  transform: translateY(-2px);
}

.gallery-card.featured {
  grid-column: span 2;
  background:
    linear-gradient(135deg, rgba(7, 56, 95, 0.9), rgba(11, 79, 138, 0.78)),
    var(--blue);
  color: #ffffff;
}

.gallery-card span {
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.gallery-card h2 {
  margin: 14px 0 10px;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.15;
}

.gallery-card p {
  color: var(--muted);
}

.gallery-card.featured p {
  color: rgba(255, 255, 255, 0.78);
}

.gallery-card .gallery-open {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  border-radius: 999px;
  background: var(--blue);
  color: #ffffff;
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0;
  padding: 8px 13px;
  text-transform: none;
}

.gallery-card.featured .gallery-open {
  background: var(--gold);
  color: #231600;
}

.entry-shell {
  display: grid;
  gap: 22px;
}

.entry-grid {
  display: grid;
  gap: 22px;
}

.form-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.form-card h2 {
  margin: 0 0 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.form-grid label,
.csv-output-label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.form-grid .wide {
  grid-column: span 2;
}

.form-grid input,
.form-grid select,
.csv-output {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink);
  font: inherit;
  padding: 11px 12px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.button.ghost {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--blue);
}

.button.danger {
  border: 1px solid #f2c7c7;
  background: #fff3f3;
  color: #9d1c1c;
}

.compact-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.preview-wrap {
  margin-bottom: 18px;
}

.csv-output {
  min-height: 160px;
  resize: vertical;
  white-space: pre;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font: inherit;
  padding: 0;
}

.text-button:hover {
  text-decoration: underline;
}

.status-message {
  min-height: 1.4em;
  color: var(--muted);
}

.status-message[data-type="success"] {
  color: #1f6f3f;
}

.status-message[data-type="error"] {
  color: #9d1c1c;
}

#results-table td {
  font-size: 0.92rem;
  font-weight: 400;
}

#results-table .medal {
  font-weight: 500;
}

@media (max-width: 860px) {
  .topbar,
  .hero,
  .two-column,
  .contact-band {
    display: grid;
  }

  .hero,
  .two-column,
  .feature-grid,
  .event-grid,
  .gallery-grid,
  .achievement-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid .wide {
    grid-column: auto;
  }

  .gallery-card.featured {
    grid-column: auto;
  }

  .main-nav {
    justify-content: flex-start;
  }

  .filters,
  .summary-strip,
  .table-tools {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-tools {
    align-items: stretch;
    display: grid;
  }

  .compact-heading {
    display: grid;
  }
}

@media (max-width: 560px) {
  .topbar,
  .hero,
  .section,
  .page-title,
  .site-footer {
    width: min(100% - 22px, 1120px);
  }

  .hero {
    padding: 44px 0 58px;
  }

  .filters,
  .summary-strip,
  .csv-row {
    grid-template-columns: 1fr;
  }

  .csv-row span {
    white-space: normal;
  }

  .site-footer {
    display: grid;
  }
}
