/* =========================================================================
   FableForge Labs — shared stylesheet
   Design direction: "Digital Foundry" — deep steel + molten brass.
   Accessibility: WCAG 2.1 AA targeted (contrast, focus, semantics, motion).
   ========================================================================= */

:root {
  /* Palette */
  --ink:        #0D1117;   /* base background — deep steel */
  --ink-2:      #141B25;   /* raised panels */
  --ink-3:      #1C2531;   /* borders / elevated */
  --line:       rgba(255, 255, 255, 0.09);
  --line-soft:  rgba(255, 255, 255, 0.05);

  --text:       #ECEFF3;   /* primary text */
  --muted:      #A0AAB8;   /* secondary text — AA on --ink */
  --faint:      #6E7887;   /* tertiary / captions */

  --brass:      #D9A94E;   /* molten brass accent */
  --brass-2:    #F0C270;   /* brass hover / highlight */
  --ember:      #E07B39;   /* warm glow, used sparingly */
  --steel:      #7FA6C4;   /* cool interactive accent */

  /* Type */
  --font-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", monospace;

  /* Scale */
  --maxw: 1120px;
  --gutter: clamp(20px, 5vw, 56px);
  --radius: 14px;
  --radius-sm: 9px;

  --shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.8);
}

/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@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;
  }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

img, svg { max-width: 100%; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.08; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
p { margin: 0 0 1rem; }
a { color: var(--brass); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--brass-2); }

/* Visible, high-contrast focus for keyboard users (ADA) */
:focus-visible {
  outline: 3px solid var(--brass-2);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Skip link */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 200;
  background: var(--brass);
  color: #12161c;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 0.18s ease;
  text-decoration: none;
}
.skip-link:focus { top: 16px; }

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

/* ---------- Layout ---------- */
.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }
.section { padding-block: clamp(64px, 9vw, 116px); }
.section--tight { padding-block: clamp(48px, 6vw, 72px); }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--brass);
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
}
/* the molten seam — the design's signature motif */
.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: linear-gradient(90deg, var(--ember), var(--brass-2));
  box-shadow: 0 0 10px rgba(224, 123, 57, 0.5);
}

.section-title { font-size: clamp(1.9rem, 4vw, 2.9rem); max-width: 20ch; }
.lede { color: var(--muted); font-size: 1.12rem; max-width: 56ch; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(13, 17, 23, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line-soft);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; height: 70px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand:hover { color: var(--text); }
.brand__mark { width: 34px; height: 34px; flex: none; }
.brand__name { font-family: var(--font-display); font-weight: 800; font-size: 1.12rem; letter-spacing: -0.02em; }
.brand__name span { color: var(--brass); }

.nav__links { display: flex; align-items: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.nav__links a {
  color: var(--muted); text-decoration: none; font-size: 0.95rem;
  padding: 9px 14px; border-radius: 8px;
}
.nav__links a:hover { color: var(--text); background: var(--ink-2); }
.nav__links a[aria-current="page"] { color: var(--text); }

.nav__toggle {
  display: none; background: var(--ink-2); border: 1px solid var(--line);
  color: var(--text); width: 44px; height: 44px; border-radius: 10px; cursor: pointer;
}
.nav__toggle svg { margin: auto; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-body); font-weight: 600; font-size: 0.98rem;
  padding: 13px 22px; border-radius: 10px; cursor: pointer;
  text-decoration: none; border: 1px solid transparent; transition: transform 0.12s ease, background 0.16s ease, border-color 0.16s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--brass); color: #12161c; }
.btn--primary:hover { background: var(--brass-2); color: #12161c; }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--brass); color: var(--text); background: var(--ink-2); }
.btn__arrow { transition: transform 0.16s ease; }
.btn:hover .btn__arrow { transform: translateX(3px); }

/* ---------- Hero ---------- */
.hero { position: relative; padding-block: clamp(72px, 12vw, 150px); overflow: hidden; }
.hero__glow {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(600px 340px at 78% 8%, rgba(224, 123, 57, 0.18), transparent 60%),
    radial-gradient(760px 460px at 12% 100%, rgba(127, 166, 196, 0.10), transparent 62%);
}
.hero__inner { position: relative; z-index: 1; }
.hero h1 {
  font-size: clamp(2.5rem, 6.2vw, 4.4rem);
  font-weight: 800;
  margin: 0 0 22px;
  max-width: 15ch;
}
.hero h1 .molten {
  background: linear-gradient(92deg, var(--brass-2), var(--ember));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__sub { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--muted); max-width: 58ch; margin-bottom: 34px; }
.hero__actions { display: flex; flex-wrap: wrap; gap: 14px; }

/* thin blueprint grid line under hero */
.rule {
  height: 1px; border: 0; margin: 0;
  background: linear-gradient(90deg, var(--line), transparent);
}

/* ---------- Stat / marquee strip ---------- */
.strip {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px;
  background: var(--line-soft); border: 1px solid var(--line-soft);
  border-radius: var(--radius); overflow: hidden; margin-top: 52px;
}
.strip__cell { background: var(--ink); padding: 26px 24px; }
.strip__k { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.strip__v { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; }

/* ---------- Cards / services ---------- */
.grid { display: grid; gap: 20px; }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--2 { grid-template-columns: repeat(2, 1fr); }

.card {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px;
  position: relative;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.card:hover { border-color: rgba(217, 169, 78, 0.5); transform: translateY(-3px); }
.card__icon {
  width: 46px; height: 46px; border-radius: 11px;
  display: grid; place-items: center; margin-bottom: 20px;
  background: rgba(217, 169, 78, 0.12); border: 1px solid rgba(217, 169, 78, 0.28);
  color: var(--brass);
}
.card h3 { font-size: 1.28rem; margin-bottom: 10px; }
.card p { color: var(--muted); margin: 0; font-size: 0.98rem; }

/* ---------- Process (numbered — real sequence) ---------- */
.steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; counter-reset: step; }
.step {
  border-top: 2px solid var(--line);
  padding-top: 22px;
  position: relative;
}
.step__no {
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em;
  color: var(--brass); margin-bottom: 14px; display: block;
}
.step h3 { font-size: 1.2rem; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.95rem; margin: 0; }

/* ---------- Portfolio ---------- */
.venture {
  display: flex; flex-direction: column; gap: 14px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px;
}
.venture__tag { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); }
.venture h3 { font-size: 1.35rem; }
.venture p { color: var(--muted); font-size: 0.96rem; margin: 0; }
.venture__status {
  margin-top: auto; font-size: 0.82rem; color: var(--steel);
  display: inline-flex; align-items: center; gap: 8px;
}
.venture__status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--steel); }

