/* ============================================================
   TELES DIBUJADAS — estilo "hecho por chicos"
   Compartido por index.html, historia.html y cooperativa.html

   Patrón "facade": se muestra la miniatura del video (siempre carga)
   con un botón ▶. Al hacer clic, se carga el iframe de YouTube.
   Así se evita el error 153 y la tele nunca queda en blanco.
   ============================================================ */

/* Tipografía manuscrita para los textos de la tele */
.tv-handdrawn,
.tv-handdrawn * {
  font-family: 'Patrick Hand', 'Comic Sans MS', cursive, sans-serif;
}

/* Contenedor principal de la tele */
.tv-handdrawn {
  position: relative;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 28px 26px 22px;
  border: 4px solid #1e272e;
  border-radius: 18px 22px 16px 24px / 24px 16px 22px 18px;
  background: #fff;
  box-shadow: 6px 6px 0 rgba(30, 39, 46, 0.15);
  transform: rotate(-0.6deg);
  transition: transform 0.3s ease;
}
.tv-handdrawn:hover {
  transform: rotate(0deg);
}

/* Antenas (orejas de conejo) — dibujadas con SVG inline */
.tv-antennas {
  position: absolute;
  top: -52px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 60px;
  pointer-events: none;
}

/* Pantalla (donde va el video / la miniatura) */
.tv-screen {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #1e272e;
  border: 4px solid #1e272e;
  border-radius: 8px 12px 6px 10px / 10px 6px 12px 8px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.4);
}
.tv-screen iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* FACADE: capa con la miniatura + botón play */
.tv-facade {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #000;
}
.tv-facade img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.tv-facade::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.45) 100%
  );
  pointer-events: none;
}
.tv-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: rgba(231, 111, 81, 0.95);
  border: 4px solid #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: transform 0.2s ease, background 0.2s ease;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}
.tv-play-btn:hover {
  transform: translate(-50%, -50%) scale(1.1);
  background: rgba(231, 111, 81, 1);
}
.tv-play-btn svg {
  width: 32px;
  height: 32px;
  fill: #fff;
  margin-left: 4px;
}

/* Etiqueta del título del video encima de la miniatura */
.tv-facade-label {
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
  color: #fff;
  font-size: 15px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  z-index: 2;
  pointer-events: none;
}

/* Link "Ver en YouTube" — respaldo siempre disponible */
.tv-yt-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  font-size: 13px;
  color: #1e272e;
  text-decoration: none;
  border: 2px dashed #1e272e;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.5);
  transition: background 0.2s ease;
}
.tv-yt-link:hover {
  background: #fff;
}
.tv-yt-link-wrap {
  text-align: center;
  margin-top: 8px;
}

/* Etiqueta arriba de la pantalla (canal / nombre) */
.tv-label {
  position: absolute;
  top: -2px;
  right: 10px;
  background: #fff;
  border: 3px solid #1e272e;
  border-radius: 50%;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: bold;
  color: #1e272e;
  z-index: 5;
  transform: rotate(8deg);
}

/* Botones de canal (cambiar de video) */
.tv-channels {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
.tv-channel-btn {
  font-family: 'Patrick Hand', cursive;
  font-size: 16px;
  padding: 8px 16px;
  border: 3px solid #1e272e;
  border-radius: 22px 14px 20px 12px / 14px 22px 12px 20px;
  background: #fff;
  color: #1e272e;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 3px 3px 0 rgba(30, 39, 46, 0.15);
  line-height: 1.2;
}
.tv-channel-btn:hover {
  transform: translate(-1px, -1px);
  box-shadow: 4px 4px 0 rgba(30, 39, 46, 0.2);
}
.tv-channel-btn.active {
  color: #fff;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(30, 39, 46, 0.2);
}

/* Título arriba de la tele */
.tv-title {
  text-align: center;
  font-size: 26px;
  color: #1e272e;
  margin-bottom: 4px;
  font-family: 'Patrick Hand', cursive;
  letter-spacing: 0.5px;
}
.tv-subtitle {
  text-align: center;
  font-size: 16px;
  color: #6b7280;
  margin-bottom: 18px;
  font-family: 'Patrick Hand', cursive;
}

/* Perillas decorativas abajo */
.tv-knobs {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 14px;
}
.tv-knob {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 3px solid #1e272e;
  position: relative;
}
.tv-knob::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  width: 3px;
  height: 8px;
  background: #1e272e;
  transform: translateX(-50%);
  border-radius: 2px;
}

