/* Placement compositions for the web-ready copies of the original 3D mascot.
   Portraits, busts and complete illustrated scenes have separate aspect ratios.
   The source model and full-frame animations are preserved unchanged. */
gyani-web {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  aspect-ratio: var(--gyani-art-ratio, 1);
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
}
gyani-web[framing="bust"] { aspect-ratio: var(--gyani-art-ratio, 1); }
gyani-web[framing="portrait"] { aspect-ratio: 1; }
gyani-web[framing="scene"] { aspect-ratio: var(--gyani-art-ratio, 1); }
gyani-web > .gyani-web__media,
gyani-web > .gyani-web__stage {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
/* Legacy page selectors also style descendant images. These explicit resets
   keep the new, already-composed media inside its allotted artwork slot. */
gyani-web img.gyani-web__poster,
gyani-web img.gyani-web__animation,
gyani-web video.gyani-web__video {
  position: absolute !important;
  inset: 0 !important;
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  object-fit: contain !important;
  object-position: center bottom !important;
  transform: none !important;
  filter: none !important;
  animation: none !important;
  clip-path: none !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  pointer-events: none;
}
gyani-web[data-facing="left"] > .gyani-web__media { transform: scaleX(-1); }
gyani-web[framing="bust"]:not([static]) > .gyani-web__media {
  -webkit-mask-image: linear-gradient(#000 88%, transparent 100%);
  mask-image: linear-gradient(#000 88%, transparent 100%);
}
gyani-web[interactive="true"] { cursor: pointer; touch-action: manipulation; }
gyani-web[interactive="true"]:focus-visible {
  outline: 3px solid #0b5cff;
  outline-offset: 4px;
  border-radius: 20px;
}

/* The original study-hub artwork is a pointing bust, rather than a standing
   figure. The close crop occupies the same cell between books and board. */
.cr-mascot > gyani-web { width: 100%; height: auto; aspect-ratio: 251 / 247; }

/* Keep the book, tablet and note-writing compositions inside their original
   library artwork columns, clear of headings and search controls. */
body#notes-page .mascot-wrapper > gyani-web,
body#pyqs-page .mascot-wrapper > gyani-web,
body.testseries-body .series-search-mascot > gyani-web {
  width: min(100%, 560px); height: auto; margin-inline: auto;
}
body#games-page .arcade-home .arcade-hero__art > gyani-web {
  position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto;
}
gyani-web.pf-hero__mascot {
  left: 50%; right: auto; bottom: 0; width: 100%; max-width: 380px;
  height: 100%; aspect-ratio: auto; transform: translateX(-50%);
}
gyani-web.rw-hero__mascot {
  left: 50%; right: auto; bottom: 0; width: 100%; max-width: 100%;
  height: min(100%, 430px); aspect-ratio: auto; transform: translateX(-50%);
}
gyani-web.rw-success__gyani { width: clamp(110px, 24vw, 160px); height: auto; margin: 0 auto 12px; }
body:has(.auth-shell) .auth-visual > gyani-web {
  position: relative; width: 100%; height: 100%; aspect-ratio: auto; margin-inline: auto;
}

/* Quiz art is purposefully cropped at the torso. It fills its artwork area
   without competing with the question, timer, answers or dialog copy. */
#quiz-screen gyani-web.qp-ask__art {
  right: 30px; bottom: 0; width: 200px; height: 214px; aspect-ratio: auto;
}
.qp-pop__art > gyani-web.qp-pop__gyani {
  width: min(100%, 340px); height: auto; max-height: min(44dvh, 350px); margin-inline: auto;
}
#level-info-modal gyani-web.lv-mascot {
  width: 132px; height: 142px; aspect-ratio: auto; margin: -6px auto 8px;
  -webkit-mask-image: none; mask-image: none;
}
#results-screen gyani-web.rs-mascot { height: auto; margin-bottom: 0; aspect-ratio: 1; }
#resultPage gyani-web.tr-mascot {
  width: clamp(150px, 22vw, 240px); height: auto; align-self: center;
}
.zero-face > gyani-web { position: absolute; inset: 0; width: 100%; height: 100%; aspect-ratio: auto; }
.mascot-wrap > gyani-web.mascot { width: 100%; height: 100%; aspect-ratio: auto; animation: none; }
.gx-directory__image-card > gyani-web { width: 100%; height: 116px; aspect-ratio: auto; }
@media (max-width: 1100px) and (min-width: 901px) {
  #quiz-screen gyani-web.qp-ask__art { right: 14px; width: 180px; height: 192px; }
}
@media (max-width: 980px) {
  body:has(.auth-shell) .info-pane .auth-visual {
    position: relative !important; inset: auto !important; width: 100% !important;
    height: auto !important; min-height: 200px; max-height: 340px !important;
    margin: 0 !important; aspect-ratio: auto; overflow: visible !important;
  }
  body:has(.auth-shell) .auth-visual > gyani-web { width: min(100%, 280px); height: 320px; }
}
@media (max-width: 960px) {
  body#notes-page .mascot-wrapper > gyani-web,
  body#pyqs-page .mascot-wrapper > gyani-web,
  body.testseries-body .series-search-mascot > gyani-web { width: min(100%, 480px); }
}
@media (max-width: 900px) {
  #quiz-screen .qp-level { min-height: 236px; }
  #quiz-screen .qp-level h3,
  #quiz-screen .qp-level > p,
  #quiz-screen .qp-meter { max-width: calc(100% - 138px); }
  #quiz-screen gyani-web.qp-level__art {
    right: 6px; bottom: -2px; width: 176px; height: 208px; aspect-ratio: auto;
  }
  gyani-web.pf-hero__mascot { width: 100%; max-width: 100%; height: 100%; }
  gyani-web.rw-hero__mascot { left: auto; right: 0; width: 100%; height: 100%; transform: none; }
}
@media (max-width: 820px) {
  .qp-pop__art > gyani-web.qp-pop__gyani { width: min(100%, 220px, 26dvh); max-height: 26dvh; }
}
@media (max-width: 680px) {
  body:has(.auth-shell) .info-pane { min-height: 0 !important; grid-template-rows: auto auto auto; padding-bottom: 24px !important; }
  body:has(.auth-shell) .auth-visual > gyani-web { width: min(100%, 240px); height: 290px; }
}
@media (max-width: 480px) {
  .gx-directory__image-card > gyani-web { height: 82px; }
  #quiz-screen gyani-web.qp-level__art { right: 2px; width: 164px; height: 202px; }
}
@media (max-height: 760px) and (max-width: 820px) {
  .qp-pop__art > gyani-web.qp-pop__gyani { width: min(100%, 170px, 24dvh); max-height: 24dvh; }
}
@media (max-height: 660px) and (max-width: 820px) {
  .qp-pop__art > gyani-web.qp-pop__gyani { width: min(100%, 135px, 21dvh); max-height: 21dvh; }
}

