/* ==========================================================================
   PUENTES LITERARIOS & ADN LECTOR (Libros Más Libres & Autores y Libros)
   Cumplimiento Estricto: Ley de la Tinta WCAG AAA (>13.5:1), Cero Pill Fatigue
   ========================================================================== */

.lbe-section {
    --lbe-bg: var(--color-soft, #f8fafc);
    --lbe-surface: var(--color-paper, #ffffff);
    --lbe-ink: var(--color-ink, #0f172a);
    --lbe-meta: var(--color-muted, #334155);
    --lbe-border: var(--color-line, #e2e8f0);
    --lbe-accent: var(--color-primary, var(--color-accent, #0f766e));
    --lbe-accent-hover: var(--color-accent-dark, #115e59);
    --lbe-accent-tint: rgba(15, 118, 110, 0.06);
    --lbe-font-heading: var(--font-editorial, 'Inter', system-ui, sans-serif);
    --lbe-font-body: var(--font-ui, 'Inter', system-ui, sans-serif);
    --lbe-radius: 6px;

    padding: clamp(2.5rem, 5vw, 4rem) 0;
    background: var(--lbe-bg);
    color: var(--lbe-ink);
    font-family: var(--lbe-font-body);
    border-top: 1px solid var(--lbe-border);
    border-bottom: 1px solid var(--lbe-border);
}

/* Adaptación Nobleza Editorial para Autores y Libros (libreria-theme) */
.libreria-theme .lbe-section {
    --lbe-bg: #fdfcf7;
    --lbe-surface: #ffffff;
    --lbe-ink: #0f172a;
    --lbe-meta: #334155;
    --lbe-border: rgba(15, 23, 42, 0.10);
    --lbe-accent: #8B1E1E;
    --lbe-accent-hover: #701616;
    --lbe-accent-tint: rgba(139, 30, 30, 0.05);
    --lbe-font-heading: 'Playfair Display', 'Lora', Georgia, serif;
}

/* Polaridad Modo Noche (Zero-Contrast Bugs) */
.dark-theme .lbe-section,
[data-theme="dark"] .lbe-section {
    --lbe-bg: #0a0e17;
    --lbe-surface: #121824;
    --lbe-ink: #f8fafc;
    --lbe-meta: #cbd5e1;
    --lbe-border: rgba(255, 255, 255, 0.12);
    --lbe-accent: #38bdf8;
    --lbe-accent-hover: #0ea5e9;
    --lbe-accent-tint: rgba(56, 189, 248, 0.10);
}

.lbe-container {
    width: min(1140px, calc(100% - 2rem));
    margin: 0 auto;
}

.lbe-header {
    max-width: 780px;
    margin-bottom: 1.75rem;
}

.lbe-kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--lbe-accent);
    margin-bottom: 0.6rem;
}

.lbe-title {
    font-family: var(--lbe-font-heading);
    font-size: clamp(1.65rem, 3.2vw, 2.35rem);
    font-weight: 700;
    line-height: 1.2;
    color: var(--lbe-ink);
    margin: 0 0 0.75rem 0;
    letter-spacing: -0.02em;
}

.lbe-lead {
    font-size: 1.06rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--lbe-ink);
    margin: 0;
}

/* Barra de Búsqueda Interactiva */
.lbe-search-panel {
    background: var(--lbe-surface);
    border: 1px solid var(--lbe-border);
    border-radius: var(--lbe-radius);
    padding: 1.25rem;
    box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
    margin-bottom: 1.75rem;
}

.lbe-search-form {
    display: flex;
    gap: 0.75rem;
    align-items: stretch;
}

.lbe-input-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.lbe-input-icon {
    position: absolute;
    left: 0.95rem;
    color: var(--lbe-meta);
    pointer-events: none;
    display: flex;
}

.lbe-search-input {
    width: 100%;
    min-height: 48px;
    padding: 0.75rem 1rem 0.75rem 2.75rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--lbe-ink);
    background: var(--lbe-bg);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.lbe-search-input:focus {
    outline: none;
    border-color: var(--lbe-accent);
    box-shadow: 0 0 0 3px var(--lbe-accent-tint);
}

.lbe-search-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 48px;
    padding: 0 1.4rem;
    background: var(--lbe-accent);
    color: #ffffff;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, transform 0.15s ease;
}

.dark-theme .lbe-search-btn,
[data-theme="dark"] .lbe-search-btn {
    color: #020617;
}

.lbe-search-btn:hover {
    background: var(--lbe-accent-hover);
    transform: translateY(-1px);
}

.lbe-presets-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--lbe-border);
}

.lbe-presets-label {
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--lbe-meta);
    margin-right: 0.25rem;
}

.lbe-preset-btn {
    background: transparent;
    color: var(--lbe-ink);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    padding: 0.38rem 0.72rem;
    font-size: 0.86rem;
    font-weight: 600;
    cursor: pointer;
    min-height: 36px;
    transition: border-color 0.18s ease, background 0.18s ease, color 0.18s ease;
}

.lbe-preset-btn:hover,
.lbe-preset-btn.is-active {
    border-color: var(--lbe-accent);
    background: var(--lbe-accent-tint);
    color: var(--lbe-accent);
}

/* Resultado del Diagnóstico de ADN Lector */
.lbe-result-stage {
    background: var(--lbe-surface);
    border: 1px solid var(--lbe-border);
    border-radius: var(--lbe-radius);
    padding: clamp(1.25rem, 3vw, 2rem);
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.05);
    transition: opacity 0.2s ease;
}

