/* =====================================================
   Ayudas España — Main CSS
   Mobile-first. Sin frameworks. CSS Grid + Custom Properties.
   ===================================================== */

/* ── Variables ─────────────────────────────────────── */
:root {
    --red:        #CC0000;
    --red-dark:   #A30000;
    --gold:       #F5A623;
    --gold-dark:  #D48B00;
    --navy:       #1A2B4A;
    --navy-dark:  #0F1A2E;
    --white:      #FFFFFF;
    --gray-50:    #F9FAFB;
    --gray-100:   #F3F4F6;
    --gray-200:   #E5E7EB;
    --gray-400:   #9CA3AF;
    --gray-600:   #4B5563;
    --text:       #1F2937;

    --font:       system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-size:  18px;
    --line:       1.7;
    --radius:     8px;
    --radius-lg:  16px;
    --shadow:     0 2px 8px rgba(0,0,0,.08);
    --shadow-md:  0 4px 16px rgba(0,0,0,.12);
    --container:  1200px;
    --pad:        1rem;
    --section:    3rem;
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body {
    font-family: var(--font);
    font-size: var(--font-size);
    line-height: var(--line);
    color: var(--text);
    background: var(--white);
    overflow-x: hidden;
}
img, video { max-width: 100%; height: auto; display: block; }
a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }
ul { list-style: none; }
button { cursor: pointer; font-family: var(--font); }
input, select, textarea { font-family: var(--font); }

/* ── Contenedor ────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 var(--pad);
}

/* ── Tipografía ────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.3;
    color: var(--navy);
}
h1 { font-size: clamp(1.6rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.3rem, 4vw, 2rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.5rem); }
h4 { font-size: 1.1rem; }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }

/* ── Botones ───────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .85rem 1.5rem;
    font-size: 1rem;
    font-weight: 700;
    border-radius: var(--radius);
    border: 2px solid transparent;
    text-decoration: none;
    transition: transform .15s, box-shadow .15s, background .15s;
    min-height: 48px;
    white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn--primary   { background: var(--navy);  color: var(--white); }
.btn--primary:hover { background: var(--navy-dark); }

.btn--danger    { background: var(--red);   color: var(--white); }
.btn--danger:hover { background: var(--red-dark); }

.btn--outline   { background: transparent; color: var(--white); border-color: var(--white); }
.btn--outline:hover { background: var(--white); color: var(--navy); }

.btn--gold      { background: var(--gold);  color: var(--navy); }
.btn--gold:hover { background: var(--gold-dark); }

.btn--full { width: 100%; }

/* ════════════════════════════════════════════════════
   CABECERA — Header
   Regla única de visibilidad:
   · Mobile  (<1024px): nav-brand + nav-toggle visibles.
                        nav-menu-desktop y nav-search-wrap OCULTOS.
                        mobile-drawer oculto por defecto, abre con JS.
   · Desktop (≥1024px): nav-brand + nav-menu-desktop + nav-search-wrap.
                        nav-toggle y mobile-drawer OCULTOS.
   ════════════════════════════════════════════════════ */

.site-header {
    --hdr-fg:            #ffffff;
    --hdr-fg-muted:      rgba(255,255,255,.55);
    --hdr-input-bg:      rgba(255,255,255,.12);
    --hdr-input-border:  rgba(255,255,255,.30);
    background: var(--navy);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.3);
}

/* ── Barra principal ───────────────────────────────── */
.site-nav {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .6rem var(--pad);
    max-width: var(--container);
    margin: 0 auto;
    width: 100%;
}

/* ── Logo (siempre visible) ────────────────────────── */
.nav-brand {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    line-height: 0;
}
.nav-brand .custom-logo-link {
    display: flex;
    align-items: center;
}
.nav-brand .custom-logo {
    display: block;
    height: 48px;
    max-width: 220px;
    width: auto;
    object-fit: contain;
}
.site-logo {
    display: flex;
    align-items: center;
    gap: .5rem;
    color: var(--hdr-fg);
    text-decoration: none;
    font-weight: 700;
    font-size: 1rem;
    line-height: 1.2;
}
.site-logo:hover { color: var(--gold); text-decoration: none; }
.site-logo__sub { display: block; font-size: .68rem; font-weight: 400; color: var(--gold); }

