/* ============================================================
   Eagre — the Workbench device + the three demos
   ============================================================ */

.workbench {
  position: relative;
  z-index: 4;
  width: min(94vw, 980px);
  height: min(100%, 600px);
  min-height: 360px;
  display: flex;
  flex-direction: column;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), transparent 30%),
    var(--surface);
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* device header ------------------------------------------- */
.wb-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
  flex-shrink: 0;
}
.wb-led {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 70%, transparent);
  animation: led 2.6s ease-out infinite;
  flex-shrink: 0;
}
@keyframes led {
  0%   { box-shadow: 0 0 0 0 color-mix(in oklab, var(--accent) 55%, transparent); }
  70%  { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}
.wb-title {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}
.wb-title b { color: var(--text); font-weight: 600; }
.wb-spec {
  margin-left: auto;
  display: flex; gap: 16px;
  font-size: 11px;
  color: var(--text-mute);
}
.wb-spec span b { color: var(--accent); font-weight: 600; }
@media (max-width: 680px) { .wb-spec { display: none; } }

/* tab rail ------------------------------------------------- */
.wb-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.wb-tabs::-webkit-scrollbar { display: none; }
.wb-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1px;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-mute);
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  transition: color .16s, background .16s, border-color .16s, transform .12s;
  white-space: nowrap;
  flex-shrink: 0;
}
.wb-tab:hover { color: var(--text-dim); background: var(--surface); }
.wb-tab[aria-selected="true"] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border-2);
}
.wb-tab .nm {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.wb-tab .ds {
  font-size: 10.5px;
  color: var(--text-mute);
  letter-spacing: 0.01em;
}
.wb-tab[aria-selected="true"] .ds { color: var(--accent-2); }
.wb-tab:active { transform: translateY(1px); }

/* demo body ------------------------------------------------ */
.wb-body {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
}
.demo {
  display: none;
  flex: 1;
  min-width: 0;
  min-height: 0;
  position: relative;
}
.demo.active {
  display: flex;
  animation: demoin .3s ease;
}
@keyframes demoin {
  from { opacity: 0; transform: translateY(8px) scale(0.995); }
  to   { opacity: 1; transform: none; }
}

/* live demo, revealed once the cover is lifted */
.demo-live {
  display: flex;
  flex: 1;
  min-width: 0;
  min-height: 0;
  width: 100%;
}

/* ---------- demo cover (the wrapper visitors unwrap) ---------- */
.cover {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  overflow: auto;
  z-index: 3;
  background:
    radial-gradient(820px 360px at 50% -12%, color-mix(in oklab, var(--accent) 10%, transparent), transparent 62%),
    linear-gradient(180deg, var(--surface-2), var(--bg-2));
}
.cover--lift {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  animation: coverlift .48s cubic-bezier(.4, 0, .2, 1) forwards;
}
@keyframes coverlift {
  to { opacity: 0; transform: translateY(-16px) scale(1.015); }
}
.cover-inner {
  margin: 0 auto;
  width: 100%;
  max-width: 560px;
  padding: clamp(22px, 3.4vw, 40px);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 13px;
}
.cover-kick {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.cover-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(32px, 4.8vw, 48px);
  line-height: 0.98;
  letter-spacing: -0.025em;
  color: var(--text);
}
.cover-tag {
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.01em;
  color: var(--accent);
}
.cover-blurb {
  margin: 2px 0 0;
  max-width: 52ch;
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-dim);
  text-wrap: pretty;
}
.cover-specs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.cover-spec {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  border: 1px solid var(--border);
  background: color-mix(in oklab, var(--surface) 55%, transparent);
  padding: 4px 11px;
  border-radius: 999px;
}
.cover-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 6px;
}
.cover-open {
  font-size: 13px;
  padding: 11px 18px;
}
.cover-open-ic { font-size: 11px; }
.cover-repo {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .16s, border-color .16s;
}
.cover-repo:hover {
  color: var(--accent);
  border-bottom-color: color-mix(in oklab, var(--accent) 50%, transparent);
}
.cover-foot {
  margin-top: 2px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.02em;
  color: var(--text-mute);
}

