/* ==========================================================================
   site.css — Quality Well Drillers Inc. (quality-well-drillers-inc-atwater-ca)
   brief.md v1 (approved 2026-09-21). Family bold-industrial, archetype
   split-hero, signature "the mast rises once and holds." Tokens only —
   no raw hex/px/font literals below (house-tech-spec §3).
   ========================================================================== */

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

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

.section {
  padding-block: var(--section-gap);
}

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

.section-title {
  font-family: var(--font-display);
  font-weight: var(--font-weight-display-mid);
  font-size: var(--text-h2);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  color: var(--color-accent);
  margin-block-end: var(--space-lg);
}

/* --- Header & navigation ----------------------------------------------------
   Sticky, stacked under the sticky expiry bar (brief §5.0/§5.1: "sticky
   header," repeated three scroll depths). css/preview.css makes .expiry
   sticky at inset-block-start:0; this pins the header directly beneath it
   using the one --expiry-height token that file declares. */

.site-header {
  position: sticky;
  inset-block-start: var(--expiry-height);
  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);
}

.site-header__brand {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  font-weight: var(--font-weight-display-mid);
  text-decoration: none;
  letter-spacing: var(--tracking-tight);
  color: var(--color-ink);
}

.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);
  color: var(--color-ink);
  font-family: var(--font-body);
  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;
  color: var(--color-ink);
  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 precedent (house skeleton default, unchanged here):
   closed is the plain CSS default below 48em, with no JS gate, so nothing
   collapses post-paint. */
.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 house roles plus one brief-added role: .btn--tel, the always-visible
   secondary phone control (brief §0.4 row 4) — an outlined control whose
   only shape is a hairline, so it takes the 3:1 control-boundary token. */

.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-family: var(--font-body);
  font-weight: var(--font-weight-body-strong);
  font-size: var(--text-small);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
  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),
              border-color var(--duration-fast) var(--ease-out);
}

.btn--primary {
  background-color: var(--color-accent);
  color: var(--color-accent-ink);
}

.btn--primary:hover,
.btn--primary:focus-visible {
  background-color: var(--color-ink);
  color: var(--color-bg);
}

.btn--tel {
  border-color: var(--color-border-strong);
  color: var(--color-ink);
}

.btn--tel:hover,
.btn--tel:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.btn--quiet {
  border-color: var(--color-border-strong);
  color: var(--color-ink);
}

.btn--quiet:hover,
.btn--quiet:focus-visible {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

/* --- Fact chips (brief §5.2: 4-chip trust strip, plus the hero's own
   compact 3-chip facts row, brief §5.0/tile precedent) ---------------------- */

.fact {
  display: inline-flex;
  align-items: center;
  padding: var(--space-2xs) var(--space-xs);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border);
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body-strong);
  font-size: var(--text-fact);
  text-transform: uppercase;
  letter-spacing: var(--tracking-normal);
}

/* --- Hero -------------------------------------------------------------------
   Split-hero archetype (brief §5): single text column at mobile; at >=64rem
   the field becomes a right-hand column, asymmetric weight toward text
   (brief §5.0 "Desktop, ≥64rem"). Atmosphere gradient per brief §2.2/§2.3 —
   peak alpha reduced to 0.16, resolving Item 1's contrast fix at the token
   level; nothing here reopens that number. */

.hero {
  position: relative;
  padding-block-start: var(--space-md);
  padding-block-end: var(--section-gap);
  background:
    radial-gradient(ellipse 90% 60% at 50% 18%, rgba(var(--hero-halo-hue), var(--hero-halo-peak-alpha)), transparent 65%),
    var(--color-bg);
}

