/* ============================================================
   Burgundy Envelope Wedding — pixel-accurate rebuild
   Reconstructed from the Canva SingleFile captures.
   Design model: fixed-size canvas (design px) scaled uniformly
   to the viewport and centered, matching Canva's export.
   ============================================================ */

/* ---- Embedded original fonts (extracted from the capture) ---- */
@font-face {
  font-family: "names";            /* YAGLy38gVoc_0 — the couple-names display face */
  src: url("../assets/fonts/names.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "body";             /* YAFdJhX-538_0 — serif body (italic used) */
  src: url("../assets/fonts/body.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "body";
  src: url("../assets/fonts/body-italic.woff") format("woff");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "caps";             /* YAGL3q8RgBA_0 — caps serif (save-the-date / date) */
  src: url("../assets/fonts/caps.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "monogram";         /* YAFdJg7KuRM_0 — large monogram letter */
  src: url("../assets/fonts/monogram.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "calnum";           /* YADpK2K4GhA_0 — calendar numbers / day-of-week */
  src: url("../assets/fonts/calnum.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "script2";          /* YALBs2pfuW0_0 — RSVP "by …" script */
  src: url("../assets/fonts/script2.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  background: #ffffff;
  width: 100%;
  overflow-x: hidden;
}

/* ============================================================
   Canvas scaling model
   Each page declares --dw / --dh (design width/height in px).
   The .canvas is that exact size, scaled by --scale (set by JS
   to viewport-width / design-width) from the top-center origin.
   A spacer element reserves the scaled height so the page flows.
   ============================================================ */
.stage {
  position: relative;
  width: 100%;
  background: #ffffff;
}
.canvas {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--dw);
  height: var(--dh);
  transform: translateX(-50%) scale(var(--scale, 1));
  transform-origin: top center;
  overflow: hidden;
  background: #ffffff;
}

/* Stacked multi-section page: each .section is a flow block whose height is
   reserved by JS (design height × scale). Its .layer is the 1497px design
   canvas, scaled to fit and centered. */
.sections { width: 100%; background:#fff; }
.section {
  position: relative;
  width: 100%;
  overflow: hidden;
}
.section > .layer {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--dw, 1497px);
  height: var(--dh);
  transform: translateX(-50%) scale(var(--scale, 1));
  transform-origin: top center;
}
#page { opacity: 1; }
#page.enter { opacity: 0; animation: fadeIn 1s ease forwards; }

/* Absolutely-positioned element inside the canvas.
   top/left set via inline --x/--y; size via --w/--h. */
.el {
  position: absolute;
  top: 0; left: 0;
  transform: translate(var(--x), var(--y));
  width: var(--w);
  height: var(--h);
}
.el > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
}

/* A text block: centered, white, exact font/size/line-height via vars */
.txt {
  position: absolute;
  top: 0; left: 0;
  transform: translate(var(--x), var(--y));
  width: var(--w);
  height: var(--h);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  color: #ffffff;          /* default; override inline per element */
}
.txt p {
  margin: 0;
  width: 100%;
  text-align: center;
  color: inherit;          /* take the .txt element's (possibly inline) color */
  font-size: var(--fs);
  line-height: var(--lh);
  letter-spacing: var(--ls, 0);
  white-space: pre-line;      /* honour \n line breaks written as real newlines */
}

/* Font role helpers */
.f-names    { font-family: "names",    serif; }
.f-body     { font-family: "body",     serif; }
.f-body-it  { font-family: "body",     serif; font-style: italic; }
.f-caps     { font-family: "caps",     serif; }
.f-monogram { font-family: "monogram", serif; }
.f-calnum   { font-family: "calnum",   serif; }
.f-script2  { font-family: "script2",  serif; }

/* Rotated 90° caption (vertical text) */
.rot90 {
  position: absolute;
  top: 0; left: 0;
  width: var(--w);
  height: var(--h);
  transform: translate(var(--x), var(--y)) rotate(90deg);
  transform-origin: 0 0;
  white-space: nowrap;
}

/* Live countdown (replaces the Reminders section) */
.countdown {
  position: absolute;
  top: 0; left: 0;
  width: var(--w);
  height: var(--h);
  transform: translate(var(--x), var(--y));
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 16px;
}
.cd-unit {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  white-space: nowrap;
}
.cd-num {
  font-size: 72px;
  line-height: 1;
  color: rgb(95, 17, 17);
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}
.cd-word {
  font-size: 26px;
  font-style: italic;
  color: rgb(40, 20, 22);
  letter-spacing: 0.04em;
}
.cd-sep {
  font-family: "caps", serif;
  font-size: 56px;
  line-height: 1;
  color: rgb(95, 17, 17);
  opacity: 0.45;
}

/* ---- Envelope page specifics ---- */
.envelope-stage .seal {
  cursor: pointer;
  background: none;
  border: 0;
  padding: 0;
}
.envelope-stage .seal:focus-visible {
  outline: 3px solid rgba(255,255,255,.7);
  outline-offset: 6px;
  border-radius: 50%;
}

/* Seal open/lift animation (kept from the original interaction) */
.seal { transition: transform .55s ease, opacity .55s ease; }
.envelope-stage.is-opening .seal { transform: translate(var(--x), var(--y)) scale(1.06); opacity: 0; }

/* Burgundy fade-to-details veil */
.transition-veil {
  position: fixed;
  inset: 0;
  background: #5a0d1a;             /* deep burgundy, matches the lace tone */
  opacity: 0;
  pointer-events: none;
  transition: opacity .6s ease;
  z-index: 9999;
}
.transition-veil.is-on { opacity: 1; }

/* Details fade-in on arrival from the envelope */
.details-stage { opacity: 1; }
.details-stage.enter { opacity: 0; animation: fadeIn 1s ease forwards; }
@keyframes fadeIn { to { opacity: 1; } }

/* Monogram letter layered on a plate: two stacked copies
   (shadow + light fill) — rendered as one element with text-shadow. */
.monoletter p {
  color: rgb(239, 239, 239);
  text-shadow: rgba(0,0,0,0.3) 2px 2px 2px;
}

/* Lace drape frame: a clipped window on the canvas holding an
   absolutely-positioned lace image (Canva uses clip-path frames). */
.lace-frame {
  position: absolute;
  overflow: hidden;
}
.lace-frame > img {
  position: absolute;
  display: block;
  max-width: none;
  user-select: none;
  -webkit-user-drag: none;
}

@media (prefers-reduced-motion: reduce) {
  .seal, .transition-veil, .details-stage.enter { transition: none; animation: none; }
}
