/* ============================================================
   animations.css — Homepage motion/energy layer
   ============================================================
   Purely additive visual layer — no rule here changes layout,
   colors, or spacing that style.css already defines; everything
   is either a transform/opacity animation or a new self-contained
   section (Trust Bar, CTA Banner). Loaded AFTER style.css.

   HOW THE SCROLL-REVEAL CLASSES WORK (see animations.js):
     .scroll-fade-up / .scroll-fade-left / .scroll-bounce-scale /
     .scroll-slide-left / .scroll-slide-right — animations.js adds
     ONE of these to a target element, which sets its HIDDEN starting
     state (opacity 0 + an offset transform). When the element scrolls
     into view, animations.js adds .in-view alongside it, which
     transitions to the visible resting state. Each pair is defined
     together below for readability.

   ACCESSIBILITY: animations.js checks prefers-reduced-motion and, if
   set, never adds the hidden-state classes at all — elements simply
   render in their final visible position, no animation, no JS needed
   to "fix" anything.
============================================================ */


/* ============================================================
   1. SCROLL-REVEAL BASE CLASSES
============================================================ */

.scroll-fade-up,
.scroll-fade-left,
.scroll-bounce-scale,
.scroll-slide-left,
.scroll-slide-right {
  transition: opacity 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  /* animations.js sets transition-delay inline per-element for stagger */
}

/* Product cards, CTA banner content — fade in + rise up */
.scroll-fade-up { opacity: 0; transform: translateY(20px); }
.scroll-fade-up.in-view { opacity: 1; transform: translateY(0); }

/* Section headings — fade in + slide from the left */
.scroll-fade-left { opacity: 0; transform: translateX(-24px); }
.scroll-fade-left.in-view { opacity: 1; transform: translateX(0); }

/* Feature strip icons, Trust Bar cards — fade + gentle overshoot scale */
.scroll-bounce-scale {
  opacity: 0;
  transform: scale(0.8);
  transition-timing-function: cubic-bezier(0.34, 1.56, 0.64, 1); /* slight overshoot = "bounce" */
}
.scroll-bounce-scale.in-view { opacity: 1; transform: scale(1); }

/* Promo banners — slide in from opposite sides */
.scroll-slide-left  { opacity: 0; transform: translateX(-40px); }
.scroll-slide-left.in-view  { opacity: 1; transform: translateX(0); }
.scroll-slide-right { opacity: 0; transform: translateX(40px); }
.scroll-slide-right.in-view { opacity: 1; transform: translateX(0); }

/* Brand carousel logos fade in only (never transform — script.js already
   drives .brands-track's transform for the auto-slide loop; animating
   transform here too would fight that inline style every tick). */
.brand-card.scroll-fade-in { transition: opacity 0.5s ease-out; opacity: 0; }
.brand-card.scroll-fade-in.in-view { opacity: 1; }

/* Respect the OS-level "reduce motion" setting: even if a hidden class
   somehow ended up on an element (e.g. JS raced the media query check),
   skip the animation and just show it — belt-and-braces on top of the
   JS-side guard in animations.js. */
