/* All sizes, positions and animations below mirror the original invitation
   (measured from its live page). Base rules = phones, @media 768px+ = desktop. */
:root {
  --gold: #b97d3e;
  --olive: #8d8f58;
  --muted: #a3936a;
  --paper: #fbf8f1;
  /* same font stacks as the original; only Lora, Viaoda Libre, Alex Brush and
     EB Garamond are web fonts, the rest come from the device */
  --serif: Baskerville, "Libre Baskerville", "Times New Roman", serif;
  --arabic-head: "Cormorant Garamond", "Noto Naskh Arabic", "Times New Roman", serif;
  --times: "Times New Roman", Times, serif;
  --sys: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --lora: Lora, "Times New Roman", serif;
  --script: "Alex Brush", "The Nautigal", cursive;
  --display: "Viaoda Libre", "EB Garamond", cursive;
  --garamond: "EB Garamond", serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: #fff;
  color: var(--olive);
  font-family: var(--serif);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.js:not(.skip-envelope) body.locked { overflow: hidden; height: 100vh; }
p, h1, h2 { margin: 0; font-weight: inherit; }
button { font: inherit; }
img { display: block; }
[hidden] { display: none !important; }

/* ======================= Cover ======================= */
.envelope { display: none; }
html.js:not(.skip-envelope) .envelope {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 16px;
  background:
    linear-gradient(to bottom right, rgba(138, 90, 42, .9), rgba(185, 125, 62, .9), rgba(216, 175, 135, .9)),
    url("img/bg-1440.webp") center / 1200px repeat,
    #b97d3e;
}

/* falling blossoms (generated in app.js) */
.petals { position: absolute; inset: 0; z-index: 1; overflow: hidden; pointer-events: none; }
.petal {
  position: absolute;
  top: -30px;
  color: #f3e9d6;
  line-height: 0;
  animation-name: ambient-fall;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
}
.petal svg, .particle svg { width: 1em; height: 1em; fill: currentColor; }

.card {
  position: relative;
  z-index: 10;
  width: 310px;
  max-width: 100%;
  border-radius: 8px;
  box-shadow: 0 25px 60px -12px rgba(0, 0, 0, .45), 0 8px 24px rgba(0, 0, 0, .2), 0 0 40px rgba(185, 125, 62, .15);
  text-align: center;
}
@media (min-width: 640px)  { .card { width: 340px; } }
@media (min-width: 768px)  { .card { width: 520px; } }
@media (min-width: 1024px) { .card { width: 600px; } }
.card.away { animation: envelope-away .8s ease-in forwards; }

.card-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(251, 248, 241, .98);
  border: 1px solid rgba(185, 125, 62, .15);
  clip-path: inset(0 round 8px);
}
.card-fl { position: absolute; width: 42%; max-width: 220px; pointer-events: none; }
.card-fl.tl { top: 0; left: 0; transform: translate(-28%, -28%) rotate(8deg); }
.card-fl.br { bottom: 0; right: 0; transform: translate(28%, 28%) rotate(8deg) scaleX(-1); }
.card-fl img { width: 100%; height: auto; opacity: .5; }
.card-fl img.fly { animation: dragon-fly-forward 1.2s ease-in forwards; }
.card-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(at center top, rgba(185, 125, 62, .2) 0%, transparent 70%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.envelope.opening .card-glow { opacity: 1; }

.seal {
  position: absolute;
  z-index: 30;
  top: 50px;
  left: 50%;
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 30% 30%, #b97d3e, #9b5f20);
  --shadow-color: rgba(185, 125, 62, .5);
  box-shadow: 0 4px 20px rgba(185, 125, 62, .5), inset 0 2px 4px rgba(255, 255, 255, .3);
  animation: seal-pulse 2s ease-in-out infinite;
}
.seal svg { width: 28px; height: 28px; }
.seal.breaking { animation: seal-break .5s cubic-bezier(.4, 0, .2, 1) forwards; }
.seal-ring {
  position: absolute;
  z-index: 29;
  top: 50px;
  left: 50%;
  width: 56px;
  height: 56px;
  border: 3px solid #b97d3e;
  border-radius: 50%;
  pointer-events: none;
  animation: seal-ring .6s ease-out forwards;
}

.card-body { position: relative; z-index: 10; padding: 112px 24px 56px; }
@media (min-width: 768px) { .card-body { padding: 96px 24px 32px; } }
.env-names {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0 8px;
  font-family: var(--display);
  font-weight: 400;
  font-size: 30px;
  line-height: 1.25;
  color: var(--gold);
}
.env-amp { font-family: var(--script); font-size: 18px; line-height: 1; }
@media (min-width: 640px) {
  .env-names { font-size: 36px; }
  .env-amp { font-size: 20px; }
}
.env-rule { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 0 0 8px; }
.env-rule .ln { width: 40px; height: 1px; }
.env-rule .ln.l { background: linear-gradient(to right, transparent, var(--gold)); }
.env-rule .ln.r { background: linear-gradient(to left, transparent, var(--gold)); }
.fleuron { font-family: var(--sys); font-size: 14px; line-height: 20px; color: var(--gold); opacity: .7; }
.env-date {
  margin: 0 0 24px;
  font-family: var(--lora);
  font-weight: 300;
  font-size: 18px;
  line-height: 27px;
  color: rgba(141, 143, 88, .85);
}
.open-btn {
  position: relative;
  overflow: hidden;
  display: flex;
  width: fit-content;
  margin: 0 auto;
  padding: 10px 32px;
  border: 0;
  border-radius: 999px;
  background: var(--gold);
  color: #fff;
  font-family: var(--lora);
  font-weight: 600;
  font-size: 18px;
  line-height: 28px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(185, 125, 62, .35);
}
@media (min-width: 640px) { .open-btn { font-weight: 500; } }
.open-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.open-label { position: relative; }
.shine {
  position: absolute;
  top: 0;
  left: -100%;
  width: 32px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .4), transparent);
  pointer-events: none;
  animation: shine 3s ease-in-out infinite;
}

