:root {
  --font-display: 'Outfit', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: 'Plus Jakarta Sans', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, monospace;
  --bg-canvas: #f8fafc;
  --bg-surface: #ffffff;
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-subtle: #64748b;
  --border-hairline: #e2e8f0;
  --emerald: #047857;
  --emerald-dark: #065f46;
  --amber: #b45309;
  --teal: #0f766e;
}

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

html,
body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* Top Bar Contract: 3 zones */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 56px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-hairline);
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.brand-wordmark {
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}

.topbar-nav {
  display: none;
  align-items: center;
  gap: 24px;
}

@media (min-width: 768px) {
  .topbar-nav {
    display: flex;
  }
}

.nav-link {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 6px 0;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: color 150ms ease, border-color 150ms ease;
}

.nav-link:hover {
  color: var(--text-main);
}

.nav-link.is-active {
  color: var(--emerald-dark);
  border-bottom-color: var(--emerald);
  font-weight: 600;
}

.topbar-actions {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.btn-primary-sm {
  min-height: 40px;
  padding: 8px 16px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: #ffffff;
  background-color: var(--emerald);
  border: none;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn-primary-sm:hover {
  background-color: var(--emerald-dark);
}

/* Hero Section */
.hero {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, #064e3b 0%, #0f172a 100%);
  color: #ffffff;
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.65) 0%, rgba(2, 6, 23, 0.56) 50%, rgba(2, 6, 23, 0.78) 100%);
}

.hero-inner {
  position: relative;
  z-index: 10;
  max-width: 896px;
  margin: 0 auto;
  padding: 48px 16px 56px;
  text-align: center;
}

@media (min-width: 640px) {
  .hero-inner {
    padding: 64px 24px 68px;
  }
}

.hero-title {
  margin: 0 auto;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4vw, 3.25rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero-subtitle {
  margin: 12px auto 0;
  max-width: 65ch;
  font-size: 0.95rem;
  line-height: 1.6;
  color: rgba(241, 245, 249, 0.92);
}

/* Search Bar */
.search-bar {
  margin-top: 28px;
  background: #ffffff;
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 20px 30px -10px rgba(2, 6, 23, 0.35);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (min-width: 640px) {
  .search-bar {
    flex-direction: row;
    align-items: center;
  }
}

.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: #94a3b8;
  pointer-events: none;
}

#search-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 38px 10px 40px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  color: var(--text-main);
  background: transparent;
}

#search-input::placeholder {
  color: #94a3b8;
}

#search-input:focus {
  outline: none;
}

.clear-btn {
  position: absolute;
  right: 6px;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.clear-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.county-select {
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: var(--text-main);
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-search {
  min-height: 44px;
  padding: 10px 22px;
  border: none;
  border-radius: 12px;
  background: var(--emerald);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease;
}

.btn-search:hover {
  background: var(--emerald-dark);
}

/* Filter Row */
.filter-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.filter-btn {
  min-height: 40px;
  padding: 8px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(15, 23, 42, 0.62);
  color: rgba(255, 255, 255, 0.95);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.filter-btn:hover {
  background: rgba(15, 23, 42, 0.85);
}

.filter-btn[aria-pressed='true']#filter-free-parking {
  background: #059669;
  border-color: #10b981;
}

.filter-btn[aria-pressed='true']#filter-toilets {
  background: #0d9488;
  border-color: #14b8a6;
}

.filter-btn[aria-pressed='true']#filter-coffee {
  background: #d97706;
  border-color: #f59e0b;
}

