/* ==========================================================================
   INICIO · portada visual por secciones
   Cada sección del sitio es una tarjeta fotográfica clickeable. Una columna en celular,
   dos en tablet y un mosaico de 12 columnas en escritorio. El orden es el mismo en todos.
   ========================================================================== */

/* ---------- Titular (único h1 de la página) ---------- */
.inicio-titular {
  padding-top: calc(var(--cabecera-alto) + var(--esp-8));
  padding-bottom: var(--esp-6);
}

.inicio-titular__lugar {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  color: var(--color-texto-tenue);
  font-size: var(--texto-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.inicio-titular__lugar::before {
  content: "";
  flex-shrink: 0;
  width: 1.5rem;
  height: 3px;
  background-color: var(--color-primario);
}

.inicio-titular__titulo {
  margin-top: var(--esp-2);
  color: var(--color-blanco);
  font-family: var(--fuente-titulos);
  font-size: var(--texto-4xl);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 0.95;
  text-transform: uppercase;
}

.inicio-titular__titulo em {
  color: var(--color-amarillo);
  font-style: normal;
}

/* ---------- Grilla de secciones ---------- */
.portada-visual {
  padding-bottom: var(--esp-16);
}

.portada-visual__grilla {
  display: grid;

  /* Móvil: 24px entre bloques + línea divisoria (ver ::after). */
  gap: 1.5rem;
  background-color: var(--color-fondo);
}

.tarjeta-seccion {
  position: relative;
}

/* Separador Racing entre bloques en una columna: línea fina + acento amarillo central. */
.tarjeta-seccion:not(:last-child)::after {
  content: "";
  position: absolute;
  right: 12%;
  bottom: calc(-0.75rem - 0.5px);
  left: 12%;
  z-index: 1;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--color-borde) 18%,
    var(--color-amarillo) 50%,
    var(--color-borde) 82%,
    transparent 100%
  );
  pointer-events: none;
}

/* ---------- Tarjeta de sección ---------- */
.tarjeta-seccion__enlace {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  height: 100%;
  min-height: clamp(27rem, 118vw, 31rem);
  overflow: hidden;
  color: var(--color-blanco);
}

.tarjeta-seccion--movil-arriba .tarjeta-seccion__enlace {
  justify-content: flex-start;
}

.tarjeta-seccion--protagonista .tarjeta-seccion__enlace,
.tarjeta-seccion--segunda .tarjeta-seccion__enlace {
  min-height: clamp(30rem, 135vw, 36rem);
}

/* <picture> es display: contents en el sitio: la foto se posiciona directamente. */
.tarjeta-seccion__foto {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: var(--foco, 50% 50%);
  transition: transform 0.45s var(--curva-suave);
}

/* Degradado del lado del texto: el resto de la foto queda limpio. */
.tarjeta-seccion__enlace::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    0deg,
    rgb(7 20 36 / 0.95) 0%,
    rgb(7 20 36 / 0.8) 32%,
    rgb(7 20 36 / 0.2) 62%,
    transparent 80%
  );
  transition: opacity 0.45s var(--curva-suave);
}

.tarjeta-seccion--movil-arriba .tarjeta-seccion__enlace::before {
  background: linear-gradient(
    180deg,
    rgb(7 20 36 / 0.95) 0%,
    rgb(7 20 36 / 0.8) 32%,
    rgb(7 20 36 / 0.2) 62%,
    transparent 80%
  );
}

.tarjeta-seccion__enlace:focus-visible {
  outline: 3px solid var(--color-foco);
  outline-offset: -3px;
}

.tarjeta-seccion__cuerpo {
  display: grid;
  justify-items: start;
  gap: var(--esp-4);
  max-width: 30rem;
  padding: var(--esp-8) var(--esp-6);
  transition: transform 0.35s var(--curva-suave);
}

