/* ============================================================================
   shapeshift — the tape
   ----------------------------------------------------------------------------
   One stylesheet, no framework, no build step, no runtime network request.

   The world comes from what the product does: ragged, nested, untyped JSON on
   one side; flat, aligned, typed columns on the other. So the page has two
   working colours rather than one accent — AMBER is always the JSON side, CYAN
   is always the columnar side — and the display face is the monospace, because
   a tool whose whole identity is alignment should be set in something that
   aligns.
   ============================================================================ */

@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("fonts/archivo-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ── Tokens ────────────────────────────────────────────────────────────────
   Dark-first, because this is an instrument. The complete DARK palette sits on
   bare :root, the light overrides live in a `prefers-color-scheme: light`
   block guarded against an explicit dark choice, and `[data-theme]` wins in
   both directions. No component declares a colour outside these three blocks. */

:root {
  --void: #0d1114;
  --panel: #141a1e;
  --panel-2: #1b2328;
  --rule: #262f35;
  --rule-lit: #37444c;
  --text: #e7eaeb;
  --text-2: #9aa8ae;
  --text-3: #808e95;   /* 4.73:1 on --panel-2, the tightest pairing */

  /* The two sides of the transformation. Never decorative, never swapped. */
  --in: #e2a25c;   /* JSON — ragged, nested, untyped */
  --in-wash: #2a2119;
  --out: #5cb9cb;  /* columnar — flat, aligned, typed */
  --out-wash: #14262b;
  --bad: #d97a72;  /* the rejected line, which is never hidden */

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --sans: "Archivo", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;

  --t-xs: 0.6875rem;
  --t-sm: 0.8125rem;
  --t-md: 1rem;
  --t-lg: 1.1875rem;
  --t-xl: 1.5rem;
  --t-h2: clamp(1.5rem, 0.9rem + 2.4vw, 2.4rem);
  --t-hero: clamp(1.9rem, 0.7rem + 4.6vw, 4rem);

  --gutter: clamp(1.15rem, 4vw, 2.75rem);
  --max: 1200px;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --void: #fbfaf7;
    --panel: #f3f2ed;
    --panel-2: #e9e8e1;
    --rule: #dbd9d0;
    --rule-lit: #bcb9ad;
    --text: #14181a;
    --text-2: #4d5559;
    --text-3: #5d6569; /* 4.77:1 on --panel-2, the tightest pairing */

    /* Both hues have to be pulled well down to clear 4.5:1 on paper; the light
       theme is a re-tuning of the same two roles, not an inversion. */
    --in: #8a5410;
    --in-wash: #f3e7d5;
    --out: #14606e;
    --out-wash: #dceaed;
    --bad: #a33a31;
  }
}

:root[data-theme="light"] {
  --void: #fbfaf7;
  --panel: #f3f2ed;
  --panel-2: #e9e8e1;
  --rule: #dbd9d0;
  --rule-lit: #bcb9ad;
  --text: #14181a;
  --text-2: #4d5559;
  --text-3: #5d6569;
  --in: #8a5410;
  --in-wash: #f3e7d5;
  --out: #14606e;
  --out-wash: #dceaed;
  --bad: #a33a31;
}

/* ── Base ──────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

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

body {
  margin: 0;
  background: var(--void);
  color: var(--text);
  font-family: var(--sans);
  font-size: var(--t-md);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
table {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

a {
  color: var(--out);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--text);
}

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

code {
  font-family: var(--mono);
  font-size: 0.92em;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

.skip {
  position: absolute;
  left: -9999px;
  background: var(--text);
  color: var(--void);
  padding: 0.7rem 1.1rem;
  z-index: 100;
  font-family: var(--mono);
  font-size: var(--t-xs);
}

.skip:focus {
  left: 0;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ── Masthead ──────────────────────────────────────────────────────────── */

.top {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--void) 90%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
}

@supports not (backdrop-filter: blur(1px)) {
  .top {
    background: var(--void);
  }
}

.top__in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.4rem;
}