@media (prefers-reduced-motion: reduce) {
  .scroll-fade-up, .scroll-fade-left, .scroll-bounce-scale,
  .scroll-slide-left, .scroll-slide-right, .brand-card.scroll-fade-in {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}


/* ============================================================
   3. HERO SECTION ENERGY UPGRADE
============================================================ */

/* ---- Animated "breathing" gradient background ----
   A subtle slow drift across a wider-than-visible gradient — the
   background-size is larger than 100% so shifting background-position
   actually moves visible color, instead of just re-centering a fixed gradient. */
.hero-section {
  background-image: linear-gradient(120deg, #FFFFFF 0%, #FDF2F2 35%, #F7ECEC 60%, #FFFFFF 100%);
  background-size: 200% 200%;
  animation: heroGradientDrift 8s ease infinite alternate;
}

@keyframes heroGradientDrift {
  0%   { background-position: 0% 50%; }
  100% { background-position: 100% 50%; }
}

/* ---- Floating hero product cards ----
   Each card floats on its own independent timing (3s / 3.5s / 4s) so
   they never move in sync — nth-child targets the 3 cards rendered by
   renderMiniProductCard() in index.php's hero-float-cards loop. */
.hero-float-card {
  animation: heroCardFloat 3s ease-in-out infinite alternate;
}
.hero-float-cards .hero-float-card:nth-child(1) { animation-duration: 3s; }
.hero-float-cards .hero-float-card:nth-child(2) { animation-duration: 3.5s; animation-delay: 0.3s; }
.hero-float-cards .hero-float-card:nth-child(3) { animation-duration: 4s;   animation-delay: 0.6s; }

@keyframes heroCardFloat {
  0%   { transform: translateY(0); }
  100% { transform: translateY(-10px); }
}

/* ---- Shimmer/gloss sweep on "SMARTEST" ----
   A bright diagonal band travels across the text every 4s. background-clip:
   text + a transparent-colored-transparent gradient masked to the glyph
   shapes is the standard CSS-only text-shimmer technique. */
.hero-headline .hl-primary {
  background-image: linear-gradient(
    100deg,
    var(--primary) 40%,
    #ff6b6b 48%,
    #ffb3b3 50%,
    #ff6b6b 52%,
    var(--primary) 60%
  );
  background-size: 300% 100%;
  background-position: 100% 0;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  animation: heroTextShimmer 4s ease-in-out infinite;
}

@keyframes heroTextShimmer {
  0%, 15%  { background-position: 100% 0; }
  55%, 100% { background-position: -100% 0; }
}

/* ---- Typing cursor on the hero subtitle ----
   A blinking "|" appended after the text via ::after — no markup
   change needed, purely decorative so it's safe to add/remove. */
.hero-subtext::after {
  content: '|';
  display: inline-block;
  margin-left: 2px;
  font-weight: 700;
  color: var(--primary);
  animation: heroCursorBlink 1s step-end infinite;
}

@keyframes heroCursorBlink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .hero-section          { animation: none; }
  .hero-float-card       { animation: none; }
  .hero-headline .hl-primary { animation: none; background-position: 0 0; }
  .hero-subtext::after   { animation: none; }
}


/* ============================================================
   4. DIAGONAL DIVIDER — hero → features strip
   A clip-path on the features strip itself cuts a shallow diagonal
   across its top edge so the seam between the two sections isn't a
   flat horizontal line. The strip is given a little extra top padding
   to compensate for the sliver the clip-path removes.
============================================================ */
.features-strip {
  clip-path: polygon(0 12px, 100% 0, 100% 100%, 0 100%);
  padding-top: 12px;
  margin-top: -1px; /* avoids a 1px seam/gap some browsers render at the clipped edge */
}


/* ============================================================
   5. FEATURE STRIP ICON HOVER (small extra polish)
============================================================ */
.feature-item .feature-icon {
  display: inline-block;
  transition: transform 0.25s ease;
}
.feature-item:hover .feature-icon {
  transform: scale(1.15);
}


/* ============================================================
   6. CALL TO ACTION BANNER — new section, added before the footer
============================================================ */
.cta-banner {
  position: relative;
  overflow: hidden;
  padding: 4rem 1.5rem;
  background: #0f1318;
  text-align: center;
}

/* Diagonal red gradient overlay, laid over the dark base */
.cta-banner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(160, 30, 30, 0.35) 0%, transparent 55%);
  pointer-events: none;
}

/* Floating low-opacity geometric blobs for depth — decorative only,
   aria-hidden in the markup. Each blob drifts slowly and independently. */
.cta-blob {
  position: absolute;
  border-radius: 50%;
  background: var(--primary);
  opacity: 0.07;
  pointer-events: none;
  filter: blur(2px);
}
.cta-blob-1 { width: 220px; height: 220px; top: -60px;  left: -40px;  animation: ctaBlobDrift1 12s ease-in-out infinite alternate; }
.cta-blob-2 { width: 160px; height: 160px; bottom: -50px; right: 8%;  animation: ctaBlobDrift2 15s ease-in-out infinite alternate; }
.cta-blob-3 { width: 110px; height: 110px; top: 20%;      right: -30px; opacity: 0.05; animation: ctaBlobDrift1 10s ease-in-out infinite alternate; }
.cta-blob-4 { width: 90px;  height: 90px;  bottom: 15%;   left: 6%;   opacity: 0.06; animation: ctaBlobDrift2 9s ease-in-out infinite alternate; }

