/* ==========================================================================
   SCROLL-WORLD 3D GALLERY - GRANDES VINOS ALTA MESA
   Ultra-luxury spatial perspective gallery driven by scroll
   ========================================================================== */

/* Main outer container spanning multiple viewports to create scroll track */
.sw-container {
    position: relative;
    width: 100%;
    height: 480vh;
    background: #080103;
    color: #f7f1e5;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Sticky viewport that stays fixed on screen while user scrolls through the track */
.sw-viewport {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: radial-gradient(ellipse at 50% 45%, #24070e 0%, #120306 45%, #050002 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    -webkit-user-select: none;
}

/* Atmospheric luxury overlays */
.sw-ambient-vignette {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 5;
    background: radial-gradient(circle at 50% 50%, transparent 40%, rgba(5, 0, 2, 0.7) 80%, rgba(0, 0, 0, 0.95) 100%),
                linear-gradient(to bottom, rgba(5, 0, 2, 0.8) 0%, transparent 15%, transparent 85%, rgba(5, 0, 2, 0.9) 100%);
}

.sw-ambient-glow {
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(178, 148, 94, 0.12) 0%, rgba(146, 0, 11, 0.08) 50%, transparent 70%);
    filter: blur(80px);
    pointer-events: none;
    z-index: 2;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.4s ease-out;
}

/* Floor grid / reflection line */
.sw-floor-line {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(178, 148, 94, 0.4) 50%, transparent);
    z-index: 6;
}

/* Header HUD */
.sw-header-hud {
    position: absolute;
    top: 2rem;
    left: 0;
    width: 100%;
    text-align: center;
    z-index: 20;
    pointer-events: none;
    padding: 0 1.5rem;
}

.sw-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: #d4a96a;
    font-weight: 600;
    padding: 0.35rem 1rem;
    background: rgba(178, 148, 94, 0.08);
    border: 1px solid rgba(178, 148, 94, 0.25);
    border-radius: 30px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    margin-bottom: 0.5rem;
}

.sw-eyebrow i {
    color: #e5c388;
    font-size: 0.85rem;
}

.sw-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: clamp(1.8rem, 4vw, 3rem);
    color: #fff;
    margin: 0;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.8);
    letter-spacing: 0.02em;
}

