/* Shared storefront performance: reserve media boxes so CLS does not return. */
img {
    max-width: 100%;
}

img[width][height] {
    height: auto;
}

/* ==================== Critical Swiper Layout (Prevents Vertical Stacking & CLS) ==================== */
.swiper {
    margin-left: auto;
    margin-right: auto;
    position: relative;
    overflow: hidden;
    list-style: none;
    padding: 0;
    z-index: 1;
    display: block;
}
.swiper-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    z-index: 1;
    display: flex;
    transition-property: transform;
    box-sizing: content-box;
}
.swiper:not(.swiper-initialized) .swiper-wrapper {
    overflow-x: hidden;
    flex-wrap: nowrap;
}
.swiper-slide {
    flex-shrink: 0;
    width: 100%;
    height: 100%;
    position: relative;
    transition-property: transform;
    display: block;
}
/* Multi-slide carousels (product cards): preserve horizontal row before initialization */
.swiper:not(.swiper-initialized) .swiper-wrapper,
.new-products-card-swiper:not(.swiper-initialized) .swiper-wrapper {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: hidden;
}
.swiper:not(.swiper-initialized) .new-products-card-swiper .swiper-slide,
.new-products-card-swiper:not(.swiper-initialized) .swiper-slide {
    width: 12.5rem;
    max-width: 80vw;
    flex-shrink: 0;
}
@media (min-width: 768px) {
    .swiper:not(.swiper-initialized) .new-products-card-swiper .swiper-slide,
    .new-products-card-swiper:not(.swiper-initialized) .swiper-slide {
        width: 13.5rem;
    }
}
@media (min-width: 1024px) {
    .swiper:not(.swiper-initialized) .new-products-card-swiper .swiper-slide,
    .new-products-card-swiper:not(.swiper-initialized) .swiper-slide {
        width: 14.5rem;
    }
}

/* Compositor-friendly animations (GPU accelerated - fixes non-composited animations) */
.animate-pulse {
    animation: diaraPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    will-change: opacity;
}
@keyframes diaraPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.theme-logo,
header img.theme-logo {
    width: auto;
    height: 3rem;
    max-width: 11rem;
    object-fit: contain;
    aspect-ratio: 15 / 4;
}

/* Diara home hero: matches h-50 / lg:h-90 (200px / 360px) */
#mainSlider .swiper-slide > a > div,
#mainSlider .theme-hero-frame {
    aspect-ratio: 1495 / 360;
    height: 12.5rem;
    width: 100%;
    overflow: hidden;
}

@media (min-width: 1024px) {
    #mainSlider .swiper-slide > a > div,
    #mainSlider .theme-hero-frame {
        height: 22.5rem;
    }
}

.mobile-banner-swiper .swiper-slide img,
#mobileBannerSwiper img {
    width: 100%;
    aspect-ratio: 459 / 200;
    object-fit: cover;
    height: auto;
}

#mobileBannerSwiper,
.mobile-banner-swiper {
    aspect-ratio: 459 / 200;
    width: 100%;
}

.diara-home-stories-section {
    min-height: 0;
}

.diara-home-stories-section #stories-container:empty {
    display: none;
    min-height: 0;
}

/* Karin hero already has h-52 / md:h-96; keep images filling that box */
.header-slider img,
#karin-main-slider-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    aspect-ratio: 16 / 7;
}

/* ShopTemplate desktop / mobile sliders */
#main-slider .carousel-inner,
#main-slider-res .carousel-inner {
    min-height: 12.5rem;
}

#main-slider .lazy-image-wrapper {
    aspect-ratio: 3 / 1;
    min-height: 12.5rem;
}

#main-slider-res .lazy-image-wrapper {
    aspect-ratio: 459 / 200;
    min-height: 12.5rem;
}

/* Product thumbs: square slot before the file arrives */
.diara-product-card img,
.product-card img,
.amazing-products img,
.new-products-card-swiper img {
    aspect-ratio: 1 / 1;
    object-fit: contain;
}

/* Home product carousels: size to card content — do NOT reserve empty track height */
#amazing-section .new-products-card-swiper,
#new-products-section .new-products-card-swiper,
#suggested-category-groups-section .new-products-card-swiper,
#best-selling-section .new-products-card-swiper,
#best-selling-products-section .new-products-card-swiper,
section .new-products-card-swiper {
    min-height: 0;
    height: auto;
}

