/* Shared illustrated room and camera frame. */
.scene-room {
  --camera-time: 420ms;
  --scene-cream: var(--advent-color-background);
  position: relative;
  isolation: isolate;
  overflow: clip;
  min-height: max(630px, 100dvh);
  background: #303C32;
  color: var(--scene-cream);
}
.camera {
  position: absolute;
  inset: 0;
  transform-origin: 0 0;
  transition: transform var(--camera-time) var(--advent-ease-out);
  background:
    radial-gradient(ellipse at 15% 68%, #E5A77325, transparent 33%),
    #383D31 url("room.svg#architecture-view") center / 100% 100% no-repeat;
}

/* The wall and floor span the stage. Each object uses its own viewBox ratio. */
.room-art {
  position: absolute;
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
  pointer-events: none;
}
.room-wallpaper {
  inset: 0 0 24.5%;
  background: url("room.svg#wallpaper-view") 0 0 / 68px 84px repeat;
}
.room-rug {
  left: 50%;
  bottom: 6%;
  width: min(85%, 1120px);
  aspect-ratio: 643 / 87;
  transform: translateX(-50%);
  background-image: url("art/christmas-rug.svg");
}
.room-pendant {
  top: 0;
  left: 50%;
  z-index: 5;
  width: 108px;
  aspect-ratio: 100 / 92;
  transform: translateX(-50%);
  background-image: url("room.svg#pendant-view");
}
.lamp-switch {
  position: absolute;
  z-index: 1;
  top: 56%;
  left: 50%;
  width: var(--advent-target-min);
  height: var(--advent-target-min);
  transform: translate(-50%, -50%);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
}
.lamp-switch:focus-visible { outline-color: var(--scene-cream); }
.room-pendant::after {
  content: "";
  position: absolute;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--advent-duration-window) var(--advent-ease-out);
}
.room-pendant::after {
  inset: 14% 7% 0;
  background: radial-gradient(circle closest-side at 50% 50%, #F7E3B7f0, #EDAB587b 37%, transparent 100%);
}
.scene-room[data-light-on] .room-pendant::after { opacity: 1; }

.scene-header {
  position: absolute;
  z-index: 4;
  inset: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 74px;
  gap: 16px;
  margin-inline: clamp(16px, 4.2vw, 72px);
}
.scene-header .wordmark {
  color: var(--scene-cream);
  font-size: clamp(.93rem, 1.7vw, 1.26rem);
  white-space: nowrap;
}

.scene-intro {
  position: absolute;
  z-index: 1;
  top: max(99px, 14%);
  left: 50%;
  width: min(90%, 610px);
  transform: translateX(-50%);
  text-align: center;
  pointer-events: none;
}
.scene-intro h1 {
  color: var(--scene-cream);
  font: 600 clamp(2.15rem, 4.3vw, 4.35rem)/1.09 var(--advent-font-display);
  letter-spacing: -.042em;
  text-shadow: 0 3px 17px #24241ebd;
}
.scene-intro p {
  max-width: 50ch;
  margin: 12px auto 0;
  font: italic 500 clamp(.93rem, 1.45vw, 1.21rem)/1.56 var(--advent-font-display);
  text-shadow: 0 2px 9px #24241e, 0 1px 3px #24241e;
  text-wrap: balance;
}
.scene-cabinet {
  position: absolute;
  left: 49.9%;
  bottom: 16.5%;
  width: min(48vw, 415px);
  margin: 0;
  padding: 12px 13px 14px;
  transform: translateX(-50%);
}
.scene-cabinet .crown {
  height: 53px;
  left: -10px;
  right: -10px;
}
.scene-cabinet .crown svg { width: 142px; height: 43px; }
.scene-cabinet .plinth { height: 19px; left: -10px; right: -10px; }
.scene-cabinet .plinth::before, .scene-cabinet .plinth::after { height: 13px; }
.scene-cabinet .compartment { padding: 18px 12px; }
.scene-grid {
  --cell-gap: clamp(4px, .7vw, 10px);
  gap: var(--cell-gap);
  min-height: 0;
}
.scene-grid .day {
  min-height: clamp(48px, 7vw, 65px);
  font-size: clamp(1.12rem, 2.1vw, 1.6rem);
}

.room-status {
  position: absolute;
  left: 50%;
  bottom: 7%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px 7px 8px;
  border: 1px solid #CEAF8E8a;
  border-radius: var(--advent-radius-control);
  background: #3F2C26;
  color: var(--scene-cream);
  font-size: .8rem;
  white-space: nowrap;
}
.room-status p { margin: 0; }
.status-mark {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--advent-color-day-opened);
  color: var(--advent-color-on-day-opened);
}
.status-mark svg { width: 14px; height: 14px; }

