/* ==========================================================================
   Kāula Tree — Shop (fully custom, Storefront API)
   Editorial / lifestyle layout on the site's brand tokens.
   No Shopify Buy Button SDK — every element is ours to style.
   ========================================================================== */

/* ---------- Hero ---------- */
.shop-hero {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  /* Fallback look when no hero image is present — an on-brand forest wash. */
  background:
    radial-gradient(120% 100% at 20% 0%, var(--forest-light) 0%, var(--forest) 45%, var(--forest-dark) 100%);
}
.shop-hero-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}
.shop-hero::after { /* legibility scrim over any image */
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, rgba(42,59,31,0.15) 0%, rgba(42,59,31,0.35) 55%, rgba(42,59,31,0.82) 100%);
}
.shop-hero-inner {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 0 0 64px;
}
.shop-hero .breadcrumb { margin-bottom: 24px; }
.shop-hero .breadcrumb a,
.shop-hero .breadcrumb .separator,
.shop-hero .breadcrumb .current { color: rgba(248,243,236,0.85); }
.shop-hero-tag {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--olive-light);
  margin-bottom: 16px;
}
.shop-hero-title {
  font-family: var(--font-heading);
  color: var(--cream);
  font-size: clamp(3.4rem, 10vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: 0.01em;
  margin: 0 0 18px;
}
.shop-hero-desc {
  color: rgba(248,243,236,0.9);
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  font-weight: 300;
  max-width: 540px;
  line-height: 1.6;
}
.shop-hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}
.shop-hero-cta a {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 13px 26px;
  border-radius: 999px;
  transition: all 0.25s var(--ease-out);
}
.shop-hero-cta .cta-solid { background: var(--cream); color: var(--forest-dark); }
.shop-hero-cta .cta-solid:hover { background: var(--olive-light); }
.shop-hero-cta .cta-ghost { border: 1px solid rgba(248,243,236,0.6); color: var(--cream); }
.shop-hero-cta .cta-ghost:hover { background: rgba(248,243,236,0.12); }

/* ---------- Nonprofit band ---------- */
.shop-band {
  background: var(--forest-dark);
  color: var(--cream);
  text-align: center;
  padding: 15px 20px;
  font-size: 14px;
  letter-spacing: 0.03em;
  font-weight: 300;
}
.shop-band strong { font-weight: 600; }
.shop-band a { color: var(--olive-light); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Category section ---------- */
.shop-cat { padding: 78px 0 24px; }
.shop-cat:nth-child(even) { background: var(--cream-dark); }
.shop-cat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 40px;
}
.shop-cat-tag {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--olive);
  margin-bottom: 10px;
}
.shop-cat-title {
  font-family: var(--font-heading);
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1;
  color: var(--forest);
  margin: 0;
}
.shop-cat-desc {
  max-width: 380px;
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 300;
  line-height: 1.65;
  padding-bottom: 6px;
}

/* ---------- Product grid ---------- */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 30px 26px;
}
.shop-grid.is-loading { min-height: 260px; }
.shop-grid-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 60px 0;
}

/* ---------- Product card ---------- */
.pcard {
  display: flex;
  flex-direction: column;
  cursor: pointer;
  opacity: 0;
  transform: translateY(16px);
  animation: pcard-in 0.6s var(--ease-out) forwards;
}
@keyframes pcard-in { to { opacity: 1; transform: none; } }
.pcard-media {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.pcard-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 0.4s var(--ease-out), transform 0.6s var(--ease-out);
}
.pcard-media img.pcard-img-alt { opacity: 0; }
.pcard:hover .pcard-media img.pcard-img-main { opacity: 0; }
.pcard:hover .pcard-media img.pcard-img-alt { opacity: 1; }
.pcard:hover .pcard-media img { transform: scale(1.03); }
.pcard-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  background: var(--forest);
  color: var(--cream);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 5px 10px;
  border-radius: 999px;
}
.pcard-badge.sold { background: var(--brown); }
.pcard-quick {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 2;
  background: var(--forest);
  color: var(--cream);
  border: none;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.05em;
  padding: 13px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.28s var(--ease-out);
}
.pcard:hover .pcard-quick { opacity: 1; transform: none; }
.pcard-quick:hover { background: var(--forest-dark); }
.pcard-body { padding: 16px 2px 0; }
.pcard-title {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: 15px;
  color: var(--text-dark);
  line-height: 1.35;
  margin: 0 0 5px;
}
.pcard-price { font-size: 14px; color: var(--text-muted); font-weight: 400; }
.pcard-swatches { display: flex; gap: 6px; margin-top: 10px; }
.pcard-swatch {
  width: 15px; height: 15px; border-radius: 50%;
  border: 1px solid var(--border-light);
  box-shadow: inset 0 0 0 2px var(--white);
}

