.header-icon {
  position: relative;
  transition: color 180ms ease;
}

.portrait-page .header-icon svg {
  width: 23px;
  height: 23px;
}

.header-icon[aria-current="page"] { color: var(--text-action); }

.shop-count {
  position: absolute;
  inset: 2px 0 auto auto;
  min-width: 1em;
  font-size: .81rem;
  font-weight: var(--font-medium);
  line-height: 1;
  text-align: center;
}

.shop-link {
  width: fit-content;
  min-height: var(--control-min-height);
  padding: 0;
  border: 0;
  background: none;
  font-size: 1.0625rem;
  text-decoration: underline;
  text-underline-offset: .24em;
  cursor: pointer;
}

a.shop-link {
  display: inline-flex;
  align-items: center;
}

.shop-link:is(:hover, :focus-visible) { color: var(--text-action); }

.saved-gallery {
  min-height: 64vh;
  padding-block: clamp(48px, 6vw, 96px);
  color: #1b2c36;
  background: var(--surface-section-light);
}

.saved-gallery-back { margin-bottom: 16px; }

.saved-gallery h1 {
  margin-bottom: clamp(30px, 4vw, 58px);
  font-size: clamp(3rem, 6.2vw, 6rem);
  font-weight: var(--font-regular);
  line-height: .98;
  letter-spacing: -.055em;
}

.saved-gallery-empty p,
.bag-empty p {
  margin: 0 0 9px;
  color: var(--text-secondary);
}

.saved-gallery-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(28px, 4vw, 64px) clamp(22px, 3.4vw, 52px);
  padding: 0;
  margin: 0;
  list-style: none;
}

.saved-artwork-image,
.bag-item-photo {
  display: grid;
  place-items: center;
  background: #eeece8;
}

.saved-artwork-image {
  aspect-ratio: 1.22;
  padding: 9%;
}

.saved-artwork-image img,
.bag-item-photo img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}

.saved-artwork-image.is-round img,
.bag-item-photo.is-round img {
  width: auto;
  height: 100%;
  max-width: 100%;
  clip-path: var(--artwork-clip, ellipse(47% 44.6% at 51% 51.6%));
}

.saved-artwork-details {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px 9px;
  padding-top: 12px;
}

.saved-artwork-details h2 {
  font-size: clamp(1.4rem, 2.2vw, 2rem);
  font-weight: var(--font-medium);
  line-height: 1.07;
}

.saved-artwork-details > p { color: var(--text-secondary); }
.saved-artwork-details > .shop-link { grid-column: 1 / -1; }
.saved-artwork-details > .selected-favorite {
  grid-column: 2;
  grid-row: 1 / span 2;
  min-width: 44px;
  min-height: 44px;
  margin-top: -5px;
}

.saved-artwork-details > .selected-favorite svg { width: 21px; height: 21px; }

html:has(.gallery-bag[open]) { overflow: hidden; }

dialog.gallery-bag {
  inset: 0 0 0 auto;
  box-sizing: border-box;
  width: min(100%, 470px);
  height: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  padding: 0;
  margin: 0;
  border: 0;
  color: #1b2c36;
  background: var(--surface-section-light);
  transform: translateX(100%);
  transition: transform 420ms cubic-bezier(.22, 1, .36, 1),
    overlay 420ms allow-discrete, display 420ms allow-discrete;
}

.gallery-bag[open] { transform: translateX(0); }
.gallery-bag::backdrop {
  background: rgb(28 27 24 / 26%);
  opacity: 0;
  transition: opacity 420ms ease, overlay 420ms allow-discrete, display 420ms allow-discrete;
}
.gallery-bag[open]::backdrop { opacity: 1; }

@starting-style {
  .gallery-bag[open] { transform: translateX(100%); }
  .gallery-bag[open]::backdrop { opacity: 0; }
}

.bag-content {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100%;
  overflow: hidden;
}

.bag-top,
.bag-summary { padding-inline: clamp(22px, 4vw, 35px); }

.bag-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 20px 16px;
  padding-block-start: max(20px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--stroke-subtle);
}

.bag-top h2 {
  margin: 0;
  font-size: clamp(2.35rem, 3.7vw, 3rem);
  font-weight: var(--font-regular);
  line-height: 1;
  letter-spacing: -.045em;
}

.bag-close {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.bag-close svg { width: 23px; height: 23px; }
.bag-close:hover { color: var(--text-action); }

.bag-body {
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 clamp(22px, 4vw, 35px);
}

.bag-empty { margin-top: 32px; }
.bag-items { margin: 0; padding: 0; list-style: none; }

.bag-item {
  display: grid;
  grid-template-columns: 94px minmax(0, 1fr);
  gap: 16px;
  padding-block: 19px;
  border-bottom: 1px solid var(--stroke-subtle);
}

.bag-item-photo { height: 94px; padding: 8px; }

.bag-item h3 {
  margin: 0;
  font-size: 1.43rem;
  font-weight: var(--font-medium);
  line-height: 1.06;
}

.bag-item p { margin-top: 4px; }

.bag-summary {
  display: grid;
  gap: 13px;
  padding-block: 19px max(22px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--stroke-subtle);
}

.bag-subtotal { display: flex; justify-content: space-between; gap: 12px; }
.bag-note { font-size: 1.0625rem; line-height: 1.25; color: var(--text-secondary); }
.bag-enquiry-form { margin-block: 26px; padding-block-start: 20px; border-top: 1px solid var(--stroke-subtle); }
.bag-enquiry-form h3 { margin: 0; font-size: 1.8rem; font-weight: 400; }
.bag-enquiry-form .contact-field { font-size: 1.15rem; }
.bag-enquiry-form .contact-field :is(input,textarea) { font: inherit; font-size: 1.2rem; }
.bag-enquiry-result { margin-block: 22px; font-size: 1.25rem; line-height: 1.3; }

.bag-checkout {
  display: grid;
  place-items: center;
  min-height: 48px;
  border: 1px solid #1b2c36;
  color: white;
  background: #1b2c36;
}

.bag-checkout:disabled {
  opacity: .57;
  cursor: default;
}

@media (max-width: 850px) {
  .saved-gallery-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .saved-gallery-list { grid-template-columns: minmax(0, 1fr); }
  dialog.gallery-bag { width: min(100%, 430px); }
}

@media (prefers-reduced-motion: reduce) {
  .header-icon, dialog.gallery-bag, .gallery-bag::backdrop { transition: none; }
}

.saved-price-note {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 1.0625rem;
}

.saved-artwork-details > .shop-link[aria-disabled="true"] {
  color: var(--text-secondary);
  text-decoration: none;
  cursor: default;
}

:is(.saved-artwork-details h2, .bag-item h3) a:hover {
  color: var(--text-action);
}
