/* Immersive Scrollable Gallery Modal */

.gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9999;
    display: none;
    opacity: 0;
    transition: opacity var(--transition-slow, 0.5s ease);
}

.gallery-modal.active {
    display: flex;
    opacity: 1;
}

.gallery-modal.closing {
    opacity: 0;
}

/* Gallery Container */
.gallery-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Gallery Header */
.gallery-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.gallery-title {
    font-family: var(--font-family-display, 'Bebas Neue', sans-serif);
    font-size: 1.5rem;
    font-weight: var(--font-weight-bold, 700);
    letter-spacing: var(--letter-spacing-wide, 0.05em);
    color: var(--text-primary, #EAEAEA);
    margin: 0;
}

.gallery-close {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: var(--text-primary, #EAEAEA);
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal, 0.3s ease);
}

.gallery-close:hover {
    background: var(--accent-primary, #FFB347);
    border-color: var(--accent-primary, #FFB347);
    color: var(--background-primary, #121212);
    transform: scale(1.1);
}

/* Gallery Content - Scrollable */
.gallery-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 80px 2rem 120px;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
.gallery-content::-webkit-scrollbar {
    width: 8px;
}

.gallery-content::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.gallery-content::-webkit-scrollbar-thumb {
    background: var(--accent-primary, #FFB347);
    border-radius: 4px;
    transition: var(--transition-normal, 0.3s ease);
}

.gallery-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover, #FFA600);
}

/* Gallery Items */
.gallery-items {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.gallery-item {
    position: relative;
    border-radius: var(--border-radius-lg, 1rem);
    overflow: hidden;
    box-shadow: var(--shadow-xl, 0 15px 35px rgba(0, 0, 0, 0.6));
    transition: var(--transition-normal, 0.3s ease);
}

.gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(255, 179, 71, 0.2);
}

/* Image Items */
.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    background: var(--background-secondary, #1A1A1A);
}

/* Video Items */
.gallery-item video {
    width: 100%;
    height: auto;
    display: block;
    background: var(--background-secondary, #1A1A1A);
}
.video-poster {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  background: rgba(0,0,0,0.4);
  border-radius: 8px;
  transition: background 0.3s;
  text-align: center;
  padding: 10px;
}

.video-item:hover .video-overlay {
  background: rgba(0,0,0,0.6);
}

/* Iframe Items (3D Viewers) */
.gallery-item iframe {
    width: 100%;
    height: 60vh;
    min-height: 400px;
    border: none;
    background: var(--background-secondary, #1A1A1A);
}

/* Media Placeholder */
.gallery-placeholder {
    width: 100%;
    height: 400px;
    background: linear-gradient(135deg, var(--background-tertiary, #2E2E2E) 0%, var(--background-quaternary, #3A3A3A) 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-tertiary, #A8A8A8);
    border: 2px dashed var(--border-color, #3A3A3A);
    transition: var(--transition-normal, 0.3s ease);
}

.gallery-placeholder:hover {
    border-color: var(--accent-primary, #FFB347);
    color: var(--accent-primary, #FFB347);
}

.gallery-placeholder i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.gallery-placeholder p {
    font-family: var(--font-family-primary, 'Bebas Neue', sans-serif);
    font-size: 1.25rem;
    font-weight: var(--font-weight-normal, 400);
    letter-spacing: var(--letter-spacing-wide, 0.05em);
    margin: 0 0 0.5rem 0;
}

.gallery-placeholder small {
    font-size: 0.875rem;
    opacity: 0.6;
}

/* Gallery Navigation */
.gallery-navigation {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.8) 0%, transparent 100%);
}

.gallery-nav-controls {
    display: flex;
    align-items: center;
    gap: 2rem;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 1rem 2rem;
    border-radius: var(--border-radius-xl, 1.5rem);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.gallery-nav-btn {
    width: 60px;
    height: 60px;
    background: transparent;
    border: 2px solid var(--accent-primary, #FFB347);
    border-radius: 50%;
    color: var(--accent-primary, #FFB347);
    font-size: 1.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-normal, 0.3s ease);
    position: relative;
    overflow: hidden;
}

.gallery-nav-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--accent-primary, #FFB347);
    transition: var(--transition-normal, 0.3s ease);
    z-index: -1;
}

.gallery-nav-btn:hover::before {
    left: 0;
}

.gallery-nav-btn:hover {
    color: var(--background-primary, #121212);
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(255, 179, 71, 0.4);
}

.gallery-nav-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.gallery-nav-btn:disabled::before {
    left: -100%;
}

.gallery-nav-btn:disabled:hover {
    color: var(--accent-primary, #FFB347);
    transform: none;
    box-shadow: none;
}

/* Gallery Counter */
.gallery-counter {
    font-family: var(--font-family-primary, 'Bebas Neue', sans-serif);
    font-size: 1rem;
    font-weight: var(--font-weight-normal, 400);
    letter-spacing: var(--letter-spacing-wide, 0.05em);
    color: var(--text-primary, #EAEAEA);
    background: rgba(0, 0, 0, 0.6);
    padding: 0.5rem 1rem;
    border-radius: var(--border-radius-lg, 1rem);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Project Detail Media Thumbnails */
.media-item {
    cursor: pointer;
    transition: var(--transition-normal, 0.3s ease);
    position: relative;
    overflow: hidden;
}

.media-item::after {
    /* Remove emoji */
    /* content: '🔍'; */
    
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    
    width: 80px;
    height: 80px;
    border-radius: 50%;
    
    background: rgba(0, 0, 0, 0.8);
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke="%23f59e0b" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"/><line x1="21" y1="21" x2="16.65" y2="16.65"/></svg>');
    background-repeat: no-repeat;
    background-position: center;
    background-size: 40%;
    
    display: flex;
    align-items: center;
    justify-content: center;
    
    opacity: 0;
    transition: var(--transition-normal, 0.3s ease);
}


.media-item:hover::after {
    opacity: 1;
}

.media-item:hover {
    transform: scale(1.02);
}

/* Loading Animation */
.gallery-loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    color: var(--text-primary, #EAEAEA);
}

.gallery-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 179, 71, 0.2);
    border-top: 4px solid var(--accent-primary, #FFB347);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.gallery-loading-text {
    font-family: var(--font-family-primary, 'Bebas Neue', sans-serif);
    font-size: 1.125rem;
    letter-spacing: var(--letter-spacing-wide, 0.05em);
}

/* Responsive Design */
@media (max-width: 768px) {
    .gallery-header {
        padding: 1rem;
    }
    
    .gallery-title {
        font-size: 1.25rem;
    }
    
    .gallery-close {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
    
    .gallery-content {
        padding: 70px 1rem 100px;
    }
    
    .gallery-items {
        gap: 1.5rem;
    }
    
    .gallery-navigation {
        padding: 1rem;
    }
    
    .gallery-nav-controls {
        gap: 1rem;
        padding: 0.75rem 1.5rem;
    }
    
    .gallery-nav-btn {
        width: 50px;
        height: 50px;
        font-size: 1rem;
    }
    
    .gallery-counter {
        font-size: 0.875rem;
    }
    
    .gallery-item iframe {
        height: 50vh;
        min-height: 300px;
    }
}

@media (max-width: 480px) {
    .gallery-header {
        padding: 0.75rem;
    }
    
    .gallery-content {
        padding: 60px 0.75rem 90px;
    }
    
    .gallery-nav-controls {
        gap: 0.75rem;
        padding: 0.5rem 1rem;
    }
    
    .gallery-nav-btn {
        width: 45px;
        height: 45px;
        font-size: 0.875rem;
    }
}

/* Keyboard Navigation */
.gallery-modal:focus {
    outline: none;
}

/* Touch Support */
@media (hover: none) and (pointer: coarse) {
    .media-item::after {
        opacity: 0.7;
        background: rgba(0, 0, 0, 0.6);
    }
    
    .gallery-nav-btn:hover {
        transform: none;
    }
    
    .gallery-nav-btn:active {
        transform: scale(0.95);
    }
}