/* ==========================================================================
   Gallery store collection pages — after nickeykehoe.com/collections/furniture
   hero triptych · sticky toolbar + category pills · 1px hairline grid · Filter & Sort drawer
   Type scale is sized for older readers: nothing under 13px (12px only for tiny badges).
   Phones (<= 767px) never cover-crop a painting: the hero shows one room image whole.
   ========================================================================== */

/* ---------- hero: seamless 3-panel triptych ---------- */
.shop-hero {
  position: relative; display: grid; grid-template-columns: repeat(var(--panels, 3), minmax(0, 1fr)); grid-template-rows: minmax(0, 1fr); gap: 1px;
  height: min(80vh, 720px); min-height: 420px; background: var(--nk-line); overflow: hidden;
}
.shop-hero::before { /* keeps the transparent header legible */
  content: ""; position: absolute; inset: 0 0 auto; height: 190px; z-index: 3; pointer-events: none;
  background: linear-gradient(rgba(22, 24, 26, .42), rgba(22, 24, 26, 0));
}
.shop-hero__panel {
  position: relative; display: block; overflow: hidden; container-type: size;
  background: var(--panel-color, #8c8a84); color: #fff;
}
.shop-hero__panel::before { /* soft floor shade for the caption */
  content: ""; position: absolute; inset: auto 0 0; height: 40%; z-index: 2; pointer-events: none; opacity: 0;
  background: linear-gradient(rgba(22, 24, 26, 0), rgba(22, 24, 26, .38)); transition: opacity .6s var(--ease);
}
.shop-hero__panel::after { /* colour curtain that lifts to reveal the photograph, panel by panel */
  content: ""; position: absolute; inset: 0; z-index: 2; background: var(--panel-color, #8c8a84);
  transform-origin: 50% 0; animation: shop-curtain 1.3s var(--ease-out) calc(.15s + var(--d, 0s)) both;
}
.shop-hero__media { position: absolute; inset: 0; animation: shop-settle 2.6s var(--ease-out) var(--d, 0s) both; }
.shop-hero__img {
  width: 100%; height: 100%; object-fit: cover;
  animation: shop-drift-a 34s ease-in-out 0s infinite alternate both; will-change: transform;
}
.shop-hero__panel:nth-child(2) .shop-hero__img { animation-name: shop-drift-b; animation-duration: 38s; }
.shop-hero__panel:nth-child(3) .shop-hero__img { animation-name: shop-drift-c; animation-duration: 31s; }
.shop-hero__caption {
  position: absolute; left: 24px; bottom: 22px; z-index: 3; max-width: calc(100% - 48px);
  font: 400 14px/1.35 var(--sans); letter-spacing: .12em; text-transform: uppercase; text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(8px); transition: opacity .45s var(--ease), transform .6s var(--ease-out);
}
.shop-hero__caption::after { content: ""; display: block; height: 1px; margin-top: 8px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform .8s var(--ease-out) .1s; }
.shop-hero__panel:hover::before, .shop-hero__panel:focus-visible::before { opacity: 1; }
.shop-hero__panel:hover .shop-hero__caption, .shop-hero__panel:focus-visible .shop-hero__caption { opacity: 1; transform: none; }
.shop-hero__panel:hover .shop-hero__caption::after, .shop-hero__panel:focus-visible .shop-hero__caption::after { transform: scaleX(1); }
.shop-hero__panel:focus-visible { outline: 1px solid #fff; outline-offset: -6px; }
/* triptych only (phones restyle the caption below). Landscape phones: the outer captions and the pause
   button stay clear of the safe-area insets */
@media (min-width: 768px) {
  .shop-hero__panel:first-child .shop-hero__caption { left: max(24px, var(--safe-l, 0px)); max-width: calc(100% - 24px - max(24px, var(--safe-l, 0px))); }
  .shop-hero__panel:nth-last-child(2) .shop-hero__caption { /* clear of the pause button */
    max-width: calc(100% - 66px - max(24px, var(--safe-l, 0px)) - max(14px, var(--safe-r, 0px)));
  }
}

/* pause / play for the slow zoom drift (WCAG 2.2.2); remembered per visitor by shop.js */
.shop-hero__toggle {
  position: absolute; z-index: 4; right: max(14px, var(--safe-r, 0px)); bottom: 14px; display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 50%; background: rgba(22, 24, 26, .5); color: #fff; opacity: .85; transition: opacity .2s, background-color .2s;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.shop-hero__toggle:hover, .shop-hero__toggle:focus-visible { opacity: 1; background: rgba(22, 24, 26, .7); }
.shop-hero__toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.shop-hero__icon { width: 13px; height: 13px; }
.shop-hero__icon--play, .shop-hero.is-motion-paused .shop-hero__icon--pause { display: none; }
.shop-hero.is-motion-paused .shop-hero__icon--play { display: block; }
.shop-hero.is-motion-paused .shop-hero__img { animation-play-state: paused; }

/* notecards & other small originals: the artwork hangs on a tinted wall instead of being cropped */
.shop-hero__panel--hang { background: color-mix(in srgb, var(--panel-color, #8c8a84) 58%, #3c403e); }
.shop-hero__panel--hang .shop-hero__media { display: grid; place-items: center; }
.shop-hero__hang {
  display: block; aspect-ratio: var(--hang-ratio, .75); width: min(50cqw, calc(62cqh * var(--hang-ratio, .75)));
  margin-top: 6cqh; box-shadow: 0 2px 3px rgba(0, 0, 0, .18), 0 26px 40px -18px rgba(0, 0, 0, .55);
}
.shop-hero__panel--hang .shop-hero__img { animation: none; }

@keyframes shop-curtain { from { transform: scaleY(1); } to { transform: scaleY(0); } }
@keyframes shop-settle { from { transform: scale(1.1); } to { transform: none; } }
@keyframes shop-drift-a { from { transform: scale(1.02) translate3d(0, 0, 0); } to { transform: scale(1.12) translate3d(-2%, -1.5%, 0); } }
@keyframes shop-drift-b { from { transform: scale(1.1) translate3d(1.5%, 1%, 0); } to { transform: scale(1.02) translate3d(-1%, 0, 0); } }
@keyframes shop-drift-c { from { transform: scale(1.03) translate3d(-1%, 1%, 0); } to { transform: scale(1.12) translate3d(2%, -1%, 0); } }

/* ---------- sticky toolbar ----------
   Side padding never drops below the safe-area insets (landscape iPhones lay the page under the sensor housing). */
.shop-toolbar {
  position: sticky; top: var(--header-offset, 0px); z-index: 700; background: var(--nk-bg);
  transition: top .45s var(--ease-out);
}
.shop-toolbar__main {
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 16px;
  min-height: 90px; padding: 0 max(28px, var(--safe-r, 0px)) 0 max(28px, var(--safe-l, 0px)); border-bottom: 1px solid var(--nk-line);
}
.shop-toolbar__tools { display: flex; align-items: center; }
.shop-toolbar__grid { display: flex; gap: 8px; }
.shop-toolbar__grid-btn {
  display: grid; place-items: center; width: 40px; height: 40px; color: var(--nk-ink); opacity: .7; transition: opacity .2s;
  background: linear-gradient(currentColor, currentColor) 50% calc(100% - 3px) / 0 1px no-repeat;
}
.shop-toolbar__grid-btn .icon { width: 18px; height: 18px; }
.shop-toolbar__grid-btn:hover { opacity: .9; }
.shop-toolbar__grid-btn[aria-pressed="true"] { opacity: 1; background-size: 18px 1px; }
.shop-toolbar__divider { width: 1px; height: 24px; margin: 0 20px 0 14px; background: var(--nk-line-strong); }
.shop-toolbar__filter { min-height: 44px; padding: 10px 0; font-size: 14px; letter-spacing: .1em; white-space: nowrap; }
.shop-toolbar__filter .icon { width: 16px; height: auto; }
.shop-toolbar__filter-num { display: none; }
.shop-toolbar__active {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--nk-ink); color: var(--nk-bg);
  font: 600 12px/20px var(--sans); letter-spacing: 0; text-align: center;
}
.shop-toolbar__title { text-align: center; padding: 6px 0; font: 400 clamp(26px, 2.4vw, 30px)/1.15 var(--serif-store); letter-spacing: 0; text-wrap: balance; }
.shop-toolbar__count { justify-self: end; font: 400 15px/1.2 var(--sans); letter-spacing: 1.2px; white-space: nowrap; }
html:not(.js) .shop-toolbar__tools, html:not(.js) .shop-toolbar__count { visibility: hidden; }

.shop-pills { border-bottom: 1px solid var(--nk-line); }
.shop-pills__list {
  position: relative; display: flex; gap: 32px; padding: 16px max(28px, var(--safe-r, 0px)) 15px max(28px, var(--safe-l, 0px)); overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
}
.shop-pills__list::-webkit-scrollbar { display: none; }
.shop-pills__list li { flex: none; }
.shop-pills__list li:first-child { margin-left: auto; }
.shop-pills__list li:last-child { margin-right: auto; }
.shop-pill {
  display: inline-block; padding: 4px 0; font: 400 15px/1.35 var(--sans-store); letter-spacing: .06em; white-space: nowrap;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size .35s var(--ease);
}
.shop-pill:hover, .shop-pill.is-active { background-size: 100% 1px; }

/* ---------- hairline grid ---------- */
.shop-grid { padding: 0 var(--safe-r, 0px) 0 var(--safe-l, 0px); } /* edge cards (and their text) clear the notch in landscape */
.product-list {
  --cols: 1;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 1px;
  padding: 1px 0; background: var(--nk-line);
}
.product-list[data-grid="small"] { --cols: 2; }
.product-list__filler { background: var(--nk-bg); }

/* small cards: info stacks; type stays at the 13px floor and titles may take two lines */
.product-list[data-grid="small"] .product-card__info { flex-direction: column; gap: 8px; padding: 12px 12px 16px; }
.product-list[data-grid="small"] .product-card__meta { justify-items: start; text-align: left; gap: 6px; }
.product-list[data-grid="small"] .product-card__vendor { font-size: 13px; letter-spacing: .1em; }
.product-list[data-grid="small"] .product-card__title {
  font-size: 13px; line-height: 1.35; letter-spacing: .08em;
  white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden;
}
.product-list[data-grid="small"] .product-card__price { font-size: 14px; letter-spacing: .08em; }
.product-list[data-grid="small"] .product-card__note { font-size: 13px; white-space: normal; }
.product-list[data-grid="small"] .swatch { width: 12px; height: 12px; }
.product-list[data-grid="small"] .product-card__swatches { gap: 4px; }
.product-list[data-grid="small"] .product-card__badge { top: 8px; left: 8px; font-size: 12px; letter-spacing: .08em; padding: 5px 7px 4px; }
.product-list[data-grid="small"] .product-card__quick { top: 4px; right: 4px; width: 36px; height: 36px; }

/* reveal: cards that start below the fold float in as they arrive (shop.js adds the classes) */
.product-card.is-pending .product-card__hang { opacity: 0; transform: translate3d(0, 22px, 0) scale(.97); }
.product-card.is-pending .product-card__info { opacity: 0; }
.product-card.is-in .product-card__hang { transition: opacity 1s var(--ease) var(--d, 0s), transform 1.4s var(--ease-out) var(--d, 0s); }
.product-card.is-in .product-card__info { transition: opacity 1s var(--ease) calc(var(--d, 0s) + .15s); }

.shop-empty, .shop-searching { padding: 96px 24px; text-align: center; border-top: 1px solid var(--nk-line); border-bottom: 1px solid var(--nk-line); }
.shop-searching { font: italic 400 19px/1.5 var(--sans-store); color: var(--nk-muted); }
.shop-empty__title { margin-bottom: 26px; font: 400 25px/1.3 var(--serif-store); }

/* ---------- collection intro + back to top ---------- */
.shop-intro { max-width: 700px; margin: 0 auto; padding: 64px 24px 0; text-align: center; }
.shop-intro__title { margin-bottom: 16px; font: 400 14px/1.4 var(--sans); letter-spacing: .12em; text-transform: uppercase; }
.shop-intro__text { font: 400 17px/1.75 var(--sans-store); letter-spacing: .01em; color: var(--nk-muted); }
.shop-intro__meta { margin-top: 14px; font: italic 400 15px/1.6 var(--sans-store); color: var(--nk-muted); }
.shop-top { padding: 40px 24px 56px; text-align: center; }
.shop-top a {
  display: inline-block; padding: 10px 4px; font: 400 14px/1.2 var(--sans); letter-spacing: .12em; text-transform: uppercase;
  text-decoration: underline; text-underline-offset: 6px; text-decoration-thickness: 1px;
}
.shop-top a:hover { text-decoration-color: transparent; }

/* ---------- Filter & Sort drawer ---------- */
.filter-drawer .nk-drawer__panel { width: min(480px, 100vw); }
.filter-form.nk-accordion { border-top: 0; }
.filter-form details { border-bottom-color: var(--nk-line); }
.filter-form summary { padding: 22px 0; font-size: 14px; letter-spacing: .12em; }
.filter-opts { display: grid; gap: 16px; min-width: 0; margin: 0; padding: 2px 0 24px; border: 0; }
.filter-opts--swatches { grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.filter-opt { position: relative; display: flex; align-items: center; gap: 14px; min-height: 28px; cursor: pointer; font: 400 16px/1.35 var(--sans-store); letter-spacing: .01em; }
.filter-opt input { position: absolute; width: 1px; height: 1px; opacity: 0; margin: 0; }
.filter-opt__box { flex: none; width: 18px; height: 18px; border: 1px solid var(--nk-ink); transition: background-color .2s, box-shadow .2s; }
.filter-opt--radio .filter-opt__box { border-radius: 50%; }
.filter-opt input:checked + .filter-opt__box { background: var(--nk-ink); box-shadow: inset 0 0 0 3px var(--nk-bg); }
.filter-opt__swatch { flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--swatch); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); transition: box-shadow .2s; }
.filter-opt input:checked + .filter-opt__swatch { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--nk-bg), 0 0 0 3px var(--nk-ink); }
.filter-opt input:focus-visible + span { outline: 1px solid var(--nk-ink); outline-offset: 4px; }
.filter-opt input:checked ~ .filter-opt__label { text-decoration: underline; text-underline-offset: 4px; }
.filter-opt__count { color: var(--nk-muted); font-size: 14px; }
.filter-opt__count::before { content: "("; }
.filter-opt__count::after { content: ")"; }
.filter-opt:hover .filter-opt__label { text-decoration: underline; text-underline-offset: 4px; }
.filter-search {
  width: 100%; height: 48px; margin-bottom: 4px; padding: 0; border: 0; border-bottom: 1px solid var(--nk-ink); border-radius: 0;
  background: transparent; font: 400 16px/1 var(--sans-store); -webkit-appearance: none; appearance: none;
}
.filter-search::placeholder { color: var(--nk-muted); opacity: 1; } /* 5.1:1 — the only visible prompt */
.filter-search:focus-visible { outline: none; border-bottom-width: 2px; }
.filter-drawer__foot { display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 12px; }
.filter-drawer__foot .nk-btn { min-height: 52px; padding: 6px 16px; font-size: 14px; letter-spacing: .1em; }

/* ---------- responsive ---------- */
@media (min-width: 700px) {
  .product-list { --cols: 2; }
  .product-list[data-grid="small"] { --cols: 4; }
}
@media (min-width: 1000px) {
  .product-list { --cols: 3; }
  .product-list[data-grid="small"] { --cols: 7; }
}
@media (min-width: 1200px) {
  .shop-pill { font-size: 16px; }
  .shop-pills__list { gap: 36px; }
}

/* tablets & phones: compact two-row toolbar so the larger title never collides with the tools
   row 1: title ........ Filter & Sort (63)   ·   row 2: category pills (scroll) | grid toggle */
@media (max-width: 999px) {
  .shop-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .shop-toolbar__main, .shop-toolbar__tools { display: contents; }
  .shop-toolbar__divider { display: none; }
  /* the count stays in the accessibility tree: it is the role="status" that announces filter results */
  .shop-toolbar__count {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
  }
  .shop-toolbar__title {
    grid-row: 1; grid-column: 1; display: flex; align-items: center; min-width: 0; min-height: 72px;
    padding: 12px 12px 12px max(20px, var(--safe-l, 0px)); border-bottom: 1px solid var(--nk-line); text-align: left; font-size: 27px;
  }
  .shop-toolbar__filter {
    grid-row: 1; grid-column: 2; align-self: stretch; gap: 8px; padding: 0 max(20px, var(--safe-r, 0px)) 0 8px; border-bottom: 1px solid var(--nk-line);
  }
  .shop-toolbar__filter-num { display: inline; }
  .shop-pills { grid-row: 2; grid-column: 1; min-width: 0; }
  /* the pills are the category navigation here (the header's category row is hidden): 44px-tall
     targets, and a soft fade on whichever edge has more pills, so the sideways scroll is discoverable */
  .shop-pills__list {
    gap: 28px; padding: 6px 20px 5px max(20px, var(--safe-l, 0px)); scroll-padding-inline: 48px;
    scrollbar-width: thin; scrollbar-color: var(--nk-line-strong) transparent;
  }
  .shop-pills__list::-webkit-scrollbar { display: block; height: 3px; }
  .shop-pills__list::-webkit-scrollbar-thumb { background: var(--nk-line-strong); }
  .shop-pills__list.is-more-end { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 64px), transparent); }
  .shop-pills__list.is-more-start { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 64px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 64px), transparent); }
  .shop-pills__list.is-more-start.is-more-end {
    -webkit-mask-image: linear-gradient(to right, transparent, #000 64px, #000 calc(100% - 64px), transparent);
    mask-image: linear-gradient(to right, transparent, #000 64px, #000 calc(100% - 64px), transparent);
  }
  .shop-pills__list li:first-child { margin-left: 0; }
  .shop-pill { padding: 12px 0; background-position: 0 calc(100% - 8px); }
  .shop-toolbar__grid {
    grid-row: 2; grid-column: 2; align-items: center; gap: 2px; padding: 0 max(12px, var(--safe-r, 0px)) 0 8px;
    border-left: 1px solid var(--nk-line); border-bottom: 1px solid var(--nk-line);
  }
  .shop-toolbar__grid-btn { width: 44px; height: 44px; }
}
@media (max-width: 699px) {
  .shop-toolbar__title { min-height: 64px; padding: 10px 10px 10px max(16px, var(--safe-l, 0px)); font-size: 23px; }
  .shop-toolbar__filter { padding: 0 max(16px, var(--safe-r, 0px)) 0 6px; }
  .shop-pills__list { gap: 24px; padding: 5px 16px 4px max(16px, var(--safe-l, 0px)); }
  .shop-toolbar__grid { padding: 0 max(6px, var(--safe-r, 0px)) 0 2px; }

  /* one-up cards get a squarer wall so the painting reads larger */
  .product-list[data-grid="large"] .product-card__figure,
  .product-list[data-grid="large"] .product-card__title a::after { aspect-ratio: 1 / 1; }
  .product-list[data-grid="small"] .product-card__info { padding: 10px 10px 14px; }
  .product-list[data-grid="small"] .product-card__vendor { display: none; }

  .shop-intro { padding-top: 48px; }
  .filter-opts--swatches { grid-template-columns: 1fr; }
}
@media (max-width: 420px) {
  .shop-toolbar__amp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; } /* "Filter (63)", still read as "Filter & Sort" */
  .shop-toolbar__title { padding-right: 8px; font-size: 21px; }
  .shop-toolbar__filter { padding: 0 max(14px, var(--safe-r, 0px)) 0 4px; }
  .filter-drawer__foot .nk-btn { padding: 6px 12px; }
}

/* phones: one room image, shown whole at its natural ratio (never cover-cropped, no zoom drift).
   It sits on a mat of its own wall colour, below the transparent header (--shop-hero-top is the
   header height, set by shop.js) with the caption underneath instead of over the picture. */
@media (max-width: 767px) {
  .shop-hero { display: block; height: auto; min-height: 0; background: none; }
  .shop-hero::before { display: none; }
  .shop-hero__panel:nth-child(n + 2) { display: none; }
  .shop-hero__panel {
    container-type: normal; padding-top: var(--shop-hero-top, 58px);
    background: color-mix(in srgb, var(--panel-color, #8c8a84) 40%, #2f3335);
  }
  .shop-hero__panel::before { display: none; }
  .shop-hero__media { position: relative; inset: auto; display: block; animation: none; }
  .shop-hero__img {
    width: 100%; height: auto; max-height: 80vh; max-height: 80svh; object-fit: contain; animation: none; will-change: auto;
  }
  .shop-hero__caption {
    position: static; display: block; max-width: none; opacity: 1; transform: none; text-shadow: none;
    padding: 14px max(16px, var(--safe-r, 0px)) 16px max(16px, var(--safe-l, 0px));
  }
  .shop-hero__toggle { display: none; }
  .shop-hero__caption::after { display: none; }

  .shop-hero__panel--hang { container-type: size; height: calc(var(--shop-hero-top, 58px) + 52px + 84vw); padding-bottom: 52px; }
  .shop-hero__panel--hang .shop-hero__caption { position: absolute; left: 0; right: 0; bottom: 0; }
  .shop-hero__panel--hang .shop-hero__media {
    position: absolute; inset: var(--shop-hero-top, 58px) 0 52px; display: grid;
    background: color-mix(in srgb, var(--panel-color, #8c8a84) 58%, #3c403e);
  }
  .shop-hero__panel--hang .shop-hero__hang { width: min(62cqw, calc(80cqh * var(--hang-ratio, .75))); margin-top: 0; }
  .shop-hero__panel--hang .shop-hero__img { height: 100%; max-height: none; }
}
@media (prefers-reduced-motion: reduce) {
  .shop-hero__panel::after { display: none; }
  .shop-hero__media, .shop-hero__img { animation: none; }
  .shop-hero__toggle { display: none; }
}
