/* ==========================================================================
   Farnsworth Builders — farnsworthbuilders.com
   Design language ported from the Palisades Fire Rebuilding site, tuned to
   the Farnsworth brand: same editorial typography and hairline detailing,
   graphite-forward with brass reserved for accents.

   Deliberately plain CSS, no build step: this file is the entire design
   system, and the next person to maintain it needs nothing but a text
   editor. Mobile-first throughout — base rules are the phone, media queries
   add scale.
   ========================================================================== */

/* ---- Fonts (self-hosted; swap keeps text visible during load) ---------- */
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-var-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-var.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ---- Tokens ------------------------------------------------------------- */
:root {
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-sans: 'Inter', -apple-system, 'Segoe UI', Helvetica, Arial, sans-serif;

  --bone-50: #fdfcfa;
  --bone-100: #f8f5f0;
  --bone-200: #efeae1;
  --ink-950: #100d0b;
  --ink-900: #17130f;
  --ink-800: #221c17;
  --ink-500: #6b5d50;
  --ink-400: #8d7f70;
  --ink-300: #ab9e90;
  --brass-300: #d9b98a;
  --brass-500: #ab7f43;
  --brass-600: #8c6534;

  --surface: var(--bone-50);
  --surface-raised: #ffffff;
  --surface-sunken: var(--bone-100);
  --text: var(--ink-900);
  --text-muted: var(--ink-500);
  --text-faint: var(--ink-400);
  --rule: rgba(23, 19, 15, 0.12);
  --rule-strong: rgba(23, 19, 15, 0.22);
  --accent: var(--brass-600);
  --accent-soft: rgba(171, 127, 67, 0.14);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --surface: var(--ink-950);
    --surface-raised: var(--ink-900);
    --surface-sunken: #0a0807;
    --text: var(--bone-100);
    --text-muted: var(--ink-300);
    --text-faint: var(--ink-400);
    --rule: rgba(248, 245, 240, 0.14);
    --rule-strong: rgba(248, 245, 240, 0.26);
    --accent: var(--brass-300);
    --accent-soft: rgba(217, 185, 138, 0.16);
    color-scheme: dark;
  }
}

/* ---- Base --------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden; /* the page itself never scrolls sideways on a phone */
}

img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
::selection { background: var(--accent-soft); color: var(--text); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 1.12;
  text-wrap: balance;
}

/* ---- Layout primitives -------------------------------------------------- */
.container {
  width: 100%;
  max-width: 78rem;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
@media (min-width: 40rem)  { .container { padding-inline: 2rem; } }
@media (min-width: 64rem)  { .container { padding-inline: 3rem; } }

.section { padding-block: 4rem; }
.section--sunken { background: var(--surface-sunken); }
@media (min-width: 40rem) { .section { padding-block: 5rem; } }
@media (min-width: 64rem) { .section { padding-block: 7rem; } }

.hairline-t { border-top: 1px solid var(--rule); }
.hairline-b { border-bottom: 1px solid var(--rule); }

/* ---- Type utilities ------------------------------------------------------ */
.eyebrow {
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.figure-numeral {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums lining-nums;
  letter-spacing: -0.035em;
  line-height: 0.9;
}
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 0.875rem; }
.lead {
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--text-muted);
  max-width: 42rem;
}
@media (min-width: 40rem) { .lead { font-size: 1.25rem; } }

