/* ============================================================
   BIBLIOTECA MISIONERA — Estilos basados en el diseño aprobado
   Paleta: crema de papel + verde oliva + salvia + terracota
   Tipografías: Gloock (serif) + DM Sans (sans)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Gloock&family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400;1,9..40,500&display=swap');

:root {
    /* Paleta principal — fondos confirmados por el cliente */
    --c-bg:           #f9f7ef;   /* Fondo general de la web */
    --c-bg-warm:      #f0ebe0;   /* Banner Colaborar y Footer */
    --c-bg-warm-border: #ddd0b0; /* Borde del banner Colaborar */
    --c-surface:      #ffffff;   /* Tarjetas de libro */
    --c-surface-alt:  #f0ebe0;   /* Separadores cálidos */

    --c-ink:          #2d3d2c;   /* Verde oliva muy oscuro (texto) */
    --c-ink-soft:     #4a5a48;
    --c-muted:        #7a7666;
    --c-muted-light:  #a8a393;

    --c-line:         #e2dac6;   /* Bordes sutiles, ajustado al fondo nuevo */
    --c-line-strong:  #c2b89c;

    --c-olive:        #5a7052;   /* Verde oliva medio (acentos) */
    --c-olive-dark:   #3f5138;
    --c-sage:         #a8c09a;   /* Salvia claro (portadas) */
    --c-sage-soft:    #c9dabe;

    --c-terracotta:       #c66b3d;   /* Colaborar */
    --c-terracotta-dark:  #a85526;

    --c-ocean:        #2d4a52;   /* Descargar */
    --c-ocean-dark:   #1f3741;

    --c-amber:        #c4943a;   /* Badge "Nuevo" */
    --c-amber-soft:   #e8d8a8;

    /* Marcadores de catálogo (puntos) */
    --dot-general:    #5a7052;
    --dot-islam:      #2d4a52;
    --dot-tienda:     #c66b3d;

    /* Tipografías */
    --font-serif: 'Gloock', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
    --font-sans:  'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

    /* Medidas */
    --container-max: 1280px;
    --container-pad: 2rem;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-pill: 999px;

    --shadow-sm: 0 1px 2px rgba(45, 61, 44, 0.06);
    --shadow-md: 0 4px 12px rgba(45, 61, 44, 0.08);
    --shadow-lg: 0 20px 50px rgba(45, 61, 44, 0.18);
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.6;
    color: var(--c-ink);
    background: var(--c-bg);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "ss01", "cv11";
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--c-olive-dark); text-decoration: none; transition: color 0.15s; }
a:hover { color: var(--c-olive); }
h1, h2, h3, h4 {
    font-family: var(--font-serif);
    font-weight: 500;
    line-height: 1.1;
    margin: 0 0 0.75rem;
    color: var(--c-ink);
    letter-spacing: -0.01em;
}
button { font-family: inherit; cursor: pointer; }

.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 var(--container-pad);
}

/* ============================================================
   HEADER — Logo + Navegación de idioma + Modo oscuro
   ============================================================ */
.site-header {
    padding: 1.5rem 0;
    background: var(--c-bg);
    border-bottom: 1px solid transparent;
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    color: var(--c-ink);
    text-decoration: none;
}
.brand:hover { text-decoration: none; color: var(--c-ink); }

.brand-logo {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--c-sage-soft);
    border: 1.5px solid var(--c-olive);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.brand-logo svg {
    width: 28px; height: 28px;
    color: var(--c-olive-dark);
}

.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
    font-family: var(--font-serif);
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.brand-sub {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 0.2rem;
    font-weight: 500;
}

