/* ================================================
   Townsend Septic Inspections — Design System
   ================================================ */

/* ================================================
   0. FONTS
   ================================================ */
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/fonts/bitter-regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Bitter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/fonts/bitter-bold.ttf') format('truetype');
}

/* ================================================
   1. DESIGN TOKENS
   ================================================ */
:root {
  /* --- Colors --- */
  --color-primary:       #1a3a2a;
  --color-primary-light: #e8ede9;
  --color-accent:        #c4882b;
  --color-accent-light:  #fdf6eb;
  --color-text:          #2d2d2d;
  --color-text-light:    #6b6b6b;
  --color-bg:            #f8f6f2;
  --color-surface:       #ffffff;
  --color-error:         #c53030;

  /* --- Spacing (fluid) --- */
  --space-xs: clamp(0.25rem, 0.5vw, 0.5rem);
  --space-s:  clamp(0.5rem, 1vw, 0.75rem);
  --space-m:  clamp(1rem, 2vw, 1.5rem);
  --space-l:  clamp(1.5rem, 3vw, 2.5rem);
  --space-xl: clamp(2rem, 5vw, 4rem);

  /* --- Type scale (fluid) --- */
  --text-sm:   clamp(0.85rem, 0.9vw, 0.925rem);
  --text-base: clamp(1rem, 1.05vw, 1.125rem);
  --text-lg:   clamp(1.15rem, 1.3vw, 1.35rem);
  --text-xl:   clamp(1.5rem, 2.5vw, 2rem);
  --text-2xl:  clamp(2rem, 3.5vw, 3rem);

  /* --- Icon sizes --- */
  --icon-sm:  24px;
  --icon-md:  32px;
  --icon-lg:  40px;
  --icon-xl:  48px;

  /* --- Misc --- */
  --measure:  65ch;
  --radius:   6px;
  --shadow:   0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg: 0 4px 24px rgba(0,0,0,0.12);
}

/* ================================================
   2. RESET & BASE
   ================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.65;
  overflow-x: hidden;
}

img, picture { max-width: 100%; height: auto; display: block; }
a { color: var(--color-primary); transition: color 0.15s; }
a:hover { color: var(--color-accent); }

h1, h2, h3, h4 {
  font-family: 'Bitter', Georgia, serif;
  color: var(--color-primary);
  line-height: 1.25;
}
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); font-weight: 700; }

p { max-width: var(--measure); }
ul, ol { padding-left: 1.5rem; }

/* ================================================
   3. LAYOUT PRIMITIVES
   ================================================ */

/* -- Stack: vertical rhythm ---------------------- */
.stack { display: flex; flex-direction: column; }
.stack > * + * { margin-block-start: var(--space-m); }
.stack--s > * + * { margin-block-start: var(--space-s); }
.stack--l > * + * { margin-block-start: var(--space-l); }

/* -- Cluster: horizontal group that wraps -------- */
.cluster {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
  align-items: center;
}
.cluster--s { gap: var(--space-s); }
.cluster--center { justify-content: center; }

/* -- Sidebar: content + sidebar ------------------ */
.sidebar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-l);
  align-items: center;
}
.sidebar > :first-child { flex: 1 1 0; min-width: 55%; }
.sidebar > :last-child  { flex: 1 1 0; min-width: min(320px, 100%); }
.sidebar img {
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sidebar--flip { flex-direction: row-reverse; }

/* -- Switcher: row ↔ column based on space ------- */
.switcher {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-m);
}
.switcher > * { flex-grow: 1; flex-basis: calc((40rem - 100%) * 999); }

/* -- Grid: auto-fill for cards ------------------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
  gap: var(--space-m);
}
.grid--narrow {
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
}
.grid--photo {
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: var(--space-s);
}
.grid--2col {
  grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr));
}
.grid--3col {
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  justify-content: center;
}
.grid--flex-center {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-m);
}
.grid--flex-center > * {
  flex: 0 1 240px;
}
.grid--flex-center > .card {
  flex: 0 1 300px;
}

/* -- Center: max-width + centering --------------- */
.center {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--space-m);
}
.center--narrow { max-width: 760px; }
.center--text { text-align: center; }
.center--text p { margin-inline: auto; }

/* -- Region: section spacing --------------------- */
.region { padding-block: var(--space-xl); }
.region--compact { padding-block: var(--space-l); }

/* ================================================
   4. COMPONENT BLOCKS (BEM)
   ================================================ */

