/*
  base.css: design tokens and shared building blocks for the whole page.
  Every section stylesheet builds on these; nothing here is specific to one section.

  Brand: taken from aCquatica's own logo and crew shirts (navy and aqua) and
  from the pale stone decks around the pools in their photos.
  Tone: clear, calm, dependable. Not flashy, not salesy, not cartoon-tropical.
  Type: Instrument Serif for headlines (its italic echoes the italic wordmark
  in their logo) and Instrument Sans for everything else.
  Motion: most of the wow is the moving pool-floor light (src/scripts/water.js).
  Every section is fully readable without motion; scroll effects only start
  when <html> has the "motion-ready" class (set by src/scripts/base.js).
*/

:root {
  /* Colors */
  --deck: #f4f1ea;          /* page background: pale pool-deck stone */
  --white: #ffffff;         /* photo frames and quote cards on the deck */
  --ink: #0d2138;           /* body text on light (14.4:1 on deck) */
  --muted: #4e5d6e;         /* secondary text on light (6:1 on deck) */
  --line: #d9d2c4;          /* hairlines on light */
  --navy: #123d73;          /* logo navy: links and buttons on light (9.6:1 on deck) */
  --deep: #062a4d;          /* deep water: header, hero panel, contact */
  --abyss: #041d36;         /* footer */
  --aqua: #3ec6e0;          /* logo aqua: the one accent (buttons and marks on dark) */
  --aqua-ink: #0f6f8c;      /* the same aqua, dark enough for text on light (5:1 on deck) */
  --on-deep: #f1f8fb;       /* text on deep and over the moving water light (5.7:1 at its brightest) */
  --on-deep-muted: #a8c4d8; /* secondary text on solid deep only (8:1), never over the moving light */

  /* Type */
  --font-display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --font-body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --fs-sm: 0.875rem;
  --fs-body: 1.0625rem;
  --fs-lead: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
  --fs-h3: clamp(1.75rem, 1.35rem + 1.6vw, 2.5rem);
  --fs-h2: clamp(2.6rem, 1.7rem + 3.8vw, 5rem);
  --fs-display: clamp(2.9rem, 1.9rem + 4.6vw, 6rem);

  /* Spacing scale (4 to 128) */
  --s1: 4px;  --s2: 8px;  --s3: 12px; --s4: 16px; --s5: 24px;
  --s6: 32px; --s7: 48px; --s8: 64px; --s9: 96px; --s10: 128px;

  --radius: 18px;          /* one radius, soft like a pool's rounded corners */
  --container: 1200px;
  --gutter: var(--s4);
  --header-h: 64px;
  /* No shadow style: surfaces are separated by color, not depth. */

  --focus: var(--navy);    /* dark sections switch it to aqua */
}

@media (min-width: 640px) { :root { --gutter: var(--s5); } }
@media (min-width: 1024px) { :root { --gutter: var(--s7); --fs-body: 1.125rem; --header-h: 72px; } }

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  background: var(--deck);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
/* Something wider than the screen must never let a phone zoom out or scroll
   sideways. "clip" on main (not body, whose value goes to the viewport) keeps
   position: sticky working, which "hidden" would break. */
main { overflow-x: clip; }
img, canvas { display: block; max-width: 100%; }
img { height: auto; }
input, select, textarea, button { font: inherit; color: inherit; }
:where(ul[class], ol[class]) { list-style: none; padding: 0; }

/* Lenis smooth scrolling (rules from the Lenis package). Lenis does the
   smoothing itself, so the browser's own smooth scrolling is switched off. */
html.lenis, html.lenis body { height: auto; scroll-behavior: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* Sections are reached from header links; keep their tops clear of the sticky header. */
[id] { scroll-margin-top: calc(var(--header-h) + var(--s4)); }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); line-height: 1.08; }
h1 em, h2 em, h3 em { font-style: italic; }
p { text-wrap: pretty; }

