/* =========================================================
   AWBY Tutoring — Motion
   Scroll-reveal, hover states, and ambient hero motion.
   Every animation here has a `prefers-reduced-motion` fallback.
   ========================================================= */

/* ---- Scroll-reveal (JS adds/removes .is-visible via IntersectionObserver,
   see assets/js/reveal.js). Elements start hidden only once JS confirms it
   can run the reveal — see the no-js/reduced-motion guards below. ---- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Staggered children within a revealed container */
.reveal-stagger > * {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity var(--duration-base) var(--ease-standard),
    transform var(--duration-base) var(--ease-standard);
}

.reveal-stagger.is-visible > * {
  opacity: 1;
  transform: translateY(0);
}

.reveal-stagger.is-visible > *:nth-child(1) { transition-delay: 0ms; }
.reveal-stagger.is-visible > *:nth-child(2) { transition-delay: 80ms; }
.reveal-stagger.is-visible > *:nth-child(3) { transition-delay: 160ms; }
.reveal-stagger.is-visible > *:nth-child(4) { transition-delay: 240ms; }
.reveal-stagger.is-visible > *:nth-child(5) { transition-delay: 320ms; }
.reveal-stagger.is-visible > *:nth-child(6) { transition-delay: 400ms; }

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal-stagger > * {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* ---- Universal hover lift + highlight glow for cards & buttons.
   "Highlight" here means an added colored glow ring around the element on
   hover — the element's own background/text color never changes, only a
   soft brand-colored halo appears around it, plus a 3D-feeling lift. ---- */
.card,
.subject-card,
.step-card,
.testimonial-card,
.tutor-card,
.pricing-factor,
.service-card,
.faq-item {
  transition: transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) ease, border-color var(--duration-fast) ease;
}

@media (hover: hover) {
  .card:hover,
  .step-card:hover,
  .testimonial-card:hover,
  .tutor-card:hover,
  .pricing-factor:hover,
  .service-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--glow-navy);
    border-color: transparent;
  }

  .subject-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--glow-purple);
  }
  .subject-card--math:hover { box-shadow: var(--glow-math); }
  .subject-card--science:hover { box-shadow: var(--glow-science); }
  .subject-card--english:hover { box-shadow: var(--glow-english); }
  .subject-card--skills:hover { box-shadow: var(--glow-skills); }
}

.btn {
  position: relative;
  overflow: hidden;
  transition: transform var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) ease, background-color var(--duration-fast) ease,
    color var(--duration-fast) ease;
}

/* Diagonal light-sweep highlight on primary buttons — a literal "highlight",
   not a color change: a bright diagonal band sweeps across on hover. */
.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 20%,
    rgba(255, 255, 255, 0.35) 45%,
    transparent 70%
  );
  transform: translateX(-120%);
  pointer-events: none;
}

@media (hover: hover) {
  .btn:hover {
    transform: translateY(-3px) scale(1.06);
  }
  .btn-primary:hover {
    box-shadow: var(--glow-purple);
  }
  .btn-primary:hover::after {
    transform: translateX(120%);
    transition: transform 650ms var(--ease-standard);
  }
  .btn-secondary:hover {
    box-shadow: var(--glow-navy);
  }
  .btn-secondary--purple:hover {
    box-shadow: var(--glow-purple);
  }
}

/* Tactile press feedback on every interactive element */
.btn:active {
  transform: scale(0.97);
}

.card:active,
.subject-card:active,
.step-card:active,
.testimonial-card:active,
.tutor-card:active,
.pricing-factor:active,
.service-card:active {
  transform: scale(0.99) translateY(-2px);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .subject-card,
  .step-card,
  .testimonial-card,
  .tutor-card,
  .pricing-factor,
  .service-card,
  .faq-item,
  .btn,
  .btn-primary::after {
    transition: none;
  }
}

/* ---- Nav pill highlight: hovering a nav item lifts it slightly and fills
   it with a white pill + soft shadow — a real button-press feel, not a
   flat color swap. The active page keeps its solid gradient fill. ---- */
.primary-nav a {
  position: relative;
  transition: background-color var(--duration-fast) ease, color var(--duration-fast) ease,
    box-shadow var(--duration-fast) ease, transform var(--duration-fast) var(--ease-standard);
}

@media (hover: hover) {
  .primary-nav a:hover {
    background: var(--color-white);
    color: var(--color-primary);
    box-shadow: var(--shadow-sm);
    transform: translateY(-1px);
  }

  .primary-nav a[aria-current="page"]:hover {
    color: var(--color-white);
    transform: translateY(-1px);
    filter: brightness(1.08);
  }
}

.footer-nav a {
  position: relative;
}

@media (prefers-reduced-motion: reduce) {
  .primary-nav a {
    transition: none;
  }
}

/* ---- Subtle shimmer sweep across gradient headline text ---- */
@keyframes awby-text-shimmer {
  0% { background-position: 0% center; }
  100% { background-position: 200% center; }
}

@media (hover: hover) {
  .text-gradient {
    transition: background-position 1.2s var(--ease-standard);
  }
  h1:hover .text-gradient,
  .text-gradient:hover {
    background-position: 100% center;
  }
}

