/* Homepage theme — load AFTER existing homepage styles and Swiper CSS.
   Scoped to .home-page; uses the font already loaded by base.html. */
.home-page {
    --home-primary: #087f75;
    --home-primary-dark: #05645c;
    --home-accent: #effaf6;
    --home-text: #182c35;
    --home-muted: #667b85;
    --home-line: #e5eeed;
    --home-shadow: 0 8px 32px rgb(24 57 52 / 5%);
    direction: rtl;
    color: var(--home-text);
    background: #f6f9f8;
    max-width: 1600px;
    margin: 0 auto;
    padding: clamp(12px, 2.2vw, 32px);
    font-family: inherit;
    line-height: 1.8;
    border-radius: 24px;
    isolation: isolate;
}

.home-page *, .home-page *::before, .home-page *::after {
    box-sizing: border-box;
}

.home-page a {
    color: inherit;
    text-decoration: none;
}

.home-page button {
    font: inherit;
    cursor: pointer;
}

.home-page img {
    display: block;
    max-width: 100%;
}

.home-page :is(h1,h2,h3,p) {
    margin: 0;
}

.home-page button, .home-page a {
    -webkit-tap-highlight-color: transparent;
}

.home-page :is(a,button):focus-visible {
    outline: 3px solid #159b89;
    outline-offset: 4px;
}

/* Banner: JS toggles .active, so no track transform is needed. */
.home-page .home-banner-section {
    margin-bottom: 22px;
}

.home-page .home-banner-carousel {
    position: relative;
    overflow: hidden;
    border-radius: 26px;
    background: #153c3a;
    box-shadow: var(--home-shadow);
}

.home-page .home-banner-track {
    display: grid;
}

.home-page .home-banner-slide {
    position: relative;
    grid-area: 1 / 1;
    min-width: 0;
    height: clamp(260px, 29vw, 450px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .55s ease, visibility .55s;
}

.home-page .home-banner-slide.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    z-index: 1;
}

.home-page .home-banner-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-page .home-banner-slide:has(.home-banner-content)::after {
    content: none;
}

.home-page .home-banner-content {
    position: absolute;
    z-index: 2;
    inset-inline-start: clamp(46px, 6vw, 96px);
    top: 50%;
    transform: translateY(-50%);
    max-width: min(64%, 650px);
    color: #fff;
}

.home-page .home-banner-content h1 {
    font-size: clamp(23px, 2.8vw, 43px);
    font-weight: 850;
    line-height: 1.55;
    text-wrap: balance;
}

.home-page .home-banner-content p {
    margin-top: 12px;
    color: #e2edeb;
    font-size: clamp(13px, 1.2vw, 17px);
}

.home-page .home-banner-button {
    display: inline-flex;
    align-items: center;
    gap: 20px;
    margin-top: 24px;
    padding: 10px 23px;
    background: #fff;
    color: #07594f;
    border-radius: 12px;
    font-weight: 750;
    transition: background .2s, transform .2s;
}

.home-page .home-banner-nav {
    position: absolute;
    z-index: 3;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 1px solid #ffffff45;
    border-radius: 50%;
    background: #ffffffdf;
    color: #174a43;
    display: grid;
    place-items: center;
}

.home-page .home-banner-nav-right {
    right: 12px;
}

.home-page .home-banner-nav-left {
    left: 12px;
}

.home-page .home-banner-dots {
    position: absolute;
    z-index: 3;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 30px;
    background: #122f394a;
}

.home-page .home-banner-dot {
    width: 8px;
    height: 8px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #ffffff80;
    transition: width .25s, background .25s;
}

.home-page .home-banner-dot.active {
    width: 26px;
    background: #fff;
}

/* Search entry */
.home-page .home-search-section {
    margin-bottom: 24px;
}

.home-page .home-search-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 21px 25px;
    background: linear-gradient(110deg, #fff, #effaf6);
    border: 1px solid #dceee6;
    border-radius: 20px;
}

.home-page .home-search-text {
    display: flex;
    align-items: center;
    gap: 15px;
    min-width: 0;
}

.home-page .home-search-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    background: #fff;
    border: 1px solid #dceee6;
    border-radius: 15px;
    color: var(--home-primary);
    font-size: 21px;
}

.home-page .home-search-text strong {
    display: block;
    font-size: 16px;
}

.home-page .home-search-text small {
    display: block;
    color: var(--home-muted);
    font-size: 12px;
    margin-top: 3px;
}

.home-page .home-advanced-search {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    flex-shrink: 0;
    background: var(--home-primary);
    color: #fff;
    border-radius: 12px;
    padding: 11px 19px;
    font-size: 13px;
    font-weight: 700;
    transition: background .2s;
}

/* Three existing panels */
.home-page .home-main-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1fr) minmax(0, 1fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 26px;
}

.home-page :is(.home-products-panel,.home-vendors-panel,.home-categories-panel,.home-final-products-section) {
    min-width: 0;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--home-line);
    border-radius: 22px;
    box-shadow: var(--home-shadow);
}

.home-page :is(.home-section-header,.home-final-products-header) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}

