/* One shared, bounded art surface for the website and the mobile sheet. */
.art-gallery {
  --art-ink: #193d36;
  --art-muted: #536c64;
  --art-surface: #eef5e9;
  --art-halo: #cce9cf;
  --art-line: #cfdfcf;
  --art-stage-ink: #52695f;
  --art-orbit: rgb(255 255 255 / 80%);
  --art-shadow: rgb(25 61 54 / 16%);
  width: 100%;
  min-width: 0;
  color: var(--art-ink);
  font-family: inherit;
  isolation: isolate;
}

.art-gallery,
.art-gallery * {
  box-sizing: border-box;
}

.art-gallery[data-art-tone="blue"] {
  --art-surface: #eef1fb;
  --art-halo: #cad5f7;
  --art-line: #d0d8ed;
}

.art-gallery[data-art-tone="coral"] {
  --art-surface: #fff0e8;
  --art-halo: #f8d0c2;
  --art-line: #ecd6ca;
}

/* Only the artwork surface changes. Reading and control surfaces stay light. */
.art-gallery[data-art-backdrop="ink"] {
  --art-surface: #142e2a;
  --art-halo: #397e70;
  --art-line: #34594c;
  --art-stage-ink: #deeee6;
  --art-orbit: rgb(224 244 235 / 24%);
  --art-shadow: rgb(0 0 0 / 38%);
}

.art-gallery[data-art-tone="blue"][data-art-backdrop="ink"] {
  --art-surface: #142341;
  --art-halo: #405ca5;
  --art-line: #354b70;
}

.art-gallery[data-art-tone="coral"][data-art-backdrop="ink"] {
  --art-surface: #332c2d;
  --art-halo: #966157;
  --art-line: #604b49;
}

.art-gallery__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
}

.art-gallery__backdrops {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  max-width: 100%;
  padding: 3px;
  border: 1px solid #dbe5dc;
  border-radius: 13px;
  background: #edf2e9;
}

.art-gallery .art-gallery__backdrops > button,
.art-gallery .art-gallery__expand {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  color: var(--art-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
  touch-action: manipulation;
}

.art-gallery .art-gallery__backdrops > button {
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
}

.art-gallery .art-gallery__backdrops > button[aria-pressed="true"] {
  border-color: #b9cbbf;
  background: #fffefa;
  box-shadow: 0 1px 3px rgb(25 61 54 / 6%);
}

.art-gallery__swatch {
  flex: 0 0 auto;
  width: 12px;
  height: 12px;
  border: 1px solid #81988b;
  border-radius: 50%;
}

.art-gallery__swatch--paper { background: #f5f6ec; }
.art-gallery__swatch--ink { background: #1b3b34; border-color: #1b3b34; }

.art-gallery .art-gallery__expand {
  flex: 0 0 auto;
  max-width: 100%;
  border: 1px solid #dbe5dc;
  border-radius: 12px;
  background: #fffefa;
}

.art-gallery .art-gallery__expand[aria-expanded="true"] {
  border-color: #93b09e;
  background: #e9f3e3;
}

.art-gallery__expand svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art-gallery__stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1.6;
  min-height: 170px;
  max-height: 335px;
  overflow: hidden;
  isolation: isolate;
  perspective: 900px;
  border: 1px solid var(--art-line);
  border-radius: 19px;
  background: var(--art-surface);
  touch-action: pan-y pinch-zoom;
}

/* An explicit size choice, without animated layout or a nested mobile dialog. */
.art-gallery[data-art-expanded="true"] .art-gallery__stage {
  width: min(100%, 520px, 72vh);
  width: min(100%, 520px, 72svh);
  min-height: 0;
  max-height: none;
  margin-inline: auto;
  aspect-ratio: 1;
}

.art-gallery__halo {
  position: absolute;
  inset: 3% 4% 0;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--art-halo) 0, transparent 67%);
  opacity: .72;
  pointer-events: none;
}

.art-gallery__orbit {
  position: absolute;
  inset: 10% 16% 14%;
  border: 1px solid var(--art-orbit);
  border-radius: 50%;
  transform: rotate(-19deg) scaleX(1.16);
  pointer-events: none;
}

.art-gallery__shadow {
  position: absolute;
  left: 28%;
  right: 28%;
  bottom: 10%;
  height: 9%;
  border-radius: 50%;
  background: radial-gradient(ellipse, var(--art-shadow), transparent 69%);
  pointer-events: none;
}

/* The pointer owns this parent. Reveal motion only owns its two children. */
.art-gallery__visual {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform-origin: 50% 56%;
  pointer-events: none;
}

.art-gallery__artwork,
.art-gallery__outgoing {
  position: absolute;
  inset: 2% 11% 5%;
  transform-origin: 50% 58%;
}

.art-gallery__artwork { z-index: 2; }
.art-gallery__outgoing { z-index: 1; }

