/* =========================================================
   KNOTICIAS — estética de la casa (fondo oscuro, notas como boletos con
   perforación en CSS puro y un neón por sección).
   Adaptada del diseño de referencia: aquí no hay portada de imagen ni
   página de detalle, así que se omiten sus estilos.
   ========================================================= */

:root {
  --bg: #14121f;
  --bg-alt: #1a1728;
  --card-bg: #1c1830;
  --card-bg-hover: #221c3a;
  /* Contraste medido con la fórmula de la WCAG 2.1, no a ojo:
     --stub-line pasa de 2.08 a 3.29 sobre --bg (límite 3:1 para bordes con
     significado) y --text-faint de 3.52 a 5.15 sobre --card-bg (límite 4.5:1
     para texto normal). Con los valores de referencia ambos fallaban. */
  --stub-line: #69628e;
  --text: #f4f1fa;
  --text-muted: #a79fc4;
  --text-faint: #9088ab;

  /* El neón de cada sección vive solo en app.js (SECCIONES) y se le pasa al
   boleto por --cat-color. No se replica aquí: con la tabla en los dos sitios
   acabarían discrepando. Abajo solo el degrade fijo del logo. */

  --radius: 16px;
  --max-width: 1080px;

  --font-display: "Unbounded", system-ui, sans-serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --font-mono: "Space Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

/* Solo para lectores de pantalla: el buscador tiene su <label>, pero no debe
   verse encima del campo. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Cabecera ---------- */

.site-header {
  padding: 2.5rem 0 1.5rem;
  border-bottom: 1px solid var(--stub-line);
}

.logo {
  font-family: var(--font-display);
  font-size: 1.6rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--text);
}

.logo-accent {
  background: linear-gradient(90deg, #ff2e7e, #b98cff, #29e5c6);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  margin: 0.35rem 0 0;
}

/* ---------- Ticker ---------- */

.ticker {
  overflow: hidden;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--stub-line);
  padding: 0.55rem 0;
}

/* Los titulares van en la tipografía de lectura, no en versalitas: en
   mayúsculas un titular largo se lee bastante peor. */
