/* ============================================
   Modern Minimal - Korean Mobile Wedding Invitation
   Color Palette: #000, #333, #666, #999, #ccc, #e5e5e5, #f5f5f5, #fff
   ============================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont,
    'Segoe UI', Roboto, sans-serif;
  color: #333;
  background: #d9d9d9;
  line-height: 1.8;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Safe area support */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

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

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

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

/* ── Wrapper ── */
.wrapper {
  max-width: 480px;
  margin: 0 auto;
  background: #fff;
  min-height: 100vh;
  position: relative;
}

@media (min-width: 768px) {
  .wrapper {
    max-width: 520px;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.06);
  }
}

@media (min-width: 1024px) {
  .wrapper {
    max-width: 560px;
  }
}

/* ── Section Common ── */
.section {
  padding: 80px 28px;
}

.section-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: #999;
  margin-bottom: 12px;
}

.section-title {
  font-size: 20px;
  font-weight: 600;
  color: #000;
  margin-bottom: 32px;
  letter-spacing: -0.03em;
  line-height: 1.4;
}

.section-divider {
  width: 32px;
  height: 1px;
  background: #ccc;
  margin: 0 auto 32px;
}

/* ── Fade-in Animation ── */
.fade-in {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

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

/* ── Hero Section ── */
.hero {
  position: relative;
  width: 100%;
  height: 100svh;
  min-height: 600px;
  max-height: 900px;
  overflow: hidden;
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 40%,
    rgba(0, 0, 0, 0.45) 100%
  );
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding: 0 28px 60px;
  text-align: center;
  color: #fff;
}

.hero-names {
  font-size: 32px;
  font-weight: 300;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
  line-height: 1.3;
}

.hero-names .ampersand {
  display: inline-block;
  margin: 0 12px;
  font-weight: 120;
  font-size: 20px;
  vertical-align: middle;
  opacity: 0.8;
}

.hero-date {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.12em;
  opacity: 0.85;
  margin-bottom: 4px;
}

.hero-venue {
  font-size: 13px;
  font-weight: 300;
  letter-spacing: 0.05em;
  opacity: 0.7;
}

.hero-scroll {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 32px;
  background: rgba(255, 255, 255, 0.4);
  animation: scrollPulse 2s ease-in-out infinite;
}

@keyframes scrollPulse {
  0%, 100% { opacity: 0.3; transform: translateX(-50%) scaleY(0.6); }
  50% { opacity: 0.8; transform: translateX(-50%) scaleY(1); }
}

/* ── Invitation Section ── */
.invitation {
  text-align: center;
  background: #fff;
}

.invitation-message {
  font-size: 15px;
  font-weight: 300;
  line-height: 2;
  color: #555;
  white-space: pre-line;
  margin-bottom: 48px;
}

.invitation-parents {
  font-size: 14px;
  color: #666;
  line-height: 2;
}

.invitation-parents .parent-line {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 6px;
}

.invitation-parents .dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ccc;
  display: inline-block;
}

.invitation-parents .deceased::after {
  content: "";
  display: none;
}

/* ── Countdown Section ── */
.countdown {
  text-align: center;
  background: #fafafa;
}

.countdown-grid {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 20px;
}

.countdown-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}

.countdown-number {
  font-size: 36px;
  font-weight: 200;
  color: #000;
  letter-spacing: -0.02em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown-unit {
  font-size: 11px;
  color: #999;
  margin-top: 8px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}

.countdown-dday {
  font-size: 13px;
  color: #999;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.countdown-calendar-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 28px;
}

.btn-calendar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #555;
  font-weight: 400;
  transition: all 0.2s;
  background: #fff;
}

.btn-calendar:hover {
  border-color: #999;
  color: #000;
}

.btn-calendar svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Story Section ── */
.story {
  background: #fff;
  padding-left: 0;
  padding-right: 0;
}

.story-header {
  padding: 0 28px;
  text-align: center;
  margin-bottom: 36px;
}

.story-content {
  font-size: 15px;
  font-weight: 300;
  line-height: 2;
  color: #555;
  white-space: pre-line;
  text-align: center;
  padding: 0 28px;
  margin-bottom: 40px;
}

.story-images {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding: 0 28px;
  scrollbar-width: none;
}

.story-images::-webkit-scrollbar {
  display: none;
}

.story-image-item {
  flex: 0 0 75%;
  scroll-snap-align: start;
  border-radius: 4px;
  overflow: hidden;
  aspect-ratio: 3 / 4;
}

.story-image-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

@media (min-width: 768px) {
  .story-image-item {
    flex: 0 0 45%;
  }
}

/* ── Gallery Section ── */
.gallery {
  background: #fafafa;
}

.gallery-header {
  text-align: center;
  margin-bottom: 24px;
}

