/* ============================================
   Mobile Wedding Invitation - Style
   Base: 390px (iPhone 13/14)
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  --color-bg: #ffffff;
  --color-bg-outer: #f0f0f0;
  --color-text: #3a3a3a;
  --color-text-light: #888888;
  --color-text-muted: #aaaaaa;
  --color-accent: #7BA7C9;
  --color-accent-dark: #5a8bb0;
  --color-gold: #C4A96B;
  --color-border: #e8e8e8;
  --color-card-bg: #fafafa;
  --color-dot-active: #7BA7C9;
  --color-dot-inactive: #d0d0d0;
  --font-kr: 'Gowun Batang', serif;
  --font-en: 'Send Flowers', cursive;
}

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

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

body {
  font-family: var(--font-kr);
  font-size: 16px;
  line-height: 1.8;
  color: var(--color-text);
  background-color: var(--color-bg-outer);
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* --- Loading Overlay --- */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #ffffff;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.8s ease;
}

.loading-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

.loading-butterflies {
  position: relative;
  width: 200px;
  height: 200px;
}

.loading-butterfly {
  position: absolute;
  width: 50px;
  height: 50px;
}

.loading-butterfly .wing {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.loading-butterfly .wing-open {
  animation: flap-open 0.45s steps(1) infinite;
}

.loading-butterfly .wing-closed {
  animation: flap-closed 0.45s steps(1) infinite;
}

.loading-b1 {
  top: 40%;
  left: 20%;
  animation: loadingFly1 2.5s ease-in-out infinite;
}

.loading-b2 {
  top: 50%;
  left: 55%;
  width: 40px;
  height: 40px;
  animation: loadingFly2 3s ease-in-out infinite 0.5s;
}

@keyframes loadingFly1 {
  0%   { transform: translate(0, 0) rotate(-5deg); }
  25%  { transform: translate(30px, -20px) rotate(3deg); }
  50%  { transform: translate(10px, -35px) rotate(-3deg); }
  75%  { transform: translate(-15px, -15px) rotate(5deg); }
  100% { transform: translate(0, 0) rotate(-5deg); }
}

@keyframes loadingFly2 {
  0%   { transform: translate(0, 0) rotate(3deg) scaleX(-1); }
  25%  { transform: translate(-25px, -15px) rotate(-4deg) scaleX(-1); }
  50%  { transform: translate(-10px, -30px) rotate(2deg) scaleX(-1); }
  75%  { transform: translate(20px, -10px) rotate(-3deg) scaleX(-1); }
  100% { transform: translate(0, 0) rotate(3deg) scaleX(-1); }
}

/* --- Main Wrapper --- */
.invitation-wrapper {
  max-width: 390px;
  margin: 0 auto;
  background-color: var(--color-bg);
  position: relative;
  overflow: hidden;
  min-height: 100vh;
}

/* --- Section Common --- */
.section {
  padding: 50px 30px;
  text-align: center;
  position: relative;
}

.section-heading {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 28px;
  color: var(--color-text);
}

.section-invitation .section-heading {
  color: var(--color-gold);
}

/* --- BGM Button (Fixed) --- */
.bgm-fixed-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  z-index: 1000;
  pointer-events: none;
}

.bgm-button {
  position: absolute;
  top: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-radius: 20px;
  pointer-events: auto;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
  transition: opacity 0.3s;
}

.bgm-button:active {
  opacity: 0.7;
}

.bgm-icon {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.bgm-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--color-accent);
  letter-spacing: 0.5px;
}

/* --- Butterfly Animation --- */
.butterfly-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 390px;
  height: 100vh;
  pointer-events: none;
  z-index: 100;
  overflow: hidden;
}

.butterfly {
  position: absolute;
  width: 45px;
  height: 45px;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.06));
  transition: opacity 0.5s;
}

.butterfly.active {
  opacity: 0.8;
}

#butterfly2 {
  width: 36px;
  height: 36px;
}

/* Wing images stacked, alternate visibility for flapping */
.wing {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.wing-open {
  animation: flap-open 0.45s steps(1) infinite;
}

.wing-closed {
  animation: flap-closed 0.45s steps(1) infinite;
}

/* Slightly different flap speed for second butterfly */
#butterfly2 .wing-open {
  animation-duration: 0.55s;
}
#butterfly2 .wing-closed {
  animation-duration: 0.55s;
}