.scene-panel {
  position: fixed;
  z-index: 5;
  top: 50%;
  margin: 0;
  right: clamp(18px, 5vw, 88px);
  width: min(368px, calc(100% - 36px));
  max-height: min(680px, calc(100dvh - 100px));
  padding: 22px;
  color: var(--advent-color-text);
  background: var(--advent-color-surface);
  border: 1px solid var(--advent-color-day-locked);
  border-radius: var(--advent-radius-panel);
  box-shadow: var(--advent-shadow-panel);
  overflow: auto;
  transform: translateY(-50%);
}

@media (max-width: 760px) {
  .scene-panel {
    top: auto;
    bottom: 0;
    right: 0;
    width: 100%;
    max-height: 55dvh;
    padding: 16px 20px max(16px, env(safe-area-inset-bottom));
    border-radius: var(--advent-radius-panel) var(--advent-radius-panel) 0 0;
    transform: none;
  }
  .scene-room { min-height: max(650px, 100dvh); }
  .scene-header { min-height: 60px; gap: 8px; }
  .scene-header .wordmark svg { width: 16px; height: 16px; }
  .scene-intro { top: 82px; }
  .scene-intro p { margin-top: 7px; max-width: 32ch; }
  .room-wallpaper { background-size: 51px 63px; }
  .room-pendant { width: 64px; }
  .room-rug { bottom: 8%; width: 95%; }
  .scene-cabinet { width: calc(100% - 40px); max-width: 375px; bottom: 16%; padding: 8px; }
  .scene-cabinet .crown { height: 36px; }
  .scene-cabinet .crown svg { width: 120px; height: 30px; }
  .scene-cabinet .compartment { padding: 8px; }
  .room-status { bottom: 7%; }
}

@media (max-width: 370px) {
  .scene-intro h1 { font-size: 1.9rem; }
  .scene-cabinet { width: calc(100% - 32px); }
}

@media (max-height: 740px) and (min-width: 761px) {
  .scene-intro { top: 89px; }
  .scene-intro h1 { font-size: clamp(2rem, 3.8vw, 3.3rem); }
  .scene-grid .day { min-height: 49px; }
  .scene-room[data-long] .scene-cabinet { bottom: 14%; }
}

.scene-room[data-short] .scene-cabinet { max-width: 315px; }
.scene-room[data-short] .scene-grid { min-height: clamp(190px, 30dvh, 270px); align-content: center; }
.scene-room[data-long] .scene-grid { --cell-gap: clamp(4px, .55vw, 7px); }
.scene-room[data-long] .day { min-height: clamp(44px, 5.7dvh, 52px); }

@media (max-width: 760px) {
  .scene-room[data-long] { min-height: max(710px, 100dvh); }
  .scene-room[data-short] .scene-cabinet { bottom: 26%; }
}
@media (max-width: 370px) {
  .scene-room[data-long] { min-height: max(760px, 100dvh); }
}

@media (prefers-reduced-motion: reduce) {
  .scene-room { --camera-time: 0ms; }
}

