/* ==========================================================================
   site.css — per-site layout & components, built FROM tokens.
   Source: runs/m-and-d-sprinklers-spring-tx/brief.md.
   Tokens only, no raw hex/size/font literals (house-tech-spec §3). Escape
   hatches: the house breakpoints (48em/64em) and `@allow-literal: reason`.
   Desktop breakpoint per brief §3.3: 64em (house default, base.css).
   ========================================================================== */

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

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

/* Vertical rhythm hook (design-rules §7.1). --section-gap is the ONLY value
   setting space BETWEEN sections: .section's padding-block and the hero's
   padding-block-end are its only two call sites (brief §3.3). */
.section {
  padding-block: var(--section-gap);
}

/* The settled leader-line, flattened, reused as the head-rule atop every
   section below (brief §8). One rule per boundary; the largest gap on the
   page (design-rules §7.1) stays the section padding. */
.section {
  border-top: var(--border-hairline) var(--border-style) var(--color-accent);
}

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

/* Anchor targets land below the sticky stack (brief §5 "Chrome"); the
   sticky positioning itself lives in preview.css. */
section[id] {
  scroll-margin-block-start: var(--sticky-stack);
}

@media (min-width: 64em) {
  section[id] {
    scroll-margin-block-start: var(--sticky-stack-desktop);
  }
}

/* --- Header & navigation ---------------------------------------------------
   Brief §5 declares the header sticky (house-tech-spec §6, design-rules
   §7.3 rule 6) — positioning lives in preview.css; this supplies the ground
   so the sticky header never shows page content through it. */

.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);
  column-gap: var(--space-xs);
}

.site-header__brand {
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-display);
  font-size: var(--text-body);
  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);
  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);
}

.site-nav {
  display: none;
  flex-basis: 100%;
  order: 1;
}

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

.site-header .site-header__call {
  flex: none;
  padding: 0;
  min-inline-size: var(--layout-tap-min);
}

.site-header__call svg {
  display: block;
}

@media (min-width: 48em) {
  .site-header__inner {
    column-gap: var(--space-sm);
  }

  .site-nav {
    display: block;
    flex-basis: auto;
    order: 0;
    margin-inline-start: auto;
  }

  .site-header__brand {
    flex: none;
    font-size: var(--text-h3);
  }

  .site-header .site-header__call {
    padding: var(--space-xs) var(--space-md);
  }

  .site-header__call .visually-hidden:not(:focus):not(:active) {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }

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

/* --- Buttons (house primitive; radius from tokens.css --radius-sm) --- */

.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);
}

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

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

/* --- Form (house primitive, house-tech-spec §6) --- */

.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);
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
}

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 (house primitive; extended below, brief's 3-col desktop) --- */

.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;
}

/* --- Hero — hero-call, editorial-stack ------------------------------------
   DOM order is the house order (eyebrow -> h1 -> cta -> field -> lead ->
   facts, design-rules §7.2 rule 1, brief §6). At >=64em the same elements
   reflow into a 1.1fr/.9fr grid via named areas, DOM order unchanged
   (brief §5, §7.3 rule 1). The one living-hero moment (§0): full-bleed dark
   frost-slate gradient + amber atmosphere, the plate as a lit technical
   card. */

.hero {
  position: relative;
  overflow: hidden;
  padding-block-start: var(--space-lg);
  padding-block-end: var(--section-gap);
  /* Solid fallback under the gradient — paints first, and gives a real
     colour to a contrast walk that reads background-color, not -image. */
  background-color: var(--color-hero-grad-dark);
  background-image:
    radial-gradient(120% 90% at 80% 0%, var(--color-hero-atmosphere), transparent 55%),
    linear-gradient(160deg, var(--color-hero-grad-dark) 0%, var(--color-hero-grad-mid) 60%, var(--color-hero-grad-light) 100%);
  color: var(--color-accent-ink);
}

.hero__grid > * {
  margin-block-start: var(--space-sm);
}

.hero__grid > *:first-child {
  margin-block-start: 0;
}

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

.hero__h1 {
  margin: 0;
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-accent-ink);
}

/* One-word emphasis accent (brief §3.2): italic cut, no colour change. */
.hero__accent {
  font-style: italic;
}

.hero__cta-wrap {
  margin-block-start: var(--space-md);
}

/* Frost-slate fill reads only 1.97:1 against the dark hero ground (WCAG
   1.4.11 needs 3:1) — both dark tones. Scoped to the hero only: every
   other primary CTA sits on the light ground, already clearing 7:1. */
.hero .btn--primary {
  border-color: var(--color-accent-ink);
}

/* The field: the diagram as a lit plate (tiles/tile-b.html's C2-locked
   ".device" treatment — border + shadow — per brief §7). */

.hero__field {
  position: relative;
  margin-block-start: var(--space-lg);
  background-color: var(--color-bg);
  border: var(--border-hairline) var(--border-style) var(--color-border);
  box-shadow: var(--shadow-device);
}

