/* AVN Networks — Animations & Interactivity
   Version: 1.1 | Sesion 6 | 2026-09-15
   Enqueue via functions.php: wp_enqueue_style('avn-animations', ...)
*/

/* =========================================
   1. KEYFRAMES BASE
   ========================================= */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(30px); }
  to   { opacity: 1; transform: translateX(0); }
}
@keyframes pulse-ring {
  0%   { transform: scale(0.8); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}
@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}
@keyframes countUp {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* =========================================
   2. SCROLL PROGRESS BAR
   ========================================= */
#avn-scroll-progress {
  position: fixed; top: 0; left: 0;
  width: 0%; height: 3px;
  background: linear-gradient(90deg, #0066cc, #00c4cc);
  z-index: 9999; transition: width 0.1s linear;
}

/* =========================================
   3. HERO / HEADER ANIMATIONS
   ========================================= */
.avn-hero h1, .avn-hero .hero-title, .entry-title.avn-page-title {
  animation: fadeInUp 0.7s ease both; animation-delay: 0.1s;
}
.avn-hero p, .avn-hero .hero-subtitle, .avn-lead {
  animation: fadeInUp 0.7s ease both; animation-delay: 0.25s;
}
.avn-hero .wp-block-buttons, .avn-hero .avn-cta-btn {
  animation: fadeInUp 0.7s ease both; animation-delay: 0.4s;
}
.site-header, header.site-header {
  transition: padding 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}
.site-header.avn-scrolled {
  padding-top: 8px !important; padding-bottom: 8px !important;
  box-shadow: 0 2px 20px rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.97) !important;
  backdrop-filter: blur(8px);
}

/* =========================================
   4. SERVICE CARDS
   ========================================= */
.avn-service-card, .wp-block-column, .wp-block-group.avn-card {
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.avn-service-card:hover, .wp-block-group.avn-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 40px rgba(0,102,204,0.18);
}
.avn-service-icon, .wp-block-image.avn-icon img {
  transition: transform 0.3s ease;
}
.avn-service-card:hover .avn-service-icon,
.avn-service-card:hover .wp-block-image.avn-icon img {
  transform: rotate(10deg) scale(1.1);
}

/* =========================================
   5. BUTTONS
   ========================================= */
.wp-block-button__link, .avn-cta-btn .wp-block-button__link, a.avn-btn {
  position: relative; overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.wp-block-button__link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,102,204,0.35);
}
.wp-block-button__link:active { transform: translateY(0); box-shadow: none; }

/* =========================================
   6. SCROLL-REVEAL
   ========================================= */
