/**
 * Homepage Hero Highlights Carousel Styles
 * Lucky Puppy Animal Rescue
 */

:root {
    --hero-mobile-ratio: 4 / 3;
}

.hero-carousel-section {
    min-width: 0;
    max-width: 100%;
    position: relative;
    padding-top: 1.5rem;
    padding-bottom: 0.5rem;
}

.hero-carousel-section .container {
    min-width: 0;
    max-width: 100%;
}

.hero-carousel {
    position: relative;
    contain: inline-size;
    min-width: 0;
    max-width: 100%;
    border-radius: 16px;
    background-color: #f8fafc;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);

    /* Inset calculations */
    --hero-arrow-offset: 16px;
    --hero-arrow-width: 44px;
    --hero-arrow-clearance: calc(var(--hero-arrow-offset) + var(--hero-arrow-width) + 16px);
    --hero-header-inset: 0px;
    --hero-text-inset: max(var(--hero-header-inset, 0px), var(--hero-arrow-clearance));

    /* Zoom scales */
    --hero-zoom-scale: 1.09;
    --hero-zoom-duration: 10s;
}

.hero-carousel.has-arrows {
    --hero-text-inset: max(var(--hero-header-inset, 0px), var(--hero-arrow-clearance));
}

.hero-carousel.no-arrows {
    --hero-text-inset: max(var(--hero-header-inset, 0px), 16px);
}

.hero-zoom-subtle {
    --hero-zoom-scale: 1.05;
}

.hero-zoom-medium {
    --hero-zoom-scale: 1.09;
}

.hero-zoom-strong {
    --hero-zoom-scale: 1.14;
}

.hero-viewport {
    position: relative;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -ms-overflow-style: none;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    border-radius: 16px;
}

.hero-viewport::-webkit-scrollbar {
    display: none;
}

.hero-viewport:focus-visible {
    outline: 2px solid var(--color-primary, #b45309);
    outline-offset: -2px;
}

.hero-track {
    display: flex;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    margin: 0;
    padding: 0;
}

.hero-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    aspect-ratio: var(--hero-mobile-ratio, calc(4 / 3));
    overflow-wrap: anywhere;
}

.hero-slide__media {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 16px;
}

.hero-slide__media picture {
    display: block;
    width: 100%;
    height: 100%;
}

.hero-slide__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transform: scale(1);
    transform-origin: center;
}

/* Focal Point object-position and transform-origin classes */
.focal-center { object-position: 50% 50%; transform-origin: 50% 50%; }
.focal-top    { object-position: 50% 0%;   transform-origin: 50% 0%; }
.focal-bottom { object-position: 50% 100%; transform-origin: 50% 100%; }
.focal-left   { object-position: 0% 50%;   transform-origin: 0% 50%; }
.focal-right  { object-position: 100% 50%; transform-origin: 100% 50%; }

/* Ken Burns Smooth Zoom-In Effect */
.hero-carousel[data-carousel-zoom="1"] .hero-slide.is-active .hero-slide__img {
    animation-name: heroZoom;
    animation-duration: var(--hero-zoom-duration, 10s);
    animation-timing-function: ease-out;
    animation-fill-mode: forwards;
    will-change: transform;
}

.hero-carousel.is-paused .hero-slide__img {
    animation-play-state: paused !important;
}

@keyframes heroZoom {
    from {
        transform: scale(1);
    }
    to {
        transform: scale(var(--hero-zoom-scale, 1.09));
    }
}

/* Overlay classes */
.hero-slide__overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 1;
}

.overlay-none {
    background: none;
}

/* Directional gradients guaranteeing worst-case alpha >= 0.60 black over text zone */
.overlay-light.overlay-pos-left {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.40) 60%, rgba(0, 0, 0, 0.15) 100%);
}
.overlay-light.overlay-pos-right {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.55) 0%, rgba(0, 0, 0, 0.40) 60%, rgba(0, 0, 0, 0.15) 100%);
}
.overlay-light.overlay-pos-center,
.overlay-light {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3) 0%, rgba(0, 0, 0, 0.5) 50%, rgba(0, 0, 0, 0.3) 100%);
}

