/* ═══ inbrain.fun — cortex UI ═══ */

:root {
  --bg: #04050a;
  --surface: rgba(255, 255, 255, 0.028);
  --surface-2: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.075);
  --border-hl: rgba(124, 108, 255, 0.4);
  --text: #eceef6;
  --dim: #8b91a8;
  --faint: #4d5268;
  --purple: #7c6cff;
  --cyan: #4dd0c4;
  --green: #34d399;
  --amber: #fbbf24;
  --red: #f87171;
  --grad: linear-gradient(100deg, #7c6cff, #4dd0c4 65%, #6ee7b7);
  --font: "Space Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.mono { font-family: var(--mono); letter-spacing: 0.02em; }

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ─── brain canvas ─── */
#brain-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse 70% 55% at 50% 42%, transparent 30%, rgba(4, 5, 10, 0.55) 78%, rgba(4, 5, 10, 0.92) 100%);
}

main, .nav, .footer { position: relative; z-index: 2; }

/* ─── nav ─── */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 28px;
  transition: background 0.3s, border-color 0.3s;
  border-bottom: 1px solid transparent;
}

.nav.scrolled {
  background: rgba(4, 5, 10, 0.88);
  border-bottom-color: var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }

.brand-logo-wrap {
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-flex;
}

.brand-logo {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: block;
  animation: logoBreath 3.2s ease-in-out infinite;
}

@keyframes logoBreath {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(59, 111, 230, 0.55)) brightness(1);
  }
  45% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 16px rgba(59, 111, 230, 0.95)) brightness(1.12);
  }
  55% {
    transform: scale(1.04);
    filter: drop-shadow(0 0 13px rgba(77, 208, 196, 0.8)) brightness(1.18);
  }
}

.brand-ring {
  position: absolute;
  inset: 0;
  border-radius: 9px;
  border: 1.5px solid rgba(59, 111, 230, 0.9);
  animation: synapseRing 3.2s ease-out infinite;
  pointer-events: none;
}

@keyframes synapseRing {
  0%, 38% { transform: scale(1); opacity: 0; }
  46% { opacity: 0.9; }
  78%, 100% { transform: scale(1.85); opacity: 0; }
}

.brand:hover .brand-logo { animation-duration: 1.1s; }
.brand:hover .brand-ring { animation-duration: 1.1s; }

.brand-name { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.02em; }

.nav-right { display: flex; align-items: center; gap: 14px; }

.net-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--cyan);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(4, 5, 10, 0.55);
}

.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); }
  50% { box-shadow: 0 0 0 6px rgba(52, 211, 153, 0); }
}

.nav-gh {
  color: var(--dim);
  display: flex;
  padding: 9px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(4, 5, 10, 0.55);
  transition: color 0.2s;
}
.nav-gh:hover { color: var(--text); }

/* ─── hero ─── */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 0 24px;
  position: relative;
}

