/* ============================================================
   GREEN FOREVER - HOMEPAGE (loaded by index.php only)
   Everything is scoped under .gf-home so no other page is touched.
   Motion = transform/opacity only. Hidden "before reveal" states exist only
   when JS is running (html.js) and are lifted by html.gf-fallback if home.js fails.
   ============================================================ */
.gf-home{overflow-x:clip;--gf-ease:cubic-bezier(.22,.61,.36,1);}
.gf-home :where(a,button):focus-visible{outline:2px solid var(--gf-primary);outline-offset:2px;}

/* ---------- Section rhythm & headings ---------- */
.gf-home .section{padding:52px 0;}
.gf-home .section-tight{padding:14px 0 26px;}
.gf-home .section-head{margin-bottom:24px;align-items:flex-end;}
.gf-home .section-head h2{font-size:clamp(22px,2.6vw,30px);letter-spacing:-.015em;line-height:1.15;}
.gf-home .section-head p{max-width:46ch;}
.gf-home .section-link{display:inline-flex;align-items:center;min-height:40px;}

/* Sections below the hero are not laid out/painted until they get near the screen */
.gf-home .gfc-section ~ .section,.gf-home .gfc-section ~ .section-tight{content-visibility:auto;contain-intrinsic-size:auto 640px;}

/* ---------- Reveal on scroll (IntersectionObserver adds .is-in) ---------- */
.js:not(.gf-fallback) .gf-home .gf-reveal:not(.is-in){opacity:0;transform:translate3d(0,16px,0);}
.gf-home .gf-reveal{transition:opacity .6s ease,transform .7s var(--gf-ease);}
@keyframes gf-rise{from{opacity:0;transform:translate3d(0,18px,0);}to{opacity:1;transform:none;}}

/* ============================================================
   1. HERO
   ============================================================ */
.gf-home .gfh{position:relative;overflow:hidden;background:var(--gf-dark);isolation:isolate;}
.gfh-viewport{position:relative;aspect-ratio:2/1;max-height:720px;touch-action:pan-y;-webkit-user-select:none;user-select:none;}
.gfh-slide{
  position:absolute;inset:0;opacity:0;visibility:hidden;z-index:0;will-change:opacity,transform;contain:layout paint;
  transform:translate3d(var(--gfh-in,3%),0,0);
  transition:opacity .85s cubic-bezier(.4,0,.2,1),transform 1.05s var(--gf-ease),visibility 0s linear .85s;
}
.gfh-slide.is-active{opacity:1;visibility:visible;transform:none;z-index:2;transition-delay:0s;}
.gfh-slide.is-leaving{opacity:0;visibility:visible;transform:translate3d(var(--gfh-out,-3%),0,0);z-index:1;transition-delay:0s;}
.gfh.is-dragging .gfh-slide{transition:none;}

/* Only the visible slide's image is rendered, so lazy images of the other slides are not downloaded early */
.gfh-slide:not(.is-active):not(.is-leaving):not(.is-entering) .gfh-media{display:none;}
.gfh-media,.gfh-media img{position:absolute;inset:0;width:100%;height:100%;display:block;}
.gfh-media img{object-fit:cover;object-position:center;}

