/* ============================================================
 *  Páxina da hemeroteca (/hemeroteca/)
 * ============================================================ */

.hemeroteca-page {
    /* O ancho do contedor xa o limita o tema (815px) */
}

/* Últimas edicións */
.hemeroteca-ultimas {
    margin: 0 0 40px;
}
.hemeroteca-ultimas h2 {
    margin: 0 0 20px;
    font-size: 1.4em;
    font-weight: bold;
}
.hemeroteca-ultimas-grid {
    display: grid;
    grid-template-columns: repeat(4, 175px);
    gap: 30px;
    justify-content: flex-start;
}

/* ============================================================
   *  Widget do shortcode [hemeroteca_ultimas]
   *  Classes propias, sen mellar coa páxina da hemeroteca
   * ============================================================ */
.hemeroteca-widget-portada {
    text-align: center;
    width: 100%;
}
.hemeroteca-widget-portada .hemeroteca-widget-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: var(--gap, 15px);
    width: 100%;
}

/* 3 ou máis: 1/3 do ancho dispoñible, tope 175px */
.hemeroteca-widget-portada .hemeroteca-widget-grid > .hemeroteca-widget-card {
    flex: 0 1 calc((100% - (var(--gap, 15px) * 2)) / 3);
    max-width: 175px;
    width: 100%;
    min-width: 0;
    box-sizing: border-box;
}

/* 1 ou 2 imaxes: medran para encher a fila, tope 175px */
.hemeroteca-widget-portada .hemeroteca-widget-grid:has(> :only-child) > .hemeroteca-widget-card,
.hemeroteca-widget-portada .hemeroteca-widget-grid:has(> :nth-child(2):last-child) > .hemeroteca-widget-card {
    flex: 1 1 0%;
    max-width: 175px;
}

/* Imaxe da portada */
.hemeroteca-widget-portada .hemeroteca-widget-card--ultima {
    width: 100%;
    aspect-ratio: 175 / 225;
    height: auto;
    background: #f5f5f5;
    overflow: hidden;
    display: block;
}
.hemeroteca-widget-portada .hemeroteca-widget-card--ultima img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Variante: última (fixo 175x225; na páxina da hemeroteca) */
.hemeroteca-card--ultima {
    width: 175px;
    height: 225px;
}

/* Tarxetas (base) */
.hemeroteca-card-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 0;
}
.hemeroteca-card {
    display: block;
    position: relative;
    overflow: hidden;
    width: 100%;
    background: #f5f5f5;
}
.hemeroteca-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Variante: regular (grid 6) */
.hemeroteca-grid--6 {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 10px;
}
.hemeroteca-card--edicion {
    aspect-ratio: 3 / 4;
}

/* Etiqueta baixo a tarxeta */
.hemeroteca-card-label {
    margin-top: 6px;
    font-size: 0.85em;
    text-align: center;
    font-weight: 600;
    color: #333;
    line-height: 1.2;
}

/* Seccións por cabeceira */
.hemeroteca-section {
    margin: 0 0 40px;
    padding-bottom: 20px;
    border-bottom: 1px solid #e0e0e0;
}
.hemeroteca-section:last-child {
    border-bottom: 0;
}
.hemeroteca-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: nowrap;
}
.hemeroteca-section-header h2 {
    margin: 0;
    font-size: 1.3em;
    font-weight: bold;
}
.hemeroteca-year-select {
    flex: 0 0 auto;
    width: auto;
    min-width: 90px;
    padding: 4px 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: #fff;
    font-size: 0.95em;
    margin-left: auto;
}

/* Especiais */
.hemeroteca-especiais {
    margin-top: 20px;
}
.hemeroteca-especiais h3 {
    margin: 0 0 10px;
    font-size: 1.05em;
    font-weight: bold;
    color: #666;
}

/* Restrición UI (só anónimos nas edicións antigas) */
.hemeroteca-card.hemeroteca-restricted {
    position: relative;
}
.hemeroteca-restricion {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    padding: 10px;
    text-align: center;
}
.hemeroteca-card:hover .hemeroteca-restricion {
    opacity: 1;
}
.hemeroteca-restricion p {
    margin: 0 0 10px;
    font-size: 0.8em;
    line-height: 1.2;
}
.hemeroteca-restricion a {
    color: #fff;
    background: #0073aa;
    padding: 5px 12px;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.8em;
}
.hemeroteca-restricion a:hover {
    background: #005a87;
}
/* Logo/imaxe corporativa da cabeceira */
.hemeroteca-cabeceira-brand {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    min-width: 0;
}
.hemeroteca-cabeceira-logo {
    max-height: 60px;
    width: auto;
    display: block;
}
