/* ========================================
   Canaries.guide Sports Directory
   Design System & Component Styles
   ======================================== */

/* --- CSS Custom Properties --- */
:root {
  /* Brand Colors */
  --blue: #005A9C;
  --blue-dark: #004578;
  --blue-light: #e8f1fa;
  --yellow: #F7D917;
  --yellow-light: #fef9e0;

  /* Semantic Colors */
  --bg: #F7F6F2;
  --surface: #FFFFFF;
  --text: #1a1a2e;
  --text-muted: #6b7280;
  --text-light: #9ca3af;
  --border: #e5e5e5;
  --border-light: #f0efeb;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.1);
  --shadow-card: 0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04);

  /* Spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --space-20: 80px;

  /* Typography */
  --font-display: 'Cabinet Grotesk', system-ui, sans-serif;
  --font-body: 'Satoshi', system-ui, sans-serif;

  --text-xs: clamp(0.75rem, 0.7rem + 0.15vw, 0.8125rem);
  --text-sm: clamp(0.8125rem, 0.78rem + 0.15vw, 0.875rem);
  --text-base: clamp(0.9375rem, 0.9rem + 0.15vw, 1rem);
  --text-lg: clamp(1.125rem, 1rem + 0.35vw, 1.25rem);
  --text-xl: clamp(1.25rem, 1.1rem + 0.5vw, 1.5rem);
  --text-2xl: clamp(1.5rem, 1.2rem + 0.8vw, 2rem);
  --text-3xl: clamp(2rem, 1.5rem + 1.5vw, 2.75rem);
  --text-hero: clamp(2.5rem, 1.8rem + 2.5vw, 4rem);

  /* Radius */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;

  /* Layout */
  --max-w: 1200px;
  --max-w-wide: 1400px;
  --gutter: clamp(var(--space-4), 4vw, var(--space-8));
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1e;
    --surface: #141b2d;
    --text: #e8e8ec;
    --text-muted: #9ca3af;
    --text-light: #6b7280;
    --border: #1e2a42;
    --border-light: #172036;
    --blue-light: #0d1f3a;
    --yellow-light: #1a1a0e;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.4);
    --shadow-card: 0 1px 3px rgba(0,0,0,0.2), 0 4px 12px rgba(0,0,0,0.15);
  }
}

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--blue);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}

a:hover {
  color: var(--blue-dark);
}

/* --- Utility --- */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.container--wide {
  max-width: var(--max-w-wide);
}

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

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(247, 246, 242, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow var(--duration-normal) var(--ease-out);
}

@media (prefers-color-scheme: dark) {
  .site-header {
    background: rgba(10, 15, 30, 0.92);
  }
}

.site-header--scrolled {
  box-shadow: var(--shadow-md);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: var(--space-4);
}

.header-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-lg);
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.header-logo:hover {
  color: var(--blue);
}

.header-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

/* Desktop nav */
.header-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
}

.header-nav a {
  display: block;
  padding: var(--space-2) var(--space-3);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast) var(--ease-out), background var(--duration-fast) var(--ease-out);
  text-decoration: none;
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--text);
  background: rgba(0, 90, 156, 0.06);
}

.header-nav a.active {
  color: var(--blue);
  font-weight: 700;
}

/* Mobile menu button */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-2);
  color: var(--text);
}

.menu-toggle svg {
  width: 24px;
  height: 24px;
}

/* Mobile nav */
@media (max-width: 768px) {
  .menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    flex-direction: column;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: var(--space-2) var(--gutter);
    box-shadow: var(--shadow-lg);
    gap: 0;
  }

  .header-nav.open {
    display: flex;
  }

  .header-nav a {
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    border-radius: var(--radius-md);
  }
}

/* --- Hero Section --- */
.hero {
  padding: clamp(var(--space-16), 10vw, var(--space-20)) 0;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero--sport {
  background: linear-gradient(135deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
}

.hero--home {
  background: linear-gradient(135deg, var(--blue) 0%, #003d6b 60%, #002a4a 100%);
  color: #fff;
  padding: clamp(var(--space-20), 12vw, 160px) 0 clamp(var(--space-16), 10vw, 120px);
}

.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  padding: var(--space-1) var(--space-4);
  border-radius: 100px;
  font-size: var(--text-xs);
  font-weight: 500;
  margin-bottom: var(--space-6);
  color: rgba(255,255,255,0.9);
}

.hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-hero);
  line-height: 1.05;
  margin-bottom: var(--space-4);
  letter-spacing: -0.02em;
}

.hero__subtitle {
  font-size: var(--text-lg);
  color: rgba(255,255,255,0.8);
  max-width: 600px;
  margin: 0 auto var(--space-8);
  line-height: 1.5;
}

.hero__stats {
  display: flex;
  justify-content: center;
  gap: clamp(var(--space-6), 4vw, var(--space-12));
  flex-wrap: wrap;
}

.hero__stat {
  text-align: center;
}

.hero__stat-number {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-2xl);
  color: var(--yellow);
  line-height: 1.2;
}

