/* ==========================================================================
   site.css — Triple C Repair (triple-c-repair-texarkana-ar). Per-site layout
   and components, built FROM tokens (house-tech-spec §3): no raw hex, size
   or font-name literal here — the two escape hatches are the house
   breakpoints and an explicit `@allow-literal: reason` comment.
   Archetype: sidebar-anchor (brief §3). Family: editorial-modern.
   ========================================================================== */

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

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

/* --section-gap is the only inter-section spacing value (design-rules §7.1). */
.section {
  padding-block: var(--section-gap);
}

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

/* --- Header & navigation. JS off: plain always-visible link list, toggle
   stays [hidden]. Brief §3.1: header target ≤64px incl. border-bottom,
   sticky (Nic's ruling, house-tech-spec §2 — bar + header stack to the
   brief's 108px sticky-chrome figure, read by the rail's sticky offset). --- */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: var(--z-header);
  padding-block: var(--space-2xs);
  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);
}

/* Brief §3.1: wordmark "Triple C Repair" (Work Sans 600), natural case — a
   compact size so the header clears its own 64px ceiling with the two 44px
   controls beside it (--text-h3's own fluid scale is reserved for on-page
   content headings, not this fixed house chrome). */
.site-header__brand {
  font-family: var(--font-body);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink);
  text-decoration: none;
}

/* Brief §3.1: persistent tel: icon-button, distinct from the nav — icon only
   below 480px, full label joins as progressive enhancement at >=480px. */
.site-header__tel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--control-height-icon);
  min-width: var(--control-height-icon);
  color: var(--color-ink);
  text-decoration: none;
}

.site-header__tel-icon {
  inline-size: var(--space-md);
  block-size: var(--space-md);
  flex: 0 0 auto;
}

.site-header__tel-label {
  display: none;
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
}

/* 480px, brief §3.1's own joining point (media-query literal, house escape
   hatch, base.css note 1). */
@media (min-width: 30em) {
  .site-header__tel {
    min-width: 0;
    padding-inline: var(--space-2xs);
  }
  .site-header__tel-label {
    display: inline;
  }
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--control-height-icon);
  min-width: var(--control-height-icon);
  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 (skeleton-level, house-wide): closed is the plain CSS
   default below 48em, no JS gate, so nothing collapses post-paint (the old
   post-paint collapse scored CLS 0.066-0.094). JS-off visitors get the nav
   back via the <noscript> override in @shared:head-boilerplate, which ships
   last and wins the cascade tie with no `!important`. */
.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. --- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2xs);
  min-height: var(--control-height);
  padding: var(--space-xs) var(--space-md);
  border: var(--border-hairline) var(--border-style) transparent;
  border-radius: var(--radius-sm);
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  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);
}

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

/* --- Section head — the unnumbered rule + block-title, reused across every
   section (brief §3.3). Instrument Serif italic (brief §2.2). --- */

.section-head {
  margin-block-end: var(--space-lg);
}

.section-head__rule {
  display: block;
  inline-size: var(--space-xl);
  block-size: 0;
  border-top: var(--border-thick) var(--border-style) var(--color-accent);
  margin-block-end: var(--space-sm);
}

.section-head__title,
h1, h2, h3 {
  font-style: italic;
}

.section-head__title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: var(--font-weight-display);
  font-size: var(--text-h2);
  line-height: var(--leading-tight);
  color: var(--color-ink);
}

/* --- Hero — brief §3.1, stacked non-overlapping. Two atmosphere gradients
   over --color-bg, AA-verified at worst-case blend (brief §2.1). --- */

.hero {
  padding-block-start: var(--hero-pad-top);
  padding-block-end: var(--hero-pad-bottom);
  background:
    radial-gradient(120% 85% at 26% 10%, var(--color-atmo-graphite), transparent 62%),
    radial-gradient(90% 60% at 90% 85%, var(--color-atmo-amber), transparent 65%),
    var(--color-bg);
}

