:root {
  color-scheme: light;
  --ink: #31281f;
  --ink-soft: #5e5144;
  --gold-ink: #755736;
  --gold-line: #b89766;
  --paper: #fdfbf6;
  --display: Didot, "Bodoni 72", "Times New Roman", Georgia, serif;
  --reading: Georgia, "Times New Roman", serif;
  --sans: Arial, Helvetica, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-height: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% 38%, #fffcf7 0%, #faf6ee 47%, #eee5d8 100%);
  font: 1rem/1.5 var(--sans);
}
body::before, body::after {
  content: "";
  position: fixed;
  pointer-events: none;
}
body::before { inset: 0; background: url("doku.png"); z-index: 6; opacity: .42; }
body::after {
  inset: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right))
    max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  border: 1px solid #a3875b40;
  z-index: 5;
}
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible {
  outline: 2px solid #755736;
  outline-offset: 5px;
}
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; }

.layout {
  min-height: 100vh;
  min-height: 100svh;
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  padding: max(73px, calc(env(safe-area-inset-top) + 54px))
    max(23px, calc(env(safe-area-inset-right) + 16px))
    max(25px, calc(env(safe-area-inset-bottom) + 17px))
    max(23px, calc(env(safe-area-inset-left) + 16px));
}
.layout::before, .layout::after {
  content: "";
  position: absolute;
  z-index: -1;
  width: clamp(120px, 23vw, 340px);
  aspect-ratio: 1;
  background: url("dal.svg") center/contain no-repeat;
  pointer-events: none;
  opacity: .2;
}
.layout::before { left: 2.4%; top: 3.8%; }
.layout::after { right: 2.4%; bottom: 3.8%; transform: rotate(180deg); }

.eyebrow {
  color: var(--gold-ink);
  font-size: .65rem;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: .25em;
}
.names {
  font: 400 clamp(2.12rem, 12vw, 4rem)/1.04 var(--display);
  letter-spacing: -.035em;
  margin: 0;
}
.names span {
  color: var(--gold-ink);
  font-size: .79em;
  font-style: italic;
  display: inline-block;
  margin-inline: .035em .075em;
}
.sprig { display: block; width: 102px; height: 34px; color: #947144; margin-inline: auto; }

.sound-control {
  position: absolute;
  z-index: 8;
  top: max(21px, calc(env(safe-area-inset-top) + 11px));
  right: max(21px, calc(env(safe-area-inset-right) + 11px));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid #b89d784f;
  border-radius: 50px;
  background: #fffdf8cc;
  color: #5c4932;
  font-size: .71rem;
  white-space: nowrap;
}
.sound-icon { width: 19px; height: 19px; }
.sound-waves, .is-playing .sound-off { display: none; }
.is-playing .sound-waves { display: initial; }

.cover, .invitation-shell { grid-area: 1 / 1; }
.cover { display: none; }
[data-state="closed"] .cover, [data-state="opening"] .cover {
  width: min(100%, 472px);
  display: block;
  text-align: center;
}
.cover-heading .eyebrow { margin: 12px 0 11px; }
.cover-heading .names { font-size: clamp(2.5rem, 12vw, 5.15rem); }
.cover-date {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: clamp(19px, 3.6vh, 34px) 0 0;
}
.cover-date span {
  width: 25px;
  height: 1px;
  background: #a8885e80;
}
.open-button {
  display: grid;
  width: 100%;
  justify-items: center;
  margin-top: clamp(30px, 6.7vh, 66px);
  padding: 0;
  border: 0;
  background: none;
  border-radius: 2px;
  overflow: visible;
}
.open-label, .map-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  min-height: 47px;
  border: 1px solid #a68a62;
  color: #614928;
  background: #fffcf6b3;
  font-size: .67rem;
  font-weight: 600;
  letter-spacing: .16em;
  padding: 8px 17px;
  text-decoration: none;
}
.open-label { margin-top: clamp(29px, 5.3vh, 52px); }
.open-label svg, .map-button svg, .replay svg { width: 17px; height: 17px; flex: none; }

