/* ==============================================
   THEMES.CSS — Las 3 direcciones de rediseño
   Selecciona con [data-theme] en <html>; el switcher
   vive en theme-picker.js y guarda la elección en
   localStorage. Ver assets/js/theme-picker.js.
   ============================================== */

/* ----------------------------------------------
   Selector de estilo (chip de 3 muestras en el header)
---------------------------------------------- */
.theme-picker {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.theme-picker__btn {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 2px solid transparent;
    padding: 0;
    cursor: pointer;
    outline-offset: 2px;
    transition: border-color 0.15s, transform 0.15s;
    -webkit-appearance: none;
}

.theme-picker__btn:hover { transform: scale(1.12); }

.theme-picker__btn[aria-pressed="true"] {
    border-color: var(--color-text);
    transform: scale(1.12);
}

.theme-picker__btn--prensa    { background: linear-gradient(135deg, #f2ede0 50%, #7a1414 50%); }
.theme-picker__btn--editorial { background: linear-gradient(135deg, #faf8f3 50%, #a8390f 50%); }
.theme-picker__btn--catalogo  { background: linear-gradient(135deg, #eef0ec 50%, #1f2420 50%); }

/* ----------------------------------------------
   Contenedor del archivo + barra de años
   (la barra sólo se muestra en el tema Archivo Documental)
---------------------------------------------- */
.archive-shell {
    display: block;
}

.year-sidebar {
    display: none;
}

.year-sidebar__title {
    font-family: var(--font-serif);
    font-weight: bold;
    font-size: 1.05rem;
}

.year-sidebar__range {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.6875rem;
    letter-spacing: 0.04em;
    margin-top: 2px;
    margin-bottom: 1.5rem;
}

.year-sidebar__list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.year-sidebar__link {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.8125rem;
    text-align: left;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    cursor: pointer;
    padding: 0.3rem 0 0.3rem 0.6rem;
    transition: opacity 0.15s, border-color 0.15s;
}

/* ==============================================
   PRENSA CLÁSICA
   Masthead de periódico impreso, columnas densas,
   capitular en la nota. Máxima cercanía al archivo físico.
   ============================================== */
[data-theme="prensa"] {
    --color-bg:      #f2ede0;
    --color-surface: #f7f3e8;
    --color-text:    #1a1a1a;
    --color-muted:   #5a5449;
    --color-border:  #cfc7b3;
    --color-accent:  #7a1414;
}

[data-theme="prensa"] .site-header {
    border-bottom: 3px double var(--color-text);
}

[data-theme="prensa"] .site-header__logo {
    font-size: 1.85rem;
    letter-spacing: -0.005em;
}

[data-theme="prensa"] .archive-controls {
    background: var(--color-surface);
}

[data-theme="prensa"] .archive-controls__input {
    border-bottom-color: var(--color-border);
}

[data-theme="prensa"] .archive-date-header,
[data-theme="prensa"] .archive-category-header {
    border-top: 3px double var(--color-text);
}

[data-theme="prensa"] .news-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0;
    background: transparent;
    border: none;
    border-top: 1px solid var(--color-text);
}

[data-theme="prensa"] .news-card {
    background: transparent;
    border-right: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
}

[data-theme="prensa"] .news-card:hover      { background: rgba(0, 0, 0, 0.025); }
[data-theme="prensa"] .news-card--highlighted { background: rgba(122, 20, 20, 0.05); }

[data-theme="prensa"] .news-title { letter-spacing: -0.005em; }

[data-theme="prensa"] .stat-item,
[data-theme="prensa"] .archive-stats-grid { border-color: var(--color-text); }

/* Página de noticia */
[data-theme="prensa"] .article-byline {
    border-top: 1px solid var(--color-text);
    border-bottom: 1px solid var(--color-text);
}

[data-theme="prensa"] .article-body > p:first-of-type::first-letter {
    float: left;
    font-family: var(--font-serif);
    font-weight: bold;
    font-size: 3.6em;
    line-height: 0.78;
    padding: 0.06em 0.09em 0 0;
    color: var(--color-text);
}

[data-theme="prensa"] .article-hero { margin-bottom: 1.25rem; }
[data-theme="prensa"] .article-hero__img { filter: saturate(0.92); }

/* ==============================================
   EDITORIAL MODERNA
   Evolución del diseño actual: más aire, buscador tipo
   píldora, tarjetas con marco, jerarquía tipo revista.
   ============================================== */
[data-theme="editorial"] {
    --color-bg:      #faf8f3;
    --color-surface: #ffffff;
    --color-text:    #1c1a17;
    --color-muted:   #8a8378;
    --color-border:  #e8e2d6;
    --color-accent:  #a8390f;
}

[data-theme="editorial"] .archive-controls__input {
    border: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    border-radius: 20px;
    padding: 0.55rem 1.1rem;
}

[data-theme="editorial"] .archive-controls__input:focus {
    border-color: var(--color-text);
}

[data-theme="editorial"] .news-grid {
    gap: 22px;
    background: transparent;
    border: none;
}

[data-theme="editorial"] .news-card {
    border: 1px solid var(--color-border);
    border-radius: 6px;
    padding: 1.4rem;
}

[data-theme="editorial"] .news-card:hover {
    background: var(--color-surface);
    border-color: var(--color-text);
}

[data-theme="editorial"] .news-card--highlighted {
    border-color: var(--color-accent);
    background: #fffaf5;
}

[data-theme="editorial"] .news-title { font-size: 1.15rem; }

[data-theme="editorial"] .archive-date-header,
[data-theme="editorial"] .archive-category-header {
    border-top: none;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.625rem;
}

[data-theme="editorial"] .archive-stats-grid,
[data-theme="editorial"] .stat-item { border-color: var(--color-border); }
[data-theme="editorial"] .archive-stats-grid { border-radius: 6px; overflow: hidden; }

/* Página de noticia */
[data-theme="editorial"] .article-wrapper { max-width: 820px; }
[data-theme="editorial"] .article-title { font-size: clamp(2rem, 4.5vw, 3rem); }
[data-theme="editorial"] .article-hero__img,
[data-theme="editorial"] .gallery-item__img { border-radius: 6px; }
[data-theme="editorial"] .article-byline {
    border: none;
    background: var(--color-surface);
    border-radius: 20px;
    padding: 0.625rem 1rem;
}
[data-theme="editorial"] .share-btn { border-radius: 20px; }

/* ==============================================
   ARCHIVO DOCUMENTAL
   Cabecera oscura tipo microfilm, filas de ficha
   densas con folio y metadatos monoespaciados.
   ============================================== */
[data-theme="catalogo"] {
    --color-bg:      #eef0ec;
    --color-surface: #ffffff;
    --color-text:    #1a1a1a;
    --color-muted:   #5a6058;
    --color-border:  #c9cec4;
    --color-accent:  #b5121b;
    --font-mono-cat: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="catalogo"] .site-header {
    background: #1f2420;
    border-bottom: 1px solid #1f2420;
}

[data-theme="catalogo"] .site-header__logo,
[data-theme="catalogo"] .site-header__logo a { color: #ffffff; }

[data-theme="catalogo"] .site-header__back { color: #8a9488; }
[data-theme="catalogo"] .site-header__back:hover { color: #ffffff; }

[data-theme="catalogo"] .theme-picker__btn[aria-pressed="true"] { border-color: #ffffff; }

/* Barra lateral de años */
[data-theme="catalogo"] .archive-shell {
    display: flex;
    max-width: var(--max-content);
    margin: 0 auto;
    align-items: flex-start;
}

[data-theme="catalogo"] .year-sidebar {
    display: block;
    width: 150px;
    flex-shrink: 0;
    background: #1f2420;
    color: #c9d0c7;
    padding: 1.75rem 1.25rem;
    min-height: 420px;
}

[data-theme="catalogo"] .year-sidebar__title { color: #ffffff; }
[data-theme="catalogo"] .year-sidebar__range { color: #8a9488; }

[data-theme="catalogo"] .year-sidebar__link { color: #c9d0c7; opacity: 0.8; }
[data-theme="catalogo"] .year-sidebar__link:hover { opacity: 1; border-left-color: #4a5548; }

[data-theme="catalogo"] .year-sidebar__link--active {
    color: #ffffff;
    opacity: 1;
    font-weight: bold;
    border-left-color: var(--color-accent);
}

[data-theme="catalogo"] .archive-main {
    flex: 1;
    max-width: none;
    margin: 0;
    min-width: 0;
}

[data-theme="catalogo"] .archive-controls__label,
[data-theme="catalogo"] .archive-stats,
[data-theme="catalogo"] .news-category,
[data-theme="catalogo"] .news-date,
[data-theme="catalogo"] .news-meta,
[data-theme="catalogo"] .news-meta span,
[data-theme="catalogo"] .archive-date-header,
[data-theme="catalogo"] .archive-category-header,
[data-theme="catalogo"] .archive-category-header__count,
[data-theme="catalogo"] .stat-label,
[data-theme="catalogo"] .article-byline,
[data-theme="catalogo"] .article-byline time {
    font-family: var(--font-mono-cat);
    letter-spacing: 0;
}

[data-theme="catalogo"] .archive-date-header,
[data-theme="catalogo"] .archive-category-header {
    border-top: 1px solid var(--color-text);
}

[data-theme="catalogo"] .news-grid {
    grid-template-columns: 1fr;
    gap: 0;
    background: transparent;
    border: none;
    border-top: 1px solid var(--color-text);
}

[data-theme="catalogo"] .news-card {
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0.7rem 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

[data-theme="catalogo"] .news-card:hover { background: #f4f6f1; }

[data-theme="catalogo"] .news-thumb {
    order: 0;
    width: 56px;
    height: 56px;
    aspect-ratio: auto;
    flex-shrink: 0;
    margin-bottom: 0;
}

[data-theme="catalogo"] .news-category {
    order: 1;
    width: 130px;
    flex-shrink: 0;
    font-size: 0.6875rem;
}

[data-theme="catalogo"] .news-volanta  { display: none; }
[data-theme="catalogo"] .news-subtitle { display: none; }

[data-theme="catalogo"] .news-title {
    order: 2;
    flex: 1;
    font-size: 0.95rem;
    line-height: 1.3;
}

[data-theme="catalogo"] .news-meta {
    order: 3;
    margin-top: 0;
    padding-top: 0;
    border-top: none;
    width: auto;
    flex-shrink: 0;
    font-size: 0.6875rem;
    gap: 1rem;
}

[data-theme="catalogo"] .news-author { display: none; }

/* Página de noticia */
[data-theme="catalogo"] .article-byline {
    font-size: 0.75rem;
    border-top: 1px solid var(--color-text);
    border-bottom: 1px solid var(--color-border);
}

[data-theme="catalogo"] .article-hero__img {
    border: 6px solid #ffffff;
    outline: 1px solid var(--color-border);
}

[data-theme="catalogo"] .article-title { font-size: clamp(1.6rem, 3.6vw, 2.2rem); }

[data-theme="catalogo"] .gallery-item__caption { font-family: var(--font-mono-cat); }

/* ==============================================
   Responsive: picker y catálogo en pantallas chicas
   ============================================== */
@media (max-width: 640px) {
    [data-theme="prensa"] .news-grid { grid-template-columns: 1fr; }

    [data-theme="catalogo"] .news-category { width: 90px; }
    [data-theme="catalogo"] .news-meta { display: none; }

    [data-theme="catalogo"] .archive-shell { flex-direction: column; }
    [data-theme="catalogo"] .year-sidebar {
        width: auto;
        min-height: 0;
        padding: 1rem 1.25rem;
    }
    [data-theme="catalogo"] .year-sidebar__list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.25rem 0.9rem;
    }
    [data-theme="catalogo"] .year-sidebar__range { display: none; }
}
