/* ==========================================================================
   site.css — per-site layout & components, built FROM tokens.

   HARD RULE (house-tech-spec §3): no raw hex, no px/rem size literals, no
   font-name literals in this file. Tokens only. The Critic greps for it.
   The two escape hatches are the house breakpoints and an explicit
   `@allow-literal: reason` comment on the preceding line.

   WHAT THE SKELETON SHIPS HERE, AND WHY IT SHIPS SO LITTLE
   --------------------------------------------------------
   Only the shell: header/nav, the section rhythm hook, buttons, the form, the
   footer. That is everything a site needs structurally and nothing that
   decides how it looks.

   The skeleton deliberately ships NO hero, NO card grid, NO feature row, NO
   testimonial block and NO section-heading pattern. Those come from the
   approved brief's layout archetype (design-rules §7) and are written per
   site. A skeleton that shipped them would hand every business the same page
   with different colours — which is the exact failure the DNA registry
   exists to prevent, and it would collide head-on with the banned-defaults
   list (design-rules §4: three-card grids, four-stat rows, centred hero with
   two pill buttons, every section the same padding with a centred heading).

   And when a brief's archetype numbers its sections, its sub-lists take a
   visibly different mark — different numeral system, face and colour role —
   or no mark at all (design-rules §4, "two counters in one costume").

   Builder: extend this file with the brief's components. Do not "fill in" a
   hero here from memory — the brief is law (spec §12).
   ========================================================================== */

/* --- 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);
  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);
  /* 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 (this skeleton-level defect was confirmed present,
   verbatim, on every site built from it -- see
   runs/3-elements-landscaping-asheville-nc/qa/critic-round-2.md): the
   collapsed state used to apply only once a deferred `type="module"`
   script called `initNav()` and set `[data-nav-ready]`, so the full nav
   list rendered open at first paint and then collapsed into the hamburger
   AFTER first contentful paint -- a timing race with no fixed outcome that
   shifted the whole header (and everything below it) and scored CLS
   0.066-0.094 in the majority of Lighthouse runs. Inverting the default
   removes the race entirely: closed is now the plain CSS default below
   48em, with no JS gate, so there is nothing left to collapse post-paint.
   The one visitor this would otherwise strand -- JS off, so
   `[data-nav-ready]` never lands -- gets the nav back via the <noscript>
   stylesheet override in `@shared:head-boilerplate` (index.html/buy.html/
   thanks.html), which ships last in source order and wins the
   display:block/display:none tie on cascade order alone, no
   `!important`. The nav-toggle button already ships `hidden` in the HTML
   and only JS ever clears that, so JS-off visitors never see a dead
   control -- nothing to change there. */
.site-nav {
  display: none;
  flex-basis: 100%;
  order: 1;
}

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

/* The header call control (W65): (0,2,0) beats .btn (0,1,0) wherever declared;
   this base rule stays BEFORE the 48em block, which restores padding at equal
   specificity by source order. */
.site-header .site-header__call {
  flex: none;
  padding: 0;
  min-inline-size: var(--layout-tap-min);
}

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

.btn--primary {
  background-color: var(--color-accent);
  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);
  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);
}

/* 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;
}

/* ==========================================================================
   Kerr Country Pump Service — "the ledger keeps" (brief §2, §6, §7, §8).
   family: warm-craft · archetype: ledger-stack. Everything below is the
   brief's own section plan (§6.3) and desktop composition (§6.2).
   ========================================================================== */

/* --- Sticky header (brief §6.1) -------------------------------------------
   Permanent, survives purchase. css/preview.css adds the offset that stacks
   it below the preview-only expiry bar and removes cleanly with that file. */

.site-header {
  position: sticky;
  inset-block-start: 0;
  padding-block: var(--space-xs);
}

/* --- Shared section furniture ----------------------------------------------
   The ledger's own ruled-row divider, flattened to a static, thickened rule
   and reused atop every section below (brief §8's signature move) — the
   whole page reads as entries in one continuous ledger. */

.eyebrow {
  margin: 0;
  font-family: var(--font-body);
  font-size: var(--text-eyebrow);
  font-weight: var(--font-weight-body-strong);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-accent);
}

.head-rule {
  /* @allow-literal: a short fixed-width ornament, not a layout value */
  inline-size: 3rem;
  block-size: var(--border-thick);
  margin-block-end: var(--space-md);
  background-color: var(--color-rule);
}

.section h2 {
  margin-block-start: var(--space-2xs);
  font-size: var(--text-h2);
}

.lede {
  margin-block-start: var(--space-sm);
  color: var(--color-ink-muted);
}

.section--alt {
  background-color: var(--color-surface);
}

/* --- Hero — "the ledger keeps" (brief §6.1, §7, §8) ------------------------ */

.hero {
  padding-block-start: var(--space-md);
  padding-block-end: var(--section-gap);
  background:
    radial-gradient(90% 70% at 72% 10%, var(--color-surface) 0%, transparent 60%),
    var(--color-bg);
}

.hero__container {
  display: flex;
  flex-direction: column;
}

