/* Logit explainers. Uses site.css tokens only.
   Ink surface so each explainer reads as an instrument on a bone page.
   Solid orange chip  = generated by the model.
   Dashed orange chip = scored by a researcher, never generated.
   No coloured edge stripes anywhere: emphasis is fill or full outline. */

.lx {
  --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
  --surf: var(--ink-hover);
  position: relative;
  margin: 32px 0;
  padding: clamp(16px, 3vw, 28px);
  border-radius: 20px;
  background: var(--ink);
  color: var(--bone);
  font-size: 15px;
  line-height: 1.55;
}
.lx:first-child { margin-top: 0; }

/* undo article prose rules inside the instrument */
.rp-prose .lx p, .rp-prose .lx li, .rp-prose .lx dd {
  max-width: none; margin: 0; font-size: inherit; line-height: inherit; color: inherit;
}
.rp-prose .lx ol, .rp-prose .lx ul { list-style: none; padding: 0; margin: 0; }
.rp-prose .lx code, .lx code {
  font-family: var(--mono); font-size: .86em; padding: 1px 6px; border-radius: 5px;
  background: var(--bone-veil-soft); color: var(--bone);
}

/* pipeline progress (a status indicator, not controls) */
.lx-pipe { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; margin-bottom: 16px; counter-reset: lx-step; }
.lx-pipe li {
  display: flex; align-items: center; gap: 6px; counter-increment: lx-step;
  font-size: 12px; line-height: 1.2; color: var(--bone-3);
  font-variation-settings: "wdth" 100, "wght" 550; transition: color .25s var(--ease);
}
.lx-pipe li > span::before {
  content: counter(lx-step); display: inline-grid; place-items: center; width: 18px; height: 18px; margin-right: 6px;
  border-radius: 50%; font-family: var(--mono); font-size: 10.5px; background: var(--bone-veil-soft); color: var(--bone-3);
  transition: background .25s var(--ease), color .25s var(--ease);
}
.lx-pipe li + li::before { content: ""; width: 14px; height: 1px; background: var(--bone-rule); }
.lx-pipe li.lx-past { color: var(--bone-2); }
.lx-pipe li.lx-past > span::before { background: var(--bone-3); color: var(--ink); }
.lx-pipe li.lx-on { color: var(--orange); }
.lx-pipe li.lx-on > span::before { background: var(--orange); color: var(--ink); }

/* boxes */
.lx-box { padding: 16px; border-radius: 14px; background: var(--surf); }
.lx-box + .lx-box { margin-top: 10px; }
.lx-k {
  display: block; font-size: 11px; line-height: 1.4; letter-spacing: .08em; text-transform: uppercase;
  color: var(--bone-3); font-variation-settings: "wdth" 100, "wght" 550;
}
.rp-prose .lx .lx-prompt { margin-top: 10px; font-size: 17px; line-height: 1.4; color: var(--bone); }
.rp-prose .lx .lx-cot { font-style: italic; color: var(--bone-2); }
.rp-prose .lx .lx-small { margin-top: 10px; font-size: 14px; line-height: 1.45; }
.rp-prose .lx .lx-sub, .lx-sub { display: block; margin-top: 10px; font-size: 12.5px; line-height: 1.45; color: var(--bone-3); }
.lx-sub b { color: var(--orange); font-family: var(--mono); font-variation-settings: normal; font-weight: 600; white-space: nowrap; }

