/* The RL360 write-up. Layout: a reading column with a live contents rail on its left, and margin notes and
   figures that bleed to its right. One bold thing, the hero mosaic of real attempts; everything else stays quiet.
   Roles follow the architecture diagram: teal is inference, orange is training, raspberry is failure. */
@font-face { font-family: "Host Grotesk"; font-style: normal; font-weight: 300 800; font-display: swap; src: url(fonts/host-grotesk.woff2) format("woff2"); }
@font-face { font-family: "Host Grotesk"; font-style: italic; font-weight: 300 800; font-display: swap; src: url(fonts/host-grotesk-italic.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(fonts/plex-mono-400.woff2) format("woff2"); }

:root {
  --bg: #f5f7f4; --text: #141c1b; --muted: #4c5956; --faint: #64716d; --rule: #d9dfda; --panel: #ebefeb;
  --link: #0b5a70; --link-hover: #c33a00;
  --teal: #00708f; --orange: #f44900; --fail: #d93a8c; --green: #2f8f47;
  /* Orange as text needs a darker step on the light page; labels on an orange fill use dark ink in both themes. */
  --orange-ink: #c23a00; --on-orange: #1d0a00;
  --tint-pass: #bfd4d6; --tint-fail: #9daaa6; --tint-few: #eab6d2;
  --fig-bg: #ebefeb;
  --code-bg: #131c1d; --code-fg: #dce5e2; --code-dim: #83938f; --code-key: #ff9a6b; --code-str: #84cfe3; --code-bar: #1c2829;
  --contour: 0, 90, 115; --contour-alpha: .075;
  --sans: "Host Grotesk", "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --rail: 196px; --read: 680px; --gutter: 44px; --margin: 248px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1516; --text: #e6ece9; --muted: #aab6b3; --faint: #8b9895; --rule: #263033; --panel: #172021;
    --link: #84cfe3; --link-hover: #ffa070;
    --teal: #5cb8d1; --orange: #ff6a2b; --fail: #f562a8; --green: #57b870; --orange-ink: #ff6a2b;
    --tint-pass: #2c4a53; --tint-fail: #4b5855; --tint-few: #6d3556;
    --fig-bg: #172021;
    --code-bg: #172122; --code-bar: #1f2b2d;
    --contour: 132, 207, 227; --contour-alpha: .06;
  }
}

/* The site's contours stay behind the title and fade out before the text starts. */
canvas.topo { position: absolute; -webkit-mask-image: linear-gradient(#000 0, #000 120px, transparent 420px); mask-image: linear-gradient(#000 0, #000 120px, transparent 420px); }

.post { display: block; font-family: var(--sans); padding-block: 26px 56px; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); overflow-x: clip; }
.post a { color: var(--link); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); }
.post a:hover, .post a:focus-visible { color: var(--link-hover); text-decoration-color: currentColor; }

/* Head */
.post-head { max-width: 1320px; margin: 0 auto; }
.post .back { margin: 0 0 clamp(36px, 7vw, 84px); font-size: 15px; }
.post .back a { text-decoration: none; color: var(--muted); }
.post-head .kicker { margin: 0 0 10px; font: 400 12.5px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--orange-ink); }
.post-head .page-title { margin: 0 0 16px; font: 300 clamp(42px, 6.5vw, 92px)/1.02 var(--sans); letter-spacing: -.028em; text-wrap: balance; }
.post-head .byline { margin: 0 0 clamp(24px, 3.5vw, 40px); color: var(--muted); font-size: 15.5px; }

/* Hero mosaic */
.hero { max-width: 1320px; margin: 0 auto clamp(48px, 7vw, 88px); }
.hero-plot { position: relative; }
.hero canvas { display: block; width: 100%; cursor: crosshair; touch-action: pan-y; border-radius: 4px; }
.hero canvas:focus-visible { outline: 2px solid var(--link); outline-offset: 4px; }
.hero-hi { position: absolute; top: -5px; bottom: -5px; border: 1px solid var(--text); border-radius: 3px; pointer-events: none; }
.hero-axis { position: relative; display: flex; justify-content: space-between; margin-top: 8px; font: 400 12px/1.4 var(--mono); color: var(--faint); }
.hero-axis .mark70 { position: absolute; left: calc(70.5 / 99 * 100%); transform: translateX(-50%); color: var(--text); }
.hero .readout { margin: 14px 0 0; min-height: 3em; font-size: clamp(17px, 1.7vw, 21px); line-height: 1.42; font-weight: 400; max-width: 1040px; }
.hero .readout b { font-weight: 600; }
.hero .key { margin-top: 12px; }
.hero figcaption { margin-top: 12px; max-width: 880px; }

