/* ==========================================================
   QSR Editorial - Página individual de libro
   Archivo: single-libro-custom.css
   ========================================================== */


/* Contenedor general de la página del libro */

.libro-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 50px 24px;
    box-sizing: border-box;
}


/* ==========================================================
   Cabecera del libro: portada + información principal
   ========================================================== */

.libro-header {
    display: grid;
    grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
    column-gap: 48px;
    row-gap: 32px;
    align-items: start;
    margin-bottom: 64px;
}


/* Portada del libro */

.libro-portada {
    display: block;
    width: 100%;
    max-width: 300px;
    height: auto;
    max-height: 460px;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.14);
    background: #ffffff;
}


/* Por si en algún momento la portada va dentro de figure */

figure.libro-portada,
.wp-block-image.libro-portada {
    max-width: 300px;
    margin: 0;
}

figure.libro-portada img,
.wp-block-image.libro-portada img {
    width: 100%;
    max-width: 300px;
    height: auto;
    display: block;
    border-radius: 8px;
}


/* Información principal */

.libro-info {
    min-width: 0;
}

.libro-info h1 {
    font-size: clamp(32px, 4vw, 46px);
    line-height: 1.15;
    margin: 0 0 14px;
    color: #1B3C3D;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.libro-autor {
    font-size: 17px;
    color: #E87B35;
    font-weight: 700;
    margin: 0 0 22px;
}

.libro-descripcion-corta {
    font-size: 18px;
    line-height: 1.65;
    color: #555555;
    margin: 0 0 26px;
    font-style: italic;
    max-width: 720px;
}


/* ==========================================================
   Metadatos: páginas, temática, formato
   ========================================================== */

.libro-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin: 26px 0;
    padding: 20px 0;
    border-top: 1px solid #E0E0E0;
    border-bottom: 1px solid #E0E0E0;
}

.meta-item {
    color: #555555;
    font-size: 14px;
    line-height: 1.4;
    min-width: 90px;
}

.meta-label {
    display: block;
    color: #999999;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 5px;
}


/* ==========================================================
   Botones
   ========================================================== */

.libro-acciones {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    margin: 32px 0;
}

.btn-amazon,
.btn-bonus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 14px 28px;
    border-radius: 5px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-amazon {
    background: #FF9900;
    color: #ffffff;
}

.btn-amazon:hover,
.btn-amazon:focus {
    background: #E68A00;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(255, 153, 0, 0.25);
}

.btn-bonus {
    background: #1B3C3D;
    color: #ffffff;
}

.btn-bonus:hover,
.btn-bonus:focus {
    background: #0f2b2c;
    color: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(27, 60, 61, 0.25);
}


/* ==========================================================
   Caja de bonus
   ========================================================== */

.bonus-section {
    background: #ffffff;
    padding: 22px;
    border: 2px solid #E87B35;
    border-radius: 8px;
    margin-top: 28px;
    max-width: 620px;
}

