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

/* Prose rhythm for thanks.html/buy.html's bare heading+paragraph shape —
   base.css zeroes block margins. Scoped to `.measure` as a WRAPPER; index.html
   only puts `.measure` on a lone <p>, which has no matching children. */
.measure > * + * {
  margin-block-start: var(--space-md);
}

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

.site-header__brand {
  font-family: var(--font-display);
  font-size: var(--text-h3);
  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;
}

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

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

/* ---- BRIEF COMPONENTS, editorial-stack. Traces to brief.md §2-§5. ------- */

/* --- Shared typographic utilities ------------------------------------------ */

.eyebrow {
  display: block;
  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-ink-muted);
}

.section-label {
  margin-block-end: var(--space-2xs);
}

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

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

/* Low-emphasis inline text link — the services section's forward link to the
   estimate form (brief §3.3: a text link, never a second pill button). */
.text-link {
  color: var(--color-ink);
  font-weight: var(--font-weight-body-strong);
  text-underline-offset: var(--space-3xs);
}

/* --- Hero: "the filament holds" --------------------------------------------
   brief §3.2 (arithmetic), §4 (imagery), §5 (motion). DOM order: eyebrow, h1,
   primary CTA, field, lead. The panel is the hero-only dark ground
   (playbooks/electrical.md §6.1's open move); the lead sits below it, back on
   the page's own light ground. */

.hero {
  overflow: clip;
}

.panel {
  background-color: var(--color-panel);
  color: var(--color-panel-ink);
  padding-block: var(--space-md);
}

/* Dark-band-safe focus ring (house-tech-spec §8, tokens.css). Scoped to the
   panel only — every other control on the page uses --color-focus. */
.panel :focus-visible {
  outline-color: var(--color-focus-on-band);
}

.hero__eyebrow {
  color: var(--color-panel-eyebrow);
  margin-block-end: var(--space-2xs);
}

.hero__title {
  font-size: var(--text-hero);
  line-height: var(--leading-tight);
  color: var(--color-panel-ink);
  margin-block-end: var(--space-sm);
}

/* The ONE place amber is literal text colour (brief §2.3's forbidden row):
   inside .panel, on the flat panel ground, 6.40:1. The border-bottom is the
   brief's own em-relative ornament (§2.5) — fixed px via --border-thick, not
   em, so it needs no face-metrics computation. */
.hero__title em {
  font-style: italic;
  font-weight: var(--font-weight-display);
  color: var(--color-accent);
  border-bottom: var(--border-thick) var(--border-style) var(--color-accent);
  padding-block-end: var(--space-3xs);
}

.hero__cta-row {
  margin-block-end: var(--space-sm);
}

/* The living-hero field. Aspect-ratio holds brief §3.2's 375px proportion at
   every width, rather than a fixed pixel height that would crop or letterbox. */
.hero__field {
  position: relative;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  border-radius: var(--radius-md);
  background-color: var(--color-panel);
}

@media (min-width: 48em) {
  .panel {
    padding-block: var(--space-xl);
  }

  .hero__field {
    aspect-ratio: 16 / 9;
  }
}

.hero__field-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 42%;
}

/* Motion overlay — decorative, aria-hidden. Colours derive from the brief's
   own panel/accent hexes via color-mix() (tokens.css), never a new literal. */
.hero__overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* 1. Conduit line — draws once across the field's foot strip, 2.4s. */
.hero__conduit {
  position: absolute;
  inset-inline: 8%;
  inset-block-end: 10%;
  height: var(--border-hairline);
  background-color: var(--color-field-track);
}

.hero__conduit::after {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0%;
  background-color: var(--color-accent);
  animation: hero-conduit-draw var(--duration-conduit-draw) var(--ease-out) 1 forwards;
}

@keyframes hero-conduit-draw {
  to { width: 100%; }
}

/* 2. Breaker — toggles ready to engaged on an independent 5.6s loop; the one
   animation here that repeats rather than settles (brief §5: a mechanical
   idle, not a one-shot event). */
