/*
 * Style sheet for Peace and Purity Cleaning website
 *
 * This file defines the typography, colour palette and responsive
 * layout rules used throughout the site. The design is based on the
 * colours from the company logo (deep blue and light blue) and aims
 * to provide a clean, modern look that works well on both desktop
 * and mobile devices. Whenever possible the CSS uses relative units
 * and flexbox to ensure the layout adapts gracefully to different
 * screen sizes. Comments are included to document the purpose of
 * each section.
 */

/* Colour palette derived from the company logo */
:root {
  /* Legacy palette (retained for backward compatibility) */
  --primary-color: #0a4c7b;
  --secondary-color: #eaf3fb;
  --accent-color: #0f609b;
  --text-color: #333333;
  --light-text: #ffffff;
  /* Brand palette matching flyer: medium sky blues and dark accents */
  --pp-medium-blue: #2C6FAB;
  --pp-light-blue: #CFE8F6;
  --pp-dark-blue: #1A3E6E;
  --pp-white: #FFFFFF;

  /* Gradient definitions for hero backgrounds, soft headings and buttons */
  --pp-grad-hero: linear-gradient(180deg, var(--pp-light-blue) 0%, var(--pp-medium-blue) 100%);
  --pp-grad-soft: linear-gradient(135deg, var(--pp-white) 0%, var(--pp-light-blue) 100%);
  --pp-grad-btn: linear-gradient(90deg, var(--pp-medium-blue), var(--pp-dark-blue));

  --border-radius: 8px;
  --transition-fast: 0.2s ease-in-out;
  /* Light tertiary colour used for alternating section backgrounds */
  --tertiary-color: #f4f8fd;
}

/*
 * Global overflow and sizing safety for mobile
 * These rules ensure no element forces horizontal scroll or zoom on phones.
 */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*, *::before, *::after {
  box-sizing: border-box;
}

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

h1, h2, h3, p {
  overflow-wrap: anywhere;
}

.container {
  width: min(100%, 1200px);
  margin: 0 auto;
  padding-inline: 16px;
}

/* Import a clean, modern sans serif font */
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@300;400;500;600;700&display=swap');

body {
  margin: 0;
  font-family: 'Montserrat', sans-serif;
  background-color: var(--secondary-color);
  color: var(--text-color);
  line-height: 1.6;
}

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

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

/* Utility classes */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem;
}

.btn {
  display: inline-block;
  background: var(--pp-grad-btn);
  color: var(--pp-white);
  border: none;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(44, 111, 171, 0.15);
  transition: all 0.25s ease;
}

.btn:hover {
  background: var(--pp-medium-blue);
}

/* Top bar with contact information and service area */
.top-bar {
  /* Use brand medium blue for top bar background and white text */
  background: var(--pp-medium-blue);
  color: var(--pp-white);
  font-size: 0.875rem;
  padding: 0.5rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.top-bar a {
  color: var(--light-text);
  text-decoration: underline;
}

/* Main header containing logo, company name and navigation */
.main-header {
  background-color: #ffffff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #dbe5ef;
  position: sticky;
  top: 0;
  z-index: 100;
}

.main-header img {
  /* Enlarge logo for better visibility */
  height: 65px;
  width: auto;
}

.site-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
  margin-left: 0.5rem;
}

/* Hamburger icon for mobile navigation */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  cursor: pointer;
  width: 25px;
  height: 25px;
}

.hamburger span {
  height: 3px;
  background-color: var(--primary-color);
  margin: 4px 0;
  width: 100%;
  transition: transform var(--transition-fast);
}

/* Navigation menu */
.nav {
  display: none;
  flex-direction: column;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: #ffffff;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
  border-radius: var(--border-radius);
  overflow: hidden;
}

.nav a {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #dbe5ef;
  font-weight: 500;
  color: var(--primary-color);
}

.nav a:last-child {
  border-bottom: none;
}