/* sparkle burst when opening (generated in app.js) */
.burst { position: absolute; inset: 0; z-index: 100; pointer-events: none; }
.particle {
  position: absolute;
  left: 50%;
  top: 50%;
  line-height: 0;
  opacity: 0;
  animation: particle-burst 1.4s cubic-bezier(.25, .46, .45, .94) forwards;
}

/* ======================= Invitation ======================= */
.paper {
  position: relative;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--paper);
  isolation: isolate;
  overflow: hidden;
  text-align: center;
}
.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("img/bg-1440.webp") 0 0 / 286% auto repeat;
  opacity: .06;
}
@media (min-width: 768px) { .paper { max-width: 900px; border: 1px solid rgba(185, 125, 62, .2); } }

.deco { position: absolute; height: auto; max-width: none; pointer-events: none; }

/* ---- hero ---- */
.hero { position: relative; isolation: isolate; padding: 96px 24px 32px; }
.hero-tr {
  top: 0; right: 0; width: 63%; z-index: 0; opacity: .2;
  transform: translate(42%, -42%) rotate(45deg);
}
.hero-l {
  left: 0; top: 485px; width: 32%; z-index: 30;
  will-change: transform;
  transform: translateX(-40%) scaleY(1) rotate(45deg) translateY(var(--py, 0px));
}
@media (min-width: 768px) {
  .hero-tr { width: 51%; }
  .hero-l { top: 700px; width: 28%; }
}
.ar-head {
  position: relative;
  z-index: 30;
  font-family: var(--arabic-head);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.5;
  color: var(--gold);
  white-space: pre-line;
}
@media (min-width: 768px) { .ar-head { font-size: 20px; } }
.frame {
  position: relative;
  z-index: 10;
  width: min(520px, 100%);
  aspect-ratio: 1074 / 1293;
  margin: 36px auto 0;
  container-type: inline-size;
}
.frame-img { position: absolute; inset: 0; width: 100%; height: 100%; }
.frame-names {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-family: var(--display);
  color: var(--gold);
  text-transform: uppercase;
}
.fn-row { display: flex; width: 56%; justify-content: center; }
.fn { white-space: nowrap; font-size: min(47px, 9.04cqw); line-height: 1.25; padding-top: .16em; }
.fn-amp {
  margin: 8px 0;
  font-family: var(--script);
  font-size: min(24px, 4.62cqw);
  text-transform: none;
  line-height: 1;
  opacity: .95;
}
@media (min-width: 768px) { .fn-amp { margin: 12px 0; } }

