/* ============================================================
   GREEN FOREVER — Loading states (customer site)
   Skeletons, button loaders, image loading, localized busy states.
   CSS only; no libraries. One shimmer, one spinner, reused everywhere.
   Enhancements are tied to html.gf-ld, which assets/js/loading.js adds itself,
   so if the script fails nothing is left hidden.
   ============================================================ */
:root{
  --gf-sk-base:#eaf0ec;            /* soft brand-compatible neutral */
  --gf-sk-hi:rgba(255,255,255,.62);
}

/* ---------- shared shimmer (background-position only: cheap, subtle, slow) ---------- */
@keyframes gf-sk-shift{from{background-position:140% 0;}to{background-position:-40% 0;}}
@keyframes gf-spin{to{transform:rotate(360deg);}}
@keyframes gf-bar{0%{transform:translateX(-100%);}100%{transform:translateX(250%);}}

.gf-sk,.gf-imgld{
  background-color:var(--gf-sk-base);
  background-image:linear-gradient(100deg,rgba(255,255,255,0) 30%,var(--gf-sk-hi) 50%,rgba(255,255,255,0) 70%);
  background-size:220% 100%;background-repeat:no-repeat;
  animation:gf-sk-shift 1.7s ease-in-out infinite;
}
.gf-sk{display:block;border-radius:6px;}
.gf-imgld{color:transparent !important;}          /* hides broken-image alt text while loading */

/* ---------- spinner (inherits the button's text colour) ---------- */
.gf-spin{display:inline-block;flex:0 0 auto;width:1em;height:1em;min-width:14px;min-height:14px;border-radius:50%;
  border:2px solid currentColor;border-right-color:transparent;opacity:.85;animation:gf-spin .7s linear infinite;vertical-align:-.15em;}

/* ---------- button loader (helper: GFLoading.btn) ---------- */
[data-gf-ld="1"]{cursor:progress;pointer-events:none;}
[data-gf-ld="1"]:disabled{opacity:.85;cursor:progress;}
[data-gf-ld] .gf-btn-t{white-space:nowrap;}
[data-gf-ld="1"],[data-gf-ld="done"]{gap:8px;}
[data-gf-ld="done"]{pointer-events:none;}
.add-cart-mini[data-gf-ld]{display:flex;align-items:center;justify-content:center;gap:7px;}
.gf-ok{display:inline-block;font-size:.95em;line-height:1;}

/* icon-only loaders (wishlist heart): the icon is hidden, a spinner takes its place; the button keeps its size */
.wishlist-btn.is-loading{pointer-events:none;cursor:progress;}
.wishlist-btn.is-loading i{opacity:0;}
.wishlist-btn.is-loading::after{content:"";position:absolute;left:50%;top:50%;width:15px;height:15px;margin:-7.5px 0 0 -7.5px;border-radius:50%;
  border:2px solid var(--gf-primary);border-right-color:transparent;animation:gf-spin .7s linear infinite;}
/* cards: the heart is already position:absolute (style.css), which anchors the spinner. On the product page / Quick View it is
   position:static, so it only becomes relative while loading (no visual shift for a flex item). */
.pd-actions .wishlist-btn.is-loading{position:relative;}

/* ---------- product image loading (cards outside the homepage; the homepage keeps its own identical rules in home.css) ---------- */
.gf-ld .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-x 1.5s ease-in-out infinite;
}
@keyframes gf-shimmer-x{to{transform:translate3d(100%,0,0);}}
.gf-ld .pm-layer:not(.img-hover):not(.is-loaded)::before{background-image:none;}      /* the blurred backdrop is only requested once the real image is in */
.gf-ld .pm-layer:not(.img-hover):not(.is-loaded) .pm-main{opacity:0;}
.gf-ld .pm-layer .pm-main{transition:opacity .22s ease,transform .4s ease;}            /* short reveal */

