/* --- Global Styles & Variables --- */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #8B4513;
    --accent-color: #f5f2e8;
    --dark-grey: #333333;
    --light-grey: #f5f2e8;
    --white-color: #ffffff;
    --font-family-headings: 'Montserrat', sans-serif;
    --font-family-body: 'Roboto', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--font-family-body);
    line-height: 1.6;
    color: var(--dark-grey);
    background-color: var(--white-color);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 20px;
}

h1, h2, h3 {
    font-family: var(--font-family-headings);
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 { font-size: 3rem; }
h2 { font-size: 2.5rem; color: var(--primary-color); }
h3 { font-size: 1.5rem; color: var(--dark-grey); }

p {
    margin-bottom: 1rem;
}

a {
    color: var(--primary-color);
    text-decoration: none;
}

/* --- Header & Navigation --- */
.header {
    background: var(--white-color);
    box-shadow: 0 2px 5px rgba(44, 62, 80, 0.1);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
}

.logo {
    height: 60px;
    width: auto;
}

.logo-link {
    display: flex;
    align-items: center;
}

.main-nav ul {
    list-style: none;
    display: flex;
}

.main-nav ul li {
    margin-left: 2rem;
}

.main-nav a {
    font-weight: bold;
    color: var(--dark-grey);
    padding: 0.5rem 0;
    border-bottom: 2px solid transparent;
    transition: color 0.3s, border-color 0.3s;
}

.main-nav a:hover,
.main-nav a.active {
    color: var(--primary-color);
    border-bottom-color: var(--secondary-color);
}

/* --- Hero Section --- */
.hero {
    background: linear-gradient(rgba(44, 62, 80, 0.8), rgba(44, 62, 80, 0.8)), url('../images/hero-bg.jpg') no-repeat center center/cover;
    color: var(--white-color);
    text-align: center;
    padding: 6rem 0;
}

.hero h1 {
    font-size: 3.5rem;
}

.hero .subtitle {
    font-size: 1.5rem;
    margin-bottom: 2rem;
}

.cta-button {
    display: inline-block;
    background: var(--secondary-color);
    color: var(--white-color);
    padding: 1rem 2.5rem;
    border-radius: 5px;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: uppercase;
    transition: background-color 0.3s, transform 0.3s;
    min-height: 48px;
    min-width: 48px;
}

.cta-button:hover {
    background-color: #a0522d;
    transform: translateY(-3px);
    color: var(--white-color);
}

/* --- View All Services Button --- */
.services-cta {
    text-align: center;
    margin-top: 3rem;
}

.services-cta .cta-button {
    padding: 1.2rem 3rem;
    font-size: 1.2rem;
}

/* --- General Section Styling --- */
section {
    padding: 4rem 0;
}

section:nth-child(even) {
    background-color: var(--accent-color);
}

.about-intro h2, .services-overview h2, .why-choose-us h2 {
    text-align: center;
    margin-bottom: 3rem;
}

.about-intro {
    text-align: center;
}

.about-intro p {
    max-width: 800px;
    margin: 0 auto;
}

/* --- Services Overview Section (Home Page) --- */
.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.service-card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.service-card {
    background: var(--white-color);
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(44, 62, 80, 0.08);
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border-top: 3px solid var(--secondary-color);
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(44, 62, 80, 0.12);
}

.service-card-link:hover .service-card {
    transform: translateY(-10px);
    box-shadow: 0 8px 20px rgba(44, 62, 80, 0.12);
}

.service-card h3 {
    margin-bottom: 1rem;
    color: var(--primary-color);
}

.service-card p {
    flex-grow: 1;
    margin-bottom: 1rem;
}

.service-card a {
    display: inline-block;
    margin-top: 1rem;
    font-weight: bold;
    color: var(--secondary-color);
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
    min-height: 44px;
    line-height: 44px;
}

.service-card a:hover {
    border-bottom-color: var(--secondary-color);
}

.service-card .learn-more {
    display: inline-block;
    margin-top: 1rem;
    font-weight: bold;
    color: var(--secondary-color);
    border-bottom: 2px solid transparent;
    transition: border-color 0.3s;
}

.service-card-link:hover .learn-more {
    border-bottom-color: var(--secondary-color);
}

/* --- Why Choose Us Section --- */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    text-align: center;
}