/* ── Menú desktop: OCULTO en mobile ───────────────── */
.nav-menu-desktop { display: none; flex: 1; min-width: 0; }
.nav-menu-desktop ul { display: flex; flex-wrap: wrap; align-items: center; gap: 0; margin: 0; padding: 0; }
.nav-menu-desktop li { list-style: none; }
.nav-menu-desktop a {
    display: block;
    color: var(--hdr-fg);
    padding: .45rem .7rem;
    font-weight: 600;
    font-size: .875rem;
    border-radius: var(--radius);
    white-space: nowrap;
    transition: background .15s, color .15s;
}
.nav-menu-desktop a:hover,
.nav-menu-desktop .current-menu-item > a,
.nav-menu-desktop .current_page_item > a {
    background: var(--hdr-input-bg);
    color: var(--gold);
    text-decoration: none;
}

/* ── Acciones derecha ──────────────────────────────── */
.nav-actions { display: flex; align-items: center; gap: .5rem; margin-left: auto; flex-shrink: 0; }

/* Búsqueda desktop: OCULTA en mobile */
.nav-search-wrap { display: none; }
.nav-search-wrap .search-form { display: flex; gap: .3rem; }
.nav-search-wrap .search-form input[type="search"] {
    width: 170px;
    padding: .38rem .7rem;
    border: 1px solid var(--hdr-input-border);
    border-radius: var(--radius);
    background: var(--hdr-input-bg);
    color: var(--hdr-fg);
    font-size: .85rem;
    min-height: 36px;
}
.nav-search-wrap .search-form input[type="search"]::placeholder { color: var(--hdr-fg-muted); }
.nav-search-wrap .search-form button {
    background: var(--red);
    color: var(--white);
    border: none;
    padding: .38rem .7rem;
    border-radius: var(--radius);
    font-size: .85rem;
    font-weight: 700;
    min-height: 36px;
    cursor: pointer;
}
.nav-search-wrap .search-form button:hover { background: var(--red-dark); }

/* ── Botón hamburguesa: visible SOLO en mobile ─────── */
.nav-toggle {
    background: none;
    border: none;
    color: var(--hdr-fg);
    padding: .4rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    flex-shrink: 0;
}
.hamburger-icon { display: flex; flex-direction: column; gap: 5px; }
.hamburger-icon span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--hdr-fg);
    border-radius: 2px;
    transition: transform .25s, opacity .25s;
    transform-origin: center;
}
/* Animación X cuando está abierto */
.nav-toggle.is-active .hamburger-icon span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-active .hamburger-icon span:nth-child(2) { opacity: 0; }
.nav-toggle.is-active .hamburger-icon span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Drawer móvil: OCULTO por defecto ─────────────── */
/* Regla base: display none sin excepciones CSS */
.mobile-drawer {
    display: none;
    flex-direction: column;
    background: var(--navy-dark);
    border-top: 1px solid rgba(255,255,255,.12);
    overflow: hidden;
}
/* Solo se abre con la clase .is-open añadida por JS */
.mobile-drawer.is-open { display: flex; }

.mobile-drawer > ul,
.mobile-drawer > div > ul { display: flex; flex-direction: column; padding: .5rem var(--pad); }
.mobile-drawer li { list-style: none; }
.mobile-drawer a {
    display: block;
    color: rgba(255,255,255,.9);
    padding: .7rem .25rem;
    font-weight: 600;
    font-size: 1rem;
    border-bottom: 1px solid rgba(255,255,255,.07);
}
.mobile-drawer a:hover { color: var(--gold); text-decoration: none; }
.mobile-drawer li:last-child > a { border-bottom: none; }

.mobile-drawer__search {
    padding: .75rem var(--pad) 1rem;
    border-top: 1px solid rgba(255,255,255,.07);
}
.mobile-drawer__search .search-form { display: flex; gap: .4rem; }
.mobile-drawer__search .search-form input[type="search"] {
    flex: 1;
    padding: .55rem .9rem;
    border: 1px solid rgba(255,255,255,.25);
    border-radius: var(--radius);
    background: rgba(255,255,255,.1);
    color: var(--white);
    font-size: .9rem;
    min-height: 44px;
}
.mobile-drawer__search .search-form input[type="search"]::placeholder { color: rgba(255,255,255,.4); }
.mobile-drawer__search .search-form button {
    background: var(--red);
    color: var(--white);
    border: none;
    padding: .55rem 1rem;
    border-radius: var(--radius);
    font-weight: 700;
    min-height: 44px;
    cursor: pointer;
}

