/**
 * Appily Forty — Orchard Catalog shop
 * Layout: hero + category pills + filters sidebar + product grid
 */

.page-shop.a40-shop-forty {
  background: var(--a40-warm);
}
.page-shop.a40-shop-forty .page-main { padding-top: 0; }

.a40-shop { padding-bottom: 3.5rem; }

/* Reveal */
.a40-shop-reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.55s cubic-bezier(0.22, 1, 0.36, 1), transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.a40-shop-reveal.is-visible { opacity: 1; transform: none; }

/* Hero */
.a40-shop-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(1.75rem, 4vw, 2.75rem) 0 clamp(1.25rem, 3vw, 1.75rem);
  background: var(--a40-hero-gradient);
}
.a40-shop-hero-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.a40-shop-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(55px);
  opacity: 0.45;
  animation: a40-shop-blob 15s ease-in-out infinite;
}
.a40-shop-blob--1 { width: 320px; height: 320px; top: -15%; right: 6%; background: rgba(224, 122, 47, 0.22); }
.a40-shop-blob--2 { width: 260px; height: 260px; bottom: -20%; left: -5%; background: rgba(64, 145, 108, 0.18); animation-delay: -5s; }
.a40-shop-ring {
  position: absolute;
  right: 10%;
  top: 50%;
  width: min(220px, 30vw);
  aspect-ratio: 1;
  border: 2px dashed rgba(45, 106, 79, 0.14);
  border-radius: 50%;
  transform: translateY(-50%);
  animation: a40-shop-spin 22s linear infinite;
}
@keyframes a40-shop-blob {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(-10px, 8px); }
}
@keyframes a40-shop-spin { to { transform: translateY(-50%) rotate(360deg); } }

.a40-shop-hero-inner {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(260px, 340px);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: end;
}

.a40-shop-eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--a40-orange);
}

.a40-shop-hero-title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 4vw, 2.65rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.08;
  color: var(--a40-ink);
}

.a40-shop-hero-lede,
.a40-shop-hero-search {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--a40-muted);
  line-height: 1.55;
  max-width: 42ch;
}

.a40-shop-hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.a40-shop-hero-stats li {
  display: flex;
  flex-direction: column;
  padding: 0.45rem 0.85rem;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(45, 106, 79, 0.12);
  border-radius: 10px;
  min-width: 68px;
}
.a40-shop-hero-stats strong {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--a40-green-dark);
}
.a40-shop-hero-stats span {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--a40-muted);
}

.a40-shop-hero-search-form {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.55rem 0.55rem 1rem;
  background: var(--a40-surface);
  border: 2px solid var(--a40-border);
  border-radius: 14px;
  box-shadow: 0 10px 32px rgba(33, 37, 41, 0.08);
  transition: border-color 0.25s, box-shadow 0.25s;
}
.a40-shop-hero-search-form:focus-within {
  border-color: var(--a40-mint);
  box-shadow: 0 14px 40px rgba(64, 145, 108, 0.14);
}
.a40-shop-hero-search-form svg { color: var(--a40-orange); flex-shrink: 0; }
.a40-shop-hero-search-form input {
  flex: 1;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  outline: none;
  min-width: 0;
}
.a40-shop-hero-search-form button {
  border: 0;
  padding: 0.5rem 1rem;
  background: var(--a40-ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.2s;
}
.a40-shop-hero-search-form button:hover { background: var(--a40-green-dark); }

/* Category pills */
.a40-shop-cats {
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(255, 252, 247, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--a40-border);
  padding: 0.65rem 0;
  margin-bottom: 1.5rem;
}
.a40-shop-cats-inner {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 0.15rem;
}
.a40-shop-cats-inner::-webkit-scrollbar { display: none; }

.a40-shop-cat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
  padding: 0.45rem 0.95rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--a40-ink);
  text-decoration: none !important;
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.a40-shop-cat-pill:hover {
  border-color: var(--a40-orange);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(224, 122, 47, 0.12);
}
.a40-shop-cat-pill.is-active {
  background: var(--a40-orange);
  border-color: transparent;
  color: #fff;
}
.a40-shop-cat-count {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.08);
}
.a40-shop-cat-pill.is-active .a40-shop-cat-count { background: rgba(255, 255, 255, 0.25); }

/* Layout */
.a40-shop-layout {
  display: grid;
  grid-template-columns: minmax(240px, 268px) minmax(0, 1fr);
  gap: clamp(1rem, 2.5vw, 1.75rem);
  align-items: start;
}

/* Filters */
.a40-shop-filters {
  position: sticky;
  top: 4rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 16px;
  padding: 1.15rem 1rem 1rem;
  box-shadow: 0 8px 28px rgba(33, 37, 41, 0.05);
}

.a40-filters-head {
  margin-bottom: 0.85rem;
  padding-bottom: 0.85rem;
  border-bottom: 1px solid var(--a40-border);
}
.a40-filters-title {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 800;
  color: var(--a40-ink);
}
.a40-filters-sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--a40-muted);
}

