/* ========================================
   TREE TRUFFLES — PREMIUM ANIMATIONS
   Sugarfina meets Apple. Alive & modern.
   ======================================== */

/* ===== PAGE LOADER ===== */
.page-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--cream);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.page-loader.loaded {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(27, 67, 50, 0.1);
  border-top-color: var(--green-dark);
  border-right-color: var(--gold);
  border-radius: 50%;
  animation: loaderSpin 0.9s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

.loader-text {
  margin-top: 20px;
  font-family: 'Playfair Display', serif;
  font-size: 0.8rem;
  color: var(--brown-mid);
  letter-spacing: 4px;
  text-transform: uppercase;
  opacity: 0.7;
}

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

/* ===== HERO LOGO SHIMMER ===== */
.hero-logo-wrap {
  position: relative;
  display: inline-block;
  overflow: hidden;
  border-radius: var(--radius-md);
  margin: 0 auto 32px;
}

.hero-logo-wrap .hero-logo {
  margin: 0;
  display: block;
}

.hero-logo-wrap::after {
  content: '';
  position: absolute;
  top: -50%;
  left: -80%;
  width: 50%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  transform: skewX(-20deg);
  animation: logoShimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes logoShimmer {
  0%, 70% { left: -80%; }
  100% { left: 180%; }
}

/* ===== HERO TEXT ENTRANCE ===== */
.hero-content .hero-logo-wrap,
.hero-content .hero-label,
.hero-content h1,
.hero-content .tagline,
.hero-content .price-badge,
.hero-content .hero-buttons,
.hero-content .hero-trust {
  opacity: 0;
  transform: translateY(30px);
  animation: heroFadeUp 0.8s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.hero-content .hero-logo-wrap  { animation-delay: 0.15s; }
.hero-content .hero-label      { animation-delay: 0.3s; }
.hero-content h1               { animation-delay: 0.45s; }
.hero-content .tagline         { animation-delay: 0.6s; }
.hero-content .price-badge     { animation-delay: 0.75s; }
.hero-content .hero-buttons    { animation-delay: 0.9s; }
.hero-content .hero-trust      { animation-delay: 1.05s; }

@keyframes heroFadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== FLOATING TRUFFLE PARTICLES ===== */
.particles-container {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.truffle-particle {
  position: absolute;
  border-radius: 50%;
  opacity: 0;
  animation: particleFloat linear infinite;
  will-change: transform, opacity;
}

@keyframes particleFloat {
  0% {
    opacity: 0;
    transform: translateY(0) translateX(0) rotate(0deg) scale(0.5);
  }
  8% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    transform: translateY(-50vh) translateX(30px) rotate(180deg) scale(1);
  }
  92% {
    opacity: 0.5;
  }
  100% {
    opacity: 0;
    transform: translateY(-110vh) translateX(-20px) rotate(360deg) scale(0.5);
  }
}

/* ===== NAVBAR HERO (transparent -> solid green on scroll) ===== */
.navbar-hero {
  background: transparent !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  border-bottom-color: transparent !important;
  transition: background 0.5s ease, padding 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

.navbar-hero .nav-links a {
  color: var(--text-muted);
  transition: color 0.3s ease;
}

.navbar-hero .nav-links a:hover,
.navbar-hero .nav-links a.active {
  color: var(--green-dark);
}

.navbar-hero.scrolled {
  background: rgba(27, 67, 50, 0.97) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border-bottom-color: rgba(255, 255, 255, 0.06) !important;
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
}

.navbar-hero.scrolled .nav-links a {
  color: rgba(250, 247, 240, 0.65);
}

.navbar-hero.scrolled .nav-links a:hover,
.navbar-hero.scrolled .nav-links a.active {
  color: var(--cream);
}

.navbar-hero.scrolled .nav-links a::after {
  background: var(--gold-light);
}

.navbar-hero.scrolled .logo-img {
  filter: brightness(1.3) contrast(1.05);
}

.navbar-hero.scrolled .nav-toggle span {
  background: var(--cream);
}

.navbar-hero.scrolled .cart-icon,
.navbar-hero.scrolled .cart-icon-mobile {
  color: var(--cream);
}

/* ===== PRODUCT CARD 3D LIFT + GOLD GLOW ===== */
.product-card {
  position: relative;
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.5s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.product-card:hover {
  transform: translateY(-12px) !important;
  box-shadow:
    0 24px 64px rgba(27, 67, 50, 0.14),
    0 0 0 2px rgba(201, 169, 110, 0.3),
    0 0 40px rgba(201, 169, 110, 0.06) !important;
}

/* Enhanced product image zoom */
.product-svg {
  transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1),
              filter 0.6s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.product-card:hover .product-svg {
  transform: scale(1.15) translateY(-4px) !important;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.2)) !important;
}

/* ===== STAGGERED CARD FADE-IN ===== */
.product-card.fade-in-observer { transition-duration: 0.7s; }
.product-card.fade-in-observer:nth-child(1)  { transition-delay: 0s; }
.product-card.fade-in-observer:nth-child(2)  { transition-delay: 0.08s; }
.product-card.fade-in-observer:nth-child(3)  { transition-delay: 0.16s; }
.product-card.fade-in-observer:nth-child(4)  { transition-delay: 0.24s; }
.product-card.fade-in-observer:nth-child(5)  { transition-delay: 0.32s; }
.product-card.fade-in-observer:nth-child(6)  { transition-delay: 0.40s; }
.product-card.fade-in-observer:nth-child(7)  { transition-delay: 0.48s; }
.product-card.fade-in-observer:nth-child(8)  { transition-delay: 0.56s; }
.product-card.fade-in-observer:nth-child(9)  { transition-delay: 0.64s; }
.product-card.fade-in-observer:nth-child(10) { transition-delay: 0.72s; }
.product-card.fade-in-observer:nth-child(11) { transition-delay: 0.80s; }
.product-card.fade-in-observer:nth-child(12) { transition-delay: 0.88s; }

/* ===== STATS COUNTER SECTION ===== */
.stats-section {
  padding: 64px 0;
  background: var(--green-dark);
  position: relative;
  overflow: hidden;
}

.stats-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(45, 106, 79, 0.5) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(64, 145, 108, 0.3) 0%, transparent 60%);
  pointer-events: none;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  position: relative;
  z-index: 1;
}

.stat-item {
  text-align: center;
}

.stat-number-wrap {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
}

.stat-number {
  font-family: 'Playfair Display', serif;
  font-size: 3.5rem;
  font-weight: 700;
  color: var(--cream);
  line-height: 1;
}

.stat-suffix {
  font-family: 'Playfair Display', serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--gold-light);
}

