/**

 * Xuan Cuong Handicraft - Module: materials.css

 * Materials Section (Chất liệu thủ công mỹ nghệ, 3.8 slider, cards, progress)

 */


/* ==========================================================================
   MATERIALS SECTION (50% OVERLAP ONTO HERO, ASPECT RATIO 9/16, HOVER INFO)
   ========================================================================== */
.section-materials-dark {
    background-color: transparent;
    color: #FFFFFF;
    position: relative;
    z-index: 10;
    margin-top: -350px;
    /* Pulls header and top 50% of cards onto the hero section */
    padding-top: 0;
    padding-bottom: 0;
}

.materials-header {
    margin-bottom: 2.8rem;
}

.materials-header .script-accent-gold {
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.materials-title {
    color: #FFFFFF;
    letter-spacing: -0.3px;
    text-shadow: 0 2px 14px rgba(0, 0, 0, 0.6);
    margin: 0;
}

.materials-three-grid {
    display: flex;
    justify-content: center;
    gap: 40px;
}

/* 9:16 Aspect Ratio Cards */
.material-card {
    position: relative;
    aspect-ratio: 37 / 52;
    width: 100%;
    max-width: 372px;
    height: auto;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2rem;
    background-color: #1A1614;
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.4s ease, border-color 0.4s ease;
    cursor: pointer;
}

.material-card:hover {
    transform: translateY(-8px);
    border-color: rgba(214, 191, 137, 0.5);
}

.material-card-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 1;
}

/* Overlay ONLY visible on hover */
.material-card-overlay {
    position: absolute;
    inset: 0;
    background: rgba(14, 11, 10, 0.65);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    z-index: 2;
}