/* -- Nav ----------------------------------------- */
.nav {
  background: var(--color-primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}
.nav__inner {
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: var(--space-m);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-s);
  height: 64px;
}
.nav__logo {
  color: var(--color-surface);
  text-decoration: none;
  font-family: 'Bitter', Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
}
.nav__logo:hover { color: var(--color-primary-light); }

.nav__links {
  display: flex;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: var(--space-xs);
  align-items: center;
}
.nav__link {
  color: rgba(255,255,255,0.88);
  text-decoration: none;
  font-size: var(--text-sm);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius);
  transition: background 0.15s, color 0.15s;
}
.nav__link:hover { background: rgba(255,255,255,0.12); color: var(--color-surface); }
.nav__link--active { background: rgba(255,255,255,0.16); color: var(--color-surface); }
.nav__link--cta {
  background: var(--color-accent);
  color: var(--color-surface);
  font-weight: 700;
  padding: 0.4rem 1rem;
}
.nav__link--cta:hover { background: #b07a24; color: var(--color-surface); }

.nav__toggle {
  display: none;
  background: none;
  border: 2px solid rgba(255,255,255,0.5);
  color: var(--color-surface);
  font-size: 1.25rem;
  cursor: pointer;
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.nav__phone {
  display: none;
  color: var(--color-surface);
  text-decoration: none;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}

/* -- Hero ---------------------------------------- */
.hero {
  position: relative;
  min-height: 480px;
  display: flex;
  align-items: center;
  background: var(--color-primary);
  color: var(--color-surface);
  text-align: center;
  overflow: hidden;
}
.hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(20,48,20,0.5), rgba(20,48,20,0.7));
}
.hero__content {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin-inline: auto;
  padding: var(--space-xl) var(--space-m);
}
.hero__title {
  color: var(--color-surface);
  margin-bottom: var(--space-s);
  text-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.hero__subtitle {
  font-size: clamp(1.25rem, 1.8vw, 1.5rem);
  opacity: 0.93;
  margin-bottom: var(--space-m);
  max-width: none;
}
.hero__tagline {
  font-size: var(--text-sm);
  font-style: italic;
  opacity: 0.8;
  margin-bottom: var(--space-m);
  max-width: none;
}
.hero--short { min-height: 300px; }

/* -- Buttons ------------------------------------- */
.btn {
  display: inline-block;
  padding: 0.75rem 1.75rem;
  border-radius: var(--radius);
  font-size: var(--text-sm);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  border: none;
  line-height: 1.2;
}
.btn:hover { transform: translateY(-1px); }
.btn--primary {
  background: var(--color-surface);
  color: var(--color-primary);
}
.btn--primary:hover { background: var(--color-primary-light); color: var(--color-primary); }
.btn--accent {
  background: var(--color-accent);
  color: var(--color-surface);
}
.btn--accent:hover { background: #b07a24; color: var(--color-surface); }
.btn--outline {
  background: transparent;
  color: var(--color-surface);
  border: 2px solid var(--color-surface);
}
.btn--outline:hover { background: rgba(255,255,255,0.12); color: var(--color-surface); }
.btn--green {
  background: var(--color-primary);
  color: var(--color-surface);
}
.btn--green:hover { background: #143020; color: var(--color-surface); }
.btn--lg { padding: 0.9rem 2.25rem; font-size: 1rem; }
.btn--full { display: block; width: 100%; text-align: center; }

/* -- Card ---------------------------------------- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card__body {
  padding: var(--space-m);
  text-align: center;
}
.card__icon {
  color: var(--color-accent);
  margin-bottom: var(--space-s);
  line-height: 1;
}
.card__icon svg {
  width: var(--icon-lg);
  height: var(--icon-lg);
}
.card__title { margin-bottom: var(--space-xs); }

/* -- Price box ----------------------------------- */
.price-box {
  background: var(--color-surface);
  border: 2px solid var(--color-primary);
  border-radius: var(--radius);
  padding: var(--space-l);
  max-width: 560px;
  margin-inline: auto;
}
.price-box__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: var(--space-s) 0;
  border-bottom: 1px solid #eee;
}
.price-box__row:last-child { border-bottom: none; }
.price-box__amount {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-accent);
  white-space: nowrap;
}
.price-box__heading {
  font-weight: 700;
  color: var(--color-primary);
  padding-top: var(--space-m);
  margin-top: var(--space-s);
}
.price-box__note {
  padding: var(--space-s) 0;
  font-size: var(--text-sm);
  color: var(--color-text-light);
}

/* -- Steps --------------------------------------- */
.step {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: var(--space-m);
  align-items: start;
}
.step__num {
  width: 52px;
  height: 52px;
  background: var(--color-primary);
  color: var(--color-surface);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Bitter', Georgia, serif;
  font-size: var(--text-lg);
  font-weight: 700;
  flex-shrink: 0;
}
.step__img {
  margin-top: var(--space-m);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  height: auto;
}

/* -- Team card ----------------------------------- */
.team-card {
  text-align: center;
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--space-l) var(--space-m);
  box-shadow: var(--shadow);
}
.team-card__avatar {
  width: 72px;
  height: 72px;
  background: var(--color-primary-light);
  color: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 auto var(--space-s);
  font-family: 'Bitter', Georgia, serif;
}
.team-card__name { font-size: 1rem; margin-bottom: 0.15rem; }
.team-card__role {
  font-size: var(--text-sm);
  color: var(--color-text-light);
}
.team-card__region {
  font-size: var(--text-sm);
  color: var(--color-accent);
  margin-top: var(--space-xs);
}
.team-card__region a { color: var(--color-accent); text-decoration: none; }
.team-card__region a:hover { text-decoration: underline; }

