/* 모바일 초대장 공통 스타일. 카드 안의 치수는 cqw(카드 가로폭 기준 %) 단위를 써서
   어떤 화면 폭에서도 인쇄물과 같은 비율로 보이게 한다. */
:root {
  --cream: #fffef6;   /* 인쇄물 배경색 */
  --ink: #3e3a39;     /* 본문 글자색 */
  --muted: #8a8580;
  --gold: #b7a61c;    /* INVITATION / WAY TO COME */
  --brown: #936c48;   /* 지도 말풍선 */
  --page-bg: #efede3;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--page-bg); }
body {
  font-family: 'Nanum Barunpen', 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
}
.page {
  max-width: 480px;
  margin: 0 auto;
  background: var(--cream);
  min-height: 100dvh;
  box-shadow: 0 0 40px rgba(0, 0, 0, .08);
}

/* ---------- 카드 (이미지로 저장되는 영역) ---------- */
.card {
  container-type: inline-size;
  background: var(--cream);
  position: relative;
  overflow: hidden;
}
.card img { display: block; width: 100%; height: auto; }
.card .cover img { aspect-ratio: 2 / 3; object-fit: cover; }

.inner { position: relative; }
.inner-top { position: relative; }
.inner-top img { aspect-ratio: 283.465 / 135; }

.inner-body {
  position: relative;
  margin-top: -34cqw;          /* 상단 나뭇잎 영역 안으로 올려서 To.가 인쇄물과 같은 높이에 오게 */
  padding: 0 9cqw;
  word-break: keep-all;
}
.to-line {
  display: flex;
  align-items: baseline;
  gap: 2cqw;
  max-width: 48cqw;             /* 오른쪽 나뭇잎을 피한다 */
  min-height: 8cqw;
}
.label { font-size: 3.9cqw; color: var(--ink); letter-spacing: .02em; }
.name {
  font-family: 'Nanum Pen Script', 'Nanum Barunpen', cursive;
  font-size: 7cqw;
  line-height: 1;
  color: var(--ink);
  border-bottom: 1px solid rgba(62, 58, 57, .35);
  padding: 0 1.5cqw .6cqw;
  min-width: 22cqw;
  text-align: center;
}
.name:empty::before { content: '\00a0'; }

.quote {
  margin: 23cqw 0 0;
  font-size: 3.7cqw;
  letter-spacing: .01em;
}
.paragraphs { margin-top: 3cqw; }
.paragraphs p {
  margin: 0 0 4.2cqw;
  font-size: 3.5cqw;
  line-height: 1.85;
}

.from-block {
  margin: 1cqw 0 0 auto;
  width: max-content;
  max-width: 100%;
}
.invitation {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-weight: 500;
  font-size: 8cqw;
  letter-spacing: .16em;
  color: var(--gold);
  line-height: 1.1;
}
.from-line {
  display: flex;
  align-items: baseline;
  gap: 2cqw;
  margin-top: 2.5cqw;
}

.way {
  margin-top: 9cqw;
  padding-right: 13cqw;        /* 오른쪽 꽃 한 송이 자리 */
  position: relative;
}
.way-title {
  font-family: 'Cormorant Garamond', 'Times New Roman', serif;
  font-weight: 500;
  font-size: 6cqw;
  letter-spacing: .14em;
  color: var(--gold);
  line-height: 1.1;
  margin-bottom: 4cqw;
}
.flower {
  position: absolute;
  right: -2cqw;
  top: -1cqw;
  width: 15cqw !important;
}
.info-row {
  display: grid;
  grid-template-columns: auto auto 1fr;
  column-gap: 2.2cqw;
  align-items: baseline;
  font-weight: 700;
  font-size: 3.8cqw;
  line-height: 1.5;
  margin-bottom: 2.2cqw;
}
.info-row .sep { width: 1px; height: 3.4cqw; background: var(--ink); opacity: .5; align-self: center; }
.info-row .val small { display: block; font-weight: 400; font-size: 3.4cqw; }

.inner-bottom { position: relative; margin-top: 4cqw; }
.inner-bottom img { aspect-ratio: 283.465 / 130.197; }
.map-label {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: 'NanumSquare', 'Nanum Barunpen', sans-serif;
  font-size: 2.2cqw;
  line-height: 1.2;
  color: #4b4642;
  text-align: center;
  white-space: pre;
}
.map-label.bubble {
  color: #fff;
  font-weight: 800;
  font-size: 2.35cqw;
  letter-spacing: .02em;
}

/* ---------- 카드 밖: 버튼, 푸터 ---------- */
.actions {
  padding: 18px 20px 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 10px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s;
}
.btn:active { background: rgba(183, 166, 28, .15); }
.btn.primary { background: var(--gold); color: #fff; border-color: var(--gold); }
.btn.wide { grid-column: 1 / -1; }
.btn[disabled] { opacity: .5; cursor: default; }

.footer {
  text-align: center;
  padding: 18px 20px 36px;
  font-size: 13px;
  color: var(--muted);
}
.footer a { color: var(--muted); }
.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(20px);
  background: rgba(62, 58, 57, .92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 10;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- 이미지 뷰어 (휴대폰에서 길게 눌러 저장) ---------- */
.img-viewer {
  position: fixed; inset: 0; z-index: 20;
  background: #1e1c18;
  display: flex; flex-direction: column;
  color: #fff;
}
.img-viewer-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 16px; font-size: 14px;
  padding-top: calc(14px + env(safe-area-inset-top));
}
.img-viewer-close {
  appearance: none; border: 0; background: rgba(255,255,255,.15); color: #fff;
  width: 36px; height: 36px; border-radius: 50%; font-size: 18px; cursor: pointer; flex: none;
}
.img-viewer-hint { padding: 0 16px 10px; font-size: 13px; color: #f3e9a5; }
.img-viewer-body { flex: 1; overflow: auto; -webkit-overflow-scrolling: touch; padding: 0 16px; }
.img-viewer-body img {
  display: block; width: 100%; max-width: 420px; margin: 0 auto; height: auto;
  -webkit-touch-callout: default; user-select: auto; -webkit-user-select: auto;
}
.img-viewer-foot { padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); text-align: center; }
.img-viewer-foot .btn { border-color: #fff; color: #fff; }

/* ---------- 은은한 낙엽 효과 (받는 분 화면 전용, 이미지 저장에는 포함되지 않음) ---------- */
.leaves { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.leaf { position: absolute; top: -6vh; will-change: transform; animation: leaf-fall linear infinite; }
.leaf svg { display: block; width: 100%; height: 100%; animation: leaf-sway ease-in-out infinite alternate; }
@keyframes leaf-fall {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to   { transform: translate3d(var(--drift, 0px), 112vh, 0) rotate(var(--spin, 200deg)); }
}
@keyframes leaf-sway {
  from { transform: translateX(calc(-1 * var(--sway, 14px))) rotate(-12deg); }
  to   { transform: translateX(var(--sway, 14px)) rotate(12deg); }
}
@media (prefers-reduced-motion: reduce) { .leaves { display: none; } }

/* ---------- 확인창 (브라우저 기본창 대신 초대장 디자인에 맞춘 것) ---------- */
.dlg-back {
  position: fixed; inset: 0; z-index: 30;
  background: rgba(62, 58, 57, .45);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: dlg-fade .15s ease-out;
}
.dlg {
  width: 100%; max-width: 340px;
  background: var(--cream); border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .25);
  padding: 22px 20px 16px; text-align: center;
  animation: dlg-pop .18s ease-out;
}
.dlg-eyebrow { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 12px; letter-spacing: .3em; color: var(--gold); text-transform: uppercase; margin-bottom: 8px; }
.dlg-msg { font-size: 16px; line-height: 1.6; color: var(--ink); white-space: pre-line; margin: 0 0 18px; }
.dlg-msg b { font-family: 'Nanum Pen Script', cursive; font-size: 24px; font-weight: 400; vertical-align: -2px; }
.dlg-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dlg-btns .btn { padding: 12px 8px; font-size: 15px; }
.dlg-btns .btn.ghost { border-color: rgba(62, 58, 57, .2); font-weight: 400; }
@keyframes dlg-fade { from { opacity: 0; } }
@keyframes dlg-pop { from { opacity: 0; transform: translateY(8px) scale(.97); } }
