/**
 * Webflow Animation & Interaction Styles Replacement
 * ==================================================
 * This CSS replaces Webflow's IX2 (Interactions 2.0) initial states
 * and provides smooth animations for self-hosted deployment.
 */

/* ===========================================
   0. NAVBAR FIXES
   =========================================== */

/*
 * The Webflow CSS stack (webflow.css + dcode---updated.webflow.css) handles
 * ALL navbar styling at ALL breakpoints:
 *   .navbar { position: fixed; inset: 0% 0% auto; }
 *   .navbar.v3 { background-color: #fff0; }
 *   .navbar.global { z-index: 100; background-color: var(--bg-color); }
 *
 * We ONLY override properties that webflow.js may set as inline styles
 * during mobile nav open/close, which could persist after a viewport resize.
 */

/* --- V3 Navbar: Hide pill on mobile (≤767px) --- */
/* dcode CSS .nav-menu.v3 { display: flex } at base wins over
 * webflow.css [data-collapse='small'] .w-nav-menu { display: none }
 * because dcode loads later at equal specificity. Force the hide,
 * but allow webflow.js to show it when hamburger is tapped. */
@media screen and (max-width: 767px) {
  .navbar.v3 .w-nav-menu:not([data-nav-menu-open]) {
    display: none !important;
  }
}

/* --- V3 Navbar: Desktop only (pill visible above 767px) --- */
/* index.html uses data-collapse="small" → collapses at 767px */
@media screen and (min-width: 768px) {
  .navbar.v3 .w-nav-menu {
    display: flex !important;
    position: relative !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
  }

  .navbar.v3 .w-nav-button {
    display: none !important;
  }
}

/* --- Global Navbar: Desktop only (links visible above 991px) --- */
/* Other pages use data-collapse="medium" → collapses at 991px */
@media screen and (min-width: 992px) {
  .navbar.global .w-nav-menu {
    display: flex !important;
    position: static !important;
    transform: none !important;
    width: auto !important;
    height: auto !important;
    float: none !important;
  }

  .navbar.global .w-nav-button {
    display: none !important;
  }
}

/* ===========================================
   1. IX2 CLASS - Enable Animation Initial States
   =========================================== */

/* When JavaScript loads, the w-mod-ix class is added to <html>.
 * This deactivates the inline <style> initial states (html.w-mod-js:not(.w-mod-ix))
 * so that JS-driven animations can take over. */

/* ===========================================
   2. FADE-IN ANIMATIONS
   =========================================== */

/* Default fade-in animation */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translate3d(0, 20px, 0);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Hero content animation handled by initScrollAnimations() in JS.
 * DO NOT use CSS animations here — they conflict with the JS IntersectionObserver
 * because CSS animations override inline styles in the cascade, causing the
 * two systems to fight and produce unpredictable rendering. */

/* ===========================================
   3. NAVIGATION MENU TRANSITIONS
   =========================================== */

/* Menu button transition — background handled by dcode CSS
 * (.menu-button.w--open { background-color: transparent } at ≤991px) */

/* ===========================================
   4. DROPDOWN TRANSITIONS
   =========================================== */

