/* Shared by the homepage selection and the collection pages. */
body:has(#product-dialog[open]) {
  overflow: hidden;
}

.packshot-window {
  display: block;
  position: relative;
  flex: none;
  overflow: hidden;
  aspect-ratio: var(--shot-ratio);
}

.packshot-window > img {
  position: absolute;
  inset: var(--shot-top) auto auto var(--shot-left);
  width: var(--shot-width);
  height: var(--shot-height);
  max-width: none;
  padding: 0;
  object-fit: fill;
  filter: brightness(var(--shot-brightness));
  mix-blend-mode: multiply;
}

#product-dialog {
  --dialog-paper: #f4f4ef;
  --dialog-ink: #292720;
  --dialog-muted: #625e54;
  --dialog-cocoa: #6a3e2a;
  --dialog-line: #d3cec2;
  --dialog-display: 'Bodoni Moda', Georgia, serif;
  --dialog-ease: cubic-bezier(0.22, 1, 0.36, 1);
  box-sizing: border-box;
  width: min(1050px, calc(100% - 64px));
  max-width: none;
  max-height: calc(100dvh - 48px);
  margin: auto;
  padding: 0;
  border: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--dialog-paper);
  color: var(--dialog-ink);
  font: 1rem/1.6 Manrope, Arial, sans-serif;
}

#product-dialog *, #product-dialog *::before, #product-dialog *::after {
  box-sizing: border-box;
}

#product-dialog [hidden] {
  display: none !important;
}

#product-dialog[open] {
  animation: detail-open 220ms var(--dialog-ease) both;
}

#product-dialog::backdrop {
  background: rgb(36 32 27 / 56%);
  animation: detail-backdrop 220ms ease-out both;
}

@keyframes detail-open {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes detail-backdrop {
  from { opacity: 0; }
  to { opacity: 1; }
}

#product-dialog a {
  color: inherit;
  text-underline-offset: .3em;
}

#product-dialog button {
  cursor: pointer;
  font: inherit;
  color: inherit;
}

#product-dialog a:focus-visible, #product-dialog button:focus-visible {
  outline: 2px solid var(--dialog-cocoa);
  outline-offset: 3px;
}

#product-dialog .dialog-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 26px;
  border-bottom: 1px solid var(--dialog-line);
}

#product-dialog #product-brand {
  margin: 0;
  color: var(--dialog-muted);
  font-size: .875rem;
  letter-spacing: .04em;
}

#product-dialog .close-dialog {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  font-size: .875rem;
}

#product-dialog .close-dialog span {
  font-size: 1.6rem;
  line-height: 1;
}

#product-dialog .dialog-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
}

#product-dialog .dialog-gallery {
  min-width: 0;
  padding: clamp(16px, 2.5vw, 32px);
  background: #eae8df;
}

#product-dialog .dialog-stage {
  display: grid;
  place-items: center;
  height: clamp(230px, 49dvh, 500px);
  isolation: isolate;
}

#product-dialog .dialog-stage > img, #product-dialog .gallery-thumbs button > img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  mix-blend-mode: multiply;
}

#product-dialog .dialog-stage.editorial > img, #product-dialog .gallery-thumbs button.editorial > img {
  mix-blend-mode: normal;
}

#product-dialog .dialog-stage > .packshot-window {
  width: min(84%, 410px);
}

#product-dialog .gallery-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 10px 0 0;
}

#product-dialog .gallery-controls button {
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: .875rem;
  text-decoration: underline;
  text-underline-offset: .3em;
}

#product-dialog .gallery-controls p {
  margin: 0;
  color: var(--dialog-muted);
  font-size: .875rem;
  text-align: center;
}

#product-dialog .gallery-thumbs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}

#product-dialog .gallery-thumbs button {
  display: grid;
  place-items: center;
  width: 54px;
  height: 58px;
  padding: 3px;
  border: 1px solid transparent;
  background: var(--dialog-paper);
}

#product-dialog .gallery-thumbs .packshot-window {
  width: 95%;
}

#product-dialog .gallery-thumbs button[aria-pressed='true'] {
  border-color: var(--dialog-cocoa);
}

#product-dialog .dialog-copy {
  align-self: center;
  padding: clamp(24px, 4vw, 58px);
}

#product-dialog .dialog-copy h2 {
  margin: 0 0 18px;
  font: 400 clamp(2rem, 3.8vw, 3.25rem)/1.07 var(--dialog-display);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}

#product-dialog .dialog-copy p {
  margin: 0 0 22px;
  color: var(--dialog-muted);
}

#product-dialog .dialog-copy .availability, #product-dialog .dialog-copy .archive-note {
  font-size: .875rem;
}

#product-dialog .dialog-copy .availability {
  margin: 16px 0 10px;
}

#product-dialog .dialog-copy .archive-note {
  border-inline-start: 1px solid var(--dialog-line);
  padding-inline-start: 12px;
}

#product-dialog .solid-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 10px 18px;
  background: var(--dialog-cocoa);
  color: white;
  font-size: .875rem;
  text-decoration: none;
}

#product-dialog .source-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--dialog-muted);
  font-size: .875rem;
}

@media (max-width: 700px) {
  #product-dialog {
    width: calc(100% - 20px);
    max-height: calc(100dvh - 20px);
  }

  #product-dialog .dialog-toolbar {
    padding: 7px 17px;
  }

  #product-dialog .dialog-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  #product-dialog .dialog-stage {
    height: clamp(195px, 40dvh, 350px);
  }

  #product-dialog .gallery-controls p {
    font-size: .8125rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #product-dialog[open], #product-dialog::backdrop {
    animation: none;
  }
}
