/* Fieldwork relay (relay.js): the PC → phone → PC round trip drawn as one walking line that steps out into the field
   lane (dashed: away from the lab server) and back. On a wide desktop it takes the directory's column while the
   directory steps aside, so the wave field stays whole beside it; on a phone it is a sheet under the field; narrow or
   short windows give it the screen. Text follows the reader's scale and wraps; the sheet scrolls, it never shrinks. */
.lab-relay { --relay-bg: var(--paper); position: absolute; z-index: 7; display: flex; flex-direction: column; min-height: 0; color: var(--ink); font: 400 var(--t2)/1.5 var(--f-ui); animation: rl-in 320ms var(--out); }
.lab-relay[hidden] { display: none; }
.lab-relay [hidden] { display: none !important; }
.lab-relay[data-mode="column"] { left: 32px; top: 80px; bottom: 16px; width: min(var(--dir-w), 44vw); }
.lab-relay[data-mode="band"], .lab-relay[data-mode="full"] { position: fixed; }
.lab-relay[data-mode="band"] { --relay-bg: var(--paper-hi); left: 0; right: 0; top: var(--relay-top, 38dvh); bottom: 0; background: var(--relay-bg); border-top: 1px solid var(--rule-2); box-shadow: 0 -20px 40px -30px rgb(0 0 0 / .4); animation-name: rl-up; }
.lab-relay[data-mode="full"] { inset: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); background: var(--relay-bg); animation-name: rl-up; }
@keyframes rl-in { from { opacity: 0; transform: translateX(-16px); } }
@keyframes rl-up { from { opacity: 0; transform: translateY(18px); } }
:root[data-motion="reduced"] .lab-relay { animation: none; }
/* the directory gives its column to the relay and comes back when it closes */
.lab[data-relay="column"] .lab-index { opacity: 0; transform: translateX(-32px); pointer-events: none; }
.lab[data-state="departing"] .lab-relay { opacity: 0; pointer-events: none; transition: opacity 380ms var(--ease); }

/* ---------- bar: the way back, then what this is ---------- */
.rl-bar { flex: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 0 12px 14px 0;
  background: repeating-linear-gradient(90deg, var(--rule-2) 0 1px, transparent 1px 8px) left bottom / 100% 5px no-repeat; }
.lab-relay:not([data-mode="column"]) .rl-bar { padding: 10px 16px 14px; border-bottom: 1px solid var(--rule); }
.rl-back { flex: none; display: inline-flex; align-items: center; gap: .5rem; min-height: 44px; padding: 0 .875rem 0 .5rem; font: 650 var(--t2)/1.1 var(--f-ui); color: var(--signal-ink); background: var(--signal); border: 0; border-radius: 999px; box-shadow: inset 0 0 0 1px rgb(18 20 18 / .14); cursor: pointer; transition: box-shadow 160ms var(--ease); }
.rl-back:hover { box-shadow: inset 0 0 0 1px rgb(18 20 18 / .2), 0 0 0 3px color-mix(in oklab, var(--signal) 38%, transparent); }
.rl-back:focus-visible { outline-color: var(--ink); }
.rl-back .i { width: var(--ic); height: var(--ic); transform: rotate(180deg); }
.rl-kicker { display: flex; align-items: baseline; gap: 8px; min-width: 0; margin: 0; font: 600 var(--t1)/1.3 var(--f-ui); color: var(--ink-2); }

.rl-scroll { flex: 1; min-height: 0; overflow: auto; overscroll-behavior: contain; scrollbar-width: thin; padding: 18px 12px 24px 0; }
.lab-relay:not([data-mode="column"]) .rl-scroll { padding: 20px 20px calc(28px + env(safe-area-inset-bottom)); }
.lab-relay[data-mode="full"] .rl-scroll > * { max-width: 42rem; margin-inline: auto; }

