/* Fidelissimo shared motion layer
   Purposeful, lightweight animations that preserve the platform rhythm. */

:root {
  --motion-ease: cubic-bezier(.2, .8, .2, 1);
  --motion-soft: cubic-bezier(.16, 1, .3, 1);
}

@keyframes fd-page-rise {
  from {
    opacity: 0;
    transform: translateY(18px);
    filter: blur(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

@keyframes fd-body-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fd-soft-pop {
  0% {
    opacity: 0;
    transform: translateY(14px) scale(.985);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes fd-orbit {
  to { transform: rotate(360deg); }
}

@keyframes fd-shimmer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(160%); }
}

@keyframes fd-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 rgba(184, 146, 76, 0); }
  50% { box-shadow: 0 0 0 8px rgba(184, 146, 76, .12); }
}

@keyframes fd-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

@keyframes fd-chart-draw {
  from {
    stroke-dashoffset: 760;
    opacity: .2;
  }
  to {
    stroke-dashoffset: 0;
    opacity: 1;
  }
}

@keyframes fd-chart-fill {
  from {
    opacity: 0;
    transform: scale(.92);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fd-radar-breathe {
  0%, 100% {
    opacity: .82;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.035);
  }
}

@keyframes fd-bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes fd-heatwave {
  0%, 100% {
    transform: scale(1);
    filter: saturate(1);
  }
  50% {
    transform: scale(1.035);
    filter: saturate(1.12);
  }
}

@keyframes fd-node-pulse {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 0 rgba(107, 63, 160, 0));
  }
  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 5px 10px rgba(107, 63, 160, .22));
  }
}

@keyframes fd-ring-spin {
  to { stroke-dashoffset: -180; }
}

@keyframes fd-data-flicker {
  0%, 100% { opacity: .9; }
  50% { opacity: 1; }
}

body {
  animation: fd-body-fade .5s var(--motion-soft) both;
}

.fd-page-main,
.follow-shell,
.learn-main,
main.wrap,
.page,
.shell {
  animation: fd-soft-pop .64s var(--motion-soft) both;
}

.fd-sidebar {
  animation: fd-page-rise .52s var(--motion-soft) both;
}

.fd-brand-mark,
.brand-mark {
  position: relative;
  overflow: hidden;
}

.fd-brand-mark::after,
.brand-mark::after {
  content: "";
  position: absolute;
  inset: -45%;
  background: conic-gradient(from 120deg, transparent, rgba(245, 239, 226, .28), transparent 34%);
  animation: fd-orbit 7s linear infinite;
  pointer-events: none;
}

.fd-nav a,
.app-nav a {
  transition: transform .18s var(--motion-ease), background .18s var(--motion-ease), color .18s var(--motion-ease), box-shadow .18s var(--motion-ease);
}

.fd-nav a:hover,
.app-nav a:hover {
  transform: translateX(4px);
}

.fd-nav a.active,
.app-nav a.active {
  animation: fd-soft-pop .34s var(--motion-soft) both;
}

.hero,
.hero-identity,
.course-hero,
.block,
.card,
.subject,
.course,
.f-card,
.k,
.stat-card,
.metric-card,
.job-card,
.price,
.rule,
.model-card,
.chest,
.inventory-item,
.pod-card,
.student-row,
.matter-card {
  animation: fd-soft-pop .52s var(--motion-soft) both;
  transition: transform .2s var(--motion-ease), box-shadow .2s var(--motion-ease), border-color .2s var(--motion-ease), background .2s var(--motion-ease);
}

.block:nth-of-type(2),
.card:nth-of-type(2),
.subject:nth-of-type(2),
.course:nth-of-type(2),
.f-card:nth-of-type(2),
.pod-card:nth-of-type(2),
.student-row:nth-of-type(2),
.matter-card:nth-of-type(2) {
  animation-delay: .04s;
}

.block:nth-of-type(3),
.card:nth-of-type(3),
.subject:nth-of-type(3),
.course:nth-of-type(3),
.f-card:nth-of-type(3),
.pod-card:nth-of-type(3),
.student-row:nth-of-type(3),
.matter-card:nth-of-type(3) {
  animation-delay: .08s;
}

