/*
 * ft-impacto · concentrador de fotos y vídeo (VII ForoTelecos Galicia)
 *
 * Paleta del evento: azul #073059 y cian #04BCE4. El cian solo se usa como
 * FONDO de botón con texto azul (contraste ≈ 6:1) y nunca como texto o borde
 * sobre blanco (≈ 2:1, no cumple AA). Tipografía heredada del tema.
 *
 * Todo cuelga de .ftimp-fotos / .ftimp-video y los botones se resetean a
 * mano: los temas de Elementor estilan `button` y `[type=button]` con
 * especificidad suficiente para estropearlos si no se pisa.
 */

.ftimp-fotos,
.ftimp-video {
  --ftimp-azul: #073059;
  --ftimp-azul-2: #0a3f73;
  --ftimp-cian: #04bce4;
  --ftimp-cian-2: #37cdef;
  --ftimp-texto: #0b2239;
  --ftimp-suave: #eaf2fa;
  --ftimp-borde: #9fb3c8;
  --ftimp-hueco: #dce6f0;
  --ftimp-radio: 10px;
  font: inherit;
  color: var(--ftimp-texto);
  line-height: 1.45;
}

.ftimp-fotos *,
.ftimp-fotos *::before,
.ftimp-fotos *::after {
  box-sizing: border-box;
}

