/* ============================================
   Colonial Pool Company - Custom Website
   ============================================ */

/* --- CSS Variables --- */
:root {
  --primary: #0b3d91;
  --primary-dark: #072a66;
  --primary-light: #1a5ec4;
  --accent: #00b4d8;
  --accent-dark: #0096b7;
  --white: #ffffff;
  --off-white: #f4f7fa;
  --light-gray: #e8ecf1;
  --gray: #6b7280;
  --dark: #1a1a2e;
  --text: #333333;
  --text-light: #555555;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.12);
  --radius: 12px;
  --transition: 0.3s ease;
  --max-width: 1200px;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--text);
  line-height: 1.6;
  background: var(--white);
  overflow-x: hidden;
}

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

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

a:hover {
  color: var(--accent-dark);
}

ul {
  list-style: none;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--dark);
  line-height: 1.2;
  font-weight: 700;
}

h1 { font-size: clamp(2rem, 5vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
h3 { font-size: clamp(1.2rem, 3vw, 1.6rem); }
h4 { font-size: 1.2rem; }

p {
  margin-bottom: 1rem;
  color: var(--text-light);
}

/* --- Utility --- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.section {
  padding: 5rem 0;
}

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

.section-header h2 {
  margin-bottom: 1rem;
  position: relative;
  display: inline-block;
}

.section-header h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  margin: 0.75rem auto 0;
  border-radius: 2px;
}

.section-header p {
  max-width: 650px;
  margin: 0 auto;
  font-size: 1.1rem;
}

.btn {
  display: inline-block;
  padding: 0.85rem 2rem;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: all var(--transition);
  border: none;
  text-align: center;
}

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

.btn-primary:hover {
  background: var(--accent-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 180, 216, 0.4);
}

.btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid var(--white);
}

.btn-outline:hover {
  background: var(--white);
  color: var(--primary);
}

.btn-dark {
  background: var(--primary);
  color: var(--white);
}

.btn-dark:hover {
  background: var(--primary-dark);
  color: var(--white);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(11, 61, 145, 0.4);
}

/* ============================================
   HEADER / NAVIGATION
   ============================================ */
.header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  background: transparent;
  transition: background var(--transition), box-shadow var(--transition);
}

.header.scrolled {
  background: var(--primary-dark);
  box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 80px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo img {
  height: 45px;
  width: auto;
}

.logo span {
  color: var(--white);
  font-size: 1.3rem;
  font-weight: 700;
  white-space: nowrap;
}

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

.nav-links a {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 500;
  font-size: 0.95rem;
  position: relative;
  padding: 0.25rem 0;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width var(--transition);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--white);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-cta {
  margin-left: 0.5rem;
}

.nav-cta .btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
}

/* Hamburger */
.hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 1001;
  background: none;
  border: none;
  padding: 0.5rem;
}

.hamburger span {
  display: block;
  width: 28px;
  height: 3px;
  background: var(--white);
  border-radius: 2px;
  transition: all var(--transition);
}

.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 6px);
}

.hamburger.active span:nth-child(2) {
  opacity: 0;
}

.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -6px);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent-dark) 100%);
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0.25;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 42, 102, 0.6) 0%, rgba(11, 61, 145, 0.8) 100%);
}

.hero-content {
  position: relative;
  z-index: 2;
  text-align: center;
  max-width: 800px;
  padding: 2rem 1.5rem;
}

.hero-content h1 {
  color: var(--white);
  margin-bottom: 1.25rem;
  font-size: clamp(2.2rem, 5.5vw, 3.5rem);
}

.hero-content .subtitle {
  color: rgba(255, 255, 255, 0.9);
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  margin-bottom: 2.5rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.7;
}

.hero-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Wave divider */
.wave-divider {
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 100%;
  overflow: hidden;
  line-height: 0;
}

.wave-divider svg {
  display: block;
  width: 100%;
  height: 80px;
}

/* ============================================
   ABOUT SECTION
   ============================================ */
.about {
  background: var(--white);
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
  align-items: center;
}

.about-image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.about-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  min-height: 400px;
}

.about-text h2 {
  margin-bottom: 1.5rem;
}

.about-text h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  margin-top: 0.75rem;
  border-radius: 2px;
}