/* Controles de la derecha: idiomas + modo oscuro + buscar */
.header-controls {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}
.lang-switch {
    display: flex;
    gap: 0.25rem;
    margin-right: 0.5rem;
}
.lang-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    background: transparent;
    border: 1.5px solid var(--c-line-strong);
    border-radius: var(--radius-sm);
    color: var(--c-muted);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
    line-height: 1;
}
.lang-btn:hover {
    color: var(--c-ink);
    border-color: var(--c-olive);
}
.lang-btn.is-active {
    color: var(--c-olive-dark);
    border-color: var(--c-olive);
    background: rgba(168, 192, 154, 0.2);
}

.icon-btn {
    width: 38px; height: 38px;
    display: grid;
    place-items: center;
    border: 1.5px solid var(--c-line-strong);
    background: transparent;
    border-radius: var(--radius-sm);
    color: var(--c-muted);
    cursor: pointer;
    transition: all 0.15s;
    text-decoration: none;
}
.icon-btn:hover {
    color: var(--c-ink);
    border-color: var(--c-olive);
}
.icon-btn svg { width: 18px; height: 18px; }

/* Flash messages */
.flash {
    padding: 0.75rem 0;
    font-size: 0.9rem;
    border-bottom: 1px solid var(--c-line);
}
.flash-success { background: #e5edd8; color: #3a5727; }
.flash-error   { background: #f5d9cc; color: #8e341a; }
.flash-info    { background: #d9e5e8; color: #234750; }

/* ============================================================
   HERO — Titular gigante + stats + buscador
   ============================================================ */
.hero {
    padding: 2rem 0 3rem;
    position: relative;
}
.hero-inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 3rem;
    align-items: center;
}
.hero-kicker {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-olive);
    text-transform: uppercase;
    letter-spacing: 0.15em;
    margin-bottom: 1rem;
}
.hero-title {
    font-family: var(--font-serif);
    font-weight: 400;
    font-size: clamp(2.5rem, 5vw + 1rem, 4.5rem);
    line-height: 0.95;
    letter-spacing: -0.025em;
    color: var(--c-ink);
    margin: 0 0 1.5rem;
}
.hero-subtitle {
    font-size: 1.05rem;
    color: var(--c-ink-soft);
    max-width: 560px;
    margin: 0 0 2rem;
    line-height: 1.65;
}

/* Stats: números enormes */
.hero-stats {
    display: flex;
    gap: 3rem;
    flex-wrap: wrap;
    margin-bottom: 2rem;
}
.hero-stat-value {
    font-family: var(--font-serif);
    font-size: 2.5rem;
    font-weight: 500;
    color: var(--c-olive-dark);
    line-height: 1;
    letter-spacing: -0.01em;
}
.hero-stat-label {
    font-family: var(--font-sans);
    font-size: 0.7rem;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 0.5rem;
    font-weight: 600;
}

/* Buscador hero */
.hero-search {
    position: relative;
    max-width: 560px;
}
.hero-search input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    border: 1.5px solid var(--c-line-strong);
    border-radius: var(--radius-pill);
    background: var(--c-surface);
    font-family: var(--font-sans);
    font-size: 1rem;
    color: var(--c-ink);
    transition: all 0.15s;
}
.hero-search input:focus {
    outline: none;
    border-color: var(--c-olive);
    background: white;
    box-shadow: 0 0 0 3px rgba(90, 112, 82, 0.12);
}
.hero-search-icon {
    position: absolute;
    left: 1.125rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-muted);
    pointer-events: none;
}
.hero-search-icon svg { width: 18px; height: 18px; }

/* Globo decorativo (lado derecho) */
.hero-globe {
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0.4;
}
.hero-globe svg {
    width: 100%;
    max-width: 320px;
    color: var(--c-olive);
}

@media (max-width: 900px) {
    .hero-inner { grid-template-columns: 1fr; gap: 1.5rem; }
    .hero-globe { display: none; }
}

/* ============================================================
   TABS (Toda la biblioteca · Recursos · Musulmania · Tienda)
   ============================================================ */
.tabs-wrap {
    border-bottom: 1px solid var(--c-line);
    margin-bottom: 0;
    position: sticky;
    top: 0;
    background: var(--c-bg);
    z-index: 40;
}
.tabs {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    overflow-x: auto;
    scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }

