/* ===========================================================================
   THE NEXT LOOP — Sección del newsletter de CICLIC
   ---------------------------------------------------------------------------
   Va en la raíz del repo, junto a styles.css y conversa.css.
   Se carga DESPUÉS de styles.css para heredar los tokens de :root.

   Todo está acotado a #tnl-root y al prefijo .tnl-*, así que no puede afectar
   ningún otro estilo del sitio. A la inversa, aquí abajo se neutralizan las
   reglas globales de styles.css que sí afectarían a este bloque.

   Tema: oscuro, alineado con el resto del sitio.
   =========================================================================== */

#tnl-root {
  /* --- tokens: heredan de styles.css, con respaldo si cambia el orden ----- */
  --tnl-verde: var(--green, #59e721);
  --tnl-azul: var(--blue, #46b1e1);
  --tnl-linea: var(--line, rgba(255, 255, 255, .12));
  --tnl-panel: var(--panel, rgba(255, 255, 255, .04));

  --tnl-texto: rgba(255, 255, 255, .72);
  --tnl-texto-fuerte: #ffffff;
  --tnl-texto-tenue: rgba(255, 255, 255, .48);
  --tnl-radio: 20px;
  --tnl-radio-sm: 12px;

  /* El rail de marca es fijo y mide 72 px: se compensa igual que el resto
     de los bloques del sitio. */
  padding: 56px clamp(20px, 4vw, 64px) 96px calc(clamp(20px, 4vw, 64px) + 72px);
  color: var(--tnl-texto);
}

@media (max-width: 1080px) {
  #tnl-root { padding-left: clamp(20px, 4vw, 64px); }
}

/* --- neutralizar reglas globales de styles.css --------------------------- */
#tnl-root h1,
#tnl-root h2,
#tnl-root h3,
#tnl-root p { margin: 0; }

#tnl-root a { text-decoration: none; }

#tnl-root button {
  font: inherit;
  font-family: inherit;
  cursor: pointer;
}

/* --- contenedor ---------------------------------------------------------- */
.tnl-wrap {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

.tnl-card {
  background: var(--tnl-panel);
  border: 1px solid var(--tnl-linea);
  border-radius: var(--tnl-radio);
  overflow: hidden;
  backdrop-filter: blur(6px);
}

/* --- barra gradiente verde → azul (firma visual del newsletter) ---------- */
.tnl-barra {
  height: 5px;
  background: linear-gradient(90deg, #59e721 0%, #54dd4d 20%, #4fd37a 40%, #4ac9a7 60%, #48bdc4 80%, #46b1e1 100%);
}

/* --- header -------------------------------------------------------------- */
.tnl-header {
  padding: 52px 44px 34px;
  text-align: center;
  background:
    radial-gradient(120% 140% at 50% 0%, rgba(89, 231, 33, .09) 0%, transparent 62%),
    rgba(0, 0, 0, .35);
}

/* Con el logo en PNG el fondo pasa a negro plano. El archivo trae su propio
   fondo negro horneado: sobre el resplandor verde se vería el recuadro. */
.tnl-header.con-logo {
  background: #000;
  padding-top: 40px;
}

/* 380 px es el mismo tamaño al que se muestra en el correo. */
.tnl-logo-img {
  display: block;
  width: 100%;
  max-width: 380px;
  height: auto;
  margin: 0 auto;
}

@media (max-width: 680px) {
  .tnl-logo-img { max-width: 270px; }
}

#tnl-root [hidden] { display: none; }

/* Wordmark en texto. Carga instantáneo y es nítido en cualquier pantalla. */
.tnl-logo-text { display: block; }

.tnl-logo-text .tnl-logo-linea {
  display: block;
  font-size: clamp(30px, 5.6vw, 52px);
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.6px;
  color: var(--tnl-texto-fuerte);
  text-transform: uppercase;
}
.tnl-logo-text .tnl-logo-linea em {
  font-style: normal;
  background: linear-gradient(90deg, var(--tnl-verde), var(--tnl-azul));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tnl-logo-text .tnl-logo-tag {
  display: block;
  margin-top: 14px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 2.6px;
  text-transform: uppercase;
  color: var(--tnl-texto-tenue);
}

.tnl-meta {
  margin-top: 24px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--tnl-texto-tenue);
}
.tnl-meta .tnl-sep { opacity: .4; padding: 0 10px; }
.tnl-meta .tnl-fecha { color: var(--tnl-verde); }

/* --- hero / bienvenida --------------------------------------------------- */
.tnl-hero {
  padding: 34px 44px 38px;
  border-bottom: 1px solid var(--tnl-linea);
}
.tnl-hero .tnl-kicker {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tnl-azul);
  margin-bottom: 14px;
}
.tnl-hero .tnl-intro {
  font-size: 17px;
  line-height: 1.68;
  color: var(--tnl-texto);
}
.tnl-hero .tnl-intro strong { color: var(--tnl-texto-fuerte); font-weight: 600; }

/* --- etiqueta de sección ------------------------------------------------- */
.tnl-seccion {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 34px 44px 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--tnl-texto-fuerte);
}
.tnl-seccion::before {
  content: "";
  width: 28px;
  height: 3px;
  background: var(--tnl-verde);
  flex: 0 0 28px;
}

