:root {
  --bg: #fbf8f2;
  --paper: #ffffff;
  --ink: #3d3a35;
  --ink-soft: #77716a;
  --line: #e8e1d5;
  --accent: #8a9a7b;      /* 세이지 그린 */
  --accent-deep: #6c7c5e;
  --rose: #d9a5a5;        /* 꽃잎 분홍 */
  --sun: #c47c7c;         /* 달력 일요일 */
  --serif: "Gowun Batang", "Nanum Myeongjo", serif;
  --sans: "Noto Sans KR", -apple-system, "Apple SD Gothic Neo", sans-serif;
  --w: 480px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: #efeae1;
  color: var(--ink);
  font-family: var(--serif);
  line-height: 1.8;
  word-break: keep-all;
  overflow-wrap: break-word;
}
#app {
  max-width: var(--w);
  margin: 0 auto;
  background: var(--bg);
  min-height: 100vh;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

/* ---------- 표지 ---------- */
.cover {
  position: relative;
  background: #fff;
  text-align: center;
  padding-bottom: 48px;
}
.cover-img {
  display: block;
  width: 100%;
  /* 그림 위쪽 빈 흰 공간을 잘라 문구 바로 아래 인물이 오도록 */
  aspect-ratio: 848 / 780;
  object-fit: cover;
  object-position: center 88%;
}
.cover-title {
  padding: 56px 24px 0;
  text-align: center;
  animation: titleIn 1.6s ease both;
}
.cover-script {
  margin: 0;
  font-family: "Great Vibes", cursive;
  font-size: 40px;
  line-height: 1.2;
  color: var(--accent-deep);
}
.cover-ko {
  margin: 10px 0 0;
  font-size: 14px;
  letter-spacing: .45em;
  padding-left: .45em; /* letter-spacing 때문에 오른쪽으로 쏠리는 것 보정 */
  color: var(--ink-soft);
}
.cover-ko::before, .cover-ko::after {
  content: "";
  display: inline-block;
  width: 22px;
  height: 1px;
  background: var(--rose);
  vertical-align: middle;
  margin: 0 12px 0 0;
}
.cover-ko::after { margin: 0 0 0 calc(12px - .45em); }
@keyframes titleIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .cover-title { animation: none; } }
.cover-text { position: relative; padding: 0 24px; }
.cover-date {
  margin: 0 0 14px;
  font-family: var(--sans);
  font-size: 13px;
  letter-spacing: .28em;
  color: var(--accent-deep);
}
.cover-names {
  margin: 0;
  font-weight: 400;
  font-size: 26px;
  letter-spacing: .12em;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 14px;
}
.cover-names i {
  font-style: normal;
  font-size: 13px;
  color: var(--ink-soft);
  letter-spacing: .1em;
}
.cover-venue { margin: 14px 0 0; font-size: 14px; color: var(--ink-soft); }

/* ---------- 공통 블록 ---------- */
.block {
  padding: 72px 28px;
  text-align: center;
  border-top: 1px solid var(--line);
}
.eyebrow {
  margin: 0 0 6px;
  font-family: var(--sans);
  font-size: 11px;
  letter-spacing: .35em;
  color: var(--accent);
}
h2 { margin: 0 0 28px; font-size: 20px; font-weight: 400; letter-spacing: .06em; }
.muted { color: var(--ink-soft); font-size: 14px; margin: 0 0 24px; }
.small { font-size: 13px; }

.fade { opacity: 0; transform: translateY(18px); transition: opacity .9s ease, transform .9s ease; }
.fade.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .fade { opacity: 1; transform: none; transition: none; } }