/* ---- main section: verses, couple, party details, calendar ---- */
.main { position: relative; isolation: isolate; z-index: 10; padding: 16px 12px 16px; }
@media (min-width: 768px) { .main { padding: 40px 24px 24px; } }
.main > :not(.deco) { position: relative; z-index: 1; }
.tiet-l {
  top: 290px; left: 0; width: 34%; opacity: .9;
  will-change: transform;
  transform: translateX(-52%) scaleX(-1) translateY(var(--py, 0px));
}
.tiet-r {
  top: 160px; right: 0; width: 34%; opacity: .9;
  will-change: transform;
  transform: translateX(62%) scaleX(-1) translateY(var(--py, 0px));
}
@media (min-width: 768px) {
  .tiet-l { top: 330px; width: 26%; }
  .tiet-r { top: 190px; width: 26%; }
}

.dots {
  font-family: var(--times);
  font-weight: 700;
  font-size: 24px;
  line-height: 36px;
  letter-spacing: 1.44px;
  color: var(--gold);
}
.ar-text { color: var(--gold); white-space: pre-line; }
.ann { margin-top: 32px; font-size: 20px; line-height: 30px; }

.couple { margin-top: 32px; }
.name {
  width: 80%;
  min-height: 80px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  font-family: var(--garamond);
  font-weight: 400;
  font-size: min(66px, 17vw);
  line-height: 46px;
  color: var(--olive);
}
.role {
  margin-top: 16px;
  font-size: 12px;
  line-height: 16px;
  letter-spacing: 2.4px;
  text-transform: uppercase;
}
.amp-lg { margin: 16px 0; font-family: var(--script); font-size: 28px; line-height: 1.5; color: var(--gold); }
@media (min-width: 768px) {
  .name { line-height: 64px; }
  .amp-lg { font-size: 38px; }
}

.when { position: relative; margin-top: 120px; }
.when > :not(.pillar) { position: relative; z-index: 1; }
.pillar {
  position: absolute;
  top: -7.5%;
  height: 115%;
  width: auto;
  max-width: none;
  z-index: 0;
  pointer-events: none;
}
.pillar-l { left: -12px; transform: translateX(-50%); }
.pillar-r { right: -12px; transform: translateX(50%) scaleX(-1); }
@media (min-width: 768px) {
  .pillar-l { left: -24px; }
  .pillar-r { right: -24px; }
}
.ar-title {
  font-family: var(--times);
  font-weight: 700;
  font-size: 24px;
  line-height: 36px;
  color: var(--gold);
}
.kicker {
  font-weight: 600;
  font-size: 20px;
  line-height: 30px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  color: var(--gold);
  text-wrap: balance;
}
.time { margin-top: 20px; font-size: 20px; line-height: 1.5; }
.dateline {
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  font-size: 16px;
  line-height: 24px;
  text-transform: uppercase;
}
.dateline .day { font-size: 30px; line-height: 1.5; }
.dateline .bar { width: 2px; height: 32px; background: var(--olive); }
.year { margin-top: 20px; font-size: 18px; line-height: 1.5; }
.kicker-sm { margin-top: 36px; font-size: 18px; line-height: 27px; letter-spacing: 1.44px; }
.countdown { margin-top: 8px; font-size: 18px; line-height: 28px; font-variant-numeric: tabular-nums; }
@media (min-width: 768px) {
  .time { font-size: 30px; }
  .dateline .day { font-size: 40px; }
  .year { font-size: 24px; }
}