/* Main Container */
.main-container {
  max-width: 1152px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 16px 64px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

@media (min-width: 640px) {
  .main-container {
    padding: 36px 24px 64px;
  }
}

/* Detail Card */
.detail-card {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
  overflow: hidden;
}

.detail-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

@media (min-width: 1024px) {
  .detail-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.detail-identity {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  min-width: 0;
}

.detail-meta {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.detail-club {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-main);
}

.detail-ground {
  margin: 2px 0 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--emerald-dark);
}

.detail-address-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.eircode-tag {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  background: #f1f5f9;
  padding: 3px 8px;
  border-radius: 6px;
}

.copy-btn {
  border: none;
  background: transparent;
  color: var(--emerald);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.copy-btn:hover {
  background: #ecfdf5;
}

.detail-cta-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-directions {
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  background: var(--emerald);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.btn-directions:hover {
  background: var(--emerald-dark);
}

.btn-secondary-link {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--border-hairline);
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
}

.btn-secondary-link:hover {
  background: #f8fafc;
}

.icon-close-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: #64748b;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.icon-close-btn:hover {
  background: #f1f5f9;
  color: var(--text-main);
}

.detail-columns {
  display: grid;
  grid-template-columns: 1fr;
}

@media (min-width: 1024px) {
  .detail-columns {
    grid-template-columns: repeat(3, 1fr);
  }
}

.detail-col {
  padding: 20px 24px;
  border-top: 1px solid var(--border-hairline);
}

@media (min-width: 1024px) {
  .detail-col {
    border-top: none;
    border-left: 1px solid var(--border-hairline);
  }
  .detail-col:first-child {
    border-left: none;
  }
}

.detail-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.detail-col-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-text {
  font-size: 0.75rem;
  font-weight: 600;
}

.status-free { color: var(--emerald); }
.status-paid { color: var(--amber); }
.status-teal { color: var(--teal); }
.status-muted { color: var(--text-subtle); }
.status-warn { color: #be123c; }

.detail-col-lead {
  margin: 0 0 4px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #1e293b;
}

.detail-col-walk {
  margin: 0 0 8px;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.detail-col-copy {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.overflow-box {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.75rem;
  line-height: 1.45;
}

.detail-source-bar {
  padding: 12px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-hairline);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

.detail-source-bar a {
  color: var(--emerald-dark);
  font-weight: 600;
  text-decoration: none;
}

.detail-source-bar a:hover {
  text-decoration: underline;
}

.detail-notes-bar {
  padding: 16px 24px;
  background: #f8fafc;
  border-top: 1px solid var(--border-hairline);
}

.detail-notes-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin-top: 10px;
}

@media (min-width: 768px) {
  .detail-notes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.note-item {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.75rem;
  color: #334155;
}

/* Results Grid */
.results-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-hairline);
}

.results-heading {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.results-count {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-subtle);
}

.results-sub {
  margin: 4px 0 0;
  font-size: 0.85rem;
  color: var(--text-subtle);
}

.reset-link {
  background: none;
  border: none;
  color: var(--emerald);
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

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

.results-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .results-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .results-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.ground-card {
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ground-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.ground-card.is-selected {
  border-color: var(--emerald);
  box-shadow: 0 0 0 2px rgba(4, 120, 87, 0.16);
}

.ground-card-trigger {
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.ground-top {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.ground-crest {
  flex-shrink: 0;
  padding-top: 2px;
}

.ground-title-wrap {
  min-width: 0;
  flex: 1;
}

.ground-meta-line {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ground-club-name {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ground-pitch-name {
  margin: 2px 0 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--emerald-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ground-facts {
  padding-top: 12px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.fact-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  line-height: 1.4;
}

.fact-icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.ground-card-footer {
  padding-top: 10px;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-directions-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 8px;
  background: #ecfdf5;
  color: var(--emerald-dark);
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 150ms ease;
}

.card-directions-link:hover {
  background: #d1fae5;
}

.card-details-btn {
  background: none;
  border: none;
  padding: 6px 4px;
  min-height: 36px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
}

.card-details-btn:hover {
  color: var(--text-main);
}

/* Empty State */
.empty-state {
  margin-top: 16px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  padding: 48px 24px;
  text-align: center;
}

.empty-state h3 {
  margin: 12px 0 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-main);
}

.empty-state p {
  margin: 6px auto 0;
  max-width: 420px;
  font-size: 0.875rem;
  color: var(--text-subtle);
}

/* Footer */
.site-footer {
  margin-top: auto;
  background: #ffffff;
  border-top: 1px solid var(--border-hairline);
  padding: 20px 24px;
}

.footer-inner {
  max-width: 1152px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--text-subtle);
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border: 1px solid var(--border-hairline);
  border-radius: 16px;
  box-shadow: 0 24px 48px rgba(15, 23, 42, 0.2);
  overflow: hidden;
}

.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 700;
}

.modal-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
}

.field-control {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  color: var(--text-main);
  background: #ffffff;
}

.field-control:focus {
  outline: 2px solid var(--emerald);
  outline-offset: 1px;
}

.cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.cat-btn {
  padding: 8px 6px;
  border-radius: 8px;
  border: 1px solid var(--border-hairline);
  background: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 600;
  color: #334155;
  cursor: pointer;
}

.cat-btn.is-selected {
  background: var(--emerald);
  border-color: var(--emerald);
  color: #ffffff;
}

.form-error {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: #be123c;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 6px;
}

.btn-ghost {
  min-height: 40px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #334155;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-ghost:hover {
  background: #f1f5f9;
}

.btn-primary {
  min-height: 40px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  background: var(--emerald);
  color: #ffffff;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:hover {
  background: var(--emerald-dark);
}
