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

:root {
  --green-dark: #0f3d24;
  --green: #1a5c32;
  --green-light: #2d7a46;
  --gold: #c9883a;
  --gold-light: #e6a84e;
  --bg: #f5f3ee;
  --surface: #ffffff;
  --border: #e2ddd5;
  --text: #1a1a18;
  --text-muted: #6b6760;
  --text-faint: #9b9790;
  --radius: 10px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
}

html { scroll-behavior: smooth; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ── Navbar ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--green-dark);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 56px;
  box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -.01em;
  text-decoration: none;
}

.nav-brand-mark {
  width: 26px;
  height: 26px;
  background: var(--gold);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  font-weight: 900;
  color: var(--green-dark);
  flex-shrink: 0;
}

.nav-links { display: flex; gap: .25rem; }

.nav-links a {
  color: rgba(255,255,255,.75);
  text-decoration: none;
  font-size: .9rem;
  font-weight: 500;
  padding: .4rem .9rem;
  border-radius: 6px;
  transition: color .15s, background .15s;
}

.nav-links a:hover {
  color: #fff;
  background: rgba(255,255,255,.1);
}

/* ── Hero ── */
.hero {
  background: linear-gradient(135deg, var(--green-dark) 0%, var(--green) 60%, var(--green-light) 100%);
  padding: 4rem 2rem 3.5rem;
  text-align: center;
  color: #fff;
}

.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  margin-bottom: .6rem;
}

.hero p {
  font-size: 1.1rem;
  color: rgba(255,255,255,.8);
  margin-bottom: 2.5rem;
}

.hero-stats {
  display: inline-flex;
  gap: 0;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 14px;
  overflow: hidden;
  backdrop-filter: blur(4px);
}

.stat {
  padding: 1rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-right: 1px solid rgba(255,255,255,.15);
}

.stat:last-child { border-right: none; }

.stat-number {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1;
  color: var(--gold-light);
}

.stat-label {
  font-size: .8rem;
  color: rgba(255,255,255,.7);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: .3rem;
}

/* ── Sections ── */
.section {
  padding: 3.5rem 2rem;
  max-width: 1280px;
  margin: 0 auto;
}

.section-header {
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -.02em;
  color: var(--green-dark);
}

.section-header p {
  color: var(--text-muted);
  margin-top: .35rem;
  font-size: .95rem;
}

.section-header p a { color: var(--green); }

/* ── Map ── */
#map {
  max-width: 100%;
  padding: 0;
  background: var(--green-dark);
}

#map .section-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 3.5rem 2rem 1.5rem;
  color: #fff;
}

#map .section-header h2 { color: #fff; }
#map .section-header p { color: rgba(255,255,255,.7); }

#mapbox-container {
  width: 100%;
  height: 520px;
  background: #1a2e1f;
}

.token-notice {
  display: none;
  background: #fffbea;
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 1rem 1.5rem;
  margin: 1.5rem 2rem;
  font-size: .9rem;
  color: #78350f;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
}

.token-notice a { color: #92400e; font-weight: 600; }

/* ── Map markers ── */
.map-marker {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2.5px solid rgba(255,255,255,.9);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transition: transform .15s;
}

.map-marker:hover { transform: scale(1.4); }

/* ── Mapbox popup ── */
.mapboxgl-popup-content {
  border-radius: 10px !important;
  padding: 14px 16px !important;
  box-shadow: var(--shadow) !important;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  min-width: 200px;
  max-width: 280px;
}

.popup-content h4 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.3;
  margin-bottom: .3rem;
}

.popup-location { font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; }
.popup-region { font-size: .75rem; color: var(--text-faint); margin-bottom: .4rem; }

.popup-orgs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }

.org-badge-sm {
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  border-radius: 4px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.popup-content a {
  font-size: .8rem;
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
}

.popup-content a:hover { text-decoration: underline; }

.popup-events { margin-top: .7rem; border-top: 1px solid var(--border); padding-top: .6rem; }
.popup-events strong { font-size: .75rem; color: var(--text-muted); display: block; margin-bottom: .4rem; }
.popup-event { font-size: .75rem; color: var(--text); padding: .2rem 0; border-bottom: 1px solid #f0ede8; }
.popup-event:last-child { border-bottom: none; }

/* ── Filters ── */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.75rem;
}

.search-input,
.filter-select {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .55rem 1rem;
  font-size: .9rem;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  font-family: inherit;
}

.search-input { flex: 1; min-width: 220px; }
.filter-select { min-width: 180px; }

.search-input:focus,
.filter-select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(26,92,50,.12);
}