/* Reading grid */
.post-body { display: grid; grid-template-columns: minmax(0, var(--read)); justify-content: center; }
.post article { min-width: 0; font-size: 18.5px; line-height: 1.62; font-weight: 400; letter-spacing: -.012em; }
.post article p { margin: 0 0 20px; }
.post article ul, .post article ol { margin: 0 0 20px; padding-left: 24px; }
.post article li + li { margin-top: 6px; }
.post .lede { font-size: clamp(23px, 2.4vw, 29px); line-height: 1.34; font-weight: 300; letter-spacing: -.012em; margin-bottom: 28px; }
.post .lead { font-size: clamp(19.5px, 1.6vw, 21px); line-height: 1.45; letter-spacing: -.008em; margin-bottom: 18px; }
.post h2 { font: 300 clamp(34px, 4vw, 52px)/1.08 var(--sans); letter-spacing: -.022em; margin: clamp(72px, 9vw, 116px) 0 26px; scroll-margin-top: 24px; text-wrap: balance; }
.post h3 { font: 500 clamp(22px, 2vw, 26px)/1.2 var(--sans); letter-spacing: -.014em; margin: clamp(52px, 6vw, 72px) 0 16px; scroll-margin-top: 24px; text-wrap: balance; }
.post h2 + h3 { margin-top: 24px; }
.post h3 .n { display: inline-block; min-width: 1.5em; font: 400 .72em/1 var(--mono); color: var(--orange-ink); vertical-align: .08em; }
.post b { font-weight: 600; }
.post code { font: .86em var(--mono); padding: .08em .3em; border-radius: 4px; background: var(--panel); overflow-wrap: anywhere; letter-spacing: 0; }
.post a code { background: none; padding: 0; }

.post .jump { display: flex; flex-wrap: wrap; gap: 6px 22px; font-size: 16px; line-height: 1.4; }
.post .jump span { flex-basis: 100%; font: 400 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }

/* Code */
.codebox { margin: 4px 0 26px; border-radius: 8px; overflow: hidden; background: var(--code-bg); color: var(--code-fg); }
.codebox .bar { display: block; padding: 8px 16px; background: var(--code-bar); font: 400 12px/1.4 var(--mono); color: var(--code-dim); }
.codebox .bar a { color: var(--code-fg); text-decoration-color: var(--code-dim); }
.post pre { margin: 0; padding: 15px 16px 16px; overflow-x: auto; font: 400 13.5px/1.6 var(--mono); tab-size: 4; background: none; }
.post pre code { font: inherit; padding: 0; background: none; color: inherit; overflow-wrap: normal; }
.post pre .c { color: var(--code-dim); }
.post pre .s { color: var(--code-str); }
.post pre .k { color: var(--code-key); }

/* Step list and the Step 70 numbers */
.post ol.steps { list-style: none; padding: 0; counter-reset: s; margin: 0 0 32px; }
.post ol.steps li { counter-increment: s; position: relative; margin: 0; padding: 12px 0 12px 2.1em; border-top: 1px solid var(--rule); font-size: 17.5px; line-height: 1.5; }
.post ol.steps li::before { content: counter(s); position: absolute; left: 0; font: 400 15px/1.75 var(--mono); color: var(--orange-ink); }
.post dl.rows { margin: 4px 0 26px; }
.post dl.rows > div { display: grid; grid-template-columns: 118px minmax(0, 1fr); gap: 0 18px; align-items: baseline; padding: 16px 0; border-top: 1px solid var(--rule); }
.post dl.rows dt { font-size: clamp(27px, 3vw, 36px); font-weight: 300; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; font-variant-numeric: tabular-nums; }
.post dl.rows dd { margin: 0; font-size: 17.5px; line-height: 1.5; }
.post ul.three { list-style: none; padding: 0; }
.post ul.three li { padding: 14px 0; margin: 0; border-top: 1px solid var(--rule); }