.logo {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.logo:hover {
  color: var(--text);
}

/* The mark is the transformation itself: ragged bars resolving into even ones. */
.logo svg {
  width: 1.35rem;
  height: 1.35rem;
  flex: none;
}

.nav {
  display: flex;
  align-items: center;
  gap: clamp(0.8rem, 2.2vw, 1.7rem);
  font-family: var(--mono);
  font-size: var(--t-xs);
  letter-spacing: 0.04em;
}

.nav a {
  color: var(--text-2);
  text-decoration: none;
  white-space: nowrap;
  padding-block: 0.4rem;
  border-bottom: 1px solid transparent;
}

.nav a:hover {
  color: var(--text);
  border-bottom-color: var(--out);
}

.nav__cta {
  color: var(--out) !important;
  font-weight: 700;
}

@media (max-width: 44rem) {
  .nav__opt {
    display: none;
  }
}

/* ── Sections ──────────────────────────────────────────────────────────── */

.band {
  border-top: 1px solid var(--rule);
}

.band--fill {
  background: var(--panel);
}

.band__in {
  padding-block: clamp(2.75rem, 6.5vw, 5rem);
}

.eyebrow {
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--out);
}

.eyebrow--in {
  color: var(--in);
}

h2 {
  font-family: var(--mono);
  font-size: var(--t-h2);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 24ch;
  margin-top: 0.9rem;
}

h3 {
  font-family: var(--mono);
  font-size: var(--t-lg);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.lead {
  margin-top: 1.1rem;
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 62ch;
}

.prose {
  margin-top: 1.2rem;
  max-width: 66ch;
  color: var(--text-2);
}

.prose p + p {
  margin-top: 0.9em;
}

.prose b,
.prose strong {
  color: var(--text);
  font-weight: 600;
}

/* ── Hero ──────────────────────────────────────────────────────────────── */

.hero {
  padding-block: clamp(2.5rem, 6vw, 4.5rem) clamp(1.5rem, 3vw, 2.5rem);
}

h1 {
  margin-top: 1.2rem;
  font-family: var(--mono);
  font-size: var(--t-hero);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.045em;
  max-width: 20ch;
  text-wrap: balance;
}

h1 .amber {
  color: var(--in);
}

h1 .cyan {
  color: var(--out);
}

.hero__lead {
  margin-top: 1.5rem;
  font-size: var(--t-lg);
  line-height: 1.55;
  color: var(--text-2);
  max-width: 58ch;
}

.acts {
  margin-top: 2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem 0.9rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-family: var(--mono);
  font-size: var(--t-sm);
  font-weight: 700;
  text-decoration: none;
  padding: 0.7rem 1.15rem;
  border: 1px solid var(--out);
  transition: background-color 0.14s ease, color 0.14s ease;
}

.btn--solid {
  background: var(--out);
  color: var(--void);
}

.btn--solid:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--void);
}

.btn--ghost {
  color: var(--out);
  background: transparent;
}

.btn--ghost:hover {
  background: var(--out-wash);
  color: var(--out);
}

/* ── The transformation panel: the hero's argument, shown ──────────────── */

.xform {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  border: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--mono);
  font-size: var(--t-xs);
  line-height: 1.65;
}

@media (max-width: 52rem) {
  .xform {
    grid-template-columns: minmax(0, 1fr);
  }
}

.side {
  padding: 1rem 1.1rem 1.15rem;
  min-width: 0;
  overflow-x: auto;
}

.side__k {
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: var(--t-xs);
  padding-bottom: 0.7rem;
}

.side--in .side__k {
  color: var(--in);
}

.side--out .side__k {
  color: var(--out);
}

.side pre {
  margin: 0;
  white-space: pre;
  color: var(--text-2);
}

.side--in .j {
  color: var(--in);
}

.side--out .t {
  color: var(--out);
}

.side .bad {
  color: var(--bad);
}

/* The arrow column. On a narrow screen the flow is vertical, so it rotates. */
.arrow {
  display: grid;
  place-items: center;
  padding-inline: 0.9rem;
  border-inline: 1px solid var(--rule);
  color: var(--text-3);
  font-weight: 700;
  font-size: 1rem;
}

@media (max-width: 52rem) {
  .arrow {
    border-inline: 0;
    border-block: 1px solid var(--rule);
    padding-block: 0.5rem;
  }
}

/* ── Terminal ──────────────────────────────────────────────────────────── */

.term {
  border: 1px solid var(--rule);
  background: var(--panel);
  font-family: var(--mono);
  font-size: var(--t-sm);
  line-height: 1.7;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  white-space: pre;
  color: var(--text);
  tab-size: 2;
}

