/* ==========================================================================================================
   WARP VAULT STORE: catalog page only (shop.html). Everything shared lives in store.css; classes here start .sh-
   Sections: top (the wall + shout title) / bar (search, count, sort) / layout / filters / chips / grid / more /
   filter button / empty state / motion.
   ========================================================================================================== */

/* ---------- top: concrete wall, one shout title, torn edge down to the paper ---------- */
.sh-top { z-index: 1; padding-block: clamp(22px, 3.6vw, 44px) calc(clamp(16px, 2.6vw, 34px) + clamp(18px, 2.6vw, 34px)); overflow: hidden; }
.sh-top-in { display: grid; gap: clamp(10px, 1.4vw, 18px); }
.sh-shout { font-size: clamp(2.4rem, 13.7vw, 9rem); margin-left: -0.045em; white-space: nowrap; }
.sh-top-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.sh-top-row .wv-lede { max-width: 25em; font-size: clamp(1rem, 1.25vw, 1.1875rem); }
.sh-top-row .wv-accent { font-size: 1.22em; line-height: 1; letter-spacing: -0.01em; white-space: nowrap; }
.sh-top-badge { --badge: 92px; flex: none; margin-bottom: -14px; }
.sh-top .wv-meta [data-sh-updated], .sh-top .wv-meta span:nth-of-type(3) { display: none; }
@media (min-width: 560px) {
  .sh-top .wv-meta [data-sh-updated], .sh-top .wv-meta span:nth-of-type(3) { display: inline; }
  .sh-top-badge { --badge: 112px; }
}
@media (min-width: 1000px) {
  .sh-top-in { grid-template-columns: auto minmax(0, 1fr); column-gap: clamp(28px, 3.4vw, 56px); align-items: end; }
  .sh-top-in > .wv-meta { grid-column: 1 / -1; }
  .sh-shout { font-size: clamp(6rem, 9.5vw, 10rem); }
  .sh-top-row { padding-bottom: 0.5vw; }
  .sh-top-badge { --badge: 136px; margin-bottom: -26px; }
}

/* the title arrives once, at first paint (static HTML, so it never waits for the data) */
.sh-rise { animation: sh-in 620ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 70ms); }
.sh-wipe { animation: sh-wipe 820ms var(--ease-out) 70ms backwards; }
.sh-top-badge > * { animation: sh-pop 520ms var(--ease-out) backwards; }
@keyframes sh-wipe { from { clip-path: inset(0 0 100% 0); transform: translate3d(0, 22%, 0); } to { clip-path: inset(-12% -4% -12% -4%); transform: none; } }
@keyframes sh-pop { from { opacity: 0; transform: scale(0.9) rotate(-14deg); } }

/* ---------- bar: search, live count, sort ---------- */
.sh-bar { position: relative; z-index: 50; background: var(--paper); }
.sh-bar-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px 16px; padding-block: 18px 6px; }
.sh-search { grid-column: 1 / -1; }
.sh-search .wv-input { padding-right: 48px; }
.sh-search .wv-input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.sh-search-x {
  position: absolute; right: 6px; top: 50%; width: 36px; height: 36px; margin-top: -18px; padding: 0; display: grid; place-items: center;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink); cursor: pointer; transition: background-color 140ms ease, transform 140ms var(--ease-out);
}
.sh-search-x[hidden] { display: none; }
.sh-search-x::after { content: ""; position: absolute; inset: -4px; }
.sh-search-x .wv-ico { position: static; margin: 0; width: 16px; height: 16px; }
.sh-search-x:active { transform: scale(0.9); }
@media (hover: hover) and (pointer: fine) { .sh-search-x:hover { background: var(--lime); } }

.sh-count { display: flex; align-items: baseline; gap: 7px; min-width: 0; font-weight: 600; font-size: 0.9375rem; line-height: 1; white-space: nowrap; }
.sh-count-n { font-stretch: 70%; font-weight: 800; font-size: 2.125rem; line-height: 1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; min-width: 1ch; flex: none; }
.sh-count-n .rc-digit { height: 1em; -webkit-mask-image: none; mask-image: none; }
.sh-count-n .rc-strip { transition-duration: 480ms; transition-timing-function: var(--ease-out); }
.sh-count-n .rc-strip > span, .sh-count-n .rc-sym { height: 1em; line-height: 1em; }
.sh-count small { font-size: inherit; font-weight: 500; color: var(--muted); }

