/* ===== 기본 세팅 ===== */
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --ink: #4a423a;
  --ink-soft: #8a8078;
  --accent: #b08d6a;
  --accent-soft: #e8ddd0;
  --line: #eae3d9;
  --danger: #c0392b;

  --font-serif: "Gowun Batang", "Apple SD Gothic Neo", serif;
  --font-sans: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-sans);
  font-weight: 300;
  color: var(--ink);
  background-color: #ffffff; /* 콘텐츠 카드 좌우 배경은 흰색 */
  background-image: url("../images/paper-texture.jpg");
  background-size: 256px 256px;
  background-repeat: repeat;
  line-height: 1.7;
  letter-spacing: -0.01em;
  touch-action: manipulation; /* 더블탭 확대 방지 */
}

.invitation {
  max-width: 420px;
  margin: 0 auto;
  background-color: var(--bg);
  background-image: url("../images/paper-texture.jpg");
  background-size: 200px 200px;
  background-repeat: repeat;
  min-height: 100dvh;
  /* 본문 카드와 좌우 배경을 선으로 구분 (참고 사이트 스타일) */
  border-left: 1px solid #e3ddd3;
  border-right: 1px solid #e3ddd3;
  box-shadow: 0 0 24px rgba(74, 66, 58, 0.06);
}

.section {
  padding: 56px 28px;
  text-align: center;
}

.section + .section { border-top: 1px solid var(--line); }

.section-title {
  font-family: var(--font-serif);
  font-size: 1.05rem;
  font-weight: 400;
  color: var(--accent);
  letter-spacing: 0.35em;
  text-indent: 0.35em;
  margin-bottom: 32px;
}

/* ===== 히어로 (PDF 커버 스타일) ===== */
.hero { padding-top: 64px; padding-bottom: 72px; }

.hero-illustration {
  width: 100%;
  max-width: 360px;
  height: auto;
  display: block;
  margin: 0 auto 6px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  margin-bottom: 14px;
}

.hero-date-en { font-size: 0.8rem; letter-spacing: 0.08em; margin-bottom: 10px; }

.hero-names-en {
  font-size: 0.95rem;
  color: #b5453c;
  letter-spacing: 0.12em;
  margin-bottom: 22px;
}

.hero-date-en { font-size: 0.8rem; letter-spacing: 0.08em; margin-bottom: 10px; }

.hero-names-en {
  font-size: 0.95rem;
  color: #b5453c;
  letter-spacing: 0.12em;
  margin-bottom: 22px;
}

.hero-date-ko { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 4px; }

.dday {
  display: inline-block;
  margin-top: 18px;
  padding: 8px 22px;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--surface);
}

.scroll-hint {
  margin-top: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--ink-soft);
}

.scroll-arrow {
  font-size: 0.9rem;
  animation: scroll-bounce 1.6s ease-in-out infinite;
}

@keyframes scroll-bounce {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50% { transform: translateY(6px); opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-arrow { animation: none; }
}

/* ===== 인사말 ===== */
.letter-body { font-family: var(--font-serif); font-size: 0.95rem; margin-bottom: 24px; }

.letter-sign { margin-top: 34px; font-size: 0.88rem; }
.letter-sign span { display: block; margin-bottom: 4px; }
.letter-sign strong { font-weight: 500; }

/* ===== 연락처 ===== */
.contact-group { margin-bottom: 26px; }
.contact-group:last-child { margin-bottom: 0; }

.contact-label {
  font-size: 0.78rem;
  color: var(--accent);
  letter-spacing: 0.2em;
  margin-bottom: 10px;
}

.contact-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 300px;
  margin: 0 auto 8px;
  font-size: 0.88rem;
}

.contact-btns a {
  display: inline-block;
  margin-left: 6px;
  padding: 3px 12px;
  font-size: 0.75rem;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  text-decoration: none;
}

.dummy-note {
  margin-top: 24px;
  font-size: 0.7rem;
  color: var(--ink-soft);
  opacity: 0.7;
}

/* ===== 예식 안내 / 달력 ===== */
.ceremony-text { font-family: var(--font-serif); font-size: 0.95rem; margin-bottom: 36px; }

.calendar { max-width: 300px; margin: 0 auto; }

.calendar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.calendar-title { font-family: var(--font-serif); font-size: 1rem; color: var(--ink); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px 0;
  font-size: 0.8rem;
}

