/* ============================================================
   406-site-kit — CHASSIS
   ============================================================
   Structure only. Authored ONLY against the token contract
   (tokens/contract.css) — a literal color in this file is a
   defect, and `python scripts/lint-site-kit.py --self-test`
   fails the build on one.

   Extracted 2026-08-09 from airtight-site (the reference build)
   with the focus/a11y layer folded in. Brand-specific pieces
   (Air Tight's .brand-hvacr slash, the .safety ribbon) stay in
   that site's own CSS — this file must work for every brand.

   Load order in a consuming site:
     fonts.css → tokens.css (the filled contract) → chassis.css
     → <page>.css → site a11y overrides (optional, last)
   ============================================================ */

/* ---- Reset-ish ---- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--body);
  font-size: var(--fs-400);
  line-height: 1.6;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent-deep); }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--display); line-height: 1.05; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 2.5rem); }

/* ---- A11y primitives ---- */
.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0; z-index: 100;
  background: var(--surface-dark); color: var(--on-dark); padding: 0.6rem 1rem;
}
.skip-link:focus { left: 0; color: var(--on-dark); }

/* Keyboard-only focus, branded */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
.site-header :focus-visible,
.site-footer :focus-visible,
.section-dark :focus-visible,
.btn-solid:focus-visible {
  outline-color: var(--on-dark);
}

/* Never break a phone number or email across lines */
a[href^="tel:"],
a[href^="mailto:"],
.nowrap { white-space: nowrap; }

/* ---- Buttons ---- */
.btn {
  display: inline-block;
  font-family: var(--display);
  font-weight: 600;
  font-size: var(--fs-400);
  letter-spacing: 0.01em;
  text-decoration: none;
  border-radius: var(--radius-btn);
  padding: 0.78rem 1.5rem;
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), color 0.15s var(--ease);
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-solid { background: var(--accent); color: var(--accent-ink); }
.btn-solid:hover { background: var(--accent-hover); color: var(--accent-ink); transform: translateY(-1px); }
.btn-ghost { border: 1.5px solid var(--ink); color: var(--ink); }
.btn-ghost:hover { background: var(--ink); color: var(--surface-alt); transform: translateY(-1px); }
.btn-ghost-light { border: 1.5px solid var(--on-dark-faint); color: var(--on-dark); }
.btn-ghost-light:hover { background: var(--on-dark); color: var(--ink); transform: translateY(-1px); }