.ticker-track {
  display: inline-flex;
  white-space: nowrap;
  animation: scroll-left 32s linear infinite;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.ticker-item {
  display: inline-flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0 1.75rem;
  border-right: 1px solid var(--stub-line);
}

.ticker-fecha {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

@keyframes scroll-left {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .ticker-track {
    animation: none;
  }
}

/* ---------- Foco visible ---------- */

/* Una sola regla para todo: el foco del teclado se ve igual en el logo, los
   chips, el buscador y el botón de cada boleto. */
:where(a, button, input):focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 4px;
}

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

.filters-bar {
  padding: 1.5rem 0 0.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.chip {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.45rem 0.9rem;
  border-radius: 999px;
  border: 1px solid var(--stub-line);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.chip.active {
  color: var(--bg);
  background: var(--chip-color, var(--text));
  border-color: var(--chip-color, var(--text));
  font-weight: 700;
}

/* El botón de ocultas se deshabilita cuando no hay nada oculto. */
.chip:disabled {
  opacity: 0.4;
  cursor: default;
}

.chip:disabled:hover {
  color: var(--text-muted);
  border-color: var(--stub-line);
}

.search-input {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg-alt);
  border: 1px solid var(--stub-line);
  color: var(--text);
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  min-width: 180px;
}

.search-input::placeholder {
  color: var(--text-faint);
}

/* ---------- Recuento ---------- */

.resumen {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ---------- Grid de boletos ---------- */

.ticket-grid {
  padding: 2rem 0 4rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

/* Una portada tiene una nota principal, no diez tarjetas del mismo tamaño: la
   más reciente ocupa toda la fila. Es puro CSS, sin tocar app.js.
   :not(:only-child) evita que un único resultado se infle a tamaño de portada. */
.ticket-grid > .ticket:first-child:not(:only-child) {
  grid-column: 1 / -1;
}

.ticket-grid > .ticket:first-child:not(:only-child) .ticket-title {
  font-size: clamp(1.5rem, 3.1vw, 2.1rem);
  max-width: 24ch;
}

.ticket-grid > .ticket:first-child:not(:only-child) .ticket-summary {
  font-size: 1rem;
  max-width: 70ch;
}

.empty-state {
  padding: 3rem 0;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

/* ---------- Tarjeta-boleto ---------- */

.ticket {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--card-bg);
  border: 1px solid var(--stub-line);
  display: flex;
  flex-direction: column;
  color: var(--text);
  transition: background 0.15s ease;
}

.ticket:hover {
  background: var(--card-bg-hover);
}

/* El boleto reacciona con su propia mecánica, no elevándose: el troquel se
   marca con el neón de la sección. Un translateY en todas las tarjetas es el
   gesto genérico que delata una plantilla. */
.ticket-perf {
  transition: border-color 0.15s ease;
}

.ticket:hover .ticket-perf {
  border-top-color: var(--cat-color, var(--stub-line));
}

.ticket-top {
  padding: 1.25rem 1.25rem 1.1rem;
  border-top: 4px solid var(--cat-color, var(--text-muted));
}

.ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.ticket-cat {
  color: var(--cat-color, var(--text-muted));
  font-weight: 700;
}

.ticket-date {
  color: var(--text-faint);
}

.ticket-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  line-height: 1.3;
  margin: 0;
}

/* El titular del listado es un enlace a la nota. Sin subrayado, porque el
   boleto ya se lee como un bloque; el subrayado aparece al pasar por encima,
   que es donde hace falta el aviso de que hay algo pulsable. */
.ticket-title a {
  text-decoration: none;
}

.ticket-title a:hover {
  text-decoration: underline;
}

/* ---------- Página de la nota ---------- */

.volver {
  display: inline-block;
  margin-top: 1rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  text-decoration: none;
}

.volver:hover {
  color: var(--text);
  text-decoration: underline;
}

.detalle-ticket {
  margin-top: 2rem;
}

/* En la página de la nota el boleto sí es el titular de la página, así que el
   <h1> se ve a tamaño de portada. La regla de la portada del listado no aplica
   aquí: vive dentro de .ticket-grid. */
.detalle-ticket .ticket-title {
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  max-width: 26ch;
}

/* La ficha: todos los datos de la nota, uno por fila. Es una lista de
   definiciones (<dl>) porque son pares de dato y valor, no un párrafo. */
.ficha {
  margin: 0;
  padding: 1.25rem 1.25rem 0.5rem;
  border-top: 1px solid var(--stub-line);
}

.ficha-fila {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--stub-line);
}

.ficha-clave {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  min-width: 11ch;
}

.ficha-valor {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text);
}

.detalle-resumen {
  font-size: 1rem;
  color: var(--text);
  margin: 0;
  white-space: pre-line;
}

/* La galería: rejilla de imágenes que se adaptan al ancho. */
.galeria-zona {
  padding: 0 0 4rem;
}

.galeria-titulo {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin: 2rem 0 1rem;
}

.galeria {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.galeria-item {
  margin: 0;
  border: 1px solid var(--stub-line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
}

.galeria-item img {
  display: block;
  width: 100%;
  height: auto;
}

/* Si el archivo no está, se dice cuál falta en vez de dejar el icono de
   imagen rota. */
.galeria-falta {
  margin: 0;
  padding: 2.5rem 1rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-faint);
  text-align: center;
}

/* Perforación: la línea discontinua más dos círculos del color del fondo. */
.ticket-perf {
  position: relative;
  margin: 0;
  border-top: 2px dashed var(--stub-line);
}

.ticket-perf::before,
.ticket-perf::after {
  content: "";
  position: absolute;
  top: -12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--bg);
}

.ticket-perf::before {
  left: -12px;
}

.ticket-perf::after {
  right: -12px;
}

.ticket-bottom {
  padding: 1.1rem 1.25rem 1.35rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.ticket-summary {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
  flex: 1;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Una sola cosa por línea y sin puntos de unión: cada dato va en su elemento
   y el espacio hace de separador. */
.ticket-pluma {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
}

.ticket-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text-faint);
  border: 1px solid var(--stub-line);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
}

/* Es un <button>, no un <a>: el boleto no lleva a ninguna página, la acción es
   ocultar la nota. Se reinician los estilos de botón para que parezca un enlace. */
.ticket-link {
  align-self: flex-start;
  margin: 0;
  padding: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--cat-color, var(--text));
  background: none;
  border: 0;
  cursor: pointer;
}

.ticket-link:hover {
  text-decoration: underline;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--stub-line);
  padding: 2rem 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
  max-width: 68ch;
}

.site-footer code {
  color: var(--text-muted);
}

/* ---------- Notas ocultas ---------- */

.oculta {
  opacity: 0.55;
}