/* =============================================
   shop.css — Shop page (shop.html) only
   Loaded after style.css and home.css; relies on home.css for the
   tokens, type, buttons, header and footer (body.h-home) and scopes
   its own layout to body.h-shop.

   Stanley's shop-all page, sized for a small catalogue: a "Shop by
   size" strip in place of "Shop by color", breadcrumb + title + count,
   and roomy cards — no filter or sort for three products.
   ============================================= */

/* Current page in the header */
.h-home .nav-links a[aria-current="page"]::after { transform: scaleX(1); }

/* ═══════════════════════════════════════════════
   1. SHOP BY SIZE
═══════════════════════════════════════════════ */
.s-sizes { padding-block: clamp(40px, 5vw, 72px) 0; }

.s-sizes-grid {
  display: grid;
  grid-template-columns: minmax(200px, 1fr) 3fr;
  gap: 24px 32px;
  align-items: start;
}
.s-sizes-head {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.s-size-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.s-size-tile > a {
  display: block;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s var(--ease-out);
}
.s-size-tile > a:active { transform: scale(0.985); }
.s-size-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--peach);
}
.s-size-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s var(--ease-out);
}
.s-size-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-top: 14px;
}
.s-size-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.015em;
}
.s-size-price {
  font-size: 15px;
  color: var(--ink-2);
  white-space: nowrap;
}

/* ═══════════════════════════════════════════════
   2. ALL PRODUCTS
═══════════════════════════════════════════════ */
.s-catalog { padding-block: clamp(56px, 7vw, 104px) clamp(72px, 8vw, 120px); }

.s-crumbs ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.s-crumbs li + li::before {
  content: '/';
  margin-right: 8px;
  opacity: 0.6;
}
.s-crumbs a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.s-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.s-title {
  font-family: var(--font-display);
  font-size: clamp(36px, 4.4vw, 60px);
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.03em;
}
.s-count {
  font-size: 14px;
  color: var(--ink-2);
  white-space: nowrap;
}

.s-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 40px 20px;
  margin-top: 32px;
}

/* ─── Card ───
   Five rows — photo, sizes, name + description, price, button — shared
   across the whole grid row (subgrid), so every card's sizes, prices and
   buttons sit on the same lines however long its text is. Without
   subgrid, a column that pins price and button to the bottom. */
.s-card { display: flex; flex-direction: column; }
@supports (grid-template-rows: subgrid) {
  .s-grid { row-gap: 0; }
  .s-card {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
    row-gap: 0;
    padding-bottom: 44px;
  }
  .s-card-meta { display: contents; }
}

.s-card-media {
  position: relative;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--tile);
}
.s-card-media > a { position: absolute; inset: 0; display: block; }
.s-card-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: transform 0.7s var(--ease-out);
}
/* Same dissolve as "Find your size": incoming photo fades up over the outgoing one */
.s-card-media img.is-prev { opacity: 1; z-index: 1; }
.s-card-media img.is-active {
  opacity: 1;
  z-index: 2;
  animation: h-dissolve 0.45s var(--ease-out) both;
}
.s-card-media img.is-static { animation: none; }
.s-card.is-soon .s-card-media img { filter: saturate(0.85); }

.s-card-badges {
  position: absolute;
  z-index: 3;
  top: 12px;
  left: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: none;
}
.s-card-badges span {
  padding: 6px 11px;
  border-radius: var(--radius-btn);
  background: rgba(252, 249, 245, 0.9);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink);
}

.s-card-fave {
  position: absolute;
  z-index: 3;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(252, 249, 245, 0.9);
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
  color: var(--ink);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.16s var(--ease-out), color 0.2s ease;
}
.s-card-fave:active { transform: scale(0.9); }
.s-card-fave svg { transition: fill 0.2s ease, transform 0.3s var(--ease-out); }
.s-card-fave.is-on { color: var(--oxblood); }
.s-card-fave.is-on svg { fill: currentColor; animation: s-pop 0.35s var(--ease-out); }
@keyframes s-pop { 40% { transform: scale(1.25); } }

