/* ===== Animations — Minimal, purposeful motion ===== */

:root {
  --ease-quintic: cubic-bezier(0.23, 1, 0.32, 1);
  --dur-fast: 250ms;
  --dur-normal: 400ms;
  --dur-entrance: 600ms;
  --stagger-delay: 60ms;
}


/* ===== Entrance: Fade Up (the only entrance animation) ===== */

.animate-fade-up {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--dur-entrance) var(--ease-quintic),
              transform var(--dur-entrance) var(--ease-quintic);
}
.animate-fade-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Slide up for hero (slightly more travel) */
.animate-slide-up {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity var(--dur-entrance) var(--ease-quintic),
              transform var(--dur-entrance) var(--ease-quintic);
}
.animate-slide-up.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Scale in for the 3D model */
.animate-scale-in {
  opacity: 0;
  transform: scale(0.92);
  transition: opacity var(--dur-entrance) var(--ease-quintic),
              transform var(--dur-entrance) var(--ease-quintic);
}
.animate-scale-in.is-visible {
  opacity: 1;
  transform: scale(1);
}


/* ===== Stagger ===== */

.stagger-children > * {
  transition-delay: calc(var(--i, 0) * var(--stagger-delay));
}


/* ===== Hover — subtle, purposeful ===== */

/* Tilt for 3D model viewer */
.hover-tilt {
  transition: transform var(--dur-normal) var(--ease-quintic);
  animation: heroFloat 5s ease-in-out infinite;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-10px); }
}


/* ===== Navbar ===== */

.nav-links a {
  position: relative;
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  border-radius: 100px;
  transition: width var(--dur-normal) var(--ease-quintic);
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

#navbar {
  transition: background var(--transition),
              box-shadow var(--transition);
}


/* ===== Model Viewer ===== */

.model-viewer-wrap {
  position: relative;
  border: 1px solid var(--border);
  background: var(--bg-card);
  padding: 8px;
  border-radius: var(--radius);
}

.model-hint {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 6px 14px;
  border-radius: 100px;
  border: 1px solid var(--border);
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.6s var(--ease-quintic);
  z-index: 2;
}

.model-hint.hidden { opacity: 0; }


/* ===== Back-to-Top ===== */

.back-to-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--dur-normal) var(--ease-quintic),
              transform var(--dur-normal) var(--ease-quintic),
              border-color var(--dur-fast) var(--ease-quintic);
  z-index: 900;
  pointer-events: none;
}

.back-to-top.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}


/* ===== Page Transition ===== */

@keyframes pageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

body {
  animation: pageIn 0.3s ease both;
}


/* ===== Confetti Canvas ===== */

.confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
}


/* ===== Keyboard Hint ===== */

.keyboard-hint {
  position: fixed;
  bottom: 32px;
  left: 32px;
  display: flex;
  gap: 6px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 0.72rem;
  color: var(--text-muted);
  z-index: 800;
  opacity: 0;
  transition: opacity var(--dur-normal) var(--ease-quintic);
  pointer-events: none;
}

.keyboard-hint.visible { opacity: 1; }

.keyboard-hint kbd {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--text);
}

@media (max-width: 768px) {
  .keyboard-hint { display: none; }
}


/* ===== Breadcrumb ===== */

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-quintic);
}

.breadcrumb a:hover { color: var(--accent); }
.breadcrumb-sep { opacity: 0.4; font-size: 0.65rem; }
.breadcrumb-current { color: var(--text); font-weight: 500; }


/* ===== Concept Block Enhancement ===== */

.concept-block {
  border-left: 3px solid var(--accent);
  transition: border-color var(--dur-normal) var(--ease-quintic);
}


/* ===== Quiz Enhancements ===== */

.quiz-question-card {
  transition: border-color var(--dur-normal) var(--ease-quintic);
}

.quiz-option {
  transition: all var(--dur-fast) var(--ease-quintic);
}

.quiz-option:hover:not(.correct):not(.incorrect):not([disabled]) {
  border-color: var(--accent);
  transform: translateX(3px);
}

@keyframes correctPulse {
  0%   { box-shadow: 0 0 0 0 rgba(92, 184, 92, 0.3); }
  100% { box-shadow: 0 0 0 8px rgba(92, 184, 92, 0); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25%      { transform: translateX(-4px); }
  75%      { transform: translateX(4px); }
}

.quiz-option.correct { animation: correctPulse 0.5s ease; }
.quiz-option.incorrect { animation: incorrectShake 0.3s ease; }

.quiz-explanation {
  border-radius: var(--radius-sm);
}


/* ===== Glossary Tabs ===== */

.glossary-alpha-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-bottom: 24px;
}

.glossary-alpha-tab {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--dur-fast) var(--ease-quintic);
  font-family: var(--font);
}

.glossary-alpha-tab:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.glossary-alpha-tab.active {
  background: var(--accent);
  color: #141414;
  border-color: var(--accent);
}

.glossary-alpha-tab.disabled {
  opacity: 0.2;
  pointer-events: none;
}


/* ===== Footer ===== */

footer {
  border-top: 1px solid var(--border);
  padding: 48px 0 32px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 48px;
  text-align: left;
  margin-bottom: 24px;
}

.footer-brand h4 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.85rem;
  line-height: 1.7;
}

.footer-modules h4 {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.footer-module-links {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.footer-module-link {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color var(--dur-fast) var(--ease-quintic);
}

.footer-module-link:hover {
  color: var(--text);
}

.footer-module-num {
  font-weight: 700;
  font-size: 0.68rem;
  color: var(--text-muted);
  opacity: 0.5;
  min-width: 16px;
}

.footer-divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 16px;
}

.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.78rem;
}

.footer-stats { display: flex; gap: 16px; }
.footer-stat { display: flex; align-items: center; gap: 4px; }
.footer-stat-num { font-weight: 700; color: var(--text); }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr; gap: 24px; }
  .footer-module-links { grid-template-columns: repeat(2, 1fr); }
  .footer-bottom { flex-direction: column; gap: 12px; }
}


/* ===== Reduced Motion ===== */

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

  [class*="animate-"],
  .hover-tilt {
    opacity: 1 !important;
    transform: none !important;
    animation: none !important;
  }

  body { animation: none !important; }
}