.tab {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 2rem;
    font-family: var(--font-sans);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--c-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md) var(--radius-md) 0 0;
    cursor: pointer;
    text-decoration: none;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    transition: all 0.15s;
}
.tab:hover { color: var(--c-ink); text-decoration: none; }
.tab.is-active {
    color: var(--c-ink);
    background: var(--c-surface);
    border-bottom-color: var(--c-surface);
    border-color: var(--c-line);
    border-bottom-color: var(--c-surface);
}
.tab-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    background: var(--dot-color, var(--c-muted));
}
.tab-count {
    background: rgba(122, 118, 102, 0.15);
    color: var(--c-ink-soft);
    font-size: 0.8rem;
    padding: 0.15rem 0.6rem;
    border-radius: var(--radius-pill);
    font-weight: 500;
}
.tab.is-active .tab-count {
    background: rgba(90, 112, 82, 0.18);
    color: var(--c-olive-dark);
}

/* Subnav (Advertencia, Bibliografía, etc.) */
.subnav {
    border-bottom: 1px solid var(--c-line);
    background: var(--c-bg);
}
.subnav-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    flex-wrap: wrap;
}
.subnav-links {
    display: flex;
    gap: 0.5rem;
    list-style: none;
    padding: 0;
    margin: 0;
    flex-wrap: wrap;
}
.subnav-links a {
    display: inline-block;
    padding: 0.4rem 0.875rem;
    color: var(--c-ink-soft);
    font-size: 0.9rem;
    border-radius: var(--radius-sm);
    text-decoration: none;
    transition: all 0.15s;
}
.subnav-links a:hover {
    background: var(--c-surface-alt);
    color: var(--c-ink);
}

/* Botón Colaborar */
.btn-collaborate {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem;
    background: var(--c-terracotta);
    color: white;
    border: none;
    border-radius: var(--radius-pill);
    font-family: var(--font-sans);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.15s;
}
.btn-collaborate:hover {
    background: var(--c-terracotta-dark);
    color: white;
    text-decoration: none;
}
.btn-collaborate svg { width: 14px; height: 14px; fill: currentColor; }

/* ============================================================
   GRUPO DE CATEGORÍAS (Separador horizontal + título)
   ============================================================ */
.category-group {
    padding: 2.5rem 0 1.5rem;
}
.category-separator {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
}
.category-separator::before,
.category-separator::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-line);
    max-width: 350px;
}
.category-separator-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.16em;
    display: inline-flex;
    align-items: center;
    gap: 0.875rem;
}
.category-separator-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 0 0.5rem;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--c-ink-soft);
}

/* ============================================================
   GRID Y TARJETAS DE LIBRO
   ============================================================ */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 2rem 0 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}
.results-count {
    color: var(--c-ink);
    font-size: 0.95rem;
}
.results-count strong { font-weight: 600; }
.results-count-label { color: var(--c-muted); }

.sort-select {
    padding: 0.5rem 0.875rem;
    background: var(--c-surface);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--c-ink);
    cursor: pointer;
}

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

.book-card {
    display: flex;
    flex-direction: column;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all 0.25s;
    text-decoration: none;
    color: inherit;
    position: relative;
}
.book-card:hover {
    border-color: var(--c-line-strong);
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
    text-decoration: none;
}

/* Portada procedural (iniciales sobre patrón) */
.book-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    background: var(--c-bg-warm);
    overflow: hidden;
    border-bottom: 1px solid var(--c-line);
}
.book-cover-pattern {
    position: absolute;
    inset: 0;
    opacity: 0.55;
}
.book-cover-initials {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: var(--c-sage);
    display: grid;
    place-items: center;
    font-family: var(--font-serif);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--c-ink);
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(45, 61, 44, 0.12);
}
.book-cover img {
    width: 100%; height: 100%;
    object-fit: cover;
}

