/* ==========================================================================
   AI avatar section — requires tokens.css + base.css.
   Two avatars, chosen by language (see docs/AI-AVATAR.md):
     ball  → Arabic · Kurdish Sorani · Turkmen      (WebGL logo globe, from the main Sahib repo)
     cube  → English                                 (CSS 3D cube that spells sa · hi · b.)
   ========================================================================== */

/* ---- Ball: the Sahib avatar class reads --sahib-avatar-* ; bridge them to design tokens (no JS edits) ---- */
.ds-ai-avatar {
  --sahib-avatar-c1: var(--ds-avatar-ball-c1); --sahib-avatar-c2: var(--ds-avatar-ball-c2); --sahib-avatar-c3: var(--ds-avatar-ball-c3);
  --sahib-avatar-x1: var(--ds-avatar-ball-x1); --sahib-avatar-x2: var(--ds-avatar-ball-x2); --sahib-avatar-x3: var(--ds-avatar-ball-x3);
  --sahib-avatar-p1: var(--ds-avatar-ball-p1); --sahib-avatar-p2: var(--ds-avatar-ball-p2); --sahib-avatar-p3: var(--ds-avatar-ball-p3);
  --sahib-avatar-g1: var(--ds-avatar-ball-g1); --sahib-avatar-g2: var(--ds-avatar-ball-g2); --sahib-avatar-g3: var(--ds-avatar-ball-g3);
  --sahib-avatar-r1: var(--ds-avatar-ball-r1); --sahib-avatar-r2: var(--ds-avatar-ball-r2); --sahib-avatar-r3: var(--ds-avatar-ball-r3);
  display: inline-grid; place-items: center; flex: none; line-height: 0;
}
.ds-ai-avatar > img { display: block; object-fit: contain; }          /* static fallback (no WebGL / no THREE) */

/* ---- Cube (English): sizes come from --size on the stage; cube width s = stage / 1.9 (the artifact's ratio) ---- */
.ds-cube-stage {
  --s: calc(var(--size, 96px) / 1.9);
  inline-size: var(--size, 96px); block-size: var(--size, 96px); max-inline-size: 100%;
  perspective: calc(var(--s) * 5); display: grid; place-items: center; position: relative; user-select: none; flex: none;
}
.ds-cube-stage[data-interactive] { cursor: grab; touch-action: none; }
.ds-cube-stage[data-interactive]:active { cursor: grabbing; }
.ds-cube-stage::after {
  content: ""; position: absolute; inset-block-end: 4%; inset-inline-start: 50%; translate: calc(var(--ds-dir-sign) * -50%) 0;
  inline-size: calc(var(--s) * 1.1); block-size: calc(var(--s) * 0.16);
  background: radial-gradient(closest-side, var(--ds-avatar-cube-shadow), transparent); pointer-events: none;
}
.ds-cube { --h: calc(var(--s) * 1985 / 2296); inline-size: var(--s); block-size: var(--h); position: relative; transform-style: preserve-3d; }
.ds-cube-face { position: absolute; display: grid; place-items: center; will-change: opacity;
  background: linear-gradient(180deg, var(--ds-avatar-cube-plate-a), var(--ds-avatar-cube-plate-b)); }   /* fills the face's negative space; alpha < 1 keeps a hint of glass */
.ds-cube-side { inset: 0; }
.ds-cube-side::after { content: ""; position: absolute; inset: 0; background: linear-gradient(135deg, var(--ds-avatar-cube-sheen) 0%, transparent 40%); pointer-events: none; }
.ds-cube-cap { inset-inline-start: 0; inset-block-start: calc((var(--h) - var(--s)) / 2); inline-size: var(--s); block-size: var(--s); opacity: 0; }
.ds-cube-face img { inline-size: 100%; block-size: 100%; display: block; pointer-events: none; -webkit-user-drag: none; }
.ds-cube-cap img { object-fit: contain; }
.ds-cube-f1 { transform: rotateY(0deg) translateZ(calc(var(--s) / 2)); }
.ds-cube-f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.ds-cube-f3 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.ds-cube-f4 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.ds-cube-f5 { transform: rotateX(90deg) translateZ(calc(var(--h) / 2)); }
.ds-cube-f6 { transform: rotateX(-90deg) translateZ(calc(var(--h) / 2)); }

/* ---- AI profile section: avatar + name + tagline. Avatar sits on the inline start; mirrors in RTL for free. ---- */
.ds-ai-profile { inline-size: 100%; display: flex; align-items: center; gap: var(--ds-space-8); padding-block: var(--ds-space-10); margin-block-end: var(--ds-space-4); }
.ds-ai-profile__info { display: flex; flex-direction: column; gap: var(--ds-space-2); min-inline-size: 0; }
.ds-ai-profile__name { margin: 0; font-size: var(--ds-font-size-2xl); font-weight: 700; line-height: var(--ds-font-leading-tight); color: var(--ds-text-primary); }
.ds-ai-profile__tagline { margin: 0; font-size: var(--ds-font-size-md); line-height: var(--ds-leading-body); color: var(--ds-text-secondary); max-inline-size: var(--ds-size-prose-max); }
.ds-ai-profile--compact { gap: var(--ds-space-4); padding-block: var(--ds-space-3); }
.ds-ai-profile--compact .ds-ai-profile__name { font-size: var(--ds-font-size-lg); }
@media (max-width: 640px) {
  .ds-ai-profile:not(.ds-ai-profile--compact) { flex-direction: column; text-align: center; padding-block: var(--ds-space-6); }
}
