/* ============================================================
   cmd+cmd — technical spec-sheet system
   Self-hosted IBM Plex Mono · strict spacing/type scale ·
   hairline registration grid · single "live" accent
   ============================================================ */

/* ---- fonts (self-hosted, latin subset) ---- */
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/IBMPlexMono-400.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/IBMPlexMono-500.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("./assets/fonts/IBMPlexMono-600.woff2") format("woff2");
}
@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/IBMPlexMono-700.woff2") format("woff2");
}

/* ---- design tokens ---- */
:root {
  /* ink + surfaces */
  --ink: #f7f7f2;
  --ink-2: #d8d8d2;
  --muted: #a0a09a;
  --faint: #3a3a36;
  --line: #242421;
  --line-strong: #f7f7f2;
  --bg: #050505;
  --hl: #171714;

  /* single signal accent — reserved for live / active states only */
  --accent: #14a06b;

  /* spacing scale (4px subgrid) */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;
  --s-7: 48px;
  --s-8: 64px;

  /* type scale */
  --t-micro: 10px;
  --t-label: 10.5px;
  --t-small: 11.5px;
  --t-body: 13px;
  --t-base: 14px;
  --t-md: 15px;
  --t-hero: clamp(30px, 5.6vw, 68px);

  --track-wide: 0.16em;
  --track-mid: 0.12em;

  --frame: 1280px;
  --pad: clamp(20px, 5vw, 64px);
  --dur: 0.15s;
}

/* ---- reset / base ---- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  font-size: var(--t-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* technical numerals everywhere they matter */
.eyebrow, .idx, .cap-lbl, .step .n, .kv, .code pre,
.status, .foot-note {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "zero" 1;
}

::selection { background: var(--ink); color: var(--bg); }
a { color: inherit; text-decoration: none; }

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

/* ---- frame ---- */
.wrap {
  max-width: var(--frame);
  margin: 0 auto;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  min-height: 100vh;
}

