/* =========================================================
   КНИГИ-СОЛДАТЫ
   ========================================================= */

:root {
    --main: #252321;
    --accent: #7a0c0c;
    --second-accent: #c9a23a;
    --light: #f4e9d0;
    --white: #ffffff;
    --text: #2b2927;
    --muted: #6a625b;
}


/* =========================================================
   ОСНОВНЫЕ НАСТРОЙКИ
   ========================================================= */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: "Merriweather", serif;
    background: url("foto/redki/BGR.png") center center / cover fixed no-repeat;
    color: var(--text);
}


/* =========================================================
   ОСНОВНОЙ РАЗДЕЛ
   ========================================================= */

.books-section {
    width: 100%;
    min-height: 100vh;
    padding: 80px 50px 100px;
}


/* =========================================================
   ЗАГОЛОВОК
   ========================================================= */

.books-section .zag {
    text-align: center;
    color: var(--second-accent);
    font-size: 42px;
    font-weight: 400;
    line-height: 1.3;
    letter-spacing: 1px;
    margin-bottom: 35px;
}

.books-intro {
    max-width: 900px;
    margin: 0 auto 20px;
    text-align: center;
    font-size: 18px;
    line-height: 1.8;
    color: #4a4540;
}


/* =========================================================
   СЕТКА КНИГ
   ========================================================= */

.books-grid {
    width: 100%;
    max-width: 1120px;
    margin: 0 auto;

    display: grid;
    grid-template-columns: repeat(3, 340px);

    justify-content: center;
    align-items: start;

    column-gap: 40px;
    row-gap: 45px;
}

.inff { width: 85%;
    max-width: 1000px;
    margin: 20px auto;
    text-align: center;
    background: #fff7e3;
    border-left: 6px solid var(--accent);
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);}
/* =========================================================
   КАРТОЧКА КНИГИ
   ========================================================= */

.book-card {
    position: relative;

    width: 320px;
    height: 680px;

    display: flex;
    flex-direction: column;

    background: rgba(255, 255, 255, 0.96);

    border-radius: 8px;
    overflow: hidden;

    cursor: pointer;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.18);

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;

    animation: bookAppear 0.6s ease both;
}

.book-card:hover {
    transform: translateY(-8px);

    box-shadow:
        0 15px 35px rgba(0, 0, 0, 0.22);
}


/* =========================================================
   ОБЛОЖКА КНИГИ
   ========================================================= */

.book-card img {
    display: block;

    width: 100%;
    height: 500px;

    flex-shrink: 0;

    object-fit: cover;
    object-position: center;

    transition: transform 0.4s ease;
}

.book-card:hover img {
    transform: scale(1.03);
}


/* =========================================================
   ИНФОРМАЦИЯ НА КАРТОЧКЕ
   ========================================================= */

.book-card-info {
    width: 100%;
    flex: 1;

    min-height: 165px;

    padding: 22px 25px 25px;

    display: flex;
    flex-direction: column;

    align-items: center;
    justify-content: center;

    text-align: center;
}

.book-card-info h3 {
    margin: 0 0 10px;

    color: var(--accent);

    font-size: 19px;
    font-weight: 700;

    line-height: 1.4;

    text-align: center;
}

.book-card-info p {
    margin: 0;

    color: var(--muted);

    font-size: 15px;
    line-height: 1.5;

    text-align: center;
}


/* =========================================================
   АКТИВНАЯ КАРТОЧКА
   ========================================================= */

.book-card.active {
    transform: translateY(-8px);

    box-shadow:
        0 15px 40px rgba(122, 12, 12, 0.25);
}

.book-card.active::after {
    content: "";

    position: absolute;

    left: 0;
    right: 0;
    bottom: 0;

    height: 5px;

    background: var(--second-accent);
}


/* =========================================================
   АНИМАЦИЯ ПОЯВЛЕНИЯ КАРТОЧЕК
   ========================================================= */