.gallery-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.gallery-item {
  aspect-ratio: 1;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-item:nth-child(3n + 1) {
  aspect-ratio: 1;
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.gallery-item:hover img {
  transform: scale(1.03);
}

.gallery-more {
  display: flex;
  justify-content: center;
  margin-top: 24px;
}

.btn-gallery-more {
  padding: 10px 28px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #666;
  font-weight: 400;
  transition: all 0.2s;
  background: #fff;
}

.btn-gallery-more:hover {
  border-color: #999;
  color: #000;
}

/* ── Photo Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.95);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  display: flex;
  opacity: 1;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  top: calc(16px + env(safe-area-inset-top));
  right: calc(16px + env(safe-area-inset-right));
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 24px;
  z-index: 10;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.modal-close:hover {
  opacity: 1;
}

.modal-counter {
  position: absolute;
  bottom: 24px;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  color: rgba(255, 255, 255, 0.6);
  font-size: 13px;
  letter-spacing: 0.1em;
  font-weight: 300;
  z-index: 10;
}

.modal-swipe-area {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
  overflow: hidden;
}

.modal-image {
  max-width: 100%;
  max-height: 90vh;
  max-height: 90svh;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
  transition: transform 0.3s ease;
}

.modal-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 20px;
  z-index: 10;
  transition: opacity 0.2s;
}

.modal-nav:hover {
  color: #fff;
}

.modal-prev {
  left: 8px;
}

.modal-next {
  right: 8px;
}

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

/* ── Location Section ── */
.location {
  background: #fff;
}

.location-header {
  text-align: center;
  margin-bottom: 32px;
}

.location-info {
  text-align: center;
  margin-bottom: 32px;
}

.location-venue-name {
  font-size: 18px;
  font-weight: 500;
  color: #000;
  margin-bottom: 4px;
}

.location-venue-hall {
  font-size: 14px;
  color: #666;
  margin-bottom: 12px;
}

.location-address {
  font-size: 14px;
  color: #555;
  margin-bottom: 4px;
}

.location-tel {
  font-size: 13px;
  color: #999;
}

.location-tel a {
  color: #999;
}

.location-map-image {
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid #eee;
}

.location-map-image img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.location-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.location-actions button,
.location-actions a {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 0;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 13px;
  color: #555;
  font-weight: 400;
  transition: all 0.2s;
  background: #fff;
  text-align: center;
}

.location-actions button:hover,
.location-actions a:hover {
  border-color: #999;
  color: #000;
}

.location-actions svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

/* ── Account Section ── */
.account {
  background: #fafafa;
  text-align: center;
}

.account-header {
  margin-bottom: 32px;
}

.account-group {
  margin-bottom: 16px;
}

.account-group-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 4px;
  font-size: 15px;
  font-weight: 500;
  color: #333;
  transition: all 0.2s;
}

.account-group-toggle:hover {
  border-color: #bbb;
}

.account-group-toggle .toggle-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.3s ease;
  color: #999;
}

.account-group.open .toggle-icon {
  transform: rotate(180deg);
}

.account-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.account-group.open .account-list {
  max-height: 500px;
}

.account-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-top: none;
}

.account-item:last-child {
  border-radius: 0 0 4px 4px;
}

.account-info {
  text-align: left;
}

.account-role {
  font-size: 12px;
  color: #999;
  margin-bottom: 2px;
}

.account-detail {
  font-size: 14px;
  color: #333;
}

.account-name {
  font-weight: 500;
  margin-right: 8px;
}

.btn-copy-account {
  padding: 8px 16px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  color: #666;
  font-weight: 400;
  transition: all 0.2s;
  background: #fafafa;
  white-space: nowrap;
}

.btn-copy-account:hover {
  border-color: #999;
  color: #000;
}

/* ── Footer ── */
.footer {
  padding: 32px 28px;
  padding-bottom: calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  border-top: 1px solid #eee;
}

.footer-text {
  font-size: 11px;
  color: #bbb;
  letter-spacing: 0.05em;
}

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 40px;
  bottom: calc(40px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #333;
  color: #fff;
  padding: 12px 24px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 400;
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 2000;
  white-space: nowrap;
  pointer-events: none;
}

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

/* ── Responsive ── */
@media (min-width: 768px) {
  .section {
    padding: 100px 36px;
  }

  .hero {
    max-height: 960px;
  }

  .hero-names {
    font-size: 38px;
  }

  .countdown-number {
    font-size: 42px;
  }

  .gallery-grid {
    gap: 6px;
  }

  .section-title {
    font-size: 22px;
  }
}

@media (min-width: 1024px) {
  .section {
    padding: 120px 40px;
  }

  .hero-names {
    font-size: 42px;
  }

  .countdown-number {
    font-size: 48px;
  }
}

/* ── Loading State ── */
.loading {
  position: relative;
  min-height: 80px;
}

.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 24px;
  height: 24px;
  margin: -12px 0 0 -12px;
  border: 2px solid #e5e5e5;
  border-top-color: #999;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Curtain / Intro Overlay ── */
.curtain-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.6s ease;
}

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

.curtain-content {
  text-align: center;
  color: #fff;
  animation: curtainFadeIn 0.8s ease forwards;
  opacity: 0;
}

@keyframes curtainFadeIn {
  to { opacity: 1; }
}

.curtain-names {
  font-size: 28px;
  font-weight: 200;
  letter-spacing: 0.15em;
  margin-bottom: 12px;
}

.curtain-date {
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 40px;
}

.curtain-btn {
  padding: 14px 40px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 4px;
  font-size: 14px;
  font-weight: 400;
  color: #fff;
  background: transparent;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: all 0.3s ease;
}

.curtain-btn:hover {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

/* ── Utility ── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
