/* Marathon Info Site — Modern Design */

/* ===== Variables ===== */
:root {
  --primary: #2563eb;
  --primary-light: #3b82f6;
  --primary-dark: #1d4ed8;
  --primary-bg: #eff6ff;
  --primary-border: #bfdbfe;
  --accent: #f59e0b;
  --accent-dark: #d97706;
  --success: #10b981;
  --success-bg: #ecfdf5;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --card: #ffffff;
  --text: #0f172a;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;
  --border: #e2e8f0;
  --border-light: #f1f5f9;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1), 0 4px 6px -4px rgba(0,0,0,.1);
  --transition: 0.2s cubic-bezier(.4,0,.2,1);
}

/* ===== Reset ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-dark); }
img { max-width: 100%; display: block; }

/* ===== Layout ===== */
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }
main.container { padding-top: 32px; padding-bottom: 64px; min-height: 60vh; }

/* ===== Header ===== */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,.92);
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 32px;
}
.logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
.logo:hover { text-decoration: none; color: var(--primary); }
nav { display: flex; gap: 8px; }
nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
nav a:hover { color: var(--primary); background: var(--primary-bg); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 8px; }
.nav-toggle span {
  display: block; width: 20px; height: 2px;
  background: var(--text); margin: 4px 0; border-radius: 2px;
  transition: var(--transition);
}

/* ===== Hero Section ===== */
.hero {
  text-align: center;
  padding: 56px 0 40px;
}
.hero h1 {
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
  background: linear-gradient(135deg, var(--text) 0%, var(--primary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.hero p {
  font-size: 1.125rem;
  color: var(--text-secondary);
  max-width: 600px;
  margin: 0 auto 32px;
}
.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-top: 24px;
}
.hero-stat {
  text-align: center;
}
.hero-stat .num {
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}
.hero-stat .label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 4px;
}

/* ===== Search ===== */
.search-box {
  position: relative;
  max-width: 560px;
  margin: 0 auto;
}
.search-box input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius-xl);
  font-size: 1rem;
  font-family: inherit;
  outline: none;
  background: var(--card);
  box-shadow: var(--shadow);
  transition: all var(--transition);
}
.search-box input:focus {
  border-color: var(--primary);
  box-shadow: var(--shadow-md), 0 0 0 4px var(--primary-bg);
}
.search-box::before {
  content: '';
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  background: var(--text-muted);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'/%3E%3C/svg%3E") center/contain no-repeat;
  pointer-events: none;
}

/* ===== Section Titles ===== */
.section-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title .icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

/* ===== Cards ===== */
.race-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all var(--transition);
  display: block;
  color: inherit;
  position: relative;
  overflow: hidden;
}
.race-card:hover {
  border-color: var(--primary-border);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}
.race-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.4;
  letter-spacing: -0.01em;
}
.race-card .meta {
  color: var(--text-secondary);
  font-size: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.race-card .meta span { display: flex; align-items: center; gap: 4px; }
.race-card .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.race-card .date-badge {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--primary-bg);
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
}

/* ===== Card with Image ===== */
.race-card.has-img {
  padding: 0;
  overflow: hidden;
}
.race-card.has-img .card-body {
  padding: 20px 24px 24px;
}
.race-card.has-img .date-badge {
  position: static;
  display: inline-block;
  margin-bottom: 8px;
}
.card-img {
  width: 100%;
  height: 180px;
  background-size: cover;
  background-position: center;
  position: relative;
}
.card-img::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 40px;
  background: linear-gradient(transparent, rgba(0,0,0,0.03));
}

