/* ============================================================
   FrontEdge Consulting - main.css
   Phase 4 build. Tokens in tokens.css (Drive design/tokens.css is canonical).
   System: design/design-system.md; plan: design/phase4-build-spec.md (rev 2).
   ============================================================ */

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

html { scroll-behavior: auto; }

body {
  background: var(--c-dark);
  color: var(--c-offwhite);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  font-weight: var(--w-body);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

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

ul[role="list"], .faq__list { list-style: none; }

a { color: inherit; }

.wrap {
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

section { padding-block: var(--s-section); }

h1, h2, h3 {
  font-family: var(--f-display);
  font-weight: var(--w-display);
  line-height: var(--lh-head);
  letter-spacing: var(--tr-display);
}

h2 { font-size: var(--fs-h2); }

p a, dd a, li a {
  color: var(--c-gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  transition: color var(--dur-hover) var(--ease-soft);
}
p a:hover, dd a:hover, li a:hover { color: var(--c-offwhite); }

::selection { background: var(--c-gold); color: var(--c-dark); }

/* ---------- focus / keyboard (spec §0.6) ---------- */
:focus-visible {
  outline: 2px solid var(--c-gold);
  outline-offset: 3px;
  border-radius: 2px;
}
.engagement :focus-visible { outline-color: var(--c-gold-deep); }

.skip-link { position: absolute; left: -999px; }
.skip-link:focus {
  left: var(--s-4); top: var(--s-4); z-index: 10000;
  background: var(--c-dark); color: var(--c-offwhite);
  padding: var(--s-2) var(--s-4);
}

/* ---------- grain (locked 2026-07-09, opacity 0.05) ---------- */
.grain {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 220px 220px;
}

/* ---------- CTA pill ---------- */
.cta-pill {
  display: inline-block;
  font-family: var(--f-label);
  font-weight: var(--w-cap);
  font-size: var(--fs-small);
  letter-spacing: var(--tr-cta);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--c-offwhite);
  border: 1px solid var(--c-gold);
  border-radius: var(--radius);
  padding: var(--s-3) var(--s-8);
  background: transparent;
  cursor: pointer;
  transition: background var(--dur-hover) var(--ease-soft),
              color var(--dur-hover) var(--ease-soft);
}
.cta-pill:hover { background: var(--c-gold); color: var(--c-dark); }

/* ---------- nav (hero-scoped, not sticky) ---------- */
.site-nav {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-6) var(--gutter);
}
.site-nav__brand { display: flex; align-items: center; gap: var(--s-4); text-decoration: none; }
.site-nav__brand img { width: 50px; height: 36px; object-fit: contain; }
.site-nav__wordmark {
  font-family: var(--f-label);
  font-weight: var(--w-cap);
  font-size: var(--fs-caption);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--c-offwhite);
}
/* keep the nav single-line at phone widths: brand shortens to "FrontEdge" and the
   chrome compacts: at full sizes brand (50+16+88) + pill (181) overflows 360-375px
   viewports and the pill overlaps the wordmark (mobile audit 2026-07-11) */
@media (max-width: 620px) {
  .site-nav__wordmark-tail { display: none; }
  .site-nav { gap: var(--s-3); }
  .site-nav__brand { gap: var(--s-3); min-width: 0; }
  .site-nav__brand img { width: 40px; height: 29px; }
  .site-nav .cta-pill { padding: var(--s-2) var(--s-4); }
}
/* resting fill so the pill never depends on the photo behind it (taste pass 1 B1) */
.site-nav .cta-pill { background: rgba(16, 39, 27, 0.4); white-space: nowrap; flex-shrink: 0; }
.site-nav .cta-pill:hover { background: var(--c-gold); }

/* ---------- topo contour texture (KW 2026-07-11) ----------
   One fixed line-work layer behind every dark section: z-index -1 sits above the body
   background and below all in-flow content, so the hero photo, bone section and cards
   cover it automatically. Contours are viewport-fixed; content scrolls over the map. */
