:root {
  --ink: #0b111c;
  --panel: #121a28;
  --panel-2: #0e1622;
  --line: #1f2b3f;
  --line-soft: #18222f;
  --text: #d9e2ef;
  --muted: #76879f;
  --accent: #4c8dff;
  --fast: #3fb6a8;
  --warm: #e8a13a;
  --hot: #e2574c;
  --display:
    "Bricolage Grotesque", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --body: "IBM Plex Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --gut: clamp(20px, 5vw, 64px);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
}
::selection {
  background: rgba(76, 141, 255, 0.28);
}

/* ---------- shared atoms ---------- */
.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 var(--gut);
}
.mono {
  font-family: var(--mono);
}
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 10px;
}
.eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}
.rule {
  height: 1px;
  background: var(--line-soft);
  border: 0;
  margin: 0;
}

/* ---------- header ---------- */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(11, 17, 28, 0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}
.masthead__in {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px var(--gut);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.brand span {
  color: var(--muted);
  font-weight: 400;
}
.probe {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.probe b {
  color: var(--fast);
  font-weight: 500;
}
.pulse {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--fast);
  box-shadow: 0 0 0 0 rgba(63, 182, 168, 0.6);
  animation: pulse 2.6s infinite;
}
@keyframes pulse {
  70% {
    box-shadow: 0 0 0 7px rgba(63, 182, 168, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(63, 182, 168, 0);
  }
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(48px, 9vw, 104px) 0 clamp(40px, 7vw, 80px);
}
.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.hero__title {
  font-family: var(--display);
  font-weight: 800;
  font-size: clamp(2.7rem, 6.4vw, 5.1rem);
  line-height: 0.93;
  letter-spacing: -0.045em;
  margin: 20px 0 0;
}
.hero__title em {
  font-style: normal;
  color: var(--accent);
}
.hero__lede {
  color: var(--muted);
  font-size: clamp(1rem, 1.35vw, 1.13rem);
  max-width: 38ch;
  margin: 22px 0 0;
}
.hero__meta {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 5px 9px;
}

/* ---------- console ---------- */
.console {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 24px 60px -30px rgba(0, 0, 0, 0.9);
}
.console__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.console__label {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}
.presets {
  display: flex;
  gap: 6px;
}
.preset {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px 8px;
  cursor: pointer;
  transition:
    color 0.15s,
    border-color 0.15s;
}
.preset:hover,
.preset:focus-visible {
  color: var(--text);
  border-color: var(--accent);
}
.editor {
  width: 100%;
  min-height: 184px;
  resize: vertical;
  display: block;
  background: transparent;
  border: 0;
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.75;
  padding: 16px 18px;
  tab-size: 2;
}
.editor:focus {
  outline: 0;
  box-shadow: inset 2px 0 0 var(--accent);
}
.console__run {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px 10px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.run {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  background: var(--accent);
  color: #05101f;
  border: 0;
  border-radius: 2px;
  padding: 8px 16px;
  cursor: pointer;
  letter-spacing: 0.02em;
}
.run:hover {
  filter: brightness(1.1);
}
.run[disabled] {
  opacity: 0.5;
  cursor: progress;
}
.timing {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
.timing b {
  font-weight: 500;
}
.result {
  margin: 0;
  padding: 16px 18px;
  max-height: 340px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  background: var(--panel-2);
  border-top: 1px solid var(--line);
  white-space: pre;
}
.result .k {
  color: var(--accent);
}
.result .s {
  color: var(--fast);
}
.result .n {
  color: var(--warm);
}
.result .e {
  color: var(--hot);
}
.result .p {
  color: var(--muted);
}
.ln {
  display: block;
  opacity: 0;
  transform: translateY(2px);
  animation: ln 0.18s forwards;
}
@keyframes ln {
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- generic section ---------- */
.sec {
  padding: clamp(56px, 8vw, 104px) 0;
}
.sec__head {
  max-width: 56ch;
}
.sec__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.2vw, 2.5rem);
  line-height: 1.06;
  letter-spacing: -0.03em;
  margin: 16px 0 0;
}
.sec__note {
  color: var(--muted);
  margin: 14px 0 0;
  font-size: 15px;
}

/* ---------- plan tree ---------- */
.plan {
  margin-top: 38px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--panel);
  overflow: hidden;
}
.plan__bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel-2);
}
.toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.toggle button {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
  background: transparent;
  border: 0;
  padding: 6px 13px;
  cursor: pointer;
}
.toggle button[aria-pressed="true"] {
  background: var(--accent);
  color: #05101f;
}
.plan__total {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--muted);
}
.plan__total b {
  font-weight: 600;
}
.plan__body {
  padding: 16px 14px;
}
.node {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 16px;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12.5px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.node:last-child {
  border-bottom: 0;
}
.node__label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.node__label i {
  color: var(--muted);
  font-style: normal;
  white-space: pre;
}
.node__label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.node__cost {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--muted);
  font-size: 11.5px;
}
.bar {
  width: clamp(60px, 14vw, 150px);
  height: 5px;
  border-radius: 3px;
  background: var(--line);
  overflow: hidden;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.t-fast {
  color: var(--fast);
}
.t-warm {
  color: var(--warm);
}
.t-hot {
  color: var(--hot);
}
.b-fast {
  background: var(--fast);
}
.b-warm {
  background: var(--warm);
}
.b-hot {
  background: var(--hot);
}
.diff {
  display: grid;
  gap: 14px;
  margin-top: 26px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}
.diff__item {
  border-left: 2px solid var(--line);
  padding: 2px 0 2px 14px;
}
.diff__item h4 {
  margin: 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.diff__item p {
  margin: 7px 0 0;
  font-size: 14.5px;
  color: var(--text);
}

/* ---------- systems: index + ledger ---------- */
.sys {
  margin-top: 44px;
  display: grid;
  grid-template-columns: minmax(210px, 264px) minmax(0, 1fr);
  gap: clamp(26px, 4vw, 64px);
  align-items: start;
}
.sys__index {
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
}
.sys__tab {
  position: relative;
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  padding: 15px 0 15px 18px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  align-items: baseline;
  border-bottom: 1px solid var(--line-soft);
}
.sys__tab:last-child {
  border-bottom: 0;
}
.sys__tab::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  bottom: -1px;
  width: 2px;
  background: transparent;
  transition: background 0.2s;
}
.sys__tab[aria-selected="true"]::before {
  background: var(--accent);
}
.sys__num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  transition: color 0.2s;
}
.sys__tab[aria-selected="true"] .sys__num {
  color: var(--accent);
}
.sys__nm {
  display: block;
  font-family: var(--mono);
  font-size: 13.5px;
  color: var(--muted);
  transition: color 0.2s;
}
.sys__tab:hover .sys__nm,
.sys__tab[aria-selected="true"] .sys__nm {
  color: var(--text);
}
.sys__dm {
  display: block;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--muted);
  opacity: 0.7;
  margin-top: 4px;
}