a { color: var(--navy); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Screen-reader-only text */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Buttons: 52px tall for thumbs. Every button sits on deep blue, so there is one style: aqua. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 52px;
  padding: var(--s3) var(--s5);
  border: 2px solid transparent;
  border-radius: var(--radius);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-aqua { background: var(--aqua); color: var(--deep); }
.btn-aqua:hover { background: var(--on-deep); }

/* Five-star row next to the real Google rating; color comes from the section. */
.stars { display: inline-flex; gap: 2px; color: var(--aqua); }
.stars svg { width: 18px; height: 18px; fill: currentColor; }

/* Their wordmark, set in type: lowercase a, capital C, as in their logo. */
.wordmark {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: -0.01em;
}
.wordmark__c { color: var(--aqua); }

/* Skip link: first thing a keyboard user reaches, above everything else on the page */
.skip-link {
  position: absolute;
  left: var(--s4);
  top: -100px;
  z-index: 300;
  padding: var(--s3) var(--s4);
  background: var(--ink);
  color: var(--on-deep);
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--s4); }

/* HomeSampleNotice: the "sample website" strip above the header. */
.sample-notice {
  --focus: var(--aqua);
  background: var(--abyss);
  color: var(--on-deep);
  font-size: var(--fs-sm);
  line-height: 1.4;
  text-align: center;
}
.sample-notice p { padding-block: var(--s2); }
.sample-notice a { color: var(--on-deep); font-weight: 600; }

/*
  HomeHeader: sticky deep-blue bar with the wordmark, section links (desktop)
  and the call button. Phones show "Call"; wider screens show the number.
*/
.site-header {
  --focus: var(--aqua);
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--deep);
  color: var(--on-deep);
  border-bottom: 1px solid rgb(241 248 251 / 0.12);
}
.site-header__bar {
  display: flex;
  align-items: center;
  gap: var(--s4);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s2);
  margin-right: auto;
  color: var(--on-deep);
  text-decoration: none;
  white-space: nowrap;
}
.brand__mark { font-size: 1.875rem; line-height: 1; }
.brand__sub { font-size: var(--fs-sm); font-weight: 600; }

.site-nav { display: none; }
.site-nav__list { display: flex; gap: var(--s5); }
.site-nav a {
  color: var(--on-deep);
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { text-decoration: underline; }

.site-header__call { min-height: 44px; padding-inline: var(--s4); }
.site-header__call-full { display: none; }

/* Narrow phones: "Pool Service" goes under the wordmark so the call button
   always fits (side by side they need about 380px). */
@media (max-width: 419px) {
  .brand { flex-direction: column; align-items: flex-start; gap: 0; }
  .brand__mark { font-size: 1.75rem; }
  .brand__sub { font-size: 0.8125rem; line-height: 1.2; }
}

@media (min-width: 640px) {
  .site-header__call-short { display: none; }
  .site-header__call-full { display: inline; }
}
@media (min-width: 960px) {
  .site-nav { display: block; }
  .brand__mark { font-size: 2.125rem; }
}

/*
  HomeHero: first screen.
  Phones: the lap-pool photo on top, the text panel (deep water) below it, so
  the headline, rating and call button all fit on the first screen.
  Desktop (960px+): text panel left, photo right, filling the screen under the header.
  The panel's gradient is the plain-water fallback; the canvas paints the
  moving light over it when WebGL is available.
*/
.hero {
  --focus: var(--aqua);
  container-type: inline-size;
  display: grid;
  grid-template-areas: "photo" "panel";
  background: var(--deep);
  color: var(--on-deep);
}

.hero__panel {
  grid-area: panel;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background: linear-gradient(180deg, #0b3d6b 0%, var(--deep) 75%);
}
.hero__floor {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}
.hero__content {
  container-type: inline-size;
  padding: var(--s6) var(--gutter) var(--s7);
  max-width: 40rem;
}

.hero__kicker { font-weight: 600; }
/* Always two lines ("Clear water," / "like clockwork."); the size follows the
   column so the longer second line never wraps. */
.hero__title {
  margin-top: var(--s3);
  font-size: min(var(--fs-display), 17.5cqi);
  line-height: 0.98;
}
.hero__title em { color: var(--aqua); }
/* SplitText wraps each word in a mask; a little room keeps italic overhangs from being clipped. */
.hero__word-mask { padding: 0.06em 0.08em 0.14em; margin: -0.06em -0.08em -0.14em; }

.hero__rating {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s2);
  margin-top: var(--s5);
}
.hero__rating strong { font-size: 1.25em; }
.hero__rating .stars svg { width: 16px; height: 16px; }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3) var(--s5);
  margin-top: var(--s5);
}
.hero__call { font-size: 1.0625rem; }
.hero__note a { color: var(--on-deep); font-weight: 600; }