/* ===== Race Hero with Image ===== */
.race-hero-img {
  background-size: cover;
  background-position: center;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  overflow: hidden;
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: flex-end;
}
.race-hero-overlay {
  background: linear-gradient(transparent 0%, rgba(0,0,0,0.7) 100%);
  padding: 60px 40px 40px;
  width: 100%;
  color: #fff;
}
.race-hero-overlay h1 { color: #fff; }
.race-hero-overlay .race-date { color: var(--accent); }
.race-hero-overlay .meta { color: rgba(255,255,255,0.85); }
.race-hero-overlay .meta span { color: rgba(255,255,255,0.85); }
.race-hero-overlay .tag { background: rgba(255,255,255,0.2); color: #fff; }
.race-hero-overlay .actions .btn-primary { background: var(--accent); }
.race-hero-overlay .actions .btn-outline { border-color: rgba(255,255,255,0.5); color: #fff; }

/* ===== Race Grid ===== */
.race-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

/* ===== Tags / Badges ===== */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 100px;
  font-size: 0.78rem;
  font-weight: 500;
  background: var(--bg-alt);
  color: var(--text-secondary);
  transition: all var(--transition);
  white-space: nowrap;
}
.tag:hover { text-decoration: none; background: var(--primary-bg); color: var(--primary); }
.tag.active, .tag.selected { background: var(--primary); color: #fff; }
.tag.trail { background: var(--success-bg); color: var(--success); }
.tag.difficulty-hard { background: var(--danger-bg); color: var(--danger); }
.tag-lg {
  padding: 8px 18px;
  font-size: 0.875rem;
}

/* ===== Browse Section ===== */
.browse-section { margin-top: 56px; }
.browse-section + .browse-section { margin-top: 40px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; }

/* ===== Race Detail (Hero) ===== */
.race-hero {
  background: var(--card);
  padding: 40px;
  border-radius: var(--radius-lg);
  margin-bottom: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.race-hero h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin-bottom: 12px;
}
.race-hero .race-date {
  font-size: 1.25rem;
  color: var(--primary);
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.race-hero .meta {
  margin-top: 12px;
  color: var(--text-secondary);
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.race-hero .tags { margin-top: 16px; display: flex; flex-wrap: wrap; gap: 8px; }
.race-hero .actions { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 12px; }

/* ===== Info Grid ===== */
.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin: 28px 0;
}
.info-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: box-shadow var(--transition);
}
.info-box:hover { box-shadow: var(--shadow-md); }
.info-box h3 {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}
.info-box .value {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
}
.info-box .sub {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ===== Table ===== */
.distance-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin: 16px 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.distance-table th,
.distance-table td {
  padding: 14px 18px;
  text-align: left;
}
.distance-table th {
  background: var(--bg-alt);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.distance-table td {
  border-bottom: 1px solid var(--border-light);
  font-size: 0.925rem;
}
.distance-table tbody tr:last-child td { border-bottom: none; }
.distance-table tbody tr:hover { background: var(--bg); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 28px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 3px rgba(37,99,235,.3);
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}
.btn-outline {
  border: 2px solid var(--border);
  color: var(--text);
  background: transparent;
}
.btn-outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-bg);
  text-decoration: none;
}
.btn-accent {
  background: var(--accent);
  color: #fff;
}
.btn-accent:hover { background: var(--accent-dark); text-decoration: none; color: #fff; }

/* ===== FAQ ===== */
.faq-list { margin-top: 8px; }
.faq-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 8px;
  overflow: hidden;
  transition: box-shadow var(--transition);
}
.faq-item:hover { box-shadow: var(--shadow); }
.faq-item h4 {
  cursor: pointer;
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1.5;
  user-select: none;
}
.faq-item h4::after {
  content: '+';
  font-size: 1.25rem;
  font-weight: 400;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-left: 12px;
  transition: transform var(--transition);
}
.faq-item.open h4::after { content: '-'; }
.faq-item p {
  padding: 0 24px 18px;
  color: var(--text-secondary);
  line-height: 1.7;
  font-size: 0.925rem;
}

/* ===== Breadcrumb ===== */
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  padding: 12px 0;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-secondary); }
.breadcrumb a:hover { color: var(--primary); }
.breadcrumb .sep { color: var(--border); }

/* ===== Page Title ===== */
.page-title {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}
.page-subtitle {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-bottom: 28px;
}

/* ===== Month Nav (Calendar) ===== */
.month-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 28px;
}

/* ===== Course Description ===== */
.content-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  margin: 24px 0;
  line-height: 1.8;
  font-size: 0.95rem;
  color: var(--text);
}
.content-block p + p { margin-top: 12px; }

/* ===== Section Divider ===== */
.section { margin-top: 48px; }
.section h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 2px solid var(--bg-alt);
}

/* ===== Footer ===== */
footer {
  background: var(--card);
  border-top: 1px solid var(--border);
  margin-top: 80px;
  padding: 48px 0 32px;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
  margin-bottom: 32px;
}
.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 8px;
  max-width: 400px;
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}
.footer-links a:hover { color: var(--primary); }
.footer-copy {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  padding-top: 24px;
  border-top: 1px solid var(--border-light);
}

/* ===== Search Results Dropdown ===== */
#search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  max-height: 420px;
  overflow-y: auto;
  z-index: 50;
}
#search-results .race-card {
  border: none;
  border-bottom: 1px solid var(--border-light);
  border-radius: 0;
  padding: 16px 20px;
  margin: 0;
}
#search-results .race-card:last-child { border-bottom: none; }
#search-results .race-card:hover { background: var(--bg); transform: none; }

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .container { padding: 0 16px; }
  main.container { padding-top: 20px; padding-bottom: 40px; }

  .header-inner { height: 56px; }
  nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    flex-direction: column;
    padding: 8px 16px;
    box-shadow: var(--shadow-md);
  }
  nav.open { display: flex; }
  nav a { padding: 12px 8px; }
  .nav-toggle { display: block; }

  .hero { padding: 32px 0 24px; }
  .hero h1 { font-size: 1.75rem; }
  .hero-stats { gap: 24px; }
  .hero-stat .num { font-size: 1.5rem; }

  .race-grid { grid-template-columns: 1fr; }
  .info-grid { grid-template-columns: 1fr; }

  .race-hero { padding: 24px; }
  .race-hero h1 { font-size: 1.5rem; }

  .page-title { font-size: 1.5rem; }

  .footer-inner { flex-direction: column; }
  .footer-links { flex-wrap: wrap; gap: 16px; }
}

/* Static pages */
.static-page { max-width: 800px; margin: 0 auto; padding: 32px 0; }
.static-page h1 { font-size: 2rem; font-weight: 800; margin-bottom: 8px; }
.static-page h2 { font-size: 1.3rem; font-weight: 700; margin-top: 32px; margin-bottom: 12px; color: var(--text); }
.static-page .content-block { line-height: 1.8; color: var(--text-secondary); }
.static-page .content-block p { margin-bottom: 12px; }
.static-page ul { padding-left: 24px; margin: 12px 0; color: var(--text-secondary); line-height: 1.8; }
.static-page li { margin-bottom: 4px; }
