/* Prevent elements from stretching past the screen width */
*, *::before, *::after {
  box-sizing: border-box;
}

:root {
  --primary-color: #0f2a4a; /* Authoritative Navy */
  --accent-color: #d32f2f; /* Action Red for CTAs */
  --bg-light: #f4f4f4;
  --text-dark: #333333;
  --text-white: #ffffff;
}

body {
  font-family: "Arial", sans-serif;
  margin: 0;
  padding: 0;
  color: var(--text-dark);
  background-color: var(--text-white);
}

/* --- Header Section --- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 5%;
  background-color: var(--text-white);
  border-bottom: 4px solid var(--primary-color);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  /* NEW: Sticky Header rules for CRO */
  position: sticky;
  top: 0;
  z-index: 1000;
}

.logo {
  font-size: 28px;
  font-weight: 900;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 25px;
}

.phone {
  font-size: 20px;
  font-weight: bold;
  color: var(--text-dark);
}

.btn {
  padding: 14px 28px;
  background-color: var(--accent-color);
  color: var(--text-white);
  text-decoration: none;
  font-weight: bold;
  border-radius: 4px;
  text-transform: uppercase;
  transition: background 0.3s ease;
  text-align: center;
}

.btn:hover {
  background-color: #b90000;
}

/* Header Navigation Styles */
.main-nav {
  display: flex;
  gap: 20px;
}

.main-nav a {
  text-decoration: none;
  color: var(--text-dark);
  font-weight: bold;
  font-size: 16px;
  text-transform: uppercase;
  transition: color 0.3s ease;
}

.main-nav a:hover, 
.main-nav a.active {
  color: var(--accent-color); /* Highlights the current page in Red */
}

/* Hide on mobile for now, or stack them */
@media (max-width: 768px) {
  .main-nav {
    flex-wrap: wrap;
    justify-content: center;
    margin: 15px 0;
  }
}

/* --- Hero Section --- */
.hero {
  background-color: var(--primary-color);
  color: var(--text-white);
  text-align: center;
  padding: 120px 20px;
}

.hero h1 {
  font-size: 52px;
  font-weight: 900;
  margin-bottom: 24px;
  text-transform: uppercase;
  line-height: 1.1;
}

.hero p {
  font-size: 22px;
  max-width: 850px;
  margin: 0 auto 40px auto;
  line-height: 1.6;
  color: #e0e0e0;
}

.hero-btns {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.btn-outline {
  background: transparent;
  border: 2px solid var(--text-white);
}

.btn-outline:hover {
  background: var(--text-white);
  color: var(--primary-color);
}

img {
  max-width: 100%;
  height: auto;
}

/* --- Trust Indicators Section --- */
.trust-bar {
  display: flex;
  justify-content: space-around;
  flex-wrap: wrap;
  background-color: var(--bg-light);
  padding: 50px 20px;
  text-align: center;
  border-bottom: 1px solid #ddd;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 20px;
}

.stat-number {
  font-size: 42px;
  font-weight: 900;
  color: var(--accent-color);
}

.stat-label {
  font-size: 16px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary-color);
}

/* Core Services Section */
.services-section {
  padding: 80px 5%;
  background-color: var(--text-white);
  text-align: center;
}

