/* Storefront shop: collection and search pages, product cards and the product page.
   Builds on ui.css (tokens, chips, pills, buttons, sheet, bar). Loaded by the templates that draw cards or the product page
   (collection, search, product, the related row, the home page's merch row and slideshow). Mobile first; wider layouts from 750px and 990px.

   Sections: 1 page and toolbar . 2 grid and card . 3 filter sheet . 4 pager and empty states . 5 rail ("You may also like")
             6 product page . 7 search page (the header search panel's rules are in ui.css) */

/* ---------- 1. Page and toolbar ---------- */
.shop-page { max-width: 130rem; }
.shop-title { margin: 4px 0 14px; font-size: 2.8rem; line-height: 1.2; }
.shop-lede { margin: -6px 0 14px; font-size: 1.5rem; color: var(--ui-muted); }
.shop-lede p { margin: 0; }
.shop-chips { margin: 0 0 4px; }
.shop-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0 16px; }
.shop-count { margin: 0; font-family: var(--ui-font-mono); font-size: 1.3rem; font-weight: 600; color: var(--ui-muted); }
.shop-filter-btn { flex: none; gap: 8px; }
.shop-filter-btn .icon { width: 18px; height: 18px; flex: none; }
.shop-filter-btn__n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--ui-signal); color: var(--ui-on-signal); font-size: 1.2rem; font-weight: 700; line-height: 1;
}
@media screen and (min-width: 750px) { .shop-title { font-size: 3.4rem; } }

/* ---------- 2. Grid and card ---------- */
.shop-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
.shop-grid__item { min-width: 0; }
@media screen and (min-width: 750px) { .shop-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 16px; } }
@media screen and (min-width: 990px) { .shop-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 20px; } }

.pcard { display: block; color: var(--ui-text); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.pcard__media { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; border-radius: var(--ui-radius-sm); background: var(--ui-surface); }
.pcard__img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; transition: opacity 0.25s ease; }
.pcard__img--alt { opacity: 0; }
@media (hover: hover) { .pcard:hover .pcard__img--alt { opacity: 1; } }
.pcard--out .pcard__img { opacity: 0.55; }
.pcard--out .pcard__img--alt { opacity: 0; }
.pcard__blank { position: absolute; inset: 0; background: var(--ui-surface-2); }
.pcard__pill {
  position: absolute; top: 8px; left: 8px; z-index: 1;
  background: var(--ui-ink); color: var(--ui-text); box-shadow: inset 0 0 0 1px var(--ui-line-strong);
}
.pcard__title {
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; margin-top: 10px;
  font-family: var(--ui-font-mono); font-weight: 600; font-size: 1.3rem; line-height: 1.35; overflow-wrap: anywhere;
}
.pcard:hover .pcard__title { text-decoration: underline; text-underline-offset: 4px; }
.pcard__price { display: block; margin-top: 4px; font-family: var(--ui-font-mono); font-weight: 600; font-size: 1.4rem; }
.pcard__was { margin-right: 6px; font-weight: 400; color: var(--ui-muted); }
.pcard--out .pcard__price, .pcard--out .pcard__title { color: var(--ui-muted); }
.pcard:focus-visible { outline: 2px solid var(--ui-signal); outline-offset: 4px; border-radius: var(--ui-radius-sm); }
@media screen and (min-width: 750px) { .pcard__title { font-size: 1.4rem; } .pcard__price { font-size: 1.5rem; } }
@media (prefers-reduced-motion: reduce) { .pcard__img { transition: none; } }

/* the home page's merch row is Dawn's slider; the new card drops straight in */
.collection .grid__item .pcard { height: 100%; }