.a40-filter-block { border-bottom: 1px solid var(--a40-border); }
.a40-filter-block:last-of-type { border-bottom: 0; }

.a40-filter-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--a40-ink);
  cursor: pointer;
  text-align: left;
  transition: color 0.2s;
}
.a40-filter-head:hover { color: var(--a40-orange); }

.a40-filter-toggle {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--a40-cream);
  display: grid;
  place-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--a40-muted);
  transition: background 0.2s, color 0.2s;
}
.a40-filter-block.is-open .a40-filter-toggle {
  background: var(--a40-orange);
  color: #fff;
}
.a40-filter-block.is-open .a40-filter-toggle::before { content: '−'; }
.a40-filter-block:not(.is-open) .a40-filter-toggle::before { content: '+'; }

.a40-filter-panel {
  padding: 0 0 0.85rem;
  display: grid;
  gap: 0.35rem;
}
.a40-filter-panel[hidden] { display: none; }

.a40-filter-check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--a40-muted);
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  margin: 0 -0.5rem;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.a40-filter-check:hover { background: rgba(224, 122, 47, 0.06); }
.a40-filter-check input { margin-top: 0.15rem; accent-color: var(--a40-orange); }
.a40-filter-check:has(input:checked) { color: var(--a40-ink); font-weight: 600; }

.a40-price-note { margin: 0 0 0.5rem; font-size: 0.74rem; color: var(--a40-muted); }
.a40-price-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.45rem; margin-bottom: 0.55rem; }
.a40-price-field { position: relative; }
.a40-price-field span {
  position: absolute;
  left: 0.55rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.78rem;
  color: var(--a40-muted);
  pointer-events: none;
}
.a40-price-field input {
  width: 100%;
  padding: 0.48rem 0.5rem 0.48rem 1.3rem;
  border: 1px solid var(--a40-border);
  border-radius: 8px;
  background: var(--a40-cream);
  font: inherit;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
}
.a40-price-field input:focus { border-color: var(--a40-mint); }

.a40-price-apply {
  width: 100%;
  padding: 0.55rem;
  border: 0;
  border-radius: 999px;
  background: var(--a40-ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.a40-price-apply:hover { background: var(--a40-green-dark); transform: translateY(-1px); }

.a40-clear-filters {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--a40-orange);
  text-decoration: none !important;
}
.a40-clear-filters:hover { text-decoration: underline !important; }

.a40-filter-mobile-toggle {
  display: none;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 12px;
  background: var(--a40-ink);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

/* Toolbar */
.a40-shop-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1.15rem;
  padding: 0.75rem 1rem;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 14px;
  box-shadow: 0 4px 16px rgba(33, 37, 41, 0.04);
}

.a40-shop-count {
  margin: 0;
  flex: 1;
  font-size: 0.88rem;
  color: var(--a40-muted);
}
.a40-shop-count strong {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--a40-orange);
  font-size: 1.05rem;
}

.a40-shop-sort {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.82rem;
  color: var(--a40-muted);
}
.a40-shop-sort span { font-weight: 700; color: var(--a40-ink); }
.a40-shop-sort select {
  padding: 0.4rem 1.75rem 0.4rem 0.65rem;
  border: 1px solid var(--a40-border);
  border-radius: 999px;
  background: var(--a40-cream);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}
.a40-shop-sort select:focus { border-color: var(--a40-mint); }

.a40-view-switch { display: flex; gap: 0.35rem; }

.a40-view-btn {
  display: flex;
  gap: 3px;
  align-items: flex-end;
  height: 32px;
  padding: 0 0.45rem;
  border: 1px solid var(--a40-border);
  border-radius: 8px;
  background: var(--a40-surface);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.a40-view-btn span {
  display: block;
  width: 4px;
  background: var(--a40-border);
  border-radius: 1px;
  transition: background 0.2s, height 0.2s;
}
.a40-view-btn[data-cols="3"] span { height: 14px; }
.a40-view-btn[data-cols="3"] span:nth-child(2) { height: 18px; }
.a40-view-btn[data-cols="3"] span:nth-child(3) { height: 12px; }
.a40-view-btn[data-cols="4"] span { height: 12px; }
.a40-view-btn[data-cols="4"] span:nth-child(2) { height: 16px; }
.a40-view-btn[data-cols="4"] span:nth-child(3) { height: 20px; }
.a40-view-btn[data-cols="4"] span:nth-child(4) { height: 14px; }
.a40-view-btn[data-cols="5"] span { height: 10px; }
.a40-view-btn[data-cols="5"] span:nth-child(3) { height: 18px; }
.a40-view-btn.is-active {
  border-color: var(--a40-orange);
  background: rgba(224, 122, 47, 0.08);
}
.a40-view-btn.is-active span { background: var(--a40-orange); }

/* Grid */
.a40-shop-grid {
  display: grid;
  gap: clamp(0.85rem, 1.5vw, 1.1rem);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--shop-col-min, 200px)), 1fr));
}
.a40-shop-grid[data-cols="3"] { --shop-col-min: 240px; }
.a40-shop-grid[data-cols="4"] { --shop-col-min: 210px; }
.a40-shop-grid[data-cols="5"] { --shop-col-min: 185px; }

