/* Relay "Try me" demo, embedded in /relay/about.html. Everything is scoped to .rd.
   Nothing talks to a server: the response is a real one, captured on 28 Sep 2026.
   It sits inside the article's glass card, so it's a bordered panel rather than glass, and its
   breakpoints follow its own width (container queries) rather than the window's. */
.rd {
  --field: rgba(255, 255, 255, 0.7);
  --accent-mid: rgba(36, 81, 214, 0.16);
  --on-accent: #fff;
  --ok-c: #0e9f6e; --ok-soft: rgba(16, 185, 129, 0.13);
  --bad-c: #dc2626; --bad-soft: rgba(239, 68, 68, 0.12);
  --warn: #b45309; --warn-soft: rgba(245, 158, 11, 0.16);
  --j-key: #2451d6; --j-str: #0f7a55; --j-num: #b4460f; --j-lit: #7c3aed;
}
:root[data-theme="dark"] .rd {
  --field: rgba(8, 14, 28, 0.55);
  --accent-mid: rgba(111, 169, 244, 0.2);
  --on-accent: #06101f;
  --ok-c: #34d399; --ok-soft: rgba(52, 211, 153, 0.14);
  --bad-c: #f87171; --bad-soft: rgba(248, 113, 113, 0.14);
  --warn: #fbbf24; --warn-soft: rgba(251, 191, 36, 0.14);
  --j-key: #8dbcf7; --j-str: #6ee7b7; --j-num: #fdba74; --j-lit: #c4b5fd;
}
.rd { container-type: inline-size; margin: 1.25rem 0 0; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; font-size: 14px; line-height: 1.5; color: var(--text); }
@media (max-width: 600px) { .rd { padding: 12px; border-radius: var(--radius); } }
/* Undo the article's prose styles inside the demo. */
.content .rd p { margin: 0; font-size: inherit; line-height: inherit; }
.content .rd code { padding: 0; background: none; border-radius: 0; font-size: inherit; color: inherit; }
.rd button, .rd input, .rd select { font: inherit; color: inherit; }
.rd .mono { font-family: var(--font-mono); }
.rd .muted { color: var(--muted); }
.rd .small { font-size: .78rem; }
.rd .rd-title { display: block; font-size: 1.05rem; font-weight: 650; text-wrap: balance; }
.rd .rd-label { font-size: .72rem; font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
.rd .sub { color: var(--text-2); max-width: 64ch; margin-top: 4px; }

/* Stepper */
.rd .stepper-wrap { overflow-x: auto; margin: -4px -6px 20px; padding: 4px 6px; scrollbar-width: none; }
.rd .stepper { display: flex; gap: 6px; }
.rd .step { flex: 1 0 118px; display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; cursor: pointer; text-align: left; transition: background .15s, border-color .15s; }
.rd .step:hover { background: var(--accent-soft); }
.rd .step .n { width: 26px; height: 26px; flex: none; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); font-size: .75rem; border: 1px solid var(--line-strong); color: var(--accent); }
.rd .step .t { display: grid; line-height: 1.2; }
.rd .step .t b { font-size: .84rem; font-weight: 600; }
.rd .step .t small { font-size: .72rem; color: var(--muted); white-space: nowrap; }
.rd .step.done .n { background: var(--accent-soft); }
.rd .step.active { background: var(--glass-strong); border-color: var(--glass-border); box-shadow: var(--shadow-sm); }
.rd .step.active .n { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.rd .head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.rd .foot { display: flex; justify-content: space-between; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); flex-wrap: wrap; align-items: center; }
.rd .row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.rd .stack { display: grid; gap: 14px; align-content: start; min-width: 0; }
.rd .split { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 680px) { .rd .split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }

/* Forms */
.rd .form { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; }
.rd .fld { display: grid; gap: 6px; min-width: 0; align-content: start; grid-column: span 12; }
@container (min-width: 560px) { .rd .s6 { grid-column: span 6; } .rd .s4 { grid-column: span 4; } .rd .s8 { grid-column: span 8; } }
.rd .lbl { font-size: .74rem; font-weight: 600; color: var(--text-2); }
.rd .hint { font-size: .74rem; color: var(--muted); }
.rd .err { font-size: .78rem; color: var(--bad-c); }
.rd .input { width: 100%; min-width: 0; padding: 9px 12px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--field); outline: none; transition: border-color .15s, box-shadow .15s; }
.rd .input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px var(--accent-soft); }
.rd .input.sm { padding: 5px 9px; font-size: .8rem; border-radius: var(--radius); width: auto; }
.rd .joined { display: flex; min-width: 0; }
.rd .joined > :first-child { border-top-right-radius: 0; border-bottom-right-radius: 0; width: auto; flex: none; }
.rd .joined > :last-child { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: none; flex: 1; }
.rd .seg { display: inline-flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: var(--radius); background: var(--field); border: 1px solid var(--line); }
.rd .seg button { border: none; background: transparent; padding: 6px 12px; border-radius: var(--radius); font-size: .82rem; color: var(--text-2); cursor: pointer; }
.rd .seg button:hover { color: var(--text); }
.rd .seg button.on { background: var(--glass-strong); color: var(--text); box-shadow: var(--shadow-sm); font-weight: 600; }