/* Content ONLY visible on hover */
.material-card-content {
    height: 100%;
    position: relative;
    z-index: 3;
    opacity: 0;
    visibility: hidden;
    transform: translateY(18px);
    transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.35s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.material-card:hover .material-card-overlay,
.material-card:focus-within .material-card-overlay {
    opacity: 1;
    visibility: visible;
}

.material-card:hover .material-card-content,
.material-card:focus-within .material-card-content {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.material-name {
    font-size: var(--fs-title-lg);
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 0.7rem;
    letter-spacing: -0.3px;
}

.material-desc {
    font-size: 18px;
    font-weight: 500;
    color: #E2DDD5;
    line-height: 1.65;
    margin-bottom: 1.5rem;
}

.material-link {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 18px;
    color: white;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.25s ease;
}


/* ==========================================================================
   2. Materials Section: Bảy chất liệu, ba kỹ thuật (Node 4259:5473)
   Exact match with User Specifications and Figma Ver 2
   ========================================================================== */
.section-materials {
    background-color: #FFFFFF;
    color: var(--text-black, #1E262B);
    padding: 5rem 0 3.75rem;
    position: relative;
    overflow: hidden;
}

.materials-intro-row {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 48px;
    align-items: flex-end;
    margin-bottom: 4rem;
}

.materials-heading-col .script-accent-gold {
    font-family: var(--font-script, 'Luxurious Script', cursive);
    font-size: var(--fs-script);
    color: var(--brown, #534833);
    line-height: 1;
    display: block;
    margin-bottom: 8px;
}

.materialstitle {
    color: var(--text-black, #1E262B);
    /* heading-title */

    font-size: var(--fs-heading);
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    margin: 0;
}

.materials-desc-col p {
    color: var(--text-black, #161519);
    font-size: var(--fs-body);
    font-style: normal;
    font-weight: 500;
    line-height: 28px;
    margin: 0;
}

/* Slider Section Wrapper: prev button at left gutter, track bleeds right */
.materials-slider-section-wrap {
    display: flex;
    align-items: center;
    gap: 24px;
    width: 100%;
    position: relative;
    padding-left: var(--edge-gutter);
    padding-right: 0;
    box-sizing: border-box;
}

/* Nút mũi tên prev duy nhất */
.materials-nav-prev {
    width: 48px;
    height: 44px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    color: var(--text-black, #1E262B);
    transition: transform 0.25s ease, opacity 0.25s ease;
}

.materials-nav-prev:hover {
    transform: translateX(-4px);
    opacity: 0.75;
}

.materials-nav-prev svg {
    width: 28px;
    height: 28px;
    display: block;
}

/* Viewport & Track: 3.8 slides per view */
.materials-slider-viewport {
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: grab;
    user-select: none;
    padding: 10px 0;
}

.materials-slider-viewport::-webkit-scrollbar {
    display: none;
}

.materials-slider-viewport:active {
    cursor: grabbing;
}

.materials-slider-track:not(.swiper-wrapper) {
    display: flex;
    gap: 40px;
    width: max-content;
    padding-right: var(--edge-gutter);
}

/* Kích thước item & cấu trúc */
.material-slide-card {
    display: flex;
    width: 386.667px;
    height: 460px;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0;
    /* Không scale */
    transform: none !important;
    transition: none;
}

/* Panel dưới đáy card */
.material-slide-panel {
    display: flex;
    padding: 32px;
    flex-direction: column;
    align-items: flex-start;
    align-self: stretch;
    background: rgba(16, 16, 24, 0.50);
    width: 100%;
    box-sizing: border-box;
}

.material-panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 8px;
}

.material-item-title {
    color: var(--text-white, #FFF);
    /* content-title-2 */

    font-size: var(--fs-card-title);
    font-style: normal;
    font-weight: 700;
    line-height: normal;
    margin: 0;
}

.material-item-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.material-item-desc {
    color: var(--secondary-color, #EFF3DD);
    /* content-sub */

    font-size: var(--fs-body);
    font-style: normal;
    font-weight: 500;
    line-height: 28px;
    /* 140% */
    margin: 0;
}

/* Desktop (>1024px, có chuột): bình thường chỉ hiện tên, hover / focus mới mở mô tả; click vào trang chi tiết.
   Panel chuyển sang grid và chuyển dòng mô tả 0fr → 1fr: chiều cao đúng bằng nội dung nên trượt lên đều, không khựng
   như khi dùng max-height cố định. */
@media (min-width: 1025px) and (hover: hover) {
    .material-slide-panel {
        display: grid;
        grid-template-rows: auto 0fr;
        row-gap: 0;
        transition: grid-template-rows 0.55s cubic-bezier(0.22, 1, 0.36, 1), row-gap 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .material-panel-title-row {
        margin-bottom: 0;
    }

    .material-item-desc {
        min-height: 0;
        overflow: hidden;
        opacity: 0;
        transform: translateY(12px);
        transition: opacity 0.3s ease, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .material-slide-card:hover .material-slide-panel,
    .material-slide-card:focus-visible .material-slide-panel {
        grid-template-rows: auto 1fr;
        row-gap: 8px;
    }

    .material-slide-card:hover .material-item-desc,
    .material-slide-card:focus-visible .material-item-desc {
        opacity: 1;
        transform: translateY(0);
        transition: opacity 0.4s ease 0.1s, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
    }
}

@media (min-width: 1025px) and (hover: hover) and (prefers-reduced-motion: reduce) {
    .material-slide-panel,
    .material-item-desc {
        transition: none;
    }
}

/* Thanh progress: 01 —— 05 */
.materials-progress-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 48px;
    color: var(--text-black, #1E262B);

    font-size: 15.84px;
    font-style: normal;
    font-weight: 700;
    line-height: 24px;
    /* 151.515% */
}

.materials-progress-wrap .progress-line {
    display: inline-block;
    width: 40px;
    height: 2px;
    background: var(--text-gray, #60606B);
}

@media (max-width: 1024px) {
    .materials-intro-row {
        grid-template-columns: minmax(0, 1fr);
        gap: 24px;
        margin-bottom: 2.5rem;
    }

    .materialstitle {
        font-size: 34px;
    }

    .materials-slider-section-wrap {
        padding-left: var(--page-gutter);
    }

    .material-slide-card {
        width: 320px;
        height: 400px;
    }

    .material-slide-panel {
        padding: 24px;
    }

    .material-item-title {
        font-size: 20px;
    }

    /* Mô tả cắt 3 dòng và luôn chiếm đủ 3 dòng để các panel cao bằng nhau */
    .material-item-desc {
        font-size: 17px;
        line-height: 24px;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 3;
        line-clamp: 3;
        overflow: hidden;
        min-height: calc(24px * 3);
    }
}

@media (max-width: 768px) {
    .section-materials {
        padding: 4rem 0;
    }

    .materialstitle {
        font-size: 34px;
    }

    .materials-desc-col p {
        font-size: 17px;
        line-height: 25px;
    }

    .materials-slider-section-wrap {
        flex-direction: column;
        align-items: flex-start;
        padding-left: 1rem;
        gap: 16px;
    }

    .materials-nav-prev {
        display: none;
    }

    .materials-slider-viewport {
        width: 100%;
    }

    .material-slide-card {
        width: 290px;
        height: 380px;
    }
}

/* ==========================================================================
   MATERIAL DETAIL PAGE (/chat-lieu/<slug>/ – taxonomy-xc_product_material.php)
   ========================================================================== */
.material-detail-page {
    padding: 4rem 0;
    background-color: #FFFFFF;
}

.material-detail-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 4rem;
    align-items: center;
    margin-bottom: 4rem;
}

.material-detail-title {
    margin: 0.5rem 0 1.5rem;
}

.material-detail-lead {
    font-family: var(--font-sans);
    font-size: 20px;
    line-height: 1.6;
    color: var(--text-gray);
    margin: 0 0 2rem;
}

.material-detail-cover {
    border-radius: var(--radius-large);
    overflow: hidden;
    aspect-ratio: 4 / 3;
    background: #F4F4F5;
}

.material-detail-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.material-detail-body {
    max-width: 940px;
    margin: 0 auto 4rem;
}

.material-detail-body img {
    max-width: 100%;
    height: auto;
    border-radius: var(--radius-middle);
}

.material-detail-pending {
    color: var(--text-gray);
    font-style: italic;
    text-align: center;
}

.material-detail-section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.material-detail-section-head .section-title {
    margin: 0;
}

.material-detail-all {
    font-family: var(--font-sans);
    font-size: 18px;
    color: var(--xc-primary);
    text-decoration: underline;
    white-space: nowrap;
}

.material-detail-products {
    margin-bottom: 4rem;
}

.material-detail-others {
    border-top: 1px solid var(--xc-border);
    padding-top: 2rem;
}

.material-detail-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
}

@media (max-width: 1024px) {
    .material-detail-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        margin-bottom: 2.5rem;
    }

    .material-detail-cover {
        order: -1;
    }
}

@media (max-width: 640px) {
    .material-detail-page {
        padding: 2rem 0;
    }

    .material-detail-lead {
        font-size: 17px;
    }

    .material-detail-section-head {
        flex-direction: column;
        align-items: flex-start;
    }
}
