/* ==========================================================================
   NOTE: این فایل به base.css وابسته است (متغیرهای :root از اونجا میان).
   حتما base.css رو قبل از این فایل توی <head> لینک کن.
   ========================================================================== */

/* ==========================================================================
   Home-page shared visuals
   ========================================================================== */
body {
    margin: 0;
}

.placeholder-img {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, #eae8e3 0%, #dfddd7 100%);
    transition: transform var(--transition-normal);
}

.placeholder-img--dark {
    background: radial-gradient(circle, #4a4d4a 0%, #2a2d2a 100%);
}

.header__logo-img {
    height: 55px;
    width: auto;
    display: block;
    object-fit: contain;
}

/* ==========================================================================
   Section Card Box Layout
   ========================================================================== */
.section {
    padding: 20px 0;
}

.features {
    padding: 20px 0;
}

.section > .container,
.hero > .container,
.features > .container {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: 28px 24px;
    box-shadow: var(--shadow-soft);
}

.hero > .container {
    padding: 12px;
}

.features > .container {
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.feature-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 18px 20px;
    box-shadow: var(--shadow-soft);
}

/* ==========================================================================
   Combined Dark Hero Card (Header + Hero + Features)
   ========================================================================== */
.hero-wrapper-card {
    width: 100%;
    margin-top: 0;
    background-color: #1a1c1e;
    border-top-left-radius: 0;
    border-top-right-radius: 0;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    padding: 16px 24px 24px;
    color: #ffffff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    margin-bottom: 1rem;
}

.header--dark {
    background: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
    position: static !important;
}

.header--dark .header__logo-symbol,
.header--dark .header__logo-title {
    color: #ffffff;
}

.header--dark .header__logo-tagline {
    color: rgba(255, 255, 255, 0.6);
}

.header--dark .header__search {
    background-color: rgba(255, 255, 255, 0.95);
}

.header--dark .header__action-btn,
.header--dark .header__icon-btn {
    color: #ffffff;
}

.header--dark .nav {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.header--dark .nav__link {
    color: rgba(255, 255, 255, 0.7);
}

.header--dark .nav__link--active,
.header--dark .nav__link:hover {
    color: var(--color-accent);
}

.header--dark .nav__link--active::after {
    background-color: var(--color-accent);
}

.hero {
    padding: 16px 0 !important;
}

.features {
    padding: 16px 0 0 !important;
}

.features__container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.hero-wrapper-card .feature-card {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 8px 12px;
    color: #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-wrapper-card .feature-card__icon {
    color: rgba(255, 255, 255, 0.85);
}

.hero-wrapper-card .feature-card__title {
    color: #ffffff;
    font-size: 13px;
}

.hero-wrapper-card .feature-card__desc {
    color: rgba(255, 255, 255, 0.5);
    font-size: 11px;
}

/* ==========================================================================
   Hero Slider (Functional Dynamic Transitions)
   ========================================================================== */
.hero {
    padding: 20px 0 0;
}

.hero__slider {
    position: relative;
    height: 380px;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background-color: var(--color-dark-bg);
}

.hero__slide {
    position: absolute;
    inset: 0;
    background-color: #111412;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.4s ease,
        visibility 0.4s ease;
}

.hero__slide--active {
    opacity: 1;
    visibility: visible;
}

.hero__slide-media {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero__slide-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
}

.hero__subtitle {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 24px;
}

.hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.hero__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.15);
    color: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    transition: background-color var(--transition-fast);
}

.hero__arrow:hover {
    background-color: rgba(255, 255, 255, 0.35);
}

.hero__arrow--prev {
    right: 16px;
}

.hero__arrow--next {
    left: 16px;
}

.hero__dots {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 6px;
    z-index: 5;
}

.hero__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.hero__dot--active {
    background-color: var(--color-surface);
    width: 20px;
    border-radius: var(--radius-full);
}

/* ==========================================================================
   Features Bar
   ========================================================================== */
.features {
    padding: 24px 0;
}

.features__container {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.feature-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: var(--shadow-soft);
}

.feature-card__icon {
    color: var(--color-primary);
}

.feature-card__title {
    font-size: 13px;
    font-weight: 700;
}

.feature-card__desc {
    font-size: 11px;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Sections Layout & Horizontal Smooth Scroll Sliders
   ========================================================================== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.section-header__title {
    font-size: 18px;
    font-weight: 700;
}

.section-header__title-wrap {
    display: flex;
    align-items: center;
    gap: 16px;
}

.section-header__link {
    font-size: 13px;
    color: var(--color-text-muted);
}
.brand-item__logo {
    max-height: 90px;
    width: auto;
    object-fit: contain;
    filter: grayscale(100%);
    opacity: 0.7;
    border: none;
    outline: none;
    transition:
        filter 0.3s ease,
        opacity 0.3s ease;
}

.brand-item__logo:hover {
    filter: grayscale(0%);
    opacity: 1;
}

.carousel-arrow {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-dark);
    box-shadow: var(--shadow-soft);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    z-index: 2;
}

.carousel-arrow:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.scroll-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
    padding: 4px 0;
    flex: 1 1 auto;
    min-width: 0; /* allow shrinking inside flex parent so it scrolls instead of overflowing the page */
}

.scroll-container::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

/* ==========================================================================
   Categories Section
   ========================================================================== */
.categories-carousel {
    display: flex;
    align-items: center;
    gap: 12px;
}

.category-circle-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    flex-shrink: 0;
    width: 100px;
}

.category-circle-card__img-wrap {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    overflow: hidden;
    margin-bottom: 8px;
    border: 1px solid var(--color-border);
}

.category-circle-card__img-wrap img.placeholder-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.category-circle-card:hover .placeholder-img {
    transform: scale(1.08);
}