/* ===== Variante COMPACTA (para columnas angostas, ej: widgets del index) ===== */
.tv-compact {
  max-width: 100%;
  padding: 18px 16px 14px;
  transform: rotate(-0.4deg);
}
.tv-compact .tv-antennas {
  top: -40px;
  width: 90px;
  height: 48px;
}
.tv-compact .tv-label {
  width: 40px;
  height: 40px;
  font-size: 17px;
}
.tv-compact .tv-channels {
  gap: 6px;
  margin-top: 14px;
}
.tv-compact .tv-channel-btn {
  font-size: 13px;
  padding: 6px 11px;
  box-shadow: 2px 2px 0 rgba(30, 39, 46, 0.15);
}
.tv-compact .tv-knobs {
  gap: 10px;
  margin-top: 10px;
}
.tv-compact .tv-knob {
  width: 16px;
  height: 16px;
}
.tv-compact .tv-yt-link {
  font-size: 11px;
  padding: 3px 8px;
}
.tv-compact .tv-facade-label {
  font-size: 13px;
  bottom: 6px;
}
.tv-compact .tv-play-btn {
  width: 52px;
  height: 52px;
  border-width: 3px;
}
.tv-compact .tv-play-btn svg {
  width: 22px;
  height: 22px;
}
.tv-handdrawn-wrap > p {
  display: none;
}

/* ===== Variantes de color (una por página) ===== */

/* Tele CORAL (index — personalidades) */
.tv-coral {
  background: #fff5f1;
}
.tv-coral .tv-channel-btn.active {
  background: #e76f51;
  border-color: #e76f51;
}
.tv-coral .tv-knob:nth-child(1) { background: #e76f51; }
.tv-coral .tv-knob:nth-child(2) { background: #2a9d8f; }
.tv-coral .tv-knob:nth-child(3) { background: #e9c46a; }
.tv-coral .tv-label {
  color: #e76f51;
  border-color: #e76f51;
}

/* Tele TEAL (historia) */
.tv-teal {
  background: #f0faf8;
}
.tv-teal .tv-channel-btn.active {
  background: #2a9d8f;
  border-color: #2a9d8f;
}
.tv-teal .tv-knob:nth-child(1) { background: #2a9d8f; }
.tv-teal .tv-knob:nth-child(2) { background: #e9c46a; }
.tv-teal .tv-knob:nth-child(3) { background: #e76f51; }
.tv-teal .tv-label {
  color: #2a9d8f;
  border-color: #2a9d8f;
}

/* Tele GOLD (cooperativa) */
.tv-gold {
  background: #fdf8ec;
}
.tv-gold .tv-channel-btn.active {
  background: #e9c46a;
  border-color: #e9c46a;
  color: #1e272e;
}
.tv-gold .tv-knob:nth-child(1) { background: #e9c46a; }
.tv-gold .tv-knob:nth-child(2) { background: #e76f51; }
.tv-gold .tv-knob:nth-child(3) { background: #2a9d8f; }
.tv-gold .tv-label {
  color: #c89930;
  border-color: #c89930;
}

/* Responsive */
@media (max-width: 640px) {
  .tv-handdrawn {
    padding: 22px 18px 18px;
  }
  .tv-title { font-size: 22px; }
  .tv-channel-btn { font-size: 14px; padding: 7px 12px; }
  .tv-label { width: 44px; height: 44px; font-size: 18px; }
  .tv-play-btn { width: 60px; height: 60px; }
  .tv-play-btn svg { width: 26px; height: 26px; }
}
