:root {
  --bg: #080b0d;
  --bg-soft: #0d1114;
  --panel: rgba(255, 255, 255, 0.055);
  --panel-strong: rgba(255, 255, 255, 0.095);
  --line: rgba(255, 255, 255, 0.13);
  --text: #f3f4ef;
  --muted: rgba(243, 244, 239, 0.66);
  --faint: rgba(243, 244, 239, 0.42);
  --accent: #d8ff72;
  --accent-2: #74e6ff;
  --warm: #ffd27a;
  --danger: #ff8d9b;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px),
    linear-gradient(180deg, #07090b 0%, var(--bg) 48%, #0b0d0e 100%);
  background-size: 56px 56px, 56px 56px, auto;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

#ambientScene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.page-noise {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .22;
  background-image: linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 100% 6px;
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}

.topbar {
  position: sticky;
  top: 10px;
  z-index: 20;
  width: min(1120px, calc(100% - 28px));
  margin: 10px auto 0;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 18px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(8, 11, 13, .72);
  backdrop-filter: blur(20px);
}

.brand, .topbar nav, .hero-actions, .visual-controls, .lab-nav, footer {
  display: flex;
  align-items: center;
}

.brand { gap: 10px; font-weight: 800; letter-spacing: 0; }
.mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 3px;
  color: #07090b;
  background: var(--accent);
}
.topbar nav { justify-content: center; gap: 4px; }
.topbar nav a, .nav-cta {
  padding: 10px 13px;
  border-radius: 4px;
  color: var(--muted);
  font-size: 14px;
}
.topbar nav a:hover { color: var(--text); background: var(--panel); }
.nav-cta { color: #080b0d; background: var(--text); font-weight: 700; }

main, footer {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
}

.hero {
  min-height: auto;
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(390px, .9fr);
  gap: 28px;
  align-items: center;
  padding: 48px 0 30px;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}

h1, h2, h3, p { margin-top: 0; }
h1 {
  margin-bottom: 22px;
  font-size: clamp(34px, 5.2vw, 68px);
  line-height: .96;
  letter-spacing: -0.035em;
}
.type-line {
  display: block;
  min-height: .92em;
  font-family: "JetBrains Mono", monospace;
  letter-spacing: -0.06em;
}
.type-line::after, .promise-line::after {
  content: "";
  display: inline-block;
  width: .08em;
  height: .74em;
  margin-left: .08em;
  background: var(--accent);
  animation: blink 1s steps(2, start) infinite;
}
.promise-line {
  display: block;
  min-height: 1em;
  color: var(--muted);
  font-size: .30em;
  line-height: 1.12;
  letter-spacing: -0.02em;
}
.lead {
  max-width: 560px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.62;
}

.hero-actions { gap: 10px; flex-wrap: wrap; margin-top: 22px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--text);
  background: transparent;
  font-weight: 700;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-2px); border-color: rgba(255,255,255,.3); background: var(--panel); }
.button.primary { color: #07090b; border-color: transparent; background: var(--accent); }
.button.subtle { color: var(--muted); }

.visual-shell {
  position: relative;
  min-height: 450px;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background:
    linear-gradient(150deg, rgba(255,255,255,.08), rgba(255,255,255,.02)),
    rgba(255,255,255,.035);
  box-shadow: var(--shadow);
}
#systemMap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.visual-readout {
  position: absolute;
  left: 22px;
  bottom: 22px;
  width: min(380px, calc(100% - 44px));
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(8, 11, 13, .62);
  backdrop-filter: blur(18px);
}
.visual-readout span, .scope-panel span, .decision-board span {
  display: block;
  margin-bottom: 7px;
  color: var(--faint);
  font-family: "JetBrains Mono", monospace;
  font-size: 12px;
  text-transform: uppercase;
}
.visual-readout strong, .scope-panel strong, .decision-board strong {
  display: block;
  margin-bottom: 8px;
  font-size: 20px;
  letter-spacing: -0.02em;
}
.visual-readout p, .scope-panel p, .decision-board p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}
.visual-controls {
  position: absolute;
  top: 18px;
  right: 18px;
  gap: 8px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: rgba(8, 11, 13, .55);
  backdrop-filter: blur(18px);
}
.visual-controls button, .lab-nav button, .quick button {
  border: 0;
  border-radius: 4px;
  color: var(--muted);
  background: transparent;
}
.visual-controls button { padding: 7px 10px; }
.visual-controls button.active, .lab-nav button.active {
  color: #080b0d;
  background: var(--accent);
}

