/* ==========================================================================
   1. GLOBAL STYLES & VARIABLES
   ========================================================================== */
html { 
    scroll-behavior: smooth; 
}

:root { 
    --accent: #F28C28; 
    --dark: #1A1A1A; 
    --gray: #F5F5F5; 
    --border: #E0E0E0; 
    --white: #FFFFFF; 
}

* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
}

body { 
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; 
    background: var(--gray); 
    color: var(--dark); 
    line-height: 1.6; 
    -webkit-font-smoothing: antialiased;
}

.container { 
    max-width: 1100px; 
    margin: auto; 
    padding: 0 20px; 
    box-sizing: border-box;
}

/* ==========================================================================
   2. HEADER & NAVIGATION
   ========================================================================== */
header.header { 
    background: var(--white); 
    border-bottom: 1px solid var(--border); 
    padding: 14px 0; 
    position: sticky; 
    top: 0; 
    z-index: 999; 
    box-sizing: border-box;
    width: 100%;
}

.header-inner { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    gap: 20px; 
    flex-wrap: wrap; 
    position: relative; /* FIX: Establishes context anchor for absolute child buttons */
}

.logo-img { 
    height: 42px; 
    width: auto; 
    object-fit: contain; 
}

.logo-text { 
    font-size: 1.2rem; 
    font-weight: bold; 
    color: var(--dark);
}

.header-phone { 
    text-align: right;
}

.header-phone a { 
    color: var(--dark); 
    text-decoration: none; 
    font-weight: bold; 
    display: block; 
    text-align: right; 
    font-size: 1rem;
}

.header-phone .email { 
    font-size: 0.88rem; 
    opacity: 0.7; 
    display: block;
    margin-top: 2px;
}

nav.nav ul { 
    display: flex; 
    gap: 18px; 
    list-style: none; 
    flex-wrap: wrap; 
    align-items: center;
}

nav.nav a { 
    text-decoration: none; 
    color: var(--dark); 
    font-weight: 500; 
    font-size: 0.98rem;
    transition: color 0.2s ease-in-out;
}

nav.nav a:hover { 
    color: var(--accent); 
}

/* FIX: Standardized header button callouts across components */
nav.nav li:last-child a, .header-cta-btn { 
    background: var(--dark); 
    color: var(--white) !important; 
    padding: 10px 18px; 
    border-radius: 4px; 
    font-weight: bold; 
    font-size: 0.9rem; 
    display: inline-block; 
    text-align: center; 
}

nav.nav li:last-child a:hover, .header-cta-btn:hover { 
    background: var(--accent); 
}

.mobile-menu-btn { 
    display: none; 
    font-size: 1.8rem; 
    background: none; 
    border: none; 
    cursor: pointer; 
    padding: 5px 10px; 
    color: var(--dark);
}

/* ==========================================================================
   3. HERO BANNER & CORE SECTIONS
   ========================================================================== */
.hero-banner { 
    background: linear-gradient(rgba(0, 0, 0, 0.75), rgba(0, 0, 0, 0.75)), url('/images/hero-technician-firebox.jpg'); 
    background-repeat: no-repeat;
    background-position: center 25%;    /* Centers the horizontal view, shifts the camera down to see the real action */
    background-size: 100% auto;          /* STOPS ALL ZOOM. Image scales to exactly the width of the screen, no wider */
    background-color: #1a1a1a; 
    padding: 160px 20px;                 /* Generous spacing to let the unzoomed image breathe naturally */
    color: var(--white); 
    text-align: center; 
    width: 100%;
}

.cta-btn { 
    display: inline-block; 
    background: var(--accent); 
    color: var(--white); 
    padding: 14px 35px; 
    text-decoration: none; 
    font-weight: bold; 
    border-radius: 4px; 
    font-size: 1.1rem; 
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.cta-btn:hover {
    transform: translateY(-2px);
    background-color: #e07b12;
}

.services-section { 
    padding: 70px 0; 
    background: var(--white); 
    text-align: center; 
}

.services-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); 
    gap: 30px; 
}

