/* ==========================================================================
   APEX ESTIMATING & BID SERVICES
   Single stylesheet. Organised as:
     01 Fonts          06 Buttons          11 Forms
     02 Tokens         07 Dimension line   12 Hero
     03 Reset/base     08 Cards & panels   13 Page blocks
     04 Typography     09 Header & nav     14 Footer
     05 Layout         10 Footer/mobile    15 Motion & a11y
   All colour, type and spacing values live in :root (section 02).
   Change a brand colour there and it updates everywhere.
   ========================================================================== */


/* ==========================================================================
   01  FONTS — self-hosted, no third-party requests
   Archivo (display) + Source Sans 3 (body), variable, subset to Latin.
   Licences: assets/fonts/OFL-Archivo.txt, OFL-SourceSans3.txt
   ========================================================================== */

@font-face {
  font-family: "Archivo";
  src: url("/assets/fonts/archivo-var.woff2") format("woff2-variations"),
       url("/assets/fonts/archivo-var.woff2") format("woff2");
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Sans 3";
  src: url("/assets/fonts/source-sans-3-var.woff2") format("woff2-variations"),
       url("/assets/fonts/source-sans-3-var.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}


/* ==========================================================================
   02  TOKENS
   ========================================================================== */

:root {

  /* --- Brand: sampled directly from assets/apex-logo.png ---------------- */
  --navy-900: #0A1521;
  --navy-800: #0E1C2D;   /* logo badge navy — the exact sampled value */
  --navy-700: #16293F;
  --navy-600: #1F3A56;
  --navy-500: #2C4E70;
  --navy-400: #3E6690;

  --gold-500: #D29B33;   /* logo chevron gold — the exact sampled value */
  --gold-600: #B8862A;
  --gold-700: #946A1A;   /* darkened for text on light: 4.8:1 on white */
  --gold-300: #E3BE74;
  --gold-200: #EFD9AC;
  --gold-100: #F7EDD8;

  /* --- Neutrals: hue-matched to the badge navy -------------------------- */
  --gray-50:  #F7F8FA;
  --gray-100: #EFF1F4;
  --gray-200: #E2E6EB;
  --gray-300: #CBD2DA;
  --gray-400: #9AA5B1;
  --gray-500: #66717D;   /* subtle text — 4.7:1 on the #F7F8FA page background */
  --gray-600: #4A5563;   /* body text on white: 7.6:1 */
  --gray-700: #334155;
  --gray-800: #1F2A37;
  --white: #FFFFFF;

  --red-600: #B42318;    /* form errors: 6.5:1 on white */
  --red-50:  #FEF3F2;
  --green-700: #196A46;

  /* --- Semantic --------------------------------------------------------- */
  --color-bg: var(--gray-50);
  --color-surface: var(--white);
  --color-surface-sunken: var(--gray-100);
  --color-text: var(--navy-800);
  --color-text-muted: var(--gray-600);
  --color-text-subtle: var(--gray-500);
  --color-border: var(--gray-200);
  --color-border-strong: var(--gray-300);
  --color-accent: var(--gold-500);
  --color-accent-ink: var(--gold-700);   /* gold as text on light bgs */
  --color-dark: var(--navy-800);
  --color-on-dark: var(--white);
  --color-on-dark-muted: #AFBCCB;        /* 7.4:1 on navy-800 */

  /* --- Type ------------------------------------------------------------- */
  --font-display: "Archivo", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;

  --text-xs:   0.8125rem;
  --text-sm:   0.9375rem;
  --text-base: 1.0625rem;
  --text-lg:   clamp(1.125rem, 1.06rem + 0.30vw, 1.3125rem);
  --text-xl:   clamp(1.3125rem, 1.19rem + 0.60vw, 1.6875rem);
  --text-2xl:  clamp(1.625rem, 1.40rem + 1.05vw, 2.25rem);
  --text-3xl:  clamp(2rem, 1.62rem + 1.75vw, 3rem);
  --text-4xl:  clamp(2.375rem, 1.80rem + 2.70vw, 3.9375rem);

  --lh-tight: 1.04;
  --lh-snug: 1.18;
  --lh-heading: 1.25;
  --lh-body: 1.6;
  --lh-relaxed: 1.7;

  --tracking-tight: -0.02em;
  --tracking-wide: 0.08em;
  --tracking-wider: 0.16em;

  /* --- Spacing: 4px base ------------------------------------------------ */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4rem;
  --space-9: 6rem;
  --space-10: 8rem;

  --section-y: clamp(3.5rem, 2.5rem + 4vw, 6.5rem);

  /* --- Shape: deliberately near-square, drafting-table feel ------------- */
  --radius: 2px;
  --radius-md: 3px;
  --radius-pill: 999px;

  --border-hair: 1px solid var(--color-border);

  /* --- Elevation: used sparingly ---------------------------------------- */
  --shadow-sm: 0 1px 2px rgba(14, 28, 45, 0.06);
  --shadow-md: 0 4px 16px rgba(14, 28, 45, 0.08);
  --shadow-lg: 0 18px 48px rgba(14, 28, 45, 0.16);

  /* --- Layout ----------------------------------------------------------- */
  --container: 1200px;
  --container-narrow: 820px;
  --gutter: 1rem;

  /* --- Motion ----------------------------------------------------------- */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --dur-fast: 140ms;
  --dur: 220ms;

  /* --- Layers ----------------------------------------------------------- */
  --z-sticky: 100;
  --z-header: 200;
  --z-menu: 300;
  --z-skip: 400;
}

@media (min-width: 40em) {
  :root { --gutter: 1.5rem; }
}
@media (min-width: 64em) {
  :root { --gutter: 2rem; }
}


/* ==========================================================================
   03  RESET & BASE
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 6.5rem;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg, video { display: block; max-width: 100%; height: auto; }

button, input, select, textarea { font: inherit; color: inherit; }

/* Long URLs, emails and IDs reflow instead of forcing horizontal scroll.
   `break-word` rather than `anywhere`: `anywhere` also shrinks the element's
   min-content width, which lets narrow grid cells break ordinary words down
   the middle ("Massachus/etts"). `break-word` only breaks a word that would
   genuinely overflow its line. */
a, p, li, td, dd { overflow-wrap: break-word; }

:focus-visible {
  outline: 3px solid var(--gold-600);
  outline-offset: 2px;
  border-radius: var(--radius);
}
.on-dark :focus-visible,
.site-footer :focus-visible,
.hero :focus-visible { outline-color: var(--gold-300); }

::selection { background: var(--gold-200); color: var(--navy-900); }

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: -100%;
  z-index: var(--z-skip);
  padding: var(--space-3) var(--space-5);
  background: var(--navy-800);
  color: var(--white);
  font-family: var(--font-display);
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
}
.skip-link:focus { top: var(--space-4); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}


/* ==========================================================================
   04  TYPOGRAPHY
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  color: var(--color-text);
  margin: 0 0 var(--space-4);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-heading);
  text-wrap: balance;
}

h1 { font-size: var(--text-4xl); font-weight: 800; line-height: var(--lh-tight); }
h2 { font-size: var(--text-3xl); font-weight: 800; line-height: var(--lh-snug); }
h3 { font-size: var(--text-xl); }
h4 { font-size: var(--text-lg); }

p { margin: 0 0 var(--space-4); max-width: 68ch; }
p:last-child { margin-bottom: 0; }

a { color: var(--navy-700); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--gold-700); }

strong, b { font-weight: 700; color: var(--color-text); }

.lead {
  font-size: var(--text-lg);
  color: var(--color-text-muted);
  line-height: var(--lh-relaxed);
  max-width: 60ch;
}

.text-muted { color: var(--color-text-muted); }
.text-small { font-size: var(--text-sm); }

/* Letterspaced caps. Used only where the logo's own "ESTIMATING" lockup
   justifies it — never as a label above every heading. */
.overline {
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-accent-ink);
  margin: 0 0 var(--space-3);
}
.on-dark .overline { color: var(--gold-300); }