.hero__lead {
  margin-top: var(--s6);
  max-width: 34ch;
  font-size: var(--fs-lead);
  line-height: 1.45;
}
.hero__award {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s5);
  font-weight: 600;
}
.hero__award svg { width: 30px; height: 30px; flex: none; color: var(--aqua); }

.hero__photo {
  grid-area: photo;
  position: relative;
  overflow: hidden;
  /* Kept short on phones so the headline and the rating are on the first
     screen even with the browser's toolbars showing (checked at 375x560). */
  height: clamp(160px, 28svh, 420px);
  background: var(--deep);
}
/* Taller than the photo box, so the slow scroll drift never shows an edge. */
.hero__media { position: absolute; inset: -6% 0; }
.hero__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 72%;
}
.hero__surface {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  mix-blend-mode: screen;
  pointer-events: none;
}

/* Short phone screens (old or small phones, or toolbars showing): a thinner
   photo strip keeps the rating on the first screen. */
@media (max-width: 959px) and (max-height: 620px) {
  .hero__photo { height: 120px; }
  .hero__content { padding-top: var(--s5); }
}
/* 320px-wide phones: smaller stars and text keep the rating on one line. */
@media (max-width: 359px) {
  .hero__rating { font-size: 0.9375rem; }
  .hero__rating .stars svg { width: 14px; height: 14px; }
  .hero__rating strong { font-size: 1.125em; }
}

/* Until the motion scripts set the opening positions, keep the hero still and
   hidden so nothing jumps. head.js lifts this after 3 seconds if they never run. */
.motion:not(.motion-ready) .hero__content,
.motion:not(.motion-ready) .hero__photo { opacity: 0; }

@media (min-width: 960px) {
  .hero {
    grid-template-areas: "panel photo";
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    min-height: clamp(620px, calc(100svh - var(--header-h) - 36px), 1000px);
  }
  .hero__panel { display: flex; align-items: center; }
  .hero__content {
    max-width: none;
    width: 100%;
    padding-block: var(--s8);
    padding-right: var(--s6);
    /* Line the text up with the page container's left edge. */
    padding-left: max(var(--gutter), calc((100cqi - var(--container)) / 2));
  }
  .hero__photo { height: auto; }
  .hero__media img { object-position: 50% 70%; }
}

/*
  HomeWork: the weekly work.
  Plain layout (no motion): heading, a 2x2 grid of the four photos, then the
  four words with their services.
  With motion (.motion-ready): one photo frame sticks under the header while
  the words scroll past it. On phones the frame sits on top and the words pass
  beneath it; on desktop the frame is the left column. The sticky frame lives
  in .work__story with the words only, so it stops before anything below.
*/
.work { padding-block: var(--s9) var(--s8); }

.work__intro { display: grid; gap: var(--s4); }
.work__intro h2 { max-width: 12ch; color: var(--navy); }
.work__intro h2 em { color: var(--aqua-ink); }
.work__lead { max-width: 52ch; font-size: var(--fs-lead); color: var(--muted); }

.work__story {
  display: grid;
  gap: var(--s7);
  margin-top: var(--s7);
}

.work__stage {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--s3);
}
.work__shot {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  background: var(--line);
}
.work__shot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.work__shot figcaption {
  position: absolute;
  left: var(--s3);
  bottom: var(--s3);
  max-width: calc(100% - 2 * var(--s3));
  padding: var(--s1) var(--s3);
  border-radius: var(--s2);
  background: var(--deep);
  color: var(--on-deep);
  font-size: var(--fs-sm);
  line-height: 1.35;
}
.work__ring { display: none; }

