.art-frame {
  position: relative;
  width: 100%;
  isolation: isolate;
  filter: drop-shadow(0 2px 1px #21180e22) drop-shadow(3px 8px 5px #21180e20) drop-shadow(10px 19px 16px #21180e13);
}
.art-frame__piece { position: absolute; pointer-events: none; }
.art-frame__top, .art-frame__bottom {
  left: var(--rail-x); right: var(--rail-x); height: var(--rail-y);
  background-size: auto 100%; background-repeat: round no-repeat;
}
.art-frame__top { top: 0; }
.art-frame__bottom { bottom: 0; }
.art-frame__left, .art-frame__right {
  top: var(--rail-y); bottom: var(--rail-y); width: var(--rail-x);
  background-size: 100% auto; background-repeat: no-repeat round;
}
.art-frame__left { left: 0; }
.art-frame__right { right: 0; }
.art-frame__top-left, .art-frame__top-right, .art-frame__bottom-left, .art-frame__bottom-right {
  width: var(--rail-x); height: var(--rail-y); background-size: 100% 100%;
}
.art-frame__top-left { top: 0; left: 0; }
.art-frame__top-right { top: 0; right: 0; }
.art-frame__bottom-left { bottom: 0; left: 0; }
.art-frame__bottom-right { bottom: 0; right: 0; }
.art-frame__opening {
  position: absolute; inset: var(--rail-y) var(--rail-x);
  background: #eeeade;
  /* Shadows belong to the opening, never to individual slices. */
  box-shadow: inset 2px 3px 5px #1c140b45, inset 0 0 1px 1px #31271966;
}
/* The white finish needs less contrast where the rail meets the mat. */
.art-frame[data-material='matte-white'] .art-frame__opening:not(.art-frame__opening--bare) {
  box-shadow: inset 1px 2px 4px #1c140b24, inset 0 0 1px #31271926;
}
.art-frame__paper {
  position: absolute; inset: var(--mat-y) var(--mat-x); background: #f9f6ed;
  box-shadow: 0 0 0 1px #fdfbf2, -1px -1px 2px 1px #b5afa166, 1px 1px 1px 1px #fffdf4;
}
.art-frame__paper img { display: block; width: 100%; height: 100%; object-fit: contain; }
.art-frame__opening--bare .art-frame__paper { box-shadow: none; }
.art-frame__opening--bare::after {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 2px 3px 4px #120c0838, inset 0 0 0 1px #19130b55;
}
/* With no mat, use one soft shadow above the artwork instead of a dark
   1px outline plus the opening shadow. Keep other finishes unchanged. */
.art-frame[data-material='matte-white'] .art-frame__opening--bare {
  box-shadow: none;
}
.art-frame[data-material='matte-white'] .art-frame__opening--bare::after {
  box-shadow: inset 1px 2px 4px #1c140b24, inset 0 0 1px #31271926;
}
.art-frame--debug .art-frame__piece { outline: 1px solid #e74d8bcc; outline-offset: -1px; }
.art-frame--debug .art-frame__paper { outline: 1px solid #008c95; }
.art-frame[data-image-ratio='mismatch'], .art-frame[data-image-ratio='error'] { outline: 3px solid #c04432; }