.stat-label {
  display: block;
  margin-top: 10px;
  font-size: 0.8rem;
  color: rgba(250, 247, 240, 0.55);
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* ===== MARQUEE TICKER ===== */
.marquee-section {
  overflow: hidden;
  padding: 18px 0;
  background: var(--cream-dark);
  border-top: 1px solid rgba(27, 67, 50, 0.05);
  border-bottom: 1px solid rgba(27, 67, 50, 0.05);
}

.marquee-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  animation: marqueeScroll 40s linear infinite;
  width: max-content;
}

.marquee-track:hover {
  animation-play-state: paused;
}

.marquee-item {
  font-family: 'Playfair Display', serif;
  font-size: 1rem;
  color: var(--green-dark);
  padding: 0 24px;
  opacity: 0.5;
  letter-spacing: 0.5px;
}

.marquee-dot {
  color: var(--gold);
  font-size: 0.5rem;
  opacity: 0.35;
}

@keyframes marqueeScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

/* ===== BACKGROUND TEXTURES ===== */
/* Subtle dot pattern overlay for depth */
.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(27, 67, 50, 0.025) 1px, transparent 0);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
}

/* Gradient overlay for green sections (section-accent) */
.section-accent {
  position: relative;
}

.section-accent::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    160deg,
    rgba(27, 67, 50, 0.02) 0%,
    transparent 40%,
    rgba(201, 169, 110, 0.02) 100%
  );
  pointer-events: none;
  z-index: 0;
}

.section-accent > .container {
  position: relative;
  z-index: 1;
}

/* Subtle texture on trust bar */
.trust-bar {
  position: relative;
}

.trust-bar::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 30% 50%, rgba(64, 145, 108, 0.25) 0%, transparent 50%),
    radial-gradient(ellipse at 70% 50%, rgba(45, 106, 79, 0.2) 0%, transparent 50%);
  pointer-events: none;
}