.w-dropdown-list {
  display: none;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.w-dropdown.w--open .w-dropdown-list {
  display: block;
  opacity: 1;
  transform: translateY(0);
}

/* ===========================================
   5. SERVICE CARD HOVER EFFECTS
   =========================================== */

/* dcode CSS provides:
 *   .service-card { background-color: var(--accent-color) }
 *   .service-card.dark { background-color: var(--grey); box-shadow: 8px 15px 30px #0000004d }
 * Hover/arrow animation is handled by JS initHoverInteractions(). */

.service-arrow {
  transition: transform 300ms ease;
}

.service-card:hover .service-arrow {
  transform: translate3d(10px, 0, 0);
}

/* ===========================================
   6. BLOG CARD HOVER EFFECTS
   =========================================== */

.blog-cell-v3,
.blog-cell-v2,
.blog-cell {
  overflow: hidden;
}

.blog-cell-v3 .full-image,
.blog-cell-v2 .full-image,
.blog-cell .full-image {
  transition: transform 400ms ease, filter 400ms ease;
}

.blog-cell-v3:hover .full-image,
.blog-cell-v2:hover .full-image,
.blog-cell:hover .full-image {
  transform: scale(1.05);
  filter: grayscale(0%);
}

.blog-cell-v3 .heading-h3,
.blog-cell-v2 .heading-h3,
.blog-cell .heading-h3 {
  transition: color 300ms ease;
}

.blog-cell-v3:hover .heading-h3,
.blog-cell-v2:hover .heading-h3,
.blog-cell:hover .heading-h3 {
  color: var(--accent-color, #b485f2);
}

.blog-image-frame {
  overflow: hidden;
}

/* ===========================================
   7. BUTTON HOVER EFFECTS
   =========================================== */

/* dcode CSS already provides:
 *   .button { transition: all .4s; background-color: var(--button-bg); color: var(--accent-color); }
 *   .button:hover { background-color: var(--accent-color); color: #383e4c; }
 *   .secondery-button { transition: all .4s; }
 *   .secondery-button:hover { background-color: var(--white); color: #383e4c; }
 * We only add hover transform — no transition overrides. */

.button:hover {
  transform: translateY(-2px);
}

/* ===========================================
   7b. MOBILE TAP & FOCUS FIXES
   =========================================== */

/* Kill the default browser tap-highlight rectangle on all interactive elements */
a,
button,
input[type="submit"],
.button,
.secondery-button,
.round-button,
.w-inline-block,
.w-nav-link,
.w-nav-button,
.service-card,
.blog-cell,
.blog-cell-v2,
.blog-cell-v3 {
  -webkit-tap-highlight-color: transparent;
}

/* Hide focus ring on mouse/touch — keep visible for keyboard users (accessibility) */
:focus:not(:focus-visible) {
  outline: none;
}

/* Button pressed (active) state — match the site's purple theme */
.button:active {
  background-color: var(--accent-color, #b485f2);
  color: var(--dark-color, #353635);
  transform: scale(0.97);
}

.secondery-button:active {
  background-color: var(--accent-color, #b485f2);
  border-color: var(--accent-color, #b485f2);
  color: var(--dark-color, #353635);
  transform: scale(0.97);
}

.secondery-button:active .button-text {
  color: var(--dark-color, #353635);
}

.secondery-button .button-arrow {
  transition: transform 300ms ease;
}

.secondery-button:hover .button-arrow {
  transform: translateX(5px);
}

/* Round button hover */
.round-button {
  transition: transform 300ms ease;
}

.round-button:hover {
  transform: scale(1.1);
}

/* ===========================================
   8. FORM TRANSITIONS
   =========================================== */

.w-form-done,
.w-form-fail {
  animation: fadeIn 300ms ease forwards;
}

/* text-field focus enhancement — dcode CSS doesn't set focus styles */
.text-field:focus {
  border-color: var(--accent-color, #b485f2);
  box-shadow: 0 0 0 3px rgba(180, 133, 242, 0.2);
}

/* ===========================================
   9. NAVBAR SCROLL EFFECTS
   =========================================== */

.navbar {
  transition: background-color 300ms ease, box-shadow 300ms ease;
}

.navbar.scrolled {
  background-color: rgba(21, 22, 20, 0.95);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* ===========================================
   9b. MOBILE NAV MENU OPEN BACKGROUND
   =========================================== */

/* webflow.css sets [data-nav-menu-open] { background: #C8C8C8 } (light gray).
 * Override to match actual site theme colors. */
[data-nav-menu-open].global-nav-menu {
  background-color: var(--grey, #222325) !important;
}

[data-nav-menu-open].nav-menu.v3 {
  background-color: var(--accent-color, #b485f2) !important;
}

/* ===========================================
   10. COLLECTION/DYNAMIC LIST STATES
   =========================================== */

.w-dyn-empty {
  display: none;
}

.w-dyn-list:not(:has(.w-dyn-items > *)) .w-dyn-empty {
  display: block;
}

/* Hide empty bound elements */
.w-dyn-bind-empty:empty {
  display: none;
}

/* ===========================================
   11. SCROLL-TRIGGERED ANIMATIONS
   =========================================== */

/* Scroll-triggered animations for [data-w-id] elements are handled entirely
 * by initScrollAnimations() in JS (sets inline transition + opacity + transform).
 * No CSS transition needed here — the JS sets its own inline transitions. */

/* Container for features row animation (no data-w-id, CSS-only) */
.row-wrap {
  opacity: 0;
  transform: translateY(30px);
  animation: fadeInUp 0.6s ease-out 0.2s forwards;
}

/* ===========================================
   12. UNDERLINE ANIMATIONS
   =========================================== */

.underline {
  position: relative;
  height: 2px;
  background-color: var(--accent-color, #b485f2);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 300ms ease;
}

.navlink:hover .underline,
.dropdown-link:hover .underline {
  transform: scaleX(1);
}

/* ===========================================
   13. IMAGE LOADING STATES
   =========================================== */

/* Smooth fade for images that load after initial paint.
 * Do NOT hide lazy images with opacity:0 — browsers handle
 * native loading="lazy" without CSS intervention, and forcing
 * opacity:0 risks hiding images (like the hero building) if
 * the recovery selector doesn't fire in time. */
img {
  transition: opacity 300ms ease;
}

/* ===========================================
   14. CART & COMMERCE MODALS
   =========================================== */

.w-commerce-commercecartcontainerwrapper {
  opacity: 0;
  visibility: hidden;
  transition: opacity 300ms ease, visibility 300ms ease;
}

.w-commerce-commercecartcontainerwrapper[style*="display: flex"],
.w-commerce-commercecartcontainerwrapper.w--open {
  opacity: 1;
  visibility: visible;
}

.w-commerce-commercecartcontainer {
  transform: translateX(100%);
  transition: transform 400ms ease-in-out;
}

.w-commerce-commercecartcontainerwrapper--cartType-modal .w-commerce-commercecartcontainer {
  transform: scale(0.9);
  transition: transform 300ms ease;
}

.w-commerce-commercecartcontainerwrapper[style*="display: flex"] .w-commerce-commercecartcontainer,
.w-commerce-commercecartcontainerwrapper.w--open .w-commerce-commercecartcontainer {
  transform: translateX(0);
}

.w-commerce-commercecartcontainerwrapper--cartType-modal[style*="display: flex"] .w-commerce-commercecartcontainer {
  transform: scale(1);
}

/* ===========================================
   15. RESPONSIVE ADJUSTMENTS
   =========================================== */

/*
 * NOTE: webflow.js handles mobile nav toggling via data-nav-menu-open attribute.
 * webflow.css + dcode---updated.webflow.css provide all mobile nav styling.
 * We only add minimal visual fixes here that the Webflow export missed.
 */

/* webflow.css + dcode CSS handle all mobile nav styling.
 * webflow.css hides the menu at the correct breakpoints:
 *   [data-collapse='small'] .w-nav-menu { display: none } at ≤767px
 *   [data-collapse='medium'] .w-nav-menu { display: none } at ≤991px
 * dcode CSS styles the hamburger, menu panel, and backgrounds. */

@media screen and (max-width: 767px) {
  /* Performance: simplify hover animations on mobile */
  .service-card:hover,
  .blog-cell-v3:hover .full-image {
    transform: none;
  }
}

/* Compact layout ONLY for ultra-small viewports (e.g. 320×480).
 * Must be BOTH narrow AND short. Taller phones like the Fold
 * (374×832) use native Webflow responsive CSS unchanged. */
@media screen and (max-width: 479px) and (max-height: 500px) {
  /* Hide building image on small phones — not enough room */
  .hero-image-v3 {
    display: none !important;
  }

  /* Reduce navbar height */
  .navbar-container._3 {
    padding-top: 12px !important;
    padding-bottom: 12px !important;
  }

  /* Push hero content below the fixed navbar, fit in viewport */
  .container.hero-v3 {
    padding-top: 70px !important;
    padding-bottom: 16px !important;
    min-height: auto !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
  }

  .hero-v3-wrapper {
    height: auto !important;
    justify-content: flex-start !important;
    gap: 16px !important;
  }

  /* Smaller heading */
  .hero-v3 .heading-h1 {
    font-size: 28px !important;
    line-height: 120% !important;
  }

  /* Smaller hero paragraph */
  .hero-v3 .content-wrap .paragraph {
    font-size: 14px !important;
    margin-bottom: 4px !important;
  }

  /* Same-size buttons */
  .hero-v3 .button,
  .hero-v3 .secondery-button {
    font-size: 14px !important;
    padding: 10px 20px !important;
  }

  /* Stats section — move up and shrink */
  .feature-wrapper {
    margin-top: 12px !important;
    gap: 16px !important;
  }

  .feature-wrapper .price.thin {
    font-size: 18px !important;
  }

  .feature-wrapper .paragraph.small {
    font-size: 12px !important;
  }

  .feature-wrap {
    gap: 2px !important;
  }
}

/* ===========================================
   16. PREFERS-REDUCED-MOTION
   =========================================== */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
