/**
 * Upjau Hero Slider - Frontend Styles
 * 
 * Performance optimized:
 * - CSS-only transitions (no JS animation libraries)
 * - Viewport-based height for automatic fold fitting
 * - Explicit aspect ratio to prevent CLS
 */

/* Container */
.upjau-hero-slider {
    position: relative;
    width: 100%;
    overflow: hidden;
    background-color: #f5f5f5;

    /* E-commerce best practice: 3.5:1 aspect ratio for hero banners
       - Shows ~28% of viewport height on desktop (1920px = 549px height)
       - Leaves content visible above the fold
       - Common ratios: 3:1 (shorter), 2.5:1 (taller), 3.5:1 (balanced) */
    aspect-ratio: 3.5 / 1;
    min-height: 200px;
    max-height: 500px;
}

/* Full-bleed alignment */
.upjau-hero-slider.alignfull {
    width: 100vw;
    margin-left: calc(-50vw + 50%);
}

.upjau-hero-slider.alignwide {
    max-width: var(--wp--style--global--wide-size, 1440px);
    margin-left: auto;
    margin-right: auto;
}

/* Track containing all slides */
.upjau-hero-slider__track {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Individual slide */
.upjau-hero-slider__slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upjau-hero-slider__slide--active {
    opacity: 1;
    visibility: visible;
    z-index: 1;
}

/* Picture element for responsive images */
.upjau-hero-slider__picture {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Slide image - covers full slide area */
.upjau-hero-slider__image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Content overlay (button) */
.upjau-hero-slider__content {
    position: absolute;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    text-align: center;
}

/* Button styling - matches current design */
.upjau-hero-slider__button {
    display: inline-block;
    padding: 12px 32px;
    background-color: #004D25;
    /* Forest green - matches theme */
    color: #ffffff;
    font-size: 16px;
    font-weight: 600;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.upjau-hero-slider__button:hover,
.upjau-hero-slider__button:focus {
    background-color: #16892F;
    /* Leaf green - matches theme */
    color: #ffffff;
    outline: none;
}

.upjau-hero-slider__button:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* Navigation arrows */
.upjau-hero-slider__arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: rgba(0, 0, 0, 0.5);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #ffffff;
    transition: background-color 0.2s ease;
    padding: 0;
}

.upjau-hero-slider__arrow:hover,
.upjau-hero-slider__arrow:focus {
    background-color: rgba(0, 0, 0, 0.7);
    outline: none;
}

.upjau-hero-slider__arrow:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

.upjau-hero-slider__arrow--prev {
    left: 16px;
}

.upjau-hero-slider__arrow--next {
    right: 16px;
}

.upjau-hero-slider__arrow svg {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Tablet breakpoint */
@media (max-width: 1024px) {
    .upjau-hero-slider {
        /* Slightly taller on tablet for better visibility */
        aspect-ratio: 3 / 1;
        min-height: 180px;
        max-height: 400px;
    }

    .upjau-hero-slider__content {
        bottom: 60px;
    }
}

/* Mobile breakpoint */
@media (max-width: 768px) {
    .upjau-hero-slider {
        /* Mobile: use dedicated mobile image with portrait ratio if available
           Otherwise maintain a shorter landscape ratio */
        aspect-ratio: 2 / 1;
        min-height: 150px;
        max-height: 350px;
    }

    .upjau-hero-slider__content {
        bottom: 40px;
    }

    .upjau-hero-slider__button {
        padding: 10px 24px;
        font-size: 14px;
    }

    .upjau-hero-slider__arrow {
        width: 36px;
        height: 36px;
    }

    .upjau-hero-slider__arrow--prev {
        left: 8px;
    }

    .upjau-hero-slider__arrow--next {
        right: 8px;
    }

    .upjau-hero-slider__arrow svg {
        width: 20px;
        height: 20px;
    }
}

/* Small mobile */
@media (max-width: 480px) {
    .upjau-hero-slider {
        aspect-ratio: 1 / 1;
        min-height: 200px;
        max-height: 350px;
    }

    .upjau-hero-slider__content {
        bottom: 24px;
    }
}

/* ========================================
   CLS PREVENTION
   ======================================== */

/* Reserve space for slider during image load */
.upjau-hero-slider::before {
    content: "";
    display: block;
    width: 100%;
    height: 0;
}

/* Ensure images don't cause layout shift */
.upjau-hero-slider__image {
    /* Force synchronous decode for first image */
    content-visibility: auto;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .upjau-hero-slider__slide {
        transition: none;
    }

    .upjau-hero-slider__button,
    .upjau-hero-slider__arrow {
        transition: none;
    }
}