/* ==========================================================================
   components.css: product cards, prices, ratings, cart drawer, accordions,
   breadcrumbs, pagination, quantity stepper, before/after slider, trust bar
   ========================================================================== */

/* ---------- Product grid & card ---------- */
.product-grid { --cols: 4; display: grid; gap: clamp(14px, 2vw, 24px); grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); }
.product-grid.cols-3 { --cols: 3; }
@media (max-width: 1100px) { .product-grid, .product-grid.cols-3 { --cols: 3; } }
@media (max-width: 760px) { .product-grid, .product-grid.cols-3 { --cols: 2; } }

/* Product photos often have a white background: "multiply" blends it into the cream card */
.product-card-media img, .gallery-main img, .gallery-thumb img, .cart-line-media img,
.compare-product img, .checkout-summary-thumb img, .search-result img, .sticky-atc img, .pack-card-media img { mix-blend-mode: multiply; }

.product-card { position: relative; display: flex; flex-direction: column; border-radius: var(--radius-lg); }
.product-card-visual { position: relative; z-index: 2; border-radius: var(--radius-lg); overflow: hidden; background: var(--cream); isolation: isolate; transition: box-shadow 0.45s var(--ease-out), transform 0.45s var(--ease-out); }
.product-card-media { position: relative; display: block; aspect-ratio: 1 / 1; overflow: hidden; }
.product-card-media::after { content: ''; position: absolute; inset: 0; background: radial-gradient(circle at 50% 120%, rgba(27, 127, 224, 0.16), transparent 60%); opacity: 0; transition: opacity 0.5s var(--ease-out); pointer-events: none; }
.product-card-media img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 9%;
  transition: opacity 0.5s var(--ease-out), transform 0.9s var(--ease-out);
}
.product-card-media img.is-cover { object-fit: cover; padding: 0; mix-blend-mode: normal; }
.product-card-media .img-hover { opacity: 0; transform: scale(1.06); }
.product-card-badges { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; pointer-events: none; }
.product-card-quick { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 3; }
.qa-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; padding: 10px 16px;
  border-radius: var(--radius-pill); background: var(--ink); color: #fff; font-weight: 700; font-size: var(--fs-sm);
  box-shadow: 0 14px 30px -12px rgba(6, 16, 31, 0.55); transition: background 0.2s, transform 0.2s;
}
.qa-btn:hover { background: var(--brand); }
.qa-btn.is-light { background: #fff; color: var(--ink); }
.qa-btn.is-loading { position: relative; color: transparent; pointer-events: none; }
.qa-btn.is-loading::after { content: ''; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid #fff; border-right-color: transparent; animation: spin 0.7s linear infinite; }
@media (hover: hover) and (pointer: fine) {
  .product-card-quick { opacity: 0; transform: translateY(18px); transition: opacity 0.35s var(--ease-out), transform 0.45s var(--ease-out); }
  .product-card:hover .product-card-quick, .product-card:focus-within .product-card-quick { opacity: 1; transform: none; }
  .product-card:hover .product-card-visual { box-shadow: 0 30px 60px -30px rgba(6, 16, 31, 0.45); transform: translateY(-4px); }
  .product-card:hover .product-card-media::after { opacity: 1; }
  .product-card:hover .img-main { transform: scale(1.07); }
  .product-card:hover .product-card-media:has(.img-hover) .img-main { opacity: 0; }
  .product-card:hover .img-hover { opacity: 1; transform: scale(1); }
}
/* Touch screens: a round + button in the corner instead of the hover bar */
@media (hover: none), (pointer: coarse) {
  .product-card-quick { left: auto; right: 10px; bottom: 10px; }
  .qa-btn { width: 44px; min-height: 44px; padding: 0; }
  .qa-btn span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .qa-btn .icon { width: 20px; height: 20px; }
}
.product-card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 4px 0; flex: 1; }
.product-card-brand { font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.product-card-title { font-family: var(--font-sans); font-size: 0.98rem; font-weight: 600; line-height: 1.35; margin: 0; letter-spacing: -0.005em; }
.product-card-title a { background: linear-gradient(currentColor, currentColor) 0 100% / 0 1.5px no-repeat; transition: background-size 0.4s var(--ease-out); }
.product-card:hover .product-card-title a { background-size: 100% 1.5px; }
.product-card-title a::after { content: ''; position: absolute; inset: 0; z-index: 1; }
.product-card-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--muted); }
.product-card .price { font-size: 1rem; }