.rd .rd-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 16px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-strong); font-size: .84rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: transform .1s, border-color .15s, opacity .15s; }
.rd .rd-btn:hover { border-color: var(--line-strong); }
.rd .rd-btn:active { transform: translateY(1px); }
.rd .rd-btn:disabled { opacity: .45; cursor: not-allowed; }
.rd .rd-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.rd .rd-btn.sm { padding: 5px 11px; font-size: .76rem; }
.rd .rd-btn.ghost { background: transparent; }
.rd .iconbtn { border: none; background: transparent; color: var(--muted); cursor: pointer; width: 26px; height: 26px; border-radius: 8px; flex: none; display: inline-grid; place-items: center; }
.rd .iconbtn:hover { background: var(--accent-soft); color: var(--text); }
.rd .iconbtn:disabled { opacity: .3; cursor: default; }

.rd .rd-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: .78rem; background: var(--accent-soft); color: var(--text-2); white-space: nowrap; }
.rd .rd-pill .rd-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.rd .rd-pill.ok { background: var(--ok-soft); color: var(--ok-c); } .rd .rd-pill.ok .rd-dot { background: var(--ok-c); box-shadow: 0 0 0 3px var(--ok-soft); }
.rd .rd-pill.warn { background: var(--warn-soft); color: var(--warn); }
.rd .status { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; padding: 2px 7px; border-radius: 6px; background: var(--ok-soft); color: var(--ok-c); }
.rd .note { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); font-size: .82rem; color: var(--text-2); }
.rd .note b { color: var(--text); }
.rd .spin { display: inline-block; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--accent); animation: rd-spin .7s linear infinite; vertical-align: middle; }
@keyframes rd-spin { to { rotate: 360deg; } }

/* Boxes, JSON and the field tree */
.rd .box { border-radius: var(--radius); border: 1px solid var(--line); background: var(--field); min-width: 0; }
.rd .box-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.rd .scroll { overflow: auto; max-height: 460px; }
.rd .json { font-family: var(--font-mono); font-size: .78rem; line-height: 1.65; padding: 12px 0; white-space: pre; min-width: max-content; }
.rd .json .ln { padding: 0 16px; }
.rd .json .k { color: var(--j-key); } .rd .json .s { color: var(--j-str); } .rd .json .n { color: var(--j-num); } .rd .json .l { color: var(--j-lit); } .rd .json .p { color: var(--muted); }
.rd .json .hl { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.rd .tree { padding: 8px; font-size: .84rem; min-width: max-content; }
.rd .trow { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: var(--radius); }
.rd label.trow { cursor: pointer; }
.rd .trow:hover { background: var(--accent-soft); }
.rd .trow.picked { background: var(--accent-soft); }
.rd .trow .key { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; }
.rd .trow .sample { font-family: var(--font-mono); font-size: .76rem; color: var(--muted); }
.rd .trow input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; cursor: pointer; flex: none; }
.rd .trow .usedby { font-size: .72rem; color: var(--accent); font-weight: 600; white-space: nowrap; }
.rd .trow.suggest .key::after { content: "← try this"; margin-left: 8px; font-family: var(--font-body); font-weight: 600; font-size: .7rem; color: var(--warn); }
.rd .chev { width: 14px; color: var(--muted); font-size: .7rem; text-align: center; flex: none; }
.rd .type { font-family: var(--font-mono); font-size: .66rem; padding: 1px 7px; border-radius: 6px; border: 1px solid var(--line); color: var(--text-2); white-space: nowrap; }
.rd .type.number { color: var(--j-num); } .rd .type.string { color: var(--j-str); } .rd .type.object { color: var(--j-key); }

