/* Modern Animations & Micro-interactions */

/* Elegant & Subtle Animations */

/* Fade-in Animations - Subtle */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Subtle Micro-interactions */
@keyframes gentleFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

@keyframes subtlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Smooth Transitions - Applied to Content */
.md-content__inner {
  animation: fadeInUp 0.6s ease-out;
}

.md-nav__item {
  animation: fadeIn 0.4s ease-out;
  animation-fill-mode: both;
}

.md-nav__item:nth-child(1) { animation-delay: 0.05s; }
.md-nav__item:nth-child(2) { animation-delay: 0.1s; }
.md-nav__item:nth-child(3) { animation-delay: 0.15s; }
.md-nav__item:nth-child(4) { animation-delay: 0.2s; }
.md-nav__item:nth-child(5) { animation-delay: 0.25s; }

/* Header - Minimal Animation */
.md-header {
  animation: fadeIn 0.4s ease-out;
}

/* Typography - Subtle Entrance */
.md-typeset h1 {
  animation: fadeInUp 0.6s ease-out 0.1s both;
}

.md-typeset h2 {
  animation: fadeInUp 0.5s ease-out 0.15s both;
}

.md-typeset p {
  animation: fadeInUp 0.5s ease-out 0.2s both;
}

.md-typeset img {
  animation: scaleIn 0.5s ease-out 0.3s both;
}

.md-typeset blockquote {
  animation: fadeInUp 0.5s ease-out 0.25s both;
}

/* Button Hover Effects - Refined */
.cta-button:hover {
  animation: none; /* Remove any existing animations */
}

.secondary-button:hover {
  animation: none; /* Remove any existing animations */
}

/* Navigation - Subtle Hover Effects */
.md-nav__link {
  position: relative;
}

.md-nav__link:hover {
  animation: none; /* Keep it simple */
}

.md-nav__link--active {
  animation: fadeIn 0.3s ease-out;
}

/* Cards - Gentle Interactions */
.step-card,
.feature-card {
  transition: all 0.3s ease;
}

.step-card:hover,
.feature-card:hover {
  animation: none; /* Remove flashy animations */
}

/* Search - Minimal Focus Effect */
.md-search__input:focus {
  transition: all 0.2s ease;
}

/* Images - Subtle Hover */
.md-typeset img:hover {
  animation: none; /* Remove scale animation */
}

/* Code Blocks - Gentle Entrance */
.md-typeset pre {
  animation: fadeInUp 0.5s ease-out 0.4s both;
}

/* Timeline - Staggered Fade-in */
.timeline-item {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }

/* Feature Grid - Subtle Stagger */
.feature-card {
  animation: fadeInUp 0.5s ease-out;
  animation-fill-mode: both;
}

.feature-grid .feature-card:nth-child(1) { animation-delay: 0.1s; }
.feature-grid .feature-card:nth-child(2) { animation-delay: 0.15s; }
.feature-grid .feature-card:nth-child(3) { animation-delay: 0.2s; }
.feature-grid .feature-card:nth-child(4) { animation-delay: 0.25s; }
.feature-grid .feature-card:nth-child(5) { animation-delay: 0.3s; }
.feature-grid .feature-card:nth-child(6) { animation-delay: 0.35s; }

/* Image Gallery - Gentle Stagger */
.image-item {
  animation: scaleIn 0.4s ease-out;
  animation-fill-mode: both;
}

.image-item:nth-child(1) { animation-delay: 0.1s; }
.image-item:nth-child(2) { animation-delay: 0.15s; }
.image-item:nth-child(3) { animation-delay: 0.2s; }
.image-item:nth-child(4) { animation-delay: 0.25s; }

/* Notifications - Gentle Slide */
.notification {
  animation: fadeInUp 0.4s ease-out;
}

/* Info Boxes - Subtle Entrance */
.info-box {
  animation: fadeInUp 0.5s ease-out 0.3s both;
}

/* Progress Bar - Smooth Fill */
.progress-fill {
  animation: progressFill 1.5s ease-out 0.5s both;
}

@keyframes progressFill {
  from { width: 0%; }
  to { width: var(--progress-width, 100%); }
}

/* Footer - Delayed Entrance */
.md-footer {
  animation: fadeIn 0.6s ease-out 0.8s both;
}

/* Theme Toggle - Gentle Rotation */
.md-header__button[data-md-component="palette"] {
  transition: transform 0.2s ease;
}

.md-header__button[data-md-component="palette"]:hover {
  transform: rotate(15deg);
}

/* Link Underlines - Smooth Expand */
.md-typeset a {
  position: relative;
}

.md-typeset a:after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--laki-primary);
  transition: width 0.3s ease;
}

.md-typeset a:hover:after {
  width: 100%;
}

/* Tab Animation - Clean Underline */
.tab-button {
  position: relative;
}

.tab-button:after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--laki-primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.tab-button.active:after,
.tab-button:hover:after {
  width: 80%;
}

/* Loading Spinner - Minimal */
.loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--md-border-primary);
  border-radius: 50%;
  border-top-color: var(--laki-primary);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Accordion - Smooth Expand */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out, padding 0.3s ease-out;
}

.accordion-item.active .accordion-content {
  max-height: 400px;
  transition: max-height 0.4s ease-in, padding 0.1s ease-in;
}

