/* Kaltura Agents Design System — tokens per Kaltura_Agents_Design_System.md §2, §4, §8 */

:root {
  --ds-roundness-1: 4px;
  --ds-roundness-2: 8px;
  --ds-roundness-3: 12px;
  --ds-font-family: 'Lato', sans-serif;
  --sidebar-width: 17rem;
  --header-height: 4rem;
}

[data-theme='dark'] {
  --ds-primary: #006efa;
  --ds-danger: #ca1c2d;
  --ds-warning: #e86925;
  --ds-screen-green: #00a078;

  --ds-tone-1: #ffffff;
  --ds-tone-2: #cccccc;
  --ds-tone-3: #999999;
  --ds-tone-4: #666666;
  --ds-tone-5: #525252;
  --ds-tone-6: #383838;
  --ds-tone-7: #212121;
  --ds-tone-8: #000000;

  --page-bg: #121212;
  --card-bg: #242424;
  --elevated-bg: #333333;
  --page-text: var(--ds-tone-1);
  --secondary-text: var(--ds-tone-2);
  --border-color: rgba(153, 153, 153, 0.25);
  --hover-bg: var(--ds-tone-5);
  --code-bg: #1a1a1a;
}

[data-theme='light'] {
  --ds-primary: #3525cd;
  --ds-danger: #ba1a1a;
  --ds-warning: #95002b;
  --ds-screen-green: #006c49;

  --page-bg: #f8f9ff;
  --card-bg: #ffffff;
  --elevated-bg: #eff4ff;
  --page-text: #0b1c30;
  --secondary-text: #464555;
  --border-color: rgba(199, 196, 216, 0.35);
  --hover-bg: #dce9ff;
  --code-bg: #eef1fb;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--page-bg);
  color: var(--page-text);
  font-family: var(--ds-font-family);
  font-size: 16px;
  line-height: 1.6;
  transition: background-color 200ms ease, color 200ms ease;
}

a {
  color: var(--ds-primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1,
h2,
h3,
h4 {
  font-weight: 700;
  line-height: 1.25;
}

h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h2 {
  font-size: 1.4rem;
  margin-top: 2.5rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-color);
}

h3 {
  font-size: 1.15rem;
  margin-top: 2rem;
}

/* Code — monospace is a functional requirement for reading/copying real code
   samples on a developer reference site, not decorative chrome; scoped only
   to pre/code so prose stays on the DS type scale. */
code,
pre {
  font-family: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.875em;
}

code {
  background: var(--code-bg);
  padding: 0.15em 0.4em;
  border-radius: var(--ds-roundness-1);
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  border-radius: var(--ds-roundness-2);
  overflow-x: auto;
  border: 1px solid var(--border-color);
}

pre code {
  background: none;
  padding: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}

th {
  color: var(--secondary-text);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

blockquote {
  margin: 1rem 0;
  padding: 0.25rem 1rem;
  border-left: 4px solid var(--ds-primary);
  color: var(--secondary-text);
}

/* Layout shell — design doc §6 */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--elevated-bg);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 10;
}

.site-header .logo img {
  height: 28px;
  display: block;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-color);
  color: var(--page-text);
  border-radius: var(--ds-roundness-3);
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.theme-toggle:hover {
  background: var(--hover-bg);
}

.theme-toggle:focus-visible,
.menu-toggle:focus-visible,
.nova-btn:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

.gh-link {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--page-text);
}

.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--elevated-bg);
  border-right: 1px solid var(--border-color);
  overflow-y: auto;
  padding: 1.5rem 0;
  /* body.home .nova-hero is full-bleed (width:100vw, negative left offset) so
     it spans underneath the fixed sidebar's screen area too; both are
     positioned with z-index:auto, so without this the hero — later in DOM —
     paints over the sidebar and blocks its nav links wherever they overlap
     vertically. */
  z-index: 5;
}

.nav-group {
  margin-bottom: 1.5rem;
}

.nav-group-label {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--secondary-text);
  padding: 0 1.5rem;
  margin-bottom: 0.5rem;
}

.nav-group ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-group a {
  display: block;
  padding: 0.5rem 1.5rem;
  color: var(--secondary-text);
  font-size: 0.9rem;
  font-weight: 500;
  border-right: 3px solid transparent;
}

.nav-group a:hover {
  background: var(--hover-bg);
  text-decoration: none;
}

.nav-group a[aria-current='page'] {
  color: var(--ds-primary);
  border-right-color: var(--ds-primary);
  background: var(--hover-bg);
  font-weight: 700;
}

.content-wrapper {
  margin-left: var(--sidebar-width);
  margin-top: var(--header-height);
  padding: 2.5rem 3rem;
  max-width: 860px;
}

.eyebrow {
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ds-primary);
}