.sw-title-accent {
    background: linear-gradient(135deg, #f5e4c3 0%, #b2945e 50%, #e2be7e 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    font-style: italic;
}

.sw-subtitle {
    font-size: clamp(0.85rem, 1.2vw, 1.05rem);
    color: rgba(240, 230, 211, 0.75);
    max-width: 650px;
    margin: 0.4rem auto 0;
    font-weight: 300;
}

/* Bottom HUD (Progress bar, counters, actions) */
.sw-bottom-hud {
    position: absolute;
    bottom: 2rem;
    left: 0;
    width: 100%;
    z-index: 20;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    box-sizing: border-box;
}

.sw-hud-left,
.sw-hud-right {
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.sw-hud-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    pointer-events: auto;
}

/* Scroll indicator animation */
.sw-scroll-hint {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: rgba(212, 169, 106, 0.85);
    transition: opacity 0.4s ease;
}

.sw-mouse-icon {
    width: 18px;
    height: 28px;
    border: 1.5px solid rgba(212, 169, 106, 0.6);
    border-radius: 12px;
    position: relative;
}

.sw-mouse-icon::after {
    content: '';
    position: absolute;
    top: 5px;
    left: 50%;
    transform: translateX(-50%);
    width: 3px;
    height: 6px;
    background: #d4a96a;
    border-radius: 2px;
    animation: swMouseWheel 1.6s infinite ease-in-out;
}

@keyframes swMouseWheel {
    0% { transform: translate(-50%, 0); opacity: 1; }
    80% { transform: translate(-50%, 8px); opacity: 0; }
    100% { transform: translate(-50%, 0); opacity: 0; }
}

/* Progress track */
.sw-progress-track {
    width: 180px;
    height: 2px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.sw-progress-fill {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #b2945e, #f5e4c3);
    transition: width 0.1s linear;
}

.sw-hud-counter {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    color: #e5c388;
    letter-spacing: 0.08em;
}

.sw-hud-counter span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.8rem;
}

/* HUD Interactive Buttons */
.sw-btn {
    background: rgba(20, 5, 8, 0.7);
    border: 1px solid rgba(178, 148, 94, 0.35);
    color: #f7f1e5;
    padding: 0.45rem 1rem;
    font-size: 0.78rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.25s ease;
}

.sw-btn:hover {
    background: rgba(178, 148, 94, 0.2);
    border-color: #b2945e;
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(178, 148, 94, 0.25);
}

.sw-btn-icon-only {
    padding: 0.45rem 0.65rem;
}

/* ==========================================================================
   3D STAGE & WORLD
   ========================================================================== */
.sw-stage {
    position: absolute;
    width: 100%;
    height: 100%;
    perspective: 1000px;
    perspective-origin: 50% 50%;
    transform-style: preserve-3d;
    overflow: hidden;
    z-index: 10;
}

.sw-world {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    transform-style: preserve-3d;
    will-change: transform;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ==========================================================================
   3D PICTURE CARDS
   ========================================================================== */
.sw-card {
    position: absolute;
    transform-style: preserve-3d;
    will-change: transform, opacity;
    cursor: pointer;
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    border-radius: 8px;
    padding: 8px;
    background: rgba(15, 3, 6, 0.85);
    border: 1px solid rgba(178, 148, 94, 0.35);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.8),
                0 0 20px rgba(178, 148, 94, 0.1);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-sizing: border-box;
}

.sw-card:hover {
    border-color: #d4a96a;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.95),
                0 0 35px rgba(212, 169, 106, 0.35);
}

/* Aspect ratios & sizes */
.sw-card-horizontal {
    width: 360px;
    max-width: 85vw;
}

.sw-card-horizontal .sw-card-img-wrap {
    aspect-ratio: 3 / 2;
}

.sw-card-vertical {
    width: 270px;
    max-width: 75vw;
}

.sw-card-vertical .sw-card-img-wrap {
    aspect-ratio: 2 / 3;
}

.sw-card-square {
    width: 300px;
    max-width: 80vw;
}

.sw-card-square .sw-card-img-wrap {
    aspect-ratio: 1 / 1;
}

/* Image container */
.sw-card-img-wrap {
    position: relative;
    width: 100%;
    overflow: hidden;
    border-radius: 4px;
    background: #1a050a;
}

.sw-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.sw-card:hover .sw-card-img {
    transform: scale(1.06);
}

/* Card gold inner rim */
.sw-card-img-wrap::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 4px;
    pointer-events: none;
    transition: border-color 0.3s ease;
}

.sw-card:hover .sw-card-img-wrap::after {
    border-color: rgba(212, 169, 106, 0.5);
}

/* Card caption bar */
.sw-card-meta {
    padding: 0.65rem 0.4rem 0.2rem;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.5rem;
}

.sw-card-info {
    flex: 1;
    min-width: 0;
}

.sw-card-badge {
    font-size: 0.65rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #b2945e;
    display: block;
    margin-bottom: 0.2rem;
    font-weight: 600;
}

.sw-card-caption {
    font-family: 'Playfair Display', serif;
    font-size: 0.95rem;
    color: #fff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sw-card-expand-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(178, 148, 94, 0.15);
    border: 1px solid rgba(178, 148, 94, 0.3);
    color: #e5c388;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    transition: all 0.25s ease;
    flex-shrink: 0;
}

.sw-card:hover .sw-card-expand-icon {
    background: #b2945e;
    color: #000;
    transform: scale(1.1);
}

/* ==========================================================================
   LIGHTBOX MODAL
   ========================================================================== */
.sw-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(4, 0, 1, 0.94);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 1.5rem;
    box-sizing: border-box;
}

.sw-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.sw-lightbox-dialog {
    position: relative;
    max-width: 1000px;
    max-height: 90vh;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sw-lightbox-figure {
    position: relative;
    max-width: 100%;
    max-height: 75vh;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(178, 148, 94, 0.4);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.9), 0 0 40px rgba(178, 148, 94, 0.15);
    border-radius: 6px;
    overflow: hidden;
    background: #000;
}