/* ---------- "how it works" hint (shown briefly before the demo unlocks) ---------- */
.demo-hint {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: pointer;
  background: color-mix(in oklab, var(--bg) 72%, transparent);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  animation: hintin .3s ease both;
}
.demo-hint--out {
  pointer-events: none;
  animation: hintout .4s ease both;
}
@keyframes hintin  { from { opacity: 0; } to { opacity: 1; } }
@keyframes hintout { from { opacity: 1; } to { opacity: 0; } }
.demo-hint-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  max-width: 440px;
  text-align: center;
  animation: hintcard .42s cubic-bezier(.2, .7, .2, 1) both;
}
@keyframes hintcard {
  from { opacity: 0; transform: translateY(9px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.demo-hint-kick {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-mute);
}
.demo-hint-text {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  text-wrap: pretty;
}
.demo-hint-text b { color: var(--accent); font-weight: 600; }
.demo-hint-bar {
  width: 132px;
  height: 3px;
  border-radius: 2px;
  background: color-mix(in oklab, var(--text) 13%, transparent);
  overflow: hidden;
}
.demo-hint-bar span {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  animation: hintfill 6s linear forwards;
}
@keyframes hintfill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.demo-hint-skip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.04em;
  color: var(--text-mute);
}

/* shared split layout */
.split { display: flex; width: 100%; min-height: 0; }
.pane { flex: 1; min-width: 0; display: flex; flex-direction: column; min-height: 0; }
.pane + .pane { border-left: 1px solid var(--border); }
.pane-head {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-mute);
  border-bottom: 1px solid var(--border);
  background: var(--bg-2);
  flex-shrink: 0;
}
.pane-head .tag {
  margin-left: auto;
  font-size: 10px;
  color: var(--accent-2);
  text-transform: none;
  letter-spacing: 0;
}
.pane-scroll { flex: 1; min-height: 0; overflow: auto; }

/* code editor textarea shared */
.editor {
  flex: 1;
  width: 100%;
  border: 0;
  outline: 0;
  resize: none;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.65;
  padding: 14px 16px;
  tab-size: 2;
}
.editor::placeholder { color: var(--text-mute); }

