:root {
  color-scheme: dark;
  --bg: #020302;
  --bg-2: #050705;
  --ink: #edf7ee;
  --muted: #8b998f;
  --dim: #56635b;
  --faint: #273229;
  --line: rgba(217, 255, 223, 0.16);
  --line-bright: rgba(217, 255, 223, 0.34);
  --green: #68ff8d;
  --green-deep: #0d3b1c;
  --amber: #e9b45d;
  --red: #ff4c63;
  --panel: rgba(2, 4, 3, 0.88);
  --panel-soft: rgba(8, 12, 9, 0.72);
  --mono: "Cascadia Code", "IBM Plex Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% -10%, rgba(104, 255, 141, 0.06), transparent 34rem),
    radial-gradient(circle at 90% 24%, rgba(255, 76, 99, 0.045), transparent 28rem),
    linear-gradient(180deg, #010201 0%, #040705 44%, #020302 100%);
  font-family: var(--sans);
  overflow-x: hidden;
}

body::before,
.screen-noise,
.boot-shutter {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

body::before {
  content: "";
  z-index: 1;
  background:
    linear-gradient(rgba(237, 247, 238, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(237, 247, 238, 0.012) 1px, transparent 1px);
  background-size: 100% 5px, 88px 100%;
  opacity: 0.74;
}

.screen-noise {
  z-index: 2;
  background-image:
    repeating-radial-gradient(circle at 12% 21%, rgba(237, 247, 238, 0.06) 0 1px, transparent 1px 6px),
    repeating-radial-gradient(circle at 71% 42%, rgba(104, 255, 141, 0.04) 0 1px, transparent 1px 9px);
  mix-blend-mode: screen;
  opacity: 0.13;
}

.boot-shutter {
  z-index: 8;
  background: #000;
  animation: boot-shutter 1300ms cubic-bezier(0.76, 0, 0.24, 1) forwards;
}

@keyframes boot-shutter {
  0% { clip-path: inset(0 0 0 0); opacity: 1; }
  55% { clip-path: inset(49.5% 0 49.5% 0); opacity: 1; }
  100% { clip-path: inset(50% 0 50% 0); opacity: 0; }
}

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

  .boot-shutter {
    display: none;
  }

  [data-boot-line] {
    opacity: 1;
    transform: none;
  }
}

.skip-link {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  transform: translateY(-150%);
  padding: 10px 12px;
  background: var(--ink);
  color: #020302;
  font: 700 0.82rem var(--mono);
}

.skip-link:focus {
  transform: translateY(0);
}

a {
  color: inherit;
}

.terminal-shell {
  position: relative;
  z-index: 5;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.terminal-artifact {
  position: relative;
  min-height: calc(100vh - 56px);
  border: 1px solid var(--line-bright);
  background:
    linear-gradient(180deg, rgba(104, 255, 141, 0.035), transparent 19rem),
    var(--panel);
  box-shadow:
    0 0 0 1px rgba(104, 255, 141, 0.05),
    0 0 80px rgba(0, 0, 0, 0.55),
    inset 0 0 90px rgba(104, 255, 141, 0.018);
  overflow: clip;
}

.terminal-artifact::before {
  content: "";
  position: absolute;
  inset: 0;
  border-left: 2px solid rgba(104, 255, 141, 0.82);
  pointer-events: none;
}

.terminal-artifact::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 28vh;
  background: linear-gradient(180deg, transparent, rgba(104, 255, 141, 0.032));
  pointer-events: none;
}

.terminal-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 56px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(2, 4, 3, 0.92);
  backdrop-filter: blur(10px);
  font-family: var(--mono);
}

.brand-chip {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 30px;
  border: 1px solid rgba(104, 255, 141, 0.42);
  color: var(--green);
  text-decoration: none;
  font-weight: 800;
}

.terminal-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 18px;
  color: var(--muted);
  font-size: 0.78rem;
}

.terminal-nav a,
.terminal-actions a {
  text-decoration: none;
}

