/* ==========================================================================
   Savio & Bosco · savio-bosco.html
   The page is written by site-internal/build_sb_page.py; the product dialog
   is wired by js/shop.js. Built on style.css + theme.css: the same white
   ground, hairlines and Glacial type as the rest of the site.
   ========================================================================== */

/* Page head ---------------------------------------------------------------
   The label's mark is kept small so it never competes with the house mark
   in the header above it. */
.sb-head__logo {
  display: block;
  height: clamp(2.75rem, 2.2rem + 1.6vw, 3.75rem);
  width: auto;
  margin-bottom: clamp(1.75rem, 3vw, 2.5rem);
}
.sb-facts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.75rem;
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-soft);
}
@media (min-width: 900px) { .sb-facts { justify-content: flex-end; padding-bottom: 0.4rem; } }

/* The two detail photographs ------------------------------------------- */
.sb-band { position: relative; margin: 0; overflow: hidden; background: var(--paper-2); }
.sb-band picture { display: block; }
.sb-band img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: 50% 55%;
}
@media (min-width: 700px) { .sb-band img { aspect-ratio: 16 / 7; } }
.sb-band .frame__caption { color: var(--white); }

.sb-detail { margin: 0; overflow: hidden; background: var(--paper-2); }
.sb-detail img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* The pieces ------------------------------------------------------------- */
/* The filter bar's top rule closes the heading; it needs no rule of its own. */
#pieces .section-head { border-bottom: 0; margin-bottom: 0; }

.shop {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(2rem, 4vw, 3.5rem) clamp(0.75rem, 1.6vw, 1.5rem);
  margin-top: clamp(1.5rem, 3vw, 2.5rem);
}
@media (min-width: 1100px) { .shop { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.product[hidden] { display: none; }

.product__open {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.product__media {
  position: relative;
  display: block;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--paper-2);
}
.product__img, .product__img img { display: block; width: 100%; height: 100%; }
.product__img img { object-fit: cover; transition: transform 1.1s var(--ease-out); }
.product__img--alt {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.5s var(--ease);
}
@media (hover: hover) {
  .product__open:hover .product__img--alt,
  .product__open:focus-visible .product__img--alt { opacity: 1; }
  .product__open:hover .product__img img { transform: scale(1.025); }
}

.product__meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.3rem 1rem;
  padding-top: 1rem;
}
.product__name {
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.2rem);
  letter-spacing: 0.01em;
}
.product__price {
  font-size: clamp(1rem, 0.94rem + 0.3vw, 1.2rem);
  font-variant-numeric: tabular-nums;
}
.product__colour {
  grid-column: 1 / -1;
  font-size: var(--fs-small);
  color: var(--ink-soft);
}

/* Without JavaScript there is no dialog: the details show under each piece. */
.product__detail { display: none; }
.no-js .product__detail { display: block; padding-top: 1rem; }
.product-dialog .product__detail { display: block; }

/* What the dialog shows (and the no-JS fallback above). */
.product__desc { font-size: var(--fs-body); line-height: 1.65; max-width: 44ch; }
.product__facts { margin: 1.75rem 0 0; border-top: 1px solid var(--line); }
.product__facts > div {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 0.9rem;
  border-bottom: 1px solid var(--line);
}
.product__facts dt {
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-soft);
  padding-top: 0.2rem;
}
.product__facts dd { margin: 0; font-size: var(--fs-small); line-height: 1.65; }
.product__facts dd a { text-decoration: underline; text-underline-offset: 0.25em; }
.product__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.75rem;
  margin-top: 2rem;
}

/* Product dialog --------------------------------------------------------- */
html:has(.product-dialog[open]) { overflow: hidden; }

.product-dialog {
  width: min(100vw, 72rem);
  max-width: 100vw;
  max-height: 100dvh;
  margin: auto;
  padding: 0;
  border: 0;
  background: var(--white);
  color: var(--ink);
}
.product-dialog::backdrop { background: rgba(16, 16, 17, 0.55); }
.product-dialog[open] { animation: product-in 0.45s var(--ease-out); }
@keyframes product-in { from { opacity: 0; transform: translateY(12px); } }

.product-dialog__inner { position: relative; display: grid; }
.product-dialog__close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 2;
  width: 48px;
  height: 48px;
  border: 0;
  background: rgba(255, 255, 255, 0.85);
  color: var(--ink);
  font-size: 1.75rem;
  line-height: 1;
  cursor: pointer;
}
.product-dialog__media { background: var(--paper-2); }
.product-dialog__media picture,
.product-dialog__media img { display: block; width: 100%; height: 100%; }
.product-dialog__media img { object-fit: cover; aspect-ratio: 4 / 5; }
.product-dialog__body { padding: clamp(1.75rem, 4vw, 3.5rem) var(--gutter) clamp(2rem, 4vw, 3.5rem); }
.product-dialog__title { margin-top: 1.25rem; }
.product-dialog__price {
  margin: 0.75rem 0 1.5rem;
  font-size: var(--fs-body-lg);
  font-variant-numeric: tabular-nums;
}
.product-dialog__price small {
  margin-left: 0.6rem;
  font-size: var(--fs-label);
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-soft);
}

/* On a phone the dialog fills the screen and scrolls; the close button stays
   put at the top corner instead of scrolling away with the photograph. */
@media (max-width: 899px) {
  .product-dialog { width: 100vw; height: 100dvh; }
  .product-dialog__close { position: fixed; }
}
@media (min-width: 900px) {
  .product-dialog { width: min(92vw, 72rem); max-height: 92vh; }
  .product-dialog__inner { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .product-dialog__media img { aspect-ratio: 2 / 3; max-height: 92vh; }
  .product-dialog__body { padding: clamp(3rem, 5vw, 4.5rem); align-self: center; }
}

/* How to order, sizes ---------------------------------------------------- */
.sb-steps { list-style: none; margin: 0; padding: 0; }
.sb-steps .index__meta a { text-decoration: underline; text-underline-offset: 0.3em; }
.sb-order-note { margin-top: clamp(2rem, 4vw, 3rem); font-size: var(--fs-small); max-width: 52ch; }
@media (min-width: 900px) { .sb-order-note { margin-left: auto; width: 50%; } }

.sb-sizes { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.sb-sizes table {
  width: 100%;
  min-width: 30rem;
  border-collapse: collapse;
  font-size: var(--fs-small);
  font-variant-numeric: tabular-nums;
}
.sb-sizes th, .sb-sizes td {
  padding: 0.85rem 0.75rem 0.85rem 0;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.sb-sizes thead th {
  font-size: var(--fs-label);
  font-weight: 400;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-soft);
  border-bottom-color: var(--ink);
}
.sb-sizes tbody th { font-weight: 400; }

/* Closing pair ----------------------------------------------------------- */
.sb-close { border-top: 1px solid var(--line); }
.sb-close__grid { display: grid; gap: clamp(3rem, 6vw, 4rem); }
.sb-close__links { display: flex; flex-wrap: wrap; gap: 1rem 2rem; margin-top: 1.75rem; }
@media (min-width: 900px) {
  .sb-close__grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; }
  .sb-close__grid > div + div { border-left: 1px solid var(--line); padding-left: clamp(2.5rem, 5vw, 5rem); }
  .sb-close__grid > div:first-child { padding-right: clamp(2.5rem, 5vw, 5rem); }
}

@media (prefers-reduced-motion: reduce) {
  .product__img img, .product__img--alt { transition: none; }
  .product-dialog[open] { animation: none; }
}