.book-body {
    padding: 1rem 1.125rem 1.125rem;
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 0.5rem;
}
.book-badge-catalog {
    display: inline-block;
    width: fit-content;
    background: var(--c-sage-soft);
    color: var(--c-olive-dark);
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.2rem 0.55rem;
    border-radius: var(--radius-sm);
}
.book-badge-catalog.is-islam {
    background: #c7d8dd;
    color: var(--c-ocean);
}
.book-badge-catalog.is-tienda {
    background: #f1d3bf;
    color: var(--c-terracotta-dark);
}

.book-title {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    line-height: 1.25;
    margin: 0;
    letter-spacing: -0.005em;
}
.book-title a { color: inherit; }
.book-authors {
    font-size: 0.85rem;
    color: var(--c-muted);
    font-style: italic;
    margin: 0;
}
.book-description {
    font-size: 0.82rem;
    color: var(--c-ink-soft);
    line-height: 1.45;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}
.book-footer {
    margin-top: auto;
    padding-top: 0.875rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
}
.book-pages {
    font-size: 0.8rem;
    color: var(--c-muted);
}

/* Badge "Nuevo" esquina */
.book-badge-new {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: var(--c-amber);
    color: white;
    font-family: var(--font-sans);
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.25rem 0.6rem;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    z-index: 5;
}

/* ============================================================
   BOTONES
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    font-family: var(--font-sans);
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.2;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 14px; height: 14px; }
.btn-sm { padding: 0.4rem 0.875rem; font-size: 0.8rem; }

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

.btn-olive {
    background: var(--c-olive-dark);
    color: white;
    border-color: var(--c-olive-dark);
}
.btn-olive:hover { background: var(--c-ink); color: white; }

.btn-terracotta {
    background: var(--c-terracotta);
    color: white;
    border-color: var(--c-terracotta);
}
.btn-terracotta:hover { background: var(--c-terracotta-dark); color: white; }

.btn-ghost {
    background: transparent;
    border-color: var(--c-line-strong);
    color: var(--c-ink);
}
.btn-ghost:hover { background: var(--c-surface-alt); }

.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   FICHA DE LIBRO (modal o página completa)
   ============================================================ */
.book-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(45, 61, 44, 0.55);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    z-index: 100;
    overflow-y: auto;
}
.book-detail-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    max-width: 800px;
    width: 100%;
    padding: 2.5rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-close {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    width: 36px; height: 36px;
    border: none;
    background: var(--c-surface-alt);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--c-ink);
    display: grid;
    place-items: center;
    text-decoration: none;
    font-size: 1.25rem;
}
.modal-close:hover { background: var(--c-line); color: var(--c-ink); }

