.shop-colors {
  min-inline-size: 0;
  padding: 0;
  margin: 0;
  border: 0;
}

.shop-color-options {
  display: flex;
  flex-wrap: wrap;
}

.shop-color-choice {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  min-height: 44px;
  cursor: pointer;
}

.shop-color-dot {
  width: 22px;
  height: 22px;
  border: 1px solid rgb(23 38 37 / .4);
  border-radius: 50%;
  background: var(--swatch);
}

.shop-color-choice input:checked + .shop-color-dot {
  outline: 1px solid var(--red);
  outline-offset: 3px;
}

.shop-color-choice input:focus-visible + .shop-color-dot {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

.product-card .shop-color-options {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 31px);
}

.product-card .shop-color-choice {
  width: 100%;
  min-height: 34px;
}

.product-card .shop-color-dot {
  width: 16px;
  height: 16px;
}

.shop-dialog {
  position: fixed;
  width: min(800px, calc(100vw - 36px));
  max-width: none;
  max-height: calc(100dvh - 36px);
  padding: 0;
  border: 1px solid var(--ink, #252117);
  color: var(--ink, #252117);
  background: var(--paper, #f7efd9);
  font: inherit;
}

.shop-dialog::backdrop {
  background: rgba(32, 25, 19, 0.58);
}

.shop-dialog button,
.shop-dialog a {
  font: inherit;
}

.shop-dialog button:not(:disabled) {
  cursor: pointer;
}

.shop-dialog :is(button, a):focus-visible {
  outline: 2px solid var(--red, #993e30);
  outline-offset: 4px;
}

.shop-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  padding: 0;
  border: 1px solid currentColor;
  border-radius: 50%;
  color: inherit;
  background: var(--paper, #f7efd9);
  font-size: 1.6rem !important;
  line-height: 1;
}

#product-dialog > .shop-close {
  position: absolute;
  z-index: 1;
  top: 14px;
  right: 14px;
}

.shop-product-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.shop-gallery {
  min-width: 0;
  align-self: center;
  background: #eeebe3;
}

.shop-product-image {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  object-fit: contain;
  background: #eeebe3;
}

.shop-thumbnails {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

.shop-thumbnails:empty {
  display: none;
}

.shop-dialog .shop-thumbnail {
  display: grid;
  justify-items: center;
  align-content: start;
  min-width: 0;
  gap: 3px;
  padding: 4px 4px 6px;
  border: 1px solid transparent;
  color: var(--ink);
  background: var(--paper);
  font-size: 0.7rem;
  line-height: 1.15;
  text-align: center;
}

.shop-thumbnail img {
  width: min(100%, 64px);
  height: auto;
  aspect-ratio: 1;
  object-fit: cover;
}

.shop-thumbnail[aria-pressed="true"] {
  border-color: var(--red);
  font-weight: 700;
}

.shop-product-content {
  padding: 62px clamp(22px, 4vw, 48px) 36px;
  align-self: center;
}

.shop-title {
  margin: 0;
  font: 400 clamp(2.25rem, 5vw, 4rem)/0.98 var(--display, "Instrument Serif", Georgia, serif);
  letter-spacing: -0.035em;
}

.shop-title:focus {
  outline: none;
}

.shop-product-description {
  margin: 16px 0 0;
  line-height: 1.45;
}

.shop-product-content .shop-colors {
  margin-top: 16px;
}

.shop-colors legend {
  padding: 0;
  font-size: 0.86rem;
  font-weight: 700;
}

.shop-selected-color {
  margin-inline-start: 6px;
  color: var(--muted);
  font-weight: 400;
}

.shop-product-availability {
  margin: 12px 0 20px;
  font-size: 0.85rem;
}

.shop-product-actions {
  display: grid;
  gap: 8px;
}

.shop-image-credit {
  margin-top: 16px;
  font-size: 0.8rem;
  color: var(--muted, #465452);
}

.shop-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.shop-dialog .shop-action {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-sizing: border-box;
  width: 100%;
  min-height: 48px;
  padding: 11px 18px;
  border: 1px solid var(--red, #993e30);
  color: var(--paper, #f7efd9);
  background: var(--red, #993e30);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}

.shop-dialog .shop-action:not(:disabled):hover {
  background: var(--ink, #252117);
  border-color: var(--ink, #252117);
}

.shop-dialog .shop-action:disabled {
  opacity: 0.6;
}

#bag-dialog {
  inset: 0 0 0 auto;
  width: min(460px, 100vw);
  max-height: none;
  height: 100dvh;
  margin: 0;
  border-width: 0 0 0 1px;
}

.shop-bag-layout {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
}

.shop-bag-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 24px clamp(16px, 5vw, 28px);
  border-bottom: 1px solid currentColor;
}

.shop-bag-header .shop-title {
  font-size: 3.25rem;
}

.shop-bag-items {
  flex: 1;
  overflow: auto;
  list-style: none;
  padding: 0 clamp(16px, 5vw, 28px);
  margin: 0;
}

.shop-bag-item {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  align-items: start;
  gap: 15px;
  padding: 18px 0;
}

.shop-bag-item + .shop-bag-item {
  border-top: 1px solid rgba(37, 33, 23, 0.25);
}

.shop-bag-item img {
  width: 100%;
  aspect-ratio: 0.9;
  object-fit: cover;
  background: #eadbc0;
}

.shop-bag-item-actions {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.shop-bag-item-content h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
}

.shop-bag-item-color {
  margin: -4px 0 8px;
  color: var(--muted);
  font-size: 0.8rem;
}

.shop-bag-item-actions {
  align-items: center;
  flex-wrap: wrap;
}

.shop-quantity {
  display: flex;
  align-items: center;
  border: 1px solid currentColor;
  box-sizing: border-box;
}

.shop-quantity button {
  min-width: 38px;
  min-height: 42px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 1.2rem;
}

.shop-quantity button:disabled {
  opacity: 0.42;
}

.shop-quantity span {
  min-width: 1.4em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.shop-dialog .shop-remove {
  min-height: 44px;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.shop-bag-summary {
  padding: 20px clamp(16px, 5vw, 28px) max(24px, env(safe-area-inset-bottom));
  border-top: 1px solid currentColor;
}

.shop-checkout-status {
  margin: 0 0 10px;
  font-size: 0.85rem;
}

.shop-bag-empty {
  padding: 24px clamp(16px, 5vw, 28px);
}

.shop-bag-empty p {
  margin: 0 0 16px;
}

@media (max-width: 620px) {
  .shop-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  .shop-product-layout {
    display: block;
  }

  .shop-product-image {
    max-height: 40dvh;
  }

  .shop-thumbnails {
    gap: 5px;
    padding: 8px;
  }

  .shop-product-content {
    padding: 20px 18px 24px;
  }
}