/* Remove large screen override so that navigation always appears in a dropdown triggered by the hamburger */

/* Ensure dropdown menu has minimum width and white space is preserved for longer labels */
.nav {
  min-width: 180px;
  white-space: nowrap;
}

/* Hero sections */
.hero {
  /* Brand gradient for hero section (light to medium blue) */
  background: var(--pp-grad-hero);
  color: var(--pp-dark-blue);
  padding: 4rem 1rem;
  text-align: center;
}

.hero h1 {
  margin-top: 0;
  font-size: 2.5rem;
  font-weight: 700;
  /* Heading colour uses our darkest blue to maximise contrast on the hero */
  color: var(--pp-dark-blue);
}

.hero p {
  margin-bottom: 1.5rem;
  font-size: 1rem;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
  color: var(--pp-dark-blue);
}

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

/* Section styles */
section {
  padding: 2rem 0;
}

/* Alternate section background colours (excluding heroes) for visual interest */
section:not(.hero):nth-of-type(even) {
  background-color: var(--tertiary-color);
}

section h2 {
  text-align: center;
  color: var(--primary-color);
  margin-bottom: 1rem;
  font-size: 1.75rem;
}

/* Section title styling for major headings. Applies a soft gradient and
   underline accent reminiscent of the brand flyer. Use this class on
   headings such as About Us, Our Services, Subscription Plans, etc. */
.section-title {
  font-size: 2rem;
  font-weight: 700;
  text-align: center;
  background: var(--pp-grad-soft);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 1.5rem;
  position: relative;
}

.section-title::after {
  content: "";
  display: block;
  height: 3px;
  width: 80px;
  margin: 0.5rem auto 0;
  background: var(--pp-grad-soft);
  border-radius: 999px;
}

/* Card and box styling */
.card {
  /* White card with subtle shadow and rounded corners matching flyer */
  background: var(--pp-white);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(44, 111, 171, 0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card h3 {
  margin-top: 0;
  color: var(--pp-dark-blue);
}

.card p {
  flex-grow: 1;
}

.card .learn-more {
  margin-top: 1rem;
  align-self: flex-start;
  font-weight: 600;
  color: var(--pp-medium-blue);
}

.cards {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Subtle hover effect for cards to give a sense of depth */
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 28px rgba(44, 111, 171, 0.15);
  transition: all 0.25s ease;
}

/*
 * 1) Section wrappers to control title contrast
 *    Use .section--light for light backgrounds and .section--dark for dark or gradient backgrounds.
 */
.section--light .section-title {
  /* Light backgrounds (e.g., About Us area) */
  color: var(--pp-dark-blue);
  background: none !important;
  -webkit-background-clip: initial;
  background-clip: initial;
  text-shadow: none;
}

.section--dark .section-title {
  /* Dark/medium backgrounds (e.g., hero or dark gradients) */
  color: var(--pp-white);
  text-shadow: 0 1px 3px rgba(26, 62, 110, 0.35);
}

/* If you want gradient text on dark sections, use this helper class */
.title-gradient {
  background: var(--pp-grad-soft);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 1px 3px rgba(26, 62, 110, 0.25);
}

/*
 * 2) Optional: add a soft overlay to hero for extra contrast
 *    Make hero relative and overlay pseudo-element to improve readability.
 */
.hero {
  position: relative;
  background: var(--pp-grad-hero);
  color: var(--pp-dark-blue);
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.05) 40%,
    rgba(26, 62, 110, 0.10) 100%
  );
  pointer-events: none;
}

.hero > * {
  position: relative;
}

/*
 * Mobile-only adjustments
 * These styles only apply to screens up to 480px wide to ensure
 * content fits naturally without requiring pinch zoom or horizontal scrolling.
 */
