/**
 * resource-artefacts.css — the five explainers on /resources/.
 *
 * Loaded only on the pages that carry one (see sizrok_enqueue()). Uses the
 * site's own tokens, so these read as part of the page rather than as embedded
 * widgets. Nothing here is decorative: every colour change carries state.
 *
 * The container is collapsed until JS marks it ready, so a page with no
 * JavaScript shows no gap and shifts nothing.
 */

[data-artefact] { display: none; }
[data-artefact][data-ready="true"] {
  display: block;
  margin: 40px 0;
  padding: 26px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 16px;
}

/* On an industry page the demo sits in the section rail under its own
   heading. Both go together: if the script never runs, the reader never sees
   a heading standing over an empty box. The JS sets data-ready on the section
   as well as on the host. */
.loc-section--demo { display: none; }
.loc-section--demo[data-ready="true"] { display: grid; }
.loc-section__body > [data-artefact][data-ready="true"] { margin: 0; }

/* The small caption above each part of a demo. Lowercase, in the words the
   script writes ("the notes that go in", "lifted out"): the brand keeps its
   labels lowercase and never sets copy in all caps, so no text-transform
   here. The tracking that suited small caps is dropped with them. */
.rx-label {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.01em;
  color: var(--mid);
  margin-bottom: 10px;
}

.rx-panel__title { margin: 0 0 8px; font-size: 1.05rem; font-weight: 600; }

/* A demo also appears inside .loc-section__body on an industry page, where
   location.css styles `ul` with a 20px indent and `li` with a marker. Those
   selectors beat a plain class, so the lists are pulled back here with the
   host attributes in front. Harmless on a resource page, where nothing
   competes. */
[data-artefact][data-ready] ul,
[data-artefact][data-ready] ol { margin: 0; padding: 0; list-style: none; }
[data-artefact][data-ready] li { margin: 0; }