#amazing-section .swiper-slide,
#new-products-section .swiper-slide,
section .new-products-card-swiper .swiper-slide {
    min-height: 0;
    height: auto;
}

#amazing-section,
#new-products-section {
    /* Removed content-visibility: auto to prevent blank areas and cut-off cards during mobile scrolling */
    contain: layout style;
}

#amazingProductsSwiper .swiper-slide > div,
#newProductsSwiper .swiper-slide > div,
#suggestedProductsSwiper .swiper-slide > div,
#bestSellingProductsSwiper .swiper-slide > div,
#marketPulseSwiper .swiper-slide > div,
#hpAssistantSwiper .swiper-slide > div {
    min-height: 17.5rem;
}

/* FormBuilder screenshot carousel */
.fb-banner-carousel-wrap img,
.screen-carousel img {
    aspect-ratio: 390 / 844;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* ==================== Accessibility: Touch Targets & Contrast (WCAG 2.1 AA / Lighthouse 100) ==================== */
.min-w-11 { min-width: 2.75rem; }
.min-h-11 { min-height: 2.75rem; }

/* Mobile Bottom Navigation & Action Buttons: Minimum 48x48px Touch Targets */
.diara-mobile-bottom-nav__item,
button.password-toggle,
#dark-mode-toggle,
#voiceSearchBtn,
#voiceSearchBtnHeaderMobile,
#voiceSearchBtnMobile,
.diara-voice-search-btn {
    min-width: 3rem !important;
    min-height: 3rem !important;
}

/* Swiper pagination bullets: Expanding invisible tap area to 44x44px to satisfy Lighthouse Touch Targets */
.swiper-pagination-bullet {
    position: relative !important;
    min-width: 12px !important;
    min-height: 12px !important;
    margin: 0 6px !important;
    display: inline-block !important;
}
.swiper-pagination-bullet::before {
    content: '' !important;
    position: absolute !important;
    top: -16px !important;
    bottom: -16px !important;
    left: -16px !important;
    right: -16px !important;
    min-width: 44px !important;
    min-height: 44px !important;
    z-index: 10 !important;
}

/* Color swatch dots: Touch target expansion */
.rounded-full.border.border-gray-300,
.rounded-full.border.border-gray-600 {
    position: relative;
}
.rounded-full.border.border-gray-300::before,
.rounded-full.border.border-gray-600::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -10px;
    right: -10px;
}

/* Trust Badges (eNamad, Samandehi): Guaranteed Touch Targets & Inline Flow */
.diara-trust-badge,
.diara-trust-badge a {
    min-width: 48px;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* ==================== WCAG AA High Contrast Color Ratios (> 4.5:1) ==================== */
/* Light Mode Muted Text Contrast */
.text-gray-400,
.text-gray-500,
.product-consumer-price,
span.text-xs.text-gray-400,
span.text-xs.text-gray-500 {
    color: #4b5563 !important; /* gray-600: 7.0:1 contrast ratio on white */
}

.diara-section-more {
    color: #ffffff !important;
}

.line-through {
    color: #64748b !important; /* slate-500: 4.6:1 contrast ratio */
}

.placeholder-gray-400::placeholder,
input::placeholder {
    color: #4b5563 !important;
}

/* Dark Mode Contrast */
.dark .text-gray-400,
.dark .dark\:text-gray-400,
.dark .text-gray-500,
.dark .dark\:text-gray-500,
.dark .diara-section-more,
.dark .product-consumer-price {
    color: #cbd5e1 !important; /* slate-300: 10.4:1 contrast on #0d1117 */
}

.dark .dark\:placeholder-gray-500::placeholder,
.dark input::placeholder {
    color: #94a3b8 !important;
}

.dark .line-through {
    color: #94a3b8 !important;
}

/* High Contrast for Gold Bottom Navigation Center Button */
.diara-mobile-bottom-nav__center-btn {
    color: #0f172a !important;
    font-weight: 800 !important;
}
.diara-mobile-bottom-nav__center-btn svg {
    color: #0f172a !important;
}