.envelope {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 5 / 3;
  max-width: 100%;
  perspective: 900px;
  transform-origin: 50% 75%;
}
.envelope-back, .envelope-front, .envelope-flap {
  position: absolute;
  inset: 0;
}
.envelope-back {
  z-index: 0;
  border-radius: 3px;
  background: url("doku.png"), linear-gradient(160deg, #c7b7a3, #e5dace 51%, #f1e9df);
  border: 1px solid #b5a38c;
  box-shadow: 0 24px 41px -19px #533c2769, 0 12px 20px -11px #72543c42, 0 1px 3px #6a513441;
}
.envelope-front {
  z-index: 3;
  background: url("zarf.svg") center/100% 100% no-repeat;
}
.envelope-flap {
  z-index: 4;
  bottom: auto;
  height: 63.5%;
  transform-origin: 50% 1%;
  /* The same paper surface reads correctly from either side of the fold. */
  background: url("kapak.svg") top/100% 100% no-repeat;
}
.seal {
  position: absolute;
  z-index: 5;
  width: 24.4%;
  aspect-ratio: 1;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  background: url("muhur.svg") center/contain no-repeat;
  filter: drop-shadow(1px 4px 3px #59431a6b);
}
.teaser {
  position: absolute;
  z-index: 2;
  display: grid;
  left: 6.5%;
  top: 5%;
  width: 87%;
  height: 91%;
  padding: 3%;
  background: url("doku.png"), #fffdf8;
  border: 1px solid #ded0bb;
  box-shadow: 0 8px 16px #3b2e2524;
  opacity: 0;
  transform-origin: 50% 40%;
}
.teaser-frame {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 5%;
  border: 1px solid #c6ac81;
  padding-top: 7%;
  color: #3e3026;
  font: 400 clamp(1.4rem, 7.8vw, 2.7rem)/1 var(--display);
}
.teaser-frame i { color: var(--gold-ink); font-size: .76em; }
.teaser-frame svg { width: 63px; height: 22px; color: #a88354; }
.teaser-frame small { font: 600 .5rem/1.1 var(--sans); letter-spacing: .19em; color: var(--gold-ink); }

.invitation-shell {
  width: min(100%, 540px);
  display: grid;
  justify-items: center;
}
[data-state="closed"] .invitation-shell { display: none; }
[data-state="opening"] .invitation-shell {
  pointer-events: none;
}
[data-state="opening"] .replay { visibility: hidden; }
.invitation {
  position: relative;
  isolation: isolate;
  width: 100%;
  text-align: center;
  padding: clamp(27px, 5.5vw, 54px) clamp(17px, 7vw, 57px) clamp(30px, 6vw, 48px);
  background: url("doku.png"), linear-gradient(148deg, #fffdfa, #fbf7ef 93%);
  border: 1px solid #d9c9ac;
  box-shadow: 0 19px 45px -19px #60462d4d, 0 4px 14px -6px #6d523126;
}
.invitation::before, .invitation::after {
  content: "";
  position: absolute;
  inset: 8px;
  z-index: -1;
  pointer-events: none;
}
.invitation::before { border: 1px solid #b4966466; }
.invitation::after {
  background: url("dal.svg") left top/auto clamp(64px, 19vw, 120px) no-repeat;
  opacity: .6;
}
.invitation .sprig { width: 94px; height: 30px; }
.letter-lead { margin: 12px 0 13px; }
.invitation .names:focus { outline: none; }
.event-name { margin: 11px 0 0; }
.rule {
  width: 88px;
  margin: clamp(15px, 2.8vh, 23px) auto;
  display: flex;
  gap: 7px;
  align-items: center;
  color: #af8f5b;
}
.rule::before, .rule::after { content: ""; flex: 1; height: 1px; background: currentColor; }
.rule i { width: 5px; height: 5px; border: 1px solid currentColor; transform: rotate(45deg); }
.message {
  max-width: 33ch;
  margin: 0 auto;
  color: var(--ink-soft);
  font: 400 clamp(1rem, 3.8vw, 1.18rem)/1.55 var(--reading);
}
.details { margin: clamp(21px, 4.2vh, 34px) auto clamp(18px, 3.1vh, 25px); }
.event-date, .event-hour { display: block; }
.event-date { font: 400 clamp(1.45rem, 6.5vw, 2.2rem)/1.12 var(--display); letter-spacing: .035em; }
.event-hour { margin-top: 5px; letter-spacing: .17em; }
.venue { margin-top: clamp(17px, 2.85vh, 23px); }
.venue .eyebrow { margin: 0 0 4px; }
address {
  color: var(--ink-soft);
  font: normal clamp(.88rem, 3.6vw, 1rem)/1.45 var(--reading);
}
.map-button { gap: 9px; min-width: 164px; }
.map-button svg:last-child { margin-left: 3px; }
.replay {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin-top: 12px;
  padding: 0 13px;
  min-height: 44px;
  color: #5c4932;
  background: transparent;
  border: 0;
  font-size: .77rem;
}

@media (hover: hover) {
  .sound-control:hover, .map-button:hover, .open-button:hover .open-label { background: #f2e7d7; }
  .replay:hover { text-decoration: underline; text-underline-offset: 4px; }
}
@media (min-width: 600px) {
  body::after {
    inset: max(19px, env(safe-area-inset-top)) max(19px, env(safe-area-inset-right))
      max(19px, env(safe-area-inset-bottom)) max(19px, env(safe-area-inset-left));
  }
  .sound-control { top: 32px; right: max(33px, calc(env(safe-area-inset-right) + 12px)); }
  .eyebrow { font-size: .69rem; }
}
@media (max-height: 710px) {
  .open-button { margin-top: 27px; }
  .open-label { margin-top: 25px; }
  .cover-date { margin-top: 16px; }
}
@media (orientation: landscape) and (max-height: 590px) {
  [data-state="closed"] .cover, [data-state="opening"] .cover { width: min(100%, 335px); }
  [data-state="opening"] .cover, [data-state="opening"] .invitation-shell { align-self: start; }
  .cover-heading .names { font-size: 3.45rem; }
  .layout::before, .layout::after { max-width: 160px; }
}
@media (max-width: 355px) {
  .sound-control { padding-inline: 10px; }
  .cover-heading .names { font-size: 11.6vw; }
  .invitation .eyebrow { letter-spacing: .17em; }
}

[data-state="opening"] .cover-heading,
[data-state="opening"] .cover-date,
[data-state="opening"] .open-label { animation: fade-cover .56s ease both; }
[data-state="opening"] .envelope { animation: leave-envelope .63s 2.37s ease-in both; }
[data-state="opening"] .seal { animation: lift-seal .84s cubic-bezier(.28,.52,.2,1) both; }
[data-state="opening"] .envelope-flap {
  animation: open-flap 1.21s .47s cubic-bezier(.32,.14,.3,1) both;
}
[data-state="opening"] .teaser {
  animation: raise-letter 1.76s 1.12s cubic-bezier(.25,.52,.3,1) both;
}
[data-state="opening"] .invitation {
  animation: reveal-letter 1.02s 2.53s cubic-bezier(.21,.62,.29,1) both;
}

@keyframes fade-cover { to { opacity: 0; } }
@keyframes lift-seal {
  0% { transform: translate(-50%, -50%); }
  39% { transform: translate(-45%, -65%) rotate(-11deg) scale(1.09); }
  100% { opacity: 0; transform: translate(11%, -112%) rotate(13deg) scale(.87); }
}
@keyframes open-flap {
  0% { z-index: 4; transform: rotateX(0deg); }
  40% { z-index: 4; transform: rotateX(-88deg); }
  41% { z-index: 1; transform: rotateX(-91deg); }
  100% { z-index: 1; transform: rotateX(-174deg); }
}
@keyframes raise-letter {
  0% { opacity: 0; transform: translateY(0); }
  16% { opacity: 1; }
  61% { opacity: 1; transform: translateY(-74%) scale(1.025); }
  83% { opacity: 1; transform: translateY(-103%) scale(1.07); }
  100% { opacity: 0; transform: translateY(-112%) scale(1.12); }
}
@keyframes leave-envelope { to { opacity: 0; transform: translateY(26px) scale(.97); } }
@keyframes reveal-letter {
  from { opacity: 0; transform: translateY(15px) scale(.965); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; scroll-behavior: auto !important; }
}