.gfh-caption{
  position:absolute;inset:0;z-index:1;display:flex;align-items:center;color:#fff;
  padding:0 max(78px,calc((100% - 1280px) / 2 + 20px));   /* 78px keeps text clear of the arrows */
  background:linear-gradient(90deg,rgba(10,25,17,.62) 0%,rgba(10,25,17,.28) 42%,rgba(10,25,17,0) 72%);
}
.gfh-caption-in{max-width:540px;}
.gfh-caption h2{font-size:clamp(26px,4.2vw,54px);font-weight:800;line-height:1.07;letter-spacing:-.02em;margin:0 0 14px;text-wrap:balance;overflow-wrap:anywhere;}
.gfh-caption p{font-size:clamp(14px,1.3vw,17px);line-height:1.55;margin:0 0 24px;max-width:46ch;opacity:.95;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
.gfh-btn{min-height:46px;padding-inline:28px;}
.gfh-caption-in > *{opacity:0;transform:translate3d(0,14px,0);transition:opacity .7s ease,transform .8s var(--gf-ease);}
.gfh-slide.is-active .gfh-caption-in > *{opacity:1;transform:none;transition-delay:.3s;}
.gfh-slide.is-active .gfh-caption-in > :nth-child(2){transition-delay:.4s;}
.gfh-slide.is-active .gfh-caption-in > :nth-child(3){transition-delay:.5s;}

.gfh-arrow{
  position:absolute;top:50%;z-index:3;width:46px;height:46px;margin-top:-23px;border-radius:50%;border:0;
  background:rgba(255,255,255,.88);color:var(--gf-dark);font-size:14px;display:flex;align-items:center;justify-content:center;
  transition:background .2s ease,transform .2s ease;
}
.gfh-arrow.prev{left:18px;} .gfh-arrow.next{right:18px;}
.gfh-arrow:hover{background:#fff;transform:scale(1.06);}
.gfh-arrow:focus-visible,.gfh-dot:focus-visible,.gfh .btn:focus-visible{outline:2px solid #fff;outline-offset:3px;}

.gfh-dots{position:absolute;left:0;right:0;bottom:12px;z-index:3;display:flex;justify-content:center;gap:2px;}
.gfh-dot{border:0;background:none;padding:10px 4px;min-width:30px;height:28px;display:flex;align-items:center;justify-content:center;}
.gfh-dot span{position:relative;display:block;width:22px;height:3px;border-radius:3px;background:rgba(255,255,255,.4);overflow:hidden;transition:width .4s var(--gf-ease);}
.gfh-dot.is-active span{width:40px;}
.gfh-dot.is-active span::after{content:"";position:absolute;inset:0;background:#fff;transform-origin:left center;transform:scaleX(0);animation:gfh-fill var(--gfh-delay,6s) linear forwards;}
@keyframes gfh-fill{to{transform:scaleX(1);}}
/* autoplay pauses: pointer over hero, keyboard focus inside, dragging, tab hidden, hero off-screen */
@media (hover:hover){.gfh:hover .gfh-dot.is-active span::after{animation-play-state:paused;}}
.gfh:has(:focus-visible) .gfh-dot.is-active span::after,
.gfh.is-paused .gfh-dot.is-active span::after,
.gfh.is-dragging .gfh-dot.is-active span::after{animation-play-state:paused;}
.gfh.is-static .gfh-dot.is-active span::after{animation:none;transform:scaleX(1);}


/* ---- DESKTOP slider height (>= 1025px) ----------------------------------------------------------------
   Tune here:  --gfh-h   = slider height  (smaller number = shorter slider)
               --gfh-fit = contain -> the whole banner is always visible (blurred sides fill the free space)
                           cover   -> banner fills the full width and is cropped top/bottom (best with wide 1920x600 art) */
@media (min-width:1025px){
  .gfh{--gfh-h:clamp(340px,30vw,460px);--gfh-fit:contain;}
  .gfh-viewport{aspect-ratio:auto;height:var(--gfh-h);max-height:none;}
  .gfh-media::before{content:"";position:absolute;inset:-24px;background:var(--gfh-bg) center/cover no-repeat;filter:blur(26px) brightness(.92);transform:translateZ(0);}
  .gfh-media img{position:relative;z-index:1;object-fit:var(--gfh-fit);}
  .gfh-arrow{width:42px;height:42px;margin-top:-21px;}
}
@media (min-width:1025px) and (max-height:760px){.gfh{--gfh-h:clamp(320px,28vw,400px);}}
@media (max-width:1024px){.gfh-media::before{display:none;}}   /* blurred backdrop is desktop-only: nothing extra to download on phones/tablets */

@media (max-width:768px){

  .gfh-arrow{display:none;}                 /* swipe + pagination on phones */
  .gfh-caption{align-items:flex-end;padding:0 20px 54px;
    background:linear-gradient(0deg,rgba(10,25,17,.78) 0%,rgba(10,25,17,.38) 45%,rgba(10,25,17,0) 78%);}
  .gfh-caption-in{max-width:100%;}
  .gfh-caption h2{font-size:clamp(24px,7.4vw,34px);margin-bottom:10px;}
  .gfh-caption p{-webkit-line-clamp:2;margin-bottom:18px;font-size:14px;}
  .gfh-btn{min-height:44px;padding-inline:24px;}
  .gfh-dots{bottom:8px;}
}
@media (max-width:480px){.gfh-caption{padding:0 16px 52px;}}

/* ============================================================
   2. MAIN CATEGORIES (top-level only)
   ============================================================ */
.gfc-grid{--gap:18px;--cols:var(--c-d,5);display:flex;flex-wrap:wrap;justify-content:center;gap:var(--gap);}
.gfc-card{
  position:relative;display:block;flex:0 0 calc((100% - (var(--cols) - 1) * var(--gap)) / var(--cols));max-width:340px;min-width:0;
  aspect-ratio:4/5;border-radius:18px;overflow:hidden;background:var(--gf-primary-light);isolation:isolate;
  transition:transform .35s var(--gf-ease),box-shadow .35s ease;-webkit-tap-highlight-color:transparent;
}
.gfc-img{position:absolute;inset:0;display:block;}
.gfc-img.is-empty{background:linear-gradient(145deg,var(--gf-primary-light),#cfe3d6);}
.gfc-img img{width:100%;height:100%;object-fit:cover;transition:transform .8s var(--gf-ease);}
.gfc-card::after{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
  background:linear-gradient(0deg,rgba(10,25,17,.72) 0%,rgba(10,25,17,.12) 52%,rgba(10,25,17,0) 100%);transition:opacity .35s ease;}
.gfc-label{position:absolute;left:0;right:0;bottom:0;z-index:2;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:16px 16px 16px 18px;color:#fff;}
.gfc-name{font-weight:700;font-size:clamp(14.5px,1.25vw,17px);letter-spacing:.005em;line-height:1.25;overflow-wrap:anywhere;}
.gfc-arrow{flex:0 0 auto;width:34px;height:34px;border-radius:50%;background:rgba(255,255,255,.95);color:var(--gf-dark);display:flex;align-items:center;justify-content:center;font-size:12px;
  transition:transform .35s var(--gf-ease),background .25s ease;}
.gfc-card:active{transform:scale(.985);}
.gfc-card:focus-visible{outline:3px solid var(--gf-primary);outline-offset:3px;}
@media (hover:hover){
  .gfc-card:hover{transform:translateY(-4px);box-shadow:var(--shadow-lg);}
  .gfc-card:hover .gfc-img img{transform:scale(1.07);}
  .gfc-card:hover .gfc-arrow{transform:translateX(3px);background:#fff;}
}
/* staggered soft entrance (backwards fill = no lingering transform, hover keeps working) */
.js:not(.gf-fallback) .gf-home .gf-stagger:not(.is-in) .gfc-card{opacity:0;}
.gf-home .gf-stagger.is-in .gfc-card{animation:gf-rise .65s var(--gf-ease) backwards;animation-delay:calc(var(--i,0) * 70ms);}
@media (max-width:1024px){.gfc-grid{--cols:var(--c-t,3);--gap:16px;}}
@media (max-width:640px){
  .gfc-grid{--cols:var(--c-m,2);--gap:12px;}
  .gfc-card{border-radius:14px;}
  .gfc-label{padding:12px 10px 12px 12px;}
  .gfc-arrow{width:28px;height:28px;font-size:10px;}
}

/* ============================================================
   3. PROMOTIONAL SECTIONS (admin-controlled content)
   ============================================================ */
.gfp{position:relative;display:flex;align-items:center;min-height:clamp(260px,30vw,380px);border-radius:20px;overflow:hidden;
  background:linear-gradient(120deg,var(--gf-dark),var(--gf-primary-dark));color:#fff;isolation:isolate;}
.gfp-img{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:-2;transition:transform 1.2s var(--gf-ease);}
.gfp::after{content:"";position:absolute;inset:0;z-index:-1;pointer-events:none;
  background:linear-gradient(90deg,rgba(10,25,17,.8) 0%,rgba(10,25,17,.48) 46%,rgba(10,25,17,.06) 100%);}
.gfp-content{position:relative;padding:clamp(28px,5vw,64px);max-width:580px;}
.gfp-content h2{font-size:clamp(24px,3.4vw,40px);font-weight:800;line-height:1.12;letter-spacing:-.015em;margin:0 0 12px;text-wrap:balance;overflow-wrap:anywhere;}
.gfp-content p{margin:0 0 24px;opacity:.92;font-size:clamp(14px,1.2vw,16.5px);line-height:1.6;max-width:50ch;}
.gfp-content .btn{min-height:46px;padding-inline:28px;}
.gfp-content .btn:focus-visible{outline:2px solid #fff;outline-offset:3px;}
@media (hover:hover){.gfp:hover .gfp-img{transform:scale(1.035);}}
@media (max-width:640px){
  .gf-home .section-tight{padding:8px 0 18px;}
  .gfp{align-items:flex-end;min-height:300px;border-radius:16px;}
  .gfp::after{background:linear-gradient(0deg,rgba(10,25,17,.88) 0%,rgba(10,25,17,.5) 55%,rgba(10,25,17,.08) 100%);}
  .gfp-content{padding:22px 20px 24px;max-width:100%;}
  .gfp-content p{margin-bottom:18px;}
}

/* ============================================================
   4/5. PRODUCT GRID & CARDS  (shared product_card.php markup, styled only on the homepage)
   ============================================================ */
.gf-home .product-grid{gap:26px 20px;}
.gf-home .product-card{display:flex;flex-direction:column;min-width:0;border-radius:14px;border-color:#e3ebe5;box-shadow:none;
  transition:box-shadow .3s ease,transform .3s ease,opacity .5s ease;}
@media (hover:hover){.gf-home .product-card:hover{box-shadow:0 14px 30px rgba(18,41,29,.11);transform:translateY(-3px);}}

/* reveal: cards fade/rise in small batches (home.js sets --gf-d), shown at once when already in view */
.js:not(.gf-fallback) .gf-home .product-card:not(.is-in){opacity:0;transform:translate3d(0,14px,0);}
.gf-home .product-card.is-in{transition-delay:var(--gf-d,0ms),var(--gf-d,0ms),var(--gf-d,0ms);}

/* image area: always 1:1, same-image blur backdrop for non-square images (JS adds .is-square for ~1:1 images) */
.gf-home .product-media{background:#eef2ef;}
.gf-home .pm-layer .pm-main{transition:opacity .45s ease,transform .5s var(--gf-ease);}
/* the blurred copy is a CSS background (not lazy) - only request it once the real image has loaded, so lazy loading stays honest */
.gf-home .pm-layer:not(.is-loaded)::before{background-image:none;}
.js:not(.gf-fallback) .gf-home .pm-layer:not(.img-hover):not(.is-loaded) .pm-main{opacity:0;}
@media (hover:hover){.gf-home .product-card:hover .pm-layer:not(.img-hover):not(.is-square) .pm-main{transform:scale(1.02);}}
@media (hover:none){.gf-home .pm-layer.img-hover{display:none;}.gf-home .product-card:hover{transform:none;box-shadow:none;}}   /* no hover on touch: do not download the 2nd image */

/* shimmer skeleton while the image loads (one cheap transform animation; removed on load) */
.js:not(.gf-fallback) .gf-home .product-media:not(.is-loaded)::after{
  content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background:linear-gradient(100deg,rgba(255,255,255,0) 25%,rgba(255,255,255,.7) 50%,rgba(255,255,255,0) 75%);
  transform:translate3d(-100%,0,0);animation:gf-shimmer 1.35s ease-in-out infinite;
}
@keyframes gf-shimmer{to{transform:translate3d(100%,0,0);}}

/* badges: small, wrap in a row, never reach the wishlist button, never block taps */
.gf-home .product-badges{top:8px;left:8px;right:50px;flex-direction:row;flex-wrap:wrap;align-items:flex-start;gap:4px;pointer-events:none;}
.gf-home .pbadge{font-size:10.5px;line-height:1.25;padding:3px 7px;border-radius:5px;letter-spacing:.04em;max-width:100%;white-space:nowrap;box-shadow:0 1px 2px rgba(0,0,0,.12);}
.gf-home .wishlist-btn{top:8px;right:8px;width:34px;height:34px;transition:transform .2s ease,color .2s ease;}
.gf-home .wishlist-btn:active{transform:scale(.92);}
.gf-home .quick-view-btn{border-radius:8px;letter-spacing:.04em;}

/* info block: equal-height cards, button pinned to the bottom */
.gf-home .product-info{display:flex;flex-direction:column;flex:1;padding:12px 14px 14px;}
.gf-home .product-info h3{font-size:14px;line-height:1.35;margin:0 0 6px;min-height:calc(1.35em * 2);
  display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;overflow-wrap:anywhere;}
.gf-home .price-row{flex-wrap:wrap;gap:2px 8px;margin-bottom:10px;}
.gf-home .stock-note{margin:-4px 0 10px;font-size:12px;}
.gf-home .product-info > form,.gf-home .product-info > .add-cart-mini{margin-top:auto;}
.gf-home .add-cart-mini{margin-top:0;min-height:40px;border-radius:10px;font-size:12px;letter-spacing:.04em;
  display:flex;align-items:center;justify-content:center;transition:background .2s ease,color .2s ease;}

@media (max-width:1024px){.gf-home .product-grid{gap:22px 16px;}}
@media (max-width:768px){
  .gf-home .section{padding:36px 0;}
  .gf-home .section-head{margin-bottom:18px;}
  .gf-home .product-grid{gap:16px 12px;}
}
@media (max-width:640px){
  .gf-home .product-badges{top:6px;left:6px;right:44px;gap:3px;}
  .gf-home .pbadge{font-size:9.5px;padding:2px 6px;border-radius:4px;}
  .gf-home .pbadge-featured{display:none;}          /* least important label: dropped on phones so the product stays clear */
  .gf-home .wishlist-btn{top:6px;right:6px;width:32px;height:32px;font-size:13px;}
  .gf-home .quick-view-btn{right:6px;bottom:6px;padding:5px 9px;font-size:10px;border-radius:6px;}
  .gf-home .product-info{padding:10px 10px 12px;}
  .gf-home .product-info h3{font-size:13px;}
  .gf-home .price{font-size:14px;}
  .gf-home .price-old{font-size:12px;}
  .gf-home .add-cart-mini{min-height:38px;font-size:11px;}
}

/* ============================================================
   Reviews (existing section) - spacing only
   ============================================================ */
.gf-home .review-card{height:100%;}

/* ============================================================
   Reduced motion: no autoplay, no slides/zoom/reveals, shimmer off
   ============================================================ */
@media (prefers-reduced-motion:reduce){
  .gf-home *,.gf-home *::before,.gf-home *::after{animation:none !important;transition-duration:.01ms !important;transition-delay:0s !important;scroll-behavior:auto !important;}
  .js .gf-home .gf-reveal:not(.is-in),.js .gf-home .product-card:not(.is-in){opacity:1 !important;transform:none !important;}
  .js .gf-home .gf-stagger:not(.is-in) .gfc-card{opacity:1 !important;}
  .js .gf-home .pm-layer:not(.img-hover):not(.is-loaded) .pm-main{opacity:1 !important;}
  .gfh-media img{transform:none !important;}
  .gfh-caption-in > *{opacity:1 !important;transform:none !important;}
}