/* ---- Header ---- */
.site-header {
  background: var(--surface-dark);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  min-height: 72px; gap: 1rem;
}
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; }
.brand-mark { width: 52px; height: auto; }
.brand-mark--padded { background: var(--surface-alt); border-radius: 6px; padding: 3px 5px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-name {
  font-family: var(--display); font-weight: 700; font-size: var(--fs-600);
  color: var(--on-dark); letter-spacing: 0.045em;
}
.brand-sub {
  font-size: var(--fs-100); color: var(--on-dark-faint);
  letter-spacing: 0.14em; text-transform: uppercase;
}
.nav-list {
  display: flex; align-items: center; gap: clamp(0.9rem, 2vw, 1.8rem);
  list-style: none; margin: 0; padding: 0;
}
.nav-list a:not(.btn) {
  color: var(--on-dark-muted); text-decoration: none;
  font-weight: 500; font-size: var(--fs-300); padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
}
.nav-list a:not(.btn):hover,
.nav-list a[aria-current="page"]:not(.btn) { color: var(--on-dark); border-bottom-color: var(--accent); }
.nav-toggle { display: none; }

/* ---- Footer ---- */
.site-footer { background: var(--surface-dark); color: var(--on-dark-muted); margin-top: clamp(4rem, 8vw, 7rem); }
.footer-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr;
  gap: clamp(1.5rem, 4vw, 4rem); padding-top: 3.5rem; padding-bottom: 2.5rem;
}
.footer-logo { margin-bottom: 0.9rem; }
.footer-logo--padded { background: var(--surface-alt); border-radius: 8px; padding: 6px 10px; }
.footer-name { font-family: var(--display); font-weight: 600; font-size: var(--fs-400); color: var(--on-dark); margin-bottom: 0.2rem; }
.footer-line { font-size: var(--fs-200); color: var(--on-dark-faint); }
.footer-head {
  font-size: var(--fs-100); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--on-dark-faint); margin-bottom: 0.9rem; font-family: var(--body); font-weight: 600;
}
.site-footer a { color: var(--on-dark); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-col p { margin-bottom: 0.45rem; }
.hours-row { display: flex; justify-content: space-between; gap: 1rem; max-width: 300px; }
.hours-row span:last-child { color: var(--on-dark); }
.footer-base {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem;
  border-top: 1px solid var(--line-on-dark);
  padding-top: 1.4rem; padding-bottom: 1.6rem; font-size: var(--fs-200); color: var(--on-dark-faint);
}
.footer-base p { margin: 0; }
.powered a,
.footer-legal a { color: var(--on-dark-faint); }
.powered a:hover,
.footer-legal a:hover { color: var(--on-dark); }

/* ---- Sections / shared ---- */
.section { padding: var(--section-pad) 0; }
.section-dark { background: var(--surface-dark); color: var(--on-dark); }
.kicker {
  font-family: var(--display); font-weight: 600; font-size: var(--fs-200);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent-deep);
  margin-bottom: 0.6rem;
}
.section-dark .kicker { color: var(--accent); }
.h-xl { font-size: clamp(2.6rem, 6vw, 4.4rem); font-weight: 700; letter-spacing: -0.01em; }
.h-lg { font-size: clamp(2rem, 4.2vw, 3rem); font-weight: 700; }
.h-md { font-size: clamp(1.35rem, 2.4vw, 1.7rem); font-weight: 600; }
.lede { font-size: clamp(1.1rem, 1.8vw, 1.3rem); color: var(--ink-muted); max-width: 34em; }
.section-dark .lede { color: var(--on-dark-muted); }

/* ---- Reveal on scroll (js/site.js adds .in) ----
   FAILS VISIBLE. The hidden state is scoped to `html.js`, a class set by the
   boot script at the top of includes/header.njk. If that script never runs --
   blocked, stripped by a proxy, an old browser, a JS error earlier on the page
   -- .reveal simply stays visible, instead of hiding content forever with
   nothing left to un-hide it.

   Measured on a consuming site before this changed: three homepage cards sat
   at opacity 0 permanently with JavaScript disabled, and nothing in the build,
   the lint or the browser audit said so. A screenshot found it.

   🔴 Do NOT move the hidden state back onto bare `.reveal`, and do not remove
   the boot script from header.njk -- either one alone restores the bug.
   `lint-site-kit.py --self-test` checks both. */
@media (prefers-reduced-motion: no-preference) {
  html.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity 0.65s var(--ease), transform 0.65s var(--ease); }
  html.js .reveal.in { opacity: 1; transform: none; }
}

/* ---- Reduced motion: kill everything ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* ---- Mobile ---- */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex; flex-direction: column; gap: 5px;
    background: none; border: 0; padding: 0.6rem; cursor: pointer;
  }
  .nav-toggle-bar { width: 24px; height: 2px; background: var(--on-dark); transition: transform 0.2s var(--ease), opacity 0.2s; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav-list {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--surface-dark); padding: 0.5rem 1.25rem 1.25rem;
    border-top: 1px solid var(--line-on-dark);
  }
  .nav-list.open { display: flex; }
  .nav-list li { border-bottom: 1px solid var(--line-on-dark); }
  .nav-list li:last-child { border-bottom: 0; }
  .nav-list a:not(.btn) { display: block; padding: 0.9rem 0; border-bottom: 0; }
  .nav-cta { padding-top: 0.9rem; }
  .nav-cta .btn { display: block; text-align: center; }
  .site-nav { position: static; }
  .header-row { position: relative; }
  .footer-grid { grid-template-columns: 1fr; }
  .footer-base { flex-direction: column; }
}