@keyframes bookAppear {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.book-card:nth-child(1) {
    animation-delay: 0.05s;
}

.book-card:nth-child(2) {
    animation-delay: 0.10s;
}

.book-card:nth-child(3) {
    animation-delay: 0.15s;
}

.book-card:nth-child(4) {
    animation-delay: 0.20s;
}

.book-card:nth-child(5) {
    animation-delay: 0.25s;
}

.book-card:nth-child(6) {
    animation-delay: 0.30s;
}

.book-card:nth-child(7) {
    animation-delay: 0.35s;
}

.book-card:nth-child(8) {
    animation-delay: 0.40s;
}


/* =========================================================
   БЛОК ПОД КАРТОЧКАМИ
   ========================================================= */

.book-info {
    width: 100%;
    max-width: 1200px;

    margin: 0 auto;

    display: none;
}

.book-info.active {
    display: block;

    margin-top: 60px;
    margin-bottom: 40px;

    padding: 0;

    animation: bookInfoShow 0.45s ease forwards;
}


/* =========================================================
   АНИМАЦИЯ ОТКРЫТИЯ
   ========================================================= */

@keyframes bookInfoShow {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}


/* =========================================================
   ВНУТРЕННИЙ БЛОК ИНФОРМАЦИИ
   ========================================================= */

.book-info-content {
    position: relative;

    width: 100%;

    background: rgba(255, 255, 255, 0.97);

    border-radius: 10px;

    padding: 45px 50px 50px;

    box-shadow:
        0 10px 35px rgba(0, 0, 0, 0.13);

    overflow: hidden;
}


/* Верхняя декоративная линия */

.book-info-content::before {
    content: "";

    position: absolute;

    top: 0;
    left: 0;
    right: 0;

    height: 5px;

    background: var(--accent);
}


/* =========================================================
   ЗАГОЛОВОК ВНУТРИ РАСКРЫТОЙ КАРТОЧКИ
   ========================================================= */

.book-info-content h2 {
    color: var(--accent);

    text-align: justify;

    font-size: 22px;
    font-weight: 400;

    line-height: 1.5;

    margin-bottom: 35px;
}

.book-info-content h2::after {
    content: "";

    display: block;

    width: 80px;
    height: 2px;

    margin: 18px auto 0;

    background: var(--second-accent);
}


/* =========================================================
   ОПИСАНИЕ КНИГИ
   ========================================================= */

.book-description {
    display: flex;

    align-items: flex-start;

    gap: 45px;
}


/* =========================================================
   ОБЛОЖКА ВНУТРИ РАСКРЫТОГО БЛОКА
   ========================================================= */

.book-description img {
    width: 280px;
    height: 390px;

    flex-shrink: 0;

    display: block;

    object-fit: cover;
    object-position: center;

    border-radius: 4px;

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.18);
}


/* =========================================================
   ТЕКСТ КНИГИ
   ========================================================= */

.book-description > div {
    flex: 1;
    min-width: 0;
}

.book-description p {
    margin-bottom: 20px;

    color: #3f3b37;

    font-size: 17px;
    line-height: 1.9;

    text-align: justify;
}

.book-description p:last-child {
    margin-bottom: 0;
}

.book-description strong {
    color: var(--accent);
}


/* =========================================================
   ДОПОЛНИТЕЛЬНАЯ ИНФОРМАЦИЯ
   ========================================================= */

.book-meta {
    margin-top: 30px;

    padding: 20px 25px;

    border-left: 4px solid var(--second-accent);

    background: rgba(201, 162, 58, 0.08);
}

.book-meta p {
    margin-bottom: 8px;

    font-size: 16px;
    line-height: 1.6;
}

.book-meta p:last-child {
    margin-bottom: 0;
}


/* =========================================================
   ГАЛЕРЕЯ КНИГИ
   ========================================================= */

.book-gallery {
    display: grid;

    grid-template-columns: repeat(3, 1fr);

    gap: 20px;

    margin-top: 40px;
}

.book-gallery img {
    display: block;

    width: 100%;
    height: 260px;

    object-fit: cover;

    border-radius: 5px;

    cursor: pointer;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

.book-gallery img:hover {
    transform: scale(1.03);

    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.2);
}


/* =========================================================
   КНОПКА ПРОСМОТРА PDF
   ========================================================= */

.book-pdf {
    display: inline-block;

    margin-top: 25px;

    padding: 11px 24px;

    color: var(--accent);

    border: 1px solid var(--accent);
    border-radius: 3px;

    background: transparent;

    text-decoration: none;

    font-family: "Merriweather", serif;
    font-size: 14px;

    transition:
        background 0.3s ease,
        color 0.3s ease,
        border-color 0.3s ease;
}

.book-pdf:hover {
    background: var(--accent);

    color: var(--white);

    border-color: var(--accent);
}


/* =========================================================
   МОДАЛЬНОЕ ОКНО
   ========================================================= */

.book-modal {
    position: fixed;

    inset: 0;

    width: 100%;
    height: 100%;

    display: flex;

    align-items: center;
    justify-content: center;

    padding: 40px;

    background: rgba(0, 0, 0, 0.88);

    opacity: 0;
    visibility: hidden;

    transition:
        opacity 0.3s ease,
        visibility 0.3s ease;

    z-index: 9999;
}