@keyframes ctaBlobDrift1 {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(24px, 18px); }
}
@keyframes ctaBlobDrift2 {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(-20px, -16px); }
}

.cta-content {
  position: relative;
  z-index: 1;
  max-width: 640px;
  margin: 0 auto;
}

.cta-headline {
  color: var(--white);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 0.75rem;
}

.cta-subtext {
  color: var(--gray-400);
  font-size: 1rem;
  line-height: 1.6;
  margin-bottom: 2rem;
}

.cta-buttons {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
}

.cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  padding: 0.95rem 1.75rem;
  border-radius: var(--radius-full, 9999px);
  font-size: 1rem;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.cta-btn-primary {
  background: var(--primary);
  color: var(--white);
  box-shadow: 0 8px 24px rgba(160, 30, 30, 0.4);
}
.cta-btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 30px rgba(160, 30, 30, 0.5);
}

.cta-btn-outline {
  background: transparent;
  color: var(--white);
  border: 2px solid rgba(255, 255, 255, 0.5);
}
.cta-btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--white);
  transform: translateY(-3px);
}

@media (min-width: 640px) {
  .cta-buttons { flex-direction: row; justify-content: center; }
  .cta-btn { width: auto; }
  .cta-headline { font-size: 2.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cta-blob-1, .cta-blob-2, .cta-blob-3, .cta-blob-4 { animation: none; }
}


/* ============================================================
   8. PRODUCT CARD MICRO-INTERACTIONS
============================================================ */

/* ---- Image zoom on card hover ----
   .product-image already has overflow:hidden (style.css), so the
   scaled-up image never breaks the card's rounded corners/layout. */
.product-image > img {
  transition: transform 0.35s ease;
}
.product-card:hover .product-image > img {
  transform: scale(1.05);
}

/* ---- "Add to Cart" click feedback ----
   .added is toggled by script.js for 1.5s after a click; the keyframe
   plays once automatically the instant the class (and therefore the
   animation-name) is applied — no extra JS timing code needed here. */
.btn-add-cart.added {
  animation: addToCartPop 0.4s ease;
}
@keyframes addToCartPop {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

/* ---- "View Details" hover arrow slide-in ----
   The arrow character is appended via ::after, hidden (0 width, 0
   opacity) until hover, when it slides in from the left of its own
   position — reads as the arrow "sliding into" the button text. */
.btn-view-details {
  position: relative;
}
.btn-view-details::after {
  content: '→';
  display: inline-block;
  width: 0;
  margin-left: 0;
  opacity: 0;
  overflow: hidden;
  transform: translateX(-6px);
  transition: width 0.25s ease, margin-left 0.25s ease, opacity 0.25s ease, transform 0.25s ease;
  vertical-align: middle;
}
.btn-view-details:hover::after {
  width: 1em;
  margin-left: 4px;
  opacity: 1;
  transform: translateX(0);
}

/* ---- Discount / Hot Deal badge attention pulse ----
   Applies to both the card-image HOT DEAL badge and product.php's
   discount-badge — a subtle scale pulse every 4s, gentle enough not
   to be annoying on a page with many discounted cards at once. */
.badge-hot-deal,
.discount-badge {
  animation: discountPulse 4s ease-in-out infinite;
}
@keyframes discountPulse {
  0%, 85%, 100% { transform: scale(1); }
  90%           { transform: scale(1.12); }
}

/* ---- Wishlist heart icon ----
   Sits in the bottom-right corner of the card image (top corners are
   already used by the stock badge + product badges). Pure client-side
   visual toggle — see animations.js for the click handler. */
.wishlist-btn {
  position: absolute;
  bottom: 8px;
  right: 8px;
  z-index: 1;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  color: #9CA3AF;
  font-size: 15px;
  line-height: 1;
  transition: color 0.2s ease, transform 0.15s ease;
}
.wishlist-btn:hover {
  color: var(--primary);
  transform: scale(1.1);
}
.wishlist-btn.active {
  color: var(--primary);
  animation: wishlistPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes wishlistPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.35); }
  100% { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .product-card:hover .product-image > img { transform: none; }
  .btn-add-cart.added   { animation: none; }
  .badge-hot-deal, .discount-badge { animation: none; }
  .wishlist-btn.active  { animation: none; }
}