/* ---- 3D tilt cards (see assets/js/tilt.js).
   The script sets `element.style.transform` directly on mousemove (combining
   the perspective tilt with the existing hover lift in one inline value) and
   clears it on mouseleave — inline styles beat the plain :hover rule above
   while active, and clearing it lets that same :hover rule take back over
   cleanly. This class only adds will-change + a fast settle transition;
   it never sets `transform` itself, so there's no cascade fight. Only ever
   activated by the script when the device has real hover + no reduced
   motion, so cards are always flat/static otherwise. ---- */
.tilt-3d {
  will-change: transform;
  transition: transform 120ms ease-out, box-shadow var(--duration-fast) ease;
}

/* ---- Hero headline entrance: the two sentences slide up and fade in one
   after another as soon as the page loads (not scroll-triggered — the hero
   is visible immediately, so this plays right away). ---- */
.hero-title__mask {
  display: block;
  overflow: hidden; /* each line has its own mask, sized to that line only,
    so one line's slide-in never visually overlaps the line next to it */
}

.hero-title__line {
  display: block;
  opacity: 0;
  transform: translateY(100%);
  animation: awby-line-in 700ms var(--ease-standard) forwards;
}

.hero-title__mask:nth-child(1) .hero-title__line {
  animation-delay: 100ms;
}

.hero-title__mask:nth-child(2) .hero-title__line {
  animation-delay: 380ms;
}

@keyframes awby-line-in {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-title__line {
    opacity: 1;
    transform: none;
    animation: none;
  }
}

/* ---- Caption badge pulse (Why AWBY photo collage) — a soft breathing
   glow to draw the eye, not a jarring flash. ---- */
@keyframes awby-pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(109, 40, 217, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(109, 40, 217, 0); }
}

.photo-collage__caption {
  animation: awby-pulse-glow 2.6s ease-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .photo-collage__caption {
    animation: none;
  }
}

/* ---- Ambient hero motion: gentle floating badges & decorative shapes ---- */
@keyframes awby-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

@keyframes awby-float-slow {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-14px) rotate(4deg); }
}

.floating-badge--1 { animation: awby-float 5.5s ease-in-out infinite; }
.floating-badge--2 { animation: awby-float 6.5s ease-in-out infinite 0.4s; }
.floating-badge--3 { animation: awby-float 5s ease-in-out infinite 0.8s; }

.hero__decor--hex { animation: awby-float-slow 9s ease-in-out infinite; }
.hero__decor--ring { animation: awby-float-slow 11s ease-in-out infinite 1s; }

@media (prefers-reduced-motion: reduce) {
  .floating-badge--1,
  .floating-badge--2,
  .floating-badge--3,
  .hero__decor--hex,
  .hero__decor--ring {
    animation: none;
  }
}

/* ---- "Blob glass" cards (Tutor cards + the featured testimonial only —
   see the comment in assets/js/render.js's wrapWithBlobGlass for why this
   isn't on every card: dozens of simultaneous looping blur animations would
   hurt performance and feel chaotic on content-heavy pages).
   Adapted from a Uiverse.io neumorphic card: the original's outer shadow
   pair (a dark + a light shadow) is calibrated for a mid-gray page
   background, which doesn't suit this site's white/pastel sections, so the
   outer card uses this site's own shadow tokens instead. What's carried
   over is the real signature of that snippet — a frosted glass panel
   floating over a soft, slowly-drifting color blob — recolored to the
   brand palette instead of the original's plain red. ---- */
.card--blob {
  position: relative;
  overflow: hidden;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: var(--shadow-lg);
}

.card-blob {
  position: absolute;
  z-index: 0;
  top: 50%;
  left: 50%;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(30px);
  opacity: 0.5;
  pointer-events: none;
  animation: card-blob-bounce 10s infinite ease;
}

.card-blob--purple { background: var(--color-purple-500); }
.card-blob--pink { background: var(--color-vivid-math); }

@keyframes card-blob-bounce {
  0% { transform: translate(-100%, -100%) translate3d(0, 0, 0); }
  25% { transform: translate(-100%, -100%) translate3d(70%, 0, 0); }
  50% { transform: translate(-100%, -100%) translate3d(70%, 70%, 0); }
  75% { transform: translate(-100%, -100%) translate3d(0, 70%, 0); }
  100% { transform: translate(-100%, -100%) translate3d(0, 0, 0); }
}

.card-glass {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
}

.tutor-card .card-glass {
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  .card-blob {
    animation: none;
    /* Park it in a fixed, unobtrusive spot instead of mid-bounce. */
    transform: translate(-140%, -140%);
  }
}

/* ---- Scroll progress bar (assets/js/interactive.js) ---- */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: var(--gradient-brand-vivid);
  z-index: 60;
  transition: width 80ms linear;
}

@media (prefers-reduced-motion: reduce) {
  .scroll-progress {
    transition: none;
  }
}

/* ---- Smooth accordion open for FAQ (progressive enhancement over
   native <details>; see assets/js/faq.js for the grid-rows technique) ---- */
.faq-item__body-inner {
  overflow: hidden;
}
