/* ── 토큰 (종이 청첩장 v2 톤: 크림 종이 · 잉크 · 타자기) ───────────── */
:root {
  --paper: #efe8e1;
  --paper-2: #e6ddd3;
  --outside: #d8cec4;
  --ink: #2a2522;
  --ink-2: #5a514b;
  --muted: #8b8179;
  --line: #d3c8bd;
  --accent: #6b4a36;
  --stage: #1c1815;
  --f-ko: "Gowun Batang", "AppleMyungjo", "Batang", serif;
  --f-mono: "Courier Prime", "Courier New", monospace;
  --f-display: "Anton", Impact, sans-serif;
  --col: 460px;
  --pad: 28px;
  color-scheme: light;
  font-size: 17px;
}
:root.is-large { font-size: 20px; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--outside);
  color: var(--ink);
  font-family: var(--f-ko);
  line-height: 1.85;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; }
.mono { font-family: var(--f-mono); letter-spacing: 0.06em; }

.app {
  position: relative;
  max-width: var(--col);
  margin: 0 auto;
  background: var(--paper);
  min-height: 100vh;
  box-shadow: 0 0 60px rgb(0 0 0 / 0.12);
}

/* ── 글자 크기 토글 ─────────────────────────────────────────── */
.fontsize {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  right: max(12px, calc(50vw - var(--col) / 2 + 12px));
  z-index: 30;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid rgb(255 255 255 / 0.35);
  background: rgb(28 24 21 / 0.45);
  color: #fff;
  font-size: 15px;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.fontsize sup { font-size: 10px; }
.fontsize[aria-pressed="true"] { background: var(--ink); }

/* ── 인트로 ─────────────────────────────────────────────────── */
.intro { position: relative; height: 800vh; height: 800svh; background: var(--stage); }
.intro__stage {
  position: sticky; top: 0;
  height: 100vh; height: 100svh;
  overflow: hidden;
}
.intro canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.intro__shade {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(to bottom, rgb(0 0 0 / 0.35), transparent 30%, transparent 60%, rgb(0 0 0 / 0.55));
}
.intro__captions { position: absolute; inset: 0; pointer-events: none; }
.intro__caption {
  position: absolute; left: 50%; bottom: 18%;
  width: calc(100% - 2 * var(--pad));
  text-align: center; color: #fff;
  opacity: 0; will-change: opacity, transform;
  text-shadow: 0 1px 14px rgb(0 0 0 / 0.5);
}
.intro__kicker { display: block; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.3em; opacity: 0.85; margin-bottom: 6px; }
.intro__text { display: block; font-size: 1.35rem; line-height: 1.5; }
.intro__caption.is-mono .intro__text { font-family: var(--f-mono); font-weight: 700; letter-spacing: 0.12em; font-size: 1.2rem; }
.intro__sub { display: block; margin-top: 10px; font-family: var(--f-mono); font-size: 0.8rem; letter-spacing: 0.2em; }
.intro__loader, .intro__hint, .intro__skip {
  position: absolute; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.25em; color: rgb(255 255 255 / 0.85);
}
.intro__loader { top: calc(22px + env(safe-area-inset-top)); left: var(--pad); }
.intro__hint { bottom: calc(28px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; transition: opacity 0.4s; }
.intro__hint span { animation: nudge 1.6s ease-in-out infinite; }
.intro__skip { bottom: calc(26px + env(safe-area-inset-bottom)); right: var(--pad); text-decoration: none; letter-spacing: 0.05em; font-family: var(--f-ko); font-size: 0.78rem; padding: 6px 10px; border: 1px solid rgb(255 255 255 / 0.4); border-radius: 999px; }
@keyframes nudge { 50% { transform: translateY(6px); } }

/* ── 공통 섹션 ──────────────────────────────────────────────── */
main > section { padding: 84px var(--pad); text-align: center; border-top: 1px solid var(--line); }
main > section:first-child { border-top: 0; }
.kicker { margin: 0 0 6px; font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.35em; color: var(--muted); }
h2 { margin: 0 0 18px; font-size: 1.25rem; font-weight: 400; letter-spacing: 0.02em; }
.note { margin: 0 0 26px; color: var(--ink-2); font-size: 0.88rem; }

.reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.9s ease, transform 0.9s ease; }
.reveal.is-in { opacity: 1; transform: none; }

/* 버튼 */
.btn-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 46px; padding: 0 20px;
  border: 1px solid var(--ink); border-radius: 2px;
  background: transparent; color: var(--ink);
  font-size: 0.88rem; text-decoration: none; cursor: pointer;
}
.btn--solid { background: var(--ink); color: var(--paper); width: 100%; min-height: 52px; letter-spacing: 0.1em; }
.btn--ghost { border-color: var(--line); color: var(--ink-2); }
.btn--wide { width: 100%; min-height: 52px; }
.btn:disabled { opacity: 0.5; cursor: progress; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.btn--sm { min-height: 36px; padding: 0 14px; font-size: 0.8rem; }
.btn:active { transform: translateY(1px); }

/* ── 표지 ───────────────────────────────────────────────────── */
.cover { padding-top: 64px !important; }
.cover__top { display: flex; justify-content: center; gap: 12px; font-size: 0.72rem; color: var(--ink-2); margin: 0; }
/* 화면 폭에 따라 줄되, 넓은 화면에서는 컬럼 폭(460px)에 맞춰 고정 */
.cover__title { margin: 10px 0 28px; font-family: var(--f-display); font-weight: 400; font-size: clamp(2.6rem, 13vw, 3.5rem); line-height: 1.02; letter-spacing: 0; }
.cover__photo { margin: 0 auto; width: 86%; }
.cover__photo img { width: 100%; filter: grayscale(1) contrast(1.02); }
.cover__bottom { margin: 30px 0 0; font-size: 0.82rem; line-height: 2; color: var(--ink-2); }

/* ── 인사말 ─────────────────────────────────────────────────── */
.quote { margin: 0 0 56px; }
.quote p { margin: 0; font-size: 1.02rem; }
.quote cite { display: block; margin-top: 10px; font-style: normal; font-size: 0.78rem; color: var(--muted); }
.greeting__body { margin: 0 0 56px; }
.families { display: grid; gap: 6px; font-size: 0.98rem; }
.families b { font-weight: 700; font-size: 1.08rem; margin-left: 6px; }
.families small { color: var(--muted); font-size: 0.82rem; margin: 0 4px; }

/* ── 일시 · 달력 ────────────────────────────────────────────── */
.when h2 { font-size: 1.08rem; margin-bottom: 4px; }
.when__venue { margin: 0 0 32px; color: var(--ink-2); font-size: 0.9rem; }
.calendar { max-width: 320px; margin: 0 auto 26px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.calendar__head { font-family: var(--f-mono); letter-spacing: 0.3em; font-size: 0.85rem; margin-bottom: 14px; }
.calendar__grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 6px; font-family: var(--f-mono); font-size: 0.82rem; }
.calendar__grid span { display: grid; place-items: center; height: 34px; }
.calendar__grid .dow { color: var(--muted); font-size: 0.7rem; }
.calendar__grid .sun { color: #a2463a; }
.calendar__grid .day-on { position: relative; color: var(--paper); }
.calendar__grid .day-on::before { content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); z-index: -1; }
.calendar__grid .day-on { z-index: 0; }
.dday { margin: 0 0 26px; font-size: 0.95rem; }
.when__actions { display: grid; gap: 10px; max-width: 320px; margin: 0 auto; }
.dday b { font-family: var(--f-mono); color: var(--accent); font-size: 1.1rem; }

/* ── 갤러리 ─────────────────────────────────────────────────── */
.gallery { padding-left: 10px !important; padding-right: 10px !important; }
.gallery__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 26px; }
.gallery__grid button { padding: 0; border: 0; background: var(--paper-2); aspect-ratio: 3 / 4; overflow: hidden; cursor: zoom-in; }
.gallery__grid button:first-child { grid-column: span 2; grid-row: span 2; aspect-ratio: auto; }
.gallery__grid img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.6s; }
.gallery__grid button:hover img { transform: scale(1.03); }
.gallery__more { margin-top: 18px; }

