.product { max-width: 1200px; padding-top: clamp(20px, 4vw, 44px); }
.product-back { margin-bottom: 15px; }
.product-back a { color: var(--accent); text-underline-offset: 4px; font-size: .875rem; display: inline-flex; align-items: center; min-height: 44px; }
.product-back span { margin-right: 7px; }
.product-layout {
  display: grid;
  grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
  grid-template-rows: max-content 1fr;
  grid-template-areas: "gallery heading" "gallery facts";
  column-gap: clamp(24px, 6vw, 80px);
  align-items: start;
}
.product-heading { grid-area: heading; }
.product-heading h1 {
  margin: 6px 0;
  font: 700 clamp(2.75rem, 6vw, 5.5rem)/.95 var(--font-pixel);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.product-meta, .product-availability { color: var(--muted); font-size: .875rem; line-height: 1.45; }
.product-meta { margin: 0; }
.product-price { font-size: 1.125rem; color: var(--accent); margin: 14px 0; }
.product-order-jump { display: none; }
.product-gallery {
  grid-area: gallery;
  display: flex;
  flex-direction: column;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--panel);
  position: relative;
}
.product-gallery .plate { width: min(100%, 370px); margin-inline: auto; }
.gallery-controls { border-top: 1px solid var(--line); flex-wrap: wrap; }
.gallery-controls .inspect {
  display: grid;
  justify-items: center;
  gap: 5px;
  padding: 4px 7px;
  min-width: 60px;
  font-size: .75rem;
}
.product-gallery .gallery-controls .plate {
  display: block;
  width: 38px;
  aspect-ratio: 1;
  overflow: hidden;
}
.gallery-controls .plate.has-photo img { object-fit: cover; }
@media (min-width: 900px) {
  .product-gallery:has(.gallery-controls:not([hidden])) {
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    grid-template-rows: auto auto;
    align-items: start;
  }
  .product-gallery > #piece-photo { grid-area: 1 / 2; width: min(100%, 390px, calc((100dvh - 180px) / 1.65)); }
  .product-gallery > .photo-caption { grid-area: 2 / 2; }
  .product-gallery > .gallery-controls {
    grid-area: 1 / 1 / 3;
    flex-direction: column;
    justify-content: flex-start;
    align-self: stretch;
    align-items: center;
    flex-wrap: nowrap;
    border-top: 0;
    border-inline-end: 1px solid var(--line);
  }
  .product-gallery:has(.gallery-controls[hidden]) > #piece-photo { width: min(100%, 390px, calc((100dvh - 180px) / 1.65)); }
}
.photo-caption { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 2px 10px; }
.photo-enlarge { margin-inline-start: auto; border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
#gallery-dialog {
  width: min(600px, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--snow);
}
#gallery-dialog[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
#gallery-dialog::backdrop { background: #090d15db; }
body:has(#gallery-dialog[open]) { overflow: hidden; }
.gallery-dialog-head, .gallery-dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.gallery-dialog-head { flex-wrap: wrap; }
.gallery-dialog-head > div { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery-dialog-head h2 { margin: 0; overflow-wrap: anywhere; font: 700 1.25rem/1.15 var(--font-pixel); }
.large-photo-scroll { margin-block: 8px; min-height: 0; max-height: calc(100dvh - 154px); overflow: auto; }
.large-photo-scroll:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#large-photo { width: min(100%, 530px, calc((100dvh - 154px) / 1.65)); margin-inline: auto; }
.large-photo-scroll.is-zoomed #large-photo { width: max(135%, 490px); margin-inline: 0; }
#zoom-photo.is-zoomed { background: var(--accent); color: var(--ink); }
#large-photo img { object-fit: contain; }
#large-photo[data-view="back"] { background-image: url('/assets/delirix-garment-backs.jpg'); }
#large-photo[data-view="detail"] { background-size: 540% auto; background-position-y: 56%; }
.gallery-dialog-actions span { font-variant-numeric: tabular-nums; }
.image-provenance { margin: 0; color: var(--muted); font-size: .8125rem; }
.size-chart { margin-block: 16px; }
.size-chart table { width: 100%; border-collapse: collapse; text-align: left; font-size: .875rem; }
.size-chart caption { text-align: left; font-weight: 700; margin-bottom: 8px; }
.size-chart :is(th, td) { padding: 8px; border-bottom: 1px solid var(--line); }
.size-chart thead th { text-transform: capitalize; background: var(--panel); }
.size-chart .product-meta { margin-top: 10px; }
.piece-facts {
  grid-area: facts;
  border-top: 1px solid var(--line);
  padding-top: 18px;
  min-width: 0;
}
.piece-about { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
#fit-summary { max-width: 55ch; color: var(--snow); }
#size-guide { margin-block: 8px 12px; border-bottom: 1px solid var(--line); }
#size-guide summary { min-height: 44px; align-content: center; font-weight: 700; cursor: pointer; }
.piece-facts h2 { margin: 0 0 8px; font-size: 1.25rem; }
.piece-facts p { line-height: 1.55; overflow-wrap: anywhere; }
.piece-facts form { display: grid; gap: 12px; }
.piece-facts .inspect.primary { font: 700 1rem/1.25 Arial, Helvetica, sans-serif; }
#pick-size { margin: 0; padding: 0; border: 0; min-width: 0; }
#pick-size legend { margin-bottom: 8px; font-weight: 700; }
#size-options { display: flex; flex-wrap: wrap; gap: 7px; }
#size-options label { display: grid; position: relative; cursor: pointer; }
#size-options input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
#size-options span {
  display: grid;
  place-items: center;
  min-width: 48px;
  min-height: 44px;
  max-width: 100%;
  padding-inline: 10px;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  color: var(--snow);
  background: var(--panel);
  border: 1px solid var(--line);
}
#size-options input:checked + span { background: var(--accent); color: var(--ink); border-color: var(--accent); }
#size-options input:focus-visible + span, #size-guide summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
#size-error { margin: 8px 0 0; color: #ffcbc4; font-size: .875rem; }
#size-error:empty { display: none; }
.related-pieces { display: block; margin-top: 50px; padding-top: 22px; border-top: 1px solid var(--line); }
.related-pieces h2 { margin-top: 0; font-size: 1.28rem; }
.related-pieces ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0;
  padding: 0;
}
.related-pieces a {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  text-underline-offset: 4px;
}
.related-pieces .plate { flex: 0 0 54px; }
.related-pieces a > div:not(.plate) { display: grid; gap: 4px; padding: 8px 8px 8px 0; overflow-wrap: anywhere; }
.related-pieces a small { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (max-width: 767px) {
  .product-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "heading" "gallery" "facts";
    gap: 18px;
  }
  .product-gallery .plate { width: min(100%, 210px); }
  .product-order-jump { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; color: var(--accent); font-size: .875rem; text-underline-offset: 4px; }
  .related-pieces ul { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .product-gallery .plate { width: min(100%, 190px); }
  .size-chart :is(th, td) { padding-inline: 4px; }
  .related-pieces ul { grid-template-columns: 1fr; }
}