.a40-shop-card {
  position: relative;
  background: var(--a40-surface);
  border: 1px solid var(--a40-border);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: hidden;
  transition: transform 0.35s cubic-bezier(0.34, 1.2, 0.64, 1), box-shadow 0.35s ease, border-color 0.35s;
  animation: a40-shop-card-in 0.5s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: calc(var(--card-i, 0) * 0.04s);
}
@keyframes a40-shop-card-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.a40-shop-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--a40-orange), var(--a40-mint));
  opacity: 0;
  transition: opacity 0.25s;
}
.a40-shop-card:hover {
  transform: translateY(-6px);
  box-shadow: 0 16px 36px rgba(33, 37, 41, 0.1);
  border-color: rgba(224, 122, 47, 0.25);
}
.a40-shop-card:hover::before { opacity: 1; }

.a40-shop-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none !important;
  color: inherit;
  padding: 0.75rem;
}

.a40-shop-card-img {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  margin-bottom: 0.6rem;
  padding: 1.15rem;
  background: var(--a40-photo-bg);
  border-radius: 10px;
  overflow: hidden;
}
.a40-shop-card-img img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center;
  transition: transform 0.45s cubic-bezier(0.34, 1.2, 0.64, 1);
}
.a40-shop-card:hover .a40-shop-card-img img { transform: scale(1.03); }

.a40-shop-sale {
  position: absolute;
  top: 0.45rem;
  left: 0.45rem;
  z-index: 1;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.2rem 0.45rem;
  background: var(--a40-berry);
  color: #fff;
  border-radius: 6px;
}

.a40-shop-card-title {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--a40-ink);
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.a40-shop-card-price { margin: 0; font-size: 0.88rem; }
.a40-shop-card-price strong {
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--a40-ink);
}
.a40-shop-card-price s {
  color: var(--a40-muted);
  margin-right: 0.3rem;
  font-size: 0.78rem;
}

.a40-shop-card.is-sold-out { opacity: 0.6; }
.a40-shop-card.is-sold-out .a40-shop-card-img { filter: grayscale(0.35); }

.a40-shop-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  background: var(--a40-surface);
  border: 1px dashed var(--a40-border);
  border-radius: 16px;
}
.a40-shop-empty-icon { font-size: 2.5rem; display: block; margin-bottom: 0.75rem; }
.a40-shop-empty p { margin: 0 0 1rem; color: var(--a40-muted); }
.a40-shop-empty-btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  background: var(--a40-orange);
  color: #fff !important;
  font-weight: 700;
  border-radius: 999px;
  text-decoration: none !important;
  transition: background 0.2s, transform 0.2s;
}
.a40-shop-empty-btn:hover { background: var(--a40-green-dark); transform: translateY(-2px); }

/* Pagination */
.a40-shop .a40-shop-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}
.a40-shop .a40-page-num,
.a40-shop .a40-page-arrow {
  min-width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--a40-border);
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 700;
  text-decoration: none !important;
  color: var(--a40-ink);
  background: var(--a40-surface);
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.a40-shop .a40-page-num.is-active {
  background: var(--a40-orange);
  border-color: transparent;
  color: #fff;
}
.a40-shop .a40-page-arrow:hover,
.a40-shop .a40-page-num:not(.is-active):hover {
  border-color: var(--a40-orange);
  transform: translateY(-2px);
}
.a40-shop .a40-page-gap { padding: 0 0.25rem; color: var(--a40-muted); }

/* Mobile filters */
@media (max-width: 900px) {
  .a40-shop-hero-inner { grid-template-columns: 1fr; }
  .a40-shop-ring { display: none; }
  .a40-filter-mobile-toggle { display: flex; }
  .a40-shop-layout { grid-template-columns: 1fr; }
  .a40-shop-filters {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1200;
    width: min(300px, 88vw);
    top: 0;
    border-radius: 0 16px 16px 0;
    transform: translateX(-105%);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
    overflow-y: auto;
  }
  body.a40-filters-open .a40-shop-filters { transform: translateX(0); }
  .a40-filter-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1190;
    background: rgba(33, 37, 41, 0.45);
    backdrop-filter: blur(3px);
  }
  body.a40-filters-open .a40-filter-backdrop { display: block; }
}

@media (max-width: 640px) {
  .a40-shop-toolbar { flex-direction: column; align-items: stretch; }
  .a40-view-switch { justify-content: flex-end; }
  .a40-shop-grid { --shop-col-min: 155px; }
}

@media (max-width: 400px) {
  .a40-shop-grid { --shop-col-min: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .a40-shop-reveal, .a40-shop-card { animation: none !important; opacity: 1; transform: none; transition: none; }
  .a40-shop-blob, .a40-shop-ring { animation: none !important; }
  .a40-shop-card:hover .a40-shop-card-img img { transform: none; }
}