/* chips */
.lx-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.lx-chips:empty { margin-top: 0; }
.lx-chip {
  padding: 5px 10px; border-radius: 8px; font-family: var(--mono); font-size: 13.5px; line-height: 1.3;
  background: var(--bone-veil); color: var(--bone); box-shadow: inset 0 0 0 1px var(--bone-rule);
  transition: background .25s var(--ease), color .25s var(--ease), box-shadow .25s var(--ease), opacity .25s var(--ease);
}
.lx-chip.lx-gen { background: var(--orange); color: var(--ink); box-shadow: none; }
.lx-chip.lx-target { background: transparent; color: var(--bone-3); box-shadow: none; outline: 1.5px dashed var(--bone-rule); outline-offset: -1.5px; }
.lx-chip.lx-target.lx-lit { color: var(--orange); outline-color: var(--orange); }
.lx-chip.lx-target.lx-cur { background: rgba(250, 102, 20, .14); }
.lx-in { animation: lx-in .38s var(--lift) both; }
.lx-flash { animation: lx-in .38s var(--lift) both, lx-flash 1.2s var(--ease) .2s; }
@keyframes lx-in { from { opacity: 0; transform: translateY(6px) scale(.96); } }
@keyframes lx-flash { 0% { box-shadow: 0 0 0 0 rgba(250, 102, 20, .6); } 100% { box-shadow: 0 0 0 10px rgba(250, 102, 20, 0); } }

/* output bars */
.lx-out-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.lx-seg { display: inline-flex; padding: 3px; border-radius: 999px; background: var(--ink); }
.lx-seg button {
  padding: 6px 12px; border: 0; border-radius: 999px; background: transparent; color: var(--bone-2);
  font-size: 12px; cursor: pointer;
}
.lx-seg button[aria-pressed="true"] { background: var(--bone); color: var(--ink); }
.lx-seg button:disabled { opacity: .4; cursor: not-allowed; }

.lx-bars { --tw: 64px; --vw: 60px; --g: 12px; --z: .3; position: relative; margin-top: 14px; display: grid; gap: 8px; }
.lx-row { display: grid; grid-template-columns: var(--tw) minmax(0, 1fr) var(--vw); align-items: center; gap: var(--g); }
.lx-tok { font-family: var(--mono); font-size: 13.5px; color: var(--bone); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lx-val { font-family: var(--mono); font-size: 13px; text-align: right; color: var(--bone-2); font-variant-numeric: tabular-nums; }
.lx-track { position: relative; height: 22px; border-radius: 6px; background: var(--ink); overflow: hidden; }
.lx-fill {
  position: absolute; top: 0; bottom: 0; left: 30%; width: 0; border-radius: 4px;
  background: var(--bone-3);
  transition: left .7s var(--lift), width .7s var(--lift), background .4s var(--ease);
}
.lx-fill.lx-neg { background: var(--bone-veil); box-shadow: inset 0 0 0 1px var(--bone-3); }
.lx-is-probs .lx-fill { background: var(--bone-2); }
.lx-zero {
  position: absolute; top: -4px; bottom: -4px; width: 0; z-index: 1; pointer-events: none;
  left: calc(var(--tw) + var(--g) + (100% - var(--tw) - var(--vw) - 2 * var(--g)) * var(--z));
  border-left: 1px dashed var(--bone-2);
  transition: left .7s var(--lift), opacity .4s var(--ease);
}
.lx-is-probs .lx-zero { opacity: .35; }
.lx-row.lx-pick .lx-fill { background: var(--orange); box-shadow: none; }
.lx-row.lx-pick .lx-tok, .lx-row.lx-pick .lx-val { color: var(--orange); }
.rp-prose .lx .lx-empty, .lx-empty { font-size: 13px; color: var(--bone-3); }
.lx-ghost-row { opacity: .5; }
.lx-ghost-row .lx-tok, .lx-ghost-row .lx-val { color: var(--bone-3); }
.lx-shimmer { position: absolute; inset: 0; width: 40%; background: linear-gradient(90deg, transparent, var(--bone-veil), transparent); transform: translateX(-100%); }
.lx-busy .lx-ghost-row { opacity: .8; }
.lx-busy .lx-shimmer { animation: lx-shim 1.1s linear infinite; }
@keyframes lx-shim { to { transform: translateX(260%); } }
.lx-btn.lx-play[aria-pressed="true"] { background: var(--bone); color: var(--ink); box-shadow: none; }

.lx-formula { margin-top: 14px; font-size: 12.5px; line-height: 1.6; color: var(--bone-3); }
.lx-formula:empty { display: none; }
.lx-formula code { display: inline-block; max-width: 100%; padding: 6px 10px; font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
.lx-sum { display: block; margin-top: 6px; }

/* explanation + controls */
.rp-prose .lx .lx-explain { margin-top: 16px; font-size: 15px; line-height: 1.6; color: var(--bone); min-height: 4.8em; }
.rp-prose .lx .lx-lead { margin-top: 0; font-size: 17px; min-height: 0; }
.lx-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.lx-btn {
  padding: 11px 18px; border: 0; border-radius: 999px; background: var(--orange); color: var(--ink);
  font-size: 13.5px; line-height: 1.2; font-variation-settings: "wdth" 100, "wght" 650; cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease), opacity .2s;
}
.lx-btn:hover { background: var(--orange-hover); }
.lx-btn:active { transform: scale(.97); }
.lx-btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.lx-btn.lx-ghost { background: transparent; color: var(--bone); box-shadow: inset 0 0 0 1px var(--bone-rule); }
.lx-btn.lx-ghost:hover:not(:disabled) { background: var(--bone-veil-soft); }

.lx-temp { display: grid; gap: 4px; margin-left: auto; min-width: 180px; font-size: 12px; color: var(--bone-2); }
.lx-temp[hidden] { display: none; }
.lx-temp output { font-family: var(--mono); color: var(--orange); }
.lx-temp input { width: 100%; accent-color: var(--orange); }

.lx-notes { display: grid; gap: 10px; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--bone-rule); }
.rp-prose .lx .lx-notes p { font-size: 13px; line-height: 1.6; color: var(--bone-2); }
.lx-notes b { color: var(--bone); }