.about-text p {
  font-size: 1.05rem;
  margin-bottom: 1.25rem;
}

/* ============================================
   SERVICES SECTION
   ============================================ */
.services {
  background: var(--off-white);
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
}

.service-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow);
  transition: all var(--transition);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.service-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  transform: scaleX(0);
  transition: transform var(--transition);
}

.service-card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-lg);
}

.service-card:hover::before {
  transform: scaleX(1);
}

.service-icon {
  width: 70px;
  height: 70px;
  margin: 0 auto 1.5rem;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.service-icon svg {
  width: 32px;
  height: 32px;
  fill: var(--white);
  stroke: var(--white);
}

.service-card h3 {
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.service-card p {
  font-size: 0.95rem;
  line-height: 1.7;
}

.service-card .btn {
  margin-top: 1.5rem;
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
}

/* ============================================
   CONTACT / CTA SECTION
   ============================================ */
.contact {
  background: var(--white);
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4rem;
}

.contact-info h3 {
  margin-bottom: 1.5rem;
  font-size: 1.5rem;
}

.contact-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.contact-item-icon {
  width: 48px;
  height: 48px;
  min-width: 48px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.contact-item-icon svg {
  width: 22px;
  height: 22px;
  fill: var(--white);
}

.contact-item-text h4 {
  margin-bottom: 0.25rem;
  font-size: 1rem;
  color: var(--dark);
}

.contact-item-text p,
.contact-item-text a {
  font-size: 0.95rem;
  color: var(--text-light);
  margin-bottom: 0;
}

.contact-item-text a:hover {
  color: var(--accent);
}

.contact-form {
  background: var(--off-white);
  padding: 2.5rem;
  border-radius: var(--radius);
}

.contact-form h3 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.contact-form > p {
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.4rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--dark);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid var(--light-gray);
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--transition);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Inline validation states */
.form-group.has-error input,
.form-group.has-error textarea,
.form-group.has-error select {
  border-color: #ef4444;
}

.form-group.has-error input:focus,
.form-group.has-error textarea:focus {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

.form-group.has-success input,
.form-group.has-success textarea {
  border-color: #10b981;
}

.field-error {
  display: block;
  color: #ef4444;
  font-size: 0.82rem;
  margin-top: 0.3rem;
  font-weight: 500;
  animation: fieldErrorIn 0.2s ease;
}

@keyframes fieldErrorIn {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.form-group textarea {
  resize: vertical;
  min-height: 120px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* --- Form Messages --- */
.form-message {
  margin-top: 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
}
.form-message.success {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.form-message.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ============================================
   POOL OPENING/CLOSING CTA
   ============================================ */
.cta-banner {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 50%, var(--accent-dark) 100%);
  padding: 4rem 0;
  text-align: center;
}

.cta-banner h2 {
  color: var(--white);
  margin-bottom: 1rem;
}

.cta-banner p {
  color: rgba(255, 255, 255, 0.9);
  font-size: 1.1rem;
  max-width: 650px;
  margin: 0 auto 2rem;
}

.cta-banner .cta-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  background: var(--dark);
  color: rgba(255, 255, 255, 0.7);
  padding: 3rem 0 1.5rem;
}

.footer-content {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 3rem;
  margin-bottom: 2rem;
}

.footer-brand p {
  color: rgba(255, 255, 255, 0.6);
  margin-top: 1rem;
  font-size: 0.95rem;
  max-width: 350px;
}

.footer-links h4,
.footer-contact h4 {
  color: var(--white);
  margin-bottom: 1rem;
  font-size: 1.1rem;
}

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

.footer-links ul li a {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.95rem;
}

.footer-links ul li a:hover {
  color: var(--accent);
}

.footer-contact-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.footer-contact-item svg {
  width: 18px;
  height: 18px;
  fill: var(--accent);
  min-width: 18px;
}

.footer-contact-item a {
  color: rgba(255, 255, 255, 0.6);
}

.footer-contact-item a:hover {
  color: var(--accent);
}

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

.footer-bottom a {
  color: rgba(255, 255, 255, 0.5);
}

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

/* ============================================
   SERVICE DETAIL PAGES
   ============================================ */
.page-hero {
  position: relative;
  padding: 10rem 0 5rem;
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
  text-align: center;
}

.page-hero h1 {
  color: var(--white);
  margin-bottom: 1rem;
}

.page-hero p {
  color: rgba(255, 255, 255, 0.85);
  font-size: 1.15rem;
  max-width: 600px;
  margin: 0 auto;
}

/* Breadcrumb Navigation */
.breadcrumb {
  background: var(--off-white);
  border-bottom: 1px solid var(--light-gray);
  padding: 0.75rem 0;
}

.breadcrumb-list {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.breadcrumb-item {
  display: flex;
  align-items: center;
  color: var(--gray);
}

.breadcrumb-item + .breadcrumb-item::before {
  content: '';
  display: inline-block;
  width: 16px;
  height: 16px;
  margin-right: 0.25rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M9 18l6-6-6-6'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
}

.breadcrumb-item a {
  color: var(--primary);
  font-weight: 500;
}

.breadcrumb-item a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.breadcrumb-item.active {
  color: var(--text);
  font-weight: 600;
}

.service-detail {
  background: var(--white);
}

.service-detail-content {
  max-width: 900px;
  margin: 0 auto;
}

.service-detail-content h2 {
  margin-bottom: 1.5rem;
}

.service-detail-content h2::after {
  content: '';
  display: block;
  width: 60px;
  height: 4px;
  background: var(--accent);
  margin-top: 0.75rem;
  border-radius: 2px;
}

.service-detail-content p {
  font-size: 1.05rem;
  line-height: 1.8;
  margin-bottom: 1.5rem;
}

.service-detail-content ol {
  padding-left: 1.5rem;
  margin-bottom: 2rem;
}

.service-detail-content ol li {
  margin-bottom: 1rem;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-light);
}

.service-detail-content ol li strong {
  color: var(--dark);
}

/* Service feature cards */
.service-features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}

.feature-card {
  background: var(--off-white);
  padding: 2rem;
  border-radius: var(--radius);
  border-left: 4px solid var(--accent);
}

.feature-card h4 {
  margin-bottom: 0.75rem;
  color: var(--primary);
  font-size: 1.1rem;
}

.feature-card p {
  font-size: 0.95rem;
  margin-bottom: 0;
}

/* Repair accordion */
.repair-accordion {
  margin-top: 2rem;
}

.accordion-item {
  background: var(--off-white);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}

.accordion-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--dark);
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
  transition: background var(--transition);
}

.accordion-header:hover {
  background: var(--light-gray);
}

.accordion-header .chevron {
  margin-left: auto;
  transition: transform var(--transition);
  width: 20px;
  height: 20px;
  fill: var(--gray);
}

.accordion-item.active .accordion-header .chevron {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.accordion-body-inner {
  padding: 0 1.5rem 1.5rem;
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-light);
}

.accordion-body-inner ul {
  list-style: disc;
  padding-left: 1.5rem;
  margin-top: 0.75rem;
}

.accordion-body-inner ul li {
  margin-bottom: 0.5rem;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 992px) {
  .about-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .about-image {
    order: -1;
  }

  .about-image img {
    min-height: 300px;
  }

  .contact-grid {
    grid-template-columns: 1fr;
    gap: 2.5rem;
  }

  .footer-content {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--primary-dark);
    flex-direction: column;
    padding: 6rem 2rem 2rem;
    gap: 1.5rem;
    transition: right var(--transition);
    box-shadow: -5px 0 20px rgba(0, 0, 0, 0.3);
  }

  .nav-links.open {
    right: 0;
  }

  .nav-cta {
    margin-left: 0;
  }

  .hamburger {
    display: flex;
  }

  .hero-content h1 {
    font-size: clamp(1.8rem, 6vw, 2.5rem);
  }

  .services-grid {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .footer-content {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .section {
    padding: 3.5rem 0;
  }

  .page-hero {
    padding: 8rem 0 3.5rem;
  }
}

@media (max-width: 480px) {
  .hero-buttons {
    flex-direction: column;
    align-items: center;
  }

  .cta-banner .cta-buttons {
    flex-direction: column;
    align-items: center;
  }
}

/* Mobile nav overlay */
.nav-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

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