:root {
    --fgg-primary: #2c5e7a; /* Site Teal */
    --fgg-secondary: #ff6a00; /* Site Orange */
    --fgg-accent: #d01c22; /* Site Red */
    --fgg-bg: #ffffff;
    --fgg-card-bg: #f8fafc;
    --fgg-text: #1e293b;
    --fgg-text-muted: #64748b;
    --fgg-radius: 8px;
    --fgg-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Gallery Container */
.fgg-container {
    background: var(--fgg-bg);
    color: var(--fgg-text);
    padding: 60px 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

.fgg-section {
    margin-bottom: 80px;
    position: relative;
    max-width: 1400px;
    margin-left: auto;
    margin-right: auto;
    padding: 0 40px;
}

.fgg-category-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 30px;
    color: var(--fgg-primary);
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 15px;
}

.fgg-category-title::before {
    content: '';
    display: block;
    width: 6px;
    height: 30px;
    background: var(--fgg-secondary);
    border-radius: 3px;
}

.fgg-carousel-wrapper {
    position: relative;
    overflow: hidden;
}

.fgg-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(300px, 1fr);
    gap: 20px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
}

.fgg-grid::-webkit-scrollbar { display: none; }

.fgg-item {
    background: var(--fgg-card-bg);
    border-radius: var(--fgg-radius);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid #e2e8f0;
    scroll-snap-align: start;
}

.fgg-item:hover {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.15);
    border-color: var(--fgg-primary);
    z-index: 2;
}

.fgg-thumbnail {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.fgg-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease, filter 0.6s ease;
}

.fgg-item:hover img {
    transform: scale(1.1);
    filter: brightness(1.1) saturate(1.1);
}

.fgg-item-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 20px 15px 15px;
    background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.4) 70%, transparent 100%);
    color: white;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    opacity: 1;
}

/* Loop Indicator */
.fgg-loop-line {
    width: 40px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.fgg-loop-line::after {
    content: 'END';
    position: absolute;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    color: var(--fgg-text-muted);
    font-size: 0.7rem;
    letter-spacing: 4px;
    font-weight: 800;
    opacity: 0.3;
}

.fgg-loop-line::before {
    content: '';
    width: 2px;
    height: 60%;
    background: repeating-linear-gradient(to bottom, var(--fgg-secondary), var(--fgg-secondary) 10px, transparent 10px, transparent 20px);
    opacity: 0.5;
}

/* Arrow Controls */
.fgg-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 10;
    box-shadow: var(--fgg-shadow);
    color: var(--fgg-primary);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.fgg-arrow:hover {
    background: var(--fgg-primary);
    color: white;
    transform: translateY(-50%) scale(1.1);
    opacity: 1;
}

.fgg-arrow-left { left: 10px; }
.fgg-arrow-right { right: 10px; }

/* MODAL STYLES - FIXED FOR CENTERING & FULLSCREEN */
.fgg-modal {
    display: none;
    position: fixed;
    z-index: 9999999; /* Ensure it is above everything */
    left: 0;
    top: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.fgg-modal-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

#fgg-zoom-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    overflow: hidden;
}

#fgg-zoom-container:active { cursor: grabbing; }

#fgg-modal-img {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    transition: transform 0.1s ease-out;
    user-select: none;
    -webkit-user-drag: none;
    box-shadow: 0 0 50px rgba(0,0,0,0.5);
}

.fgg-modal-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10000001;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
    padding: 10px; /* Bigger hit area */
}

@media (max-width: 768px) {
    .fgg-modal-close {
        top: 10px;
        right: 15px;
        font-size: 36px;
    }
}

.fgg-modal-caption {
    position: absolute;
    top: 20px;
    left: 30px;
    color: #fff;
    font-size: 1.25rem;
    font-weight: 700;
    z-index: 10000001;
    background: rgba(0,0,0,0.4);
    padding: 10px 20px;
    border-radius: 4px;
    backdrop-filter: blur(5px);
    max-width: 70%; /* Prevent hitting the close button */
}

@media (max-width: 768px) {
    .fgg-modal-caption {
        top: auto;
        bottom: 100px; /* Above the zoom controls */
        left: 20px;
        right: 20px;
        max-width: none;
        font-size: 1rem;
        text-align: center;
    }
}

.fgg-modal-controls {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    z-index: 10000001;
}

.fgg-modal-controls button {
    background: var(--fgg-primary);
    border: none;
    color: white;
    padding: 12px 24px;
    border-radius: 30px;
    cursor: pointer;
    font-weight: 700;
    font-size: 1rem;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
}

.fgg-modal-controls button:hover {
    background: var(--fgg-secondary);
    transform: translateY(-2px);
}

.fgg-modal-controls button.zoom-reset {
    background: #475569;
}

.fgg-hide-titles .fgg-item-title,
.fgg-section-hide-titles .fgg-item-title {
    display: none !important;
}

.fgg-item:focus {
    outline: 3px solid var(--fgg-secondary);
    outline-offset: 2px;
    z-index: 5;
}

.fgg-modal-close:focus,
.fgg-modal-controls button:focus {
    outline: 3px solid white;
    outline-offset: 2px;
}