/**
 * A2Z Grid Widget Styles (Bulletproof V2)
 * High-priority grid engine to force pixel-perfect layouts.
 */

/* Foundation: Enforce Grid & 16:9 cinematic Ratio */
.a2z-expert-grid-v2 {
    display: grid !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
    position: relative !important;
    box-sizing: border-box !important;
    gap: var(--a2z-gap-desktop) !important;
    border-radius: 0 !important;
    margin: 0 !important;
}

@media (max-width: 767px) {
    .a2z-expert-grid-v2 {
        gap: var(--a2z-gap-mobile) !important;
    }
}

/* Interior Slot Precision */
.a2z-v2-slot {
    position: relative !important;
    overflow: hidden !important;
    width: 100% !important;
    height: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
}

.a2z-v2-slot img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: inherit !important;
    transition: transform 0.5s ease !important;
}

/* Standardized hover behavior: shadow handled by parent class, no zoom */

/* ============================================
   LIGHTBOX STYLES (MATCHING PREMIUM LOOK)
   ============================================ */
.featured-work-lightbox.a2z-grid-lightbox {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(10, 10, 10, 0.95);
    z-index: 99999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    font-family: 'Inter', sans-serif;
}

.featured-work-lightbox.a2z-grid-lightbox.active {
    display: flex;
}

.lightbox-controls {
    position: absolute;
    top: 24px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 24px;
    z-index: 100000;
}

.lightbox-control {
    background: transparent;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}

.lightbox-control:hover {
    opacity: 0.8;
}

.lightbox-control svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    fill: none;
}

.lightbox-close svg {
    width: 32px;
    height: 32px;
}

.lightbox-controls-left,
.lightbox-controls-right {
    display: flex;
    gap: 16px;
}

.lightbox-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 24px;
    flex: 1;
    width: 100%;
    padding: 80px 24px 120px;
    position: relative;
}

.lightbox-image-container {
    max-width: 90vw;
    max-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.lightbox-image {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    transition: transform 0.3s ease;
}

.lightbox-image.zoomed {
    transform: scale(1.5);
    cursor: zoom-out;
}

.lightbox-nav {
    background: transparent;
    border: none;
    color: #FFFFFF;
    cursor: pointer;
    padding: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}

.lightbox-nav svg {
    width: 48px;
    height: 48px;
    fill: currentColor;
}

.lightbox-thumbnails {
    position: absolute;
    bottom: 24px;
    left: 0;
    right: 0;
    padding: 0 24px;
    z-index: 100000;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.lightbox-thumbnails-container {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 12px 0;
}

.lightbox-thumbnail {
    width: 80px;
    height: 80px;
    border: 2px solid transparent;
    border-radius: 4px;
    overflow: hidden;
    cursor: pointer;
    background: transparent;
    padding: 0;
    transition: border-color 0.3s ease, transform 0.3s ease;
    flex-shrink: 0;
}

.lightbox-thumbnail:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.lightbox-thumbnail.active {
    border-color: #FFFFFF;
    border-width: 3px;
}

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

@media (max-width: 767px) {
    .lightbox-main {
        padding: 60px 16px 100px;
        gap: 12px;
    }

    .lightbox-nav svg {
        width: 36px;
        height: 36px;
    }

    .lightbox-thumbnail {
        width: 64px;
        height: 64px;
    }
}

/* --- PATTERN: 1 IMAGE --- */
.a2z-expert-grid-v2.a2z-v2-count-1 {
    display: block !important;
}

/* --- PATTERN: 2 IMAGES --- */
.a2z-expert-grid-v2.a2z-v2-p2-split {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: 1fr !important;
}

.a2z-expert-grid-v2.a2z-v2-p2-stack {
    grid-template-columns: 1fr !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

/* --- PATTERN: 3 IMAGES --- */
.a2z-expert-grid-v2.a2z-v2-p3-feature-left {
    grid-template-columns: 1fr 2.15fr !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-left .a2z-v2-slot-1 {
    grid-row: span 2 !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-right {
    grid-template-columns: 2.15fr 1fr !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

/* 3 Images - Verticals */
.a2z-expert-grid-v2.a2z-v2-p3-verticals {
    grid-template-columns: repeat(3, 1fr) !important;
    grid-template-rows: 1fr !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-verticals .a2z-v2-slot {
    grid-column: span 1 !important;
    grid-row: span 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-right .a2z-v2-slot-1 {
    grid-row: 1 !important;
    grid-column: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-right .a2z-v2-slot-2 {
    grid-row: span 2 !important;
    grid-column: 2 !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-right .a2z-v2-slot-3 {
    grid-row: 2 !important;
    grid-column: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-top {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: 1.2fr 1fr !important;
}

.a2z-expert-grid-v2.a2z-v2-p3-feature-top .a2z-v2-slot-1 {
    grid-column: span 2 !important;
}

/* --- PATTERN: 4 IMAGES --- */
.a2z-expert-grid-v2.a2z-v2-p4-symmetric {
    grid-template-columns: 1.1fr 1fr 1.1fr !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-symmetric .a2z-v2-slot-1 {
    grid-row: span 2 !important;
    grid-column: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-symmetric .a2z-v2-slot-2 {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-symmetric .a2z-v2-slot-3 {
    grid-column: 2 !important;
    grid-row: 2 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-symmetric .a2z-v2-slot-4 {
    grid-row: span 2 !important;
    grid-column: 3 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

/* 4 Images - Balanced */
.a2z-expert-grid-v2.a2z-v2-p4-balanced {
    grid-template-columns: 1fr 1fr 1fr !important;
    grid-template-rows: repeat(2, 1fr) !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-balanced .a2z-v2-slot-1 {
    grid-row: span 2 !important;
    grid-column: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-balanced .a2z-v2-slot-2 {
    grid-column: 2 !important;
    grid-row: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-balanced .a2z-v2-slot-3 {
    grid-column: 3 !important;
    grid-row: 1 !important;
}

.a2z-expert-grid-v2.a2z-v2-p4-balanced .a2z-v2-slot-4 {
    grid-column: 2 / span 2 !important;
    grid-row: 2 !important;
}

/* --- Responsive Force --- */
@media (max-width: 767px) {
    .a2z-expert-grid-v2 {
        aspect-ratio: 1 / 1 !important;
        /* Square ratio on mobile to prevent vertical clipping */
    }
}