.tabular { font-variant-numeric: tabular-nums; }


/* ==========================================================================
   05  LAYOUT
   ========================================================================== */

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

.section { padding-block: var(--section-y); }
.section--tight { padding-block: clamp(2.5rem, 2rem + 2vw, 4rem); }
.section--flush-top { padding-top: 0; }

.section-head { margin-bottom: var(--space-7); max-width: 60ch; }
.section-head > :last-child { margin-bottom: 0; }

.stack > * + * { margin-top: var(--space-4); }
.stack-lg > * + * { margin-top: var(--space-6); }

.grid { display: grid; gap: var(--space-5); }
@media (min-width: 48em) {
  .grid--2 { grid-template-columns: repeat(2, 1fr); }
  .grid--3 { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 64em) {
  .grid--4 { grid-template-columns: repeat(4, 1fr); }
  .grid--sidebar { grid-template-columns: 1.15fr 0.85fr; gap: var(--space-8); align-items: start; }
}
@media (min-width: 48em) and (max-width: 63.999em) {
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
}

/* Dark band ------------------------------------------------------------- */
.on-dark {
  background-color: var(--navy-800);
  color: var(--color-on-dark);
}
.on-dark h1, .on-dark h2, .on-dark h3, .on-dark h4 { color: var(--white); }
.on-dark p, .on-dark li { color: var(--color-on-dark-muted); }
.on-dark .lead { color: #C3CEDA; }
.on-dark a { color: var(--gold-300); }
.on-dark a:hover { color: var(--gold-200); }

/* Blueprint grid. Two scales: 24px minor, 96px major. */
.blueprint {
  position: relative;
  background-color: var(--navy-800);
  background-image:
    linear-gradient(rgba(210, 155, 51, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 155, 51, 0.07) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 96px 96px, 96px 96px, 24px 24px, 24px 24px;
  background-position: center top;
}
/* Fade the grid out toward the bottom so it reads as drafting paper,
   not as a tiled texture. */
.blueprint::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg,
    rgba(14, 28, 45, 0) 0%,
    rgba(14, 28, 45, 0.55) 78%,
    rgba(14, 28, 45, 0.9) 100%);
}
.blueprint > * { position: relative; z-index: 1; }


/* ==========================================================================
   06  BUTTONS
   Primary = logo gold fill with navy label. Measured 6.9:1.
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 48px;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: 0.02em;
  text-decoration: none;
  text-align: center;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease),
              border-color var(--dur) var(--ease),
              color var(--dur) var(--ease);
}

.btn--primary {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
}
.btn--primary:hover { background: var(--gold-600); border-color: var(--gold-600); color: var(--navy-900); }

.btn--dark {
  background: var(--navy-800);
  color: var(--white);
  border-color: var(--navy-800);
}
.btn--dark:hover { background: var(--navy-700); border-color: var(--navy-700); color: var(--white); }

.btn--outline {
  background: transparent;
  color: var(--navy-800);
  border-color: var(--color-border-strong);
}
.btn--outline:hover { border-color: var(--navy-800); background: var(--white); color: var(--navy-800); }

.on-dark .btn--outline {
  color: var(--white);
  border-color: rgba(255, 255, 255, 0.38);
}
.on-dark .btn--outline:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--white);
  color: var(--white);
}

.btn--block { width: 100%; }
.btn--lg { min-height: 54px; padding-inline: var(--space-7); font-size: var(--text-base); }

.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }

/* Text link with a chevron that nudges on hover. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--navy-700);
  text-decoration: none;
}
.link-arrow svg { transition: transform var(--dur) var(--ease); flex: none; }
.link-arrow:hover { color: var(--gold-700); }
.link-arrow:hover svg { transform: translateX(3px); }
.on-dark .link-arrow { color: var(--gold-300); }


/* ==========================================================================
   07  DIMENSION LINE
   The site's signature structural device: a drafting dimension rule with
   tick terminators. Used under headings, between process steps and beneath
   credential figures. Decorative only — always aria-hidden in markup.
   ========================================================================== */

.dimline {
  position: relative;
  height: 1px;
  width: 72px;
  background: var(--gold-700);
  margin-block: var(--space-5);
  flex: none;
}
.dimline::before,
.dimline::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 1px;
  height: 9px;
  background: var(--gold-700);
}
.dimline::before { left: 0; }
.dimline::after { right: 0; }