.lbe-result-stage.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.lbe-dna-banner {
    border-bottom: 1px solid var(--lbe-border);
    padding-bottom: 1.35rem;
    margin-bottom: 1.65rem;
}

.lbe-dna-eyebrow {
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--lbe-accent);
    margin-bottom: 0.4rem;
}

.lbe-dna-heading {
    font-family: var(--lbe-font-heading);
    font-size: clamp(1.35rem, 2.5vw, 1.8rem);
    font-weight: 700;
    color: var(--lbe-ink);
    margin: 0 0 0.65rem 0;
    line-height: 1.25;
}

.lbe-dna-thesis {
    font-size: 1rem;
    font-weight: 500;
    line-height: 1.65;
    color: var(--lbe-ink);
    margin: 0 0 1rem 0;
}

.lbe-axes-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.15rem;
    list-style: none;
    padding: 0;
    margin: 0;
}

.lbe-axis-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--lbe-ink);
}

.lbe-axis-item svg {
    color: var(--lbe-accent);
    flex-shrink: 0;
}

/* Grilla de 3 Estaciones Activas (Apple Books Card con lomo 3D) */
.lbe-subhead {
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--lbe-meta);
    margin: 0 0 1rem 0;
}

.lbe-books-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.lbe-book-card {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background: var(--lbe-bg);
    border: 1px solid var(--lbe-border);
    border-radius: 5px;
    padding: 1.15rem;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.lbe-book-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(15, 23, 42, 0.07);
}

.lbe-book-top {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    margin-bottom: 0.9rem;
}

.lbe-cover-wrap {
    width: 84px;
    flex-shrink: 0;
    aspect-ratio: 2 / 3;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 8px 18px -4px rgba(15, 23, 42, 0.18), -2px 0 6px inset rgba(0, 0, 0, 0.16);
}

.lbe-cover-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lbe-book-meta {
    flex: 1;
    min-width: 0;
}

.lbe-station-kicker {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lbe-accent);
    margin-bottom: 0.2rem;
}

.lbe-book-title {
    font-family: var(--lbe-font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--lbe-ink);
    margin: 0 0 0.2rem 0;
}

.lbe-book-author {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--lbe-meta);
}

.lbe-audio-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    margin-top: 0.35rem;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--lbe-accent);
}

.lbe-btn-audio {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.38rem;
    min-height: 40px;
    padding: 0.5rem 0.78rem;
    background: var(--lbe-surface);
    color: var(--lbe-accent);
    border: 1px solid var(--lbe-accent);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.18s ease, color 0.18s ease;
}

.lbe-btn-audio:hover {
    background: var(--lbe-accent);
    color: #ffffff;
}

.dark-theme .lbe-btn-audio:hover,
[data-theme="dark"] .lbe-btn-audio:hover {
    color: #020617;
}