/* Transform */
.rd .fcard { border-radius: var(--radius); border: 1px solid var(--line); background: var(--field); padding: 14px 16px; display: grid; gap: 12px; }
.rd .fcard .top { display: flex; gap: 10px 14px; align-items: center; flex-wrap: wrap; }
.rd .fcard .top .input { width: 190px; font-family: var(--font-mono); font-size: .82rem; padding: 6px 10px; }
.rd .fcard .path { font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.rd .pipe { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.rd .chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 6px 5px 11px; border-radius: 999px; background: var(--glass-strong); border: 1px solid var(--line); font-size: .78rem; font-weight: 600; white-space: nowrap; }
.rd .chip.src { padding: 5px 11px; background: transparent; border-style: dashed; color: var(--muted); font-weight: 500; font-family: var(--font-mono); font-size: .72rem; }
.rd .chip.editing { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.rd .chip .lab { border: none; background: none; padding: 0; cursor: pointer; font-weight: 600; }
.rd .chip .x { width: 18px; height: 18px; border-radius: 50%; border: none; background: var(--accent-soft); cursor: pointer; font-size: .8rem; color: var(--text-2); display: grid; place-items: center; padding: 0; }
.rd .chip .x:hover { background: var(--bad-soft); color: var(--bad-c); }
.rd .to { color: var(--muted); font-size: .8rem; }
.rd .addop { padding: 5px 8px; border-radius: var(--radius); border: 1px dashed var(--line-strong); background: transparent; font-size: .76rem; cursor: pointer; }
.rd .addop.nudge { border-color: var(--warn); box-shadow: 0 0 0 3px var(--warn-soft); }
.rd .editor { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); font-size: .82rem; }
.rd .arg { display: inline-flex; gap: 6px; align-items: center; font-size: .78rem; color: var(--text-2); }
.rd .preview { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-family: var(--font-mono); font-size: .78rem; }
.rd .preview .before { color: var(--muted); overflow-wrap: anywhere; }
.rd .preview .after { font-weight: 700; padding: 2px 8px; border-radius: 8px; background: var(--accent-soft); }

/* Shape */
.rd .builder { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
@container (min-width: 600px) { .rd .builder { grid-template-columns: 190px minmax(0, 1fr); } .rd .builder > :last-child { grid-column: 1 / -1; } }
@container (min-width: 980px) { .rd .builder { grid-template-columns: 210px minmax(0, 1.1fr) minmax(0, 1fr); } .rd .builder > :last-child { grid-column: auto; } }
.rd .palette { display: grid; gap: 6px; align-content: start; padding: 12px; grid-template-columns: minmax(0, 1fr); }
.rd .pitem { display: flex; align-items: center; gap: 8px; padding: 7px 8px 7px 10px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--glass-strong); font-size: .8rem; min-width: 0; }
.rd .pitem.used { opacity: .55; }
.rd .pitem .nm { font-family: var(--font-mono); font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rd .pitem .add { border: none; background: var(--accent-soft); color: var(--accent); border-radius: 8px; width: 24px; height: 24px; cursor: pointer; font-weight: 700; flex: none; }
.rd .otree { padding: 10px; display: grid; gap: 6px; grid-template-columns: minmax(0, 1fr); }
.rd .onode { display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 10px; border-radius: var(--radius); background: var(--glass-strong); border: 1px solid var(--line); min-width: 0; }
.rd .onode input { flex: 1; width: 0; min-width: 48px; border: none; background: transparent; font-family: var(--font-mono); font-size: .8rem; font-weight: 600; padding: 3px 4px; border-radius: 6px; }
.rd .onode input:focus { outline: none; background: var(--accent-soft); }
.rd .onode .from { font-size: .72rem; color: var(--muted); white-space: nowrap; }
@container (max-width: 480px) { .rd .onode .from { display: none; } }
.rd .empty { font-size: .78rem; color: var(--muted); padding: 14px; text-align: center; border: 1.5px dashed var(--line); border-radius: var(--radius); }

/* Publish */
.rd .url-hero { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 14px 16px; border-radius: var(--radius); background: var(--field); border: 1px solid var(--line); }
.rd .url-hero .method { font-family: var(--font-mono); font-size: .72rem; font-weight: 700; padding: 3px 8px; border-radius: 7px; background: var(--ok-soft); color: var(--ok-c); }
.rd .url-hero code { font-family: var(--font-mono); font-size: .9rem; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.rd .term { border-radius: var(--radius); background: var(--code-bg); color: var(--code-text); font-family: var(--font-mono); font-size: .78rem; line-height: 1.65; padding: 14px 16px; overflow-x: auto; white-space: pre; }
.rd .term .c { color: #7f93b5; }
.rd .term .g { color: #6ee7b7; }
.rd .chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