.hero__stat-label {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

/* --- Island Filter --- */
.filter-section {
  padding: var(--space-6) 0;
  position: sticky;
  top: 64px;
  z-index: 50;
  background: rgba(247, 246, 242, 0.95);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

@media (prefers-color-scheme: dark) {
  .filter-section {
    background: rgba(10, 15, 30, 0.95);
  }
}

.filter-buttons {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: var(--space-1);
}

.filter-buttons::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border: 1.5px solid var(--border);
  border-radius: 100px;
  background: var(--surface);
  color: var(--text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--duration-fast) var(--ease-out);
  flex-shrink: 0;
}

.filter-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.filter-btn.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.filter-btn .count {
  font-size: var(--text-xs);
  opacity: 0.7;
}

/* --- Directory Grid --- */
.directory {
  padding: var(--space-8) 0 var(--space-16);
}

.island-section {
  margin-bottom: var(--space-10);
}

.island-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-3);
  border-bottom: 2px solid var(--blue);
}

.island-header h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--text);
}

.island-header .club-count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  font-weight: 400;
}

.clubs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: var(--space-4);
}

@media (max-width: 480px) {
  .clubs-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Club Card --- */
.club-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--duration-normal) var(--ease-out), transform var(--duration-normal) var(--ease-out);
}

.club-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.club-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-base);
  color: var(--text);
  margin-bottom: var(--space-2);
  line-height: 1.3;
}

.club-card__location {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.club-card__location svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  color: var(--blue);
}

.club-card__details {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.club-card__tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--space-2);
  background: var(--blue-light);
  color: var(--blue);
  font-size: var(--text-xs);
  font-weight: 500;
  border-radius: var(--radius-sm);
}

.club-card__tag--accent {
  background: var(--yellow-light);
  color: #7a6a00;
}

@media (prefers-color-scheme: dark) {
  .club-card__tag--accent {
    color: var(--yellow);
  }
}

.club-card__facilities {
  font-size: var(--text-xs);
  color: var(--text-muted);
  line-height: 1.5;
}

/* --- Home Page Sport Cards --- */
.sports-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-5);
  padding: var(--space-12) 0 var(--space-16);
}

.sport-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-8) var(--space-6);
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
  overflow: hidden;
}

.sport-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--blue);
  color: var(--text);
}

.sport-card__icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  background: var(--blue-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-normal) var(--ease-out);
}

.sport-card:hover .sport-card__icon {
  background: var(--blue);
}

.sport-card__icon svg {
  width: 32px;
  height: 32px;
  color: var(--blue);
  transition: color var(--duration-normal) var(--ease-out);
}

.sport-card:hover .sport-card__icon svg {
  color: #fff;
}

.sport-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-xl);
  margin-bottom: var(--space-2);
}

.sport-card__count {
  font-size: var(--text-sm);
  color: var(--text-muted);
  margin-bottom: var(--space-3);
}

.sport-card__islands {
  font-size: var(--text-xs);
  color: var(--text-light);
}

.sport-card__arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-4);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--blue);
}

.sport-card__arrow svg {
  width: 16px;
  height: 16px;
  transition: transform var(--duration-fast) var(--ease-out);
}

.sport-card:hover .sport-card__arrow svg {
  transform: translateX(4px);
}

/* Golf card - external link style */
.sport-card--external {
  border-style: dashed;
}

.sport-card--external .sport-card__arrow svg {
  width: 14px;
  height: 14px;
}

/* --- Scroll Reveal Animation --- */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s var(--ease-out), transform 0.6s var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children */
.reveal-stagger > .reveal:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger > .reveal:nth-child(2) { transition-delay: 60ms; }
.reveal-stagger > .reveal:nth-child(3) { transition-delay: 120ms; }
.reveal-stagger > .reveal:nth-child(4) { transition-delay: 180ms; }
.reveal-stagger > .reveal:nth-child(5) { transition-delay: 240ms; }
.reveal-stagger > .reveal:nth-child(6) { transition-delay: 300ms; }

/* --- Footer --- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: var(--space-10) 0;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-4);
  text-align: center;
}

.footer-nav {
  display: flex;
  gap: var(--space-5);
  flex-wrap: wrap;
  justify-content: center;
  list-style: none;
}

.footer-nav a {
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--blue);
}

.footer-disclaimer {
  font-size: var(--text-xs);
  color: var(--text-light);
  max-width: 600px;
  line-height: 1.5;
}

.footer-attribution {
  font-size: var(--text-xs);
  color: var(--text-light);
}

.footer-attribution a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-attribution a:hover {
  color: var(--blue);
}

/* --- Section Titles --- */
.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-2xl);
  text-align: center;
  margin-bottom: var(--space-3);
  color: var(--text);
}

.section-subtitle {
  font-size: var(--text-base);
  color: var(--text-muted);
  text-align: center;
  max-width: 600px;
  margin: 0 auto var(--space-8);
}

/* --- Home Features --- */
.features {
  padding: var(--space-12) 0;
}

.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 768px) {
  .features-grid {
    grid-template-columns: 1fr;
    gap: var(--space-4);
  }
}

.feature-item {
  text-align: center;
  padding: var(--space-6);
}

.feature-item__icon {
  width: 48px;
  height: 48px;
  margin: 0 auto var(--space-3);
  color: var(--blue);
}

.feature-item__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-lg);
  margin-bottom: var(--space-2);
}

.feature-item__text {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: 1.5;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
