/* Galería pública en single post — feature 016, T3: descarga jerarquizada.
   Cada adjunto pasa de una fila de texto con emoji a una fila con
   affordance clara de acción — icono + nombre/tipo/peso + botón
   "Descargar" — visible en la parte alta del documento (llega vía
   `the_content`, Modules/*/Frontend.php::appendGallery). */
.ugel-file-gallery--public {
  margin: 2rem 0 1.5rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.ugel-file-gallery__title {
  margin: 0 0 0.85rem;
  font-family: var(--ugel-font-display);
  font-weight: var(--ugel-fw-heading);
  font-size: 1.2rem;
  color: var(--ugel-ink);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--ugel-border);
}

.ugel-file-gallery__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ugel-file-gallery--public .ugel-file-gallery__item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0.5rem;
  background: transparent;
  border: 0;
  border-radius: 0;
  transition: background-color 0.15s ease;
}

.ugel-file-gallery--public .ugel-file-gallery__item + .ugel-file-gallery__item {
  border-top: 1px solid var(--ugel-border);
}

.ugel-file-gallery--public .ugel-file-gallery__item:hover {
  background: var(--ugel-sand);
  box-shadow: none;
  transform: none;
}

/* 021: the icon is now the colored SVG from FileIcons (32×36 intrinsic), not
   an emoji — the old font-size sizing was dead weight. The svg scales to the
   wrapper so the 28px mobile width can't overflow (review finding, T3). */
.ugel-file-gallery__icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
}
.ugel-file-gallery__icon svg {
  width: 100%;
  height: auto;
}

/* Bloque nombre + tipo/peso — ocupa el espacio disponible entre el icono
   y el botón de descarga. */
.ugel-file-gallery__info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.ugel-file-gallery__name {
  color: var(--ugel-ink);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.45;
  word-break: break-word;
}

.ugel-file-gallery__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Badge de tipo (extensión → PDF/DOCX/XLSX/…, `FileGallery::
   fileTypeLabel()`) — SIEMPRE presente, nunca hueco (fallback "ARCHIVO"
   para extensión desconocida/ausente). */
.ugel-file-gallery__type {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  border-radius: var(--ugel-r8);
  background: var(--ugel-sand);
  color: var(--ugel-ink);
  font-size: var(--ugel-fs-xs);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Peso legible (`FileGallery::humanFileSize()`) — CONDICIONAL: el template
   ya no renderiza este `<span>` cuando el filesize no está disponible. */
.ugel-file-gallery__weight {
  color: var(--ugel-muted);
  font-size: var(--ugel-fs-sm);
}

/* Affordance de botón — mismo lenguaje visual que
   `.ugel-ultimos-contrataciones__download` (azul/blanco, r8, hover a ink)
   para consistencia de "acción de descarga" en todo el sitio. */
.ugel-file-gallery__download {
  flex-shrink: 0;
  padding: 0.5rem 1rem;
  background: var(--ugel-blue);
  color: var(--ugel-white);
  border-radius: var(--ugel-r8);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  transition: background-color 0.15s ease;
}

.ugel-file-gallery__download:hover {
  background: var(--ugel-ink);
  color: var(--ugel-white);
}

.ugel-file-gallery__download:focus-visible {
  outline: 2px solid var(--ugel-gold);
  outline-offset: 2px;
}

/* `Frontend::appendGallery()` envuelve la galería en
   `.ugel-scope.ugel-post-content` — ese wrapper fuerza `color`/
   `text-decoration` de CUALQUIER `<a>` con `!important` (post-content.css,
   pensado para links de texto dentro del cuerpo del post). Sin este
   override el botón queda blanco-sobre-azul forzado a AZUL-sobre-azul —
   texto invisible (bug real, cazado en la verificación E2E del clon,
   feature 016 T3). Gana por especificidad (3 clases > 2 clases + tag) +
   `!important` para empatar la regla que se está ganando. */
.ugel-scope.ugel-post-content .ugel-file-gallery__download,
.ugel-scope.ugel-post-content .ugel-file-gallery__download:link,
.ugel-scope.ugel-post-content .ugel-file-gallery__download:visited {
  color: var(--ugel-white) !important;
  text-decoration: none !important;
}

.ugel-scope.ugel-post-content .ugel-file-gallery__download:hover {
  color: var(--ugel-white) !important;
}

@media (max-width: 600px) {
  .ugel-file-gallery--public .ugel-file-gallery__item {
    padding: 0.85rem 0.4rem;
    gap: 0.65rem;
  }
  .ugel-file-gallery__icon {
    width: 28px;
  }
  .ugel-file-gallery__name {
    font-size: 0.95rem;
  }
  .ugel-file-gallery__download {
    padding: 0.45rem 0.75rem;
    font-size: 0.8rem;
  }
}

/* Admin metabox */
.ugel-file-gallery--admin {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.ugel-file-gallery--admin .ugel-file-gallery__item {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 0.4rem;
  align-items: center;
  padding: 0.4rem 0.5rem;
  background: #fff;
  border: 1px solid #c3c4c7;
  border-radius: 4px;
  font-size: 0.85rem;
}

.ugel-file-gallery--admin .ugel-file-gallery__name {
  text-decoration: none;
  color: #1d2327;
  word-break: break-word;
}

.ugel-file-gallery--admin .ugel-file-gallery__name:hover {
  color: #2271b1;
}

.ugel-file-gallery__empty {
  color: var(--ugel-muted);
  font-style: italic;
  margin: 0.5rem 0;
}
