/**
 * Serendipity Lavender — Shop
 * Aesthetic: Botanical Atelier · Curator's Index
 * v6.0.0
 */

/* ──────────────────────────────────────────
   Design tokens (shop-scoped)
────────────────────────────────────────── */
.sl-shop-layout,
.sl-shop-logo-wrap {
  --sh-cream:      #F4EDE0;
  --sh-ink:        #1A0E2E;
  --sh-lav:        #4A2C7A;
  --sh-lav-mid:    #7153A6;
  --sh-lav-light:  #A882C8;
  --sh-lav-pale:   #EFE8F7;
  --sh-sage:       #7A8C6E;
  --sh-muted:      #7B6490;
  --sh-border:     rgba(74, 44, 122, 0.13);
  --sh-border-act: #4A2C7A;
}

/* ──────────────────────────────────────────
   Logo
────────────────────────────────────────── */
.sl-shop-logo-wrap {
  text-align: center;
  margin: 0 auto 0.25rem;
}
.sl-shop-logo {
  width: 120px !important;
  max-width: 120px !important;
  height: auto !important;
  display: inline-block;
}
.sl-shop-logo-wrap + .wp-block-query-title { display: none !important; }

/* ──────────────────────────────────────────
   Layout
────────────────────────────────────────── */
.sl-shop-layout {
  display: flex;
  gap: 3.5rem;
  max-width: var(--wp--style--global--wide-size, 1200px);
  margin: 0 auto;
  padding: 1.5rem 0 4rem;
  align-items: flex-start;
}

/* ──────────────────────────────────────────
   Sidebar
────────────────────────────────────────── */
.sl-shop-sidebar {
  width: 180px;
  flex-shrink: 0;
  position: sticky;
  top: 72px;
}

.sl-sidebar-title {
  font-family: 'Crimson Pro', 'Cormorant Garamond', Georgia, serif;
  font-size: 0.92rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #4A2C7A;
  padding: 0 0 0.9rem;
  margin: 0 0 0.2rem;
  border-bottom: 1px solid var(--sh-border);
}

/* ──────────────────────────────────────────
   Category nav — Curator's Index style
────────────────────────────────────────── */
.sl-shop-categories {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  margin: 0;
}

.sl-cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.52rem 0.6rem 0.52rem 0.9rem;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--sh-muted);
  font-family: 'Cormorant Garamond', 'URW Chancery L', Georgia, serif;
  font-size: 1.05rem;
  font-style: italic;
  font-weight: 400;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: color 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  white-space: nowrap;
  line-height: 1.45;
  text-align: left;
  width: 100%;
  position: relative;
  overflow: hidden;
}

/* Wipe fill — slides in from left on hover */
.sl-cat-btn::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(74,44,122,0.08) 0%, rgba(74,44,122,0.03) 100%);
  transform: translateX(-102%);
  transition: transform 0.28s cubic-bezier(0.22, 0.84, 0.44, 1);
  pointer-events: none;
}

.sl-cat-btn:hover::before { transform: translateX(0); }

.sl-cat-btn:hover {
  color: var(--sh-ink);
  border-left-color: var(--sh-lav);
  background: transparent;
}

/* Label nudges right on hover */
.sl-cat-btn:hover .sl-cat-label {
  transform: translateX(3px);
}
.sl-cat-label {
  transition: transform 0.22s cubic-bezier(0.22, 0.84, 0.44, 1);
}

.sl-cat-btn:active { transform: none; }

.sl-cat-btn.active {
  color: var(--sh-ink);
  border-left-color: var(--sh-lav);
  font-weight: 600;
  background: rgba(74, 44, 122, 0.06);
}

.sl-cat-btn.active::before { transform: translateX(0); }

.sl-cat-btn.active:hover {
  color: var(--sh-lav);
  background: transparent;
}