.block:nth-of-type(4),
.card:nth-of-type(4),
.subject:nth-of-type(4),
.course:nth-of-type(4),
.f-card:nth-of-type(4),
.pod-card:nth-of-type(4),
.student-row:nth-of-type(4),
.matter-card:nth-of-type(4) {
  animation-delay: .12s;
}

.card:hover,
.course:hover,
.subject:hover,
.f-card:hover,
.job-card:hover,
.pod-card:hover,
.inventory-item:hover,
.chest:hover {
  transform: translateY(-3px);
}

button,
a[class*="btn"],
.btn,
.new-course,
.mode-chip,
.mode-pill,
.eco-pill,
.credit-pill,
.tag,
.b,
.badge,
.chip,
.chip-opt,
.import-chip {
  transition: transform .18s var(--motion-ease), box-shadow .18s var(--motion-ease), background .18s var(--motion-ease), border-color .18s var(--motion-ease), color .18s var(--motion-ease);
}

button:hover,
a[class*="btn"]:hover,
.btn:hover,
.new-course:hover,
.mode-chip:hover,
.mode-pill:hover,
.eco-pill:hover,
.credit-pill:hover,
.chip-opt:hover,
.import-chip:hover {
  transform: translateY(-2px);
}

.xp,
.cost,
.cost-mini,
.credit-price,
.amount,
.tag,
.loot-chip,
.rc-bonus,
.r-xp {
  animation: fd-pulse-glow 2.8s ease-in-out infinite;
}

.progress,
.bar,
.streak-return-progress,
.streak-mini-track,
.level-fill,
.meter,
.track {
  position: relative;
  overflow: hidden;
}

.progress i,
.bar i,
.streak-return-progress i,
.streak-mini-track i,
.level-fill i,
.meter i,
.track i {
  position: relative;
  overflow: hidden;
}

.progress i::after,
.bar i::after,
.streak-return-progress i::after,
.streak-mini-track i::after,
.level-fill i::after,
.meter i::after,
.track i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .5), transparent);
  animation: fd-shimmer 2.6s linear infinite;
}

.progress i,
.bar i,
.oc-bar i,
.lb-bar i,
.r-prog .bar i,
.rc-retention .bar i,
.chall-bar i,
.boss-hp .bar i,
.stat-bar i,
.q-progress .fill,
.bar-fill {
  transform-origin: left center;
  animation: fd-bar-grow .9s var(--motion-soft) both, fd-data-flicker 4.5s ease-in-out infinite .9s;
}

.oc-bar i,
.lb-bar i,
.r-prog .bar i,
.rc-retention .bar i,
.chall-bar i,
.boss-hp .bar i,
.stat-bar i,
.q-progress .fill,
.bar-fill {
  position: relative;
  overflow: hidden;
}

.oc-bar i::after,
.lb-bar i::after,
.r-prog .bar i::after,
.rc-retention .bar i::after,
.chall-bar i::after,
.boss-hp .bar i::after,
.stat-bar i::after,
.q-progress .fill::after,
.bar-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .45), transparent);
  animation: fd-shimmer 2.8s linear infinite;
}

.hm-cell,
.heat-cell,
.heatmap-cell,
.calendar-cell,
.skill-dot,
.radar-card svg,
.mindmap-card svg,
.chart-card svg {
  animation: fd-soft-pop .5s var(--motion-soft) both;
}

.hm-cell:nth-child(3n),
.heat-cell:nth-child(3n),
.heatmap-cell:nth-child(3n),
.calendar-cell:nth-child(3n) {
  animation-delay: .05s;
}

.hm-cell:nth-child(4n),
.heat-cell:nth-child(4n),
.heatmap-cell:nth-child(4n),
.calendar-cell:nth-child(4n) {
  animation-delay: .1s;
}

.hm-cell,
.heat-cell,
.heatmap-cell,
.calendar-cell {
  transform-origin: center;
  animation-name: fd-soft-pop, fd-heatwave;
  animation-duration: .5s, 5.2s;
  animation-timing-function: var(--motion-soft), ease-in-out;
  animation-iteration-count: 1, infinite;
}