.dimline--wide { width: 100%; }
.dimline--tight { margin-block: var(--space-4); }
.on-dark .dimline,
.on-dark .dimline::before,
.on-dark .dimline::after { background: var(--gold-500); }

/* Horizontal rule variant that runs to the container edge with one tick. */
.dimline--lead {
  width: 100%;
  max-width: 340px;
}


/* ==========================================================================
   08  CARDS, PANELS, SCOPE LIST
   ========================================================================== */

.card {
  background: var(--color-surface);
  border: var(--border-hair);
  border-radius: var(--radius);
  padding: var(--space-6);
  height: 100%;
}
.card > :last-child { margin-bottom: 0; }
.card h3 { margin-bottom: var(--space-3); }

.card--accent { border-top: 3px solid var(--gold-500); }

.panel {
  background: var(--color-surface);
  border: var(--border-hair);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 1.2rem + 1.4vw, 2.5rem);
}
.panel--sunken { background: var(--color-surface-sunken); border-color: transparent; }
.panel--dark { background: var(--navy-800); border-color: var(--navy-700); }

/* Scope list — service rows set as estimate line items, not cards. ------- */
.scope-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--color-border);
}
.scope-item { border-bottom: 1px solid var(--color-border); }

.scope-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: start;
  padding: var(--space-6) var(--space-2);
  text-decoration: none;
  color: inherit;
  transition: background-color var(--dur) var(--ease),
              padding-inline-start var(--dur) var(--ease);
}
.scope-link:hover,
.scope-link:focus-visible {
  background: var(--white);
  padding-inline-start: var(--space-4);
  color: inherit;
}
/* Pin the mark to the title's line box rather than the row's centre, so it
   reads as a marker on the heading and not a bullet on the paragraph. */
