:root {
  --red: #7a1520;
  --red-dark: #5c0f18;
  --gold: #d4b062;
  --gold-light: #e6cc8f;
  --text: #f7efe3;
  --text-dim: rgba(247, 239, 227, 0.72);
  --text-faint: rgba(247, 239, 227, 0.5);
  --line: rgba(212, 176, 98, 0.35);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100svh;
  background: var(--red);
  color: var(--text);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

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

/* ---------- Layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100svh;
}

.hero {
  position: relative;
  margin: 0;
  height: 40svh;
  min-height: 240px;
  overflow: hidden;
  background: #2c8fc4; /* pool blue while the photo loads */
}

.hero-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
}

.credit {
  position: absolute;
  right: 10px;
  bottom: 8px;
  padding: 2px 7px;
  font-size: 11px;
  color: #fff;
  background: rgba(0, 0, 0, 0.45);
  border-radius: 3px;
}
.credit a { text-decoration: underline; text-underline-offset: 2px; }

.panel {
  display: flex;
  flex-direction: column;
  padding: 28px 20px calc(24px + env(safe-area-inset-bottom));
  background: var(--red);
}

@media (min-width: 900px) {
  .layout {
    grid-template-columns: minmax(420px, 42fr) 58fr;
    grid-template-rows: 1fr;
    height: 100svh;
  }
  .hero {
    order: 2;
    height: 100svh;
  }
  .credit { right: 14px; bottom: 12px; }
  .panel {
    order: 1;
    padding: clamp(40px, 8vh, 88px) clamp(32px, 4vw, 64px) 28px;
    overflow-y: auto;
  }
}

/* ---------- Brand ---------- */

.wordmark {
  margin: 0;
  font-size: clamp(2.6rem, 7vw, 3.6rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--gold);
}

.tagline {
  margin: 8px 0 0;
  font-size: 1.05rem;
  color: var(--text-dim);
}

/* ---------- Search ---------- */

.search {
  display: flex;
  gap: 8px;
  margin-top: 28px;
}

.search input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--red-dark);
  border: 1px solid var(--line);
  border-radius: 6px;
}
.search input::placeholder { color: var(--text-faint); }
.search input:focus { border-color: var(--gold); outline: none; }

.btn {
  height: 48px;
  padding: 0 20px;
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}
.btn-gold {
  color: var(--red-dark);
  background: var(--gold);
}
.btn-gold:hover { background: var(--gold-light); }
.btn:disabled { opacity: 0.7; cursor: default; }

.locate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  align-self: flex-start;
  margin-top: 12px;
  padding: 6px 0;
  font: inherit;
  font-size: 0.95rem;
  color: var(--gold);
  background: none;
  border: 0;
  cursor: pointer;
}
.locate:hover { color: var(--gold-light); }

:where(.btn, .locate, .search input, a):focus-visible {
  outline: 2px solid var(--gold-light);
  outline-offset: 2px;
}

.status {
  min-height: 1.5em;
  margin: 20px 0 0;
  font-size: 0.9rem;
  color: var(--text-dim);
}
.status.is-error { color: #ffc2b8; }

/* ---------- Results ---------- */

.results {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.club {
  display: grid;
  grid-template-columns: 1.5em 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}
.club:last-child { border-bottom: 1px solid var(--line); }

.rank {
  font-weight: 600;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.club-body { min-width: 0; }

.club-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
}

.club-where {
  margin: 2px 0 0;
  font-size: 0.875rem;
  color: var(--text-dim);
}

.club-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 6px 0 0;
  font-size: 0.875rem;
}
.club-links a {
  color: var(--gold);
  text-underline-offset: 3px;
}
.club-links a:hover { color: var(--gold-light); }
.club-links a[hidden] { display: none; }

.dist {
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.foot {
  margin-top: auto;
  padding-top: 28px;
  font-size: 0.8rem;
  color: var(--text-faint);
}
