/* ════════════════════════════════════════════════════════════════════════
   Re4G — foundation: tokens, reset, type scale, primitives.
   Section layout lives in site.css, which is loaded after this file.

   Direction: the forge. Cold steel (deep green-black fields) against hot
   metal (ember). Teal carries the brand and every call to action; ember is
   rationed to heat moments only — the heat bar, active stages, the hero
   glow. If ember starts appearing everywhere, the metaphor dies.
   ════════════════════════════════════════════════════════════════════════ */

/* Fonts are linked from base.html, not imported here: an @import can
   only start downloading after this file has arrived, which serialises
   the two requests and delays first paint. */

:root {
  /* ── Steel: the dark fields ──────────────────────────────────────── */
  --ink:        #08100f;
  --steel-900:  #0b1a18;
  --steel-800:  #102421;
  --steel-700:  #17332f;
  --steel-600:  #22453f;
  --steel-500:  #345b54;

  /* ── Paper: the light fields ─────────────────────────────────────── */
  --paper:      #ffffff;
  --paper-2:    #eff2f1;
  --paper-3:    #e2e8e6;
  --line:       #d3dbd9;
  --line-soft:  #e6ebea;

  /* ── Teal: the brand ─────────────────────────────────────────────── */
  --teal-800:   #073f3a;
  --teal-700:   #0a5f57;
  --teal-600:   #0c7269;
  --teal-500:   #0e8a7c;
  --teal-400:   #14a899;
  --teal-300:   #35c7b6;
  --teal-200:   #9ee3d8;
  --teal-100:   #e2f5f1;

  /* ── Ember: the heat. Rationed. ──────────────────────────────────── */
  --ember-700:  #9c3413;
  --ember-600:  #c4451d;
  --ember-500:  #e1562a;
  --ember-400:  #f5793f;
  --ember-300:  #ffa36b;
  --ember-100:  #fdeae1;

  /* ── Text roles ──────────────────────────────────────────────────── */
  --text:              var(--steel-900);
  --text-muted:        #4c6360;
  --text-faint:        #566b68;  /* 5.7:1 on white, 5.0:1 on --paper-2 */
  --text-invert:       #f2f6f5;
  --text-invert-muted: #9fb4b0;
  --text-invert-faint: #6e8783;

  --focus: var(--ember-500);

  /* ── Type ────────────────────────────────────────────────────────── */
  --font-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --font-body:    "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  --font-mono:    "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --fs-display: clamp(2.85rem, 6.3vw, 5.25rem);
  --fs-h1:      clamp(2.3rem, 4.8vw, 3.9rem);
  --fs-h2:      clamp(1.85rem, 3.3vw, 2.85rem);
  --fs-h3:      clamp(1.28rem, 1.9vw, 1.6rem);
  --fs-h4:      1.1rem;
  --fs-lead:    clamp(1.06rem, 1.4vw, 1.26rem);
  --fs-body:    1.0625rem;
  --fs-sm:      0.9375rem;
  --fs-xs:      0.8125rem;
  --fs-mono:    0.75rem;

  /* ── Space (4px base) ────────────────────────────────────────────── */
  --s1: 4px;   --s2: 8px;   --s3: 12px;  --s4: 16px;  --s5: 24px;
  --s6: 32px;  --s7: 48px;  --s8: 64px;  --s9: 96px;  --s10: 128px;

  --section-y: clamp(64px, 8.5vw, 128px);
  --gutter:    clamp(20px, 5vw, 64px);
  --measure:   66ch;

  /* ── Geometry ────────────────────────────────────────────────────── */
  --r-sm: 3px;
  --r-md: 6px;
  --r-lg: 10px;
  --r-pill: 999px;

  /* ── Elevation. Shadows are green-black, never neutral grey, so they
        sit in the same world as the steel fields. ───────────────────── */
  --shadow-sm: 0 1px 2px rgba(8, 16, 15, 0.08);
  --shadow-md: 0 6px 20px -6px rgba(8, 16, 15, 0.18);
  --shadow-lg: 0 24px 60px -18px rgba(8, 16, 15, 0.32);

  /* ── Motion ──────────────────────────────────────────────────────── */
  --ease: cubic-bezier(0.22, 0.75, 0.28, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  /* ── Chrome ──────────────────────────────────────────────────────── */
  --nav-h: 68px;
}

@media (max-width: 820px) {
  :root { --nav-h: 60px; }
}

/* ════════════════════════════════════════════════════════════════════════
   Reset
   ════════════════════════════════════════════════════════════════════════ */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.65;
  text-wrap: pretty;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Locked while the mobile drawer is open. */
body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 112;
  font-weight: 800;
  line-height: 1.04;
  letter-spacing: -0.02em;
  text-wrap: balance;
  margin: 0;
}