.work__steps { display: grid; gap: var(--s7); }
.work__word {
  font-size: clamp(3.25rem, 2rem + 6vw, 7.5rem);
  line-height: 0.95;
  color: var(--navy);
}
/* SplitText masks for the letters; a little room keeps the serif tails from being clipped. */
.work__char-mask { padding: 0.04em 0.06em 0.12em; margin: -0.04em -0.06em -0.12em; }

.work__tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s4);
}
.work__tags li {
  padding: var(--s1) var(--s3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font-weight: 500;
}

.work__quote { margin-top: var(--s4); max-width: 30rem; }
.work__quote p {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.25rem + 1vw, 2rem);
  line-height: 1.2;
}
.work__quote figcaption { margin-top: var(--s3); color: var(--muted); font-weight: 600; }

/* Motion: one sticky frame, photos stacked inside it. */
.motion-ready .work__stage {
  position: sticky;
  top: calc(var(--header-h) + var(--s3));
  z-index: 2;
  display: block;
  /* Short enough that every word and its services fit below it on a 568px-tall phone. */
  height: clamp(190px, 36svh, 440px);
  overflow: hidden;
  border-radius: var(--radius);
  background: var(--deep);
  /* Not a shadow: a band of page color around the frame. On phones the words
     scroll up under the frame, and this hides them in the 12px gap below the
     header and around the rounded corners, so no text peeks out. */
  box-shadow: 0 0 0 var(--s3) var(--deck);
}
.motion-ready .work__shot {
  position: absolute;
  inset: 0;
  aspect-ratio: auto;
  border-radius: 0;
}
.motion-ready .work__shot:first-child { z-index: 1; }
.motion-ready .work__ring {
  display: block;
  position: absolute;
  left: 50%;
  top: 55%;
  z-index: 10000;
  width: 36%;
  aspect-ratio: 1;
  border: 2px solid var(--on-deep);
  border-radius: 50%;
  opacity: 0;
  translate: -50% -50%;
  pointer-events: none;
}
.motion-ready .work__steps { gap: 0; }
/* Phones: each word starts just under the sticky photo and has half a screen
   of scrolling before the next one takes over. */
.motion-ready .work__step {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 50svh;
  padding-top: var(--s6);
}

@media (min-width: 960px) {
  .work__intro { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); align-items: end; gap: var(--s7); }
  .work__stage { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .motion-ready .work__story {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--s8);
    align-items: start;
  }
  .motion-ready .work__stage {
    top: calc(var(--header-h) + 5svh);
    height: calc(90svh - var(--header-h));
    max-height: 760px;
  }
  .motion-ready .work__step { justify-content: center; min-height: 78svh; padding-top: 0; }
}

/*
  HomeReviews: Google proof on a white band between the light sections.
  Top: the big water-filled 5.0 with stars and the link, next to the topic
  bars. Then one large quote and three smaller ones (on the page, not in
  boxes), then the Best of 352 award on deep water blue.
*/
.reviews {
  padding-block: var(--s9);
  background: var(--white);
}

.reviews__top {
  display: grid;
  gap: var(--s7);
}

.reviews__score { display: grid; justify-items: start; gap: var(--s3); }
.score { width: min(100%, 360px); height: auto; }
.score__digits,
.score__outline {
  font-family: var(--font-display);
  font-size: 196px;
}
.score__outline { fill: none; stroke: var(--navy); stroke-width: 1.5; }
.score__wave { fill: var(--navy); }
.reviews__title {
  font-family: var(--font-body);
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.reviews__stars { color: var(--aqua-ink); }
.reviews__link { font-weight: 600; }

.reviews__topics-title {
  font-family: var(--font-body);
  font-size: var(--fs-lead);
  font-weight: 600;
  line-height: 1.3;
}
.topics { display: grid; gap: var(--s4); margin-top: var(--s5); }
.topic {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--s2) var(--s4);
  align-items: baseline;
}
.topic__name { font-weight: 600; }
.topic__count { color: var(--muted); font-variant-numeric: tabular-nums; }
.topic__bar {
  grid-column: 1 / -1;
  width: 100%;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
}
.topic__track { fill: var(--deck); }
.topic__fill { fill: var(--aqua-ink); }
.reviews__note { margin-top: var(--s4); color: var(--muted); font-size: var(--fs-sm); }

