﻿/* ===== JHbot: pixel guide poured from the hero portrait ===== */
.portrait__pixel { display: none; }
.portrait__poured {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: 1.6rem;
  gap: .35rem;
  font-family: var(--label);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--faint);
  opacity: 0;
  transition: opacity .3s ease;
  pointer-events: none;
}
.portrait__poured small { font-size: .78rem; letter-spacing: .12em; font-weight: 500; }
.portrait__frame.is-poured .portrait__poured { opacity: 1; }
:root[data-theme="dark"] .jhbot__figure {
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, .35)) drop-shadow(0 4px 6px rgba(0, 0, 0, .4));
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .jhbot__figure {
    filter: drop-shadow(0 0 1px rgba(255, 255, 255, .35)) drop-shadow(0 4px 6px rgba(0, 0, 0, .4));
  }
}

.jhbot__stream {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 79;
}

.jhbot {
  --jh-scale: 1;
  position: fixed;
  right: 16px;
  bottom: 10px;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: .45rem;
  pointer-events: none;
  opacity: 0;
  transition: opacity .12s linear;
  will-change: transform, opacity;
}
.jhbot.is-active { opacity: 1; }
.jhbot.is-active .pbot__panel,
.jhbot.is-active .pbot__bubble,
.jhbot.is-active .jhbot__walker { pointer-events: auto; }

.jhbot__walker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.jhbot__figure {
  position: relative;
  display: block;
  width: calc(96px * var(--jh-scale));
  height: calc(164px * var(--jh-scale));
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  transform-origin: bottom center;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .18));
}
.jhbot__figure:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.jhbot__sprite {
  position: absolute;
  inset: 0;
  background: url("assets/jhbot/jhbot-sheet.webp") 0 0 / 1400% 100% no-repeat;
  image-rendering: auto;
}
.jhbot.is-flipped .jhbot__sprite { transform: scaleX(-1); }
.jhbot__shadow {
  position: absolute;
  left: 48%;
  bottom: 0;
  width: calc(46px * var(--jh-scale));
  height: 6px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: rgba(20, 22, 26, .26);
  filter: blur(2px);
  pointer-events: none;
}
.jhbot.is-hopping .jhbot__figure {
  animation: jhbotHop .45s cubic-bezier(.2, .9, .3, 1.15);
}
@keyframes jhbotHop {
  0%   { transform: translateY(0); }
  45%  { transform: translateY(-14px); }
  100% { transform: translateY(0); }
}

.jhbot__controls {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  opacity: .88;
  transition: opacity .15s ease;
}
.jhbot__walker:hover .jhbot__controls,
.jhbot__controls:focus-within {
  opacity: 1;
}
.jhbot__pill {
  padding: .12em .5em;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: .64rem;
  font-weight: 500;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  line-height: 1.3;
}
.jhbot__pill:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}
.jhbot__pill--off {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--line);
}
.jhbot__pill--off:hover {
  background: var(--surface-alt);
  color: var(--text);
  border-color: var(--text);
}

.pbot__off-btn {
  background: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .15em .45em;
  cursor: pointer;
}
.pbot__off-btn:hover {
  border-color: var(--text);
  color: var(--text);
}

.jhbot__restore {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 79;
  padding: .32em .7em;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  cursor: pointer;
  opacity: .82;
  transition: opacity .15s ease, border-color .15s ease, color .15s ease;
}
.jhbot__restore:hover {
  opacity: 1;
  border-color: var(--accent);
  color: var(--accent);
}
.jhbot__restore[hidden] { display: none; }

.pbot__bubble {
  width: min(310px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .75rem .85rem;
  font-size: .92rem;
  line-height: 1.45;
  animation: pbotPop .22s ease;
}
@keyframes pbotPop {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.pbot__bubble-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}
.pbot__bubble-tag {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
}
.pbot__bubble-close, .pbot__icon-btn {
  background: none;
  border: 0;
  color: var(--faint);
  font-size: 1.15rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
.pbot__bubble-close:hover, .pbot__icon-btn:hover { color: var(--text); }
.pbot__bubble-text {
  margin: 0 0 .55rem;
  color: var(--text);
}
.pbot__bubble-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  border-top: 1px solid var(--line);
  padding-top: .45rem;
}
.pbot__link-btn {
  background: none;
  border: 0;
  padding: .15rem 0;
  font-family: var(--label);
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
}
.pbot__link-btn:hover { color: var(--text); }
.pbot__link-btn--accent { color: var(--accent); }

.pbot__panel {
  width: min(350px, calc(100vw - 24px));
  max-height: min(72vh, 520px);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--text);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  animation: pbotPop .22s ease;
}
.pbot__panel[hidden], .pbot__bubble[hidden] { display: none; }