/* ── Sección genérica ──────────────────────────────── */
.section { padding: var(--section) 0; }
.section--gray { background: var(--gray-50); }
.section__title {
    text-align: center;
    margin-bottom: 1.5rem;
    position: relative;
    padding-bottom: .75rem;
}
.section__title::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: var(--red);
    border-radius: 2px;
}

/* ── Cards ─────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.card__body { padding: 1rem; flex: 1; }
.card__title { font-size: 1.05rem; margin-bottom: .5rem; color: var(--navy); }
.card__title a { color: inherit; }
.card__title a:hover { color: var(--red); text-decoration: none; }
.card__excerpt { font-size: .9rem; color: var(--gray-600); }
.card__footer { padding: .75rem 1rem; border-top: 1px solid var(--gray-200); }
.card__img { width: 100%; height: 200px; object-fit: cover; }

/* Pill de estado */
.estado-pill {
    display: inline-block;
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.estado-pill--abierta  { background: #D1FAE5; color: #065F46; }
.estado-pill--cerrada  { background: #FEE2E2; color: #991B1B; }
.estado-pill--proxima  { background: #FEF3C7; color: #92400E; }

/* ── Grids ─────────────────────────────────────────── */
.card-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
}

/* ── Sidebar layout ────────────────────────────────── */
.content-area { display: block; }
.main-content { min-width: 0; }
.sidebar { display: none; }

/* ── Artículo single ───────────────────────────────── */
.entry-header { margin-bottom: 1.5rem; }
.entry-title { margin-bottom: .75rem; font-size: clamp(1.4rem, 4vw, 2.2rem); }
.entry-meta {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    font-size: .85rem;
    color: var(--gray-600);
    margin-bottom: 1rem;
    align-items: center;
}
.entry-meta a { color: var(--gray-600); }
.meta-cat {
    background: var(--gray-100);
    padding: .2rem .6rem;
    border-radius: 99px;
    font-size: .75rem;
    font-weight: 700;
    color: var(--navy) !important;
    text-transform: uppercase;
}
.entry-content { font-size: 1rem; }
.entry-content h2 { margin-top: 2rem; margin-bottom: .75rem; }
.entry-content h3 { margin-top: 1.5rem; margin-bottom: .5rem; }
.entry-content ul, .entry-content ol { margin-left: 1.5rem; margin-bottom: 1rem; list-style: revert; }
.entry-content img { border-radius: var(--radius); margin: 1rem 0; }
.entry-content blockquote {
    border-left: 4px solid var(--red);
    padding: 1rem 1.25rem;
    margin: 1.5rem 0;
    background: var(--gray-50);
    border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic;
}
.entry-content table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: .9rem; }
.entry-content th, .entry-content td { border: 1px solid var(--gray-200); padding: .5rem .75rem; text-align: left; }
.entry-content th { background: var(--navy); color: var(--white); }
.entry-content tr:nth-child(even) { background: var(--gray-50); }

/* ── Convocatoria meta ─────────────────────────────── */
.convocatoria-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .75rem;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 1.5rem 0;
}
.conv-meta-item { display: flex; flex-direction: column; gap: .2rem; }
.conv-meta-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--gray-400); font-weight: 700; }
.conv-meta-value { font-weight: 700; color: var(--navy); font-size: .95rem; }

