/* ===================================================================
   HMNS Membership Header - Full Screen Hero Carousel
   Inspired by Chevron.com with smooth transitions and performance optimization
   =================================================================== */

/* Reset and base styles */
.membership-hero * {
    box-sizing: border-box;
}

/* Main carousel container - Full screen width, dynamic height */
.membership-hero.fullscreen-carousel {
    position: relative;
    width: 100vw;
    min-height: 600px;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    overflow: hidden;
    z-index: 0;
}

#container { padding-top: 0 !important; }

.membership-hero .carousel-container {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Carousel items container */
.membership-hero .carousel-items {
    position: relative;
    width: 100%;
    height: 100%;
    min-height: 400px;
}

/* Individual carousel items */
.membership-hero .carousel-item {
    position: absolute !important;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 1;
    cursor: grab;
}

.membership-hero .carousel-item.active {
    opacity: 1;
    transform: translateX(0);
    z-index: 10;
}

.membership-hero .carousel-item.exiting {
    opacity: 0;
    transform: translateX(-100%);
    z-index: 5; /* Lower than entering slide */
}

.membership-hero .carousel-item.entering {
    opacity: 1;
    transform: translateX(0);
    z-index: 15; /* Higher than active slide during transition */
}

/* Dragging states */
.membership-hero.is-dragging .carousel-item {
    transition: none; /* Disable transitions during drag */
    cursor: grabbing;
}

.membership-hero.is-dragging .carousel-item.active {
    z-index: 20; /* Highest during drag */
}

/* Ensure non-active slides stay behind during drag */
.membership-hero.is-dragging .carousel-item:not(.active) {
    z-index: 2;
}

/* Disable pointer events on content during drag to prevent conflicts */
.membership-hero.is-dragging .carousel-content {
    pointer-events: none;
}

.membership-hero.is-dragging .carousel-ui {
    pointer-events: none;
}

/* Cursor states */
.membership-hero .carousel-item:hover {
    cursor: grab;
}

.membership-hero.is-dragging .carousel-item {
    cursor: grabbing !important;
}

/* Smooth drag preview transitions */
.membership-hero .carousel-item:not(.active) {
    will-change: transform, opacity;
}

/* Prevent text selection during potential drags */
.membership-hero .carousel-items {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Video backgrounds */
.membership-hero .hero-video, .membership-hero .hero-vimeo {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center center;
    pointer-events: none;
    z-index: 1;
}

.membership-hero .hero-vimeo iframe {
    position: absolute;
    top: 50% !important;
    left: 50% !important;
    width: 100% !important;
    height: 100% !important;
    min-width: 177.78vh !important; /* Width at 16:9 when height = 100vh */
    min-height: 56.25vw !important; /* Height at 16:9 when width = 100vw */
    transform: translate(-50%, -50%) !important;
    pointer-events: none;
    z-index: 1;
}

/* Safari-specific fixes for Vimeo iframe positioning */
.membership-hero.is-safari .hero-vimeo iframe {
    /* Safari fix: Avoid viewport units and use percentage-based approach */
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    width: 100% !important;
    height: auto !important;
    min-width: 100% !important;
    min-height: 100% !important;
    transform: translate(-50%, -50%) !important;
    -webkit-transform: translate(-50%, -50%) !important;
    object-fit: cover;
}

/* For Safari, ensure the container uses the full viewport break-out technique */
.membership-hero.is-safari .hero-vimeo {
    position: absolute !important;
    top: 0 !important;
    left: 50% !important;
    width: 100vw !important;
    height: 100% !important;
    transform: translateX(-50%) !important;
    -webkit-transform: translateX(-50%) !important;
    overflow: hidden;
    z-index: 1;
}

/* iOS Safari specific fixes */
.membership-hero.is-ios .hero-vimeo iframe {
    /* iOS Safari: JavaScript will handle precise dimensions */
    position: absolute !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    -webkit-transform: translate(-50%, -50%) !important;
    width: auto !important;
    height: auto !important;
    min-width: 100% !important;
    min-height: 100% !important;
}

/* Fallback for @supports detection */
@supports (-webkit-appearance: none) and (not (transform-style: preserve-3d)) {
    .membership-hero .hero-vimeo iframe {
        /* Additional Safari fallback */
        -webkit-backface-visibility: hidden;
        backface-visibility: hidden;
        -webkit-perspective: 1000px;
        perspective: 1000px;
    }
}

/* Image backgrounds with zoom animation */
.membership-hero .hero-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center center;
    background-repeat: no-repeat;
    z-index: 1;
}

.membership-hero .carousel-item.active .hero-image {
    animation: heroZoomOut var(--photo-duration, 8s) ease-out forwards;
}

.membership-hero .carousel-item:not(.active) .hero-image {
    animation: none;
    transform: scale(1.1); /* Reset to starting position */
}

@keyframes heroZoomOut {
    0% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

/* Shade overlay */
.membership-hero .shade {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        135deg,
        rgba(0, 0, 0, 0.4) 0%,
        rgba(0, 0, 0, 0.2) 50%,
        rgba(0, 0, 0, 0.6) 100%
    );
    z-index: 2;
}

/* Content container */
.membership-hero .carousel-content {
    position: absolute;
    top: 0;
    left: 50%;
    width: 1400px;
    max-width:100%;
    height: 100%;
    display: flex;
    align-items: center;
    z-index: 10;
    opacity: 0;
    transform: translateX(-50%) !important;
    transition: all 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94) 0.3s;
    /* Padding will be applied via JavaScript based on user settings */
}

