/* ============================================================
   상견례 발표 자료 — 디자인 시스템 (소프트 로맨틱 리뉴얼)
   화면: 풀블리드 연속 스크롤 + 오로라 메시.
   인쇄: 9장 A4 세로. 화면=인쇄 정합을 mm 단위로 잡아요.
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+KR:wght@300;400;500;700&family=Noto+Serif+KR:wght@300;500;700;900&display=swap");

/* --- 디자인 토큰 --------------------------------------------- */
:root {
  /* 색 (소프트 로맨틱 · 채도 낮춤) */
  --color-bg: #f7efe7;        /* 아이보리 바탕 */
  --color-ink: #3a2f2c;       /* 먹 — 이름·제목 */
  --color-text: #6b625c;      /* 보조 본문 */
  --color-point: #b07b63;     /* 로즈 포인트 */
  --color-subpoint: #7c8a6f;  /* 세이지 서브포인트 */
  --color-accent: #c9a24a;    /* 샴페인 골드 */
  --color-border: #e6d8c6;    /* 베이지 보더 */
  --color-hairline: rgba(176, 123, 99, 0.4); /* 가는 금빛 선 */
  --color-deep: #6e2b3a;      /* 버건디 — 깊이 액센트(선·번호·보더 한정) */

  /* 메시 stop */
  --mesh-peach: #ffd2bf;
  --mesh-blush: #f4c9d6;
  --mesh-sage: #cdd9bf;
  --mesh-sand: #e9d3b0;

  /* 타이포 */
  --font-serif: "Noto Serif KR", serif;
  --font-sans: "Noto Sans KR", sans-serif;

  /* A4 치수 */
  --page-width: 210mm;
  --page-height: 297mm;
  --page-margin: 18mm;

  /* 간격 */
  --space-xs: 4mm;
  --space-sm: 8mm;
  --space-md: 12mm;
  --space-lg: 18mm;

  /* 모션 */
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  line-height: 1.7;
  word-break: keep-all; /* 한글은 음절 중간이 아니라 단어/어절 단위로 줄바꿈 */
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* --- 오로라 메시 + 그레인 (화면 배경 레이어) ----------------- */
.mesh-bg {
  position: fixed;
  inset: -25%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(38% 38% at 24% 22%, var(--mesh-peach) 0%, transparent 60%),
    radial-gradient(42% 42% at 80% 18%, var(--mesh-blush) 0%, transparent 60%),
    radial-gradient(46% 46% at 72% 82%, var(--mesh-sage) 0%, transparent 60%),
    radial-gradient(40% 40% at 18% 80%, var(--mesh-sand) 0%, transparent 60%);
  filter: blur(10px);
  opacity: 0.85;
  animation: mesh-drift 16s ease-in-out infinite alternate;
}

@keyframes mesh-drift {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(2%, -2%) scale(1.06); }
  100% { transform: translate(-2%, 2%) scale(1.04); }
}

.grain {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.3'/%3E%3C/svg%3E");
}

/* --- 페이지(섹션) 기본 -------------------------------------- */
.page {
  position: relative;
  z-index: 2;
  width: var(--page-width);
  min-height: var(--page-height);
  padding: var(--page-margin);
  margin: 0 auto;
  overflow: hidden;
  page-break-after: always;
  break-after: page;
}

.page:last-child {
  page-break-after: auto;
  break-after: auto;
}

/* --- 화면: 풀블리드 연속 스크롤 ------------------------------ */
@media screen {
  .page {
    width: 100%;
    max-width: 880px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 14vh clamp(24px, 6vw, 80px);
    overflow: visible;
  }

  /* 스크롤 등장: JS(html.js)가 있을 때만 숨겼다 등장. 없으면 그대로 보여요. */
  /* .reveal-on이 있는 섹션만 opt-in으로 등장 애니메이션이 적용돼요. */
  html.js .page.reveal-on > *:not(.scroll-cue) {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
  }
  html.js .page.reveal-on.in-view > *:not(.scroll-cue) { opacity: 1; transform: none; }
  html.js .page.reveal-on.in-view > *:nth-child(1) { transition-delay: 0.04s; }
  html.js .page.reveal-on.in-view > *:nth-child(2) { transition-delay: 0.12s; }
  html.js .page.reveal-on.in-view > *:nth-child(3) { transition-delay: 0.20s; }
  html.js .page.reveal-on.in-view > *:nth-child(4) { transition-delay: 0.28s; }
  html.js .page.reveal-on.in-view > *:nth-child(5) { transition-delay: 0.36s; }
  html.js .page.reveal-on.in-view > *:nth-child(6) { transition-delay: 0.44s; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .mesh-bg, .scroll-cue { animation: none; }
  html.js .page > * { opacity: 1 !important; transform: none !important; transition: none; }
}

/* --- 섹션 머리말 -------------------------------------------- */
.section-header {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-sm);
  border-bottom: 1px solid var(--color-hairline);
}