/* ── shared: hit lists ─────────────────────────────────────────────── */
.rx-hits { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rx-hit {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: 8px;
}
.rx-hit__title { font-size: 0.92rem; text-decoration: none; color: inherit; }
a.rx-hit__title { border-bottom: 1px solid var(--rule-2); }
a.rx-hit__title:hover { border-bottom-color: var(--orange); color: var(--orange); }
.rx-hit__bar {
  width: 78px; height: 5px; border-radius: 3px;
  background: linear-gradient(to right, var(--orange) var(--w, 20%), var(--warm-2) var(--w, 20%));
}
.rx-hit__score { font-variant-numeric: tabular-nums; font-size: 0.8rem; color: var(--mid); }

/* ── RES-13 · pipeline ─────────────────────────────────────────────── */
.rx-queries { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.rx-queries .rx-label { width: 100%; margin-bottom: 4px; }
.rx-query {
  font: inherit; font-size: 0.85rem;
  padding: 8px 14px; border-radius: 999px;
  background: var(--cream); border: 1px solid var(--rule);
  cursor: pointer; text-align: left;
}
.rx-query[aria-pressed="true"] { background: var(--ink); color: var(--white); border-color: var(--ink); }

.rx-stages { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.rx-stage {
  font: inherit; display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px; cursor: pointer;
  background: var(--cream); border: 1px solid var(--rule);
}
.rx-stage__n {
  width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center;
  font-size: 0.72rem; background: var(--warm-2); color: var(--ink);
}
.rx-stage__name { font-size: 0.86rem; }
.rx-stage[data-state="done"] .rx-stage__n { background: var(--ink); color: var(--white); }
.rx-stage[data-state="live"] { background: var(--orange); border-color: var(--orange); color: var(--black); }
.rx-stage[data-state="live"] .rx-stage__n { background: var(--black); color: var(--white); }
.rx-arrow { color: var(--mid); }

.rx-note {
  margin: 0 0 18px; padding: 14px 16px;
  background: var(--cream); border-radius: 10px;
  font-size: 0.92rem; line-height: 1.6;
}
.rx-results__idle { margin: 0; color: var(--mid); font-size: 0.9rem; }
.rx-results .rx-hit { animation: rx-in 0.32s var(--ease) both; animation-delay: calc(var(--i, 0) * 60ms); }

@keyframes rx-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── RES-15 · the map ──────────────────────────────────────────────── */
[data-artefact="vector"][data-ready="true"] { display: grid; grid-template-columns: 1.35fr 1fr; gap: 24px; }
.rx-plot { background: var(--cream); border-radius: 12px; padding: 8px; }
.rx-plot__svg { width: 100%; height: auto; display: block; }
.rx-dot circle {
  fill: var(--warm-2); stroke: none; cursor: pointer;
  transition: fill 0.25s var(--ease), r 0.25s var(--ease);
}
.rx-dot[data-state="near"] circle { fill: var(--ink); r: 2; }
.rx-dot[data-state="on"] circle { fill: var(--orange); r: 2.8; }
.rx-dot circle:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.rx-panel { min-width: 0; }

/* ── RES-14 · client, server, tools ────────────────────────────────── */
.rx-mcp { display: flex; align-items: stretch; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.rx-mcp__part {
  font: inherit; flex: 1 1 130px; min-width: 0;
  display: grid; gap: 3px; text-align: left;
  padding: 14px; border-radius: 10px; cursor: pointer;
  background: var(--cream); border: 1px solid var(--rule);
}
.rx-mcp__part[aria-expanded="true"] { background: var(--warm); border-color: var(--rule-2); }
.rx-mcp__name { font-weight: 600; font-size: 0.95rem; }
.rx-mcp__sub { font-size: 0.78rem; color: var(--mid); }
.rx-mcp__link { align-self: center; color: var(--mid); }
.rx-mcp__note { padding: 16px; background: var(--cream); border-radius: 10px; }
.rx-mcp__note p { margin: 0; font-size: 0.92rem; line-height: 1.6; }

/* ── RES-06 · taxonomy ─────────────────────────────────────────────── */
.rx-types { display: grid; gap: 8px; }
.rx-type { background: var(--cream); border-radius: 10px; overflow: hidden; }
.rx-type__head {
  font: inherit; width: 100%; cursor: pointer;
  display: grid; grid-template-columns: 1fr 90px auto; align-items: center; gap: 14px;
  padding: 13px 16px; text-align: left; background: none;
}
.rx-type__name { font-size: 0.95rem; font-weight: 500; }
.rx-type__meter {
  height: 5px; border-radius: 3px;
  background: linear-gradient(to right, var(--orange) calc(var(--lv) * 100%), var(--warm-2) calc(var(--lv) * 100%));
}
.rx-type__autonomy { font-size: 0.8rem; color: var(--mid); }
.rx-type__body { display: none; padding: 0 16px 16px; }
.rx-type[data-open="true"] .rx-type__body { display: block; }
.rx-type[data-open="true"] { background: var(--warm); }
.rx-facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0 0 10px; font-size: 0.88rem; }
.rx-facts dt { color: var(--mid); }
.rx-facts dd { margin: 0; }
.rx-eg { margin: 0; font-size: 0.9rem; line-height: 1.6; }

/* ── RES-04 · rules vs a model ─────────────────────────────────────── */
.rx-toggle { display: inline-flex; gap: 4px; padding: 4px; background: var(--cream); border-radius: 999px; margin-bottom: 18px; }
.rx-toggle__btn {
  font: inherit; font-size: 0.88rem; padding: 8px 20px;
  border-radius: 999px; cursor: pointer; background: none;
}
.rx-toggle__btn[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.rx-scene { padding: 16px; background: var(--cream); border-radius: 10px; margin-bottom: 18px; }
.rx-scene__body { margin: 0; font-size: 0.93rem; line-height: 1.65; }
.rx-compare { display: grid; gap: 2px; }
.rx-compare__row {
  display: grid; grid-template-columns: 160px 1fr 1fr; gap: 14px;
  padding: 10px 14px; font-size: 0.88rem; background: var(--cream);
}
.rx-compare__row:first-child { border-radius: 8px 8px 0 0; }
.rx-compare__row:last-child { border-radius: 0 0 8px 8px; }
.rx-compare__dim { color: var(--mid); }
.rx-compare__row[data-side="a"] .rx-compare__a,
.rx-compare__row[data-side="b"] .rx-compare__b { color: var(--ink); font-weight: 500; }
.rx-compare__row[data-side="a"] .rx-compare__b,
.rx-compare__row[data-side="b"] .rx-compare__a { color: var(--warm-2); }

/* ── narrow screens ────────────────────────────────────────────────── */
@media (max-width: 780px) {
  [data-artefact][data-ready="true"] { padding: 18px; }
  [data-artefact="vector"][data-ready="true"] { grid-template-columns: 1fr; }
  .rx-stages { flex-direction: column; align-items: stretch; }
  .rx-stages .rx-arrow { display: none; }
  .rx-stage { justify-content: flex-start; }
  .rx-compare__row { grid-template-columns: 1fr; gap: 3px; }
  .rx-compare__row[data-side="a"] .rx-compare__b,
  .rx-compare__row[data-side="b"] .rx-compare__a { display: none; }
  .rx-dot circle { r: 2.2; }
  .rx-dot[data-state="on"] circle { r: 3.4; }
  .rx-hit { grid-template-columns: 1fr auto; }
  .rx-hit__bar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rx-results .rx-hit { animation: none; }
  .rx-dot circle { transition: none; }
}
