/**
 * Luxe Gallery Frontend Styles - Optimized Build
 * Includes custom slider + lightbox styles (replaces Swiper CSS + PhotoSwipe CSS)
 * @version 2.0.5
 */

/* =========================================================================
 * CSS Custom Properties
 * ========================================================================= */
:root {
    --luxe-gap: 8px;
    --luxe-radius: 12px;
    --luxe-radius-small: 8px;
    --luxe-transition: transform 0.3s ease, box-shadow 0.3s ease, opacity 0.3s ease;
    --luxe-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --luxe-shadow-hover: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --luxe-overlay-bg: linear-gradient(to top, rgba(0,0,0,0.7) 0%, transparent 50%);
    --luxe-caption-color: #ffffff;
    --luxe-caption-bg: rgba(0, 0, 0, 0.8);
    --luxe-button-bg: #ffffff;
    --luxe-button-text: #222222;
    --luxe-accent: #8b6914;
    --luxe-skeleton-bg: #e5e7eb;
    --luxe-skeleton-shine: #f3f4f6;
    /* Spacing scale — replaces scattered magic numbers */
    --luxe-space-xs: 4px;
    --luxe-space-sm: 8px;
    --luxe-space-md: 16px;
    --luxe-space-lg: 24px;
    --luxe-space-xl: 32px;
    --luxe-space-2xl: 40px;
    /* Text colors — replaces hardcoded #222, #595959, #6b7280, #9ca3af */
    --luxe-text-primary: #222222;
    --luxe-text-secondary: #595959;
    --luxe-text-muted: #6b7280;
    --luxe-text-faint: #9ca3af;
    /* Surface colors */
    --luxe-surface: #ffffff;
    --luxe-surface-alt: #f0f0f1;
    --luxe-border: #dddddd;
    /* Lightbox backdrop */
    --luxe-backdrop-bg: rgba(0, 0, 0, 0.92);
}

/* =========================================================================
 * Scoped Reset — prevent theme styles from bleeding into the gallery
 * ========================================================================= */
.luxe-gallery-container img,
.luxe-gallery-lightbox img { border: none; box-shadow: none; max-width: 100%; height: auto; }
.luxe-gallery-container button,
.luxe-gallery-lightbox button { background: none; border: none; padding: 0; margin: 0; cursor: pointer; font: inherit; color: inherit; }
.luxe-gallery-container a { text-decoration: none; color: inherit; }

/* =========================================================================
 * Main Container
 * ========================================================================= */
.luxe-gallery-container {
    max-width: 1280px;
    margin: 0 auto;
    font-family: inherit;
}

/* hero="no" — only the modal dialog renders; container takes no visible space. */
.luxe-gallery-container.luxe-gallery-hero-hidden {
    display: contents;
}

/* Gallery Title */
.luxe-gallery-title { margin: 0 0 16px 0; font-size: 28px; font-weight: 600; line-height: 1.3; color: inherit; letter-spacing: -0.01em; }
.luxe-gallery-title.h1 { font-size: 36px; }
.luxe-gallery-title.h3 { font-size: 24px; }
.luxe-gallery-title.h4 { font-size: 20px; }
.luxe-gallery-title.h5 { font-size: 18px; }
.luxe-gallery-title.h6 { font-size: 16px; }

/* =========================================================================
 * Hero Grid Layout
 * ========================================================================= */
.luxe-gallery-hero-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: var(--luxe-gap);
    height: 55vh;
    height: 55dvh;
    min-height: 450px;
    position: relative;
    border-radius: var(--luxe-radius);
    overflow: hidden;
}

.luxe-gallery-hero-grid .hero-image-item { overflow: hidden; }
.luxe-gallery-hero-grid .hero-image-item a { display: block; width: 100%; height: 100%; }
.luxe-gallery-hero-grid .hero-image-item .luxe-gallery-image-wrapper { width: 100%; height: 100%; }
.luxe-gallery-hero-grid .hero-image-item picture { display: block; width: 100%; height: 100%; }
.luxe-gallery-hero-grid .hero-image-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.3s ease; }
.luxe-gallery-hero-grid .hero-image-item a:hover img { transform: scale(1.05); }

/* Grid Item Positions */
.luxe-gallery-hero-grid .area-1 { grid-column: 1 / 3; grid-row: 1 / 3; }
.luxe-gallery-hero-grid .area-2 { grid-column: 3 / 4; grid-row: 1 / 2; }
.luxe-gallery-hero-grid .area-3 { grid-column: 4 / 5; grid-row: 1 / 2; }
.luxe-gallery-hero-grid .area-4 { grid-column: 3 / 4; grid-row: 2 / 3; }
.luxe-gallery-hero-grid .area-5 { grid-column: 4 / 5; grid-row: 2 / 3; }