/* Native video and its transparent compatibility fallback share one slot. */
.mascot-video-surface { position: relative; display: block; }
.mascot-video-surface > video,
.mascot-video-surface > .mascot-video-fallback,
.mascot-video-surface > .mascot-video-fallback > img {
  position: absolute; inset: 0; display: block; width: 100%; height: 100%;
  max-width: 100%; max-height: 100%; margin: 0; object-fit: contain;
  object-position: center bottom; pointer-events: none;
}
.mascot-video-fallback { opacity: 0; }
:is(gyani-web,[data-mascot-video])[data-mascot-controlled]:not([data-gyani-state="ready"]) .mascot-video-fallback,
:is(gyani-web,[data-mascot-video])[data-gyani-paused] .mascot-video-fallback { opacity: 1; }
:is(gyani-web,[data-mascot-video])[data-mascot-controlled]:not([data-gyani-state="ready"]) video,
:is(gyani-web,[data-mascot-video])[data-gyani-paused] video { opacity: 0; }
body#home .home-namaste-mascot { position: relative; aspect-ratio: 5 / 6; }
body#home .home-namaste-mascot :is(img,video) { height: 100%; }
@media (prefers-reduced-motion: reduce) {
  .mascot-video-surface > video { opacity: 0; }
  .mascot-video-fallback { opacity: 1; }
}
