/* ============================================================
   LAB ANIMATIONS & MOTION — Module styles
   ============================================================ */

/* ---- Bouton commun ---- */
.anim-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: var(--font-body);
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.anim-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in oklch, var(--accent) 10%, var(--surface-hi));
}

/* ============================================================
   01 Scroll-driven — animation-timeline
   ============================================================ */
.anim-scroller {
  max-height: 180px;
  overflow-y: auto;
  position: relative;
  scroll-timeline: --anim-sc block;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.anim-progress-track {
  position: sticky;
  top: 0;
  height: 6px;
  background: var(--surface-hi);
  z-index: 2;
}
.anim-progress {
  height: 100%;
  width: 0;
  background: var(--owl-gold);
  animation: anim-grow linear both;
  animation-timeline: --anim-sc;
}
@keyframes anim-grow { to { width: 100%; } }
.anim-scroll-content { padding: 1rem 1.25rem; }
.anim-scroll-content p { margin-bottom: 1.4rem; color: var(--text); }

/* ============================================================
   02 View Transitions API
   ============================================================ */
.anim-vt-card {
  width: 200px;
  padding: 1.5rem;
  text-align: center;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.anim-vt-emoji { font-size: 3rem; line-height: 1; }
.anim-vt-label {
  margin-top: 0.5rem;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-bright);
}

/* ============================================================
   03 @property — dégradé conique animé
   ============================================================ */
@property --anim-angle {
  syntax: '<angle>';
  initial-value: 0deg;
  inherits: false;
}
.anim-neon {
  display: grid;
  place-items: center;
  width: 150px;
  height: 84px;
  font-family: var(--font-mono);
  color: var(--text-bright);
  border: 2px solid transparent;
  border-radius: var(--radius);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from var(--anim-angle), transparent 0%, var(--owl-gold) 15%, #ffe9a0 25%, var(--owl-gold) 35%, transparent 50%) border-box;
  animation: anim-spin 3s linear infinite;
}
@keyframes anim-spin { to { --anim-angle: 360deg; } }

/* ============================================================
   04 @starting-style + allow-discrete
   ============================================================ */
.anim-pop {
  margin-top: 1rem;
  display: none;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.3s ease, transform 0.3s ease, display 0.3s allow-discrete;
  max-width: 340px;
  padding: 1rem;
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  background: var(--surface-hi);
}
.anim-pop strong { color: var(--text-bright); }
.anim-pop p { margin-top: 0.4rem; color: var(--text); }
.anim-pop.is-open {
  display: block;
  opacity: 1;
  transform: none;
}
@starting-style {
  .anim-pop.is-open {
    opacity: 0;
    transform: translateY(8px);
  }
}

/* ============================================================
   05 Easing — playground cubic-bezier
   ============================================================ */
.anim-bezier-track {
  position: relative;
  height: 44px;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: 99px;
  margin-bottom: 0.75rem;
}
.anim-ball {
  position: absolute;
  top: 5px;
  left: 5px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--owl-gold);
}
.anim-ball.play {
  animation: anim-slide 1s var(--anim-ease, ease) forwards;
}
@keyframes anim-slide { to { left: calc(100% - 37px); } }
.anim-bezier-value {
  display: block;
  font-size: 0.8rem;
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.anim-bezier-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1.25rem;
  margin-bottom: 0.25rem;
}
.anim-bezier-controls label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-muted);
}
.anim-bezier-controls input {
  flex: 1;
  accent-color: var(--owl-gold);
}

/* ============================================================
   06 Reveal en cascade
   ============================================================ */
.anim-stagger {
  display: flex;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.anim-stagger-item {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--surface-hi);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-bright);
  font-family: var(--font-display);
  font-weight: 700;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  transition-delay: calc(var(--i) * 80ms);
}
.anim-stagger-item.in {
  opacity: 1;
  transform: none;
}

/* ---- Respect des préférences moteur (a11y) ---- */
@media (prefers-reduced-motion: reduce) {
  .anim-progress,
  .anim-neon,
  .anim-ball.play { animation: none; }
  .anim-stagger-item {
    transition: none;
    transition-delay: 0s;
    opacity: 1;
    transform: none;
  }
  .anim-progress { width: 100%; }
}
