/* Popup configurable + página de cada material. Colores del tema (_variables.scss):
   azul #0c7599, turquesa #65aec0, morado #7363a9, gris #7f7f80 */

/* Botones/enlaces propios con la tipografía del tema (los <button>/<a> no la heredan) */
.tf-popup__button,
.tf-material__btn,
.tf-material__back,
.tf-material__tag,
.tf-copy-link,
.tf-material-share__more {
  font-family: "HelveticaNeue-Medium", "Helvetica Neue", Helvetica, Arial, sans-serif;
  letter-spacing: 0.02em;
}

/* ---------------------------------------------------------------- Popup */
html.tf-popup-open { overflow: hidden; }

.tf-popup {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.tf-popup[hidden] { display: none; }

.tf-popup__overlay {
  position: absolute;
  inset: 0;
  background: rgba(12, 41, 56, 0.55);
  animation: tf-fade 0.25s ease both;
}

.tf-popup__dialog {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
  animation: tf-pop 0.3s ease both;
  outline: none;
}

.tf-popup__close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  color: #0c7599;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: transform 0.2s ease;
}
.tf-popup__close:hover { transform: rotate(90deg); }
.tf-popup__close svg { width: 18px; height: 18px; }

.tf-popup__img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 16px 16px 0 0;
}

.tf-popup__body {
  display: grid;
  gap: 12px;
  padding: 28px 28px 30px;
  text-align: center;
}
.tf-popup__title { margin: 0; color: #0c7599; }
.tf-popup__text { color: #636363; }
.tf-popup__text p { margin: 0 0 8px; }
.tf-popup__text p:last-child { margin-bottom: 0; }

.tf-popup__button,
.tf-material__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  justify-self: center;
  min-height: 46px;
  padding: 0 28px;
  border: 1px solid #7363a9;
  border-radius: 2rem;
  background: #7363a9;
  color: #fff !important;
  font-size: 1rem;
  line-height: 1;
  text-decoration: none !important;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease;
}
.tf-popup__button:hover,
.tf-material__btn:hover { background: #0c7599; border-color: #0c7599; }
.tf-popup__button { margin-top: 6px; }

@keyframes tf-fade { from { opacity: 0; } }
@keyframes tf-pop { from { opacity: 0; transform: translateY(16px) scale(0.98); } }
@media (prefers-reduced-motion: reduce) {
  .tf-popup__overlay, .tf-popup__dialog { animation: none; }
}

/* ---------------------------------------------------- Botón copiar enlace */
.tf-copy-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid #0c7599;
  border-radius: 2rem;
  background: #fff;
  color: #0c7599;
  font-size: 0.9rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.tf-copy-link svg { width: 18px; height: 18px; flex: none; }
.tf-copy-link:hover { background: #0c7599; color: #fff; }
.tf-copy-link.is-copied { background: #9acfae; border-color: #9acfae; color: #fff; }

/* -------------------------------------------- Listado de materiales */
.tf-material-link { color: inherit; text-decoration: none; }
.tf-material-link:hover { color: #0c7599; text-decoration: underline; }
.tf-material-share {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.tf-material-share .tf-copy-link { min-height: 38px; padding: 0 16px; font-size: 0.85rem; }
.tf-material-share__more {
  color: #0c7599;
  font-size: 0.9rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ---------------------------------------------- Página de un material */
.tf-material { padding: 40px 0 80px; background: rgba(101, 174, 192, 0.08); }
.tf-material__inner {
  width: calc(100% - 32px);
  max-width: 1060px;
  margin: 0 auto;
  display: grid;
  gap: 24px;
}
.tf-material__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  color: #0c7599;
  text-decoration: none;
}
.tf-material__back svg { width: 18px; height: 18px; }
.tf-material__back:hover { text-decoration: underline; }

.tf-material__card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  padding: 24px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(12, 117, 153, 0.08);
}
@media (min-width: 992px) {
  .tf-material__card { grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 48px; padding: 40px; }
}

.tf-material__media { position: relative; display: block; margin: 0; }
.tf-material__media img { display: block; width: 100%; height: auto; border-radius: 12px; }
.tf-material__media.__video .__icon {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 72px;
  height: auto;
  transform: translate(-50%, -50%);
  border-radius: 0;
}

.tf-material__info { display: grid; align-content: start; gap: 14px; min-width: 0; }
.tf-material__tags { display: flex; flex-wrap: wrap; gap: 8px; }
.tf-material__tag {
  padding: 4px 12px;
  border-radius: 2rem;
  background: #65aec0;
  color: #fff;
  font-size: 0.8rem;
  text-transform: uppercase;
}
.tf-material__tag.__cat { background: #968cbb; }
.tf-material__date { margin: 0; color: #7f7f80; }
.tf-material__title { margin: 0; color: #0c7599; }
.tf-material__descr, .tf-material__content { color: #636363; }

.tf-material__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }
.tf-material__btn.__outline { background: #fff; color: #7363a9 !important; }
.tf-material__btn.__outline:hover { background: #7363a9; color: #fff !important; }