/* ── Deadline bar ──────────────────────────────────── */
.deadline-bar {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .85rem 1rem;
    border-radius: var(--radius);
    font-weight: 700;
    margin-bottom: 1.5rem;
    font-size: .95rem;
}
.deadline-bar--urgent { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.deadline-bar--soon   { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.deadline-bar--ok     { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.deadline-bar--closed { background: var(--gray-100); color: var(--gray-600); border: 1px solid var(--gray-200); }

/* ── Requisitos list ───────────────────────────────── */
.requisitos-list { list-style: none; margin: 1rem 0; }
.requisitos-list li {
    display: flex;
    gap: .6rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--gray-100);
    align-items: flex-start;
    line-height: 1.5;
}
.requisitos-list li:last-child { border-bottom: none; }
.requisitos-list li::before {
    content: '✓';
    color: #059669;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: .1rem;
}

/* ── CTA WhatsApp block ────────────────────────────── */
.cta-whatsapp-block {
    background: linear-gradient(135deg, #25D366, #128C7E);
    color: var(--white);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    margin: 2rem 0;
}
.cta-whatsapp-block h3 { color: var(--white); margin-bottom: .5rem; }
.cta-whatsapp-block p { margin-bottom: 1rem; opacity: .9; }
.cta-whatsapp-block .btn { background: var(--white); color: #128C7E; }

/* ── Breadcrumbs ───────────────────────────────────── */
.breadcrumbs {
    background: var(--gray-100);
    padding: .5rem var(--pad);
    font-size: .8rem;
}
.breadcrumbs__list {
    display: flex;
    flex-wrap: wrap;
    gap: .25rem;
    align-items: center;
    max-width: var(--container);
    margin: 0 auto;
}
.breadcrumbs__item { color: var(--gray-600); }
.breadcrumbs__item a { color: var(--red); }
.breadcrumbs__item:not(:last-child)::after { content: '›'; margin-left: .25rem; color: var(--gray-400); }
.breadcrumbs__item--current { color: var(--text); }

/* ── Archive header ────────────────────────────────── */
.archive-header {
    background: var(--navy);
    color: var(--white);
    padding: 2rem var(--pad);
    margin-bottom: 2rem;
}
.archive-header h1 { color: var(--white); margin-bottom: .5rem; }
.archive-header p { color: rgba(255,255,255,.8); margin: 0; }

/* ── Footer ────────────────────────────────────────── */
.site-footer {
    background: var(--navy);
    color: rgba(255,255,255,.8);
    padding: 2rem 0 1rem;
}
.footer-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.footer-col h4 {
    color: var(--white);
    font-size: 1rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid var(--red);
}
.footer-col h4 a {
    color: var(--white);
    text-decoration: none;
}
.footer-col h4 a:hover { color: var(--gold); }
.footer-col ul { display: flex; flex-direction: column; gap: .5rem; }
.footer-col a { color: rgba(255,255,255,.75); font-size: .9rem; }
.footer-col a:hover { color: var(--gold); text-decoration: none; }
.footer-links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; font-size: .85rem; }
.footer-links a { color: rgba(255,255,255,.6); }
.footer-links li { list-style: none; }
.footer-links li a::before { content: ''; }

.footer-bottom {
    border-top: 1px solid rgba(255,255,255,.15);
    padding-top: 1rem;
    display: flex;
    flex-direction: column;
    gap: .75rem;
    align-items: center;
    text-align: center;
    font-size: .85rem;
}
.footer-bottom p { margin: 0; }
.footer-social {
    display: flex;
    gap: .75rem;
}
.footer-social a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,.1);
    border-radius: 50%;
    color: var(--white) !important;
    transition: background .2s;
}
.footer-social a:hover { background: var(--red); text-decoration: none; }

/* ── WhatsApp float ────────────────────────────────── */
.whatsapp-float {
    position: fixed;
    bottom: 80px;
    right: 16px;
    z-index: 999;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    background: #25D366;
    color: var(--white);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(37,211,102,.4);
    text-decoration: none;
    transition: transform .2s, box-shadow .2s;
}
.whatsapp-float:hover { transform: scale(1.1); box-shadow: 0 6px 20px rgba(37,211,102,.5); text-decoration: none; }
.whatsapp-float svg { width: 30px; height: 30px; }

/* ── Share row ─────────────────────────────────────── */
.share-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    padding: 1rem 0;
    border-top: 1px solid var(--gray-200);
    margin-top: 2rem;
}
.share-row__label { font-weight: 700; font-size: .9rem; color: var(--gray-600); width: 100%; }
.share-btn {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .4rem .85rem;
    border-radius: 99px;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: none;
    border: none;
    transition: opacity .15s;
    min-height: 36px;
}
.share-btn:hover { opacity: .85; text-decoration: none; }
.share-btn--facebook  { background: #1877F2; color: #fff; }
.share-btn--whatsapp  { background: #25D366; color: #fff; }
.share-btn--native    { background: var(--gray-200); color: var(--text); }

/* ── Anuncios — prevenir CLS ───────────────────────── */
.ad-container { min-height: 60px; text-align: center; overflow: hidden; }
.ad-container ins { display: block; }
.ad-placeholder { font-size: .8rem; color: var(--gray-400); padding: .5rem; border: 1px dashed var(--gray-200); border-radius: var(--radius); }

/* ── Paginación ────────────────────────────────────── */
.pagination {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: .5rem;
    padding: 2rem 0;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 .75rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: .9rem;
    color: var(--text);
}
.pagination .current { background: var(--red); color: var(--white); border-color: var(--red); }
.pagination a:hover { background: var(--gray-100); text-decoration: none; }
.nav-links { display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center; padding: 2rem 0; }

/* ── No results / Error ────────────────────────────── */
.no-results { text-align: center; padding: 4rem 1rem; }
.no-results h2 { margin-bottom: 1rem; }
.error-404 { text-align: center; padding: 4rem 1rem; }
.error-404 .error-code { font-size: 6rem; font-weight: 900; color: var(--gray-200); line-height: 1; }
.error-404 h2 { margin: 1rem 0 .5rem; }

/* ── Search form ───────────────────────────────────── */
.search-form { display: flex; gap: .5rem; }
.search-form input[type="search"] {
    flex: 1;
    padding: .6rem 1rem;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: .95rem;
    min-height: 44px;
}
.search-form button {
    background: var(--red);
    color: var(--white);
    border: none;
    padding: .6rem 1rem;
    border-radius: var(--radius);
    font-size: .95rem;
    font-weight: 700;
    min-height: 44px;
}
.search-form button:hover { background: var(--red-dark); }
/* Botón icono: cuadrado compacto */
.search-form button.search-btn--icon {
    padding: 0;
    width: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.nav-search-wrap .search-form button.search-btn--icon {
    width: 36px;
    min-width: 36px;
    min-height: 36px;
}

/* ── Accesibilidad ─────────────────────────────────── */
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    position: absolute;
    height: 1px;
    width: 1px;
    overflow: hidden;
    white-space: nowrap;
}
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ═══════════════════════════════════════════════════
   TABLET (600px+)
   ═══════════════════════════════════════════════════ */
@media (min-width: 600px) {
    :root { --pad: 1.5rem; }

    .card-grid          { grid-template-columns: repeat(2, 1fr); }
    .card-grid--4col    { grid-template-columns: repeat(2, 1fr); }
    .segment-grid       { grid-template-columns: repeat(2, 1fr); }

    .btn--full { width: auto; }

    .share-row__label { width: auto; }
    .footer-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ═══════════════════════════════════════════════════
   DESKTOP (1024px+)
   ═══════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    :root {
        --pad:     2rem;
        --section: 4rem;
    }

    /* Nav desktop: mostrar menú y búsqueda, ocultar hamburguesa y drawer */
    .nav-toggle        { display: none !important; }
    .mobile-drawer     { display: none !important; }
    .nav-menu-desktop  { display: flex; }
    .nav-search-wrap   { display: block; }

    /* Grids */
    .card-grid--3col { grid-template-columns: repeat(3, 1fr); }
    .card-grid--4col { grid-template-columns: repeat(4, 1fr); }
    .segment-grid    { grid-template-columns: repeat(var(--seg-cols, 4), 1fr); }

    /* Sidebar layout */
    .content-area--with-sidebar {
        display: grid;
        grid-template-columns: 1fr 300px;
        gap: 2rem;
        align-items: start;
    }
    .sidebar {
        display: block;
        position: sticky;
        top: 80px;
    }

    /* Hero */
    .hero { min-height: 480px; padding: 4rem 2rem 5rem; }

    /* Footer */
    .footer-grid { grid-template-columns: repeat(3, 1fr); }
    .footer-bottom { flex-direction: row; justify-content: space-between; text-align: left; }
}

/* ═══════════════════════════════════════════════════
   PÁGINAS DE ARCHIVO (Categorías / Taxonomías)
   ═══════════════════════════════════════════════════ */

/* ── Cabecera del archivo ──────────────────────────── */
.archive-header {
    background: var(--navy);
    color: var(--white);
    padding: 2rem var(--pad) 1.5rem;
}
.archive-header .container { display: flex; flex-direction: column; gap: .75rem; }
.archive-header h1 { color: var(--white); margin: 0; font-size: clamp(1.4rem, 4vw, 2rem); }
.archive-header__desc { color: rgba(255,255,255,.8); margin: 0; font-size: .95rem; line-height: 1.6; max-width: 700px; }
.archive-header__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    font-size: .82rem;
    color: rgba(255,255,255,.65);
}
.archive-count {
    background: rgba(255,255,255,.12);
    padding: .2rem .6rem;
    border-radius: 99px;
    font-weight: 700;
    color: var(--gold);
}

/* ── Pills de filtro (términos relacionados) ───────── */
.archive-filters {
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    padding: .75rem var(--pad);
}
.archive-filters__inner {
    max-width: var(--container);
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .4rem;
}
.archive-filters__label {
    font-size: .78rem;
    font-weight: 700;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: .05em;
    white-space: nowrap;
    margin-right: .25rem;
}
.archive-filter-pill {
    display: inline-flex;
    align-items: center;
    padding: .3rem .7rem;
    border-radius: 99px;
    font-size: .8rem;
    font-weight: 600;
    background: var(--white);
    border: 1px solid var(--gray-200);
    color: var(--navy);
    text-decoration: none;
    transition: background .15s, color .15s, border-color .15s;
    white-space: nowrap;
}
.archive-filter-pill:hover,
.archive-filter-pill--active {
    background: var(--red);
    color: var(--white);
    border-color: var(--red);
    text-decoration: none;
}

/* ── Grid del archivo ──────────────────────────────── */
.archive-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
    padding: 2rem 0 3rem;
}
@media (min-width: 600px) {
    .archive-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1024px) {
    .archive-grid { grid-template-columns: repeat(var(--archive-cols, 3), 1fr); }
}

