/* ========================================
   REFERENCIA GALÉRIA - GRID & KÁRTYÁK
   ======================================== */

.references-section {
    background: var(--color-primary-mid);
    padding: var(--space-3xl) 0;
}

.references-section .section-label {
    display: flex;
    justify-content: center;
    margin-bottom: var(--space-sm);
}

.references-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2xl);
    margin-top: var(--space-xl);
}

/* Referencia kártya */
.reference-card {
    background: rgba(20, 28, 42, 0.8);
    border-radius: var(--radius-xl);
    overflow: hidden;
    border: 1px solid var(--glass-border);
    transition: all var(--transition-slow);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.reference-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-accent);
    opacity: 0;
    transition: opacity 0.4s;
}

.reference-card:hover {
    transform: translateY(-8px);
    border-color: rgba(45, 122, 246, 0.4);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.reference-card:hover::before {
    opacity: 1;
}

/* Kép */
.reference-card__image {
    position: relative;
    width: 100%;
    height: 240px;
    overflow: hidden;
    cursor: pointer;
    background: rgba(10, 15, 25, 0.6);
}

.reference-card__image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.85) saturate(1.1);
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.reference-card__image:hover img {
    transform: scale(1.05);
    filter: brightness(0.95) saturate(1.2);
}

.reference-card__count {
    position: absolute;
    bottom: var(--space-md);
    right: var(--space-md);
    background: rgba(10, 15, 25, 0.95);
    backdrop-filter: blur(12px);
    color: white;
    padding: 8px 14px;
    border-radius: var(--radius-full);
    font-size: var(--fs-caption);
    font-weight: var(--fw-semibold);
    font-family: var(--font-heading);
    display: flex;
    align-items: center;
    gap: 6px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    letter-spacing: var(--ls-wide);
    z-index: 2;
}

.reference-card__count svg {
    width: 14px;
    height: 14px;
    opacity: 0.8;
}

/* Tartalom */
.reference-card__content {
    padding: var(--space-xl);
    background: rgba(20, 28, 42, 1);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.reference-card__title {
    font-family: var(--font-heading);
    font-size: var(--fs-lg);
    font-weight: var(--fw-semibold);
    color: var(--color-white);
    margin-bottom: var(--space-md);
    letter-spacing: var(--ls-tight);
    line-height: 1.4;
}

.reference-card__description {
    color: var(--color-mid-gray);
    line-height: 1.7;
    margin-bottom: var(--space-lg);
    font-size: var(--fs-body-sm);
}

/* Meta információk */
.reference-card__meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
    padding-top: var(--space-md);
    border-top: 1px solid var(--glass-border);
}

.reference-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: rgba(255, 255, 255, 0.5);
    font-size: var(--fs-caption);
    font-family: var(--font-heading);
    letter-spacing: var(--ls-wide);
}

.reference-meta-item svg {
    flex-shrink: 0;
    opacity: 0.5;
    width: 14px;
    height: 14px;
}

/* Gomb */
.reference-card .btn {
    width: 100%;
    justify-content: center;
    margin-top: auto;
}

/* ========================================
   EGYSZERŰ MODAL GALÉRIA
   ======================================== */

.ref-modal {
    display: none;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 2147483647 !important; /* Max z-index */
    background: transparent;
    transform: none !important;
}

.ref-modal-bg {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(5, 10, 20, 0.95) !important;
    cursor: pointer;
    backdrop-filter: blur(5px);
    z-index: 1;
}

.ref-modal-wrap {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;
    width: 100% !important;
    height: 100% !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 2;
}

.ref-modal-wrap img {
    max-width: 90%;
    max-height: 85%;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.8);
    pointer-events: auto;
    user-select: none;
}

#modalCaption {
    color: rgba(255, 255, 255, 0.9);
    margin-top: 20px;
    font-size: 1.1rem;
    font-weight: 500;
    font-family: var(--font-heading);
    letter-spacing: 0.5px;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    pointer-events: auto;
}

.ref-modal-close,
.ref-modal-prev,
.ref-modal-next {
    position: fixed;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: white;
    cursor: pointer;
    font-size: 1.8rem;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
    backdrop-filter: blur(10px);
    outline: none;
    user-select: none;
    pointer-events: auto;
}

.ref-modal-close:hover,
.ref-modal-prev:hover,
.ref-modal-next:hover {
    background: rgba(45, 122, 246, 0.8);
    border-color: rgba(45, 122, 246, 0.8);
    transform: scale(1.05);
}

.ref-modal-close {
    top: 30px;
    right: 30px;
    line-height: 1;
    font-size: 2.2rem;
}

.ref-modal-prev {
    left: 30px;
    top: 50%;
    transform: translateY(-50%);
    padding-right: 4px;
}

.ref-modal-next {
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    padding-left: 4px;
}

/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1024px) {
    .references-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: var(--space-xl);
    }
}

@media (max-width: 768px) {
    .references-section {
        padding: var(--space-2xl) 0;
    }
    
    .references-grid {
        grid-template-columns: 1fr;
        gap: var(--space-lg);
    }
    
    .reference-card__image {
        height: 220px;
    }
    
    .ref-modal-wrap img {
        max-width: 95vw;
        max-height: 70vh;
    }
    
    .ref-modal-close,
    .ref-modal-prev,
    .ref-modal-next {
        width: 44px;
        height: 44px;
        font-size: 1.4rem;
    }
    
    .ref-modal-close {
        top: 20px;
        right: 20px;
    }
    
    .ref-modal-prev {
        left: 15px;
    }
    
    .ref-modal-next {
        right: 15px;
    }
    
    #modalCaption {
        font-size: 1rem;
        margin-top: 15px;
        padding: 0 20px;
    }
}