/* ---- Header ------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in oklab, var(--surface) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}
.site-header__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 4.25rem;
}
@media (min-width: 64rem) { .site-header__row { height: 5rem; } }

.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; }
.brand__mark { width: 2rem; height: auto; }
.brand__name {
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
}
.brand__name small {
  display: block;
  font-family: var(--font-sans);
  font-size: 0.55rem;
  letter-spacing: 0.42em;
  color: var(--text-muted);
}

.nav-desktop { display: none; }
@media (min-width: 64rem) {
  .nav-desktop { display: flex; align-items: center; gap: 1.6rem; }
  .nav-desktop a {
    font-size: 0.8125rem;
    letter-spacing: -0.01em;
    text-decoration: none;
    color: var(--text-muted);
    position: relative;
    transition: color 0.2s ease;
  }
  .nav-desktop a:hover { color: var(--text); }
  .nav-desktop a[aria-current='page'] { color: var(--text); }
  .nav-desktop a[aria-current='page']::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: -0.45rem;
    height: 1px;
    background: var(--accent);
  }
}
.nav-cta {
  display: none;
}
@media (min-width: 64rem) {
  .nav-cta {
    display: inline-flex;
    padding: 0.65rem 1.1rem;
    background: var(--text);
    color: var(--surface);
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    transition: opacity 0.2s ease;
  }
  .nav-cta:hover { opacity: 0.88; }
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  margin-right: -0.5rem;
  align-items: center;
  background: none;
  border: 0;
}
.nav-toggle span {
  display: block;
  width: 1.25rem;
  height: 1px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.nav-toggle[aria-expanded='true'] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded='true'] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded='true'] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
@media (min-width: 64rem) { .nav-toggle { display: none; } }

.nav-mobile {
  display: none;
  border-top: 1px solid var(--rule);
  background: var(--surface);
}
.nav-mobile.is-open { display: block; }
.nav-mobile a {
  display: block;
  padding: 0.9rem 0;
  font-family: var(--font-display);
  font-size: 1.125rem;
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
}
.nav-mobile a:last-child { border-bottom: 0; }
.nav-mobile a[aria-current='page'] { color: var(--accent); }

/* ---- Hero --------------------------------------------------------------- */
.hero { border-bottom: 1px solid var(--rule); }
.hero .container { padding-block: 3.5rem; }
@media (min-width: 40rem) { .hero .container { padding-block: 5rem; } }
@media (min-width: 64rem) { .hero .container { padding-block: 7rem; } }
.hero h1 {
  font-size: 2.25rem;
  max-width: 22ch;
  margin-top: 1.25rem;
}
@media (min-width: 40rem) { .hero h1 { font-size: 3.25rem; } }
@media (min-width: 64rem) { .hero h1 { font-size: 4.25rem; } }
.hero .lead { margin-top: 1.5rem; }
.hero__meta { margin-top: 1.5rem; font-size: 0.75rem; letter-spacing: 0.02em; color: var(--text-faint); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 1.5rem;
  background: var(--text);
  color: var(--surface);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border: 0;
  transition: opacity 0.2s ease;
}
.btn:hover { opacity: 0.88; }
.btn--ghost {
  background: transparent;
  color: var(--text-muted);
  border-bottom: 1px solid var(--rule);
  padding-inline: 0.25rem;
}
.btn--ghost:hover { color: var(--text); opacity: 1; }
.btn-row { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 2rem; }
@media (min-width: 40rem) { .btn-row { flex-direction: row; align-items: center; gap: 1.25rem; } }

.link-accent {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 0.25rem;
  transition: color 0.2s ease;
}
.link-accent:hover { color: var(--accent); }

/* ---- Section headers ----------------------------------------------------- */
.section-head { margin-bottom: 2.5rem; }
@media (min-width: 40rem) { .section-head { margin-bottom: 3.5rem; } }
.section-head h2 {
  font-size: 1.875rem;
  max-width: 24ch;
  margin-top: 1rem;
}
@media (min-width: 40rem) { .section-head h2 { font-size: 2.75rem; } }
.section-head .lead { margin-top: 1.25rem; }

/* ---- Card grids ---------------------------------------------------------- */
.grid {
  display: grid;
  gap: 1px;
  background: var(--rule);
}
.grid > * { background: var(--surface); }
.section--sunken .grid > * { background: var(--surface-sunken); }
@media (min-width: 40rem)  { .grid--2 { grid-template-columns: 1fr 1fr; } .grid--3 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 64rem)  { .grid--3 { grid-template-columns: repeat(3, 1fr); } .grid--4 { grid-template-columns: repeat(4, 1fr); } }

.card {
  display: flex;
  flex-direction: column;
  padding: 1.75rem;
  text-decoration: none;
  transition: background 0.2s ease;
}
a.card:hover { background: var(--surface-raised); }
.section--sunken a.card:hover { background: var(--surface-raised); }
.card h3 { font-size: 1.25rem; margin-top: 0.9rem; line-height: 1.25; }
.card p { flex: 1; margin-top: 0.85rem; font-size: 0.9375rem; line-height: 1.6; color: var(--text-muted); }
.card .link-accent { margin-top: 1.4rem; border-bottom: 0; color: var(--accent); }

/* ---- Two-column feature ------------------------------------------------- */
.split { display: grid; gap: 2.5rem; }
@media (min-width: 64rem) {
  .split { grid-template-columns: 1fr 1.15fr; gap: 5rem; align-items: start; }
  .split--rev { grid-template-columns: 1.15fr 1fr; }
}
.split h2 { font-size: 1.75rem; }
@media (min-width: 40rem) { .split h2 { font-size: 2.5rem; } }
.split .body > p { margin-top: 1.1rem; font-size: 0.9375rem; line-height: 1.7; color: var(--text-muted); }
@media (min-width: 40rem) { .split .body > p { font-size: 1rem; } }
.split .body > p strong { color: var(--text); font-weight: 600; }

/* ---- Media -------------------------------------------------------------- */
.frame { overflow: hidden; }
.frame img { width: 100%; height: 100%; object-fit: cover; }
.frame--43 { aspect-ratio: 4 / 3; }
.frame--32 { aspect-ratio: 3 / 2; }
.frame--45 { aspect-ratio: 4 / 5; }
figcaption { margin-top: 0.75rem; font-size: 0.75rem; line-height: 1.5; color: var(--text-faint); }

