/* Headwaters Waterworks
 *
 * Warm, light, and quiet, so the photographs carry the page. The palette
 * is taken from the job site: paper-white and dust for the page, asphalt
 * for type, work-zone orange (black on orange, like a job-site sign) for
 * the emergency line only, and safety amber for the things you press.
 * Headings are Barlow Semi Condensed, a face drawn from highway signage.
 * Photos sit to one side of each section and dissolve into the page
 * before they reach the text.
 */

@font-face { font-family: "Barlow"; src: url(/fonts/barlow-400.a1a45de2.woff2) format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow"; src: url(/fonts/barlow-600.7f4d31d8.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Barlow Semi Condensed"; src: url(/fonts/barlow-semi-condensed-600.cafc79c0.woff2) format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
/* metric-matched fallbacks, so the swap to the web font does not move text */
@font-face { font-family: "Barlow Fallback"; src: local("Arial"), local("Liberation Sans"), local("Helvetica"); size-adjust: 90%; ascent-override: 111%; descent-override: 22%; line-gap-override: 0%; }
@font-face { font-family: "Barlow SC Fallback"; src: local("Arial Narrow"), local("Liberation Sans Narrow"), local("Arial"), local("Liberation Sans"); size-adjust: 88%; ascent-override: 113%; descent-override: 23%; line-gap-override: 0%; }

:root {
  --paper:    #FFFDF8;
  --dust:     #F6EFE6;
  --rule:     #E5DACB;
  --field:    #CDBFAD;
  --ink:      #221D18;
  --muted:    #6B5747;
  --workzone: #F47B20;
  --amber:    #FFB81C;
  --amber-hi: #FFC94D;
  --error:    #A8321B;

  --body:    "Barlow", "Barlow Fallback", "Segoe UI", system-ui, sans-serif;
  --display: "Barlow Semi Condensed", "Barlow SC Fallback", "Barlow", "Segoe UI", system-ui, sans-serif;

  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 62ch;
  --strip-h: 2.75rem;
  --nav-h: 3.75rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--strip-h) + var(--nav-h) + 1rem); }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--display); font-weight: 600; margin: 0; line-height: 1.1; letter-spacing: -0.005em; }
p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.2em; }
strong { font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; }

:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.wrap { width: 100%; max-width: 76rem; margin: 0 auto; padding: 0 var(--gutter); }

.skip { position: absolute; left: 1rem; top: -4rem; z-index: 100; background: var(--ink); color: var(--paper); padding: 0.5rem 1rem; }
.skip:focus { top: 0.5rem; }

/* ---------- the emergency strip: always on screen ---------- */

.emergency {
  position: sticky; top: 0; z-index: 30;
  background: var(--workzone); color: var(--ink);
  font-family: var(--display); font-weight: 600;
}
.emergency-inner { min-height: var(--strip-h); display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.emergency-line { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 0.75rem; }
.emergency-label { font-size: 1rem; }
.emergency-phone { font-size: 1.3rem; letter-spacing: 0.01em; text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.18em; white-space: nowrap; }
.emergency-phone:hover { text-decoration-thickness: 3px; }
.emergency-office { font-size: 0.95rem; white-space: nowrap; }
.emergency-office a { text-decoration: none; }
.emergency-office a:hover { text-decoration: underline; }

/* ---------- navigation ---------- */

.nav { background: var(--paper); border-bottom: 1px solid var(--rule); position: relative; z-index: 20; }
@media (min-width: 900px) { .nav { position: sticky; top: var(--strip-h); } }
.nav-inner { min-height: var(--nav-h); display: flex; align-items: center; gap: 2rem; }
.brand { display: flex; align-items: baseline; gap: 0.7rem; font-family: var(--display); font-weight: 600; font-size: 1.35rem; text-decoration: none; white-space: nowrap; margin-right: auto; }
/* "Established 2002" sits right after the name, like the line under a nameplate */
.brand-est, .footer-est {
  font-family: var(--body); font-weight: 600; font-size: 0.72rem; letter-spacing: 0.09em; text-transform: uppercase;
  color: var(--muted); padding-left: 0.7rem; border-left: 1px solid var(--field);
}
.nav-links { display: flex; gap: 1.6rem; font-size: 0.98rem; }
.nav-links a { text-decoration: none; color: var(--muted); }
.nav-links a:hover { color: var(--ink); text-decoration: underline; }
@media (max-width: 899px) { .nav-links { display: none; } }

/* ---------- buttons ---------- */

.button {
  display: inline-block; border: 0; border-radius: 3px; cursor: pointer;
  background: var(--amber); color: var(--ink);
  font-family: var(--display); font-weight: 600; font-size: 1.08rem; line-height: 1.2;
  padding: 0.8rem 1.35rem; text-decoration: none;
  box-shadow: inset 0 -2px 0 rgba(34, 29, 24, 0.18);
}
.button:hover { background: var(--amber-hi); }
.button:active { transform: translateY(1px); }
.button[disabled] { opacity: 0.6; cursor: default; }
.button-quiet { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink); }
.button-quiet:hover { background: rgba(34, 29, 24, 0.06); }
.button-small { font-size: 0.98rem; padding: 0.55rem 1rem; }