/* ---------- inkmd demo ---------- */
.ink-page {
  background: #f6f5f1;
  color: #1b1b1a;
  font-family: Helvetica, Arial, sans-serif;
  padding: 26px 30px;
  margin: 16px;
  border-radius: 4px;
  box-shadow: 0 18px 40px -18px rgba(0,0,0,0.7);
  font-size: 12.5px;
  line-height: 1.5;
  min-height: calc(100% - 32px);
}
.ink-page h1 { font-size: 21px; margin: 0 0 .5em; letter-spacing: -0.01em; }
.ink-page h2 { font-size: 16.5px; margin: 1.1em 0 .45em; }
.ink-page h3 { font-size: 13.5px; margin: 1em 0 .4em; }
.ink-page p  { margin: 0 0 .7em; }
.ink-page a  { color: #1a52c4; text-decoration: underline; }
.ink-page code {
  font-family: var(--font-mono);
  font-size: 11px;
  background: #e7e6e0;
  padding: 1px 4px; border-radius: 3px;
}
.ink-page pre {
  background: #eceae3;
  border-radius: 5px;
  padding: 11px 13px;
  overflow-x: auto;
  margin: 0 0 .8em;
}
.ink-page pre code { background: none; padding: 0; font-size: 11px; line-height: 1.5; }
.ink-page blockquote {
  margin: 0 0 .8em; padding: 2px 0 2px 13px;
  border-left: 3px solid #b9b7ad; color: #4a4a45;
}
.ink-page ul, .ink-page ol { margin: 0 0 .8em; padding-left: 1.4em; }
.ink-page li { margin: .15em 0; }
.ink-page hr { border: 0; border-top: 1px solid #cfcdc4; margin: 1.1em 0; }
.ink-page del { color: #8a8980; }
.ink-page table { border-collapse: collapse; width: 100%; margin: 0 0 .8em; font-size: 11.5px; }
.ink-page th { background: #e7e6e0; text-align: left; }
.ink-page th, .ink-page td { border: 1px solid #cfcdc4; padding: 5px 8px; }

/* control bar shared */
.ctl {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  flex-shrink: 0;
}
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-ink);
  background: var(--accent);
  border: 0;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  transition: transform .12s, filter .16s, box-shadow .16s;
  box-shadow: 0 4px 14px -6px var(--accent);
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn.ghost {
  color: var(--text-dim); background: var(--surface-2);
  border: 1px solid var(--border-2); box-shadow: none;
}
.btn.ghost:hover { color: var(--text); }
.chip {
  font-size: 11px; color: var(--text-mute);
  display: inline-flex; align-items: center; gap: 6px;
}
.chip b { color: var(--text-dim); font-weight: 500; }
.chip .hash { color: var(--accent-2); }
.spacer { margin-left: auto; }

/* ---------- nightjar demo ---------- */
.nj {
  display: flex; flex-direction: column; width: 100%; min-height: 0; height: 100%;
  background:
    radial-gradient(700px 300px at 80% -10%, rgba(53,214,200,0.05), transparent),
    var(--bg-2);
}
.nj-wrap { display: flex; flex: 1; width: 100%; min-height: 0; }
.nj-compose { width: 44%; display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--border); }
.nj-field {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-bottom: 1px solid var(--border);
  font-size: 12px; color: var(--text-dim);
}
.nj-field label { color: var(--text-mute); width: 38px; }
.nj-field .val { color: var(--text); }
.nj-sign {
  margin-left: auto; display: inline-flex; align-items: center; gap: 6px;
  font-size: 10.5px; padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--border-2); color: var(--text-dim);
  cursor: pointer; user-select: none; transition: all .16s;
}
.nj-sign.on  { color: var(--accent); border-color: color-mix(in oklab,var(--accent) 40%,transparent); background: color-mix(in oklab,var(--accent) 12%, transparent); }
.nj-sign.off { color: #e0795f; border-color: color-mix(in oklab,#e0795f 40%,transparent); background: color-mix(in oklab,#e0795f 12%, transparent); }
.nj-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }

.nj-log {
  flex: 1; min-width: 0; min-height: 0; overflow: auto;
  padding: 14px 16px; display: flex; flex-direction: column; gap: 9px;
}
.nj-step {
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 12px; color: var(--text-mute);
  opacity: 0; transform: translateX(-6px);
  transition: opacity .3s, color .3s, transform .3s;
}
.nj-step.show { opacity: 1; transform: none; }
.nj-step .ic {
  width: 16px; height: 16px; border-radius: 4px; flex-shrink: 0; margin-top: 1px;
  display: grid; place-items: center; font-size: 10px;
  border: 1px solid var(--border-2); color: var(--text-mute);
}
.nj-step.ok .ic   { color: var(--accent); border-color: color-mix(in oklab,var(--accent) 45%,transparent); background: color-mix(in oklab,var(--accent) 12%,transparent); }
.nj-step.ok       { color: var(--text-dim); }
.nj-step.fail .ic { color: #e0795f; border-color: color-mix(in oklab,#e0795f 45%,transparent); background: color-mix(in oklab,#e0795f 12%,transparent); }
.nj-step.fail     { color: #e0795f; }
.nj-step .mono { font-family: var(--font-mono); }
.nj-reply {
  margin-top: 4px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); padding: 12px 14px;
  font-size: 12.5px; line-height: 1.55; color: var(--text);
  opacity: 0; transform: translateY(8px); transition: opacity .35s, transform .35s;
}
.nj-reply.show { opacity: 1; transform: none; }
.nj-reply .from { font-size: 10.5px; color: var(--accent-2); margin-bottom: 6px; letter-spacing: .03em; }
.nj-reply .from.muted { color: var(--text-mute); }
.nj-reply .sig { margin-top: 9px; font-size: 10px; color: var(--text-mute); border-top: 1px dashed var(--border-2); padding-top: 8px; word-break: break-all; }
.nj-reply .nj-note { margin-top: 9px; font-size: 10.5px; color: var(--text-mute); border-top: 1px dashed var(--border-2); padding-top: 8px; line-height: 1.5; }

.nj-presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 4px; }
.nj-preset {
  font-size: 10.5px; color: var(--text-dim);
  border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 4px 10px; transition: all .14s;
}
.nj-preset:hover { color: var(--text); border-color: var(--border-2); }

/* sender role selector */
.nj-roles {
  display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px;
}
.nj-roles button {
  border: 0; background: transparent; color: var(--text-mute);
  font-family: var(--font-mono); font-size: 10.5px;
  padding: 4px 9px; border-radius: 6px; transition: color .14s, background .14s;
}
.nj-roles button:hover { color: var(--text-dim); }
.nj-roles button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }
.nj-addr {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px 2px; font-size: 11px;
}
.nj-addr .who { color: var(--text-dim); font-family: var(--font-mono); }
.nj-addr .scope { color: var(--text-mute); }
.nj-addr .scope.danger { color: #e0795f; }

/* ---------- torch demo ---------- */
.torch { width: 100%; }
.gba {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 6px),
    var(--bg);
  padding: 18px;
}
.gba-screen {
  width: 100%; max-width: 360px; aspect-ratio: 3 / 2;
  border-radius: 10px;
  border: 2px solid #2c333d;
  background: linear-gradient(180deg, #11201d, #0b1614);
  box-shadow: 0 0 0 6px #161a20, 0 22px 40px -18px rgba(0,0,0,.8), inset 0 0 40px rgba(0,0,0,.5);
  position: relative; overflow: hidden;
  display: flex; flex-direction: column;
  font-family: var(--font-mono);
}
.gba-map {
  flex: 1; position: relative;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(7, 1fr);
  gap: 0; padding: 8px;
}
.gba-tile { box-shadow: inset 0 0 0 1px rgba(0,0,0,0.18); }
.gba-actors { position: absolute; inset: 8px; pointer-events: none; }
.gba-npc {
  position: absolute; width: 9%; aspect-ratio: 1; border-radius: 3px;
  transform: translate(-50%, -50%);
  background: var(--accent); box-shadow: 0 0 10px color-mix(in oklab,var(--accent) 60%,transparent);
  transition: left .5s cubic-bezier(.5,.1,.2,1), top .5s cubic-bezier(.5,.1,.2,1);
  display: grid; place-items: center; color: var(--accent-ink); font-size: 8px; font-weight: 700;
}
.gba-box {
  position: absolute; left: 8px; right: 8px; bottom: 8px;
  min-height: 30%;
  border: 2px solid #3a4654;
  border-radius: 7px;
  background: rgba(8,16,15,0.94);
  padding: 9px 11px;
  font-size: 11px; line-height: 1.5; color: #cfeee9;
}
.gba-box .gba-who { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.gba-box .who {
  display: inline-block; background: var(--accent); color: var(--accent-ink);
  font-size: 9px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px;
}
.gba-box .got { font-size: 9px; color: var(--accent-2); }
.gba-box .tri {
  position: absolute; right: 9px; bottom: 7px;
  width: 0; height: 0; border-left: 5px solid transparent; border-right: 5px solid transparent;
  border-top: 6px solid var(--accent); animation: blink 1s steps(2) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
@keyframes fadein { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* TorScript syntax reference (under the editor) */
.tor-ref {
  border-top: 1px solid var(--border);
  background: var(--bg-2);
  padding: 11px 14px 12px;
  flex-shrink: 0;
}
.tor-ref h5 {
  margin: 0 0 8px; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--text-dim); font-weight: 600;
}
.tor-ref-grid { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: baseline; }
.tor-ref-grid code { font-family: var(--font-mono); font-size: 11px; color: var(--accent-2); white-space: nowrap; }
.tor-ref-grid span { font-size: 11px; color: var(--text-mute); }

/* segmented toggle in the preview pane head */
.tor-seg {
  margin-left: auto; display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 2px;
}
.tor-seg button {
  border: 0; background: transparent; color: var(--text-mute);
  font-family: var(--font-mono); font-size: 10.5px; text-transform: none; letter-spacing: 0;
  padding: 4px 10px; border-radius: 6px; transition: color .14s, background .14s;
}
.tor-seg button:hover { color: var(--text-dim); }
.tor-seg button[aria-pressed="true"] { background: var(--surface-3); color: var(--text); }

/* compiled poryscript output */
.tor-pory {
  flex: 1; min-height: 0; overflow: auto; margin: 0;
  padding: 15px 17px; background: var(--bg);
  font-family: var(--font-mono); font-size: 12px; line-height: 1.7;
  color: #aeb7c2; white-space: pre; tab-size: 4;
}
.tor-pory .k { color: var(--accent); }
.tor-pory .s { color: #e7ebf1; }
.tor-pory .n { color: var(--accent-2); }
.tor-pory .c { color: var(--text-mute); font-style: italic; }

/* decompile caption */
.tor-cap {
  font-size: 11px; line-height: 1.55; color: var(--text-mute);
  padding: 11px 14px 13px; border-top: 1px solid var(--border);
  background: var(--bg-2); flex-shrink: 0;
}
.tor-cap b { color: var(--text-dim); font-weight: 600; }

/* preview: read-only stepping source with a debugger-style gutter arrow */
.tor-run {
  flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden;
  background: var(--bg); padding: 12px 0;
  font-family: var(--font-mono); font-size: 12px; line-height: 1.75;
}
.tor-row { display: flex; align-items: flex-start; }
.tor-gutter {
  width: 24px; flex-shrink: 0; text-align: center;
  color: var(--accent); font-weight: 700; user-select: none;
}
.tor-code { white-space: pre; padding-right: 14px; color: #aeb7c2; }
.tor-edit {
  margin-left: auto; border: 1px solid var(--border-2); background: var(--surface-2);
  color: var(--text-dim); font-family: var(--font-mono); font-size: 10.5px;
  text-transform: none; letter-spacing: 0; padding: 4px 12px; border-radius: 7px;
  transition: color .14s, border-color .14s;
}
.tor-edit:hover { color: var(--text); border-color: var(--border); }

/* second sprite — the static player protagonist */
.gba-npc.player {
  background: #d7dde6; color: #1a1f28;
  box-shadow: 0 0 8px rgba(215,221,230,0.4);
}
.gba-box .sys { color: var(--accent); font-weight: 600; }

.stage.no-grid::before { display: none; }

/* small helper */
.kbd {
  font-size: 10px; color: var(--text-mute);
  border: 1px solid var(--border-2); border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 5px; background: var(--surface);
}