/* ── Card de artículo en archivo ───────────────────── */
.archive-card {
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
    transition: transform .2s, box-shadow .2s;
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
}
.archive-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); text-decoration: none; }

.archive-card__img-wrap { display: block; overflow: hidden; flex-shrink: 0; }
.archive-card__img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform .3s;
}
.archive-card:hover .archive-card__img { transform: scale(1.04); }
.archive-card__img--placeholder {
    height: 200px;
    background: linear-gradient(135deg, var(--gray-100), var(--gray-200));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
}

.archive-card__body { padding: 1rem; flex: 1; display: flex; flex-direction: column; gap: .4rem; }
.archive-card__tax {
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--red);
    text-decoration: none;
}
.archive-card__tax:hover { text-decoration: underline; }
.archive-card__title {
    font-size: .95rem;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.4;
    margin: 0;
    flex: 1;
}
.archive-card__title a { color: inherit; text-decoration: none; }
.archive-card__title a:hover { color: var(--red); }
.archive-card__excerpt {
    font-size: .82rem;
    color: var(--gray-600);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.archive-card__footer {
    padding: .6rem 1rem;
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: .4rem;
    font-size: .78rem;
    color: var(--gray-600);
}
.archive-card__meta { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.archive-card__date { white-space: nowrap; }
.archive-card__author a { color: var(--gray-600); }
.archive-card__author a:hover { color: var(--red); text-decoration: none; }
.archive-card__readmore {
    color: var(--red);
    font-weight: 700;
    font-size: .82rem;
    white-space: nowrap;
    text-decoration: none;
}
.archive-card__readmore:hover { text-decoration: underline; }

/* ── Sección relacionados al final del archivo ─────── */
.archive-related {
    background: var(--gray-50);
    border-top: 1px solid var(--gray-200);
    padding: 2rem 0;
}
.archive-related__title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--navy);
    margin-bottom: .75rem;
}
.archive-related__pills { display: flex; flex-wrap: wrap; gap: .4rem; }
