/*
 * Reportes sismológicos de colaboradores (2026-11-21): el listado
 * (reportes-sismologicos.php), cada reporte (reporte.php) y su visor de
 * imágenes (js/reportes.js). Archivo propio, no dentro de css/styles.css,
 * para no tener que subir el ?v= de styles.css en todas las páginas: solo lo
 * cargan estas dos.
 *
 * Usa los tokens de css/styles.css (--bg-elev, --border, --text, --accent...),
 * así que sigue solo el tema claro/oscuro del sitio.
 */

:root {
  --rep-vt-verde: var(--source-geofon, #4cd074);
  --rep-vt-azul: #4fc3f7;
  --rep-vt-naranja: var(--warning, #ffb03f);
  --rep-vt-rojo: var(--danger, #ff5a6e);
}
:root[data-theme="light"] { --rep-vt-azul: #09639a; }

/* Colores del editor visual del panel (ver includes/html_seguro.php). */
.vtxt-acento { color: var(--accent); }
.vtxt-verde { color: var(--rep-vt-verde); }
.vtxt-azul { color: var(--rep-vt-azul); }
.vtxt-naranja { color: var(--rep-vt-naranja); }
.vtxt-rojo { color: var(--rep-vt-rojo); }

/* Más anchas que una página de texto común (pedido del usuario, 2026-11-21).
   En reporte.php el ancho extra se usa con dos columnas: el hilo a la
   izquierda y los sismos y el autor al costado, así el texto justificado no
   queda con líneas demasiado largas para leer. */
/* Mismo ancho que avisos-tsunami.php (main.tsunami-page), pedido del usuario. */
main.reportes-page { max-width: 1220px; }
main.reporte-page { max-width: 1220px; }

.reporte-layout { display: grid; grid-template-columns: 1fr; gap: 0 32px; align-items: start; }
.reporte-lateral .reporte-seccion:first-child { margin-top: 28px; }
.reporte-lateral .reporte-nota { margin-top: 16px; }
@media (min-width: 980px) {
  .reporte-layout { grid-template-columns: minmax(0, 1fr) 360px; }
  .reporte-lateral .reporte-seccion:first-child { margin-top: 0; }
  .reporte-lateral .reporte-autor-ficha { flex-direction: column; }
}

/* Texto de los reportes: JUSTIFICADO y SIN dividir palabras en sílabas (los
   dos, pedidos del usuario el 2026-11-21). hyphens: manual = solo corta
   donde el texto trae un guion propio. */
.reporte-justificado,
.reporte-post-texto {
  text-align: justify;
  hyphens: manual;
  -webkit-hyphens: manual;
  overflow-wrap: break-word;
}

/* «Reporte automatizado»: junto al autor de los reportes de un colaborador
   automatizado (colaboradores.reportes_automatizados), para que el
   visitante sepa que no lo escribió una persona. */
.reporte-etiqueta-auto {
  display: inline-block;
  vertical-align: middle;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  white-space: nowrap;
  cursor: help;
}

/* ---------- Listado ---------- */

.reportes-lista { list-style: none; margin: 24px 0 28px; padding: 0; display: grid; gap: 18px; }

.reporte-tarjeta {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}
.reporte-tarjeta.sin-imagen { grid-template-columns: 1fr; }
.reporte-tarjeta-autor { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.reporte-tarjeta-autor .reporte-avatar { width: 36px; height: 36px; font-size: 15px; }
.reporte-tarjeta-autor small { display: block; color: var(--text-dim); font-size: 12.5px; }
.reporte-tarjeta h2 { font-size: 19px; line-height: 1.35; margin: 0 0 8px; }
.reporte-tarjeta h2 a { color: var(--text); text-decoration: none; }
.reporte-tarjeta h2 a:hover, .reporte-tarjeta h2 a:focus-visible { color: var(--accent); text-decoration: underline; }
.reporte-tarjeta-resumen { margin: 0 0 12px; color: var(--text-dim); line-height: 1.65; font-size: 15px; }
.reporte-tarjeta-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12.5px; color: var(--text-dim); }
.reporte-tarjeta-img {
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 4 / 3;
  align-self: start;
  background: var(--bg);
}
.reporte-tarjeta-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reporte-leer { display: inline-block; margin-top: 12px; font-weight: 600; }

/* Pastilla de un sismo relacionado: magnitud (con el color de la escala del
   sitio), escala y fuente. */
.reporte-sismo-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 10px 2px 3px;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--bg);
}
.reporte-mag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  color: #0b0f17;
}

.reportes-vacio {
  text-align: center;
  padding: 48px 20px;
  margin-top: 24px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
}

/* Paginación: mismo aspecto que la de avisos-tsunami.php. */
.reportes-paginacion { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin: 28px 0 8px; }
.reportes-paginacion a,
.reportes-paginacion span {
  min-width: 40px;
  min-height: 40px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.reportes-paginacion a:hover, .reportes-paginacion a:focus-visible { border-color: var(--accent); color: var(--accent); }
.reportes-paginacion [aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #0b0f17; font-weight: 700; }
.reportes-paginacion .deshabilitado { opacity: .45; }
.reportes-paginacion-info { text-align: center; color: var(--text-dim); font-size: 13px; margin: 0; }

/* ---------- Un reporte: el hilo ---------- */

.reporte-volver { display: inline-block; margin-bottom: 12px; font-size: 14px; }
.reporte-titulo { font-size: 28px; line-height: 1.25; margin: 0 0 8px; }
.reporte-cabecera-meta { color: var(--text-dim); font-size: 14px; margin: 0 0 24px; }

.reporte-hilo-caja {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 22px 18px;
}

.reporte-hilo { list-style: none; margin: 0; padding: 0; }
.reporte-post { display: flex; gap: 12px; }
.reporte-post-avatar { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; }
.reporte-post-linea { flex: 1; width: 2px; background: var(--border); margin: 4px 0; min-height: 12px; }
.reporte-post-cuerpo { flex: 1; min-width: 0; padding-bottom: 26px; }
.reporte-post:last-child .reporte-post-cuerpo { padding-bottom: 0; }
.reporte-post-autor { display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; font-size: 15px; }
.reporte-post-usuario { color: var(--text-dim); }
.reporte-post-num { color: var(--text-dim); font-size: 13px; margin-left: auto; }
.reporte-post-texto { font-size: 16.5px; line-height: 1.75; color: var(--text); }
.reporte-post-texto p { margin: 0 0 .75em; }
.reporte-post-texto p:last-child { margin-bottom: 0; }
.reporte-post-texto ul, .reporte-post-texto ol { margin: 0 0 .75em; padding-left: 1.4em; text-align: left; }
.reporte-post-texto code { background: var(--bg); border: 1px solid var(--border); border-radius: 4px; padding: 0 4px; font-size: .92em; }

.reporte-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.reporte-avatar-vacio { background: var(--bg); border: 1px solid var(--border); color: var(--text-dim); font-weight: 700; font-size: 18px; }

/* Grilla de 1 a 4 imágenes, mismas proporciones que X: una en 16:9, dos lado
   a lado, tres con la primera alta a la izquierda, cuatro en 2x2. */
.reporte-grilla {
  display: grid;
  gap: 2px;
  margin-top: 12px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 16 / 9;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.reporte-grilla-1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.reporte-grilla-2 { grid-template-rows: 1fr; }
.reporte-grilla-3 .reporte-grilla-item:first-child { grid-row: span 2; }
.reporte-grilla-item { display: block; min-height: 0; background: var(--bg); cursor: zoom-in; }
.reporte-grilla-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.reporte-grilla-item:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }

/* Sismos relacionados: la MISMA tarjeta que el listado del monitor
   (.quake-card, .quake-mag, .source-badge... de css/styles.css; pedido del
   usuario). Acá solo se adapta a que es un <button> (abre la ventana del
   sismo) y se le da la caja del panel del monitor. */
.reporte-seccion { margin-top: 28px; }
.reporte-seccion h2 { font-size: 18px; margin: 0 0 12px; }
.reporte-sismos {
  list-style: none;
  margin: 0;
  padding: 6px;
  display: grid;
  gap: 2px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.reporte-sismo-card {
  width: 100%;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
}
.reporte-sismo-card .quake-mag { cursor: pointer; }
.reporte-sismo-card .quake-time { text-align: right; }
.reporte-sismo-card .quake-time-ago,
.reporte-sismo-card .quake-time-abs { display: block; }
.reporte-sismo-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.reporte-sismo-chip .source-badge { font-size: 10.5px; padding: 1px 6px; }

/* ---------- Ventana de un sismo relacionado (js/reportes.js) ---------- */
/* Se abre encima del reporte para no salir de la página: datos del sismo,
   mapa del epicentro y enlace a la ficha de la red. */
.reporte-sismo-ventana {
  position: fixed;
  inset: 0;
  z-index: 5000;
  background: rgba(5, 8, 14, .72);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.reporte-sismo-ventana[hidden] { display: none; }
.reporte-sismo-dialogo {
  position: relative;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.reporte-sismo-cabecera {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 56px 14px 18px;
  border-bottom: 1px solid var(--border);
}
.reporte-sismo-cabecera .quake-mag { cursor: default; flex-shrink: 0; }
.reporte-sismo-cabecera h2 { font-size: 17px; line-height: 1.3; margin: 0 0 4px; }
.reporte-sismo-cerrar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.reporte-sismo-cerrar:hover, .reporte-sismo-cerrar:focus-visible { border-color: var(--accent); color: var(--accent); outline: none; }
.reporte-sismo-datos {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0;
  padding: 14px 18px;
}
.reporte-sismo-datos dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); }
.reporte-sismo-datos dd { margin: 2px 0 0; font-size: 14.5px; }
#reporteSismoMapa { width: 100%; height: 280px; background: #0d1420; }
#reporteSismoMapa .leaflet-control-attribution a { color: #0078a8; }
.reporte-sismo-pie { padding: 12px 18px 16px; font-size: 14px; }
.reporte-sismo-pie p { margin: 0; color: var(--text-dim); font-size: 12.5px; }
/* La ventana se agrega al <body>, fuera de .content-page: el color de enlace
   del sitio no le llega solo. */
.reporte-sismo-pie a { font-weight: 600; color: var(--accent); text-decoration: none; }
.reporte-sismo-pie a:hover, .reporte-sismo-pie a:focus-visible { text-decoration: underline; }
body.reporte-sismo-abierta { overflow: hidden; }

.reporte-autor-ficha {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.reporte-autor-ficha .reporte-avatar { width: 64px; height: 64px; font-size: 24px; }
.reporte-autor-ficha p { margin: 4px 0 8px; color: var(--text-dim); }
.reporte-autor-enlaces { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 14px; }

.reporte-nota {
  margin-top: 28px;
  font-size: 13px;
  color: var(--text-dim);
  border-left: 3px solid var(--accent);
  padding: 8px 14px;
  background: var(--bg-elev);
  border-radius: 0 10px 10px 0;
}

/* ---------- Visor de imágenes (js/reportes.js) ---------- */

.reporte-visor {
  position: fixed;
  inset: 0;
  /* Por encima de todo el sitio: el encabezado fijo usa 2100 y el selector
     de fechas 3000 (css/styles.css). */
  z-index: 5000;
  background: rgba(5, 8, 14, .94);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 56px 12px 20px;
  touch-action: pan-y;
}
.reporte-visor[hidden] { display: none; }
.reporte-visor-img {
  max-width: 100%;
  max-height: calc(100vh - 140px);
  max-height: calc(100dvh - 140px);
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, .6);
  user-select: none;
}
.reporte-visor-pie { color: #e7edf5; font-size: 14px; margin-top: 12px; max-width: 900px; text-align: center; line-height: 1.5; }
.reporte-visor-contador { opacity: .75; margin-right: 10px; white-space: nowrap; }
.reporte-visor-boton {
  position: absolute;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  font-size: 26px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.reporte-visor-boton:hover, .reporte-visor-boton:focus-visible { background: rgba(255, 255, 255, .25); outline: 2px solid var(--accent); }
.reporte-visor-cerrar { top: 10px; right: 10px; }
.reporte-visor-anterior { left: 12px; top: 50%; transform: translateY(-50%); }
.reporte-visor-siguiente { right: 12px; top: 50%; transform: translateY(-50%); }
.reporte-visor-boton[hidden] { display: none; }
body.reporte-visor-abierto { overflow: hidden; }

@media (max-width: 640px) {
  .reporte-tarjeta { grid-template-columns: 1fr; padding: 14px; }
  .reporte-tarjeta-img { order: -1; aspect-ratio: 16 / 9; }
  .reporte-titulo { font-size: 23px; }
  .reporte-hilo-caja { padding: 16px 14px 14px; }
  /* En el teléfono el texto justificado necesita todo el ancho: con la
     columna del avatar al costado quedaban huecos grandes entre palabras.
     El avatar pasa a la fila del nombre (display: contents deja que los
     hijos del cuerpo se ubiquen en la grilla del post) y las publicaciones
     se separan con una línea en vez de la línea vertical del hilo. */
  .reporte-post {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    column-gap: 10px;
    padding-bottom: 20px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
  }
  .reporte-post:last-child { padding-bottom: 0; margin-bottom: 0; border-bottom: 0; }
  .reporte-post-avatar { grid-column: 1; grid-row: 1; align-self: center; }
  .reporte-post-avatar .reporte-avatar { width: 36px; height: 36px; font-size: 15px; }
  .reporte-post-linea { display: none; }
  .reporte-post-cuerpo { display: contents; }
  .reporte-post-autor { grid-column: 2; grid-row: 1; align-self: center; margin: 0; font-size: 14.5px; }
  .reporte-post-texto, .reporte-grilla { grid-column: 1 / -1; }
  .reporte-post-texto { font-size: 16px; margin-top: 10px; }
  .reporte-visor-anterior, .reporte-visor-siguiente { top: auto; bottom: 14px; transform: none; }
  .reporte-visor { padding-bottom: 76px; }
  .reporte-sismo-ventana { padding: 0; align-items: flex-end; }
  .reporte-sismo-dialogo { width: 100%; border-radius: var(--radius) var(--radius) 0 0; max-height: 92vh; max-height: 92dvh; }
  #reporteSismoMapa { height: 220px; }
}