.lbe-cross-portal-bar {
    margin-top: 1rem;
    padding: 0.95rem 1.15rem;
    background: var(--lbe-bg);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.lbe-cross-portal-copy {
    font-size: 0.94rem;
    font-weight: 500;
    line-height: 1.5;
    color: var(--lbe-ink);
}

.lbe-cross-portal-kicker {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--lbe-accent);
    margin-bottom: 0.15rem;
}

.lbe-cross-portal-cta {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: 38px;
    padding: 0.42rem 0.9rem;
    background: var(--lbe-surface);
    color: var(--lbe-ink);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.lbe-cross-portal-cta:hover {
    border-color: var(--lbe-accent);
    color: var(--lbe-accent);
}

.lbe-book-reason {
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--lbe-ink);
    margin: 0 0 0.75rem 0;
}

.lbe-book-quote {
    font-size: 0.88rem;
    font-style: italic;
    font-weight: 500;
    line-height: 1.5;
    color: var(--lbe-meta);
    border-left: 2px solid var(--lbe-accent);
    padding-left: 0.7rem;
    margin: 0 0 1rem 0;
}

.lbe-book-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: auto;
}

.lbe-btn-read {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    min-height: 40px;
    padding: 0.5rem 0.85rem;
    background: var(--lbe-accent);
    color: #ffffff;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.18s ease;
}

.dark-theme .lbe-btn-read,
[data-theme="dark"] .lbe-btn-read {
    color: #020617;
}

.lbe-btn-read:hover {
    background: var(--lbe-accent-hover);
}

.lbe-btn-club {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 40px;
    padding: 0.5rem 0.75rem;
    background: var(--lbe-surface);
    color: var(--lbe-ink);
    border: 1px solid var(--lbe-border);
    font-size: 0.86rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    transition: border-color 0.18s ease;
}

.lbe-btn-club:hover {
    border-color: var(--lbe-accent);
    color: var(--lbe-accent);
}

/* Radar de Genealogía Completa en Dominio Público */
.lbe-genealogy-box {
    border-top: 1px solid var(--lbe-border);
    padding-top: 1.5rem;
}

.lbe-genealogy-group {
    margin-bottom: 1.35rem;
}

.lbe-genealogy-group:last-child {
    margin-bottom: 0;
}

.lbe-genealogy-group-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--lbe-accent);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 0.75rem 0;
}

.lbe-genealogy-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 0.85rem;
}

.lbe-genealogy-item {
    background: var(--lbe-bg);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    padding: 0.95rem 1rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 0.65rem;
}

.lbe-gen-work-head {
    font-size: 0.98rem;
    font-weight: 700;
    color: var(--lbe-ink);
    line-height: 1.35;
}

.lbe-gen-work-author {
    font-weight: 600;
    color: var(--lbe-meta);
}

.lbe-gen-work-note {
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--lbe-ink);
    margin: 0;
}

.lbe-gen-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding-top: 0.45rem;
    border-top: 1px solid var(--lbe-border);
}

.lbe-gen-live-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.86rem;
    font-weight: 700;
    color: var(--lbe-accent);
    text-decoration: none;
}

.lbe-vote-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--lbe-surface);
    color: var(--lbe-ink);
    border: 1px solid var(--lbe-border);
    border-radius: 4px;
    padding: 0.32rem 0.68rem;
    font-size: 0.85rem;
    font-weight: 600;
    min-height: 34px;
    cursor: pointer;
    transition: border-color 0.18s ease, color 0.18s ease;
}

.lbe-vote-btn:hover,
.lbe-vote-btn.is-voted {
    border-color: var(--lbe-accent);
    color: var(--lbe-accent);
}

.lbe-dilemma-bar {
    margin-top: 1.5rem;
    padding: 1rem 1.15rem;
    background: var(--lbe-accent-tint);
    border-left: 3px solid var(--lbe-accent);
    border-radius: 0 4px 4px 0;
    font-size: 0.96rem;
    font-weight: 500;
    line-height: 1.55;
    color: var(--lbe-ink);
}

/* Responsivo Móvil (< 920px y < 640px) */
@media (max-width: 920px) {
    .lbe-books-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .lbe-search-form {
        flex-direction: column;
    }
    .lbe-search-btn {
        width: 100%;
    }
}