.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: rgb(15 13 12 / 0.96); color: #fff; }
.lightbox[open] { display: grid; place-items: center; }
.lightbox::backdrop { background: transparent; }
.lightbox img { max-width: 100%; max-height: 86vh; object-fit: contain; user-select: none; touch-action: pan-y; }
.lightbox button { position: absolute; background: none; border: 0; color: #fff; cursor: pointer; font-size: 2rem; line-height: 1; padding: 12px; }
.lightbox__close { top: calc(8px + env(safe-area-inset-top)); right: 8px; }
.lightbox__prev { left: 4px; top: 50%; transform: translateY(-50%); }
.lightbox__next { right: 4px; top: 50%; transform: translateY(-50%); }
.lightbox__count { position: absolute; bottom: calc(14px + env(safe-area-inset-bottom)); left: 0; right: 0; text-align: center; font-size: 0.78rem; margin: 0; opacity: 0.8; }

/* ── 오시는 길 ──────────────────────────────────────────────── */
.location__addr { margin: 0 0 12px; font-size: 0.92rem; color: var(--ink-2); }
.maps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 28px 0 34px; }
.maps a { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 4px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: 0.8rem; background: var(--paper-2); }
.maps a i { font-style: normal; font-family: var(--f-mono); font-weight: 700; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; color: #fff; font-size: 0.85rem; }
.transit { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 auto; max-width: 300px; text-align: left; font-size: 0.9rem; }
.transit dt { color: var(--muted); }
.transit dd { margin: 0; }

/* ── 계좌 ───────────────────────────────────────────────────── */
.account { border: 1px solid var(--line); margin-bottom: 10px; text-align: left; background: var(--paper-2); }
.account summary { list-style: none; cursor: pointer; padding: 15px 18px; display: flex; justify-content: space-between; align-items: center; font-size: 0.95rem; }
.account summary::-webkit-details-marker { display: none; }
.account summary::after { content: "+"; font-family: var(--f-mono); color: var(--muted); }
.account[open] summary::after { content: "−"; }
.account ul { list-style: none; margin: 0; padding: 0 18px 8px; }
.account li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 0; border-top: 1px dashed var(--line); font-size: 0.86rem; }
.account li small { display: block; color: var(--muted); font-size: 0.76rem; }
.account li .num { font-family: var(--f-mono); letter-spacing: 0; }