.section-number {
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 12pt;
  letter-spacing: 0.1em;
  color: var(--color-deep);
  margin-bottom: 2mm;
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(24pt, 7vw, 32pt);
  line-height: 1.25;
  color: var(--color-ink);
  letter-spacing: 0.01em;
}

.section-subtitle {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 10pt;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  color: var(--color-point);
  margin-top: 2mm;
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

/* --- 표지 --------------------------------------------------- */
.cover {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.cover__subtitle {
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 11pt;
  text-transform: uppercase;
  letter-spacing: 0.42em;
  color: var(--color-point);
}

.cover__rule {
  width: 30mm;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-accent), transparent);
  margin: var(--space-sm) auto;
}

.cover__title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(34pt, 11vw, 52pt);
  line-height: 1.35;
  color: var(--color-ink);
  letter-spacing: 0.01em;
}

.cover__meta {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 11pt;
  letter-spacing: 0.18em;
  color: var(--color-text);
  margin-top: var(--space-sm);
  padding: 2mm 6mm;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  border: 1px solid rgba(255, 255, 255, 0.6);
}

.cover__qr {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3mm;
}

.cover__qr img {
  width: 92px;
  height: 92px;
  padding: 3mm;
  background: #fdf9f4;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}

.cover__qr-caption {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 9pt;
  letter-spacing: 0.12em;
  color: var(--color-text);
}

.cover__closing-word {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: clamp(30pt, 9vw, 44pt);
  line-height: 1.4;
  letter-spacing: 0.06em;
  color: var(--color-ink);
}

.cover__closing-names {
  margin-top: var(--space-md);
  font-family: var(--font-serif);
  font-size: 15pt;
  letter-spacing: 0.06em;
  color: var(--color-point);
}

.cover__closing-date {
  margin-top: var(--space-xs);
  font-family: var(--font-sans);
  font-size: 10pt;
  letter-spacing: 0.2em;
  color: var(--color-text);
}

.scroll-cue {
  position: absolute;
  bottom: 5vh;
  left: 50%;
  transform: translateX(-50%);
  font-size: 22px;
  line-height: 1;
  color: var(--color-point);
  animation: cue-bounce 2s var(--ease) infinite;
}

@keyframes cue-bounce {
  0%, 100% { transform: translate(-50%, 0); opacity: 0.5; }
  50%      { transform: translate(-50%, 8px); opacity: 1; }
}

/* --- 사진 자리 (placeholder) -------------------------------- */
.photo-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2mm;
  border: 1px dashed var(--color-hairline);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.35);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: var(--color-accent);
  text-align: center;
  min-height: 40mm;
}

.photo-placeholder__icon { font-size: 20pt; line-height: 1; }

.photo-placeholder__label {
  font-family: var(--font-sans);
  font-size: 9pt;
  letter-spacing: 0.08em;
  color: var(--color-subpoint);
}

.photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  object-fit: cover;
}

/* 프로필 사진: placeholder와 같은 고정 프레임을 채워요 */
.profile-photo {
  display: block;
  width: 30mm;
  height: 36mm;
  flex-shrink: 0;
  border-radius: 14px;
  object-fit: cover;
}

/* 갤러리 사진: 정사각 칸을 채워요 */
.gallery-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  object-fit: cover;
}

/* 하와이 콜라주: 2×2 타일로 하이라이트 4곳을 담아요 */
.hawaii-collage {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2mm;
}

.collage-photo {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 10px;
  object-fit: cover;
}

/* 2세 사진: 큰 세로 프레임을 채워요 */
.kids-photo {
  display: block;
  width: 100%;
  height: 95mm;
  border-radius: 14px;
  object-fit: cover;
}

/* 청첩장 시안: 원본 비율 그대로, 실물 카드 느낌의 테두리·그림자 */
.invitation-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid var(--color-hairline);
}

/* 신혼집 미니어처: 원본 비율 그대로, 카드 폭에 맞춰요 */
.home-photo {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;
  margin-bottom: var(--space-sm);
}

/* --- 카드 --------------------------------------------------- */
.card {
  border: 1px solid var(--color-hairline);
  border-radius: 14px;
  background: rgba(255, 252, 248, 0.78);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  padding: var(--space-sm);
}

/* 강조 카드: 로즈 틴트 + 포인트 보더. 인라인 배경 대신 이 클래스를 써요. */
.card--highlight {
  background: linear-gradient(180deg, rgba(176, 123, 99, 0.10), rgba(255, 255, 255, 0.55));
  border-color: var(--color-deep);
}