.sh-sort { display: flex; align-items: center; gap: 10px; min-width: 0; }
.sh-sort .wv-select { width: auto; min-height: 44px; padding-block: 6px; font-weight: 600; font-size: 0.9375rem; max-width: 100%; }
@media (max-width: 479px) { .sh-sort .wv-meta { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } }

@media (min-width: 720px) {
  .sh-bar-in { grid-template-columns: auto minmax(0, 1fr) auto; gap: 16px 24px; }
  .sh-search { grid-column: 2; grid-row: 1; max-width: 520px; }
  .sh-count { grid-column: 1; grid-row: 1; }
}
@media (min-width: 1100px) {
  :root { --sh-rail: 264px; --sh-gap: clamp(28px, 3vw, 48px); --sh-bar-h: 80px; }
  .sh-bar { position: sticky; top: var(--nav-h); border-bottom: var(--bw) solid var(--ink); }
  .sh-bar-in { grid-template-columns: var(--sh-rail) minmax(0, 1fr) auto; column-gap: var(--sh-gap); height: var(--sh-bar-h); padding-block: 0; }
}

/* ---------- layout: rail | grid ---------- */
.sh-layout { padding-block: 14px clamp(56px, 8vw, 112px); }
.sh-rail { display: none; }
.sh-main { min-width: 0; }
@media (min-width: 1100px) {
  .sh-layout { display: grid; grid-template-columns: var(--sh-rail) minmax(0, 1fr); column-gap: var(--sh-gap); align-items: start; padding-top: 28px; }
  .sh-rail {
    display: block; position: sticky; top: calc(var(--nav-h) + var(--sh-bar-h) + 28px); max-height: calc(100vh - var(--nav-h) - var(--sh-bar-h) - 44px); max-height: calc(100dvh - var(--nav-h) - var(--sh-bar-h) - 44px);
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--concrete) transparent; padding: 3px 14px 56px 3px; margin: -3px 0 0 -3px;
    -webkit-mask-image: linear-gradient(#000 calc(100% - 56px), transparent); mask-image: linear-gradient(#000 calc(100% - 56px), transparent);
  }
  .sh-rail::-webkit-scrollbar { width: 6px; }
  .sh-rail::-webkit-scrollbar-track { background: transparent; }
  .sh-rail::-webkit-scrollbar-thumb { background: var(--concrete); border: 0; }
  .sh-quick { display: none; }
  .sh-grid.wv-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1700px) { .sh-grid.wv-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.sh-rail-skel { display: grid; gap: 18px; padding-top: 6px; }
.sh-rail-skel i { height: 14px; width: 70%; }
.sh-rail-skel i:nth-child(2n) { width: 48%; }
.sh-rail-skel i:first-child { height: 30px; width: 40%; }

/* ---------- filters (same form in the rail and in the phone sheet) ---------- */
.sh-filters { display: block; }
.wv-drawer .sh-filters { padding-top: 16px; }

.sh-clear {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--ink); cursor: pointer;
  font-weight: 700; font-size: 0.875rem; text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; white-space: nowrap;
}
.sh-clear[hidden] { display: none; }
.sh-clear:disabled { color: var(--muted); text-decoration: none; cursor: default; }
@media (hover: hover) and (pointer: fine) { .sh-clear:not(:disabled):hover { background: var(--lime); } }