/* ---------- Quick view modal ---------- */
.qv-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(42,59,31,0.55);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
  opacity: 0; visibility: hidden;
  transition: opacity 0.3s var(--ease-out), visibility 0.3s;
}
.qv-overlay.open { opacity: 1; visibility: visible; }
.qv {
  background: var(--cream);
  border-radius: 12px;
  width: min(920px, 100%);
  max-height: 90vh;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr 1fr;
  transform: translateY(18px) scale(0.98);
  transition: transform 0.3s var(--ease-out);
}
.qv-overlay.open .qv { transform: none; }
.qv-media { background: var(--white); position: relative; overflow-y: auto; }
.qv-media-main { aspect-ratio: 1/1; }
.qv-media-main img { width: 100%; height: 100%; object-fit: cover; }
.qv-thumbs { display: flex; gap: 8px; padding: 12px; flex-wrap: wrap; }
.qv-thumb {
  width: 54px; height: 54px; border-radius: 5px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; opacity: 0.7;
}
.qv-thumb.active { border-color: var(--forest); opacity: 1; }
.qv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.qv-info { padding: 40px 38px; overflow-y: auto; }
.qv-close {
  position: absolute; top: 14px; right: 16px; z-index: 3;
  background: var(--cream); border: none; width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 18px; color: var(--forest);
  display: flex; align-items: center; justify-content: center;
  transition: background 0.2s;
}
.qv-close:hover { background: var(--cream-dark); }
.qv-type { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--olive); font-weight: 600; }
.qv-title { font-family: var(--font-heading); font-size: 2.4rem; line-height: 1; color: var(--forest); margin: 8px 0 10px; }
.qv-price { font-size: 20px; color: var(--text-muted); margin-bottom: 18px; }
.qv-desc { font-size: 14px; font-weight: 300; line-height: 1.7; color: var(--text-body); margin-bottom: 24px; max-height: 132px; overflow-y: auto; padding-right: 8px; }
.qv-desc::-webkit-scrollbar { width: 5px; }
.qv-desc::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
.qv-opt { margin-bottom: 18px; }
.qv-opt-label { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dark); font-weight: 600; margin-bottom: 9px; }
.qv-opt-values { display: flex; flex-wrap: wrap; gap: 8px; }
.qv-chip {
  font-family: var(--font-body); font-size: 13px; font-weight: 400;
  padding: 9px 16px; border: 1px solid var(--border-light);
  border-radius: 999px; background: var(--white); cursor: pointer;
  transition: all 0.2s var(--ease-out);
}
.qv-chip:hover { border-color: var(--forest); }
.qv-chip.selected { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.qv-chip.disabled { opacity: 0.35; cursor: not-allowed; text-decoration: line-through; }
.qv-add {
  width: 100%; margin-top: 10px;
  background: var(--forest); color: var(--cream); border: none;
  font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: 0.04em;
  padding: 16px; border-radius: 7px; cursor: pointer;
  transition: background 0.2s;
}
.qv-add:hover:not(:disabled) { background: var(--forest-dark); }
.qv-add:disabled { background: var(--brown-light); cursor: not-allowed; }

/* ---------- Cart drawer ---------- */
.cart-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 1500;
  background: var(--forest); color: var(--cream);
  width: 58px; height: 58px; border-radius: 50%; border: none;
  cursor: pointer; box-shadow: 0 8px 24px rgba(42,59,31,0.32);
  display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s var(--ease-out), background 0.2s;
}
.cart-fab:hover { background: var(--forest-dark); transform: translateY(-2px); }
.cart-fab svg { width: 22px; height: 22px; }
.cart-fab-count {
  position: absolute; top: -4px; right: -4px;
  background: var(--olive); color: var(--forest-dark);
  min-width: 22px; height: 22px; border-radius: 999px;
  font-size: 12px; font-weight: 700; line-height: 22px; text-align: center;
  padding: 0 5px; opacity: 0; transform: scale(0.5);
  transition: all 0.25s var(--ease-out);
}
.cart-fab-count.show { opacity: 1; transform: scale(1); }

