/* ========================================
   3D IMAGE CUBE GRID GALLERY
   ======================================== */

/* ---------- GLOBAL RESET ---------- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    border: 0;
    box-sizing: border-box;
}

*:focus {
    outline: none;
}

/* ---------- BODY CONTAINER ---------- */
.image-cube-gallery-wrapper {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 20px;
    position: relative;
}

/* ---------- GALLERY CONTAINER ---------- */
.image-cube-grid-gallery {
    width: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ---------- UNSUPPORTED BROWSER MESSAGE ---------- */
.image-cube-grid-gallery__unsupported {
    display: none;
    padding: 20px;
    background: #f8d7da;
    color: #721c24;
    border-radius: 8px;
    text-align: center;
    margin-bottom: 20px;
}

@supports not (container-type: inline-size) {
    .image-cube-grid-gallery__unsupported {
        display: block;
    }
}

/* ---------- INFO TEXT ---------- */
.image-cube-grid-gallery__info {
    text-align: center;
    color: #666;
    font-size: 14px;
    margin-bottom: 30px;
    padding: 10px;
}

.image-cube-grid-gallery__info a {
    color: #c14242;
    text-decoration: none;
}

/* ---------- NAVIGATION ---------- */
.image-cube-grid-gallery__navigation {
    display: flex;
    gap: 12px;
    margin-bottom: 30px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 30px;
    flex-wrap: wrap;
    justify-content: center;
}

.image-cube-grid-gallery__button {
    display: inline-block;
}

.image-cube-grid-gallery__button input[type="radio"] {
    appearance: none;
    -webkit-appearance: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid #ddd;
    transition: all 0.3s ease;
    position: relative;
}

.image-cube-grid-gallery__button input[type="radio"]:checked {
    border-color: #c14242;
    background: #c14242;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(193, 66, 66, 0.3);
}

.image-cube-grid-gallery__button input[type="radio"]::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: transparent;
    transition: all 0.3s ease;
}

.image-cube-grid-gallery__button input[type="radio"]:checked::after {
    background: white;
}

/* ---------- GRID CONTAINER ---------- */
.image-cube-grid {
    width: 100%;
    container-type: inline-size;
    container-name: grid;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 30px;
    padding: 20px;
    perspective: 1000px;
}

/* ---------- 3D CUBE ---------- */
.image-cube {
    aspect-ratio: 1 / 1;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 1s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

/* Cube face rotation controlled by radio buttons */
#face-front:checked ~ .image-cube-grid .image-cube {
    transform: rotateY(0deg) rotateX(0deg);
}

#face-right:checked ~ .image-cube-grid .image-cube {
    transform: rotateY(-90deg) rotateX(0deg);
}

#face-back:checked ~ .image-cube-grid .image-cube {
    transform: rotateY(180deg) rotateX(0deg);
}

#face-left:checked ~ .image-cube-grid .image-cube {
    transform: rotateY(90deg) rotateX(0deg);
}

#face-top:checked ~ .image-cube-grid .image-cube {
    transform: rotateX(-90deg) rotateY(0deg);
}

/* ---------- CUBE FACES ---------- */
.image-cube__face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    background: #fff;
    transition: box-shadow 0.3s ease;
}

.image-cube:hover .image-cube__face {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
}

.image-cube__face img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.image-cube:hover .image-cube__face img {
    transform: scale(1.05);
}

/* Face positions */
.image-cube__face--front {
    transform: translateZ(calc(100% / 2));
}

.image-cube__face--back {
    transform: rotateY(180deg) translateZ(calc(100% / 2));
}

.image-cube__face--right {
    transform: rotateY(90deg) translateZ(calc(100% / 2));
}

.image-cube__face--left {
    transform: rotateY(-90deg) translateZ(calc(100% / 2));
}

.image-cube__face--top {
    transform: rotateX(90deg) translateZ(calc(100% / 2));
}

.image-cube__face--bottom {
    transform: rotateX(-90deg) translateZ(calc(100% / 2));
}

/* ---------- RESPONSIVE SIZING ---------- */
@container grid (min-width: 800px) {
    .image-cube {
        --cube-size: 200px;
    }
}

@container grid (max-width: 799px) and (min-width: 500px) {
    .image-cube {
        --cube-size: 160px;
    }
}

@container grid (max-width: 499px) {
    .image-cube {
        --cube-size: 130px;
    }
}

/* ---------- CUBE SIZE ADJUSTMENT ---------- */
.image-cube {
    width: var(--cube-size, 200px);
    height: var(--cube-size, 200px);
    margin: 0 auto;
}