/* ---- shared label types ---- */
.eyebrow {
  font-size: var(--t-label);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.idx {
  font-size: var(--t-label);
  letter-spacing: var(--track-mid);
  color: var(--ink);
  font-weight: 600;
}
.cap-lbl {
  display: block;
  margin: var(--s-5) 0 var(--s-2);
  font-size: var(--t-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* ---- registration plus-marks ---- */
.tick {
  position: absolute;
  width: 9px;
  height: 9px;
  pointer-events: none;
  background:
    linear-gradient(var(--faint), var(--faint)) center / 9px 1px no-repeat,
    linear-gradient(var(--faint), var(--faint)) center / 1px 9px no-repeat;
}
.tick.tl { left: calc(var(--pad) - 4.5px); top: 19.5px; }
.tick.tr { right: calc(var(--pad) - 4.5px); top: 19.5px; }
.tick.bl { left: calc(var(--pad) - 4.5px); bottom: 19.5px; }
.tick.br { right: calc(var(--pad) - 4.5px); bottom: 19.5px; }

/* ---- live square indicator ---- */
.dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- header ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  padding: var(--s-4) var(--pad);
}
.brand { display: flex; align-items: center; }
.brand img {
  height: 17px;
  width: auto;
  display: block;
  filter: invert(1);
}
.status {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  font-size: var(--t-micro);
  letter-spacing: var(--track-wide);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}

/* ---- hero ---- */
.hero {
  position: relative;
  padding: clamp(28px, 7vw, 80px) var(--pad) clamp(40px, 8vw, 80px);
  border-bottom: 1px solid var(--line);
}
.hero h1 {
  font-weight: 600;
  font-size: var(--t-hero);
  line-height: 1.05;
  letter-spacing: 0;
  max-width: 18ch;
}

.cta-row {
  margin-top: var(--s-7);
  display: flex;
  flex-wrap: wrap;
  border: 1px solid var(--line-strong);
  width: fit-content;
  max-width: 100%;
}
.cta {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  padding: 15px 22px;
  font-weight: 600;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--ink);
  color: var(--bg);
  transition: background var(--dur) ease, color var(--dur) ease;
}
.cta:hover { background: var(--hl); color: var(--ink); }
.cta .arr { font-weight: 400; transition: transform var(--dur) ease; }
.cta:hover .arr { transform: translateX(4px); }

/* ---- section blocks ---- */
section.block {
  display: grid;
  grid-template-columns: minmax(220px, 0.36fr) 1fr;
  border-bottom: 1px solid var(--line);
}
section.block > .col-l {
  position: relative;
  padding: clamp(28px, 5vw, 48px) var(--pad);
  border-right: 1px solid var(--line);
}
/* marching registration marks down the central spine */
.col-l::before,
.col-l::after {
  content: "";
  position: absolute;
  right: -4.5px;
  width: 9px;
  height: 9px;
  background:
    linear-gradient(var(--faint), var(--faint)) center / 9px 1px no-repeat,
    linear-gradient(var(--faint), var(--faint)) center / 1px 9px no-repeat;
}
.col-l::before { top: -4.5px; }
.col-l::after { bottom: -4.5px; }
.col-l-sticky { position: sticky; top: var(--s-5); }
.col-l .idx { display: block; margin-bottom: var(--s-3); }
.col-l h2 {
  font-size: var(--t-md);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.3;
}
.col-l .note {
  margin-top: var(--s-4);
  font-size: var(--t-small);
  color: var(--muted);
  line-height: 1.6;
  max-width: 24ch;
}
section.block > .col-r {
  padding: clamp(28px, 5vw, 48px) var(--pad);
  min-width: 0;
}
@media (max-width: 720px) {
  section.block { grid-template-columns: 1fr; }
  section.block > .col-l {
    border-right: none;
    border-bottom: 1px solid var(--line);
    padding-bottom: 20px;
  }
  .col-l::before, .col-l::after { display: none; }
  .col-l-sticky { position: static; }
  .col-l .note { max-width: none; }
}

/* ---- steps with connecting spine ---- */
.steps { position: relative; list-style: none; }
.steps::before {
  content: "";
  position: absolute;
  left: 11.5px;
  top: 4px;
  bottom: 4px;
  width: 1px;
  background: var(--line);
}
.step {
  position: relative;
  display: flex;
  gap: var(--s-5);
  padding: var(--s-5) 0;
}
.step:first-child { padding-top: 0; }
.step:last-child { padding-bottom: 0; }
.step .n {
  position: relative;
  z-index: 1;
  flex: 0 0 24px;
  width: 24px;
  text-align: center;
  padding: 2px 0;
  background: var(--bg);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  transition: color var(--dur) ease;
}
.step:hover .n { color: var(--ink); }
.step .body { flex: 1 1 auto; min-width: 0; }
.step .body p { font-size: var(--t-body); line-height: 1.6; max-width: 66ch; }
.step .body p b { font-weight: 600; }
.hl {
  background: var(--hl);
  padding: 1px 5px;
  font-weight: 500;
  white-space: nowrap;
}
.aside {
  margin-top: var(--s-3);
  font-size: var(--t-small);
  color: var(--muted);
  line-height: 1.6;
}

/* ---- code blocks (dark) ---- */
.code {
  margin-top: var(--s-3);
  position: relative;
  border: 1px solid var(--line);
  background: #11110f;
  color: #f4f4f4;
}
.cap-lbl + .code { margin-top: 0; }
.code pre {
  margin: 0;
  padding: var(--s-3) var(--s-4);
  overflow-x: auto;
  font-size: 12.5px;
  line-height: 1.85;
  font-family: inherit;
}
.code pre .c { color: #85857e; }
.code pre .p { color: #a4a49c; }
.code ::selection { background: var(--ink); color: var(--bg); }
.cursor {
  display: inline-block;
  width: 8px;
  height: 1.05em;
  margin-left: 6px;
  vertical-align: -2px;
  background: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.copy {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  padding: 0 14px;
  border: none;
  border-left: 1px solid var(--line);
  background: transparent;
  font-family: inherit;
  font-size: 9.5px;
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: background var(--dur) ease, color var(--dur) ease;
}
.copy:hover { background: var(--ink); color: var(--bg); }
.copy.done { color: var(--ink); }

/* ---- inspect-script disclosure ---- */
.disclosure { margin-top: var(--s-4); }
.disclosure > summary {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  list-style: none;
  cursor: pointer;
  font-size: var(--t-micro);
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  font-weight: 500;
  color: var(--muted);
  user-select: none;
  transition: color var(--dur) ease;
}
.disclosure > summary::-webkit-details-marker { display: none; }
.disclosure > summary::before {
  content: "[ + ]";
  font-weight: 600;
  color: var(--ink);
}
.disclosure[open] > summary::before { content: "[ \2013 ]"; }
.disclosure > summary:hover { color: var(--ink); }
.disclosure .code { margin-top: var(--s-3); }
.code-scroll pre { max-height: 380px; overflow: auto; }

/* ---- key-value rows ---- */
.kv { border-top: 1px solid var(--line); }
.kv .row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: var(--s-3);
  padding: var(--s-4) 0;
  border-bottom: 1px solid var(--line);
  align-items: baseline;
}
.kv .row .k {
  font-size: var(--t-label);
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.kv .row .v { font-size: 12.5px; word-break: break-all; }
.kv .row .v .mono { display: inline; }
.kv .row .v .small {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  word-break: normal;
}
@media (max-width: 460px) {
  .kv .row { grid-template-columns: 1fr; gap: var(--s-1); }
}

/* ---- footer ---- */
footer {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: var(--s-4);
  padding: clamp(28px, 5vw, 44px) var(--pad);
}
.foot-note {
  font-size: var(--t-micro);
  letter-spacing: var(--track-mid);
  text-transform: uppercase;
  color: var(--faint);
}
footer .links { display: flex; gap: var(--s-5); }
footer .links a {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  transition: color var(--dur) ease;
}
footer .links a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---- entrance motion ---- */
.js .reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.js .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .dot, .cursor, .cta:hover .arr { animation: none; transform: none; }
}
