/* Chromie - TheWoWDB's on-site guide.
   Loaded by site_shell.render_chromie_chat_tag(); bump CHROMIE_ASSET_VERSION there on ANY edit
   to this file or chromie-chat.js (they are served 1yr-immutable and share one token).

   DESIGN CONTRACT (owner order 2026-09-18: "much more hidden and elegant").
   * RESTING: a 38x38 portrait disc tucked at the RIGHT edge, vertically centred, 24px of it
     showing, 45% opacity, no label and no glow. Right-edge-centre on purpose: the bottom-right
     corner carries the mobile version selector sheet, the ad anchor bar and the thumb zone, so
     a launcher parked there covers a control every time. Nothing here is in document flow and
     nothing animates a layout property, so the widget costs ZERO CLS.
   * OPEN: the client's own floating window - the UI-Tooltip nine-slice border over the tiled
     tooltip backdrop, gold FrizQT title, bronze rules, and GOSSIP OPTION rows rather than chat
     pills. The recipe is the one in docs/ui-ux/18-blizzard-textures.md (.wgf-tex-tooltip); it
     is carried here inline for the same reason wgf-keybinds.js carries its window rules inline:
     this widget also loads on the baked static pages, which do not link the texture kit.
   * PALETTE: docs/ui-ux/17-blizzard-palette.md tokens, with the Blizzard literals as
     var() fallbacks (the house pattern for a sheet that must paint without _tokens.css).
     NO GREEN CHROME anywhere - the old bright-green "online" dot went out with the rest of the
     support-widget look. No class name starts with "ad-".
   * LAYERING: every real modal must win. Chromie sits UNDER the cookie bar (9999), the version
     selector sheet (10000) and the Escape Game Menu (2147482000). She never covers a decision. */

.chromie-tab,
.chromie-panel,
.chromie-panel * { box-sizing: border-box; }

