/* site.css — Apex Trees & Turf. Layout and components built FROM tokens
   (house-tech-spec §3: no raw hex/px/font literals outside tokens.css — the
   two escape hatches are the house breakpoints and an explicit
   `@allow-literal: reason` comment). Archetype: ledger-stack. Family:
   editorial-modern. Source: runs/apex-trees-and-turf-logan-ut/brief.md. */

/* --- 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: closed is the plain CSS default below 48em (no JS
   gate), so there's no post-paint collapse race. JS-off visitors get the nav
   back via the <noscript> override in @shared:head-boilerplate. */
.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);
}

/* Brief §2's contrast table states the primary CTA explicitly as the site's
   own reversed ink/bg pair (14.64:1), not a separate hued accent — the
   generic --color-accent/--color-accent-ink pair is reserved for base.css's
   skip-link only (tokens.css's own note). */
.btn--primary {
  background-color: var(--color-ink);
  color: var(--color-bg);
}

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

/* ==========================================================================
   BRIEF COMPONENTS — runs/apex-trees-and-turf-logan-ut/brief.md §4/§5/§6/§8.
   ========================================================================== */

/* --- Eyebrow ---------------------------------------------------------------
   Natural-case source text, CSS-uppercased (house-tech-spec §8's labelling
   rule). accent-ink is the ONLY accent variant that carries text (brief §2). */

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

h2 {
  font-style: normal;  /* brief §3: upright Instrument Serif for h2, italic reserved for the hero */
  margin-block-start: var(--space-2xs);
}

/* --- Hero -------------------------------------------------------------------
   "The crown is measured" (brief §5). Single-column stack <48em; a 2-col
   grid >=48em where only .hero__field takes an explicit column (brief §6) —
   no DOM reorder, grid-auto-flow: dense lets the text items backfill column
   1 around it. Never reveal-gated (house rule); the hero carries its own
   signature motion instead. --------------------------------------------- */

.hero {
  padding-block-start: var(--space-lg);
  padding-block-end: var(--section-gap);
  background-color: var(--color-bg);
}

.hero__inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-sm);
}

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

.hero__title {
  margin: 0 0 var(--space-sm);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: var(--font-weight-display);
  font-size: var(--text-h1);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
}

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

.hero__field {
  position: relative;
  aspect-ratio: var(--hero-field-ratio);
  max-inline-size: 100%;
  margin-block-end: var(--space-md);
  overflow: hidden;
}

.hero__field picture,
.hero__field img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hero__overlay--wide {
  display: none;
}

.hero__lead {
  max-width: var(--measure-hero-text);
  margin: 0 0 var(--space-sm);
  font-size: var(--text-lead);
  line-height: var(--leading-body);
}

.hero__facts {
  margin: 0;
  padding-block-start: var(--space-sm);
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
  color: var(--color-ink-muted);
  font-size: var(--text-small);
}

@media (min-width: 48em) {
  .hero__inner {
    /* minmax(0, 1fr), not bare 1fr: a bare <flex> track's min sizing
       function is "auto", which resolves against the track's item content
       — here .hero__field's fixed --hero-field-width (600px) — so the track
       never shrinks below it and the declared 1fr 1fr split collapses the
       text column instead of realizing 50/50 (lensA/hero-grid, r1 FIX).
       Explicit minmax(0, 1fr) sets the track's min sizing function to a
       literal 0 instead, so both tracks actually share the available
       space; .hero__field's own `max-inline-size: 100%` then does what it
       already says and caps the field to whatever its track resolves to. */
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    column-gap: var(--space-2xl);
    row-gap: var(--space-sm);
    grid-auto-flow: row dense;
    align-items: start;
  }

  .hero__inner > :not(.hero__field) {
    max-width: var(--measure-hero-text);
  }

  .hero__field {
    grid-column: 2;
    /* Spans the 5 implicit rows the text items occupy — NOT "1 / -1", which
       resolves against the explicit grid (none declared) and collapses to
       zero, dumping the field's full height into row 1 alone (measured: a
       537px gap, desktop-audit's void check). An explicit span distributes
       the field's height across all 5 rows via the track-sizing algorithm. */
    grid-row: 1 / span 5;
    align-self: center;
    inline-size: var(--hero-field-width);
    max-inline-size: 100%;
    aspect-ratio: var(--hero-field-ratio-wide);
    margin-block-end: 0;
  }

  .hero__overlay--narrow {
    display: none;
  }

  .hero__overlay--wide {
    display: block;
  }
}

/* The signature — "the crown is measured" (brief §5/§8). One-shot annotation
   draw, then two independent ambient loops, never synced to each other or to
   anything else on the page. pathLength="100" on the arc (index.html)
   normalises stroke-dasharray/offset so both viewBox variants share one
   keyframe regardless of their differing geometry. */

.hero__annotation-arc {
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  animation: hero-crown-draw var(--duration-signature-draw) var(--ease-out) forwards;
}

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