.reviews__quotes {
  display: grid;
  gap: var(--s7);
  margin-top: var(--s9);
}
.quote blockquote p { font-size: var(--fs-lead); line-height: 1.5; }
.quote figcaption { margin-top: var(--s3); color: var(--muted); font-weight: 600; }
.quote--lead blockquote p {
  font-family: var(--font-display);
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.75rem);
  line-height: 1.08;
  color: var(--navy);
}
.reviews__more { display: grid; gap: var(--s6); }
.reviews__more .quote { padding-top: var(--s5); border-top: 1px solid var(--line); }

.award {
  --focus: var(--aqua);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--s4) var(--s5);
  align-items: start;
  margin-top: var(--s9);
  padding: var(--s6) var(--s5);
  border-radius: var(--radius);
  background: var(--deep);
  color: var(--on-deep);
}
.award__icon { width: 48px; height: 48px; color: var(--aqua); }
.award__title { font-size: var(--fs-h3); }
.award__title em { color: var(--aqua); }
.award__text { margin-top: var(--s3); max-width: 56ch; color: var(--on-deep-muted); }

@media (min-width: 960px) {
  .reviews__top {
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
    gap: var(--s9);
    align-items: center;
  }
  .reviews__quotes { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--s8); }
  .award { padding: var(--s7) var(--s8); gap: var(--s6); }
  .award__icon { width: 64px; height: 64px; }
}

/*
  HomeContact: deep-water section with the big phone number.
  The gradient is the plain-water fallback; the canvas paints the moving light
  over it. All text here is --on-deep (never the muted color), because it sits
  over the moving light lines.
*/
.contact {
  --focus: var(--aqua);
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--s9);
  background: linear-gradient(180deg, #0b3d6b 0%, var(--deep) 80%);
  color: var(--on-deep);
}
.contact__water {
  position: absolute;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
}

.contact__title { font-size: var(--fs-h2); }
.contact__title em { color: var(--aqua); }
.contact__lead {
  margin-top: var(--s4);
  max-width: 44ch;
  font-size: var(--fs-lead);
}

.contact__phone {
  display: inline-block;
  margin-top: var(--s6);
  color: var(--on-deep);
  font-family: var(--font-display);
  font-size: clamp(2.75rem, 1.6rem + 6.4vw, 7rem);
  line-height: 1;
  white-space: nowrap;
  text-decoration-color: var(--aqua);
  text-decoration-thickness: 3px;
  text-underline-offset: 0.12em;
}
.contact__phone:hover { color: var(--aqua); }

.contact__list {
  display: grid;
  gap: var(--s4);
  margin-top: var(--s7);
}
.contact__list li {
  display: flex;
  align-items: center;
  gap: var(--s3);
  min-height: 44px;
  overflow-wrap: anywhere;
}
.contact__list svg { width: 22px; height: 22px; flex: none; color: var(--aqua); }
.contact__list a { color: var(--on-deep); font-weight: 500; }

@media (min-width: 960px) {
  .contact { padding-block: var(--s10); }
  .contact__list { grid-template-columns: repeat(2, minmax(0, max-content)); gap: var(--s4) var(--s8); }
}

/*
  HomeFooter: darkest blue, the wordmark sized to the column (container units,
  so it never overflows), then the line and the sample notice.
*/
.site-footer {
  --focus: var(--aqua);
  padding-block: var(--s8) var(--s6);
  background: var(--abyss);
  color: var(--on-deep);
}
.site-footer__inner { container-type: inline-size; display: grid; gap: var(--s4); }
.site-footer__mark {
  font-size: min(9rem, 24cqi);
  line-height: 0.9;
  white-space: nowrap;
}
.site-footer__line { max-width: 60ch; color: var(--on-deep-muted); }
.site-footer a { color: var(--on-deep); }
.site-footer__notice {
  margin-top: var(--s5);
  padding-top: var(--s4);
  border-top: 1px solid rgb(241 248 251 / 0.16);
  color: var(--on-deep-muted);
  font-size: var(--fs-sm);
}
