/* --- 1. DESIGN TOKENS --- */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f6f8fb;
    --text-primary: #0f172a;
    --text-muted: #575f73;
    --accent: #1a4d8f; /* Emstowing Blue */
    --accent-hover: #12366b;
    --cta-urgent: #f1c40f; /* Yellow for urgency/CTA */
    --cta-urgent-hover: #d4ac0d;
    --border-color: rgba(0, 0, 0, 0.08);

    /* --- SPACING SCALE (1rem = 10px) --- */
    --space-xs: 0.8rem;
    --space-sm: 1.6rem;
    --space-md: 2.4rem;
    --space-lg: 3.2rem;
    --space-xl: 6.4rem;
    --space-xxl: 12.0rem;

    --section-padding: var(--space-xl);
    --card-padding: var(--space-lg);
}

/* --- UTILITY CLASSES --- */
.section-spacing {
    padding: var(--section-padding) 0;
}

.card-spacious {
    padding: var(--card-padding);
}

@media (max-width: 768px) {
    :root {
        --section-padding: 4.8rem;
        --card-padding: 2.4rem;
    }
}

/* --- 2. RESET & BASE --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    font-size: 62.5%; /* 1rem = 10px */
}

body {
    font-family: 'Roboto', sans-serif;
    font-size: 1.6rem;
    line-height: 1.6;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 2.4rem;
}

a {
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease, opacity 0.25s ease, box-shadow 0.25s ease;
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    z-index: 9999;
    padding: 1rem 2rem;
    background: var(--accent);
    color: white;
    font-weight: 700;
}

.skip-link:focus {
    position: fixed;
    left: 50%;
    top: 1rem;
    transform: translateX(-50%);
    width: auto;
    height: auto;
    overflow: visible;
}

/* --- 3. NAVIGATION --- */
.navbar {
    height: 8rem;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    background: var(--bg-primary);
    z-index: 2000;
}

.navbar .container {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
}


.logo-brand {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
}

.logo-brand img {
    height: 40px;
    width: auto;
    display: block;
}

.brand-text {
    font-family: 'Merriweather', Georgia, serif;
    font-weight: 700;
    color: var(--accent);
    font-size: 1.8rem;
    letter-spacing: 0.3px;
    display: none;
}

@media (min-width: 768px) {
    .brand-text {
        display: inline-block;
    }
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 2.5rem;
}

.nav-links {
    display: flex;
    gap: 2rem;
}

.nav-link {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 1.4rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.nav-link:hover {
    color: var(--accent);
}

.hamburger {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1005;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    transition: transform 0.3s ease, opacity 0.3s ease, box-shadow 0.3s ease;
    border-radius: 3px;
}

/* --- 4. BUTTONS --- */
.btn {
    display: inline-block;
    padding: 1.4rem 2.8rem;
    border-radius: 0.4rem;
    font-weight: 700;
    cursor: pointer;
    border: none;
    font-size: 1.5rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-primary {
    background-color: var(--accent);
    color: #ffffff;
}

.btn-primary:hover {
    background-color: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(26, 77, 143, 0.4);
}

.btn-urgent {
    background-color: var(--cta-urgent);
    color: #1a4d8f;
}

.btn-urgent:hover {
    background-color: var(--cta-urgent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px -10px rgba(241, 196, 15, 0.4);
}

.btn-sm {
    padding: 1rem 2rem;
    font-size: 1.3rem;
}

/* --- 5. MOBILE CALL CTA --- */
.mobile-call-cta {
    display: none;
    position: fixed;
    bottom: 2rem;
    left: 2rem;
    right: 2rem;
    background: var(--cta-urgent);
    color: #000;
    padding: 1.6rem;
    text-align: center;
    font-size: 1.8rem;
    font-weight: 900;
    border-radius: 5rem;
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
    z-index: 999;
    text-transform: uppercase;
}

@media (max-width: 768px) {
    .mobile-call-cta {
        display: block;
    }
}

/* --- 6. HERO SECTION --- */
.hero {
    min-height: 50rem;
    contain: layout style;
    padding: 8rem 0;
    background: var(--accent); background: linear-gradient(rgba(26, 77, 143, 0.8), rgba(26, 77, 143, 0.9)), url('/images/hero-bg.jpg');
    background-size: cover;
    background-position: center;
    text-align: center;
}

.hero h1 {
    font-size: clamp(3.2rem, 6vw, 5.6rem);
    margin-bottom: 2rem;
    color: #ffffff !important;
}

.hero p {
    max-width: 70rem;
    margin: 0 auto 3.5rem;
    font-size: 2rem;
    color: rgba(255, 255, 255, 0.9) !important;
}

.hero-actions {
    display: flex;
    gap: 2rem;
    justify-content: center;
}

/* --- 7. FEATURES / SERVICES GRID --- */
.services-section {
    padding: 8rem 0;
    background: var(--bg-secondary);
}

.section-header {
    text-align: center;
    margin-bottom: 5rem;
}

.section-header h2 {
    font-size: 3.4rem;
    margin-bottom: 1.5rem;
}

.service-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(30rem, 1fr));
    gap: 3rem;
}

.service-card {
    background: var(--bg-primary);
    padding: 4rem;
    border-radius: 0.8rem;
    border: 1px solid var(--border-color);
    transition: box-shadow 0.3s ease, border-color 0.3s ease;
    text-align: center;
}

.service-card:hover {
    border-color: var(--accent);
    box-shadow: 0 4px 20px rgba(0,0,0,0.12);
}

.service-card .icon {
    font-size: 4.8rem;
    margin-bottom: 2rem;
    display: block;
}

.service-card h3 {
    font-size: 2.2rem;
    margin-bottom: 1.5rem;
}

.service-card p {
    color: var(--text-muted);
    font-size: 1.6rem;
    margin-bottom: 2rem;
}

/* --- 8. CTA SECTION --- */
.cta-section {
    padding: 8rem 0;
    background: var(--accent);
    color: #fff;
    text-align: center;
}

.cta-section h2 {
    color: #fff;
    font-size: 3.6rem;
    margin-bottom: 2rem;
}

.cta-section p {
    font-size: 2rem;
    margin-bottom: 4rem;
    opacity: 0.9;
}

/* --- 9. FOOTER --- */
.footer {
    padding: 8rem 0 4rem;
    background: #0f172a;
    color: #fff;
}

.footer .logo {
    color: #fff;
    margin-bottom: 2rem;
}

.footer h3 {
    color: var(--cta-urgent);
    font-size: 1.8rem;
    margin-bottom: 2rem;
    text-transform: uppercase;
}

.footer-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1.5fr;
    gap: 4rem;
    margin-bottom: 6rem;
}

