/* ==========================================================================
   site.css — per-site layout & components, built FROM tokens.
   HARD RULE (house-tech-spec §3): no raw hex/px/rem/font-name literals here
   — tokens only. Escape hatches: house breakpoints, `@allow-literal:`.
   Components below implement brief.md's editorial-stack archetype; the
   skeleton ships no hero/card-grid/section-heading pattern by design.
   ========================================================================== */

/* --- Layout primitives ---------------------------------------------------- */

.container {
  width: 100%;
  max-width: var(--layout-container);
  margin-inline: auto;
  padding-inline: var(--layout-gutter);
}

/* Vertical rhythm hook. --section-gap is the only inter-section spacing value
   on a site (design-rules §7.1); the brief picks which scale step it is. */
.section {
  padding-block: var(--section-gap);
}

.measure {
  max-width: var(--layout-measure);
}

/* --- Header & navigation --------------------------------------------------
   Progressive enhancement: with JS off the nav list is a plain, always-visible
   list of links and the toggle stays [hidden] (it ships hidden in the HTML;
   main.js reveals it). With JS on, narrow viewports collapse the list behind
   the toggle. Nothing about navigation depends on JavaScript.              */

.site-header {
  position: relative;
  z-index: var(--z-header);
  padding-block: var(--space-sm);
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
  background-color: var(--color-bg);
}

.site-header__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

/* Brief §2.5 defines no --text-h3 (this site's scale is eyebrow/h1/h2/index/
   body/lead/small only). --text-lead is reused for the wordmark rather than
   inventing an unstated value — it sits close to --text-small (the nav
   links' own size) so the brand does not fight the two-item nav for
   attention on this quiet, rule-based register. */
.site-header__brand {
  font-family: var(--font-display);
  font-size: var(--text-lead);
  font-weight: var(--font-weight-display);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2xs);
  padding: var(--space-2xs) var(--space-xs);
  /* The nav-toggle's only shape is this hairline, so it is a CONTROL boundary
     (WCAG 1.4.11, >= 3:1), not a decorative one — use --color-border-strong. */
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
}

.site-nav__list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav__link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
}

.site-nav__link:hover,
.site-nav__link:focus-visible {
  text-decoration: underline;
  text-underline-offset: var(--space-3xs);
}

/* QA r3 FIX perf/cls (house-wide skeleton fix, carried unchanged): closed is
   the plain CSS default below 48em with no JS gate, so there is no post-
   paint collapse to cause CLS. JS-off visitors get the nav back via the
   <noscript> override in @shared:head-boilerplate, which ships last and
   wins the cascade tie with no `!important`. */
.site-nav {
  display: none;
}

[data-nav-ready] .site-nav[data-nav-open='true'] {
  display: block;
  flex-basis: 100%;
}

@media (min-width: 48em) {
  .site-nav {
    display: block;
  }

  [data-nav-ready] .nav-toggle {
    display: none;
  }
}

/* --- Buttons --------------------------------------------------------------
   Two roles, no more. Radius, weight and colour all come from the brief via
   tokens — including --radius-none, which is a legitimate answer.          */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  padding: var(--space-xs) var(--space-md);
  border: var(--border-hairline) var(--border-style) transparent;
  border-radius: var(--radius-sm);
  font-weight: var(--font-weight-body-strong);
  line-height: var(--leading-snug);
  text-align: center;
  text-decoration: none;
  transition: background-color var(--duration-fast) var(--ease-out),
              color var(--duration-fast) var(--ease-out);
}

/* WCAG 1.4.11: --color-accent's fill measures 2.41:1 against --color-bg (the
   same ratio that forbids it as text, brief §2.3), so the control's own
   boundary needs the border, not the fill, to clear 3:1 — --color-border-
   strong, the same control-boundary token --btn--quiet already uses. */
.btn--primary {
  background-color: var(--color-accent);
  border-color: var(--color-border-strong);
  color: var(--color-accent-ink);
}

.btn--quiet {
  /* Outline button: the border is the whole control, so it takes the 3:1
     control-boundary token, not the decorative hairline (WCAG 1.4.11). */
  border-color: var(--color-border-strong);
  color: var(--color-ink);
}