/* Show All Photos Button */
.luxe-gallery-hero-grid .show-all-photos {
    position: absolute; bottom: 24px; right: 24px;
    padding: 8px 16px; background: var(--luxe-button-bg, #fff); color: var(--luxe-button-text, #222);
    border: 1px solid var(--luxe-button-text, #222); border-radius: var(--luxe-radius-small);
    cursor: pointer; font-size: 14px; font-weight: 600; transition: var(--luxe-transition);
    display: inline-flex; align-items: center; gap: 8px;
}
.luxe-gallery-hero-grid .show-all-photos:hover { transform: scale(1.02); box-shadow: var(--luxe-shadow); }
.luxe-gallery-hero-grid .show-all-photos:active { transform: scale(0.97); }

/* Virtual Tour Button */
.luxe-gallery-virtual-tour-btn {
    position: absolute; bottom: 24px; left: 24px;
    padding: 8px 16px; background: var(--luxe-button-bg, #fff); color: var(--luxe-button-text, #222);
    border: 1px solid var(--luxe-button-text, #222); border-radius: var(--luxe-radius-small);
    cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--luxe-transition); z-index: 10;
}
.luxe-gallery-virtual-tour-btn:hover { transform: scale(1.02); box-shadow: var(--luxe-shadow); }
.luxe-gallery-virtual-tour-btn:active { transform: scale(0.97); }
.luxe-gallery-virtual-tour-btn svg { width: 16px; height: 16px; }

/* Video, Floor Plan & Compare Buttons — stacked left-side buttons */
.luxe-gallery-video-btn,
.luxe-gallery-floor-plan-btn {
    position: absolute; bottom: 24px; left: 24px;
    padding: 8px 16px; background: var(--luxe-button-bg, #fff); color: var(--luxe-button-text, #222);
    border: 1px solid var(--luxe-button-text, #222); border-radius: var(--luxe-radius-small);
    cursor: pointer; font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--luxe-transition); z-index: 10;
    font-family: inherit;
}
.luxe-gallery-video-btn:hover,
.luxe-gallery-floor-plan-btn:hover { transform: scale(1.02); box-shadow: var(--luxe-shadow); }
.luxe-gallery-video-btn:active,
.luxe-gallery-floor-plan-btn:active { transform: scale(0.97); }
.luxe-gallery-video-btn svg,
.luxe-gallery-floor-plan-btn svg { width: 16px; height: 16px; }

/*
 * Button stacking: each left-side button (VT, Video, Floor Plan, Compare) stacks
 * upward. The template order is: VT → Video → Floor Plan → Compare.
 * We use a counter-based approach: each button lifts the next by 44px.
 */
.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-video-btn,
.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-floor-plan-btn,
.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-compare-btn { bottom: 68px; }

.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-video-btn ~ .luxe-gallery-floor-plan-btn,
.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-video-btn ~ .luxe-gallery-compare-btn,
.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-floor-plan-btn ~ .luxe-gallery-compare-btn { bottom: 112px; }

.luxe-gallery-virtual-tour-btn ~ .luxe-gallery-video-btn ~ .luxe-gallery-floor-plan-btn ~ .luxe-gallery-compare-btn { bottom: 156px; }

/* Without virtual tour: stack from bottom 24px */
.luxe-gallery-video-btn ~ .luxe-gallery-floor-plan-btn,
.luxe-gallery-video-btn ~ .luxe-gallery-compare-btn,
.luxe-gallery-floor-plan-btn ~ .luxe-gallery-compare-btn { bottom: 68px; }

.luxe-gallery-video-btn ~ .luxe-gallery-floor-plan-btn ~ .luxe-gallery-compare-btn { bottom: 112px; }

/* Feature Buttons Container — positioned over the bottom of the hero grid / mobile slider */
.luxe-gallery-feature-buttons {
    display: flex; flex-wrap: wrap; gap: 8px;
    margin-top: -60px; position: relative; z-index: 10;
    padding: 0 24px; pointer-events: none;
}
.luxe-gallery-feature-buttons > * {
    pointer-events: auto; position: static !important;
    bottom: auto !important;
}
.luxe-gallery-feature-buttons > button,
.luxe-gallery-feature-buttons > a {
    padding: 8px 16px; background: var(--luxe-button-bg, #fff); color: var(--luxe-button-text, #222);
    border: 1px solid var(--luxe-button-text, #222); border-radius: var(--luxe-radius-small, 8px);
    cursor: pointer; font-size: 14px; font-weight: 600; text-decoration: none;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--luxe-transition);
    font-family: inherit;
}
.luxe-gallery-feature-buttons > button:hover,
.luxe-gallery-feature-buttons > a:hover { transform: scale(1.02); box-shadow: var(--luxe-shadow); }
.luxe-gallery-feature-buttons > button svg,
.luxe-gallery-feature-buttons > a svg { width: 16px; height: 16px; }

/* Before/After Compare Button */
.luxe-gallery-compare-btn {
    position: absolute; bottom: 24px;
    padding: 8px 16px; background: var(--luxe-button-bg, #fff); color: var(--luxe-button-text, #222);
    border: 1px solid var(--luxe-button-text, #222); border-radius: var(--luxe-radius-small);
    cursor: pointer; font-size: 14px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 8px; transition: var(--luxe-transition); z-index: 10;
    font-family: inherit; left: 24px;
}
.luxe-gallery-compare-btn:hover { transform: scale(1.02); box-shadow: var(--luxe-shadow); }
.luxe-gallery-compare-btn:active { transform: scale(0.97); }
.luxe-gallery-compare-btn svg { width: 16px; height: 16px; }

/* Video in lightbox */
.luxe-lb-video { display: block; margin: auto; }

/* =========================================================================
 * Custom Mobile Slider (replaces Swiper ~14KB CSS)
 * ========================================================================= */
.luxe-gallery-mobile-slider { position: relative; }

.luxe-slider { width: 100%; height: 50vh; height: 50dvh; border-radius: var(--luxe-radius); overflow: hidden; position: relative; }

.luxe-slider-track {
    display: flex; overflow-x: auto;
    -webkit-scroll-snap-type: x mandatory; scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; height: 100%;
}
.luxe-slider-track::-webkit-scrollbar { display: none; }

.luxe-slider-track > * {
    flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always;
    height: 100%;
}

/* The image wrapper owns the full slide height so object-fit: cover fills
 * corner-to-corner. Without this, the wrapper collapses to the image's
 * intrinsic height and a sharp edge shows above the slider's rounded bottom. */
.luxe-gallery-mobile-slider .luxe-gallery-image-wrapper {
    width: 100%; height: 100%;
}

.luxe-slider-track img,
.luxe-slider-track picture { width: 100%; height: 100%; display: block; }
.luxe-slider-track img { object-fit: cover; }

/* Pagination lives on a translucent pill so white/black dots stay legible on
 * any image background (pool, sky, shadow) without shifting layout. */
.luxe-slider-pagination {
    position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%);
    display: flex; z-index: 5; align-items: center;
    min-height: 12px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}
.luxe-slider-pagination:empty { display: none; }

/* Specificity note: the .luxe-gallery-container button reset (line ~51) has
 * specificity (0,1,1) and zeroes padding/margin. Matching that selector by
 * qualifying the dot as button.luxe-slider-dot ensures our rules win. */
button.luxe-slider-dot {
    position: relative;
    width: 10px; height: 10px; border-radius: 50%;
    border: 1px solid rgba(0, 0, 0, 0.25);
    background: rgba(255, 255, 255, 0.75);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    padding: 0;
    /* Visible gap between dots — JS caps visible count at 3. */
    margin: 0 6px;
    flex-shrink: 0;
    box-sizing: border-box;
    transition: width 0.25s ease, height 0.25s ease, opacity 0.25s ease,
                background 0.2s, transform 0.2s, margin 0.25s ease, border-width 0.25s ease;
}
/* Invisible tap-target overlay — extends each dot's hit zone to ~38x38
 * (exceeds WCAG 2.5.8 AA 24x24) without inflating the pagination pill. */
button.luxe-slider-dot::before {
    content: '';
    position: absolute;
    inset: -14px;
    border-radius: 50%;
}
button.luxe-slider-dot.active {
    background: #fff; transform: scale(1.25);
    border-color: rgba(0, 0, 0, 0.35);
}
button.luxe-slider-dot.luxe-dot-hidden {
    width: 0; height: 0; opacity: 0; border-width: 0;
    margin: 0; pointer-events: none;
    box-shadow: none;
}

.luxe-gallery-mobile-slider .show-all-photos-mobile {
    position: absolute; bottom: 35px; left: 50%; transform: translateX(-50%);
    padding: 8px 16px; background: rgba(255, 255, 255, 0.9); border: 1px solid var(--luxe-button-text, #222);
    border-radius: var(--luxe-radius-small); cursor: pointer; font-size: 14px; font-weight: 600; z-index: 10;
    display: inline-flex; align-items: center; gap: 8px;
    /* Keep the label on one line on narrow phones (375px iPhone SE).
     * Absolute-positioned flex elements blockify to display: flex under UA
     * defaults, so labels can wrap without an explicit nowrap. */
    white-space: nowrap;
    max-width: calc(100% - 32px);
}

/* =========================================================================
 * Full View Layout - Modal
 * ========================================================================= */
/* Native <dialog> — opened via showModal(), top-layer, focus-trap & Escape built-in */
dialog.luxe-gallery-full-view {
    width: 100%; max-width: 100%; height: 100%; max-height: 100%;
    margin: 0; border: none; padding: 0;
    background: var(--luxe-surface, #fff); overflow-y: auto;
    box-sizing: border-box;
    opacity: 0;
    transition: opacity 0.3s ease,
                display 0.3s ease allow-discrete, overlay 0.3s ease allow-discrete;
}
dialog.luxe-gallery-full-view[open] { opacity: 1; }
@starting-style { dialog.luxe-gallery-full-view[open] { opacity: 0; } }
dialog.luxe-gallery-full-view::backdrop { background: rgba(0, 0, 0, 0.5); }

.luxe-gallery-full-view .luxe-gallery-categories-wrapper { margin: 0 auto; padding: 16px 40px 40px; }

/* Category Navigation — header bar with integrated back button */
.luxe-gallery-category-nav {
    background: var(--luxe-surface, #fff); border-bottom: 1px solid var(--luxe-border, #ddd);
    display: flex; align-items: center; gap: 0;
    padding: 8px 0;
}

.back-to-grid-view {
    flex-shrink: 0;
    background: var(--luxe-surface-alt, #f0f0f1); border: 1px solid var(--luxe-border, #ddd); border-radius: 50%;
    width: 40px; height: 40px; cursor: pointer;
    display: flex; align-items: center; justify-content: center; padding: 0;
    margin: 0 8px 0 16px;
}
.back-to-grid-view:focus-visible {
    outline: 3px solid var(--luxe-accent, #8b6914); outline-offset: 2px;
}
.back-to-grid-view svg { color: var(--luxe-text-primary, #222); }

.luxe-gallery-category-nav ul {
    list-style: none; padding: 0 16px 0 0; margin: 0;
    display: flex; gap: 10px; overflow-x: auto; white-space: nowrap;
    -ms-overflow-style: none; scrollbar-width: none;
    flex: 1; min-width: 0;
}
.luxe-gallery-category-nav ul::-webkit-scrollbar { display: none; }

.luxe-gallery-category-nav a {
    text-decoration: none; color: var(--luxe-text-secondary, #595959); padding: 8px;
    display: flex; flex-direction: column; align-items: center; gap: 12px;
    border-bottom: 2px solid transparent; border-radius: var(--luxe-radius-small); min-width: 110px;
    transition: color 0.3s ease, border-bottom-color 0.3s ease, transform 0.3s ease;
}
.luxe-gallery-category-nav a:hover { color: var(--luxe-text-primary, #222); transform: translateY(-2px); }
.luxe-gallery-category-nav a.active { color: var(--luxe-text-primary, #222); border-bottom-color: var(--luxe-text-primary, #222); background-color: transparent; }
.luxe-gallery-category-nav a:focus:not(:focus-visible) { outline: none; box-shadow: none; }
.luxe-gallery-category-nav img { width: clamp(80px, 25vw, 175px); height: clamp(80px, 25vw, 175px); border-radius: var(--luxe-radius-small); object-fit: cover; }
.luxe-gallery-category-nav span { font-weight: 600; font-size: 16px; }

/* Category Sections */
.luxe-gallery-category-section { padding-top: 32px; }
.luxe-gallery-category-section:first-of-type { padding-top: 8px; }
.luxe-gallery-category-section h2, .luxe-gallery-category-section h3,
.luxe-gallery-category-section h4, .luxe-gallery-category-section h5,
.luxe-gallery-category-section h6 { font-size: 24px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 24px; }
.luxe-gallery-category-section .image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
.luxe-gallery-category-section .grid-image-item { display: block; width: 100%; aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--luxe-radius-small); text-decoration: none; cursor: pointer; }
.luxe-gallery-category-section .grid-image-item:hover img { transform: scale(1.05); }
.luxe-gallery-category-section .grid-image-item img { transition: transform 0.3s ease; }
.luxe-gallery-category-section .grid-image-item .luxe-gallery-image-wrapper { width: 100%; height: 100%; }
.luxe-gallery-category-section .grid-image-item picture { display: block; width: 100%; height: 100%; }
.luxe-gallery-category-section .grid-image-item img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* =========================================================================
 * Additional Layouts
 * ========================================================================= */
.luxe-gallery-columns-1 .luxe-gallery-hero-grid { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.luxe-gallery-columns-2 .luxe-gallery-hero-grid { grid-template-columns: repeat(2, 1fr); grid-template-rows: auto; }
.luxe-gallery-columns-3 .luxe-gallery-hero-grid { grid-template-columns: repeat(3, 1fr); grid-template-rows: auto; }
.luxe-gallery-columns-5 .luxe-gallery-hero-grid { grid-template-columns: repeat(5, 1fr); grid-template-rows: auto; }
.luxe-gallery-columns-6 .luxe-gallery-hero-grid { grid-template-columns: repeat(6, 1fr); grid-template-rows: auto; }

/* Reset grid positions for custom columns */
.luxe-gallery-columns-1 .area-1, .luxe-gallery-columns-1 .area-2, .luxe-gallery-columns-1 .area-3, .luxe-gallery-columns-1 .area-4, .luxe-gallery-columns-1 .area-5,
.luxe-gallery-columns-2 .area-1, .luxe-gallery-columns-2 .area-2, .luxe-gallery-columns-2 .area-3, .luxe-gallery-columns-2 .area-4, .luxe-gallery-columns-2 .area-5,
.luxe-gallery-columns-3 .area-1, .luxe-gallery-columns-3 .area-2, .luxe-gallery-columns-3 .area-3, .luxe-gallery-columns-3 .area-4, .luxe-gallery-columns-3 .area-5,
.luxe-gallery-columns-5 .area-1, .luxe-gallery-columns-5 .area-2, .luxe-gallery-columns-5 .area-3, .luxe-gallery-columns-5 .area-4, .luxe-gallery-columns-5 .area-5,
.luxe-gallery-columns-6 .area-1, .luxe-gallery-columns-6 .area-2, .luxe-gallery-columns-6 .area-3, .luxe-gallery-columns-6 .area-4, .luxe-gallery-columns-6 .area-5 {
    grid-column: auto; grid-row: auto;
}

/* Gallery Item */
.luxe-gallery-item {
    position: relative; overflow: hidden; border-radius: var(--luxe-radius-small);
    background: var(--luxe-skeleton-bg, #e5e7eb); transition: var(--luxe-transition); cursor: pointer;
}
.luxe-gallery-item:hover { transform: translateY(-2px); box-shadow: var(--luxe-shadow-hover); }
.luxe-gallery-item img { width: 100%; height: 100%; object-fit: cover; transition: var(--luxe-transition); }
.luxe-gallery-item:hover img { transform: scale(1.05); }

/* Captions */
.luxe-gallery-caption {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 1rem;
    color: var(--luxe-caption-color); background: var(--luxe-caption-bg);
    transform: translateY(100%); transition: transform 0.3s ease; font-size: 0.875rem; line-height: 1.4;
}
.luxe-gallery-item:hover .luxe-gallery-caption, .hero-image-item:hover .luxe-gallery-caption { transform: translateY(0); }

/* Masonry Layout */
.luxe-gallery-masonry { column-gap: var(--luxe-gap); }
.luxe-gallery-masonry .luxe-gallery-item { break-inside: avoid; margin-bottom: var(--luxe-gap); aspect-ratio: auto; }

/* Justified Layout */
.luxe-gallery-justified { display: flex; flex-wrap: wrap; gap: var(--luxe-gap); }
.luxe-gallery-justified .luxe-gallery-item { flex: 1 1 auto; height: 200px; min-width: 150px; aspect-ratio: auto; }

/* =========================================================================
 * Loading States & Progressive Image Loading
 * ========================================================================= */
.luxe-gallery-skeleton { position: relative; overflow: hidden; background: var(--luxe-skeleton-bg); }
.luxe-gallery-skeleton::after {
    content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent 30%, var(--luxe-skeleton-shine) 50%, transparent 70%);
    opacity: 0.5;
    animation: luxe-skeleton-shimmer 2.5s ease-in-out infinite; will-change: transform;
}
@keyframes luxe-skeleton-shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* Progressive image loading (blur-up LQIP) */
.luxe-gallery-image-wrapper { position: relative; overflow: hidden; }
.luxe-gallery-image-wrapper .luxe-lqip {
    position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
    filter: blur(20px); transform: scale(1.1);
    transition: opacity 0.4s ease;
    z-index: 1; pointer-events: none;
}
.luxe-gallery-image-wrapper .luxe-lqip.luxe-lqip-hidden { opacity: 0; }
.luxe-gallery-image-wrapper .luxe-gallery-image {
    transition: opacity 0.4s ease;
}
.luxe-gallery-image-wrapper .luxe-gallery-image.luxe-img-loading { opacity: 0; }
.luxe-gallery-image-wrapper .luxe-gallery-image.luxe-img-loaded { opacity: 1; }


/* Error boundary for failed images */
.luxe-gallery-image-wrapper.luxe-img-error {
    background: var(--luxe-skeleton-bg, #e5e7eb);
    display: flex; align-items: center; justify-content: center;
}
.luxe-gallery-image-wrapper.luxe-img-error picture { display: none; }
.luxe-gallery-image-wrapper.luxe-img-error .luxe-lqip { display: none; }
.luxe-gallery-image-error-notice {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 8px; color: var(--luxe-text-muted, #6b7280); font-size: 13px; text-align: center; padding: 16px;
}
.luxe-gallery-image-error-notice svg { opacity: 0.4; }

.luxe-gallery-loading { position: relative; min-height: 400px; }
.luxe-gallery-loading::after {
    content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 40px; height: 40px; border: 3px solid var(--luxe-skeleton-bg);
    border-top-color: var(--luxe-accent); border-radius: 50%; animation: luxe-spin 1.2s linear infinite; opacity: 0.6;
}
@keyframes luxe-spin { to { transform: translate(-50%, -50%) rotate(360deg); } }

/* Zoom trigger icon */
.luxe-gallery-zoom {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    width: 48px; height: 48px; background: rgba(255,255,255,0.9); border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    opacity: 0; transition: opacity 0.3s ease; pointer-events: none; z-index: 10;
}
.luxe-gallery-item:hover .luxe-gallery-zoom, .hero-image-item:hover .luxe-gallery-zoom { opacity: 1; }
.luxe-gallery-zoom svg { width: 24px; height: 24px; fill: var(--luxe-text-primary, #222); }

/* =========================================================================
 * Custom Lightbox (replaces PhotoSwipe ~7KB CSS)
 * ========================================================================= */
.luxe-lightbox {
    position: fixed; top: 0; right: 0; bottom: 0; left: 0; z-index: 99999;
    display: flex; flex-direction: column; color: #fff;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
.luxe-lightbox.is-open { opacity: 1; visibility: visible; }

.luxe-lb-backdrop { position: absolute; top: 0; right: 0; bottom: 0; left: 0; background: var(--luxe-backdrop-bg, rgba(0, 0, 0, 0.92)); }

.luxe-lb-topbar {
    position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center;
    padding: 16px 20px; color: #fff;
}
.luxe-lb-counter { font-size: 14px; font-weight: 500; text-shadow: 0 1px 3px rgba(0,0,0,0.5); }
.luxe-lb-actions { display: flex; gap: 8px; }

.luxe-lb-btn {
    background: none; border: none; color: #fff; cursor: pointer;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.3s ease, transform 0.3s ease;
}
.luxe-lb-btn:hover { background: rgba(255, 255, 255, 0.15); }
.luxe-lb-btn:active { background: rgba(255, 255, 255, 0.25); transform: scale(0.92); }
.luxe-lb-close { font-size: 32px; line-height: 1; }

.luxe-lb-content {
    position: relative; z-index: 1; flex: 1; display: flex; align-items: center;
    justify-content: center; padding: 0 80px; min-height: 0;
}

.luxe-lb-image-wrap {
    display: flex; align-items: center; justify-content: center;
    width: 100%; height: 100%; overflow: hidden;
    -webkit-user-select: none; user-select: none;
}

.luxe-lb-image {
    max-width: 100%; max-height: calc(100vh - 100px); object-fit: contain;
    transition: opacity 0.3s ease, transform 0.3s ease;
}
.luxe-lightbox.is-open .luxe-lb-image { will-change: transform; }

.luxe-lb-arrow {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
    width: 56px; height: 56px; border-radius: 50%;
    background: rgba(0, 0, 0, 0.35); border: none; color: #fff;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.3s ease, opacity 0.3s ease; opacity: 0.9;
}
.luxe-lb-arrow:hover { background: rgba(0, 0, 0, 0.55); opacity: 1; }
.luxe-lb-arrow:active { background: rgba(0, 0, 0, 0.7); }
.luxe-lb-arrow:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.luxe-lb-arrow:disabled { visibility: hidden; pointer-events: none; }
.luxe-lb-prev { left: 16px; }
.luxe-lb-next { right: 16px; }

.luxe-lb-arrow svg { filter: drop-shadow(0 1px 2px rgba(0,0,0,0.3)); }

/* Lightbox caption */
.luxe-lb-caption {
    position: relative; z-index: 2; text-align: center;
    color: rgba(255, 255, 255, 0.85); font-size: 14px;
    padding: 8px 20px 16px; margin: 0;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Lightbox loading spinner */
.luxe-lb-image-wrap[data-loading]::after {
    content: ''; position: absolute; width: 32px; height: 32px;
    border: 3px solid rgba(255, 255, 255, 0.2);
    border-top-color: #fff; border-radius: 50%;
    animation: luxe-spin 0.8s linear infinite;
}

/* Share Notification */
.luxe-gallery-share-notification {
    position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.85); color: #fff; padding: 12px 24px;
    border-radius: var(--luxe-radius-small, 8px); font-size: 14px; z-index: 100000;
    font-family: inherit;
    animation: luxe-notif-in 0.3s ease;
}
.luxe-gallery-share-notification.fade-out { animation: luxe-notif-out 0.3s ease forwards; }
@keyframes luxe-notif-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes luxe-notif-out { from { opacity: 1; transform: translateX(-50%) translateY(0); } to { opacity: 0; transform: translateX(-50%) translateY(10px); } }

/* =========================================================================
 * Alignment Support
 * ========================================================================= */
.alignwide .luxe-gallery-container { max-width: 1200px; margin-inline: auto; }
.alignfull .luxe-gallery-container { max-width: 100%; }

/* =========================================================================
 * Non-hero-grid layouts (grid / masonry) — show categories inline
 * ========================================================================= */
.luxe-gallery-layout-grid .luxe-gallery-hero-grid,
.luxe-gallery-layout-masonry .luxe-gallery-hero-grid,
.luxe-gallery-layout-grid .luxe-gallery-mobile-slider,
.luxe-gallery-layout-masonry .luxe-gallery-mobile-slider { display: none !important; }

.luxe-gallery-layout-grid .luxe-gallery-feature-buttons,
.luxe-gallery-layout-masonry .luxe-gallery-feature-buttons { margin-top: 0; margin-bottom: 16px; padding: 0; }

/* Grid/masonry layouts render the dialog inline-open — but only when the
   container actually has a visible preview. With hero="no" the dialog must
   stay a true modal regardless of layout, so we scope these overrides out. */
.luxe-gallery-layout-grid:not(.luxe-gallery-hero-hidden) dialog.luxe-gallery-full-view,
.luxe-gallery-layout-masonry:not(.luxe-gallery-hero-hidden) dialog.luxe-gallery-full-view {
    display: block; position: static; opacity: 1; transform: none;
    width: auto; max-width: none; height: auto; max-height: none;
    overflow: visible; padding: 0; margin: 0; border: none;
    background: transparent; transition: none;
}
.luxe-gallery-layout-grid:not(.luxe-gallery-hero-hidden) dialog.luxe-gallery-full-view::backdrop,
.luxe-gallery-layout-masonry:not(.luxe-gallery-hero-hidden) dialog.luxe-gallery-full-view::backdrop { display: none; }

.luxe-gallery-layout-grid:not(.luxe-gallery-hero-hidden) .back-to-grid-view,
.luxe-gallery-layout-masonry:not(.luxe-gallery-hero-hidden) .back-to-grid-view { display: none; }

.luxe-gallery-layout-masonry .image-grid {
    column-count: var(--luxe-columns, 4); column-gap: var(--luxe-gap, 8px);
}
.luxe-gallery-layout-masonry .image-grid .grid-image-item {
    break-inside: avoid; margin-bottom: var(--luxe-gap, 8px); display: block;
}

/* =========================================================================
 * Responsive (mobile-first: base styles are mobile, scale up with min-width)
 * ========================================================================= */

/* --- Base (mobile) defaults --- */
.luxe-gallery-hero-grid { display: none; }
.luxe-gallery-mobile-slider { display: block; }
.luxe-gallery-masonry { column-count: 1; }
.luxe-gallery-full-view .luxe-gallery-categories-wrapper { padding: 16px 12px 24px; }
.luxe-gallery-category-nav ul { padding-left: 56px; gap: 6px; }
.luxe-gallery-category-nav img { width: clamp(60px, 20vw, 100px); height: clamp(60px, 20vw, 100px); }
.luxe-gallery-category-nav span { font-size: 13px; }
.luxe-gallery-category-section .image-grid { grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 8px; }
.luxe-lb-content { padding: 0 8px; }
.luxe-lb-arrow {
    width: 48px; height: 48px; background: rgba(255,255,255,0.2);
    top: auto; bottom: 16px; transform: none;
}
.luxe-lb-image { max-height: calc(100vh - 160px); max-height: calc(100dvh - 160px); }
.luxe-gallery-caption { transform: translateY(0); }
.luxe-floor-plan-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.luxe-gallery-justified .luxe-gallery-item { width: 100%; height: 250px; }

/* Custom column layouts: single column on mobile */
.luxe-gallery-columns-6 .luxe-gallery-hero-grid,
.luxe-gallery-columns-5 .luxe-gallery-hero-grid,
.luxe-gallery-columns-4 .luxe-gallery-hero-grid,
.luxe-gallery-columns-3 .luxe-gallery-hero-grid,
.luxe-gallery-columns-2 .luxe-gallery-hero-grid {
    display: grid; grid-template-columns: 1fr; height: auto; min-height: auto;
}

/* Landscape phone */
@media (orientation: landscape) and (max-height: 500px) {
    .luxe-slider { height: 70vh; height: 70dvh; }
    .luxe-lb-image { max-height: calc(100vh - 100px); max-height: calc(100dvh - 100px); }
}

/* --- 481px+: restore justified layout --- */
@media (min-width: 481px) {
    .luxe-gallery-justified .luxe-gallery-item { width: auto; height: 200px; }
}

/* --- 769px+: desktop layout --- */
@media (min-width: 769px) {
    .luxe-gallery-hero-grid { display: grid; }
    .luxe-gallery-mobile-slider { display: none; }
    .luxe-gallery-masonry { column-count: 3; }
    .luxe-gallery-full-view .luxe-gallery-categories-wrapper { padding: 16px 40px 40px; }
    .luxe-gallery-category-nav ul { gap: 10px; }
    .luxe-gallery-category-nav img { width: clamp(80px, 25vw, 175px); height: clamp(80px, 25vw, 175px); }
    .luxe-gallery-category-nav span { font-size: 16px; }
    .luxe-gallery-category-section .image-grid { grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 16px; }
    .luxe-lb-content { padding: 0 80px; }
    .luxe-lb-arrow {
        width: 56px; height: 56px; background: rgba(0, 0, 0, 0.35);
        top: 50%; bottom: auto; transform: translateY(-50%);
    }
    .luxe-lb-image { max-height: calc(100vh - 100px); }
    .luxe-gallery-caption { transform: translateY(100%); }
    .luxe-floor-plan-wrapper { overflow-x: visible; }

    /* Custom column layouts: restore multi-column on desktop */
    .luxe-gallery-columns-6 .luxe-gallery-hero-grid { grid-template-columns: repeat(6, 1fr); }
    .luxe-gallery-columns-5 .luxe-gallery-hero-grid { grid-template-columns: repeat(5, 1fr); }
    .luxe-gallery-columns-4 .luxe-gallery-hero-grid { grid-template-columns: repeat(4, 1fr); }
    .luxe-gallery-columns-3 .luxe-gallery-hero-grid { grid-template-columns: repeat(3, 1fr); }
    .luxe-gallery-columns-2 .luxe-gallery-hero-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1128px) {
    .luxe-gallery-full-view .luxe-gallery-categories-wrapper { padding-left: 120px; padding-right: 120px; }
}

/* =========================================================================
 * Before/After Comparison Overlay
 * ========================================================================= */
.luxe-compare-overlay {
    position: fixed; inset: 0; z-index: 99999;
    display: flex; align-items: center; justify-content: center; color: #fff;
    opacity: 0; visibility: hidden; transition: opacity 0.3s ease, visibility 0.3s ease;
}
.luxe-compare-overlay.is-open { opacity: 1; visibility: visible; }
.luxe-compare-backdrop { position: absolute; inset: 0; background: var(--luxe-backdrop-bg, rgba(0, 0, 0, 0.92)); }
.luxe-compare-close {
    position: absolute; top: 16px; right: 16px; z-index: 2;
    background: none; border: none; color: #fff; font-size: 32px; cursor: pointer;
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    border-radius: 50%; transition: background 0.3s ease;
}
.luxe-compare-close:hover { background: rgba(255, 255, 255, 0.15); }
.luxe-compare-container {
    position: relative; z-index: 1; width: 90vw; max-width: 1100px;
    max-height: 80vh; display: flex; align-items: center; justify-content: center;
}
.luxe-compare-wrapper {
    position: relative; display: inline-block; max-width: 100%; overflow: hidden;
    border-radius: var(--luxe-radius-small, 8px); -webkit-user-select: none; user-select: none;
    cursor: col-resize; line-height: 0;
}
.luxe-compare-after { display: block; max-width: 100%; max-height: 80vh; object-fit: contain; }
.luxe-compare-before-clip {
    position: absolute; inset: 0; width: 50%; overflow: hidden;
}
.luxe-compare-before {
    display: block; height: 100%; width: auto; min-width: 100%;
    object-fit: cover; object-position: left center;
}
.luxe-compare-handle {
    position: absolute; top: 0; bottom: 0; left: 50%; width: 4px; transform: translateX(-50%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    cursor: col-resize; z-index: 2; outline: none;
}
.luxe-compare-handle-line { flex: 1; width: 3px; background: #fff; box-shadow: 0 0 4px rgba(0,0,0,0.5); }
.luxe-compare-handle-circle {
    width: 48px; height: 48px; border-radius: 50%; background: #fff;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3); flex-shrink: 0; color: var(--luxe-text-primary, #222);
    transition: transform 0.3s ease;
}
.luxe-compare-handle:active .luxe-compare-handle-circle { transform: scale(0.92); }
.luxe-compare-label {
    position: absolute; top: 12px; padding: 4px 12px; border-radius: var(--luxe-radius-small, 8px);
    background: rgba(0, 0, 0, 0.6); color: #fff; font-size: 13px; font-weight: 600;
    pointer-events: none; line-height: 1.4;
}
.luxe-compare-label-before { left: 12px; }
.luxe-compare-label-after { right: 12px; }

/* =========================================================================
 * Gallery Archive (Property Cards)
 * ========================================================================= */
.luxe-gallery-archive { max-width: 1280px; margin: 0 auto; }
.luxe-gallery-archive-grid {
    display: grid;
    grid-template-columns: repeat(var(--luxe-archive-columns, 3), 1fr);
    gap: var(--luxe-archive-gap, 24px);
}

.luxe-gallery-archive-card {
    border-radius: var(--luxe-radius, 12px); overflow: hidden;
    transition: var(--luxe-transition);
}
.luxe-gallery-archive-card:hover { transform: translateY(-4px); box-shadow: var(--luxe-shadow-hover); }

.luxe-gallery-archive-card-link { text-decoration: none; color: inherit; display: block; }

.luxe-gallery-archive-cover {
    position: relative; aspect-ratio: 4 / 3; overflow: hidden;
    background: var(--luxe-skeleton-bg, #e5e7eb); border-radius: var(--luxe-radius, 12px);
}
.luxe-gallery-archive-cover picture { display: block; width: 100%; height: 100%; }
.luxe-gallery-archive-cover img {
    width: 100%; height: 100%; object-fit: cover; display: block;
    transition: transform 0.3s ease;
}
.luxe-gallery-archive-card:hover .luxe-gallery-archive-cover img { transform: scale(1.05); }

.luxe-gallery-archive-no-image {
    width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
    color: var(--luxe-text-faint, #9ca3af);
}

.luxe-gallery-archive-count {
    position: absolute; bottom: 10px; right: 10px;
    background: rgba(0, 0, 0, 0.7); color: #fff;
    padding: 4px 10px; border-radius: var(--luxe-radius-small, 8px); font-size: 13px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 5px;
}

.luxe-gallery-archive-video-badge {
    position: absolute; bottom: 10px; left: 10px;
    background: rgba(0, 0, 0, 0.7); color: #fff;
    padding: 4px 8px; border-radius: var(--luxe-radius-small, 8px); font-size: 12px; font-weight: 600;
    display: inline-flex; align-items: center; gap: 4px;
}

.luxe-gallery-archive-thumbs {
    display: flex; gap: 4px; margin-top: 8px; align-items: center;
}
.luxe-gallery-archive-thumb {
    width: 60px; height: 44px; object-fit: cover;
    border-radius: var(--luxe-radius-small, 8px); flex-shrink: 0;
}
.luxe-gallery-archive-more {
    font-size: 12px; color: var(--luxe-text-muted, #6b7280); font-weight: 600;
    padding: 0 6px; white-space: nowrap;
}

.luxe-gallery-archive-info { padding: 12px 4px 8px; }
.luxe-gallery-archive-title {
    font-size: 16px; font-weight: 600; margin: 0 0 4px; line-height: 1.3;
    color: var(--luxe-text-primary, #222); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.luxe-gallery-archive-desc {
    font-size: 14px; color: var(--luxe-text-muted, #6b7280); margin: 0 0 4px; line-height: 1.4;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.luxe-gallery-archive-meta { font-size: 13px; color: var(--luxe-text-faint, #9ca3af); }

/* Archive grid: mobile-first (1 col base, scale up) */
.luxe-gallery-archive-grid { grid-template-columns: 1fr; }
@media (min-width: 481px) {
    .luxe-gallery-archive-grid { grid-template-columns: repeat(2, 1fr); gap: 16px; }
}
@media (min-width: 769px) {
    .luxe-gallery-archive-grid { grid-template-columns: repeat(var(--luxe-archive-columns, 3), 1fr); gap: var(--luxe-archive-gap, 24px); }
}

/* =========================================================================
 * Interactive Floor Plan
 * ========================================================================= */
.luxe-floor-plan-interactive { position: relative; margin-top: 30px; padding: 0 40px; text-align: center; }
.luxe-floor-plan-interactive h3 { margin-bottom: 12px; text-align: left; }
.luxe-floor-plan-wrapper { position: relative; display: inline-block; max-width: min(600px, 100%); }
.luxe-floor-plan-wrapper > img { width: 100%; height: auto; max-height: 60vh; object-fit: contain; border-radius: var(--luxe-radius-small); border: 1px solid var(--luxe-border, #ddd); }
.luxe-floor-plan-hotspot {
    position: absolute; transform: translate(-50%, -50%);
    width: 44px; height: 44px; border-radius: 50%;
    background: var(--luxe-accent, #8b6914); color: #fff;
    border: 2px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 700; transition: transform 0.3s ease;
    /* Pulsing animation to signal interactivity */
    animation: luxe-hotspot-pulse 2s ease-in-out infinite;
}
@keyframes luxe-hotspot-pulse {
    0%, 100% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 0 rgba(139, 105, 20, 0.4); }
    50% { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3), 0 0 0 8px rgba(139, 105, 20, 0); }
}
.luxe-floor-plan-hotspot:hover { transform: translate(-50%, -50%) scale(1.15); }
.luxe-floor-plan-hotspot:active { transform: translate(-50%, -50%) scale(0.95); }
.luxe-floor-plan-hotspot:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* =========================================================================
 * Empty state — shown when gallery has 0 images
 * ========================================================================= */
.luxe-gallery-empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: var(--luxe-space-2xl) var(--luxe-space-md);
    min-height: 200px; text-align: center;
    color: var(--luxe-text-muted, #6b7280);
    border: 2px dashed var(--luxe-border, #ddd);
    border-radius: var(--luxe-radius, 12px);
}
.luxe-gallery-empty-state svg { opacity: 0.4; margin-bottom: var(--luxe-space-md); }
.luxe-gallery-empty-state p { margin: 0; font-size: 15px; line-height: 1.5; }

/* Archive card — active press state for tactile feedback */
.luxe-gallery-archive-card:active { transform: translateY(0) scale(0.98); }

/* Lightbox swipe hint on mobile (first open) */
.luxe-lb-swipe-hint {
    position: absolute; bottom: 80px; left: 50%; transform: translateX(-50%);
    color: rgba(255,255,255,0.6); font-size: 13px; text-align: center;
    animation: luxe-swipe-hint 2s ease-in-out forwards;
    pointer-events: none; z-index: 5;
    display: flex; align-items: center; gap: 8px;
}
@keyframes luxe-swipe-hint {
    0% { opacity: 0; transform: translateX(-50%) translateY(0); }
    20% { opacity: 1; }
    80% { opacity: 1; }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

/* =========================================================================
 * Print
 * ========================================================================= */
@media print {
    .luxe-gallery-category-nav, .luxe-gallery-zoom, .show-all-photos,
    .show-all-photos-mobile, .back-to-grid-view, .luxe-lightbox { display: none; }
    .luxe-gallery-item, .hero-image-item, .luxe-gallery-archive-card { break-inside: avoid; page-break-inside: avoid; }
}

/* =========================================================================
 * Accessibility
 * ========================================================================= */
.luxe-gallery-item:focus-within, .hero-image-item:focus-within { outline: 3px solid var(--luxe-accent, #8b6914); outline-offset: 3px; }

/* WCAG 2.4.7 / 1.4.11 — 3px ring + white shadow layer so focus stays visible
 * on both light and dark image surfaces (≥3:1 contrast against surroundings). */
.grid-image-item:focus-visible,
.hero-image-item a:focus-visible,
.show-all-photos:focus-visible,
.show-all-photos-mobile:focus-visible,
.back-to-grid-view:focus-visible,
.luxe-gallery-category-nav a:focus-visible,
.luxe-gallery-virtual-tour-btn:focus-visible,
.luxe-gallery-compare-btn:focus-visible,
.luxe-gallery-video-btn:focus-visible,
.luxe-gallery-floor-plan-btn:focus-visible,
.luxe-compare-handle:focus-visible,
.luxe-compare-close:focus-visible,
.luxe-slider-dot:focus-visible,
.luxe-lb-btn:focus-visible,
.luxe-lb-arrow:focus-visible,
.luxe-floor-plan-hotspot:focus-visible,
.luxe-keyboard-help-close:focus-visible,
.luxe-gallery-archive-card-link:focus-visible {
    outline: 3px solid var(--luxe-accent, #8b6914);
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.85);
}
.luxe-gallery-link:focus:not(:focus-visible), .hero-image-item a:focus:not(:focus-visible) { outline: none; }

/* Screen-reader-only utility (ships with the plugin in case the theme omits it). */
.luxe-gallery-root .screen-reader-text,
.luxe-gallery-root .luxe-sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}
.luxe-gallery-root .screen-reader-text:focus,
.luxe-gallery-root .luxe-sr-only:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* Keyboard shortcuts help overlay */
.luxe-keyboard-help-overlay {
    position: fixed; inset: 0; z-index: 100001;
    background: rgba(0, 0, 0, 0.6); display: flex; align-items: center; justify-content: center;
}
.luxe-keyboard-help {
    background: var(--luxe-surface, #fff); border-radius: var(--luxe-radius, 12px); padding: 24px 32px; max-width: 420px; width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); font-family: inherit;
}
.luxe-keyboard-help-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.luxe-keyboard-help-header h3 { margin: 0; font-size: 18px; font-weight: 600; }
.luxe-keyboard-help-close { background: none; border: none; font-size: 24px; cursor: pointer; color: var(--luxe-text-muted, #6b7280); padding: 4px 8px; line-height: 1; }
.luxe-keyboard-help-close:hover { color: var(--luxe-text-primary, #222); }
.luxe-keyboard-help-body dl { margin: 0; }
.luxe-keyboard-help-body dl > div { display: flex; align-items: center; padding: 8px 0; border-bottom: 1px solid #f0f0f0; }
.luxe-keyboard-help-body dl > div:last-child { border-bottom: none; }
.luxe-keyboard-help-body dt { min-width: 120px; display: flex; gap: 4px; flex-shrink: 0; }
.luxe-keyboard-help-body dd { margin: 0; color: var(--luxe-text-secondary, #595959); font-size: 14px; }
.luxe-keyboard-help-body kbd {
    background: #f3f4f6; border: 1px solid #d1d5db; border-radius: 4px;
    padding: 2px 8px; font-size: 12px; font-family: inherit; color: #374151;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

@media (prefers-color-scheme: dark) {
    .luxe-keyboard-help { background: #1a1a1a; color: #f0f0f0; }
    .luxe-keyboard-help-close { color: #999; }
    .luxe-keyboard-help-close:hover { color: #fff; }
    .luxe-keyboard-help-body dl > div { border-bottom-color: #333; }
    .luxe-keyboard-help-body dd { color: #aaa; }
    .luxe-keyboard-help-body kbd { background: #2a2a2a; border-color: #444; color: #ddd; }
}

@media (prefers-contrast: high) {
    .luxe-gallery-item, .hero-image-item { border: 2px solid currentColor; }
    .show-all-photos, .show-all-photos-mobile { border-width: 2px; }
}

@media (prefers-reduced-motion: reduce) {
    .luxe-gallery-item, .luxe-gallery-item img, .hero-image-item img,
    .luxe-gallery-caption, .luxe-gallery-zoom, .luxe-gallery-full-view,
    .luxe-lightbox, .luxe-lb-image, .luxe-compare-overlay,
    .luxe-slider-dot, .luxe-gallery-archive-card,
    .luxe-gallery-archive-cover img, .luxe-gallery-category-nav a,
    .luxe-lb-arrow, .luxe-lb-btn, .luxe-lqip,
    .luxe-gallery-image-wrapper .luxe-gallery-image { transition: none; }
    .luxe-gallery-loading-spinner,
    .luxe-gallery-skeleton::after,
    .luxe-gallery-loading::after,
    .luxe-lb-image-wrap[data-loading]::after,
    .luxe-gallery-share-notification,
    .luxe-gallery-share-notification.fade-out,
    .luxe-fav-toggle.luxe-fav-active,
    .luxe-floor-plan-hotspot,
    .luxe-lb-swipe-hint { animation: none; }
    /* Prevent hover transforms */
    .luxe-gallery-item:hover,
    .luxe-gallery-archive-card:hover,
    .luxe-gallery-category-nav a:hover { transform: none; }
    .luxe-gallery-item:hover img,
    .hero-image-item a:hover img,
    .luxe-gallery-archive-card:hover .luxe-gallery-archive-cover img,
    .luxe-gallery-category-section .grid-image-item:hover img { transform: none; }
}

/* =========================================================================
 * Dark Mode
 * ========================================================================= */
@media (prefers-color-scheme: dark) {
    /* Override design tokens for dark mode so all components adapt automatically */
    :root {
        --luxe-button-bg: #2a2a2a;
        --luxe-button-text: #f0f0f0;
        --luxe-surface: #1a1a1a;
        --luxe-surface-alt: #2a2a2a;
        --luxe-border: #444;
        --luxe-skeleton-bg: #2a2a2a;
        --luxe-skeleton-shine: #3a3a3a;
        --luxe-text-primary: #f0f0f0;
        --luxe-text-secondary: #d0d0d0;
        --luxe-text-muted: #a3a3a3;
        --luxe-text-faint: #666;
    }
    .luxe-gallery-full-view { background: var(--luxe-surface); color: var(--luxe-text-primary); }
    .luxe-gallery-category-nav { background: var(--luxe-surface); border-bottom-color: var(--luxe-border); }
    .luxe-gallery-category-nav a { color: var(--luxe-text-muted); }
    .luxe-gallery-category-nav a:hover, .luxe-gallery-category-nav a.active { color: #fff; border-bottom-color: #fff; }
    .back-to-grid-view { background: var(--luxe-surface-alt); border-color: var(--luxe-border); }
    .back-to-grid-view svg { color: var(--luxe-text-primary); }
    .luxe-gallery-item { background: var(--luxe-surface-alt); }
    .luxe-gallery-skeleton, .hero-image-item.is-loading, .grid-image-item.is-loading { background: var(--luxe-surface-alt); }
    .luxe-gallery-archive-title { color: var(--luxe-text-primary); }
    .luxe-gallery-archive-cover { background: var(--luxe-surface-alt); }
    .luxe-gallery-archive-no-image { color: #555; }
}
