/* 결혼 알림 페이지 스타일 — 색은 :root 에서만 바꾼다 */

:root {
  --paper: #f6f1e9;
  --paper-deep: #ece4d8;
  --card: #fffdf9;
  --ink: #3a332e;
  --muted: #8d8178;
  --accent: #a8705a;
  --accent-soft: #c99a8a;
  --line: #e2d6c6;

  --env-back: #e4d8c6;
  --env-pocket: #f0e7da;
  --env-flap: #e9dfd0;
  --env-flap-inside: #ddd0bd;

  --font-title: "Gowun Batang", "Noto Serif KR", serif;
  --font-body: "Noto Serif KR", serif;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--paper);
  /* 종이 결: 아주 옅은 잡티 */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.45 0 0 0 0 0.38 0 0 0 0 0.3 0 0 0 0.06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.9;
  word-break: keep-all;
}

body.is-locked {
  overflow: hidden;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

.heart {
  color: var(--accent-soft);
  font-size: 0.75em;
}

/* =========================================================
   봉투
   ========================================================= */

.envelope-screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 44px;
  background:
    radial-gradient(ellipse at 50% 45%, rgba(255, 253, 249, 0.9), transparent 65%),
    var(--paper);
  transition: opacity 0.9s ease;
}

.envelope-stage {
  position: relative;
  transition: transform 1.2s var(--ease-out), opacity 0.7s ease 0.2s, filter 0.7s ease 0.2s;
}

.envelope {
  position: relative;
  display: block;
  width: min(320px, 84vw);
  aspect-ratio: 1.45;
  animation: env-float 3.6s ease-in-out infinite;
}

.envelope > span {
  position: absolute;
  display: block;
}

.env-back {
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(165deg, #e9dfcf, var(--env-back));
}

.env-card {
  top: 5%;
  left: 6%;
  right: 6%;
  height: 90%;
  z-index: 1;
  border-radius: 2px;
  background: var(--card);
  box-shadow:
    inset 0 0 0 6px var(--card),
    inset 0 0 0 7px var(--line),
    0 1px 3px rgba(80, 60, 40, 0.08);
  transition: transform 1.1s var(--ease-out) 1.15s;
}

.card-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding-top: 13%;
}

.card-names {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 19px;
  letter-spacing: 0.12em;
}

.card-line {
  width: 22px;
  height: 1px;
  background: var(--accent-soft);
}

.card-msg {
  font-size: 12px;
  letter-spacing: 0.28em;
  color: var(--muted);
}

/* 앞 주머니: V 자로 파인 종이 + 파인 가장자리 그림자 */
.env-pocket-wrap {
  inset: 0;
  z-index: 2;
  filter: drop-shadow(0 -1px 1.5px rgba(80, 60, 40, 0.14));
}

.env-pocket {
  position: absolute;
  inset: 0;
  border-radius: 4px;
  background: linear-gradient(180deg, #f3ebdf, var(--env-pocket) 60%, #ece2d3);
  clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%);
}

.env-address {
  left: 0;
  right: 0;
  bottom: 9%;
  z-index: 3;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.address-label {
  font-size: 10.5px;
  letter-spacing: 0.3em;
  color: var(--muted);
}

.address-names {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-title);
  font-size: 16px;
  letter-spacing: 0.1em;
}

/* 덮개: 감싼 쪽이 그림자를 맡고, 안쪽이 3D 로 뒤집힌다 */
.env-flap-wrap {
  inset: 0;
  z-index: 4;
  perspective: 900px;
  filter: drop-shadow(0 2px 2px rgba(80, 60, 40, 0.16));
  pointer-events: none;
}

.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, #ede4d6, var(--env-flap));
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
}

/* 밀랍 도장 */
.env-seal {
  top: 50%;
  left: 50%;
  z-index: 5;
  width: 50px;
  height: 50px;
  display: grid !important;
  place-items: center;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  background: radial-gradient(circle at 34% 30%, #c98d76 0%, #a8705a 42%, #8b5442 100%);
  box-shadow:
    0 3px 6px rgba(70, 40, 30, 0.28),
    inset 0 -3px 6px rgba(60, 30, 20, 0.3),
    inset 0 2px 3px rgba(255, 220, 200, 0.25);
  transform: translate(-50%, -50%);
}

.env-seal::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 1px solid var(--accent-soft);
  animation: seal-pulse 2.4s ease-out infinite;
}

.seal-ring {
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  border: 1px solid rgba(255, 228, 212, 0.35);
}

.seal-mark {
  width: 22px;
  height: 22px;
  fill: rgba(255, 232, 218, 0.82);
  filter: drop-shadow(0 -1px 0 rgba(60, 30, 20, 0.35));
}

.env-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: -26px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(80, 60, 40, 0.18), transparent 70%);
  animation: shadow-breathe 3.6s ease-in-out infinite;
}

.envelope-hint {
  font-size: 13px;
  letter-spacing: 0.22em;
  color: var(--muted);
  animation: hint-blink 2.4s ease-in-out infinite;
  transition: opacity 0.4s ease;
}

/* ---- 여는 순서: 도장 → 덮개 → 카드 ---- */