/* ── the resting affordance ───────────────────────────────────────────────────────────── */
.chromie-tab {
  --chromie-tuck: 14px;              /* 14 of the 38px disc sits past the edge -> 24px showing */
  --chromie-rest-opacity: 0.45;
  position: fixed;
  right: 0;
  top: 50%;
  z-index: 9980;
  width: 38px;
  height: 38px;
  padding: 0;
  margin: 0;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  border-radius: 50%;
  background: var(--wgf-well, #08090c);
  color: var(--wgf-gold-bright, #ffe375);
  cursor: pointer;
  opacity: var(--chromie-rest-opacity);
  transform: translate(var(--chromie-tuck), -50%);
  transition: transform 0.28s ease, opacity 0.28s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.chromie-tab__face {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

/* Reaching for her pulls her fully onto the page; nothing else does. */
.chromie-tab:hover,
.chromie-tab:focus-visible,
.chromie-tab[aria-expanded="true"] {
  --chromie-tuck: -8px;
  opacity: 1;
  border-color: var(--wgf-gold-accent, #b7912f);
  outline: none;
}

.chromie-tab:focus-visible {
  box-shadow: 0 0 0 2px var(--wgf-focus, #ffe375);
}

/* While the reader is scrolling or working a tool she slides further out of the way. */
.chromie-tab.is-tucked:not(:hover):not(:focus-visible) {
  --chromie-tuck: 26px;
  opacity: 0.18;
}

/* The name only exists on hover/focus, and never takes a click away from the page. */
.chromie-tab__flag {
  position: absolute;
  right: 46px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 9px;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  background: var(--wgf-panel-1, #14161c);
  color: var(--wgf-gold-muted, #b5a06a);
  font-size: 11px;
  line-height: 1.5;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.chromie-tab:hover .chromie-tab__flag,
.chromie-tab:focus-visible .chromie-tab__flag { opacity: 1; }

.chromie-tab__key {
  margin-left: 6px;
  padding: 0 4px;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  color: var(--wgf-neutral-text, #9b9384);
}

/* ── the open window: the client's floating frame ─────────────────────────────────────── */
.chromie-panel {
  position: fixed;
  right: 12px;
  top: 50%;
  z-index: 9990;
  display: flex;
  flex-direction: column;
  width: min(370px, calc(100vw - 24px));
  max-height: min(560px, calc(100vh - 96px));
  max-height: min(560px, calc(100dvh - 96px));
  padding: 0;
  /* UI-Tooltip-Border drawn at 12px over UI-Tooltip-Background, multiplied by the client's
     own backdrop tint - the same recipe .wgf-tex-tooltip uses. */
  border: 12px solid transparent;
  border-image: url(/assets/ui/blizzard/tooltip-border-9slice.png) 16 / 12px / 0 round;
  border-radius: 0;
  background-color: #12121f;
  background-image: url(/assets/ui/blizzard/tooltip-background.png);
  background-repeat: repeat;
  background-size: 64px 64px;
  background-origin: border-box;
  background-clip: border-box;
  background-blend-mode: multiply;
  color: var(--wgf-text, #f4ecd8);
  font-family: inherit;
  font-size: 13px;
  opacity: 0;
  transform: translateY(-50%) translateX(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.chromie-panel.is-open {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
  pointer-events: auto;
}

/* ── title bar ────────────────────────────────────────────────────────────────────────── */
.chromie-panel__bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 0 8px;
  border-bottom: 1px solid var(--wgf-metal, #6e5a2a);
}

/* The achievement icon ring (UI-Achievement-IconFrame) around the portrait, the same
   border-image form the kit uses on a replaced element. */
.chromie-panel__face {
  box-sizing: content-box;
  display: block;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 5px solid transparent;
  border-image: url(/assets/ui/achv/piece-iconframe.png) 14 / 5px / 0 stretch;
  background: #000;
  object-fit: cover;
}

.chromie-panel__names { flex: 1 1 auto; min-width: 0; }

.chromie-panel__name {
  margin: 0;
  font-family: var(--font-game, "FrizQT", "FrizQuadrata", "Friz Quadrata TT", Georgia, serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--wgf-gold-primary, #ffd100);
  text-shadow: 1px 1px 0 #000;
}

.chromie-panel__where {
  margin: 0;
  overflow: hidden;
  color: var(--wgf-neutral-text, #9b9384);
  font-size: 11px;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chromie-panel__close {
  flex: 0 0 auto;
  padding: 2px 7px;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  background: transparent;
  color: var(--wgf-gold-muted, #b5a06a);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.chromie-panel__close:hover,
.chromie-panel__close:focus-visible { color: var(--wgf-gold-bright, #ffe375); outline: none; }

/* ── the scroll of talk ───────────────────────────────────────────────────────────────── */
.chromie-log {
  flex: 1 1 auto;
  padding: 10px 2px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.chromie-line { margin: 0 0 10px; line-height: 1.5; }
.chromie-line:last-child { margin-bottom: 0; }

.chromie-line--her { color: var(--wgf-text, #f4ecd8); }

.chromie-line--her::before {
  content: "Chromie";
  display: block;
  margin-bottom: 2px;
  color: var(--wgf-gold-primary, #ffd100);
  font-family: var(--font-game, "FrizQT", "FrizQuadrata", Georgia, serif);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.chromie-line--you {
  padding-left: 10px;
  border-left: 2px solid var(--wgf-gold-accent, #b7912f);
  color: var(--wgf-muted, #b3a88f);
}

.chromie-line--resting { color: var(--wgf-neutral-text, #9b9384); font-style: italic; }

.chromie-line a,
.chromie-links a { color: var(--wgf-gold-bright, #ffe375); }

.chromie-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.chromie-links a {
  padding: 2px 8px;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  background: var(--wgf-panel-1, #14161c);
  font-size: 11px;
  text-decoration: none;
}

.chromie-links a:hover,
.chromie-links a:focus-visible { border-color: var(--wgf-gold-accent, #b7912f); outline: none; }

/* ── gossip options: the in-game "what can I ask you" list, not chat pills ────────────── */
.chromie-gossip { margin: 0 0 8px; padding: 0; list-style: none; }

.chromie-gossip__opt {
  display: block;
  width: 100%;
  padding: 7px 4px 7px 0;
  border: 0;
  border-bottom: 1px solid rgba(110, 90, 42, 0.38);
  background: transparent;
  color: var(--wgf-gold-bright, #ffe375);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

/* The bronze lozenge the client puts in front of a gossip line. Drawn, not an image file. */
.chromie-gossip__opt::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin: 0 8px 1px 2px;
  background: var(--wgf-gold-accent, #b7912f);
  transform: rotate(45deg);
}

.chromie-gossip__opt:hover,
.chromie-gossip__opt:focus-visible {
  background: rgba(255, 209, 0, 0.07);
  color: var(--wgf-gold-primary, #ffd100);
  outline: none;
}

.chromie-gossip__opt:hover::before,
.chromie-gossip__opt:focus-visible::before { background: var(--wgf-gold-primary, #ffd100); }

/* ── ask box ──────────────────────────────────────────────────────────────────────────── */
.chromie-ask {
  display: flex;
  gap: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--wgf-metal, #6e5a2a);
}

.chromie-ask__input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--wgf-border-neutral, #2e313a);
  border-radius: 0;
  background: var(--wgf-well, #08090c);
  color: var(--wgf-text, #f4ecd8);
  font: inherit;
}

.chromie-ask__input:focus {
  border-color: var(--wgf-gold-accent, #b7912f);
  outline: none;
}

.chromie-ask__send {
  flex: 0 0 auto;
  padding: 7px 12px;
  border: 1px solid var(--wgf-metal, #6e5a2a);
  border-radius: 0;
  background: var(--wgf-panel-2, #1a1d24);
  color: var(--wgf-gold-primary, #ffd100);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.chromie-ask__send:hover:not(:disabled) { border-color: var(--wgf-gold-accent, #b7912f); }
.chromie-ask__send:disabled { color: var(--wgf-neutral-text, #9b9384); cursor: wait; }

/* ── foot: the privacy line and the way out ───────────────────────────────────────────── */
.chromie-foot {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin: 6px 0 0;
  color: var(--wgf-neutral-text, #9b9384);
  font-size: 10.5px;
  line-height: 1.35;
}

.chromie-foot__hide {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--wgf-gold-muted, #b5a06a);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.chromie-foot__hide:hover,
.chromie-foot__hide:focus-visible { color: var(--wgf-gold-bright, #ffe375); outline: none; }

/* ── waiting ──────────────────────────────────────────────────────────────────────────── */
.chromie-wait { display: inline-flex; gap: 4px; padding: 2px 0; }

.chromie-wait i {
  width: 5px;
  height: 5px;
  background: var(--wgf-gold-accent, #b7912f);
  animation: chromie-sand 1.2s infinite ease-in-out;
}

.chromie-wait i:nth-child(2) { animation-delay: 0.2s; }
.chromie-wait i:nth-child(3) { animation-delay: 0.4s; }

@keyframes chromie-sand {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 1; }
}

/* ── phone: same right-edge anchor, a little smaller, clear of the thumb arc ──────────── */
@media (max-width: 640px) {
  .chromie-tab {
    top: 44%;
    width: 34px;
    height: 34px;
    --chromie-tuck: 12px;
  }
  .chromie-tab__flag { display: none; }
  .chromie-panel {
    right: 8px;
    left: 8px;
    width: auto;
    max-height: min(70vh, calc(100dvh - 120px));
  }
}

/* ── motion, contrast, print ──────────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .chromie-tab,
  .chromie-panel,
  .chromie-tab__flag { transition: none; }
  .chromie-wait i { animation: none; opacity: 0.7; }
}

@media (prefers-contrast: more) {
  .chromie-tab { --chromie-rest-opacity: 0.85; border-color: var(--wgf-gold-accent, #b7912f); }
}

@media print {
  .chromie-tab,
  .chromie-panel { display: none !important; }
}