/* ── 모달 (컬럼 폭 안에, 위쪽에 고정해 아래로 펼쳐지게) ──────────── */
.modal {
  width: min(calc(100vw - 32px), calc(var(--col) - 32px));
  max-height: calc(100vh - 48px);
  max-height: calc(100svh - 48px);
  margin: max(24px, 8vh) auto auto;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 20px 60px rgb(0 0 0 / 0.25);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal::backdrop { background: rgb(28 24 21 / 0.55); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.modal[open] { animation: modal-in 0.28s ease; }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px); } }
.modal__close { position: absolute; top: 8px; right: 8px; width: 40px; height: 40px; border: 0; background: none; font-size: 1.6rem; line-height: 1; color: var(--ink-2); cursor: pointer; }
.modal h2 { margin-bottom: 8px; }
.modal .note { margin-bottom: 22px; }

/* 펼침: grid-template-rows 0fr → 1fr 로 높이를 부드럽게 늘린다 */
.expand { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.42s ease, opacity 0.3s ease; opacity: 0; }
.expand.is-open { grid-template-rows: 1fr; opacity: 1; }
.expand__inner { min-height: 0; overflow: hidden; }
.expand__body { display: grid; gap: 22px; padding-top: 22px; }

/* ── RSVP ───────────────────────────────────────────────────── */
.rsvp__form { display: grid; text-align: left; padding: 40px 24px 28px; }
.rsvp__form .kicker, .rsvp__form h2, .rsvp__form .note { text-align: center; }
.seg--choice span { min-height: 56px; font-size: 1rem; }
.rsvp__done { padding: 48px 24px 28px; text-align: center; }
.seg { border: 0; margin: 0; padding: 0; display: flex; gap: 8px; flex-wrap: wrap; }
.seg legend, .field > span { display: block; width: 100%; font-size: 0.82rem; color: var(--ink-2); margin-bottom: 8px; padding: 0; }
.seg label { flex: 1; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span { display: grid; place-items: center; min-height: 46px; border: 1px solid var(--line); font-size: 0.9rem; cursor: pointer; background: var(--paper-2); }
.seg input:checked + span { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.field { display: block; }
.field input, .field select, .field textarea {
  width: 100%; font: inherit; font-size: 1rem; color: var(--ink);
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 0; background: #fbf8f5;
}
.field textarea { resize: vertical; }
.rsvp__error { margin: 0; color: #a2463a; font-size: 0.85rem; }
.rsvp__done .note { margin-bottom: 24px; }

/* ── 공유 · 푸터 ────────────────────────────────────────────── */
.share { padding-top: 40px !important; padding-bottom: 40px !important; }
.footer { display: flex; justify-content: space-between; padding: 22px var(--pad) calc(28px + env(safe-area-inset-bottom)); font-size: 0.8rem; font-style: italic; font-weight: 700; color: var(--ink-2); border-top: 1px solid var(--line); }

/* ── 토스트 ─────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom));
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 40px);
  padding: 12px 18px; background: var(--ink); color: var(--paper);
  font-size: 0.85rem; border-radius: 2px; transition: opacity 0.3s, transform 0.3s; z-index: 50;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .expand { transition: none; }
  .modal[open] { animation: none; }
  .intro__hint span { animation: none; }
}
