/* Layout: one centered hero over a full-screen particle canvas; the architecture page is a three-lane stack ending in the hardware rows. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url("./inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  --bg: #ffffff;
  --ink: #0a0a0a;
  --muted: #64748b;
  --line: #64748b;
  --soft: #e2e8f0;
  --btn-bg: #000000;
  --btn-fg: #ffffff;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0f19;
    --ink: #f4f6fa;
    --muted: #94a3b8;
    --line: #64748b;
    --soft: #1e2636;
    --btn-bg: #f4f6fa;
    --btn-fg: #0b0f19;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0f19;
  --ink: #f4f6fa;
  --muted: #94a3b8;
  --line: #64748b;
  --soft: #1e2636;
  --btn-bg: #f4f6fa;
  --btn-fg: #0b0f19;
  color-scheme: dark;
}

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 6px; }

/* ---------- Landing ---------- */
#sim {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

.hero {
  position: relative;
  z-index: 1;
  min-height: 100%;
  box-sizing: border-box;
  display: grid;
  place-items: center;
  padding-block: 48px 96px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  pointer-events: none;
  text-align: center;
}
.hero-inner { display: grid; justify-items: center; gap: 0; }

.hero h1 {
  margin: 0;
  font-weight: 650;
  font-size: clamp(2.75rem, 7.2vw, 4.25rem);
  line-height: 1.05;
  letter-spacing: -0.035em;
  text-wrap: balance;
  text-shadow: 0 0 18px var(--bg), 0 0 6px var(--bg);
}
.hero .sub {
  margin: 14px 0 0;
  font-size: clamp(0.95rem, 1.6vw, 1.05rem);
  color: var(--muted);
  letter-spacing: 0.005em;
  text-wrap: balance;
  text-shadow: 0 0 10px var(--bg), 0 0 4px var(--bg);
}

.hero .sub a { pointer-events: auto; color: var(--ink); text-underline-offset: 3px; }

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  margin-top: 40px;
  pointer-events: auto;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 96px;
  height: 46px;
  box-sizing: border-box;
  padding: 0 30px;
  border-radius: 6px;
  font: 500 16px/1 var(--sans);
  text-decoration: none;
  transition: transform 120ms ease, background-color 120ms ease, opacity 120ms ease;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--btn-bg); color: var(--btn-fg); border: 1px solid var(--btn-bg); }
.btn-primary:hover { opacity: 0.86; }
.btn-ghost { background: var(--bg); color: var(--muted); border: 1px solid var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink); }

.demos {
  position: fixed;
  z-index: 2;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  display: flex;
  gap: 4px;
  padding: 6px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
}
.demos button {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.demos button::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  opacity: 0.45;
  transition: opacity 150ms ease, transform 150ms ease;
}
.demos button:hover::before { opacity: 0.8; }
.demos button[aria-pressed="true"]::before { opacity: 1; background: var(--ink); transform: scale(1.15); }

/* ---------- Architecture ---------- */
.arch {
  max-width: 980px;
  margin: 0 auto;
  box-sizing: border-box;
  padding-block: 40px 64px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.back {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}
.back:hover { color: var(--ink); }
.arch h1 {
  margin: 20px 0 0;
  font-weight: 650;
  font-size: clamp(2rem, 5vw, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1.1;
}
.arch .lede {
  margin: 10px 0 0;
  color: var(--muted);
  max-width: 60ch;
  line-height: 1.55;
}

.diagram-wrap { margin-top: 36px; overflow-x: auto; }
.diagram {
  min-width: 600px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 18px;
  row-gap: 30px;
  font-size: 13px;
}
.lane {
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding-bottom: 2px;
  margin-bottom: -16px;
}

.node {
  position: relative;
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 10px 12px 11px;
  background: var(--bg);
  min-width: 0;
}
.node b { display: block; font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.node span { display: block; margin-top: 3px; color: var(--muted); line-height: 1.4; }
.node code { font-family: var(--mono); font-size: 12px; }
.node.soft { border-color: var(--line); }

/* arrows: a line + head drawn in the row gap under a node */
.down::after,
.pass::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 100%;
  width: 1px;
  height: 30px;
  background: var(--ink);
}
.down::before,
.pass::before {
  content: "";
  position: absolute;
  left: calc(50% - 4px);
  top: calc(100% + 23px);
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 7px solid var(--ink);
  z-index: 1;
}
.down.split::after { left: 25%; }
.down.split::before { left: calc(25% - 4px); }
.down.split2 > .tick { position: absolute; left: 75%; top: 100%; width: 1px; height: 30px; background: var(--ink); }
.down.split2 > .tick::after {
  content: "";
  position: absolute;
  left: -4px;
  top: 23px;
  border-left: 4.5px solid transparent;
  border-right: 4.5px solid transparent;
  border-top: 7px solid var(--ink);
}
.span2 { grid-column: 1 / span 2; }
.pass { position: relative; }
.pass.nohead::before { display: none; }
.pass::after { top: -30px; height: calc(100% + 60px); }
.pass::before { top: calc(100% + 23px); }

.slurm {
  grid-column: 1 / span 2;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: color-mix(in srgb, var(--soft) 55%, var(--bg));
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 18px;
  position: relative;
}
.slurm > .tag {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}
.slurm > .tag b { color: var(--ink); font-weight: 600; }

.sparks {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  position: relative;
}
.spark {
  border: 1px solid var(--ink);
  border-radius: 6px;
  padding: 10px 10px 11px;
  background: var(--bg);
  min-width: 0;
}
.spark b { display: block; font-weight: 600; font-size: 13px; }
.spark span { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }
.spark.soon { border-style: dashed; border-color: var(--line); }
.spark.soon b { color: var(--muted); }
.spark .state {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.spark .state::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink); }
.spark.soon .state::before { background: transparent; border: 1px solid var(--line); width: 5px; height: 5px; }

.fabric {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  position: relative;
}
.bus {
  position: absolute;
  left: 8%;
  right: 8%;
  top: -16px;
  height: 1px;
  background: var(--ink);
}
.fabric .node::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 100%;
  width: 1px;
  height: 16px;
  background: var(--ink);
}
.sparks::after {
  content: "";
  position: absolute;
  left: 8%;
  right: 8%;
  top: 100%;
  height: 14px;
  border-left: 1px solid var(--ink);
  border-right: 1px solid var(--ink);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin-top: 28px;
  font-size: 13px;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 18px;
  height: 11px;
  border: 1px solid var(--ink);
  border-radius: 3px;
  vertical-align: -1px;
  margin-right: 8px;
}
.legend i.dash { border-style: dashed; border-color: var(--line); }

.notes {
  margin-top: 36px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px 28px;
  font-size: 14px;
  line-height: 1.55;
}
.notes h2 {
  margin: 0 0 6px;
  font: 600 11px/1.2 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.notes p { margin: 0; max-width: 60ch; }

@media (max-width: 640px) {
  .sparks { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .btn, .demos button::before { transition: none; }
}
