/* Tour virtual 360° - páginas individuales de proyecto */
.tv-seccion {
  --tv-rojo: #A72608;
  --tv-azul: #1D3441;
  --tv-gris: #75838A;
  --tv-oscuro: #102430;
  font-family: 'Montserrat', sans-serif;
  max-width: 1200px;
  margin: 5rem auto 4rem;
  padding: 0 1rem;
  text-align: center;
}

.tv-encabezado {
  margin-bottom: 1.75rem;
}

.tv-pre {
  display: block;
  font-size: clamp(1.4rem, 2.6vw, 2.4rem);
  font-weight: 400;
  color: var(--tv-azul);
  line-height: 1.1;
}

.tv-titulo {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.8rem);
  font-weight: 700;
  color: var(--tv-rojo);
  line-height: 1.15;
}

.tv-bajada {
  max-width: 40rem;
  margin: 0.9rem auto 0;
  font-size: 1rem;
  color: var(--tv-gris);
}

/* Selector de unidades */
.tv-tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
}

.tv-tab {
  padding: 0.55rem 1.2rem;
  border: 1px solid var(--tv-rojo);
  border-radius: 999px;
  background: transparent;
  color: var(--tv-azul);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.tv-tab:hover {
  background: rgba(167, 38, 8, 0.08);
}

.tv-tab.tv-activo {
  background: var(--tv-rojo);
  color: #fff;
}

.tv-tab:focus-visible,
.tv-portada:focus-visible {
  outline: 3px solid var(--tv-azul);
  outline-offset: 3px;
}

/* Visor */
.tv-visor {
  position: relative;
  aspect-ratio: 16 / 9;
  max-height: 80vh;
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: var(--tv-oscuro);
  box-shadow: 0 24px 50px -24px rgba(16, 36, 48, 0.55);
}

.tv-visor iframe {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
}

.tv-portada {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 1rem;
  border: 0;
  background: none;
  color: #fff;
  font-family: inherit;
  cursor: pointer;
}

.tv-portada img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s ease;
}

.tv-portada::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(16, 36, 48, 0.25), rgba(16, 36, 48, 0.75));
}

.tv-portada:hover img {
  transform: scale(1.03);
}

.tv-play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  background: var(--tv-rojo);
  box-shadow: 0 0 0 0 rgba(167, 38, 8, 0.6);
  animation: tv-pulso 2.2s infinite;
}

.tv-play svg {
  width: 1.8rem;
  height: 1.8rem;
  margin-left: 0.25rem;
  fill: #fff;
}

.tv-portada-texto {
  font-size: clamp(1rem, 1.6vw, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.tv-portada-unidad {
  font-size: 0.85rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  opacity: 0.85;
}

.tv-visor.tv-iniciado .tv-portada {
  display: none;
}

/* Indicador de carga: queda detrás del iframe hasta que el tour se dibuja */
.tv-visor.tv-iniciado::before,
.tv-visor.tv-iniciado::after {
  position: absolute;
  top: 50%;
  z-index: 0;
}

.tv-visor.tv-iniciado::before {
  content: "";
  left: 50%;
  width: 2.5rem;
  height: 2.5rem;
  margin: -2.5rem 0 0 -1.25rem;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tv-giro 0.9s linear infinite;
}

.tv-visor.tv-iniciado::after {
  content: "Cargando recorrido\2026";
  left: 0;
  right: 0;
  margin-top: 1rem;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.75);
}

.tv-abrir {
  display: inline-block;
  margin-top: 1rem;
  font-size: 0.85rem;
  color: var(--tv-gris);
  text-decoration: none;
}

.tv-abrir:hover {
  color: var(--tv-rojo);
  text-decoration: underline;
}

@keyframes tv-giro {
  to { transform: rotate(360deg); }
}

@keyframes tv-pulso {
  70% { box-shadow: 0 0 0 1.1rem rgba(167, 38, 8, 0); }
  100% { box-shadow: 0 0 0 0 rgba(167, 38, 8, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .tv-play { animation: none; }
  .tv-portada img { transition: none; }
}

@media (max-width: 600px) {
  .tv-seccion { margin: 3rem auto 2.5rem; }
  .tv-visor { aspect-ratio: 4 / 5; border-radius: 8px; }
  .tv-tab { font-size: 0.72rem; padding: 0.5rem 0.9rem; }
  .tv-play { width: 4rem; height: 4rem; }
}
