/* ==========================================================================
   site_min.css — CSS CRÍTICO DE FORMATO BASE (carga inicial bloqueante).
   Contiene SOLO el CSS mínimo necesario para que la estructura de la página
   (encabezado, navegación, layout, sidebar, grilla base y footer base) se
   renderice correctamente en el primer pintado.
   El resto de estilos específicos vive en site.css (carga diferida/async).
   ========================================================================== */

:root {
    --primary: #2d3436;
    --branding: #10a588;
    --accent: #258e79;
    --text: #4a4d4f;
    --light: #f9f9f9;
    --border: #e1e8ed;
    --surface: #ffffff;
    --badge-bg: #e6f8f4;

    --btn-primary: #10a588;
    --btn-primary-hover: #009d7e;

    --gratis: #03A9F4;
    --gratis-hover: #132c71;

    --oferta-descuento: #e15b4f;
    --oferta-descuento-text: #ffffff;
    --oferta-tag-bg: #e15b4f;
    --oferta-tag-text: #ffffff;
    --oferta-caja-bg: #ffffff;
}

/* ===== BASE ===== */
body {
    font-family: 'Segoe UI', Roboto, -apple-system, BlinkMacSystemFont, Helvetica, Arial, sans-serif;
    line-height: 1.2;
    color: var(--primary);
    background-color: var(--light);
    margin: 0;
    padding: 0 0 2rem 0;
    font-size: 1em;
}

/* ===== HEADER ===== */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
    margin-bottom: 1rem;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-container {
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 12px;
}

.site-brand {
    grid-column: 2;
    justify-self: center;
    display: flex;
    align-items: center;
    gap: 12px;
}

.site-logo {
    height: 40px;
    width: auto;
    display: block;
}

.site-title {
    font-size: 1.4em;
    font-weight: bold;
    color: var(--primary);
    margin: 0;
    text-decoration: none;
}

.site-title span {
    color: var(--branding);
}

/* Botón hamburguesa: posición en la grilla del header + su propia apariencia */
.sidebar-toggle-btn {
    grid-column: 1;
    justify-self: start;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    cursor: pointer;
    padding: 0;
}

.sidebar-toggle-btn span {
    display: block;
    width: 20px;
    height: 2px;
    background: var(--primary);
    border-radius: 2px;
}

.header-icon-group {
    grid-column: 3;
    justify-self: end;
    display: flex;
    align-items: center;
    gap: 6px;
}

.header-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 8px;
    color: var(--primary);
    transition: background 0.2s, color 0.2s;
}

.header-icon-link:hover {
    background: var(--light);
    color: var(--accent);
}

.header-icon-link:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
/* Pastillas de navegación */
.nav-pill {
    color: var(--primary);
    text-decoration: none;
    background: var(--border);
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    transition: background 0.2s, color 0.2s;
}

.nav-pill:hover {
    background: var(--accent);
    color: white;
}

/* BARRA DE CATEGORÍAS BAJO EL HEADER (solo mobile) */
.mobile-category-bar {
    display: none;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 1.5rem;
    font-size: 0.85em;
    color: var(--text);
    text-align: left;
}

.breadcrumb a {
    color: var(--text);
    text-decoration: underline;
}

.breadcrumb a:hover {
    color: var(--accent);
}

.breadcrumb-sep {
    color: var(--border);
}

.breadcrumb-current {
    color: var(--primary);
    font-weight: bold;
}

/* ===== LAYOUT PRINCIPAL ===== */
.main-layout {
    display: grid;
    grid-template-columns: 215px 1fr;
    gap: 1rem;
    margin: 0 auto;
    padding: 0 1rem;
    align-items: start;
    box-sizing: border-box;
}

/* Evita que el contenido fuerce scroll horizontal por min-width:auto por defecto */
.main-layout > * {
    min-width: 0;
}

.main-layout.sidebar-collapsed {
    grid-template-columns: 1fr;
}

.main-layout.sidebar-collapsed .sidebar-column {
    display: none;
}

/* ===== SIDEBAR ===== */
.sidebar-column {
    position: sticky;
    top: calc(var(--header-height, 72px) + 1rem);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.sidebar-menu {
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 1.5rem;
    border-radius: 12px;
    font-size: 0.9em;
}

.sidebar-menu h3 {
    font-size: 1.1em;
    margin: 0 0 1rem 0;
    color: var(--primary);
    border-bottom: 2px solid var(--light);
    padding-bottom: 0.5rem;
}

.sidebar-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar-menu li {
    margin-bottom: 0.5rem;
}

.sidebar-menu li a {
    display: block;
    padding: 6px 5px;
    color: var(--text);
    text-decoration: none;
    font-size: 0.9em;
    font-weight: 500;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
}

.sidebar-menu li a.active,
.sidebar-menu li a:hover {
    background: var(--light);
    color: var(--accent);
    font-weight: bold;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 998;
}

.sidebar-backdrop.visible {
    display: block;
}
/* ===== CONTENIDO / GRILLA DE TARJETAS ===== */
.content-area {
    background: var(--surface);
    padding: 3rem 2rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.02);
}

.content-area h1 {
    font-size: 2em;
    margin: 0 0 2.5rem 0;
    color: var(--primary);
    text-align: center;
}

.content-area .subtitle {
    color: var(--text);
    margin-bottom: 3rem;
    font-size: 1.05em;
    display: none;
}

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

.grid-resources.list-mode {
    gap: 1rem;
}

/* ===== FOOTER (base) ===== */
.site-footer {
    text-align: center;
    padding: 3rem 1rem 2rem 1rem;
    color: var(--text);
    font-size: 0.85em;
    border-top: 1px solid var(--border);
    margin-top: 3rem;
    clear: both;
}

/* ===== RESPONSIVE (unificado en un solo breakpoint de 900px) =====
   Solo las reglas estructurales críticas del layout base. */
@media (max-width: 900px) {
    .site-header {
        padding: 1rem;
        margin-bottom: 0;
        position: sticky;
        z-index: 1000;
    }

    .main-layout {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0;
    }

    .sidebar-column {
        position: static;
    }

    .sidebar-container {
        position: fixed;
        top: var(--header-height, 72px);
        left: 0;
        height: calc(100vh - var(--header-height, 72px));
        height: calc(100dvh - var(--header-height, 72px));
        width: 85%;
        max-width: 300px;
        margin: 0;
        background: var(--light);
        z-index: 999;
        padding: 1.5rem;
        padding-bottom: calc(1.5rem + env(safe-area-inset-bottom));
        overflow-y: auto;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
        transition: transform 0.25s ease;
    }

    .sidebar-container.sidebar-open {
        transform: translateX(0);
    }

    .content-area {
        padding: 2rem 1rem;
    }

    .site-title {
        font-size: 1em;
    }

    .mobile-category-bar {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 0.75rem 1rem;
        background: var(--surface);
        border-bottom: 1px solid var(--border);
        -webkit-overflow-scrolling: touch;
        position: sticky;
        top: var(--header-height, 72px);
        z-index: 999;
        scrollbar-width: none;
        -ms-overflow-style: none;
        font-size: 0.75em;
    }

    .mobile-category-bar::-webkit-scrollbar {
        display: none;
    }

    .mobile-category-bar .nav-pill {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .mobile-category-bar .nav-pill.active {
        background: var(--accent);
        color: #fff;
    }

    .grid-resources.list-mode {
        grid-template-columns: 1fr;
    }
}

@media (min-width: 901px) {
    .content-area {
        min-height: calc(var(--sidebar-height, 1000px) + 40vh);
    }
}