.book-modal.active {
    opacity: 1;
    visibility: visible;
}

.book-modal img {
    display: block;

    max-width: 90%;
    max-height: 90vh;

    object-fit: contain;

    box-shadow:
        0 10px 40px rgba(0, 0, 0, 0.5);
}


/* =========================================================
   КНОПКА ЗАКРЫТИЯ
   ========================================================= */

.book-modal-close {
    position: absolute;

    top: 25px;
    right: 35px;

    color: var(--white);

    font-size: 42px;
    line-height: 1;

    cursor: pointer;

    transition: color 0.3s ease;
}

.book-modal-close:hover {
    color: var(--second-accent);
}


/* =========================================================
   АДАПТИВНОСТЬ — ДО 1200 PX
   ========================================================= */

@media (max-width: 1200px) {

    .books-section {
        padding: 70px 35px 80px;
    }

    .books-grid {
        max-width: 1000px;

        grid-template-columns: repeat(3, minmax(0, 1fr));

        column-gap: 25px;
        row-gap: 35px;
    }

    .book-card {
        width: 100%;
        height: 570px;
    }

    .book-card img {
        height: 405px;
    }

    .book-card-info {
        min-height: 165px;
        padding: 20px;
    }

    .book-info-content {
        padding: 40px;
    }

    .book-description {
        gap: 30px;
    }

    .book-description img {
        width: 250px;
        height: 350px;
    }
}


/* =========================================================
   АДАПТИВНОСТЬ — ДО 900 PX
   ========================================================= */

@media (max-width: 900px) {

    .books-section {
        padding: 60px 30px 70px;
    }

    .books-section .zag {
        font-size: 36px;
    }

    .books-intro {
        font-size: 16px;
        margin-bottom: 40px;
    }

    .books-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));

        column-gap: 25px;
        row-gap: 30px;
    }

    .book-card {
        width: 100%;
        height: 560px;
    }

    .book-card img {
        height: 395px;
    }

    .book-card-info {
        min-height: 165px;
        padding: 20px;
    }

    .book-card-info h3 {
        font-size: 18px;
    }

    .book-info.active {
        margin-top: 45px;
    }

    .book-info-content {
        padding: 35px;
    }

    .book-description {
        flex-direction: column;
        align-items: center;
    }

    .book-description img {
        width: 280px;
        height: 390px;
    }

    .book-description > div {
        width: 100%;
    }

    .book-gallery {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* =========================================================
   АДАПТИВНОСТЬ — ДО 600 PX
   ========================================================= */

@media (max-width: 600px) {

    .books-section {
        padding: 45px 15px 60px;
    }

    .books-section .zag {
        font-size: 30px;
        line-height: 1.3;
    }

    .books-intro {
        font-size: 15px;
        line-height: 1.7;
        margin-bottom: 35px;
    }

    .books-grid {
        grid-template-columns: 1fr;
        gap: 25px;
    }

    .book-card {
        width: 100%;
        max-width: 380px;
        height: 570px;

        margin: 0 auto;
    }

    .book-card img {
        height: 410px;
    }

    .book-card-info {
        min-height: 160px;
        padding: 20px;
    }

    .book-card-info h3 {
        font-size: 18px;
    }

    .book-info.active {
        margin-top: 35px;
    }

    .book-info-content {
        padding: 30px 20px 35px;
    }

    .book-info-content h2 {
        font-size: 22px;
    }

    .book-description img {
        width: 230px;
        height: 320px;
    }

    .book-description p {
        font-size: 15px;
        line-height: 1.8;
    }

    .book-gallery {
        grid-template-columns: 1fr;
    }

    .book-gallery img {
        height: 280px;
    }

    .book-modal {
        padding: 20px;
    }

    .book-modal img {
        max-width: 95%;
        max-height: 80vh;
    }

    .book-modal-close {
        top: 15px;
        right: 20px;
        font-size: 35px;
    }
}


/* =========================================================
   МАЛЕНЬКИЕ ЭКРАНЫ — ДО 400 PX
   ========================================================= */

@media (max-width: 400px) {

    .books-section .zag {
        font-size: 27px;
    }

    .book-card {
        height: 540px;
    }

    .book-card img {
        height: 380px;
    }

    .book-card-info {
        min-height: 160px;
        padding: 18px;
    }

    .book-description img {
        width: 200px;
        height: 280px;
    }

    .book-info-content h2 {
        font-size: 20px;
    }
}