.studio, .systems, .console, .quote { padding: 50px 0; }
.section-copy {
  display: grid;
  grid-template-columns: minmax(0, .55fr) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  margin-bottom: 22px;
}
h2 {
  margin-bottom: 0;
  max-width: 780px;
  font-size: clamp(25px, 3.2vw, 42px);
  line-height: 1.04;
  letter-spacing: -0.032em;
}

.principles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.principles article {
  min-height: 180px;
  padding: 16px 16px 16px 0;
  border-bottom: 1px solid var(--line);
}
.principles article + article { padding-left: 16px; border-left: 1px solid var(--line); }
.principles span {
  color: var(--accent);
  font-family: "JetBrains Mono", monospace;
}
.principles h3 {
  margin: 38px 0 10px;
  font-size: 18px;
  letter-spacing: -0.02em;
}
.principles p { color: var(--muted); line-height: 1.5; }

.system-lab {
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255,255,255,.035);
}
.lab-nav {
  gap: 8px;
  padding: 10px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}
.lab-nav button {
  flex: 0 0 auto;
  padding: 8px 12px;
}
.lab-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 340px;
}
#scopeViz {
  width: 100%;
  height: 100%;
  min-height: 340px;
}
.scope-panel {
  padding: 16px;
  border-left: 1px solid var(--line);
  background: rgba(0,0,0,.13);
}
.scope-panel dl {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}
.scope-panel div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
}
.scope-panel dd { margin: 0; color: var(--text); font-weight: 700; }

.advisor {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(340px, .5fr);
  gap: 16px;
}
.chat-window, .decision-board, .quote-form {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(255,255,255,.04);
}
.chat-window { padding: 12px; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.chat-head > span {
  width: 42px;
  height: 42px;
  border-radius: 3px;
  background: radial-gradient(circle at 35% 30%, var(--text), var(--accent) 42%, #1b1f1c 72%);
}
.chat-head small { color: var(--faint); font-family: "JetBrains Mono", monospace; }
.messages {
  min-height: 180px;
  max-height: 250px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 0;
}
.msg {
  max-width: 82%;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: rgba(0,0,0,.16);
  line-height: 1.5;
}
.msg.user {
  align-self: flex-end;
  color: #07090b;
  border-color: transparent;
  background: var(--accent);
}
.quick {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.quick button {
  padding: 9px 11px;
  border: 1px solid var(--line);
}
.chat-form {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 10px;
}
input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  background: rgba(8, 11, 13, .72);
  outline: none;
}
input, select { height: 40px; padding: 0 14px; }
textarea { min-height: 112px; padding: 12px; resize: vertical; }
input:focus, textarea:focus, select:focus { border-color: rgba(216,255,114,.6); box-shadow: 0 0 0 4px rgba(216,255,114,.1); }
.chat-form button {
  border: 0;
  border-radius: 5px;
  color: #07090b;
  background: var(--accent);
  font-weight: 800;
}
.decision-board { padding: 16px; }
.module-list {
  display: grid;
  gap: 8px;
  margin-top: 22px;
}
.module-list i {
  padding: 7px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-style: normal;
}

.quote-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding: 14px;
}
.quote-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
}
.wide { grid-column: 1 / -1; }
.quote-output {
  grid-column: 1 / -1;
  min-height: 84px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: rgba(0,0,0,.16);
}

footer {
  justify-content: space-between;
  padding: 26px 0 32px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}
footer span { color: var(--text); font-weight: 800; }
footer a { color: var(--accent); }

@keyframes blink { 50% { opacity: 0; } }

@media (max-width: 980px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .hero, .section-copy, .advisor, .lab-stage { grid-template-columns: 1fr; }
  .visual-shell { min-height: 560px; }
  .scope-panel { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 680px) {
  main, footer, .topbar { width: min(100% - 20px, 1120px); }
  .brand { font-size: 14px; }
  h1 { font-size: 36px; }
  .promise-line { font-size: .42em; }
  .hero { padding-top: 42px; }
  .principles { grid-template-columns: 1fr; }
  .principles article, .principles article + article { padding-left: 0; border-left: 0; }
  .visual-controls { left: 14px; right: auto; top: 10px; }
  .visual-readout { left: 14px; bottom: 14px; width: calc(100% - 28px); }
  .quote-form { grid-template-columns: 1fr; }
}