.calendar {
  width: min(440px, 100%);
  margin: 39px auto 0;
  padding: 20px clamp(28px, 10vw, 44px) 28px;
}
.cal-frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: fill; pointer-events: none; }
.cal-title {
  position: relative;
  padding: 10px 0;
  border-bottom: 1px solid rgba(185, 125, 62, .25);
  font-family: var(--sys);
  font-weight: 600;
  font-size: 13px;
  line-height: 21px;
  letter-spacing: .35px;
}
.cal-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  font-family: var(--sys);
  font-weight: 300;
  font-size: 12px;
  line-height: 19.5px;
}
.cal-grid .wd { padding: 6px 0; margin-bottom: 8px; font-size: 10px; line-height: 16.5px; font-weight: 500; opacity: .6; }
.cal-grid .d { height: 36px; display: grid; place-items: center; position: relative; }
.cal-grid .d.hl { color: #fff; font-weight: 700; font-size: 11px; z-index: 0; isolation: isolate; }
.cal-grid .d.hl::before {
  content: "";
  position: absolute;
  width: 26px; height: 26px;
  left: 50%; top: 50%;
  transform: translate(-50%, -46%);
  background: url("img/heart.svg") center / contain no-repeat;
  z-index: -1;
}
@media (min-width: 768px) {
  .cal-title { font-size: 14px; }
  .cal-grid { font-size: 13px; }
  .cal-grid .wd { font-size: 11px; }
  .cal-grid .d.hl { font-size: 12px; }
}

.text-link {
  display: inline-flex;
  margin-top: 12px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--olive);
  font-family: var(--serif);
  font-weight: 300;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: .7px;
  text-decoration: underline;
  text-underline-offset: 4px;
  cursor: pointer;
}
.divider { display: flex; justify-content: center; margin-top: 24px; height: 53px; }
.divider img { height: 100%; width: auto; opacity: .9; transform: translateY(13px); }
@media (min-width: 768px) { .divider { height: 68px; } }

/* ---- venue ---- */
.where { position: relative; padding: 32px 24px 64px; }
@media (min-width: 768px) { .where { padding-top: 40px; } }
.map-link-wrap { margin-top: 12px; }
.map-link {
  display: inline-block;
  max-width: 100%;
  padding: 0 8px 12px;
  border-bottom: 1px solid rgba(141, 143, 88, .15);
  color: var(--olive);
  font-size: 16px;
  line-height: 24px;
  letter-spacing: .4px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.map {
  display: block;
  width: 100%;
  max-width: 340px;
  height: 280px;
  margin: 32px auto 0;
  border: 0;
  border-radius: 16px;
}
.directions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
  padding: 8px 20px;
  border-radius: 999px;
  color: var(--olive);
  font-weight: 600;
  font-size: 14px;
  line-height: 20px;
  text-decoration: none;
}
.directions svg { width: 15px; height: 15px; }
@media (min-width: 768px) {
  .map { max-width: 560px; height: 380px; }
  .directions { font-size: 16px; line-height: 24px; }
}

/* ---- decorations anchored to the whole column ---- */
.col-hoa-bl {
  bottom: 0; left: 0; width: 63%; z-index: 0; opacity: .2;
  transform: translate(-42%, 42%) rotate(225deg);
}
.col-tiet-r {
  bottom: 380px; right: 0; width: 39%; opacity: .9;
  will-change: transform;
  transform: translateX(55%) scaleX(-1) translateY(var(--py, 0px));
}
@media (min-width: 768px) {
  .col-hoa-bl { width: 51%; }
  .col-tiet-r { bottom: 400px; width: 30%; }
}

/* ---- thank-you footer ---- */
.thanks {
  position: relative;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0 24px 64px;
}
@media (min-width: 768px) { .thanks { padding: 0 40px 80px; } }
.thanks-hoa {
  top: 0; left: 5%; width: 32%; z-index: 0;
  will-change: transform;
  transform: translateX(0%) rotate(45deg) translateY(var(--py, 0px));
}
@media (min-width: 768px) { .thanks-hoa { left: 0; width: 28%; } }
.thanks .ar-text { position: relative; z-index: 1; max-width: 560px; font-size: 18px; line-height: 28px; }
.foot {
  position: absolute;
  left: 0; right: 0; bottom: 8px;
  font-family: var(--sys);
  font-size: 12px;
  line-height: 16px;
  opacity: .5;
}