.overlay-medium.overlay-pos-left {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.68) 55%, rgba(0, 0, 0, 0.25) 100%);
}
.overlay-medium.overlay-pos-right {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.68) 55%, rgba(0, 0, 0, 0.25) 100%);
}
.overlay-medium.overlay-pos-center,
.overlay-medium {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.75) 30%, rgba(0, 0, 0, 0.75) 70%, rgba(0, 0, 0, 0.62) 100%);
}

.overlay-strong.overlay-pos-left {
    background: linear-gradient(to right, rgba(0, 0, 0, 0.90) 0%, rgba(0, 0, 0, 0.82) 55%, rgba(0, 0, 0, 0.40) 100%);
}
.overlay-strong.overlay-pos-right {
    background: linear-gradient(to left, rgba(0, 0, 0, 0.90) 0%, rgba(0, 0, 0, 0.82) 55%, rgba(0, 0, 0, 0.40) 100%);
}
.overlay-strong.overlay-pos-center,
.overlay-strong {
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.70) 0%, rgba(0, 0, 0, 0.88) 30%, rgba(0, 0, 0, 0.88) 70%, rgba(0, 0, 0, 0.70) 100%);
}

/* Slide Content Overlay (both desktop and mobile) */
.hero-slide__content {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    padding-left: var(--hero-text-inset);
    padding-right: var(--hero-text-inset);
    padding-top: 1rem;
    padding-bottom: 4.25rem;
    pointer-events: none;
    overflow-wrap: anywhere;
    box-sizing: border-box;
}

.text-pos-left {
    justify-content: flex-start;
    text-align: left;
}
.text-pos-left .hero-slide__card {
    text-align: left;
    margin-right: auto;
    margin-left: 0;
}
.text-pos-left .hero-slide__btn {
    margin-right: auto;
    margin-left: 0;
}

.text-pos-center {
    justify-content: center;
    text-align: center;
}
.text-pos-center .hero-slide__card {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}
.text-pos-center .hero-slide__btn {
    margin-left: auto;
    margin-right: auto;
}

.text-pos-right {
    justify-content: flex-end;
    text-align: right;
}
.text-pos-right .hero-slide__card {
    text-align: right;
    margin-left: auto;
    margin-right: 0;
}
.text-pos-right .hero-slide__btn {
    margin-left: auto;
    margin-right: 0;
}

.hero-slide__card {
    max-width: 560px;
    width: 100%;
    pointer-events: auto;
    color: #ffffff;
}

.hero-slide__title {
    font-weight: 800;
    color: #ffffff;
    line-height: 1.25;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.75);
    overflow-wrap: anywhere;
}

.hero-slide__subheading {
    color: #f8fafc;
    line-height: 1.45;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.75);
    overflow-wrap: anywhere;
}

.hero-slide__btn {
    width: auto;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
    text-decoration: none;
}