/* ===== BUTTON ENHANCEMENTS ===== */
.btn, .btn-add-cart, .btn-checkout {
  position: relative;
  overflow: hidden;
}

/* Ripple effect */
.btn-ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.3);
  transform: scale(0);
  animation: rippleEffect 0.6s ease-out forwards;
  pointer-events: none;
}

@keyframes rippleEffect {
  to {
    transform: scale(4);
    opacity: 0;
  }
}

/* Button glow + enhanced hover */
.btn-primary {
  box-shadow: 0 2px 12px rgba(27, 67, 50, 0.12);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.btn-primary:hover {
  box-shadow: 0 8px 32px rgba(27, 67, 50, 0.25), 0 0 0 1px rgba(27, 67, 50, 0.08) !important;
  transform: translateY(-3px) scale(1.02) !important;
}

.btn-secondary {
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.btn-secondary:hover {
  box-shadow: 0 8px 28px rgba(27, 67, 50, 0.15) !important;
  transform: translateY(-3px) scale(1.02) !important;
}

.btn-add-cart {
  box-shadow: 0 2px 8px rgba(27, 67, 50, 0.1);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.btn-add-cart:hover {
  box-shadow: 0 6px 20px rgba(27, 67, 50, 0.22) !important;
  transform: translateY(-2px) scale(1.03) !important;
}

/* ===== BACK TO TOP — ENHANCED ===== */
.back-to-top {
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.back-to-top.visible {
  animation: bttPulse 2.5s ease-in-out infinite;
}

.back-to-top:hover {
  transform: translateY(-4px) scale(1.1) !important;
  box-shadow: 0 8px 30px rgba(27, 67, 50, 0.3) !important;
  animation: none;
}

@keyframes bttPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(27, 67, 50, 0.2); }
  50%      { box-shadow: 0 6px 28px rgba(27, 67, 50, 0.35); }
}

/* ===== SOCIAL MEDIA ICONS ===== */
.social-links {
  display: flex;
  gap: 12px;
  margin-top: 20px;
}

.social-links a {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(250, 247, 240, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(250, 247, 240, 0.5);
  transition: all 0.4s cubic-bezier(0.23, 1, 0.32, 1);
}

.social-links a:hover {
  background: var(--cream);
  color: var(--green-dark);
  border-color: var(--cream);
  transform: translateY(-3px) scale(1.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.social-links svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* ===== SCROLL REVEAL ===== */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity 0.7s cubic-bezier(0.23, 1, 0.32, 1),
              transform 0.7s cubic-bezier(0.23, 1, 0.32, 1);
}

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

/* ===== FEATURE/TESTIMONIAL CARD ENHANCEMENTS ===== */
.feature-card,
.testimonial-card {
  transition: transform 0.5s cubic-bezier(0.23, 1, 0.32, 1),
              box-shadow 0.5s cubic-bezier(0.23, 1, 0.32, 1) !important;
}

.feature-card:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 16px 48px rgba(27, 67, 50, 0.1) !important;
}

.testimonial-card:hover {
  transform: translateY(-6px) !important;
  box-shadow: 0 16px 48px rgba(27, 67, 50, 0.1) !important;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }

  .stat-number {
    font-size: 2.5rem;
  }

  .stat-suffix {
    font-size: 1.5rem;
  }

  .marquee-item {
    font-size: 0.9rem;
    padding: 0 16px;
  }

  .navbar-hero.scrolled .nav-links {
    background: var(--green-dark);
  }

  .navbar-hero.scrolled .nav-links a {
    color: rgba(250, 247, 240, 0.7);
  }

  .navbar-hero.scrolled .nav-links a:hover,
  .navbar-hero.scrolled .nav-links a.active {
    color: var(--cream);
  }

  .hero-content .hero-logo-wrap,
  .hero-content .hero-label,
  .hero-content h1,
  .hero-content .tagline,
  .hero-content .price-badge,
  .hero-content .hero-buttons,
  .hero-content .hero-trust {
    animation-duration: 0.6s;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }

  .stat-number {
    font-size: 2rem;
  }
}

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

  .truffle-particle {
    display: none !important;
  }

  .marquee-track {
    animation: none !important;
  }

  .reveal {
    opacity: 1 !important;
    transform: none !important;
  }
}
