/* ========================================
   МАТЕРИАЛЫ — VINTAGE BOTANICAL DESIGN
   ======================================== */

.materials-main {
    position: relative;
    margin-top: 80px;
    min-height: calc(100vh - 120px);

    color: #f5eee1;
    overflow: hidden;
}

/* ========================================
   КОНТЕЙНЕР
   ======================================== */

.materials-page {
    position: relative;
    z-index: 2;

    max-width: 1200px;
    margin: 0 auto;

    padding: 42px 30px 35px;
}


/* ========================================
   ЗАГОЛОВОК
   ======================================== */

.materials-header {
    text-align: center;
    padding: 5px 0 30px;
}

.materials-header h1 {
    margin: 0 0 8px;

    font-family: "Playfair Display", Georgia, serif;
    font-size: clamp(42px, 5vw, 64px);
    font-weight: 400;
    line-height: 1.1;

    color: #f7f0e4;

    text-shadow:
        0 2px 5px rgba(0, 0, 0, 0.25);
}

.materials-header p {
    margin: 0;

    font-family: "Inter", sans-serif;
    font-size: 17px;
    font-weight: 400;

    color: rgba(247, 240, 228, 0.75);
}


/* ========================================
   ТАБЫ
   ======================================== */

.tabs {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;

    gap: 8px;

    margin: 0 auto 30px;

    border: none;
    padding: 0;
}

.tab-btn {
    position: relative;

    padding: 9px 20px;

    border: 1px solid rgba(242, 225, 204, 0.35);
    border-radius: 30px;

    background: rgba(55, 57, 32, 0.35);

    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 500;

    color: rgba(247, 240, 228, 0.72);

    cursor: pointer;

    transition:
        background 0.25s ease,
        color 0.25s ease,
        border-color 0.25s ease,
        transform 0.25s ease;
}

.tab-btn:hover {
    color: #fff8ed;

    background: rgba(166, 77, 103, 0.35);

    border-color: rgba(235, 159, 181, 0.6);

    transform: translateY(-1px);
}

.tab-btn.active {
    background: #bd5577;
    border-color: #d47794;

    color: #fff7ee;

    box-shadow:
        0 4px 12px rgba(49, 31, 24, 0.22);
}

.tab-btn.active:hover {
    background: #c45d7e;
}


/* ========================================
   СЕТКА
   ======================================== */

.materials-grid {
    display: grid;

    grid-template-columns:
        repeat(auto-fit, minmax(330px, 1fr));

    gap: 30px;

    padding: 0;
}


/* ========================================
   КАРТОЧКА
   ======================================== */

.material-card {
    position: relative;

    min-height: 390px;

    padding: 38px 38px 32px;

    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;

    border-radius: 22px;

    border: 1px solid rgba(255, 235, 218, 0.25);

    background:
        linear-gradient(145deg,
            rgba(197, 82, 119, 0.96),
            rgba(169, 67, 101, 0.94));

    box-shadow:
        0 15px 35px rgba(27, 25, 15, 0.28),
        inset 0 0 0 1px rgba(255, 255, 255, 0.10);

    overflow: hidden;

    transition:
        transform 0.3s ease,
        box-shadow 0.3s ease;
}

/* Внутренняя рамка */
.material-card::before {
    content: "";

    position: absolute;
    inset: 12px;

    border: 1px solid rgba(255, 236, 220, 0.38);

    border-radius: 15px;

    pointer-events: none;
}

/* Лёгкая винтажная текстура */
.material-card::after {
    content: "";

    position: absolute;
    inset: 0;

    background:
        radial-gradient(circle at 30% 20%,
            rgba(255, 255, 255, 0.10),
            transparent 30%);

    pointer-events: none;
}

.material-card:hover {
    transform: translateY(-5px);

    box-shadow:
        0 20px 45px rgba(25, 23, 13, 0.38),
        inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}


/* ========================================
   ОЛИВКОВЫЕ КАРТОЧКИ
   ======================================== */

.material-card:has(.material-type[data-type="book"]),
.material-card.book-card {
    background:
        linear-gradient(145deg,
            rgba(91, 96, 57, 0.98),
            rgba(73, 78, 43, 0.97));
}


/* ========================================
   ВЕРХ КАРТОЧКИ
   ======================================== */

