:root {
  --red: #862221;
  --ink: #3b2a22;
  --gold: #a8874a;
  --cream: #fffaf0;
  --font-body: "Cormorant Garamond", serif;
  --font-script: "Pinyon Script", cursive;
  --font-arab: "Amiri", serif;
  --w: min(100vw, 480px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--ink);
  background: #e8d7b0;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* One phone screen: ornaments pinned to the corners, content scaled to fit between them (fit.js) */
.flyer {
  position: relative;
  width: var(--w);
  height: 100vh;
  height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  text-align: center;
  background: url("art/bg.webp") center / cover no-repeat, var(--cream);
}
.flyer::before {
  content: ""; position: absolute; inset: 10px; pointer-events: none; z-index: 2;
  border: 1px solid rgba(168, 135, 74, .45);
  outline: 1px solid rgba(168, 135, 74, .25); outline-offset: 4px;
}

.art { position: absolute; pointer-events: none; user-select: none; }
.art-tm { top: 0; left: 0; width: 100%; }
.art-tr { top: 0; right: 0; width: 30%; }
.art-bl { bottom: 0; left: 0; width: 30%; }
.art-bm { bottom: 0; right: 0; width: 100%; }
.art img { display: block; width: 100%; height: auto; }

.stage {
  position: absolute; z-index: 1;
  top: calc(var(--w) * .21); bottom: calc(var(--w) * .17);
  left: 18px; right: 18px;
}
/* fixed 340px design canvas; fit.js sets --s */
.content {
  position: absolute; left: 50%; top: 50%; width: 340px;
  transform: translate(-50%, -50%) scale(var(--s, 1));
}

/* fallback when the screen is far too short (e.g. landscape phone): plain scroll */
.flyer.scroll { height: auto; min-height: 100svh; }
.flyer.scroll .stage { position: relative; inset: auto; padding: calc(var(--w) * .26) 18px calc(var(--w) * .3); }
.flyer.scroll .content { position: relative; left: auto; top: auto; margin: 0 auto; transform: none; }

.nw { white-space: nowrap; }
.arab { font-family: var(--font-arab); direction: rtl; color: var(--red); line-height: 1.9; white-space: nowrap; }
.label { font-size: .7rem; font-weight: 600; letter-spacing: .26em; text-transform: uppercase; color: var(--gold); }
.gold { color: #94733a; }

.salam .arab { font-size: 1.35rem; }

.lead { margin-top: 12px; font-size: .98rem; font-weight: 500; line-height: 1.4; }

.parents { display: grid; grid-template-columns: 1fr 1fr; margin-top: 10px; align-items: center; }
.parents .side { padding: 2px 8px; }
.parents .side + .side { border-left: 1px solid rgba(168, 135, 74, .55); }
.parents p { font-size: .95rem; font-weight: 500; line-height: 1.35; }
.parents .amp { display: block; font-family: var(--font-script); font-size: 1.1rem; line-height: 1.1; color: var(--gold); }

.couple { margin-top: 10px; font-weight: 400; }
.couple .script { display: block; font-family: var(--font-script); font-size: 2.25rem; line-height: 1.3; color: var(--red); white-space: nowrap; }
.couple .amp { display: block; font-family: var(--font-script); font-size: 1.6rem; line-height: 1; color: var(--gold); }

.rule-label { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 14px; }
.rule-label::before, .rule-label::after { content: ""; width: 48px; height: 1px; background: var(--gold); }

.date-block { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 10px; margin: 8px auto 0; max-width: 270px; }
.date-block span { padding: 4px 0; border-top: 1px solid rgba(168, 135, 74, .7); border-bottom: 1px solid rgba(168, 135, 74, .7); font-size: .72rem; font-weight: 600; letter-spacing: .22em; text-transform: uppercase; }
.date-block strong { font-size: 2.2rem; font-weight: 500; line-height: 1; color: var(--red); }
.time { margin-top: 6px; font-size: 1rem; }

.venue { margin-top: 8px; }
.venue strong { display: block; font-size: 1.15rem; font-weight: 600; color: var(--red); line-height: 1.3; }
.venue address { font-style: normal; font-size: .9rem; line-height: 1.35; margin-top: 2px; }

.btn {
  display: inline-block; margin-top: 8px; padding: 5px 20px;
  border: 1px solid var(--red); border-radius: 999px; color: var(--red);
  font-size: .68rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; text-decoration: none;
  transition: background .2s, color .2s;
}
.btn:hover { background: var(--red); color: #fff; }
.btn:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }

.note { margin-top: 12px; font-size: .95rem; font-style: italic; font-weight: 500; line-height: 1.4; }
.fine { margin-top: 10px; letter-spacing: .14em; }

.doa { margin-top: 12px; }
.doa .arab { font-size: 1.2rem; }
.doa .quote { font-style: italic; font-size: .92rem; line-height: 1.35; }
.doa .label { margin-top: 3px; }

.closing { margin-top: 8px; }
.closing .arab { font-size: 1.25rem; }

/* entrance: staggered fade once the layout is fitted */
.reveal { opacity: 0; transform: translateY(10px); transition: opacity .7s ease, transform .7s ease; transition-delay: calc(var(--i, 0) * 80ms); }
.ready .reveal { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* Undangan 1: more breathing room from the location button down to the closing salam */
.u1 .fine { margin-top: 18px; }
.u1 .doa { margin-top: 18px; }
.u1 .closing { margin-top: 14px; }

/* Undangan 2: slightly smaller names and doa */
.u2 .couple .script { font-size: 2rem; }
.u2 .doa .arab { font-size: 1.08rem; }
.u2 .doa .quote { font-size: .85rem; }