.sys__pane {
  min-width: 0;
}
.sys__pane[data-anim="in"] {
  animation: paneIn 0.3s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes paneIn {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.sys__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 26px;
}
.sys__constraint {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.12rem, 1.9vw, 1.5rem);
  line-height: 1.38;
  letter-spacing: -0.018em;
  margin: 0 0 34px;
  max-width: 44ch;
}
.ledger {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
}
.ledger__side {
  padding-right: clamp(18px, 2.2vw, 34px);
}
.ledger__side + .ledger__side {
  border-left: 1px solid var(--line);
  padding: 0 0 0 clamp(18px, 2.2vw, 34px);
}
.ledger__k {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 13px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.ledger__k::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line-soft);
}
.ledger__k.is-gain {
  color: var(--fast);
}
.ledger__k.is-cost {
  color: var(--warm);
}
.ledger__side p {
  margin: 0;
  font-size: 15px;
  line-height: 1.68;
  color: #b9c6d6;
}

/* ---------- contact form ---------- */
.form__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 1px;
  background: var(--line);
}
.field {
  background: var(--panel);
  padding: 14px 18px 16px;
  min-width: 0;
}
.field--full {
  grid-column: 1 / -1;
}
.field label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 7px;
}
.field label span {
  color: var(--muted);
  opacity: 0.6;
  text-transform: none;
  letter-spacing: 0;
}
.field input,
.field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--text);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.55;
  resize: vertical;
}
.field input::placeholder,
.field textarea::placeholder {
  color: var(--muted);
  opacity: 0.45;
}
.field input:focus,
.field textarea:focus {
  outline: 0;
}
.field:focus-within {
  background: var(--panel-2);
}
.field:focus-within label {
  color: var(--accent);
}
.field[data-invalid="true"] label {
  color: var(--hot);
}
.field textarea {
  min-height: 112px;
}
.field__err {
  display: none;
  margin: 7px 0 0;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--hot);
}
.field[data-invalid="true"] .field__err {
  display: block;
}
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.form__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: var(--panel-2);
}
.form__hint {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
}
/* ---------- footer ---------- */
.foot {
  border-top: 1px solid var(--line-soft);
  padding: clamp(48px, 7vw, 80px) 0 60px;
}
.foot__grid {
  display: grid;
  gap: 32px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  align-items: start;
}
.curl {
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--panel);
  padding: 13px 15px;
  font-family: var(--mono);
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.curl code {
  color: var(--fast);
}
.copy {
  font-family: var(--mono);
  font-size: 11px;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 4px 9px;
  cursor: pointer;
}
.copy:hover {
  color: var(--text);
  border-color: var(--accent);
}
.foot__note {
  color: var(--muted);
  font-size: 13.5px;
  margin: 12px 0 0;
}
.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  margin-top: 6px;
}
.foot__links a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.foot__links a:hover {
  color: var(--accent);
  border-color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

@media (max-width: 880px) {
  .hero__grid {
    grid-template-columns: 1fr;
    gap: 34px;
  }
  .sys {
    grid-template-columns: 1fr;
    gap: 30px;
  }
  .sys__index {
    flex-direction: row;
    overflow-x: auto;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    scrollbar-width: none;
  }
  .sys__index::-webkit-scrollbar {
    display: none;
  }
  .sys__tab {
    display: block;
    padding: 0 18px 13px 0;
    border-bottom: 0;
    flex: none;
  }
  .sys__tab::before {
    left: 0;
    right: auto;
    top: auto;
    bottom: -1px;
    width: 100%;
    height: 2px;
  }
  .sys__dm {
    display: none;
  }
  .ledger {
    grid-template-columns: 1fr;
    gap: 26px;
  }
  .ledger__side {
    padding-right: 0;
  }
  .ledger__side + .ledger__side {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 26px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
  .ln {
    opacity: 1;
    transform: none;
  }
}