.material-top {
    position: relative;
    z-index: 2;

    width: 100%;

    display: flex;
    justify-content: space-between;
    align-items: center;

    margin-bottom: 35px;
}

.material-type,
.material-level {
    font-family: "Inter", sans-serif;
    font-size: 24px;

    color: rgba(255, 246, 232, 0.78);
}

.material-level {
    opacity: 0.8;
}


/* ========================================
   ИКОНКА / ТИП
   ======================================== */

.material-type {
    padding: 6px 12px;

    border: 1px solid rgba(255, 255, 255, 0.22);
    border-radius: 20px;

    background: rgba(0, 0, 0, 0.08);
}


/* ========================================
   ЗАГОЛОВОК КАРТОЧКИ
   ======================================== */

.material-card h3 {
    position: relative;
    z-index: 2;

    margin: 0 0 18px;

    font-family: "Playfair Display", Georgia, serif;

    font-size: 34px;
    font-weight: 400;

    line-height: 1.2;

    color: #fff8ed;
}


/* ========================================
   ОПИСАНИЕ
   ======================================== */

.material-desc {
    position: relative;
    z-index: 2;

    max-width: 430px;

    margin: 0;

    font-family: "Inter", sans-serif;

    font-size: 15px;
    line-height: 1.7;

    color: rgba(255, 247, 235, 0.78);
}


/* ========================================
   КНОПКА
   ======================================== */

.material-card .material-actions {
    position: relative;
    z-index: 2;

    margin-top: auto;
    padding-top: 35px;

    display: flex;
    justify-content: center;
    align-items: center;

    width: 100%;
}

.material-card .btn {
    min-width: 180px;

    padding: 11px 22px;

    border: 1px solid rgba(255, 238, 220, 0.6);
    border-radius: 10px;

    background: transparent;

    color: #fff8ed;

    font-family: "Inter", sans-serif;
    font-size: 14px;
    font-weight: 400;

    text-decoration: none;

    transition:
        background 0.25s ease,
        color 0.25s ease,
        transform 0.25s ease;
}

.material-card .btn:hover {
    background: rgba(255, 242, 228, 0.95);

    color: #5d503e;

    transform: translateY(-2px);
}


/* ========================================
   ЦЕНА
   ======================================== */

.material-price {
    padding: 11px 22px;

    border: 1px solid rgba(255, 238, 220, 0.45);
    border-radius: 10px;

    color: #fff8ed;

    font-family: "Inter", sans-serif;
    font-size: 14px;
}


/* ========================================
   НИЖНЯЯ НАДПИСЬ
   ======================================== */

.materials-bottom-text {
    padding-top: 30px;

    text-align: center;

    font-family: "Inter", sans-serif;
    font-size: 14px;

    color: rgba(247, 240, 228, 0.68);
}


/* ========================================
   EMPTY STATE
   ======================================== */

.empty-state,
.error-state,
.loading-placeholder {
    grid-column: 1 / -1;

    text-align: center;

    padding: 70px 20px;

    color: rgba(255, 247, 235, 0.75);
}

.empty-state .icon {
    display: block;

    margin-bottom: 15px;

    font-size: 45px;
}

.empty-state p {
    margin: 5px 0;

    font-family: "Playfair Display", Georgia, serif;
    font-size: 22px;
}

.empty-state .sub-text {
    font-family: "Inter", sans-serif;
    font-size: 14px;
    opacity: 0.7;
}


/* ========================================
   BOTANICAL ДЕКОР
   ======================================== */

.botanical {
    position: absolute;

    width: 170px;
    height: 170px;

    opacity: 0.75;

    pointer-events: none;

    z-index: 1;
}

/*
   Здесь используется CSS-декор.
   Он имитирует ветви и листья без дополнительных картинок.
*/

.botanical::before,
.botanical::after {
    content: "";

    position: absolute;

    width: 100px;
    height: 160px;

    border-left: 2px solid rgba(52, 66, 35, 0.8);

    transform-origin: bottom;
}

.botanical::before {
    transform: rotate(-35deg);
}

.botanical::after {
    transform: rotate(25deg);
}


/* Левый верх */
.botanical-left-top {
    top: 10px;
    left: -20px;
}

/* Правый верх */
.botanical-right-top {
    top: 10px;
    right: -20px;

    transform: scaleX(-1);
}

/* Левый низ */
.botanical-left-bottom {
    bottom: 0;
    left: -20px;

    transform: rotate(180deg);
}

