/* =========================================================
   Design tokens
   Palette is drawn directly from the project's own output
   colours (wound-yellow / normal-skin-gray, see visualize.py)
   rather than an unrelated brand palette.
   ========================================================= */
:root {
  --bg: #12151b;
  --bg-alt: #171b23;
  --panel: #1b202a;
  --edge: #262b35;
  --text: #e8e6df;
  --text-dim: #9aa0ac;
  --wound: #e6c200;
  --wound-soft: #6b5f1f;
  --normal: #4a5163;
  --teal: #5fd8cb;

  --font-display: 'IBM Plex Mono', 'SF Mono', monospace;
  --font-body: 'IBM Plex Sans', -apple-system, sans-serif;

  --maxw: 1080px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 28px;
}

/* subtle film-grain / noise texture over the whole page, ambient rather than decorative */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

code {
  font-family: var(--font-display);
  background: var(--panel);
  padding: 0.1em 0.4em;
  border-radius: 3px;
  font-size: 0.9em;
  color: var(--wound);
}

/* ============ Topbar ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(18, 21, 27, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--edge);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}
.brand {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.04em;
}
.brand-mark { color: var(--wound); }
.brand-dim { color: var(--text-dim); font-weight: 400; }
.topnav { display: flex; align-items: center; gap: 28px; }
.topnav a {
  color: var(--text-dim);
  font-family: var(--font-display);
  font-size: 0.85rem;
}
.topnav a:hover { color: var(--text); text-decoration: none; }
.nav-cta {
  color: var(--text) !important;
  border: 1px solid var(--edge);
  padding: 7px 14px;
  border-radius: 4px;
}
.nav-cta:hover { border-color: var(--wound); color: var(--wound) !important; }

/* ============ Hero ============ */
.hero {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 48px;
  align-items: center;
  padding-top: 96px;
  padding-bottom: 96px;
}
.eyebrow {
  font-family: var(--font-display);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--wound);
  margin: 0 0 18px;
}
h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 3.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.01em;
  margin: 0 0 24px;
}
.hero-sub {
  color: var(--text-dim);
  font-size: 1.05rem;
  max-width: 46ch;
  margin: 0 0 32px;
}
.hero-actions { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 48px; }
.btn {
  font-family: var(--font-display);
  font-size: 0.88rem;
  padding: 12px 20px;
  border-radius: 5px;
  display: inline-block;
}
.btn-primary {
  background: var(--wound);
  color: #1a1400;
  font-weight: 600;
}
.btn-primary:hover { background: #f2cf1a; text-decoration: none; }
.btn-ghost {
  border: 1px solid var(--edge);
  color: var(--text);
}
.btn-ghost:hover { border-color: var(--text-dim); text-decoration: none; }

.hero-stats { display: flex; gap: 40px; }
.hero-stats > div { display: flex; flex-direction: column; }
.stat-num {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--wound);
}
.stat-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.hero-visual { position: relative; }
.mesh-face { width: 100%; height: auto; display: block; filter: drop-shadow(0 20px 60px rgba(0,0,0,0.45)); }
.hero-visual-caption {
  font-family: var(--font-display);
  font-size: 0.72rem;
  color: var(--text-dim);
  text-align: center;
  margin-top: 14px;
  letter-spacing: 0.02em;
}

/* ============ Section rhythm ============ */
.section { padding: 88px 28px; border-top: 1px solid var(--edge); }
.section-tight { padding: 56px 28px; }
.kicker {
  font-family: var(--font-display);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--teal);
  margin: 0 0 14px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.6vw, 2.1rem);
  font-weight: 600;
  margin: 0 0 20px;
  max-width: 26ch;
}
.lede { color: var(--text-dim); max-width: 68ch; font-size: 1.02rem; }
.lede em { color: var(--text); font-style: normal; border-bottom: 1px dotted var(--wound); }

/* ============ Pipeline graph ============ */
.graph {
  position: relative;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 20px;
  margin-top: 48px;
}
.graph-line {
  position: absolute;
  top: 15px;
  left: 6%;
  right: 6%;
  height: 1px;
  background: repeating-linear-gradient(to right, var(--edge) 0 6px, transparent 6px 12px);
}
.node { position: relative; }
.node-dot {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg);
  border: 1.5px solid var(--wound);
  color: var(--wound);
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  margin-bottom: 16px;
  position: relative;
  z-index: 2;
}
.node h3 { font-family: var(--font-display); font-size: 1rem; margin: 0 0 8px; }
.node p { color: var(--text-dim); font-size: 0.9rem; margin: 0; }

/* ============ Architecture figure ============ */
.arch-figure {
  margin: 40px 0 0;
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
  background: var(--panel);
}
.arch-figure img { width: 100%; display: block; background: #fff; }
.arch-figure figcaption {
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--text-dim);
  border-top: 1px solid var(--edge);
}

/* ============ Cards ============ */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--edge);
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
  margin-top: 40px;
}
.card { background: var(--panel); padding: 30px; }
.card-tag {
  font-family: var(--font-display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--wound);
  margin: 0 0 12px;
}
.card h3 { font-size: 1.05rem; margin: 0 0 10px; }
.card p { color: var(--text-dim); font-size: 0.92rem; margin: 0; }

/* ============ Table ============ */
.table-wrap {
  margin-top: 32px;
  border: 1px solid var(--edge);
  border-radius: 8px;
  overflow: hidden;
}
table { width: 100%; border-collapse: collapse; font-family: var(--font-display); font-size: 0.9rem; }
th, td { text-align: left; padding: 14px 20px; }
thead th {
  background: var(--bg-alt);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--edge);
}
tbody tr { border-bottom: 1px solid var(--edge); }
tbody tr:last-child { border-bottom: none; }
.row-best td { color: var(--wound); font-weight: 600; }
.table-note { color: var(--text-dim); font-size: 0.88rem; max-width: 70ch; margin-top: 20px; }

/* ============ CTA ============ */
.cta { text-align: center; }
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 2.4vw, 1.8rem);
  max-width: 32ch;
  margin: 0 auto 28px;
}

/* ============ Footer ============ */
footer {
  position: relative;
  padding: 56px 28px 40px;
  border-top: 1px solid var(--edge);
  overflow: hidden;
}
.footer-mesh {
  position: absolute;
  right: -60px;
  top: -40px;
  width: 260px;
  opacity: 0.06;
  pointer-events: none;
}
.footer-inner { position: relative; z-index: 1; color: var(--text-dim); font-size: 0.88rem; }
.footer-links a { color: var(--text-dim); }
.footer-links a:hover { color: var(--wound); }

/* ============ Reveal-on-scroll ============ */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ============ Responsive ============ */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 56px; }
  .hero-visual { order: -1; max-width: 320px; margin: 0 auto 24px; }
  .graph { grid-template-columns: 1fr 1fr; }
  .graph-line { display: none; }
  .card-grid { grid-template-columns: 1fr; }
  .topnav a:not(.nav-cta) { display: none; }
  .hero-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
}

@media (max-width: 480px) {
  .graph { grid-template-columns: 1fr; }
}