/* --- headlines ----------------------------------------------------------- */
.tnl-lista { padding: 0 44px; }

.tnl-item {
  display: flex;
  gap: 20px;
  padding: 28px 0 26px;
  border-bottom: 1px solid var(--tnl-linea);
}
.tnl-item:last-child { border-bottom: 0; padding-bottom: 10px; }

.tnl-num {
  flex: 0 0 46px;
  font-size: 28px;
  line-height: 1;
  font-weight: 800;
  padding-top: 2px;
  font-variant-numeric: tabular-nums;
}
.tnl-num.verde { color: var(--tnl-verde); }
.tnl-num.azul  { color: var(--tnl-azul); }

.tnl-cuerpo { min-width: 0; }

.tnl-cat {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.tnl-cat.verde { color: var(--tnl-verde); }
.tnl-cat.azul  { color: var(--tnl-azul); }

.tnl-titulo {
  font-size: 20px;
  line-height: 1.38;
  font-weight: 600;
  margin-bottom: 10px;
}
.tnl-titulo a {
  color: var(--tnl-texto-fuerte);
  background-image: linear-gradient(var(--tnl-verde), var(--tnl-verde));
  background-size: 0 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .25s ease;
}
.tnl-titulo a:hover,
.tnl-titulo a:focus-visible { background-size: 100% 2px; }

.tnl-resumen {
  font-size: 15.5px;
  line-height: 1.62;
  color: var(--tnl-texto);
  margin-bottom: 14px;
}

.tnl-leer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--tnl-azul);
  margin-bottom: 8px;
}
.tnl-leer .tnl-flecha { transition: transform .2s ease; }
.tnl-leer:hover .tnl-flecha,
.tnl-leer:focus-visible .tnl-flecha { transform: translateX(4px); }

.tnl-fuente {
  font-size: 12px;
  line-height: 1.5;
  color: var(--tnl-texto-tenue);
}

/* --- cierre -------------------------------------------------------------- */
.tnl-cierre {
  padding: 46px 44px 44px;
  text-align: center;
  margin-top: 30px;
  border-top: 1px solid var(--tnl-linea);
  background:
    radial-gradient(110% 150% at 50% 100%, rgba(70, 177, 225, .10) 0%, transparent 60%),
    rgba(0, 0, 0, .3);
}
.tnl-cierre h2 {
  font-size: 25px;
  line-height: 1.32;
  font-weight: 600;
  color: var(--tnl-verde);
  margin-bottom: 14px;
}
.tnl-cierre .tnl-cierre-texto {
  font-size: 15.5px;
  line-height: 1.68;
  color: var(--tnl-texto);
  max-width: 560px;
  margin: 0 auto 30px;
}

/* --- botones ------------------------------------------------------------- */
.tnl-acciones {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  align-items: center;
}

.tnl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  padding: 0 28px;
  border: 0;
  border-radius: var(--tnl-radio-sm);
  background: var(--tnl-verde);
  color: #000;
  font-size: 15px;
  font-weight: 700;
  transition: transform .15s ease, box-shadow .2s ease;
}
.tnl-btn:hover,
.tnl-btn:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(89, 231, 33, .28);
}
.tnl-btn:active { transform: translateY(0); }

.tnl-cierre-link {
  margin-top: 20px;
  font-size: 13.5px;
  color: var(--tnl-texto-tenue);
}
.tnl-cierre-link a { color: var(--tnl-azul); font-weight: 600; }
.tnl-cierre-link a:hover { text-decoration: underline; }

/* --- menú de compartir --------------------------------------------------- */
.tnl-share { position: relative; }