.band--fill .term {
  background: var(--void);
}

.term .c {
  color: var(--text-3);
}

.term .p {
  color: var(--out);
  font-weight: 700;
  user-select: none;
}

.term .k {
  color: var(--in);
}

.term .bad {
  color: var(--bad);
}

/* ── Steps ─────────────────────────────────────────────────────────────── */

.steps {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 3vw, 2.25rem);
  margin-top: 2rem;
}

.step {
  display: grid;
  grid-template-columns: 2.5rem minmax(0, 1fr);
  gap: 0.5rem clamp(0.8rem, 2vw, 1.4rem);
  align-items: start;
}

@media (max-width: 40rem) {
  .step {
    grid-template-columns: minmax(0, 1fr);
  }
}

.step__n {
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  color: var(--out);
  padding-top: 0.35rem;
  font-variant-numeric: tabular-nums;
}

.step__b > * + * {
  margin-top: 0.8rem;
}

.step__t {
  font-family: var(--mono);
  font-weight: 700;
  font-size: var(--t-md);
  color: var(--text);
  letter-spacing: -0.01em;
}

.step__d {
  font-size: var(--t-sm);
  color: var(--text-2);
  max-width: 62ch;
  line-height: 1.55;
}

/* ── Measured figures ──────────────────────────────────────────────────── */

.figs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 2rem;
}

.fig {
  background: var(--void);
  padding: 1.1rem 1.15rem 1.25rem;
}

.band--fill .fig {
  background: var(--panel);
}

.fig__n {
  font-family: var(--mono);
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
  color: var(--out);
  font-variant-numeric: tabular-nums;
}

.fig__n small {
  font-size: 0.55em;
  color: var(--text-2);
  letter-spacing: 0;
}

.fig__t {
  margin-top: 0.5rem;
  font-size: var(--t-sm);
  color: var(--text-2);
  line-height: 1.45;
}

/* ── Tables ────────────────────────────────────────────────────────────── */

.tw {
  overflow-x: auto;
  border: 1px solid var(--rule);
  margin-top: 1.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--mono);
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

thead th {
  text-align: left;
  font-weight: 700;
  font-size: var(--t-xs);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--rule-lit);
  background: var(--panel);
}

.band--fill thead th {
  background: var(--panel-2);
}

tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--rule);
  color: var(--text-2);
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody td:first-child {
  color: var(--text);
}

td.num {
  text-align: right;
}

td.win {
  color: var(--out);
  font-weight: 700;
}

td.lose {
  color: var(--in);
  font-weight: 700;
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-top: 2rem;
}

.card {
  background: var(--void);
  padding: clamp(1.1rem, 2.4vw, 1.6rem);
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  min-width: 0;
}

.band--fill .card {
  background: var(--panel);
}

.card__k {
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--out);
}

.card__k--in {
  color: var(--in);
}

.card p {
  font-size: var(--t-sm);
  color: var(--text-2);
  line-height: 1.55;
}

.card ul {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: var(--t-sm);
  color: var(--text-2);
}

.card li {
  position: relative;
  padding-left: 0.95rem;
  line-height: 1.45;
}

.card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.62em;
  width: 0.4rem;
  height: 1px;
  background: var(--out);
}

/* A note the page would be dishonest without. */
.caveat {
  margin-top: 1.5rem;
  border-left: 2px solid var(--in);
  background: var(--in-wash);
  padding: 0.9rem 1.1rem;
  font-size: var(--t-sm);
  color: var(--text-2);
  line-height: 1.55;
  max-width: 68ch;
}

.caveat b {
  color: var(--in);
  font-family: var(--mono);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.35rem;
}

.note {
  margin-top: 1rem;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--text-3);
  line-height: 1.6;
  max-width: 74ch;
}

/* ── Footer ────────────────────────────────────────────────────────────── */

.foot {
  border-top: 1px solid var(--rule-lit);
  background: var(--panel);
}

.foot__in {
  padding-block: 2rem 2.5rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 2rem;
  justify-content: space-between;
  font-family: var(--mono);
  font-size: var(--t-xs);
  color: var(--text-3);
  line-height: 1.7;
}

.foot a {
  color: var(--text-2);
  text-decoration: none;
}

.foot a:hover {
  color: var(--out);
}

.foot__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1.1rem;
}
