@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;500;600;700;800&family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;1,400&family=Fragment+Mono&display=swap');

@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --color-primary: #10b981;
    --color-primary-hover: #059669;
    --color-pond: #406ae4;
    --color-pond-hover: #3b82f6;
    --color-background: #f8fafc;
    --color-surface-white: #ffffff;
    --color-surface-gray: #edf1f4;
    --color-surface-dark: #0f1115;
    --color-text-primary: #1d1d1f;
    --color-text-secondary: #4d585f;
    --color-text-muted: #86868b;
    --color-border-subtle: #dde5ed;
    --color-warning: #ff8b06;
    --color-danger: #f51c23;

    --font-display: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'Fragment Mono', SFMono-Regular, monospace;
  }

  html {
    scroll-behavior: smooth;
    font-family: var(--font-sans);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
  }

  body {
    background-color: var(--color-background);
    color: var(--color-text-primary);
    overflow-x: hidden;
    line-height: 1.5;
    letter-spacing: -0.011em;
  }
}

/* Custom Apple-grade minimal scrollbar */
::-webkit-scrollbar {
  width: 7px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.16);
  border-radius: 9999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.28);
}

/* ==========================================================================
   Apple Materials: Liquid Glass, Specular Highlights & Surface Vibrancy
   ========================================================================== */
.apple-glass {
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(28px) saturate(190%);
  -webkit-backdrop-filter: blur(28px) saturate(190%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -1px 1px 0 rgba(0, 0, 0, 0.03),
    0 20px 45px -15px rgba(0, 0, 0, 0.06);
}

.apple-glass-dark {
  background: rgba(18, 20, 24, 0.85);
  backdrop-filter: blur(32px) saturate(200%);
  -webkit-backdrop-filter: blur(32px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 
    inset 0 1px 1px 0 rgba(255, 255, 255, 0.25),
    0 25px 60px -15px rgba(0, 0, 0, 0.45);
}

.apple-bezel {
  box-shadow: 
    0 0 0 1px rgba(0, 0, 0, 0.06),
    0 2px 4px rgba(0, 0, 0, 0.04),
    0 12px 28px -6px rgba(0, 0, 0, 0.08),
    0 30px 60px -12px rgba(0, 0, 0, 0.12);
}

/* ==========================================================================
   Apple 3D Perspective Card Tilt & Specular Light Glare
   ========================================================================== */
.apple-tilt-card {
  perspective: 1200px;
  transform-style: preserve-3d;
  will-change: transform;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1), box-shadow 0.25s ease;
}

.apple-tilt-card:hover {
  box-shadow: 
    0 25px 50px -12px rgba(16, 185, 129, 0.15),
    0 0 0 1px rgba(16, 185, 129, 0.3);
}

.specular-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: radial-gradient(
    550px circle at var(--glare-x, 50%) var(--glare-y, 50%),
    rgba(255, 255, 255, 0.28),
    transparent 65%
  );
  opacity: 0;
  transition: opacity 0.35s ease;
  z-index: 2;
}

.apple-tilt-card:hover .specular-glare {
  opacity: 1;
}

.specular-glare-dark {
  background: radial-gradient(
    550px circle at var(--glare-x, 50%) var(--glare-y, 50%),
    rgba(16, 185, 129, 0.18),
    transparent 60%
  );
}

/* ==========================================================================
   Apple Tactile Magnetic Buttons
   ========================================================================== */
.apple-magnetic-btn {
  position: relative;
  overflow: hidden;
  will-change: transform;
  transition: transform 0.2s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.2s ease;
}

.apple-magnetic-btn:active {
  transform: scale(0.96) !important;
}

/* Shimmer reflection sweep on hover */
.apple-magnetic-btn::after {
  content: "";
  position: absolute;
  top: -50%;
  left: -60%;
  width: 40%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.32),
    transparent
  );
  transform: rotate(25deg);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.75s ease, opacity 0.3s ease;
}

.apple-magnetic-btn:hover::after {
  opacity: 1;
  transform: translateX(380%) rotate(25deg);
}

/* ==========================================================================
   Apple Studio Keynote Lighting (Overhead Ambient Spotlight)
   ========================================================================== */
.apple-overhead-spotlight {
  background: radial-gradient(
    ellipse 70% 55% at 50% -10%,
    rgba(16, 185, 129, 0.24) 0%,
    rgba(56, 189, 248, 0.12) 40%,
    transparent 75%
  );
}

/* ==========================================================================
   60FPS Biological Frog Animation Dynamics (Blinking + Breathing + Jump)
   ========================================================================== */
@keyframes frogBreathe {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.025, 0.985); }
}

.frog-breathe {
  animation: frogBreathe 4.2s ease-in-out infinite;
  transform-origin: center bottom;
}