/* ---------- 3. Filter and sort sheet ---------- */
.shop-sheet { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.shop-sheet__group { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; }
.shop-sheet__label { padding: 0; margin: 0 0 6px; font-family: var(--ui-font-mono); font-size: 1.3rem; font-weight: 600; color: var(--ui-muted); }
.shop-sort { display: flex; flex-direction: column; border-top: 1px solid var(--ui-line); }
.shop-sort__item { display: flex; align-items: center; gap: 12px; min-height: 48px; border-bottom: 1px solid var(--ui-line); cursor: pointer; font-size: 1.5rem; }
.shop-sheet input[type="radio"], .shop-sheet input[type="checkbox"] {
  -webkit-appearance: none; appearance: none; flex: none; display: grid; place-content: center; width: 22px; height: 22px; margin: 0;
  border: 1.5px solid var(--ui-line-strong); background: transparent; cursor: pointer;
}
.shop-sheet input[type="radio"] { border-radius: 50%; }
.shop-sheet input[type="radio"]:checked { border-color: var(--ui-signal); background: radial-gradient(circle, var(--ui-signal) 0 42%, transparent 47%); }
.shop-sheet input[type="checkbox"] { border-radius: 6px; }
.shop-sheet input[type="checkbox"]:checked { border-color: var(--ui-signal); background: var(--ui-signal); }
.shop-sheet input[type="checkbox"]:checked::before { content: ""; width: 6px; height: 11px; margin-top: -2px; border: solid var(--ui-on-signal); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.shop-sort__item:has(input:checked) span { font-weight: 600; }
.shop-price { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.shop-price .ui-field { margin: 0; }

/* ---------- 4. Pager and empty states ---------- */
.shop-pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 36px 0 8px; }
.shop-pager__now { font-family: var(--ui-font-mono); font-size: 1.3rem; font-weight: 600; color: var(--ui-muted); text-align: center; }
.shop-pager__gap { min-width: 96px; }
.shop-empty { margin: 32px 0; padding: 28px 0; text-align: center; }
.shop-empty__title { margin: 0 0 6px; font-family: var(--ui-font-mono); font-weight: 700; font-size: 1.8rem; }
.shop-empty__text { margin: 0 0 18px; color: var(--ui-muted); }
.shop-page > .shop-empty__text { margin: 12px 0; }

/* ---------- 5. A horizontal row of cards ("You may also like") ---------- */
.rail-wrap { max-width: 130rem; margin: 0 auto; padding: 16px 0 36px; }
.rail-title { margin: 0 var(--ui-gutter) 14px; font-size: 1.8rem; line-height: 1.3; }
.rail { display: flex; gap: 12px; margin: 0; padding: 0 var(--ui-gutter) 8px; list-style: none; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.rail::-webkit-scrollbar { display: none; }
.rail__item { flex: 0 0 44vw; max-width: 230px; scroll-snap-align: start; scroll-margin-left: var(--ui-gutter); }
@media screen and (min-width: 990px) {
  .rail-wrap { padding: 24px 32px 56px; }
  .rail-title { margin-left: 0; font-size: 2rem; }
  .rail { padding-left: 0; padding-right: 0; gap: 20px; scrollbar-width: thin; }
  .rail__item { flex-basis: 230px; }
}

/* ---------- 6. Product page ---------- */
.pdp { max-width: 130rem; margin: 0 auto; }
.pdp__media { max-width: 64rem; margin: 0 auto; }
.pdp-gallery { display: block; position: relative; }
.pdp-gallery__track {
  display: flex; margin: 0; padding: 0; list-style: none; overflow-x: auto; scroll-snap-type: x mandatory;
  scrollbar-width: none; overscroll-behavior-x: contain; -webkit-overflow-scrolling: touch;
}
.pdp-gallery__track::-webkit-scrollbar { display: none; }
.pdp-gallery__slide { position: relative; flex: 0 0 100%; scroll-snap-align: start; aspect-ratio: var(--box, 0.8); background: #fff; }
.pdp-gallery__zoom { display: block; position: relative; width: 100%; height: 100%; }
.pdp-gallery__zoom img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pdp-gallery__open { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; cursor: zoom-in; }
.pdp-gallery__open:focus-visible { outline: 2px solid var(--ui-signal); outline-offset: -4px; }
.pdp-gallery__blank { aspect-ratio: 4 / 3; background: var(--ui-surface); }
.pdp-dots { display: flex; flex-wrap: wrap; justify-content: center; }
.pdp-dot { position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: none; color: var(--ui-text); cursor: pointer; }
.pdp-dot::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  background: var(--ui-line-strong); transition: background-color 0.15s ease, transform 0.15s ease;
}
.pdp-dot[aria-current="true"]::before { background: var(--ui-text); transform: scale(1.3); }
.pdp-dot:focus-visible { outline: 2px solid var(--ui-signal); outline-offset: -2px; border-radius: 8px; }
@media (prefers-reduced-motion: reduce) { .pdp-dot::before { transition: none; } }

.pdp__info { max-width: 64rem; margin: 0 auto; padding: 4px var(--ui-gutter) 28px; }
.pdp__title { margin: 8px 0 8px; font-size: 2.4rem; line-height: 1.2; overflow-wrap: anywhere; }
.pdp-price { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; font-family: var(--ui-font-mono); font-size: 2rem; font-weight: 700; }
.pdp-price__was { font-size: 1.6rem; font-weight: 500; color: var(--ui-muted); }
.pdp__vendor { margin: 6px 0 0; font-size: 1.4rem; color: var(--ui-muted); }
.pdp-noscript { color: var(--ui-muted); font-size: 1.4rem; }

.pdp-options { display: block; margin-top: 22px; }
.pdp-opt { position: relative; min-width: 0; margin: 0 0 18px; padding: 0; border: 0; }
.pdp-opt__label { float: left; width: 100%; padding: 0; margin: 0 0 10px; font-family: var(--ui-font-mono); font-size: 1.3rem; font-weight: 600; color: var(--ui-muted); }
.pdp-opt__guide {
  position: absolute; top: -13px; right: 0; display: inline-flex; align-items: center; min-height: var(--ui-tap);
  font-family: var(--ui-font-mono); font-size: 1.3rem; font-weight: 600; color: var(--ui-text); text-underline-offset: 4px;
}
.pdp-chips { clear: both; display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 8px; }
.pdp-chip__input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.pdp-chip {
  display: flex; align-items: center; justify-content: center; min-height: 48px; padding: 4px 10px; margin: 0;
  border: 1px solid var(--ui-line-strong); border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-text);
  font-family: var(--ui-font-mono); font-size: 1.4rem; font-weight: 600; line-height: 1.2; text-align: center; overflow-wrap: anywhere; cursor: pointer;
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.pdp-chip:hover { border-color: var(--ui-text); }
.pdp-chip__input:checked + .pdp-chip { background: var(--ui-text); color: var(--ui-ink); border-color: var(--ui-text); }
.pdp-chip__input:focus-visible + .pdp-chip { outline: 2px solid var(--ui-signal); outline-offset: 2px; }
.pdp-chip__input:disabled + .pdp-chip {
  background: transparent; border-color: var(--ui-line); color: var(--ui-muted); text-decoration: line-through; text-decoration-thickness: 1.5px; cursor: not-allowed;
}
.pdp-chip__input:disabled:checked + .pdp-chip { border-color: var(--ui-line-strong); }
@media (prefers-reduced-motion: reduce) { .pdp-chip { transition: none; } }

/* the buy bar: Dawn's product form submit, laid out as the kit's action bar */
.pdp-bar { flex-direction: column; align-items: stretch; gap: 8px; }
.pdp-bar > .ui-btn { max-width: none; margin: 0; }
.pdp-error { display: flex; align-items: flex-start; gap: 8px; font-size: 1.4rem; color: var(--ui-bad); }
.pdp-error[hidden] { display: none; }
.pdp-error .icon { flex: none; width: 16px; height: 16px; margin-top: 3px; }
.pdp-submit { position: relative; }
.pdp-submit[disabled] { background: var(--ui-surface-2); color: var(--ui-muted); opacity: 1; box-shadow: inset 0 0 0 1px var(--ui-line); }
.pdp-submit .loading-overlay__spinner { position: absolute; inset: 0; display: grid; place-items: center; width: auto; height: auto; }
.pdp-submit .loading-overlay__spinner .spinner { width: 22px; height: 22px; }
.pdp-submit .loading-overlay__spinner .path { stroke: var(--ui-on-signal); }
.pdp-submit.loading > span:first-child { visibility: hidden; }

/* accordion */
.pdp-acc { margin-top: 24px; border-top: 1px solid var(--ui-line); }
.pdp-acc__item { border-bottom: 1px solid var(--ui-line); }
.pdp-acc__item > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; cursor: pointer; list-style: none;
  font-family: var(--ui-font-mono); font-weight: 600; font-size: 1.5rem;
}
.pdp-acc__item > summary::-webkit-details-marker { display: none; }
.pdp-acc__item > summary::after {
  content: ""; flex: none; width: 18px; height: 18px; background: var(--ui-muted); transition: transform 0.18s ease;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 9l7 7 7-7'/%3E%3C/svg%3E") center / contain no-repeat;
}
.pdp-acc__item[open] > summary::after { transform: rotate(180deg); }
.pdp-acc__item > summary:focus-visible { outline: 2px solid var(--ui-signal); outline-offset: -2px; }
.pdp-acc__body { padding: 0 0 18px; font-size: 1.5rem; color: rgba(242, 242, 242, 0.88); overflow-wrap: anywhere; }
.pdp-acc__body p { margin: 0 0 0.8em; }
.pdp-acc__body p:last-child { margin-bottom: 0; }
.pdp-acc__body a { color: var(--ui-text); }
.pdp-acc__text { white-space: pre-line; }
.pdp-facts { margin: 0; padding-left: 18px; }
.pdp-facts li { margin: 4px 0; }
@media (prefers-reduced-motion: reduce) { .pdp-acc__item > summary::after { transition: none; } }

.pdp-share { display: block; margin-top: 14px; }
.pdp-share .share-button__button { font-family: var(--ui-font-mono); font-weight: 600; font-size: 1.3rem; min-height: var(--ui-tap); color: var(--ui-text); text-decoration: none; }
.pdp-share .share-button__button .icon { width: 14px; height: 14px; margin-right: 8px; }

@media screen and (min-width: 990px) {
  .pdp { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 56px; align-items: start; padding: 32px 32px 0; }
  .pdp__media { max-width: none; margin: 0; }
  .pdp-gallery__track { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow: visible; }
  .pdp-gallery__slide { aspect-ratio: var(--ratio, 0.8); border-radius: var(--ui-radius-sm); overflow: hidden; }
  .pdp-gallery__slide:first-child:not(:only-child) { grid-column: 1 / -1; }
  .pdp-gallery__zoom img { object-fit: cover; }
  .pdp-dots { display: none; }
  .pdp__info { position: sticky; top: calc(var(--ui-header-h) + 24px); max-width: none; margin: 0; padding: 0 0 56px; }
  .pdp__title { font-size: 3.2rem; }
  .pdp-price { font-size: 2.4rem; }
  .pdp-bar { position: static; padding: 0; background: none; border: 0; margin: 24px 0 4px; }
}

/* ---------- 7. Search page ---------- */
.shop-search { max-width: 64rem; margin: 0 0 18px; }
.template-search .search .field { margin: 0; }
.pdp-priceline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