.image-cube__face {
    width: var(--cube-size, 200px);
    height: var(--cube-size, 200px);
}

.image-cube__face--front {
    transform: translateZ(calc(var(--cube-size, 200px) / 2));
}

.image-cube__face--back {
    transform: rotateY(180deg) translateZ(calc(var(--cube-size, 200px) / 2));
}

.image-cube__face--right {
    transform: rotateY(90deg) translateZ(calc(var(--cube-size, 200px) / 2));
}

.image-cube__face--left {
    transform: rotateY(-90deg) translateZ(calc(var(--cube-size, 200px) / 2));
}

.image-cube__face--top {
    transform: rotateX(90deg) translateZ(calc(var(--cube-size, 200px) / 2));
}

.image-cube__face--bottom {
    transform: rotateX(-90deg) translateZ(calc(var(--cube-size, 200px) / 2));
}

/* ---------- HOVER EFFECTS ---------- */
.image-cube:hover {
    transform: rotateY(15deg) rotateX(5deg) scale(1.02);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.image-cube-grid-gallery__navigation:has(#face-front:checked) ~ .image-cube-grid .image-cube:hover {
    transform: rotateY(15deg) rotateX(5deg) scale(1.02);
}

.image-cube-grid-gallery__navigation:has(#face-right:checked) ~ .image-cube-grid .image-cube:hover {
    transform: rotateY(-75deg) rotateX(5deg) scale(1.02);
}

.image-cube-grid-gallery__navigation:has(#face-left:checked) ~ .image-cube-grid .image-cube:hover {
    transform: rotateY(105deg) rotateX(5deg) scale(1.02);
}

.image-cube-grid-gallery__navigation:has(#face-top:checked) ~ .image-cube-grid .image-cube:hover {
    transform: rotateX(-75deg) rotateY(15deg) scale(1.02);
}

/* ---------- FACE OVERLAY WITH GRADIENT ---------- */
.image-cube__face::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40%;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.6), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.image-cube:hover .image-cube__face::after {
    opacity: 1;
}

/* ---------- RESPONSIVE MOBILE ---------- */
@media (max-width: 768px) {
    .image-cube-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 20px;
        padding: 15px;
    }

    .image-cube {
        --cube-size: 160px;
    }

    .image-cube__face {
        --cube-size: 160px;
    }

    .image-cube-grid-gallery__navigation {
        gap: 8px;
        padding: 8px;
    }

    .image-cube-grid-gallery__button input[type="radio"] {
        width: 32px;
        height: 32px;
    }
}

@media (max-width: 480px) {
    .image-cube-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
        gap: 15px;
        padding: 10px;
    }

    .image-cube {
        --cube-size: 130px;
    }

    .image-cube__face {
        --cube-size: 130px;
    }

    .image-cube-grid-gallery__button input[type="radio"] {
        width: 28px;
        height: 28px;
    }

    .image-cube-grid-gallery__info {
        font-size: 12px;
        padding: 5px;
    }
}

/* ---------- ANIMATION DELAYS FOR STAGGERED LOAD ---------- */
.image-cube:nth-child(1) { transition-delay: 0.05s; }
.image-cube:nth-child(2) { transition-delay: 0.10s; }
.image-cube:nth-child(3) { transition-delay: 0.15s; }
.image-cube:nth-child(4) { transition-delay: 0.20s; }
.image-cube:nth-child(5) { transition-delay: 0.25s; }
.image-cube:nth-child(6) { transition-delay: 0.30s; }
.image-cube:nth-child(7) { transition-delay: 0.35s; }
.image-cube:nth-child(8) { transition-delay: 0.40s; }
.image-cube:nth-child(9) { transition-delay: 0.45s; }
.image-cube:nth-child(10) { transition-delay: 0.50s; }
.image-cube:nth-child(11) { transition-delay: 0.55s; }
.image-cube:nth-child(12) { transition-delay: 0.60s; }
.image-cube:nth-child(13) { transition-delay: 0.65s; }
.image-cube:nth-child(14) { transition-delay: 0.70s; }
.image-cube:nth-child(15) { transition-delay: 0.75s; }
.image-cube:nth-child(16) { transition-delay: 0.80s; }