h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); letter-spacing: -0.01em; }
h4 { font-size: var(--fs-h4); font-weight: 700; letter-spacing: -0.005em; }

p { margin: 0; }
p + p { margin-top: 1em; }

ul, ol { margin: 0; padding: 0; }
li { list-style: none; }

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

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

button { font: inherit; color: inherit; }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}
::selection { background: var(--teal-200); color: var(--steel-900); }

/* ════════════════════════════════════════════════════════════════════════
   Layout helpers
   ════════════════════════════════════════════════════════════════════════ */

.wrap {
  width: 100%;
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow { max-width: 940px; }

.section { padding-block: var(--section-y); }

/* Solid fields. Each one is a full-bleed block of colour — this is the
   "solid colours" the brief asked for, doing structural work rather than
   sitting behind hairline outlines. */
.field-steel { background: var(--steel-900); color: var(--text-invert); }
.field-ink    { background: var(--ink);      color: var(--text-invert); }
.field-mist   { background: var(--paper-2);  color: var(--text); }

.field-steel h1, .field-steel h2, .field-steel h3,
.field-ink h1, .field-ink h2, .field-ink h3 { color: var(--text-invert); }

.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

.skip-link {
  position: absolute; top: 0; left: 50%;
  transform: translate(-50%, -110%);
  z-index: 200;
  padding: var(--s3) var(--s5);
  background: var(--ember-500); color: #fff;
  font-family: var(--font-mono); font-size: var(--fs-xs);
  text-transform: uppercase; letter-spacing: 0.1em; text-decoration: none;
  border-radius: 0 0 var(--r-md) var(--r-md);
  transition: transform 200ms var(--ease);
}
.skip-link:focus-visible { transform: translate(-50%, 0); color: #fff; }

/* ════════════════════════════════════════════════════════════════════════
   Type primitives
   ════════════════════════════════════════════════════════════════════════ */

/* The mono eyebrow. This is the only place uppercase tracking is allowed —
   it reads as a machine label, which is the point. Headings stay in
   sentence case so they can be read rather than decoded. */
.eyebrow {
  display: flex;
  align-items: center;
  gap: var(--s3);
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  font-weight: 500;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--teal-700);
  margin: 0 0 var(--s4);
}
.eyebrow::before {
  content: "";
  width: 28px; height: 2px; flex: none;
  background: currentColor;
}
.field-steel .eyebrow, .field-ink .eyebrow { color: var(--ember-400); }

.lead {
  font-size: var(--fs-lead);
  line-height: 1.6;
  color: var(--text-muted);
  max-width: var(--measure);
}
.field-steel .lead, .field-ink .lead { color: var(--text-invert-muted); }

.display {
  font-family: var(--font-display);
  font-variation-settings: "wdth" 112;
  font-weight: 800;
  font-size: var(--fs-display);
  line-height: 0.98;
  letter-spacing: -0.03em;
  margin: 0;
}

.mono {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}

.text-ember { color: var(--ember-500); }
.text-teal  { color: var(--teal-500); }

/* Brand wordmark casing never gets touched by parent text-transform. */
.brand-case { text-transform: none; }

/* ════════════════════════════════════════════════════════════════════════
   The heat bar — the signature device.

   A gradient that runs teal (cold) to ember (hot). It appears in the hero
   and returns as the rule between sections. Each instance carries a
   --heat value from 0 to 1: the further down the page, the hotter the bar.
   That makes it structural rather than decorative — it encodes progress
   through the reforge.
   ════════════════════════════════════════════════════════════════════════ */

.heat {
  --heat: 0.5;
  position: relative;
  height: 3px;
  width: 100%;
  border: 0;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(
    90deg,
    var(--teal-500) 0%,
    color-mix(in oklab, var(--teal-400), var(--ember-500) calc(var(--heat) * 100%)) 55%,
    var(--ember-500) 100%
  );
  background-size: 100% 100%;
}

/* A single travelling highlight, slow enough to read as a kiln glow rather
   than a loading spinner. */
.heat::after {
  content: "";
  position: absolute;
  inset-block: 0;
  width: 22%;
  background: linear-gradient(90deg, transparent, rgba(255, 236, 214, 0.85), transparent);
  animation: heat-travel 6s linear infinite;
}
@keyframes heat-travel {
  from { transform: translateX(-120%); }
  to   { transform: translateX(560%); }
}

.heat--thick { height: 5px; }

/* ════════════════════════════════════════════════════════════════════════
   Buttons — solid, weighty, 48px minimum touch target
   ════════════════════════════════════════════════════════════════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 50px;
  padding: var(--s3) var(--s6);
  font-family: var(--font-body);
  font-size: var(--fs-sm);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  transition: background 200ms var(--ease), border-color 200ms var(--ease),
              color 200ms var(--ease), transform 160ms var(--ease),
              box-shadow 200ms var(--ease);
}
.btn:active { transform: translateY(1px); }
.btn .icon { flex: none; }

.btn-primary {
  background: var(--teal-600);
  border-color: var(--teal-600);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-primary:hover {
  background: var(--teal-700);
  border-color: var(--teal-700);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-ember {
  background: var(--ember-500);
  border-color: var(--ember-500);
  color: #fff;
  box-shadow: var(--shadow-sm);
}
.btn-ember:hover {
  background: var(--ember-600);
  border-color: var(--ember-600);
  color: #fff;
  box-shadow: var(--shadow-md);
}

.btn-outline {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}
.btn-outline:hover {
  background: var(--paper-2);
  border-color: var(--steel-600);
  color: var(--text);
}

/* On dark fields the outline button inverts. */
.field-steel .btn-outline,
.field-ink .btn-outline,
.hero .btn-outline {
  border-color: rgba(242, 246, 245, 0.28);
  color: var(--text-invert);
}
.field-steel .btn-outline:hover,
.field-ink .btn-outline:hover,
.hero .btn-outline:hover {
  background: rgba(242, 246, 245, 0.1);
  border-color: var(--text-invert);
  color: var(--text-invert);
}

.btn-sm { min-height: 44px; padding: var(--s2) var(--s5); font-size: var(--fs-xs); }
.btn-block { width: 100%; }

/* ════════════════════════════════════════════════════════════════════════
   Form controls
   ════════════════════════════════════════════════════════════════════════ */

.field-group { display: flex; flex-direction: column; gap: var(--s2); }

.field-group > label {
  font-family: var(--font-mono);
  font-size: var(--fs-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.input {
  width: 100%;
  min-height: 52px;
  padding: var(--s3) var(--s4);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--text);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  caret-color: var(--teal-500);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
  /* 16px minimum stops iOS Safari zooming the viewport on focus. */
  font-size: max(16px, var(--fs-body));
}
.input::placeholder { color: var(--text-faint); opacity: 1; }
.input:hover { border-color: var(--steel-500); }
.input:focus-visible {
  outline: none;
  border-color: var(--teal-500);
  box-shadow: 0 0 0 3px var(--teal-100);
}
textarea.input { min-height: 132px; resize: vertical; }

.input[aria-invalid="true"] {
  border-color: var(--ember-600);
  box-shadow: 0 0 0 3px var(--ember-100);
}

.field-error {
  display: none;
  align-items: center;
  gap: var(--s2);
  font-size: var(--fs-xs);
  color: var(--ember-700);
}
.field-error.is-shown { display: flex; }

/* ════════════════════════════════════════════════════════════════════════
   Reveal on scroll. Opacity and a short lift only — no scale, no blur.
   ════════════════════════════════════════════════════════════════════════ */

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
}
[data-reveal].is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity 620ms var(--ease-out), transform 620ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

/* ════════════════════════════════════════════════════════════════════════
   Reduced motion. Everything still arrives, nothing moves to get there.
   ════════════════════════════════════════════════════════════════════════ */

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