.sl-cat-label {
  pointer-events: none;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.sl-cat-count {
  display: inline-flex;
  align-items: center;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.82rem;
  font-style: normal;
  font-weight: 400;
  color: var(--sh-lav-light);
  pointer-events: none;
  min-width: 1.4rem;
  text-align: right;
  line-height: 1;
}

.sl-cat-btn.active .sl-cat-count { color: var(--sh-lav-mid); }

/* ──────────────────────────────────────────
   Products area
────────────────────────────────────────── */
.sl-shop-products {
  flex: 1;
  min-width: 0;
}

/* ──────────────────────────────────────────
   Category banner — editorial, typographic
────────────────────────────────────────── */
.sl-category-banner {
  padding: 0.25rem 0 2rem;
  margin: 0 0 2rem;
  position: relative;
  overflow: visible;
  animation: sl-banner-in 0.45s cubic-bezier(0.22, 0.84, 0.44, 1) both;
  border-bottom: 1px solid var(--sh-border);
  background: transparent;
  border-radius: 0;
}

/* Remove old decorative pseudo-elements */
.sl-category-banner::before,
.sl-category-banner::after { display: none; }

.sl-category-banner h2 {
  font-family: 'Cormorant Garamond', 'URW Chancery L', Georgia, serif;
  font-size: clamp(2.5rem, 4.8vw, 4.8rem);
  font-weight: 300;
  font-style: italic;
  color: var(--sh-ink);
  margin: 0;
  letter-spacing: 0.01em;
  line-height: 0.95;
  position: relative;
  z-index: 1;
}

.sl-banner-desc {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  font-style: normal;
  font-weight: 400;
  color: var(--sh-muted);
  line-height: 1.65;
  margin: 0.85rem 0 0;
  max-width: 52ch;
  position: relative;
  z-index: 1;
}

@keyframes sl-banner-in {
  from { opacity: 0; transform: translateY(-10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────
   Toolbar
────────────────────────────────────────── */
.sl-shop-toolbar {
  display: flex !important;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--sh-border);
}

/* ──────────────────────────────────────────
   Loading state
────────────────────────────────────────── */
.sl-loading {
  position: relative;
  min-height: 200px;
}

.sl-loading .wc-block-product-template,
.sl-loading > *:not(.wc-block-components-notices) {
  opacity: 0.2;
  pointer-events: none;
  transition: opacity 0.25s;
}

.sl-loading::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 28px; height: 28px;
  margin: -14px 0 0 -14px;
  border: 1.5px solid rgba(74, 44, 122, 0.12);
  border-top-color: var(--sh-lav);
  border-radius: 50%;
  animation: sl-spin 0.75s linear infinite;
  z-index: 10;
}

@keyframes sl-spin { to { transform: rotate(360deg); } }

/* Hide WC Pagination */
.wp-block-query-pagination { display: none !important; }

/* ──────────────────────────────────────────
   Search bar — bottom-border only
────────────────────────────────────────── */
.sl-shop-search {
  flex: 1;
  max-width: 300px;
  min-width: 160px;
}

.sl-search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.sl-search-icon {
  position: absolute;
  left: 0;
  color: var(--sh-lav-light);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.sl-search-input {
  width: 100%;
  padding: 0.4rem 2rem 0.4rem 1.6rem;
  border: none;
  border-bottom: 1.5px solid rgba(74, 44, 122, 0.2);
  border-radius: 0;
  background: transparent;
  color: var(--sh-ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-style: italic;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.sl-search-input::placeholder {
  color: var(--sh-lav-light);
  font-style: italic;
  opacity: 0.7;
}

.sl-search-input:focus {
  border-bottom-color: var(--sh-lav);
  box-shadow: none;
}

.sl-search-clear {
  position: absolute;
  right: 0;
  width: 22px; height: 22px;
  border: none;
  background: transparent;
  color: var(--sh-lav-light);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s;
  padding: 0;
  line-height: 1;
}

.sl-search-clear:hover { color: var(--sh-lav); }

/* ──────────────────────────────────────────
   Product cards — Botanical Atelier
────────────────────────────────────────── */
.sl-shop-products .wc-block-product {
  background: #ffffff;
  border-radius: 2px;
  overflow: hidden;
  transition: transform 0.32s cubic-bezier(0.22, 0.84, 0.44, 1),
              box-shadow 0.32s cubic-bezier(0.22, 0.84, 0.44, 1);
  box-shadow: 0 1px 5px rgba(26, 14, 46, 0.055);
}

.sl-shop-products .wc-block-product:hover {
  transform: translateY(-5px);
  box-shadow: 0 14px 36px rgba(26, 14, 46, 0.13);
}

.sl-shop-products .wc-block-components-product-image {
  background: #ffffff;
  overflow: hidden;
}

.sl-shop-products .wc-block-components-product-image img,
.sl-shop-products .wc-block-components-product-image a img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.42s cubic-bezier(0.22, 0.84, 0.44, 1);
}

.sl-shop-products .wc-block-product:hover .wc-block-components-product-image img,
.sl-shop-products .wc-block-product:hover .wc-block-components-product-image a img {
  transform: scale(1.06);
}

/* Product title */
.sl-shop-products .wc-block-components-product-title,
.sl-shop-products .wc-block-components-product-title a {
  font-family: 'Cormorant Garamond', 'URW Chancery L', Georgia, serif !important;
  font-size: 1.2rem !important;
  font-weight: 400 !important;
  font-style: italic !important;
  color: var(--sh-ink) !important;
  line-height: 1.22 !important;
  letter-spacing: 0.01em;
  text-decoration: none !important;
}

/* Product price */
.sl-shop-products .wc-block-components-product-price,
.sl-shop-products .wc-block-components-product-price .woocommerce-Price-amount {
  font-family: 'Crimson Pro', Georgia, serif !important;
  font-size: 0.92rem !important;
  color: var(--sh-lav-mid) !important;
  font-weight: 400 !important;
  font-style: normal !important;
}

/* Add to cart button — minimal outline */
.sl-shop-products .wp-block-button__link,
.sl-shop-products .wc-block-components-product-button .wc-block-components-product-button__button,
.sl-shop-products .add_to_cart_button {
  font-family: 'Crimson Pro', Georgia, serif !important;
  font-size: 0.68rem !important;
  letter-spacing: 0.2em !important;
  text-transform: uppercase !important;
  font-style: normal !important;
  font-weight: 500 !important;
  padding: 0.55rem 1.2rem !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: var(--sh-lav) !important;
  border: 1px solid rgba(74, 44, 122, 0.32) !important;
  transition: background 0.22s, color 0.22s, border-color 0.22s !important;
  width: 100% !important;
  text-align: center !important;
  display: block !important;
  box-shadow: none !important;
}

.sl-shop-products .wp-block-button__link:hover,
.sl-shop-products .wc-block-components-product-button .wc-block-components-product-button__button:hover,
.sl-shop-products .add_to_cart_button:hover {
  background: var(--sh-lav) !important;
  color: #ffffff !important;
  border-color: var(--sh-lav) !important;
}

/* ──────────────────────────────────────────
   Infinite scroll loader
────────────────────────────────────────── */
.sl-infinite-loader {
  text-align: center;
  padding: 2.5rem 0;
}

.sl-loader-dots {
  display: inline-flex;
  gap: 7px;
  align-items: center;
}

.sl-loader-dots span {
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--sh-lav-light);
  animation: sl-dot-pulse 1.4s ease-in-out infinite;
}

.sl-loader-dots span:nth-child(2) { animation-delay: 0.2s; }
.sl-loader-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes sl-dot-pulse {
  0%, 80%, 100% { opacity: 0.15; transform: scale(0.7); }
  40%           { opacity: 1;    transform: scale(1);   }
}

.sl-scroll-sentinel { height: 1px; }

/* ──────────────────────────────────────────
   Fade-in for new items
────────────────────────────────────────── */
.sl-fade-in {
  animation: sl-item-in 0.45s cubic-bezier(0.22, 0.84, 0.44, 1);
}

@keyframes sl-item-in {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ──────────────────────────────────────────
   Search result cards
────────────────────────────────────────── */
.sl-search-result { list-style: none; }

.sl-search-card {
  display: flex;
  gap: 1.2rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--sh-border);
  text-decoration: none;
  color: inherit;
  transition: opacity 0.18s;
}

.sl-search-card:last-child { border-bottom: none; }
.sl-search-card:hover { opacity: 0.68; }

.sl-search-card-img {
  flex-shrink: 0;
  width: 68px; height: 68px;
  overflow: hidden;
  background: #f8f5fc;
}

.sl-search-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
}

.sl-search-card-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.2rem;
}

.sl-search-card-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.15rem;
  font-style: italic;
  margin: 0;
  color: var(--sh-ink);
  line-height: 1.25;
}