.book-detail {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 2rem;
    align-items: start;
}
@media (max-width: 700px) {
    .book-detail { grid-template-columns: 1fr; }
    .book-detail-cover { max-width: 200px; margin: 0 auto; }
    .book-detail-card { padding: 1.5rem; }
}
.book-detail-cover {
    position: relative;
    aspect-ratio: 1 / 1;
    border-radius: var(--radius-md);
    overflow: hidden;
    background: var(--c-bg-warm);
}
.book-detail-cover .book-cover-pattern { opacity: 0.55; }
.book-detail-cover .book-cover-initials {
    width: 85px; height: 85px;
    font-size: 1.75rem;
}
.book-detail-cover .book-badge-catalog-strip {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    background: rgba(45, 61, 44, 0.8);
    color: white;
    text-align: center;
    padding: 0.4rem;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.book-detail-content h2 {
    font-size: 1.875rem;
    line-height: 1.15;
    margin: 0 0 0.5rem;
    letter-spacing: -0.015em;
}
.book-detail-content .book-authors {
    font-size: 0.95rem;
    margin-bottom: 1rem;
}
.book-detail-content .book-description {
    font-size: 0.95rem;
    color: var(--c-ink-soft);
    line-height: 1.6;
    margin-bottom: 1.5rem;
    -webkit-line-clamp: unset;
    display: block;
}

/* Selector de formatos */
.format-selector {
    background: var(--c-bg-warm);
    border-radius: var(--radius-md);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
}
.format-selector-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.875rem;
}
.format-selector-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-ink);
}
.format-back-btn {
    font-size: 0.85rem;
    color: var(--c-olive-dark);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    text-decoration: none;
}
.format-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0.75rem;
    border-top: 1px solid var(--c-line);
}
.format-row:first-of-type { border-top: none; }
.format-row-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--c-ink);
}
.format-row-label.disabled { color: var(--c-muted); font-weight: 500; }
.format-row-action {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.format-row .btn-sm {
    background: var(--c-ocean);
    color: white;
    font-size: 0.8rem;
    padding: 0.35rem 0.875rem;
}
.format-coming {
    font-size: 0.75rem;
    color: var(--c-muted);
    font-style: italic;
    padding: 0.35rem 0.875rem;
    background: var(--c-surface-alt);
    border-radius: var(--radius-sm);
}

/* Panel "Este material es gratuito" */
.free-panel {
    background: var(--c-amber-soft);
    border-radius: var(--radius-md);
    padding: 1.25rem;
}
.free-panel h4 {
    font-size: 1rem;
    font-family: var(--font-sans);
    font-weight: 600;
    margin: 0 0 0.4rem;
    color: var(--c-ink);
}
.free-panel p {
    font-size: 0.85rem;
    color: var(--c-ink-soft);
    line-height: 1.5;
    margin: 0 0 0.875rem;
}

/* Meta bibliografía */
.book-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.875rem;
    margin: 1.25rem 0;
    padding: 1rem 0;
    border-top: 1px solid var(--c-line);
    border-bottom: 1px solid var(--c-line);
    font-size: 0.85rem;
}
.book-meta-grid dt {
    color: var(--c-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.25rem;
    font-weight: 600;
}
.book-meta-grid dd { margin: 0; font-weight: 500; color: var(--c-ink); }

/* ============================================================
   MODAL GENÉRICO (Colaborar, Bibliografía, Histórico)
   ============================================================ */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(45, 61, 44, 0.55);
    backdrop-filter: blur(4px);
    display: grid;
    place-items: center;
    padding: 2rem 1rem;
    z-index: 100;
    overflow-y: auto;
}
.modal-card {
    background: var(--c-surface);
    border-radius: var(--radius-lg);
    max-width: 600px;
    width: 100%;
    padding: 2.5rem;
    position: relative;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}
.modal-card.centered { text-align: center; }
.modal-card.centered h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}
.modal-icon {
    width: 56px; height: 56px;
    background: var(--c-terracotta);
    border-radius: var(--radius-pill);
    display: grid; place-items: center;
    margin: 0 auto 1rem;
    color: white;
}

/* ============================================================
   PANEL COLABORAR (banner inferior)
   ============================================================ */
.collaborate-banner {
    background: var(--c-bg-warm);
    border: 1px solid var(--c-bg-warm-border);
    border-radius: var(--radius-lg);
    padding: 2rem 2.5rem;
    margin: 3rem 0 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
}
.collaborate-banner h3 {
    font-family: var(--font-serif);
    font-size: 1.5rem;
    margin: 0 0 0.4rem;
    line-height: 1.2;
}
.collaborate-banner p {
    margin: 0;
    color: var(--c-ink-soft);
    font-size: 0.95rem;
    max-width: 540px;
}

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    padding: 2rem 0;
    border-top: 1px solid var(--c-line);
    margin-top: 4rem;
    background: var(--c-bg-warm);
}
.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 2rem;
    flex-wrap: wrap;
}
.site-footer h4 {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    margin: 0 0 0.25rem;
}
.footer-disclaimer {
    font-size: 0.8rem;
    color: var(--c-muted);
    max-width: 520px;
    margin: 0;
    line-height: 1.5;
}
.footer-links {
    display: flex;
    gap: 1.5rem;
    font-size: 0.9rem;
    flex-wrap: wrap;
}
.footer-links a { color: var(--c-ink-soft); }
.footer-links a:hover { color: var(--c-olive); }