.material-symbols-outlined {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 22px;
  line-height: 1;
  display: inline-block;
  vertical-align: middle;
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--page-text);
  cursor: pointer;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 200ms ease-in-out;
    z-index: 9;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .content-wrapper {
    margin-left: 0;
    padding: 1.5rem;
  }

  .menu-toggle {
    display: flex;
  }
}

@media (max-width: 600px) {
  .content-wrapper {
    padding: 1rem;
  }

  h1 {
    font-size: 1.6rem;
  }
}

/* Nova — the live docs-avatar widget, persistent site-wide (base.njk).
   #nova-widget is always position:fixed and never re-parented; its inline
   top/left/width/height are written entirely by nova/dock.js — either
   tracking #nova-hero-slot's rect (hero mode, homepage only) or the
   standing dock rect (every other page/state). overflow stays visible on
   the widget itself so .nova-panel can spill outside the small dock
   circle; the circular/rounded clip lives on .nova-video-wrap instead. */

.nova-widget {
  position: fixed;
  overflow: visible;
  z-index: 20;
}

.nova-video-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  /* Idle fallback only — the <video poster> (Nova's real portrait, set in
     connect.js) covers this almost immediately, so this gradient is just
     what's visible for an instant before the poster paints. */
  background: radial-gradient(circle at 30% 25%, color-mix(in srgb, var(--ds-primary) 35%, transparent), transparent 55%),
    radial-gradient(circle at 75% 75%, var(--hover-bg), transparent 60%), radial-gradient(circle at 50% 42%, var(--hover-bg), var(--elevated-bg) 70%);
  overflow: hidden;
  animation: nova-idle-breathe 4s ease-in-out infinite;
}

/* .nova-placeholder gets .hidden the moment connect.js's session.connect()
   resolves — reuse that as the "video is actually live" signal rather than
   introducing a separate JS-set flag. */
.nova-video-wrap:has(.nova-placeholder.hidden) {
  animation: none;
}

@keyframes nova-idle-breathe {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.06);
  }
}

/* Three explicit agent states, mirroring the idle/thinking/talking
   vocabulary conversational-AI widgets use (e.g. ElevenLabs UI's Orb) —
   adapted to this card's own radial-gradient/box-shadow system instead of a
   WebGL orb, keeping the SDK's zero-runtime-dependency, no-bundler stance. */
.nova-video-wrap.is-connecting {
  animation: nova-connecting-pulse 1s ease-in-out infinite;
}

@keyframes nova-connecting-pulse {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.18);
  }
}

.nova-video-wrap.is-talking {
  animation: nova-talk-pulse 900ms ease-in-out infinite;
}

/* box-shadow would draw a hard rectangle behind the vignette mask (masks
   clip the whole element, shadow included) — a saturate/brightness pulse on
   the masked content itself reads as "alive" without redrawing an edge. */
@keyframes nova-talk-pulse {
  0%,
  100% {
    filter: brightness(1) saturate(1);
  }
  50% {
    filter: brightness(1.1) saturate(1.15);
  }
}


.nova-video-wrap video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  /* Frameless: the mask lives on the video/poster itself, not the wrap, so
     the CTA caption + controls layered on top (siblings in the wrap) stay
     fully legible — only the portrait's own outer ring fades to
     transparent, bleeding into --page-bg instead of a hard rectangle edge. */
  -webkit-mask-image: radial-gradient(ellipse 55% 62% at 50% 42%, black 55%, transparent 100%);
  mask-image: radial-gradient(ellipse 55% 62% at 50% 42%, black 55%, transparent 100%);
}

/* Nova's real portrait (the <video poster>) is the focal point now — this
   overlay is just a bottom-anchored CTA caption over it, like Docket's
   "Talk to Aura" prompt over its own always-visible avatar, not an opaque
   scrim that hides the face behind flat color. */
.nova-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  text-align: center;
  padding: 1.5rem 1.5rem 2.5rem;
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.7) 100%);
  cursor: pointer;
}

.nova-placeholder-icon {
  font-size: 1.75rem;
  opacity: 0.9;
  animation: nova-icon-pulse 2.6s ease-in-out infinite;
}

@keyframes nova-icon-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.7;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

.nova-placeholder.hidden {
  display: none;
}

.nova-disclosure {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  /* .nova-panel now overlays the video's bottom edge and grows upward with
     the transcript — anchoring the disclosure banner to the top instead
     keeps it clear of that overlay regardless of how tall the panel gets. */
  top: 0.75rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.7rem;
  text-align: center;
  padding: 0.4rem 0.65rem;
  border-radius: var(--ds-roundness-1);
}

.nova-disclosure.hidden,
.nova-widget.dock-mode .nova-disclosure {
  display: none;
}

.nova-disclosure-chip {
  position: absolute;
  bottom: -4px;
  right: -4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--ds-primary);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--page-bg);
  cursor: default;
}

