/* ==========================================================================
   1. FONTS & ROOT VARIABLES
   ========================================================================== */
/* 구글 웹폰트 (Alex Brush, Cinzel, Gowun Dodum) */
@import url('https://fonts.googleapis.com/css2?family=Alex+Brush&family=Cinzel:wght@400;500&family=Gowun+Dodum&display=swap');

/* Crimson Pro 폰트 정의 */
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(https://fonts.gstatic.com/s/crimsonpro/v28/q5uUsoa5M_tv7IihmnkabC5XiXCAlXGks1WZzm1MMJs-ZNU.woff2) format('woff2');
  unicode-range: U+0102-0103, U+0110-0111, U+0128-0129, U+0168-0169, U+01A0-01A1, U+01AF-01B0, U+0300-0301, U+0303-0304, U+0308-0309, U+0323, U+0329, U+1EA0-1EF9, U+20AB;
}

/* 로컬 영문 폰트 정의 */
@font-face {
  font-family: 'MrSheffieldPro-Regular';
  src: url('../font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.woff2') format('woff2'),
       url('../font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.woff') format('woff'),
       url('../font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.otf') format('opentype'),
       url('../font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'mrsheffield-pro';
  src: url('img/font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.woff') format('woff'),
       url('img/font/MrSheffieldPro-Regular/MrSheffieldPro-Regular.otf') format('opentype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colors */
  --primary-bg-color: #fbf4f4;
  --secondary-bg-color: #f8ecec;
  --third-bg-color: rgba(188, 132, 132, 0.14);
  --footer-bg-color: rgba(188, 132, 132, 0.14);
  
  --text-color: #49413a;
  --text-dark-color: #643e3e;
  --text-light-color: #ad6c7a;
  --title-text-color: #c07989;
  --subtitle-text-color: #deafaf;
  
  --border-color: #f5e6e6;
  --border-light-color: #ece3d7;
  --icon-color: #dea0a0;

  /* Assets & Layout */
  --primary-bg-image: url('./mcard/assets/images/bg_paper_00.png');
  --margin-bg-color: #fbf4f4;

  /* Buttons */
  --btn-text-color: #b96c6c;
  --btn-border-color: #e9d6d6;

  /* Typography & Spacing */
  --font-size: 18px;
  --common-margin-lr: 2rem;
  --account-margin-lr: 1.1rem;
  --calendar-margin-lr: 1rem;
  
  --font-regular: 'Gowun Dodum', serif;
  --font-regular-spacing: -0.2px;
  --font-gothic: 'Pretendard Variable', sans-serif;
  --font-gothic-spacing: -0.2px;
  --font-bold: 'Gowun Dodum', serif;
  --font-bold-weight: bold;
}

/* PC 화면(카드가 중앙 정렬되는 431px 이상) 배경 처리 */
@media (min-width: 431px) {
  :root {
    --margin-bg-color: #ffffff;
  }
}

/* ==========================================================================
   2. RESET & BASE
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body, #app {
  height: 100%;
}

html {
  font-size: calc(var(--font-size) * 430 / 390);
}

body {
  margin: 0;
  padding: 0;
  background-color: var(--margin-bg-color) !important;
}

body.modal-open {
  overflow: hidden;
}

#app {
  font-family: var(--font-gothic), sans-serif;
  -webkit-font-smoothing: antialiased;
  text-align: center;
}

button {
  font-family: inherit;
}

/* ==========================================================================
   3. UTILITIES & MAIN CONTAINER
   ========================================================================== */
.gothic {
  font-family: var(--font-gothic), sans-serif;
  letter-spacing: var(--font-gothic-spacing);
}

.mcard-view {
  position: relative;
  width: 100% !important;
  min-width: 320px;
  max-width: 430px !important;
  margin: 0 auto !important;
  padding: 0;
  color: var(--text-color);
  background: var(--primary-bg-color) var(--primary-bg-image);
  line-height: 2rem;
  font-family: var(--font-regular), serif;
  letter-spacing: var(--font-regular-spacing);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

.m-title {
  color: var(--title-text-color);
  font-size: 1.1rem;
  margin-bottom: 20px;
}

.m-subtitle {
  font-size: 0.7rem;
  color: var(--subtitle-text-color);
  font-family: 'Crimson Pro', serif;
  letter-spacing: 3px;
  line-height: 20px;
}

.inner {
  opacity: 0;
  animation: fadeIn 0.5s ease-in-out forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

/* Audio Player */
.audio-player {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 999;
}
.audio-alert { font-size: 12px; line-height: 0; }
.audio-alert svg { width: 16px; height: 16px; fill: #777; cursor: pointer; display: none; }
.audio-alert.muted .svg-mute { display: inline-block; }
.audio-alert:not(.muted) .svg-unmute { display: inline-block; }

/* ==========================================================================
   4. SECTIONS
   ========================================================================== */
/* Intro */
.mcard-intro { position: relative; margin-bottom: 40px; color: #2b2222; }
.mcard-intro .title-wrap { display: flex; flex-direction: column; padding: 40px 0 30px; }
.mcard-intro .title-wrap .subtitle {
  font-family: 'Crimson Pro', serif;
  letter-spacing: 2px;
  font-size: 13px;
  line-height: 28px;
  color: #898484;
}
.mcard-intro .bottom-wrap { display: flex; flex-direction: column; gap: 12px; padding-top: 30px; }
.mcard-intro .eng-name {
  font-family: 'MrSheffieldPro-Regular', 'mrsheffield-pro', cursive !important;
  font-size: min(1.8rem, 30px) !important;
  line-height: 2.2rem;
  letter-spacing: 1.5px;
}
.mcard-intro .date-place { font-size: 0.9rem; line-height: 1.8rem; }
.mcard-intro .photo-wrap.arch { width: 100%; overflow: hidden; line-height: 0; }
.mcard-intro .photo img { width: 100%; height: auto; display: block; object-fit: cover; }

/* Greetings */
.greetings-wrap { padding: 40px 0; }
.greetings-wrap .text { display: inline-block; margin: 16px 1rem 1.2rem; font-size: 0.9rem; }
.greetings-wrap .image img { display: block; width: 100%; margin: 50px 0 0; border-radius: 6px; }
.members-wrap { padding: 1.2rem 0; }
.members-wrap .relation { font-size: 0.8rem; color: #8a857f; }
.contact-box { margin: 0 auto; max-width: 220px; color: var(--btn-text-color); border: 1px solid var(--btn-border-color); border-radius: 32px; font-size: 0.85rem; cursor: pointer; }

/* Calendar & Countdown */
.calendar-wrap { padding: 30px 0; }
.calendar-inner { padding: 3.6rem 0 3.8rem; background: var(--secondary-bg-color) var(--primary-bg-image); }
.calendar-wrap .date { font-size: 1.2rem; letter-spacing: 3px; font-family: 'Crimson Pro', serif; }
.calendar-wrap .hours { margin-bottom: 1.25rem; font-size: 0.9rem; color: var(--text-dark-color); }
.c-calendar { padding: 0 var(--calendar-margin-lr); margin: 0 36px; border: 1px solid var(--border-color); border-left: 0; border-right: 0; }
.c-calendar-table { width: 100%; font-size: 0.875rem; line-height: 1.8rem; padding: 1.5rem 0; }
.c-calendar-table td { position: relative !important; text-align: center !important; }
.c-calendar-table tr td:first-child, .c-calendar-table tr th:first-child { color: #c6472b !important; }
.c-calendar-table td:has(.c-calendar-eday) > span { display: none !important; }
.c-calendar-eday { position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; display: flex !important; align-items: center !important; justify-content: center !important; }
.c-calendar-eday > div { width: 28px !important; height: 28px !important; line-height: 28px !important; border-radius: 50% !important; background: var(--icon-color) !important; color: #fff !important; margin: 0 auto !important; font-weight: bold !important; }

.dday-wrap { padding: 1.25rem 0 0; font-size: 0.9rem; }
.dday-wrap span[pink] { color: #ea7664; }
.dday-wrap .countdown { display: flex; justify-content: center; align-items: center; gap: 6px; font-family: 'Crimson Pro', serif; margin: 20px 0; }
.dday-wrap .countdown .card { display: flex !important; flex-direction: column !important; align-items: center !important; justify-content: center !important; background: var(--third-bg-color) !important; color: var(--text-light-color) !important; font-size: 1.1rem !important; width: 2.5rem !important; height: 3.8rem !important; border-radius: 8px !important; }
.dday-wrap .countdown .desc { display: block !important; font-size: 0.49rem !important; text-transform: uppercase !important; color: var(--subtitle-text-color) !important; margin-top: 4px !important; }

/* Gallery (높이 깨짐 및 겹침 방지 최적화) */
.gallery-wrap {
  width: 100%;
  position: relative;
  clear: both;
  display: block;
  height: auto;
  overflow: visible;
  padding: 40px 0 20px;
}

.gallery-grid {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 8px;
  margin: 0 16px;
  height: auto;
  overflow: visible;
}

.gallery-grid .grid-item.hidden {
  display: none !important;
}

.gallery-grid .grid-item {
  position: relative;
  width: 100%;
  grid-column: span 1 !important;
  grid-row: span 1 !important;
  aspect-ratio: 3 / 4;
}

.gallery-grid .grid-item.landscape {
  aspect-ratio: 4 / 3;
}

.gallery-grid .item {
  width: 100%;
  height: 100%;
  background-color: #eee;
  background-position: center;
  background-size: cover;
  border: 3px solid var(--primary-bg-color);
  border-radius: 6px;
  cursor: pointer;
}

.gallery-btn-wrap {
  position: relative;
  clear: both;
  margin-top: 20px;
  margin-bottom: 5px;
  text-align: center;
}

.btn-more-gallery {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  height: 42px;
  background: transparent;
  border: 1px solid #ebdada;
  border-radius: 25px;
  color: #d18d8d;
  font-size: 14px;
  cursor: pointer;
}
.btn-more-gallery svg {
  width: 15px;
  height: 15px;
  margin-right: 6px;
  stroke: currentColor;
}

/* Location & Map */
.map-wrap {
  position: relative;
  clear: both;
  display: block;
  padding: 30px 0 40px;
  margin-top: 20px;
}
.location-hall { color: #000; }
.location-address { font-size: 0.95rem; color: #797979; margin-bottom: 20px; }
.map-inner { margin: 0 20px 10px; }
#map { width: 100%; height: 270px; }
#map .anchorCS, #map [class*="logo"], #map [class*="copyright"] { display: none !important; }

.c-map-navi { display: flex; align-items: center; justify-content: center; gap: 15px; padding: 15px 0; background: var(--third-bg-color); font-size: 0.8rem; }
.c-map-navi .navi-item { display: inline-flex; align-items: center; gap: 6px; text-decoration: none !important; color: inherit; }
.c-map-navi .navi-item img { width: 20px; height: 20px; }
.c-map-navi .divider { width: 1px; height: 12px; background-color: #ddd; }

.waytocome-wrap { padding: 0 var(--common-margin-lr); text-align: left; }
.waytocome-wrap .box { display: flex; padding: 15px 0; border-bottom: 1px solid var(--border-light-color); }
.waytocome-wrap .box:last-child { border: 0; padding-bottom: 0 !important; }
.waytocome-wrap .box .left { padding-right: 10px; }
.waytocome-wrap .box .right { flex: 1; }
.waytocome-wrap .box .icon-circle { background: var(--third-bg-color); width: 2.2rem; height: 2.2rem; text-align: center; border-radius: 50%; opacity: 0.7; }
.waytocome-wrap .box svg { width: 1.2rem; height: 1.2rem; fill: var(--title-text-color); }
.waytocome-wrap .title { font-size: 1rem; color: var(--title-text-color); }
.waytocome-wrap .content { font-size: 0.8rem; line-height: 1.5rem; }

/* Modals (Contact & Swiper Lightbox) */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.6); display: flex; justify-content: center; align-items: center; z-index: 10000; opacity: 0; visibility: hidden; transition: all 0.3s ease; }
.modal-overlay.active { opacity: 1; visibility: visible; }
.contact-modal { width: 85%; max-width: 370px; background: #fff; border-radius: 5px; overflow: hidden; transform: scale(0.9); transition: transform 0.3s ease; }
.modal-overlay.active .contact-modal { transform: scale(1); }

.modal-header {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center;
  background-color: #fbf5f4;
  padding: 20px 0 16px;
  border-bottom: 1px solid #f2e9e7;
}
.modal-header .sub-title {
  display: block;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.35em;
  color: #cda29a;
  margin-bottom: 6px;
  padding-left: 0.35em;
}
.modal-header .main-title {
  display: block;
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.25em;
  color: #8c7f99;
  padding-left: 0.25em;
}

.modal-body { padding: 1rem; background: var(--primary-bg-color); }
.modal-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; }
.modal-row .role {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  line-height: 1.3;
}
.modal-row .role span { display: block; }
.modal-row .role.groom { color: #5a83a0; }
.modal-row .role.bride { color: #d17b7b; }
.modal-row .actions { display: flex; gap: 12px; }
.modal-row .actions svg { width: 18px; height: 18px; }
.groom-icon svg { fill: #5a83a0; }
.bride-icon svg { fill: #d17b7b; }

.image-modal-overlay { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.9); z-index: 99999; align-items: center; justify-content: center; }
.image-modal-overlay.active { display: flex; }
.image-modal-content { position: relative; width: 100%; max-width: 430px; margin: auto; }
.gallery-swiper .swiper-slide img { width: 100% !important; height: auto !important; object-fit: contain; }
.modal-controls button { position: absolute; background: transparent; border: none; cursor: pointer; z-index: 1050; padding: 15px; }
.modal-controls .btn-close { top: 15px; right: 15px; color: #fff; font-size: 24px; }
.modal-controls .btn-prev { top: 50%; left: 0; transform: translateY(-50%); color: #fff; font-size: 30px; }
.modal-controls .btn-next { top: 50%; right: 0; transform: translateY(-50%); color: #fff; font-size: 30px; }

/* Footer */
.footer-wrap { padding: 30px 0; background: var(--footer-bg-color) var(--primary-bg-image); color: #434343; }
.kakao-wrap { display: flex; flex-direction: column; align-items: center; gap: 1px; margin-bottom: 20px; }
.btn-share { display: inline-flex; align-items: center; justify-content: center; background: transparent; border: none; color: #49413a; font-size: 0.8rem; cursor: pointer; padding: 5px 10px; }
.btn-share svg { width: 18px; height: 18px; margin-right: 8px; fill: #49413a; }
.copyright-wrap { margin-top: 12px; font-size: 0.5rem; color: rgba(0, 0, 0, 0.4); font-family: 'Crimson Pro', serif; letter-spacing: 0.6px; }


/* ==========================================================================
   Gallery (Flex 기반 절대 비율 고정형 - 겹침 및 빈칸 완벽 방지)
   ========================================================================== */
.gallery-wrap {
  width: 100% !important;
  position: relative !important;
  clear: both !important;
  display: block !important;
  height: auto !important;
  overflow: visible !important;
  padding: 40px 0 20px !important;
}

.gallery-grid {
  display: flex !important;
  flex-wrap: wrap !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  padding: 0 16px !important;
  margin: 0 !important;
  height: auto !important;
}

/* 숨김 상태 */
.gallery-grid .grid-item.hidden {
  display: none !important;
}

/* 1줄에 정확히 3개 배치 (gap 6px 고려) */
.gallery-grid .grid-item {
  width: calc((100% - 12px) / 3) !important;
  position: relative !important;
  padding-top: calc(((100% - 12px) / 3) * 1.333) !important; /* 세로형 3:4 비율 완벽 고정 */
  height: 0 !important;
  overflow: hidden !important;
  border-radius: 6px !important;
  background-color: #f0f0f0;
}

/* 실제 이미지 박스 */
.gallery-grid .grid-item .item {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  border: 2px solid var(--primary-bg-color) !important;
  border-radius: 6px !important;
  cursor: pointer !important;
}

.gallery-btn-wrap {
  position: relative !important;
  clear: both !important;
  margin-top: 25px !important;
  margin-bottom: 10px !important;
  text-align: center !important;
}

/* 하단 지도 섹션 완벽 분리 */
.map-wrap {
  position: relative !important;
  clear: both !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  margin-top: 40px !important;
  padding: 30px 0 40px !important;
}
.copyright-wrap span { color: rgba(0, 0, 0, 0.7); }