/* terms + tooltip */
.lx-term { border-bottom: 1px dotted currentColor; cursor: help; }
.lx-tip {
  position: absolute; z-index: 5; padding: 10px 12px; border-radius: 10px;
  background: var(--bone); color: var(--ink); font-size: 12.5px; line-height: 1.5;
  text-transform: none; letter-spacing: 0; font-variation-settings: "wdth" 100, "wght" 450;
  box-shadow: 0 10px 30px var(--shade-34); pointer-events: none;
}
.lx-tip[hidden] { display: none; }

/* monitoring rows */
.lx-cond { display: grid; gap: 10px; margin-top: 12px; }
.lx-crow {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 40px; align-items: center; gap: 12px;
  opacity: .45; transition: opacity .3s var(--ease);
}
.lx-crow.lx-on { opacity: 1; }
.rp-prose .lx .lx-crow .lx-expr, .lx-crow .lx-expr { background: none; padding: 0; font-size: 12.5px; line-height: 1.4; color: var(--bone-2); overflow-wrap: anywhere; }
.rp-prose .lx .lx-crow.lx-cur .lx-expr, .lx-crow.lx-cur .lx-expr { color: var(--orange); }
.lx-crow .lx-track { height: 14px; }
.lx-crow .lx-fill { left: 0; background: var(--bone-2); }
.lx-crow.lx-cur .lx-fill { background: var(--orange); }

.lx-prod { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--bone-rule); display: grid; justify-items: start; gap: 6px; }
.lx-prod code { max-width: 100%; line-height: 1.6; overflow-wrap: anywhere; }
.lx-big { font-family: var(--mono); font-size: clamp(26px, 6vw, 32px); line-height: 1.1; color: var(--orange); margin-top: 4px; }
.lx-prod .lx-sub { margin-top: 0; }

/* the comparison */
.lx-vs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 22px; animation: lx-in .5s var(--lift) both; }
.lx-vs[hidden] { display: none; }
.lx-vs-col { padding: 16px; border-radius: 14px; background: var(--surf); }
.lx-vs-mon { background: transparent; outline: 1.5px dashed var(--orange); outline-offset: -1.5px; }
.lx-vs .lx-k { color: var(--bone); }
.rp-prose .lx .lx-climax, .lx-climax {
  grid-column: 1 / -1; margin-top: 8px; padding: 18px 20px; border-radius: 14px;
  background: var(--bone); color: var(--ink); font-size: 18px; line-height: 1.45;
  font-variation-settings: var(--sub);
}
.lx-replay { grid-column: 1 / -1; justify-self: start; }