.tarjeta-seccion__kicker {
  display: flex;
  align-items: center;
  gap: var(--esp-3);
  font-size: var(--texto-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tarjeta-seccion__kicker::before {
  content: "";
  flex-shrink: 0;
  width: 1.5rem;
  height: 3px;
  background-color: var(--color-primario);
}

/* El h2 solo aporta semántica: el nombre visible vive en el botón. */
.tarjeta-seccion__titulo {
  margin: 0;
  font-size: inherit;
  font-weight: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}

.tarjeta-seccion__descripcion {
  max-width: 24rem;
  color: var(--color-texto-suave);
  font-size: var(--texto-sm);
  line-height: 1.55;
}

/* Datos oficiales de la próxima fecha */
.tarjeta-seccion__datos {
  display: flex;
  flex-wrap: wrap;
  gap: var(--esp-2);
}

.tarjeta-seccion__dato {
  padding: var(--esp-1) var(--esp-3);
  border: 1px solid var(--color-borde);
  background-color: rgb(7 20 36 / 0.7);
  font-family: var(--fuente-titulos);
  font-size: var(--texto-base);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tarjeta-seccion__dato--dia {
  border-color: var(--color-amarillo);
  color: var(--color-amarillo);
}

/* Opción B · fill deslizante Racing (local a la portada; no toca botones globales). */
.tarjeta-seccion__cta.boton {
  --cta-desliz: 0.35s var(--curva-suave);

  position: relative;
  isolation: isolate;
  margin-top: var(--esp-1);
  overflow: hidden;
  min-height: 3rem;
  padding-block: 0.85rem;
  font-family: var(--fuente-titulos);
  font-size: clamp(1.05rem, 0.85rem + 0.9vw, 1.35rem);
  font-weight: 700;
  letter-spacing: 0.02em;
  transition:
    color var(--cta-desliz),
    box-shadow var(--cta-desliz);
}

/* z-index -1 (con isolation del botón): el fill queda detrás del texto en flujo.
   Los CTA contorno no envuelven el título en .boton__texto; con z-index 0 el
   amarillo tapaba la palabra. Primario ya tenía z-index 1 en .boton__texto. */
.tarjeta-seccion__cta.boton::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--color-amarillo);
  transform: translateX(-101%);
  transition: transform var(--cta-desliz);
  pointer-events: none;
}

.tarjeta-seccion__cta.boton::after {
  content: none;
}

.tarjeta-seccion__cta .boton__texto,
.tarjeta-seccion__cta .boton__flecha,
.tarjeta-seccion__cta .boton__arr {
  position: relative;
  z-index: 1;
  transition:
    transform var(--cta-desliz),
    fill var(--cta-desliz),
    color var(--cta-desliz);
}

/* Sin círculo Uiverse: el fill lo hace ::before. Una sola flecha visible. */
.tarjeta-seccion__cta .boton__circulo {
  display: none;
}

.tarjeta-seccion__cta .boton__arr--2 {
  display: none;
}

.tarjeta-seccion__cta .boton__arr--1 {
  right: 1rem;
  transition:
    transform var(--cta-desliz),
    fill var(--cta-desliz);
}

.tarjeta-seccion__cta.boton--primario:has(.boton__arr) .boton__texto {
  transform: translateX(-0.75rem);
}

.tarjeta-seccion--protagonista .tarjeta-seccion__cta.boton,
.tarjeta-seccion--segunda .tarjeta-seccion__cta.boton {
  min-height: 3.1rem;
  padding-block: 0.85rem;
  padding-inline: 2rem;
  font-size: clamp(1.1rem, 0.9rem + 0.95vw, 1.45rem);
}

/*
  Fill + flecha: hover (escritorio / emulador con mouse) y :active (toque real).
  Fuera de (hover: hover) para que también se vea en vista móvil del DevTools.
*/
.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton::before,
.tarjeta-seccion__cta.boton:hover::before,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton::before,
.tarjeta-seccion__cta.boton:active::before,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton::before {
  transform: translateX(0);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton,
.tarjeta-seccion__cta.boton:hover,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton,
.tarjeta-seccion__cta.boton:active,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton {
  translate: none;
  color: var(--color-texto-oscuro);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton--primario,
.tarjeta-seccion__cta.boton--primario:hover,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton--primario,
.tarjeta-seccion__cta.boton--primario:active,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton--primario {
  border-radius: 100px;
  box-shadow: 0 0 0 2px var(--color-amarillo);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta .boton__arr--1,
.tarjeta-seccion__cta.boton:hover .boton__arr--1,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta .boton__arr--1,
.tarjeta-seccion__cta.boton:active .boton__arr--1,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta .boton__arr--1 {
  right: 1rem;
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton--primario:has(.boton__arr) .boton__texto,
.tarjeta-seccion__cta.boton--primario:hover:has(.boton__arr) .boton__texto,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton--primario:has(.boton__arr) .boton__texto,
.tarjeta-seccion__cta.boton--primario:active:has(.boton__arr) .boton__texto,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton--primario:has(.boton__arr) .boton__texto {
  transform: translateX(-0.75rem);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta .boton__arr,
.tarjeta-seccion__cta.boton:hover .boton__arr,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta .boton__arr,
.tarjeta-seccion__cta.boton:active .boton__arr,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta .boton__arr {
  fill: var(--color-texto-oscuro);
  transform: translate(0.3rem, -0.3rem);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta .boton__flecha,
.tarjeta-seccion__cta.boton:hover .boton__flecha,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta .boton__flecha,
.tarjeta-seccion__cta.boton:active .boton__flecha,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta .boton__flecha {
  transform: translate(0.3rem, -0.3rem);
}

.tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton--contorno,
.tarjeta-seccion__cta.boton--contorno:hover,
.tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton--contorno,
.tarjeta-seccion__cta.boton--contorno:active,
.tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton--contorno {
  background-color: transparent;
  box-shadow: inset 0 0 0 1.5px var(--color-amarillo);
}

/* Zoom de foto solo con puntero fino: evita zoom “pegado” tras tocar en móvil. */
@media (hover: hover) {
  .tarjeta-seccion__enlace:hover .tarjeta-seccion__foto {
    transform: scale(1.04);
  }

  .tarjeta-seccion__enlace:hover::before {
    opacity: 0.88;
  }

  .tarjeta-seccion__enlace:hover .tarjeta-seccion__cuerpo {
    transform: translateY(-0.25rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .tarjeta-seccion__foto,
  .tarjeta-seccion__enlace::before,
  .tarjeta-seccion__cuerpo,
  .tarjeta-seccion__cta.boton,
  .tarjeta-seccion__cta.boton::before,
  .tarjeta-seccion__cta .boton__texto,
  .tarjeta-seccion__cta .boton__flecha,
  .tarjeta-seccion__cta .boton__arr,
  .tarjeta-seccion__cta .boton__arr--1 {
    transition: none;
  }

  .tarjeta-seccion__enlace:hover .tarjeta-seccion__foto,
  .tarjeta-seccion__enlace:hover .tarjeta-seccion__cuerpo {
    transform: none;
  }

  .tarjeta-seccion__enlace:hover .tarjeta-seccion__cta .boton__arr,
  .tarjeta-seccion__cta.boton:hover .boton__arr,
  .tarjeta-seccion__enlace:active .tarjeta-seccion__cta .boton__arr,
  .tarjeta-seccion__cta.boton:active .boton__arr,
  .tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta .boton__arr,
  .tarjeta-seccion__enlace:hover .tarjeta-seccion__cta .boton__flecha,
  .tarjeta-seccion__cta.boton:hover .boton__flecha,
  .tarjeta-seccion__enlace:active .tarjeta-seccion__cta .boton__flecha,
  .tarjeta-seccion__cta.boton:active .boton__flecha,
  .tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta .boton__flecha {
    transform: none;
  }

  .tarjeta-seccion__enlace:hover .tarjeta-seccion__cta.boton::before,
  .tarjeta-seccion__cta.boton:hover::before,
  .tarjeta-seccion__enlace:active .tarjeta-seccion__cta.boton::before,
  .tarjeta-seccion__cta.boton:active::before,
  .tarjeta-seccion__enlace:focus-visible .tarjeta-seccion__cta.boton::before {
    transform: translateX(0);
  }
}

/* ---------- Encuadre de cada foto: celular (--foco) y desde tablet (--foco-escritorio) ---------- */
.tarjeta-seccion--soy-piloto {
  --foco: 42% 30%;
  --foco-escritorio: 50% 30%;
}

.tarjeta-seccion--proxima-fecha {
  --foco: 72% 50%;
  --foco-escritorio: 68% 50%;
}

.tarjeta-seccion--calendario {
  --foco: 58% 50%;
  --foco-escritorio: 55% 50%;
}

.tarjeta-seccion--categorias {
  --foco: 62% 20%;
  --foco-escritorio: 50% 25%;
}

.tarjeta-seccion--posiciones {
  --foco: 30% 80%;
  --foco-escritorio: 40% 80%;
}

.tarjeta-seccion--resultados {
  --foco: 40% 30%;
  --foco-escritorio: 40% 35%;
}

.tarjeta-seccion--galeria {
  --foco: 52% 30%;
  --foco-escritorio: 50% 35%;
}

.tarjeta-seccion--soy-publico {
  --foco: 66% 70%;
  --foco-escritorio: 60% 60%;
}

.tarjeta-seccion--contacto {
  --foco: 58% 40%;
  --foco-escritorio: 50% 40%;
}

.tarjeta-seccion--circuito {
  --foco: 62% 75%;
  --foco-escritorio: 50% 70%;
}

.tarjeta-seccion--reglamento {
  --foco: 60% 30%;
  --foco-escritorio: 50% 30%;
}

.tarjeta-seccion--sponsors {
  --foco: 58% 60%;
  --foco-escritorio: 70% 50%;
}

/* ---------- Tablet: dos columnas ---------- */
@media (min-width: 48em) {
  .portada-visual__grilla {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--esp-4);
    max-width: var(--contenedor-ancho);
    margin-inline: auto;
    padding-inline: var(--contenedor-margen);
  }

  /* En grilla multi-columna las líneas entre filas cortarían mal: solo aire. */
  .tarjeta-seccion:not(:last-child)::after {
    content: none;
  }

  .tarjeta-seccion__enlace,
  .tarjeta-seccion--protagonista .tarjeta-seccion__enlace,
  .tarjeta-seccion--segunda .tarjeta-seccion__enlace {
    min-height: 28rem;
    border-radius: var(--radio-boton);
  }

  .tarjeta-seccion__foto {
    object-position: var(--foco-escritorio, var(--foco, 50% 50%));
  }

  /* Desde tablet manda `texto`; en celular manda `textoMovil` (clases --movil-*). */
  .tarjeta-seccion--texto-abajo .tarjeta-seccion__enlace {
    justify-content: flex-end;
  }

  .tarjeta-seccion--texto-arriba .tarjeta-seccion__enlace {
    justify-content: flex-start;
  }

  .tarjeta-seccion--texto-abajo .tarjeta-seccion__enlace::before {
    background: linear-gradient(
      0deg,
      rgb(7 20 36 / 0.95) 0%,
      rgb(7 20 36 / 0.8) 32%,
      rgb(7 20 36 / 0.2) 62%,
      transparent 80%
    );
  }

  .tarjeta-seccion--texto-arriba .tarjeta-seccion__enlace::before {
    background: linear-gradient(
      180deg,
      rgb(7 20 36 / 0.95) 0%,
      rgb(7 20 36 / 0.8) 32%,
      rgb(7 20 36 / 0.2) 62%,
      transparent 80%
    );
  }
}

/* ---------- Escritorio: mosaico editorial de 12 columnas ----------
   Fila 1: Soy piloto (7) + Próxima fecha (5). Filas 2-3: de a tres.
   Fila 4: Contacto (4) + Circuito (8). Fila 5: Reglamento + Sponsors (6 y 6).
   Empieza en 80em: más angosto, las tarjetas de a tres quedan apretadas. */
@media (min-width: 80em) {
  .portada-visual__grilla {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: var(--esp-5);
  }

  .tarjeta-seccion {
    grid-column: span 4;
  }

  .tarjeta-seccion--protagonista {
    grid-column: span 7;
  }

  .tarjeta-seccion--segunda {
    grid-column: span 5;
  }

  .tarjeta-seccion--ancha {
    grid-column: span 8;
  }

  .tarjeta-seccion--media {
    grid-column: span 6;
  }

  .tarjeta-seccion__enlace {
    min-height: 26rem;
  }

  .tarjeta-seccion--protagonista .tarjeta-seccion__enlace,
  .tarjeta-seccion--segunda .tarjeta-seccion__enlace {
    min-height: clamp(34rem, 42vw, 40rem);
  }

  .tarjeta-seccion__cuerpo {
    padding: var(--esp-8);
  }

  .tarjeta-seccion--protagonista .tarjeta-seccion__cta.boton,
  .tarjeta-seccion--segunda .tarjeta-seccion__cta.boton {
    font-size: clamp(1.2rem, 0.95rem + 1vw, 1.55rem);
  }
}
