/* Nova, the visible AI tutor window (public/nova.js). Lightweight CSS animation only: no video,
   no generated imagery. Every state is also said in words in .nova-status. */

.nova {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.4rem;
  padding: 0.75rem;
  border-radius: 1rem;
  background: #ffffff;
  border: 1px solid #ddd8f5;
  color: #1d1b3a;
}

.nova-frame {
  position: relative;
  width: 100%;
  max-width: 12rem;
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  border-radius: 1rem;
  overflow: hidden;
  background: radial-gradient(circle at 50% 40%, #3b2f7a 0%, #1d1b3a 100%);
  box-shadow: inset 0 0 0 3px #9a8cff;
}

.nova-avatar {
  position: absolute;
  inset: 12%;
  width: 76%;
  height: 76%;
  transform-origin: 50% 60%;
}

.nova-fx { position: absolute; inset: 0; pointer-events: none; }

.nova-name { margin: 0; font-size: 1rem; }
.nova-ai {
  display: inline-block;
  padding: 0 0.45rem;
  border-radius: 999px;
  background: #ecebff;
  color: #2c1f5e;
  font-size: 0.8rem;
  font-weight: 600;
}
.nova-status { margin: 0; font-weight: 600; color: #2c1f5e; }
.nova-caption { margin: 0; font-size: 0.95rem; line-height: 1.4; }
.nova-note { margin: 0; font-size: 0.75rem; color: #4a4766; }
.nova-simulated {
  margin: 0;
  padding: 0.2rem 0.5rem;
  border-radius: 0.5rem;
  background: #fff4d6;
  color: #5c3b00;
  font-size: 0.8rem;
  font-weight: 600;
}
.nova-simulated[hidden] { display: none; }
.nova-caption, .nova-actions, .nova-note, .nova-simulated { grid-column: 1 / -1; }
.nova-actions { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.nova-action {
  min-height: 44px;
  padding: 0.4rem 0.8rem;
  border-radius: 0.75rem;
  border: 2px solid #5b4cdb;
  background: #ffffff;
  color: #2c1f5e;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.nova-action:focus-visible { outline: 3px solid #ffb020; outline-offset: 2px; }

/* States */
.nova[data-state="idle"] .nova-avatar { animation: nova-float 4s ease-in-out infinite; }
.nova[data-state="speaking"] .nova-avatar { animation: nova-talk 0.45s ease-in-out infinite alternate; }
.nova[data-state="speaking"] .nova-fx {
  background: radial-gradient(circle at 50% 55%, transparent 52%, rgba(255, 204, 61, 0.35) 54%, transparent 58%);
  animation: nova-wave 1s linear infinite;
}
.nova[data-state="listening"] .nova-frame { box-shadow: inset 0 0 0 4px #2bb3a3; }
.nova[data-state="listening"] .nova-fx {
  border-radius: 1rem;
  box-shadow: inset 0 0 0 0 rgba(43, 179, 163, 0.6);
  animation: nova-pulse 1.4s ease-out infinite;
}
.nova[data-state="thinking"] .nova-avatar { animation: nova-tilt 1.6s ease-in-out infinite; opacity: 0.9; }
.nova[data-state="thinking"] .nova-fx {
  background:
    radial-gradient(circle at 40% 88%, #ffffff 3%, transparent 4%),
    radial-gradient(circle at 50% 88%, #ffffff 3%, transparent 4%),
    radial-gradient(circle at 60% 88%, #ffffff 3%, transparent 4%);
  animation: nova-blink 1.2s steps(3) infinite;
}
.nova[data-state="waiting"] .nova-frame { box-shadow: inset 0 0 0 4px #ffb020; }
.nova[data-state="waiting"] .nova-status { color: #7a4a00; }

@keyframes nova-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4%); } }
@keyframes nova-talk { from { transform: scale(1); } to { transform: scale(1.06, 0.97); } }
@keyframes nova-wave { from { transform: scale(0.8); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }
@keyframes nova-pulse { 0% { box-shadow: inset 0 0 0 0 rgba(43, 179, 163, 0.6); } 100% { box-shadow: inset 0 0 0 1.2rem rgba(43, 179, 163, 0); } }
@keyframes nova-tilt { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes nova-blink { 0% { opacity: 0.3; } 100% { opacity: 1; } }

/* Reduced motion: no movement; states stay distinguishable by the frame colour and the words. */
@media (prefers-reduced-motion: reduce) {
  .nova .nova-avatar, .nova .nova-fx { animation: none !important; }
  .nova[data-state="speaking"] .nova-frame { box-shadow: inset 0 0 0 4px #ffcc3d; }
  .nova[data-state="thinking"] .nova-frame { box-shadow: inset 0 0 0 4px #9a8cff; }
}

/* Below the workspace's sidebar width (1024px, public/workspace.css) Nova sits at the top of the
   lesson column: a compact strip (small square + words) that never covers the question or answers. */
@media (max-width: 1023px) {
  .nova {
    grid-template-columns: 4rem 1fr;
    align-items: center;
    column-gap: 0.6rem;
    padding: 0.5rem;
  }
  .nova-frame { grid-row: span 2; width: 4rem; max-width: 4rem; }
  .nova-caption, .nova-actions, .nova-note { grid-column: 1 / -1; }
}