@media (max-width: 480px) {
  /* Tighten header so it doesn't exceed viewport width */
  .main-header {
    padding: 10px 12px;
  }
  .site-title {
    font-size: 1.6rem;
    line-height: 1.2;
  }
  .main-header img {
    width: 44px;
    height: auto;
  }

  /* Hero spacing/typography so it fits on first paint */
  .hero {
    padding: 28px 16px;
  }
  .hero h1 {
    font-size: 1.8rem;
    line-height: 1.2;
    margin-bottom: 10px;
  }
  .hero p {
    font-size: 1rem;
  }

  /* Buttons: avoid fixed widths that cause overflow */
  .btn {
    width: 100%;
    max-width: 320px;
    margin: 8px auto;
    display: block;
  }

  /* Cards contain themselves on small screens */
  .card {
    margin-inline: auto;
  }

  /* Expand navigation to full width on mobile to prevent overflow */
  .nav {
    min-width: 0;
    width: 100%;
  }
}

@media (min-width: 768px) {
  .cards {
    flex-direction: row;
  }
}

/* Testimonials section */
.testimonial {
  background-color: #ffffff;
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.testimonial p {
  font-style: italic;
}

.testimonial cite {
  display: block;
  margin-top: 0.5rem;
  font-weight: 600;
  color: var(--primary-color);
}

.testimonials {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .testimonials {
    flex-direction: row;
  }
}

/* Gallery grid */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.gallery-grid img {
  width: 100%;
  height: 150px;
  object-fit: cover;
  border-radius: var(--border-radius);
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: var(--light-text);
  padding: 2rem 1rem;
}

footer .footer-container {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

footer h4 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  color: var(--light-text);
}

footer p, footer a {
  font-size: 0.875rem;
  color: var(--light-text);
}

footer a {
  text-decoration: underline;
}

@media (min-width: 768px) {
  footer .footer-container {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Blog styles */
.blog-post {
  margin-bottom: 3rem;
}

.blog-post h3 {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.blog-post p,
.blog-post ul {
  margin-bottom: 1rem;
  line-height: 1.5;
}

.blog-images {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.blog-images img {
  flex: 1 1 200px;
  height: 200px;
  object-fit: cover;
  border-radius: var(--border-radius);
}

/* FAQ accordion for Help page */
.faq-item {
  background-color: #ffffff;
  border-radius: var(--border-radius);
  margin-bottom: 1rem;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.faq-question {
  padding: 1rem;
  cursor: pointer;
  position: relative;
  font-weight: 600;
  color: var(--primary-color);
}

.faq-question::after {
  content: '+';
  position: absolute;
  right: 1rem;
  font-size: 1.5rem;
  line-height: 1;
}

.faq-item.active .faq-question::after {
  content: '–';
}

.faq-answer {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-fast);
  padding: 0 1rem;
}

.faq-item.active .faq-answer {
  max-height: 500px; /* large enough to fit content */
  padding-bottom: 1rem;
}

/* Estimate table */
.estimate-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
}

.estimate-table th,
.estimate-table td {
  border: 1px solid #dbe5ef;
  padding: 0.5rem;
  text-align: left;
}

.estimate-table th {
  background-color: var(--primary-color);
  color: var(--light-text);
  font-weight: 600;
}

.estimate-totals {
  background-color: #ffffff;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  padding: 1rem;
}

.estimate-totals p {
  margin: 0.5rem 0;
  font-weight: 500;
}

.estimate-totals span {
  float: right;
}

/* Responsive table on small screens */
@media (max-width: 600px) {
  .estimate-table th, .estimate-table td {
    font-size: 0.75rem;
  }
}

/* Reveal animations for scroll-based pop up sections */
.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: opacity 0.6s ease-out, transform 0.6s ease-out;
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Quote form grid layout */
.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.form-grid label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  padding: 0.5rem;
  border-radius: var(--border-radius);
  border: 1px solid #dbe5ef;
  font-family: inherit;
  resize: vertical;
}

@media (min-width: 768px) {
  .form-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .form-grid .full-width {
    grid-column: span 2;
  }
}