/* ======================= Music button ======================= */
.music { position: fixed; right: 16px; bottom: 56px; z-index: 40; }
.music[hidden] { display: none; }
.music-btn {
  position: relative;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .1), 0 4px 6px -4px rgba(0, 0, 0, .1);
}
.disc {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(to bottom right, rgba(185, 125, 62, .8), #b97d3e, rgba(185, 125, 62, .867));
}
.disc-ring { position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2); }
.note { position: relative; width: 20px; height: 20px; color: #fff; }
.eq { position: relative; display: none; align-items: flex-end; gap: 2px; height: 16px; }
.eq i { width: 4px; background: #fff; border-radius: 999px; animation: dance .4s ease-in-out infinite; }
.eq i:nth-child(1) { height: 60%; }
.eq i:nth-child(2) { height: 100%; animation-delay: .1s; }
.eq i:nth-child(3) { height: 40%; animation-delay: .2s; }
.music-btn[aria-pressed="true"] .disc { animation: spin-cd 3s linear infinite; }
.music-btn[aria-pressed="true"] .note { display: none; }
.music-btn[aria-pressed="true"] .eq { display: flex; }

/* ======================= Keyframes ======================= */
@keyframes ambient-fall {
  0%   { transform: translateY(-8vh) translateX(0) rotate(0deg); opacity: 0; }
  10%  { opacity: .5; }
  50%  { transform: translateY(48vh) translateX(var(--sway, 20px)) rotate(180deg); opacity: .6; }
  92%  { opacity: .45; }
  100% { transform: translateY(105vh) translateX(0) rotate(360deg); opacity: 0; }
}
@keyframes seal-pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 4px 20px var(--shadow-color); }
  50%      { transform: translate(-50%, -50%) scale(1.06); box-shadow: 0 6px 35px var(--shadow-color); }
}
@keyframes seal-break {
  0%   { transform: translate(-50%, -50%) scale(1) rotate(0deg); opacity: 1; filter: brightness(1); }
  30%  { transform: translate(-50%, -50%) scale(1.15) rotate(5deg); opacity: .9; filter: brightness(1.3); }
  60%  { transform: translate(-50%, -50%) scale(1.05) rotate(-3deg); opacity: .5; filter: brightness(1.5); }
  100% { transform: translate(-50%, -50%) scale(0) rotate(15deg); opacity: 0; filter: brightness(2); }
}
@keyframes seal-ring {
  0%   { transform: translate(-50%, -50%) scale(.8); opacity: .8; }
  100% { transform: translate(-50%, -50%) scale(2.5); opacity: 0; }
}
@keyframes envelope-away {
  0%   { transform: translateY(0) rotate(0deg); opacity: 1; }
  15%  { transform: translateY(10px) rotate(.5deg); opacity: 1; }
  100% { transform: translateY(-120vh) rotate(-2deg); opacity: 0; }
}
@keyframes dragon-fly-forward {
  0%   { transform: scale(1); filter: blur(0); opacity: .7; }
  40%  { transform: scale(1.6); filter: blur(2px); opacity: .5; }
  100% { transform: scale(3); filter: blur(10px); opacity: 0; }
}
@keyframes particle-burst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0) rotate(0deg); }
  15%  { opacity: 1; transform: translate(-50%, -50%) scale(1.3) rotate(var(--rot-start, 15deg)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(.6) rotate(var(--rot-end, 180deg)); }
}
@keyframes shine { 0% { left: -100%; } 50%, 100% { left: 100%; } }
@keyframes spin-cd { to { transform: rotate(360deg); } }
@keyframes dance { 0%, 100% { height: 20%; } 50% { height: 100%; } }

@media (prefers-reduced-motion: reduce) {
  .petals, .burst { display: none; }
  .seal, .shine { animation: none; }
}