/* -- Contact card -------------------------------- */
.contact-card {
  text-align: center;
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: var(--space-l) var(--space-m);
  min-width: 200px;
}
.contact-card__icon {
  font-size: 2rem;
  margin-bottom: var(--space-s);
  line-height: 1;
  color: var(--color-accent);
}
.contact-card__icon svg {
  width: var(--icon-lg);
  height: var(--icon-lg);
}
.contact-card__label {
  font-size: var(--text-sm);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--color-text-light);
  margin-bottom: var(--space-xs);
}
.contact-card__value {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-primary);
}
.contact-card__value a {
  color: var(--color-primary);
  text-decoration: none;
}
.contact-card__value a:hover { color: var(--color-accent); }
.contact-card__sub {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-xs);
}

/* -- CTA banner ---------------------------------- */
.cta-banner {
  background: var(--color-primary);
  color: var(--color-surface);
  text-align: center;
  padding-block: var(--space-xl);
}
.cta-banner h2 { color: var(--color-surface); }
.cta-banner p {
  opacity: 0.92;
  margin-inline: auto;
  margin-bottom: var(--space-m);
  max-width: none;
}
.cta-banner .contact-card { background: rgba(255,255,255,0.08); }
.cta-banner .contact-card__label { color: rgba(255,255,255,0.65); }
.cta-banner .contact-card__value { color: var(--color-surface); }
.cta-banner .contact-card__value a { color: var(--color-surface); }
.cta-banner .contact-card__sub { color: rgba(255,255,255,0.55); }

/* -- Guarantee ----------------------------------- */
.guarantee {
  display: flex;
  align-items: center;
  gap: var(--space-m);
  background: var(--color-accent-light);
  border-left: 4px solid var(--color-accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: var(--space-m) var(--space-l);
  margin-top: var(--space-m);
}
.guarantee__icon {
  flex-shrink: 0;
  line-height: 1;
  color: var(--color-accent);
}
.guarantee__icon svg {
  width: var(--icon-xl);
  height: var(--icon-xl);
}
.guarantee__text strong { color: var(--color-primary); }
.guarantee__note {
  margin-top: var(--space-m);
  color: var(--color-text-light);
}

/* -- Testimonial --------------------------------- */
.testimonial {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--space-l);
  padding-top: calc(var(--space-l) + 0.5rem);
  margin: 0;
  position: relative;
}
.testimonial::before {
  content: "\201C";
  font-family: 'Bitter', Georgia, serif;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--color-accent);
  position: absolute;
  top: var(--space-s);
  left: var(--space-m);
  opacity: 0.35;
}
.testimonial__text {
  font-style: italic;
  color: var(--color-text);
  font-size: var(--text-sm);
  line-height: 1.7;
  max-width: none;
}
.testimonial__cite {
  display: block;
  margin-top: var(--space-m);
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-primary);
  font-style: normal;
}
.testimonial__loc {
  display: block;
  font-weight: 400;
  color: var(--color-text-light);
  font-size: 0.8rem;
}

/* -- Form ---------------------------------------- */
.form { max-width: 600px; margin-inline: auto; }
.form__group { margin-bottom: var(--space-m); }
.form__label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: var(--space-xs);
}
.form__input,
.form__select,
.form__textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid #ccc;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color 0.15s;
}
.form__input:focus,
.form__select:focus,
.form__textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,58,42,0.1);
}
.form__textarea { resize: vertical; min-height: 120px; }
.form__row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-m);
}
.form__error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
  border-radius: var(--radius);
  padding: var(--space-s) var(--space-m);
  font-size: var(--text-sm);
  margin-bottom: var(--space-m);
}
.form__hint {
  font-size: var(--text-sm);
  color: var(--color-text-light);
  margin-top: var(--space-m);
  text-align: center;
}