.hero__field picture,
.hero__field img {
  display: block;
  width: 100%;
}

/* Ambient overlay — the signature move (brief §8), non-interactive. */
.hero__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Two frost-wisp drift planes, offset (brief §8: "9s / 11.4s, offset"). */
.hero__wisp {
  fill: var(--color-accent);
  opacity: 0.18;
  animation: hero-wisp-drift var(--duration-wisp-a) var(--ease-in-out) infinite;
}

.hero__wisp--b {
  animation-duration: var(--duration-wisp-b);
  animation-delay: var(--delay-wisp-b);
}

@keyframes hero-wisp-drift {
  0%, 100% { transform: translateX(0); opacity: 0.14; }
  50%      { transform: translateX(3%); opacity: 0.32; }
}

/* One amber work-light pulse, its own period (brief §8: "a single small
   glow or highlight accent"). */
.hero__worklight {
  fill: var(--color-accent-warm);
  animation: hero-worklight-pulse var(--duration-worklight) var(--ease-in-out) infinite;
}

@keyframes hero-worklight-pulse {
  0%, 100% { opacity: 0.5; }
  50%      { opacity: 1; }
}

/* One-shot leader-line draw (brief §8): 1.8s, ease-out, once on load, from
   the valve box's un-drawn stub to its pin. Frost-slate — the same colour
   that settles into the flattened head-rule (.section border-top, above).
   pathLength="1" normalises the dash maths. */
.hero__leader {
  fill: none;
  stroke: var(--color-accent);
  stroke-width: 0.4;
  stroke-linecap: round;
  stroke-dasharray: 1 1;
  stroke-dashoffset: 1;
  animation: hero-leader-draw var(--duration-leader-draw) var(--ease-out) forwards;
}

@keyframes hero-leader-draw {
  to { stroke-dashoffset: 0; }
}

.hero__leader-pin {
  fill: var(--color-accent);
  opacity: 0;
  animation: hero-leader-pin-in var(--duration-fast) var(--ease-out) forwards;
  animation-delay: var(--duration-leader-draw);
}

@keyframes hero-leader-pin-in {
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__wisp {
    animation: none;
    opacity: 0.24;
  }
  .hero__worklight {
    animation: none;
    opacity: 0.75;
  }
  .hero__leader {
    animation: none;
    stroke-dashoffset: 0;
  }
  .hero__leader-pin {
    animation: none;
    opacity: 1;
  }
}

.hero__lead {
  margin-block-start: var(--space-lg);
  max-width: var(--layout-measure);
  font-size: var(--text-lead);
  line-height: var(--leading-body);
}

.hero__facts {
  margin-block-start: var(--space-sm);
  font-size: var(--text-small);
  color: var(--color-bg);
  opacity: 0.85;
}

@media (min-width: 64em) {
  .hero__grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    column-gap: var(--space-xl);
    align-items: center;
    grid-template-areas:
      "eyebrow art"
      "h1      art"
      "cta     art"
      "lead    art"
      "facts   art";
  }

  .hero__grid > * {
    margin-block-start: 0;
  }

  .hero__eyebrow   { grid-area: eyebrow; }
  .hero__h1        { grid-area: h1; margin-block-start: var(--space-sm); }
  .hero__cta-wrap  { grid-area: cta; margin-block-start: var(--space-md); }
  .hero__lead      { grid-area: lead; margin-block-start: var(--space-lg); }
  .hero__facts     { grid-area: facts; margin-block-start: var(--space-sm); }

  .hero__field {
    grid-area: art;
    margin-block-start: 0;
    align-self: start;
  }
}

/* --- Seasonal pair — seasonal-pair (brief §4 row 2, §5) --------------------
   2-column 50/50 grid at >=64em, gap --space-lg (40px). */

.seasonal__icons {
  width: var(--seasonal-icons-width);   /* ~140px drawn — reads each icon at roughly 64px, brief §7 */
  height: auto;
  margin-block-end: var(--space-sm);
}

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

.seasonal__card {
  padding: var(--space-md);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.seasonal__card h3 {
  margin-block-end: var(--space-2xs);
}

.seasonal__card p {
  max-width: var(--measure-seasonal-card);
  margin-block-end: var(--space-sm);
}

@media (min-width: 64em) {
  .seasonal__grid {
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }
}

/* --- Explainer — blowout-startup-explained (brief §4 row 3, §5) ------------
   2-column 1fr/1fr grid at >=64em, gap --space-xl (64px). The inset image
   sits in the left column's header only. */

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

.explainer__col-head img {
  width: 100%;
  max-width: var(--explainer-inset-mobile);   /* ~224px drawn at mobile; capped further at desktop below */
  margin-block-end: var(--space-sm);
}

.explainer__col-head h3 {
  margin: 0;
}

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

.explainer__index li {
  display: flex;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
  max-width: var(--measure-explainer-row);
}

/* Nested-counter distinction (design-rules §5): italic display + amber-
   text role — no section-level numbering on this page to clash with. */
.explainer__n {
  flex: none;
  min-width: var(--explainer-n-width);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-accent-warm-text);
}

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

  .explainer__col-head img {
    max-width: var(--explainer-inset-desktop);  /* 340px, brief §5's stated desktop cap */
  }
}

