/* Animation keyframes */
@keyframes flip-in {
  0% {
    transform: rotateX(-90deg);
    opacity: 0;
  }
  100% {
    transform: rotateX(0);
    opacity: 1;
  }
}

@keyframes slide-in {
  0% {
    transform: translateY(-20px);
    opacity: 0;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fade-out {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

@keyframes fadeIn {
  0% {
    opacity: 0;
  }
  100% {
    opacity: 1;
  }
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  80% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes pop-in {
  0% {
    transform: scale(0.8);
    opacity: 0;
  }
  70% {
    transform: scale(1.05);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Mood-specific animations for Saylor */
#saylor-image.skeptical {
  filter: saturate(0.9);
}

#saylor-image.panicked {
  animation: shake 0.5s ease-in-out;
  filter: saturate(0.7);
}

#saylor-image.curious {
  filter: brightness(1.1);
}

#saylor-image.dismissive {
  transform: rotate(-2deg);
  filter: saturate(0.8);
}

#saylor-image.inspired {
  filter: brightness(1.2) saturate(1.2);
}

#saylor-image.tired {
  filter: contrast(0.9) brightness(0.95);
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  10%, 30%, 50%, 70%, 90% { transform: translateX(-2px); }
  20%, 40%, 60%, 80% { transform: translateX(2px); }
}

/* 3D Calendar Page Flip Animations */
@keyframes calendar-front-flip {
  0% {
    transform: rotateX(0deg);
    z-index: 10;
  }
  50% {
    transform: rotateX(-90deg);
    z-index: 10;
  }
  51% {
    transform: rotateX(-90deg);
    z-index: 5;
  }
  100% {
    transform: rotateX(-180deg);
    z-index: 5;
  }
}

@keyframes calendar-back-flip {
  0% {
    transform: rotateX(180deg);
    z-index: 5;
  }
  50% {
    transform: rotateX(90deg);
    z-index: 5;
  }
  51% {
    transform: rotateX(90deg);
    z-index: 10;
  }
  100% {
    transform: rotateX(0deg);
    z-index: 10;
  }
}

/* Only day portion animation with curl effect (0.4s duration) */
@keyframes day-front-flip {
  0% {
    transform: rotateX(0deg);
    z-index: 10;
  }
  20% {
    transform: rotateX(-20deg);
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: rotateX(-90deg);
    z-index: 10;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4);
  }
  80% {
    transform: rotateX(-160deg);
    z-index: 5;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.3);
  }
  100% {
    transform: rotateX(-180deg);
    z-index: 5;
    opacity: 0;
  }
}

/* Back page flip animation (0.4s duration) */
@keyframes day-back-flip {
  0% {
    transform: rotateX(180deg);
    z-index: 5;
    opacity: 0;
  }
  20% {
    transform: rotateX(160deg);
    z-index: 5;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  }
  50% {
    transform: rotateX(90deg);
    z-index: 5;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  }
  80% {
    transform: rotateX(20deg);
    z-index: 10;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
  }
  100% {
    transform: rotateX(0deg);
    z-index: 10;
    opacity: 1;
  }
}

/* Header transition for month/year */
@keyframes header-transition {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.8;
    transform: translateY(-2px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shadow-fade {
  0% {
    opacity: 0.2;
  }
  50% {
    opacity: 0.6;
  }
  100% {
    opacity: 0.2;
  }
}

/* Day number flip effect - just the bottom half */
@keyframes day-flip {
  0% {
    transform: rotateX(0deg);
    opacity: 1;
  }
  50% {
    transform: rotateX(-90deg);
    opacity: 0.5;
  }
  100% {
    transform: rotateX(0deg);
    opacity: 1;
  }
}

/* Month/year subtle animation */
@keyframes header-change {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  50% {
    transform: translateY(-5px);
    opacity: 0.7;
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Calendar page animation enhancements */
.calendar-page {
  position: relative;
  overflow: hidden;
}

.calendar-page:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.3) 0%, rgba(255,255,255,0) 50%);
  pointer-events: none;
  z-index: 5;
}

.calendar-page.flipping-front:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to bottom, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%);
  transform-origin: bottom center;
  animation: fold-shadow 0.4s ease-in-out forwards;
  pointer-events: none;
  z-index: 6;
}

