.portrait-room, #cabinet.portrait-cabinet {
  color: #ffecd0;
  background: radial-gradient(ellipse at 35% 28%, #452c2b, transparent 65%), #1c1117;
}
.portrait-room { padding: 0 var(--edge) 1.8rem; }
.portrait-entry {
  max-width: 1080px; margin: 0 auto; display: grid; align-items: center;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr); gap: clamp(1.3rem, 4vw, 4rem);
}
.gallery-intro { position: relative; align-self: start; padding: 2rem 0; }
@media(min-width:821px) and (min-height:610px) {
  .gallery-intro { position: sticky; top: 0; }
}
.gallery-threshold { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.gallery-sconce { position: relative; isolation: isolate; display: block; width: clamp(3rem,5.3vw,5rem); pointer-events: none; }
.gallery-sconce img { display: block; width: 100%; height: auto; }
.gallery-sconce::before {
  content: ''; position: absolute; z-index: -1; inset: -34% -95% 21%; pointer-events: none;
  background: radial-gradient(ellipse,#ecaa5c3b, #cf753921 32%,transparent 70%);
}
.gallery-sconce .candle-glow.room-glow { overflow: visible; --halo-width: 100%; }
.gallery-sconce .room-glow i::after { height: 14%; }
@media(max-width:820px) {
  .gallery-sconce { position: absolute; right: clamp(1.1rem,3vw,2.75rem); top: .4rem; width: clamp(2.9rem,13vw,4.4rem); }
  .gallery-intro :is(h1,.gallery-invite) { margin-right: clamp(3.7rem,14vw,6rem); }
}
.gallery-back, #cabinet.portrait-cabinet .back {
  display: inline-flex; gap: .55em; align-items: center; min-height: 44px;
  font: italic 1.07rem var(--head); color: #f2d8ad; text-decoration: none;
}
.gallery-back::before, #cabinet.portrait-cabinet .back::before {
  content: ''; width: .44em; height: .44em; border: solid currentColor;
  border-width: 0 0 1px 1px; transform: rotate(45deg);
}
.gallery-back:hover, #cabinet.portrait-cabinet .back:hover { text-decoration: underline; }
.gallery-intro h1 { margin: .44em 0 .3em; font: clamp(3.15rem, 5.4vw, 5.6rem)/1 var(--head); }
.gallery-intro h1 em { display: block; color: #edce98; }
.gallery-invite { font: italic clamp(1.18rem, 1.85vw, 1.45rem)/1.4 var(--head); max-width: 25ch; }
.gallery-flourish { display: block; width: 68px; height: 25px; margin: 1.65rem 0 .85rem; background: #c59e69; mask: var(--flourish) center/contain no-repeat; }
.gallery-aside { color: #dfc8b2; font: 1.14rem/1.4 var(--head); }
.featured-portrait { display: block; color: inherit; text-decoration: none; min-width: 0; }
.portrait-mount {
  position: relative; display: block; width: 100%; aspect-ratio: 4 / 5; isolation: isolate;
  background: #4b2027 url('assets/galerie-boiserie.webp') center/100% 100% no-repeat;
  perspective: 850px;
}
.portrait-panel, .portrait-recess {
  position: absolute; left: 23.92%; top: 15.18%; width: 52.65%; height: 49.56%;
}
.portrait-panel {
  display: block; object-fit: cover; object-position: 50% 37%; transform-origin: left center;
  box-shadow: 0 0 0 1px #3b2113, inset 1px 1px 5px #2c1d08; backface-visibility: hidden;
}
.portrait-recess {
  display: grid; place-items: center;
  background: linear-gradient(146deg,#60402d 2%,#e2caa2 34%,#f7e8c7 70%,#b18c59);
  box-shadow: inset 2px 4px 17px #492c16;
}
.portrait-recess span {
  display: grid; place-items: center; width: 29%; aspect-ratio: 1; border-radius: 50%;
  box-shadow: 1px 3px 3px #5c3c2b70, inset 0 0 0 3px #64303a; background: #772e41;
  color: #e0b484; font: italic clamp(1rem,2.4vw,1.9rem) var(--head);
}
.brass-name {
  position: absolute; left: 50%; top: 76%; transform: translateX(-50%); max-width: 80%; white-space: nowrap;
  padding: .36em 1.05em .3em; color: #372211; text-shadow: 0 1px #fbe5af90;
  background: linear-gradient(110deg,#9e7640,#edce98 28%,#c89d62 65%,#e1c28a);
  border: 1px solid #8c653b; box-shadow: inset 0 0 0 2px #e1bd83, inset 0 0 0 3px #967345, 0 2px 4px #1a0c09bd;
  font: small-caps clamp(1rem,1.6vw,1.25rem)/1.18 var(--head); letter-spacing: .025em;
}
.featured-portrait .brass-name::after {
  content: ''; position: absolute; right: -6px; top: -4px; width: 6px; height: 6px; border-radius: 50%;
  background: #fffad0; box-shadow: -8px -4px 3px #ffe2a1, 5px -7px 2px #ffdf8e, 0 0 8px 3px #f4bf57;
  animation: plate-glimmer 3.1s ease-in-out infinite alternate;
}
@keyframes plate-glimmer { to { transform: translate(2px,-3px); opacity: .65; } }
.featured-portrait:hover .brass-name, .featured-portrait:focus-visible .brass-name { filter: brightness(1.12); }
#cabinet.portrait-cabinet { padding: 1rem var(--edge) 3rem; }
.portrait-cabinet .room-head { max-width: 980px; margin-bottom: .35rem; }
.portrait-cabinet .room-head .back { padding: 0; margin: 0; }
.portrait-cabinet .cabinet {
  display: grid; grid-template-columns: .86fr 1fr; align-items: center;
  padding: 0; max-width: 980px; text-align: left; background: transparent; box-shadow: none;
}
.cabinet-portrait { z-index: 0; animation: approach-frame .6s ease-out both; }
@keyframes approach-frame { from { transform: scale(.966); opacity: .78; } }
.secret-slip, .personal-letter {
  position: relative; z-index: 1; padding: clamp(1.6rem, 4vw, 3.7rem);
  background: linear-gradient(125deg,#fbf3e1ee,#fcf5e7ed 55%,#f1e1c5ed), url('assets/papier-journal.webp') center/370px;
  box-shadow: 0 10px 32px #170b0b60; color: #392d33;
}
.secret-slip { margin-left: -1rem; }
.letter-kicker { font: small-caps 1rem/1.3 var(--head); letter-spacing: .06em; color: #795c41; }
.portrait-cabinet h1 { margin: .45rem 0 .6rem; font-size: clamp(2.4rem, 4.8vw, 4.2rem); }
.gate-note, .personal-motto { font: italic 1.26rem/1.4 var(--head); color: #684c42; }
.secret-slip form { margin: 1.3rem 0 0; }
.secret-slip input { border-radius: 0; }
.secret-slip .cta { width: auto; min-width: 9.4rem; }
.form-msg:empty { margin: 0; }
.is-unsealing .portrait-panel { animation: turn-portrait .8s ease-in-out both; }
@keyframes turn-portrait { to { transform: rotateY(-81deg); } }
.portrait-cabinet.is-reading .cabinet { display: block; max-width: 740px; }
.personal-letter { display: flow-root; animation: take-letter .45s ease both; }
@keyframes take-letter { from { opacity: .4; transform: translateY(10px); } }
.letter-likeness {
  float: right; width: clamp(70px,15vw,128px); margin: 0 0 1rem 1rem;
  box-shadow: 1px 3px 6px #583e3545; border: 4px solid #fff8ec; transform: rotate(2deg);
}
.personal-motto { max-width: 36ch; margin: .7rem 0 1.6rem; }
.personal-fold { clear: both; padding: .2rem 0; }
.personal-fold summary {
  padding: .6rem .1rem; cursor: pointer; color: var(--wine);
  font: clamp(1.4rem,3vw,1.84rem)/1.23 var(--head);
}
.personal-fold summary::marker { font-size: .56em; color: #986c49; }
.personal-fold p { margin: .55rem 0 1.05rem; }
.personal-letter .cta { width: auto; margin-top: 1.4rem; }
@media(max-width:680px) {
  .portrait-room { padding: .5rem 0 1rem; }
  .portrait-entry { display: block; }
  .gallery-intro { padding: 0 1.3rem 1rem; }
  .gallery-intro h1 { font-size: clamp(2.4rem,10vw,3.5rem); margin: .05rem 0 .42rem; }
  .gallery-intro h1 em { display: inline; }
  .gallery-invite { font-size: 1.12rem; max-width: none; }
  .gallery-flourish, .gallery-aside { display: none; }
  .featured-portrait { width: min(100%,450px); margin: 0 auto; }
  #cabinet.portrait-cabinet { padding: .4rem .9rem 1.5rem; }
  .portrait-cabinet .cabinet { display: block; }
  .cabinet-portrait { max-width: 192px; margin: 0 auto; }
  .cabinet-portrait .brass-name { font-size: .72rem; }
  .secret-slip { margin: -1.75rem 0 0; padding: 1.35rem 1.25rem; }
  .secret-slip form { max-width: none; margin-top: .95rem; }
  .gate-note, .personal-motto { font-size: 1.15rem; }
  .personal-letter { padding: 1.6rem 1.15rem; }
}
@media(prefers-reduced-motion:reduce) {
  .featured-portrait .brass-name::after, .cabinet-portrait, .is-unsealing .portrait-panel, .personal-letter { animation: none; }
}

.gallery-hang { min-width: 0; }
.portrait-entry { max-width: 1240px; grid-template-columns: minmax(0, .78fr) minmax(0, 2fr); }
#portrait-wall { position: relative; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); }
.gallery-finder, .portrait-navigation { display: none; }
@media (max-width: 820px) {
  .portrait-entry { display: block; }
  .gallery-intro { padding: .15rem clamp(.9rem,4vw,1.6rem) .75rem; }
  .gallery-threshold { min-height: 44px; }
  .gallery-sconce { top: 3.1rem; }
  .gallery-intro h1 { font-size: clamp(2.15rem,8vw,3.5rem); margin-block: .18rem .35rem; }
  .gallery-intro h1 em { display: inline; }
  .gallery-intro .gallery-invite { font-size: 1.06rem; line-height: 1.3; max-width: 32ch; }
  .gallery-flourish, .gallery-aside { display: none; }
  .portrait-room { overflow: clip; }
  .gallery-finder {
    position: relative; display: inline-flex; align-items: center; justify-content: flex-end;
    min-height: 44px; padding: .3rem 1.1rem .3rem .2rem;
    font: italic 1.03rem/1.2 var(--head); color: #f0d6a7; text-align: right;
  }
  .gallery-finder > span { text-decoration: underline; text-decoration-color: #ac8d5f75; text-underline-offset: .25em; }
  .gallery-finder::after {
    content: ''; position: absolute; right: .3rem; width: .45em; height: .45em; pointer-events: none;
    border: solid #ddc295; border-width: 0 1px 1px 0; transform: translateY(-.13em) rotate(45deg);
  }
  #portrait-choices { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font: inherit; }
  .gallery-finder:focus-within { outline: 2px solid #e5c58f; outline-offset: 1px; }
  #portrait-wall {
    --frame-width: min(92%,28rem); display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain; scrollbar-width: none;
  }
  #portrait-wall::-webkit-scrollbar { display: none; }
  #portrait-wall::before, #portrait-wall::after { content: ''; flex: 0 0 calc((100% - var(--frame-width)) / 2); }
  #portrait-wall .featured-portrait {
    position: relative; flex: 0 0 var(--frame-width); margin: 0; overflow: hidden;
    aspect-ratio: 4/4.5; scroll-snap-align: center;
  }
  #portrait-wall .portrait-mount { position: absolute; width: 108%; left: -4%; top: -3%; }
  #portrait-wall .featured-portrait:focus-visible { outline-offset: -3px; }
  .portrait-navigation {
    display: flex; align-items: center; justify-content: center; gap: clamp(.85rem,4.5vw,2rem);
    padding: .25rem .75rem; color: #d9c4a8;
  }
  .portrait-navigation button { min-height: 44px; border: 0; color: #ffe2af; background: transparent; font: italic 1.1rem var(--head); }
  .portrait-navigation button:disabled { opacity: .42; }
  #portrait-position { min-width: 4.6em; text-align: center; font: 1rem var(--head); font-variant-numeric: tabular-nums; }
}
@media(max-width:350px) {
  .gallery-threshold { gap: .25rem; }
  .gallery-intro { padding-inline: .7rem; }
  .gallery-back, .gallery-finder { font-size: .925rem; }
  .gallery-back { gap: .2em; white-space: nowrap; }
  .gallery-finder { padding-inline: 0 .8rem; }
  .gallery-finder::after { right: 0; }
}