/* ---------- CTA band ---------- */
.cta {
  background: linear-gradient(180deg, var(--ink-2), var(--ink));
  border: 1px solid var(--line); border-radius: 20px;
  padding: clamp(36px, 6vw, 64px); text-align: center;
  position: relative; overflow: hidden;
}
.cta::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(420px 200px at 50% 0%, rgba(224, 123, 57, 0.16), transparent 70%);
}
.cta > * { position: relative; }
.cta h2 { font-size: clamp(1.7rem, 4vw, 2.6rem); margin-bottom: 16px; }
.cta p { color: var(--muted); max-width: 48ch; margin: 0 auto 28px; }

/* ---------- Forms (accessible) ---------- */
.form { display: grid; gap: 20px; max-width: 640px; }
.field { display: grid; gap: 8px; }
.field label { font-weight: 600; font-size: 0.95rem; }
.field .req { color: var(--brass); }
.field .hint { color: var(--faint); font-size: 0.85rem; font-weight: 400; }
.field input, .field textarea, .field select {
  font: inherit; color: var(--text);
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: 10px; padding: 13px 15px; width: 100%;
}
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid var(--brass-2); outline-offset: 2px; border-color: var(--brass);
}
.field textarea { min-height: 150px; resize: vertical; }
.field--error input, .field--error textarea { border-color: #E86A5E; }
.field__err { color: #F1948C; font-size: 0.85rem; min-height: 1em; }

.form__status {
  border-radius: 10px; padding: 14px 16px; font-size: 0.95rem;
  border: 1px solid var(--line); display: none;
}
.form__status.is-visible { display: block; }
.form__status.is-success { background: rgba(127, 166, 196, 0.12); border-color: rgba(127, 166, 196, 0.4); color: #cfe2f0; }
.form__status.is-error { background: rgba(232, 106, 94, 0.10); border-color: rgba(232, 106, 94, 0.42); color: #f4b3ab; }

.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- Legal / prose pages ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: 1.5rem; margin: 40px 0 12px; }
.prose h3 { font-size: 1.15rem; margin: 26px 0 8px; }
.prose p, .prose li { color: var(--muted); }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1rem; }
.prose li { margin-bottom: 6px; }
.prose a { color: var(--brass); }
.legal-meta { color: var(--faint); font-family: var(--font-mono); font-size: 0.8rem; margin-bottom: 8px; }
.callout {
  background: var(--ink-2); border: 1px solid var(--line);
  border-left: 3px solid var(--brass); border-radius: 10px;
  padding: 16px 18px; margin: 24px 0; font-size: 0.92rem; color: var(--muted);
}

.toc {
  background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 26px; margin-bottom: 40px;
}
.toc h2 { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); margin: 0 0 12px; }
.toc ol { margin: 0; padding-left: 1.2em; columns: 2; gap: 24px; }
.toc a { text-decoration: none; color: var(--text); }
.toc a:hover { color: var(--brass); text-decoration: underline; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); background: var(--ink); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 40px; padding-block: 56px 34px; }
.footer-brand p { color: var(--muted); font-size: 0.95rem; max-width: 34ch; margin-top: 14px; }
.footer-col h4 { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--faint); font-weight: 400; margin-bottom: 14px; }
.footer-col ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.footer-col a { color: var(--muted); text-decoration: none; font-size: 0.95rem; }
.footer-col a:hover { color: var(--brass); }
.footer-bottom {
  display: flex; flex-wrap: wrap; gap: 12px; justify-content: space-between;
  align-items: center; padding-block: 22px; border-top: 1px solid var(--line-soft);
  color: var(--faint); font-size: 0.85rem;
}

/* ---------- Reveal-on-scroll (progressive, JS-gated) ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-in { opacity: 1; transform: none; }
.no-js .reveal { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .grid--3, .steps { grid-template-columns: 1fr 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav__links {
    position: fixed; inset: 70px 0 auto 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    background: var(--ink); border-bottom: 1px solid var(--line);
    padding: 16px var(--gutter) 24px; transform: translateY(-140%);
    transition: transform 0.25s ease; box-shadow: var(--shadow);
  }
  .nav__links.is-open { transform: translateY(0); }
  .nav__links a { padding: 14px 12px; }
  .nav__toggle { display: grid; }
  .grid--3, .grid--2, .steps { grid-template-columns: 1fr; }
  .strip { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr; }
  .toc ol { columns: 1; }
}