.hero__grid {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.hero__eyebrow {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  margin: 0;
  color: var(--color-accent);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body-strong);
  font-size: var(--text-eyebrow);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

.hero__eyebrow-rule {
  /* @allow-literal: a fixed decorative rule width has no space-scale match at this size */
  width: 22px;
  height: var(--border-thick);
  background-color: var(--color-accent);
  flex: none;
}

.hero__title {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: var(--font-weight-display-strong);
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

.hero__accent {
  color: var(--color-accent);
}

.hero__ctas {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm);
  margin: 0;
}

.hero__lead {
  margin: 0;
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body-medium);
  font-size: var(--text-lead);
  line-height: var(--leading-snug);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* --- Hero field (the LCP image + motion overlay) -----------------------------
   Fixed 190px height at mobile per brief §5.0's own computed arithmetic —
   the field clears the fold with 147px to spare at 375x667. */

.hero-field {
  position: relative;
  margin-block-start: var(--space-3xs);
  /* @allow-literal: the brief's own computed fold arithmetic (§5.0) fixes this exact mobile height, not a free design value */
  height: 190px;
  overflow: hidden;
  background-color: var(--color-bg);
  clip-path: inset(100% 0 0 0);
  animation: hero-mast-rise var(--duration-mast-rise) var(--ease-mast-rise) both;
}

/* <picture> has no explicit height of its own (base.css sets only
   display:block/max-width), so height:100% on the <img> inside resolves to
   auto unless <picture> itself carries a definite height too — without
   this the image fell back to its intrinsic ratio and the SVG overlay
   (sized off .hero-field's real height) stopped lining up at desktop. */
.hero-field picture {
  display: block;
  width: 100%;
  height: 100%;
}

.hero-field__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 78%;
}

.hero-field__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero-field__cable {
  stroke: var(--color-ink-muted);
  /* @allow-literal: hairline stroke weight on a decorative SVG overlay, not a border */
  stroke-width: 3;
  /* @allow-literal: SVG viewBox-space pivot coordinate for the cable-sway rotation, not a layout position */
  transform-origin: 800px 70px;
  animation: hero-cable-sway var(--duration-cable-sway) var(--ease-in-out) infinite;
}

.hero-field__glint {
  fill: var(--color-accent);
  animation: hero-glint-pulse var(--duration-glint) var(--ease-in-out) infinite;
}

.hero-field__flow {
  fill: none;
  stroke: var(--color-flow);
  /* @allow-literal: decorative SVG stroke weight, not a border */
  stroke-width: 5;
  stroke-linecap: round;
  /* @allow-literal: SVG path-length-adjacent dash values, not a spacing token */
  stroke-dasharray: 170;
  stroke-dashoffset: 170;
  opacity: 0;
  animation: hero-flow-settle var(--duration-flow-line) var(--ease-out) var(--delay-flow-line) both;
}

@keyframes hero-mast-rise {
  to { clip-path: inset(0 0 0 0); }
}

