<!-- Modern Gallery & Image Arrangement Styles
     Enhanced layouts for image showcases with proper alignment and spacing -->

<style>
/* ============================================================================
   MODERN IMAGE GALLERY LAYOUTS
   ============================================================================ */

/* Masonry Gallery (3 columns) */
.gallery-masonry {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 40px 0;
}

.gallery-masonry-item {
    position: relative;
    overflow: hidden;
    aspect-ratio: 1 / 1;
    background: #1a1a1a;
    animation: fadeInUp 0.6s ease-out backwards;
}

.gallery-masonry-item:nth-child(1) { animation-delay: 0s; }
.gallery-masonry-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-masonry-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-masonry-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-masonry-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-masonry-item:nth-child(6) { animation-delay: 0.3s; }

.gallery-masonry-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1), filter 0.3s ease;
}

.gallery-masonry-item:hover img {
    transform: scale(1.1) rotate(0.5deg);
    filter: brightness(1.1);
}

/* Wide Gallery (2 columns with featured items) */
.gallery-featured {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 16px;
    margin: 40px 0;
}

.gallery-featured-main {
    grid-row: 1 / 3;
    aspect-ratio: 0.8 / 1;
    overflow: hidden;
    background: #1a1a1a;
    animation: fadeInUp 0.6s ease-out;
}

.gallery-featured-main img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center 20%;
    transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-featured-main:hover img {
    transform: scale(1.08);
}

.gallery-featured-side {
    aspect-ratio: 1 / 1;
    overflow: hidden;
    background: #1a1a1a;
    animation: fadeInUp 0.6s ease-out 0.1s both;
}

.gallery-featured-side:nth-child(2) {
    animation-delay: 0.1s;
}

.gallery-featured-side:nth-child(3) {
    animation-delay: 0.2s;
}

.gallery-featured-side img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-featured-side:hover img {
    transform: scale(1.08);
}

/* Hero Image with Overlay Text */
.gallery-hero-card {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    background: #0d0d0d;
    display: flex;
    align-items: flex-end;
    margin: 40px 0;
    animation: fadeInUp 0.6s ease-out;
}

.gallery-hero-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: var(--hero-image);
    background-size: cover;
    background-position: center 30%;
    z-index: 0;
    transition: transform 0.8s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-hero-card:hover::before {
    transform: scale(1.05);
}

.gallery-hero-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.2) 60%, transparent);
    z-index: 1;
}

.gallery-hero-content {
    position: relative;
    z-index: 2;
    padding: 40px;
    color: #fff;
}

.gallery-hero-content h3 {
    margin: 0 0 12px;
    font-size: 2rem;
    font-family: var(--serif);
}

.gallery-hero-content p {
    margin: 0;
    max-width: 600px;
    color: #e0e0e0;
}

/* Grid Gallery (Varied Sizes) */
.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
    margin: 40px 0;
}

.gallery-grid-item {
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 1 / 1;
    animation: fadeInUp 0.6s ease-out backwards;
}

.gallery-grid-item:nth-child(1) { grid-column: span 2; grid-row: span 2; animation-delay: 0s; }
.gallery-grid-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-grid-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-grid-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-grid-item:nth-child(5) { animation-delay: 0.25s; }
.gallery-grid-item:nth-child(6) { animation-delay: 0.3s; }
.gallery-grid-item:nth-child(7) { animation-delay: 0.35s; }

.gallery-grid-item:nth-child(1) {
    aspect-ratio: 1 / 1;
}

.gallery-grid-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-grid-item:hover img {
    transform: scale(1.1);
}

/* Carousel/Slider Gallery */
.gallery-carousel {
    position: relative;
    margin: 40px 0;
    overflow: hidden;
    background: #0d0d0d;
    border-radius: 4px;
}

.gallery-carousel-inner {
    display: flex;
    transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-carousel-item {
    flex: 0 0 100%;
    min-height: 400px;
    overflow: hidden;
}

.gallery-carousel-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-carousel-nav {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    pointer-events: none;
    z-index: 2;
}

.gallery-carousel-button {
    width: 40px;
    height: 40px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: auto;
    border-radius: 4px;
}

.gallery-carousel-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.6);
}

/* Horizontal Scroll Gallery */
.gallery-scroll {
    overflow-x: auto;
    overflow-y: hidden;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    margin: 40px 0;
    padding-bottom: 12px;
}

.gallery-scroll-inner {
    display: flex;
    gap: 12px;
}

.gallery-scroll-item {
    flex: 0 0 280px;
    aspect-ratio: 0.75 / 1;
    overflow: hidden;
    background: #1a1a1a;
    border-radius: 4px;
    animation: slideInLeft 0.6s ease-out backwards;
}

.gallery-scroll-item:nth-child(1) { animation-delay: 0s; }
.gallery-scroll-item:nth-child(2) { animation-delay: 0.1s; }
.gallery-scroll-item:nth-child(3) { animation-delay: 0.15s; }
.gallery-scroll-item:nth-child(4) { animation-delay: 0.2s; }
.gallery-scroll-item:nth-child(5) { animation-delay: 0.25s; }

.gallery-scroll-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-scroll-item:hover img {
    transform: scale(1.08);
}

