/* Design tokens */
:root {
  --bg: #fffdfc;
  --paper: #fffdfb;
  --surface: #ffffff;
  --surface-tint: #fffafa;
  --ink: #342529;
  --muted: #84797c;
  --line: rgba(160, 116, 123, 0.1);
  --sage: #ad858c;
  --sage-dark: #765a60;
  --rose: #d88996;
  --rose-soft: #fff6f7;
  --champagne: #fff8f0;
  --shadow: 0 18px 52px rgba(92, 70, 73, 0.055);
  --page-x: 22px;
  --font-body: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Segoe UI", sans-serif;
  --font-serif: "Gowun Batang", "AppleMyungjo", "Nanum Myeongjo", serif;
  --font-hand: "Nanum Pen Script", "Gowun Batang", cursive;
  --font-script: "Caveat", "Gowun Batang", cursive;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  font-family: var(--font-body);
  letter-spacing: 0;
}

body.is-splashing {
  position: fixed;
  inset: 0;
  width: 100%;
  overflow: hidden;
  touch-action: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

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

/* Splash */
.splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #fffdfb;
  opacity: 1;
  touch-action: none;
  transition: opacity 720ms ease, visibility 720ms ease;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.splash.is-hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.splash__title {
  width: min(88vw, 420px);
  height: auto;
  overflow: visible;
}

.splash__stroke,
.splash__fill {
  font-family: var(--font-hand);
  font-size: 72px;
  font-weight: 400;
  letter-spacing: 0;
}

.splash__stroke {
  fill: transparent;
  stroke: #a0737d;
  stroke-width: 1.7px;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 540;
  stroke-dashoffset: 540;
}

.splash__fill {
  fill: #a0737d;
  opacity: 0;
}

.splash__stroke .splash__pink {
  fill: transparent;
  stroke: #e6a8b1;
}

.splash__fill .splash__pink {
  fill: #e6a8b1;
  stroke: none;
}

.splash__stroke--first {
  animation: writeText 1100ms ease forwards 260ms;
}

.splash__stroke--second {
  animation: writeText 1500ms ease forwards 1050ms;
}

.splash__fill--first {
  animation: fillText 500ms ease forwards 1180ms;
}

.splash__fill--second {
  animation: fillText 600ms ease forwards 2380ms;
}

.is-splashing .site-frame {
  opacity: 0;
  transform: translateY(10px);
}

.site-frame {
  transition: opacity 820ms ease, transform 820ms ease;
}

@keyframes writeText {
  to {
    stroke-dashoffset: 0;
  }
}

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

/* App shell */
.site-frame {
  min-height: 100svh;
  display: flex;
  justify-content: center;
  background: var(--bg);
}

.invitation {
  width: 100%;
  max-width: 480px;
  min-height: 100svh;
  padding-bottom: 0;
  background: var(--paper);
  box-shadow: var(--shadow);
}

/* Hero */
.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: #fff7f8;
}

.hero picture,
.hero__image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.hero__image {
  object-fit: cover;
  object-position: 58% center;
}

.hero__meta {
  position: absolute;
  top: max(24px, env(safe-area-inset-top));
  left: 44px;
  right: 44px;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #ffffff;
  text-shadow: 0 1px 12px rgba(52, 37, 41, 0.28);
  pointer-events: none;
}

.hero__meta p {
  margin: 0;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0;
}

.hero__names {
  position: absolute;
  left: 50%;
  bottom: max(42px, calc(env(safe-area-inset-bottom) + 32px));
  z-index: 1;
  margin: 0;
  color: #ffffff;
  font-family: var(--font-script);
  font-size: 2rem;
  font-style: italic;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  text-shadow: 0 2px 14px rgba(52, 37, 41, 0.32);
  transform: translateX(-50%) skewX(-4deg);
  pointer-events: none;
  white-space: nowrap;
}

/* Shared sections */
.section-kicker {
  margin: 0;
  color: #c27d89;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0;
}

.section {
  padding: 52px var(--page-x);
  border-bottom: 0;
  background: #fffdfb;
}