.terminal-nav a:hover,
.terminal-actions a:hover,
.terminal-nav a:focus-visible,
.terminal-actions a:focus-visible {
  color: var(--green);
  outline: none;
}

.boot-panel {
  display: grid;
  gap: 8px;
  padding: 28px 22px 0;
  color: var(--dim);
  font: 0.72rem var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

[data-boot-line] {
  display: block;
  opacity: 0;
  transform: translateY(4px);
  animation: boot-line 700ms ease forwards;
}

[data-boot-line]:nth-child(2) { animation-delay: 180ms; }
[data-boot-line]:nth-child(3) { animation-delay: 360ms; color: var(--green); }

@keyframes boot-line {
  to { opacity: 1; transform: translateY(0); }
}

.terminal-hero {
  min-height: min(680px, calc(100vh - 112px));
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.44fr);
  align-items: center;
  gap: clamp(28px, 6vw, 80px);
  padding: clamp(56px, 9vh, 96px) clamp(24px, 6vw, 78px) clamp(52px, 8vh, 90px);
}

.hero-session {
  max-width: 820px;
  min-width: 0;
}

.prompt-line {
  margin: 0 0 22px;
  color: var(--green);
  font: 700 clamp(1.2rem, 2vw, 1.6rem) var(--mono);
}

.prompt-line span,
.source-output span {
  color: var(--ink);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  position: relative;
  margin: 0 0 22px;
  color: var(--ink);
  font: 800 clamp(3.5rem, 8vw, 7.4rem)/0.82 var(--mono);
  letter-spacing: -0.105em;
  text-transform: lowercase;
}

h1::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: var(--red);
  opacity: 0.34;
  transform: translate(0.026em, 0.014em);
  clip-path: inset(58% 0 26% 0);
}

.tagline {
  max-width: 620px;
  margin-bottom: 20px;
  color: var(--ink);
  font: 500 clamp(1.25rem, 2.4vw, 2.1rem)/1.18 var(--sans);
  letter-spacing: -0.05em;
}

.safety-line {
  max-width: 780px;
  margin-bottom: 30px;
  color: var(--muted);
  font: 0.96rem/1.8 var(--mono);
}

.terminal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--green);
  font: 700 0.9rem var(--mono);
}

.terminal-actions a {
  padding: 10px 0;
}

.runtime-facts {
  align-self: center;
  margin: 0;
  border-top: 1px solid var(--line);
  font-family: var(--mono);
}

