:root {
  color-scheme: dark;
  --cream: #ffefcf;
  --honey: #e8c485;
  --navy: #17202b;
  --painting-light: none;
  --sky-tint: none;
  --stars: 0;
  --moon: 0;
}
:root[data-time="day"] {
  --painting-light: brightness(1.3) saturate(.94) contrast(.96);
  --sky-tint: radial-gradient(ellipse 77% 70% at 16% 0%, #a1d6efc9 0%, #77badf99 34%, #b8d8cc39 66%, transparent 90%);
}
:root[data-time="dawn"] {
  --painting-light: brightness(1.11) saturate(.88);
  --sky-tint: radial-gradient(ellipse 66% 53% at 7% 38%, #ffd092a1 0%, #f6a1a660 40%, #da9cb81c 74%, transparent 100%);
  --stars: .15;
}
:root[data-time="dusk"] { --stars: .4; }
:root[data-time="night"] {
  --painting-light: brightness(.74) saturate(.87);
  --sky-tint: linear-gradient(180deg, #10244738, transparent 67%);
  --stars: 1;
  --moon: 1;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: #19232d; }
body { font-family: Georgia, 'Times New Roman', serif; color: var(--cream); }
button { font: inherit; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: wait; }
button:disabled:not([aria-busy]) { cursor: default; }
.gate {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  isolation: isolate;
  overflow: hidden;
}
.world {
  position: absolute;
  z-index: -1;
  inset: 0;
  overflow: hidden;
  container-type: size;
  isolation: isolate;
  background: radial-gradient(ellipse at 53% 68%, #8d6440, #493d42 25%, #263445 61%, #161f2d);
}
.scene {
  --image-ratio: 1.59879;
  /* Centers and bounds in the native painting. All lights travel with the canvas. */
  --door-x: 53.05%;
  --door-y: 65.2%;
  --door-w: 8.9%;
  --door-h: 26.4%;
  --w1-x: 36.07%; --w1-y: 62.9%; --w1-w: 5.93%; --w1-h: 10.28%;
  --w2-x: 69.92%; --w2-y: 62.9%; --w2-w: 5.55%; --w2-h: 9.47%;
  --w3-x: 49.05%; --w3-y: 40.12%; --w3-w: 3.53%; --w3-h: 7.66%;
  --w4-x: 57.6%; --w4-y: 40.1%; --w4-w: 3.22%; --w4-h: 7.86%;
  --upper-bars: linear-gradient(90deg, transparent 47%, #382819 48% 52%, transparent 53%);
  --lower-bars: linear-gradient(90deg, transparent 29%, #382819 30% 33%, transparent 34% 63%, #382819 64% 67%, transparent 68%);
  --moon-x: 41%;
  --moon-y: 13%;
  position: absolute;
  left: 50%; top: 50%;
  width: max(100vw, calc(100vh * var(--image-ratio)));
  width: max(100cqw, calc(100cqh * var(--image-ratio)));
  aspect-ratio: var(--image-ratio);
  translate: -50% -50%;
  transform-origin: var(--door-x) var(--door-y);
  isolation: isolate;
}
.painting, .painting img, .atmosphere, .stars {
  position: absolute;
  display: block;
  inset: 0;
  width: 100%; height: 100%;
  pointer-events: none;
}
.painting img { filter: var(--painting-light); }
.art-missing .painting { visibility: hidden; }
.atmosphere { background: var(--sky-tint); mix-blend-mode: screen; }
[data-time="night"] .atmosphere { mix-blend-mode: multiply; }
.stars {
  opacity: var(--stars);
  background:
    radial-gradient(circle at 5% 21%, #fff4d9 0 .7px, transparent 1.7px),
    radial-gradient(circle at 13% 6%, #fff2dc 0 .5px, transparent 1.4px),
    radial-gradient(circle at 18% 24%, #f4e5c7 0 .5px, transparent 1.5px),
    radial-gradient(circle at 26% 8%, #ffeece 0 .8px, transparent 2px),
    radial-gradient(circle at 28% 20%, #f4e5c7 0 .7px, transparent 1.5px),
    radial-gradient(circle at 32% 13%, #f4e5c7 0 .8px, transparent 1.7px),
    radial-gradient(circle at 37% 4%, #f4e5c7 0 .6px, transparent 1.5px),
    radial-gradient(circle at 39% 18%, #fff2dc 0 .7px, transparent 1.6px),
    radial-gradient(circle at 44% 6%, #fff4d9 0 1px, transparent 2px);
}
.moon {
  position: absolute;
  left: var(--moon-x); top: var(--moon-y);
  width: 2.1%; aspect-ratio: 1;
  border-radius: 50%;
  opacity: var(--moon);
  background: radial-gradient(circle at 37% 40%, #ffedce, #e4d1ae 56%, #c5c6b1 74%);
  box-shadow: 0 0 12px #f6dcb541, 0 0 32px 5px #f0e1c824;
  mix-blend-mode: screen;
  pointer-events: none;
}
.wordmark {
  position: absolute;
  top: max(7.3svh, env(safe-area-inset-top));
  left: max(6vw, env(safe-area-inset-left));
  margin: 0;
  color: #fff1d5;
  font-size: clamp(55px, 6.4vw, 108px);
  font-weight: 400;
  line-height: .98;
  letter-spacing: -.05em;
  text-shadow: 0 1px 2px #142035, 0 0 5px #142035c4, 0 2px 18px #0c192e85;
  pointer-events: none;
}
.wordmark::after {
  content: '';
  display: block;
  margin: .23em 0 0 .08em;
  width: .73em; height: 5px;
  background:
    linear-gradient(135deg, transparent 50%, #e9c88e 51%) 0 50% / 3px 3px,
    linear-gradient(315deg, transparent 50%, #e9c88e 51%) 3px 50% / 3px 3px,
    linear-gradient(90deg, #e9c88e 20%, #f0d5a226) right center / calc(100% - 11px) 1px;
  background-repeat: no-repeat;
}
[data-time="day"] .wordmark {
  color: #19273a;
  text-shadow: 0 0 2px #e3eff2f5, 0 0 6px #dae9ebc9, 0 1px 12px #d5e5e485;
}
.doorway, .door {
  position: absolute;
  left: var(--door-x); top: var(--door-y);
  width: var(--door-w); height: var(--door-h);
  translate: -50% -50%;
}
.doorway {
  overflow: hidden;
  border-radius: 50% 50% 1% 1% / 28% 28% 1% 1%;
  background: radial-gradient(ellipse at 46% 57%, #fff4c7 5%, #ffdd8f 47%, #fcc165 77%, #d7752c);
  box-shadow: 0 0 13px #ffd67c, 0 0 50px #ffc164bd, 0 0 85px #f69c478c;
  opacity: 0;
  perspective: 550px;
  pointer-events: none;
}
.door-leaf {
  display: block;
  width: 100%; height: 100%;
  background: linear-gradient(95deg, #6d4222, #a06c35 39%, #7b4a23);
  transform-origin: 0 50%;
  backface-visibility: hidden;
}
.door {
  min-width: 44px; min-height: 44px;
  padding: 0; border: 0;
  border-radius: 50% 50% 1% 1% / 28% 28% 1% 1%;
  background: transparent;
  cursor: pointer;
  outline-offset: 4px;
  z-index: 1;
}
.door-label, .key-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  white-space: nowrap;
  padding: .5em 1.15em .58em;
  min-width: 6.2em;
  color: #fff0cf;
  background: linear-gradient(165deg, #353642, #171f2b 70%);
  border: 1px solid #d1af71;
  border-radius: 4px;
  box-shadow: inset 0 0 0 2px #232834, inset 0 0 0 3px #c7a2634d, 0 3px 10px #12171c8c;
  font-size: 21px;
  line-height: 1.1;
  font-weight: 400;
  letter-spacing: -.035em;
}
.door-label {
  position: absolute;
  top: calc(100% + clamp(12px, 2.1svh, 24px)); left: 50%;
  transform: translateX(-50%);
}
.door:is(:hover,:focus-visible) .door-label, .key-button:is(:hover,:focus-visible) {
  border-color: #ffe6aa;
  background: linear-gradient(165deg, #48434a, #222c3b 70%);
}
button:focus-visible { outline: 3px solid #fff3d2; }
.door:focus-visible .door-label { outline: 3px solid #fff3d2; outline-offset: 3px; }
.window-one { --x: var(--w1-x); --y: var(--w1-y); --w: var(--w1-w); --h: var(--w1-h); --delay: .22s; }
.window-two { --x: var(--w2-x); --y: var(--w2-y); --w: var(--w2-w); --h: var(--w2-h); --delay: .45s; }
.window-three { --x: var(--w3-x); --y: var(--w3-y); --w: var(--w3-w); --h: var(--w3-h); --delay: .66s; }
.window-four { --x: var(--w4-x); --y: var(--w4-y); --w: var(--w4-w); --h: var(--w4-h); --delay: .83s; }
.window-light {
  position: absolute;
  left: var(--x); top: var(--y); width: var(--w); height: var(--h);
  translate: -50% -50%;
  opacity: 0;
  background:
    var(--bars, var(--lower-bars)),
    linear-gradient(0deg, transparent 46%, #402e1c 47% 50%, transparent 51%),
    radial-gradient(ellipse at 50% 86%, #ffe49f, #e8a54f 56%, #9b542c);
  box-shadow: 0 0 12px 2px #ffbe5e92, 0 0 32px 5px #ef9f583c;
  mix-blend-mode: screen;
  pointer-events: none;
}
.window-three, .window-four { --bars: var(--upper-bars); }
.spill {
  position: absolute;
  left: calc(var(--door-x) - var(--door-w) * 1.25);
  top: calc(var(--door-y) + var(--door-h) * .45);
  width: calc(var(--door-w) * 3.2);
  height: calc(var(--door-h) * .78);
  opacity: 0;
  mix-blend-mode: screen;
  filter: blur(5px);
  pointer-events: none;
}
.spill::before {
  content: ''; position: absolute; inset: 0;
  clip-path: polygon(27% 0, 56% 0, 99% 99%, 0 80%);
  background: radial-gradient(ellipse 70% 138% at 42% 0, #ffd477 3%, #f0a74dc9 30%, #efa34d59 59%, transparent 80%);
}
.art-missing .doorway { opacity: 1; }
.art-missing .window-light { display: none; }
.welcomed .doorway { opacity: 1; }
.welcomed .door-leaf { animation: open-door .78s .08s cubic-bezier(.32,.08,.25,1) both; }
.welcomed .window-light { animation: light-window .39s var(--delay) ease-out both; }
.welcomed .spill { animation: light-window .65s .12s ease-out both; }
.welcomed .scene { animation: enter-home .76s .88s cubic-bezier(.64,.01,.86,.34) both; }
.welcomed .wordmark, .welcomed .door-label { animation: step-away .36s .24s ease-in both; }
@keyframes open-door { to { transform: rotateY(-88deg); filter: brightness(.59); } }
@keyframes light-window { to { opacity: 1; } }
@keyframes enter-home { from { transform: scale(1); } to { transform: scale(12); } }
@keyframes step-away { to { opacity: 0; } }
.status, .notice {
  margin: 0;
  font: 500 14px/1.5 system-ui, sans-serif;
  text-align: center;
}
.gate-status, .notice {
  position: absolute;
  z-index: 2;
  bottom: max(15px, env(safe-area-inset-bottom));
  left: 50%; transform: translateX(-50%);
  width: max-content; max-width: min(calc(100% - 26px), 490px);
}
.gate-status:not(:empty), .notice {
  padding: 8px 14px;
  border: 1px solid #b79966;
  border-radius: 4px;
  color: #fff1d4; background: #19212c;
}
.invitation {
  display: grid;
  align-items: center;
  padding: max(165px, 18vh) 5.5vw max(28px, env(safe-area-inset-bottom));
}
.invitation .world::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #0b142470, transparent 61%);
  pointer-events: none;
}
.letter {
  position: relative;
  isolation: isolate;
  width: clamp(297px, 26vw, 410px);
  padding: clamp(26px, 4.2vh, 48px) clamp(26px, 3vw, 45px);
  border: 1px solid #d0b989;
  border-radius: 2px;
  color: #362b25;
  text-align: center;
  background:
    radial-gradient(ellipse at 2% 100%, #c4a47474, transparent 53%),
    radial-gradient(ellipse at 89% 3%, #fff3d1 7%, transparent 49%),
    linear-gradient(126deg, #e8d1a5, #f0dfb9 40%, #e5cda2);
  box-shadow: 0 15px 36px #10172267, 2px 4px 0 #8f754f, 3px 6px 0 #dcc69c;
}
.letter::before {
  content: '';
  position: absolute; inset: 9px;
  border: 1px solid #93774965;
  outline: 1px solid #987c4a45;
  outline-offset: 3px;
  pointer-events: none;
}
.key-imprint { width: 56%; margin: 0 auto clamp(16px, 3vh, 32px); }
.key-imprint svg { display: block; width: 100%; filter: drop-shadow(0 3px 2px #573a2148); }
.invite-title {
  font-size: clamp(32px, 3.25vw, 50px);
  font-weight: 400;
  letter-spacing: -.055em;
  line-height: 1.08;
  max-width: 7.25em;
  margin: 0 auto clamp(23px, 3.4vh, 39px);
  text-wrap: balance;
}
.key-button { min-height: 46px; cursor: pointer; }
.key-button:focus-visible { outline-color: #1e2b3c; outline-offset: 4px; }
.key-button:disabled:not([aria-busy]) { background: #575047; }
.letter .status:not(:empty) { margin: 18px auto 0; }
.welcomed .letter { animation: step-away .55s .2s ease-in both; }

@media (orientation: portrait) {
  .scene {
    --image-ratio: .449733;
    --door-x: 50.8%; --door-y: 59.06%; --door-w: 15.93%; --door-h: 13.74%;
    --w1-x: 21.7%; --w1-y: 58.07%; --w1-w: 9.16%; --w1-h: 5.03%;
    --w2-x: 80.02%; --w2-y: 57.91%; --w2-w: 9.04%; --w2-h: 4.81%;
    --w3-x: 43.52%; --w3-y: 46.18%; --w3-w: 6.18%; --w3-h: 3.9%;
    --w4-x: 58.09%; --w4-y: 46.12%; --w4-w: 5.59%; --w4-h: 3.8%;
    --moon-x: 21%; --moon-y: 20%;
  }
  .wordmark {
    left: 50%; top: max(12.7svh, calc(env(safe-area-inset-top) + 12px));
    transform: translateX(-50%);
    font-size: clamp(54px, 12.8vw, 88px);
  }
  .wordmark::after { margin: .25em auto 0; }
  .door-label { font-size: 20px; }
  .moon { width: 4.2%; }
  .invitation {
    align-items: end;
    justify-items: center;
    padding: max(145px, 25vh) 18px max(5.5svh, calc(env(safe-area-inset-bottom) + 13px));
  }
  .invitation .world::after { background: linear-gradient(0deg, #07111bc9, transparent 56%); }
  .letter { width: min(100%, 355px); padding: 23px 26px 25px; }
  .key-imprint { width: 93px; margin-bottom: 10px; }
  .invite-title { font-size: clamp(29px, 7.3vw, 39px); max-width: none; margin-bottom: 17px; }
}
@media (max-height: 550px) and (orientation: landscape) {
  .world { height: 100%; }
  .wordmark { top: max(17px, env(safe-area-inset-top)); font-size: 44px; }
  .door-label { top: calc(100% + 4px); font-size: 17px; }
  .invitation { padding-top: 81px; padding-bottom: 18px; }
  .letter { padding: 21px; }
  .key-imprint { width: 76px; margin-bottom: 10px; }
  .invite-title { font-size: 28px; margin-bottom: 15px; }
}
@media (min-aspect-ratio: 2/1) {
  .scene { top: 78%; translate: -50% -78%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .welcomed .window-light, .welcomed .spill { opacity: 1; }
  .welcomed .door-leaf { visibility: hidden; }
}