/* ---- Stats band --------------------------------------------------------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem 1.5rem; }
@media (min-width: 64rem) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat .figure-numeral { font-size: 2.5rem; }
@media (min-width: 40rem) { .stat .figure-numeral { font-size: 3.25rem; } }
.stat__label { display: block; margin-top: 0.6rem; font-size: 0.875rem; font-weight: 500; }
.stat__note { display: block; margin-top: 0.3rem; font-size: 0.75rem; line-height: 1.5; color: var(--text-faint); }

/* ---- Process steps ------------------------------------------------------- */
.steps { list-style: none; counter-reset: step; }
.steps li {
  counter-increment: step;
  position: relative;
  padding: 0 0 2.5rem 3rem;
}
.steps li:last-child { padding-bottom: 0; }
.steps li::before {
  content: counter(step, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.875rem;
  border: 1px solid var(--rule);
  background: var(--surface);
}
.steps li:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 0.95rem;
  top: 2.4rem;
  bottom: 0;
  width: 1px;
  background: var(--rule);
}
.steps h3 { font-size: 1.25rem; }
.steps p { margin-top: 0.6rem; font-size: 0.9375rem; line-height: 1.65; color: var(--text-muted); }

/* ---- Quotes -------------------------------------------------------------- */
.quote {
  border-left: 2px solid var(--accent);
  padding-left: 1.5rem;
}
.quote blockquote {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.5;
}
@media (min-width: 40rem) { .quote blockquote { font-size: 1.5rem; } }
.quote figcaption { margin-top: 1rem; font-size: 0.8125rem; color: var(--text-muted); }

/* ---- Forms --------------------------------------------------------------- */
.field { margin-top: 1.4rem; }
.field label { display: block; margin-bottom: 0.5rem; }
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font: inherit;
  font-size: 0.9375rem;
  color: var(--text);
  background: var(--surface-raised);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.field textarea { resize: vertical; min-height: 8rem; }
.field .hint { margin-top: 0.4rem; font-size: 0.75rem; color: var(--text-faint); }
.field--error input, .field--error textarea { border-color: #a8482f; }
.form-error {
  margin-top: 1.25rem;
  padding: 0.9rem 1.1rem;
  border-left: 2px solid #a8482f;
  background: var(--surface-sunken);
  font-size: 0.875rem;
}
/* Honeypot: hidden from people, present for bots. */
.hp-field { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---- Footer -------------------------------------------------------------- */
.site-footer {
  margin-top: 6rem;
  border-top: 1px solid var(--rule);
  background: var(--surface-sunken);
}
.site-footer .container { padding-block: 3.5rem; }
@media (min-width: 64rem) { .site-footer .container { padding-block: 5rem; } }
.footer-grid { display: grid; gap: 2.5rem; }
@media (min-width: 64rem) { .footer-grid { grid-template-columns: 1.4fr 2fr; gap: 4rem; } }
.footer-about p.display {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.4;
  max-width: 26rem;
  margin-top: 1rem;
}
.footer-about .small { margin-top: 1rem; max-width: 26rem; line-height: 1.6; }
.footer-nav { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
@media (min-width: 40rem) { .footer-nav { grid-template-columns: repeat(3, 1fr); } }
.footer-nav ul { list-style: none; margin-top: 1rem; display: flex; flex-direction: column; gap: 0.6rem; }
.footer-nav a { font-size: 0.875rem; color: var(--text-muted); text-decoration: none; }
.footer-nav a:hover { color: var(--text); }
.footer-legal {
  margin-top: 3rem;
  padding-top: 2rem;
  border-top: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: var(--text-faint);
}
@media (min-width: 40rem) { .footer-legal { flex-direction: row; justify-content: space-between; } }

/* ---- Sticky mobile CTA (proven pattern from the Reality Check) ---------- */
.mobile-cta {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-top: 1px solid var(--rule);
  background: color-mix(in oklab, var(--surface-raised) 95%, transparent);
  backdrop-filter: blur(10px);
}
.mobile-cta a {
  padding: 0.95rem 0.5rem;
  text-align: center;
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: none;
}
.mobile-cta a + a { border-left: 1px solid var(--rule); background: var(--text); color: var(--surface); }
@media (min-width: 64rem) { .mobile-cta { display: none; } }
body { padding-bottom: 3.4rem; } /* clearance for the bar */
@media (min-width: 64rem) { body { padding-bottom: 0; } }

/* ---- Tables (scroll inside themselves, never the page) ------------------- */
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ---- Utility ------------------------------------------------------------- */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 0.75rem; z-index: 50;
  background: var(--surface-raised); padding: 0.6rem 1rem; font-size: 0.875rem;
}
.skip-link:focus { left: 0.75rem; }