/* Centered Image with Caption */
.gallery-centered-item {
    text-align: center;
    margin: 60px 0;
    animation: fadeInUp 0.6s ease-out;
}

.gallery-centered-image {
    max-width: 700px;
    margin: 0 auto 24px;
    overflow: hidden;
    aspect-ratio: 0.9 / 1;
    background: #1a1a1a;
}

.gallery-centered-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.gallery-centered-item:hover .gallery-centered-image img {
    transform: scale(1.05);
}

.gallery-centered-caption {
    color: #999;
    font-size: 0.95rem;
    max-width: 700px;
    margin: 0 auto;
}

/* Before/After Comparison */
.gallery-comparison {
    position: relative;
    max-width: 700px;
    margin: 40px auto;
    overflow: hidden;
    background: #1a1a1a;
    aspect-ratio: 1 / 1;
}

.gallery-comparison-after {
    position: absolute;
    inset: 0;
    overflow: hidden;
}

.gallery-comparison-slider {
    position: absolute;
    top: 0;
    left: 50%;
    width: 4px;
    height: 100%;
    background: rgba(255, 255, 255, 0.8);
    transform: translateX(-50%);
    cursor: ew-resize;
    z-index: 10;
}

.gallery-comparison-slider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: 4px;
}

/* ============================================================================
   RESPONSIVE IMAGE GALLERIES
   ============================================================================ */

@media (max-width: 1024px) {
    .gallery-masonry {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-featured {
        grid-template-columns: 1fr;
    }

    .gallery-featured-main {
        grid-row: 1;
    }

    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .gallery-grid-item:nth-child(1) {
        grid-column: span 1;
        grid-row: span 1;
    }

    .gallery-scroll-item {
        flex: 0 0 240px;
    }
}

@media (max-width: 768px) {
    .gallery-masonry {
        grid-template-columns: 1fr;
    }

    .gallery-hero-card {
        min-height: 400px;
    }

    .gallery-hero-content {
        padding: 30px;
    }

    .gallery-hero-content h3 {
        font-size: 1.5rem;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .gallery-grid-item:nth-child(1) {
        grid-column: span 1;
        grid-row: span 1;
    }

    .gallery-scroll-item {
        flex: 0 0 200px;
    }

    .gallery-centered-image {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .gallery-carousel-item {
        min-height: 280px;
    }

    .gallery-scroll-item {
        flex: 0 0 180px;
    }
}

/* ============================================================================
   LIGHTBOX/MODAL OVERLAY FOR IMAGES
   ============================================================================ */

.gallery-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 9999;
    animation: fadeInUp 0.3s ease-out;
}

.gallery-lightbox.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    animation: scaleIn 0.3s ease-out;
}

.gallery-lightbox-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.gallery-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 40px;
    height: 40px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    cursor: pointer;
    font-size: 1.5rem;
    display: grid;
    place-items: center;
    transition: all 0.2s ease;
}

.gallery-lightbox-close:hover {
    border-color: #fff;
    background: rgba(255, 255, 255, 0.1);
}
</style>

<!-- Improved Image Arrangement Utilities -->
<style>
/* Image alignment and positioning utilities */

.image-full-width {
    width: 100vw;
    position: relative;
    left: 50%;
    right: 50%;
    margin-left: -50vw;
    margin-right: -50vw;
}

.image-container-centered {
    max-width: 900px;
    margin: 40px auto;
    overflow: hidden;
    border-radius: 4px;
}

.image-with-caption {
    display: grid;
    gap: 12px;
    margin: 30px 0;
}

.image-with-caption figure {
    margin: 0;
    overflow: hidden;
}

.image-with-caption img {
    width: 100%;
    display: block;
    transition: transform 0.5s cubic-bezier(0.2, 0.6, 0.2, 1);
}

.image-with-caption:hover img {
    transform: scale(1.03);
}

.image-with-caption figcaption {
    color: #999;
    font-size: 0.9rem;
    padding: 12px 0;
    text-align: center;
}

/* Image aspect ratio containers */
.image-aspect-1-1 { aspect-ratio: 1 / 1; }
.image-aspect-16-9 { aspect-ratio: 16 / 9; }
.image-aspect-4-3 { aspect-ratio: 4 / 3; }
.image-aspect-9-16 { aspect-ratio: 9 / 16; }
.image-aspect-3-2 { aspect-ratio: 3 / 2; }
.image-aspect-2-3 { aspect-ratio: 2 / 3; }

.image-aspect-1-1,
.image-aspect-16-9,
.image-aspect-4-3,
.image-aspect-9-16,
.image-aspect-3-2,
.image-aspect-2-3 {
    overflow: hidden;
    background: #1a1a1a;
}

.image-aspect-1-1 img,
.image-aspect-16-9 img,
.image-aspect-4-3 img,
.image-aspect-9-16 img,
.image-aspect-3-2 img,
.image-aspect-2-3 img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Image filters and effects */
.image-filter-saturate {
    filter: saturate(1.2) contrast(1.1);
}

.image-filter-cool {
    filter: hue-rotate(10deg) saturate(0.95);
}

.image-filter-fade {
    opacity: 0.9;
    transition: opacity 0.3s ease;
}

.image-filter-fade:hover {
    opacity: 1;
}
</style>