/* Margin notes: inline on small screens, in the right margin once there is room */
.side { margin: 0 0 20px; padding-left: 14px; border-left: 2px solid var(--rule); font-size: 15px; line-height: 1.5; color: var(--muted); }

/* Figures */
.fig { margin: 36px 0 40px; clear: right; }
.fig .stage { position: relative; }
.fig .stage.video { overflow: hidden; aspect-ratio: 16 / 9; background: #f8f8f6; border-radius: 8px; max-width: 100%; }
.fig .stage.video video { display: block; width: 100%; height: 100%; cursor: pointer; }
.vid-btn { position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 7px; padding: 7px 12px 7px 10px; border: 0; border-radius: 999px; background: rgba(15, 21, 22, .78); color: #fff; font: 400 12px/1 var(--mono); cursor: pointer; }
.vid-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tabs button { font: 400 12.5px/1 var(--mono); color: var(--muted); background: var(--panel); border: 0; border-radius: 4px; padding: 10px 13px; cursor: pointer; }
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--bg); background: var(--text); }
.tabs button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.panel + .panel { margin-top: 12px; }
.fig svg { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--sans); }
.fig figcaption, .hero figcaption { margin-top: 12px; font-size: 14.5px; line-height: 1.5; color: var(--muted); max-width: 760px; }
.fig figcaption b, .hero figcaption b { font: 400 12px/1 var(--mono); letter-spacing: .03em; color: var(--text); margin-right: 3px; }
.fig .say { margin: 12px 0 0; min-height: 3.1em; font-size: 16px; line-height: 1.5; color: var(--text); }
.fig .ctl { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.fig .ctl button { font: 400 12px/1 var(--mono); color: var(--muted); background: var(--panel); border: 0; border-radius: 4px; padding: 9px 11px; cursor: pointer; }
.fig .ctl button:hover { color: var(--text); }
.fig .ctl button[aria-pressed="true"] { color: var(--bg); background: var(--text); }
.fig .ctl button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.fig .ctl .go { color: var(--text); background: none; box-shadow: inset 0 0 0 1px var(--rule); }
.key { display: flex; flex-wrap: wrap; gap: 5px 18px; margin: 12px 0 0 !important; padding: 0 !important; list-style: none; font-size: 14px; line-height: 1.45; color: var(--muted); }
.key li { margin: 0 !important; }
.key i { display: inline-block; width: 12px; height: 12px; margin-right: 6px; vertical-align: -1px; border-radius: 3px; }
.k-prompt { background: color-mix(in srgb, var(--faint) 35%, transparent); }
.k-gen { background: var(--teal); }
.k-tool { box-shadow: inset 0 0 0 1.5px var(--faint); }
.k-drop { background: repeating-linear-gradient(135deg, var(--fail) 0 2px, transparent 2px 5px); opacity: .7; }
.k-train { background: var(--orange); }
.k-push { background: var(--orange); width: 4px !important; border-radius: 1px !important; }
.k-idle { background: repeating-linear-gradient(135deg, var(--faint) 0 1px, transparent 1px 5px); box-shadow: inset 0 0 0 1px var(--rule); }
.k-pass { background: var(--green); border-radius: 50% !important; }
.k-fail { box-shadow: inset 0 0 0 1.5px var(--text); border-radius: 50% !important; }
.k-crash { background: linear-gradient(45deg, transparent 42%, var(--fail) 42% 58%, transparent 58%), linear-gradient(-45deg, transparent 42%, var(--fail) 42% 58%, transparent 58%); }
.k-trained { background: var(--orange); }
.k-masked { background: var(--fail); }
.k-allpass { background: var(--tint-pass); }
.k-allfail { background: var(--tint-fail); }
.k-few { background: var(--tint-few); }
.k-line-a, .k-line-b { height: 2px !important; width: 16px !important; vertical-align: 4px !important; border-radius: 1px !important; }
.k-line-a { background: var(--orange); }
.k-line-b { background: var(--teal); }

/* SVG roles */
.fig svg text { fill: var(--muted); font-size: 13px; }
.fig svg text.strong { fill: var(--text); font-weight: 600; }
.fig svg text.on-dark { fill: var(--bg); font-weight: 600; }
.fig svg text.tick { font: 400 11.5px var(--mono); fill: var(--faint); }
.fig svg .gen { fill: var(--teal); }
.fig svg .train { fill: var(--orange); }
.fig svg .prompt { fill: color-mix(in srgb, var(--faint) 35%, transparent); }
.fig svg .tool { fill: none; stroke: var(--faint); stroke-width: 1.5; }
.fig svg .rule { stroke: var(--rule); stroke-width: 1; fill: none; }
.fig svg .axis { stroke: var(--faint); stroke-width: 1; fill: none; }
.fig svg .ink { stroke: var(--text); fill: none; }
.fig svg .pass { fill: var(--green); }
.fig svg .fail { fill: none; stroke: var(--text); stroke-width: 1.5; }
.fig svg .crash { stroke: var(--fail); stroke-width: 2.4; stroke-linecap: round; fill: none; }
.fig svg text.failtxt { fill: var(--text); font-weight: 600; }
.fig svg text.oktxt { fill: var(--text); font-weight: 600; }
.fig svg text.tealtxt { fill: var(--text); font-weight: 600; }
.fig svg text.orangetxt { fill: var(--text); font-weight: 600; }
.fig svg .hl-fail { stroke: var(--fail); }
.fig svg .hl-idle { stroke: var(--faint); }
.fig svg .line-a { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fig svg .line-b { fill: none; stroke: var(--teal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fig svg .dot-a { fill: var(--orange); stroke: var(--bg); stroke-width: 2; }
.fig svg .dot-b { fill: var(--teal); stroke: var(--bg); stroke-width: 2; }
.fig svg .col-a { fill: var(--teal); }
.fig svg .col-b { fill: var(--orange); }
.fig svg .col-hit { fill: transparent; }
.fig svg .col-hit:hover + .col-a, .fig svg .col-hit:hover + .col-b { opacity: .72; }
.fig svg .cross { stroke: var(--text); stroke-width: 1; }
.fig .stage:empty { display: none; }

.tip { position: fixed; z-index: 20; max-width: 280px; padding: 8px 10px; border-radius: 6px; background: var(--text); color: var(--bg); font: 400 12.5px/1.45 var(--mono); pointer-events: none; }
.tip b { font-weight: 400; display: block; }
.fig details.data, .hero details.data { margin-top: 10px; font-size: 14px; color: var(--muted); }
details.data summary { cursor: pointer; font: 400 12px/1.6 var(--mono); }
details.data .scroll { max-height: 260px; overflow: auto; margin-top: 8px; }
details.data table { border-collapse: collapse; font: 400 12px/1.5 var(--mono); }
details.data th, details.data td { padding: 2px 14px 2px 0; text-align: right; border-bottom: 1px solid var(--rule); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* To-scale bars, plain HTML so they read without any script */
.seg-chart { display: grid; gap: 6px; }
.seg-title { margin: 8px 0 0 !important; font-size: 15px; line-height: 1.4; color: var(--muted); }
.seg { display: flex; gap: 2px; height: 28px; }
.seg span { display: flex; align-items: center; padding: 0 9px; min-width: 0; border-radius: 4px; font-size: 13.5px; line-height: 1; white-space: nowrap; overflow: visible; }
.seg .s-orange { background: var(--orange); color: var(--on-orange); font-weight: 600; }
.seg .s-pale { background: var(--tint-pass); color: var(--text); }
.seg.tall { height: 44px; }
.seg.tall span { font-size: 15.5px; }

.bars { display: grid; gap: 6px; }
.bars-group { margin: 12px 0 0 !important; font: 400 12px/1.4 var(--mono); letter-spacing: .04em; color: var(--faint); }
.bars-group:first-child { margin-top: 0 !important; }
.bar { display: grid; grid-template-columns: 200px minmax(0, 1fr) 150px; align-items: center; gap: 10px; font-size: 14.5px; line-height: 1.3; }
.bar-t { display: block; }
.bar-t i { display: block; height: 16px; min-width: 2px; border-radius: 0 4px 4px 0; }
.bar-v { font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-v small { font-weight: 400; font-size: 12.5px; color: var(--faint); margin-left: 3px; }
.b-muted { background: var(--tint-fail); }
.b-teal { background: var(--teal); }
.b-fail { background: var(--fail); }

.post dl.spec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 28px; margin: 24px 0 0; }
.post dl.spec dt { font-size: clamp(27px, 3vw, 36px); font-weight: 300; letter-spacing: -.02em; line-height: 1.1; }
.post dl.spec dd { margin: 5px 0 0; font-size: 14.5px; line-height: 1.42; color: var(--muted); }

/* Measurement table */
.table-wrap { overflow-x: auto; margin: 8px 0 26px; }
table.num { border-collapse: collapse; width: 100%; font-size: 16px; }
table.num th, table.num td { padding: 9px 14px 9px 0; text-align: left; border-bottom: 1px solid var(--rule); vertical-align: top; }
table.num th { font: 400 12px/1.4 var(--mono); color: var(--faint); }
table.num td:not(:first-child), table.num th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }

.post .sources { font-size: 15px; line-height: 1.5; padding-left: 18px; color: var(--muted); }
.post-foot { margin-top: 44px; padding-top: 16px; border-top: 1px solid var(--rule); font-size: 15px; color: var(--muted); }
.post-foot p { margin: 0 !important; }

/* Contents: a collapsed block on small screens, a sticky rail once there is room */
.rail { margin: 0 0 32px; font-size: 14px; line-height: 1.35; }
.rail summary { cursor: pointer; font: 400 12px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--faint); }
.rail ol { list-style: none; margin: 0; padding: 0; }
.rail details > ol { margin-top: 12px; }
.rail li { margin: 0; }
.rail a { display: block; padding: 3px 0; color: var(--muted); text-decoration: none; }
.rail a:hover { color: var(--text); }
.rail a[aria-current="true"] { color: var(--text); font-weight: 600; }
.rail a span { display: inline-block; width: 1.7em; font: 400 11.5px var(--mono); color: var(--faint); }
.rail a[aria-current="true"] span { color: var(--orange-ink); }
.rail .group { margin-top: 10px; }
.rail .group > a { color: var(--text); }

@media (min-width: 1240px) {
  .post-body { grid-template-columns: var(--rail) minmax(0, var(--read)) var(--margin); column-gap: var(--gutter); }
  .rail { position: sticky; top: 24px; align-self: start; max-height: calc(100vh - 48px); overflow-y: auto; margin: 0; }
  .rail summary { list-style: none; pointer-events: none; }
  .rail summary::-webkit-details-marker { display: none; }
  .post article { grid-column: 2; }
  .side { float: right; clear: right; width: var(--margin); margin: 6px calc(-1 * (var(--margin) + var(--gutter))) 14px 0; padding-left: 0; border-left: 0; font-size: 14.5px; }
  .fig { margin-right: calc(-1 * (var(--margin) + var(--gutter))); }
  .fig.narrow { margin-right: 0; }
}

@media (max-width: 720px) {
  .post { padding-block: 18px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  .post article { font-size: 17.5px; line-height: 1.58; }
  .post pre { font-size: 12.3px; padding: 12px; }
  .fig svg text { font-size: 12px; }
  .bar { grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; }
  .bar-t { grid-column: 1 / -1; grid-row: 2; }
  .post dl.spec { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .post dl.rows > div { grid-template-columns: 88px minmax(0, 1fr); gap: 0 12px; }
  .post dl.rows dd { font-size: 16.5px; }
  .post ol.steps li { font-size: 16.5px; }
  .seg span { font-size: 12px; padding: 0 6px; }
  .seg.tall span { font-size: 13px; }
}
@media print { .rail, .vid-btn { display: none; } }