.btn, .btn-ghost {
  display: inline-block;
  min-height: 46px;
  padding: 10px 26px;
  border-radius: 999px;
  font-size: 15px;
  border: 1px solid var(--accent);
  transition: background .2s, color .2s;
}
.btn { background: var(--accent); color: #fff; }
.btn:active { background: var(--accent-deep); }
.btn:disabled { opacity: .6; }
.btn-ghost { background: transparent; color: var(--accent-deep); }
.btn-ghost:active { background: #f1efe8; }
.chip {
  margin-left: 6px;
  padding: 2px 10px;
  font-family: var(--sans);
  font-size: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  vertical-align: 1px;
}

/* ---------- 인사말 ---------- */
.greet-body { font-size: 15.5px; line-height: 2.1; margin-bottom: 40px; }
.greet-body p { margin: 0; min-height: 1em; }
.parents { font-size: 16px; line-height: 2.2; }
.parents .p-names { color: var(--ink-soft); }
.parents .p-rel { font-size: 13px; color: var(--ink-soft); margin: 0 4px; }
.parents b { font-weight: 700; letter-spacing: .08em; }
.contact-row { margin-top: 28px; display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- 달력 ---------- */
.when-main { font-size: 16px; margin: 0 0 28px; }
.calendar {
  margin: 0 auto;
  max-width: 320px;
  padding: 22px 12px 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.cal-title { font-size: 15px; margin: 0 0 12px; letter-spacing: .1em; }
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  row-gap: 4px;
  font-family: var(--sans);
  font-size: 13.5px;
}
.cal-grid span { height: 38px; display: grid; place-items: center; }
.cal-grid .dow { font-size: 12px; color: var(--ink-soft); height: 30px; }
.cal-grid .sun { color: var(--sun); }
.cal-grid .day-wed {
  position: relative;
  color: #fff;
}
.cal-grid .day-wed::before {
  content: "";
  position: absolute;
  inset: 3px;
  margin: auto;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: var(--rose);
  z-index: 0;
}
.cal-grid .day-wed b { position: relative; z-index: 1; font-weight: 500; }
.dday { margin: 24px 0 0; font-size: 15px; }
.dday em { font-style: normal; color: var(--sun); font-weight: 700; }

/* ---------- 갤러리 ---------- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  margin: 0 -12px 20px;
}
.gallery button {
  padding: 0;
  border: 0;
  background: #eee;
  aspect-ratio: 1;
  overflow: hidden;
}
.gallery img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s; }
.gallery button:active img { transform: scale(1.04); }

.lightbox {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(20, 18, 16, .94);
  display: flex; align-items: center; justify-content: center;
  touch-action: pan-y;
}
.lightbox img { max-width: 100%; max-height: 86vh; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-close, .lb-nav {
  position: absolute; border: 0; background: transparent; color: #fff;
  font-size: 34px; line-height: 1; padding: 12px 16px;
}
.lb-close { top: max(8px, env(safe-area-inset-top)); right: 6px; }
.lb-prev { left: 0; }
.lb-next { right: 0; }
.lb-count {
  position: absolute; bottom: max(14px, env(safe-area-inset-bottom)); left: 0; right: 0;
  margin: 0; color: #ddd; font-family: var(--sans); font-size: 13px; text-align: center;
}

/* ---------- 오시는 길 ---------- */
.venue-name { font-size: 18px; margin: 0 0 4px; }
.venue-addr { font-size: 14px; color: var(--ink-soft); margin: 0 0 8px; }
.venue-tel { display: inline-block; font-size: 14px; color: var(--accent-deep); margin-bottom: 8px; }
.map-img { display: block; width: 100%; margin: 20px 0 0; border-radius: 6px; }
.map-links {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 22px 0 32px;
}
.map-links a {
  display: block; padding: 11px 0;
  font-family: var(--sans); font-size: 13px;
  text-decoration: none; color: var(--ink);
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
}
.transport { text-align: left; margin: 0; font-size: 14.5px; }
.transport dt {
  font-family: var(--sans); font-size: 13px; font-weight: 500; color: var(--accent-deep);
  margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--line);
}
.transport dt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.transport dd { margin: 4px 0 0; color: var(--ink); }

/* ---------- 계좌 ---------- */
.acc-group { margin-top: 12px; text-align: left; }
.acc-toggle {
  width: 100%; display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; background: var(--paper);
  border: 1px solid var(--line); border-radius: 10px; font-size: 15px;
}
.acc-toggle::after { content: "⌄"; font-size: 18px; transition: transform .25s; line-height: 1; }
.acc-group.open .acc-toggle { border-radius: 10px 10px 0 0; }
.acc-group.open .acc-toggle::after { transform: rotate(180deg); }
.acc-list {
  display: none; margin: 0; padding: 0; list-style: none;
  border: 1px solid var(--line); border-top: 0; border-radius: 0 0 10px 10px; background: var(--paper);
}
.acc-group.open .acc-list { display: block; }
.acc-list li {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 14px 18px; border-top: 1px solid #f2eee6; font-family: var(--sans); font-size: 13.5px;
}
.acc-list li:first-child { border-top: 0; }
.acc-list .who { color: var(--ink-soft); font-size: 12.5px; }
.acc-list .num { display: block; color: var(--ink); }

/* ---------- 방명록 ---------- */
.gb-list { list-style: none; margin: 28px 0 16px; padding: 0; text-align: left; }
.gb-list li {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px 14px;
  margin-bottom: 10px;
}
.gb-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.gb-name { font-weight: 700; font-size: 15px; }
.gb-date { font-family: var(--sans); font-size: 11.5px; color: var(--ink-soft); }
.gb-msg { margin: 0; font-size: 14.5px; white-space: pre-wrap; }
.gb-del {
  position: absolute; top: 10px; right: 10px;
  border: 0; background: transparent; color: #b8b1a6; font-size: 18px; padding: 4px 8px;
}

/* ---------- 공유·하단 ---------- */
.share { display: flex; flex-direction: column; gap: 10px; align-items: center; padding: 48px 28px; }
.share .btn-ghost { width: 100%; max-width: 280px; }
.foot { text-align: center; padding: 28px 0 48px; font-size: 13px; color: var(--ink-soft); }

/* ---------- 입력 창 ---------- */
.sheet {
  width: min(100% - 24px, 440px);
  max-height: calc(100dvh - 40px);
  border: 0; border-radius: 16px; padding: 0;
  background: var(--bg); color: var(--ink);
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
}
.sheet::backdrop { background: rgba(30, 26, 22, .45); }
.sheet form { padding: 26px 22px 20px; }
.sheet h3 { margin: 0 0 18px; font-weight: 400; font-size: 18px; text-align: center; }
.field { display: block; font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-bottom: 14px; }
.field small { font-size: 11.5px; }
.field input, .field select, .field textarea {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px;
  font-size: 16px; /* 아이폰 확대 방지 */
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: 8px;
  font-family: var(--sans);
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.seg { border: 0; padding: 0; margin: 0 0 14px; }
.seg legend { font-family: var(--sans); font-size: 13px; color: var(--ink-soft); margin-bottom: 6px; padding: 0; }
.seg { display: flex; gap: 6px; flex-wrap: wrap; }
.seg legend { width: 100%; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: block; text-align: center; padding: 10px 4px;
  font-family: var(--sans); font-size: 14px;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
}
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent-deep); outline-offset: 2px; }
.form-err { min-height: 1.2em; margin: 4px 0 8px; color: #b5574f; font-family: var(--sans); font-size: 13px; text-align: center; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions > * { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px);
  background: rgba(40, 36, 32, .9); color: #fff;
  padding: 10px 20px; border-radius: 999px;
  font-family: var(--sans); font-size: 13.5px;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 60;
  white-space: nowrap;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