/* Black Friday switch */
.sh-bf {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 6px;
  border: var(--bw) solid var(--ink); background: var(--paper-hi); cursor: pointer; transition: background-color 160ms ease; -webkit-tap-highlight-color: transparent;
}
.sh-bf input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sh-bf-txt { display: grid; gap: 3px; }
.sh-bf-txt b { font-stretch: 75%; font-weight: 800; font-size: 1.25rem; line-height: 1; letter-spacing: -0.01em; }
.sh-bf-txt small { font-size: 0.8125rem; font-weight: 500; line-height: 1.25; color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-switch { position: relative; width: 46px; height: 26px; border: var(--bw) solid var(--ink); border-radius: 999px; background: transparent; transition: background-color 160ms ease; }
.sh-switch::after { content: ""; position: absolute; left: 3px; top: 3px; width: 17px; height: 17px; border-radius: 50%; background: var(--ink); transition: transform 180ms var(--ease-out), background-color 160ms ease; }
.sh-bf:has(input:checked) { background: var(--sale); }
.sh-bf:has(input:checked) .sh-bf-txt small { color: #2d0f08; }
.sh-bf:has(input:checked) .sh-switch { background: var(--ink); }
.sh-bf:has(input:checked) .sh-switch::after { transform: translateX(20px); background: var(--sale); }
.sh-bf:has(input:focus-visible) { outline: 2.5px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--lime); }

.sh-group { min-width: 0; margin: 14px 0 0; padding: 12px 0 0; border: 0; border-top: var(--bw) solid var(--ink); }
.sh-group legend { float: left; width: 100%; padding: 0; margin-bottom: 8px; }
.sh-group legend + * { clear: both; }
.sh-opts.pills { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 2px; }

.sh-opt {
  position: relative; display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; min-height: 34px;
  font-weight: 600; font-size: 0.9375rem; line-height: 1.2; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.sh-opt input, .sh-pill input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.sh-box { position: relative; width: 20px; height: 20px; border: var(--bw) solid var(--ink); background: var(--paper-hi); transition: background-color 120ms ease; }
.sh-box::after {
  content: ""; position: absolute; inset: 0; background: var(--ink); opacity: 0; transform: scale(0.6); transition: opacity 120ms ease, transform 160ms var(--ease-out);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 15px no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 15px no-repeat;
}
.sh-opt small { font-size: 0.8125rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.sh-opt:has(input:checked) .sh-box { background: var(--lime); }
.sh-opt:has(input:checked) .sh-box::after { opacity: 1; transform: none; }
.sh-opt:has(input:checked) small { color: var(--ink); }
.sh-opt:has(input:focus-visible) .sh-box { outline: 2.5px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--lime); }
.sh-opt.is-off, .sh-pill.is-off { opacity: 0.38; cursor: default; }
.sh-opt.is-off input, .sh-pill.is-off input { cursor: default; }

.sh-pill { position: relative; display: inline-flex; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sh-pill-in {
  display: inline-flex; align-items: center; gap: 7px; min-height: 36px; padding: 4px 13px; border: var(--bw) solid var(--ink); border-radius: 999px; background: transparent;
  font-weight: 600; font-size: 0.9375rem; line-height: 1.1; white-space: nowrap; transition: background-color 140ms ease, color 140ms ease, transform 140ms var(--ease-out);
}
.sh-pill-in small { font-size: 0.75rem; font-weight: 700; font-variant-numeric: tabular-nums; opacity: 0.66; }
.sh-pill:not(.is-off):active .sh-pill-in { transform: scale(0.96); }
.sh-pill:has(input:checked) .sh-pill-in { background: var(--ink); color: var(--paper); }
.sh-pill:has(input:focus-visible) .sh-pill-in { outline: 2.5px solid var(--ink); outline-offset: 3px; box-shadow: 0 0 0 6px var(--lime); }
@media (hover: hover) and (pointer: fine) {
  .sh-opt:not(.is-off):hover .sh-box { background: var(--lime); }
  .sh-pill:not(.is-off):not(:has(input:checked)):hover .sh-pill-in { background: var(--lime); }
}
@media (pointer: coarse) {
  .sh-opt { min-height: 46px; font-size: 1rem; }
  .sh-box { width: 22px; height: 22px; }
  .sh-opt { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .sh-pill-in { min-height: 44px; padding-inline: 16px; }
}
.sh-sheet-foot { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; background: var(--paper); }

/* ---------- quick section chips + active filter chips ---------- */
.sh-quick { margin-bottom: 14px; padding-block: 2px; }
.sh-active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.sh-active[hidden] { display: none; }
.sh-achip { min-height: 40px; padding: 4px 10px 4px 14px; gap: 6px; font-size: 0.875rem; background: var(--paper-hi); }
.sh-achip .wv-ico { width: 14px; height: 14px; }
@media (pointer: coarse) { .sh-achip { min-height: 44px; } }

/* ---------- grid motion ---------- */
.sh-in { animation: sh-in 480ms var(--ease-out) backwards; animation-delay: calc(var(--i, 0) * 35ms); }
.sh-swap > * { animation: sh-fade 200ms ease backwards; }
@keyframes sh-in { from { opacity: 0; transform: translate3d(0, 16px, 0); } }
@keyframes sh-fade { from { opacity: 0; } }

/* ---------- show more ---------- */
.sh-more { display: grid; justify-items: center; gap: 12px; margin-top: clamp(32px, 4vw, 56px); }
.sh-more[hidden] { display: none; }
.sh-more-track { width: min(240px, 60%); height: 4px; background: #d9d4c9; overflow: hidden; }
.sh-more-track i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform 420ms var(--ease-out); }
.sh-more .wv-btn { margin-top: 8px; min-width: 220px; }
.sh-more .wv-btn[hidden] { display: none; }

/* ---------- sticky Filter button (screens without the rail) ---------- */
.sh-fab-dock { position: sticky; bottom: calc(14px + env(safe-area-inset-bottom, 0px)); z-index: 40; display: flex; justify-content: center; margin-top: 28px; pointer-events: none; }
.sh-fab {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 22px 0 18px; border: var(--bw) solid var(--ink); border-radius: 999px;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 1rem; cursor: pointer; -webkit-tap-highlight-color: transparent;
  box-shadow: 0 14px 28px -12px rgba(20, 20, 18, 0.7), 0 3px 8px rgba(20, 20, 18, 0.28); transition: transform 140ms var(--ease-out), background-color 160ms ease;
}
.sh-fab[hidden] { display: none; }
.sh-fab:active { transform: scale(0.96); }
.sh-fab.has { padding-right: 8px; }
.sh-fab b { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 9px; border-radius: 999px; background: var(--lime); color: var(--ink); font-weight: 800; font-size: 0.9375rem; font-variant-numeric: tabular-nums; }
.sh-fab b[hidden] { display: none; }
.sh-fab-ico { display: grid; justify-items: center; gap: 4px; width: 20px; }
.sh-fab-ico i { display: block; height: 2px; border-radius: 2px; background: currentColor; width: 18px; }
.sh-fab-ico i:nth-child(2) { width: 12px; }
.sh-fab-ico i:nth-child(3) { width: 6px; }
@media (min-width: 1100px) { .sh-fab-dock { display: none; } }
@media (max-width: 1099px) { .wv-toasts { bottom: calc(82px + env(safe-area-inset-bottom, 0px)); } }

/* ---------- empty state: the bare pipe rack ---------- */
.sh-grid.is-empty { display: block; }
/* nothing to filter down further: the Filter button stops floating so it cannot sit on the message */
.sh-grid.is-empty ~ .sh-fab-dock { position: static; margin-top: 20px; justify-content: flex-start; }
.sh-empty { position: relative; max-width: 760px; margin-top: 8px; padding-top: clamp(64px, 9vw, 96px); }
.sh-empty::before {
  content: ""; position: absolute; left: clamp(28px, 5vw, 56px); right: clamp(28px, 5vw, 56px); top: clamp(22px, 3vw, 32px); height: clamp(22px, 3vw, 34px);
  border: 6px solid var(--ink); border-bottom: 0; border-radius: 3px 3px 0 0;
}
.sh-empty-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sh-empty-acts .wv-btn { white-space: normal; text-align: left; }
.sh-empty-acts .wv-btn small { font-weight: 600; font-size: 0.8125rem; opacity: 0.7; margin-left: 4px; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .sh-in { animation: sh-fade 200ms ease backwards; animation-delay: 0s; }
  .sh-rise, .sh-wipe, .sh-top-badge > * { animation: sh-fade 240ms ease backwards; animation-delay: 0s; }
  .sh-switch::after, .sh-box::after, .sh-more-track i, .sh-fab, .sh-pill-in, .sh-search-x { transition: none; }
  .sh-top-badge { transform: none; }
}
@media print { .sh-bar, .sh-rail, .sh-quick, .sh-fab-dock, .sh-more { display: none !important; } }