.sw-lightbox-img {
    max-width: 100%;
    max-height: 75vh;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.sw-lightbox-caption-box {
    margin-top: 1rem;
    text-align: center;
    max-width: 700px;
}

.sw-lightbox-tag {
    font-size: 0.75rem;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    color: #d4a96a;
    display: block;
    margin-bottom: 0.3rem;
}

.sw-lightbox-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.35rem;
    color: #fff;
    margin: 0 0 0.3rem;
}

.sw-lightbox-desc {
    font-size: 0.9rem;
    color: rgba(240, 230, 211, 0.8);
    margin: 0;
    line-height: 1.5;
}

.sw-lightbox-close {
    position: absolute;
    top: -2.5rem;
    right: 0;
    background: transparent;
    border: none;
    color: #fff;
    font-size: 1.8rem;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease, transform 0.2s ease;
}

.sw-lightbox-close:hover {
    color: #d4a96a;
    transform: scale(1.15);
}

.sw-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(20, 4, 8, 0.8);
    border: 1px solid rgba(178, 148, 94, 0.4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sw-lightbox-nav:hover {
    background: #b2945e;
    color: #000;
    border-color: #b2945e;
}

.sw-lightbox-prev {
    left: -3.5rem;
}

.sw-lightbox-next {
    right: -3.5rem;
}

/* ==========================================================================
   MASONRY GRID MODAL (ALTERNATIVE BROWSER VIEW)
   ========================================================================== */
.sw-grid-modal {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: rgba(8, 1, 3, 0.96);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 4rem 1.5rem 3rem;
    box-sizing: border-box;
}

.sw-grid-modal.active {
    opacity: 1;
    visibility: visible;
}

.sw-grid-container {
    max-width: 1280px;
    margin: 0 auto;
}

.sw-grid-header {
    text-align: center;
    margin-bottom: 2.5rem;
    position: relative;
}

.sw-grid-close {
    position: absolute;
    top: -1rem;
    right: 0;
    background: rgba(178, 148, 94, 0.1);
    border: 1px solid rgba(178, 148, 94, 0.3);
    color: #e5c388;
    padding: 0.5rem 1.25rem;
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.25s ease;
}

.sw-grid-close:hover {
    background: #b2945e;
    color: #000;
}

.sw-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
}

.sw-grid-item {
    position: relative;
    border-radius: 6px;
    overflow: hidden;
    background: #150307;
    border: 1px solid rgba(178, 148, 94, 0.25);
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 4 / 3;
}

.sw-grid-item:hover {
    transform: translateY(-5px);
    border-color: #d4a96a;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(178, 148, 94, 0.3);
}

.sw-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.sw-grid-item:hover img {
    transform: scale(1.08);
}

.sw-grid-item-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1rem;
    box-sizing: border-box;
}

.sw-grid-item:hover .sw-grid-item-overlay {
    opacity: 1;
}

.sw-grid-item-title {
    font-family: 'Playfair Display', serif;
    font-size: 1rem;
    color: #fff;
    margin: 0;
}

.sw-grid-item-sub {
    font-size: 0.75rem;
    color: #d4a96a;
    margin: 0.2rem 0 0;
}

/* ==========================================================================
   RESPONSIVE QUERIES
   ========================================================================== */
@media (max-width: 991px) {
    .sw-container {
        height: 440vh;
    }

    .sw-lightbox-nav {
        display: none;
    }

    .sw-card-horizontal {
        width: 300px;
    }

    .sw-card-vertical {
        width: 230px;
    }
}

@media (max-width: 767px) {
    .sw-container {
        height: 400vh;
    }

    .sw-header-hud {
        top: 1.2rem;
        padding: 0 1rem;
    }

    .sw-subtitle {
        display: none;
    }

    .sw-bottom-hud {
        bottom: 1rem;
        padding: 0 1rem;
    }

    .sw-scroll-hint {
        display: none;
    }

    .sw-card-horizontal {
        width: 260px;
    }

    .sw-card-vertical {
        width: 210px;
    }

    .sw-btn span {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .sw-world {
        transition: none !important;
    }
}