.cart-overlay {
  position: fixed; inset: 0; z-index: 1900;
  background: rgba(42,59,31,0.5);
  opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s;
}
.cart-overlay.open { opacity: 1; visibility: visible; }
.cart-drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 1950;
  width: min(420px, 100%); background: var(--cream);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform 0.35s var(--ease-out);
  box-shadow: -10px 0 40px rgba(0,0,0,0.15);
}
.cart-drawer.open { transform: none; }
.cart-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 22px 24px; border-bottom: 1px solid var(--border-light);
}
.cart-head h3 { font-family: var(--font-heading); font-size: 1.7rem; color: var(--forest); margin: 0; letter-spacing: 0.02em; }
.cart-close { background: none; border: none; font-size: 22px; color: var(--text-muted); cursor: pointer; line-height: 1; }
.cart-items { flex: 1; overflow-y: auto; padding: 8px 24px; }
.cart-empty { text-align: center; color: var(--text-muted); padding: 60px 20px; font-weight: 300; }
.cart-line { display: flex; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--border-light); }
.cart-line-img { width: 66px; height: 66px; border-radius: 6px; overflow: hidden; background: var(--white); border: 1px solid var(--border-light); flex-shrink: 0; }
.cart-line-img img { width: 100%; height: 100%; object-fit: cover; }
.cart-line-info { flex: 1; min-width: 0; }
.cart-line-title { font-size: 14px; font-weight: 500; color: var(--text-dark); line-height: 1.3; }
.cart-line-variant { font-size: 12px; color: var(--text-muted); margin-top: 3px; }
.cart-line-bottom { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; }
.cart-qty { display: flex; align-items: center; border: 1px solid var(--border-light); border-radius: 999px; overflow: hidden; }
.cart-qty button { background: none; border: none; width: 28px; height: 28px; cursor: pointer; color: var(--forest); font-size: 15px; }
.cart-qty button:hover { background: var(--cream-dark); }
.cart-qty span { min-width: 26px; text-align: center; font-size: 13px; }
.cart-line-price { font-size: 14px; color: var(--text-dark); font-weight: 500; }
.cart-line-remove { background: none; border: none; color: var(--text-muted-light); font-size: 11px; letter-spacing: 0.04em; cursor: pointer; text-transform: uppercase; margin-top: 6px; }
.cart-line-remove:hover { color: var(--brown); }
.cart-foot { padding: 20px 24px 26px; border-top: 1px solid var(--border-light); }
.cart-subtotal { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 5px; }
.cart-subtotal .label { font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-muted); }
.cart-subtotal .amount { font-family: var(--font-heading); font-size: 1.8rem; color: var(--forest); }
.cart-note { font-size: 12px; color: var(--text-muted-light); font-weight: 300; margin-bottom: 16px; }
.cart-checkout {
  width: 100%; background: var(--forest); color: var(--cream); border: none;
  font-family: var(--font-body); font-weight: 600; font-size: 15px; letter-spacing: 0.05em;
  padding: 16px; border-radius: 7px; cursor: pointer; transition: background 0.2s;
}
.cart-checkout:hover:not(:disabled) { background: var(--forest-dark); }
.cart-checkout:disabled { background: var(--brown-light); cursor: wait; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .shop-grid { grid-template-columns: repeat(3, 1fr); }
  .qv { grid-template-columns: 1fr; max-height: 92vh; overflow-y: auto; }
  .qv-media-main { aspect-ratio: 4/3; }
}
@media (max-width: 640px) {
  .shop-grid { grid-template-columns: repeat(2, 1fr); gap: 22px 16px; }
  .shop-cat-head { flex-direction: column; align-items: flex-start; gap: 14px; }
  .shop-cat { padding: 54px 0 20px; }
  .pcard-quick { opacity: 1; transform: none; } /* touch: always show */
}