/* ---------- head: what is selected and what this guide is (and is not) ---------- */
.rl-head { padding: 0 0 22px; }
.rl-title { margin: 0 0 12px; font: 600 var(--t3)/1.1 var(--f-display); letter-spacing: -.01em; text-wrap: balance; }
.rl-title:focus { outline: none; } /* focus lands here on open; it is a heading, not a control */
.rl-k { font: 600 var(--t1)/1.35 var(--f-ui); color: var(--ink-3); }
.rl-project { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin: 0 0 12px; font: 400 var(--t1)/1.4 var(--f-ui); }
.rl-pname { min-width: 0; font-weight: 650; color: var(--ink); overflow-wrap: anywhere; }
.rl-change { margin: -10px 0; padding: 10px 4px; font: inherit; color: var(--ink-2); background: none; border: 0; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.rl-change:hover { color: var(--ink); }
.rl-model { max-width: 36em; margin: 0; color: var(--ink-2); }

/* ---------- the track: one line, two lanes ---------- */
.rl-track { --pc: 9px; --app: 33px; list-style: none; margin: 0; padding: 0; }
.rl-leg { --x: var(--pc); position: relative; padding: 0 0 30px 36px; }
.rl-leg[data-lane="app"] { --x: var(--app); padding-left: 60px; }
.rl-leg::before { content: ""; position: absolute; left: calc(var(--x) - 1px); top: 0; bottom: 0; border-left: 2px solid var(--ink-3); }
.rl-leg[data-lane="app"]::before { border-left-style: dashed; }
.rl-leg:first-child::before { top: 14px; }
.rl-leg:last-child { padding-bottom: 20px; }
.rl-leg:last-child::before { bottom: auto; height: 14px; }
/* the step out into the field lane, and the step back */
.rl-leg + .rl-leg::after { content: ""; position: absolute; top: -1px; left: calc(var(--pc) - 1px); width: calc(var(--app) - var(--pc) + 2px); border-top: 2px solid var(--ink-3); }
.rl-leg[data-lane="app"] + .rl-leg::after { border-top-style: dashed; }
.rl-node { position: absolute; left: calc(var(--x) - 7px); top: 7px; width: 14px; height: 14px; box-sizing: border-box; border: 2px solid var(--ink); border-radius: 50%; background: var(--relay-bg); }
.rl-leg:first-child .rl-node { background: var(--ink); }
.rl-leg[data-lane="app"] .rl-node { background: var(--signal); }
.rl-lane { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-height: 28px; margin: 0 0 2px; font: 500 var(--t1)/1.2 var(--f-num); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.rl-tag { padding: 3px 9px; font: 650 var(--t1)/1.15 var(--f-ui); letter-spacing: 0; text-transform: none; color: var(--signal-ink); background: var(--signal); border-radius: 999px; }
.rl-name { margin: 0 0 6px; font: 600 calc(var(--t2) * 1.3)/1.2 var(--f-display); text-wrap: balance; }
.rl-text { max-width: 36em; margin: 0 0 12px; color: var(--ink-2); }
.rl-leg .task { max-width: 32rem; }
.rl-leg .task-primary { margin-top: 4px; }

/* ---------- leg 2: steps on the phone ---------- */
.rl-steps { counter-reset: rl; display: grid; gap: 12px; max-width: 36em; margin: 6px 0 16px; padding: 0; list-style: none; }
.rl-steps > li { counter-increment: rl; position: relative; padding-left: 2.4em; }
.rl-steps > li::before { content: counter(rl, decimal-leading-zero); position: absolute; left: 0; top: .2em; font: 500 var(--t1)/1.3 var(--f-num); color: var(--ink-3); }
.rl-step { margin: 0 0 8px; font-weight: 600; }
.rl-addr { display: grid; gap: 6px; margin: 0 0 10px; padding: 10px 12px 12px; background: var(--paper-hi); border: 1px solid var(--rule-2); border-radius: 3px; }
.rl-url { font: 500 var(--t1)/1.45 var(--f-num); color: var(--ink); overflow-wrap: anywhere; user-select: all; }
.rl-addr-act { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.rl-copy { min-height: 36px; padding: 0 12px; font: 600 var(--t1)/1.1 var(--f-ui); color: var(--ink); background: transparent; border: 1px solid var(--rule-2); border-radius: 3px; cursor: pointer; }
.rl-copy:hover { background: var(--wash); }
.rl-copied { font: 400 var(--t1)/1.35 var(--f-ui); color: var(--ink-2); }
.rl-dl { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 14px 8px 12px; font: 650 var(--t2)/1.25 var(--f-ui); color: var(--on-slab); background: var(--slab); border-radius: 3px; text-decoration: none; transition: box-shadow 160ms var(--ease); }
.rl-dl:hover, .rl-dl:focus-visible { box-shadow: inset 3px 0 0 var(--signal); }
.rl-dl .i { flex: none; width: var(--ic); height: var(--ic); }
/* on a PC the address is what matters; the file itself is the quieter option */
.lab-relay:not([data-device="phone"]) .rl-dl { font-weight: 600; font-size: var(--t1); color: var(--ink); background: transparent; box-shadow: inset 0 0 0 1px var(--rule-2); }
.lab-relay:not([data-device="phone"]) .rl-dl:hover, .lab-relay:not([data-device="phone"]) .rl-dl:focus-visible { background: var(--wash); box-shadow: inset 0 0 0 1px var(--rule-2), inset 3px 0 0 var(--signal); }
.rl-fine { max-width: 36em; margin: 8px 0 0; font: 400 var(--t1)/1.45 var(--f-ui); color: var(--ink-3); }
.rl-inapp { margin: 0; padding: 10px 12px; color: var(--ink); background: var(--wash); border-left: 3px solid var(--signal); }

/* what the phone's side cannot do, and what this page cannot know */
.rl-facts { display: grid; gap: 8px; max-width: 36em; margin: 0 0 18px; }
.rl-facts > div { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 3px; }
.rl-facts [data-tone="limit"] { border-left: 3px solid var(--alert); }
.rl-facts [data-tone="unknown"] { border-left: 3px dashed var(--ink-3); }
.rl-facts dt { display: flex; align-items: center; gap: 8px; font: 650 var(--t1)/1.35 var(--f-ui); }
.rl-facts dt .i { flex: none; width: var(--ic); height: var(--ic); color: var(--ink-3); }
.rl-facts dd { margin: 0; font: 400 var(--t1)/1.45 var(--f-ui); color: var(--ink-2); }
.rl-notes ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 0; padding: 0; list-style: none; }
.rl-note { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; font: 500 var(--t1)/1.25 var(--f-ui); color: var(--ink); border: 1px solid var(--rule-2); border-radius: 999px; text-decoration: none; }
.rl-note:hover, .rl-note:focus-visible { background: var(--wash); }

/* ---------- leg 3: what the lab server holds, then the real destinations ---------- */
.rl-server { margin: 0 0 10px; }
.rl-server dl { display: flex; flex-wrap: wrap; gap: 4px 24px; margin: 4px 0 0; }
.rl-server dl > div { display: flex; align-items: baseline; gap: 8px; }
.rl-server dt { order: 2; font: 400 var(--t1)/1.3 var(--f-ui); color: var(--ink-2); }
.rl-server dd { order: 1; margin: 0; font: 600 var(--t2)/1.2 var(--f-num); }
.rl-gos { max-width: 32rem; margin: 0 0 14px; padding: 0; list-style: none; }
.rl-files { max-width: 36em; margin: 0; padding-top: 12px; font: 400 var(--t1)/1.5 var(--f-ui); color: var(--ink-2); border-top: 1px solid var(--rule); }
.rl-files b { font-weight: 650; color: var(--ink); }

.rl-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; padding-top: 16px; border-top: 1px solid var(--rule-2); }
.rl-done { min-height: 44px; padding: 0 16px; font: 650 var(--t2)/1.1 var(--f-ui); color: var(--ink); background: transparent; border: 1px solid var(--rule-2); border-radius: 999px; cursor: pointer; }
.rl-done:hover { background: var(--wash); }
@media (pointer: coarse) { .rl-copy, .rl-note { min-height: 44px; } }