/* Flex justify-content based on text alignment */
.membership-hero .carousel-content.text-center {
    justify-content: center;
}

.membership-hero .carousel-content.text-left {
    justify-content: flex-start;
}

.membership-hero .carousel-content.text-right {
    justify-content: flex-end;
}

.membership-hero .carousel-item.active .carousel-content {
    opacity: 1;
    transform: translateX(0);
}

/* Base content inner styling */
.membership-hero .carousel-content-inner {
    width: 100%;
    max-width: 1400px; /* HMNS standard section width */
    color: white;
}

/* Text alignment specific layouts */
.membership-hero .carousel-content.text-center .carousel-content-inner {
    margin-left: auto;
    margin-right: auto;
    text-align: center;
}

.membership-hero .carousel-content.text-left .carousel-content-inner {
    margin-left: 0;
    margin-right: auto;
    text-align: left;
}

.membership-hero .carousel-content.text-right .carousel-content-inner {
    margin-left: auto;
    margin-right: 0;
    text-align: right;
}



/* Temporary measurement container is now created dynamically by JavaScript */

/* Typography */
.membership-hero .large-title {
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    font-weight: bold;
    margin-bottom: 1rem;
    line-height: 1.2;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
}

.membership-hero .sub-title {
    font-size: clamp(1.2rem, 2.5vw, 1.8rem);
    margin-bottom: 1.5rem;
    font-weight: 300;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

.membership-hero .text {
    font-size: clamp(1rem, 1.5vw, 1.2rem);
    margin-bottom: 2rem;
    line-height: 1.6;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.7);
}

/* Button styles */
.membership-hero .button-container {
    margin-top: 2rem;
}

/* Button alignment based on text alignment */
.membership-hero .carousel-content.text-center .button-container {
    text-align: center;
}

.membership-hero .carousel-content.text-left .button-container {
    text-align: left;
}

.membership-hero .carousel-content.text-right .button-container {
    text-align: right;
}

/* UI Controls */
.membership-hero .carousel-ui {
    position: absolute;
    bottom: 1rem;
    left: 50%;
    transform: translate(-50%,-50%);
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    padding: 0 10px;
    border-radius: 25px;
}

/* Dash indicators with improved clickability */
.membership-hero .dashes-container {
    display: flex;
    justify-content: center;
}