.room-vignette {
  position: absolute;
  left: 3vw;
  bottom: 16%;
  width: min(34vw, 57dvh, 640px);
  height: 1px;
  container-type: inline-size;
  pointer-events: none;
}
.room-vignette .room-art {
  height: auto;
  object-fit: contain;
}
.room-vignette .room-fireplace { left: 0; bottom: 0; width: 43%; }
.room-vignette .room-armchair { left: 36%; bottom: -1cqw; width: 32%; }
.room-vignette .room-tree { right: 0; bottom: 0; width: 34%; }
.room-vignette .room-window {
  left: 36.75%;
  bottom: calc(50cqw + 8px);
  width: 24%;
  transform: translateX(-50%);
}

@media (max-width: 760px) {
  .room-vignette { left: 7%; bottom: 4%; width: min(70%, 235px); }
  .room-vignette .room-window { bottom: 47cqw; width: 19%; }
  .recipient-room .room-vignette { bottom: 23%; }
}

.room-fireplace { isolation: isolate; }
.room-fireplace img {
  display: block;
  width: 100%;
  height: auto;
}
.room-fireplace::before,
.room-fireplace::after {
  content: "";
  position: absolute;
  z-index: -1;
  pointer-events: none;
}
.room-fireplace::before {
  inset: 31% -39% -26%;
  background: radial-gradient(ellipse closest-side at 50% 58%, #EDAB58c9 0, #D97D426f 40%, transparent 100%);
  opacity: .76;
}
.room-fireplace::after {
  inset: -28% -28% 36%;
  background:
    radial-gradient(circle closest-side at 30% 36%, #EDAB58a8 0, #D97D4239 42%, transparent 100%),
    radial-gradient(circle closest-side at 70% 36%, #EDAB5894 0, #D97D4239 40%, transparent 100%);
  opacity: .7;
}

@media (prefers-reduced-motion: no-preference) {
  .room-fireplace::before { animation: fireplace-glow 4.8s cubic-bezier(.4, 0, .6, 1) infinite; }
  .room-fireplace::after { animation: fireplace-glow 6.2s cubic-bezier(.4, 0, .6, 1) -1.2s infinite; }
}

@keyframes fireplace-glow {
  0%, 100% { opacity: .7; }
  29% { opacity: .92; }
  56% { opacity: .59; }
  77% { opacity: .83; }
}

@media (max-width: 400px) {
  .scene-room:not([data-arranging]) .room-pendant {
    top: 42px;
    left: 12%;
  }
}

.advent-language-menu {
  position: absolute;
  top: calc(100% - 6px);
  inset-inline-start: 0;
  color: inherit;
}
.advent-language-menu summary {
  padding: 3px 7px;
  border: 1px solid currentColor;
  border-radius: 2px;
  color: inherit;
  font-size: .7rem;
  line-height: 1.3;
  cursor: pointer;
  list-style: none;
}
.advent-language-menu summary::-webkit-details-marker { display: none; }
.advent-language-menu summary:hover { text-decoration: underline; }
.advent-language-options {
  position: absolute;
  top: calc(100% + 4px);
  inset-inline-start: 0;
  display: grid;
  min-width: 114px;
  padding: 4px;
  border: 1px solid var(--control-border);
  border-radius: var(--control-radius);
  background: var(--control-fill);
  color: var(--control-ink);
  box-shadow: var(--advent-shadow-panel);
}
.advent-language-options a {
  padding: 5px 8px;
  border-radius: 2px;
  color: inherit;
  font-size: .8rem;
  text-decoration: none;
}
.advent-language-options a:hover,
.advent-language-options a:focus-visible,
.advent-language-options a[aria-current] { background: color-mix(in srgb, var(--control-ink) 15%, transparent); }

.is-focused .advent-language-menu { visibility: hidden; }
@media (max-width: 760px) {
  .recipient-room .advent-language-menu { inset-inline: auto 0; top: 65px; }
  .recipient-room .advent-language-options { inset-inline: auto 0; }
  [data-editor-room] .scene-header .wordmark { white-space: normal; }
  [data-editor-room] .scene-header .wordmark svg { flex: none; }
}
@media (max-width: 400px) {
  [data-editor-room] .advent-language-menu { inset-inline-start: 53px; }
  [data-editor-room] .editor-header-actions .bulk-open-button { max-width: calc(100% - 92px); }
}