.tnl-share-menu {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(6px);
  min-width: 240px;
  background: #0b0b0b;
  border: 1px solid var(--tnl-linea);
  border-radius: 14px;
  padding: 8px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .6);
  opacity: 0;
  visibility: hidden;
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
  /* Por debajo del header sticky (z-index 20) del sitio. */
  z-index: 18;
  text-align: left;
}
.tnl-share.abierto .tnl-share-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}
.tnl-share-menu button,
.tnl-share-menu a {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 14px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--tnl-texto-fuerte);
  text-align: left;
}
.tnl-share-menu button:hover,
.tnl-share-menu a:hover,
.tnl-share-menu button:focus-visible,
.tnl-share-menu a:focus-visible { background: rgba(255, 255, 255, .07); }
.tnl-share-menu .tnl-ico { color: var(--tnl-verde); font-size: 13px; width: 16px; text-align: center; }

/* --- archivo histórico --------------------------------------------------- */
.tnl-archivo { margin-top: 58px; }

.tnl-archivo-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}
.tnl-archivo-head h2 {
  font-size: 22px;
  font-weight: 700;
  color: var(--tnl-texto-fuerte);
  letter-spacing: -0.2px;
}
.tnl-archivo-head p {
  font-size: 14px;
  color: var(--tnl-texto-tenue);
  margin-top: 6px;
}

.tnl-filtro { display: flex; align-items: center; gap: 8px; }
.tnl-filtro label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--tnl-texto-tenue);
}
.tnl-filtro select {
  font: inherit;
  font-size: 14px;
  padding: 9px 14px;
  border: 1px solid var(--tnl-linea);
  border-radius: 10px;
  background: rgba(255, 255, 255, .05);
  color: var(--tnl-texto-fuerte);
  cursor: pointer;
}
.tnl-filtro select option { background: #0b0b0b; color: #fff; }
.tnl-filtro select:focus-visible { outline: 2px solid var(--tnl-azul); outline-offset: 1px; }

.tnl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}

.tnl-edicion {
  display: block;
  background: var(--tnl-panel);
  border: 1px solid var(--tnl-linea);
  border-radius: 14px;
  padding: 20px;
  transition: border-color .2s ease, transform .15s ease, background-color .2s ease;
}
.tnl-edicion:hover,
.tnl-edicion:focus-visible {
  border-color: var(--tnl-verde);
  background: rgba(255, 255, 255, .07);
  transform: translateY(-2px);
}
.tnl-edicion[aria-current="page"] {
  border-color: var(--tnl-verde);
  background: rgba(89, 231, 33, .08);
}

.tnl-ed-num {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--tnl-verde);
  margin-bottom: 8px;
}
.tnl-ed-fecha {
  font-size: 16px;
  font-weight: 600;
  color: var(--tnl-texto-fuerte);
  margin-bottom: 8px;
}
.tnl-ed-resumen {
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--tnl-texto-tenue);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --- estados ------------------------------------------------------------- */
.tnl-estado {
  padding: 72px 32px;
  text-align: center;
  color: var(--tnl-texto-tenue);
  font-size: 15px;
}
.tnl-estado strong {
  display: block;
  color: var(--tnl-texto-fuerte);
  font-size: 17px;
  margin-bottom: 8px;
}

.tnl-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(12px);
  background: #0b0b0b;
  border: 1px solid var(--tnl-linea);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  border-radius: 11px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .6);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  /* Por encima del rail fijo (z-index 25) para que el aviso sea legible. */
  z-index: 40;
}
.tnl-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.tnl-sr {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 680px) {
  #tnl-root { padding-top: 36px; padding-bottom: 64px; }
  .tnl-header { padding: 36px 22px 28px; }
  .tnl-hero { padding: 28px 22px 32px; }
  .tnl-seccion { padding: 30px 22px 0; }
  .tnl-lista { padding: 0 22px; }
  .tnl-cierre { padding: 38px 22px 36px; }
  .tnl-item { gap: 14px; padding: 24px 0 22px; }
  .tnl-num { flex-basis: 34px; font-size: 22px; }
  .tnl-titulo { font-size: 18px; }
  .tnl-cierre h2 { font-size: 21px; }
  .tnl-acciones { flex-direction: column; }
  .tnl-btn, .tnl-share { width: 100%; max-width: 340px; }
  .tnl-share-menu { min-width: 100%; }
  .tnl-archivo-head { flex-direction: column; align-items: stretch; }
  .tnl-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  #tnl-root *, #tnl-root *::before, #tnl-root *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
}
