/* =========================================================
   모바일 청첩장 — 이명재 · 최유주
   디자인 기준 폭 390px. 모든 크기는 화면 폭에 비례(--u)해서 늘어나고 줄어듭니다.
   ========================================================= */
:root {
  --W: min(100vw, 720px);           /* 모바일: 화면 폭 (최대 720px) */
  --u: calc(var(--W) / 390);        /* 디자인 1px */
  --ink: #292a2d;
  --ink-2: #5a5c63;
  --gray: #989ba2;
  --line: #e1e2e4;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --f-line: "LINE Seed Sans", "Wanted Sans", system-ui, sans-serif;
  --f-wanted: "Wanted Sans", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --f-pre: "Pretendard", "Wanted Sans", system-ui, sans-serif;
}
/* 데스크탑(마우스 환경): 480px 고정 */
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  :root { --W: 480px; }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: #f4f4f5;
  color: var(--ink);
  font-family: var(--f-wanted);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  word-break: keep-all;
}
p, h1, h2, h3 { margin: 0; font-weight: inherit; font-size: inherit; }
img { display: block; max-width: none; -webkit-user-drag: none; user-select: none; -webkit-touch-callout: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
button:focus-visible { outline: 2px solid #1f7ff6; outline-offset: 2px; }
html.no-scroll, html.no-scroll body { overflow: hidden; }

.page { position: relative; width: var(--W); margin: 0 auto; background: #fff; overflow: hidden; }
@media (hover: hover) and (pointer: fine) and (min-width: 600px) {
  .page { box-shadow: 0 0 40px rgba(0, 0, 0, .12), 0 0 2px rgba(0, 0, 0, .06); }
}

/* ---------- 공통 ---------- */
.sec { position: relative; width: 100%; overflow: hidden; }
.bg { position: absolute; pointer-events: none; }
.sec > p, .sec > h2, .sec > h3 {
  position: absolute; left: 0; right: 0;
  top: calc(var(--top) * var(--u));
  text-align: center; white-space: nowrap;
}
.t-line  { font-family: var(--f-line); font-weight: 700; font-size: calc(16 * var(--u)); line-height: normal; margin-top: calc(3 * var(--u)); }
.t-names { font-family: var(--f-wanted); font-weight: 500; font-size: calc(16 * var(--u)); line-height: 1.6; white-space: pre !important; }
.t-title { font-family: var(--f-wanted); font-weight: 700; font-size: calc(18 * var(--u)); line-height: 1.6; }
.t-body  { font-family: var(--f-wanted); font-weight: 500; font-size: calc(14 * var(--u)); line-height: 1.6; }
.t-reg   { font-weight: 400; }
.t-sub   { font-family: var(--f-wanted); font-weight: 700; font-size: calc(16 * var(--u)); line-height: 1.2; }
.t-tag   { font-family: var(--f-wanted); font-weight: 600; font-size: calc(10 * var(--u)); line-height: 1.6; color: var(--gray); }
.t-month { font-family: var(--f-line); font-weight: 700; font-size: calc(14 * var(--u)); line-height: 1.6; color: #fff; margin-top: calc(2 * var(--u)); }
.t-dday  { font-family: var(--f-wanted); font-weight: 600; font-size: calc(14 * var(--u)); line-height: 1.6; color: #fff; }

/* ---------- 스크롤 등장 애니메이션 (slide up from bottom) ---------- */
.rv {
  opacity: 0; translate: 0 calc(36 * var(--u));
  transition: opacity .9s var(--ease), translate .9s var(--ease);
  transition-delay: var(--d, 0s);
}
.rv.in { opacity: 1; translate: 0 0; }
.rv.instant { transition: none !important; }
@media (prefers-reduced-motion: reduce) { .rv { opacity: 1; translate: none; transition: none; } }
.no-js .rv { opacity: 1; translate: none; }

/* ---------- 1. 메인 ---------- */
.s-hero { height: calc(525 * var(--u)); background: #afafaf; }
.hero-img { left: calc(-31 * var(--u)); top: 0; width: calc(422 * var(--u)); height: calc(634 * var(--u)); object-fit: cover; }
.hero-fade { left: calc(-43 * var(--u)); top: calc(297 * var(--u)); width: calc(461 * var(--u)); height: calc(258 * var(--u)); background: linear-gradient(to top, #fff 38.953%, rgba(255, 255, 255, 0) 96.318%); }

/* ---------- 2. 일시·장소 + 롤링 사진 ---------- */
.s-story { height: calc(550 * var(--u)); background: #fff; }
.roll { position: absolute; left: 0; top: calc(219 * var(--u)); width: 100%; height: calc(169 * var(--u)); overflow: hidden; }
.roll-track { display: flex; height: 100%; will-change: transform; }
.roll-track.anim { transition: transform 1.2s cubic-bezier(.65, 0, .35, 1); }
.roll-slide { position: relative; flex: 0 0 100%; height: 100%; background: #fff; overflow: hidden; }
.roll-slide img { position: absolute; left: 50%; top: 50%; width: calc(352 * var(--u)); height: calc(170 * var(--u)); margin: calc(-85 * var(--u)) 0 0 calc(-176 * var(--u)); object-fit: cover; }

/* ---------- 3. 초대글 ---------- */
.s-invite { height: calc(507 * var(--u)); background: linear-gradient(to top, #f4f4f5 33.136%, #fff 84.32%); }
.invite-texture { left: 50%; margin-left: calc(-198 * var(--u)); top: calc(131 * var(--u)); width: calc(396 * var(--u)); height: calc(379 * var(--u)); opacity: .5; overflow: hidden; }
.invite-texture img { position: absolute; left: -7.95%; top: -10.88%; width: 115.9%; height: 121.07%; }
.s-invite .parents { height: calc(22.4 * var(--u)); font-size: calc(14 * var(--u)); line-height: 1.6; font-weight: 500; }
.parents span { position: absolute; top: 0; left: calc(var(--x) * var(--u)); transform: translateX(-50%); white-space: nowrap; }

/* ---------- 4. 예식일 ---------- */
.s-date { height: calc(637 * var(--u)); background: #37383c; color: #fff; }
.date-photo { position: absolute; left: calc(122 * var(--u)); top: calc(141 * var(--u)); width: calc(147 * var(--u)); height: calc(147 * var(--u)); overflow: hidden; }
.date-photo img { position: absolute; left: -0.05%; top: -42.18%; width: 100.09%; height: 151.02%; }
.cal {
  position: absolute; left: 50%; margin-left: calc(-93 * var(--u)); top: calc(351 * var(--u));
  width: calc(186 * var(--u)); height: calc(164 * var(--u));
  display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: repeat(6, 1fr);
  font-family: var(--f-line); font-weight: 400; font-size: calc(14 * var(--u)); line-height: 1.6; text-align: center;
}
.cal b { position: relative; font-weight: 400; height: calc(25 * var(--u)); padding-top: calc(2 * var(--u)); }
.cal b span { position: relative; z-index: 1; }
.cal b.on { color: var(--ink); }
/* 동그라미: 숫자 글자의 실제 중심에 맞춤 (script.js 에서 글꼴 모양을 재서 미세 조정) */
.cal b.on::before {
  content: ""; position: absolute; z-index: 0;
  left: calc(50% + var(--cx, 0px)); top: calc(calc(2 * var(--u)) + calc(11.2 * var(--u)) + var(--cy, 0px));
  width: calc(33 * var(--u)); height: calc(33 * var(--u)); margin: calc(-16.5 * var(--u)) 0 0 calc(-16.5 * var(--u));
  border-radius: 50%; background: #fff;
}

/* ---------- 5. 갤러리 ---------- */
.s-gallery { height: calc(655 * var(--u)); background: #fff; }
.gallery {
  position: absolute; left: 0; top: calc(169 * var(--u)); width: 100%; height: calc(465 * var(--u));
  overflow: hidden; touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab;
}
.gallery.dragging { cursor: grabbing; }
.gallery-track { position: absolute; left: 0; top: 0; height: 100%; display: flex; gap: calc(20 * var(--u)); will-change: transform; }
.gallery-track.anim { transition: transform .45s var(--ease); }
.g-slide { flex: 0 0 calc(310 * var(--u)); height: 100%; overflow: hidden; background: #eee; }
.g-slide img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; transition: transform .25s ease; }
.g-slide:active img { transform: scale(.985); }

/* ---------- 6. 오시는 길 ---------- */
.s-map { height: calc(955 * var(--u)); background: #fff; }
.map-box { position: absolute; left: calc(30 * var(--u)); top: calc(193 * var(--u)); width: calc(331 * var(--u)); height: calc(167 * var(--u)); background: #d9d9d9; overflow: hidden; }
.map { position: absolute; inset: 0; }
.map iframe { width: 100%; height: 100%; border: 0; pointer-events: none; }
.map-tap { position: absolute; inset: 0; z-index: 2; }
.map-btns { position: absolute; left: calc(30 * var(--u)); top: calc(380 * var(--u)); width: calc(331 * var(--u)); height: calc(34 * var(--u)); display: flex; justify-content: space-between; }
.map-btn {
  position: relative; width: calc(107 * var(--u)); height: calc(34 * var(--u));
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--line); border-radius: calc(4 * var(--u));
  font-family: var(--f-wanted); font-weight: 700; font-size: calc(12 * var(--u)); line-height: 1; color: var(--ink);
  white-space: nowrap; transition: background-color .15s, transform .15s;
}
.map-btn:active { background: #f4f4f5; transform: scale(.97); }
/* 글자 쪽이 더 무거워 보이는 만큼 왼쪽으로 살짝 옮겨 시각 중심을 맞춤 */
.map-btn[data-nav="kakao"] { padding-right: calc(1.6 * var(--u)); }
.map-btn[data-nav="tmap"] { padding-right: calc(3.6 * var(--u)); }
/* 시각 보정: 아이콘의 '보이는 부분' 크기를 맞추고, 아이콘+글자 묶음을 버튼 가운데에 배치 */
.map-btn .ico { flex: none; display: block; background-repeat: no-repeat; margin-right: calc(5 * var(--u)); }
.map-btn .lbl { display: block; margin-top: calc(-0.4 * var(--u)); }
.ico-naver { margin-right: calc(4.25 * var(--u)) !important; width: calc(11.2 * var(--u)); height: calc(14 * var(--u)); background-image: url(images/naver.png); background-size: calc(17.92 * var(--u)) calc(17.92 * var(--u)); background-position: calc(-3.36 * var(--u)) calc(-1.96 * var(--u)); }
.ico-kakao { margin-right: calc(4.75 * var(--u)) !important; width: calc(14 * var(--u)); height: calc(14 * var(--u)); border-radius: calc(3 * var(--u)); background-image: url(icons/kakaomap.svg); background-size: 100% 100%; }
.ico-tmap  { margin-right: calc(4.5 * var(--u)) !important; width: calc(12.5 * var(--u)); height: calc(12.5 * var(--u)); background-image: url(images/tmap.png); background-size: calc(20 * var(--u)) calc(20 * var(--u)); background-position: calc(-3.75 * var(--u)) calc(-3.75 * var(--u)); }

/* ---------- 7. 마음 전하실 곳 ---------- */
.s-account { background: #fff; }
.mountain { left: 50%; margin-left: calc(-200 * var(--u)); width: calc(400 * var(--u)); height: calc(682 * var(--u)); bottom: calc(-236 * var(--u)); object-fit: cover; }
.mountain-fade { left: calc(-35 * var(--u)); width: calc(461 * var(--u)); height: calc(212 * var(--u)); bottom: calc(263 * var(--u)); background: linear-gradient(to bottom, #fff 16.274%, rgba(255, 255, 255, 0)); }
.account-inner { position: relative; z-index: 1; padding: calc(80 * var(--u)) calc(40 * var(--u)) calc(212 * var(--u)); }
.acc-title { font-family: var(--f-wanted); font-weight: 700; font-size: calc(18 * var(--u)); line-height: 1.6; height: calc(29 * var(--u)); text-align: center; margin-bottom: calc(40 * var(--u)); }
.acc + .acc { margin-top: calc(12 * var(--u)); }
.acc-head {
  position: relative; z-index: 2; display: block; width: 100%; height: calc(50 * var(--u));
  background: var(--line); border-radius: calc(8 * var(--u));
  font-family: var(--f-wanted); font-weight: 700; font-size: calc(14 * var(--u)); line-height: 1.6;
  transition: border-radius .2s, background-color .15s;
}
.acc-head span { display: inline-block; transform: translateX(calc(-7 * var(--u))); }
.acc-head:active { background: #d8d9dc; }
.acc.open .acc-head { border-radius: calc(8 * var(--u)) calc(8 * var(--u)) 0 0; }
.acc-chev { position: absolute; right: calc(23 * var(--u)); top: calc(17 * var(--u)); width: calc(11.314 * var(--u)); height: calc(11.314 * var(--u)); display: flex; align-items: center; justify-content: center; transition: transform .35s var(--ease); }
.acc-chev::before { content: ""; width: calc(9.5 * var(--u)); height: calc(9.5 * var(--u)); background: url(icons/chevron.svg) center / 100% 100% no-repeat; transform: rotate(45deg) translate(calc(-2.2 * var(--u)), calc(-2.2 * var(--u))); }
.acc.open .acc-chev { transform: rotate(180deg); }
.acc-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .45s var(--ease); }
.acc.open .acc-body { grid-template-rows: 1fr; }
.acc-clip { overflow: hidden; min-height: 0; padding: 0 calc(14 * var(--u)) calc(14 * var(--u)); margin: 0 calc(-14 * var(--u)) calc(-14 * var(--u)); }
.acc-panel { background: #fff; border-radius: 0 0 calc(8 * var(--u)) calc(8 * var(--u)); box-shadow: 0 calc(4 * var(--u)) calc(14 * var(--u)) rgba(0, 0, 0, .15); opacity: 0; transition: opacity .3s; }
.acc.open .acc-panel { opacity: 1; }
.acc-row { position: relative; height: calc(84 * var(--u)); }
.acc-row + .acc-row::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: .5px; background: #d2d3d6; }
.acc-name { position: absolute; left: calc(20 * var(--u)); top: calc(20 * var(--u)); font-family: var(--f-wanted); font-weight: 700; font-size: calc(14 * var(--u)); line-height: 1.2; white-space: nowrap; }
.acc-name small { font-weight: 500; font-size: calc(10 * var(--u)); margin-right: calc(4 * var(--u)); position: relative; top: calc(-0.5 * var(--u)); }
.acc-num { position: absolute; left: calc(20 * var(--u)); top: calc(47 * var(--u)); font-family: var(--f-wanted); font-weight: 500; font-size: calc(14 * var(--u)); line-height: 1.2; color: var(--ink-2); white-space: nowrap; }
.copy {
  position: absolute; right: calc(21 * var(--u)); top: calc(28 * var(--u)); width: calc(28 * var(--u)); height: calc(28 * var(--u));
  display: flex; align-items: center; justify-content: center;
  background: #f4f4f5; border: .5px solid #eaebec; border-radius: calc(4 * var(--u));
  transition: transform .15s, background-color .15s;
}
.copy::after { content: ""; position: absolute; inset: calc(-8 * var(--u)); }
.copy img { width: calc(12 * var(--u)); height: calc(12 * var(--u)); }
.copy:active { transform: scale(.92); background: #e9e9eb; }
.copyright { margin-top: calc(26 * var(--u)); font-family: var(--f-pre); font-size: calc(12 * var(--u)); line-height: 1.2; text-align: center; }

/* ---------- 고정 버튼 ---------- */
.fab-layer { position: fixed; z-index: 50; top: 0; bottom: 0; left: 50%; width: var(--W); transform: translateX(-50%); pointer-events: none; }
.fab {
  position: absolute; right: calc(20 * var(--u)); width: calc(40 * var(--u)); height: calc(40 * var(--u)); pointer-events: auto;
  border-radius: 50%; background: rgba(255, 255, 255, .7);
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
  box-shadow: 0 calc(4 * var(--u)) calc(8 * var(--u)) rgba(41, 42, 45, .5);
  transition: transform .2s var(--ease);
}
.fab svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.fab:active { transform: scale(.9); }
.fab-music { top: calc(calc(20 * var(--u)) + env(safe-area-inset-top, 0px)); }
.fab-top   { bottom: calc(calc(80 * var(--u)) + env(safe-area-inset-bottom, 0px)); }
.fab-share { bottom: calc(calc(20 * var(--u)) + env(safe-area-inset-bottom, 0px)); }
.fab-music .ic-off { opacity: 0; }
.fab-music.muted .ic-on { opacity: 0; }
.fab-music.muted .ic-off { opacity: 1; }
.fab-music.playing .ic-on { animation: pulse 2.4s ease-in-out infinite; transform-origin: 50% 50%; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- 라이트박스 ---------- */
.lightbox {
  position: fixed; z-index: 100; top: 0; left: 50%; transform: translateX(-50%);
  width: var(--W); height: 100vh; height: 100dvh;
  background: #292a2d; overflow: hidden; touch-action: none;
  opacity: 0; transition: opacity .3s ease;
}
.lightbox[hidden] { display: block; visibility: hidden; pointer-events: none; }
.lightbox.show { opacity: 1; visibility: visible; }
.lb-track { position: absolute; inset: 0; display: flex; will-change: transform; }
.lb-track.anim { transition: transform .4s var(--ease); }
.lb-slide { flex: 0 0 100%; height: 100%; display: flex; align-items: center; justify-content: center; }
.lb-slide img { width: min(calc(310 * var(--u)), calc(78dvh * 2 / 3)); aspect-ratio: 310 / 465; height: auto; object-fit: cover; transform: scale(.94); transition: transform .4s var(--ease); }
.lightbox.show .lb-slide img { transform: none; }
.lb-nav { position: absolute; top: 50%; width: calc(48 * var(--u)); height: calc(64 * var(--u)); margin-top: calc(-32 * var(--u)); display: flex; align-items: center; justify-content: center; z-index: 2; }
.lb-nav svg { width: calc(10 * var(--u)); height: calc(10 * var(--u)); overflow: visible; }
.lb-prev { left: calc(2 * var(--u)); }
.lb-prev svg { transform: rotate(135deg); }
.lb-next { right: calc(2 * var(--u)); }
.lb-next svg { transform: rotate(-45deg); }
.lb-nav:active { opacity: .6; }
.lb-close { position: absolute; z-index: 2; top: calc(calc(18 * var(--u)) + env(safe-area-inset-top, 0px)); right: calc(16 * var(--u)); width: calc(40 * var(--u)); height: calc(40 * var(--u)); }
.lb-close::before, .lb-close::after { content: ""; position: absolute; left: 50%; top: 50%; width: calc(18 * var(--u)); height: 2px; margin: -1px 0 0 calc(-9 * var(--u)); background: rgba(255, 255, 255, .8); border-radius: 2px; transform: rotate(45deg); }
.lb-close::after { transform: rotate(-45deg); }
.lb-count { position: absolute; left: 0; right: 0; bottom: calc(calc(40 * var(--u)) + env(safe-area-inset-bottom, 0px)); text-align: center; font-family: var(--f-line); font-size: calc(12 * var(--u)); letter-spacing: .08em; color: rgba(255, 255, 255, .6); }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed; z-index: 120; left: 50%; bottom: calc(calc(150 * var(--u)) + env(safe-area-inset-bottom, 0px));
  transform: translate(-50%, calc(10 * var(--u))); max-width: calc(var(--W) - calc(80 * var(--u)));
  padding: calc(10 * var(--u)) calc(18 * var(--u)); border-radius: calc(20 * var(--u));
  background: rgba(41, 42, 45, .92); color: #fff;
  font-family: var(--f-wanted); font-weight: 500; font-size: calc(13 * var(--u)); line-height: 1.4; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s var(--ease);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