.calendar-dow { color: var(--ink-soft); font-size: 0.72rem; padding: 6px 0; }
.calendar-dow:nth-child(1) { color: #c0776b; }
.calendar-dow:nth-child(7) { color: #6b7fc0; }

.calendar-day { padding: 8px 0; position: relative; }

.calendar-day.wedding {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-weight: 500;
  width: 32px;
  height: 32px;
  line-height: 16px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ===== 갤러리 ===== */
.gallery-grid {
  display: grid;
  /* 6열 기준: 일반 사진은 2칸(한 행 3장), 넓은 사진은 3칸(한 행 2장) */
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

.gallery-grid figure {
  grid-column: span 2;
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  background: var(--accent-soft);
}

.gallery-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.4s ease;
  /* 사진 확대/저장 차단 */
  pointer-events: none;
  -webkit-touch-callout: none; /* iOS 길게 누르기 메뉴 차단 */
  -webkit-user-select: none;
  user-select: none;
}

.gallery-grid img { transition: none; }

.gallery-grid figure:hover img { transform: none; }

.gallery-item--tall { grid-row: span 2; aspect-ratio: auto; }

/* 7,8번: 한 행에 2장씩 넓게(MAIN) — 6열 그리드에서 3칸 차지.
   .gallery-grid figure(0,1,1)보다 명시도가 높아야 span 3이 적용됨 */
.gallery-grid .gallery-item--wide { grid-column: span 3; }

/* ===== 버튼 ===== */
.btn-outline {
  padding: 10px 34px;
  font-size: 0.82rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-outline:hover { background: var(--surface); }

.btn-primary {
  width: 100%;
  padding: 14px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-primary:disabled { opacity: 0.5; cursor: wait; }

.btn-copy {
  padding: 4px 14px;
  font-size: 0.75rem;
  font-family: var(--font-sans);
  color: var(--accent);
  background: transparent;
  border: 1px solid var(--accent-soft);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
}

/* ===== 오시는 길 ===== */
.location-address { font-size: 0.9rem; margin-bottom: 16px; }

.map-btns { display: flex; justify-content: center; gap: 10px; margin: 22px 0 36px; }

.map-btn {
  padding: 8px 18px;
  font-size: 0.78rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
}

.info-block { max-width: 320px; margin: 0 auto 24px; text-align: left; }
.info-block:last-child { margin-bottom: 0; }

.info-block h3 {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 6px;
}

.info-block p { font-size: 0.83rem; color: var(--ink-soft); }

.map-embed {
  max-width: 340px;
  margin: 22px auto 6px;
}

.location-map {
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
  display: block;
  border-radius: 8px;
}

/* ===== 계좌 ===== */
.accounts-desc { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 30px; }

.account-group {
  max-width: 340px;
  margin: 0 auto 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  overflow: hidden;
}

.account-group summary {
  padding: 14px 18px;
  font-size: 0.85rem;
  color: var(--ink);
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.account-group summary::after { content: "+"; color: var(--accent); font-size: 1.1rem; }
.account-group[open] summary::after { content: "−"; }

.account-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
}

.account-num { flex: 1; font-size: 0.85rem; }
.account-owner { font-size: 0.78rem; color: var(--ink-soft); }

/* ===== 폼 공통 ===== */
.field {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.field:focus { border-color: var(--accent); }

.field::placeholder { color: #c5bcb2; }

.radio-row { display: flex; gap: 10px; margin-bottom: 10px; }

.radio-row label {
  flex: 1;
  padding: 11px;
  font-size: 0.84rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.radio-row input { display: none; }

.radio-row input:checked + * { color: inherit; }

.radio-row label:has(input:checked) {
  border-color: var(--accent);
  color: var(--accent);
  background: #fdfaf6;
}

.form-status { margin-top: 12px; font-size: 0.8rem; color: var(--accent); min-height: 1.2em; }
.form-status.error { color: var(--danger); }

/* ===== 게스트 스냅 ===== */
.snap-desc { font-size: 0.85rem; color: var(--ink-soft); margin-bottom: 24px; }

.snap-date-box {
  max-width: 320px;
  margin: 0 auto 28px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--accent-soft);
  border-radius: 10px;
  font-size: 0.82rem;
  line-height: 1.8;
}

.snap-date-box strong { color: var(--accent); font-weight: 600; }

.snap-date-sub {
  margin-top: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.snap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

.snap-grid figure {
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 4px;
  background: var(--accent-soft);
  position: relative;
}

.snap-grid img,
.snap-grid video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.snap-grid figure.is-new::after {
  content: "NEW";
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 2px 7px;
  font-size: 0.6rem;
  color: #fff;
  background: rgba(176, 141, 106, 0.9);
  border-radius: 999px;
}

.snap-actions { display: flex; gap: 8px; align-items: center; }
.snap-actions .btn-outline { flex: 1; padding: 12px 10px; white-space: nowrap; }
.snap-actions .btn-primary { flex: 1; width: auto; padding: 12px 10px; }

.snap-file-info { margin-top: 10px; font-size: 0.75rem; color: var(--ink-soft); word-break: keep-all; }

.snap-locked {
  margin-top: 20px;
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--ink-soft);
  line-height: 1.9;
}

/* ===== 토스트 ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%) translateY(20px);
  padding: 11px 26px;
  font-size: 0.82rem;
  color: #fff;
  background: rgba(74, 66, 58, 0.92);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 100;
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ===== 라이트박스 ===== */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(30, 26, 22, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 90;
  padding: 20px;
}

.lightbox.open { display: flex; }

.lightbox-main {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  /* 크게 본 사진도 저장 차단 유지 */
  pointer-events: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  transition: filter 0.25s ease, opacity 0.18s ease, transform 0.18s ease;
}

/* 스와이프/버튼 넘길 때 살짝 미끄러지듯 전환 */
.lightbox-main.slide-out-left { opacity: 0; transform: translateX(-24px); }
.lightbox-main.slide-out-right { opacity: 0; transform: translateX(24px); }

/* ===== 확대 시도 차단 — 핀치줌 하면 사진이 블러 처리됨 ===== */
body.anti-zoom .gallery-grid img,
body.anti-zoom .lightbox-main {
  filter: blur(16px);
}

.lightbox-close {
  position: absolute;
  top: 18px;
  right: 18px;
  width: 40px;
  height: 40px;
  font-size: 1.3rem;
  color: #fff;
  background: none;
  border: none;
  cursor: pointer;
}

/* 라이트박스 좌우 넘김 화살표 (모바일에서는 스와이프가 기본, 버튼은 보조) */
.lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 2rem;
  line-height: 1;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(0, 0, 0, 0.25);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lightbox-prev { left: 10px; }
.lightbox-next { right: 10px; }

.lightbox-nav:active { background: rgba(0, 0, 0, 0.45); }

@media (hover: none) {
  /* 터치 기기: 화살표 작게 — 스와이프가 주 수단 */
  .lightbox-nav { width: 36px; height: 36px; font-size: 1.6rem; opacity: 0.55; }
}

@media (prefers-reduced-motion: reduce) {
  .lightbox-main { transition: filter 0.25s ease; }
  .lightbox-main.slide-out-left,
  .lightbox-main.slide-out-right { opacity: 0; transform: none; }
}

/* ===== 애니메이션 ===== */
/* 이미지 깜빡임 방지: 등장 애니메이션은 불투명도+미세 이동, 부드럽게 */
.section { opacity: 0; transition: opacity 0.7s ease; }

.section.visible { opacity: 1; }

/* 섹션 내부 요소 순차 등장 (스태거) */
.section .anim {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.section.visible .anim {
  opacity: 1;
  transform: translateY(0);
}

/* 순차 딜레이 — CSS 변수로 순서 제어 */
.section.visible .anim:nth-child(1), .section.visible .anim.d0 { transition-delay: 0.05s; }
.section.visible .anim.d1 { transition-delay: 0.15s; }
.section.visible .anim.d2 { transition-delay: 0.25s; }
.section.visible .anim.d3 { transition-delay: 0.35s; }
.section.visible .anim.d4 { transition-delay: 0.45s; }
.section.visible .anim.d5 { transition-delay: 0.55s; }

/* 갤러리 사진 하나씩 떠오르기 */
.gallery-grid figure {
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.section.visible .gallery-grid figure {
  opacity: 1;
  transform: scale(1);
}

.section.visible .gallery-grid figure:nth-child(1) { transition-delay: 0.15s; }
.section.visible .gallery-grid figure:nth-child(2) { transition-delay: 0.22s; }
.section.visible .gallery-grid figure:nth-child(3) { transition-delay: 0.29s; }
.section.visible .gallery-grid figure:nth-child(4) { transition-delay: 0.36s; }
.section.visible .gallery-grid figure:nth-child(5) { transition-delay: 0.43s; }
.section.visible .gallery-grid figure:nth-child(6) { transition-delay: 0.5s; }
.section.visible .gallery-grid figure:nth-child(n+7) { transition-delay: 0.55s; }

@media (prefers-reduced-motion: reduce) {
  .section { opacity: 1; transform: none; transition: none; }
  .section .anim { opacity: 1; transform: none; transition: none; }
  .gallery-grid figure { opacity: 1; transform: none; transition: none; }
}

/* ===== BGM 버튼 ===== */
/* 유튜브 플레이어 숨김 — display:none/화면 밖 배치는 모바일에서 재생이 막힐 수 있어
   시야 안 가장자리에 거의 투명하게 배치 (모바일 호환 방식) */
#ytPlayerWrap {
  position: fixed;
  right: 0;
  bottom: 0;
  width: 100px;
  height: 60px;
  opacity: 0.001;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.bgm-btn {
  position: fixed;
  right: 16px;
  bottom: 16px;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--accent-soft);
  border-radius: 50%;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  z-index: 80;
}

.bgm-btn.playing .bgm-icon { animation: bgm-spin 4s linear infinite; }

@keyframes bgm-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .bgm-btn.playing .bgm-icon { animation: none; }
}

/* ===== 모바일 대응 ===== */
@media (max-width: 380px) {
  .section { padding: 44px 20px; }
  .hero { padding-top: 64px; }
  .hero-names { font-size: 1.6rem; }
  .contact-row { max-width: 100%; font-size: 0.84rem; }
  .map-btns { flex-wrap: wrap; }
}

/* 아이폰 노치/홈바 대응 */
@supports (padding: max(0px)) {
  .section {
    padding-left: max(28px, env(safe-area-inset-left));
    padding-right: max(28px, env(safe-area-inset-right));
  }
}
