/* tablon.css — zona Logros y anuncios (bloque B): tarjetas, listas, paginación.
 * La portada también pinta .card/.cards-3 (logros y anuncios), así que un cambio aquí se ve en las dos páginas. */

.cards { display: grid; gap: 20px; align-items: stretch; }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cards > li { min-width: 0; }
.cards-3, .tablon-lista { gap: 24px; }
.tablon-lista { grid-template-columns: minmax(0, 1fr); }
.card { display: flex; flex-direction: column; gap: 4px; padding: 0; }
.card-cuerpo { flex: 1; }
.card h3 { font-size: var(--t-m); line-height: 1.3; margin: 0 0 4px; }
.card p { font-size: var(--t-s); line-height: 1.45; margin: 0 0 4px; }
.card .meta { margin: 0; font-size: var(--t-micro); }
/* «Nuevo desde tu última visita»: texto visible, no solo color (blanco sobre --accent = 5,58:1) */
.card .meta .tag { display: inline-flex; margin: 0 0 0 4px; padding: 2px 8px; font-size: var(--t-micro); font-weight: 600; vertical-align: 1px; }
.card .meta .tag.nuevo { background: var(--accent); color: #fff; }
/* «Nuevo» va antes del título (se ve al ojear), en su propia línea */
.card .etiqueta-nuevo { margin: 0 0 var(--e-1); }
.card .etiqueta-nuevo .tag { margin: 0; padding: 2px 8px; font-size: var(--t-micro); background: var(--accent); color: #fff; }
.logro, .anuncio { position: relative; }
.logro-foto { width: 72px; height: 72px; object-fit: cover; border-radius: var(--radio-m); background: var(--soft); }
.titulo-enlace { color: inherit; text-decoration: none; min-width: 0; }
.titulo-enlace:hover, .titulo-enlace:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.ver-todos { margin: 16px 0 0; font-size: var(--t-s); font-weight: 600; }
.ver-todos a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent); text-decoration: none; }
.ver-todos a svg { width: 16px; height: 16px; }
.rancio { margin: 0 0 12px; font-style: italic; }
@media (min-width: 901px) {
  .tablon-lista { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .cards-3 { grid-template-columns: minmax(0, 1fr); }
  .cards-3 > li + li { border-top: 1px solid var(--line); padding-top: 24px; }
  .logro { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 16px; }
  .logro:not(:has(.logro-foto)) { display: flex; }
  .logro .meta { grid-column: 2; }
  .logro:not(:has(.logro-foto)) .meta { grid-column: auto; }
}
@media (max-width: 640px) {
  .cards-3, .tablon-lista { gap: 16px; }
  .cards-3 > li + li, .tablon-lista > li + li { padding-top: 16px; }
  .tablon-lista > li + li { border-top: 1px solid var(--line); }
  .card h3 { font-size: var(--t-base); }
  .tablon-intro.welcome > .btn { width: auto; margin-top: 8px; justify-content: flex-start; padding-left: 0; }
}

/* ---- Activos ------------------------------------------------------------------------------ */
.contador { font-weight: 400; color: var(--muted); }
.card .meta .tag.para { margin: 0 8px 0 0; }
.card .meta .tag.amber { margin: 0 0 0 4px; }
.card .meta .caduca { white-space: nowrap; }
/* «Reconocemos a:» como etiquetas (el rótulo va en aria-label) */
.reconocidos { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 var(--e-2); padding: 0; }
.reconocidos li { font-size: var(--t-micro); font-weight: 600; padding: 3px 9px; border-radius: 999px; line-height: 1.4; }
.reconocidos .persona { background: var(--tint); color: var(--accent-ink); }
.reconocidos .equipo { background: var(--soft); color: var(--muted); }
.vacio-historial { margin: 0; }

/* ---- Historial: filas compactas, agrupadas por mes ----------------------------------------- */
.historial .section-head h2::before { background: var(--tan); }
.hist-intro { margin: calc(-1 * var(--e-2)) 0 var(--e-4); }
.hist-mes { margin-top: var(--e-6); max-width: 760px; }
.hist-intro + .hist-mes { margin-top: 0; }
/* Cabecera de mes fija sin JS: pegada arriba mientras se recorre su mes (ningún ancestro lleva overflow) */
.mes { position: sticky; top: 0; z-index: 1; margin: 0; padding: 10px 0 8px; background: var(--surface); border-bottom: 1px solid var(--line); font-size: var(--t-s); font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--muted); }
.tablon-historial { display: block; margin: 0; padding: 0; list-style: none; }
.hist { border-bottom: 1px solid var(--line); }
.hist:last-child { border-bottom: 0; }
.hist-linea { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; min-height: 44px; padding: 6px 0; }
summary.hist-linea { list-style: none; cursor: pointer; }
summary.hist-linea::-webkit-details-marker { display: none; }
summary.hist-linea::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
details[open] > summary.hist-linea::after { transform: rotate(-135deg); }
summary.hist-linea:hover .hist-titulo, summary.hist-linea:focus-visible .hist-titulo { text-decoration: underline; text-underline-offset: 4px; }
.hist-fecha { flex: none; min-width: 5.5rem; font-size: var(--t-s); font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.hist-titulo { flex: 1 1 10rem; min-width: 0; margin: 0; font-size: var(--t-base); font-weight: 600; line-height: 1.35; letter-spacing: 0; }
.hist-caduco { flex: none; }
.hist-cuerpo { padding: 0 0 var(--e-3) calc(5.5rem + 12px); }
.hist-cuerpo p { margin: 0 0 var(--e-2); color: var(--muted); }
.hist-cuerpo .meta { margin: 0; }
.hist-cuerpo .tag { margin: 0; }
.hist .tag.nuevo { margin: 0; padding: 2px 8px; font-size: var(--t-micro); background: var(--accent); color: #fff; }

/* ---- Activos plegados (página 2 en adelante) ---------------------------------------------- */
.plegable { padding: 0 var(--e-5); }
.plegable summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: var(--e-3); min-height: 52px; font-size: var(--t-s); font-weight: 600; color: var(--muted); }
.plegable summary::-webkit-details-marker { display: none; }
.plegable summary .ver { color: var(--accent-ink); }
.plegable summary:hover .ver, .plegable summary:focus-visible .ver { text-decoration: underline; text-underline-offset: 4px; }
.plegable summary svg { flex: none; width: 16px; height: 16px; color: var(--accent-ink); transform: rotate(90deg); }
.plegable details[open] summary svg { transform: rotate(-90deg); }
.plegable .tablon-lista { padding-bottom: var(--e-5); }

/* ---- Paginación simétrica: «← Más recientes · Página 2 de 4 · Más antiguos →» ---------------- */
.paginacion { display: grid; grid-template-columns: 1fr auto 1fr; grid-template-areas: "prev texto next"; align-items: center; gap: 8px 16px; margin-top: var(--e-5); }
.pag-prev { grid-area: prev; justify-self: start; }
.pag-texto { grid-area: texto; text-align: center; }
.pag-next { grid-area: next; justify-self: end; }
.flecha-izq { display: inline-flex; }
.flecha-izq svg { transform: scaleX(-1); }
.paginacion .btn svg { width: 16px; height: 16px; }
.paginacion .pag-prev:empty, .paginacion .pag-next:empty { display: block; }
.ver-todos.arriba { text-align: center; margin-top: var(--e-2); }
.ver-todos.arriba svg { transform: rotate(-90deg); }
@media (max-width: 640px) {
  .paginacion { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "texto texto" "prev next"; }
  .pag-prev, .pag-next { justify-self: stretch; }
  .paginacion .btn { width: 100%; white-space: nowrap; padding-left: 8px; padding-right: 8px; }
  .hist-mes { margin-top: var(--e-5); }
  .hist-intro + .hist-mes { margin-top: 0; }
  .hist-cuerpo { padding-left: 0; }
}

/* ---- Diseño 2: activos sin título, medallón/baldosa/miniatura, calidez con la marca ----------- */
.bloque.activos { padding: 0; background: transparent; border: 0; box-shadow: none; }
@media (min-width: 901px) {
  .tablon-lista { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.logro, .anuncio { flex-direction: column; gap: 12px; padding: var(--e-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radio-l); box-shadow: var(--shadow); }
.logro-foto, .medallon { width: 96px; height: 96px; border-radius: var(--radio-l); }
.logro-foto { object-fit: cover; background: var(--soft); }
.medallon { display: grid; place-items: center; background: var(--yellow); color: var(--ink); }
.medallon svg { width: 44px; height: 44px; }
.baldosa, .anuncio-foto { width: 56px; height: 56px; border-radius: var(--radio-m); }
.baldosa { display: grid; place-items: center; background: var(--tint); color: var(--accent-ink); }
.baldosa svg { width: 28px; height: 28px; }
.anuncio-foto { object-fit: cover; background: var(--soft); }
/* Foto que no carga: portal.js la oculta y marca el contenedor; el hueco desaparece */
.sin-imagen > [data-opcional][hidden] { display: none; }
.logro.sin-imagen { gap: 0; }
@media (max-width: 900px) {
  /* Dos columnas solo si la tarjeta lleva imagen (medallón, baldosa o foto): la portada pinta anuncios sin ella y,
     con la rejilla, el texto se quedaba en la columna de 72 px. */
  .logro:has(> .logro-foto, > .medallon), .anuncio:has(> .baldosa, > .anuncio-foto) { display: grid; grid-template-columns: 72px minmax(0, 1fr); column-gap: 16px; align-items: start; }
  .logro-foto, .medallon { width: 72px; height: 72px; }
  .medallon svg { width: 34px; height: 34px; }
  .baldosa, .anuncio-foto { width: 56px; height: 56px; }
  .logro.sin-imagen, .anuncio.sin-imagen { display: flex; }
}
@media (prefers-reduced-motion: no-preference) {
  .logro, .anuncio { transition: transform .15s ease; }
  .logro:hover, .anuncio:hover { transform: translateY(-2px); }
}

/* ---- Tarjetas enlazadas a su ficha: UN enlace (el título) que cubre toda la tarjeta, sin anidar enlaces ------ */
.card-enlace::after { content: ""; position: absolute; inset: 0; border-radius: var(--radio-l); }
.card-enlace:focus-visible { outline: 0; }
.card-enlace:focus-visible::after { outline: var(--foco); outline-offset: 3px; }
.card:has(.card-enlace) { cursor: pointer; }

/* Historial: la fila sin cuerpo entera es un enlace; con cuerpo, el enlace va dentro de lo desplegado */
a.hist-linea { color: inherit; text-decoration: none; }
a.hist-linea::after { content: ""; flex: none; width: 8px; height: 8px; margin-left: auto; border-right: 2px solid var(--muted); border-top: 2px solid var(--muted); transform: rotate(45deg); }
a.hist-linea:hover .hist-titulo, a.hist-linea:focus-visible .hist-titulo { text-decoration: underline; text-underline-offset: 4px; }
.hist-cuerpo .hist-ficha { margin: var(--e-2) 0 0; font-weight: 600; }
.hist-cuerpo .hist-ficha a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; color: var(--accent-ink); text-decoration: none; }
.hist-cuerpo .hist-ficha a:hover, .hist-cuerpo .hist-ficha a:focus-visible { text-decoration: underline; text-underline-offset: 4px; }
.hist-cuerpo .hist-ficha svg { width: 16px; height: 16px; }

/* ---- Ficha de un logro o anuncio (/logros/:id, /anuncios/:id): reutiliza `.edicion` y `.cuerpo` de newsletters.css ------ */
.ficha-tablon .miga { margin: 0 0 var(--e-3); }
.ficha-tablon .cabecera-pagina { margin-bottom: var(--e-3); }
.ficha-tablon .ficha-meta { margin: 0 0 var(--e-3); }
.ficha-tablon-foto { display: block; width: 160px; height: 160px; object-fit: cover; border-radius: var(--radio-l); background: var(--soft); margin: 0 0 var(--e-4); }
.ficha-tablon .entradilla { margin: 0 0 var(--e-4); }
.ficha-tablon .reconocidos { margin: 0 0 var(--e-4); }
.ficha-tablon .cuerpo figure { margin: 24px 0; }
.ficha-tablon .cuerpo figure:first-child { margin-top: 0; }
.ficha-tablon .cuerpo figure:last-child { margin-bottom: 0; }
.cuerpo-imagen { display: block; max-width: 100%; height: auto; border-radius: var(--radio-m); background: var(--soft); }
.ficha-tablon .cuerpo figcaption { margin-top: 8px; font-size: var(--t-s); line-height: 1.4; color: var(--muted); }
.ficha-tablon .cuerpo .sin-imagen { margin: 0; }
@media (max-width: 640px) {
  .ficha-tablon-foto { width: 120px; height: 120px; }
}
