/* ==========================================================================
   Feed de TikTok propio (sustituye al widget de Elfsight)

   Archivo aparte a propósito: styles.css es la plantilla original y theme.css
   la capa de modernización. Esto es una pieza nueva y autocontenida, así que
   se puede quitar entera sin tocar nada más.

   Vive dentro de .social-feed-box, que ya aporta el fondo blanco y el radio.
   ========================================================================== */

.tiktok-grid {
  display: grid;
  /* auto-fill + minmax: 4 columnas en escritorio, 2 en tablet y 1 en móvil
     sin una sola media query. */
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}

.tiktok-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: #f6f8fa;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tiktok-card:hover,
.tiktok-card:focus {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(10, 37, 64, 0.18);
  text-decoration: none;
  color: inherit;
}

/* Foco visible para quien navega con teclado; el :hover de arriba no basta. */
.tiktok-card:focus-visible {
  outline: 3px solid #5ac4de;
  outline-offset: 2px;
}

.tiktok-card-media {
  position: relative;
  /* 9:16, la vertical nativa de TikTok. Reservar la proporción evita que la
     página salte cuando cargan las imágenes. */
  aspect-ratio: 9 / 16;
  background: #0a2540;
  overflow: hidden;
}

.tiktok-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.tiktok-card-sin-portada {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, #0a2540 0%, #103a5c 100%);
}

/* Triángulo de "play" dibujado con bordes: sin imagen ni fuente de iconos. */
.tiktok-card-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  margin: -11px 0 0 -7px;
  border-style: solid;
  border-width: 11px 0 11px 18px;
  border-color: transparent transparent transparent rgba(255, 255, 255, 0.92);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
  pointer-events: none;
}

.tiktok-card-duracion {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 600;
}

.tiktok-card-texto {
  margin: 0;
  padding: 10px 12px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #0a2540;
  /* Dos líneas como máximo: descripciones largas descuadran la rejilla. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tiktok-pie {
  margin-top: 24px;
  text-align: center;
}

/* Estado sin vídeos: nunca se deja la sección vacía. */
.tiktok-fallback {
  padding: 28px 16px;
  text-align: center;
  color: #425466;
}

.tiktok-fallback p {
  margin: 0 0 16px;
  font-size: 15px;
}

/* Mientras carga, el hueco ya tiene altura: sin esto la home daría un salto. */
.tiktok-cargando {
  min-height: 200px;
}

@media (max-width: 480px) {
  .tiktok-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
}

/* Modo oscuro: theme.css marca la raíz, aquí solo se ajustan los tonos. */
[data-theme='dark'] .tiktok-card {
  background: #16202c;
}

[data-theme='dark'] .tiktok-card-texto {
  color: #d7e2ec;
}

[data-theme='dark'] .tiktok-fallback {
  color: #a8b6c4;
}