body:not(.page-plain)::before {
  content: "";
  position: fixed; inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0;
  background-size: cover;
  background-position: center;
}
/* main.js preloads the SVG after window load then lands .topo-ready; keeps the ~70KB
   file off the critical path (mobile LCP budget, §9 gate 5). Opacity value is KW-locked
   (25%, 2026-07-11 variants page). */
body.topo-ready:not(.page-plain)::before {
  opacity: var(--topo-opacity, 0.25);
  background-image: url("/assets/topo-contours.svg");
}
@media (prefers-reduced-motion: no-preference) {
  body:not(.page-plain)::before { transition: opacity 0.6s var(--ease-soft); }
}

/* ---------- 1. hero ---------- */
.hero {
  position: relative;
  min-height: 100svh;
  display: grid;
  align-content: end;
  /* top padding reserves the absolute nav's band (bottom ~96px): on short/wide
     viewports the bottom-anchored content otherwise grows up under the brand
     (KW screen, 2026-07-16; 81px overlap measured at 2000x700). Invisible at
     gated sizes: content 683px + 112 <= 800 at 1280, so the hero stays 100svh.
     7rem deliberate: s-24 (96px) = zero clearance, s-32 (128px) grows the fold. */
  padding-block: 7rem 0;
  overflow: hidden;
}
.hero__media, .hero__media img,
.hero__scrim {
  position: absolute; inset: 0;
}
.hero__media img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.hero__scrim {
  /* top band protects nav legibility over pale sky (taste pass 1 B1); floor guarantees AA for the headline */
  background:
    linear-gradient(180deg, rgba(16, 39, 27, 0.62) 0%, rgba(16, 39, 27, 0) 26%),
    linear-gradient(180deg, rgba(16, 39, 27, 0.25) 0%, rgba(16, 39, 27, 0.78) 78%);
}
.hero__content {
  position: relative;
  width: 100%;
  padding-bottom: var(--s-24);
}
.hero__headline {
  font-size: var(--fs-display);
  line-height: var(--lh-display);
  max-width: 12ch;
  text-wrap: balance;
}
@media (prefers-reduced-motion: no-preference) {
  html.js .hero__headline { visibility: hidden; }  /* revealed by moment 1; JS-failure fallback in main.js + head timeout */
}
.hero__subhead {
  font-weight: var(--w-body-lt);
  font-size: var(--fs-subhead);
  color: var(--c-offwhite);
  max-width: 44ch;
  margin-top: var(--s-6);
}
.hero .cta-pill { margin-top: var(--s-8); }

/* ---------- 2. positioning ---------- */
.positioning { padding-block: calc(var(--s-section) * 1.15); }
.positioning__reveal {
  font-weight: var(--w-body-lt);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  max-width: 34ch;
  /* starts ~col 4 of 12 (spec §2): off-centre without abandoning the left half */
  margin-left: calc(100% / 12 * 3);
  margin-right: auto;
}

/* ---------- shared: section heading rail ---------- */
.services h2, .proof h2, .data h2, .faq h2 { margin-bottom: var(--s-12); }

/* ---------- 3a/3b. services (split into two sections 2026-07-15;
   design/2026-07-15-cards-copy-update-spec.md; §13.3 "one light section" dissolved) ---------- */
.services__intro {
  font-weight: var(--w-body-lt);
  font-size: var(--fs-subhead);
  max-width: 44ch;
  margin-bottom: var(--s-12);
}
/* two cream cards, equal height (grid stretch), content top-aligned */
.services__cards {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--s-4);
}
.card {
  /* opaque bone fill mandatory: the fixed topo layer must not read through
     (same failure mode as the 07-13 form-input F1) */
  background: var(--c-bone);
  color: var(--c-text-bone);
  border-radius: var(--radius-card);
  padding: var(--s-8);
}
.card__title { font-size: var(--fs-h3); }
.card__points { margin-top: var(--s-6); }
.card__points li {
  font-size: var(--fs-small);
  padding-block: var(--s-2);
}
/* custom-training one-liner (replaces the third card) */
.services__custom {
  margin-top: var(--s-8);
  font-weight: var(--w-body-lt);
  font-size: var(--fs-subhead);
  max-width: 44ch;
}

