/* =========================================================================
   AmbitForge — "The Drawing Sheet" design system (DESIGN.md).
   Public B2B pages only (/, /capabilities, /rfq, /thanks). The admin panel
   stays on the legacy styles.css (visual redesign out of scope).
   Everything toleranced, nothing decorated.
   ========================================================================= */

/* ---- Self-hosted fonts (OFL, no CDN) ---------------------------------- */
@font-face {
  font-family: 'Archivo';
  src: url('/assets/fonts/archivo-var.woff2') format('woff2');
  font-weight: 600 800;
  font-stretch: 62.5% 125%;
  font-display: swap;
}
@font-face {
  font-family: 'Public Sans';
  src: url('/assets/fonts/public-sans-var.woff2') format('woff2');
  font-weight: 400 700;
  font-display: swap;
}
@font-face {
  font-family: 'B612 Mono';
  src: url('/assets/fonts/b612mono-400.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'B612 Mono';
  src: url('/assets/fonts/b612mono-700.woff2') format('woff2');
  font-weight: 700;
  font-display: swap;
}

/* ---- Tokens ----------------------------------------------------------- */
:root {
  /* color */
  --mill:    #F5F7F8;  /* ground — mill-finish aluminium */
  --alu:     #D9DEE2;  /* rules, grids, hairlines */
  --ink:     #181B20;  /* graphite */
  --slate:   #49555F;  /* muted — secondary text, units, captions */
  --dykem:   #1E36A8;  /* the only accent — action + reference */
  --dykem-wash: rgba(30, 54, 168, 0.08); /* dragover / hover flood */
  --blued:   #0F1622;  /* dark blocks — footer, NOTES panel */
  --stamp-ok:  #146B3F;
  --stamp-no:  #A8271D;

  /* type */
  --f-display: 'Archivo', system-ui, sans-serif;
  --f-body:    'Public Sans', system-ui, sans-serif;
  --f-mono:    'B612 Mono', ui-monospace, Menlo, monospace;

  /* spacing (8px base) */
  --s-2xs: 2px; --s-xs: 4px; --s-sm: 8px; --s-md: 16px;
  --s-lg: 24px; --s-xl: 32px; --s-2xl: 48px; --s-3xl: 64px;

  --wrap: 1200px;
  --measure: 68ch;
}

/* ---- Reset / base ----------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--mill);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { margin: 0; font-weight: 700; line-height: 1.1; }
p { margin: 0; }
a { color: var(--dykem); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:visited { color: var(--dykem); }
img { max-width: 100%; height: auto; display: block; }

/* Visible focus everywhere: 2px Dykem ring, 2px offset. */
:focus-visible {
  outline: 2px solid var(--dykem);
  outline-offset: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: var(--mill);
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.06em;
  padding: var(--s-sm) var(--s-md); text-transform: uppercase;
}
.skip-link:focus { left: 0; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--s-lg); }

/* ---- Eyebrows, labels, notes (mono-caps) ------------------------------ */
.eyebrow {
  font-family: var(--f-mono); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--slate);
  margin: 0 0 var(--s-md);
}
.notes {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: var(--slate); text-transform: uppercase;
}

/* ---- Sheet frame + zone ticks ----------------------------------------- */
/* A 1px Aluminium border inset from the viewport, with A–D / 1–4 zone ticks
   in the hero. The frame is the drawing; the ticks are the drafting signal. */
.sheet { position: relative; border-bottom: 1px solid var(--alu); }
.sheet::before {
  content: ""; position: absolute; inset: var(--s-sm);
  border: 1px solid var(--alu); pointer-events: none;
}

