/* ============================================================
   Madrid Corre – CSS
   Palette: deep reds + warm gold
   ============================================================ */

:root {
  --green-900: #7B1D1D;
  --green-700: #B91C1C;
  --green-600: #DC2626;
  --green-500: #EF4444;
  --green-300: #FCA5A5;
  --green-100: #FEE2E2;
  --green-50:  #FFF5F5;
  --orange:    #F59E0B;
  --orange-dk: #D97706;
  --text-dark: #1C0A0A;
  --text-mid:  #5C1A1A;
  --text-light:#9B4A4A;
  --bg:        #FFF5F5;
  --card-bg:   #FFFFFF;
  --border:    #FECACA;
  --shadow-sm: 0 1px 4px rgba(185,28,28,0.10);
  --shadow-md: 0 4px 16px rgba(185,28,28,0.14);
  --shadow-lg: 0 8px 32px rgba(185,28,28,0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-head: 'Poppins', sans-serif;
  --font-body: 'Nunito', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text-dark);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(240, 251, 244, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 6px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text-dark);
}

.logo-bear {
  height: 52px;
  width: auto;
  flex-shrink: 0;
}

.btn-lang {
  background: var(--green-700);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 7px 16px;
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 0.5px;
  transition: background 0.2s, transform 0.1s;
}
.btn-lang:hover  { background: var(--green-900); }
.btn-lang:active { transform: scale(0.96); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  background: linear-gradient(135deg, var(--green-700) 0%, var(--green-600) 50%, var(--green-500) 100%);
  color: white;
  padding: 56px 24px 64px;
  overflow: hidden;
  position: relative;
}

.hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0; right: 0;
  height: 40px;
  background: var(--bg);
  clip-path: ellipse(55% 100% at 50% 100%);
}

.hero-inner {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 48px;
}

.hero-mascot { flex-shrink: 0; }

.mascot-hero-svg {
  height: 200px;
  width: auto;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,0.22));
  animation: mascot-bounce 3s ease-in-out infinite;
}

@keyframes mascot-bounce {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-8px); }
}

.hero-text { flex: 1; }

.hero-tag {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.75);
  margin-bottom: 10px;
}

.hero-title {
  font-family: var(--font-head);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.15;
  margin-bottom: 14px;
  text-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.hero-sub {
  font-size: 1.1rem;
  color: rgba(255,255,255,0.88);
  margin-bottom: 28px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border-radius: var(--radius-sm);
  padding: 10px 18px;
  backdrop-filter: blur(4px);
}
.stat-num {
  font-family: var(--font-head);
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1;
  color: var(--orange);
}
.stat-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,0.8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}
.stat-sep {
  font-size: 1.4rem;
  color: rgba(255,255,255,0.35);
  font-weight: 300;
}

/* ============================================================
   CONTROLS
   ============================================================ */
.controls-section {
  padding: 28px 24px 20px;
  background: var(--bg);
}

.controls-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Year selector */
.year-selector {
  display: flex;
  gap: 8px;
  align-self: flex-start;
  background: var(--green-100);
  padding: 4px;
  border-radius: var(--radius-md);
}

.year-btn {
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 10px 28px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  color: var(--text-mid);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.year-btn:hover { background: rgba(255,255,255,0.6); }
.year-btn.active {
  background: white;
  color: var(--green-700);
  box-shadow: var(--shadow-sm);
}

/* Filters bar */
.filters-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: flex-end;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 160px;
}

.filter-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-light);
}

.filter-select {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-family: var(--font-body);
  font-size: 0.9rem;
  color: var(--text-dark);
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%239B4A4A' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.filter-select:focus {
  outline: none;
  border-color: var(--green-500);
  box-shadow: 0 0 0 3px rgba(82,183,136,0.2);
}

.btn-clear {
  background: transparent;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  align-self: flex-end;
  transition: all 0.2s;
  white-space: nowrap;
}
.btn-clear:hover {
  background: #FFF0EB;
  border-color: var(--orange-dk);
  color: var(--orange-dk);
}

/* ============================================================
   RESULTS
   ============================================================ */