.feature h3 {
    margin-bottom: 0.5rem;
    color: var(--primary-color);
}

/* --- Footer --- */
.footer {
    background: var(--primary-color);
    color: var(--white-color);
    padding: 3rem 0 1rem;
}

.footer-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 2rem;
    margin-bottom: 2rem;
}

.footer-logo img {
    height: 50px;
    width: auto;
    margin-bottom: 1rem;
}

.footer h4 {
    font-family: var(--font-family-headings);
    color: var(--secondary-color);
    margin-bottom: 1rem;
}

.footer ul {
    list-style: none;
}

.footer ul li {
    margin-bottom: 0.5rem;
}

.footer a {
    color: var(--accent-color);
    transition: color 0.3s;
    min-height: 44px;
    display: inline-block;
    line-height: 1.8;
}

.footer a:hover {
    color: var(--secondary-color);
}

.social-links {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.social-links a {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    font-size: 1.5rem;
    color: var(--accent-color);
    transition: color 0.3s, transform 0.3s;
}

.social-links a:hover {
    color: var(--secondary-color);
    transform: scale(1.1);
}

.copyright {
    text-align: center;
    border-top: 1px solid rgba(245, 242, 232, 0.3);
    padding-top: 1rem;
    font-size: 0.9rem;
}

/* --- Page Header for Sub-pages --- */
.page-header {
    background-color: var(--primary-color);
    color: var(--white-color);
    padding: 3rem 0;
    text-align: center;
}

.page-header h1 {
    margin-bottom: 0.5rem;
}

.page-header p {
    font-size: 1.1rem;
    max-width: 700px;
    margin: 0 auto;
    color: var(--accent-color);
}

/* --- Services List Section (Services Page) --- */
.services-grid-full {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.service-item {
    background-color: var(--white-color);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 2rem;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    box-shadow: 0 2px 5px rgba(44, 62, 80, 0.05);
    transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
    border-top: 3px solid var(--accent-color);
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.service-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 6px 15px rgba(44, 62, 80, 0.1);
    border-top-color: var(--secondary-color);
    color: var(--secondary-color);
}

/* --- CTA Section --- */
.cta-section {
    background-color: var(--accent-color);
    text-align: center;
}

.cta-section h2 {
    margin-bottom: 1rem;
}

/* --- Layout for Pages with Sidebars --- */
.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
}

@media (min-width: 992px) {
    .layout-grid {
        grid-template-columns: 1fr 1fr;
        gap: 4rem;
        align-items: start;
    }
}

.main-content h2, .main-content h3 {
    margin-top: 2rem;
}

.main-content h2:first-child, .main-content h3:first-child {
    margin-top: 0;
}

.main-content ul, .main-content ol {
    margin-left: 1.5rem;
    margin-bottom: 1rem;
}

.main-content ul li, .main-content ol li {
    margin-bottom: 0.5rem;
}

/* --- Sidebar Styling --- */
.sidebar-widget {
    background-color: var(--accent-color);
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    border-left: 4px solid var(--secondary-color);
}

.sidebar-widget h3 {
    margin-bottom: 1rem;
    border-bottom: 2px solid var(--secondary-color);
    padding-bottom: 0.5rem;
    color: var(--primary-color);
}

.sidebar-widget .checklist {
    list-style: none;
    padding-left: 0;
}

.sidebar-widget .checklist li {
    margin-bottom: 0.75rem;
}

.cta-button.full-width {
    display: block;
    text-align: center;
    width: 100%;
}

.sidebar-widget .top-margin {
    margin-top: 2rem;
}

.sidebar-links {
    list-style: none;
    padding: 0;
}

.sidebar-links li a {
    display: block;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(139, 69, 19, 0.2);
    transition: color 0.3s;
    color: var(--primary-color);
    min-height: 44px;
}

.sidebar-links li a:hover {
    color: var(--secondary-color);
}

.sidebar-links li:last-child a {
    border-bottom: none;
}

/* --- Contact Form Styling --- */
.contact-form .form-group {
    margin-bottom: 1.5rem;
}

.contact-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form input[type="tel"],
.contact-form textarea {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ccc;
    border-radius: 5px;
    font-size: 16px;
    font-family: var(--font-family-body);
    min-height: 48px;
}

.contact-form input:focus,
.contact-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 5px rgba(44, 62, 80, 0.5);
}