/* --- Form -----------------------------------------------------------------
   One form per site (spec §6). POSTs to the endpoint constant in main.js;
   works as a plain HTML POST with JS off; auto-hides when no endpoint is
   configured so a spec site never shows a dead form.                       */

.form {
  display: grid;
  gap: var(--space-md);
  max-width: var(--layout-measure);
}

.field {
  display: grid;
  gap: var(--space-3xs);
}

.field__label {
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
}

.field__control {
  width: 100%;
  min-height: var(--layout-tap-min);
  padding: var(--space-2xs) var(--space-xs);
  background-color: var(--color-surface);
  color: var(--color-ink);
  /* A control's own boundary (WCAG 1.4.11) — --color-border-strong, not the
     decorative hairline. */
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  /* Brief §2.2: --radius-sm is "the only radius token in use, on buttons
     only — no rounded cards." A form field is not a button; this site's
     flat, rule-based register keeps it square. */
  border-radius: var(--radius-none);
}

textarea.field__control {
  min-height: var(--space-3xl);
  resize: vertical;
}

.field__hint {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

/* Honeypot: present in the DOM for bots, unreachable for humans and assistive
   tech. Not display:none — some bots skip those. */
.form__trap {
  position: absolute;
  /* @allow-literal: off-canvas parking position, not a design value */
  left: -9999px;
  opacity: 0;
  pointer-events: none;
}

.form__status {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

.form__status[data-state='error'] {
  color: var(--color-ink);
  font-weight: var(--font-weight-body-strong);
}

/* --- Footer ---------------------------------------------------------------- */

.site-footer {
  padding-block: var(--space-xl);
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
  font-size: var(--text-small);
}

.site-footer a {
  text-underline-offset: var(--space-3xs);
}

.site-footer__nap {
  font-style: normal;
}

/* --- Eyebrow ---------------------------------------------------------------
   House rule (house-tech-spec §8): label copy is authored in its natural
   case and uppercased with text-transform, never typed in caps — the copy
   doc's eyebrows ("What We Do", "Elkview, WV · Est. 2007"...) stay natural
   case in the HTML; this is what displays them uppercase. */

.eyebrow {
  font-size: var(--text-eyebrow);
  line-height: var(--leading-snug);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-xs);
}

/* --- Quiet text link --------------------------------------------------------
   Low-emphasis CTA device: the services-list closing line and the mailto
   photo link (brief §3.1 row 2, §3.3(B)) — a link, not a button, so it never
   competes with the primary/secondary CTAs' weight. */

.link-quiet {
  color: var(--color-ink-muted);
  font-weight: var(--font-weight-body-strong);
  text-decoration: underline;
  text-underline-offset: var(--space-3xs);
}

/* ---- HERO — "the bevel draws true" (brief §3.2, §5) -----------------------
   .hero__top -> .hero__field -> .hero__lead-band, single column until the
   two-col split at >=64em (top+field side by side, lead-band full width
   below) — one reading order, no overlap (brief §1's ref-011 caution).
   --section-gap's only two call sites (brief §3.1): .section's padding-block
   and this hero's padding-block-end; the arithmetic table's 24px "hero
   padding" is the smaller top+field cluster margin below, not this. */

.hero {
  padding-block-start: var(--space-md);
  padding-block-end: var(--section-gap);
}

.hero__grid {
  display: grid;
  grid-template-areas: 'top' 'field' 'lead';
  row-gap: 0;
}

.hero__top { grid-area: top; }
.hero__field { grid-area: field; }
.hero__lead-band { grid-area: lead; }

/* Trade statement (NEW, r3 — brief §3.2 revision, resolves the clarity/5s
   BLOCKER, qa/r1/report.md). A plain-words copy slot between the eyebrow
   and the H1, static and not reveal-gated (brief §5). --text-lead (15px,
   fixed, §2.5) in --color-ink: the same "Body text" contrast pairing
   already in §2.3's table (13.80:1), reused rather than a new one — full
   body-text contrast because this line is load-bearing comprehension
   content, not decoration. margin-block-end matches the eyebrow's own
   --space-xs gap above it, per §3.2's arithmetic (8px both sides). */
.hero__trade {
  font-size: var(--text-lead);
  line-height: 1.3;
  color: var(--color-ink);
  margin: 0 0 var(--space-xs);
}

.hero__title {
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  margin: 0 0 var(--space-sm);
}

.hero__title em {
  font-style: italic;
  font-family: var(--font-emphasis);
  font-weight: var(--font-weight-display);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: 0;
}

/* Field: fixed height at mobile (brief §3.2 — 240px). Free-flowing
   (aspect-ratio) from the tablet breakpoint up, house precedent
   (calwater-drilling-company-turlock-ca's --layout-hero-field-block). The
   14.4px gap before it and the 24px gap after it are the brief's own
   arithmetic (§3.2's "gap" and "hero padding-bottom" rows). */
.hero__field {
  position: relative;
  overflow: hidden;
  block-size: var(--layout-hero-field-block);
  margin-block-start: var(--space-sm);
  margin-block-end: var(--space-md);
}

.hero__img {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: center;
}

.bevel-diagram {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
}

.hero__lead-band {
  max-width: var(--layout-measure);
}

.hero__lead {
  color: var(--color-ink);
  margin: 0 0 var(--space-md);
}

/* The hero's one-off decorative index teaser (brief §2.3, revised r2: the
   bright-accent carve-out this section once granted is retired — every
   accent TEXT role, including this numeral, uses --color-accent-deep, no
   exceptions). ONE <p>, two <span>s, so the copy doc's exact string
   ("01 · What happens next") ships unedited while each half takes its own
   size/colour role. */
.hero__index {
  margin: 0;
  line-height: 1;
}

.hero__index-num {
  font-family: var(--font-display);
  font-size: var(--text-index);
  font-weight: var(--font-weight-display);
  color: var(--color-accent-deep);
}

.hero__index-label {
  display: block;
  margin-block-start: var(--space-3xs);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink-muted);
}