/* Blended into the photograph, not sat on top of it — a flat opaque shape
   here reads as a UI glitch, not a mechanical toggle. */
.hero__breaker {
  position: absolute;
  inset-inline-start: 14%;
  inset-block-start: 12%;
  width: 6%;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  background-color: var(--color-field-track);
  mix-blend-mode: soft-light;
  opacity: 0.6;
}

.hero__breaker-toggle {
  position: absolute;
  inset: 22%;
  border-radius: var(--radius-sm);
  background-color: var(--color-field-toggle-body);
  mix-blend-mode: soft-light;
  opacity: 0.9;
  transform-origin: top center;
  animation: hero-breaker-toggle var(--duration-breaker-loop) var(--ease-in-out) infinite;
}

@keyframes hero-breaker-toggle {
  0%, 60%, 100% { transform: rotate(0deg); }
  75% { transform: rotate(18deg); }
}

/* 3. Filament — flickers twice, settles to a steady glow, one-shot, 3.2s,
   overlapping the conduit draw. */
.hero__filament {
  position: absolute;
  inset-inline-end: 17%;
  inset-block-start: 21%;
  width: 8%;
  aspect-ratio: 1;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 45% 40%, var(--color-panel-ink) 0%, var(--color-accent) 45%, transparent 78%);
  box-shadow: 0 0 var(--glow-inner) var(--glow-inner-spread) var(--color-field-glow-inner), 0 0 var(--glow-outer) var(--glow-outer-spread) var(--color-field-glow-outer);
  animation: hero-filament-settle var(--duration-filament-settle) var(--ease-in-out) 1 both;
}

@keyframes hero-filament-settle {
  0% { opacity: 0.15; }
  10% { opacity: 1; }
  18% { opacity: 0.35; }
  30% { opacity: 1; }
  100% { opacity: 1; }
}

/* 4. Two spark marks, image slot 2 reused: one asset, two independent,
   non-synced loops (7s/9s) — ref-001's physics-not-subject caution. Screen
   blend drops the asset's flat-black ground, leaving only the glow (the
   tool has no true alpha channel to composite with instead). */
.hero__spark {
  position: absolute;
  width: 8%;
  height: auto;
  mix-blend-mode: screen;
  opacity: 0.85;
}

.hero__spark--1 {
  inset-inline-start: 30%;
  inset-block-start: 58%;
  animation: hero-spark-drift-a var(--duration-spark-1) var(--ease-in-out) infinite;
}

.hero__spark--2 {
  inset-inline-start: 58%;
  inset-block-start: 68%;
  animation: hero-spark-drift-b var(--duration-spark-2) var(--ease-in-out) infinite;
}

@keyframes hero-spark-drift-a {
  0%, 100% { transform: translate(0, 0); opacity: 0.5; }
  50% { transform: translate(var(--drift-sm), calc(var(--drift-md) * -1)); opacity: 0.9; }
}

@keyframes hero-spark-drift-b {
  0%, 100% { transform: translate(0, 0); opacity: 0.4; }
  50% { transform: translate(calc(var(--drift-sm) * -1), var(--drift-sm)); opacity: 0.85; }
}

/* Reduced motion: every loop stops at its settled end-state (spec §8) —
   conduit drawn, breaker engaged, filament at full glow, sparks present.
   Fixes the final frame; the durations themselves collapse in tokens.css. */
@media (prefers-reduced-motion: reduce) {
  .hero__conduit::after {
    animation: none;
    width: 100%;
  }

  .hero__breaker-toggle {
    animation: none;
    transform: rotate(18deg);
  }

  .hero__filament {
    animation: none;
    opacity: 1;
  }

  .hero__spark--1,
  .hero__spark--2 {
    animation: none;
    opacity: 0.7;
  }
}

.hero__lead-wrap {
  background-color: var(--color-bg);
  padding-block-start: var(--space-md);
  padding-block-end: var(--section-gap);
}