.section h2 {
  margin: 12px 0 18px;
  font-family: var(--font-serif);
  font-size: 1.82rem;
  font-weight: 400;
  line-height: 1.45;
}

.section p {
  margin: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.85;
  word-break: keep-all;
}

.intro {
  text-align: center;
}

/* Intro */
.parents {
  display: grid;
  gap: 8px;
  margin-top: 30px;
  padding: 0;
}

.parents p {
  font-family: var(--font-serif);
  color: var(--ink);
  font-size: 0.96rem;
  line-height: 1.9;
}

.parents strong {
  color: #8f6570;
}

.details {
  background: #fffdfb;
}

/* Schedule */
.event-schedule {
  margin-top: 24px;
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.event-summary {
  display: grid;
  gap: 14px;
  margin-bottom: 34px;
  text-align: center;
}

.event-summary p {
  color: #d88996;
  font-family: var(--font-body);
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.1;
  text-transform: uppercase;
}

.event-summary strong {
  color: #8f878c;
  font-family: var(--font-body);
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.25;
}

.countdown {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr auto 1fr;
  align-items: center;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 12px 30px rgba(92, 70, 73, 0.07);
}

.countdown div {
  display: grid;
  gap: 4px;
  min-width: 0;
  text-align: center;
}

.countdown strong {
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.countdown span,
.countdown i {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 600;
}

.month-calendar {
  padding: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

/* Calendar */
.calendar-head {
  display: grid;
  place-items: center;
  margin-bottom: 28px;
}

.calendar-head strong {
  color: #d88996;
  font-family: var(--font-serif);
  font-size: 4.6rem;
  font-weight: 400;
  line-height: 0.95;
}

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

.calendar-weekdays {
  margin-bottom: 22px;
}

.calendar-weekdays span {
  color: var(--ink);
  font-size: 1.12rem;
  font-weight: 500;
  text-align: center;
}

.calendar-weekdays span:first-child {
  color: #c97886;
}

.calendar-days span {
  min-height: 45px;
  display: grid;
  place-items: center;
  color: var(--ink);
  font-size: 1.08rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.calendar-days span:nth-child(7n + 1):not(:empty) {
  color: #c97886;
}

.calendar-days .wedding-day {
  position: relative;
  min-height: 45px;
  background: transparent;
  color: #ffffff;
}

.wedding-day strong {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  background: #d98a98;
  font-size: 1.08rem;
  line-height: 1;
}

.detail-grid {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
}

.detail-item,
.account-row {
  border: 0;
  border-radius: 14px;
  background: var(--surface);
}

.detail-item {
  display: grid;
  gap: 6px;
  padding: 18px;
}

.detail-item span,
.account-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.detail-item strong {
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.55;
}

/* Buttons */
.primary-link,
.outline-button,
.gallery-toolbar button,
.account-row button {
  min-height: 44px;
  border-radius: 999px;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0;
  text-decoration: none;
  cursor: pointer;
}

.primary-link,
.outline-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 0 16px;
}

.primary-link {
  border: 0;
  background: var(--sage);
  color: #ffffff;
}

.outline-button {
  border: 0;
  background: rgba(255, 255, 255, 0.78);
  color: var(--sage-dark);
  box-shadow: inset 0 0 0 1px rgba(160, 116, 123, 0.1);
}

.quiet-action {
  gap: 8px;
}

.location {
  text-align: center;
}

/* Location */
.gallery,
.share {
  text-align: center;
}

.venue-name {
  color: var(--ink);
  font-size: 1.02rem;
  font-weight: 600;
}

.address {
  margin-top: 4px;
}

.map-preview {
  position: relative;
  height: 260px;
  margin: 24px 0 16px;
  overflow: hidden;
  border: 0;
  border-radius: 18px;
  background: #fffafa;
  box-shadow: 0 12px 28px rgba(92, 70, 73, 0.055);
}

.map-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
}

.map-preview.is-loaded .map-placeholder {
  display: none;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.location-links {
  grid-template-columns: repeat(3, 1fr);
}

.transport-list {
  display: grid;
  gap: 14px;
  margin: 24px 0 0;
}

.transport-list div {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
}

.transport-list dt {
  color: var(--sage-dark);
  font-size: 0.86rem;
  font-weight: 600;
  text-align: left;
}

.transport-list dd {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.65;
  text-align: left;
  word-break: keep-all;
}

.gallery-slider {
  margin-top: 24px;
}

/* Gallery */
.gallery-toolbar {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.gallery-meta {
  display: grid;
  place-items: center;
  gap: 6px;
}

.gallery-toolbar p {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  text-align: center;
}

.gallery-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--sage-dark);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  opacity: 0.72;
}

.gallery-toolbar > button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  border: 0;
  background: rgba(255, 250, 250, 0.92);
  color: var(--sage-dark);
  box-shadow: inset 0 0 0 1px rgba(160, 116, 123, 0.1);
}

.chevron-icon {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.chevron-icon--left {
  transform: rotate(-135deg) translate(-1px, -1px);
}

.chevron-icon--right {
  transform: rotate(45deg) translate(-1px, 1px);
}

.expand-icon {
  position: relative;
  width: 13px;
  height: 13px;
}

.expand-icon::before,
.expand-icon::after {
  content: "";
  position: absolute;
  width: 5px;
  height: 5px;
}

.expand-icon::before {
  top: 1px;
  right: 1px;
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

.expand-icon::after {
  left: 1px;
  bottom: 1px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
}

.gallery-track {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x pan-y;
  -webkit-overflow-scrolling: touch;
  outline: none;
}

.gallery-track::-webkit-scrollbar {
  display: none;
}

.gallery-slide {
  flex: 0 0 calc(100% - 18px);
  margin: 0;
  scroll-snap-align: start;
}

.gallery-slide img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: 18px;
  background: #fffafa;
  box-shadow: 0 14px 34px rgba(92, 70, 73, 0.06);
  cursor: zoom-in;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

/* Lightbox */
.lightbox {
  position: fixed;
  left: var(--vv-left, 0);
  top: var(--vv-top, 0);
  z-index: 30;
  display: none;
  width: var(--vv-width, 100vw);
  height: var(--vv-height, 100dvh);
  padding: max(18px, env(safe-area-inset-top)) 18px max(18px, env(safe-area-inset-bottom));
  overflow: hidden;
  overscroll-behavior: contain;
  touch-action: none;
}

.lightbox,
.lightbox * {
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.lightbox.is-open {
  display: block;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(52, 37, 41, 0.76);
  backdrop-filter: blur(10px);
}

.lightbox__dialog {
  position: relative;
  height: 100%;
  display: grid;
  grid-template-rows: 44px minmax(0, 1fr) 52px;
  align-items: center;
  max-width: 720px;
  margin: 0 auto;
}

.lightbox__stage {
  position: relative;
  grid-row: 2;
  align-self: stretch;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 18px;
  touch-action: none;
}

.lightbox__stage img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 14px;
  object-fit: contain;
  transform: translate3d(var(--lightbox-x, 0), var(--lightbox-y, 0), 0)
    scale(var(--lightbox-scale, 1));
  transform-origin: center;
  transition: transform 160ms ease;
  user-select: none;
  -webkit-user-drag: none;
  -webkit-user-select: none;
}

.lightbox__stage.is-dragging img,
.lightbox__stage.is-gesturing img {
  cursor: grabbing;
  transition: none;
}

.lightbox__topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.lightbox__topbar p {
  margin: 0;
  padding: 0 12px;
  color: #fffdfb;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 38px;
}

.lightbox__button,
.lightbox__nav {
  border: 0;
  background: rgba(255, 250, 250, 0.9);
  color: var(--sage-dark);
  box-shadow: 0 10px 26px rgba(52, 37, 41, 0.14);
  font: inherit;
  font-weight: 700;
}

.lightbox__button {
  width: 38px;
  height: 38px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
}

.lightbox__nav {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.lightbox__controls {
  grid-row: 3;
  z-index: 2;
  display: flex;
  justify-content: center;
  gap: 14px;
}

.close-icon {
  position: relative;
  width: 16px;
  height: 16px;
}

.close-icon::before,
.close-icon::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 1px;
  width: 2px;
  height: 14px;
  border-radius: 999px;
  background: currentColor;
}

.close-icon::before {
  transform: rotate(45deg);
}

.close-icon::after {
  transform: rotate(-45deg);
}

.account-list {
  display: grid;
  gap: 0;
  overflow: hidden;
}

/* Accounts */
.account-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.account-group {
  margin-top: 10px;
  overflow: hidden;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 10px 26px rgba(92, 70, 73, 0.055);
}

.account-group summary {
  min-height: 58px;
  display: grid;
  grid-template-columns: 1fr 12px;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  cursor: pointer;
}

.account-group summary::marker {
  content: "";
}

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

.account-group summary span {
  color: var(--ink);
  font-size: 0.98rem;
  font-weight: 600;
}

.account-group summary::after {
  content: "";
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--rose);
  border-bottom: 2px solid var(--rose);
  transform: rotate(45deg) translateY(-2px);
  transition: transform 220ms ease;
}

.account-group.is-expanded summary::after {
  transform: rotate(225deg) translate(-2px, -2px);
}

.account-group .account-row {
  border: 0;
  border-top: 1px solid rgba(160, 116, 123, 0.1);
  border-radius: 0;
  background: transparent;
}

.account-row > div {
  display: grid;
  gap: 5px;
}

.account-row p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.account-row a,
.account-row a[x-apple-data-detectors] {
  color: var(--muted) !important;
  text-decoration: none !important;
  pointer-events: none;
}

.account-row button {
  width: 44px;
  min-width: 44px;
  padding: 0;
  border: 0;
  background: var(--rose-soft);
  color: var(--sage-dark);
}

.icon-button {
  display: inline-grid;
  place-items: center;
}

/* Icons */
.copy-icon,
.link-icon {
  position: relative;
  display: inline-block;
  width: 18px;
  height: 18px;
}

.copy-icon::before,
.copy-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 12px;
  border: 1.6px solid currentColor;
  border-radius: 3px;
}

.copy-icon::before {
  left: 2px;
  top: 4px;
  opacity: 0.56;
}

.copy-icon::after {
  left: 6px;
  top: 1px;
  background: var(--rose-soft);
}

.link-icon::before,
.link-icon::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 7px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.link-icon::before {
  left: 1px;
  top: 6px;
  transform: rotate(-36deg);
}

.link-icon::after {
  right: 1px;
  top: 5px;
  transform: rotate(-36deg);
}

.closing {
  margin: 0;
  padding: 40px var(--page-x) 54px;
  color: var(--muted);
  text-align: center;
  font-size: 0.94rem;
  line-height: 1.7;
}

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

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(calc(var(--vv-width, 100vw) - 44px), calc(100vw - 44px));
  padding: 11px 16px;
  border: 1px solid rgba(160, 116, 123, 0.14);
  border-radius: 999px;
  background: rgba(255, 250, 250, 0.94);
  box-shadow: 0 14px 36px rgba(92, 70, 73, 0.12);
  color: var(--sage-dark);
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

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

.is-viewport-zoomed .toast {
  padding: 8px 12px;
  font-size: 0.7rem;
}

.is-viewport-zoomed .lightbox__topbar p,
.is-viewport-zoomed .lightbox__button,
.is-viewport-zoomed .lightbox__nav {
  font-size: 0.7rem;
}

/* Responsive */
@media (prefers-reduced-motion: reduce) {
  .splash {
    transition: none;
  }

  .splash__stroke,
  .splash__fill {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }

  .site-frame {
    transition: none;
  }

  .toast {
    transition: none;
  }
}

@media (max-width: 360px) {
  :root {
    --page-x: 16px;
  }

  .section {
    padding-top: 44px;
    padding-bottom: 44px;
  }

  .section h2 {
    font-size: 1.58rem;
  }

  .transport-list div {
    grid-template-columns: 54px 1fr;
  }
}

@media (min-width: 760px) {
  :root {
    --page-x: 34px;
  }

  .site-frame {
    padding: 32px 0;
  }

  .invitation {
    min-height: auto;
  }

  .section {
    padding-top: 60px;
    padding-bottom: 60px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