.art-gallery__artwork img,
.art-gallery__outgoing img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  object-fit: contain;
  filter: drop-shadow(0 10px 9px rgb(29 57 50 / 9%));
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}

.art-gallery__light {
  position: absolute;
  inset: -40%;
  z-index: 3;
  background: linear-gradient(113deg, transparent 39%, rgb(255 255 255 / 0%) 43%, rgb(255 255 255 / 24%) 50%, rgb(255 255 255 / 0%) 57%, transparent 62%);
  transform: translate3d(-14%, -2%, 0);
  pointer-events: none;
}

.art-gallery__counter {
  position: absolute;
  top: 14px;
  left: 16px;
  z-index: 4;
  color: var(--art-stage-ink);
  font: inherit;
  font-size: 11px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: .04em;
  pointer-events: none;
}

.art-gallery__fallback {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: grid;
  align-content: center;
  margin: 0;
  padding: 28px;
  color: var(--art-stage-ink);
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
}

.art-gallery__caption-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
  padding: 13px 2px 12px;
}

.art-gallery__caption { min-width: 0; }

.art-gallery__disclosure {
  display: block;
  margin: 0 0 4px;
  color: var(--art-muted);
  font-size: 12px;
  line-height: 1.3;
}

.art-gallery .art-gallery__title {
  margin: 0;
  color: var(--art-ink);
  font: inherit;
  font-size: 20px;
  font-weight: 750;
  line-height: 1.15;
  letter-spacing: -.04em;
}

.art-gallery__caption p {
  margin: 5px 0 0;
  color: var(--art-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
  text-wrap: pretty;
}

.art-gallery .art-gallery__replay {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 44px;
  min-height: 44px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #dbe5dc;
  border-radius: 12px;
  background: #fffefa;
  color: var(--art-ink);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
}

.art-gallery__replay svg {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art-gallery .art-gallery__replay:disabled {
  color: #687a72;
  background: #f3f5ef;
  cursor: default;
  opacity: .7;
}

.art-gallery__choices {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.art-gallery .art-gallery__choices > button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 78px;
  margin: 0;
  padding: 6px 7px 8px;
  border: 1px solid #dfe6de;
  border-radius: 13px;
  background: #fffefa;
  color: var(--art-muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.2;
  text-transform: none;
  letter-spacing: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.art-gallery__choices img {
  display: block;
  width: 45px;
  height: 40px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

.art-gallery__choices [data-art-label] { pointer-events: none; }

.art-gallery .art-gallery__choices > button[aria-pressed="true"] {
  border-color: #5f9783;
  background: #f2f8ee;
  color: #153e34;
  box-shadow: 0 0 0 1px #5f9783 inset;
}

.art-gallery button:focus-visible {
  outline: 3px solid #16624f;
  outline-offset: 3px;
}

.art-gallery [hidden] { display: none !important; }

@media (hover: hover) and (pointer: fine) {
  .art-gallery .art-gallery__choices > button:hover,
  .art-gallery .art-gallery__replay:hover,
  .art-gallery .art-gallery__backdrops > button:hover,
  .art-gallery .art-gallery__expand:hover {
    border-color: #83a595;
    background: #f4f9f0;
  }
}

.art-gallery[data-art-reduced="true"] .art-gallery__choices > button { transition: none; }
.art-gallery[data-art-reduced="true"] .art-gallery__artwork img { filter: none; }

@media (prefers-reduced-motion: reduce) {
  .art-gallery .art-gallery__choices > button { transition: none; }
  .art-gallery__artwork img,
  .art-gallery__outgoing img { filter: none; }
}

@media (forced-colors: active) {
  .art-gallery__counter,
  .art-gallery__fallback { color: CanvasText; }
  .art-gallery__stage,
  .art-gallery .art-gallery__choices > button,
  .art-gallery .art-gallery__backdrops,
  .art-gallery .art-gallery__backdrops > button,
  .art-gallery .art-gallery__expand,
  .art-gallery .art-gallery__replay { border: 1px solid CanvasText; }
  .art-gallery .art-gallery__choices > button[aria-pressed="true"],
  .art-gallery .art-gallery__backdrops > button[aria-pressed="true"],
  .art-gallery .art-gallery__expand[aria-expanded="true"] { outline: 2px solid Highlight; outline-offset: -3px; }
  .art-gallery__light,
  .art-gallery__halo,
  .art-gallery__orbit,
  .art-gallery__shadow { display: none; }
}

@media print {
  .art-gallery__toolbar,
  .art-gallery__choices,
  .art-gallery__replay { display: none !important; }
  .art-gallery__visual,
  .art-gallery__artwork { transform: none !important; }
  .art-gallery__artwork { clip-path: none !important; opacity: 1 !important; }
  .art-gallery__stage { background: #eef5e9 !important; }
  .art-gallery__counter,
  .art-gallery__fallback { color: #52695f; }
}