.scope-mark { color: var(--gold-600); align-self: start; margin-top: 4px; flex: none; }
.scope-link:hover .scope-mark { color: var(--gold-700); }

/* These are spans (they sit inside an <a>, so block-level children would be
   invalid) — they need an explicit display or title and copy run together. */
.scope-body { display: block; min-width: 0; }

.scope-title {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  line-height: var(--lh-heading);
  margin: 0 0 var(--space-2);
  color: var(--navy-800);
}
.scope-desc {
  display: block;
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  max-width: 62ch;
}

@media (min-width: 64em) {
  .scope-link { grid-template-columns: auto 1fr auto; align-items: center; }
  .scope-body { padding-right: var(--space-6); }
  .scope-desc { margin-bottom: 0; }
}

/* Checklist ------------------------------------------------------------- */
.checklist { list-style: none; margin: 0 0 var(--space-4); padding: 0; }
.checklist li {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: var(--space-3);
  align-items: start;
  padding-block: var(--space-2);
  color: var(--color-text-muted);
}
.checklist svg { margin-top: 0.3em; color: var(--gold-600); flex: none; }
.on-dark .checklist svg,
.panel--dark .checklist svg { color: var(--gold-500); }

/* `.checklist li` sets a light-background grey. On a dark band it has the same
   specificity as `.on-dark li` but is declared later, so it wins and drops the
   text to ~2.3:1. These put it back. */
.on-dark .checklist li,
.panel--dark .checklist li { color: var(--color-on-dark-muted); }
.on-dark .checklist a,
.panel--dark .checklist a { color: var(--gold-300); }

/* Credential strip ------------------------------------------------------ */
.stat-strip {
  display: grid;
  gap: var(--space-6);
  grid-template-columns: repeat(2, 1fr);
}
@media (min-width: 62em) {
  .stat-strip { grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
}

/* Both are <p>, so they must out-specify the generic `.on-dark p` rule —
   otherwise the figures render in muted body grey instead of white. */
.stat-figure,
.on-dark .stat-figure {
  font-family: var(--font-display);
  font-size: clamp(2.5rem, 2rem + 2.2vw, 3.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: var(--tracking-tight);
  font-variant-numeric: tabular-nums;
  color: var(--white);
  margin: 0;
}
.stat-label,
.on-dark .stat-label {
  margin: 0;
  font-size: var(--text-sm);
  color: var(--color-on-dark-muted);
  line-height: 1.45;
}
.stat-item .dimline { margin-block: var(--space-3); width: 44px; }

/* Photo slot ------------------------------------------------------------ */
/* Ships with a drafting-paper panel behind it, so a slot with no photograph
   still reads as a designed element rather than a gap. */
.photo-slot {
  position: relative;
  background: var(--gray-100);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; display: block; }


/* ==========================================================================
   09  HEADER & NAVIGATION
   ========================================================================== */

.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--white);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow var(--dur) var(--ease);
}
.site-header.is-condensed { box-shadow: var(--shadow-md); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 76px;
  transition: min-height var(--dur) var(--ease);
}
.site-header.is-condensed .header-inner { min-height: 62px; }

/* Logo lockup. The source PNG has a solid white background, so it is
   clipped to the badge circle in CSS. The file itself is never altered. */
.logo-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex: none;
}
.logo-badge {
  width: 46px;
  height: 46px;
  clip-path: circle(45.3% at 50% 50%);
  transition: width var(--dur) var(--ease), height var(--dur) var(--ease);
}
.site-header.is-condensed .logo-badge { width: 38px; height: 38px; }

.logo-text {
  display: none;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--text-base);
  line-height: 1.1;
  letter-spacing: var(--tracking-tight);
  color: var(--navy-800);
}
.logo-text span {
  display: block;
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-subtle);
}
/* The subtle grey above is tuned for the white header. On the navy footer and
   in the mobile drawer it lands at 4.0:1 — under AA for this size. */
.site-footer .logo-text span,
.primary-nav .logo-text span { color: var(--gray-300); }
@media (min-width: 30em) { .logo-text { display: block; } }

