.gallery-switch:not([hidden]) { display: inline-flex; align-items: stretch; }
.gallery-switch button {
  min-height: 44px;
  padding: 0 .65rem;
  background: transparent;
  border: 1px solid var(--gift-control);
  color: var(--rp-ink);
  font: 500 .85rem/1.12 var(--rp-sans);
  white-space: nowrap;
  cursor: pointer;
}
.gallery-switch button + button { border-inline-start: 0; }
.gallery-switch button[aria-pressed="true"] {
  background: var(--gift-berry);
  color: white;
  font-weight: 600;
}
.gallery-switch button:hover { text-decoration: underline; text-underline-offset: .2em; }
.gallery-item { min-width: 0; }
.gallery-item .gallery-preview-link { position: relative; display: block; }
.gallery-item .gallery-preview {
  position: absolute;
  inset: 0 0 auto;
  width: 100%;
  height: auto;
  aspect-ratio: 4/5;
  opacity: 0;
  pointer-events: none;
}
@media (min-width:741px) and (hover:hover) and (pointer:fine) {
  .gallery-item.gallery-hovering:hover .gallery-preview.is-ready { opacity: 1; }
}
@media (prefers-reduced-motion:no-preference) {
  .gallery-item .gallery-preview { transition: opacity 150ms ease; }
}
.gallery-caption, .gallery-add { display: none; }
.collection-page[data-view="photo"] .gallery-item { position: relative; align-self: start; }
.gallery-in-bag:not([hidden]) {
  position: absolute;
  inset-block-start: 7px;
  inset-inline-start: 7px;
  padding: 5px 7px;
  border-radius: 2px;
  background: var(--gift-berry, #512732);
  color: white;
  font: 600 .8rem/1.2 var(--rp-sans);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  pointer-events: none;
}
.collection-page[data-view="photo"] .gallery-item article a {
  display: block;
  position: relative;
}
.collection-page[data-view="photo"] .gallery-item article a:is(:hover,:focus-visible) {
  outline: 2px solid var(--gift-berry);
  outline-offset: 2px;
}
.collection-page[data-view="photo"] .gallery-item article :is(h2,p,.j-card-stock) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  margin: 0;
}
.collection-page[data-view="photo"] .gallery-caption {
  position: absolute;
  inset: auto 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: .12rem .3rem;
  padding: 20px 11px 8px;
  color: #302520;
  background: linear-gradient(transparent, rgb(247 240 229 / .9) 76%, rgb(247 240 229 / .97));
  pointer-events: none;
  font-variant-numeric: tabular-nums;
  line-height: 1.16;
}
.gallery-price { font-size: clamp(.94rem,1.25vw,1.1rem); font-weight: 600; }
.gallery-weight, .gallery-stock { color: #57463d; font-size: .85rem; }
body[data-gallery-ordering="on"] .collection-page[data-view="photo"] .gallery-add:not([hidden]) {
  position: absolute;
  inset: 7px 7px auto auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .22em;
  min-width: 44px;
  min-height: 44px;
  padding: 0 .58rem;
  border: 1px solid #89796c;
  border-radius: 0;
  background: #fcf9f4;
  color: var(--gift-berry);
  font: 600 .84rem/1 var(--rp-sans);
  cursor: pointer;
}
.gallery-add span { font-size: 1.15rem; line-height: .8; font-weight: 400; }
body[data-gallery-ordering="on"] .collection-page[data-view="photo"] .gallery-add:hover { color: white; background: var(--gift-berry); }
.gallery-dialog {
  box-sizing: border-box;
  width: min(27rem, calc(100% - 24px));
  max-height: calc(100dvh - 24px);
  margin: auto;
  padding: 26px;
  overflow: auto;
  border: 1px solid #9c8c80;
  background: var(--gift-paper,#fbf8f4);
  color: var(--rp-ink);
}
.gallery-dialog::backdrop { background: rgb(30 23 20 / .47); }
.gallery-close {
  position: absolute;
  inset: 4px 4px auto auto;
  width: 44px;
  height: 44px;
  border: 0;
  background: transparent;
  color: var(--rp-ink);
  font-size: 1.65rem;
  cursor: pointer;
}
.gallery-summary { display: grid; grid-template-columns: 74px minmax(0,1fr); align-items: center; gap: 16px; padding-inline-end: 12px; }
.gallery-summary img { display: block; width: 74px; height: auto; aspect-ratio: 4/5; object-fit: contain; }
.gallery-summary h2 { margin: 0 0 .2rem; font: 500 clamp(1.4rem,3vw,1.75rem)/1.12 var(--rp-serif); }
.gallery-summary a, .gallery-added a { color: var(--gift-berry); text-underline-offset: .2em; }
.gallery-summary a { display: inline-flex; min-height: 36px; align-items: center; font-size: .91rem; }
.gallery-dialog form { margin-top: 18px; border-top: 1px solid var(--gift-line); padding-top: 16px; }
.gallery-dialog label:not([hidden]) { display: block; margin: 0 0 .4rem; font-size: .93rem; font-weight: 600; }
.gallery-dialog :is(input,select) {
  min-width: 0;
  min-height: 44px;
  border: 1px solid var(--gift-control);
  border-radius: 0;
  background: white;
  color: var(--rp-ink);
  padding: .5rem;
  font: inherit;
}
.gallery-dialog select { width: 100%; }
.gallery-dialog .gallery-selection { display: flex; align-items: baseline; flex-wrap: wrap; gap: .45rem .8rem; margin: .85rem 0; }
.gallery-selection strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
.gallery-selection span, .gallery-dialog .gallery-article { color: var(--rp-muted); font-size: .91rem; }
.gallery-dialog .gallery-article { margin: -.5rem 0 .8rem; }
.gallery-action-row { display: grid; grid-template-columns: 4.5rem minmax(0,1fr); gap: .65rem; }
.gallery-action-row button { min-height: 44px; justify-content: center; cursor: pointer; }
.gallery-action-row button:disabled { opacity: .6; cursor: auto; }
.gallery-dialog .gallery-error { color: var(--gift-berry); margin: .6rem 0 0; }
.gallery-error:empty { display: none; }
.gallery-added {
  position: fixed;
  inset: auto 16px max(14px, env(safe-area-inset-bottom)) auto;
  z-index: 5;
  max-width: min(32rem, calc(100vw - 32px));
}
.gallery-added:has([data-added-message]:not(:empty)) {
  display: flex;
  align-items: center;
  gap: .8rem;
  border: 1px solid var(--gift-control);
  padding: 6px 14px;
  background: var(--gift-paper,#fbf8f4);
  box-shadow: 0 4px 14px rgb(30 23 20 / .15);
}
.gallery-added a:not([hidden]) { display: inline-flex; align-items: center; min-height: 44px; flex: none; }
.gallery-added button:not([hidden]) { width: 44px; min-height: 44px; flex: none; border: 0; background: transparent; color: var(--rp-ink); font-size: 1.35rem; cursor: pointer; }
.gallery-added [data-added-message] { min-width: 0; overflow-wrap: anywhere; }
@media (max-width:1050px) {
  .collection-page > .collection-toolbar:has(.gallery-switch:not([hidden])) { gap: 7px; }
  .gallery-switch button { padding-inline: .42rem; }
}
@media (max-width:600px) {
  .gallery-in-bag:not([hidden]) { inset-block-start: 5px; inset-inline-start: 5px; padding: 4px 6px; font-size: .75rem; }
  .collection-toolbar .collection-count { white-space: nowrap; }
  .collection-toolbar:has(.gallery-switch:not([hidden])) .collection-tools { gap: 4px; }
  .collection-toolbar:has(.gallery-switch:not([hidden])) .collection-tools summary { padding-inline: 8px; gap: 6px; }
  .gallery-switch button { font-size: .8rem; }
  .collection-page[data-view="photo"] .gallery-caption { padding: 15px 6px 5px; gap: 2px 4px; }
  .gallery-weight, .gallery-stock { font-size: .8rem; }
  body[data-gallery-ordering="on"] .collection-page[data-view="photo"] .gallery-add { inset: 5px 5px auto auto; padding-inline: .42rem; }
}
@media (max-width:355px) {
  body[data-gallery-ordering="on"] .collection-page[data-view="photo"] .gallery-add:not([hidden]) {
    min-width: 44px;
    padding-inline: .3rem;
  }
  .gallery-add span[aria-hidden] { display: none; }
  .collection-toolbar:has(.gallery-switch:not([hidden])) { flex-wrap: wrap; }
  .collection-toolbar:has(.gallery-switch:not([hidden])) .collection-count { flex: 1 1 100%; }
  .gallery-dialog { padding: 20px 15px; }
}

/* Leave the model photograph's lower-right wordmark unobstructed. */
@media (min-width:741px) and (hover:hover) and (pointer:fine) {
  .collection-page[data-view="photo"] .gallery-hovering:hover:has(.gallery-preview.is-ready) .gallery-caption {
    inset: auto auto 7px 7px;
    display: grid;
    gap: 2px;
    padding: 6px 10px;
    background: #fffaf3;
    text-align: left;
  }
}