.runtime-facts div {
  display: grid;
  grid-template-columns: 0.82fr 1fr;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.runtime-facts dt {
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.runtime-facts dd {
  margin: 0;
  color: var(--green);
  font-size: 0.82rem;
}

.session-grid,
.terminal-section {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 70px);
  padding: clamp(72px, 11vw, 130px) clamp(24px, 6vw, 78px);
  border-top: 1px solid var(--line);
}

.section-copy {
  max-width: 360px;
}

.section-index {
  margin-bottom: 18px;
  color: var(--dim);
  font: 700 0.72rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

h2 {
  margin-bottom: 18px;
  color: var(--ink);
  font: 800 clamp(2rem, 4.2vw, 4.4rem)/0.9 var(--mono);
  letter-spacing: -0.09em;
  text-transform: lowercase;
}

.section-copy p:not(.section-index),
.scene p,
.terminal-list,
.safety-log,
.source-output {
  color: var(--muted);
  line-height: 1.75;
}

.terminal-window {
  min-height: 440px;
  border: 1px solid var(--line-bright);
  background: rgba(0, 0, 0, 0.5);
}

.window-bar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  min-height: 42px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font: 700 0.72rem var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

#scene-state[data-state="planned"] { color: var(--amber); }
#scene-state[data-state="locked"] { color: var(--red); }
#scene-state[data-state="real"] { color: var(--green); }

#terminal-output {
  position: relative;
  min-height: 395px;
  margin: 0;
  padding: 44px 24px 26px;
  color: var(--green);
  font: clamp(0.72rem, 1.18vw, 0.95rem)/1.72 var(--mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

#terminal-output::before {
  content: attr(data-badge);
  position: absolute;
  top: 16px;
  right: 18px;
  color: var(--muted);
  font: 700 0.68rem var(--mono);
  letter-spacing: 0.14em;
}

.scene-rail {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.scene {
  min-height: 210px;
  padding: 22px 18px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.006);
  opacity: 0.52;
  transition: opacity 160ms ease, background 160ms ease;
}

.scene:last-child {
  border-right: 0;
}

.scene.is-active {
  opacity: 1;
  background: rgba(104, 255, 141, 0.035);
}

.scene-state {
  display: block;
  margin-bottom: 28px;
  font: 800 0.68rem var(--mono);
  letter-spacing: 0.16em;
}

.scene-state.real { color: var(--green); }
.scene-state.planned { color: var(--amber); }
.scene-state.locked { color: var(--red); }

h3 {
  margin-bottom: 12px;
  color: var(--ink);
  font: 800 1rem/1.1 var(--mono);
  letter-spacing: -0.04em;
  text-transform: lowercase;
}

.scene p {
  margin-bottom: 0;
  font-size: 0.86rem;
}

.terminal-list {
  border-top: 1px solid var(--line);
  font: 0.82rem var(--mono);
}

.terminal-list div {
  display: grid;
  grid-template-columns: 1fr 0.58fr 0.58fr 1.5fr;
  gap: 1px;
  border-bottom: 1px solid var(--line);
}

.terminal-list span {
  padding: 13px 10px;
  min-width: 0;
}

.terminal-list span:first-child {
  color: var(--green);
}

.list-head {
  color: var(--dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.68rem;
}

.risk-lock {
  color: var(--red);
}

.safety-terminal {
  grid-template-columns: minmax(220px, 0.38fr) minmax(0, 1fr);
}

.safety-log,
.source-output {
  margin: 0;
  border-left: 1px solid var(--line-bright);
  padding-left: 22px;
  font: 0.95rem var(--mono);
}

.safety-log p,
.source-output p {
  margin: 0 0 14px;
}

.safety-log span {
  display: inline-block;
  min-width: 54px;
  margin-right: 14px;
  color: var(--green);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
}

.safety-log p:nth-last-child(-n + 3) span {
  color: var(--red);
}

.secondary-actions {
  grid-column: 2;
  margin-top: -42px;
  align-self: end;
}

.source-output {
  color: var(--green);
}

@media (max-width: 980px) {
  .terminal-hero,
  .session-grid,
  .terminal-section {
    grid-template-columns: 1fr;
  }

  .runtime-facts {
    max-width: 520px;
  }

  .scene-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scene:nth-child(2n) {
    border-right: 0;
  }

  .secondary-actions {
    grid-column: 1;
    margin-top: 0;
  }
}

@media (max-width: 660px) {
  .terminal-shell {
    width: 100%;
    padding: 0;
  }

  .terminal-artifact {
    min-height: 100vh;
    border-left: 0;
    border-right: 0;
  }

  .terminal-bar {
    position: relative;
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .terminal-nav {
    justify-content: flex-start;
    gap: 12px;
  }

  .boot-panel {
    padding: 22px 16px 0;
  }

  .terminal-hero,
  .session-grid,
  .terminal-section {
    padding-left: 16px;
    padding-right: 16px;
  }

  .terminal-hero {
    min-height: auto;
    padding-top: 80px;
  }

  h1 {
    font-size: clamp(2.45rem, 12.5vw, 3rem);
    letter-spacing: -0.09em;
  }

  .tagline {
    max-width: 27ch;
    font-size: 1.18rem;
    overflow-wrap: anywhere;
  }

  .safety-line {
    max-width: 31ch;
    overflow-wrap: anywhere;
  }

  .runtime-facts div,
  .terminal-list div {
    grid-template-columns: 1fr;
  }

  .scene-rail {
    grid-template-columns: 1fr;
  }

  .scene,
  .scene:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .terminal-window {
    min-height: 400px;
  }

  #terminal-output {
    min-height: 340px;
    padding: 42px 16px 22px;
    font-size: 0.72rem;
  }
}