.header-actions { display: flex; align-items: center; gap: var(--space-3); }

.header-phone {
  display: none;
  align-items: center;
  gap: var(--space-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  color: var(--navy-800);
  text-decoration: none;
  white-space: nowrap;
}
.header-phone svg { color: var(--gold-600); flex: none; }
.header-phone:hover { color: var(--gold-700); }
@media (min-width: 48em) { .header-phone { display: inline-flex; } }

.header-cta { display: none; }
@media (min-width: 64em) { .header-cta { display: inline-flex; } }

/* Primary nav ----------------------------------------------------------- */
.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  background: transparent;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--navy-800);
}
.nav-toggle:hover { border-color: var(--navy-800); }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: block; }

.primary-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}
.primary-nav a {
  display: block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
  text-decoration: none;
  color: var(--navy-700);
}
.primary-nav a:hover { color: var(--gold-700); }
.primary-nav a[aria-current="page"] { color: var(--navy-900); }

/* Mobile: full-height drawer */
@media (max-width: 63.999em) {
  .primary-nav {
    position: fixed;
    inset: 0;
    top: 0;
    z-index: var(--z-menu);
    background: var(--navy-800);
    padding: var(--space-6) var(--gutter) var(--space-8);
    overflow-y: auto;
    visibility: hidden;
    opacity: 0;
    /* visibility must flip to `visible` in the SAME frame the drawer opens.
       Transitioning it normally leaves the computed value at `hidden` for one
       frame, and a visibility:hidden element cannot take focus — so the
       opening focus call silently does nothing and the focus trap has nothing
       to trap. Zero-duration with no delay on open, delayed to the end of the
       fade on close. */
    transition: opacity var(--dur) var(--ease),
                visibility 0s linear var(--dur);
  }
  .primary-nav.is-open {
    visibility: visible;
    opacity: 1;
    transition: opacity var(--dur) var(--ease),
                visibility 0s linear 0s;
  }

  .primary-nav .nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 46px;
    margin-bottom: var(--space-6);
  }
  .primary-nav .nav-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px; height: 46px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius);
    color: var(--white);
    cursor: pointer;
  }
  .primary-nav li + li { border-top: 1px solid var(--navy-700); }
  .primary-nav a {
    padding-block: var(--space-4);
    font-size: var(--text-lg);
    color: var(--white);
    min-height: 48px;
  }
  .primary-nav a:hover,
  .primary-nav a[aria-current="page"] { color: var(--gold-300); }
  .primary-nav .nav-foot { margin-top: var(--space-7); display: grid; gap: var(--space-3); }
}

/* Desktop: inline bar */
@media (min-width: 64em) {
  .nav-toggle { display: none; }
  .primary-nav .nav-head, .primary-nav .nav-foot { display: none; }
  .primary-nav ul { display: flex; align-items: center; gap: var(--space-5); }
  .primary-nav a { padding-block: var(--space-2); position: relative; }
  .primary-nav a[aria-current="page"]::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -2px;
    height: 2px;
    background: var(--gold-500);
  }
}

body.nav-open { overflow: hidden; }


/* ==========================================================================
   10  MOBILE STICKY ACTION BAR
   ========================================================================== */

.mobile-bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: var(--z-sticky);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--navy-700);
  border-top: 1px solid var(--navy-700);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.mobile-bar a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 56px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--text-sm);
  text-decoration: none;
}
.mobile-bar .bar-call { background: var(--navy-800); color: var(--white); }
.mobile-bar .bar-quote { background: var(--gold-500); color: var(--navy-900); }
.mobile-bar svg { flex: none; }

@media (min-width: 48em) { .mobile-bar { display: none; } }
@media (max-width: 47.999em) { body { padding-bottom: 56px; } }


/* ==========================================================================
   11  FORMS
   ========================================================================== */

.form-grid { display: grid; gap: var(--space-4); }
@media (min-width: 40em) {
  .form-grid--2 { grid-template-columns: repeat(2, 1fr); }
  .field--full { grid-column: 1 / -1; }
}

.field { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }

.field label {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy-800);
}
.field .req { color: var(--red-600); margin-left: 2px; }
.on-dark .field label, .panel--dark .field label { color: var(--white); }
.on-dark .field .req, .panel--dark .field .req { color: var(--gold-300); }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 48px;
  padding: var(--space-3) var(--space-4);
  background: var(--white);
  color: var(--navy-800);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius);
  font-size: 1rem; /* >=16px stops iOS zoom-on-focus */
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
}
.field textarea { min-height: 132px; padding-top: var(--space-3); resize: vertical; }