/* Eyelids smooth blinking transition */
.frog-eyelid {
  transform-origin: center;
  transition: transform 0.12s ease-in-out;
  transform: scaleY(0);
}

.frog-eyelid.blinking {
  transform: scaleY(1);
}

/* Pupil natural damping */
.frog-pupil {
  transition: transform 0.1s cubic-bezier(0.2, 0, 0, 1);
  transform-origin: center;
}

/* Apple Keynote Frog Jump with Realistic Squash & Stretch */
@keyframes appleFrogHop {
  0% {
    transform: translateY(0) scale(1, 1);
  }
  15% {
    /* Pre-jump anticipation squash */
    transform: translateY(8px) scale(1.22, 0.78);
  }
  42% {
    /* High launch stretch */
    transform: translateY(-130px) scale(0.85, 1.25) rotate(-3deg);
  }
  68% {
    /* Airborne hang-time */
    transform: translateY(-145px) scale(1.04, 0.96) rotate(1deg);
  }
  88% {
    /* Landing impact squash */
    transform: translateY(-5px) scale(1.24, 0.76);
  }
  100% {
    /* Spring settle back */
    transform: translateY(0) scale(1, 1);
  }
}

.apple-jumping {
  animation: appleFrogHop 0.72s cubic-bezier(0.25, 0.46, 0.45, 0.94) forwards;
}

/* ==========================================================================
   Linear Mask & Continuous GPU Ticker
   ========================================================================== */
.mask-fade-x {
  mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
  -webkit-mask-image: linear-gradient(to right, transparent, black 12%, black 88%, transparent);
}

@keyframes ticker {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

.animate-ticker {
  display: flex;
  width: max-content;
  animation: ticker 32s linear infinite;
  will-change: transform;
}

.animate-ticker:hover {
  animation-play-state: paused;
}

/* Floating Physics Badges */
@keyframes floatBadge1 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-7px) rotate(-0.8deg); }
}

@keyframes floatBadge2 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-9px) rotate(1.2deg); }
}

@keyframes floatBadge3 {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  50% { transform: translateY(-6px) rotate(-0.5deg); }
}

.float-badge-1 { animation: floatBadge1 5.5s ease-in-out infinite; }
.float-badge-2 { animation: floatBadge2 7s ease-in-out 0.8s infinite; }
.float-badge-3 { animation: floatBadge3 6.2s ease-in-out 1.5s infinite; }

/* Pond Water Shockwave Ripples */
.ripple {
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(16, 185, 129, 0.7);
  transform: translate(-50%, -50%) scale(1);
  pointer-events: none;
  animation: rippleSpread 0.9s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes rippleSpread {
  0%   { width: 10px; height: 10px; opacity: 1; border-width: 2.5px; }
  100% { width: 170px; height: 170px; opacity: 0; border-width: 1px; }
}

/* Catch Pop (+1) */
.catch-pop {
  position: absolute;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: #10b981;
  pointer-events: none;
  z-index: 25;
  animation: popRise 0.75s ease-out forwards;
}

@keyframes popRise {
  0%   { opacity: 1; transform: translate(-50%, 0) scale(0.7); }
  50%  { transform: translate(-50%, -30px) scale(1.2); }
  100% { opacity: 0; transform: translate(-50%, -55px) scale(1); }
}

/* Lily pad bobbing physics */
.bobbing {
  animation: padBob 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes padBob {
  0%   { transform: scale(1) translateY(0); }
  30%  { transform: scale(1.08, 0.94) translateY(6px); }
  65%  { transform: scale(0.96, 1.04) translateY(-4px); }
  100% { transform: scale(1) translateY(0); }
}

/* Falling flies */
.pond-fly {
  position: absolute;
  font-size: 24px;
  line-height: 1;
  pointer-events: none;
  z-index: 10;
  will-change: transform, left, top;
}

/* Sound button active state */
.sound-btn.playing {
  border-color: #10b981 !important;
  background-color: rgba(16, 185, 129, 0.12) !important;
  transform: scale(0.97);
}

/* Accordion Smooth Grid Transition */
.faq-grid-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-grid-content.is-open {
  grid-template-rows: 1fr;
}

.faq-grid-inner {
  overflow: hidden;
}

/* Entrance Animation */
@keyframes fadeInUp {
  from {
    opacity: 0.2;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal-on-scroll {
  will-change: opacity, transform;
}

.reveal-on-scroll.is-revealed {
  animation: fadeInUp 0.75s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.stagger-1 { animation-delay: 80ms; }
.stagger-2 { animation-delay: 160ms; }
.stagger-3 { animation-delay: 240ms; }
.stagger-4 { animation-delay: 320ms; }