/* ── Club cards ── */
.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.club-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  transition: box-shadow .2s, border-color .2s, transform .2s;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.club-card:hover {
  box-shadow: var(--shadow);
  border-color: #ccc;
  transform: translateY(-1px);
}

.club-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
}

.club-abbr {
  font-size: .8rem;
  font-weight: 800;
  color: var(--text-muted);
  letter-spacing: .04em;
  text-transform: uppercase;
  font-family: 'SF Mono', 'Fira Code', monospace;
}

.region-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .2rem .55rem;
  border-radius: 20px;
  color: #fff;
  letter-spacing: .02em;
  background-color: var(--region-color, #999);
  white-space: nowrap;
}

.club-name {
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}

.club-location {
  font-size: .85rem;
  color: var(--text-muted);
}

.club-orgs { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .1rem; }

.org-badge {
  font-size: .7rem;
  font-weight: 700;
  padding: .2rem .55rem;
  border-radius: 5px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.org-asfa { background: #e8f5ee; color: #1a5c32; }
.org-akc  { background: #e8eef8; color: #1a3a7a; }
.org-lgra { background: #fff3e0; color: #8a4400; }
.org-notra { background: #f3e8ff; color: #6b21a8; }

.club-link {
  font-size: .8rem;
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  margin-top: auto;
  display: inline-block;
}

.club-link:hover { text-decoration: underline; }

.no-results {
  color: var(--text-muted);
  font-size: .95rem;
  grid-column: 1 / -1;
  padding: 2rem 0;
  text-align: center;
}

/* ── Events list ── */
.events-list { display: flex; flex-direction: column; }

.month-header {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--text-muted);
  padding: 1.5rem 0 .6rem;
  border-bottom: 1.5px solid var(--border);
  margin-bottom: .5rem;
}

.month-header:first-child { padding-top: 0; }

.event-item {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 1rem;
  align-items: start;
  padding: .85rem 1rem;
  border-radius: 8px;
  transition: background .15s;
  border-left: 3px solid transparent;
}

.event-item:hover { background: rgba(26,92,50,.04); }

.event-item.specialty { border-left-color: var(--gold); }

.event-item.past { opacity: .5; }

.event-item.cancelled {
  opacity: .45;
  text-decoration: line-through;
}

.event-date {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .35rem .4rem;
  min-width: 52px;
  text-align: center;
}

.event-month {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green);
}

.event-day {
  font-size: 1.35rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--text);
}

.event-details { display: flex; flex-direction: column; gap: .2rem; }

.event-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .4rem;
}

.event-club-abbr {
  font-size: .75rem;
  font-weight: 800;
  color: var(--text-muted);
  font-family: 'SF Mono', 'Fira Code', monospace;
  letter-spacing: .03em;
}

.event-name {
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
}

.specialty-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  background: #fff8e8;
  color: #8a5a00;
  border: 1px solid #f5d88a;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cancelled-badge {
  font-size: .65rem;
  font-weight: 700;
  padding: .15rem .45rem;
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.event-club-name { font-size: .82rem; color: var(--text-muted); }

.event-location { font-size: .82rem; color: var(--text-faint); }

.event-org { padding-top: .1rem; }

/* ── Footer ── */
.footer {
  background: var(--green-dark);
  color: rgba(255,255,255,.6);
  text-align: center;
  padding: 2rem;
  font-size: .85rem;
  line-height: 1.8;
}

.footer a { color: rgba(255,255,255,.8); }
.footer a:hover { color: #fff; }

/* ── Global org selector ── */
.global-filters {
  margin-top: 1.5rem;
  display: flex;
  justify-content: center;
}

.org-selector {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 9999px;
  padding: .55rem 1.5rem;
  font-size: .95rem;
  font-weight: 600;
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  backdrop-filter: blur(4px);
  appearance: auto;
}

.org-selector:focus {
  outline: 2px solid rgba(255, 255, 255, 0.6);
  outline-offset: 2px;
}

.org-selector option {
  background: var(--green-dark);
  color: #fff;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .nav-links a { padding: .4rem .6rem; font-size: .85rem; }
  .hero { padding: 2.5rem 1.25rem 2.5rem; }
  .hero-stats { flex-direction: row; }
  .stat { padding: .75rem 1.25rem; }
  .section { padding: 2rem 1.25rem; }
  #map .section-header { padding: 2rem 1.25rem 1.25rem; }
  #mapbox-container { height: 380px; }
  .clubs-grid { grid-template-columns: 1fr; }
  .event-item { grid-template-columns: 46px 1fr; }
  .event-org { display: none; }
  .filters { flex-direction: column; }
  .search-input, .filter-select { width: 100%; min-width: unset; }
  .org-selector { width: 80%; border-radius: 8px; }
}