.envelope-screen.is-opening .envelope,
.envelope-screen.is-opening .env-shadow {
  animation: none;
}

.envelope-screen.is-opening .envelope-hint {
  animation: none;
  opacity: 0;
}

.envelope-screen.is-opening .env-seal {
  animation: seal-off 0.7s var(--ease-out) forwards;
}

.envelope-screen.is-opening .env-seal::after {
  animation: none;
  opacity: 0;
}

.envelope-screen.is-opening .env-flap {
  animation: flap-open 0.9s cubic-bezier(0.45, 0, 0.2, 1) 0.35s forwards;
}

.envelope-screen.is-opening .env-flap-wrap {
  z-index: 0;
  transition: z-index 0s linear 0.8s;
}

.envelope-screen.is-opening .env-card {
  transform: translateY(-58%);
}

/* ---- 걷히기 ---- */

.envelope-screen.is-leaving {
  opacity: 0;
  pointer-events: none;
}

.envelope-screen.is-leaving .envelope-stage {
  transform: translateY(-3vh) scale(1.14);
  opacity: 0;
  filter: blur(4px);
}

@keyframes env-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@keyframes shadow-breathe {
  0%, 100% { transform: scaleX(1); opacity: 1; }
  50% { transform: scaleX(0.9); opacity: 0.7; }
}

@keyframes seal-pulse {
  0% { transform: scale(1); opacity: 0.8; }
  100% { transform: scale(1.7); opacity: 0; }
}

@keyframes hint-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

@keyframes seal-off {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
  30% { transform: translate(-50%, -50%) scale(1.12); opacity: 1; }
  100% { transform: translate(-50%, 10%) scale(0.5) rotate(28deg); opacity: 0; }
}

@keyframes flap-open {
  0% { transform: rotateX(0deg); background: var(--env-flap); }
  49% { background: var(--env-flap); }
  50% { background: var(--env-flap-inside); }
  100% { transform: rotateX(180deg); background: var(--env-flap-inside); }
}

/* =========================================================
   꽃잎
   ========================================================= */

.petals {
  position: fixed;
  inset: 0;
  z-index: 30;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.5s ease 0.6s;
}

.petals.is-on {
  opacity: 1;
}

/* =========================================================
   본문 공통
   ========================================================= */

.main {
  max-width: 480px;
  margin: 0 auto;
}

.section {
  position: relative;
  padding: 80px 28px;
  text-align: center;
}

.section-title {
  margin-bottom: 36px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.25em;
  text-indent: 0.25em;
  color: var(--accent);
}

.section-title::after {
  content: "";
  display: block;
  width: 18px;
  height: 1px;
  margin: 14px auto 0;
  background: var(--accent-soft);
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 36px;
  font-size: 11px;
  color: var(--accent-soft);
}

.ornament span {
  width: 0;
  height: 1px;
  background: var(--line);
  transition: width 1.2s var(--ease-out) 0.2s;
}

.ornament.is-visible span {
  width: 48px;
}

/* 스크롤 등장: 흐릿하게 아래에서 떠오른다 */
.reveal,
.stagger > * {
  opacity: 0;
  transform: translateY(18px);
  filter: blur(4px);
  transition:
    opacity 1.1s ease,
    transform 1.1s var(--ease-out),
    filter 1.1s ease;
}

.stagger > * {
  transition-delay: calc(var(--i, 0) * 0.16s);
}

.reveal.is-visible,
.stagger.is-visible > * {
  opacity: 1;
  transform: none;
  filter: none;
}

/* 사진 자리: 불러오면 서서히, 파일이 없으면 「사진」 */
.photo-frame {
  position: relative;
  display: block;
  overflow: hidden;
  background: var(--paper-deep);
}

.photo-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease, transform 0.8s var(--ease-out);
}

.photo-frame.is-loaded img {
  opacity: 1;
}