@keyframes flap-open {
  0%, 49.9%  { opacity: 1; }
  50%, 100%  { opacity: 0; }
}

@keyframes flap-closed {
  0%, 49.9%  { opacity: 0; }
  50%, 100%  { opacity: 1; }
}

/* --- Floral Decorations --- */
.floral {
  position: absolute;
  pointer-events: none;
  z-index: 1;
}

.floral-1 {
  top: -10px;
  right: 10px;
  width: 100px;
  opacity: 0.7;
  animation: floralDrift 4s ease-in-out infinite;
}

.floral-2 {
  bottom: -20px;
  left: 10px;
  width: 80px;
  opacity: 0.6;
  animation: floralSway 5s ease-in-out infinite;
}

.floral-3 {
  top: -10px;
  left: 10px;
  width: 70px;
  opacity: 0.5;
  animation: floralRock 3.5s ease-in-out infinite;
}

.floral-4 {
  top: 10px;
  right: 0;
  width: 110px;
  opacity: 0.5;
  animation: floralDrift 4.5s ease-in-out infinite reverse;
}

.floral-5 {
  top: -20px;
  right: 15px;
  width: 65px;
  opacity: 0.5;
  animation: floralRock 4s ease-in-out infinite;
}

/* floral_print_6: 나뭇잎 가지 (우상단→좌하단) - 연락하기 섹션 */
.floral-6 {
  top: -15px;
  right: -10px;
  width: 120px;
  opacity: 0.45;
  animation: floralSwing 5s ease-in-out infinite;
}

/* floral_print_7: 나뭇잎 가지 (좌하단→우상단) - 캘린더 섹션 */
.floral-7 {
  top: -10px;
  left: -10px;
  width: 110px;
  opacity: 0.4;
  animation: floralSwing 5.5s ease-in-out infinite reverse;
}

/* floral_print_2 재사용: 꽃잎 - 계좌 섹션 */
.floral-acct {
  bottom: 20px;
  right: 5px;
  width: 75px;
  opacity: 0.35;
  animation: floralFloat 6s ease-in-out infinite;
}

/* floral_print_4 재사용: 꽃잎 - 클로징 섹션 */
.floral-closing {
  top: -5px;
  left: 5px;
  width: 90px;
  opacity: 0.3;
  animation: floralFloat 5s ease-in-out infinite 1s;
}

@keyframes floralDrift {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(8px) rotate(2deg); }
}

@keyframes floralSway {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(5px); }
}

@keyframes floralRock {
  0%, 100% { transform: rotate(-2deg); }
  50% { transform: rotate(2deg); }
}

@keyframes floralSwing {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  30% { transform: rotate(1.5deg) translateY(3px); }
  70% { transform: rotate(-1deg) translateY(-2px); }
}

@keyframes floralFloat {
  0%, 100% { transform: translateY(0) translateX(0) rotate(0deg); }
  33% { transform: translateY(-5px) translateX(3px) rotate(1deg); }
  66% { transform: translateY(3px) translateX(-2px) rotate(-1deg); }
}

/* --- Scroll Fade-In Animation --- */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --- Section 1: Title with Wreath --- */
.section-title {
  padding-top: 60px;
  padding-bottom: 20px;
}

.wedding-eng {
  font-family: var(--font-en);
  font-size: 22px;
  color: var(--color-gold);
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.wreath-frame {
  position: relative;
  width: 340px;
  margin: 0 auto;
}

.wreath-img {
  width: 100%;
  display: block;
}

.wreath-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72%;
  text-align: center;
}

.couple-names {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 16px;
  line-height: 1.4;
  white-space: nowrap;
}

.couple-names .amp {
  font-weight: 400;
  color: var(--color-gold);
  margin: 0 3px;
}

.poem {
  font-size: 14px;
  color: var(--color-text);
  line-height: 2;
  margin-bottom: 6px;
}

.poem-last {
  margin-top: 10px;
  margin-bottom: 0;
}