.mini-rail {
  margin: 0 0 var(--space-xs);
  font-size: var(--text-eyebrow);
  color: var(--color-ink-muted);
}

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

.hero__title {
  margin: var(--space-sm) 0 0;
  font-size: var(--text-hero);
  /* The one place --leading-snug overrides the h1/h2/h3 default of
     --leading-tight (brief §2.3): 1.05 crowds the italic descenders across
     this block's own two-line wrap. */
  line-height: var(--leading-snug);
  max-inline-size: var(--hero-title-measure);
}

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

/* The living-hero field — duct-run/thermostat study (§6.1 anchor) plus its
   inline-SVG overlay. Ratio-locked (tokens.css note) so coordinates hold. */

.hero__field {
  position: relative;
  overflow: hidden;
  margin: var(--space-lg) 0 0;
  aspect-ratio: var(--hero-field-ratio);
  background-color: var(--color-surface);
}

.hero__field img {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
}

.hero__overlay {
  position: absolute;
  inset: 0;
  inline-size: 100%;
  block-size: 100%;
  pointer-events: none;
}

.hero__duct-line {
  stroke-dasharray: var(--motion-draw-length);
  stroke-dashoffset: var(--motion-draw-length);
  animation: hero-draw-line var(--duration-draw) var(--ease-out) var(--delay-draw) 1 forwards;
}

.hero__dial-tick {
  /* Percentage transform-origin resolves against the viewBox (0 0 100 100),
     so this is exactly the needle's own measured pivot (80.7, 74.6). */
  transform-origin: 80.7% 74.6%;
  animation: hero-dial-tick var(--loop-dial) var(--ease-in-out) infinite;
}

.hero__dust {
  animation: hero-dust-drift var(--loop-dust) var(--ease-in-out) infinite;
}

.hero__dust--b {
  animation-delay: var(--delay-dust-b);
}

@keyframes hero-draw-line {
  from { stroke-dashoffset: var(--motion-draw-length); }
  to   { stroke-dashoffset: 0; }
}

@keyframes hero-dial-tick {
  0%, 100% { transform: rotate(-3deg); }
  50%      { transform: rotate(3deg); }
}

@keyframes hero-dust-drift {
  0%, 100% { transform: translate(0, 0); opacity: 0.4; }
  50%      { transform: translate(var(--mote-drift-x), var(--mote-drift-y)); opacity: 0.8; }
}

@media (prefers-reduced-motion: reduce) {
  .hero__duct-line {
    animation: none;
    stroke-dashoffset: 0;
  }
  .hero__dial-tick,
  .hero__dust {
    animation: none;
    opacity: 1;
  }
}

.hero__lead {
  margin: var(--space-md) 0 0;
  font-size: var(--text-small);
  line-height: var(--leading-body);
  color: var(--color-ink-muted);
  max-inline-size: var(--layout-measure);
}

.hero__facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2xs) var(--space-md);
  margin: var(--space-sm) 0 0;
  padding-block-start: var(--space-sm);
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
  list-style: none;
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

/* --- "Systems we work on" — a plain ruled index list, never a card grid
   (brief §3.3 step 3, design-rules §4). --- */

.divider-image {
  display: block;
  margin-block: var(--space-lg);
  max-inline-size: 100%;
}

.index-list {
  margin: var(--space-lg) 0 0;
  padding: 0;
  border-top: var(--border-hairline) var(--border-style) var(--color-border);
}

.index-list__row {
  counter-increment: index-row;
  padding: var(--space-sm) 0;
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
  font-size: var(--text-body);
}

.index-list__row::before {
  display: inline-block;
  inline-size: var(--index-num-width);
  content: counter(index-row, decimal-leading-zero);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-accent);
}

.index-list {
  counter-reset: index-row;
}

/* --- Trust strip — 4 tiered facts, laid flat in a row. Never a four-stat
   counter row (design-rules §4: this is text, not a big-number counter). --- */