.home-page .home-section-title {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.home-page .home-section-title > div {
    min-width: 0;
}

.home-page .home-section-title h2 {
    font-size: clamp(14px, 1.15vw, 18px);
    font-weight: 800;
    line-height: 1.65;
}

.home-page .home-section-title p {
    margin-top: 3px;
    color: var(--home-muted);
    font-size: 11px;
}

.home-page .home-section-icon {
    width: 42px;
    height: 42px;
    border-radius: 13px;
    background: #eaf7f1;
    color: var(--home-primary);
    display: grid;
    place-items: center;
    flex-shrink: 0;
    font-size: 20px;
}

.home-page .vendors-icon {
    color: #7060c5;
    background: #f1edff;
}

.home-page .categories-icon {
    color: #bb7e1c;
    background: #fff6e5;
}

.home-page .all-products-icon {
    color: #357ac0;
    background: #ecf5ff;
}

.home-page .cheapest-products-icon {
    color: #16876c;
    background: #eaf9f1;
}

.home-page .most-viewed-products-icon {
    color: #d36c45;
    background: #fff0e8;
}

.home-page .home-section-more {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 700;
    color: var(--home-primary);
    padding: 6px 0;
}

/* Swiper: preserve its widths and transforms. */
.home-page .swiper {
    min-width: 0;
    --swiper-theme-color: var(--home-primary);
    --swiper-pagination-bullet-inactive-color: #b7c9c4;
    --swiper-pagination-bullet-inactive-opacity: .6;
    padding: 3px 2px 35px;
}

.home-page .swiper-wrapper {
    align-items: stretch;
}

.home-page .swiper-slide {
    height: auto;
    min-width: 0;
}

.home-page .swiper-pagination {
    bottom: 1px;
    line-height: 1;
}

.home-page .swiper-pagination-bullet {
    width: 6px;
    height: 6px;
    border-radius: 10px;
    transition: width .2s;
}

.home-page .swiper-pagination-bullet-active {
    width: 20px;
}

.home-page .home-product-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #fff;
    border: 1px solid var(--home-line);
    border-radius: 16px;
    transition: border-color .22s, box-shadow .22s, transform .22s;
}

.home-page .home-product-image {
    position: relative;
    aspect-ratio: 5 / 4;
    padding: 12px;
    background: #f8faf9;
    overflow: hidden;
}

.home-page .home-product-image > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .35s;
}

.home-page .home-product-discount {
    position: absolute;
    top: 10px;
    inset-inline-start: 10px;
    min-width: 35px;
    text-align: center;
    padding: 1px 8px;
    background: #e54d68;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    border-radius: 8px;
}

.home-page .home-product-stock {
    position: absolute;
    bottom: 10px;
    inset-inline-end: 10px;
    width: 25px;
    height: 25px;
    display: grid;
    place-items: center;
    background: #fff;
    color: #14916e;
    border-radius: 50%;
    font-size: 15px;
}

.home-page .home-product-info {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 10px;
    min-width: 0;
}

.home-page .home-product-info h3 {
    font-size: 12px;
    line-height: 1.9;
    font-weight: 700;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 3.8em;
    overflow-wrap: anywhere;
}