/* gallery main image: the reserved 4:5 box shimmers while a new picture is fetched; the previous picture stays underneath */
.gallery-main.gf-imgwait::after{content:"";position:absolute;inset:0;z-index:1;pointer-events:none;
  background:linear-gradient(100deg,rgba(240,243,241,.35) 25%,rgba(255,255,255,.7) 50%,rgba(240,243,241,.35) 75%);
  transform:translate3d(-100%,0,0);animation:gf-shimmer-x 1.4s ease-in-out infinite;}
.gallery-main.gf-imgwait img{opacity:.55;}
.gallery-main img{transition:opacity .2s ease;}

/* ---------- product card skeleton (mirrors .product-card: 1:1 media, name, price, action) ---------- */
.gf-sk-card{background:#fff;border:1px solid var(--gf-border);border-radius:var(--radius);overflow:hidden;min-width:0;}
.gf-home .gf-sk-card{border-radius:14px;border-color:#e3ebe5;}
.gf-sk-card .gf-sk-media{aspect-ratio:1/1;width:100%;border-radius:0;}
.gf-sk-card .gf-sk-info{padding:14px 14px 16px;}
.gf-sk-card .gf-sk-name{height:16px;width:82%;margin:2px 0 10px;}      /* = name line (14.5px/1.35) + its 8px gap */
.gf-sk-card .gf-sk-price{height:20px;width:38%;margin:2px 0;}           /* = price row (15.5px/1.55) */
.gf-sk-card .gf-sk-btn{height:37px;width:100%;margin-top:10px;border-radius:6px;}   /* = Add to Cart button */
/* same grid as the real list */
.gf-sk-grid{pointer-events:none;}

/* shop: while a filter / sort / page request runs, the old grid is swapped for skeletons and the controls ignore taps */
.gf-grid-hidden{display:none !important;}
body.gf-shop-busy .filter-panel,
body.gf-shop-busy .filter-drawer-body,
body.gf-shop-busy .shop-toolbar form,
body.gf-shop-busy .pagination{pointer-events:none;opacity:.6;}
body.gf-shop-busy .shop-toolbar .result-count{opacity:.6;}

/* ---------- Quick View skeleton (same 2-column layout as .quick-view-grid) ---------- */
.gf-qv-sk{display:grid;grid-template-columns:1fr 1fr;gap:26px;}
.gf-qv-sk > *{min-width:0;}
.gf-qv-sk .gf-sk-img{aspect-ratio:3/4;width:100%;border-radius:8px;}
.gf-qv-sk .gf-sk-title{height:26px;width:75%;margin:0 0 12px;}
.gf-qv-sk .gf-sk-pricebar{height:22px;width:34%;margin:0 0 16px;}
.gf-qv-sk .gf-sk-label{height:12px;width:22%;margin:18px 0 10px;}
.gf-qv-sk .gf-sk-pills{display:flex;gap:8px;flex-wrap:wrap;}
.gf-qv-sk .gf-sk-pill{height:32px;width:46px;border-radius:6px;}
.gf-qv-sk .gf-sk-qty{height:40px;width:120px;margin-top:18px;border-radius:6px;}
.gf-qv-sk .gf-sk-actions{display:flex;gap:10px;margin-top:20px;}
.gf-qv-sk .gf-sk-add{height:46px;flex:1;border-radius:6px;}
.gf-qv-sk .gf-sk-heart{height:46px;width:46px;border-radius:6px;}
.gf-qv-sk .gf-sk-link{height:14px;width:38%;margin-top:18px;}
@media (max-width:768px){.gf-qv-sk{grid-template-columns:1fr;gap:18px;}}

/* ---------- error + empty states (Quick View / dynamic blocks) ---------- */
.gf-state{text-align:center;padding:44px 18px;color:var(--gf-text-light);}
.gf-state i{display:block;font-size:34px;color:var(--gf-border);margin-bottom:12px;}
.gf-state p{margin:0 0 14px;color:var(--gf-text);font-weight:600;}
.gf-state .btn{min-width:120px;}

/* ---------- cart: localized busy states ---------- */
.cart-item.gf-row-busy{opacity:.6;pointer-events:none;transition:opacity .15s ease;}
.cart-item.gf-row-busy .qty-selector,.cart-item.gf-row-busy .cart-item-remove{cursor:progress;}
.gf-qty-busy input{color:transparent !important;}
.gf-qty-busy{position:relative;}
.gf-qty-busy::after{content:"";position:absolute;left:50%;top:50%;width:14px;height:14px;margin:-7px 0 0 -7px;border-radius:50%;
  border:2px solid var(--gf-primary);border-right-color:transparent;animation:gf-spin .7s linear infinite;}
.cart-summary.gf-sum-busy{position:relative;overflow:hidden;}
.cart-summary.gf-sum-busy .summary-row,.cart-summary.gf-sum-busy .btn{opacity:.55;}
.cart-summary.gf-sum-busy::before{content:"";position:absolute;top:0;left:0;height:3px;width:40%;background:var(--gf-primary);animation:gf-bar 1.1s ease-in-out infinite;}

/* ---------- checkout ---------- */
.co-proc{display:none;margin:12px 0 0;padding:10px 12px;border-radius:8px;background:var(--gf-primary-light);color:var(--gf-primary-dark);font-size:13.5px;line-height:1.45;}
.co-proc.is-on{display:flex;gap:10px;align-items:flex-start;}
.co-proc .gf-spin{margin-top:3px;}
.co-proc strong{display:block;font-weight:700;}
.co-summary.is-calc .co-rows,.co-summary.is-calc #stickyTotal{opacity:.5;transition:opacity .15s ease;}   /* stale numbers are dimmed, never shown as final */
.co-summary.is-calc{position:relative;overflow:hidden;}
.co-summary.is-calc::before{content:"";position:absolute;top:0;left:0;height:3px;width:40%;background:var(--gf-primary);animation:gf-bar 1.1s ease-in-out infinite;}
.co-item.gf-row-busy{opacity:.55;pointer-events:none;}
.co-sticky strong.is-calc{opacity:.5;}

/* ---------- mobile ---------- */
@media (max-width:480px){
  .gf-sk-card .gf-sk-info{padding:10px 10px 12px;}
  .gf-sk-card .gf-sk-name{height:14px;margin:2px 0 9px;}
  .gf-sk-card .gf-sk-price{height:18px;}
  .gf-state{padding:34px 12px;}
}
/* keep the sticky checkout bar clear of everything we add */
.co-proc{scroll-margin-bottom:96px;}

/* ---------- reduced motion: no shimmer movement, no sliding bars; spinners stay (slower) so loading is still visible ---------- */
@media (prefers-reduced-motion:reduce){
  .gf-sk,.gf-imgld{animation:none !important;background-image:none;}
  .gf-ld .product-media:not(.is-loaded)::after,.gallery-main.gf-imgwait::after{animation:none !important;transform:none;background:rgba(255,255,255,.35);}
  .cart-summary.gf-sum-busy::before,.co-summary.is-calc::before{animation:none !important;width:100%;opacity:.5;}
  .gf-spin,.wishlist-btn.is-loading::after,.gf-qty-busy::after{animation-duration:1.8s !important;}
  .gf-ld .pm-layer .pm-main,.gallery-main img{transition:none !important;}
}

/* ---------- small extras ---------- */
.gf-vh{position:absolute !important;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0;}
.gf-sk-grid{scroll-margin-top:calc(var(--header-h,72px) + 70px);}
.gf-searching .gf-msearch-field,.gf-searching input[type="text"]{opacity:.65;transition:opacity .15s ease;}
.gf-searching{cursor:progress;}

/* checkout "Processing your order…" message: in the summary on desktop, floating just above the sticky bar on phones/tablets */
.co-proc .co-proc-sub{display:block;font-weight:500;opacity:.9;}
.co-sticky .co-proc{display:none;}
@media (max-width:900px){
  .co-summary .co-proc{display:none !important;}
  .co-sticky .co-proc.is-on{display:flex;position:absolute;left:0;right:0;bottom:100%;margin:0;border-radius:12px 12px 0 0;box-shadow:0 -4px 14px rgba(18,41,29,.08);padding:9px 16px;font-size:12.5px;}
}
.co-coupon-row .btn[data-gf-ld]{min-width:64px;}