.accordion-header:after {
  content: '+';
  transition: transform 0.2s ease;
  font-weight: normal;
  opacity: 0.7;
}

.accordion-item.active .accordion-header:after {
  content: '−';
  transform: rotate(180deg);
}

/* Responsive Animation Adjustments */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  
  .md-header__button[data-md-component="palette"]:hover {
    transform: none;
  }
}

@media (max-width: 768px) {
  .md-content__inner {
    animation-duration: 0.4s;
  }
  
  .md-nav__item {
    animation-duration: 0.3s;
  }
  
  /* Disable hover animations on mobile */
  .step-card:hover,
  .feature-card:hover,
  .image-item:hover {
    transform: none;
    animation: none;
  }
}

/* Intersection Observer for Scroll Animations */
.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.6s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Special Effects - Minimal */
.glow-effect {
  box-shadow: 0 0 15px rgba(48, 187, 85, 0.2);
}

/* Focus States - Accessible */
.cta-button:focus,
.secondary-button:focus,
.tab-button:focus,
.accordion-header:focus {
  outline: 2px solid var(--laki-primary);
  outline-offset: 2px;
}

/* Smooth Page Transitions */
.page-transition {
  animation: pageEnter 0.5s ease-out;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Gradient Animation */
@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* Pulse Animation */
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* Bounce Animation */
@keyframes bounce {
  0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  60% { transform: translateY(-5px); }
}

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

/* Slide Animations */
@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInFromBottom {
  from {
    opacity: 0;
    transform: translateY(100%);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Rotation Animations */
@keyframes rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes flipIn {
  from {
    opacity: 0;
    transform: rotateY(-90deg);
  }
  to {
    opacity: 1;
    transform: rotateY(0);
  }
}

/* Table Row Hover */
.md-typeset table tbody tr {
  transition: all 0.3s ease;
}

.md-typeset table tbody tr:hover {
  transform: translateX(5px);
}

/* Code Block Animation */
.md-typeset pre {
  animation: fadeInUp 0.8s ease-out 0.8s both;
}

/* Tab Animation */
.tab-button {
  position: relative;
}

.tab-button:after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 50%;
  width: 0;
  height: 3px;
  background: var(--laki-primary);
  transition: all 0.3s ease;
  transform: translateX(-50%);
}

.tab-button.active:after,
.tab-button:hover:after {
  width: 100%;
}

/* Accordion Animation */
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.accordion-item.active .accordion-content {
  max-height: 500px;
  transition: max-height 0.5s ease-in;
}

.accordion-header:after {
  content: '+';
  transition: transform 0.3s ease;
  font-weight: bold;
}

.accordion-item.active .accordion-header:after {
  content: '−';
  transform: rotate(180deg);
}

/* Timeline Animation */
.timeline-item {
  animation: fadeInLeft 0.8s ease-out;
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.3s; }
.timeline-item:nth-child(3) { animation-delay: 0.5s; }
.timeline-item:nth-child(4) { animation-delay: 0.7s; }

/* Image Gallery Animation */
.image-item {
  animation: scaleIn 0.6s ease-out;
}

.image-item:nth-child(1) { animation-delay: 0.1s; }
.image-item:nth-child(2) { animation-delay: 0.2s; }
.image-item:nth-child(3) { animation-delay: 0.3s; }
.image-item:nth-child(4) { animation-delay: 0.4s; }

/* Notification Animation */
.notification {
  animation: slideInFromTop 0.5s ease-out;
}

.notification.success {
  animation: fadeInUp 0.6s ease-out;
}

.notification.warning {
  animation: shake 0.6s ease-out;
}

.notification.error {
  animation: shake 0.8s ease-out;
}

/* Theme Toggle Animation */
.md-header__button[data-md-component="palette"] {
  transition: all 0.3s ease;
}

.md-header__button[data-md-component="palette"]:hover {
  animation: rotate 0.5s ease-in-out;
}

/* Scroll Animations */
.scroll-fade {
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s ease-out;
}

.scroll-fade.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Link Hover Animations */
.md-typeset a {
  position: relative;
}

.md-typeset a:after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--laki-primary);
  transition: width 0.3s ease;
}

.md-typeset a:hover:after {
  width: 100%;
}

/* Footer Animation */
.md-footer {
  animation: fadeInUp 1s ease-out 1s both;
}

/* Responsive Animation Adjustments */
@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 768px) {
  .md-content__inner {
    animation-duration: 0.6s;
  }
  
  .md-nav__item {
    animation-duration: 0.4s;
  }
  
  .step-card:hover,
  .feature-card:hover {
    transform: none;
    animation: none;
  }
  
  .md-typeset table tbody tr:hover {
    transform: none;
  }
}

/* Intersection Observer Animations */
@keyframes revealUp {
  from {
    opacity: 0;
    transform: translateY(50px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.reveal {
  opacity: 0;
  transform: translateY(50px);
  transition: all 0.8s ease-out;
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* Special Effects */
.glow-effect {
  box-shadow: 0 0 20px rgba(48, 187, 85, 0.3);
  animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
  from { box-shadow: 0 0 20px rgba(48, 187, 85, 0.3); }
  to { box-shadow: 0 0 30px rgba(48, 187, 85, 0.6); }
}

.typing-effect {
  overflow: hidden;
  border-right: 2px solid var(--laki-primary);
  white-space: nowrap;
  animation: typing 3s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--laki-primary); }
} 