.service-card { 
    border: 1px solid var(--border); 
    padding: 30px; 
    border-radius: 6px; 
    text-align: left; 
    background: #FAFAFA; 
}

/* ==========================================================================
   4. CASE STUDIES & PROJECT SHOWCASE GRID
   ========================================================================== */
.work-teaser-section { 
    padding: 70px 0; 
    background: var(--white); 
    text-align: center; 
    border-top: 1px solid var(--border); 
}

.work-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); 
    gap: 20px; 
    margin-top: 30px; 
}

.work-item { 
    border: 1px solid var(--border); 
    border-radius: 6px; 
    overflow: hidden; 
    background: var(--gray); 
    text-align: left; 
    display: flex;
    flex-direction: column;
}

.work-item img { 
    width: 100%; 
    height: 260px; 
    object-fit: cover; 
    display: block; 
}

.work-details { 
    padding: 15px; 
    background: var(--white); 
    flex-grow: 1;
}

/* ==========================================================================
   5. SCHEDULING, FOOTER & UTILITY BARS
   ========================================================================== */
.scheduling-box { 
    padding: 60px 0; 
    background: var(--gray); 
}

.form-wrapper { 
    max-width: 780px; 
    margin: 0 auto; 
    background: var(--white); 
    border: 1px solid var(--border); 
    padding: 35px; 
    border-radius: 8px; 
}

.booking-wrapper { 
    border: 2px solid var(--accent); 
    padding: 5px; 
    border-radius: 8px; 
    width: 100%; 
    margin: 20px auto 30px; 
}

/* FIX: Gap removed (margin-top: 0), colors updated to match dark layout */
.footer { 
    text-align: center; 
    padding: 80px 20px 100px 20px; 
    background: var(--dark); 
    margin-top: 0; /* Removing the 80px here eliminates the white gap completely */
    border-top: 4px solid var(--accent); 
}

.footer p {
    color: #555555;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.footer-nav {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px 22px;
    flex-wrap: wrap;
}

.footer-nav a {
    color: var(--white); /* Updated for contrast on dark footer */
    text-decoration: underline;
    margin: 0;
    font-size: 0.95rem;
    font-weight: 500;
    display: inline-block;
    transition: color 0.2s ease;
}

.footer-nav a:hover {
    color: var(--accent);
}

.footer-disclaimer {
    font-size: 0.82rem;
    line-height: 1.6;
    color: #666666;
    margin: 20px auto 0 auto;
    padding-top: 20px;
    border-top: 1px dashed #444444; /* Darkened border for dark footer */
    max-width: 680px;
    text-align: justify;
    text-justify: inter-word;
}

/* FIX: Optimized flex parameters to match your footer leaf asset properties cleanly */
.mobile-sticky-bar { 
    display: none; 
    position: fixed; 
    bottom: 0; 
    left: 0; 
    width: 100%; 
    height: 60px; 
    background-color: var(--white); 
    box-shadow: 0 -3px 12px rgba(0,0,0,0.06); 
    z-index: 9999; 
    border-top: 1px solid var(--border); 
    box-sizing: border-box; 
}

.sticky-btn { 
    flex: 1;
    display: flex; 
    align-items: center; 
    justify-content: center; 
    text-decoration: none; 
    font-size: 0.95rem; 
    font-weight: bold; 
    color: var(--dark); 
    border-right: 1px solid var(--border); 
    height: 100%;
    box-sizing: border-box;
    gap: 8px;
}

.phone-btn, .sms-btn {
    border-right: 1px solid var(--border);
}

.booking-btn {
    flex: 1.2;
    border-right: none !important;
    color: var(--white) !important;
    background: var(--accent) !important;
}

/* ==========================================================================
   6. PROGRAMMATIC SEO STABILIZATION & RENDERING CONTROLS
   ========================================================================== */
.work-item .img-frame {
    width: 100%;
    height: 260px;
    overflow: hidden;
    background: #1A1A1A;
    position: relative;
}