.services-section h2 {
  font-size: 36px;
  color: var(--primary-color);
  margin-bottom: 50px;
  text-transform: uppercase;
  font-weight: 900;
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr); /* Forces exactly 4 columns on PC */
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.service-card {
  background-color: var(--bg-light);
  padding: 40px 30px;
  border-radius: 8px;
  border-top: 5px solid var(--accent-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
  text-align: left;
}

.service-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.service-icon {
  font-size: 40px;
  color: var(--primary-color);
  margin-bottom: 20px;
  display: block;
}

.service-card h3 {
  font-size: 24px;
  color: var(--primary-color);
  margin-bottom: 15px;
  font-weight: bold;
}

.service-card p {
  font-size: 16px;
  color: #555;
  line-height: 1.6;
  margin-bottom: 25px;
}

.service-link {
  font-weight: bold;
  color: var(--accent-color);
  text-decoration: none;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: 0.5px;
  display: inline-block;
}

.service-link:hover {
  color: var(--primary-color);
}

/* Process Section */
.process-section {
  padding: 80px 5%;
  background-color: var(--primary-color); /* Navy background for authority */
  color: var(--text-white);
  text-align: center;
}

.process-header h2 {
  font-size: 36px;
  margin-bottom: 10px;
  text-transform: uppercase;
  font-weight: 900;
}

.process-header p {
  font-size: 20px;
  color: #e0e0e0;
  margin-bottom: 50px;
}

.process-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.step-card {
  flex: 1;
  min-width: 250px;
  background-color: rgba(255, 255, 255, 0.05); /* Subtle transparent box */
  padding: 40px 20px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  text-align: center;
}

.step-number {
  background-color: var(--accent-color);
  color: var(--text-white);
  font-size: 24px;
  font-weight: 900;
  width: 50px;
  height: 50px;
  line-height: 50px;
  border-radius: 50%;
  margin: 0 auto 20px auto;
  display: block;
}

.step-card h3 {
  font-size: 22px;
  margin-bottom: 15px;
  color: var(--text-white);
}

.step-card p {
  font-size: 16px;
  line-height: 1.6;
  color: #d1d5db;
}

/* Footer Section */
footer {
  background-color: #0a1c32; /* A slightly darker navy for contrast */
  color: #d1d5db;
  padding: 60px 5% 20px 5%;
  font-size: 15px;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 40px;
}

.footer-col h4 {
  color: var(--text-white);
  font-size: 20px;
  margin-bottom: 20px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: bold;
}

.footer-col p {
  line-height: 1.6;
  margin-bottom: 15px;
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col ul li {
  margin-bottom: 12px;
}

.footer-col ul li a {
  color: #d1d5db;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-col ul li a:hover {
  color: var(--accent-color); /* Action Red */
}

.footer-hours span {
  display: block;
  margin-bottom: 8px;
}

.footer-bottom {
  text-align: center;
  padding-top: 20px;
  font-size: 14px;
  color: #888;
}

.footer-bottom p {
  margin: 5px 0;
}

/* --- Subpage Layout Styles (Siding, Roofing, etc.) --- */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Subpage Hero */
.subpage-hero {
  background-color: var(--primary-color);
  color: var(--text-white);
  text-align: center;
  padding: 80px 20px;
  border-bottom: 5px solid var(--accent-color);
}

.subpage-hero h1 {
  font-size: 48px;
  font-weight: 900;
  margin-bottom: 20px;
  text-transform: uppercase;
}

.subpage-hero p {
  font-size: 20px;
  max-width: 800px;
  margin: 0 auto 30px auto;
  line-height: 1.6;
  color: #e0e0e0;
}

/* Detailed Services Rows */
.detailed-services {
  padding: 80px 0;
  background-color: var(--text-white);
}

.service-detail-row {
  display: flex;
  align-items: center;
  margin-bottom: 60px;
  padding: 40px;
  background-color: var(--bg-light);
  border-radius: 8px;
  border-left: 6px solid var(--primary-color);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
  width: 85%;
  margin-right: auto;
  margin-left: 0;
}

/* Alternating layout for visual interest */
.service-detail-row.reverse-layout {
  border-left: none;
  border-right: 6px solid var(--accent-color);
  text-align: right;
  margin-left: auto;
  margin-right: 0;
  text-align: left;
  flex-direction: row-reverse;
}

.service-text h2 {
  font-size: 32px;
  color: var(--primary-color);
  margin-bottom: 20px;
}

.service-text p {
  font-size: 18px;
  line-height: 1.7;
  color: #444;
  margin-bottom: 15px;
}

.service-text,
.service-image {
  flex: 1;
}

.service-image img {
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: block;
}

/* Call to Action Banner */
.cta-banner {
  background-color: var(--accent-color); /* Action Red background */
  color: var(--text-white);
  text-align: center;
  padding: 70px 20px;
}

.cta-banner h2 {
  font-size: 36px;
  font-weight: 900;
  margin-bottom: 15px;
}

.cta-banner p {
  font-size: 20px;
  margin-bottom: 30px;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.cta-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.btn-white {
  background-color: var(--text-white);
  color: var(--accent-color);
}

.btn-white:hover {
  background-color: #f0f0f0;
  color: var(--primary-color);
}

.cta-phone {
  font-size: 20px;
}

/* --- Contact Page Specific Styles --- */

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: flex-start;
}

/* Form Styles */
.contact-form .form-group {
  margin-bottom: 20px;
}

.contact-form label {
  display: block;
  font-size: 14px;
  font-weight: bold;
  color: var(--primary-color);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.contact-form input[type="text"],
.contact-form input[type="tel"],
.contact-form input[type="email"],
.contact-form select,
.contact-form textarea {
  width: 100%;
  padding: 12px 15px;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 16px;
  font-family: inherit;
  box-sizing: border-box; /* Ensures padding doesn't affect total width */
  transition: border-color 0.3s ease;
}

.contact-form input:focus,
.contact-form select:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 5px rgba(15, 42, 74, 0.2);
}

/* --- Customer Reviews Section --- */
.reviews-section {
  padding: 80px 5%;
  background-color: var(
    --bg-light
  ); /* Soft background to separate it from the navy process section */
  text-align: center;
}

.reviews-header h2 {
  font-size: 36px;
  color: var(--primary-color);
  margin-bottom: 10px;
  text-transform: uppercase;
  font-weight: 900;
}

.reviews-header p {
  font-size: 20px;
  color: #555;
  margin-bottom: 50px;
}

.reviews-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.review-card {
  background-color: var(--text-white);
  padding: 40px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.06);
  text-align: left;
  border-top: 4px solid var(--primary-color);
  transition: transform 0.3s ease;
}

.review-card:hover {
  transform: translateY(-5px);
}

.review-stars {
  font-size: 24px;
  margin-bottom: 15px;
  letter-spacing: 2px;
}

.review-text {
  font-size: 16px;
  line-height: 1.7;
  color: #444;
  font-style: italic;
  margin-bottom: 25px;
}

.reviewer-name {
  font-size: 16px;
  font-weight: bold;
  color: var(--primary-color);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.reviews-cta {
  margin-top: 50px;
}

/* --- Upgraded Brands We Trust Banner --- */
.trust-brands {
  background-color: #eaeaea;
  padding: 60px 5%; /* Made the section taller */
  text-align: center;
  border-bottom: 1px solid #ddd;
}

.trust-brands p {
  font-size: 18px; /* Larger text */
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #555;
  margin-bottom: 30px; /* More space between text and logos */
  font-weight: 900;
}

.brand-logos {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 60px; /* More breathing room between logos */
}

/* Styles for text placeholders */
.brand-logos .brand {
  font-size: 18px;
  font-weight: bold;
  color: #888;
  text-transform: uppercase;
}

.brand-img {
  max-height: 80px; /* Allows the logos to be much larger */
  width: auto;
  filter: grayscale(100%); /* Keeps them gray for a clean look */
  opacity: 0.6;
  transition: all 0.3s ease;
}

.brand-img:hover {
  filter: grayscale(0%); /* Color comes back when hovered */
  opacity: 1;
  transform: scale(1.05); /* Slight pop out effect */
}

/* =======================================================
   RESPONSIVE DESIGN (Media Queries)
   These MUST stay at the very bottom of the file!
   ======================================================= */

/* 1. Prevent horizontal scroll globally */
html, body {
  overflow-x: hidden;
  width: 100%;
}

/* 2. Make sure long words/logos don't stretch the screen */
h1, h2, h3, .logo {
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* --- Tablet Layout (Max 1024px) --- */
@media (max-width: 1024px) {
  .services-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Small Tablet / Large Phone (Max 900px) --- */
@media (max-width: 900px) {
  .service-detail-row,
  .service-detail-row.reverse-layout {
    width: 100%; 
    flex-direction: column; 
    text-align: center; 
    padding: 30px 20px;
  }
  .service-text ul {
    text-align: left;
    display: inline-block;
  }
  .contact-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
}

/* --- Mobile Phones (Max 768px) --- */
@media (max-width: 768px) {
  /* Bulletproof body wrapper to kill any rogue wide elements */
  html, body {
    overflow-x: hidden !important;
    width: 100%;
    max-width: 100vw;
  }

  /* Sleek Header & Logo adjustments */
  header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 10px 15px;
  }
  
  .logo {
    font-size: 22px; 
  }

  .nav-actions {
    flex-direction: column;
    width: 100%;
    gap: 10px;
  }
  
  .phone {
    font-size: 16px; 
  }

  /* Scale down paddings for easier scrolling */
  .hero, .subpage-hero, .services-section, 
  .process-section, .detailed-services, 
  .reviews-section, .trust-brands {
    padding: 50px 15px;
  }

  /* Scale down font sizes */
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 18px; }
  .subpage-hero h1 { font-size: 32px; }
  .cta-banner h2 { font-size: 28px; }

  /* =========================================
     CRITICAL HORIZONTAL OVERFLOW FIXES
     ========================================= */
     
  /* Fix 1: Stop the review grid from forcing a 300px width */
  .reviews-grid {
    grid-template-columns: 1fr;
  }
  
  /* Fix 2: Stop the footer columns from forcing a 250px width */
  .footer-container {
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: center; /* Centers footer links on mobile */
  }

  /* Fix 3: Prevent the process steps from retaining their 250px min-width */
  .step-card {
    min-width: 100%;
  }

  /* Fix 4: Override the 40px inline padding from contact.php using !important */
  .contact-form-wrapper {
    padding: 20px !important;
  }

  /* Fix 5: Reduce the large gap between brand logos so they wrap neatly */
  .brand-logos {
    gap: 30px;
  }

  /* Make buttons full-width and touch-friendly */
  .btn {
    width: 100%;
    display: block;
    padding: 12px; /* Slightly slimmer to save screen space */
  }
  .hero-btns {
    flex-direction: column;
    width: 100%;
    gap: 15px;
  }

  /* Grid adjustments */
  .services-grid {
    grid-template-columns: 1fr;
  }
}

