:root {
  color-scheme: light;
  --gold: #806533;
  --gold-edge: #ae9463;
  --ink: #514a51;
  --purple: #704e76;
  --serif: Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { margin: 0; background: #fff; color: var(--ink); font: 16px/1.75 system-ui, sans-serif; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 4px; }
h1, h2, h3, .signature { color: var(--gold); font-family: var(--serif); font-weight: normal; line-height: 1.12; }
h2 { font-size: clamp(2.15rem, 5.4vw, 3.3rem); margin: 16px 0 24px; }
h3 { font-size: clamp(1.3rem, 3vw, 1.75rem); margin: 5px 0 14px; }
p { margin: 0 0 18px; }

header { max-width: 1000px; margin: auto; padding: 29px 14px 21px; text-align: center; }
.brand { display: inline-block; margin-bottom: 15px; color: var(--gold); text-decoration: none; letter-spacing: .26em; }
.brand em { font-family: var(--serif); letter-spacing: .08em; }
nav { display: flex; justify-content: center; flex-wrap: wrap; column-gap: clamp(.85rem, 2.5vw, 1.7rem); }
nav a { display: inline-flex; align-items: center; min-height: 44px; font-size: .79rem; text-decoration: none; }
nav a:hover { text-decoration: underline; }

main, footer { width: min(100% - 10px, 1000px); margin-inline: auto; text-align: center; }
.strip {
  padding: 11px 8px; margin: 0; background: #e2c2e6; color: #553d58;
  font-size: clamp(.66rem, 2.45vw, .81rem); letter-spacing: .06em; font-weight: 650;
}
.strip span { margin-inline: .5em; }
.hero-inner {
  position: relative; overflow: hidden; padding: clamp(70px, 12vw, 136px) 15px 48px;
  background: radial-gradient(ellipse at 2% 14%, #f8e2ee, transparent 48%),
              radial-gradient(ellipse at 96% 87%, #e2f3f5, transparent 48%),
              radial-gradient(ellipse at 12% 100%, #efe8f8, transparent 46%), #fff;
}
.eyebrow { color: #715629; font-size: .67rem; text-transform: uppercase; letter-spacing: .22em; font-weight: 700; }
h1 { margin: 17px 0 20px; font-size: clamp(3.75rem, 11vw, 6.1rem); line-height: .96; letter-spacing: -.045em; }
.hero-tagline { margin: 28px 0; color: var(--gold); font: italic clamp(1.35rem, 4vw, 2rem)/1.3 var(--serif); }
.divider { display: flex; align-items: center; justify-content: center; gap: 12px; color: var(--gold); margin: 26px auto; }
.divider::before, .divider::after { content: ''; width: 65px; height: 1px; background: linear-gradient(90deg, transparent, #bba273, transparent); }
.opal-star {
  position: absolute; top: 44px; left: 4%; width: clamp(32px, 8vw, 70px); aspect-ratio: 1;
  background: conic-gradient(from 25deg, #f8ebd9, #d9cdf2, #f9f8f6, #a9d8df, #eed6eb, #fff, #f8ebd9);
  clip-path: polygon(50% 0,58% 34%,86% 14%,65% 42%,100% 50%,65% 58%,86% 86%,58% 66%,50% 100%,42% 66%,14% 86%,35% 58%,0 50%,35% 42%,14% 14%,42% 34%);
}
.letter-stage { position: relative; max-width: 710px; margin: auto; }
.letter-invitation { font-size: clamp(1.05rem, 3vw, 1.3rem); margin-bottom: 34px; }
.envelope-scene { position: relative; width: min(334px, 83%); aspect-ratio: 1.72; margin: 0 auto 30px; }
.envelope { position: absolute; inset: 0; perspective: 700px; }
.envelope-back, .envelope-flap, .envelope-pocket, .letter-in-envelope { position: absolute; inset: 0; }
.envelope-back, .envelope-pocket { border: 1px solid #aa8c50; border-radius: 2px; }
.envelope-back {
  background: linear-gradient(135deg,#fff1f7,#ebdff2 48%, #daedf0);
  box-shadow: 0 14px 35px #8460782b;
}
.envelope-flap {
  z-index: 4; transform-origin: top; transform: rotateX(0);
  clip-path: polygon(0 0,100% 0,50% 67%);
  background: linear-gradient(135deg,#b79b5e,#d5bd85 40%,#9f8249);
  transition: transform .6s ease, z-index 0s .26s;
}
.envelope-flap::before {
  content: ''; position: absolute; inset: 1px 2px 3px; clip-path: inherit;
  background: linear-gradient(155deg,#fff5f9,#efe0ef 50%,#e0dbf1);
}
.envelope-pocket {
  z-index: 3; clip-path: polygon(0 0, 50% 60%, 100% 0, 100% 100%, 0 100%);
  background: linear-gradient(to top right, transparent 49.6%, #b99c6b8c 50%, transparent 50.4%),
              linear-gradient(to top left, transparent 49.6%, #b99c6b8c 50%, transparent 50.4%),
              linear-gradient(135deg,#fbecf5,#eee1f6 65%, #d9eff1);
}
.letter-in-envelope {
  z-index: 2; inset: 10% 12% 4%; border: 1px solid #e0cba6; border-radius: 5px;
  background: linear-gradient(145deg,#fff,#fbf0f3,#fff7e6); box-shadow: 0 5px 18px #7f587e24;
}
.envelope-ribbon { position: absolute; z-index: 5; top: 49%; left: 50%; width: 70%; height: 34%; transform: translate(-50%,-50%); transition: opacity .27s, transform .33s; }
.envelope-ribbon i {
  position: absolute; top: 12%; width: 46%; height: 78%; background: linear-gradient(#ac80b7,#f1d8ef 38%,#b285bc);
  border-radius: 57% 43% 42% 58%; transform: rotate(12deg);
}
.envelope-ribbon i:first-child { left: 0; }
.envelope-ribbon i:nth-child(2) { right: 0; transform: scaleX(-1) rotate(12deg); }
.envelope-ribbon::before {
  position: absolute; content: ''; top: 45%; left: 16%; width: 68%; height: 150%;
  background: linear-gradient(105deg,#9770a5,#edcce8,#b58fbd);
  clip-path: polygon(47% 0,58% 16%,100% 100%,67% 84%,51% 42%,37% 84%,0 100%,42% 13%);
}
.envelope-ribbon span {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 29%; aspect-ratio: 1;
  display: grid; place-items: center; border-radius: 50%; border: 3px double #f9edd3;
  background: radial-gradient(circle at 30% 20%, #faf0cc,#bd9a55 65%,#8d7036);
  color: #fff9e7; font-size: clamp(1.3rem,5vw,2.4rem); text-shadow: 0 0 8px #fff3da;
}
.envelope-touch { position: absolute; z-index: 6; inset: 0; background: transparent; border: 0; border-radius: 6px; }
.letter-stage.opening .envelope-flap { z-index: 1; transform: rotateX(172deg); }
.letter-stage.opening .envelope-ribbon { opacity: 0; transform: translate(-50%,-40%) scale(.82); }
.letter-stage.opening .letter-in-envelope { animation: rise-from-envelope .88s .3s ease-in-out both; }
@keyframes rise-from-envelope { 65% { transform: translateY(-85%); opacity: 1; } to { transform: translateY(-102%); opacity: 0; } }
.welcome {
  position: relative; z-index: 6; max-width: 630px; margin: 24px auto 10px; padding: clamp(24px,6vw,50px);
  border: 1px solid #e4d7b8; border-radius: 7px; transform-origin: center top;
  background: linear-gradient(149deg,#fff 40%,#fcf3f8 80%,#fbf8ee);
  box-shadow: 0 16px 46px #62485c1c; animation: unfold .78s ease-out both;
}
.welcome p { margin-bottom: 17px; }
.letter-ending { color: var(--gold); font: italic clamp(1.28rem,4vw,1.8rem)/1.3 var(--serif); }
.letter-action { display: grid; justify-items: center; gap: 16px; animation: show-letter-action .25s .79s both; }
@keyframes show-letter-action {
  from { opacity: 0; visibility: hidden; }
  to { opacity: 1; visibility: visible; }
}
@keyframes unfold {
  from { opacity: 0; transform: translateY(clamp(-246px,-39vw,-148px)) scale(.48,.16) rotateX(-35deg); clip-path: inset(0 0 72% 0); }
  36% { opacity: 1; transform: translateY(-60px) scale(.74,.32); clip-path: inset(0 0 42% 0); }
  to { opacity: 1; transform: none; clip-path: inset(0 -10% -20% -10%); }
}
.primary, .outline {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; border-radius: 99px; font-size: .84rem; text-decoration: none; padding: 9px 18px;
}
.primary { padding-inline: 25px; color: white; border: 1px solid var(--purple); background: var(--purple); box-shadow: 0 7px 20px #704e7621; font-weight: 650; }
.outline { color: #56415a; border: 1px solid #ad92b1; background: #fffafdbb; }
.primary:hover { background: #583861; }
.outline:hover { background: #f9eef9; }

.calendar-section {
  position: relative; padding: 50px 9px 40px;
  background: radial-gradient(ellipse at 7% 15%,#f6dce9,transparent 58%),
              radial-gradient(ellipse at 86% 32%,#d1ebed,transparent 54%),
              radial-gradient(ellipse at 5% 95%, #dcd0ee,transparent 55%),
              radial-gradient(ellipse at 96% 96%, #f3d9e7,transparent 57%), #fff;
}
.calendar-section:focus { outline: 0; }
.section-copy { max-width: 600px; margin: 0 auto 22px; padding: 0 7px; }
.wheel { width: min(100%, 630px); aspect-ratio: 1; position: relative; margin: 3px auto 12px; --door-width: clamp(42px,8.2vw,67px); }
.wheel::before, .wheel::after { content: ''; position: absolute; border-radius: 50%; pointer-events: none; }
.wheel::before { inset: 7%; border: 1px solid #bca37191; }
.wheel::after { inset: 18%; border: 1px solid #fff9; }
.wheel-center { position: absolute; inset: 20%; display: grid; place-content: center; color: var(--ink); }
.wheel-center p { margin: 0 0 12px; color: var(--gold); font: italic clamp(1.28rem,5.1vw,3rem)/1.14 var(--serif); }
.wheel-center > span:not(.opal-star) { font-size: clamp(.68rem,2.6vw,1rem); }
.wheel-center .opal-star { position: absolute; top: 1%; left: 0; width: clamp(22px,6vw,54px); }
.door {
  position: absolute; top: var(--y); left: var(--x); translate: -50% -50%;
  display: grid; justify-items: center; align-content: center; gap: 0;
  width: var(--door-width); min-width: 44px; aspect-ratio: .89;
  border: clamp(2px,.55vw,5px) solid var(--gold-edge); border-radius: 50% 50% 17% 17% / 46% 46% 15% 15%;
  color: #654d27; background: linear-gradient(145deg,#fff,#f8e6eb); box-shadow: inset 0 0 0 1px #fff8, 0 5px 10px #8f71582a;
  transition: transform .24s, box-shadow .24s;
}
.door:nth-child(3n+2) { background: linear-gradient(145deg,#fff,#e3d8f3); }
.door:nth-child(3n) { background: linear-gradient(145deg,#fff,#d5edf0); }
.door:hover, .door.previewing { transform: scale(1.11); z-index: 2; box-shadow: 0 0 18px #e2b96aa8; }
.door[data-collected] { background: linear-gradient(145deg,#fffdf0,#f1db9d); }
.door b { font: clamp(1.17rem, 4vw, 2.05rem)/.95 var(--serif); }
.door small { font-size: clamp(.5rem,1.65vw,.65rem); line-height: 1.35; }
.door-dot { position: absolute; right: 11%; bottom: 17%; height: 4px; aspect-ratio: 1; border-radius: 50%; background: var(--gold-edge); }
.daily-time { font-size: .84rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px; margin: 0 auto 17px; }
.signature { font-style: italic; font-size: clamp(1.25rem,3.8vw,1.85rem); margin: 18px auto 5px; }

.stages {
  display: grid; grid-template-columns: repeat(2, 1fr);
  gap: clamp(8px,2vw,18px); padding: 27px clamp(8px,3vw,27px);
}
.stages article { background: radial-gradient(at 21% 0%, #fff8,transparent 62%),#f4d6e5; border-radius: 11px; padding: 16px clamp(8px,2vw,20px); }
.stages article:nth-child(2) { background-color: #e4d9f3; }
.stages article:nth-child(3) { background-color: #cde8ed; }
.stages article:nth-child(4) { background-color: #eee1f0; }
.stages article > span { display: block; min-height: 36px; text-align: left; color: var(--gold); font-size: 30px; line-height: 1.1; }
.stages article p { font-size: clamp(.75rem,2vw,.91rem); margin: 0; }
.collection { background: linear-gradient(160deg,#fbf0f7,#fff 45%,#eef8f8); padding: 47px 12px; }
.collection h2 { margin-top: 12px; }
#count { color: var(--gold); font: 1.85rem var(--serif); margin-bottom: 10px; }
#progress { appearance: none; display: block; width: min(420px,79%); height: 8px; margin: 0 auto 24px; border: 0; border-radius: 8px; background: #e8dfeb; }
#progress::-webkit-progress-bar { background: #e8dfeb; border-radius: 8px; }
#progress::-webkit-progress-value { background: #aa8849; border-radius: 8px; }
#progress::-moz-progress-bar { background: #aa8849; border-radius: 8px; }
#keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 9px 12px; list-style: none; margin: 0 auto 22px; padding: 0; max-width: 625px; }
#keys li { display: grid; justify-items: center; align-content: center; gap: 5px; color: #807084; width: 44px; }
#keys li.collected { color: #886728; }
#keys small { font-size: .68rem; }
.key-icon { display: inline-block; width: 23px; height: 31px; position: relative; color: inherit; opacity: .8; }
.key-icon::before { content: ''; position: absolute; left: 3px; top: 0; width: 12px; height: 11px; border: 2px solid currentColor; border-radius: 43% 55% 40% 55%; box-shadow: inset 0 0 0 2px #fff9; }
.key-icon::after { content: ''; position: absolute; left: 9px; top: 13px; width: 10px; height: 16px; background: currentColor; clip-path: polygon(0 0,35% 0,35% 36%,85% 36%,85% 57%,35% 57%,35% 77%,99% 77%,99% 95%,0 95%); }
.key-icon.golden { color: #9c7535; scale: 1.15; opacity: 1; }
.collection-note { font-size: .79rem; }
footer { padding: 25px 12px 40px; }
footer .telegram { margin-top: 14px; border-color: var(--gold-edge); }
footer .eyebrow { margin-top: 14px; }
dialog {
  width: min(92vw,570px); max-height: 90dvh; padding: 14px clamp(16px,5vw,30px) 28px;
  border: 1px solid #d6bd93; border-radius: 17px;
  background: linear-gradient(145deg,#fffdf9,#fbf1f9); color: var(--ink); text-align: center;
}
dialog::backdrop { background: #37293b88; }
dialog form { display: flex; justify-content: flex-end; }
dialog h2 { margin-top: 5px; }
.close { min-width: 44px; min-height: 44px; border: 1px solid #c8b3c9; border-radius: 50%; background: #fff; color: #59435c; font-size: 21px; }
#door-content { overflow-wrap: anywhere; }
#door-content p { white-space: pre-line; }
#door-content a { display: block; color: var(--purple); margin-top: .6em; }
#door-content :is(img,audio,iframe) { display: block; max-width: 100%; margin: 12px auto; }
#door-content iframe { width: 100%; aspect-ratio: 16/9; border: 0; }
.dust { position: fixed; pointer-events: none; z-index: 30; color: #956e2c; text-shadow: 0 0 6px #fff, 0 0 12px #fff; animation: scatter .8s ease-out both; }
@keyframes scatter { to { opacity: 0; transform: translate(var(--dx, 12px),var(--dy, 21px)) scale(.25) rotate(65deg); } }
.snow { position: fixed; z-index: 2; pointer-events: none; inset-block-start: -24px; color: #fff; text-shadow: 0 0 4px #a88bba65; animation: snowfall var(--duration) linear infinite; }
@keyframes snowfall { to { transform: translate(17px,110vh) rotate(135deg); } }
@media (max-width: 370px) {
  header { padding-inline: 7px; }
  nav { column-gap: .6rem; }
  nav a { font-size: .73rem; }
  .door { border-width: 2px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .dust, .snow { display: none; }
}