@media (min-width: 48em) {
  .hero__field {
    block-size: auto;
    aspect-ratio: 4 / 3;
  }
}

@media (min-width: 64em) {
  .hero__grid {
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      'top field'
      'lead field';
    column-gap: var(--space-lg);
    align-items: start;
  }

  .hero__field {
    margin-block-start: 0;
    margin-block-end: 0;
  }

  .hero__lead-band {
    margin-block-start: var(--space-md);
  }
}

/* Living-hero signature (brief §5): two one-shot draws (bevel outline, then
   the weld-symbol tick, overlapping) via stroke-dasharray/dashoffset with
   pathLength="1" — unitless, no measured path length needed. Then exactly
   two independent ambient loops (C2-DECISION nudge 1): angle-tick fade,
   glint drift. */

.bevel-diagram__line,
.bevel-diagram__tick {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
}

.bevel-diagram__line {
  animation: bevel-line-draw var(--duration-bevel-draw) var(--ease-out) forwards;
}

.bevel-diagram__tick {
  animation: bevel-tick-draw var(--duration-tick-draw) var(--ease-out) var(--delay-tick-draw) forwards;
}

@keyframes bevel-line-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes bevel-tick-draw {
  to { stroke-dashoffset: 0; }
}

.bevel-diagram__angle {
  animation: bevel-angle-fade var(--duration-angle-loop) var(--ease-in-out) infinite;
}

@keyframes bevel-angle-fade {
  0%, 100% { opacity: 0.35; }
  50% { opacity: 1; }
}

.bevel-diagram__glint {
  animation: bevel-glint-drift var(--duration-glint-loop) var(--ease-in-out) infinite;
}

@keyframes bevel-glint-drift {
  0%, 100% { opacity: 0.4; transform: translate(0, 0); }
  50% { opacity: 1; transform: translate(var(--motion-glint-shift-x), var(--motion-glint-shift-y)); }
}

/* Reduced motion (brief §5): draws land fully drawn, angle tick and glint
   sit at a fixed partial opacity — no exception, house-tech-spec §8. */