.results-section {
  padding: 0 24px 60px;
}

.results-inner {
  max-width: 1200px;
  margin: 0 auto;
}

.results-count {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-light);
  margin-bottom: 20px;
  padding-left: 2px;
}

/* Month heading dividers */
.month-divider {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 12px 0 4px;
}
.month-divider h2 {
  font-family: var(--font-head);
  font-size: 1rem;
  font-weight: 700;
  color: var(--green-700);
  white-space: nowrap;
  text-transform: capitalize;
}
.month-divider-line {
  flex: 1;
  height: 1.5px;
  background: var(--green-100);
  border-radius: 2px;
}

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

/* No results */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 24px;
  color: var(--text-light);
  font-size: 1rem;
}
.no-results-icon { font-size: 3rem; display: block; margin-bottom: 12px; }

/* ============================================================
   RACE CARD
   ============================================================ */
.race-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border-left: 5px solid var(--green-300);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s, transform 0.2s;
}
.race-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.race-card.estado-confirmada { border-left-color: var(--green-600); }
.race-card.estado-pendiente  { border-left-color: var(--orange); }
.race-card.estado-cancelada  {
  border-left-color: #CCC;
  opacity: 0.65;
}

.card-header {
  padding: 14px 16px 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.race-name {
  font-family: var(--font-head);
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-dark);
  line-height: 1.3;
  flex: 1;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px 8px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-confirmada {
  background: #FEE2E2;
  color: var(--green-700);
}
.badge-pendiente {
  background: #FFF3E0;
  color: #B45309;
}
.badge-cancelada {
  background: #F3F4F6;
  color: #6B7280;
}

/* Card body */
.card-body {
  padding: 0 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-info {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-mid);
}
.info-icon { flex-shrink: 0; font-size: 0.9rem; }

.info-date {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.day-name {
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--green-100);
  color: var(--green-700);
  padding: 1px 6px;
  border-radius: 4px;
}

.date-provisional { color: var(--text-light); }

.provisional-note {
  font-size: 0.72rem;
  color: var(--orange-dk);
  font-weight: 600;
  font-style: italic;
}

.date-cancelled {
  color: #9CA3AF;
  font-style: italic;
  font-size: 0.82rem;
}

.card-note {
  font-size: 0.78rem;
  color: var(--green-700);
  background: var(--green-50);
  border-radius: 6px;
  padding: 5px 8px;
  margin-top: 4px;
  font-style: italic;
}

/* Card footer / organizer link */
.card-footer {
  padding: 10px 16px 14px;
  border-top: 1px solid var(--border);
}

.btn-org {
  display: inline-block;
  background: var(--green-700);
  color: white;
  text-decoration: none;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
  transition: background 0.2s;
  width: 100%;
  text-align: center;
}
.btn-org:hover  { background: var(--green-900); }
.btn-org:active { opacity: 0.85; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--green-900);
  color: rgba(255,255,255,0.7);
  padding: 32px 24px;
}
.footer-inner {
  max-width: 1200px;
  margin: 0 auto;
  text-align: center;
}
.footer-text {
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: rgba(255,255,255,0.9);
}
.footer-note {
  font-size: 0.78rem;
  color: rgba(255,255,255,0.5);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .hero-inner {
    flex-direction: column;
    text-align: center;
    gap: 24px;
  }
  .hero-stats { justify-content: center; }
  .mascot-hero-svg { height: 150px; width: auto; }

  .filters-bar { flex-direction: column; }
  .filter-group { min-width: unset; width: 100%; }
  .filter-select { width: 100%; }
  .btn-clear { width: 100%; text-align: center; }

  .races-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .header-inner { padding: 10px 16px; }
  .hero { padding: 36px 16px 48px; }
  .controls-section { padding: 20px 16px 16px; }
  .results-section { padding: 0 16px 40px; }

  .hero-title { font-size: 1.75rem; }
  .year-btn { padding: 8px 20px; }
}

@media (min-width: 900px) {
  .races-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 1100px) {
  .races-grid { grid-template-columns: repeat(4, 1fr); }
}