/* ---------- FALLBACK FOR NON-SUPPORTING BROWSERS ---------- */
@supports not (container-type: inline-size) {
    .image-cube-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 20px;
        perspective: none;
    }

    .image-cube {
        transform: none !important;
        animation: none !important;
        perspective: none;
        aspect-ratio: 1 / 1;
        border-radius: 12px;
        overflow: hidden;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
        transition: transform 0.3s ease;
    }

    .image-cube:hover {
        transform: scale(1.03);
    }

    .image-cube__face {
        position: relative;
        transform: none !important;
        backface-visibility: visible;
        border-radius: 12px;
    }

    .image-cube__face--front {
        transform: none !important;
    }

    .image-cube__face--back,
    .image-cube__face--right,
    .image-cube__face--left,
    .image-cube__face--top,
    .image-cube__face--bottom {
        display: none;
    }

    .image-cube-grid-gallery__unsupported {
        display: block !important;
    }

    .image-cube-grid-gallery__navigation {
        display: none;
    }
}

/* ========================================
   AUTO-ADVANCING FADE GALLERY
   ======================================== */

.auto-gallery-wrapper {
    width: 100%;
    max-width: 900px; /* Adjust to fit your layout */
    margin: 0 auto;
    padding: 20px;
}

.auto-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9; /* Keeps consistent dimensions */
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    background-color: #000;
}

.auto-gallery__slide {
    position: absolute;
    inset: 0; /* Modern equivalent to top:0, left:0, right:0, bottom:0 */
    opacity: 0;
    visibility: hidden;
    /* Adds a subtle zoom-out effect alongside the fade */
    transform: scale(1.05); 
    /* 1s transition duration for a smooth, elegant switch */
    transition: opacity 1s ease-in-out, transform 1s ease-in-out, visibility 1s;
    z-index: 1;
}

/* The active state */
.auto-gallery__slide.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 2;
}

.auto-gallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}


/* Make sure the main container has a dark background 
   so you don't see white flashes between fades */
.auto-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.15);
    background-color: #111; 
}

/* 1. THE BASE STATE (Hidden) */
.auto-gallery__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    
    /* Starts slightly pushed in */
    transform: scale(1.15); 
    
    /* THE MAGIC: This creates the smooth 1.5-second animation */
    transition: opacity 1.5s ease-in-out, transform 1.5s ease-out, visibility 1.5s;
    z-index: 1;
}

/* 2. THE ACTIVE STATE (Visible) */
.auto-gallery__slide.active {
    opacity: 1;
    visibility: visible;
    
    /* Settles perfectly into the center */
    transform: scale(1);
    z-index: 2;
}

/* Ensure the image fills the space correctly */
.auto-gallery__slide img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}/* ========================================
   HERO TEXT OVERLAY
   ======================================== */

.hero-inner {
    position: absolute;
    inset: 0; /* Stretches to fill the gallery container */
    z-index: 10; /* Ensures it sits above the active slide (which is z-index 2) */
    
    /* Flexbox for perfect centering */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    
    /* Typography styling for a clean, modern aesthetic */
    color: #ffffff;
    pointer-events: none; /* Allows user to right-click/save images through the text */
}

/* Base typography setup - adjust to match your ultra-thin font stack */
.hero-eyebrow {
    font-size: 0.9rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    margin-bottom: 10px;
    opacity: 0.8;
}

.hero-title {
    font-size: clamp(1.5rem, 4vw, 3rem); /* Responsive sizing */
    font-weight: 300;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.hero-subtitle {
    font-size: 1.2rem;
    font-weight: 300;
    letter-spacing: 0.3em;
}

/* OPTIONAL: Adds a dark tint over the images so the white text is always readable */
.auto-gallery::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4); /* 40% black overlay */
    z-index: 5; /* Sits between the images (2) and the text (10) */
    pointer-events: none;
}.auto-gallery__slide {
    position: absolute;
    inset: 0;
    opacity: 0;
    visibility: hidden;
    transform: scale(1.15);
    /* Crucial: Set transition here */
    transition: opacity 1.5s ease-in-out, transform 1.5s ease-out, visibility 1.5s;
    z-index: 1; /* Standard slides */
}