.footer-brand p {
    color: rgba(255,255,255,0.7);
    margin-bottom: 2rem;
}

.footer ul li {
    list-style: none;
    margin-bottom: 1.2rem;
}

.footer ul li a {
    color: rgba(255,255,255,0.7);
    font-size: 1.5rem;
}

.footer ul li a:hover {
    color: var(--cta-urgent);
    padding-left: 5px;
}

.footer-bottom {
    text-align: center;
    border-top: 1px solid rgba(255,255,255,0.1);
    padding-top: 3rem;
    color: rgba(255,255,255,0.5);
    font-size: 1.4rem;
}

/* --- 10. MEDIA QUERIES --- */
@media (max-width: 768px) {
    .hamburger {
        display: flex;
    }

    .nav-right {
        position: fixed;
        top: 0;
        right: -100%;
        width: 280px;
        height: 100vh;
        background: var(--bg-primary);
        z-index: 1002;
        border-left: 1px solid var(--border-color);
        flex-direction: column;
        align-items: flex-start;
        padding: 8rem 3rem 3rem;
        transition: right 0.3s ease;
        box-shadow: -4px 0 20px rgba(0, 0, 0, 0.3);
    }

    .nav-right.active {
        right: 0;
    }

    .nav-links {
        flex-direction: column;
        width: 100%;
    }

    .nav-link {
        font-size: 1.8rem;
        padding: 1.5rem 0;
        border-bottom: 1px solid var(--border-color);
        display: block;
    }

    .btn-call-header {
        display: none;
    }

    .hero-actions {
        flex-direction: column;
    }

    .footer-grid {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
}

.nav-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.nav-overlay.active {
    display: block;
    opacity: 1;
}

/* SVG Icon Styling */
.icon svg {
    display: block;
    margin: 0 auto 1rem;
    color: var(--primary, #1a4d8f);
}

.service-card .icon svg {
    width: 48px;
    height: 48px;
}

.btn .icon svg,
.btn-call-header .icon svg {
    display: inline-block;
    width: 18px;
    height: 18px;
    vertical-align: middle;
    margin: 0 0.25rem 0 0;
}

.btn-call-header .icon svg {
    color: white !important;
}

.icon {
    display: block;
    text-align: center;
    line-height: 1;
}

/* Responsive grid fix for neighborhood pages */
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr !important;
    }
}
.sr-only{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;}

/* About Grid - prevent CLS */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: center;
}
@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
    }
}

/* Performance Optimization: No background image on small screens for LCP */
@media (max-width: 768px) {
    .hero {
        background: linear-gradient(rgba(26, 77, 143, 0.9), rgba(26, 77, 143, 1)) !important;
        min-height: 40rem;
    }
    .hero h1, .hero p {
        color: #ffffff;
    }
}

/* Mobile: solid background, no image for performance */
@media (max-width: 768px) {
    .hero {
        background: linear-gradient(rgba(15, 23, 42, 0.9), rgba(15, 23, 42, 0.95)) !important;
        min-height: 40rem;
    }
}

/* ============================================ */
/* CLS OPTIMIZATION FIXES (2026-03-17)         */
/* ============================================ */

/* FIX 1: Stable scrollbar gutter prevents layout shift */
body {
    scrollbar-gutter: stable;
}

/* FIX 2: Contain nav overlay to isolated layout layer */
.nav-overlay {
    contain: layout style paint;
}

/* FIX 3: Contain mobile call CTA */
.mobile-call-cta {
    contain: layout style paint;
}

/* FIX 4: Isolate nav-right layout impact */
.nav-right {
    contain: paint;
}


/* FIX 5: nav-open class for JavaScript toggle (no body.style manipulation) */
html.nav-open {
    overflow: hidden;
    /* Keep scrollbar space reserved to prevent shift */
    scrollbar-gutter: stable;
}


/* FIX: Phone button header layout - inline icon + text */
@media (min-width: 769px) {
    .btn-call-header {
        display: inline-block;
        white-space: nowrap;
        padding: 1.2rem 2rem;
        font-size: 1.4rem;
    }

    .btn-call-header .icon {
        display: inline-block;
        margin: 0;
        text-align: baseline;
        line-height: 1;
    }
}