.avn-reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.avn-reveal.avn-visible { opacity: 1; transform: translateY(0); }
.avn-reveal-left { opacity: 0; transform: translateX(-24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.avn-reveal-left.avn-visible { opacity: 1; transform: translateX(0); }
.avn-reveal-right { opacity: 0; transform: translateX(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.avn-reveal-right.avn-visible { opacity: 1; transform: translateX(0); }
.avn-reveal:nth-child(1) { transition-delay: 0s; }
.avn-reveal:nth-child(2) { transition-delay: 0.1s; }
.avn-reveal:nth-child(3) { transition-delay: 0.2s; }
.avn-reveal:nth-child(4) { transition-delay: 0.3s; }
.avn-reveal:nth-child(5) { transition-delay: 0.4s; }
.avn-reveal:nth-child(6) { transition-delay: 0.5s; }

/* =========================================
   7. STATS
   ========================================= */
.avn-stat-number { font-size: 3rem; font-weight: 800; color: #0066cc; line-height: 1; animation: countUp 0.5s ease both; }
.avn-stats-section { background: linear-gradient(135deg,#f0f7ff 0%,#e8f4fd 100%); padding: 60px 0; }

/* =========================================
   8. WHATSAPP BUTTONS
   ========================================= */
#avn-whatsapp-btn {
  position: fixed; bottom: 28px; right: 28px;
  width: 60px; height: 60px; background: #25D366; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(37,211,102,0.45); z-index: 9998;
  text-decoration: none; transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: float 3s ease-in-out infinite;
}
#avn-whatsapp-btn:hover { transform: scale(1.15); box-shadow: 0 8px 30px rgba(37,211,102,0.6); animation: none; }
#avn-whatsapp-btn svg { width: 32px; height: 32px; fill: white; }
#avn-whatsapp-btn::before {
  content: ''; position: absolute; width: 100%; height: 100%;
  border-radius: 50%; background: rgba(37,211,102,0.4);
  animation: pulse-ring 2s ease-out infinite;
}
#avn-whatsapp-btn-alt {
  position: fixed; bottom: 100px; right: 28px;
  width: 48px; height: 48px; background: #128C7E; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(18,140,126,0.45); z-index: 9997;
  text-decoration: none; transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#avn-whatsapp-btn-alt:hover { transform: scale(1.12); box-shadow: 0 6px 24px rgba(18,140,126,0.6); }
#avn-whatsapp-btn-alt svg { width: 26px; height: 26px; fill: white; }

/* =========================================
   9. BACK TO TOP
   ========================================= */
#avn-back-top {
  position: fixed; bottom: 100px; right: 88px;
  width: 44px; height: 44px; background: #0066cc; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: 0; transform: translateY(10px);
  transition: opacity 0.3s ease, transform 0.3s ease, background 0.2s ease;
  z-index: 9996; border: none; box-shadow: 0 3px 12px rgba(0,102,204,0.35);
}
#avn-back-top.avn-visible { opacity: 1; transform: translateY(0); }
#avn-back-top:hover { background: #0052a3; }
#avn-back-top svg { width: 20px; height: 20px; fill: white; }

/* =========================================
   10. LINK UNDERLINE ANIMATION
   ========================================= */
.site-nav a, .main-navigation a, nav a { position: relative; }
.site-nav a::after, .main-navigation a::after, nav a::after {
  content: ''; position: absolute; bottom: -2px; left: 0;
  width: 0; height: 2px; background: #0066cc; transition: width 0.25s ease;
}
.site-nav a:hover::after, .main-navigation a:hover::after, nav a:hover::after { width: 100%; }

/* =========================================
   11. SKELETON / BLOG / FORMS
   ========================================= */
.avn-skeleton { background: linear-gradient(90deg,#f0f0f0 25%,#e0e0e0 50%,#f0f0f0 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 4px; }
article.post, .wp-block-post { transition: transform 0.25s ease, box-shadow 0.25s ease; border-radius: 8px; }
article.post:hover, .wp-block-post:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.1); }
input[type="text"], input[type="email"], input[type="tel"], textarea, select {
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  border: 1.5px solid #ddd !important; border-radius: 6px !important;
}
input[type="text"]:focus, input[type="email"]:focus, input[type="tel"]:focus, textarea:focus, select:focus {
  border-color: #0066cc !important; box-shadow: 0 0 0 3px rgba(0,102,204,0.15) !important; outline: none;
}

/* =========================================
   12. LANGUAGE SWITCHER
   ========================================= */
.avn-lang__btn { transition: color 0.2s ease, transform 0.2s ease; }
.avn-lang__btn:hover { color: #0066cc; transform: scale(1.1); }
.avn-lang__btn.active { font-weight: 700; color: #0066cc; }

/* =========================================
   13. HAMBURGER MENU (MOBILE NAV)
   ========================================= */
.avn-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: none; border: none;
  cursor: pointer; padding: 8px;
  z-index: 10001;
  -webkit-tap-highlight-color: transparent;
}
.avn-hamburger span {
  display: block; width: 26px; height: 2px;
  background: #0066cc; border-radius: 2px;
  transition: transform 0.3s ease, opacity 0.3s ease;
  transform-origin: center;
}
.avn-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.avn-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.avn-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* =========================================
   14. RESPONSIVE — MOBILE MENU
   ========================================= */

/* --- Breakpoint: tablet/mobile <= 1023px --- */
@media screen and (max-width: 1023px) {
  .avn-hamburger { display: flex; }

  .avn-nav {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100vh;
    background: rgba(255,255,255,0.98);
    backdrop-filter: blur(10px);
    display: flex; align-items: center; justify-content: center;
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    z-index: 10000;
    overflow-y: auto;
  }
  .avn-nav.avn-nav--open {
    opacity: 1; visibility: visible; pointer-events: auto;
  }
  .avn-nav__list {
    flex-direction: column !important;
    align-items: center;
    gap: 0; margin: 0; padding: 80px 24px 40px;
    list-style: none; width: 100%;
    max-width: 400px;
  }
  .avn-nav__list li { width: 100%; text-align: center; }
  .avn-nav__list li a {
    display: block; padding: 16px 24px;
    font-size: 1.2rem; font-weight: 600;
    color: #1a1a2e; text-decoration: none;
    border-bottom: 1px solid #eee;
    transition: color 0.2s ease, background 0.2s ease;
  }
  .avn-nav__list li:last-child a { border-bottom: none; }
  .avn-nav__list li a:hover { color: #0066cc; background: #f0f7ff; }

  /* Submenu (dropdown) mobile */
  .avn-nav__list .sub-menu {
    position: static !important; display: none;
    background: #f8f9fa; width: 100%;
  }
  .avn-nav__list .menu-item-has-children.open > .sub-menu { display: block; }
  .avn-nav__list .menu-item-has-children > a::after {
    content: ' \25BE'; font-size: 0.8em;
  }

  /* Header layout on mobile */
  .avn-header__inner {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
  }
  .avn-logo-img img { max-height: 48px; width: auto; }

  /* Stack columns on mobile */
  .wp-block-columns {
    flex-direction: column !important;
  }
  .wp-block-column {
    width: 100% !important; max-width: 100% !important;
    flex-basis: 100% !important;
  }

  /* Stats responsive */
  .avn-stat-number { font-size: 2.2rem; }
  .avn-stats-section { padding: 40px 16px; }

  /* WhatsApp/buttons on small screens */
  #avn-whatsapp-btn { width: 52px; height: 52px; bottom: 20px; right: 16px; }
  #avn-whatsapp-btn-alt { width: 42px; height: 42px; bottom: 84px; right: 20px; }
  #avn-back-top { bottom: 84px; right: 70px; }
}

/* --- Breakpoint: phone portrait <= 680px --- */
@media screen and (max-width: 680px) {
  .avn-nav__list li a { font-size: 1.05rem; padding: 14px 20px; }
  .avn-logo-img img { max-height: 40px; }
  .avn-stat-number { font-size: 1.8rem; }

  /* Full width blocks */
  .wp-block-group, .wp-block-cover, .wp-block-media-text {
    padding-left: 16px !important; padding-right: 16px !important;
  }
  /* Hero text */
  .avn-hero h1, .avn-hero .hero-title { font-size: clamp(1.6rem, 5vw, 2.5rem); }
  .avn-hero p { font-size: clamp(0.9rem, 3vw, 1.1rem); }

  /* Buttons full width on mobile */
  .wp-block-buttons { flex-direction: column; align-items: stretch; }
  .wp-block-button { width: 100%; }
  .wp-block-button__link { width: 100%; text-align: center; padding: 14px 20px !important; }
}

/* --- Breakpoint: very small <= 400px --- */
@media screen and (max-width: 400px) {
  .avn-header__inner { padding: 10px 12px; }
  .avn-logo-img img { max-height: 36px; }
  .avn-nav__list li a { font-size: 1rem; padding: 12px 16px; }
}

/* --- Breakpoint: large screens >= 1400px --- */
@media screen and (min-width: 1400px) {
  .avn-stat-number { font-size: 3.5rem; }
  .avn-stats-section { padding: 80px 0; }
}

/* --- 4K / very high DPI --- */
@media screen and (min-width: 2560px) {
  body { font-size: 18px; }
  .avn-hero h1 { font-size: clamp(2.5rem, 3vw, 5rem); }
  #avn-whatsapp-btn { width: 72px; height: 72px; }
  #avn-whatsapp-btn svg { width: 40px; height: 40px; }
}

/* --- Landscape phone (height <= 500px) --- */
@media screen and (max-height: 500px) and (orientation: landscape) {
  .avn-nav {
    padding-top: 60px;
    align-items: flex-start;
    overflow-y: auto;
  }
  .avn-nav__list { padding: 60px 16px 20px; }
  .avn-nav__list li a { padding: 10px 16px; font-size: 1rem; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