.s-card-meta {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Size chips — Stanley's colour swatches, as bottle sizes */
.s-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 0;
  margin: 16px 0 0;
  padding: 0;
  border: 0;
  list-style: none;
}
.s-chip { position: relative; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.s-chip input { position: absolute; opacity: 0; pointer-events: none; }
.s-chip span {
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
  transition: border-color 0.2s ease, background-color 0.2s ease, color 0.2s ease, transform 0.16s var(--ease-out);
}
.s-chip:active span { transform: scale(0.95); }
.s-chip input:checked + span {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}
.s-chip input:focus-visible + span { outline: 2px solid var(--oxblood); outline-offset: 2px; }
/* Coming soon: the sizes it will come in, as plain pills (not choosable yet) */
.s-chips-static span {
  display: grid;
  place-items: center;
  height: 32px;
  padding: 0 12px;
  border: 1px dashed rgba(28, 22, 19, 0.22);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-2);
}

.s-card-text { margin-top: 16px; }

.s-card-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.015em;
}
.s-card-name a { color: inherit; }
.s-card-desc {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 6px;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-2);
}

.s-card-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-top: auto;
  padding-top: 18px;
  font-size: 18px;
  font-weight: 500;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
}
.s-card-size { font-size: 14px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); }
.s-card-soon { color: var(--ink-2); } /* same size as a price, so the rows share a baseline */

.s-card-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 14px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius-btn);
  background: var(--oxblood);
  color: #fff;
  font-family: var(--font-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.2s ease, transform 0.16s var(--ease-out);
}
.s-card-btn:active { transform: scale(0.97); }
.s-card.is-soon .s-card-btn {
  background: none;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

@media (hover: hover) and (pointer: fine) {
  .s-size-tile > a:hover .s-size-media img,
  .s-card:not(.is-soon) .s-card-media:hover img.is-active { transform: scale(1.035); }
  .s-card-name a:hover { text-decoration: underline; text-underline-offset: 3px; }
  .s-chip:hover input:not(:checked) + span { border-color: var(--ink-2); color: var(--ink); }
  .s-card-btn:hover { background: var(--oxblood-hi); }
  .s-card.is-soon .s-card-btn:hover { background: var(--ink); color: var(--paper); }
  .s-card-fave:hover { color: var(--oxblood); }
}

/* ═══════════════════════════════════════════════
   3. MORE ON THE WAY
═══════════════════════════════════════════════ */
.s-soon {
  background: var(--tile);
  padding-block: clamp(64px, 7vw, 104px);
}
.s-soon-inner {
  display: grid;
  justify-items: center;
  gap: 14px;
  text-align: center;
}
.s-soon-inner .h-sub { max-width: 42ch; }
.s-soon-inner .h-btn { margin-top: 12px; }

/* ═══════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════ */
@media (max-width: 1024px) {
  .s-sizes-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  /* Size tiles: a swipeable row that bleeds to the screen edge */
  .s-size-tiles {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 72%;
    gap: 12px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter);
    margin-inline: calc(var(--gutter) * -1);
    padding-inline: var(--gutter);
    scrollbar-width: none;
  }
  .s-size-tiles::-webkit-scrollbar { display: none; }
  .s-size-tile { scroll-snap-align: start; }

  /* Cards: the available product full width, coming-soon pair side by side */
  .s-grid { grid-template-columns: repeat(2, 1fr); gap: 32px 12px; }
  /* No subgrid on phones: Safari can size the photo's row shorter than the
     photo, which then covers the button. The lone full-width card has no
     neighbour to align with, so each card is a plain column here. */
  .s-card,
  .s-card-meta { display: flex; flex-direction: column; }
  .s-card { grid-row: auto; padding-bottom: 0; }
  .s-card-meta { flex: 1; }
  .s-card:not(.is-soon) { grid-column: 1 / -1; }
  .s-card.is-soon .s-card-name { font-size: 18px; }
  .s-card.is-soon .s-card-desc { display: none; }
  .s-head { flex-direction: column; gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .s-card-media img.is-active { animation: h-fade 0.3s ease both; }
  .s-card-media img,
  .s-size-media img { transition: none; }
  .s-card-fave.is-on svg { animation: none; }
}