/* ---------- photos: one side of a section, dissolving toward the text ---------- */

.photo { position: absolute; top: 0; bottom: 0; right: 0; width: 56%; z-index: 0; pointer-events: none; overflow: hidden; }
.photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.photo, .svc-right .photo {
  -webkit-mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 24%, #000 52%);
          mask-image: linear-gradient(to right, transparent 0%, rgba(0, 0, 0, 0.55) 24%, #000 52%);
}
.svc-left .photo {
  right: auto; left: 0;
  -webkit-mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.55) 24%, #000 52%);
          mask-image: linear-gradient(to left, transparent 0%, rgba(0, 0, 0, 0.55) 24%, #000 52%);
}
/* no photo yet: a faint survey-contour plate keeps the composition; the
 * service groups get a line drawing of their own work instead */
.photo-fallback { background: url(/assets/contours.svg) center / cover no-repeat; opacity: 0.6; }
.photo-chlorination.photo-fallback { background-image: url(/assets/plate-chlorination.svg); opacity: 0.75; }
.photo-prv.photo-fallback          { background-image: url(/assets/plate-prv.svg); opacity: 0.75; }
.photo-agriculture.photo-fallback  { background-image: url(/assets/plate-agriculture.svg); opacity: 0.75; }
/* keep the detailed side of a drawing on the side that stays visible */
.svc-left .photo-fallback { background-position: left center; }
.svc-right .photo-fallback { background-position: right center; }

/* where each photo's subject sits */
.photo-hero img      { object-position: 70% 55%; }
.photo-utilities img { object-position: 55% 45%; }

/* ---------- hero ---------- */

.hero { position: relative; overflow: hidden; border-bottom: 1px solid var(--rule); }
.hero .photo { width: 62%; }
.hero-inner { position: relative; z-index: 1; padding-top: clamp(4rem, 10vh, 7rem); padding-bottom: clamp(4rem, 11vh, 7.5rem); }
.hero h1 { font-size: clamp(2.5rem, 5vw, 4.25rem); line-height: 1.02; letter-spacing: -0.015em; max-width: 12.5ch; text-wrap: balance; }
.hero-sub { margin-top: 1.4rem; max-width: 33rem; font-size: clamp(1.05rem, 1.35vw, 1.2rem); color: #3d342c; }
.hero-actions { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.9rem; }
.hero-facts { margin-top: 2.2rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem; font-family: var(--display); font-weight: 600; font-size: 1.12rem; }
.hero-facts li { position: relative; padding-left: 1.05rem; }
.hero-facts li::before { content: ""; position: absolute; left: 0; top: 0.42em; width: 0.5rem; height: 0.5rem; background: var(--amber); }
.hero-license { margin-top: 0.6rem; font-size: 0.92rem; color: var(--muted); }
.hero-license strong { color: var(--ink); }

/* ---------- sections ---------- */

section { position: relative; }
h2 { font-size: clamp(2rem, 3.4vw, 2.85rem); }
.lede { margin-top: 1rem; max-width: var(--measure); font-size: 1.12rem; color: #3d342c; }

.services { padding-top: clamp(4rem, 8vw, 6.5rem); }
.services-head { padding-bottom: 1rem; }

.svc-group { position: relative; overflow: hidden; }
.svc-inner { position: relative; z-index: 1; display: flex; }
.svc-text { width: min(100%, 34rem); padding: clamp(3rem, 6vw, 5rem) 0; }
.svc-left .svc-inner { justify-content: flex-end; }
.svc-text h3 { font-size: 1.85rem; }
.svc-note { margin-top: 0.4rem; color: var(--muted); }
.svc-list { margin-top: 1.6rem; border-top: 1px solid var(--rule); }
.service { padding: 1rem 0 1.1rem; border-bottom: 1px solid var(--rule); }
.service-name { font-size: 1.22rem; }
.service-summary { margin-top: 0.3rem; max-width: 58ch; color: #3d342c; }

.backflow, .contact { background: var(--dust); }
.backflow, .software, .contact { padding: clamp(4rem, 8vw, 6.5rem) 0; border-top: 1px solid var(--rule); }

.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: start; position: relative; z-index: 1; }

/* prices read like a sign plate */
.price { margin-top: 1rem; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.4rem 0.75rem; }
.price-amount { font-family: var(--display); font-weight: 600; font-size: 2.4rem; line-height: 1; background: var(--amber); padding: 0.18em 0.32em 0.12em; border-radius: 3px; }
.price-unit { color: var(--muted); font-size: 1.02rem; }

/* the backflow process is a real sequence, so it is numbered */
.steps { margin-top: 2rem; counter-reset: step; display: grid; gap: 1.25rem; }
.steps li { counter-increment: step; display: grid; grid-template-columns: 2.3rem 1fr; column-gap: 0.9rem; }
.steps li::before {
  content: counter(step); grid-row: span 2;
  width: 2.3rem; height: 2.3rem; display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 1.15rem;
  border: 1.5px solid var(--ink); border-radius: 50%;
}
.steps h3 { font-size: 1.2rem; padding-top: 0.35rem; }
.steps p { color: #3d342c; margin-top: 0.15rem; }

.features { margin-top: 1.8rem; display: grid; gap: 0.6rem; }
.features li { position: relative; padding-left: 1.4rem; }
.features li::before { content: ""; position: absolute; left: 0; top: 0.55em; width: 0.55rem; height: 0.55rem; background: var(--workzone); }
.requirements { margin-top: 1.8rem; padding: 0.75rem 1rem; background: var(--dust); border-left: 3px solid var(--amber); border-radius: 0 3px 3px 0; }
.requirements-label { font-family: var(--display); font-weight: 600; margin-right: 0.2rem; }

/* ---------- video ---------- */

.video { margin-top: 1.8rem; }
.video-frame {
  position: relative; aspect-ratio: 16 / 9; border-radius: 4px; overflow: hidden;
  background:
    linear-gradient(160deg, rgba(255, 184, 28, 0.22), rgba(255, 184, 28, 0) 55%),
    linear-gradient(180deg, #3a3029 0%, #221D18 100%);
}
.video-frame video { display: block; width: 100%; height: 100%; background: #000; }
.video-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* the poster is a title card with its words on the left: keep the button off them */
.has-poster .video-play { justify-items: end; padding-right: 9%; }
.has-poster .video-frame { background: var(--dust); }
.video-play { position: absolute; inset: 0; width: 100%; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; }
.video-glyph { width: 4.25rem; height: 4.25rem; border-radius: 50%; background: var(--amber); position: relative; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25); }
.video-glyph::after { content: ""; position: absolute; left: 1.7rem; top: 1.3rem; border-style: solid; border-width: 0.82rem 0 0.82rem 1.3rem; border-color: transparent transparent transparent var(--ink); }
.video-play:hover .video-glyph { background: var(--amber-hi); }
.video-play:focus-visible { outline-offset: -6px; outline-color: var(--amber); }
.video-soon { position: absolute; inset: 0; display: grid; place-items: center; color: var(--dust); font-family: var(--display); font-weight: 600; font-size: 1.15rem; }
.video-caption { margin-top: 0.55rem; font-size: 0.95rem; color: var(--muted); }

/* ---------- forms ---------- */

.form {
  background: #fff; border: 1px solid var(--rule); border-radius: 4px;
  padding: clamp(1.25rem, 3vw, 2rem); display: grid; gap: 1.1rem;
}
.software .form { background: var(--dust); }
.form-title { font-size: 1.55rem; }
.field { display: grid; gap: 0.35rem; min-width: 0; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.field-short { max-width: 9rem; }
label { font-family: var(--display); font-weight: 600; font-size: 1rem; }
.optional { font-family: var(--body); font-weight: 400; color: var(--muted); font-size: 0.9rem; margin-left: 0.25rem; }
input[type="text"], input[type="email"], input[type="tel"], input[type="number"], select, textarea {
  width: 100%; padding: 0.68rem 0.8rem; border: 1px solid var(--field); border-radius: 3px; background: #fff;
}
textarea { resize: vertical; min-height: 5.5rem; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(255, 184, 28, 0.55); }
::placeholder { color: #9b8b7c; }
.field.invalid input, .field.invalid select, .field.invalid textarea { border-color: var(--error); }
.field-error { color: var(--error); font-size: 0.92rem; }
.field-error:empty { display: none; }
.check { display: flex; gap: 0.6rem; align-items: flex-start; font-family: var(--body); font-weight: 400; cursor: pointer; }
.check input { width: 1.15rem; height: 1.15rem; margin: 0.2rem 0 0; flex: none; accent-color: var(--ink); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.order-total { display: flex; align-items: baseline; gap: 0.7rem; font-family: var(--display); font-weight: 600; font-size: 1.1rem; border-top: 1px solid var(--rule); padding-top: 1rem; }
.order-amount { font-size: 1.7rem; }
.form-actions { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.form-status { color: var(--muted); }
.form-status.error { color: var(--error); }
.form-done { background: #fff; border: 1px solid var(--rule); border-left: 4px solid var(--amber); border-radius: 4px; padding: 1.75rem 2rem; display: grid; gap: 0.75rem; }
.form-done:focus { outline: none; }
/* author display rules (grid, flex) would otherwise beat the hidden attribute */
[hidden] { display: none !important; }
.form-done h3 { font-size: 1.6rem; }
.done-amount strong { font-family: var(--display); font-size: 1.35rem; }

/* ---------- contact ---------- */

.contact { overflow: hidden; }
.contact .photo { width: 50%; opacity: 0.9; }
.contacts { margin-top: 1.8rem; display: grid; gap: 1.4rem; }
.contact-item { padding-left: 1rem; border-left: 3px solid var(--rule); }
.contact-emergency { border-left-color: var(--workzone); }
.contact-item dt { font-family: var(--display); font-weight: 600; color: var(--muted); font-size: 1rem; }
.contact-name { color: var(--ink); margin-left: 0.25rem; }
.contact-name:empty { display: none; }
.contact-item dd + dd { margin-top: 0.1rem; }
.contact-phone { font-family: var(--display); font-weight: 600; font-size: 1.65rem; text-decoration: none; }
.contact-phone:hover { text-decoration: underline; }
.contact-meta { margin-top: 2rem; color: var(--muted); }

/* ---------- footer ---------- */

.footer { border-top: 1px solid var(--rule); padding: 2.5rem 0 3rem; font-size: 0.92rem; color: var(--muted); }
.footer-inner { display: grid; gap: 0.4rem; }
.footer-name { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.7rem; font-family: var(--display); font-weight: 600; font-size: 1.15rem; color: var(--ink); }
.footer-est { font-size: 0.68rem; }
.footer strong { color: var(--ink); }

/* ---------- small screens: photos become a band above the text ---------- */

@media (max-width: 760px) {
  :root { --strip-h: 3rem; }
  .emergency-office, .emergency-hours { display: none; }
  .emergency-phone { font-size: 1.35rem; }
  .photo, .hero .photo, .contact .photo {
    position: relative; width: 100%; height: 13.5rem;
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
            mask-image: linear-gradient(to bottom, #000 55%, transparent 100%);
  }
  .svc-left .photo { -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); mask-image: linear-gradient(to bottom, #000 55%, transparent 100%); }
  .hero .photo { height: 15rem; }
  .hero-inner { padding-top: 1rem; padding-bottom: 3.5rem; }
  .svc-text { padding: 0.5rem 0 3rem; }
  .two-col, .field-row { grid-template-columns: 1fr; }
  .contact .photo { display: none; }
  .nav-inner { gap: 1rem; }
  .brand { font-size: 1.2rem; flex-direction: column; align-items: flex-start; gap: 0.1rem; line-height: 1.1; }
  .brand-est { font-size: 0.64rem; padding-left: 0; border-left: 0; }
}