.sl-search-card-price {
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 0.95rem;
  color: var(--sh-lav-mid);
}

.sl-search-empty {
  list-style: none;
  text-align: center;
  padding: 4rem 1rem;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.6rem;
  font-style: italic;
  color: var(--sh-lav-light);
}

/* ──────────────────────────────────────────
   Mobile toggle button
────────────────────────────────────────── */
.sl-sidebar-toggle {
  display: none !important;
  margin: 0 !important;
  width: 100%;
  padding: 0.7rem 1rem;
  border: none;
  border-bottom: 1px solid var(--sh-border);
  border-radius: 0;
  background: var(--sh-cream);
  color: var(--sh-ink);
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.1rem;
  font-style: italic;
  cursor: pointer;
  text-align: left;
  justify-content: space-between;
  align-items: center;
}

.sl-sidebar-toggle svg {
  width: 16px; height: 16px;
  stroke: var(--sh-lav-mid);
  stroke-width: 2;
  fill: none;
  transition: transform 0.22s ease;
}

.sl-sidebar-toggle.open svg { transform: rotate(180deg); }

/* ──────────────────────────────────────────
   Responsive — tablet / mobile
────────────────────────────────────────── */
@media (max-width: 768px) {
  .sl-shop-layout {
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin-block-start: 0 !important;
  }

  .sl-shop-sidebar {
    width: 100%;
    position: static;
    background: transparent;
    padding: 0;
    margin: 0;
    max-height: none;
    overflow: visible;
    border: none;
    z-index: auto;
  }

  .sl-sidebar-title    { display: none; }
  .sl-sidebar-toggle   { display: none !important; }

  .sl-shop-categories {
    position: relative;
    width: 100%;
    margin: 0 !important;
    padding-top: 0 !important;
    box-sizing: border-box;
    background-color: #FAF5EE;
    z-index: 999;
  }

  .sl-shop-categories.is-fixed {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    box-shadow: 0 2px 10px rgba(26, 14, 46, 0.1);
  }

  .sl-categories-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 14px 20px;
    background-color: #FAF5EE;
    border: none;
    border-bottom: 1px solid var(--sh-border, rgba(74,44,122,0.13));
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 1.1rem;
    font-style: italic;
    font-weight: 400;
    cursor: pointer;
    box-sizing: border-box;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    color: var(--sh-ink, #1A0E2E);
  }

  .sl-categories-toggle svg {
    transition: transform 0.25s ease;
    flex-shrink: 0;
    stroke: #7153A6;
  }

  .sl-categories-toggle.open svg { transform: rotate(180deg); }

  .sl-categories-inner {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: #FAF5EE;
    box-shadow: 0 8px 20px rgba(26, 14, 46, 0.12);
    z-index: 998;
    flex-direction: column;
    max-height: 70vh;
    overflow-y: auto;
  }

  .sl-shop-categories.is-open .sl-categories-inner { display: flex !important; }

  .sl-categories-inner .sl-cat-btn {
    font-size: 1rem;
    padding: 0.65rem 1.5rem 0.65rem 1.65rem;
    border-radius: 0;
    text-align: left;
    justify-content: flex-start;
    border-bottom: 1px solid rgba(74, 44, 122, 0.08);
    border-left: 2px solid transparent;
  }

  .sl-categories-inner .sl-cat-btn:last-child { border-bottom: none; }
  .sl-categories-inner .sl-cat-btn.active { border-left-color: #4A2C7A; }

  .sl-category-banner { padding: 0.5rem 0 1.5rem; margin-bottom: 1.5rem; }
  .sl-category-banner h2 { font-size: clamp(1.8rem, 8vw, 2.8rem); }

  .sl-shop-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .sl-shop-search {
    max-width: 100%;
    order: -1;
  }

  /* Product grid: 2 columns */
  .sl-shop-products .wc-block-product-template__responsive {
    grid-template-columns: repeat(2, 1fr) !important;
  }
  .sl-shop-products .wc-block-product-template.is-flex-container > li {
    width: calc(50% - 0.625em) !important;
  }
  .sl-shop-products .wc-block-components-product-image img,
  .sl-shop-products .wc-block-components-product-image a img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: cover;
  }
}

@media (max-width: 480px) {
  .sl-cat-btn        { font-size: 0.98rem; }
  .sl-cat-count      { font-size: 0.65rem; }
  .sl-search-input   { font-size: 1rem; }
  .sl-category-banner h2 { font-size: clamp(1.6rem, 10vw, 2.4rem); }
}