/* --- 반응형 grid 유틸 -------------------------------------- */
.grid-2        { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-sm); }
.grid-3        { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }
.grid-4        { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-xs); }
.grid-gallery  { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-sm); }
.grid-photo-list { display: grid; grid-template-columns: 1.2fr 1fr; gap: var(--space-sm); }
.grid-sched-head { display: grid; grid-template-columns: 1fr 1.3fr 0.6fr; gap: var(--space-sm); }
.grid-checklist  { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-xs) var(--space-sm); }

@media screen and (max-width: 640px) {
  /* 텍스트 카드 묶음: 모두 1열 (screen 한정 — 인쇄 경로와 분리) */
  .grid-2,
  .grid-3,
  .grid-photo-list,
  .grid-sched-head { grid-template-columns: 1fr; gap: var(--space-xs); }
  /* 사진 썸네일: 2열 유지(너무 작아지지 않게) */
  .grid-gallery   { grid-template-columns: 1fr 1fr; }
  .gallery-photo  { aspect-ratio: 4 / 3; }
  /* 짧은 라벨 타임라인/체크리스트: 2열 유지 */
  .grid-4         { grid-template-columns: 1fr 1fr; }
  .grid-checklist { grid-template-columns: 1fr; }
  .profile-card { flex-direction: column; text-align: center; }
  .photo-placeholder { min-height: 0 !important; aspect-ratio: 4 / 3; }
  .profile-card .photo-placeholder { width: 60% !important; height: auto !important; aspect-ratio: 5 / 6; }
  .profile-card .profile-photo { width: 60%; height: auto; aspect-ratio: 5 / 6; }
  /* 04 2세 큰 사진은 세로형 */
  #future-kids .photo-placeholder { aspect-ratio: 3 / 4; }
  #future-kids .kids-photo { height: auto; aspect-ratio: 3 / 4; }
}

/* --- 점 내비게이션 (화면 전용) ------------------------------ */
.dot-nav {
  position: fixed;
  right: clamp(12px, 2.5vw, 30px);
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dot-nav a {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: rgba(58, 47, 44, 0.18);
  transition: background 0.3s, transform 0.3s;
}

.dot-nav a:hover { background: var(--color-point); transform: scale(1.25); }
.dot-nav a.active { background: var(--color-accent); transform: scale(1.35); }

@media (max-width: 640px) { .dot-nav { display: none; } }

/* --- 인쇄 보정 ---------------------------------------------- */
@page {
  size: A4 portrait;
  margin: 0; /* 여백은 .page padding이 대신해요 — 배경이 종이 끝까지 차게 */
}

@media print {
  /* 시트 단위(html)로 크림 배경을 칠해 넘침 영역까지 채워요. */
  html { background: var(--color-bg); }
  body { background: var(--color-bg); padding: 0; }

  /* 화면 전용 요소·연출은 인쇄에서 모두 꺼요. */
  .mesh-bg, .grain, .dot-nav, .scroll-cue { display: none !important; }
  html.js .page > * { opacity: 1 !important; transform: none !important; }

  .page {
    width: auto;
    max-width: none;
    min-height: var(--page-height);
    padding: var(--page-margin);
    margin: 0;
    display: block;
    box-shadow: none;
    overflow: visible;
    /* 메시는 인쇄 시 옅은 정지 워시로만 남겨요. */
    background:
      radial-gradient(60% 50% at 82% 0%, rgba(244, 201, 214, 0.16) 0%, transparent 70%),
      radial-gradient(52% 42% at 0% 100%, rgba(205, 217, 191, 0.16) 0%, transparent 70%);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* 표지: 인쇄에서 .page가 block이 되며 풀린 가운데 정렬을 복구해요. */
  .cover {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
  }

  /* 표지 QR: 인쇄에서 크기를 줄여 표지 한 장 안에 담는다.
     화면전용 숨김 목록(.mesh-bg/.grain/.dot-nav/.scroll-cue)에 넣지 않아 인쇄에 표시된다. */
  .cover__qr { margin-top: var(--space-sm); }
  .cover__qr img { width: 26mm; height: 26mm; padding: 2mm; }
  .cover__qr-caption { font-size: 8pt; }

  .photo-placeholder, .card { break-inside: avoid; }

  /* 반투명 그라데이션 + backdrop-filter는 미리보기(Quartz)에서 세로 이음새로 보여요.
     인쇄에선 blur가 안 보이니 카드 배경을 불투명 단색으로 바꿔 이음새를 없애요. */
  .card, .card--highlight {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
  .card { background: #fdf9f4; }
  .card--highlight { background: #f6ece6; }

  /* 03 신혼집 사진: 원본 비율 유지한 채 높이만 줄여 2세 카드까지 한 장에 담아요. */
  .home-photo {
    width: auto;
    max-width: 100%;
    max-height: 100mm;
    margin-left: auto;
    margin-right: auto;
  }
}