/* --- Forest Photo Section --- */
.section-forest-photo {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.forest-bg {
  width: 100%;
  display: block;
}

.forest-photo-wrapper {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 65%;
}

.forest-wedding-photo {
  width: 100%;
  display: block;
}

/* --- Section 3: Date & Venue --- */
.section-date {
  padding-top: 30px;
  padding-bottom: 40px;
}

.date-intro {
  font-size: 15px;
  color: var(--color-gold);
  margin-bottom: 20px;
}

.date-main {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.venue-name {
  font-size: 15px;
  color: var(--color-text-light);
  margin-bottom: 20px;
}

/* --- Section 4: Invitation --- */
.section-invitation {
  padding-top: 40px;
  padding-bottom: 40px;
}

.invitation-body p {
  font-size: 15px;
  line-height: 2.2;
  color: var(--color-text);
}

/* --- Section 5: Gallery --- */
.section-gallery {
  padding: 20px 0 40px;
}

.gallery-viewport {
  width: 100%;
  overflow: hidden;
  touch-action: pan-y;
}

.gallery-track {
  display: flex;
  transition: transform 0.35s ease-out;
  will-change: transform;
}

.gallery-slide {
  min-width: 100%;
  padding: 0 20px;
}

.gallery-slide img {
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
  aspect-ratio: 3 / 4;
}

.gallery-wrapper {
  position: relative;
}

.gallery-hint {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 24px;
  white-space: nowrap;
  pointer-events: none;
  animation: hintPulse 2s ease-in-out infinite;
  transition: opacity 0.4s;
}

.gallery-hint.hidden {
  animation: none;
  opacity: 0;
}

@keyframes hintPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.gallery-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 18px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--color-dot-inactive);
  transition: background-color 0.3s, transform 0.3s;
  cursor: pointer;
}

.dot.active {
  background-color: var(--color-dot-active);
  transform: scale(1.2);
}

/* --- Section 6: Family --- */
.section-family {
  padding-top: 50px;
  padding-bottom: 30px;
}

.family-line {
  font-size: 16px;
  line-height: 2;
  letter-spacing: 1px;
}

.family-line strong {
  font-weight: 700;
}

.deceased {
  font-size: 12px;
  color: var(--color-text-light);
}

.family-call {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 6px;
  transition: background-color 0.2s;
}

.family-call:active {
  background-color: rgba(0, 0, 0, 0.04);
}

.family-call .phone-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

.family-message {
  margin-top: 28px;
}

.family-message p {
  font-size: 15px;
  line-height: 2;
  color: var(--color-text);
}

/* --- Section 7: Contact --- */
.section-contact {
  padding-top: 40px;
  padding-bottom: 40px;
  background-color: var(--color-card-bg);
}

.contact-group {
  margin-bottom: 20px;
}

.contact-side {
  display: block;
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 8px;
  letter-spacing: 1px;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 0;
}

.contact-link {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 20px;
  border-radius: 8px;
  transition: background-color 0.2s;
}

.contact-link:active {
  background-color: rgba(0, 0, 0, 0.04);
}

.contact-name {
  font-size: 16px;
  font-weight: 700;
}

.phone-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.phone-icon-disabled {
  opacity: 0.3;
  pointer-events: none;
}

.contact-row-inline {
  display: flex;
  justify-content: center;
  gap: 12px;
}

.contact-row-inline .contact-item {
  padding: 8px 16px;
}

/* --- Section 8: Flower Refusal --- */
.section-refusal {
  padding: 36px 30px;
}

.refusal-box {
  padding: 24px 20px;
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
}

.refusal-box p {
  font-size: 14px;
  line-height: 2;
  color: var(--color-text-light);
}

/* --- Section 9: Calendar --- */
.section-calendar {
  padding-top: 40px;
  padding-bottom: 40px;
}

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

.calendar-title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 8px;
}

.calendar-weekdays span {
  font-size: 12px;
  color: var(--color-text-light);
  text-align: center;
  padding: 4px 0;
}

.calendar-weekdays .sun {
  color: #d96b6b;
}

.calendar-weekdays .sat {
  color: var(--color-accent);
}

.calendar-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px 0;
}

.calendar-days span {
  text-align: center;
  padding: 6px 0;
  font-size: 14px;
  color: var(--color-text);
  position: relative;
}