.auto-gallery__slide.active {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
    z-index: 2; /* Active slide pops to the front */
}.auto-gallery {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 16px;
    background: #000;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}

.auto-gallery__slide{
    position:absolute;
    inset:0;

    opacity:0;
    visibility:hidden;

    transition:
        opacity 1.2s ease,
        visibility 1.2s;

    z-index:1;
}

.auto-gallery__slide.active{
    opacity:1;
    visibility:visible;
    z-index:2;
}

.auto-gallery__slide img{
    width:100%;
    height:100%;
    object-fit:cover;

    transform:scale(1.15);
    transition:transform 5s ease;
}

.auto-gallery__slide.active img{
    transform:scale(1);
}

.gallery3d-container {
    width: 100%;
    height: 600px;
    display: flex;
    justify-content: center;
    align-items: center;
    perspective: 2500px; /* Increased for better depth */
    overflow: hidden;
    background: transparent;
}

.gallery3d {
    position: relative;
    width: 340px;
    height: 460px;
    transform-style: preserve-3d;
    animation: spin 30s linear infinite; /* Slightly slower for elegance */
    cursor: grab;
}

.gallery3d:hover {
    animation-play-state: paused;
}

.gallery3d-item {
    position: absolute;
    width: 340px;
    height: 460px;
    left: 0;
    top: 0;
    backface-visibility: hidden; /* Critical for 3D performance */
    transition: transform 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.gallery3d-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 24px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    transition: all 0.5s ease;
}

/* Enhanced Hover Effect */
.gallery3d-item:hover {
    z-index: 10;
}

.gallery3d-item:hover img {
    transform: scale(1.15); /* Slightly larger pop-out */
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

/* Positioning remains similar, but ensure spacing allows rotation */
.gallery3d-item:nth-child(1) { transform: rotateY(0deg) translateZ(400px); }
.gallery3d-item:nth-child(2) { transform: rotateY(60deg) translateZ(400px); }
.gallery3d-item:nth-child(3) { transform: rotateY(120deg) translateZ(400px); }
.gallery3d-item:nth-child(4) { transform: rotateY(180deg) translateZ(400px); }
.gallery3d-item:nth-child(5) { transform: rotateY(240deg) translateZ(400px); }
.gallery3d-item:nth-child(6) { transform: rotateY(300deg) translateZ(400px); }

@keyframes spin {
    from { transform: rotateX(-5deg) rotateY(0deg); }
    to { transform: rotateX(-5deg) rotateY(360deg); }
}


.gallery3d {
    transform-style: preserve-3d;
    transition: transform 0.2s ease-out;
}

/* When the user moves the mouse, change the rotation based on position */
/* This requires a tiny bit of JS to be truly effective */
.gallery3d:hover {
    transform: rotateY(var(--mouse-x)) rotateX(var(--mouse-y));
}
.gallery3d {
    position: relative;
    width: 340px;
    height: 460px;
    transform-style: preserve-3d;
    /* Tilt the entire stack for a cinematic feel */
    transform: rotateY(-20deg) rotateX(10deg);
}

.gallery3d-item {
    position: absolute;
    width: 340px;
    height: 460px;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Offset each card in Z-space to create depth */
.gallery3d-item:nth-child(1) { transform: translateZ(0px); }
.gallery3d-item:nth-child(2) { transform: translateZ(-50px) translateX(20px); }
.gallery3d-item:nth-child(3) { transform: translateZ(-100px) translateX(40px); }
.gallery3d-item:nth-child(4) { transform: translateZ(-150px) translateX(60px); }

/* Hover makes the cards "fan out" */
.gallery3d:hover .gallery3d-item:nth-child(2) { transform: translateZ(50px) translateX(100px); }
.gallery3d-item:hover { transform: translateZ(100px) !important; }



.flip-card {
  background-color: transparent;
  width: 300px;
  height: 400px;
  perspective: 1000px; /* Provides the 3D depth */
  cursor: pointer;
}

.flip-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  text-align: center;
  transition: transform 0.8s;
  transform-style: preserve-3d;
}

/* Trigger the flip on hover */
.flip-card:hover .flip-card-inner {
  transform: rotateY(180deg);
}

.flip-card-front, .flip-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden; /* Hides the back of the card */
  border-radius: 20px;
  overflow: hidden;
}

.flip-card-front {
  background-color: #bbb;
}

.flip-card-back {
  background-color: #333;
  color: white;
  transform: rotateY(180deg); /* Pre-rotate the back side */
  display: flex;
  align-items: center;
  justify-content: center;
}




.dust-container {
    position: relative;
    width: 400px;
    height: 500px;
    overflow: hidden;
    cursor: pointer;
}

canvas {
    width: 100%;
    height: 100%;
}

.text-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 3rem;
    color: white;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.dust-container:hover .text-overlay {
    opacity: 1;
}.gallery-item {
    width: 340px;
    height: 460px;
    background-image: url('your-image.jpg');
    background-size: cover;
    transition: clip-path 1.5s ease-in-out, opacity 1.5s ease;
    /* This creates the 'disappearing' animation */
    clip-path: inset(0% 0% 0% 0%);
}

.gallery-item:hover {
    /* Wipes the image away from the center */
    clip-path: inset(50% 50% 50% 50%);
    opacity: 0;
}