.hero-title {
  font-size: clamp(2.6rem, 7vw, 5.4rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.hero-title .line { display: block; }

.hero-title .line:first-child {
  animation: riseIn 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.hero-title .line.grad {
  animation: riseIn 0.9s 0.15s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(34px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-tag {
  margin-top: 26px;
  font-size: 0.7rem;
  letter-spacing: 0.32em;
  color: var(--cyan);
  animation: fadeIn 1s 0.5s both;
}

.hero-meta {
  margin-top: 14px;
  display: flex;
  gap: 12px;
  font-size: 0.74rem;
  color: var(--faint);
  animation: fadeIn 1s 0.7s both;
}
.hero-meta i { font-style: normal; color: var(--purple); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.scroll-hint {
  position: absolute;
  bottom: 34px;
  font-size: 0.64rem;
  letter-spacing: 0.2em;
  color: var(--faint);
  animation: bob 2.2s ease-in-out infinite;
}
@keyframes bob {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(7px); opacity: 1; }
}

/* ─── sections ─── */
.section {
  max-width: 1060px;
  margin: 0 auto;
  padding: 110px 24px;
}

.sec-label {
  font-size: 0.66rem;
  letter-spacing: 0.26em;
  color: var(--purple);
  margin-bottom: 14px;
}

.section h2 {
  font-size: clamp(1.7rem, 3.6vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.12;
  margin-bottom: 38px;
}

/* ─── console ─── */
.console-wrap {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 9, 16, 0.92);
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(124, 108, 255, 0.06);
}

.console-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.cdot { width: 11px; height: 11px; border-radius: 50%; }
.cdot.r { background: #ff5f57; }
.cdot.y { background: #febc2e; }
.cdot.g { background: #28c840; }

.console-title {
  margin-left: 12px;
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.1em;
}

.console-state {
  margin-left: auto;
  font-size: 0.66rem;
  color: var(--green);
  letter-spacing: 0.12em;
  animation: blink 2.2s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

.console-body {
  height: 340px;
  overflow-y: auto;
  padding: 18px 20px;
  font-size: 0.76rem;
  line-height: 1.9;
  scrollbar-width: thin;
  scrollbar-color: var(--faint) transparent;
}

.cl { animation: lineIn 0.3s ease both; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@keyframes lineIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

.cl .t { color: var(--faint); }
.cl .dim { color: var(--dim); }
.cl b { color: var(--text); }
.agent-sig { color: var(--cyan); }
.agent-brain { color: var(--purple); }
.agent-mem { color: var(--green); }
.agent-dream { color: var(--amber); }
.agent-sys { color: var(--faint); }

/* ─── HUD stats ─── */
.hud-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.hud {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 9, 16, 0.88);
  padding: 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hud::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: var(--grad);
  opacity: 0.5;
}

.hud-v {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hud-k {
  margin-top: 4px;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  color: var(--faint);
  text-transform: uppercase;
}

/* ─── signals ─── */
.signals-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 12px;
}

.sig {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 9, 16, 0.88);
  padding: 18px 19px;
  transition: border-color 0.22s, transform 0.22s;
}

.sig:hover { border-color: var(--border-hl); transform: translateY(-3px); }

.sig-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 11px;
}

.sig-conv {
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  padding: 4px 10px;
  border-radius: 100px;
}
.conv-high { background: rgba(52, 211, 153, 0.12); color: var(--green); }
.conv-contested { background: rgba(251, 191, 36, 0.12); color: var(--amber); }
.conv-watch { background: rgba(124, 108, 255, 0.14); color: #a99fff; }

.sig-vol { font-size: 0.66rem; color: var(--faint); }

.sig-q {
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.42;
  min-height: 2.7em;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.sig-row { display: flex; align-items: center; gap: 10px; }

.sig-pct {
  font-size: 1rem;
  font-weight: 600;
  min-width: 44px;
  font-variant-numeric: tabular-nums;
}

.conv-high ~ * .sig-pct { color: var(--green); }

.sig-bar {
  flex: 1;
  height: 5px;
  border-radius: 100px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.sig-bar i {
  display: block;
  height: 100%;
  border-radius: 100px;
  background: var(--grad);
  transition: width 0.8s cubic-bezier(0.22, 1, 0.36, 1);
}

.sig-yes { font-size: 0.62rem; color: var(--faint); letter-spacing: 0.12em; }

/* ─── flow ─── */
.flow {
  display: grid;
  grid-template-columns: 1fr 36px 1fr 36px 1.1fr 36px 1fr 36px 1fr;
  align-items: center;
  gap: 6px;
}

.flow-node {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(7, 9, 16, 0.88);
  padding: 22px 14px;
  text-align: center;
  transition: border-color 0.25s;
}

.flow-node:hover { border-color: var(--border-hl); }

.flow-core {
  border-color: var(--border-hl);
  background: linear-gradient(160deg, rgba(124, 108, 255, 0.13), rgba(77, 208, 196, 0.05));
  box-shadow: 0 0 40px rgba(124, 108, 255, 0.12);
}

.flow-ico { font-size: 1.35rem; margin-bottom: 9px; }
.flow-name { font-weight: 600; font-size: 0.95rem; }
.flow-sub { margin-top: 5px; font-size: 0.6rem; color: var(--faint); letter-spacing: 0.06em; }

.flow-line {
  position: relative;
  height: 2px;
  background: rgba(124, 108, 255, 0.18);
  border-radius: 2px;
  overflow: visible;
}

.flow-dot {
  position: absolute;
  top: 50%;
  left: 0;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  transform: translateY(-50%);
  animation: travel 2.4s linear infinite;
}
.flow-dot.d2 { animation-delay: 0.6s; }
.flow-dot.d3 { animation-delay: 1.2s; }
.flow-dot.d4 { animation-delay: 1.8s; }

@keyframes travel {
  from { left: -4px; opacity: 0; }
  15% { opacity: 1; }
  85% { opacity: 1; }
  to { left: calc(100% - 3px); opacity: 0; }
}

.flow-loop {
  margin-top: 26px;
  text-align: center;
  font-size: 0.74rem;
  color: var(--dim);
  letter-spacing: 0.06em;
}

/* ─── dream ─── */
.dream-chamber {
  position: relative;
  height: 560px;
  border: 1px solid var(--border-hl);
  border-radius: 20px;
  background: radial-gradient(ellipse 60% 55% at 50% 50%, rgba(124, 108, 255, 0.09), rgba(7, 9, 16, 0.94) 75%);
  overflow: hidden;
  box-shadow: 0 0 80px rgba(124, 108, 255, 0.1), inset 0 0 120px rgba(4, 5, 10, 0.6);
}

#dream-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.dream-core {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -54%);
  text-align: center;
  pointer-events: none;
}

.dream-count {
  font-size: clamp(2.4rem, 6.5vw, 4.2rem);
  font-weight: 500;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 0 50px rgba(124, 108, 255, 0.4);
  animation: coreBreath 4.6s ease-in-out infinite;
}

@keyframes coreBreath {
  0%, 100% { opacity: 0.92; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.02); }
}

.dream-label {
  margin-top: 6px;
  font-size: 0.64rem;
  letter-spacing: 0.22em;
  color: var(--faint);
  text-transform: uppercase;
}

.dream-rem {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  color: var(--cyan);
  text-transform: uppercase;
}

.rem-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: pulse 2.6s ease-in-out infinite;
}

.dream-phase {
  position: absolute;
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  color: var(--faint);
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 100px;
  background: rgba(7, 9, 16, 0.85);
  white-space: nowrap;
  transform: translate(-50%, -50%);
  transition: color 0.5s, border-color 0.5s, box-shadow 0.5s, text-shadow 0.5s;
}

.dream-phase b { color: var(--purple); font-weight: 500; margin-right: 4px; transition: color 0.5s; }

.dream-phase.active {
  color: var(--text);
  border-color: rgba(77, 208, 196, 0.65);
  box-shadow: 0 0 24px rgba(77, 208, 196, 0.25), inset 0 0 14px rgba(77, 208, 196, 0.08);
}

.dream-phase.active b { color: var(--cyan); }

/* phase positions on the orbit */
.dream-phase[data-phase="0"] { top: 18%; left: 24%; }
.dream-phase[data-phase="1"] { top: 30%; left: 79%; }
.dream-phase[data-phase="2"] { top: 76%; left: 72%; }
.dream-phase[data-phase="3"] { top: 70%; left: 22%; }

/* ─── cta ─── */
.cta { padding-bottom: 130px; max-width: 760px; }

.cta-term {
  border: 1px solid var(--border-hl);
  border-radius: 14px;
  background: rgba(7, 9, 16, 0.92);
  overflow: hidden;
  box-shadow: 0 0 60px rgba(124, 108, 255, 0.08);
}

.cta-body {
  padding: 26px 26px 30px;
  font-size: 0.8rem;
  line-height: 1.9;
  min-height: 220px;
}

.cta-prompt { color: var(--purple); }
.cta-dollar { color: var(--faint); }
#cta-cmd { color: var(--text); }

.cta-cursor {
  display: inline-block;
  width: 8px;
  height: 1em;
  margin-left: 2px;
  vertical-align: text-bottom;
  background: var(--cyan);
  animation: blink 1s steps(1) infinite;
}

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

#cta-out { color: var(--dim); white-space: pre-wrap; }

#cta-out .ok { color: var(--cyan); }
#cta-out .dim { color: var(--faint); }
#cta-out .moat {
  display: block;
  margin-top: 14px;
  color: var(--text);
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cta-actions {
  margin-top: 18px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.ghost-btn {
  display: inline-block;
  padding: 11px 22px;
  border: 1px solid var(--border-hl);
  border-radius: 10px;
  background: rgba(7, 9, 16, 0.7);
  color: var(--dim);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: rgba(77, 208, 196, 0.55);
  box-shadow: 0 0 24px rgba(77, 208, 196, 0.15);
}

/* ─── footer ─── */
.footer {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 34px 24px;
  border-top: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--faint);
  letter-spacing: 0.08em;
  background: rgba(4, 5, 10, 0.7);
}

.footer a { color: var(--dim); text-decoration: none; }
.footer a:hover { color: var(--text); }

/* screenshot helper */
.shot .hero { min-height: 640px; }
.shot html { scroll-behavior: auto; }

/* ─── responsive ─── */
@media (max-width: 1000px) {
  .flow { grid-template-columns: 1fr; }
  .flow-line { width: 2px; height: 30px; margin: 0 auto; }
  .flow-dot { animation: travelV 2.4s linear infinite; left: 50%; transform: translateX(-50%); }
  @keyframes travelV {
    from { top: -4px; opacity: 0; }
    15% { opacity: 1; }
    85% { opacity: 1; }
    to { top: calc(100% - 3px); opacity: 0; }
  }
}

@media (max-width: 720px) {
  .hud-row { grid-template-columns: repeat(2, 1fr); }
  .net-chip { display: none; }
  .console-body { height: 280px; font-size: 0.68rem; }
  .section { padding: 80px 18px; }
  .dream-chamber { height: 460px; }
  .dream-phase { font-size: 0.56rem; padding: 6px 10px; }
}