.services__automation { display: grid; grid-template-columns: 4fr 8fr; column-gap: var(--s-12); }
.services__automation .services__intro { margin-bottom: 0; }
.services__list li {
  border-top: 1px solid var(--c-hairline-dark);
  padding-block: var(--s-8);
}
.services__list li:last-child { border-bottom: 1px solid var(--c-hairline-dark); }
.services__list strong { font-weight: var(--w-cap); }

/* ---------- 4. proof: text-only for launch (KW 2026-07-16) ----------
   Framed screenshot format parked for Phase 8+:
   Drive design/2026-07-16-proof-frames-parked-phase8.md.
   Title | text rows, same editorial split as the automation and data sections. */
.artifact {
  display: grid;
  grid-template-columns: 4fr 8fr;
  column-gap: var(--s-12);
  align-items: start;
  border-top: 1px solid var(--c-hairline-dark);
  padding-block: var(--s-12);
}
.artifact__title { font-size: var(--fs-h3); }
.artifact__text { max-width: 58ch; }
.artifact__io div { margin-bottom: var(--s-6); }
.artifact__io dt {
  display: inline;
  font-weight: var(--w-cap);
  margin-right: 0.35ch;
}
.artifact__io dd { display: inline; }
.artifact__result {
  border-top: 1px solid var(--c-hairline-dark);
  padding-top: var(--s-6);
  font-size: var(--fs-subhead);
  font-weight: var(--w-body);
}
/* ledger closes like the page's other hairline lists (taste proof-delta F2) */
.artifact:last-of-type { border-bottom: 1px solid var(--c-hairline-dark); }
.proof__closer {
  color: var(--c-slate-light);
  max-width: 58ch;
  margin-top: var(--s-8);
  /* start on the text-column grid line of the 4fr/8fr rows above
     (taste proof-delta F1: auto-margin sat 26px off the column line) */
  margin-left: calc((100% - var(--s-12)) * 4 / 12 + var(--s-12));
}

/* ---------- 5. engagement (THE bone section) ---------- */
.engagement {
  background: var(--c-bone);
  color: var(--c-text-bone);
  padding-block: calc(var(--s-section) * 1.4);
}
.engagement__grid {
  display: grid;
  grid-template-columns: 4fr 7fr;
  column-gap: var(--s-12);
  align-items: start;
}
.engagement__body {
  font-weight: var(--w-body-lt);
  font-size: var(--fs-lead);
  line-height: var(--lh-lead);
  max-width: 36ch;
}

/* ---------- 6. data ---------- */
/* intro sits beside the option rows; same editorial idiom as the automation block */
.data__grid {
  display: grid;
  grid-template-columns: 4fr 8fr;
  column-gap: var(--s-12);
}
.data h2 { grid-column: 1 / -1; }
.data__intro { max-width: 44ch; }
.data__options li {
  border-top: 1px solid var(--c-hairline-dark);
  padding-block: var(--s-8);
  max-width: 58ch;
}
.data__options li:last-child { border-bottom: 1px solid var(--c-hairline-dark); }

/* ---------- 7. founder ---------- */
.founder__grid {
  display: grid;
  grid-template-columns: 4fr 7fr;
  column-gap: var(--s-16);
}
.founder h2 { grid-column: 1 / -1; margin-bottom: var(--s-12); }
.founder__media { margin-top: var(--s-8); }
.founder__body { align-self: center; }
.founder__media img { border-radius: var(--radius); }
.founder__body p {
  font-weight: var(--w-body-lt);
  font-size: var(--fs-subhead);
  max-width: 58ch;
}
/* credentials plate (KW ruling 2026-07-10): flat, late, small slate; no caps transform;
   it would mangle the (BASc) post-nominal casing */
