/* rmps — site styles
 *
 * Palette is taken from the encoder's own diagnostic plots: pale plotter
 * paper, ink for structure, magenta for bits actually spent, teal for the
 * masking threshold those bits are chasing. Nothing here is decorative that
 * isn't also a label somewhere in the codec.
 */

:root {
  --paper:  #e9ebe4;
  --paper2: #f2f3ee;
  --ink:    #12151a;
  --dim:    #5c6169;
  --rule:   #c3c7bc;
  --signal: #c4265e;   /* bits spent */
  --mask:   #1e6f6a;   /* masking threshold */

  --display: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  --body:    'IBM Plex Sans', system-ui, sans-serif;
  --mono:    'IBM Plex Mono', ui-monospace, monospace;

  --pad: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration-color: var(--rule); text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--signal); }
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }

.wrap { max-width: 1080px; margin: 0 auto; padding-inline: var(--pad); }

/* ---------- masthead ---------- */
.mast {
  display: flex; align-items: center; gap: 1.5rem;
  padding-block: 1.1rem;
  border-bottom: 1px solid var(--rule);
}
.mark {
  font-family: var(--mono); font-weight: 600; font-size: 1rem;
  letter-spacing: .18em; text-transform: uppercase; text-decoration: none;
}
.mark::before {
  content: ''; display: inline-block; width: .5rem; height: .5rem;
  background: var(--signal); margin-right: .55rem; vertical-align: .05em;
}
.mast nav { margin-left: auto; display: flex; gap: 1.25rem; align-items: center;
  font-size: .82rem; font-family: var(--mono); letter-spacing: .04em; }
.lang { display: flex; border: 1px solid var(--rule); }
.lang a { padding: .15rem .5rem; text-decoration: none; color: var(--dim); }
.lang a[aria-current] { background: var(--ink); color: var(--paper); }

/* ---------- hero ---------- */
.hero { padding-block: clamp(3rem, 8vw, 6rem) 0; }
.eyebrow {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--mask); margin: 0 0 1.25rem;
}
h1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 8vw, 5.4rem);
  font-weight: 700; line-height: .96; letter-spacing: -.03em;
  margin: 0 0 1.25rem; max-width: 16ch;
}
h1 em { font-style: normal; color: var(--signal); }
.lede { font-size: clamp(1.05rem, 2.2vw, 1.3rem); max-width: 54ch; margin: 0 0 2rem; color: #22262d; }

.cta { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.btn {
  display: inline-block; padding: .7rem 1.5rem; text-decoration: none;
  font-family: var(--mono); font-size: .85rem; letter-spacing: .05em;
  border: 1px solid var(--ink); background: var(--ink); color: var(--paper);
  transition: transform .12s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--signal); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { box-shadow: 3px 3px 0 var(--mask); }

/* ---------- signature: the frame ladder ---------- */
.ladder { margin: clamp(2.5rem, 6vw, 4rem) 0 0; }  /* figure's UA 40px inset would
                                                       break alignment with the text column */
.ladder canvas { display: block; width: 100%; height: 190px; }
.ladder-key {
  display: flex; flex-wrap: wrap; gap: 1.5rem; margin-top: .7rem;
  font-family: var(--mono); font-size: .72rem; color: var(--dim);
  letter-spacing: .04em; border-top: 1px solid var(--rule); padding-top: .6rem;
}
.ladder-key i { display: inline-block; width: .7rem; height: .7rem; margin-right: .4rem; }
.k-bits { background: var(--signal); }
.k-mask { background: var(--mask); }
.k-res  { background: var(--rule); }

/* ---------- sections ---------- */
section { padding-block: clamp(3.5rem, 8vw, 6rem); }
section + section { border-top: 1px solid var(--rule); }
h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.4rem); letter-spacing: -.02em;
  line-height: 1.1; margin: 0 0 .6rem;
}
.sec-note { color: var(--dim); max-width: 58ch; margin: 0 0 2.5rem; }

.grid { display: grid; gap: 1px; background: var(--rule);
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); border: 1px solid var(--rule); }
.cell { background: var(--paper2); padding: 1.5rem; }
.cell h3 { font-family: var(--body); font-size: 1rem; font-weight: 600; margin: 0 0 .5rem; }
.cell p { margin: 0; font-size: .92rem; color: #2c3038; }
.cell .tag {
  display: block; font-family: var(--mono); font-size: .7rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mask); margin-bottom: .9rem;
}

/* pipeline — genuinely ordered, so it's numbered */
.pipe { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.pipe li {
  display: grid; grid-template-columns: 3.5rem 1fr; gap: 1.25rem;
  padding: 1.15rem 0; border-top: 1px solid var(--rule); align-items: baseline;
}
.pipe li:last-child { border-bottom: 1px solid var(--rule); }
.pipe li::before {
  counter-increment: step; content: counter(step, decimal-leading-zero);
  font-family: var(--mono); font-size: .8rem; color: var(--signal); letter-spacing: .08em;
}
.pipe b { font-weight: 600; display: block; }
.pipe span { color: var(--dim); font-size: .92rem; }

pre {
  background: var(--ink); color: #dfe3dc; padding: 1.4rem; overflow-x: auto;
  font-family: var(--mono); font-size: .84rem; line-height: 1.7; margin: 0;
}
pre .c { color: #7f8a86; }
pre .s { color: #f0949f; }
pre .k { color: #8fd0c6; }

.cols { display: grid; gap: 2.5rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols h3 { font-family: var(--mono); font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--mask); margin: 0 0 .9rem; }

dl.spec { margin: 0; font-size: .92rem; }
dl.spec div { display: flex; justify-content: space-between; gap: 1rem;
  padding: .55rem 0; border-bottom: 1px solid var(--rule); }
dl.spec dt { color: var(--dim); margin: 0; }
dl.spec dd { margin: 0; font-family: var(--mono); font-size: .84rem; text-align: right; }

.warn { border-left: 3px solid var(--signal); padding: .2rem 0 .2rem 1.15rem; margin: 1.5rem 0 0;
  font-size: .92rem; color: #2c3038; }

footer { border-top: 1px solid var(--rule); padding-block: 2.5rem 3.5rem;
  font-family: var(--mono); font-size: .78rem; color: var(--dim);
  display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; }
footer a { color: var(--dim); }
footer .sp { margin-left: auto; }

@media (max-width: 640px) {
  .mast { flex-wrap: wrap; gap: .75rem 1rem; }
  .mast nav { width: 100%; margin-left: 0; justify-content: space-between; }
  .pipe li { grid-template-columns: 2.5rem 1fr; gap: .75rem; }
}