/* Cards on dark bands (e.g. the boots edit) */
.edit-band .product-card-visual { background: #f3eee8; }
.edit-band .product-card-title, .edit-band .price-current { color: #fff; }
.edit-band .product-card-meta, .edit-band .product-card-brand, .edit-band .price-compare, .edit-band .unit-price, .edit-band .rating-line { color: rgba(255, 255, 255, 0.6); }

/* ---------- Carousel (scroll-snap + buttons) ---------- */
.carousel { position: relative; }
.carousel-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: calc((100% - 3 * 20px) / 4); gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 6px; overscroll-behavior-x: contain;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track > * { scroll-snap-align: start; }
@media (max-width: 1100px) { .carousel-track { grid-auto-columns: calc((100% - 2 * 20px) / 3); } }
@media (max-width: 760px) { .carousel-track { grid-auto-columns: 72%; gap: 14px; } }
.carousel-nav { display: none; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.carousel.is-scrollable .carousel-nav { display: flex; }
.carousel-btn {
  width: 50px; height: 50px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--line-2); background: #fff; color: var(--ink); transition: background 0.2s, color 0.2s, transform 0.2s, opacity 0.2s, border-color 0.2s;
}
.carousel-btn:hover:not(:disabled) { background: var(--ink); color: #fff; border-color: var(--ink); transform: scale(1.06); }
.carousel-btn:disabled { opacity: 0.35; cursor: default; }
.edit-band .carousel-btn { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.3); }
.edit-band .carousel-btn:hover:not(:disabled) { background: #fff; color: var(--ink); border-color: #fff; }

/* ---------- Price ---------- */
.price { display: inline-flex; align-items: baseline; gap: 8px; flex-wrap: wrap; font-weight: 700; }
.price-current { color: var(--ink); }
.price-current.is-sale { color: var(--sale); }
.price-compare { color: var(--muted); font-weight: 500; text-decoration: line-through; font-size: 0.9em; }
.price-from { font-weight: 500; color: var(--muted); font-size: 0.85em; }
.unit-price { font-size: var(--fs-xs); color: var(--muted); font-weight: 600; }

/* ---------- Rating stars ---------- */
.stars { --rating: 0; --star: 16px; display: inline-block; position: relative; width: calc(var(--star) * 5); height: var(--star); line-height: 1; }
.stars::before, .stars::after {
  content: ''; position: absolute; inset: 0;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7L12 17.3 5.8 21l1.6-7L2 9.2l7.1-.6z'/%3E%3C/svg%3E") 0 0 / var(--star) var(--star) repeat-x;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2l2.9 6.6 7.1.6-5.4 4.7 1.6 7L12 17.3 5.8 21l1.6-7L2 9.2l7.1-.6z'/%3E%3C/svg%3E") 0 0 / var(--star) var(--star) repeat-x;
}
.stars::before { background: var(--line-2); }
.stars::after { background: #f5a300; width: calc(var(--rating) / 5 * 100%); }
.rating-line { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-sm); color: var(--muted); }

/* ---------- Quantity stepper ---------- */
.qty { display: inline-flex; align-items: center; border: 1.5px solid var(--line-2); border-radius: var(--radius-pill); background: #fff; height: 48px; }
.qty button { width: 44px; height: 100%; display: inline-flex; align-items: center; justify-content: center; color: var(--ink); border-radius: var(--radius-pill); }
.qty button:hover { background: var(--cream); }
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty input { width: 44px; text-align: center; border: 0; font-weight: 700; background: transparent; -moz-appearance: textfield; appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.qty-sm { height: 38px; }
.qty-sm button { width: 34px; }
.qty-sm input { width: 34px; font-size: var(--fs-sm); }

/* ---------- Cart drawer ---------- */
.cart-drawer .drawer-panel { width: min(460px, 100vw); }
.free-ship { margin-bottom: 16px; padding: 14px 16px; background: var(--cream); border-radius: var(--radius); font-size: var(--fs-sm); font-weight: 600; }
.free-ship.is-unlocked { display: flex; align-items: center; gap: 10px; background: var(--success-soft); color: #14532d; }
.free-ship.is-unlocked .icon { color: var(--success); animation: truck 2.4s var(--ease-in-out, ease) infinite; }
@keyframes truck { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(4px); } }
.free-ship-bar { height: 6px; margin-top: 10px; background: #fff; border-radius: 6px; overflow: hidden; }
.free-ship-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-bright), var(--sky)); border-radius: 6px; transition: width 0.5s var(--ease); }
.cart-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.cart-line { display: grid; grid-template-columns: 84px 1fr auto; gap: 14px; align-items: start; animation: enter 0.5s var(--ease-out, ease) both; }
.cart-line-media { width: 84px; height: 84px; border-radius: var(--radius-sm); background: var(--cream); overflow: hidden; display: block; }
.cart-line-media img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.cart-line-title { font-weight: 600; font-size: var(--fs-sm); line-height: 1.35; display: block; }
.cart-line-variant { font-size: var(--fs-xs); color: var(--muted); margin-top: 2px; }
.cart-line-actions { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.cart-line-remove { font-size: var(--fs-xs); color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.cart-line-remove:hover { color: var(--sale); }
.cart-line-price { text-align: right; font-weight: 700; font-size: var(--fs-sm); }
.cart-line-price s { display: block; color: var(--muted); font-weight: 500; font-size: var(--fs-xs); }
.cart-totals { display: grid; gap: 8px; margin-bottom: 14px; font-size: var(--fs-sm); }
.cart-totals-row { display: flex; justify-content: space-between; gap: 12px; }
.cart-totals-row.is-total { font-size: var(--fs-md); font-weight: 800; padding-top: 8px; border-top: 1px solid var(--line); }
.cart-totals-row.is-discount { color: var(--success); font-weight: 600; }
.cart-empty { text-align: center; padding: 40px 12px; }
.cart-empty .icon { width: 48px; height: 48px; margin: 0 auto 12px; color: var(--muted-2); }
.cart-drawer.is-loading .drawer-body { opacity: 0.55; pointer-events: none; }
.secure-note { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; font-size: var(--fs-xs); color: var(--muted); }

/* ---------- Trust bar ---------- */
.trust-bar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.trust-item { display: flex; align-items: center; gap: 12px; font-size: var(--fs-sm); }
.trust-item strong { display: block; font-size: var(--fs-sm); }
.trust-item span { color: var(--muted); font-size: var(--fs-xs); }
.trust-icon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
@media (max-width: 900px) { .trust-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Accordion (details/summary) ---------- */
.accordion { border-top: 1px solid var(--line); }
.accordion details { border-bottom: 1px solid var(--line); }
.accordion summary {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 2px;
  font-weight: 700; cursor: pointer; list-style: none;
}
.accordion summary::-webkit-details-marker { display: none; }
.accordion summary .icon { transition: transform 0.25s var(--ease); }
.accordion details[open] summary .icon { transform: rotate(45deg); }
.accordion .accordion-body { padding: 0 2px 20px; color: var(--ink-2); overflow: hidden; }
.accordion summary:hover { color: var(--brand); }

/* ---------- Breadcrumbs & pagination ---------- */
.breadcrumbs { font-size: var(--fs-xs); color: var(--muted); padding-block: 16px; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.breadcrumbs li + li::before { content: '/'; margin-right: 6px; color: var(--line-2); }
.breadcrumbs a:hover { color: var(--ink); text-decoration: underline; }
.pagination { display: flex; justify-content: center; gap: 6px; margin-top: 48px; }
.pagination a, .pagination span {
  min-width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0 12px;
  border-radius: var(--radius-pill); border: 1px solid var(--line); font-weight: 600; font-size: var(--fs-sm);
}
.pagination a:hover { border-color: var(--ink); }
.pagination .is-current { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Before / after slider ---------- */
.ba { position: relative; aspect-ratio: 4 / 3; border-radius: var(--radius-lg); overflow: hidden; background: var(--cream); user-select: none; touch-action: pan-y; --pos: 50%; }
.ba img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.ba-before { clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba-label { position: absolute; top: 14px; z-index: 2; padding: 5px 12px; border-radius: var(--radius-pill); background: rgba(6, 16, 31, 0.75); color: #fff; font-size: var(--fs-xs); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.ba-label-before { left: 14px; }
.ba-label-after { right: 14px; background: var(--brand); }
.ba-handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; z-index: 3; pointer-events: none; box-shadow: 0 0 0 1px rgba(6, 16, 31, 0.1); }
.ba-handle::after {
  content: ''; position: absolute; top: 50%; left: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%);
  border-radius: 50%; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='22' fill='none' stroke='%2306101f' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6l-5 5 5 5M14 6l5 5-5 5'/%3E%3C/svg%3E") center / 22px no-repeat;
  box-shadow: var(--shadow);
}
.ba img { transition: opacity 0.2s; }
.ba.is-switching img { opacity: 0.2; }
.ba-hint {
  position: absolute; left: var(--pos); bottom: 18px; z-index: 3; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px; border-radius: var(--radius-pill); background: var(--accent); color: var(--ink); font-size: var(--fs-xs); font-weight: 800;
  box-shadow: var(--shadow); pointer-events: none; transition: opacity 0.3s;
}
.ba.is-touched .ba-hint { opacity: 0; }
.ba-handle::after { animation: pulse-ring 2.2s infinite; }
.ba input[type='range'] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; z-index: 4; margin: 0; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.tab {
  padding: 10px 18px; border-radius: var(--radius-pill); border: 1.5px solid var(--line-2); background: #fff;
  font-weight: 700; font-size: var(--fs-sm); color: var(--ink-2); transition: all 0.15s;
}
.tab:hover { border-color: var(--ink); }
.tab[aria-selected='true'], .tab.is-active { background: var(--ink); color: #fff; border-color: var(--ink); box-shadow: 0 10px 20px -10px rgba(6, 16, 31, 0.5); }

/* ---------- Cards / misc ---------- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius-lg); padding: clamp(20px, 3vw, 32px); }
.card-cream { background: var(--cream); border-color: transparent; }
.empty-state { text-align: center; padding: 64px 16px; }
.empty-state .icon { width: 56px; height: 56px; margin: 0 auto 16px; color: var(--muted-2); }
.divider { height: 1px; background: var(--line); border: 0; margin: 24px 0; }
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-pill);
  border: 1.5px solid var(--line-2); font-size: var(--fs-sm); font-weight: 600; background: #fff; transition: all 0.15s;
}
.chip:hover { border-color: var(--ink); }
.chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip-count { font-size: var(--fs-xs); opacity: 0.7; }