.hero__annotation-tick {
  transform-box: fill-box;
  transform-origin: center;
  animation: hero-tick-float var(--duration-tick-float) var(--ease-in-out) infinite;
}

@keyframes hero-tick-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(calc(var(--hero-tick-drift) * -1)); }
}

.hero__leaf-sway {
  transform-box: fill-box;
  animation: hero-leaf-sway var(--duration-leaf-sway) var(--ease-in-out) infinite;
}

@keyframes hero-leaf-sway {
  0%, 100% { transform: rotate(calc(var(--hero-leaf-rotate) * -1)); }
  50% { transform: rotate(var(--hero-leaf-rotate)); }
}

/* Reduced motion: the settled visual state, set explicitly (brief §8) rather
   than relied upon from a near-zero duration — the arc reads fully drawn,
   the tick and leaf sit at rest. No !important: these rules simply exist
   only in this file, so normal cascade order wins (house-tech-spec §12). */
@media (prefers-reduced-motion: reduce) {
  .hero__annotation-arc {
    stroke-dashoffset: 0;
    animation: none;
  }

  .hero__annotation-tick {
    animation: none;
    transform: translateY(0);
  }

  .hero__leaf-sway {
    animation: none;
    transform: rotate(0deg);
  }
}

/* --- "What the Visit Covers" — ledger-stack (brief §4/§6/§9) ---------------
   One continuous reading column, 45rem/60ch. Numbered rows carry the italic
   Instrument Serif numerals (ref-011's borrowed device) against Work Sans
   body — never cards, never icons. */

.ledger__strip {
  line-height: 0;
}

.ledger__strip img {
  width: 100%;
  height: var(--ledger-strip-height);
  object-fit: cover;
}

.ledger__container {
  max-width: var(--measure-ledger);
  margin-inline: auto;
}

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

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

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

.ledger__num {
  flex: none;
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-h2);
  line-height: 1;
  color: var(--color-accent-ink);
}

.ledger__body {
  display: block;
}

.ledger__row-title {
  display: block;
  font-weight: var(--font-weight-body-strong);
  margin-block-end: var(--space-3xs);
}

.ledger__row-desc {
  display: block;
  color: var(--color-ink-muted);
}

/* --- Reviews — pull-quote band (brief §6/§7) -------------------------------
   One large verbatim quote in upright Instrument Serif, two attributed lines
   beneath at the house body measure, a dated rating anchor. */

.reviews__pullquote {
  margin: var(--space-md) 0 0;
  max-width: var(--measure-reviews-quote);
}

.reviews__pullquote blockquote {
  margin: 0;
}

.reviews__pullquote p {
  margin: 0;
  font-family: var(--font-display);
  font-style: normal;
  font-size: var(--text-pullquote);
  line-height: var(--leading-tight);
}

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

.reviews__more {
  margin: var(--space-lg) 0 0;
  display: grid;
  gap: var(--space-md);
  max-width: var(--layout-measure);
}

.reviews__more blockquote {
  margin: 0;
}

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

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

/* --- About — short, V-tier only (brief §6/§7) ------------------------------
   Low-opacity treeline backdrop; text sits on flat bg regardless, so the
   backdrop carries no contrast obligation of its own. */

.about {
  position: relative;
  overflow: hidden;
}

.about__backdrop {
  position: absolute;
  inset: 0;
  z-index: var(--z-base);
  opacity: var(--about-backdrop-opacity);
}

.about__backdrop img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.about__container {
  position: relative;
  z-index: 1;
  max-width: var(--measure-about);
  margin-inline: auto;
}

.about__container p + p {
  margin-block-start: var(--space-sm);
}

/* --- "Get a Quote" — inverted CTA band (brief §4/§6/§9) --------------------
   The site's own validated ink/bg pair, reversed. Phone CTA (primary) above
   the house form (secondary), one narrow centred column at every width —
   never a two-column desktop treatment (brief §6). */

.band {
  background-color: var(--color-ink);
  color: var(--color-bg);
}

.band :focus-visible {
  outline-color: var(--color-focus-on-band);
}

.band__container {
  max-width: var(--measure-cta);
  margin-inline: auto;
}

.band__intro {
  margin-block-start: var(--space-sm);
}

.band__cta-row {
  margin-block-start: var(--space-md);
}

/* The band's own CTA swaps fill/label so it reads against the dark ground —
   the same ink/bg pair, reversed again (still 14.64:1, no new pairing). */
.band .btn--primary {
  background-color: var(--color-bg);
  color: var(--color-ink);
}

.band .form {
  margin-block-start: var(--space-lg);
  max-width: none;
}

.band .field__control {
  background-color: transparent;
  color: var(--color-bg);
  border-color: var(--color-bg);
}

.band .field__hint {
  color: var(--color-border);
}

.band .form__status {
  color: var(--color-border);
}

.band .form__status[data-state='error'] {
  color: var(--color-bg);
}
