<?php
require_once $_SERVER['DOCUMENT_ROOT'] . '/config.php';
include BASE_PATH . '/include/header.php'; ?>

<!-- Portfolio Specific CSS -->
<link rel="stylesheet" href="/css/portfolio.css">

<main id="content">
    <!-- Hero Section -->
    <section class="subpage-hero">
        <div class="container">
            <h1>Our <span>Work</span></h1>
            <p>A showcase of our commitment to excellence in chimney care, fireplace restoration, and masonry
                craftsmanship.</p>
            <div class="mt-4">
                <a href="/contact-us/" class="btn-pro">Get a Free Estimate</a>
            </div>
        </div>
    </section>

    <!-- Breadcrumbs -->
    <div class="breadcrumb-container">
        <div class="container">
            <a href="/"><i class="fas fa-home"></i> Home</a> / <span>Our Work</span>
        </div>
    </div>

    <!-- Portfolio Section -->
    <section class="portfolio-section">
        <div class="container">
            <div class="text-center mb-5">
                <h2 class="section-title">Project Gallery</h2>
                <p class="text-muted max-w-700 mx-auto">Browse through our extensive portfolio of completed projects.
                    From routine cleanings to complex masonry rebuilds, we deliver quality you can trust.</p>
            </div>

            <!-- Filter Buttons -->
            <div class="portfolio-filter">
                <button class="filter-btn active" data-filter="all">All Projects</button>
                <button class="filter-btn" data-filter="chimney-rebuild">Chimney Rebuild</button>
                <button class="filter-btn" data-filter="tuck-pointing">Tuck Pointing</button>
                <button class="filter-btn" data-filter="cap-replacement">Cap Replacement</button>
                <button class="filter-btn" data-filter="stucco">Stucco Repair</button>
                <button class="filter-btn" data-filter="firebox">Firebox Remodeling</button>
                <button class="filter-btn" data-filter="cleaning">Cleaning</button>
            </div>

            <!-- Portfolio Grid -->
            <div class="portfolio-grid">
                <!-- Item 1: Tuck Pointing -->
                <div class="portfolio-item" data-category="tuck-pointing">
                    <span class="portfolio-badge">Masonry</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/tuck-pointing-1.jpg" alt="Tuck Pointing Project">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Precision Tuck Pointing</h3>
                                <p>Restoring structural integrity and aesthetic appeal to aged brickwork.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Item 2: Stucco Repair -->
                <div class="portfolio-item" data-category="stucco">
                    <span class="portfolio-badge">Exterior</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/stucco-repair-1.jpg" alt="Stucco Repair Project">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Stucco Restoration</h3>
                                <p>Seamless repair and coating for a weather-resistant finish.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Item 3: Standard Cap -->
                <div class="portfolio-item" data-category="cap-replacement">
                    <span class="portfolio-badge">Protection</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/standard-cap-replacement-7.jpg"
                            alt="Chimney Cap Replacement">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Chimney Cap Install</h3>
                                <p>Premium stainless steel caps to prevent water and debris entry.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Item 4: Chimney Rebuild -->
                <div class="portfolio-item" data-category="chimney-rebuild">
                    <span class="portfolio-badge">Rebuild</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/chimney-rebuild-1.jpg" alt="Chimney Rebuild">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Complete Chimney Rebuild</h3>
                                <p>Full structural reconstruction using high-quality matching bricks.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Item 5: Firebox -->
                <div class="portfolio-item" data-category="firebox">
                    <span class="portfolio-badge">Interior</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/firebox-remodeling-1.jpg" alt="Firebox Remodeling">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Firebox Remodeling</h3>
                                <p>Modernizing the heart of the home with heat-resistant materials.</p>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Item 6: Cleaning -->
                <div class="portfolio-item" data-category="cleaning">
                    <span class="portfolio-badge">Maintenance</span>
                    <div class="portfolio-img-wrapper">
                        <img src="/wp-content/uploads/2025/08/chimney-cleaning-1.jpg" alt="Chimney Cleaning">
                        <div class="portfolio-overlay">
                            <div class="portfolio-info">
                                <h3>Professional Sweep</h3>
                                <p>Comprehensive cleaning and inspection for maximum safety.</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- CTA Section -->
            <div class="pro-card mt-5 text-center">
                <h3 class="mb-3">Ready to start your project?</h3>
                <p class="mb-4">Join hundreds of satisfied homeowners who trust Crest Chimney for their fireplace needs.
                </p>
                <div class="d-flex justify-content-center gap-3 flex-wrap">
                    <a href="tel:<?php echo get_phone_number_tel(); ?>" class="btn-pro">
                        <i class="fas fa-phone-alt me-2"></i> Call <?php echo get_phone_number(); ?>
                    </a>
                    <a href="/contact-us/" class="btn-pro" style="background-color: var(--secondary-color);">
                        <i class="fas fa-calendar-alt me-2"></i> Book Online
                    </a>
                </div>
            </div>
        </div>
    </section>
</main>

<!-- Lightbox -->
<div class="lightbox" id="portfolio-lightbox">
    <div class="lightbox-content">
        <span class="lightbox-close">&times;</span>
        <img src="" alt="Full Size Image" id="lightbox-img">
    </div>
</div>

<script>
    document.addEventListener('DOMContentLoaded', function () {
        const filterBtns = document.querySelectorAll('.filter-btn');
        const portfolioItems = document.querySelectorAll('.portfolio-item');
        const lightbox = document.getElementById('portfolio-lightbox');
        const lightboxImg = document.getElementById('lightbox-img');
        const lightboxClose = document.querySelector('.lightbox-close');

        // Filtering Logic
        filterBtns.forEach(btn => {
            btn.addEventListener('click', () => {
                // Update active button
                filterBtns.forEach(b => b.classList.remove('active'));
                btn.classList.add('active');

                const filter = btn.getAttribute('data-filter');

                portfolioItems.forEach(item => {
                    if (filter === 'all' || item.getAttribute('data-category') === filter) {
                        item.style.display = 'block';
                        setTimeout(() => item.style.opacity = '1', 10);
                    } else {
                        item.style.opacity = '0';
                        setTimeout(() => item.style.display = 'none', 300);
                    }
                });
            });
        });

        // Lightbox Logic
        portfolioItems.forEach(item => {
            item.addEventListener('click', () => {
                const imgSrc = item.querySelector('img').src;
                lightboxImg.src = imgSrc;
                lightbox.classList.add('active');
                document.body.style.overflow = 'hidden';
            });
        });

        lightboxClose.addEventListener('click', () => {
            lightbox.classList.remove('active');
            document.body.style.overflow = 'auto';
        });

        lightbox.addEventListener('click', (e) => {
            if (e.target === lightbox) {
                lightbox.classList.remove('active');
                document.body.style.overflow = 'auto';
            }
        });
    });
</script>

<?php include BASE_PATH . '/include/footer.php'; ?>