:root {
  --cream: #f5f5f0;
  --paper: #fbfbf8;
  --cloud: #e9eef1;
  --soft-gold: #d4af37;
  --old-gold: #9b7a22;
  --ink: #2e3032;
  --muted-ink: #77736b;
  --line: rgba(183, 154, 97, 0.46);
  --shadow: 0 2px 8px rgba(29, 31, 34, 0.1);
  --deep-shadow: 0 22px 60px rgba(25, 28, 30, 0.24);
  --vh: 1vh;
}

* {
  box-sizing: border-box;
}

.wechat-share-thumbnail {
  position: fixed;
  top: 0;
  left: -10000px;
  width: 300px;
  height: 300px;
  pointer-events: none;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  color: var(--ink);
  background: var(--cream);
  font-family: "Noto Serif SC", "Songti SC", STSong, SimSun, Georgia, serif;
}

body.video-mode,
body.modal-open,
body.transitioning {
  overflow: hidden;
}

body.info-mode {
  overflow-x: hidden;
  overflow-y: auto;
}

body.info-mode.modal-open,
body.info-mode.transitioning {
  overflow: hidden;
}

button {
  border: 0;
  margin: 0;
  padding: 0;
  color: inherit;
  font: inherit;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 2px solid rgba(212, 175, 55, 0.95);
  outline-offset: 3px;
}

[hidden] {
  display: none !important;
}

.wedding-app,
.app-page {
  width: 100%;
  min-height: 100%;
}

.video-page {
  position: fixed;
  z-index: 1;
  inset: 0;
  height: calc(var(--vh) * 100);
  min-height: 520px;
  overflow: hidden;
  isolation: isolate;
  background: #559fd0 url("./assets/bgVideoPoster.jpg") center / cover no-repeat;
  transition: opacity 0.55s ease, transform 0.75s cubic-bezier(0.22, 0.72, 0.2, 1);
}

.video-page.is-leaving {
  opacity: 0.35;
  transform: scale(1.035);
}

.background-fallback,
.background-video,
.soft-vignette {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.background-fallback {
  z-index: 0;
  opacity: 0;
  background-image:
    linear-gradient(180deg, rgba(47, 43, 36, 0.06), rgba(47, 43, 36, 0.18)),
    url("./assets/bgPicture.jpg");
  background-position: center;
  background-size: cover;
  transform: scale(1.01);
  transition: opacity 0.35s ease;
}

.video-page.has-video-error .background-fallback {
  opacity: 1;
}

.background-video {
  z-index: 1;
  display: block;
  object-fit: cover;
  background: transparent;
  transition: opacity 0.6s ease;
}

.background-video.is-hidden {
  opacity: 0;
}

.soft-vignette {
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 56%, rgba(245, 245, 240, 0) 0 44%, rgba(29, 25, 20, 0.18) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), transparent 40%, rgba(0, 0, 0, 0.24));
}

.video-controls {
  position: fixed;
  z-index: 8;
  top: calc(env(safe-area-inset-top) + 14px);
  right: calc(env(safe-area-inset-right) + 14px);
  display: grid;
  gap: 10px;
}

.round-control {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--old-gold);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(245, 245, 240, 0.8);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  transition: transform 0.18s ease, background 0.18s ease;
}

.round-control:active {
  transform: scale(0.93);
}

.round-control .icon {
  grid-area: 1 / 1;
  width: 22px;
  height: 22px;
}

svg path,
svg circle {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sound-toggle .icon {
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.sound-toggle .icon-sound,
.sound-toggle.is-on .icon-muted {
  opacity: 0;
  transform: scale(0.86);
}

.sound-toggle.is-on .icon-sound,
.sound-toggle .icon-muted {
  opacity: 1;
  transform: scale(1);
}

.video-play-gate {
  position: fixed;
  z-index: 7;
  top: 50%;
  left: 50%;
  display: grid;
  min-width: 176px;
  min-height: 48px;
  grid-template-columns: 24px auto;
  place-items: center;
  gap: 8px;
  padding: 0 18px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background: rgba(35, 38, 39, 0.58);
  box-shadow: 0 8px 28px rgba(20, 22, 23, 0.2);
  backdrop-filter: blur(12px);
  transform: translate(-50%, -50%);
}

.video-play-gate svg {
  width: 22px;
  height: 22px;
}

.video-play-gate span {
  font-size: 14px;
  letter-spacing: 0.04em;
}

.info-page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom);
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.5)),
    repeating-linear-gradient(120deg, rgba(157, 169, 178, 0.025) 0 1px, transparent 1px 8px),
    var(--paper);
}

.info-hero {
  position: relative;
  height: min(70dvh, 660px);
  min-height: 510px;
  overflow: hidden;
  background: var(--cloud);
}