/* Solo lector de pantalla. */
.ftimp-sr {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* `hidden` debe ganar a cualquier display que pongamos más abajo. */
.ftimp-fotos [hidden],
.ftimp-video [hidden] {
  display: none !important;
}

.ftimp-fotos .ftimp-ico {
  flex: none;
  display: block;
}

.ftimp-fotos .ftimp-aviso {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border: 2px dashed var(--ftimp-azul);
  border-radius: var(--ftimp-radio);
  color: var(--ftimp-azul);
}

/* ---------- Filtros ---------- */

.ftimp-fotos .ftimp-filtros {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
}

.ftimp-fotos .ftimp-chip {
  position: relative;
  display: inline-flex;
  margin: 0;
}

/* El radio real queda encima, invisible: recibe foco y clics, y su estado
   :checked / :focus-visible se pinta en el <span> hermano. */
.ftimp-fotos .ftimp-chip input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.ftimp-fotos .ftimp-chip span {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.45rem 1rem;
  border: 2px solid var(--ftimp-azul);
  border-radius: 999px;
  background: #fff;
  color: var(--ftimp-azul);
  font-weight: 600;
  line-height: 1.2;
}

.ftimp-fotos .ftimp-chip b {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
}

.ftimp-fotos .ftimp-chip input:checked + span {
  background: var(--ftimp-azul);
  color: #fff;
}

.ftimp-fotos .ftimp-chip input:focus-visible + span {
  outline: 3px solid var(--ftimp-azul);
  outline-offset: 3px;
}

.ftimp-fotos .ftimp-estado {
  margin: 0 0 1rem;
  font-size: 0.9em;
}

/* ---------- Botones ---------- */

.ftimp-fotos .ftimp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.15rem 0.5rem;
  min-height: 44px;
  margin: 0;
  padding: 0.5rem 1rem;
  border: 2px solid var(--ftimp-azul);
  border-radius: 8px;
  background: #fff;
  box-shadow: none;
  color: var(--ftimp-azul);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  letter-spacing: normal;
  text-align: center;
  text-decoration: none;
  text-transform: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ftimp-fotos .ftimp-btn:hover {
  background: var(--ftimp-suave);
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-btn-pri,
.ftimp-fotos .ftimp-btn-pri:visited {
  background: var(--ftimp-azul);
  color: #fff;
}

.ftimp-fotos .ftimp-btn-pri:hover {
  background: var(--ftimp-azul-2);
  color: #fff;
}

.ftimp-fotos .ftimp-btn-max,
.ftimp-fotos .ftimp-btn-max:visited {
  border-color: var(--ftimp-cian);
  background: var(--ftimp-cian);
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-btn-max:hover {
  border-color: var(--ftimp-cian-2);
  background: var(--ftimp-cian-2);
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-btn:focus-visible,
.ftimp-fotos .ftimp-foto:focus-visible,
.ftimp-fotos .ftimp-nav:focus-visible,
.ftimp-fotos .ftimp-v-cerrar:focus-visible {
  outline: 3px solid var(--ftimp-azul);
  outline-offset: 3px;
}

.ftimp-fotos .ftimp-hasta {
  flex-basis: 100%;
  font-size: 0.8em;
  font-weight: 500;
}

/* ---------- Descargas por set ---------- */

.ftimp-fotos .ftimp-descargas {
  display: grid;
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.ftimp-fotos .ftimp-set {
  padding: 0.9rem 1rem;
  border: 1px solid var(--ftimp-borde);
  border-radius: var(--ftimp-radio);
  background: var(--ftimp-suave);
}

.ftimp-fotos .ftimp-set-t {
  margin: 0 0 0.6rem;
}

.ftimp-fotos .ftimp-set-t span {
  display: inline-block;
  font-size: 0.9em;
}

.ftimp-fotos .ftimp-set-b {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0;
}

/* ---------- Cuadrícula ---------- */

.ftimp-fotos .ftimp-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 0.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Móvil estrecho: 150 px mínimos darían una sola columna; fijamos dos. */
@media (max-width: 420px) {
  .ftimp-fotos .ftimp-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.4rem;
  }
}

.ftimp-fotos .ftimp-celda {
  margin: 0;
  padding: 0;
  list-style: none;
  aspect-ratio: 3 / 2;
}

.ftimp-fotos .ftimp-foto {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: var(--ftimp-hueco);
  box-shadow: none;
  overflow: hidden;
  cursor: zoom-in;
  -webkit-appearance: none;
  appearance: none;
}

.ftimp-fotos .ftimp-foto img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

.ftimp-fotos .ftimp-foto:hover img {
  opacity: 0.88;
}

/* ---------- Visor ---------- */

.ftimp-fotos .ftimp-visor {
  position: fixed;
  inset: 0;
  z-index: 999999;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: #04172b;
  color: #fff;
  overflow: hidden;
  overscroll-behavior: contain;
}

@supports (height: 100dvh) {
  .ftimp-fotos .ftimp-visor {
    height: 100dvh;
  }
}

.ftimp-fotos .ftimp-visor:not([open]) {
  display: none;
}

.ftimp-fotos .ftimp-visor[open] {
  display: flex;
  flex-direction: column;
}

.ftimp-fotos .ftimp-visor:focus {
  outline: none; /* tabindex=-1: recibe el foco al pulsar sobre la foto; no es un control */
}

.ftimp-fotos .ftimp-visor::backdrop {
  background: #04172b;
}

html.ftimp-sin-scroll {
  overflow: hidden;
}

.ftimp-fotos .ftimp-visor-barra {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0.75rem 0.35rem 1rem;
}

.ftimp-fotos .ftimp-visor-cont {
  margin: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ftimp-fotos .ftimp-v-cerrar,
.ftimp-fotos .ftimp-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0;
  border: 0;
  background: rgba(255, 255, 255, 0.14);
  box-shadow: none;
  color: #fff;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.ftimp-fotos .ftimp-v-cerrar:hover,
.ftimp-fotos .ftimp-nav:hover {
  background: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.ftimp-fotos .ftimp-v-cerrar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.ftimp-fotos .ftimp-visor .ftimp-v-cerrar:focus-visible,
.ftimp-fotos .ftimp-visor .ftimp-nav:focus-visible,
.ftimp-fotos .ftimp-visor .ftimp-btn:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

.ftimp-fotos .ftimp-visor-escena {
  position: relative;
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}

.ftimp-fotos .ftimp-visor-fig {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  /* La miniatura (ya en caché) hace de marcador mientras llega la grande. */
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  touch-action: pan-y pinch-zoom;
}

.ftimp-fotos .ftimp-visor-img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  max-width: none;
  object-fit: contain;
  transition: opacity 0.18s ease;
}

.ftimp-fotos .ftimp-visor-fig.ftimp-cargando .ftimp-visor-img {
  opacity: 0;
}

.ftimp-fotos .ftimp-visor-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 1rem;
  text-align: center;
}

.ftimp-fotos .ftimp-nav {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 48px;
  height: 72px;
  transform: translateY(-50%);
}

.ftimp-fotos .ftimp-nav-ant {
  left: 0;
  border-radius: 0 10px 10px 0;
}

.ftimp-fotos .ftimp-nav-sig {
  right: 0;
  border-radius: 10px 0 0 10px;
}

.ftimp-fotos .ftimp-nav[aria-disabled='true'] {
  opacity: 0.3;
  cursor: default;
}

.ftimp-fotos .ftimp-visor-pie {
  flex: none;
  margin: 0;
  padding: 0.4rem 1rem 0;
  text-align: center;
  font-size: 0.9em;
  overflow-wrap: anywhere;
}

.ftimp-fotos .ftimp-visor-acciones {
  display: flex;
  flex: none;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem calc(0.75rem + env(safe-area-inset-bottom, 0px));
}

/* Botones del visor sobre fondo oscuro. */
.ftimp-fotos .ftimp-visor .ftimp-btn {
  border-color: #fff;
  background: transparent;
  color: #fff;
}

.ftimp-fotos .ftimp-visor .ftimp-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.ftimp-fotos .ftimp-visor .ftimp-btn-pri,
.ftimp-fotos .ftimp-visor .ftimp-btn-pri:visited {
  border-color: #fff;
  background: #fff;
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-visor .ftimp-btn-pri:hover {
  background: var(--ftimp-suave);
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-visor .ftimp-btn-max,
.ftimp-fotos .ftimp-visor .ftimp-btn-max:visited {
  border-color: var(--ftimp-cian);
  background: var(--ftimp-cian);
  color: var(--ftimp-azul);
}

.ftimp-fotos .ftimp-visor .ftimp-btn-max:hover {
  border-color: var(--ftimp-cian-2);
  background: var(--ftimp-cian-2);
  color: var(--ftimp-azul);
}

@media (max-width: 480px) {
  .ftimp-fotos .ftimp-nav {
    width: 40px;
    height: 64px;
  }

  .ftimp-fotos .ftimp-visor-acciones .ftimp-btn {
    flex: 1 1 100%;
  }
}

/* ---------- Vídeo [ftimp_video] ---------- */

.ftimp-video {
  margin: 0 0 1.5rem;
}

.ftimp-video video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  background: #000;
}

.ftimp-video video:focus-visible {
  outline: 3px solid var(--ftimp-azul);
  outline-offset: 3px;
}

.ftimp-video figcaption {
  margin-top: 0.5rem;
  font-size: 0.9em;
}

.ftimp-video .ftimp-aviso {
  margin: 0;
  padding: 0.75rem 1rem;
  border: 2px dashed var(--ftimp-azul);
  border-radius: var(--ftimp-radio);
  color: var(--ftimp-azul);
}

/* ---------- Preferencias del usuario ---------- */

@media (prefers-reduced-motion: reduce) {
  .ftimp-fotos *,
  .ftimp-fotos *::before,
  .ftimp-fotos *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .ftimp-fotos .ftimp-chip span,
  .ftimp-fotos .ftimp-btn,
  .ftimp-fotos .ftimp-foto,
  .ftimp-fotos .ftimp-nav,
  .ftimp-fotos .ftimp-v-cerrar {
    border: 2px solid ButtonText;
  }

  .ftimp-fotos .ftimp-chip input:checked + span {
    border-color: Highlight;
    forced-color-adjust: none;
    background: Highlight;
    color: HighlightText;
  }
}

/* El tema (Astra) subraya TODOS los enlaces del contenido con más especificidad que `.ftimp-btn`: los botones no llevan subrayado (24-oct-2026). */
body .ftimp-fotos a.ftimp-btn,
body .ftimp-fotos a.ftimp-btn:visited,
body .ftimp-fotos a.ftimp-btn:hover,
body .ftimp-fotos a.ftimp-btn:focus {
  text-decoration: none;
}
