* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  background: #f5f5f5;
  color: #111;
}

/* HERO */
.hero {
  position: relative;
  height: 70vh;
  background:
    linear-gradient(
      180deg,
      rgba(0,0,0,.75) 0%,
      rgba(0,0,0,.55) 50%,
      rgba(0,0,0,.85) 100%
    ),
    url('../img/hero-photo.jpg') center/cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.hero-inner {
  max-width: 800px;
  color: #fff;
  padding: 1.5rem;
}

.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: .8rem;
  letter-spacing: -0.02em;
}

.hero h1 span {
  display: block;
  font-weight: 700;
  opacity: .9;
}

.hero p {
  font-size: 1.1rem;
  opacity: .85;
  margin: 0;
}


/* CONTENT */
.container {
  max-width: 1200px;
  margin: -5rem auto 3rem;
  padding: 0 1rem;
}


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

/* CARD */
.race-card {
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 8px 22px rgba(0,0,0,.08);
  transition: transform .25s ease, box-shadow .25s ease;
  display: flex;
  flex-direction: column;
}

.race-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 18px 40px rgba(0,0,0,.14);
}

/* Imagen con overlay suave */
.race-image {
  position: relative;
  height: 190px;
  background-size: cover;
  background-position: center;
}

.race-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0,0,0,0) 40%,
    rgba(0,0,0,.45) 100%
  );
}

/* Info */
.race-info {
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.race-info h2 {
  font-size: 1.05rem;
  margin: 0 0 .35rem;
  font-weight: 700;
  line-height: 1.25;
}

.race-info p {
  font-size: .9rem;
  color: #555;
  margin: 0 0 1rem;
}

/* Botón */
.btn-primary {
  margin-top: auto;
  align-self: flex-start;
  padding: .55rem 1.2rem;
  background: #111;
  color: #fff;
  border-radius: 999px;
  font-size: .85rem;
  font-weight: 600;
  letter-spacing: .02em;
  transition: background .2s ease, transform .2s ease;
}

.race-card:hover .btn-primary {
  background: #000;
  transform: translateY(-1px);
}


/* FOOTER */
.footer {
  text-align: center;
  padding: 2rem 1rem;
  font-size: .85rem;
  color: #666;
}

@media (max-width: 600px) {
  .race-image {
    height: 160px;
  }

  .race-info h2 {
    font-size: 1rem;
  }
}

/* BADGES */
.badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: .35rem .7rem;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.badge.available {
  background: rgba(0,0,0,.75);
  color: #fff;
}

.badge.coming {
  background: rgba(255,255,255,.85);
  color: #111;
}

/* Estado deshabilitado */
.is-coming {
  opacity: .75;
  cursor: default;
}

.is-coming:hover {
  transform: none;
  box-shadow: 0 8px 22px rgba(0,0,0,.08);
}

.btn-disabled {
  margin-top: auto;
  padding: .55rem 1.2rem;
  border-radius: 999px;
  font-size: .85rem;
  background: #ddd;
  color: #666;
}

/* Animación de entrada */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Cards animadas */
.race-card {
  opacity: 0;
  animation: fadeUp .6s ease forwards;
}

.race-card:nth-child(1) { animation-delay: .05s; }
.race-card:nth-child(2) { animation-delay: .12s; }
.race-card:nth-child(3) { animation-delay: .19s; }
.race-card:nth-child(4) { animation-delay: .26s; }
.race-card:nth-child(5) { animation-delay: .33s; }
.race-card:nth-child(6) { animation-delay: .40s; }

@media (prefers-reduced-motion: reduce) {
  .race-card {
    animation: none;
    opacity: 1;
    transform: none;
  }
}

.race-card:hover {
  transform: translateY(-6px);
}

@media (max-width: 768px) {
  .hero {
    height: 52vh;
    background-position: center top;
  }

  .hero h1 {
    font-size: 1.9rem;
    line-height: 1.2;
  }

  .hero p {
    font-size: 1rem;
  }
}

@media (max-width: 600px) {
  .container {
    margin: -3rem auto 2rem;
  }

  .race-image {
    height: 145px;
  }

  .race-info {
    padding: .9rem;
  }

  .race-info h2 {
    font-size: .95rem;
  }

  .race-info p {
    font-size: .85rem;
    margin-bottom: .7rem;
  }
}

@media (max-width: 600px) {
  .btn-primary,
  .btn-disabled {
    padding: .65rem 1.4rem;
    font-size: .9rem;
  }
}
@media (max-width: 600px) {
  .badge {
    font-size: .65rem;
    padding: .3rem .6rem;
  }
}

body {
  -webkit-overflow-scrolling: touch;
}

/* Portada individual de carrera */
.race-intro {
  max-width: 600px;
  margin: 2rem auto 0;
  text-align: center;
}

.race-intro p {
  font-size: 1rem;
  color: #444;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.btn-large {
  font-size: 1rem;
  padding: .75rem 1.8rem;
}

/* Buscador */
.search-form {
  margin: 1.5rem 0 1rem;
  display: flex;
  gap: .6rem;
  flex-wrap: wrap;
  justify-content: center;
}

/* Resultados del buscador */
#results {
  margin-top: 1.5rem;
}