/* Phone Layout (< 768px): Aspect-ratio 4:3, compact overlaid text */
@media (max-width: 767.98px) {
    .hero-carousel {
        --hero-arrow-offset: 8px;
        --hero-arrow-width: 40px;
        --hero-arrow-clearance: calc(var(--hero-arrow-offset) + var(--hero-arrow-width) + 16px);
    }

    .hero-slide__content {
        padding-top: 0.75rem;
        padding-bottom: 3.75rem;
    }

    .hero-slide__card {
        max-width: 100%;
    }

    .hero-slide__title {
        font-size: 1.35rem;
        margin-bottom: 0.35rem;
    }

    .hero-slide__subheading {
        font-size: 0.95rem;
        margin-bottom: 0.75rem;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
    }

    .hero-slide__btn {
        min-height: 44px;
        padding: 0.5rem 1rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.95rem;
    }

    /* On phones, effective overlay is never weaker than medium for slides with text */
    .hero-slide.has-text .hero-slide__overlay.overlay-none,
    .hero-slide.has-text .hero-slide__overlay.overlay-light {
        display: block !important;
    }

    .hero-slide.has-text .hero-slide__overlay.overlay-none.overlay-pos-left,
    .hero-slide.has-text .hero-slide__overlay.overlay-light.overlay-pos-left {
        background: linear-gradient(to right, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.68) 55%, rgba(0, 0, 0, 0.25) 100%);
    }

    .hero-slide.has-text .hero-slide__overlay.overlay-none.overlay-pos-right,
    .hero-slide.has-text .hero-slide__overlay.overlay-light.overlay-pos-right {
        background: linear-gradient(to left, rgba(0, 0, 0, 0.78) 0%, rgba(0, 0, 0, 0.68) 55%, rgba(0, 0, 0, 0.25) 100%);
    }

    .hero-slide.has-text .hero-slide__overlay.overlay-none.overlay-pos-center,
    .hero-slide.has-text .hero-slide__overlay.overlay-light.overlay-pos-center {
        background: linear-gradient(to bottom, rgba(0, 0, 0, 0.62) 0%, rgba(0, 0, 0, 0.75) 30%, rgba(0, 0, 0, 0.75) 70%, rgba(0, 0, 0, 0.62) 100%);
    }

    .hero-arrow {
        width: 40px;
        height: 40px;
    }

    .hero-arrow--prev {
        left: 8px;
    }

    .hero-arrow--next {
        right: 8px;
    }

    .hero-controls-bar {
        bottom: 10px;
        padding: 4px 8px;
        gap: 6px;
    }

    .hero-dot {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }

    .hero-dot::before {
        width: 10px;
        height: 10px;
    }

    .hero-play-pause-btn {
        width: 28px;
        height: 28px;
        min-width: 28px;
        min-height: 28px;
    }
}

/* Desktop & Tablet (>= 768px): Aspect-ratio 32:15 */
@media (min-width: 768px) {
    .hero-slide {
        aspect-ratio: 32 / 15;
    }

    .hero-slide__media {
        aspect-ratio: 32 / 15;
    }

    .hero-slide__card {
        max-width: 560px;
    }

    .hero-slide__title {
        font-size: 2.25rem;
        margin-bottom: 0.75rem;
    }

    .hero-slide__subheading {
        font-size: 1.125rem;
        margin-bottom: 1.5rem;
    }

    .hero-slide__btn {
        min-height: 44px;
    }

    .hero-arrow {
        width: 44px;
        height: 44px;
    }

    .hero-arrow--prev {
        left: 16px;
    }

    .hero-arrow--next {
        right: 16px;
    }

    .hero-controls-bar {
        bottom: 16px;
        padding: 6px 14px;
        gap: 12px;
    }
}

/* Hero Controls: Arrows, Dots, Play/Pause */
.hero-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.92);
    color: #1e293b;
    border: 1px solid rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

.hero-arrow:hover {
    background-color: #ffffff;
    transform: translateY(-50%) scale(1.06);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.hero-arrow:focus-visible {
    outline: 2px solid var(--color-primary, #b45309);
    outline-offset: 2px;
}

.hero-arrow--prev {
    left: 16px;
}

.hero-arrow--next {
    right: 16px;
}

.hero-controls-bar {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 10;
    background: rgba(15, 23, 42, 0.65);
    padding: 6px 14px;
    border-radius: 24px;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.hero-dots {
    display: flex;
    align-items: center;
    gap: 2px;
}

.hero-dot {
    position: relative;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.hero-dot::before {
    content: '';
    display: block;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    transition: background-color 0.2s, transform 0.2s;
}

.hero-dot.is-active::before {
    background-color: #ffffff;
    transform: scale(1.25);
}

.hero-dot:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: -2px;
    border-radius: 4px;
}

.hero-play-pause-btn {
    background: none;
    border: none;
    color: #ffffff;
    width: 28px;
    height: 28px;
    min-width: 28px;
    min-height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: transform 0.2s, opacity 0.2s;
}

.hero-play-pause-btn:hover {
    opacity: 0.85;
}

.hero-play-pause-btn:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .hero-slide__img {
        animation: none !important;
        transform: none !important;
    }

    .hero-play-pause-btn {
        display: none !important;
    }
}