.pbot__panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .6rem .85rem;
  background: var(--surface-alt);
  border-bottom: 1px solid var(--line);
}
.pbot__panel-id {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-family: var(--mono);
  font-size: .75rem;
  letter-spacing: .08em;
  color: var(--text);
}
.pbot__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.pbot__tour {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: .5rem .85rem;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}
.pbot__tour-label {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.pbot__tour-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: .28em .65em;
  font-family: var(--label);
  font-weight: 600;
  font-size: .82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.pbot__tour-btn:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

.pbot__jumps {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .6rem .85rem;
  border-bottom: 1px solid var(--line);
}
.pbot__jumps button, .pbot__prompts button {
  background: var(--surface-alt);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: .22em .55em;
  font-family: var(--label);
  font-weight: 500;
  font-size: .82rem;
  letter-spacing: .05em;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}
.pbot__jumps button:hover, .pbot__prompts button:hover,
.pbot__jumps button.is-current {
  border-color: var(--accent);
  color: var(--accent);
}

.pbot__log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: .75rem .85rem;
  display: flex;
  flex-direction: column;
  gap: .55rem;
  min-height: 110px;
  max-height: 210px;
}
.pbot__msg {
  margin: 0;
  padding: .55rem .7rem;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.45;
  color: var(--text);
}
.pbot__msg--user {
  align-self: flex-end;
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
  max-width: 85%;
}
.pbot__msg-link {
  display: inline-block;
  margin-top: .35rem;
  font-family: var(--label);
  font-weight: 600;
  font-size: .84rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent);
  text-decoration: none;
}
.pbot__msg-link:hover { text-decoration: underline; }

.pbot__prompts {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  padding: .5rem .85rem;
  border-top: 1px solid var(--line);
}
.pbot__prompts button {
  font-size: .78rem;
  background: transparent;
}

.pbot__form {
  display: flex;
  gap: .4rem;
  padding: .55rem .85rem .7rem;
  border-top: 1px solid var(--line);
  background: var(--surface-alt);
}
.pbot__form input {
  flex: 1;
  min-width: 0;
  padding: .42rem .6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-family: var(--body);
  font-size: .9rem;
}
.pbot__form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pbot__form button {
  padding: .42rem .85rem;
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-family: var(--label);
  font-weight: 600;
  font-size: .88rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
}
.pbot__form button:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

@media (max-width: 720px) {
  .jhbot { --jh-scale: .75; right: 10px; bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .jhbot, .jhbot__figure, .pbot__bubble, .pbot__panel { animation: none; transition: none; }
}

/* ===== Eyes, drag, thinking ===== */
.jhbot__eyes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.jhbot.is-dragging .jhbot__figure { cursor: grabbing; transform-origin: 48% 6%; }
.jhbot.is-dragging .jhbot__shadow { opacity: 0; }
.jhbot.is-dragging .jhbot__controls { visibility: hidden; }
.jhbot__figure::after {
  content: "";
  position: absolute;
  left: 62%;
  top: -10px;
  font-family: var(--label);
  font-weight: 600;
  font-size: 1.1rem;
  letter-spacing: .1em;
  color: var(--muted);
  opacity: 0;
  transition: opacity .3s ease;
}
.jhbot.is-thinking .jhbot__figure::after { content: "…"; opacity: 1; animation: jhThink 1.6s ease-in-out infinite; }
@keyframes jhThink { 50% { transform: translateY(-4px); } }

/* ===== Jargon decoder ===== */
.jh-term {
  text-decoration: underline dotted var(--accent);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  cursor: help;
  border-radius: 2px;
  transition: background-color .15s ease;
}
.jh-term:hover, .jh-term.is-active { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.jh-term:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cyan .jh-term { text-decoration-color: currentColor; }

.jh-tip {
  position: fixed;
  z-index: 90;
  width: min(320px, calc(100vw - 24px));
  padding: .7rem .85rem .8rem;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: var(--body);
  animation: pbotPop .18s ease;
}
.jh-tip[hidden] { display: none; }
.jh-tip__top { display: flex; justify-content: space-between; align-items: center; gap: .5rem; margin-bottom: .35rem; }
.jh-tip__tag {
  font-family: var(--label); font-weight: 600; font-size: .78rem;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.jh-tip__modes { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.jh-tip__modes button {
  background: none; border: 0; padding: .12rem .5rem; cursor: pointer;
  font-family: var(--label); font-weight: 600; font-size: .74rem; letter-spacing: .08em;
  text-transform: uppercase; color: var(--muted);
}
.jh-tip__modes button[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); }
.jh-tip__term { margin: 0 0 .2rem; font-family: var(--display); font-size: 1.15rem; line-height: 1.2; }
.jh-tip__text { margin: 0; font-size: .92rem; line-height: 1.5; color: var(--text); }

.jh-leader {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 85;
  pointer-events: none;
  overflow: visible;
  opacity: 0;
  transition: opacity .15s ease;
}
.jh-leader.is-on { opacity: 1; }
.jh-leader polyline { stroke: var(--accent); }
.jh-leader circle { fill: var(--accent); }
@media (prefers-reduced-motion: reduce) {
  .jh-tip, .jhbot.is-thinking .jhbot__figure::after { animation: none; }
}
.jh-sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ===== Tucked: no free space, he peeks in from the right edge ===== */
.jhbot__walker { transition: transform .35s ease; }
.jhbot.is-tucked .jhbot__walker { transform: translateX(42%); }
.jhbot.is-tucked .jhbot__controls { transform: translateX(-64%); }
.jhbot.is-tucked .jhbot__controls .jhbot__pill:not(.jhbot__pill--off) { visibility: hidden; }
.jhbot.is-tucked .jhbot__walker:hover,
.jhbot.is-tucked .jhbot__walker:focus-within { transform: none; }
.jhbot.is-tucked .jhbot__walker:hover .jhbot__controls,
.jhbot.is-tucked .jhbot__walker:focus-within .jhbot__controls { visibility: visible; }
@media (max-width: 720px) {
  .jhbot.is-tucked .jhbot__walker { transform: translateX(66%); }
}
.jhbot.is-sliding { transition: opacity .12s linear, transform .35s ease; }