.work-item .img-frame img {
    width: 100%;
    height: 100%;
    display: block;
    max-width: 100%; /* FIX: Protects cross-browser scale layouts from stretching */
}

.work-grid .crop-1 { 
    object-fit: cover !important; 
    object-position: 50% 0% !important; 
}

.work-grid .crop-2 { 
    object-fit: contain !important; 
    object-position: center center !important; 
    background: #1A1A1A !important; 
}

/* FIX: Integrated portrait ratio optimization class for sweeping templates */
.work-grid .crop-3 { 
    object-fit: cover !important; 
    object-position: 50% 5% !important; 
}

.work-teaser-section + .work-teaser-section,
#work + #work {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* ==========================================================================
   7. RESPONSIVE MEDIA QUERIES
   ========================================================================== */
@media (max-width: 768px) { 
    body { 
        padding-bottom: 60px; 
    }

    .header-inner {
        flex-direction: column;
        align-items: center;
        gap: 14px;
        padding: 14px 10px;
    }

    .header-phone {
        width: 100%;
        border-top: 1px dashed var(--border);
        padding-top: 10px;
        text-align: center;
    }

    .header-phone a {
        text-align: center;
    }

    .logo-text {
        font-size: 1.15rem;
        width: 100%;
        text-align: center;
    }

    nav.nav { 
        display: none; 
        width: 100%;
        margin-top: 5px;
    } 
    
    nav.nav.open { 
        display: flex; 
    } 

    nav.nav ul {
        flex-direction: column;
        align-items: center;
        width: 100%;
        padding: 10px 0;
        gap: 12px;
    }
    
    nav.nav li {
        display: inline-block;
        width: 100%;
        text-align: center;
    }

    nav.nav li:last-child {
        margin-top: 4px;
    }

    nav.nav li:last-child a {
        width: 85%;
        max-width: 260px;
        padding: 12px;
    }
    
    .mobile-menu-btn { 
        display: block; 
        position: absolute;
        top: 10px;
        right: 10px;
    } 
    
    .mobile-sticky-bar { 
        display: flex; 
    } 

    .work-item .img-frame,
    .work-item img {
        height: 240px !important;
    }
}

/* ==========================================================================
   8. SPECIFIC GALLERY CROPPING & RATIO REPAIRS
   ========================================================================== */

/* Fixes Structural Chimney Maintenance Card: Lowers the focal point so the newly built crown caps are visible */
.work-grid .crop-1, 
.work-item img[src*="structural-chimney-maintenance"] {
    object-fit: cover !important;
    object-position: 50% 18% !important;
}

/* Fixes Custom Stainless Steel Chase Pan Card: Strips out layout pinch constraints so the before/after displays fully */
.work-grid .crop-2,
.work-item img[src*="custom-stainless-steel"] {
    object-fit: cover !important;
    object-position: center center !important;
    background: transparent !important;
}

/* Fixes Chimney Liner Upgrade Card: Shifts crop to the top edge so the new caps are fully visible */
.work-grid .crop-liner-top,
.img-frame img[src*="damaged-chimney-liner"] {
    object-fit: cover !important;
    object-position: center top !important; /* Forces the browser to anchor to the very top edge */
}

/* ==========================================================================
   9. CTA EMERGENCY SECTION (Added to break up black sections)
   ========================================================================== */
.emergency-cta-section {
    background-color: var(--gray); /* Breaks up the dark layout */
    padding: 70px 20px;
    text-align: center;
    border-top: 1px solid var(--border);
}

.emergency-cta-section h2,
.emergency-cta-section p,
.emergency-cta-section span {
    color: var(--dark) !important;
}

.emergency-cta-section a:not(.cta-btn) {
    color: var(--accent);
    text-decoration: underline;
    font-weight: 600;
    transition: color 0.2s ease;
}

.emergency-cta-section a:not(.cta-btn):hover {
    color: #d1751d;
}