/* ---- Header / nav (D-DES1: the sheet's header row) -------------------- */
.site-header {
  border-bottom: 1px solid var(--alu);
  background: var(--mill);
}
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--s-md); min-height: 64px; flex-wrap: wrap;
}
.logo {
  font-family: var(--f-display); font-stretch: 125%; font-weight: 800;
  font-size: 1.25rem; letter-spacing: 0.02em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
}
.logo .dot { color: var(--dykem); }
.nav { display: flex; align-items: center; gap: var(--s-lg); }
.nav a {
  font-family: var(--f-mono); font-size: 0.8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink); text-decoration: none; padding: var(--s-xs) 0;
  position: relative;
}
/* Active page: the Dykem scribe-line reused as "you are here". */
.nav a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 2px; background: var(--dykem);
}
.nav a:hover { color: var(--dykem); }
/* The nav CTA is a button, not a link — keep its own text color (the `.nav a`
   rule above would otherwise win on specificity and wash it to near-invisible
   ink-on-Dykem). Matches the footer override. */
.nav a.btn-primary, .nav a.btn-primary:hover { color: var(--mill); }

/* ---- Buttons (chamfer, mono caps) ------------------------------------- */
.btn {
  --chamfer: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; /* touch target */
  font-family: var(--f-mono); font-weight: 700;
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.07em;
  padding: 11px 20px; border: 1px solid var(--ink); background: var(--mill);
  color: var(--ink); text-decoration: none; cursor: pointer;
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
  transition: background 100ms ease-out, color 100ms ease-out;
}
.btn:hover { background: var(--dykem-wash); }
.btn-primary {
  background: var(--dykem); border-color: var(--dykem); color: var(--mill);
}
.btn-primary:hover { background: var(--blued); border-color: var(--blued); color: var(--mill); }
/* Buttons are actions, not content links — never inherit the a:visited color
   (0-1-1, more specific than .btn-primary at 0-1-0). Without this, a visited
   primary button rendered Dykem-on-Dykem (invisible until hover). */
.btn:link, .btn:visited { color: var(--ink); }
.btn-primary:link, .btn-primary:visited { color: var(--mill); }

/* ---- Sections --------------------------------------------------------- */
section { padding: var(--s-3xl) 0; }
.section-head { margin-bottom: var(--s-xl); }
h2, .section-head h1 {
  font-family: var(--f-display); font-stretch: 110%; font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em;
}
.lede { max-width: var(--measure); color: var(--slate); font-size: 1.0625rem; }

/* Section separator: a short run of 45° hatching (sectioned material). */
.hatch { height: 12px; border: 0; margin: 0;
  background: repeating-linear-gradient(45deg,
    var(--alu) 0, var(--alu) 1px, transparent 1px, transparent 7px);
}

/* ---- Hero ------------------------------------------------------------- */
.hero { padding: var(--s-3xl) 0 var(--s-2xl); }
.hero-inner {
  /* faint 8px drafting grid, hero only */
  background-image:
    linear-gradient(to right, rgba(24,27,32,0.03) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(24,27,32,0.03) 1px, transparent 1px);
  background-size: 8px 8px;
}
.hero-grid {
  display: grid; grid-template-columns: 1.6fr 1fr; gap: var(--s-2xl);
  align-items: end;
}
.hero h1 {
  font-family: var(--f-display); font-stretch: 125%; font-weight: 800;
  font-size: clamp(2.25rem, 5.5vw, 4rem); letter-spacing: -0.01em;
  margin: var(--s-md) 0;
}
.hero .scribe { margin: var(--s-lg) 0; }
.hero .lede { margin: var(--s-lg) 0 var(--s-xl); max-width: 46ch; color: var(--ink); }

/* The one orchestrated moment: the Dykem scribe-line draws in on load. */
.scribe { height: 3px; background: var(--dykem); width: 220px; max-width: 100%;
  transform-origin: left center; animation: scribe 400ms ease-out both; }
@keyframes scribe { from { transform: scaleX(0); } to { transform: scaleX(1); } }

.cta-row { display: flex; flex-wrap: wrap; gap: var(--s-md); align-items: center; }