.info-hero-picture,
.info-hero-picture img,
.hero-shade {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.info-hero-picture img {
  display: block;
  object-fit: cover;
  object-position: center 36%;
  transform: scale(1.012);
}

.hero-shade {
  background:
    linear-gradient(180deg, rgba(29, 39, 47, 0.2), transparent 28%),
    linear-gradient(0deg, var(--paper) 0, rgba(251, 251, 248, 0) 24%);
}

.hero-copy {
  position: absolute;
  z-index: 2;
  top: calc(env(safe-area-inset-top) + 20px);
  right: 0;
  bottom: auto;
  left: 0;
  width: min(96vw, 560px);
  margin: 0 auto;
  color: #fff;
  text-align: center;
  text-shadow: 0 2px 14px rgba(28, 33, 35, 0.35);
}

.arched-title {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.arched-title text {
  fill: currentColor;
  stroke: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 23px;
  letter-spacing: 0.055em;
}

.hero-copy p {
  margin: -95px 0 0;
  font-size: 22px;
  letter-spacing: 0.12em;
}

.info-content {
  position: relative;
  z-index: 3;
  width: min(100%, 760px);
  margin: 0 auto;
  padding: 0 14px 6px;
}

.countdown-section {
  margin-top: calc(clamp(210px, 35dvh, 300px) + 186px - max(510px, min(70dvh, 660px)));
  text-align: center;
}

.section-eyebrow {
  margin: 0 0 7px;
  color: var(--ink);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.countdown {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}

.countdown > div {
  display: grid;
  min-height: 56px;
  place-content: center;
  color: #554625;
  border: 1px solid rgba(183, 154, 97, 0.58);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(244, 247, 247, 0.98), rgba(220, 229, 231, 0.96));
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.9), 0 4px 14px rgba(80, 91, 94, 0.1);
}

.countdown strong,
.countdown span {
  display: block;
}

.countdown strong {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  font-weight: 400;
  line-height: 1;
}

.countdown span {
  margin-top: 4px;
  color: var(--muted-ink);
  font-size: 10px;
}

.detail-section,
.invitation-letter {
  padding: 7px 0 6px;
  text-align: center;
  border-bottom: 1px solid rgba(183, 154, 97, 0.28);
}

.detail-heading {
  margin: 0;
  color: var(--old-gold);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 16px;
  font-style: italic;
}

.detail-label {
  margin: 1px 0 3px;
  color: var(--muted-ink);
  font-size: 10px;
}

.detail-section h1,
.detail-section h2 {
  margin: 0 0 2px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.venue-hall {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  transform: translateY(-3px);
}

.detail-section > p:last-of-type,
.invitation-letter > p:nth-child(2) {
  margin: 0;
  color: #55565a;
  font-size: 11px;
  line-height: 1.35;
}

.invitation-letter {
  border-bottom: 0;
}

.invitation-letter span {
  display: block;
  margin-top: 2px;
  color: var(--old-gold);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.info-toolbar {
  position: absolute;
  z-index: 12;
  top: calc(clamp(210px, 35dvh, 300px) + 62px);
  right: calc(env(safe-area-inset-right) + 9px);
  display: grid;
  gap: 7px;
  width: 52px;
}

.info-toolbar button,
.section-nav-control {
  width: 52px;
  display: grid;
  min-height: 55px;
  place-items: center;
  padding: 6px 2px 5px;
  color: var(--old-gold);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.info-toolbar svg,
.section-nav-control svg {
  width: 22px;
  height: 22px;
}

.info-toolbar span,
.section-nav-control span {
  font-size: 11px;
  line-height: 1;
}

.address-section {
  position: relative;
}

.section-nav-control {
  position: absolute;
  z-index: 4;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
}

.entrance-item {
  transform-origin: center;
}

.info-page.prepare-enter .entrance-item {
  opacity: 0;
  transform: translateY(26px) scale(0.985);
}

.info-page.is-entering .entrance-item {
  animation: informationEnter 0.78s cubic-bezier(0.2, 0.74, 0.24, 1) both;
  animation-delay: calc(var(--enter-order) * 105ms);
}

.info-page.prepare-enter .hero-copy {
  transform: none;
}

.info-page.is-entering .hero-copy {
  animation-name: heroCopyEnter;
}

@keyframes heroCopyEnter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes informationEnter {
  from {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.page-transition {
  position: fixed;
  z-index: 60;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  background: rgba(245, 245, 240, 0.96);
  transition: opacity 0.36s ease;
}

.page-transition.is-covering {
  opacity: 1;
}

.page-transition.is-revealing {
  opacity: 0;
}

.map-backdrop {
  position: fixed;
  z-index: 70;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 18px 12px calc(env(safe-area-inset-bottom) + 14px);
  background: rgba(30, 32, 34, 0.25);
  opacity: 0;
  transition: opacity 0.24s ease;
}

.map-backdrop.is-open {
  opacity: 1;
}

.map-sheet {
  width: min(94vw, 390px);
  padding: 10px 12px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(251, 251, 248, 0.92);
  box-shadow: var(--deep-shadow);
  transform: translateY(24px);
  transition: transform 0.28s ease;
  backdrop-filter: blur(16px);
}

.map-backdrop.is-open .map-sheet {
  transform: translateY(0);
}

.sheet-handle {
  width: 38px;
  height: 3px;
  margin: 2px auto 10px;
  border-radius: 999px;
  background: rgba(155, 122, 34, 0.38);
}

.sheet-title {
  margin: 0;
  text-align: center;
  font-size: 17px;
  font-weight: 600;
}

.sheet-address {
  margin: 7px auto 12px;
  max-width: 19em;
  color: var(--muted-ink);
  text-align: center;
  font-size: 12px;
  line-height: 1.55;
}

.map-sheet button {
  display: block;
  width: 100%;
  min-height: 45px;
  margin-top: 8px;
  border: 1px solid rgba(183, 154, 97, 0.48);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.album-modal {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: calc(env(safe-area-inset-top) + 14px) 0 calc(env(safe-area-inset-bottom) + 14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.album-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.album-scrim {
  position: absolute;
  inset: 0;
  background: rgba(23, 27, 29, 0.66);
  backdrop-filter: blur(6px);
}

.album-dialog {
  position: relative;
  width: min(95vw, calc(72dvh * var(--photo-ratio)));
  max-width: 920px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(245, 245, 240, 0.96);
  box-shadow: var(--deep-shadow);
  opacity: 0;
  overflow: hidden;
  transform: scale(0.9);
  transition: width 0.32s ease, opacity 0.5s ease, transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.album-modal.is-open .album-dialog {
  opacity: 1;
  transform: scale(1);
}

.album-modal.is-closing {
  opacity: 0;
  transition-duration: 0.3s;
}

.album-modal.is-closing .album-dialog {
  opacity: 0;
  transform: scale(0.9);
  transition-duration: 0.3s;
}

.album-close {
  position: absolute;
  z-index: 6;
  top: 8px;
  right: 8px;
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: var(--old-gold);
  border: 1px solid rgba(183, 154, 97, 0.55);
  border-radius: 999px;
  background: rgba(245, 245, 240, 0.84);
  box-shadow: var(--shadow);
  font-family: Georgia, serif;
  font-size: 28px;
  line-height: 1;
}

.photo-stage {
  position: relative;
  width: 100%;
  aspect-ratio: var(--photo-aspect);
  overflow: hidden;
  background: #e9e9e5;
  touch-action: pan-y;
  transition: aspect-ratio 0.3s ease;
}

.album-photo {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  user-select: none;
  backface-visibility: hidden;
  will-change: opacity, transform;
  transition: opacity 0.48s ease, transform 0.48s cubic-bezier(0.22, 0.72, 0.2, 1);
}

.album-photo.is-current {
  z-index: 1;
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.album-photo.is-next {
  z-index: 2;
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(1.018);
}

.photo-stage.is-switching .album-photo.is-current {
  opacity: 0;
  transform: translate3d(0, 0, 0) scale(0.985);
}

.photo-stage.is-switching .album-photo.is-next {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
}

.photo-loader {
  position: absolute;
  z-index: 5;
  inset: 0;
  display: grid;
  place-content: center;
  color: #fff;
  text-align: center;
  background: rgba(30, 34, 36, 0.34);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.photo-loader.is-visible {
  opacity: 1;
}

.photo-loader span {
  width: 25px;
  height: 25px;
  margin: 0 auto 8px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 999px;
  animation: loaderSpin 0.7s linear infinite;
}

.photo-loader em {
  font-size: 12px;
  font-style: normal;
}

@keyframes loaderSpin {
  to { transform: rotate(360deg); }
}

.photo-nav {
  position: absolute;
  z-index: 4;
  top: 50%;
  display: grid;
  width: 38px;
  height: 46px;
  place-items: center;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 8px;
  background: rgba(28, 32, 34, 0.34);
  transform: translateY(-50%);
  backdrop-filter: blur(5px);
}

.photo-nav svg {
  width: 22px;
  height: 22px;
}

.photo-prev { left: 8px; }
.photo-next-button { right: 8px; }

.album-footer {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  gap: 10px;
}

.album-footer p {
  margin: 0;
  color: var(--muted-ink);
  font-family: Georgia, serif;
  font-size: 12px;
}

.photo-dots {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
  overflow: hidden;
}

.photo-dots button {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(155, 122, 34, 0.26);
  transition: width 0.24s ease, background 0.24s ease;
}

.photo-dots button.is-active {
  width: 18px;
  background: var(--soft-gold);
}

@media (min-width: 760px) {
  .info-page {
    box-shadow: inset 0 0 100px rgba(142, 157, 167, 0.08);
  }

  .info-content {
    padding-right: 42px;
    padding-left: 42px;
  }

  .info-toolbar {
    right: calc(50% - 360px);
  }

}

@media (max-width: 360px) {
  .info-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .countdown {
    gap: 5px;
  }

  .countdown > div {
    min-height: 52px;
  }

  .countdown strong {
    font-size: 19px;
  }

  .info-toolbar {
    right: 6px;
  }

}

@media (orientation: landscape) and (max-height: 560px) {
  .info-hero {
    height: 100dvh;
  }

  .video-controls {
    grid-template-columns: repeat(3, 44px);
  }

  .album-dialog {
    width: min(92vw, calc(66dvh * var(--photo-ratio)));
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