/* ============================================================
   FILTROS Y PAGINACIÓN
   ============================================================ */
.filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem;
    background: var(--c-surface);
    border: 1px solid var(--c-line);
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}
.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    min-width: 160px;
    flex: 1;
}
.filter-group label {
    font-size: 0.7rem;
    color: var(--c-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}
.filter-group input,
.filter-group select {
    padding: 0.55rem 0.75rem;
    background: var(--c-bg);
    border: 1px solid var(--c-line-strong);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.9rem;
    color: var(--c-ink);
}
.filter-group input:focus,
.filter-group select:focus {
    outline: none;
    border-color: var(--c-olive);
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 3rem;
    list-style: none;
    padding: 0;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--c-line);
    background: var(--c-surface);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--c-ink);
    text-decoration: none;
}
.pagination a:hover {
    background: var(--c-bg-warm);
    border-color: var(--c-line-strong);
}
.pagination .current {
    background: var(--c-olive-dark);
    color: white;
    border-color: var(--c-olive-dark);
}
.pagination .disabled { color: var(--c-muted); cursor: not-allowed; opacity: 0.5; }

/* Empty state */
.empty-state {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--c-muted);
}
.empty-state h3 {
    font-family: var(--font-serif);
    color: var(--c-ink);
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

/* Static pages */
.static-page {
    max-width: 760px;
    margin: 0 auto;
    padding: 3rem 0;
}
.static-page h1 {
    font-size: clamp(2rem, 3vw + 1rem, 3rem);
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--c-line);
}
.static-page .prose {
    font-size: 1.05rem;
    line-height: 1.75;
    color: var(--c-ink-soft);
}
.static-page .prose p { margin-bottom: 1.25rem; }
.static-page .prose h2 {
    margin-top: 2.5rem;
    font-size: 1.5rem;
    color: var(--c-ink);
}
.static-page .prose a { color: var(--c-olive); text-decoration: underline; }

/* Breadcrumb */
.breadcrumb {
    font-size: 0.85rem;
    color: var(--c-muted);
    margin: 1.5rem 0 0.5rem;
}
.breadcrumb a { color: var(--c-muted); }
.breadcrumb a:hover { color: var(--c-olive); }

/* Author page */
.author-hero {
    padding: 3rem 0 2rem;
}
.author-hero h1 {
    font-size: clamp(2rem, 3vw + 1rem, 3rem);
    margin-bottom: 0.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 800px) {
    .container { --container-pad: 1.25rem; }
    .header-inner { flex-wrap: wrap; gap: 1rem; }
    .lang-switch { margin-right: 0 ;}
    .hero { padding: 1rem 0 2rem; }
    .hero-stats { gap: 1.5rem; }
    .hero-stat-value { font-size: 2rem; }
    .tab { padding: 0.75rem 1rem; font-size: 0.85rem; }
    .book-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
    .book-body { padding: 0.75rem 0.875rem 1rem; }
    .book-title { font-size: 0.95rem; }
    .book-description { -webkit-line-clamp: 2; }
    .collaborate-banner { padding: 1.5rem; flex-direction: column; text-align: center; }
}

/* Modo oscuro opcional (mínimo: para el toggle del diseño) */
body.dark {
    --c-bg:           #1c241b;
    --c-bg-warm:      #232b21;
    --c-surface:      #2a3328;
    --c-surface-alt:  #323b30;
    --c-ink:          #e8e3d2;
    --c-ink-soft:     #c5c0b0;
    --c-muted:        #9a9686;
    --c-line:         #3c4438;
    --c-line-strong:  #525948;
}