/* ---- Title block (the signature device) ------------------------------- */
.title-block {
  --chamfer: 12px; border: 1px solid var(--ink); background: var(--mill);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--chamfer)), calc(100% - var(--chamfer)) 100%, 0 100%);
}
.title-block dl {
  margin: 0; display: grid; grid-template-columns: max-content 1fr;
}
.title-block dt, .title-block dd {
  margin: 0; font-family: var(--f-mono); font-size: 0.6875rem;
  letter-spacing: 0.06em; text-transform: uppercase;
  padding: 7px 10px; border-top: 1px solid var(--alu);
}
.title-block .tb-row:first-child dt, .title-block .tb-row:first-child dd { border-top: 0; }
.title-block dt { color: var(--slate); border-right: 1px solid var(--alu); }
.title-block dd { color: var(--ink); font-weight: 700; }
.title-block .tb-row { display: contents; }

/* ---- Spec table (engagement models D-DES3; reused for capabilities) ---- */
.spec-wrap { overflow-x: auto; }
.spec {
  width: 100%; border-collapse: collapse; border: 1px solid var(--alu);
  font-size: 0.9375rem;
}
.spec caption { text-align: left; }
.spec th, .spec td {
  border: 1px solid var(--alu); padding: 10px 12px; text-align: left;
  vertical-align: top;
}
.spec thead th {
  font-family: var(--f-mono); font-size: 0.6875rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--slate);
  background: #eef1f3;
}
.spec tbody th {
  font-family: var(--f-display); font-stretch: 110%; font-weight: 700;
  font-size: 1rem; white-space: nowrap;
}
.spec .num { font-family: var(--f-mono); text-align: right; white-space: nowrap; }
.spec .unit { color: var(--slate); font-size: 0.85em; }

/* Capabilities datasheet tables (have a datum caption). The attribute column
   is a quiet mono label; the value carries the weight. */
.spec caption.datum {
  text-align: left; font-family: var(--f-display); font-stretch: 110%; font-weight: 700;
  font-size: 1.125rem; padding: 0 0 var(--s-sm); line-height: 1.4;
}
.datum-flag {
  display: inline-block; vertical-align: 2px; margin-right: var(--s-sm);
  font-family: var(--f-mono); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em;
  color: var(--dykem); border: 1px solid var(--dykem); padding: 2px 6px; white-space: nowrap;
}
.spec:has(caption.datum) tbody th {
  font-family: var(--f-mono); font-stretch: normal; font-weight: 700;
  font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--slate); white-space: nowrap; width: 1%; vertical-align: top;
}
.spec td.materials { font-family: var(--f-mono); font-size: 0.85rem; line-height: 1.8; }
.spec-wrap + .spec-wrap { margin-top: var(--s-xl); }

.notes-block { margin-top: var(--s-xl); border-top: 1px solid var(--alu); padding-top: var(--s-md); }
.notes-title {
  font-family: var(--f-mono); font-size: 0.75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--slate); margin-bottom: var(--s-sm);
}
.notes-block ol { margin: 0; padding-left: 1.4em; color: var(--slate); font-size: 0.9375rem; }
.notes-block li { margin-bottom: var(--s-xs); }

/* ---- Proof / process / terms ------------------------------------------ */
.rail { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s-xl); }
.rail > div > .eyebrow { margin-bottom: var(--s-sm); }
.rail h3 { font-family: var(--f-display); font-stretch: 110%; font-size: 1.125rem; margin-bottom: var(--s-sm); }
.rail p { color: var(--slate); font-size: 0.9375rem; }

/* Drawing "NOTE" box — the on-system replacement for a left-accent callout. */
.honest {
  position: relative; border: 1px solid var(--alu); background: #fff;
  padding: var(--s-xl) var(--s-lg) var(--s-lg);
}
.honest::before {
  content: "NOTE"; position: absolute; top: -1px; left: -1px;
  font-family: var(--f-mono); font-size: 0.625rem; font-weight: 700;
  letter-spacing: 0.08em; color: var(--mill); background: var(--dykem);
  padding: 3px 8px;
}
.honest strong { font-weight: 700; }