.membership-hero .dashes {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

/* Clickable container around each dash */
.membership-hero .dash-clickable {
    padding: 12px 8px; /* Larger click target */
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Original dash styling restored */
.membership-hero .dash {
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.membership-hero .dash::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 100%;
    background: var(--monarch, #d4a574);
    border-radius: 2px;
    transition: none; /* Remove transition to prevent conflicts with animation */
}

.membership-hero .dash.active::before {
    width: 100%;
    background:rgba(255,255,255,.7);
}

/* Restore dash filling animation */
.membership-hero .dash.filling::before {
    width: 0; /* Ensure we start from 0 */
    animation: dashFill var(--slide-duration, 8s) linear forwards;
    background:var(--monarch, #d4a574);
}

@keyframes dashFill {
    0% {
        width: 0;
    }
    100% {
        width: 100%;
    }
}

.membership-hero .dash-clickable:hover .dash {
    background: rgba(255, 255, 255, 0.5);
}


/* Control buttons positioned at bottom right of content area */
.membership-hero .carousel-controls {
    position: relative;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    pointer-events: auto; /* Re-enable pointer events for controls */
}

.membership-hero .carousel-controls button svg {
    width: 20px;
    height: 20px;
}

.membership-hero .carousel-controls button svg path { fill: white; }

.membership-hero .carousel-controls a.cta.tertiary { gap: 8px; }

.membership-hero .carousel-controls a.cta.tertiary svg {
    margin: 0;
    width:24px;
    height: 24px;
}

/* Rotate the next arrow (reusing left arrow) */
.membership-hero .rotated-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotate(180deg);
    width: 100%;
    height: 100%;
}

.membership-hero .carousel-controls button {
    background: none;
    border: none;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0;
    margin: 0; 
}

/* Clean, minimal SVG styling */
.membership-hero .carousel-controls button svg {
    width: 32px;
    height: 32px;
    fill: white;
    flex-shrink: 0;
    transition: opacity 0.3s ease;
    margin:0;
}
.carousel-content-inner a { display: flex; align-items: center; justify-content: center; gap: 8px; }
.carousel-content-inner a svg { width: 16px; height: 16px; margin: 0;}
.carousel-content-inner a svg path { fill: white; }

/* Subtle hover effect - just opacity change */
.membership-hero .carousel-controls button:hover svg {
    opacity: 0.7;
}

/* Clean SVG styling - minimal and elegant */
.membership-hero .carousel-controls button svg path {
    fill: white;
}

/* Keep the original stroke styling for play/pause button borders */
.membership-hero .carousel-controls .carousel-play svg rect,
.membership-hero .carousel-controls .carousel-pause svg rect {
    stroke: rgba(242, 244, 238, 0.3);
    fill: none;
}

/* Modal styles */
.membership-hero .modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.membership-hero .modal-container.show {
    opacity: 1;
    visibility: visible;
}

.membership-hero .modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
}

.membership-hero .close-modal {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    transition: all 0.3s ease;
}

.membership-hero .close-modal:hover {
    background: rgba(0, 0, 0, 0.9);
}

.membership-hero .close-modal svg {
    width: 20px;
    height: 20px;
    fill: white;
}

.membership-hero .modal-video {
    width: 100%;
    height: auto;
    display: block;
}

@media screen and (max-width:1120px) {
    .membership-hero .carousel-content * * *{
        text-align: center;
    }
    .membership-hero .carousel-content.text-left * * *{
        text-align: center;
    }
    .membership-hero .carousel-content.text-right * * *{
        text-align: center;
    }
    .membership-hero .carousel-content .button-container a { margin: 0 auto;}
}

/* Responsive design */
@media (max-width: 768px) {
    .membership-hero.fullscreen-carousel {
        min-height: 400px;
    }
    
    .membership-hero .carousel-content-inner {
        padding: 0;
        max-width: 100%;
    }
    
    /* Padding will be handled by JavaScript for responsive behavior */
    
    /* Responsive text alignment adjustments */
    .membership-hero .carousel-content.text-left .large-title,
    .membership-hero .carousel-content.text-left .sub-title,
    .membership-hero .carousel-content.text-left .text,
    .membership-hero .carousel-content.text-right .large-title,
    .membership-hero .carousel-content.text-right .sub-title,
    .membership-hero .carousel-content.text-right .text {
        max-width: 100%;
    }
    
    .membership-hero .carousel-content.text-center .large-title,
    .membership-hero .carousel-content.text-center .sub-title,
    .membership-hero .carousel-content.text-center .text {
        max-width: 90%;
    }
    
    .membership-hero .carousel-ui {
        bottom: 2rem;
        gap: 1rem;
    }
    
    .membership-hero .dash {
        width: 30px;
        height: 3px;
    }
    
    .membership-hero .dash-clickable {
        padding: 10px 6px;
    }
    
    .membership-hero .carousel-controls-container {
        width: 100%;
    }
    
    
    .membership-hero .carousel-controls button {
        width: 40px;
        height: 40px;
    }
    
    .membership-hero .carousel-controls button svg {
        width: 16px;
        height: 16px;
    }
    
    .membership-hero .carousel-controls .carousel-play,
    .membership-hero .carousel-controls .carousel-pause {
        width: 40px;
        height: 40px;
    }
    
    .membership-hero .carousel-controls .carousel-play svg,
    .membership-hero .carousel-controls .carousel-pause svg {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .membership-hero.fullscreen-carousel {
        min-height: 350px;
    }
    
    /* Mobile padding handled by JavaScript */
    
    .membership-hero .dashes {
        gap: 0.3rem;
    }
    
    .membership-hero .dash {
        width: 25px;
    }
    
    .membership-hero .dash-clickable {
        padding: 8px 4px;
    }
  
}

/* Performance optimizations - Hide inactive slides completely */
.membership-hero .carousel-item:not(.active):not(.entering):not(.exiting) {
    visibility: hidden;
    z-index: 0; /* Ensure they're at the bottom of the stack */
}

/* Ensure only transition states are visible */
.membership-hero .carousel-item:not(.active):not(.entering):not(.exiting) {
    opacity: 0 !important;
    transform: translateX(100%) !important;
}

.membership-hero .hero-video {
    will-change: transform;
}

.membership-hero .carousel-content {
    will-change: opacity, transform;
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    .membership-hero .carousel-item,
    .membership-hero .carousel-content,
    .membership-hero .dash,
    .membership-hero .carousel-controls button {
        transition: none;
    }
    
    .membership-hero .hero-image {
        animation: none;
    }
    
    .membership-hero .dash.filling::before {
        animation: none;
        width: 100%;
    }
}

/* Focus styles for accessibility */
.membership-hero .carousel-controls button:focus,
.membership-hero .dash:focus,
.membership-hero .close-modal:focus {
    

}

