/* Gnosys explainer player. Every rule is namespaced with .hiw- so the file can load on any page. */

.hiw-player {
  --hiw-user: #F5EAEA;
  --hiw-ok: #2E7D4F;
  --hiw-shadow: 0 24px 60px -24px rgba(40, 20, 20, 0.25);
  position: relative;
}
:is([data-theme="dark"], [data-theme="system"].sys-dark) .hiw-player {
  --accent: #E08888;
  --text-muted: #8A8894;
  --hiw-user: rgba(192, 76, 76, 0.18);
  --hiw-ok: #6FCF97;
  --hiw-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
}

/* ── Storyboard is the default (no JS, reduced motion) ── */

.hiw-note { margin-top: 16px; text-align: center; font-size: 14px; color: var(--text-secondary); }
.hiw-player :focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.hiw-toolbar { display: flex; justify-content: flex-end; margin-bottom: 12px; }
.hiw-toolbar[hidden], .hiw-controls[hidden] { display: none; }
.hiw-mode {
  font: inherit; font-size: 13px; font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 6px 14px;
  cursor: pointer;
}
.hiw-mode:hover { color: var(--accent); border-color: var(--accent-lighter); }

.hiw-screen { display: grid; gap: 28px; }

.hiw-scene {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--hiw-shadow);
  text-align: left;
}

.hiw-scene-title { display: flex; align-items: center; gap: 10px; padding: 18px 20px 14px; font-size: 18px; font-weight: 600; }
.hiw-scene-title span {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-faint); color: var(--accent);
  font-size: 13px; font-weight: 700;
}

.hiw-bar {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 16px;
  background: var(--bg-code);
  border-block: 1px solid var(--border);
  font-size: 13px; color: var(--text-secondary);
  white-space: nowrap;
}
.hiw-dots { display: inline-flex; gap: 6px; flex: none; }
.hiw-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--border); }
.hiw-dots i:first-child { background: var(--accent-lighter); }
.hiw-app { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.hiw-app strong { color: var(--text); font-weight: 600; }
.hiw-clock {
  margin-left: auto; flex: none;
  font-family: 'JetBrains Mono', monospace; font-size: 12px;
  padding: 2px 10px; border-radius: 100px;
  background: var(--bg-card); border: 1px solid var(--border);
}

.hiw-intro { display: flex; flex-wrap: wrap; gap: 4px 10px; padding: 10px 20px; border-bottom: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); }
.hiw-intro-big { font-weight: 600; color: var(--text); }

.hiw-panes { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.08fr); }
.hiw-pane { min-width: 0; padding: 14px 20px 18px; }
.hiw-trace { background: var(--bg-code); border-left: 1px solid var(--border); }
.hiw-pane-label { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px; }
.hiw-scroll { display: flex; flex-direction: column; gap: 12px; }
.hiw-scroll > * { flex: none; }

.hiw-msg { max-width: 92%; font-size: 14px; line-height: 1.55; }
.hiw-who { display: block; font-size: 11px; font-weight: 600; color: var(--text-muted); margin-bottom: 4px; }
.hiw-user { align-self: flex-end; background: var(--hiw-user); border-radius: 14px 14px 4px 14px; padding: 10px 14px; }
.hiw-agent { align-self: flex-start; }
.hiw-player code { font-family: 'JetBrains Mono', monospace; font-size: 0.88em; overflow-wrap: anywhere; }
.hiw-agent code { color: var(--accent); }

.hiw-chip {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-secondary);
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--border); border-radius: 100px;
  background: var(--bg-card);
}
.hiw-chip::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.hiw-chip code { color: var(--text); }

.hiw-call {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  overflow: hidden;
  transition: border-color 0.3s;
}
.hiw-call-head { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--border-light); }
.hiw-call-head code { font-size: 13px; font-weight: 500; color: var(--accent); }
.hiw-status {
  margin-left: auto;
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--hiw-ok);
}
.hiw-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }

.hiw-args, .hiw-result, .hiw-code, .hiw-install pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--text);
}
.hiw-args { padding: 10px 12px; }
.hiw-result {
  padding: 10px 12px;
  background: var(--bg-code);
  border-top: 1px dashed var(--border);
  color: var(--text-secondary);
}
.hiw-result::before { content: "Result"; display: block; font-family: 'Inter', sans-serif; font-size: 10px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 4px; }
.hiw-code { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-code); }