.home-page .home-product-vendor {
    display: block;
    margin-top: 7px;
    color: var(--home-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-page .home-product-vendor i {
    margin-inline-end: 4px;
}

.home-page .home-product-price {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    gap: 2px;
    min-height: 51px;
    margin-top: auto;
    padding-top: 8px;
}

.home-page .home-product-price strong {
    font-size: clamp(13px, 1vw, 16px);
    font-weight: 850;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.home-page .home-product-price small {
    margin-inline-start: 3px;
    color: var(--home-muted);
    font-size: 10px;
    font-weight: 500;
}

.home-page .home-product-price del {
    color: #88969d;
    font-size: 11px;
}

.home-page .home-product-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 8px;
    padding-top: 7px;
    border-top: 1px solid #edf2f0;
    color: var(--home-primary);
    font-size: 10px;
    font-weight: 700;
}

.home-page :is(.home-product-swiper-nav,.library-home-latest-prev,.library-home-latest-next) {
    position: absolute;
    z-index: 5;
    top: 38%;
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #dce7e3;
    border-radius: 50%;
    background: #fffffff2;
    color: var(--home-primary);
    box-shadow: 0 3px 12px #183a3210;
}

.home-page :is(.home-products-prev,.home-all-products-prev,.cheapest-products-prev,.most-viewed-products-prev,.library-home-latest-prev) {
    right: 6px;
}

.home-page :is(.home-products-next,.home-all-products-next,.cheapest-products-next,.most-viewed-products-next,.library-home-latest-next) {
    left: 6px;
}

.home-page .swiper-button-disabled {
    opacity: .35;
    cursor: default;
}

.home-page .swiper-button-lock {
    display: none;
}

/* Vertical carousels: 10px desktop gap matches desktopStep(). */
.home-page .vertical-carousel {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.home-page .vertical-carousel-btn {
    display: grid;
    place-items: center;
    width: 100%;
    height: 25px;
    border: 1px solid #edf2f0;
    border-radius: 8px;
    background: #f8fbfa;
    color: #6b8b80;
    font-size: 12px;
}

.home-page .vertical-carousel-window {
    height: 320px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    overscroll-behavior: contain;
}

.home-page .vertical-carousel-window::-webkit-scrollbar {
    display: none;
}

.home-page .vertical-carousel-track {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.home-page :is(.home-vendor-card,.home-category-card) {
    display: flex;
    align-items: center;
    gap: 11px;
    flex-shrink: 0;
    min-width: 0;
    padding: 11px;
    border: 1px solid var(--home-line);
    border-radius: 14px;
    background: #fff;
    transition: background .2s, border-color .2s;
}

.home-page .home-vendor-card {
    min-height: 100px;
}

.home-page .home-category-card {
    min-height: 78px;
}

.home-page :is(.home-vendor-image,.home-category-image) {
    position: relative;
    flex-shrink: 0;
    width: 53px;
    height: 53px;
    border-radius: 13px;
    background: #f3f7f5;
}

.home-page :is(.home-vendor-image,.home-category-image) > img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.home-page .home-category-image {
    width: 45px;
    height: 45px;
}

.home-page :is(.home-vendor-placeholder,.home-category-placeholder) {
    height: 100%;
    display: grid;
    place-items: center;
    color: #84a197;
    font-size: 24px;
}

.home-page .home-vendor-special {
    position: absolute;
    bottom: -4px;
    inset-inline-end: -4px;
    width: 21px;
    height: 21px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #fff1cc;
    color: #b78113;
    font-size: 10px;
}

.home-page :is(.home-vendor-info,.home-category-info) {
    min-width: 0;
    flex: 1;
}

.home-page .home-vendor-info h3, .home-page .home-category-info strong {
    display: block;
    font-size: 12px;
    font-weight: 750;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-page .home-vendor-info > span {
    display: block;
    max-width: 100%;
    margin-top: 3px;
    color: var(--home-muted);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.home-page .home-vendor-info small, .home-page .home-category-info > span {
    display: flex;
    align-items: center;
    gap: 7px;
    margin-top: 5px;
    font-size: 10px;
    color: var(--home-primary);
}

/* Library */
.home-page .library-home-latest-section {
    margin-bottom: 26px;
    padding: 25px;
    border: 1px solid #dbeae3;
    border-radius: 23px;
    background: linear-gradient(120deg, #eaf5ed, #f9fcf8 70%);
}

.home-page .library-home-latest-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 22px;
}

.home-page .library-home-latest-eyebrow {
    display: inline-block;
    font-size: 10px;
    font-weight: 800;
    color: #34795a;
    background: #dceee0;
    border-radius: 6px;
    padding: 1px 9px;
    margin-bottom: 6px;
}

.home-page .library-home-latest-heading h2 {
    font-size: 22px;
    font-weight: 850;
}

.home-page .library-home-latest-heading p {
    color: var(--home-muted);
    font-size: 12px;
    margin-top: 4px;
}

.home-page .library-home-latest-more {
    display: inline-flex;
    gap: 10px;
    align-items: center;
    font-size: 12px;
    font-weight: 700;
    color: var(--home-primary);
}

.home-page .library-home-book-card {
    display: block;
    height: 100%;
    padding: 6px 8px 14px;
    background: transparent;
    border: 0;
    border-radius: 0;
}

.home-page .library-home-book-cover {
    position: relative;
    aspect-ratio: 3 / 4;
    overflow: hidden;
    border-radius: 8px 4px 4px 8px;
    background: transparent;
    box-shadow: -5px 9px 15px #26452e26;
}

.home-page .library-home-book-cover > img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .3s;
}

.home-page .library-home-book-no-cover {
    height: 100%;
    display: grid;
    place-items: center;
    color: #729a7d;
    font-size: 45px;
}

.home-page .library-home-book-cover-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px 8px;
    background: linear-gradient(transparent 40%, #122f25b3);
    opacity: 0;
    transition: opacity .25s;
}

.home-page .library-home-book-read {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-size: 12px;
}

.home-page .library-home-book-card:focus-visible .library-home-book-cover-overlay {
    opacity: 1;
}

.home-page .home-final-products-section {
    margin-bottom: 24px;
}

.home-page .home-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 260px;
    padding: 30px 15px;
    text-align: center;
    border: 1px dashed #dce7e2;
    border-radius: 16px;
    background: #fafcfb;
}

.home-page .home-empty > i {
    font-size: 38px;
    color: #97b4a8;
}

.home-page .home-empty strong {
    font-size: 13px;
}

.home-page .home-empty span {
    color: var(--home-muted);
    font-size: 11px;
}

.home-page .home-empty-small {
    min-height: 210px;
}

@media (hover: hover) {
    .home-page .home-product-card:hover {
        transform: translateY(-2px);
        border-color: #adcec0;
        box-shadow: 0 6px 15px #164b3510;
    }

    .home-page .home-product-card:hover .home-product-image img {
        transform: scale(1.045);
    }

    .home-page :is(.home-vendor-card,.home-category-card):hover {
        border-color: #bfdbcd;
        background: #f7fcf9;
    }

    .home-page .home-advanced-search:hover {
        background: var(--home-primary-dark);
    }

    .home-page .home-banner-button:hover {
        background: #e5f8ee;
        transform: translateY(-2px);
    }

    .home-page .library-home-book-card:hover .library-home-book-cover-overlay {
        opacity: 1;
    }
}

@media (max-width: 1199px) and (min-width: 701px) {
    .home-page .home-main-layout {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .home-page .home-products-panel {
        grid-column: 1 / -1;
    }

    .home-page .vertical-carousel-window {
        height: 240px;
    }
}

@media (max-width: 700px) {
    .home-page {
        padding: 12px;
        border-radius: 16px;
    }

    .home-page .home-main-layout {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
    }

    .home-page :is(.home-products-panel,.home-vendors-panel,.home-categories-panel,.home-final-products-section) {
        padding: 15px;
        border-radius: 18px;
    }

    .home-page .home-banner-carousel {
        border-radius: 18px;
    }

    .home-page .home-banner-slide {
        height: auto;
        aspect-ratio: 16 / 9;
    }

    .home-page .home-banner-image {
        position: absolute;
        inset: 0;
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .home-page .home-banner-content {
        top: auto;
        bottom: 33px;
        transform: none;
    }

    .home-page .home-banner-content h1 {
        line-height: 1.4;
    }

    .home-page .home-banner-content p {
        margin-top: 4px;
    }

    .home-page .home-banner-content .home-banner-button {
        margin-top: 8px;
        padding: 5px 12px;
    }

    .home-page .home-banner-content {
        inset-inline-start: 43px;
        max-width: calc(100% - 86px);
    }

    .home-page .home-banner-content h1 {
        font-size: clamp(16px, 4vw, 24px);
    }

    .home-page .home-banner-content p {
        font-size: 12px;
    }

    .home-page .home-banner-button {
        margin-top: 16px;
        font-size: 12px;
        padding: 8px 14px;
    }

    .home-page .home-banner-nav {
        width: 29px;
        height: 34px;
        border-radius: 9px;
        font-size: 12px;
    }

    .home-page .home-banner-nav-right {
        right: 7px;
    }

    .home-page .home-banner-nav-left {
        left: 7px;
    }

    .home-page .home-search-box {
        flex-wrap: wrap;
        padding: 16px;
        gap: 15px;
    }

    .home-page .home-search-text strong {
        font-size: 14px;
    }

    .home-page .home-search-text small {
        font-size: 11px;
    }

    .home-page .home-advanced-search {
        width: 100%;
        font-size: 12px;
        padding: 9px 15px;
    }

    .home-page .home-section-title h2 {
        font-size: 15px;
    }

    .home-page .home-section-title p {
        font-size: 10px;
    }

    .home-page .home-section-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
        border-radius: 11px;
    }

    .home-page .home-section-more {
        font-size: 10px;
        gap: 5px;
    }

    /* Positive scrollLeft is required by the existing mobile carousel JS.
       Restore RTL on each individual card. Gap matches mobileStep(). */
    .home-page .vertical-carousel-window {
        direction: ltr;
        height: auto;
        overflow-x: auto;
        overflow-y: hidden;
        scroll-snap-type: x proximity;
    }

    .home-page .vertical-carousel-track {
        flex-direction: row;
        gap: 12px;
        width: max-content;
        min-width: 100%;
        padding: 2px 0 5px;
    }

    .home-page :is(.home-vendor-card,.home-category-card) {
        direction: rtl;
        width: clamp(210px, 65vw, 300px);
        scroll-snap-align: start;
    }

    .home-page .vertical-carousel {
        display: grid;
        grid-template-columns: 26px minmax(0, 1fr) 26px;
        align-items: center;
        gap: 7px;
    }

    .home-page .vertical-carousel-btn {
        height: 36px;
        width: 26px;
    }

    .home-page .vertical-carousel-up i {
        transform: rotate(90deg);
    }

    .home-page .vertical-carousel-down i {
        transform: rotate(90deg);
    }

    .home-page .home-empty-small {
        width: 240px;
        min-height: 110px;
        direction: rtl;
    }

    .home-page .library-home-latest-section {
        padding: 17px;
        border-radius: 18px;
    }

    .home-page .library-home-latest-header {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 12px;
    }

    .home-page .library-home-latest-heading h2 {
        font-size: 19px;
    }

    .home-page .library-home-latest-heading p {
        font-size: 11px;
    }

    .home-page .library-home-latest-more {
        font-size: 11px;
    }

    .home-page .library-home-book-card {
        padding: 9px;
    }

    .home-page .library-home-book-cover-overlay {
        opacity: 1;
        padding: 10px 6px;
    }

    .home-page .library-home-book-read {
        font-size: 10px;
    }

    .home-page :is(.home-product-swiper-nav,.library-home-latest-prev,.library-home-latest-next) {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (max-width: 380px) {
    .home-page {
        padding: 8px;
    }

    .home-page :is(.home-products-panel,.home-vendors-panel,.home-categories-panel,.home-final-products-section) {
        padding: 12px;
    }

    .home-page .home-section-title {
        gap: 7px;
    }

    .home-page .home-section-icon {
        width: 30px;
        height: 34px;
        font-size: 16px;
    }

    .home-page .home-section-title h2 {
        font-size: 13px;
    }

    .home-page .home-section-title p {
        font-size: 9px;
    }

    .home-page .home-product-info {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page *, .home-page *::before, .home-page *::after {
        transition: none !important;
        animation: none !important;
        scroll-behavior: auto !important;
    }
}

/* ===================================
   تازه‌ترین کتاب‌ها
=================================== */

.home-page .library-home-latest-section {
    position: relative;
    isolation: isolate;
    margin-bottom: 26px;
    padding: 24px;
    overflow: hidden;
    border: 1px solid #dce9e2;
    border-radius: 24px;
    background: radial-gradient(
            ellipse at top right,
            #dcefe2 0,
            transparent 55%
    ),
    linear-gradient(135deg, #f5faf6, #edf5ef);
}

.home-page .library-home-latest-header {
    position: relative;
    gap: 16px;
    margin-bottom: 20px;
}

.home-page .library-home-latest-heading h2 {
    margin: 0;
    color: #203d30;
    font-size: 22px;
    font-weight: 850;
}

.home-page .library-home-latest-eyebrow {
    padding: 4px 11px;
    border: 1px solid #cee5d5;
    border-radius: 20px;
    background: #ffffff80;
    color: #397451;
    font-size: 10px;
    font-weight: 800;
}

.home-page .library-home-latest-more {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 13px;
    border: 1px solid #d3e5d9;
    border-radius: 12px;
    background: #ffffff90;
    color: #286246;
    text-decoration: none;
    transition: background .2s ease,
    border-color .2s ease;
}

.home-page .libraryHomeLatestSwiper {
    padding: 8px 2px 34px;
}

.home-page .libraryHomeLatestSwiper .swiper-slide {
    height: auto;
}

.home-page .library-home-book-card {
    display: block;
    height: 100%;
    padding: 3px 5px 12px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.home-page .library-home-book-cover {
    position: relative;
    aspect-ratio: 2 / 3;
    overflow: hidden;
    border: 1px solid #23483214;
    border-radius: 9px 4px 4px 9px;
    background: transparent;
    box-shadow: -3px 4px 0 #ffffff70,
    -5px 6px 0 #c8d8cc,
    0 10px 16px -8px #25443155;
    transition: transform .25s ease,
    box-shadow .25s ease;
}

/* نور ملایم روی عطف کتاب */
.home-page .library-home-book-cover::after {
    content: "";
    position: absolute;
    z-index: 1;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
            to right,
            #00000012,
            transparent 5%,
            #ffffff20 8%,
            transparent 13%
    );
    box-shadow: inset 0 0 0 1px #ffffff25;
}

.home-page .library-home-book-cover > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform .3s ease;
}

.home-page .library-home-book-no-cover {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(145deg, #d8e9dd, #b6d1c0);
    color: #507a5e;
    font-size: 36px;
}

.home-page .library-home-book-cover-overlay {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 12px 6px;
    background: linear-gradient(
            transparent 45%,
            #102c2380 75%,
            #102c23d9
    );
    opacity: 0;
    transition: opacity .25s ease;
}

.home-page .library-home-book-read {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.home-page .library-home-book-card:focus-visible {
    outline: 2px solid #3d8962;
    outline-offset: 3px;
}

.home-page .library-home-book-card:focus-visible
.library-home-book-cover-overlay {
    opacity: 1;
}

.home-page :is(
    .library-home-latest-prev,
    .library-home-latest-next
) {
    top: 42%;
    width: 34px;
    height: 34px;
    border: 1px solid #d3e2d7;
    background: #fffffff2;
    color: #286246;
    box-shadow: 0 4px 12px #23483215;
}

.home-page .library-home-latest-pagination {
    bottom: 0;
    --swiper-pagination-color: #397b55;
    --swiper-pagination-bullet-inactive-color: #9cb8a5;
    --swiper-pagination-bullet-inactive-opacity: .5;
}

@media (hover: hover) {
    .home-page .library-home-book-card:hover
    .library-home-book-cover {
        transform: translateY(-5px);
        box-shadow: -3px 4px 0 #ffffff80,
        -5px 6px 0 #c8d8cc,
        0 16px 22px -10px #25443166;
    }

    .home-page .library-home-book-card:hover
    .library-home-book-cover-overlay {
        opacity: 1;
    }

    .home-page .library-home-latest-more:hover {
        border-color: #b6d4c1;
        background: #fff;
    }
}

@media (max-width: 700px) {
    .home-page .library-home-latest-section {
        padding: 17px 12px;
        border-radius: 18px;
    }

    .home-page .library-home-latest-header {
        flex-wrap: wrap;
        gap: 12px;
        margin-bottom: 14px;
    }

    .home-page .library-home-latest-heading h2 {
        font-size: 19px;
    }

    .home-page .library-home-latest-more {
        padding: 7px 10px;
        font-size: 11px;
    }

    .home-page .library-home-book-card {
        padding: 3px 4px 10px;
    }

    .home-page .library-home-book-cover-overlay {
        padding: 10px 5px;
        opacity: 1;
    }

    .home-page :is(
        .library-home-latest-prev,
        .library-home-latest-next
    ) {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page .library-home-book-cover,
    .home-page .library-home-book-cover > img,
    .home-page .library-home-book-cover-overlay,
    .home-page .library-home-latest-more {
        transition: none;
    }

    .home-page .library-home-book-card:hover
    .library-home-book-cover {
        transform: none;
    }
}

/* کتاب‌های متحرک، با الگوی بخش اول کتابراه */

.home-page .kr-books-section {
    --kr-cover-width: 130px;
    --kr-cover-height: 186px;
    --kr-gap: 16px;

    margin-bottom: 26px;
    padding: 24px 0;
    overflow: hidden;
    border-radius: 20px;
    background: #f5f7f3;
}

.home-page .kr-books-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 24px;
    margin-bottom: 18px;
}

.home-page .kr-books-eyebrow {
    display: block;
    margin-bottom: 5px;
    color: #649c3d;
    font-size: 11px;
    font-weight: 700;
}

.home-page .kr-books-header h2 {
    margin: 0;
    color: #263126;
    font-size: 22px;
    font-weight: 800;
}

.home-page .kr-books-header p {
    margin: 6px 0 0;
    color: #7a8279;
    font-size: 12px;
}

.home-page .kr-books-more {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    color: #649c3d;
    font-size: 12px;
    font-weight: 700;
    text-decoration: none;
}

.home-page .kr-books-wall {
    padding: 8px 0;
}

.home-page .kr-books-row {
    direction: ltr;
    overflow: hidden;
    padding: 8px 0;
}

.home-page .kr-books-track {
    display: flex;
    width: max-content;
    will-change: transform;
}

.home-page .kr-books-row.is-ready .kr-books-track {
    animation: kr-books-scroll var(--kr-duration, 180s) linear infinite;
}

.home-page .kr-books-group {
    display: flex;
    align-items: flex-start;
    flex: 0 0 auto;
    gap: var(--kr-gap);
    padding-right: var(--kr-gap);
}

.home-page .kr-book {
    position: relative;
    display: block;
    flex: 0 0 var(--kr-cover-width);
    width: var(--kr-cover-width);
    height: var(--kr-cover-height);
    overflow: hidden;
    border-radius: 10px;
    background: #eff5eb;
    box-shadow: 0 2px 8px rgb(0 0 0 / 10%);
    color: #567344;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.home-page .kr-book > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.home-page .kr-book-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    height: 100%;
    padding: 12px;
    direction: rtl;
    text-align: center;
    background: linear-gradient(145deg, #e5eedf, #cedfc4);
}

.home-page .kr-book-placeholder > i {
    font-size: 30px;
}

.home-page .kr-book-placeholder > span {
    display: -webkit-box;
    overflow: hidden;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    font-size: 11px;
    line-height: 1.9;
}

.home-page .kr-books-row:hover .kr-books-track,
.home-page .kr-books-row:focus-within .kr-books-track,
.home-page .kr-books-row.is-touching .kr-books-track {
    animation-play-state: paused;
}

.home-page .kr-book:focus-visible {
    outline: 3px solid #649c3d;
    outline-offset: -3px;
}

@keyframes kr-books-scroll {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(var(--kr-travel));
    }
}

@media (max-width: 991px) {
    .home-page .kr-books-section {
        --kr-cover-width: 84px;
        --kr-cover-height: 120px;

        padding: 18px 0;
        border-radius: 16px;
    }

    .home-page .kr-books-header {
        flex-wrap: wrap;
        padding: 0 16px;
    }

    .home-page .kr-books-header h2 {
        font-size: 19px;
    }

    .home-page .kr-book {
        border-radius: 7px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .home-page .kr-books-row.is-ready .kr-books-track {
        animation: none;
        transform: none;
    }

    .home-page .kr-books-row {
        overflow-x: auto;
    }
}

/* ===================================
   Green product strips
   =================================== */

.market-strip,
.market-strip * {
    box-sizing: border-box;
}

.market-strip {
    --strip-green: #70b925;
    --strip-gap: 4px;
    --strip-card-width: 185px;

    display: flex;
    align-items: stretch;
    gap: 14px;
    min-width: 0;
    margin-block: 28px;
    padding: 20px;
    border-radius: 20px;
    background: linear-gradient(110deg, #9ac24f, var(--strip-green));
    font-family: inherit;
    isolation: isolate;
}

/* Right green panel */

.market-strip .market-strip__intro {
    flex: 0 0 150px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 12px 4px;
    text-align: center;
    color: #fff;
}

.market-strip .market-strip__symbol {
    display: grid;
    place-items: center;
    width: 76px;
    height: 76px;
    border-bottom: 5px solid rgb(255 255 255 / 90%);
    border-radius: 50%;
    font-size: 64px;
    font-weight: 900;
    line-height: 1;
    transform: rotate(-12deg);
}

.market-strip .market-strip__intro h2 {
    margin: 0;
    color: #fff;
    font-size: 23px;
    font-weight: 900;
    line-height: 1.65;
}

.market-strip .market-strip__intro p {
    margin: 0;
    color: #fff;
    font-size: 12px;
    line-height: 1.9;
}

.market-strip .market-strip__all {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    min-height: 36px;
    padding: 7px 14px;
    border-radius: 8px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 12px;
    font-weight: 700;
}

.market-strip .market-strip__all span {
    font-size: 23px;
    line-height: 1;
}

/* Horizontal track */

.market-strip .market-strip__viewport {
    position: relative;
    flex: 1 1 0;
    min-width: 0;
}

.market-strip .market-strip__track {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: var(--strip-card-width);
    gap: var(--strip-gap);
    align-items: stretch;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    border-radius: 10px;
    -webkit-overflow-scrolling: touch;
}

.market-strip .market-strip__track::-webkit-scrollbar {
    display: none;
}

/* Product cards */

.market-strip .market-strip__card {
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 12px 10px 14px;
    background: #fff;
    color: #343434;
    text-decoration: none;
    scroll-snap-align: start;
}

.market-strip .market-strip__image {
    display: grid;
    place-items: center;
    width: 100%;
    height: 170px;
    margin-bottom: 12px;
    overflow: hidden;
    background: #fff;
}

.market-strip .market-strip__image img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: transform 180ms ease;
}

.market-strip .market-strip__placeholder {
    color: #999;
    font-size: 12px;
}

.market-strip .market-strip__title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    min-height: 50px;
    margin: 0 0 12px;
    color: #444;
    font-size: 12px;
    font-weight: 500;
    line-height: 25px;
}

.market-strip .market-strip__pricing {
    margin-top: auto;
}

.market-strip .market-strip__old-row {
    display: flex;
    align-items: center;
    gap: 7px;
    min-height: 23px;
}

.market-strip .market-strip__old-row del {
    color: #a5a5a5;
    font-size: 11px;
}

.market-strip .market-strip__discount {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 33px;
    padding: 2px 5px;
    border-radius: 20px;
    background: #d7333d;
    color: #fff;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.3;
}

.market-strip .market-strip__price {
    display: flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 5px;
    min-height: 27px;
    color: #262637;
}

.market-strip .market-strip__price strong {
    font-size: 17px;
    font-weight: 900;
    font-variant-numeric: tabular-nums;
}

.market-strip .market-strip__price small {
    font-size: 10px;
    font-weight: 600;
}

/* Navigation */

.market-strip .market-strip__arrow {
    position: absolute;
    top: 50%;
    z-index: 2;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid #e2e2e2;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 3px 12px rgb(0 0 0 / 12%);
    color: #555;
    font: inherit;
    font-size: 30px;
    line-height: 1;
    cursor: pointer;
    transform: translateY(-50%);
}

.market-strip .market-strip__arrow--prev {
    right: 8px;
}

.market-strip .market-strip__arrow--next {
    left: 8px;
}

.market-strip .market-strip__arrow:disabled {
    visibility: hidden;
    pointer-events: none;
}

.market-strip .market-strip__card:focus-visible,
.market-strip .market-strip__all:focus-visible,
.market-strip .market-strip__arrow:focus-visible,
.market-strip .market-strip__track:focus-visible {
    outline: 3px solid #253c95;
    outline-offset: -3px;
}

@media (hover: hover) {
    .market-strip .market-strip__card:hover img {
        transform: scale(1.045);
    }

    .market-strip .market-strip__arrow:hover {
        background: #f3f8ec;
    }
}

@media (min-width: 1500px) {
    .market-strip {
        --strip-card-width: 200px;
    }
}

@media (max-width: 900px) {
    .market-strip {
        --strip-card-width: 170px;
        gap: 10px;
        padding: 14px;
    }

    .market-strip .market-strip__intro {
        flex-basis: 125px;
    }

    .market-strip .market-strip__intro h2 {
        font-size: 20px;
    }

    .market-strip .market-strip__image {
        height: 150px;
    }
}

@media (max-width: 600px) {
    .market-strip {
        --strip-card-width: 150px;
        gap: 8px;
        margin-block: 18px;
        padding: 12px 8px;
        border-radius: 15px;
    }

    .market-strip .market-strip__intro {
        flex-basis: 100px;
        gap: 11px;
        padding-inline: 2px;
    }

    .market-strip .market-strip__symbol {
        width: 56px;
        height: 56px;
        font-size: 46px;
    }

    .market-strip .market-strip__intro h2 {
        font-size: 17px;
    }

    .market-strip .market-strip__intro p {
        font-size: 10px;
    }

    .market-strip .market-strip__all {
        gap: 7px;
        padding: 6px 9px;
        font-size: 10px;
    }

    .market-strip .market-strip__card {
        padding: 9px 8px 12px;
    }

    .market-strip .market-strip__image {
        height: 130px;
        margin-bottom: 8px;
    }

    .market-strip .market-strip__title {
        font-size: 11px;
        line-height: 23px;
        min-height: 46px;
    }

    .market-strip .market-strip__price strong {
        font-size: 15px;
    }

    .market-strip .market-strip__arrow {
        width: 32px;
        height: 32px;
        font-size: 25px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-strip .market-strip__image img {
        transition: none;
    }
}

.market-strip .market-strip__viewport {
    min-width: 0;
    overflow: hidden;
}

.market-strip .market-strip__track {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    cursor: grab;
}

.market-strip .market-strip__track.is-dragging {
    cursor: grabbing;
    scroll-snap-type: none;
    user-select: none;
}

.market-strip .market-strip__card,
.market-strip .market-strip__image img {
    -webkit-user-drag: none;
}

.market-strip .market-strip__arrow {
    z-index: 5;
    pointer-events: auto;
}

/* همه محصولات: گرادیانت آبی و بنفش */
.market-strip.market-strip--all {
    --strip-accent: #6246cf;

    background: radial-gradient(
            ellipse at 95% 0%,
            rgb(255 255 255 / 22%),
            transparent 55%
    ),
    linear-gradient(
            120deg,
            #4338ca 0%,
            #7650d7 48%,
            #3498df 100%
    );
}

/* پربازدیدترین‌ها: گرادیانت صورتی و نارنجی */
.market-strip.market-strip--popular {
    --strip-accent: #c93862;

    background: radial-gradient(
            ellipse at 95% 0%,
            rgb(255 255 255 / 22%),
            transparent 55%
    ),
    linear-gradient(
            120deg,
            #a93277 0%,
            #df4967 48%,
            #f18a47 100%
    );
}

/* ارزان‌ترین‌ها: گرادیانت سبز و فیروزه‌ای */
.market-strip.market-strip--budget {
    --strip-accent: #137b68;

    background: radial-gradient(
            ellipse at 95% 0%,
            rgb(255 255 255 / 22%),
            transparent 55%
    ),
    linear-gradient(
            120deg,
            #087f82 0%,
            #249d75 48%,
            #78b83d 100%
    );
}

/* هماهنگی دکمه مشاهده همه با رنگ هر ردیف */
.market-strip .market-strip__all {
    color: var(--strip-accent, #417c24);
    background: #fff;
    box-shadow: 0 4px 14px rgb(0 0 0 / 10%);
    transition: transform 180ms ease, box-shadow 180ms ease;
}

/* هماهنگی فلش‌ها با رنگ هر ردیف */
.market-strip .market-strip__arrow {
    color: var(--strip-accent, #417c24);
}

@media (hover: hover) {
    .market-strip .market-strip__all:hover {
        transform: translateY(-2px);
        box-shadow: 0 7px 18px rgb(0 0 0 / 16%);
    }

    .market-strip .market-strip__arrow:hover {
        background: #fff;
    }
}

@media (prefers-reduced-motion: reduce) {
    .market-strip .market-strip__all {
        transition: none;
    }
}

/* حذف زمینه و هالهٔ قاب صفحه اصلی */
.home-page {
    background: transparent !important;
    box-shadow: none !important;
}
/* ==================================================
   بنر موبایل و تبلت
   حفظ اسلایدشو + ارتفاع یکسان + نمایش کامل تصاویر
================================================== */

@media (max-width: 1024px) {

    .home-page .home-banner-carousel {
        min-width: 0;
        overflow: hidden;
    }

    /* همهٔ اسلایدها روی یک خانه قرار می‌گیرند */
    .home-page .home-banner-track {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        width: 100%;
    }

    /* کادر همهٔ اسلایدها اندازهٔ یکسان دارد */
    .home-page .home-banner-slide {
        position: relative;
        inset: auto;
        grid-area: 1 / 1;

        width: 100%;
        min-width: 0;
        height: auto;
        min-height: 0;
        max-height: none;
        aspect-ratio: 16 / 7;

        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        z-index: 0;

        transition: opacity .55s ease, visibility .55s;
    }

    .home-page .home-banner-slide.active {
        position: relative;
        inset: auto;

        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        z-index: 1;
    }

    /* تصویر کامل داخل کادر ثابت نمایش داده می‌شود */
    .home-page .home-banner-image {
        position: absolute;
        inset: 0;

        display: block;
        width: 100%;
        max-width: 100%;
        height: 100%;
        min-height: 0;
        max-height: none;

        margin: 0;
        aspect-ratio: auto;
        object-fit: contain;
        object-position: center;
    }
}

/* کادر کمی بلندتر برای موبایل */
@media (max-width: 700px) {
    .home-page .home-banner-slide {
        aspect-ratio: 16 / 9;
    }
}

/* رعایت تنظیم کاهش حرکت دستگاه */
@media (prefers-reduced-motion: reduce) {
    .home-page .home-banner-slide {
        transition: none;
    }
}