.nova-disclosure-chip.hidden,
.nova-widget:not(.dock-mode) .nova-disclosure-chip {
  display: none;
}

/* Hero mode: the panel (controls/status/transcript) overlays the bottom of
   the video itself, like a real video-call control tray — not a separate
   block floating in the page background below it. A scrim keeps it legible
   over any video content; growth stays inside the video's own footprint. */
.nova-panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  padding: 2.5rem 1rem 1rem;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.7) 60%);
  border-radius: 0 0 var(--ds-roundness-3) var(--ds-roundness-3);
  color: #fff;
}

.nova-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.nova-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--page-text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease;
}

.nova-btn:hover:not(:disabled) {
  background: var(--hover-bg);
}

.nova-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

/* Mute/End only mean anything once a session exists — connect.js disables
   them at rest and enables them on session.connect(); showing them
   greyed-out the whole time reads as a redundant affordance next to the
   video itself, which is the click target that starts a session. Hide
   instead of just dimming. */
#nova-mute:disabled,
#nova-end:disabled {
  display: none;
}

.nova-status {
  margin-top: 0.6rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.8);
  min-height: 1.2em;
}

.nova-transcript {
  margin-top: 0.5rem;
  /* .nova-panel overlays the video's own bottom edge (see .nova-panel) — this
     cap keeps a full transcript from growing tall enough to cover most of
     the video above it, not to reserve page space below the hero. */
  max-height: 6rem;
  overflow-y: auto;
  font-size: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  padding-top: 0.5rem;
}

/* No messages yet: don't render a dangling border/gap on the video overlay. */
.nova-transcript:empty {
  display: none;
}

.nova-transcript p {
  margin: 0.4rem 0;
}

.nova-transcript .nova-you {
  color: rgba(255, 255, 255, 0.65);
}

.nova-transcript .nova-nova {
  color: #fff;
}

/* Dock mode — small circular floating widget, standing in a viewport
   corner (rect computed by dock.js). The panel can't render inline at
   this size, so it collapses to a click-to-expand flyout. */
.nova-widget.dock-mode {
  cursor: pointer;
}

.nova-widget.dock-mode .nova-video-wrap {
  border-radius: 50%;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.nova-widget.dock-mode .nova-video-wrap video {
  mask-image: none;
  -webkit-mask-image: none;
}

/* A full sentence can't read in a 96px circle — swap it for a mic glyph. */
.nova-widget.dock-mode .nova-placeholder {
  font-size: 0;
  padding: 0;
}

.nova-widget.dock-mode .nova-placeholder::before {
  content: 'mic';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 56px;
  color: #fff;
}

.nova-widget.dock-mode .nova-panel {
  display: none;
}

.nova-widget.dock-mode.expanded .nova-panel {
  display: block;
  position: absolute;
  bottom: calc(100% + 0.75rem);
  right: 0;
  top: auto;
  left: auto;
  width: 280px;
  max-width: calc(100vw - 48px);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: var(--ds-roundness-3);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
  padding: 1rem;
  z-index: 21;
  /* Unlike the inline/hero .nova-panel, this flyout sits on the themed
     --card-bg, not a permanent black video scrim — the white text/border
     values above are tuned for that scrim and read as invisible-on-white
     in light mode without these resets. */
  color: var(--page-text);
}

.nova-widget.dock-mode.expanded .nova-status {
  color: var(--secondary-text);
}

.nova-widget.dock-mode.expanded .nova-transcript {
  border-top-color: var(--border-color);
}

.nova-widget.dock-mode.expanded .nova-transcript .nova-you {
  color: var(--secondary-text);
}

.nova-widget.dock-mode.expanded .nova-transcript .nova-nova {
  color: var(--page-text);
}

.nova-highlight-ring {
  position: fixed;
  border: 1.5px solid var(--ds-primary);
  border-radius: var(--ds-roundness-2);
  pointer-events: none;
  z-index: 19;
  animation:
    nova-ring-in 320ms cubic-bezier(0.22, 1, 0.36, 1) both,
    nova-ring-pulse 2.2s ease-in-out 320ms infinite;
}

@keyframes nova-ring-in {
  from {
    opacity: 0;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes nova-ring-pulse {
  0%,
  100% {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--ds-primary) 16%, transparent),
      0 0 20px 2px color-mix(in srgb, var(--ds-primary) 28%, transparent);
  }
  50% {
    box-shadow:
      0 0 0 5px color-mix(in srgb, var(--ds-primary) 24%, transparent),
      0 0 32px 6px color-mix(in srgb, var(--ds-primary) 42%, transparent);
  }
}

/* Natural expiry only (see dock.js's clearPointing) — a scroll/nav interrupt removes the
   ring outright with no transition, since its position is stale the instant either happens. */
.nova-highlight-ring.is-leaving {
  animation: none;
  transition: opacity 300ms ease, transform 300ms ease;
  opacity: 0;
  transform: scale(0.98);
}

/* Hero section — homepage only. Full-bleed to the viewport's right edge
   while its inner content stays aligned with the normal reading column
   (the standard margin-inline: calc(50% - 50vw) trick, adapted for this
   layout's fixed, non-centered sidebar offset). */
body.home .nova-hero {
  position: relative;
  left: calc(-1 * (var(--sidebar-width) + 3rem));
  width: 100vw;
  margin: 2rem 0 3rem;
  padding: 3.5rem 3rem 3.5rem calc(var(--sidebar-width) + 3rem);
  background: linear-gradient(180deg, var(--elevated-bg), var(--page-bg));
}

.nova-hero-inner {
  display: flex;
  /* The visual column (video + floating panel) runs taller than the copy
     column — centering them vertically strands the "Talk to Nova" button
     far below the copy's own CTA. Sharing a top edge keeps both calls to
     action in the same visual band. */
  align-items: flex-start;
  justify-content: space-between;
  gap: 3rem;
  max-width: 1400px;
}

.nova-hero-copy {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 34rem;
}

.nova-hero-copy h2 {
  margin: 0 0 1rem;
  font-size: 2.25rem;
  letter-spacing: -0.01em;
  border-bottom: none;
  padding-bottom: 0;
}

.nova-hero-copy p {
  max-width: 32rem;
  font-size: 1.05rem;
  color: var(--secondary-text);
}

/* NN/g's "use-case prompt suggestion" pattern (the pills ChatGPT/Claude/Poe
   show pre-auth): real, focusable buttons — not decorative chrome — that
   both start the session and ask their exact question in one click. */
.nova-hero-prompts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1.5rem;
}