.trust-strip {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-md);
  margin: 0;
  padding: 0;
  list-style: none;
}

.trust-strip__item {
  padding: var(--space-md);
  background-color: var(--color-surface);
  font-size: var(--text-small);
  color: var(--color-ink);
}

@media (min-width: 48em) {
  .trust-strip {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* --- Sidebar-anchor layout (brief §3.4): the 01/02/03 rail previewed in the
   hero becomes the sticky sidebar beside the process rows at >=641px;
   static, stacked, at <=640px. No third breakpoint. --- */

.layout-sidebar {
  display: block;
  padding-block-start: var(--section-gap);
}

@media (min-width: 641px) {
  .layout-sidebar {
    display: grid;
    grid-template-columns: var(--rail-column) 1fr;
    align-items: start;
    gap: var(--space-xl);
  }
}

.index-rail {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
  margin: 0 0 var(--space-lg);
  padding: 0;
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
  padding-block-end: var(--space-sm);
  list-style: none;
}

.index-rail__row {
  font-size: var(--text-small);
  font-weight: var(--font-weight-body-strong);
  color: var(--color-ink-muted);
}

.index-rail__num {
  margin-inline-end: var(--space-3xs);
  font-family: var(--font-display);
  font-style: italic;
  color: var(--color-accent);
}

@media (min-width: 641px) {
  .layout-sidebar__rail {
    position: sticky;
    inset-block-start: var(--sticky-chrome);
  }

  .index-rail {
    display: block;
    margin: 0;
    padding-block-end: 0;
    border-bottom: 0;
    border-inline-end: var(--border-hairline) var(--border-style) var(--color-border);
    padding-inline-end: var(--space-md);
  }

  .index-rail__row {
    display: block;
    padding-block: var(--space-2xs);
  }
}

/* --- Process rows (brief §3.3 step 5). Numerals in Instrument Serif italic
   (brief §2.2). No fee figure, no turnaround-time promise, in any row. --- */

.process-rows {
  margin: var(--space-lg) 0 0;
  padding: 0;
  list-style: none;
}

.process-row {
  display: flex;
  gap: var(--space-md);
  padding-block: var(--space-md);
  border-bottom: var(--border-hairline) var(--border-style) var(--color-border);
}

.process-row:first-child {
  padding-block-start: 0;
}

.process-row__num {
  flex: 0 0 auto;
  inline-size: var(--process-num-width);
  font-family: var(--font-display);
  font-style: italic;
  font-size: var(--text-h2);
  line-height: 1;
  color: var(--color-accent);
}

.process-row__heading {
  margin: 0 0 var(--space-3xs);
  font-size: var(--text-h3);
}

.process-row__body p {
  margin: 0;
  font-size: var(--text-small);
  color: var(--color-ink-muted);
  max-inline-size: var(--layout-measure);
}

/* --- Reviews — verbatim quotes, text only, no fabricated widget (brief
   §3.3 step 6). --- */

.section--reviews {
  position: relative;
  isolation: isolate;
}

/* Slot 4's texture, low opacity; every review card keeps its own opaque
   surface fill underneath the text (brief §4's contrast requirement). */
.section--reviews__bg {
  position: absolute;
  inset: 0;
  z-index: -1;
  inline-size: 100%;
  block-size: 100%;
  object-fit: cover;
  opacity: 0.5;
}

.section--reviews .container {
  position: relative;
}

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

@media (min-width: 48em) {
  .review-list {
    grid-template-columns: repeat(2, 1fr);
  }
}

.review-list__item {
  padding: var(--space-md);
  background-color: var(--color-surface);
}

.review-list__quote {
  margin: 0 0 var(--space-sm);
  font-size: var(--text-body);
  color: var(--color-ink);
}

.review-list__attribution {
  margin: 0;
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

.review-list__caption {
  margin: var(--space-lg) 0 0;
  font-size: var(--text-small);
  color: var(--color-ink-muted);
}

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