.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%234A5563' stroke-width='2'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 16px;
  padding-right: var(--space-8);
}

.field input:hover,
.field select:hover,
.field textarea:hover { border-color: var(--gray-400); }

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--gold-600);
  box-shadow: 0 0 0 3px rgba(210, 155, 51, 0.28);
}

.field-hint { font-size: var(--text-sm); color: var(--color-text-subtle); }
.on-dark .field-hint, .panel--dark .field-hint { color: #A9B6C4; }

.field-error {
  display: none;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--red-600);
}
.field.has-error .field-error { display: block; }
.field.has-error input,
.field.has-error select,
.field.has-error textarea { border-color: var(--red-600); }
.on-dark .field.has-error .field-error,
.panel--dark .field.has-error .field-error { color: #FFB4AB; }

/* Checkbox group */
.checkbox-grid { display: grid; gap: var(--space-2); }
@media (min-width: 40em) { .checkbox-grid { grid-template-columns: repeat(2, 1fr); } }

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--white);
  cursor: pointer;
  font-size: var(--text-sm);
}
.checkbox:hover { border-color: var(--gray-400); }
.checkbox input { width: 20px; height: 20px; min-height: 0; flex: none; accent-color: var(--gold-600); margin: 0; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy-800);
  padding: 0;
  margin-bottom: var(--space-2);
}

/* Error summary, focused after a failed submit */
.form-error-summary {
  display: none;
  padding: var(--space-4) var(--space-5);
  background: var(--red-50);
  border: 1px solid var(--red-600);
  border-radius: var(--radius);
  color: #7A1C14;
}
.form-error-summary.is-visible { display: block; }
.form-error-summary h2, .form-error-summary p:first-child {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  margin: 0 0 var(--space-2);
  color: #7A1C14;
}
.form-error-summary ul { margin: 0; padding-left: var(--space-5); }
.form-error-summary a { color: #7A1C14; font-weight: 600; }

/* Honeypot: hidden from sight and from assistive tech. */
.hp-field {
  position: absolute !important;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.form-note {
  font-size: var(--text-sm);
  color: var(--color-text-subtle);
  display: flex;
  align-items: flex-start;
  gap: var(--space-2);
}
.form-note svg { flex: none; margin-top: 0.2em; color: var(--gold-600); }
.on-dark .form-note, .panel--dark .form-note { color: #A9B6C4; }

.quote-form { display: grid; gap: var(--space-4); }
.quote-form .form-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 800;
  letter-spacing: var(--tracking-tight);
  margin: 0;
}


/* ==========================================================================
   12  HERO
   ========================================================================== */

.hero {
  position: relative;
  padding-block: clamp(3rem, 2rem + 5vw, 6rem);
  color: var(--white);
}
.hero h1 { color: var(--white); margin-bottom: var(--space-5); }
.hero p { color: #C3CEDA; }

.hero-grid { display: grid; gap: var(--space-8); align-items: start; }
@media (min-width: 64em) {
  .hero-grid { grid-template-columns: 1.05fr 0.95fr; gap: var(--space-9); }
}

.hero-eyebrow {
  display: block;
  max-width: 44ch;
  line-height: 1.5;
  font-family: var(--font-display);
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--gold-300);
  margin-bottom: var(--space-5);
}

.hero-points {
  list-style: none;
  margin: var(--space-6) 0 0;
  padding: 0;
  display: grid;
  gap: var(--space-3);
}
.hero-points li {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: var(--space-3);
  align-items: start;
  color: #C3CEDA;
}
.hero-points svg { margin-top: 0.3em; color: var(--gold-500); flex: none; }

.hero-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 1.4vw, 2rem);
  box-shadow: var(--shadow-lg);
  border-top: 3px solid var(--gold-500);
}

/* The quote card is a LIGHT surface sitting inside a DARK band. The .hero and
   .on-dark text rules would otherwise cascade into it and render the form
   label and title in pale blue-grey on white. These selectors carry one extra
   class so they win regardless of source order. */
.hero .hero-form,
.cta-band .cta-form { color: var(--color-text); }

.hero .hero-form p,
.cta-band .cta-form p { color: var(--color-text-muted); }

.hero .hero-form .form-title,
.hero .hero-form label,
.hero .hero-form legend,
.cta-band .cta-form .form-title,
.cta-band .cta-form label,
.cta-band .cta-form legend { color: var(--navy-800); }

.hero .hero-form .field-hint,
.hero .hero-form .form-note,
.cta-band .cta-form .field-hint,
.cta-band .cta-form .form-note { color: var(--color-text-subtle); }