@keyframes hero-cable-sway {
  /* @allow-literal: a decorative rotation angle, not a design token */
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

@keyframes hero-glint-pulse {
  /* @allow-literal: decorative opacity keyframe values, not tokens */
  0%, 100% { opacity: 0.2; }
  50% { opacity: 1; }
}

@keyframes hero-flow-settle {
  to { stroke-dashoffset: 0; opacity: 1; }
}

/* Reduced motion: the hero freezes to a finished-reading state (brief §7) —
   mast fully risen, glint at a steady mid-value, cable at rest, flow-line
   fully drawn. base.css already zeroes --duration-fast/base/slow; these four
   custom motion tokens are the site's own addition and are not covered by
   that generic kill switch, so they get their own explicit freeze here. */
@media (prefers-reduced-motion: reduce) {
  .hero-field {
    clip-path: inset(0 0 0 0);
    animation: none;
  }

  .hero-field__cable {
    animation: none;
    transform: rotate(0deg);
  }

  .hero-field__glint {
    animation: none;
    /* @allow-literal: the brief's own stated reduced-motion value — "a
       steady mid-value, not its peak, not its trough" */
    opacity: 0.6;
  }

  .hero-field__flow {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@media (min-width: 64em) {
  /* Grid, not flex, at this breakpoint: the six hero children stay in the
     house DOM order (brief §5.0) — eyebrow, h1, ctas, field, lead, facts —
     but the split-hero archetype wants a text column and a field column,
     and the field sits BETWEEN the CTA and the lead in source order. Grid
     placement puts .hero-field in its own column without moving it in the
     DOM, so the mobile fold arithmetic's source order is never disturbed
     by this layout. */
  .hero__grid {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    align-items: center;
    column-gap: var(--space-2xl);
  }

  .hero__eyebrow { grid-column: 1; grid-row: 1; }
  .hero__title   { grid-column: 1; grid-row: 2; }
  .hero__ctas    { grid-column: 1; grid-row: 3; }
  .hero__lead    { grid-column: 1; grid-row: 4; }
  .hero__facts   { grid-column: 1; grid-row: 5; }

  .hero-field {
    grid-column: 2;
    grid-row: 1 / 6;
    align-self: stretch;
    /* @allow-literal: desktop split-hero column height, brief §5.0's own
       "asymmetric weight toward the text column" with no further-specified
       fixed height at this breakpoint — stretched to the text column's own
       measured height instead of a second literal */
    height: auto;
    min-height: var(--hero-field-desktop-min-height);
    margin-block-start: 0;
  }

  .hero-field__img {
    object-position: center 62%;
  }
}

/* --- Services & trust (brief §5.2, §0.4) ------------------------------------- */

.services-trust__row {
  display: grid;
  gap: var(--space-lg);
  align-items: start;
}

.services-index {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.services-index__row {
  display: grid;
  grid-template-columns: var(--layout-numeral-col) 1fr;
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
}

.services-index__row:first-child {
  border-top: none;
  padding-block-start: 0;
}

.services-index__num {
  font-family: var(--font-display);
  font-weight: var(--font-weight-display-strong);
  font-size: var(--text-h2);
  line-height: 1;
  color: var(--color-accent);
}

.services-index__name {
  margin: 0 0 var(--space-3xs);
  color: var(--color-ink);
  font-family: var(--font-display);
  font-weight: var(--font-weight-display-mid);
  font-size: var(--text-lead);
}

.services-index__note {
  margin: 0;
  color: var(--color-ink-muted);
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
}

.services-trust__media,
.trust-strip__media {
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.services-trust__media img,
.trust-strip__media img {
  width: 100%;
  height: auto;
}

.trust-strip {
  display: grid;
  gap: var(--space-lg);
  align-items: center;
  margin-block-start: var(--space-lg);
  padding-block-start: var(--space-lg);
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
}

.trust-strip__list {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2xs);
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 48em) {
  .services-trust__row {
    grid-template-columns: 1fr var(--space-3xl);
  }

  .trust-strip {
    grid-template-columns: var(--space-3xl) 1fr;
  }
}

/* --- Service area (brief §5.3) ------------------------------------------------
   Slot 4 sits behind the section as a low-opacity background texture, never
   the foreground subject (brief §6.2 slot 4). */

.service-area {
  position: relative;
  overflow: hidden;
}

.service-area__texture {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* @allow-literal: the brief's own "low opacity, background only" framing
     clause (§6.2 slot 4) — a decorative opacity value, not a colour or size
     token */
  opacity: 0.16;
}

.service-area .container {
  position: relative;
}

/* --- CTA band (brief §5.4) ----------------------------------------------------- */

.cta-band {
  background-color: var(--color-surface);
  border-block: var(--border-hairline) var(--border-style) var(--color-border);
}

.cta-band__inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.cta-band__ctas {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin: 0;
}

@media (min-width: 48em) {
  .cta-band__inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* --- Form ---------------------------------------------------------------------
   One form per site (spec §6). POSTs to the endpoint constant in main.js. */

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

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

.field__label {
  color: var(--color-ink);
  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);
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
}

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

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

.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);
  color: var(--color-ink-muted);
  font-size: var(--text-small);
}

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

.site-footer__nap {
  font-style: normal;
  color: var(--color-ink);
}

.site-footer__nap a {
  display: inline-block;
  margin-block-start: var(--space-3xs);
}