/* --- Services — services-specific (brief §4 row 4, §5) ---------------------
   3-column grid (6 cards, 3x2) at >=64em, gap --space-lg (40px). The
   controller inset is a secondary focal point beside its own card only. */

.services__grid {
  display: grid;
  gap: var(--space-md);
  margin-block-start: var(--space-lg);
  padding: 0;
  list-style: none;
}

.services__card {
  padding: var(--space-md);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.services__card h3 {
  font-size: var(--text-h3);
  margin: 0 0 var(--space-2xs);
  max-width: var(--measure-services-card);
}

.services__card p {
  max-width: var(--measure-services-card);
  margin: 0;
}

.services__card--controller img {
  width: var(--services-icon-size);    /* 96px, fixed, brief §5 */
  height: var(--services-icon-size);
  margin-block-end: var(--space-sm);
}

@media (min-width: 64em) {
  .services__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-lg);
  }
}

/* --- Trust line — named technicians + tenure (brief §4 row 5, §5) ---------
   Lead paragraph centred 62ch; 3-col quote-card grid at >=64em, gap
   --space-md (24px). */

.trust__lead {
  margin-inline: auto;
  text-align: center;
  font-size: var(--text-lead);
}

.trust__grid {
  display: grid;
  gap: var(--space-md);
  margin-block-start: var(--space-lg);
  padding: 0;
  list-style: none;
}

.trust__card {
  padding: var(--space-md);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.trust__card blockquote {
  margin: 0;
  max-width: var(--measure-trust-card);
}

.trust__card p {
  margin: 0;
}

.trust__attribution {
  margin-block-start: var(--space-sm);
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

@media (min-width: 64em) {
  .trust__grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* --- Service area (brief §4 row 6, §5) -------------------------------------
   Centred single column, 60ch, inside the container. */

.service-area__col {
  max-width: var(--measure-service-area);
  margin-inline: auto;
  text-align: center;
}

.service-area__col p {
  max-width: none;
}

/* --- Reviews — aggregate (brief §4 row 7, §5) -------------------------------
   2-column 35/65 split at >=64em, gap --space-xl (64px). */

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

.reviews__stat-figure {
  margin-block-start: var(--space-sm);
  font-size: var(--text-lead);
  color: var(--color-accent);
  font-weight: var(--font-weight-body-strong);
}

.reviews__quotes {
  display: grid;
  gap: var(--space-md);
}

.reviews__quote {
  max-width: var(--measure-reviews-quote);
}

.reviews__quote blockquote {
  margin: 0;
}

.reviews__attribution {
  margin-block-start: var(--space-sm);
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

/* Decorative rating-star mark, drawn stand-in for copy.md's ★ (Critic r1
   FIX). One rule, every call site. */
.star-icon {
  display: inline-block;
  width: var(--star-icon-size);
  height: var(--star-icon-size);
  vertical-align: var(--star-icon-shift);
  fill: currentColor;
}

@media (min-width: 64em) {
  .reviews__grid {
    grid-template-columns: 35% 1fr;
    gap: var(--space-xl);
    align-items: start;
  }
}

/* --- Request form (brief §4 row 8, §5): centred single column, 62ch,
   at every width >=1024px too — a form reads best narrow. --- */
.contact__col {
  max-width: var(--layout-measure);
  margin-inline: auto;
}

/* --- FAQ (brief §4 row 9, §5) -----------------------------------------------
   2-col Q/A grid at >=64em, gap --space-lg (40px). */

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

.faq__item h3 {
  font-size: var(--text-h3);
  margin: 0 0 var(--space-2xs);
}

.faq__item p {
  max-width: var(--measure-faq-answer);
  margin: 0;
}

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

/* --- Footer -----------------------------------------------------------------
   House primitives extended with the brief's extra content (service-area
   recap, bare license recap) in a 3-column row at >=64em, gap --space-lg
   (brief §5 footer row). */

.site-footer__grid {
  display: grid;
  gap: var(--space-md);
}

.site-footer__area {
  margin: 0;
}

.site-footer__meta p {
  margin: 0;
}

.site-footer__meta p + p {
  margin-block-start: var(--space-2xs);
}

.site-footer__rights {
  margin: 0;
}

@media (min-width: 64em) {
  .site-footer__grid {
    grid-template-columns: repeat(3, 1fr);
    align-items: start;
    gap: var(--space-lg);
  }

  .site-footer__rights {
    grid-column: 1 / -1;
  }
}