.bonus-badge {
    display: inline-block;
    background: #E87B35;
    color: #ffffff;
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 12px;
    line-height: 1;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.bonus-titulo {
    font-size: 17px;
    line-height: 1.35;
    font-weight: 700;
    color: #1B3C3D;
    margin: 0 0 8px;
}

.bonus-section p {
    font-size: 14px;
    color: #666666;
    line-height: 1.6;
    margin: 0;
}


/* ==========================================================
   Contenido principal: descripción + sidebar
   ========================================================== */

.libro-contenido {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    column-gap: 60px;
    row-gap: 40px;
    align-items: start;
}


/* Descripción larga */

.libro-descripcion-larga {
    color: #333333;
    font-size: 17px;
    line-height: 1.8;
    min-width: 0;
}

.libro-descripcion-larga h2 {
    font-size: 26px;
    line-height: 1.25;
    margin: 42px 0 18px;
    color: #1B3C3D;
    font-weight: 700;
}

.libro-descripcion-larga h2:first-child {
    margin-top: 0;
}

.libro-descripcion-larga h3 {
    font-size: 22px;
    line-height: 1.3;
    margin: 34px 0 16px;
    color: #1B3C3D;
    font-weight: 700;
}

.libro-descripcion-larga p {
    margin: 0 0 18px;
}

.libro-descripcion-larga ul,
.libro-descripcion-larga ol {
    margin: 0 0 22px 24px;
    padding: 0;
}

.libro-descripcion-larga li {
    margin-bottom: 8px;
}


/* Sidebar */

.libro-sidebar {
    background: #F5F1EB;
    padding: 28px;
    border-radius: 10px;
    height: fit-content;
    box-sizing: border-box;
}

.sidebar-titulo {
    font-size: 19px;
    line-height: 1.3;
    font-weight: 700;
    color: #1B3C3D;
    margin: 0 0 22px;
}

.sidebar-item {
    background: #ffffff;
    padding: 16px;
    border-radius: 7px;
    margin-bottom: 16px;
    box-sizing: border-box;
}

.sidebar-item:last-child {
    margin-bottom: 0;
}

.sidebar-label {
    font-size: 12px;
    line-height: 1.3;
    color: #999999;
    margin-bottom: 6px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.sidebar-value {
    font-size: 15px;
    line-height: 1.45;
    font-weight: 700;
    color: #1B3C3D;
    word-break: break-word;
}


/* ==========================================================
   Libros relacionados
   ========================================================== */

.libros-relacionados {
    margin-top: 72px;
    padding-top: 56px;
    border-top: 1px solid #E0E0E0;
}

.relacionados-titulo {
    font-size: 30px;
    line-height: 1.25;
    margin: 0 0 32px;
    color: #1B3C3D;
    font-weight: 700;
}

.libros-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 26px;
}

.libro-card {
    display: block;
    background: #ffffff;
    border: 1px solid #E0E0E0;
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.libro-card:hover,
.libro-card:focus {
    transform: translateY(-4px);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.10);
    text-decoration: none;
}

.libro-card img {
    display: block;
    width: 100%;
    height: 220px;
    object-fit: cover;
    background: #F5F1EB;
}

.libro-card-info {
    padding: 14px;
}

.libro-card-titulo {
    font-size: 14px;
    line-height: 1.35;
    font-weight: 700;
    color: #1B3C3D;
    margin-bottom: 7px;
}

.libro-card-autor {
    font-size: 12px;
    line-height: 1.4;
    color: #999999;
}


/* ==========================================================
   Fallback por si el navegador no soporta CSS Grid
   ========================================================== */

@supports not (display: grid) {
    .libro-header,
    .libro-contenido,
    .libros-grid {
        display: flex;
        flex-wrap: wrap;
    }

    .libro-header > div:first-child {
        width: 300px;
        max-width: 100%;
        margin-right: 40px;
    }

    .libro-header > div:last-child {
        flex: 1;
        min-width: 280px;
    }

    .libro-descripcion-larga {
        flex: 1;
        min-width: 300px;
        margin-right: 50px;
    }

    .libro-sidebar {
        width: 300px;
        max-width: 100%;
    }

    .libro-card {
        width: 180px;
        margin-right: 20px;
        margin-bottom: 20px;
    }
}


/* ==========================================================
   Responsive
   ========================================================== */

@media (max-width: 900px) {
    .libro-container {
        padding: 40px 20px;
    }

    .libro-header {
        grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
        column-gap: 34px;
    }

    .libro-contenido {
        grid-template-columns: 1fr;
    }

    .libro-sidebar {
        max-width: 100%;
    }
}

@media (max-width: 768px) {
    .libro-container {
        padding: 32px 18px;
    }

    .libro-header {
        display: block;
        margin-bottom: 48px;
    }

    .libro-header > div:first-child {
        margin-bottom: 28px;
    }

    .libro-portada {
        max-width: 240px;
        margin: 0 auto;
    }

    figure.libro-portada,
    .wp-block-image.libro-portada {
        max-width: 240px;
        margin-left: auto;
        margin-right: auto;
    }

    .libro-info h1 {
        font-size: 32px;
    }

    .libro-descripcion-corta {
        font-size: 16px;
    }

    .libro-meta {
        gap: 16px;
    }

    .libro-acciones {
        flex-direction: column;
        align-items: stretch;
    }

    .btn-amazon,
    .btn-bonus {
        width: 100%;
        text-align: center;
    }

    .libro-descripcion-larga {
        font-size: 16px;
    }

    .libro-descripcion-larga h2 {
        font-size: 24px;
    }

    .libros-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 18px;
    }

    .libro-card img {
        height: 200px;
    }
}

@media (max-width: 480px) {
    .libro-container {
        padding: 28px 16px;
    }

    .libro-portada {
        max-width: 210px;
    }

    figure.libro-portada,
    .wp-block-image.libro-portada {
        max-width: 210px;
    }

    .libro-info h1 {
        font-size: 28px;
    }

    .libro-meta {
        display: block;
    }

    .meta-item {
        margin-bottom: 14px;
    }

    .meta-item:last-child {
        margin-bottom: 0;
    }

    .bonus-section {
        padding: 18px;
    }

    .libro-sidebar {
        padding: 22px;
    }

    .relacionados-titulo {
        font-size: 24px;
    }

    .libros-grid {
        grid-template-columns: 1fr 1fr;
    }

    .libro-card img {
        height: 180px;
    }
}