@media (prefers-reduced-motion: reduce) {
  .bevel-diagram__line,
  .bevel-diagram__tick {
    animation: none;
    stroke-dashoffset: 0;
  }

  .bevel-diagram__angle {
    animation: none;
    opacity: 0.85;
  }

  .bevel-diagram__glint {
    animation: none;
    opacity: 0.7;
    transform: none;
  }
}

/* ============================================================================
   SERVICES (brief §3.1 row 2) — named-by-job list, verbatim order, closing
   with the quiet unnumbered industrial sub-line and a low-emphasis link.
   ============================================================================ */

.services__grid {
  display: grid;
  gap: var(--space-lg);
}

.services__list {
  margin: var(--space-md) 0;
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.services__list li {
  padding-block: var(--space-sm);
  border-block-end: var(--border-hairline) var(--border-style) var(--color-border);
}

/* The quiet, unnumbered industrial sub-line (C2-DECISION nudge 4): smaller
   type, ink-muted, no numeral — visibly a different, lesser register than
   the numbered/ruled list above it. */
.services__industrial {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
  margin: 0 0 var(--space-md);
}

.services__figure {
  margin: 0;
}

.services__figure img {
  width: 100%;
  height: auto;
}

@media (min-width: 48em) {
  .services__grid {
    grid-template-columns: 3fr 2fr;
    align-items: start;
    column-gap: var(--space-lg);
  }
}

/* ============================================================================
   TRUST STRIP (brief §3.1 row 3) — rule-separated editorial list. NOT the
   banned four-stat counter row (design-rules §4): single column, no cards,
   no icons, no uniform grid, no ordinal marks.
   ============================================================================ */

.trust {
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.trust__list {
  margin: var(--space-md) 0 0;
}

.trust__row {
  padding-block: var(--space-sm);
  border-block-end: var(--border-hairline) var(--border-style) var(--color-border);
}

/* ============================================================================
   REVIEWS (brief §3.1 row 4) — two verbatim quotes. No star rating repeated
   here; the count already lives in the trust strip.
   ============================================================================ */

.reviews__grid {
  display: grid;
  gap: var(--space-lg);
  margin-block-start: var(--space-md);
}

.reviews__quote {
  margin: 0;
  padding-block-start: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.reviews__quote blockquote {
  margin: 0 0 var(--space-xs);
}

.reviews__quote p {
  font-family: var(--font-emphasis);
  font-style: italic;
  color: var(--color-ink);
}

.reviews__quote figcaption {
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

@media (min-width: 48em) {
  .reviews__grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ============================================================================
   PROCESS (brief §3.1 row 5) — the page's one true counter. Numeral column
   fixed width so the three steps' body copy lines up regardless of the
   numeral's own measured glyph width (house precedent: calwater's --step).
   ============================================================================ */

.process__grid {
  display: grid;
  gap: var(--space-lg);
}

.process__list {
  margin: var(--space-md) 0 0;
  padding: 0;
  list-style: none;
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.process__step {
  display: grid;
  grid-template-columns: var(--layout-numeral-col) 1fr;
  column-gap: var(--space-sm);
  align-items: start;
  padding-block: var(--space-sm);
  border-block-end: var(--border-hairline) var(--border-style) var(--color-border);
}

.process__step p {
  margin: 0;
}

/* The ONLY load-bearing numeral on the page (brief §2.5's nested-counters
   check) — accent-deep, never bright accent (brief §2.3: 4.71:1, the sole
   way a reader learns the step order). */
.process__num {
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  color: var(--color-accent-deep);
  line-height: var(--leading-tight);
}

.process__figure {
  margin: 0;
}

.process__figure img {
  width: 100%;
  height: auto;
}

@media (min-width: 48em) {
  .process__grid {
    grid-template-columns: 3fr 2fr;
    align-items: start;
    column-gap: var(--space-lg);
  }
}

/* ============================================================================
   CONTACT (brief §3.3) — the mailto photo link sits outside <form>, given
   its own breathing room so it reads as a second, independent path rather
   than a form footnote.
   ============================================================================ */

.contact__mailto {
  margin-block-start: var(--space-md);
  padding-block-start: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}