.hiw-narration { padding: 14px 20px 18px 40px; border-top: 1px solid var(--border); font-size: 14px; color: var(--text-secondary); }
.hiw-narration li + li { margin-top: 6px; }

.hiw-end-card { display: grid; justify-items: center; gap: 18px; padding: 40px 24px; text-align: center; }
.hiw-end-logo { display: inline-flex; }
.hiw-end-logo img { display: block; width: 140px; height: 30px; }
.hiw-end-logo .logo-dark { display: none; }
:is([data-theme="dark"], [data-theme="system"].sys-dark) .hiw-end-logo .logo-light { display: none; }
:is([data-theme="dark"], [data-theme="system"].sys-dark) .hiw-end-logo .logo-dark { display: block; }
.hiw-end-title { font-size: clamp(24px, 3.2vw, 34px); font-weight: 700; letter-spacing: -0.02em; }
.hiw-install { position: relative; width: min(420px, 100%); }
.hiw-install pre {
  text-align: left; font-size: 14px;
  padding: 14px 84px 14px 16px;
  background: var(--bg-code); border: 1px solid var(--border); border-radius: 10px;
}
.hiw-copy {
  position: absolute; top: 9px; right: 9px;
  font: inherit; font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 6px; cursor: pointer;
  color: var(--text); background: var(--bg-card); border: 1px solid var(--border);
}
.hiw-copy:hover { border-color: var(--accent-lighter); color: var(--accent); }
.hiw-end-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

.hiw-caption { display: none; }

/* ── Video mode ──
   .hiw-video is set by the script. The .hiw-motion arm is set on <html> by an inline head
   script when motion is allowed, so the player has its video height before the deferred
   script runs and the page below it does not jump. */

:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-screen {
  display: block;
  position: relative;
  height: 580px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-card);
  box-shadow: var(--hiw-shadow);
}
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-scene { display: none; height: 100%; flex-direction: column; border: 0; border-radius: 0; box-shadow: none; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-scene.is-active { display: flex; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) :is(.hiw-scene-title, .hiw-narration) { display: none; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-bar { border-top: 0; flex: none; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-panes { flex: 1; min-height: 0; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-pane { display: flex; flex-direction: column; min-height: 0; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; padding-bottom: 8px; }

:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro {
  position: absolute; inset: 44px 0 0;
  z-index: 2;
  flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 24px; border: 0; text-align: center;
  background: color-mix(in srgb, var(--bg-card) 82%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0; visibility: hidden;
  transition: opacity 0.4s, visibility 0.4s;
}
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro.is-on { opacity: 1; visibility: visible; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro-big { font-size: clamp(28px, 4.4vw, 46px); font-weight: 700; letter-spacing: -0.03em; line-height: 1.15; }
:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro-sub { font-size: 16px; max-width: 460px; }

.hiw-video .is-off { display: none; }
.hiw-video .is-new { animation: hiw-in 0.35s ease-out; }
.hiw-video .hiw-typing::after {
  content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 2px;
  vertical-align: -0.18em; background: currentColor;
  animation: hiw-blink 0.9s steps(1) infinite;
}
.hiw-video .hiw-call.is-running { border-color: var(--accent-lighter); box-shadow: 0 0 0 3px var(--accent-glow); }
.hiw-video .hiw-call.is-running .hiw-status { color: var(--accent); }
.hiw-video .hiw-call.is-running .hiw-status::before { animation: hiw-pulse 0.8s ease-in-out infinite alternate; }

:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-end { align-items: center; justify-content: center; background: radial-gradient(ellipse at 50% 0%, var(--accent-faint), transparent 60%), var(--bg-card); }

:is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-caption {
  display: flex; align-items: center; justify-content: center;
  min-height: 3.4em; max-width: 760px;
  margin: 14px auto 6px;
  text-align: center; font-size: 16px; line-height: 1.5;
  color: var(--text-secondary);
}

.hiw-controls { margin-top: 6px; }
.hiw-transport { display: flex; align-items: center; gap: 12px; }
.hiw-btn {
  flex: none; display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text);
  cursor: pointer;
}
.hiw-btn svg { width: 18px; height: 18px; fill: currentColor; }
.hiw-btn:hover { border-color: var(--accent-lighter); color: var(--accent); }
.hiw-play { width: 46px; height: 46px; background: #C04C4C; border-color: #C04C4C; color: #fff; }
.hiw-play:hover { background: #D46A6A; border-color: #D46A6A; color: #fff; }
.hiw-play .hiw-i-pause, .hiw-play.is-playing .hiw-i-play { display: none; }
.hiw-play.is-playing .hiw-i-pause { display: block; }

.hiw-track { position: relative; flex: 1; min-width: 0; height: 24px; display: flex; align-items: center; }
.hiw-tick { position: absolute; top: 50%; width: 3px; height: 10px; margin: -5px 0 0 -1.5px; background: var(--bg); pointer-events: none; z-index: 1; }
.hiw-scrub {
  --p: 0%;
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 6px; border-radius: 6px; margin: 0;
  background: linear-gradient(to right, var(--accent) var(--p), var(--border) var(--p));
  cursor: pointer;
}
.hiw-scrub::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-card); border: 2px solid var(--accent);
  position: relative; z-index: 2;
}
.hiw-scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--bg-card); border: 2px solid var(--accent); }
.hiw-time { flex: none; font-family: 'JetBrains Mono', monospace; font-size: 12px; color: var(--text-secondary); min-width: 88px; text-align: right; }

.hiw-chapter-list { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 0; padding: 0; }
.hiw-chapter {
  display: inline-flex; align-items: baseline; gap: 8px;
  font: inherit; font-size: 13px; font-weight: 500;
  padding: 6px 12px; border-radius: 8px; cursor: pointer;
  color: var(--text-secondary); background: transparent; border: 1px solid var(--border);
}
.hiw-chapter span { font-family: 'JetBrains Mono', monospace; font-size: 11px; color: var(--text-muted); }
.hiw-chapter:hover { color: var(--text); border-color: var(--accent-lighter); }
.hiw-chapter[aria-current="step"] { color: var(--accent); border-color: var(--accent); background: var(--accent-faint); }

.hiw-storyboard .hiw-transport, .hiw-storyboard .hiw-chapter-list { display: none; }

/* Recap under the player on the home page. */
.hiw-recap {
  list-style: none;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px;
  margin: 40px 0 0; padding: 28px 0 0;
  border-top: 1px solid var(--border);
}
.hiw-recap h3 { font-size: 15px; font-weight: 600; margin-bottom: 6px; }
.hiw-recap p { font-size: 14px; line-height: 1.6; color: var(--text-secondary); }
.hiw-recap code { font-family: 'JetBrains Mono', monospace; font-size: 0.86em; overflow-wrap: anywhere; }

@keyframes hiw-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes hiw-blink { 50% { opacity: 0; } }
@keyframes hiw-pulse { from { opacity: 0.3; } to { opacity: 1; } }

/* The Ask Gnosys launcher is fixed bottom-right: 60px wide at 12px from the edge, 48px at 600px and below. */
@media (max-width: 920px) {
  .hiw-controls { padding-right: calc(72px + env(safe-area-inset-right, 0px)); }
  .hiw-recap { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .hiw-panes { grid-template-columns: minmax(0, 1fr); }
  .hiw-trace { border-left: 0; border-top: 1px solid var(--border); }
  .hiw-pane { padding: 12px 14px 14px; }
  .hiw-bar { padding: 0 12px; gap: 8px; }
  .hiw-clock { font-size: 11px; padding: 2px 8px; }
  :is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-screen { height: 680px; }
  :is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-panes { grid-template-rows: minmax(0, 1fr) minmax(0, 1.1fr); }
  :is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-caption { font-size: 15px; min-height: 4.6em; }
  .hiw-transport { gap: 8px; }
  .hiw-time { min-width: 0; font-size: 11px; }
  .hiw-chapter { padding: 6px 10px; }
}

@media (max-width: 600px) {
  .hiw-controls { padding-right: calc(60px + env(safe-area-inset-right, 0px)); }
  .hiw-recap { grid-template-columns: minmax(0, 1fr); gap: 16px; }
}

@media (max-width: 420px) {
  .hiw-dots { display: none; }
  :is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro-sub { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .hiw-video .is-new, .hiw-video .hiw-call.is-running .hiw-status::before { animation: none; }
  .hiw-video .hiw-typing::after { animation: none; }
  .hiw-video .hiw-intro { transition: none; }
}

@media (prefers-reduced-transparency: reduce) {
  :is(.hiw-video, .hiw-motion .hiw-player:not(.hiw-storyboard)) .hiw-intro { background: var(--bg-card); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