.category-circle-card__title {
    font-size: 12px;
    font-weight: 500;
}

/* ==========================================================================
   Banners
   ========================================================================== */
.promo-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.promo-card {
    position: relative;
    height: 160px;
    border-radius: var(--radius-md);
    overflow: hidden;
    color: var(--color-surface);
}

.promo-card__content {
    position: absolute;
    inset: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(90deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 0.6) 100%);
}

.promo-card__title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 4px;
}

.promo-card__desc {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 12px;
}

/* ==========================================================================
   Products Section
   ========================================================================== */
.countdown-timer {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--color-text-muted);
}

.countdown-timer__time {
    font-family: var(--font-en);
    font-weight: 700;
    color: var(--color-accent);
}

.products-carousel-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* کارت محصول یکپارچه (ظاهر کارت دوم) — محدود به اسلایدر صفحه اصلی
   تا با کلاس‌های هم‌نام تو shop.css (نسخه‌ی گرید) تداخل نکنه.
   width + flex-shrink برای سالم موندن اسکرول افقی .scroll-container لازمه. */
.products-carousel-wrap .product-card {
    background-color: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 12px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    box-shadow: var(--shadow-soft);
    transition:
        transform var(--transition-normal),
        box-shadow var(--transition-normal);
    flex-shrink: 0;
    width: 180px;
}

.products-carousel-wrap .product-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.products-carousel-wrap .discount-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    background-color: #16a34a;
    color: #ffffff;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 7px;
    border-radius: var(--radius-sm);
    z-index: 2;
}

.products-carousel-wrap .product-img {
    height: 130px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.products-carousel-wrap .product-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--transition-normal);
}

.products-carousel-wrap .product-card:hover .product-img img {
    transform: scale(1.06);
}

.products-carousel-wrap .product-title {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    text-align: center;
    margin-bottom: 8px;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.products-carousel-wrap .price-line {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.products-carousel-wrap .product-price {
    font-size: 13px;
    font-weight: 700;
    color: var(--color-primary);
}

.products-carousel-wrap .product-price.price-discounted {
    color: #16a34a;
}

.products-carousel-wrap .product-price-old {
    font-size: 11px;
    color: var(--color-text-muted);
    text-decoration: line-through;
}

.products-carousel-wrap .price-variant-note {
    font-size: 10px;
    color: var(--color-text-muted);
    text-align: center;
    margin-top: -6px;
    margin-bottom: 10px;
}

.products-carousel-wrap .btn-add-cart {
    width: 100%;
    background-color: #1a1c1e;
    color: #ffffff;
    border: none;
    padding: 8px 10px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color var(--transition-fast);
    text-decoration: none;
    box-sizing: border-box;
    min-height: 34px;
}

.products-carousel-wrap .btn-add-cart:hover {
    background-color: #000000;
}

.products-carousel-wrap .btn-add-cart i {
    font-size: 11px;
    line-height: 1;
}

/* روی موبایل کارت رو کمی باریک‌تر می‌کنیم تا چند تا بیشتر تو دید باشه،
   خود اسکرول افقی نیازی به تغییر تعداد ستون نداره */
@media (max-width: 480px) {
    .products-carousel-wrap .product-card {
        width: 150px;
    }

    .products-carousel-wrap .product-img {
        height: 110px;
    }
}

/* ==========================================================================
   Continuous Infinite Loop Brands Ticker (Self Animated)
   ========================================================================== */
.brands-ticker {
    overflow: hidden;
    width: 100%;
    position: relative;
    padding: 4px 0;
}

.brands-ticker__track {
    display: flex;
    gap: 16px;
    width: max-content;
    animation: infiniteTicker 20s linear infinite;
}

.brands-ticker:hover .brands-ticker__track {
    animation-play-state: paused;
}

@keyframes infiniteTicker {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(50%);
    }
}

.brand-item {
    background-color: var(--color-surface);
    height: 60px;
    width: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.brand-item__text {
    font-family: var(--font-en);
    font-weight: 700;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* ==========================================================================
   Blog Section
   ========================================================================== */
.blog-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ==========================================================================
   Hero Content (text block over the slide image)
   ========================================================================== */
.hero__content {
    position: relative;
    z-index: 2;
    padding: 0 60px;
    max-width: 550px;
    color: var(--color-surface);
}

.hero__title {
    font-size: 34px;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.hero__title span {
    display: inline-block;
    justify-content: center;
    align-items: center;
}

.hero__slide::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: linear-gradient(
        to left,
        rgba(10, 12, 10, 0.1) 0%,
        rgba(10, 12, 10, 0.7) 60%,
        rgba(10, 12, 10, 0.85) 100%
    );
}

/* ==========================================================================
   Blog Article Cards (Home page "مجله علم و هنر" section)
   ========================================================================== */
.article-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%; /* fills the grid row so all 4 cards in a row match height */
    transition:
        transform 0.2s ease,
        box-shadow 0.2s ease;
}

.article-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

/* The <a> wraps the whole card and was breaking the flex chain
   (card-footer's margin-top:auto had nothing to push against
   because its flex parent, .card-content, never got real height
   to grow into). Making the anchor a stretching flex column fixes it. */
.article-card > a {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.card-image {
    position: relative;
    width: 100%;
    height: 160px;
    background-color: #e9ecef;
    flex-shrink: 0;
}

.card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
}

.card-content {
    padding: 16px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: #212529;
    margin-bottom: 8px;
    line-height: 1.4;
}

.card-excerpt {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 16px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    margin-top: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 1px dashed black;
    padding-top: 10px;
    font-size: 11px;
    color: var(--text-muted);
}

.read-more {
    color: var(--primary-color);
    font-weight: 500;
}