/* Правый низ */
.botanical-right-bottom {
    bottom: 0;
    right: -20px;

    transform: rotate(180deg) scaleX(-1);
}


/* ========================================
   АДАПТИВ
   ======================================== */

@media (max-width: 800px) {

    .materials-page {
        padding: 30px 20px;
    }

    .materials-header h1 {
        font-size: 42px;
    }

    .materials-header p {
        font-size: 15px;
    }

    .materials-grid {
        grid-template-columns: 1fr;
    }

    .material-card {
        min-height: 350px;
    }

    .botanical {
        opacity: 0.35;
        transform: scale(0.7);
    }
}


@media (max-width: 600px) {

    .materials-page {
        padding: 25px 15px 30px;
    }

    .materials-header {
        padding-bottom: 25px;
    }

    .materials-header h1 {
        font-size: 36px;
    }

    .tabs {
        gap: 6px;
    }

    .tab-btn {
        padding: 8px 14px;
        font-size: 12px;
    }

    .material-card {
        min-height: 320px;
        padding: 30px 25px;
    }

    .material-card h3 {
        font-size: 29px;
    }

    .material-desc {
        font-size: 14px;
    }

    .material-card::before {
        inset: 9px;
    }
}

.material-card.material-book {
    background:
        linear-gradient(145deg,
            #646947,
            #4f5539);
}

.material-card.material-film {
    background:
        linear-gradient(145deg,
            #c85a7d,
            #ad4667);
}

.material-card.material-song {
    background:
        linear-gradient(145deg,
            #967052,
            #75583f);
}

.material-card.material-article {
    background:
        linear-gradient(145deg,
            #68745a,
            #505d45);
}

/* ========================================
   НОВЫЕ КАРТОЧКИ С КАРТИНКОЙ
   ======================================== */

.material-card {
    padding: 0;
    min-height: auto;
    cursor: pointer;
    overflow: hidden;
}

/* Убираем старую внутреннюю рамку (она конфликтует с картинкой) */
.material-card::before {
    display: none;
}

.material-image-wrap {
    position: relative;
    width: 100%;
    height: 220px;
    overflow: hidden;
    background: #444936;
}

.material-image-wrap img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.material-card:hover .material-image-wrap img {
    transform: scale(1.05);
}

.material-image-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg,
            rgba(25, 28, 17, 0.05) 25%,
            rgba(25, 28, 17, 0.55) 100%);
}

.material-image-wrap::after {
    content: "";
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(255, 239, 220, 0.35);
    border-radius: 10px;
    pointer-events: none;
}

.material-type-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 3;
    padding: 5px 12px;
    border: 1px solid rgba(255, 235, 218, 0.4);
    border-radius: 20px;
    background: rgba(57, 48, 34, 0.5);
    backdrop-filter: blur(5px);
    font-family: "Inter", sans-serif;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #fff0df;
}

.material-level-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 3;
    padding: 5px 12px;
    border: 1px solid rgba(255, 235, 218, 0.4);
    border-radius: 20px;
    background: rgba(57, 48, 34, 0.5);
    backdrop-filter: blur(5px);
    font-family: "Inter", sans-serif;
    font-size: 10px;
    font-weight: 600;
    color: #fff0df;
}

.material-card-body {
    position: relative;
    z-index: 2;
    padding: 24px 26px 20px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.material-card h3 {
    margin: 0 0 12px;
    font-family: "Playfair Display", Georgia, serif;
    font-size: 26px;
    font-weight: 400;
    line-height: 1.2;
    color: #fff8ed;
}

.material-desc {
    flex-grow: 1;
    min-height: 60px;
    margin: 0 0 18px;
    font-family: "Inter", sans-serif;
    font-size: 13px;
    line-height: 1.7;
    color: rgba(255, 247, 235, 0.78);
}

.material-card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 235, 216, 0.2);
}

.material-price-tag {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 18px;
    color: #f4d9c8;
}

.material-arrow {
    font-family: Georgia, serif;
    font-size: 20px;
    color: rgba(255, 255, 255, 0.55);
    transition: transform 0.25s ease, color 0.25s ease;
}

.material-card:hover .material-arrow {
    transform: translateX(5px);
    color: #ffd6e0;
}

/* Палитра карточек остаётся как была (material-book / material-film / etc.) */