.founder__body .founder__creds {
  margin-top: var(--s-8);
  padding-top: var(--s-6);
  border-top: 1px solid var(--c-hairline-dark);
  font-weight: var(--w-body);
  font-size: var(--fs-small);
  color: var(--c-slate-light);
  line-height: 1.8;
}

/* ---------- 8. contact ---------- */
.contact { padding-block: calc(var(--s-section) * 1.3); }
.contact__inner { max-width: 640px; }
.contact h2, .contact__body { text-align: center; }
.contact__body { margin-top: var(--s-6); }
.contact__form { margin-top: var(--s-12); }
.field { margin-bottom: var(--s-6); }
.field label {
  display: block;
  font-family: var(--f-label);
  font-weight: var(--w-cap);
  font-size: var(--fs-caption);
  letter-spacing: var(--tr-label);
  text-transform: uppercase;
  color: var(--c-slate-light);
  margin-bottom: var(--s-2);
}
.field input, .field textarea {
  width: 100%;
  /* opaque equivalent of the old rgba(241,238,230,0.06) overlay on --c-dark: same
     rendered colour, but blocks the topo contours from running through the input
     interior (taste delta pass 1 F1, 2026-07-13) */
  background: #1E3327;
  border: 1px solid var(--c-input-border);
  border-radius: var(--radius);
  color: var(--c-offwhite);
  font-family: var(--f-body);
  font-size: var(--fs-body);
  padding: var(--s-3) var(--s-4);
  transition: border-color var(--dur-hover) var(--ease-soft);
}
.field input:focus, .field textarea:focus { border-color: var(--c-gold); }
.field textarea { resize: vertical; }
/* visually hidden, available to AT (screen-reader copy of the split positioning paragraph) */
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* honeypot: off-screen but not display:none (some AT still announces that), per runbook §3.2 */
.hp-field {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
/* reserve the Managed-mode widget's height so the mount never shifts the layout */
.contact__turnstile { min-height: 65px; margin-bottom: var(--s-6); }
.contact__status:empty { display: none; }
.contact__status { margin-bottom: var(--s-6); }
.contact__status--success { color: var(--c-gold); }
.contact__status--error { color: #D98C6B; } /* warm terracotta, palette-family error (runbook §3.2) */
.contact__status--pending { color: var(--c-slate-light); }
.cta-pill--submit { padding: var(--s-4) var(--s-12); }
.contact__alt {
  margin-top: var(--s-8);
  font-size: var(--fs-small);
  color: var(--c-slate-light);
  text-align: center;
}

/* ---------- 9. faq ---------- */
.faq__item {
  display: grid;
  grid-template-columns: 5fr 7fr;
  column-gap: var(--s-12);
  border-top: 1px solid var(--c-hairline-dark);
  padding-block: var(--s-8);
}
.faq__list .faq__item:last-child { border-bottom: 1px solid var(--c-hairline-dark); }
.faq__item dt {
  font-family: var(--f-display);
  font-weight: var(--w-display);
  font-size: var(--fs-h4);
  line-height: var(--lh-head);
  letter-spacing: var(--tr-display);
}
.faq__item dd { max-width: 58ch; }

/* ---------- 10. footer ---------- */
.site-footer {
  overflow: hidden;
  padding-top: var(--s-24);
  display: flex;
  flex-direction: column;
}
/* meta row renders ABOVE the wordmark; full letterforms show; the old -0.16em
   bottom-edge crop was vetoed by KW 2026-07-15 ("FRONTEDGE" cut off on desktop) */
.site-footer__wordmark {
  order: 2;
  font-family: var(--f-display);
  font-weight: var(--w-display);
  font-size: clamp(4rem, 27vw, 23rem);
  line-height: 0.8;
  letter-spacing: -0.01em;
  color: var(--c-green);
  user-select: none;
  white-space: nowrap;
  text-align: left;
  padding-inline: var(--gutter);
  margin-bottom: 0;
  margin-top: var(--s-8);
}
.site-footer__meta {
  order: 1;
  width: 100%;   /* .wrap auto-margins otherwise shrink-wrap it inside the flex footer */
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-8);
  border-top: 1px solid var(--c-hairline-dark);
  padding-block: var(--s-6);
}
.site-footer__meta a {
  color: var(--c-offwhite);
  font-size: var(--fs-small);
  text-decoration: none;
  border-bottom: 1px solid var(--c-gold);
  transition: color var(--dur-hover) var(--ease-soft);
}
.site-footer__meta a:hover { color: var(--c-gold); }
.site-footer__fineprint {
  font-size: var(--fs-caption);
  color: var(--c-slate-light);
  text-align: right;
}

/* ============================================================
   Responsive: 768-1023 tablet, <768 stacked
   ============================================================ */
@media (max-width: 1023px) {
  /* stack below 1024: equal-height stretch only operates where the 5fr/7fr
     composition exists; at tablet it left ~190px of dead cream in the
     shorter card (taste delta pass 1 F1, 2026-07-16) */
  .services__cards { grid-template-columns: 1fr; gap: var(--s-6); }
  .services__automation { grid-template-columns: 1fr; }
  .services__automation .services__intro { margin-bottom: var(--s-8); }
  .artifact { grid-template-columns: 1fr; row-gap: var(--s-4); }
  .proof__closer { margin-left: 0; }
  .engagement__grid { grid-template-columns: 1fr; row-gap: var(--s-8); }
  .data__grid { grid-template-columns: 1fr; }
  .data__intro { margin-bottom: var(--s-8); }
  .founder__grid { grid-template-columns: 1fr 2fr; column-gap: var(--s-8); }
  .faq__item { grid-template-columns: 1fr; row-gap: var(--s-4); }
  .positioning__reveal { margin-left: calc(100% / 8); }
}

/* ---------- plain pages (/privacy): static nav, prose column, no hero/grain/JS ---------- */
.site-nav--static { position: static; }
.prose { padding-block: var(--s-12) var(--s-24); }
.prose h1 { font-size: var(--fs-h2); margin-bottom: var(--s-12); }
.prose p { max-width: 58ch; }
.prose p + p { margin-top: var(--s-6); }
.prose__updated {
  margin-top: var(--s-12);
  font-size: var(--fs-small);
  color: var(--c-slate-light);
}

@media (max-width: 767px) {
  /* phone rhythm: the desktop-scale voids (81px section pads, 128px block gaps,
     96px footer gap) read as dead holes at 375; mobile audit 2026-07-11 */
  :root { --s-section: 4rem; }
  .services h2, .proof h2, .data h2, .faq h2, .founder h2 { margin-bottom: var(--s-8); }

  /* phone hero: bottom-anchoring left half a screen of bare photo between the
     brand and the headline (KW 2026-07-17): centre the stack on phones only */
  .hero { align-content: center; }
  .hero__content { padding-bottom: 0; }
  .hero__headline { max-width: none; }
  /* stacked column: natural heights (equal-height is a desktop-grid rule only) */
  .services__cards { grid-template-columns: 1fr; gap: var(--s-6); }
  .positioning__reveal { margin-left: 0; max-width: none; }
  .founder__grid { grid-template-columns: 1fr; row-gap: var(--s-8); }
  .founder__media { max-width: 100%; margin-top: 0; }
  .cta-pill--submit { width: 100%; }
  .site-footer { padding-top: var(--s-12); }
  /* wordmark fits gutter-to-gutter (3.267 width/font-px measured); bottom crop kept.
     At full 27vw it overflowed the right edge mid-letter at 375 */
  .site-footer__wordmark { font-size: calc(30vw - 15px); }
  .site-footer__meta { flex-direction: column; align-items: flex-start; }
  .site-footer__fineprint { text-align: left; }
}