.contact-form textarea {
    resize: vertical;
    min-height: 150px;
}

/* --- Mobile Navigation --- */
.mobile-nav-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    position: relative;
    width: 44px;
    height: 44px;
    z-index: 1001;
}

.mobile-nav-toggle .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.mobile-nav-toggle::before,
.mobile-nav-toggle::after,
.mobile-nav-toggle span {
    content: '';
    position: absolute;
    left: 7px;
    width: 30px;
    height: 3px;
    background-color: var(--primary-color);
    transition: all 0.3s ease;
}

.mobile-nav-toggle::before { top: 10px; }
.mobile-nav-toggle span { top: 50%; transform: translateY(-50%); }
.mobile-nav-toggle::after { bottom: 10px; }

.mobile-nav-toggle[aria-expanded="true"]::before {
    top: 50%;
    transform: translateY(-50%) rotate(45deg);
}

.mobile-nav-toggle[aria-expanded="true"]::after {
    top: 50%;
    transform: translateY(-50%) rotate(-45deg);
}

.mobile-nav-toggle[aria-expanded="true"] span {
    opacity: 0;
}

/* --- Housecall Pro Iframe Styling --- */
#hcp-lead-iframe {
    width: 100%;
    min-height: 800px;
    border: none;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(44, 62, 80, 0.1);
}

/* --- Portfolio Gallery --- */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 10px rgba(44, 62, 80, 0.1);
}

.portfolio-item img {
    width: 100%;
    height: 250px;
    object-fit: cover;
    transition: transform 0.3s;
}

.portfolio-item:hover img {
    transform: scale(1.05);
}

/* ============================================
   RESPONSIVE DESIGN - MOBILE FIRST APPROACH
   ============================================ */

/* Small devices (phones, 576px and below) */
@media (max-width: 576px) {
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.25rem; }
    
    .hero { padding: 3rem 0; }
    .hero h1 { font-size: 2rem; }
    .hero .subtitle { font-size: 1.1rem; }
    
    section { padding: 2.5rem 0; }
    
    .container { padding: 0 15px; }
    
    .services-grid { grid-template-columns: 1fr; }
    .services-grid-full { grid-template-columns: 1fr; }
    
    .footer-content { grid-template-columns: 1fr; text-align: center; }
    .social-links { justify-content: center; }
    
    .cta-button { 
        padding: 0.875rem 2rem;
        font-size: 1rem;
        width: 100%;
        text-align: center;
    }
}

/* Medium devices (tablets, 991px and below) */
@media (max-width: 991px) {
    h1 { font-size: 2.5rem; }
    h2 { font-size: 2rem; }
    .hero h1 { font-size: 2.5rem; }
    
    .mobile-nav-toggle {
        display: block;
    }

    .main-nav {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background-color: var(--white-color);
        box-shadow: 0 4px 6px rgba(44, 62, 80, 0.1);
        z-index: 999;
    }

    .main-nav.nav-visible {
        display: block;
    }

    .main-nav ul {
        flex-direction: column;
        text-align: center;
        padding: 0;
    }

    .main-nav ul li {
        margin: 0;
    }

    .main-nav a {
        display: block;
        padding: 1rem;
        border-bottom: 1px solid var(--accent-color);
        min-height: 48px;
        line-height: 1.5;
    }
    
    .main-nav a:hover, 
    .main-nav a.active {
        background-color: var(--accent-color);
        border-bottom-color: var(--accent-color);
    }

    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .layout-grid {
        grid-template-columns: 1fr;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 992px) {
    .mobile-nav-toggle {
        display: none;
    }
    
    .main-nav {
        display: block !important;
    }
}

/* Print styles */
@media print {
    .header, .footer, .mobile-nav-toggle, .cta-button {
        display: none;
    }
    
    body {
        font-size: 12pt;
        line-height: 1.5;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
}