.hero .hero-form .req,
.cta-band .cta-form .req { color: var(--red-600); }

.hero .hero-form .field-error,
.cta-band .cta-form .field-error { color: var(--red-600); }

.hero .hero-form :focus-visible,
.cta-band .cta-form :focus-visible { outline-color: var(--gold-600); }

/* Compact inner page header */
.page-header {
  padding-block: clamp(2.5rem, 2rem + 3vw, 4.5rem);
  color: var(--white);
}
.page-header h1 { color: var(--white); margin-bottom: var(--space-4); }
.page-header .lead { color: #C3CEDA; }

.breadcrumb { margin-bottom: var(--space-5); font-size: var(--text-sm); }
.breadcrumb ol { list-style: none; display: flex; flex-wrap: wrap; gap: var(--space-2); margin: 0; padding: 0; }
.breadcrumb li { display: flex; align-items: center; gap: var(--space-2); color: #A9B6C4; }
.breadcrumb li + li::before { content: "/"; color: var(--navy-500); }
.breadcrumb a { color: #C3CEDA; text-decoration: none; }
.breadcrumb a:hover { color: var(--gold-300); text-decoration: underline; }


/* ==========================================================================
   13  PAGE BLOCKS
   ========================================================================== */

/* Process steps ---------------------------------------------------------- */
.process { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-6); counter-reset: step; }
@media (min-width: 52em) { .process--4 { grid-template-columns: repeat(4, 1fr); gap: var(--space-5); } }
@media (min-width: 52em) { .process--3 { grid-template-columns: repeat(3, 1fr); } }

.process li { counter-increment: step; position: relative; }
.process .step-num {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--gold-700);
  letter-spacing: var(--tracking-wide);
  display: block;
  margin-bottom: var(--space-3);
}
.on-dark .process .step-num { color: var(--gold-300); }
.process h3 { font-size: var(--text-lg); margin-bottom: var(--space-2); }
.process p { font-size: var(--text-sm); color: var(--color-text-muted); margin: 0; }
.on-dark .process p { color: var(--color-on-dark-muted); }
.process .dimline { width: 100%; margin-block: 0 var(--space-4); }

/* Accordion -------------------------------------------------------------- */
.accordion { border-top: 1px solid var(--color-border); }
.accordion-item { border-bottom: 1px solid var(--color-border); }

.accordion-trigger {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  width: 100%;
  padding: var(--space-5) var(--space-2);
  background: transparent;
  border: 0;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  color: var(--navy-800);
  min-height: 56px;
  transition: color var(--dur-fast) var(--ease);
}
.accordion-trigger:hover { color: var(--gold-700); }
.accordion-icon {
  flex: none;
  margin-top: 0.25em;
  color: var(--gold-600);
  transition: transform var(--dur) var(--ease);
}
.accordion-trigger[aria-expanded="true"] .accordion-icon { transform: rotate(45deg); }

.accordion-panel { padding: 0 var(--space-2) var(--space-5); }
.accordion-panel[hidden] { display: none; }
.accordion-panel > :last-child { margin-bottom: 0; }

/* Service filter tabs ---------------------------------------------------- */
.tablist {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-6);
  padding: 0;
  list-style: none;
}
.tab {
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  background: var(--white);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--navy-700);
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.tab:hover { border-color: var(--navy-800); }
.tab[aria-selected="true"] {
  background: var(--navy-800);
  border-color: var(--navy-800);
  color: var(--white);
}

/* Split comparison ------------------------------------------------------- */
.split { display: grid; gap: var(--space-6); }
@media (min-width: 56em) {
  .split { grid-template-columns: 1fr 1px 1fr; gap: var(--space-8); }
  .split-divider { background: var(--color-border); width: 1px; }
}
@media (max-width: 55.999em) { .split-divider { display: none; } }

/* CTA band --------------------------------------------------------------- */
.cta-band { padding-block: var(--section-y); }
.cta-grid { display: grid; gap: var(--space-7); align-items: center; }
@media (min-width: 64em) {
  .cta-grid { grid-template-columns: 0.9fr 1.1fr; gap: var(--space-9); }
}
.cta-form {
  background: var(--white);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 1rem + 1.4vw, 2rem);
  border-top: 3px solid var(--gold-500);
}