.hero__h1 {
  margin-block: var(--space-2xs) var(--space-md);
  font-size: var(--text-h1);
  color: var(--color-ink);
}

.hero__cta {
  margin: 0;
}

.hero-field {
  margin-block-start: var(--space-md);
}

.hero-field__frame {
  position: relative;
  isolation: isolate;
  overflow: clip;
  block-size: var(--field-height);
}

.hero-field__frame picture,
.hero-field__bg {
  display: block;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  object-position: 50% 30%;
}

.hero__lead {
  margin-block-start: var(--space-sm);
  font-size: var(--text-lead);
  color: var(--color-ink-muted);
  max-width: var(--measure-lead);
}

.hero__fact {
  margin-block-start: var(--space-xs);
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  font-family: var(--font-display);
  font-size: var(--text-fact);
  font-weight: 600;
  color: var(--color-accent);
  background-color: var(--color-surface);
  border: var(--border-hairline) var(--border-style) var(--color-border-strong);
  border-radius: var(--radius-sm);
  padding: var(--space-3xs) var(--space-xs);
}

/* --- Living-hero overlays: four independent, non-synced loops (brief §8) -- */

.hero__cable,
.hero__sprig,
.hero__page,
.hero__glint {
  position: absolute;
  pointer-events: none;
}

.hero__cable {
  inset-block-start: 10%;
  inset-inline-start: 63%;
  inline-size: 6%;
  block-size: 60%;
}

.hero__cable-line {
  stroke: var(--color-ink);
  stroke-width: var(--border-thick);
  stroke-linecap: round;
}

.hero__cable-cap {
  fill: var(--color-accent);
}

.hero__cable-sway {
  transform-origin: 50% 3%;
  transform-box: fill-box;
  animation: hero-cable-sway var(--loop-cable) var(--ease-in-out) infinite alternate;
}

@keyframes hero-cable-sway {
  from { transform: rotate(-1deg); }
  to { transform: rotate(1.6deg); }
}

.hero__sprig {
  inset-block-start: 4%;
  inset-inline-start: 76%;
  inline-size: 20%;
  block-size: 42%;
}

.hero__sprig-branch {
  stroke: var(--color-ink-muted);
  stroke-width: var(--border-thick);
  stroke-linecap: round;
}

.hero__sprig-leaf {
  fill: var(--color-ink-muted);
  opacity: 0.85;
}

.hero__sprig-sway {
  transform-origin: 50% 100%;
  transform-box: fill-box;
  animation: hero-sprig-sway var(--loop-sprig) var(--ease-in-out) infinite alternate;
}

@keyframes hero-sprig-sway {
  from { transform: rotate(1.2deg); }
  to { transform: rotate(-1.4deg); }
}

.hero__page {
  inset-block-start: 56%;
  inset-inline-start: 2%;
  inline-size: 26%;
  block-size: 26%;
}

.hero__page-leaf {
  fill: var(--color-surface);
  stroke: var(--color-ink-muted);
  stroke-width: var(--border-hairline);
}

.hero__page-rule {
  stroke: var(--color-accent);
  stroke-width: var(--border-hairline);
}

.hero__page-flutter {
  transform-origin: 2% 50%;
  transform-box: fill-box;
  animation: hero-page-flutter var(--loop-page) var(--ease-in-out) infinite alternate;
}

@keyframes hero-page-flutter {
  from { transform: rotate(-1.5deg); }
  to { transform: rotate(1deg); }
}

.hero__glint {
  inset-block-start: 12%;
  inset-inline-start: 63%;
  inline-size: 7%;
  block-size: 7%;
}

.hero__glint-dot {
  fill: var(--color-water);
  animation: hero-glint-pulse var(--loop-glint) var(--ease-in-out) infinite;
}

@keyframes hero-glint-pulse {
  0%, 100% { opacity: 0.25; }
  50% { opacity: 0.8; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__cable-sway,
  .hero__sprig-sway,
  .hero__page-flutter,
  .hero__glint-dot {
    animation: none;
  }

  .hero__cable-sway { transform: var(--rest-cable); }
  .hero__sprig-sway { transform: var(--rest-sprig); }
  .hero__page-flutter { transform: var(--rest-page); }
  .hero__glint-dot { opacity: var(--rest-glint-opacity); }
}

/* --- Services — "The Work, Line by Line" (brief §6.3 row 2) ---------------
   01-07, EB Garamond 600 numerals in accent colour — the page's only
   counter role (brief §6.4). */

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

.services__row {
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-block-end: var(--border-hairline) var(--border-style) var(--color-border);
}

.services__row:first-child {
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.services__num {
  flex: none;
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--text-ledger-value);
  color: var(--color-accent);
  /* @allow-literal: aligns a 2-digit numeral column, not a design value */
  min-inline-size: 2ch;
}

.services__label {
  font-size: var(--text-body);
}

/* Mobile-only accent (brief §7 slot 2); the desktop composition's own
   Image/field cell reads "None — typographic numerals only" (brief §6.2),
   so this drops at >=64em rather than crowding the two-column index. */
.services__specimen {
  margin-block-start: var(--space-lg);
  max-inline-size: var(--space-3xl);
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.services__specimen img {
  inline-size: 100%;
  block-size: auto;
}

/* --- The Ledger: What the Book Says (brief §6.3 row 3) --------------------
   Field/value table, no numerals — the record register. */

.container--narrow {
  max-width: var(--content-ledger);
}

.ledger-table {
  margin-block-start: var(--space-lg);
  padding-inline: var(--space-md);
  background-color: var(--color-bg);
}

.ledger-table__row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3xs);
  padding-block: var(--space-sm);
  margin: 0;
  border-block-end: var(--border-hairline) dashed var(--color-rule);
}

