/* Humexa scripted demo. Theme it from the host page with the custom properties below. */
.hx-demo {
  --hx-ink: #f5f5f3;
  --hx-dim: rgba(245, 245, 243, .62);
  --hx-faint: rgba(245, 245, 243, .14);
  --hx-accent: #f5f5f3;          /* highlights: map department, active state */
  --hx-accent-ink: #0b0b0c;      /* text on the accent */
  --hx-stage: #0b0b0c;
  --hx-panel: rgba(255, 255, 255, .045);
  --hx-radius: 22px;
  --hx-caption-size: clamp(17px, 1.55vw, 24px);
  color: var(--hx-ink);
  font: inherit;
  position: relative;
  display: grid;
  gap: 18px;
}
.hx-demo--split { grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); align-items: stretch; }
.hx-demo--split .hx-controls, .hx-demo--split .hx-transcript { grid-column: 1 / -1; }

/* ---------- stage */
.hx-stage {
  position: relative; overflow: hidden; isolation: isolate;
  border-radius: var(--hx-radius);
  background:
    radial-gradient(70% 55% at 50% 30%, rgba(255, 246, 232, .10), rgba(255, 246, 232, 0) 70%),
    linear-gradient(#1a1918, var(--hx-stage) 78%);
  aspect-ratio: 4 / 5;
  box-shadow: 0 1px 0 rgba(255, 255, 255, .07) inset, 0 40px 90px -40px rgba(0, 0, 0, .9);
}
.hx-demo--screen .hx-stage { aspect-ratio: 9 / 16; border-radius: 0; box-shadow: none; }
.hx-face { position: absolute; inset: 0; }
.hx-face__f {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 50% 0%;
  opacity: 0;
}
.hx-demo--screen .hx-face__f {
  top: 0; height: 66%; object-fit: cover; object-position: 50% 0%;
  -webkit-mask-image: linear-gradient(#000 78%, transparent); mask-image: linear-gradient(#000 78%, transparent);
}
.hx-demo--screen .hx-caption { bottom: auto; top: 55%; min-height: 0; align-items: flex-start; }
.hx-demo--screen .hx-attract { bottom: auto; top: 64%; }
.hx-face__f.is-on { opacity: 1; }

.hx-status, .hx-badges { position: absolute; top: 16px; z-index: 3; display: flex; gap: 8px; align-items: center; }
.hx-status { left: 16px; }
.hx-badges { right: 16px; }
.hx-status, .hx-badge {
  height: 30px; padding: 0 12px; border-radius: 999px;
  font-size: 13px; font-weight: 500; letter-spacing: .01em; white-space: nowrap;
  background: rgba(12, 12, 13, .62); color: var(--hx-ink);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .10) inset;
}
.hx-badge { display: inline-flex; align-items: center; gap: 7px; }
.hx-badge svg { width: 13px; height: 13px; opacity: .85; }
.hx-badge--lang { min-width: 40px; justify-content: center; font-variant-numeric: tabular-nums; }
.hx-status { display: inline-flex; align-items: center; gap: 9px; }
.hx-status__meter { display: inline-flex; gap: 2px; align-items: center; height: 12px; }
.hx-status__meter i { width: 2px; height: 4px; border-radius: 2px; background: currentColor; opacity: .8; transform-origin: 50% 50%; }
.hx-demo[data-state="speak"] .hx-status__meter i,
.hx-demo[data-state="listen"] .hx-status__meter i { animation: hx-level .5s ease-in-out infinite alternate; }
.hx-status__meter i:nth-child(2) { animation-delay: -.12s !important; }
.hx-status__meter i:nth-child(3) { animation-delay: -.31s !important; }
.hx-status__meter i:nth-child(4) { animation-delay: -.2s !important; }
@keyframes hx-level { from { transform: scaleY(.6); } to { transform: scaleY(2.6); } }
.hx-demo[data-state="listen"] .hx-status { box-shadow: 0 0 0 1px var(--hx-accent) inset; }

.hx-attract {
  position: absolute; left: 50%; bottom: 9%; z-index: 3; transform: translateX(-50%);
  font-size: var(--hx-caption-size); color: var(--hx-dim); white-space: nowrap;
  transition: opacity .5s ease;
}
.hx-attract b { color: var(--hx-ink); font-weight: 600; }
.hx-demo:not(.is-idle) .hx-attract { opacity: 0; }

.hx-caption {
  position: absolute; left: 7%; right: 7%; bottom: 7%; z-index: 3;
  min-height: calc(var(--hx-caption-size) * 2.7);
  display: flex; align-items: flex-end; justify-content: center;
}
.hx-line {
  margin: 0; text-align: center; text-wrap: pretty;
  font-size: var(--hx-caption-size); line-height: 1.32; font-weight: 500;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8), 0 6px 22px rgba(0, 0, 0, .55);
}
.hx-line--visitor { color: var(--hx-dim); font-style: italic; }
.hx-line--visitor::before { content: "– "; }
/* live-caption behaviour: a word exists once it is spoken, so every line stays centred */
.hx-w:not(.is-in) { display: none; }
.hx-w.is-in { animation: hx-word .2s ease-out both; }
@keyframes hx-word { from { opacity: 0; } }