.calendar-days span.empty {
  visibility: hidden;
}

.calendar-days span.sun-day {
  color: #d96b6b;
}

.calendar-days span.sat-day {
  color: var(--color-accent);
}

.calendar-days span.wedding-day {
  color: #fff;
  font-weight: 700;
}

.calendar-days span.wedding-day::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 32px;
  height: 32px;
  background-color: var(--color-accent);
  border-radius: 50%;
  z-index: -1;
}

.dday-text {
  font-size: 15px;
  color: var(--color-text);
  margin-top: 8px;
}

.dday-count {
  color: var(--color-gold);
  font-size: 16px;
}

/* --- Section 10: Location --- */
.section-location {
  padding-top: 40px;
  padding-bottom: 40px;
  background-color: var(--color-card-bg);
}

.location-name {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.location-address {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 4px;
}

.location-parking {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 18px;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 20px;
}

.nav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 10px;
  border-radius: 10px;
  transition: background-color 0.2s;
  width: 100px;
}

.nav-btn:active {
  background-color: rgba(0, 0, 0, 0.04);
}

.nav-btn img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
}

.nav-btn span {
  font-size: 12px;
  line-height: 1.4;
  color: var(--color-text);
  text-align: center;
}

.nav-btn small {
  color: var(--color-text-light);
}

/* --- Section 11: Account --- */
.section-account {
  padding-top: 40px;
  padding-bottom: 40px;
}

.account-intro {
  font-size: 16px;
  margin-bottom: 24px;
  color: var(--color-text);
}

.account-card {
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.account-side {
  display: block;
  font-size: 12px;
  color: var(--color-text-light);
  margin-bottom: 10px;
  letter-spacing: 1px;
}

.account-bank {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 2px;
}

.account-holder {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 14px;
}

.account-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
}

/* --- Section 12: Closing --- */
.section-closing {
  padding-top: 50px;
  padding-bottom: 40px;
  background: linear-gradient(180deg, #eaf1f7 0%, var(--color-bg) 100%);
}

.closing-text {
  font-size: 15px;
  line-height: 2;
  color: var(--color-text);
}

.closing-names {
  font-size: 17px;
  font-weight: 700;
  margin-top: 28px;
  margin-bottom: 4px;
  letter-spacing: 2px;
}

.closing-date {
  font-size: 14px;
  color: var(--color-text-light);
  margin-bottom: 28px;
}

.calendar-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.calendar-buttons .btn {
  width: 200px;
}

/* --- Footer --- */
.section-footer {
  position: relative;
  overflow: hidden;
}

.footer-floral {
  width: 100%;
  display: block;
}

/* --- Buttons --- */
.btn {
  display: inline-block;
  padding: 10px 24px;
  font-size: 13px;
  font-family: var(--font-kr);
  border-radius: 24px;
  transition: all 0.2s;
  letter-spacing: 0.5px;
}

.btn:active {
  transform: scale(0.97);
}

.btn-outline {
  border: 1px solid var(--color-border);
  background-color: var(--color-bg);
  color: var(--color-text);
}

.btn-outline:active {
  background-color: var(--color-card-bg);
}

.btn-primary {
  background-color: var(--color-accent);
  color: #fff;
  border: none;
  padding: 12px 28px;
  font-size: 14px;
  text-align: center;
}

.btn-primary:active {
  background-color: var(--color-accent-dark);
}

.btn-kakaopay {
  display: inline-block;
  padding: 10px 20px;
  font-size: 13px;
  font-family: var(--font-kr);
  border-radius: 24px;
  background-color: #FEE500;
  color: #3C1E1E;
  font-weight: 700;
  transition: all 0.2s;
}

.btn-kakaopay:active {
  transform: scale(0.97);
  opacity: 0.85;
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background-color: rgba(50, 50, 50, 0.9);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 13px;
  font-family: var(--font-kr);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 2000;
  white-space: nowrap;
}

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

/* --- Mobile-first responsiveness --- */
@media (max-width: 390px) {
  .invitation-wrapper {
    max-width: 100%;
  }
}

@media (min-width: 391px) {
  body {
    background-color: var(--color-bg-outer);
  }

  .invitation-wrapper {
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.06);
  }
}
