/* The rounded frame never scrolls; only the content inset inside it does. */
:is(#product-dialog, #promotion-dialog, #notification-terms-dialog, #pickup-location-dialog, #team-bio-dialog) {
  --dialog-height: 90vh;
  --dialog-height: 90dvh;
  max-height: var(--dialog-height);
  /* Reserve the inset on the frame itself so native scrollbars cannot reach
     its corners, including browsers that paint a square scrollbar track. */
  padding: 12px 8px 12px 0;
  overflow: hidden;
  clip-path: inset(0 round var(--radius-panel, 24px));
}

#promotion-dialog,
#notification-terms-dialog {
  background: var(--cream);
}

:is(#product-dialog, #promotion-dialog, #notification-terms-dialog, #pickup-location-dialog, #team-bio-dialog)
  > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout) {
  max-height: calc(var(--dialog-height) - 24px);
  margin: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #9c90a0 transparent;
}

dialog > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout)::-webkit-scrollbar {
  width: 8px;
}

dialog > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout)::-webkit-scrollbar-track {
  background: transparent;
}

dialog > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout)::-webkit-scrollbar-thumb {
  background: #9c90a0;
  border: 2px solid transparent;
  border-radius: 999px;
  background-clip: padding-box;
}

dialog > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout)::-webkit-scrollbar-button {
  display: none;
}

/* Keep dismissal reachable while reading the bottom of a long popup. */
dialog .dialog-close,
#pickup-location-dialog .pickup-close {
  position: absolute;
  float: none;
  top: 12px;
  right: 16px;
  margin: 0;
  z-index: 3;
}

html:has(dialog[open]) { overflow: hidden; }

@media (forced-colors: active) {
  dialog > :is(#product-content, .promotion-copy, #pickup-location-content, .team-bio-layout) {
    scrollbar-color: auto;
  }
}