.radar svg,
svg.radar,
.radar-card svg,
.aura,
.hero-score svg,
.energy svg,
.chart-card svg,
.mindmap-card svg,
.mindmap-canvas svg,
.canvas-stub svg,
.map-card svg,
.graph-card svg,
.course-graph svg,
.msg-card svg,
.preview svg {
  overflow: visible;
}

.radar svg polygon,
svg.radar polygon,
.radar-card svg polygon,
.aura polygon,
.hero-score svg polygon,
.energy svg polygon,
.chart-card svg polygon {
  transform-box: fill-box;
  transform-origin: center;
  animation: fd-chart-fill .82s var(--motion-soft) both, fd-radar-breathe 4.8s ease-in-out infinite .9s;
}

.radar svg .shape,
svg.radar .shape,
.aura .aura-fill {
  animation: fd-chart-fill .82s var(--motion-soft) both, fd-radar-breathe 3.8s ease-in-out infinite .9s;
}

.radar svg path,
.radar svg line,
.radar svg polyline,
svg.radar path,
svg.radar line,
svg.radar polyline,
.radar-card svg path,
.radar-card svg line,
.radar-card svg polyline,
.chart-card svg path,
.chart-card svg line,
.chart-card svg polyline,
.course-graph svg path,
.course-graph svg line,
.course-graph svg polyline,
.msg-card svg path,
.msg-card svg line,
.msg-card svg polyline,
.preview svg path,
.preview svg line,
.preview svg polyline,
.aura path,
.aura line,
.aura polyline {
  stroke-dasharray: 760;
  stroke-dashoffset: 760;
  animation: fd-chart-draw 1.25s var(--motion-soft) both;
}

.radar svg circle,
svg.radar circle,
.radar-card svg circle,
.chart-card svg circle,
.hero-score svg circle,
.energy svg circle,
.mindmap-card svg circle,
.mindmap-canvas svg circle,
.canvas-stub svg circle,
.preview svg circle,
.msg-card svg circle {
  transform-box: fill-box;
  transform-origin: center;
  animation: fd-node-pulse 3.6s ease-in-out infinite;
}

.mindmap-card svg path,
.mindmap-card svg line,
.mindmap-card svg polyline,
.mindmap-canvas svg path,
.mindmap-canvas svg line,
.mindmap-canvas svg polyline,
.canvas-stub svg path,
.canvas-stub svg line,
.canvas-stub svg polyline {
  stroke-dasharray: 520;
  stroke-dashoffset: 520;
  animation: fd-chart-draw 1.45s var(--motion-soft) both;
}

.mindmap-card svg rect,
.mindmap-canvas svg rect,
.canvas-stub svg rect,
.msg-card svg rect,
.preview svg rect {
  transform-box: fill-box;
  transform-origin: center;
  animation: fd-chart-fill .72s var(--motion-soft) both, fd-node-pulse 4.2s ease-in-out infinite .9s;
}

.ring-fg,
svg circle.energy-r,
.rec-circle {
  stroke-dasharray: 240;
  animation: fd-chart-draw 1s var(--motion-soft) both, fd-ring-spin 7s linear infinite 1s;
}

.k .v,
.kpi-card .num,
.big,
.hs-cell .v,
.stat-num,
.score-num,
.xp-total,
.level-num {
  animation: fd-soft-pop .6s var(--motion-soft) both, fd-data-flicker 5s ease-in-out infinite .8s;
}

.avatar-stage,
.hero-score,
.energy,
.course-preview,
.character-stage {
  animation: fd-float 5.8s ease-in-out infinite;
}

input,
textarea,
select {
  transition: border-color .18s var(--motion-ease), box-shadow .18s var(--motion-ease), background .18s var(--motion-ease);
}

input:focus,
textarea:focus,
select:focus {
  box-shadow: 0 0 0 4px rgba(107, 63, 160, .1);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: .001ms !important;
  }
}