.terms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-2xl); }
.terms-grid ul { list-style: none; margin: 0; padding: 0; }
.terms-grid li {
  padding: var(--s-sm) 0 var(--s-sm) var(--s-lg); position: relative;
  border-top: 1px solid var(--alu); font-size: 0.9375rem;
}
.terms-grid li::before {
  content: ""; position: absolute; left: 0; top: 16px; width: 8px; height: 8px;
}
.terms-grid .does li::before { background: var(--stamp-ok); }
.terms-grid .doesnt li::before { background: var(--stamp-no);
  clip-path: polygon(50% 0, 100% 100%, 0 100%); background-color: var(--stamp-no); }

/* ---- Footer (Blued Steel title block) --------------------------------- */
.site-footer { background: var(--blued); color: var(--mill); padding: var(--s-2xl) 0; }
.site-footer a { color: var(--mill); }
/* Buttons keep their own text color on the dark footer (the link rule above
   would otherwise wash a plain .btn to invisible white-on-white). */
.site-footer a.btn { color: var(--ink); }
.site-footer a.btn-primary { color: var(--mill); }
.footer-block { display: flex; flex-wrap: wrap; gap: var(--s-2xl); justify-content: space-between; align-items: flex-end; }
.footer-block .notes { color: #9aa6b0; }
.footer-cta h2 { color: var(--mill); margin-bottom: var(--s-md); }

/* ---- RFQ form (the drawing-intake station) ---------------------------- */
.rfq-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: var(--s-2xl); align-items: start; }
.gotcha { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.field { margin-bottom: var(--s-lg); }
.field > label, .field-label {
  display: block; font-family: var(--f-mono); font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--slate);
  margin-bottom: var(--s-sm);
}
.field .opt { color: var(--slate); font-weight: 400; text-transform: none; letter-spacing: 0; }
.field input[type="text"], .field input[type="email"], .field textarea, .field select {
  width: 100%; font-family: var(--f-body); font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid var(--alu); border-radius: 0;
  padding: 10px 12px;
}
.field textarea { min-height: 120px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible, .field select:focus-visible {
  outline: 2px solid var(--dykem); outline-offset: 0; border-color: var(--dykem);
}
.field .hint { font-size: 0.8125rem; color: var(--slate); margin-top: var(--s-xs); }
.field-error {
  font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--stamp-no); margin-top: var(--s-xs); display: none;
}
.field.invalid .field-error { display: block; }
.field.invalid input, .field.invalid textarea { border-color: var(--stamp-no); }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-md); }

/* Dropzone: dashed hidden-line stroke, chamfered, Dykem flood on dragover. */
.dropzone {
  --chamfer: 12px; position: relative; display: block; cursor: pointer;
  border: 1.5px dashed var(--slate); background: #fff;
  padding: var(--s-xl) var(--s-lg); text-align: center;
  clip-path: polygon(0 0, calc(100% - var(--chamfer)) 0, 100% var(--chamfer), 100% 100%, 0 100%);
}
.dropzone .dz-label { font-family: var(--f-mono); font-size: 0.8125rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink); }
.dropzone .dz-hint { font-family: var(--f-mono); font-size: 0.6875rem; color: var(--slate);
  text-transform: uppercase; letter-spacing: 0.05em; margin-top: var(--s-sm); }
.dropzone.dragover { border-color: var(--dykem); border-style: solid; background: var(--dykem-wash); }
.dropzone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dz-selected { display: none; font-family: var(--f-mono); font-size: 0.8125rem; }
.dropzone.has-file .dz-prompt { display: none; }
.dropzone.has-file .dz-selected { display: block; }
.dz-actions { margin-top: var(--s-sm); }
.dz-actions button {
  font-family: var(--f-mono); font-size: 0.6875rem; text-transform: uppercase;
  letter-spacing: 0.06em; background: none; border: 0; color: var(--dykem);
  cursor: pointer; padding: 0; text-decoration: underline;
}
/* Upload progress (determinate). */
.dz-progress { margin-top: var(--s-md); display: none; }
.dropzone.uploading .dz-progress { display: block; }
.dz-track { height: 6px; background: var(--alu); }
.dz-fill { height: 100%; width: 0; background: var(--dykem); transition: width 120ms linear; }
.dz-pct { font-family: var(--f-mono); font-size: 0.6875rem; color: var(--slate);
  text-transform: uppercase; letter-spacing: 0.06em; margin-top: var(--s-xs); }