.hero__lead {
  font-size: var(--text-lead);
  color: var(--color-ink-muted);
  line-height: var(--leading-body);
}

/* --- Services: named-by-job editorial list ---------------------------------
   Rule-separated, no bullets, no card grid (design-rules §4). */

.services-list {
  margin-block-start: var(--space-md);
}

.services-list li {
  padding-block: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.services-list li:first-child {
  border-block-start: var(--border-thick) var(--border-style) var(--color-ink);
}

.services-closing {
  margin-block-start: var(--space-md);
  color: var(--color-ink-muted);
}

/* --- Proof index: rule-separated editorial list, NOT a card grid -----------
   design-rules §4's banned "four-stat counter row." No ordinal marks (brief
   §3.1's nested-counters check) — the bold lead figure is its own anchor. */

.proof-list {
  margin-block-start: var(--space-md);
}

.proof-list__row {
  display: grid;
  grid-template-columns: var(--col-proof-figure) 1fr;
  gap: var(--space-sm);
  padding-block: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.proof-list__row:first-child {
  border-block-start: var(--border-thick) var(--border-style) var(--color-ink);
}

.proof-list__figure {
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--text-h3);
  margin: 0;
}

.proof-list__copy {
  margin: 0;
  color: var(--color-ink-muted);
}

@media (max-width: 47.99em) {
  .proof-list__row {
    grid-template-columns: 1fr;
    gap: var(--space-2xs);
  }
}

.proof-list__texture {
  margin-block-start: var(--space-lg);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.proof-list__texture img {
  width: 100%;
  height: auto;
}

/* --- Reviews ---------------------------------------------------------------- */

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

.review {
  margin: 0;
  padding-inline-start: var(--space-md);
  border-inline-start: var(--border-thick) var(--border-style) var(--color-border-strong);
}

.review__quote {
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-lead);
  line-height: var(--leading-snug);
  margin: 0 0 var(--space-2xs);
}

.review__attribution {
  display: block;
  font-style: normal;
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink-muted);
}

/* --- Process: the numbered walkthrough (ref-011's index-list vocabulary) ---
   Carries an explicit textual ordinal PLUS an amber mark — visually distinct
   from the proof index's un-marked rows (brief §3.1's nested-counters check). */

.process-list {
  margin-block-start: var(--space-md);
}

.process-list__step {
  position: relative;
  padding-block: var(--space-sm);
  padding-inline-start: var(--space-lg);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.process-list__step:first-child {
  border-block-start: var(--border-thick) var(--border-style) var(--color-ink);
}

.process-list__mark {
  position: absolute;
  inset-inline-start: 0;
  inset-block-start: var(--space-sm);
  width: var(--space-xs);
  height: var(--space-xs);
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at 45% 40%, var(--color-panel-ink) 0%, var(--color-accent) 60%, var(--color-panel) 100%);
}

/* The explicit textual ordinal (brief §3.1's nested-counters check) — a
   distinct visual system from the proof index's un-ordinaled rows: numeral
   system (spelled-out "01"), face (display, not body) and colour role
   (muted ink, not the accent) all differ from that list's bold ink figure. */
.process-list__num {
  display: block;
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--text-h3);
  color: var(--color-ink-muted);
  margin-block-end: var(--space-3xs);
}

.process-list__copy {
  margin: 0;
}

.process-list__copy strong {
  color: var(--color-ink);
}

/* --- FAQ --------------------------------------------------------------------- */

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

.faq-item {
  padding-block-start: var(--space-sm);
  border-block-start: var(--border-hairline) var(--border-style) var(--color-border);
}

.faq-item:first-child {
  border-block-start: var(--border-thick) var(--border-style) var(--color-ink);
}

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

.faq-item__a {
  margin: 0;
  color: var(--color-ink-muted);
}

/* --- buy.html: seller-voice prose ------------------------------------------- */

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

.buy__terms-links a,
.buy__terms a {
  color: var(--color-ink);
}