/* ---------- panel */
.hx-panel { position: relative; display: grid; gap: 12px; align-content: start; }
.hx-demo--screen .hx-panel { position: absolute; left: 6%; right: 6%; bottom: 4%; z-index: 4; display: block; }
.hx-demo--screen .hx-panel > * { position: absolute; left: 0; right: 0; bottom: 0; }
.hx-demo--screen .hx-card, .hx-demo--screen .hx-note { display: none; }
.hx-demo--screen .hx-source { bottom: 0; }
.hx-demo--screen .hx-map { left: 13%; right: 13%; bottom: 52px; padding: 8px; }
.hx-map, .hx-card, .hx-source, .hx-note {
  margin: 0; border-radius: 16px; background: var(--hx-panel);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, .08) inset;
  opacity: .28; transform: translateY(6px);
  transition: opacity .55s cubic-bezier(.2, .7, .2, 1), transform .55s cubic-bezier(.2, .7, .2, 1);
}
.hx-demo--screen .hx-map, .hx-demo--screen .hx-card, .hx-demo--screen .hx-source, .hx-demo--screen .hx-note {
  opacity: 0; background: rgba(12, 12, 13, .82);
}
.hx-map.is-on, .hx-card.is-on, .hx-source.is-on, .hx-note.is-on { opacity: 1; transform: none; }
.hx-map { padding: 14px 14px 10px; }
.hx-map__svg { display: block; width: 100%; height: auto; }
.hx-map__floor { fill: rgba(255, 255, 255, .03); stroke: rgba(255, 255, 255, .14); }
.hx-map__dept rect { fill: rgba(255, 255, 255, .06); stroke: rgba(255, 255, 255, .12); transition: fill .5s ease, stroke .5s ease; }
.hx-map__dept text { fill: var(--hx-dim); font-size: 11px; font-weight: 500; transition: fill .5s ease; }
.hx-map__dept.is-hit rect { fill: var(--hx-accent); stroke: var(--hx-accent); }
.hx-map__dept.is-hit text { fill: var(--hx-accent-ink); font-weight: 600; }
.hx-map__you circle { fill: var(--hx-ink); }
.hx-map__you text { fill: var(--hx-ink); font-size: 11px; font-weight: 600; }
.hx-map__ring { fill: none !important; stroke: var(--hx-ink); transform-box: fill-box; transform-origin: center; animation: hx-ring 2.4s ease-out infinite; }
@keyframes hx-ring { from { transform: scale(1); opacity: .8; } to { transform: scale(4); opacity: 0; } }
.hx-map__cap { display: flex; gap: 6px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--hx-dim); }
.hx-map__cap svg { width: 12px; height: 12px; }
.hx-demo--screen .hx-map__cap { display: none; }
.hx-card { padding: 14px 16px; display: grid; gap: 2px; }
.hx-card:not(.is-on), .hx-note:not(.is-on) { opacity: 0; }
.hx-card__title { font-size: 17px; font-weight: 600; }
.hx-card__meta { font-size: 13px; color: var(--hx-dim); }
.hx-source, .hx-note { display: flex; gap: 10px; align-items: center; padding: 12px 16px; font-size: 14px; }
.hx-source__icon svg { width: 16px; height: 16px; display: block; }
.hx-source.is-none { box-shadow: 0 0 0 1px rgba(255, 255, 255, .22) inset; }
.hx-note:empty { display: none; }

/* ---------- controls */
.hx-controls { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; }
.hx-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px 0 12px;
  border: 0; border-radius: 999px; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 500; color: var(--hx-ink); white-space: nowrap;
  background: rgba(255, 255, 255, .07); box-shadow: 0 0 0 1px rgba(255, 255, 255, .1) inset;
  transition: background .2s ease;
}
.hx-btn:hover { background: rgba(255, 255, 255, .13); }
.hx-btn:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 3px; }
.hx-btn svg { width: 14px; height: 14px; }
.hx-label { font-size: 13px; color: var(--hx-dim); }
.hx-transcript { font-size: 14px; color: var(--hx-dim); }
.hx-transcript summary { cursor: pointer; width: max-content; }
.hx-transcript summary:focus-visible { outline: 2px solid var(--hx-accent); outline-offset: 3px; border-radius: 4px; }
.hx-transcript ol { margin: 10px 0 0; padding-left: 1.2em; display: grid; gap: 4px; }
.hx-transcript b { color: var(--hx-ink); font-weight: 600; }

@media (max-width: 760px) {
  .hx-demo--split { grid-template-columns: 1fr; }
  .hx-status, .hx-badge { height: 28px; font-size: 12px; padding: 0 10px; }
  .hx-badge--local span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .hx-demo *, .hx-demo *::before { animation: none !important; transition: none !important; }
  .hx-w:not(.is-in) { display: inline; }
}