/* Blued Steel NOTES panel (NDA / privacy statement, D17). */
.notes-panel {
  background: var(--blued); color: var(--mill); padding: var(--s-xl);
  font-size: 0.9375rem; position: sticky; top: var(--s-lg);
}
.notes-panel .eyebrow { color: #9aa6b0; }
.notes-panel p { margin-bottom: var(--s-md); }
.notes-panel a { color: #9db2ff; }

.form-status {
  font-family: var(--f-mono); font-size: 0.8125rem; letter-spacing: 0.04em;
  border: 1px solid var(--stamp-no); color: var(--stamp-no); background: #fff;
  padding: var(--s-md); margin: var(--s-md) 0; text-transform: uppercase;
}

/* Success panel: a one-row revision-table stamp. */
.rfq-success { display: none; }
.rfq-success.show { display: block; }
.rev-row {
  border: 1px solid var(--ink); display: flex; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 0.8125rem; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.rev-row span { padding: 12px 16px; border-right: 1px solid var(--alu); }
.rev-row span:last-child { border-right: 0; }
.rev-row .rev-mark { background: var(--stamp-ok); color: var(--mill); font-weight: 700; }
.rev-row .rev-ref { font-weight: 700; }

/* ---- Responsive ------------------------------------------------------- */
@media (max-width: 860px) {
  .rfq-grid { grid-template-columns: 1fr; gap: var(--s-xl); }
  .notes-panel { position: static; }
}
@media (max-width: 860px) {
  /* D-DES5: hero stacks, title block reflows to a full-width band below. */
  .hero-grid { grid-template-columns: 1fr; gap: var(--s-xl); }
  .rail { grid-template-columns: 1fr; gap: var(--s-lg); }
  .terms-grid { grid-template-columns: 1fr; gap: var(--s-xl); }
  .masthead { min-height: 0; padding-top: var(--s-md); padding-bottom: var(--s-md); }
  .nav { width: 100%; gap: var(--s-md); }
  .nav .btn { margin-left: auto; }
}
@media (max-width: 520px) {
  .nav { flex-wrap: wrap; }
  .nav .btn { width: 100%; text-align: center; margin-left: 0; }
  .footer-block { gap: var(--s-lg); }
}

/* ---- Legal / policy documents ----------------------------------------- */
.legal { max-width: 76ch; }
.legal .draft-banner {
  border: 1px solid var(--stamp-no); background: #fff; color: var(--stamp-no);
  font-family: var(--f-mono); font-size: 0.75rem; text-transform: uppercase;
  letter-spacing: 0.05em; line-height: 1.6; padding: var(--s-md) var(--s-lg);
  margin-bottom: var(--s-xl);
}
.legal .meta {
  font-family: var(--f-mono); font-size: 0.75rem; color: var(--slate);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: var(--s-xl);
}
.legal h2 {
  font-family: var(--f-display); font-stretch: 110%; font-weight: 700;
  font-size: clamp(1.15rem, 2.4vw, 1.4rem); letter-spacing: -0.005em;
  margin: var(--s-2xl) 0 var(--s-sm);
}
.legal h3 {
  font-family: var(--f-display); font-stretch: 110%; font-weight: 700;
  font-size: 1.05rem; margin: var(--s-lg) 0 var(--s-xs);
}
.legal p { margin-bottom: var(--s-md); }
.legal ol, .legal ul { padding-left: 1.4em; margin-bottom: var(--s-md); }
.legal li { margin-bottom: var(--s-sm); }
.legal .fill { background: #fff3f2; padding: 0 3px; border-bottom: 1px dashed var(--stamp-no); }
.legal .xref a { font-family: var(--f-mono); font-size: 0.8125rem; }

/* ---- Reduced motion --------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .scribe { animation: none; transform: none; }
  * { transition: none !important; }
}
