/* ================================
   Gallery Page Styles
   ================================ */

/* Back to Home Button */
.back-to-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-secondary, #666);
    text-decoration: none;
    padding: 8px 0;
    transition: color 0.3s ease;
}

.back-to-home:hover {
    color: var(--primary-color, #1a4670);
}

.back-to-home svg {
    display: block;
    transition: transform 0.3s ease;
}

.back-to-home:hover svg {
    transform: translateX(-4px);
}

/* ================================
   Gallery Hero
   ================================ */
.gallery-hero {
    padding: 140px 0 40px;
    background: var(--bg-cream, #f7f5f2);
    text-align: center;
}

.gallery-hero-content {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 20px;
}

.gallery-hero .section-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary-color, #1a4670);
    background: rgba(26, 70, 112, 0.1);
    padding: 8px 16px;
    border-radius: 100px;
    margin-bottom: 24px;
}

.gallery-title {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(48px, 8vw, 72px);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin: 0 0 20px 0;
    line-height: 1.1;
}

.gallery-title em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--accent-color, #c9a66b);
}

.gallery-subtitle {
    font-size: 18px;
    color: var(--text-secondary, #4a5568);
    line-height: 1.6;
    margin: 0;
}

/* ================================
   Gallery Grid Section
   ================================ */
.gallery-grid-section {
    padding: 60px 0 100px;
    background: var(--bg-cream, #f7f5f2);
    position: relative;
    overflow: hidden;
}

/* Grid pattern background */
.gallery-grid-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        linear-gradient(rgba(201, 166, 107, 0.15) 1px, transparent 1px),
        linear-gradient(90deg, rgba(201, 166, 107, 0.15) 1px, transparent 1px);
    background-size: 60px 60px;
    pointer-events: none;
    z-index: 0;
}

/* Gold swoosh 1 */
.gallery-grid-section::after {
    content: '';
    position: absolute;
    top: -20%;
    left: -15%;
    width: 70%;
    height: 160%;
    background: radial-gradient(ellipse at center, rgba(201, 166, 107, 0.25) 0%, transparent 60%);
    transform: rotate(-15deg);
    pointer-events: none;
    z-index: 0;
    animation: gallerySwoosh1 15s ease-in-out infinite;
}

@keyframes gallerySwoosh1 {
    0%, 100% {
        transform: rotate(-15deg) translateX(0) translateY(0);
        opacity: 0.8;
    }
    50% {
        transform: rotate(-15deg) translateX(5%) translateY(3%);
        opacity: 1;
    }
}

/* Additional swoosh via wrapper */
.gallery-grid-section .container {
    position: relative;
    z-index: 1;
}

.gallery-grid-section .container::before {
    content: '';
    position: absolute;
    bottom: -30%;
    right: -25%;
    width: 60%;
    height: 140%;
    background: radial-gradient(ellipse at center, rgba(201, 166, 107, 0.2) 0%, transparent 55%);
    transform: rotate(20deg);
    pointer-events: none;
    z-index: -1;
    animation: gallerySwoosh2 18s ease-in-out infinite;
}

@keyframes gallerySwoosh2 {
    0%, 100% {
        transform: rotate(20deg) translateX(0) translateY(0);
        opacity: 0.7;
    }
    50% {
        transform: rotate(20deg) translateX(-4%) translateY(-2%);
        opacity: 1;
    }
}

/* Third swoosh - blue accent */
.gallery-grid-section .container::after {
    content: '';
    position: absolute;
    top: 10%;
    right: -15%;
    width: 50%;
    height: 100%;
    background: radial-gradient(ellipse at center, rgba(26, 70, 112, 0.12) 0%, transparent 50%);
    transform: rotate(-25deg);
    pointer-events: none;
    z-index: -1;
    animation: gallerySwoosh3 20s ease-in-out infinite;
}

@keyframes gallerySwoosh3 {
    0%, 100% {
        transform: rotate(-25deg) translateX(0) translateY(0);
        opacity: 0.6;
    }
    50% {
        transform: rotate(-25deg) translateX(3%) translateY(2%);
        opacity: 1;
    }
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

/* ================================
   Gallery Filters
   ================================ */
.gallery-filters {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 48px;
    flex-wrap: wrap;
}

.gallery-filter {
    padding: 10px 24px;
    background: transparent;
    border: 1.5px solid rgba(10, 37, 64, 0.15);
    border-radius: 100px;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary, #4a5568);
    cursor: pointer;
    transition: all 0.3s ease;
    letter-spacing: 0.02em;
}

.gallery-filter:hover {
    border-color: rgba(10, 37, 64, 0.3);
    color: var(--text-primary, #1a1a1a);
}

.gallery-filter.active {
    background: var(--primary-deep, #0a2540);
    border-color: var(--primary-deep, #0a2540);
    color: white;
}

.gallery-filter.active[data-filter="residential"] {
    background: #1a4670;
    border-color: #1a4670;
}

.gallery-filter.active[data-filter="commercial"] {
    background: #8B2635;
    border-color: #8B2635;
}

.gallery-filter.active[data-filter="siteworks"] {
    background: #2C6E49;
    border-color: #2C6E49;
}

/* Filter animation */
.gallery-item {
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.gallery-item.hidden {
    display: none;
}

.gallery-item {
    position: relative;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    background: #e5e5e5;
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.3) 100%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item:hover img {
    transform: scale(1.08);
}

.gallery-item:hover::after {
    opacity: 1;
}

/* Expand icon on hover */
.gallery-item::before {
    content: '';
    position: absolute;
    bottom: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.8);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-image: url("data:image/svg+xml,%3Csvg width='18' height='18' viewBox='0 0 20 20' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 7V3H7M13 3H17V7M17 13V17H13M7 17H3V13' stroke='%231a1a1a' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    z-index: 2;
}

.gallery-item:hover::before {
    opacity: 1;
    transform: scale(1);
}

/* ================================
   Lightbox
   ================================ */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 22, 40, 0.98);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-close {
    position: absolute;
    top: 30px;
    right: 30px;
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10;
}

.lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lightbox-prev {
    left: 30px;
}

.lightbox-prev:hover {
    transform: translateY(-50%) translateX(-4px);
}

.lightbox-next {
    right: 30px;
}

.lightbox-next:hover {
    transform: translateY(-50%) translateX(4px);
}

.lightbox-content {
    max-width: 90vw;
    max-height: 85vh;
    position: relative;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 8px;
    opacity: 0;
    transform: scale(0.95);
    transition: opacity 0.4s ease, transform 0.4s ease;
}

.lightbox.active .lightbox-image {
    opacity: 1;
    transform: scale(1);
}

.lightbox-counter {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 0.1em;
}

/* ================================
   Gallery CTA Section
   ================================ */
.gallery-cta-section {
    padding: 100px 0;
    background: white;
}

.gallery-cta-box {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.gallery-cta-box .section-label {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.15em;
    color: var(--primary-color, #1a4670);
    background: rgba(26, 70, 112, 0.1);
    padding: 8px 16px;
    border-radius: 100px;
    margin-bottom: 20px;
}

.gallery-cta-box .cta-title {
    font-family: 'DM Sans', sans-serif;
    font-size: clamp(32px, 5vw, 44px);
    font-weight: 700;
    color: var(--text-primary, #1a1a1a);
    margin-bottom: 16px;
    line-height: 1.2;
}

.gallery-cta-box .cta-title em {
    font-family: 'Instrument Serif', Georgia, serif;
    font-style: italic;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--accent-color, #c9a66b);
}

.gallery-cta-box .cta-text {
    font-size: 18px;
    color: var(--text-secondary, #4a5568);
    margin-bottom: 32px;
}

/* ================================
   Responsive
   ================================ */
@media (max-width: 1200px) {
    .gallery-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .gallery-hero {
        padding: 140px 0 60px;
    }
    
    .gallery-filters {
        gap: 6px;
        margin-bottom: 32px;
    }

    .gallery-filter {
        padding: 8px 18px;
        font-size: 13px;
    }

    .gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .gallery-grid-section {
        padding: 40px 0 80px;
    }
    
    .lightbox-nav {
        width: 48px;
        height: 48px;
    }
    
    .lightbox-prev {
        left: 15px;
    }
    
    .lightbox-next {
        right: 15px;
    }
    
    .lightbox-close {
        top: 20px;
        right: 20px;
        width: 48px;
        height: 48px;
    }
    
    .gallery-cta-section {
        padding: 60px 20px;
    }
}

@media (max-width: 480px) {
    .gallery-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    
    .gallery-item {
        aspect-ratio: 16 / 10;
    }
}