.nova-hero-prompts.hidden {
  display: none;
}

.nova-hero-prompts-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--secondary-text);
  margin-right: 0.15rem;
}

.nova-chip {
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--page-text);
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 999px;
  padding: 0.5rem 1rem;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background-color 150ms ease, border-color 150ms ease;
}

.nova-chip:hover {
  background: var(--hover-bg);
  border-color: var(--ds-primary);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px -8px rgba(0, 0, 0, 0.35);
}

.nova-chip:focus-visible {
  outline: 2px solid var(--ds-primary);
  outline-offset: 2px;
}

.nova-hero-visual {
  position: relative;
  flex: 0 1 440px;
  width: 100%;
  max-width: 440px;
  /* A tall, human portrait ratio (matching Nova's actual catalog-visual
     framing) instead of a square — reads as a person-sized presence, not
     an icon-sized call card. */
  aspect-ratio: 3 / 4;
  max-height: min(65vh, 560px);
  transition: transform 200ms ease;
}

/* Lift-on-hover affordance (Fitts's-law-style visual feedback that the
   avatar is a real target) — scoped to before a session starts, so a live
   call's controls/transcript don't jitter under the pointer. */
.nova-hero-visual:has(.nova-placeholder:not(.hidden)):hover {
  transform: translateY(-3px);
  cursor: pointer;
}

.nova-hero-visual:has(.nova-placeholder:not(.hidden)):hover .nova-video-wrap {
  filter: brightness(1.04);
}

/* Between this and the sidebar-collapse breakpoint (900px, see .sidebar's own
   media query), the sidebar is still fixed and visible, so .nova-hero itself
   keeps its normal offset/padding — only the copy/visual pair stacks. Without
   this, default flex-shrink crushes .nova-hero-visual down to ~225px at
   common "small laptop" widths like 1024x768 well before the 900px
   breakpoint, wrapping the caption onto 3 cramped lines. */
@media (max-width: 1200px) and (min-width: 901px) {
  .nova-hero-inner {
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;
  }

  .nova-hero-copy {
    max-width: none;
  }

  .nova-hero-visual {
    max-width: 320px;
    max-height: min(55vh, 420px);
  }
}

@media (max-width: 900px) {
  body.home .nova-hero {
    left: -1.5rem;
    padding: 2.5rem 1.5rem;
  }

  .nova-hero-inner {
    flex-direction: column;
    justify-content: flex-start;
    gap: 2rem;
  }

  .nova-hero-copy {
    max-width: none;
  }

  .nova-hero-visual {
    max-width: 320px;
    max-height: min(55vh, 420px);
  }
}

@media (max-width: 600px) {
  body.home .nova-hero {
    left: -1rem;
    padding: 2rem 1rem;
  }

  .nova-hero-copy h2 {
    font-size: 1.75rem;
  }

  .nova-hero-visual {
    max-width: 260px;
    max-height: min(48vh, 340px);
  }
}
