/* ==========================================================================
   GCSE Revision Hub — Custom Styles & 3D Flashcard Animations
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;600;700&family=Plus+Jakarta+Sans:wght@600;700;800&display=swap');

:root {
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

body {
  font-family: var(--font-sans);
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

h1, h2, h3, .font-display {
  font-family: var(--font-display);
}

.font-mono-code {
  font-family: var(--font-mono);
}

/* --------------------------------------------------------------------------
   3D Flashcard Flip Engine
   -------------------------------------------------------------------------- */
.perspective-container {
  perspective: 1400px;
}

.flashcard-3d-inner {
  position: relative;
  width: 100%;
  min-height: 390px;
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
}

@media (min-width: 640px) {
  .flashcard-3d-inner {
    min-height: 410px;
  }
}

.flashcard-3d-inner.is-flipped {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.card-face-front {
  transform: rotateY(0deg);
  z-index: 2;
  pointer-events: auto;
}

.flashcard-3d-inner.is-flipped .card-face-front {
  pointer-events: none;
  z-index: 1;
}

.card-face-back {
  transform: rotateY(180deg);
  z-index: 1;
  pointer-events: none;
}

.flashcard-3d-inner.is-flipped .card-face-back {
  pointer-events: auto;
  z-index: 2;
}

/* --------------------------------------------------------------------------
   Subject Accent Glows & Borders
   -------------------------------------------------------------------------- */
.subject-glow-biology {
  box-shadow: 0 0 35px -8px rgba(16, 185, 129, 0.28);
}

.subject-glow-chemistry {
  box-shadow: 0 0 35px -8px rgba(6, 182, 212, 0.28), 0 0 20px -10px rgba(245, 158, 11, 0.22);
}

.subject-glow-physics {
  box-shadow: 0 0 35px -8px rgba(139, 92, 246, 0.28);
}

.subject-glow-english {
  box-shadow: 0 0 35px -8px rgba(244, 63, 94, 0.28);
}

.subject-glow-all {
  box-shadow: 0 0 35px -8px rgba(99, 102, 241, 0.25);
}

/* --------------------------------------------------------------------------
   Custom Scrollbars inside Cards & Modals
   -------------------------------------------------------------------------- */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.custom-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.3);
  border-radius: 9999px;
}

.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(148, 163, 184, 0.5);
}

/* --------------------------------------------------------------------------
   Micro-Animations & Visual Feedback
   -------------------------------------------------------------------------- */
@keyframes pulseFlame {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(249, 115, 22, 0.55));
  }
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 12px rgba(249, 115, 22, 0.85));
  }
}

.animate-flame {
  animation: pulseFlame 2.2s infinite ease-in-out;
}

@keyframes popIn {
  0% {
    opacity: 0;
    transform: scale(0.94) translateY(8px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.animate-pop-in {
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes shakeWrong {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

.animate-shake {
  animation: shakeWrong 0.38s ease-in-out;
}

/* Keyboard keycap badge styling */
.kbd-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  line-height: 1;
  padding: 0.2rem 0.45rem;
  border-radius: 0.375rem;
  border-bottom-width: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
