/* ═══════════════════════════════════════════════════════════
   SUPERLOGICAL — terminal-native design system
   monospace-driven · keyboard-first · precise instant motion
   ═══════════════════════════════════════════════════════════ */

:root {
  --bg: #0b0d0a;
  --bg-2: #10130e;
  --panel: #13170f;
  --panel-2: #171c12;
  --rule: #262c1e;
  --rule-soft: #1d2218;
  --ink: #e9efe2;
  --ink-dim: #a7b29a;
  --muted: #6f7a62;
  --green: #8dff9e;
  --green-deep: #3fae56;
  --amber: #ffc35c;
  --blue: #7db8ff;
  --red: #ff6b6b;
  --caret-time: 1.06s;
  --snap: 120ms cubic-bezier(.2, .9, .25, 1);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* subtle scanline/grain atmosphere, purely background */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(141, 255, 158, .05), transparent 60%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}

main, header.topbar, footer { position: relative; z-index: 1; }

::selection { background: var(--green); color: #0b0d0a; }

a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button { font-family: inherit; }

:focus-visible { outline: 1px solid var(--green); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--green); color: #0b0d0a; padding: .4rem .8rem; z-index: 100;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ── top bar ─────────────────────────────────────────────── */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem 1rem;
  background: rgba(11, 13, 10, .86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
}
.topbar-brand { display: flex; align-items: center; gap: .5rem; color: var(--ink); }
.topbar-brand:hover { text-decoration: none; color: var(--green); }
.brand-mark { width: 18px; height: 18px; fill: currentColor; }
.brand-word { letter-spacing: .02em; }

.topbar-session {
  display: flex; align-items: center; gap: .45rem;
  border: 1px solid var(--rule); border-radius: 999px;
  padding: .12rem .65rem;
  color: var(--ink-dim);
  background: var(--bg-2);
  white-space: nowrap;
}
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-live { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot-dead { background: var(--amber); box-shadow: 0 0 8px var(--amber); }
.session-uptime { color: var(--muted); font-variant-numeric: tabular-nums; }

.topbar-nav { margin-left: auto; display: flex; gap: 1.1rem; align-items: center; }
.topbar-nav a { color: var(--ink-dim); }
.topbar-nav a:hover { color: var(--green); text-decoration: none; }
.nav-cta {
  border: 1px solid var(--green-deep); border-radius: 4px;
  color: var(--green) !important; padding: .1rem .6rem;
}
.nav-cta:hover { background: rgba(141, 255, 158, .08); }

/* ── hero terminal ───────────────────────────────────────── */
.hero {
  min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: calc(56px + 2vh) 1rem 1rem;
}
.hero-inner { max-width: 1080px; width: 100%; margin: 0 auto; }

.term-window, .share-window, .join-window {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .55), 0 0 0 1px rgba(141,255,158,.04), 0 0 60px rgba(141,255,158,.05);
}

.term-titlebar {
  display: flex; align-items: center; gap: .8rem;
  padding: .5rem .8rem;
  background: var(--panel-2);
  border-bottom: 1px solid var(--rule);
  font-size: 12.5px; color: var(--muted);
  user-select: none;
}
.tb-dots { display: flex; gap: 6px; }
.tb-dots i { width: 10px; height: 10px; border-radius: 50%; background: #2c3424; }
.tb-dots i:nth-child(1) { background: #ff5f57; }
.tb-dots i:nth-child(2) { background: #febc2e; }
.tb-dots i:nth-child(3) { background: #28c840; }
.tb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-actions { margin-left: auto; display: flex; gap: .4rem; }
.tb-btn {
  background: var(--bg-2); color: var(--ink-dim);
  border: 1px solid var(--rule); border-radius: 4px;
  font-size: 11.5px; padding: .1rem .55rem; cursor: pointer;
  transition: color var(--snap), border-color var(--snap), background var(--snap);
}
.tb-btn:hover { color: var(--green); border-color: var(--green-deep); }
.tb-btn[aria-pressed="true"] { color: var(--green); border-color: var(--green-deep); background: rgba(141,255,158,.07); }
.tb-peers { margin-left: auto; display: flex; align-items: center; gap: .35rem; }
.peer-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: .5rem; }
.pd-you { background: var(--green); box-shadow: 0 0 6px var(--green); }
.pd-m { background: var(--amber); box-shadow: 0 0 6px var(--amber); }

.term-body {
  display: flex;
  height: min(62vh, 560px);
  min-height: 340px;
  position: relative;
}
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane-main { flex: 1 1 auto; position: relative; }
.pane-watch { flex: 0 0 var(--watch-w, 42%); border-left: 0; background: var(--bg-2); }
.pane-tag {
  padding: .3rem .7rem; font-size: 11px; color: var(--muted);
  border-bottom: 1px dashed var(--rule-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.pane-divider {
  flex: 0 0 7px; cursor: col-resize;
  background: var(--rule-soft);
  position: relative;
  transition: background var(--snap);
}
.pane-divider::after {
  content: "⋮"; position: absolute; inset: 0;
  display: grid; place-items: center;
  color: var(--muted); font-size: 11px;
}
.pane-divider:hover, .pane-divider:focus-visible { background: var(--green-deep); }

.pane-scroll {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: .9rem 1rem .4rem;
  scrollbar-width: thin; scrollbar-color: var(--rule) transparent;
  overflow-wrap: break-word;
}
.watch-scroll { font-size: 12.5px; color: var(--ink-dim); }

/* terminal output lines */
.tl { white-space: pre-wrap; animation: lineIn var(--snap) both; }
@keyframes lineIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }
.tl-cmd { color: var(--ink); }
.tl-cmd::before { content: "visitor@sl:~$ "; color: var(--green); }
.tl-dim { color: var(--muted); }
.tl-green { color: var(--green); }
.tl-amber { color: var(--amber); }
.tl-blue { color: var(--blue); }
.tl-red { color: var(--red); }
.tl a { text-decoration: underline; text-underline-offset: 3px; }
.tl-table { color: var(--ink-dim); }
.tl .key { color: var(--green); }

/* input line */
.term-inputline {
  display: flex; align-items: baseline; gap: .55rem;
  padding: .5rem 1rem .85rem;
}
.prompt { color: var(--green); white-space: nowrap; user-select: none; }
.input-wrap { position: relative; flex: 1; min-width: 0; }
#term-input {
  width: 100%;
  background: transparent; border: 0; outline: 0;
  color: var(--ink); font: inherit; caret-color: transparent;
}
.caret {
  position: absolute; top: .2em; left: 0;
  width: .58em; height: 1.15em;
  background: var(--green);
  box-shadow: 0 0 10px rgba(141, 255, 158, .7);
  animation: caretBlink var(--caret-time) steps(1) infinite;
  pointer-events: none;
}
@keyframes caretBlink { 0%, 55% { opacity: 1; } 55.1%, 100% { opacity: 0; } }

/* status bar */
.term-statusbar {
  display: flex; gap: 1.2rem; align-items: center;
  padding: .3rem .8rem;
  background: var(--panel-2);
  border-top: 1px solid var(--rule);
  font-size: 11.5px; color: var(--ink-dim);
  user-select: none; white-space: nowrap; overflow: hidden;
}
.sb-green { color: var(--green); }
.sb-dim { color: var(--muted); }
.sb-right { margin-left: auto; }
.sb-cell b { color: var(--green); font-weight: 600; }

/* detach overlay */
.detach-overlay {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(8, 10, 7, .92);
  backdrop-filter: blur(3px);
  display: grid; place-items: center;
}
.detach-card { text-align: center; max-width: 30rem; padding: 1rem; }
.detach-line { color: var(--amber); font-size: 15px; }
.detach-line b { color: var(--ink); }
.detach-sub { color: var(--ink-dim); margin: .4rem 0 1rem; }
.detach-log {
  text-align: left; font-size: 12px; color: var(--muted);
  border: 1px dashed var(--rule); border-radius: 6px;
  padding: .6rem .8rem; margin-bottom: 1.1rem;
  min-height: 5.4em; max-height: 8.5em; overflow: hidden;
}
.detach-hint { color: var(--muted); font-size: 12px; margin-top: .9rem; }

.btn-solid {
  background: var(--green); color: #0b0d0a;
  border: 0; border-radius: 5px;
  font: inherit; font-weight: 600;
  padding: .45rem 1.1rem; cursor: pointer;
  transition: transform var(--snap), box-shadow var(--snap);
}
.btn-solid:hover { box-shadow: 0 0 24px rgba(141, 255, 158, .35); transform: translateY(-1px); }
.btn-solid:active { transform: translateY(0); }

/* game layer */
.game-layer { position: absolute; inset: 0; z-index: 4; background: var(--bg); display: flex; flex-direction: column; }
#game-canvas { flex: 1; width: 100%; height: 100%; outline-offset: -1px; cursor: crosshair; }
.game-hud {
  display: flex; gap: 1.2rem; padding: .3rem .8rem;
  border-top: 1px solid var(--rule); background: var(--panel-2);
  font-size: 12px; color: var(--ink-dim); user-select: none;
}
.game-quit-hint { margin-left: auto; color: var(--muted); }
.game-touch { display: none; gap: .6rem; padding: .5rem .8rem; background: var(--panel-2); border-top: 1px solid var(--rule); }
.game-touch button {
  flex: 1; padding: .7rem 0; font-size: 18px;
  background: var(--bg-2); color: var(--green);
  border: 1px solid var(--green-deep); border-radius: 6px;
}
.game-touch button:active { background: rgba(141,255,158,.12); }

/* chips + caption */
.chips {
  display: none; flex-wrap: wrap; gap: .5rem;
  margin: .8rem 0 0;
}
.chips button, .inline-cmd {
  background: var(--bg-2); color: var(--green);
  border: 1px solid var(--green-deep); border-radius: 4px;
  font: inherit; font-size: 12.5px; padding: .25rem .7rem; cursor: pointer;
  transition: background var(--snap);
}
.chips button:active { background: rgba(141,255,158,.15); }
.inline-cmd { padding: 0 .4rem; font-size: inherit; }
.inline-cmd:hover { background: rgba(141,255,158,.1); }

.hero-caption {
  margin-top: 1rem;
  color: var(--muted); font-size: 13.5px; text-align: center;
}
.noscript-note { max-width: 60ch; margin: 2rem auto; color: var(--ink-dim); text-align: center; }

/* ── sections ────────────────────────────────────────────── */
.section {
  max-width: 1080px; margin: 0 auto;
  padding: clamp(4rem, 10vh, 7rem) 1rem 0;
}
.section-head { margin-bottom: 2.2rem; }
.kicker { color: var(--muted); font-size: 13px; margin-bottom: .8rem; }
.prompt-mini { color: var(--green); }
.section h2 {
  font-weight: 600;
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.25; letter-spacing: -.01em;
}
.section h2 em { color: var(--green); font-style: normal; }
.section-copy { max-width: 62ch; margin-top: 1.8rem; color: var(--ink-dim); display: grid; gap: 1rem; }

/* reveal on scroll — snappy, no floaty drift */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .28s ease-out, transform .28s ease-out; }
.reveal.in { opacity: 1; transform: none; }

/* problem silos */
.problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.silos-card {
  border: 1px dashed var(--rule);
  border-radius: 8px; padding: 1rem;
  background: var(--bg-2);
  display: flex; flex-direction: column; gap: .8rem;
  transition: border-color var(--snap), transform var(--snap);
}
.silos-card:hover { border-color: var(--muted); transform: translateY(-2px); }
.silos-card header { display: flex; align-items: center; gap: .5rem; font-size: 13px; color: var(--ink); }
.silo-dot { width: 8px; height: 8px; border-radius: 50%; }
.silo-interactive .silo-dot { background: var(--green); }
.silo-automatic .silo-dot { background: var(--amber); }
.silo-production .silo-dot { background: var(--blue); }
.silo-term {
  background: var(--bg); border: 1px solid var(--rule-soft); border-radius: 6px;
  padding: .6rem .7rem; font-size: 12.5px; color: var(--ink-dim);
  white-space: pre-wrap; line-height: 1.7;
}
.silo-bad { color: var(--red); }
.silos-card p { font-size: 13.5px; color: var(--ink-dim); }

/* mux diagram */
.mux-figure {
  border: 1px solid var(--rule); border-radius: 10px;
  background: var(--bg-2); overflow: hidden;
}
#mux-canvas { display: block; width: 100%; height: clamp(260px, 42vw, 420px); }
.mux-caption {
  display: flex; flex-wrap: wrap; gap: .9rem; align-items: center;
  padding: .6rem 1rem; border-top: 1px solid var(--rule-soft);
  font-size: 12.5px; color: var(--ink-dim);
}
.k-i { color: var(--green); } .k-a { color: var(--amber); } .k-p { color: var(--blue); } .k-sl { color: var(--ink); }
.mux-arrow { color: var(--muted); }

/* changelog */
.changelog { display: grid; gap: 0; border: 1px solid var(--rule); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.cl-entry { padding: 1.2rem 1.3rem; border-top: 1px solid var(--rule-soft); position: relative; }
.cl-entry:first-child { border-top: 0; }
.cl-entry::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: transparent;
}
.cl-current { background: rgba(141, 255, 158, .045); }
.cl-current::before { background: var(--green); }
.cl-head { display: flex; gap: .9rem; align-items: baseline; font-size: 12.5px; margin-bottom: .4rem; flex-wrap: wrap; }
.cl-version { color: var(--ink); font-weight: 600; }
.cl-hash { color: var(--muted); }
.cl-status { margin-left: auto; }
.st-building { color: var(--green); animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
.st-planned { color: var(--muted); }
.cl-entry h3 { font-size: 1.05rem; font-weight: 600; margin-bottom: .5rem; }
.cl-entry ul { list-style: none; color: var(--ink-dim); font-size: 13.5px; display: grid; gap: .3rem; }
.cl-entry li::before { content: "+ "; color: var(--green-deep); }

/* share demo */
.share-wrap { display: grid; grid-template-columns: 1.5fr 1fr; gap: 1.4rem; align-items: start; }
.share-screen {
  height: 300px; overflow: hidden;
  padding: .9rem 1rem;
  font-size: 13px; line-height: 1.65;
  white-space: pre-wrap; overflow-wrap: break-word;
}
.share-points { list-style: none; display: grid; gap: .9rem; color: var(--ink-dim); font-size: 14px; }
.share-points b { color: var(--ink); }
.share-points li { padding-left: 1.2rem; position: relative; }
.share-points li::before { content: "▸"; position: absolute; left: 0; color: var(--green); }

/* cursors inside the share demo */
.cur { display: inline-block; width: .58em; height: 1.1em; vertical-align: text-bottom; animation: caretBlink var(--caret-time) steps(1) infinite; }
.cur-you { background: var(--green); box-shadow: 0 0 8px rgba(141,255,158,.7); }
.cur-m { background: var(--amber); box-shadow: 0 0 8px rgba(255,195,92,.7); }
.cur-tag {
  font-size: 10px; padding: 0 .3em; border-radius: 3px;
  vertical-align: .3em; margin-left: .2em;
}
.cur-tag-you { background: var(--green); color: #0b0d0a; }
.cur-tag-m { background: var(--amber); color: #0b0d0a; }
.hl-you { background: rgba(141,255,158,.16); border-radius: 2px; }
.hl-m { background: rgba(255,195,92,.16); border-radius: 2px; }

/* team man pages */
.man-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem; }
.man-card {
  border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
  background: var(--bg-2);
  transition: border-color var(--snap), transform var(--snap);
}
.man-card:hover { border-color: var(--green-deep); transform: translateY(-2px); }
.man-strip {
  display: flex; justify-content: space-between; gap: 1rem;
  background: var(--panel-2); border-bottom: 1px solid var(--rule);
  padding: .3rem .8rem; font-size: 11px; color: var(--muted);
}
.man-body { padding: 1rem 1.1rem 1.2rem; font-size: 13.5px; position: relative; }
.man-body h3 { font-size: 12px; color: var(--green); letter-spacing: .08em; margin: .9rem 0 .2rem; }
.man-body h3:first-child { margin-top: 0; }
.man-body p { color: var(--ink-dim); }
.man-body b { color: var(--ink); }
.man-face {
  float: right; width: 72px; height: 72px; object-fit: cover;
  border-radius: 6px; border: 1px solid var(--rule);
  margin: 0 0 .6rem .9rem;
  filter: saturate(.85);
}

.team-photo { margin-top: 2.4rem; }
.team-photo img {
  width: 100%; height: auto; display: block;
  border: 1px solid var(--rule); border-radius: 10px;
  filter: saturate(.9) contrast(1.02);
}
.team-photo figcaption { color: var(--muted); font-size: 12.5px; margin-top: .6rem; }

/* funders */
.funder-list {
  list-style: none;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--rule); border-radius: 10px; overflow: hidden;
  background: var(--bg-2);
}
.funder-list li {
  padding: 1rem 1.2rem; color: var(--ink-dim);
  border-top: 1px solid var(--rule-soft); border-left: 1px solid var(--rule-soft);
  margin: -1px 0 0 -1px;
  font-size: 14px;
  transition: color var(--snap), background var(--snap);
}
.funder-list li:hover { color: var(--green); background: rgba(141,255,158,.04); }

/* join */
.join { padding-bottom: clamp(4rem, 10vh, 7rem); }
.join-window { max-width: 640px; margin: 0 auto; }
.join-body { padding: 1.4rem 1.4rem 1.6rem; }
.join-line { color: var(--green); margin-bottom: .6rem; }
.join-desc { color: var(--ink-dim); font-size: 14px; margin-bottom: 1.2rem; max-width: 48ch; }
.join-form { display: flex; gap: .6rem; align-items: baseline; flex-wrap: wrap; }
.join-label { color: var(--muted); }
#join-email {
  flex: 1; min-width: 12rem;
  background: var(--bg); border: 1px solid var(--rule); border-radius: 5px;
  color: var(--ink); font: inherit; padding: .45rem .7rem;
  caret-color: var(--green);
}
#join-email:focus { outline: 0; border-color: var(--green-deep); box-shadow: 0 0 0 1px var(--green-deep); }
.join-out { margin-top: .9rem; font-size: 13.5px; color: var(--green); white-space: pre-wrap; }
.join-out.err { color: var(--red); }
.join-note { margin-top: 1rem; font-size: 12px; color: var(--muted); }

/* footer */
.footer {
  border-top: 1px solid var(--rule-soft);
  padding: 1.4rem 1rem 2rem;
  display: flex; align-items: center; gap: 1rem;
  max-width: 1080px; margin: 0 auto;
  font-size: 13px;
}
.footer-mark { fill: var(--muted); }
.footer-nav { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.footer-nav a { color: var(--ink-dim); }
.footer-nav a:hover { color: var(--green); }
.footer-dim { color: var(--muted); margin-left: auto; }

/* ── responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
  .problem-grid { grid-template-columns: 1fr; }
  .share-wrap { grid-template-columns: 1fr; }
  .man-grid { grid-template-columns: 1fr; }
  .funder-list { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .topbar { gap: .6rem; padding: .5rem .7rem; }
  .topbar-nav a:not(.nav-cta) { display: none; }
  .session-uptime { display: none; }
  .hero { padding: calc(52px + 1vh) .6rem .8rem; }
  .term-body { height: 64svh; min-height: 300px; }
  .tb-btn#btn-split { display: none; }  /* splits are a wide-screen luxury; chips carry the commands */
  .chips { display: flex; }
  .sb-hide-sm { display: none; }
  .section { padding-left: .8rem; padding-right: .8rem; }
  .game-touch { display: flex; }
  .man-face { width: 60px; height: 60px; }
  .funder-list { grid-template-columns: 1fr 1fr; font-size: 13px; }
  .footer-dim { display: none; }
}
@media (max-width: 380px) {
  .funder-list { grid-template-columns: 1fr; }
  .prompt { font-size: 12px; }
}