.photo-frame.is-empty::after {
  content: "사진";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* =========================================================
   표지
   ========================================================= */

.hero {
  min-height: 100svh;
  padding-top: 60px;
  padding-bottom: 72px;
}

.intro {
  opacity: 0;
}

.main.is-in .intro {
  animation: intro-rise 1.2s var(--ease-out) forwards;
  animation-delay: var(--d, 0s);
}

.hero-eyebrow { --d: 0.1s; }
.hero-photo { --d: 0.15s; }
.hero-names { --d: 0.85s; }
.hero-date { --d: 1s; }
.hero-lead { --d: 1.2s; }
.scroll-cue { --d: 1.9s; }

.hero-eyebrow {
  margin-bottom: 30px;
  font-size: 12px;
  letter-spacing: 0.5em;
  text-indent: 0.5em;
  color: var(--muted);
}

.hero-photo {
  position: relative;
  padding: 10px;
}

/* 사진 바깥 아치 테두리 */
.hero-photo::before {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 999px 999px 8px 8px;
}

.hero-photo .photo-frame {
  aspect-ratio: 4 / 5;
  border-radius: 999px 999px 4px 4px;
}

.main.is-in .hero-photo .photo-frame {
  animation: unveil 1.8s cubic-bezier(0.65, 0, 0.25, 1) 0.2s both;
}

.main.is-in .hero-photo .photo-frame img {
  animation: slow-zoom 3.2s var(--ease-out) 0.2s both;
}

.hero-names {
  margin-top: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  font-family: var(--font-title);
  font-weight: 400;
  font-size: 24px;
  letter-spacing: 0.14em;
}

.hero-date {
  margin-top: 14px;
  font-size: 14px;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.hero-lead {
  margin-top: 30px;
  font-size: 15px;
  line-height: 2;
}

.scroll-cue {
  position: relative;
  display: block;
  width: 1px;
  height: 44px;
  margin: 40px auto 0;
  overflow: hidden;
  background: var(--line);
}

.scroll-cue::after {
  content: "";
  position: absolute;
  left: 0;
  top: -14px;
  width: 1px;
  height: 14px;
  background: var(--accent);
  animation: cue-drop 2s ease-in-out infinite;
}

@keyframes intro-rise {
  from { opacity: 0; transform: translateY(16px); filter: blur(4px); }
  to { opacity: 1; transform: none; filter: none; }
}

@keyframes unveil {
  from { clip-path: inset(100% 0 0 0 round 999px 999px 4px 4px); }
  to { clip-path: inset(0 0 0 0 round 999px 999px 4px 4px); }
}

@keyframes slow-zoom {
  from { transform: scale(1.14); }
  to { transform: scale(1); }
}

@keyframes cue-drop {
  0% { top: -14px; }
  70%, 100% { top: 44px; }
}

/* =========================================================
   인사말 · 가족
   ========================================================= */

.greeting {
  background: rgba(255, 253, 249, 0.7);
}

.greeting-text {
  display: flex;
  flex-direction: column;
  gap: 24px;
  font-size: 15px;
  line-height: 2;
}

.greeting-sign {
  margin-top: 40px;
  font-family: var(--font-title);
  font-size: 14px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.family-card {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 26px;
}

.family-divider {
  width: 1px;
  height: 52px;
  background: var(--line);
}

.family-parents {
  font-size: 14px;
  color: var(--muted);
}

.family-child {
  margin-top: 2px;
  font-size: 15px;
}

.family-child strong {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 16px;
}

/* =========================================================
   사진 모음
   ========================================================= */

.gallery {
  background: rgba(255, 253, 249, 0.7);
}

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

.gallery-item {
  aspect-ratio: 1;
  border-radius: 4px;
}

/* 첫 사진은 크게 */
.gallery-item:first-child {
  grid-column: span 2;
  grid-row: span 2;
}

.gallery-item:active img {
  transform: scale(1.04);
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(24, 20, 17, 0.95);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease;
}

#lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.4s ease, transform 0.5s var(--ease-out);
}

#lightbox-img.is-shown {
  opacity: 1;
  transform: none;
}

.lightbox-close {
  position: absolute;
  top: max(12px, env(safe-area-inset-top));
  right: 16px;
  padding: 4px 8px;
  font-size: 32px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.85);
}

.lightbox-nav {
  position: absolute;
  top: 50%;
  padding: 16px 10px;
  font-size: 34px;
  color: rgba(255, 255, 255, 0.6);
  transform: translateY(-50%);
}

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

.lightbox-count {
  position: absolute;
  bottom: max(24px, env(safe-area-inset-bottom));
  font-size: 13px;
  letter-spacing: 0.15em;
  color: rgba(255, 255, 255, 0.6);
}

/* =========================================================
   마음 전하실 곳
   ========================================================= */

.accounts-lead {
  margin-bottom: 28px;
  font-size: 14px;
  color: var(--muted);
}

.account-groups {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.account-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  overflow: hidden;
}

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

.account-group summary::-webkit-details-marker {
  display: none;
}

.chevron {
  width: 8px;
  height: 8px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 0.3s ease;
}

.account-group[open] .chevron {
  transform: rotate(-135deg) translateY(-2px);
}

.account-group[open] .account-list {
  animation: list-open 0.4s var(--ease-out);
}

.account-list {
  list-style: none;
  border-top: 1px solid var(--line);
}

.account-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: center;
  padding: 14px 18px;
}

.account-row + .account-row {
  border-top: 1px dashed var(--line);
}

.account-who {
  font-size: 14px;
}

.account-role {
  margin-right: 4px;
  font-size: 12px;
  color: var(--muted);
}

.account-number {
  grid-column: 1;
  font-size: 13px;
  color: var(--muted);
}

.copy-button {
  grid-column: 2;
  grid-row: 1 / span 2;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12px;
  color: var(--accent);
}

.copy-button:active {
  background: var(--paper-deep);
}

@keyframes list-open {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: none; }
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(32px, env(safe-area-inset-bottom));
  z-index: 70;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(58, 51, 46, 0.92);
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 10px);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-out);
  pointer-events: none;
}

.toast.is-shown {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* =========================================================
   마무리
   ========================================================= */

.closing {
  padding-bottom: 120px;
}

.closing-thanks {
  font-family: var(--font-title);
  font-size: 19px;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
}

.closing-names {
  margin-top: 14px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }
}
