:root {
  --navy: #131D33;
  --navy-deep: #0A1122;
  --navy-soft: #1D2A45;
  --cream: #F4F2EE;
  --cream-2: #EAE6DE;
  --silver: #A9B2C1;        /* 크림 배경 위 포인트 */
  --silver-light: #D3D9E2;  /* 네이비 배경 위 포인트 */
  --muted: #6B7489;

  --serif: "Noto Serif KR", "AppleMyungjo", "Batang", serif;
  --sans: "Pretendard", -apple-system, "Apple SD Gothic Neo", sans-serif;
  --en: var(--serif);  /* 날짜·숫자도 같은 명조체로 통일 */
  --hand: "Nanum Pen Script", cursive;

  --vh: 100svh;
  --col: 480px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { background: var(--navy-deep); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  color: var(--navy);
  background: var(--navy-deep);
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
img { max-width: 100%; display: block; }

/* 이미지 길게 눌러 저장/드래그/선택 방지 */
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
img, .photo, .hero-photo {
  -webkit-user-drag: none; user-drag: none;
  -webkit-touch-callout: none;
  pointer-events: none;   /* 클릭은 감싸는 요소(폴라로이드)가 받음 */
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
[hidden] { display: none !important; }

html.locked, html.locked body { overflow: hidden; height: 100%; overscroll-behavior: none; }

/* ───────── 인트로 ───────── */
.intro {
  position: relative;
  height: var(--vh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(14px, 3.5vh, 34px);
  background: radial-gradient(120% 80% at 50% 42%, #1B2945 0%, var(--navy-deep) 72%);
  overflow: hidden;
}
.intro-top, .intro-bottom {
  font-family: var(--en);
  color: var(--silver-light);
  opacity: 0;
  animation: fadeIn 1.4s .4s forwards;
}
.intro-top { font-family: var(--serif); font-size: 15px; letter-spacing: .2em; }
.intro-bottom { font-family: var(--serif); font-size: 15px; letter-spacing: .3em; color: rgba(244,242,238,.55); }

.stage {
  position: relative;
  width: min(100%, var(--col), calc((var(--vh) - 140px) * 1178 / 1396));
  aspect-ratio: 1178 / 1396;
  background: url("../images/slot-panel.jpg") center / cover no-repeat;
  box-shadow: 0 30px 60px rgba(0,0,0,.45);
}
.clip {
  position: absolute; left: 0; right: 0; top: 32.6%; bottom: 0;
  overflow: hidden; pointer-events: none;
}
.clip::after {
  content: ""; position: absolute; top: 0; left: 21%; right: 21%; height: 7%;
  background: linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,0));
}
.card {
  position: absolute; left: 50%; top: 0;
  width: 56%; aspect-ratio: 3 / 4; margin-left: -28%;
  background: var(--cream);
  padding: 4.5% 4.5% 16%;
  border-radius: 2px;
  box-shadow: 0 10px 22px rgba(0,0,0,.28), 0 2px 4px rgba(0,0,0,.2);
  transform: translateY(-101%);
  will-change: transform;
}
.photo {
  width: 100%; height: 100%;
  background: #222 center / cover no-repeat;
  filter: brightness(.15) contrast(.6) saturate(0) blur(2px);
}
.photo.develop { transition: filter 3.2s ease-out; filter: none; }
.caption {
  position: absolute; left: 0; right: 0; bottom: 4%;
  text-align: center; color: var(--navy);
  font-family: var(--hand); font-size: clamp(16px, 4.6vw, 26px);
  opacity: 0; transition: opacity 1.5s 1.2s;
}
.card.done .caption { opacity: .85; }
.card.flying { position: fixed; margin: 0; z-index: 60; aspect-ratio: auto; }
.card.flying .caption { transition: opacity .3s; }
.card.expanding .caption { opacity: 0; }

/* ───────── 본문 공통 ───────── */
main {
  max-width: var(--col);
  margin: 0 auto;
  background: var(--cream);
  box-shadow: 0 0 80px rgba(0,0,0,.35);
}
.sec { padding: 100px 28px; text-align: center; }
.label {
  font-family: var(--en); font-size: 12px; font-weight: 500;
  letter-spacing: .38em; text-transform: uppercase;
  color: var(--silver); margin-bottom: 14px;
}
.title { font-family: var(--serif); font-weight: 400; font-size: 21px; letter-spacing: .04em; margin-bottom: 44px; }

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

/* ───────── 1. 히어로 ───────── */
.hero {
  position: relative; overflow: hidden; background: var(--navy-deep); color: var(--cream);
  /* 주소창·하단바가 줄어든 가장 긴 화면(lvh) 기준 → 어떤 기기에서도 아래 영역이 비치지 않음 */
  --hero-extra: 0px;
  height: var(--vh);
}
@supports (height: 100lvh) {
  .hero {
    --hero-extra: max(0px, 100lvh - var(--vh));
    height: max(var(--vh), 100lvh);
  }
}
.hero-photo { position: absolute; inset: 0; background: center / cover no-repeat; visibility: hidden; }
.hero.photo-on .hero-photo { visibility: visible; }
.hero-shade {
  position: absolute; inset: 0; opacity: 0; transition: opacity 1.4s ease;
  background:
    linear-gradient(to bottom, rgba(10,17,34,.35), rgba(10,17,34,0) 22%),
    linear-gradient(to bottom, rgba(10,17,34,0) 45%, rgba(10,17,34,.88) 100%);
}
.hero-text {
  position: absolute; left: 0; right: 0;
  bottom: calc(78px + var(--hero-extra) + env(safe-area-inset-bottom, 0px));
  text-align: center; padding: 0 24px;
}
.hero-text > * { opacity: 0; transform: translateY(14px); transition: opacity 1.1s ease, transform 1.1s ease; }
.hero.ready .hero-shade { opacity: 1; }
.hero.ready .hero-text > * { opacity: 1; transform: none; }
.hero.ready .hero-text > :nth-child(2) { transition-delay: .25s; }
.hero.ready .hero-text > :nth-child(3) { transition-delay: .5s; }
.hero.ready .hero-text > :nth-child(4) { transition-delay: .65s; }
.eyebrow { font-family: var(--en); font-size: 12px; letter-spacing: .4em; text-transform: uppercase; color: var(--silver-light); margin-bottom: 14px; }
.hero h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; letter-spacing: .1em; margin-bottom: 16px; }
.hero h1 i { font-family: var(--en); font-style: normal; font-weight: 400; color: var(--silver-light); margin: 0 .45em; font-size: .9em; }
.hero-meta { font-family: var(--en); font-size: 17px; letter-spacing: .16em; }
.scroll-hint {
  position: absolute; left: 50%; bottom: calc(22px + var(--hero-extra) + env(safe-area-inset-bottom, 0px));
  width: 1px; height: 38px; background: rgba(244,242,238,.25); overflow: hidden;
  opacity: 0; transition: opacity 1s 1.2s;
}
.hero.ready .scroll-hint { opacity: 1; }
.scroll-hint span { position: absolute; left: 0; top: -40%; width: 1px; height: 40%; background: var(--cream); animation: drip 2s ease-in-out infinite; }

/* ───────── 2. 초대글 ───────── */
.sec-invite { background: var(--cream); }
.poem { font-family: var(--serif); font-size: 15px; line-height: 2; color: var(--muted); white-space: pre-line; margin-top: 18px; }
.ornament { width: 44px; height: 1px; background: var(--silver); margin: 40px auto; position: relative; }
.ornament::after {
  content: ""; position: absolute; left: 50%; top: 50%; width: 6px; height: 6px;
  background: var(--cream); border: 1px solid var(--silver); transform: translate(-50%, -50%) rotate(45deg);
}
.message p { font-family: var(--serif); font-size: 16px; line-height: 2.1; white-space: pre-line; }
.message p + p { margin-top: 22px; }
.invite-family { margin-top: 48px; display: grid; gap: 10px; font-family: var(--serif); }
.invite-family-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; }
.if-parents { font-size: 15px; }
.if-rel { font-size: 13px; color: var(--muted); }
.if-child { font-size: 17px; font-weight: 700; min-width: 2.6em; text-align: left; }

/* ───────── 3. 날짜 ───────── */
.sec-date { background: var(--navy); color: var(--cream); }
.sec-date .label { color: var(--silver-light); }
.big-date { font-family: var(--en); font-size: 40px; letter-spacing: .08em; margin-top: 6px; }
.date-sub { font-family: var(--serif); font-size: 15px; margin-top: 10px; opacity: .85; line-height: 1.8; }
.calendar { margin: 44px auto 0; max-width: 320px; padding-top: 28px; border-top: 1px solid rgba(211,217,226,.25); }
.cal-month { font-family: var(--serif); font-size: 15px; letter-spacing: .12em; color: var(--silver-light); margin-bottom: 18px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); row-gap: 6px; font-family: var(--en); font-size: 16px; }
.cal-grid span { height: 38px; display: flex; align-items: center; justify-content: center; }
.cal-grid .dow { font-family: var(--sans); font-size: 11px; opacity: .55; height: 28px; }
.cal-grid .sun { color: #E3B4B4; }
.cal-grid .on {
  position: relative; color: var(--navy); font-weight: 500;
}
.cal-grid .on::before {
  content: ""; position: absolute; width: 34px; height: 34px; border-radius: 50%;
  background: var(--silver-light); z-index: -1;
}
.cal-grid .on { z-index: 0; }
.dday { margin-top: 36px; font-family: var(--serif); font-size: 15px; opacity: .9; }
.dday b { font-family: var(--en); font-size: 22px; font-weight: 500; color: var(--silver-light); margin: 0 2px; }

/* ───────── 4. 신랑 / 신부 (화면당 한 명) ───────── */
.sec-person, .sec-family {
  min-height: var(--vh);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.sec-person { background: var(--cream); }
#brideSec { background: var(--cream-2); }
.person-photo {
  width: min(78%, 320px); margin-top: 12px;
  box-shadow: 0 16px 36px rgba(19,29,51,.18), 0 2px 4px rgba(19,29,51,.12);
}
.person-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.person-name { font-family: var(--serif); font-weight: 400; font-size: 24px; letter-spacing: .06em; margin-top: 40px; }
.person-role { font-size: 14px; color: var(--muted); margin-right: 10px; letter-spacing: 0; }
.person-bio { margin-top: 22px; }
.person-bio p, .family-bio p { font-family: var(--serif); font-size: 15px; line-height: 2; white-space: pre-line; color: #3A4660; }
.person-bio p + p, .family-bio p + p { margin-top: 16px; }

/* ───────── 5. 양가 부모님 (한 화면) ───────── */
.sec-family { background: var(--cream); color: var(--navy); }
.family { display: grid; gap: 64px; width: 100%; justify-items: center; }
.family-side { width: min(86%, 340px); }
.family-photo { box-shadow: 0 14px 32px rgba(19,29,51,.18), 0 2px 4px rgba(19,29,51,.12); }
.family-photo img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.family-side-label { font-family: var(--serif); font-size: 13px; color: var(--muted); margin: 26px 0 12px; }
.family-row { display: flex; align-items: baseline; justify-content: center; gap: 8px; font-family: var(--serif); }
.family-row + .family-row { margin-top: 6px; }
.family-role { font-size: 12px; opacity: .6; }
.family-name { font-size: 19px; letter-spacing: .06em; }

/* ───────── 6. 갤러리 (텍스트 없음, 반듯한 배치) ───────── */
.sec-gallery { background: var(--navy); padding: 72px 0; }
.gallery-track {
  --pw: min(70vw, 280px);
  display: flex; gap: 20px;
  overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 30px calc(50% - var(--pw) / 2) 40px;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.gallery-track::-webkit-scrollbar { display: none; }
.pola {
  flex: 0 0 var(--pw);
  scroll-snap-align: center;
  background: var(--cream);
  padding: 12px 12px 54px;
  box-shadow: 0 14px 30px rgba(0,0,0,.35), 0 2px 4px rgba(0,0,0,.25);
  transform: scale(.9);
  opacity: .55;
  transition: transform .5s ease, opacity .5s ease;
}
.pola.active { transform: scale(1); opacity: 1; }
.pola img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; background: #ccc; }

/* ───────── 공유 ───────── */
.sec-share { background: var(--cream); padding-bottom: 80px; }
.sec-share .title { margin-bottom: 32px; }
.share-btns { display: grid; gap: 10px; max-width: 300px; margin: 0 auto; }
.share-btns button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; border-radius: 999px;
  border: 1px solid var(--navy); color: var(--navy); font-size: 14px;
  transition: background .2s, color .2s;
}
.share-btns button:active { background: var(--navy); color: var(--cream); }
.share-btns svg { width: 18px; height: 18px; fill: currentColor; }
.footer {
  background: var(--navy-deep); color: rgba(244,242,238,.5);
  text-align: center; font-family: var(--serif); font-size: 12px; letter-spacing: .15em;
  padding: 36px 20px calc(36px + env(safe-area-inset-bottom, 0px));
}

/* ───────── 배경음악 버튼 ───────── */
.bgm-btn {
  position: fixed; z-index: 40;
  top: calc(env(safe-area-inset-top, 0px) + 14px);
  right: max(14px, calc(50% - var(--col) / 2 + 14px));
  width: 40px; height: 40px; border-radius: 50%;
  background: rgba(10,17,34,.55); border: 1px solid rgba(211,217,226,.35);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn .8s ease;
}
.eq { display: flex; align-items: flex-end; gap: 3px; height: 14px; }
.eq i { width: 2px; height: 4px; background: var(--silver-light); border-radius: 1px; }
.bgm-btn.playing .eq i { animation: eq 1s ease-in-out infinite; }
.bgm-btn.playing .eq i:nth-child(2) { animation-delay: .2s; }
.bgm-btn.playing .eq i:nth-child(3) { animation-delay: .4s; }

/* ───────── 라이트박스 ───────── */
.lightbox {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(6,11,22,.92);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 22px;
  padding: 24px; animation: fadeIn .3s ease;
}
.lightbox-pola { background: var(--cream); padding: 14px 14px 64px; width: min(88vw, 420px); box-shadow: 0 20px 50px rgba(0,0,0,.5); }
.lightbox-pola img { width: 100%; aspect-ratio: 4 / 5; object-fit: cover; }
.lightbox-close { color: rgba(244,242,238,.5); font-size: 12px; }

/* ───────── 토스트 ───────── */
.toast {
  position: fixed; left: 50%; z-index: 90;
  bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, 20px);
  background: rgba(10,17,34,.92); color: var(--cream);
  padding: 12px 20px; border-radius: 999px; font-size: 13px; white-space: nowrap;
  opacity: 0; pointer-events: none; transition: opacity .3s, transform .3s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes drip { 0% { top: -40%; } 100% { top: 100%; } }
@keyframes eq { 0%, 100% { height: 4px; } 50% { height: 14px; } }