/* research context */
.lx-flow { display: grid; gap: 8px; margin-top: 18px; }
.lx-flow li {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px;
  border-radius: 12px; background: var(--surf); font-size: 14.5px; line-height: 1.4; color: var(--bone);
}
.lx-flow li span {
  flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  font-family: var(--mono); font-size: 12px; background: var(--orange); color: var(--ink);
}
.lx-defs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 18px 0 0; }
.lx-defs > div { padding: 16px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--bone-rule); }
.lx-defs dt { font-size: 14.5px; color: var(--orange); font-variation-settings: "wdth" 100, "wght" 650; }
.rp-prose .lx .lx-defs dd, .lx-defs dd { margin: 6px 0 0; font-size: 13.5px; line-height: 1.55; color: var(--bone-2); }
.rp-prose .lx .lx-caution, .lx-caution {
  margin-top: 18px; padding: 14px 16px; border-radius: 12px;
  background: var(--bone); color: var(--ink); font-size: 14.5px; line-height: 1.6;
}

.rp-prose .lx .lx-cap, .lx-cap { margin-top: 20px; font-size: 12px; line-height: 1.5; color: var(--bone-3); text-align: left; }

/* ── Preview cards linking to the explainers (posts + hub) ── */
.lx-cards { --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 32px 0; }
.rp-prose .lx-card, .lx-card {
  display: grid; align-content: start; gap: 10px; padding: 16px 16px 20px; border-radius: 18px;
  background: var(--ink); color: var(--bone); text-decoration: none;
  transition: transform .25s var(--lift), background .2s var(--ease);
}
.rp-prose .lx-card:hover, .lx-card:hover { background: var(--ink-hover); color: var(--bone); transform: translateY(-2px); }
.lx-card-art {
  display: grid; align-content: center; gap: 10px; min-height: 150px; margin-bottom: 6px; padding: 16px;
  border-radius: 12px; background: var(--ink-hover); overflow: hidden;
  transition: background .2s var(--ease);
}
.lx-card:hover .lx-card-art { background: #332e29; }
.lx-card-art .lx-chips { margin: 0; gap: 5px; }
.lx-card-art .lx-chip { padding: 3px 7px; font-size: 11.5px; }
.lx-mini-ctx { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.lx-mini-ar { color: var(--bone-3); font-size: 13px; }
.lx-mini-bars { display: grid; grid-template-columns: 46px minmax(0, 1fr) 40px; align-items: center; gap: 5px 8px; font-family: var(--mono); font-size: 10.5px; color: var(--bone-3); }
.lx-mini-bars i { display: block; height: 8px; border-radius: 3px; background: var(--ink); position: relative; overflow: hidden; }
.lx-mini-bars i::after { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--w); border-radius: 3px; background: var(--bone-3); transform-origin: left; transition: transform .6s var(--lift); }
.lx-mini-bars i.on::after { background: var(--orange); }
.lx-mini-bars em { font-style: normal; text-align: right; }
.lx-mini-bars .on { color: var(--orange); }
.lx-card:hover .lx-mini-bars i::after { transform: scaleX(1.04); }
.lx-mini-cot { font-size: 12px; line-height: 1.4; font-style: italic; color: var(--bone-2); }
.lx-mini-prod { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.rp-prose .lx-mini-prod code, .lx-mini-prod code { padding: 0; background: none; font-family: var(--mono); font-size: 11px; color: var(--bone-3); }
.lx-mini-prod b { font-family: var(--mono); font-size: 22px; line-height: 1; color: var(--orange); font-weight: 600; font-variation-settings: normal; }
.lx-card .lx-k { color: var(--orange); }
.rp-prose .lx-card .lx-card-h, .lx-card .lx-card-h { margin: 0; font-size: 18px; line-height: 1.25; letter-spacing: 0; color: var(--bone); font-variation-settings: var(--sub); }
.rp-prose .lx-card span.lx-card-p, .lx-card-p { font-size: 14px; line-height: 1.5; color: var(--bone-2); }
.lx-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.lx-tags span { padding: 3px 9px; border-radius: 999px; font-size: 11.5px; color: var(--bone-2); box-shadow: inset 0 0 0 1px var(--bone-rule); }
.lx-card .lx-go { margin-top: 4px; font-size: 13.5px; color: var(--orange); font-variation-settings: "wdth" 100, "wght" 600; }

/* larger variant on the explainers hub */
.lx-cards-lg { gap: 16px; margin: 0; }
.lx-cards-lg .lx-card { padding: 18px 18px 24px; border-radius: 22px; }
.lx-cards-lg .lx-card-art { min-height: 210px; padding: 22px; gap: 14px; }
.lx-cards-lg .lx-card-art .lx-chip { font-size: 12.5px; padding: 4px 9px; }
.lx-cards-lg .lx-mini-bars { grid-template-columns: 54px minmax(0, 1fr) 46px; gap: 8px 10px; font-size: 12px; }
.lx-cards-lg .lx-mini-bars i { height: 12px; }
.lx-cards-lg .lx-mini-cot { font-size: 14px; }
.lx-cards-lg .rp-prose .lx-mini-prod code, .lx-cards-lg .lx-mini-prod code { font-size: 12.5px; }
.lx-cards-lg .lx-mini-prod b { font-size: 30px; }
.rp-prose .lx-cards-lg .lx-card .lx-card-h, .lx-cards-lg .lx-card .lx-card-h { font-size: 22px; }

/* ── Small screens ─────────────────────────────────────────── */
@media (max-width: 640px) {
  .lx { margin-inline: -8px; padding: 14px; border-radius: 16px; }
  .lx-box, .lx-vs-col { padding: 14px; }
  .lx-pipe li + li::before { width: 6px; }
  .lx-pipe li { font-size: 11.5px; }
  .lx-bars { --tw: 50px; --vw: 50px; --g: 8px; }
  .lx-tok, .lx-val { font-size: 12.5px; }
  .lx-controls .lx-btn { flex: 1 1 auto; }
  .lx-temp { margin-left: 0; width: 100%; }
  .lx-crow { grid-template-columns: minmax(0, 1fr) 40px; gap: 6px 10px; }
  .lx-crow .lx-track { grid-column: 1 / -1; grid-row: 2; }
  .lx-vs, .lx-defs, .lx-cards { grid-template-columns: minmax(0, 1fr); }
  .rp-prose .lx .lx-climax, .lx-climax { font-size: 16px; padding: 16px; }
  .rp-prose .lx .lx-explain { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lx *, .lx *::before, .lx-card { animation: none !important; transition: none !important; }
}

/* list blocks keep their spacing after the prose list reset above */
.rp-prose .lx .lx-pipe { margin-bottom: 16px; }
.rp-prose .lx .lx-cond { margin-top: 12px; }
.rp-prose .lx .lx-flow { margin-top: 18px; }

/* quick "how to use" strip at the top of each interactive */
.lx-how {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  margin-bottom: 18px; padding: 10px 14px; border-radius: 12px;
  background: var(--bone); color: var(--ink); font-size: 13px; line-height: 1.4;
}
.lx-how-k {
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--rust);
  font-variation-settings: "wdth" 100, "wght" 650;
}
.rp-prose .lx .lx-how ol { display: flex; flex-wrap: wrap; gap: 4px 14px; counter-reset: lx-how; }
.rp-prose .lx .lx-how li { counter-increment: lx-how; display: flex; align-items: center; gap: 6px; color: var(--ink-2); }
.lx-how li::before {
  content: counter(lx-how); display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%;
  font-family: var(--mono); font-size: 10.5px; background: var(--ink); color: var(--bone);
}
.lx-how b { color: var(--ink); }
.lx-how b.lx-how-o { padding: 1px 7px; border-radius: 999px; background: var(--orange); color: var(--ink); }
.lx-how-u { border-bottom: 1px dotted currentColor; }
@media (max-width: 640px) {
  .lx-how { padding: 10px 12px; }
  .rp-prose .lx .lx-how ol { flex-direction: column; }
}