/* Contact methods -------------------------------------------------------- */
.contact-methods { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-4); }
.contact-method {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
  background: var(--white);
  border: var(--border-hair);
  border-radius: var(--radius);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--dur) var(--ease);
}
.contact-method:hover { border-color: var(--navy-800); color: inherit; }
.contact-method .cm-icon {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  background: var(--navy-800);
  border-radius: var(--radius);
  color: var(--gold-500);
}
.contact-method .cm-label {
  display: block;
  font-size: var(--text-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-text-subtle);
  font-family: var(--font-display);
}
.contact-method .cm-value {
  display: block;
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--navy-800);
  letter-spacing: var(--tracking-tight);
}

/* The email address is one long unbreakable token. Globally we use
   `break-word`, which does NOT shrink min-content — so inside this grid the
   column grew to the full address and pushed the page wide at 360px. These
   two lines are the standard pair: a shrinkable grid child plus `anywhere`
   on the token itself. */
.contact-method > span { min-width: 0; }
.contact-method .cm-value,
.site-footer a { overflow-wrap: anywhere; }

/* Plan-room name row ----------------------------------------------------- */
.source-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}
.source-row li {
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--navy-600);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--white);
  background: rgba(255, 255, 255, 0.04);
}

/* Trades grid ------------------------------------------------------------ */
.trade-grid { display: grid; gap: var(--space-3); grid-template-columns: repeat(2, 1fr); list-style: none; margin: 0; padding: 0; }
@media (min-width: 48em) { .trade-grid { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 64em) { .trade-grid { grid-template-columns: repeat(4, 1fr); } }
.trade-grid li {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--white);
  border: var(--border-hair);
  border-radius: var(--radius);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: var(--text-sm);
}
.trade-grid svg { color: var(--gold-600); flex: none; }

/* Content-width variant. Fixed columns force long labels like "Massachusetts"
   to wrap awkwardly in a narrow column, so these chips hug their text instead. */
.trade-grid--auto { display: flex; flex-wrap: wrap; grid-template-columns: none; }
.trade-grid--auto li { flex: 0 0 auto; }

/* Placeholder marker for content the client still owes -------------------- */
.placeholder {
  display: inline-block;
  padding: 0.15em 0.5em;
  background: var(--gold-100);
  border: 1px dashed var(--gold-600);
  border-radius: var(--radius);
  font-size: 0.95em;
  color: #6F4E0F;
  font-weight: 600;
}


/* ==========================================================================
   14  FOOTER
   ========================================================================== */

.site-footer {
  background: var(--navy-900);
  color: var(--color-on-dark-muted);
  padding-block: var(--space-8) var(--space-6);
}
.footer-grid { display: grid; gap: var(--space-7); }
@media (min-width: 48em) { .footer-grid { grid-template-columns: 1.4fr 1fr 1fr; } }
@media (min-width: 64em) { .footer-grid { grid-template-columns: 1.6fr 1fr 1fr 1.1fr; } }

.site-footer h2 {
  font-size: var(--text-sm);
  font-weight: 700;
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--white);
  margin-bottom: var(--space-4);
}
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.site-footer a { color: var(--color-on-dark-muted); text-decoration: none; }
.site-footer a:hover { color: var(--gold-300); text-decoration: underline; }
.site-footer p { color: var(--color-on-dark-muted); font-size: var(--text-sm); }

.footer-brand .logo-badge { width: 54px; height: 54px; }
.footer-brand .logo-link { margin-bottom: var(--space-4); }

.social-row { display: flex; gap: var(--space-3); margin-top: var(--space-5); }
.social-row a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px; height: 44px;
  border: 1px solid var(--navy-700);
  border-radius: var(--radius);
  color: var(--white);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.social-row a:hover { border-color: var(--gold-500); background: rgba(210, 155, 51, 0.12); color: var(--gold-300); }

.footer-bottom {
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: 1px solid var(--navy-700);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  justify-content: space-between;
  align-items: center;
  font-size: var(--text-sm);
}


/* ==========================================================================
   15  MOTION & ACCESSIBILITY
   ========================================================================== */

/* Scroll reveal. The no-JS and reduced-motion paths both leave content
   fully visible — nothing here is required to read the page. */
.reveal { opacity: 0; transform: translateY(12px); }
.js-on .reveal { transition: opacity 340ms var(--ease), transform 340ms var(--ease); }
.reveal.is-visible { opacity: 1; transform: none; }
html:not(.js-on) .reveal { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .reveal { opacity: 1 !important; transform: none !important; }
}

@media print {
  .site-header, .mobile-bar, .cta-band, .site-footer, .nav-toggle { display: none !important; }
  body { padding-bottom: 0; background: #fff; }
  .on-dark, .blueprint { background: #fff !important; color: #000 !important; }
  .on-dark h1, .on-dark h2, .on-dark h3, .on-dark p { color: #000 !important; }
}