.ledger-table__row:first-child {
  border-block-start: var(--border-hairline) dashed var(--color-rule);
}

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

.ledger-table__value {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--text-ledger-value);
  color: var(--color-ink);
}

/* Mobile-only accent (brief §7 slot 3); desktop's Image/field cell also
   reads "None" (brief §6.2), so this drops at >=64em. */
.ledger__specimen {
  margin-block-start: var(--space-lg);
  max-inline-size: var(--space-3xl);
  border: var(--border-hairline) var(--border-style) var(--color-border);
}

.ledger__specimen img {
  inline-size: 100%;
  block-size: auto;
}

/* --- Ledger Entries (brief §6.3 row 4) ------------------------------------- */

.container--entries {
  max-width: var(--content-entries);
}

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

.entries__quote {
  margin: 0;
  font-size: var(--text-lead);
  color: var(--color-ink);
}

.entries__quote p {
  margin: 0;
}

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

.section-divider { margin-block: var(--space-lg); background-color: var(--color-surface); }
.section-divider picture { display: block; margin-inline: auto; max-inline-size: var(--content-ledger); }
.section-divider__img { display: block; inline-size: 100%; block-size: auto; }

/* --- Call / Consult (brief §6.3 row 5) -------------------------------------- */

.container--consult {
  max-width: var(--content-consult);
}

.form {
  margin-block-start: var(--space-lg);
}

/* --- Footer — 3-col at desktop (brief §6.2) -------------------------------- */

.site-footer__inner {
  display: grid;
  gap: var(--space-lg);
  margin-block-end: var(--space-lg);
}

.site-footer__cell p {
  margin: 0;
}

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

/* --- Desktop composition, >= 64rem (brief §6.2) --------------------------- */

@media (min-width: 64em) {

  .hero__container {
    display: grid;
    grid-template-columns: var(--content-hero-text) var(--content-hero-field);
    align-items: start;
    gap: 0;
  }

  .hero {
    padding-block-start: var(--space-2xl);
  }

  /* Explicit row numbers, not auto-placement: the field's grid-row: 1/-1
     span (below) resolves against the IMPLICIT grid size, and intermixing
     that with auto-flowed column-1 siblings left a 585px void between the
     eyebrow and H1 (desktop-audit desktop/void) — numbering every row
     removes the ambiguity rather than fighting it. */
  .hero__container > .eyebrow,
  .hero__container > .hero__h1,
  .hero__container > .hero__cta,
  .hero__container > .hero__lead,
  .hero__container > .hero__fact {
    grid-column: 1;
    padding-inline-end: var(--space-xl);
  }

  .hero__container > .eyebrow   { grid-row: 1; }
  .hero__container > .hero__h1  { grid-row: 2; }
  .hero__container > .hero__cta { grid-row: 3; }
  .hero__container > .hero__lead { grid-row: 4; }
  .hero__container > .hero__fact { grid-row: 5; }

  .hero__container > .hero-field {
    grid-column: 2;
    grid-row: 1 / 6;
    margin-block-start: 0;
    align-self: stretch;
  }

  .hero-field {
    block-size: 100%;
  }

  .hero-field__frame {
    block-size: 100%;
    min-block-size: var(--field-height-desktop);
  }

  .hero__h1 {
    max-width: var(--measure-h1-desktop);
  }

  .services {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(4, auto);
    grid-auto-flow: column;
    column-gap: var(--services-col-gap);
    row-gap: 0;
  }

  .services__row {
    align-self: start;
  }

  /* Column flow (grid-auto-flow: column, above) puts item 05 at the top of
     the second column, so it takes the same top rule item 01 takes. */
  .services__row:nth-child(5) {
    border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
  }

  /* Desktop's Image/field cell reads "None" for both sections (brief §6.2) —
     typographic numerals only in Services, the field/value table alone in
     the Ledger. */
  .services__specimen,
  .ledger__specimen {
    display: none;
  }

  .ledger-table__row {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-md);
  }

  /* Both centre a column < 0.6x the container; brief §6.2's correction:
     a visible left/right rule frames it rather than reading as stretched. */
  .container--entries,
  .container--consult {
    border-inline: var(--border-hairline) var(--border-style) var(--color-rule);
    padding-block: var(--space-lg);
  }

  .site-footer__inner {
    grid-template-columns: repeat(3, 1fr);
  }
}
