.atelier-gallery {
  --atelier-paper: #f5e8cc;
  --atelier-gold: #c7a46d;
  --atelier-gutter: clamp(22px, 4vw, 72px);
  --atelier-clearance: clamp(72px, 9dvh, 111px);
  --atelier-frame-width: min(clamp(192px, 44dvh, 440px), 78vw);
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: auto;
  overscroll-behavior: contain;
  background: #3b2b22;
  color: var(--atelier-paper);
}

.atelier-gallery::backdrop {
  background: #191813;
}

.atelier-room {
  --atelier-scene: url('/assets/experience/atelier-interior-painted.jpg');
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-rows: minmax(min-content, 1fr);
  min-height: 100%;
  gap: 18px;
  padding: max(22px, env(safe-area-inset-top)) var(--atelier-gutter)
    max(clamp(22px, 4vh, 44px), env(safe-area-inset-bottom));
  background:
    linear-gradient(180deg, #1719154d, transparent 30%, transparent 65%, #1a1511a6),
    var(--atelier-scene) center / cover no-repeat;
}

.atelier-room-header {
  position: absolute;
  z-index: 1;
  inset-block-start: max(clamp(14px, 3vh, 32px), env(safe-area-inset-top));
  inset-inline-start: var(--atelier-gutter);
}

.atelier-back {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  margin-inline-start: -10px;
  padding: 8px 10px;
  color: var(--atelier-paper);
  font-size: 13px;
  text-shadow: 0 1px 7px #1c140f, 0 1px 3px #1c140f;
}

.atelier-back:hover { color: #fffaf0; }

.atelier-room h2 {
  margin: clamp(7px, 2vh, 18px) 0 0;
  color: #fbebca;
  font: italic 400 clamp(43px, 6vw, 91px)/.94 Newsreader, var(--serif);
  letter-spacing: -.035em;
  text-shadow: 0 3px 26px #1c130eee, 0 1px 4px #1c130ebf;
}

.atelier-wall {
  grid-row: 1;
  justify-self: center;
  align-self: start;
  width: min(100%, 490px);
  min-width: 0;
  margin-block-start: var(--atelier-clearance);
  text-align: center;
}

.atelier-wall h3 {
  display: inline-block;
  max-width: 100%;
  margin: 0;
  padding: 5px 15px;
  background: #29362deb;
  border: 1px solid #bd9a627d;
  color: #f8e6bd;
  box-shadow: 0 3px 9px #21140965;
  font: 500 12px/1.4 var(--serif);
  letter-spacing: .12em;
  overflow-wrap: anywhere;
}

.atelier-display {
  width: min(100%, var(--atelier-frame-width));
  margin: clamp(12px, 2vh, 18px) auto 0;
}

.atelier-paintings {
  margin: 0;
  padding: 0;
  list-style: none;
}

.atelier-portrait {
  margin: 0;
}

.atelier-frame {
  position: relative;
  isolation: isolate;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
}

.atelier-frame::after {
  content: '';
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: url('/assets/experience/atelier-gilt-frame.png') center / 100% 100% no-repeat;
  filter: drop-shadow(2px 8px 7px #221107b0) drop-shadow(0 2px 2px #221107b0);
}

.atelier-canvas {
  position: absolute;
  isolation: isolate;
  inset: 8% 10%;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 11px;
  overflow: hidden;
  background-color: #c7ab81;
  background-image: radial-gradient(ellipse at 44% 32%, #e6cea0, #c1a078 72%, #98805c);
  box-shadow: inset 0 0 23px #43291f87;
}

.atelier-canvas::before,
.atelier-canvas::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
}

.atelier-canvas::before {
  background: var(--atelier-scene) 50% 37% / auto 230% no-repeat;
  filter: grayscale(1);
  mix-blend-mode: soft-light;
  opacity: .32;
}

.atelier-canvas::after {
  background: radial-gradient(ellipse at 44% 38%, transparent 24%, #4222184d);
  box-shadow: inset 0 0 15px #4a2c204d;
}

.atelier-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 38%;
  filter: saturate(.83) sepia(.14) contrast(1.04);
}

.atelier-status {
  display: table;
  max-width: min(100%, 36ch);
  margin: 16px auto 0;
  padding: 6px 11px;
  background: #32251ce5;
  color: #fff4de;
  font-size: 13px;
  line-height: 1.45;
}

.atelier-status:empty { display: none; }

.atelier-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 9px 17px;
  border: 1px solid #b7935e;
  background: #2c352df2;
  color: var(--atelier-paper);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.atelier-meet {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: min(100%, 224px);
  max-width: 100%;
  min-height: 54px;
  margin-block-start: 12px;
  padding: 10px 24px;
  border: 1px solid #f5d48c;
  background: linear-gradient(180deg, #f9e0a7, #dfb56b 54%, #c59248);
  box-shadow: 0 4px 12px #251406b0, inset 0 0 0 2px #76502080;
  color: #2d210f;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  overflow-wrap: anywhere;
}

.atelier-meet:hover:not(:disabled) { filter: brightness(1.09); }
.atelier-meet:disabled { cursor: wait; opacity: .8; }
.atelier-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 10px; }
.atelier-pager button { width: 44px; padding: 9px; font-size: 20px; }
.atelier-pager button:disabled { opacity: .45; cursor: default; }
.atelier-pager output { min-width: 4ch; padding: 4px 7px; background: #29362deb; font-size: 13px; }
.atelier-action:hover { border-color: #f3d498; }
.atelier-action:disabled { cursor: wait; opacity: .8; }
.atelier-gallery :is(button, [tabindex]):focus-visible {
  outline: 2px solid #ffe5ac;
  outline-offset: 4px;
}

@media (max-width: 720px) {
  .atelier-gallery {
    --atelier-gutter: 19px;
    --atelier-clearance: max(105px, 15dvh);
    --atelier-frame-width: min(clamp(164px, 40dvh, 320px), 79vw);
  }

  .atelier-room { background-position: center, 50% center; }
  .atelier-room h2 { font-size: clamp(42px, 12vw, 67px); }
}

@media (max-height: 570px) {
  .atelier-gallery {
    --atelier-frame-width: min(clamp(115px, 38dvh, 218px), 71vw);
    --atelier-clearance: 62px;
  }

  .atelier-room { gap: 11px; padding-block-end: max(12px, env(safe-area-inset-bottom)); }
  .atelier-room h2 { margin-top: 2px; font-size: 40px; }
}

@media (max-width: 720px) and (max-aspect-ratio: 3 / 4) {
  .atelier-room { --atelier-scene: url('/assets/experience/atelier-interior-painted-portrait.jpg'); }
  .atelier-canvas::before { background-position: 50% 22%; background-size: 460% 280%; }
}

@media (max-width: 720px) and (max-height: 570px) {
  .atelier-gallery { --atelier-clearance: 94px; }
}