/* -- FAQ (details/summary) ----------------------- */
.faq__item {
  border-bottom: 1px solid var(--color-primary-light);
}
.faq__item:first-of-type {
  margin-top: var(--space-m);
}
.faq__question {
  display: block;
  width: 100%;
  padding: var(--space-m) 0;
  font-family: 'Bitter', Georgia, serif;
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
  list-style: none;
}
.faq__question::-webkit-details-marker { display: none; }
.faq__question::before {
  content: '+';
  display: inline-block;
  width: 1.5em;
  font-family: system-ui, sans-serif;
  font-weight: 400;
  color: var(--color-accent);
}
details[open] > .faq__question::before { content: '\2212'; }
details[open] > .faq__question { padding-bottom: var(--space-xs); }
.faq__answer {
  padding: 0 0 var(--space-m) 1.5em;
  color: var(--color-text-light);
}
.faq__answer p { max-width: var(--measure); }

/* -- County grid --------------------------------- */
.county-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr));
  gap: var(--space-xs);
  list-style: none;
  padding: 0;
}
.county-grid__item {
  background: var(--color-primary-light);
  border-radius: var(--radius);
  padding: var(--space-xs) var(--space-s);
  font-size: var(--text-sm);
  color: var(--color-primary);
}
.county-grid__note {
  text-align: center;
  margin-top: var(--space-m);
  color: var(--color-text-light);
  font-size: var(--text-sm);
}

/* -- Photo grid ---------------------------------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr));
  gap: var(--space-s);
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  border-radius: var(--radius);
}

/* -- Section intro ------------------------------- */
.section-intro {
  text-align: center;
  max-width: 680px;
  margin-inline: auto;
  margin-bottom: var(--space-l);
}
.section-intro p {
  font-size: var(--text-base);
  color: var(--color-text-light);
  margin-inline: auto;
}

/* -- Background modifiers ------------------------ */
.bg--alt { background: var(--color-primary-light); }
.bg--warm { background: var(--color-accent-light); }
.bg--dark {
  background: var(--color-primary);
  color: var(--color-surface);
}
.bg--dark h2, .bg--dark h3 { color: var(--color-surface); }

/* -- Footer -------------------------------------- */
.footer {
  background: #0f261a;
  color: rgba(255,255,255,0.85);
  padding: var(--space-xl) 0 var(--space-m);
}
.footer__grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: var(--space-l);
  margin-bottom: var(--space-l);
}
.footer h4 {
  color: var(--color-surface);
  margin-bottom: var(--space-s);
  font-size: 1rem;
}
.footer p, .footer li {
  font-size: var(--text-sm);
}
.footer a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
}
.footer a:hover { color: var(--color-surface); text-decoration: underline; }
.footer p + p { margin-top: var(--space-s); }
.footer ul { list-style: none; padding: 0; }
.footer li { margin-bottom: var(--space-xs); }
.footer__bottom {
  border-top: 1px solid rgba(255,255,255,0.12);
  padding-top: var(--space-m);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-s);
  font-size: var(--text-sm);
  opacity: 0.6;
}

/* ================================================
   5. UTILITIES
   ================================================ */
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-center { text-align: center; }
.flow > * + * { margin-block-start: var(--flow-space, 1em); }

/* ================================================
   6. RESPONSIVE (nav collapse only)
   ================================================ */
@media (max-width: 768px) {
  .nav__toggle { display: flex; }
  .nav__phone { display: block; }
  .nav__links {
    display: none;
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    background: var(--color-primary);
    flex-direction: column;
    align-items: stretch;
    padding: var(--space-m);
    gap: var(--space-xs);
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    border-top: 1px solid rgba(255,255,255,0.1);
  }
  .nav__links--open { display: flex; }
  .nav__link {
    padding: 0.65rem var(--space-m);
    display: block;
    width: 100%;
    text-align: left;
  }

  .hero__img { object-position: center 30%; }
  .hero__content { padding-bottom: calc(var(--space-xl) + var(--space-m)); }
  .sidebar { flex-direction: column; }
  .sidebar--flip { flex-direction: column; }
  .footer__grid { grid-template-columns: 1fr; gap: var(--space-m); }
  .form__row { grid-template-columns: 1fr; }
}