.calendar-page.flipping-back:after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0) 0%, rgba(0,0,0,0.5) 100%);
  transform-origin: top center;
  animation: unfold-shadow 0.4s ease-in-out forwards;
  pointer-events: none;
  z-index: 6;
}

@keyframes fold-shadow {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes unfold-shadow {
  0% {
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes page-shadow {
  0% {
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  }
  50% {
    box-shadow: 0 15px 40px rgba(0,0,0,0.5);
  }
  100% {
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 25px rgba(255, 215, 0, 0.8);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
  }
}

/* Page curl gradient animation (0.4s duration) */
@keyframes page-curl {
  0% {
    opacity: 0;
    background-position: 0% 0%;
  }
  20% {
    opacity: 0.3;
    background-position: 5% 5%;
  }
  40% {
    opacity: 0.5;
    background-position: 10% 10%;
  }
  60% {
    opacity: 0.8;
    background-position: 15% 15%;
  }
  80% {
    opacity: 0.4;
    background-position: 20% 20%;
  }
  100% {
    opacity: 0;
    background-position: 25% 25%;
  }
}

/* Corner fold animation (0.4s duration) */
@keyframes corner-fold {
  0% {
    transform: rotate(-45deg) translate(20px, 20px);
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.15);
  }
  30% {
    transform: rotate(-55deg) translate(15px, 15px);
    box-shadow: -5px 5px 8px rgba(0, 0, 0, 0.2);
  }
  60% {
    transform: rotate(-85deg) translate(10px, 10px);
    box-shadow: -8px 8px 12px rgba(0, 0, 0, 0.25);
  }
  100% {
    transform: rotate(-95deg) translate(5px, 5px);
    box-shadow: -10px 10px 15px rgba(0, 0, 0, 0.3);
  }
}

/* Corner unfold animation for back page (0.4s duration) */
@keyframes corner-unfold {
  0% {
    transform: rotate(-95deg) translate(5px, 5px);
    box-shadow: -10px 10px 15px rgba(0, 0, 0, 0.3);
  }
  30% {
    transform: rotate(-85deg) translate(10px, 10px);
    box-shadow: -8px 8px 12px rgba(0, 0, 0, 0.25);
  }
  60% {
    transform: rotate(-55deg) translate(15px, 15px);
    box-shadow: -5px 5px 8px rgba(0, 0, 0, 0.2);
  }
  100% {
    transform: rotate(-45deg) translate(15px, 15px);
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.15);
  }
}

/* Shadow movement during page turn */
@keyframes shadow-move {
  0% {
    opacity: 0.5;
    transform: translateX(0);
  }
  25% {
    opacity: 0.7;
    transform: translateX(-5px);
  }
  50% {
    opacity: 0.9;
    transform: translateX(-10px);
  }
  75% {
    opacity: 0.7;
    transform: translateX(-5px);
  }
  100% {
    opacity: 0.5;
    transform: translateX(0);
  }
}

.day-container.flipping-front:after {
  animation: page-curl 0.4s ease-in-out forwards;
}

.calendar-shadow.flipping {
  animation: shadow-move 0.4s ease-in-out;
}

.day-container.flipping-front .page-corner {
  animation: corner-fold 0.4s ease-in-out forwards;
}

.day-container.flipping-back .page-corner {
  animation: corner-unfold 0.4s ease-in-out forwards;
}

/* Date transition animations */
@keyframes dateChangeFade {
  0% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.5;
    transform: scale(0.98);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Headline animations */
@keyframes headline-slide-in {
  0% {
    transform: translateX(-20px);
    opacity: 0;
  }
  100% {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes headline-fade-out {
  0% {
    opacity: 1;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-10px);
  }
}

/* Date display styles */
#date-display {
  transition: all 0.3s ease;
}

#date-display.changing {
  animation: dateChangeFade 0.5s ease-in-out;
}

/* Particle Effects */
.particle {
  position: absolute;
  pointer-events: none;
  z-index: 1000;
  font-size: 1.2em;
  line-height: 1;
  animation: particle-float 1.5s ease-out forwards;
}

.particle.positive {
  color: #00ff00;
}

.particle.negative {
  color: #ff0000;
}

@keyframes particle-float {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px) scale(0.8);
    opacity: 0;
  }
}

/* Particle container */
#particle-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
} 