:root {
  --bg: #f3efe8;
  --bg-deep: #e8dfd1;
  --text: #2c221b;
  --muted: #6f6156;
  --accent: #b64a3c;
  --accent-soft: #d77967;
  --card: rgba(255, 250, 244, 0.72);
  --line: rgba(58, 38, 26, 0.12);
  --shadow: 0 18px 45px rgba(49, 31, 20, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  color: var(--text);
  background: linear-gradient(160deg, var(--bg) 0%, #f9f5ef 42%, var(--bg-deep) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

body.locked {
  overflow: hidden;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}

.opening-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background:
    radial-gradient(circle at top, rgba(255, 244, 236, 0.9), rgba(243, 239, 232, 0.82)),
    linear-gradient(160deg, rgba(182, 74, 60, 0.18), rgba(212, 186, 160, 0.32));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 10;
  transition: opacity 0.8s ease, visibility 0.8s ease;
}

.opening-screen.hidden {
  opacity: 0;
  visibility: hidden;
}

.opening-card {
  width: min(100%, 420px);
  text-align: center;
  padding: 2rem 1.4rem;
  border-radius: 28px;
  background: rgba(255, 251, 247, 0.84);
  border: 1px solid rgba(58, 38, 26, 0.1);
  box-shadow: 0 24px 50px rgba(59, 39, 25, 0.18);
  animation: cardEnter 1s ease both;
}

.opening-kicker {
  margin: 0 0 0.5rem;
  letter-spacing: 0.28em;
  color: var(--muted);
  font-size: 0.85rem;
}

.opening-card h2 {
  margin-bottom: 0.4rem;
}

.opening-card p {
  margin: 0.35rem 0;
  color: var(--muted);
}

.music-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 8;
  border: 1px solid rgba(182, 74, 60, 0.2);
  background: rgba(255, 251, 247, 0.88);
  color: var(--accent);
  border-radius: 999px;
  padding: 0.6rem 0.95rem;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(49, 31, 20, 0.12);
}

.glow {
  position: absolute;
  width: 55vmax;
  height: 55vmax;
  border-radius: 50%;
  filter: blur(65px);
  opacity: 0.3;
  animation: drift 14s ease-in-out infinite alternate;
}

.glow-1 {
  background: #f0b59f;
  top: -12vmax;
  left: -14vmax;
}

.glow-2 {
  background: #d4baa0;
  bottom: -14vmax;
  right: -16vmax;
  animation-duration: 17s;
}

.grain {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(51, 40, 30, 0.08) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
  opacity: 0.25;
}

.hero,
main,
footer {
  width: min(920px, calc(100% - 2rem));
  margin: 0 auto;
}

.hero {
  min-height: 90vh;
  display: grid;
  align-content: center;
  gap: 1rem;
  text-align: center;
  padding: 2.5rem 0 4rem;
  animation: heroBloom 1.1s ease both;
}

.eyebrow {
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  letter-spacing: 0.25em;
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

h1 {
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 0.9rem;
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  font-size: clamp(2.2rem, 7vw, 4.8rem);
  font-weight: 600;
}

h1 span:nth-child(2) {
  font-size: 0.9em;
  color: var(--accent);
}

.date {
  margin: 0;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.hero-text {
  width: min(640px, 95%);
  margin: 0.2rem auto 0.6rem;
  color: var(--muted);
  line-height: 1.85;
}

.btn {
  display: inline-block;
  align-self: center;
  justify-self: center;
  text-decoration: none;
  color: #fff7f2;
  background: linear-gradient(120deg, var(--accent) 0%, var(--accent-soft) 100%);
  padding: 0.75rem 1.6rem;
  border-radius: 999px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  transition: transform 0.28s ease, box-shadow 0.28s ease;
  box-shadow: 0 10px 24px rgba(150, 62, 49, 0.36);
}

.btn:hover {
  transform: translateY(-2px) scale(1.01);
  box-shadow: 0 14px 30px rgba(150, 62, 49, 0.42);
}

.btn.secondary {
  background: #fff;
  color: var(--accent);
  border: 1px solid rgba(182, 74, 60, 0.35);
  box-shadow: none;
}

.scroll-tip {
  margin-top: 2rem;
  color: var(--muted);
  font-size: 0.9rem;
  animation: bob 1.8s ease-in-out infinite;
}

main {
  padding-bottom: 3rem;
  display: grid;
  gap: 1.1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: clamp(1rem, 2.2vw, 2rem);
  box-shadow: var(--shadow);
}

h2 {
  margin: 0 0 0.9rem;
  font-family: "Times New Roman", "Songti SC", "STSong", serif;
  font-size: clamp(1.6rem, 4.4vw, 2.2rem);
  color: #4a3327;
}

.count-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.count-panel + .count-panel {
  margin-top: 1rem;
}

.count-title {
  margin: 0 0 0.55rem;
  color: var(--muted);
  font-size: 0.94rem;
}

.count-grid div {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 0.6rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.6);
}

.count-grid strong {
  font-family: "Cormorant Garamond", serif;
  display: block;
  font-size: clamp(1.5rem, 4.5vw, 2.4rem);
  line-height: 1.1;
}

.count-grid span {
  color: var(--muted);
}

.info-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.85rem;
}

.info-list li {
  display: grid;
  gap: 0.2rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px dashed var(--line);
}

.info-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.info-list span {
  color: var(--muted);
  font-size: 0.94rem;
}

.info-list p {
  margin: 0;
}

.timeline {
  display: grid;
  gap: 0.8rem;
}

.node {
  position: relative;
  padding: 0.8rem 0.9rem 0.8rem 1.1rem;
  border-left: 3px solid rgba(182, 74, 60, 0.45);
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
}

.node time {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 700;
}

.node p {
  margin: 0.2rem 0 0;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.photo-grid figure {
  margin: 0;
  border-radius: 14px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
  transition: transform 0.7s ease;
}

.photo-grid figure:hover img {
  transform: scale(1.09);
}

.invitation-frame {
  display: block;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(58, 38, 26, 0.12);
  box-shadow: 0 14px 34px rgba(58, 38, 26, 0.16);
}

.invitation-frame img {
  display: block;
  width: 100%;
  height: auto;
  transition: transform 0.55s ease;
}

.invitation-frame:hover img {
  transform: scale(1.02);
}

.flipbook {
  display: grid;
  gap: 0.9rem;
}

.book-stage {
  position: relative;
  height: min(76vw, 500px);
  min-height: 360px;
  perspective: 1800px;
  border-radius: 16px;
  background: linear-gradient(145deg, rgba(227, 208, 188, 0.35), rgba(255, 255, 255, 0.45));
  border: 1px solid rgba(58, 38, 26, 0.12);
  padding: 0.8rem;
  overflow: hidden;
  cursor: pointer;
}

.book-stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgba(91, 60, 41, 0.16), transparent 12%, transparent 88%, rgba(91, 60, 41, 0.08));
}

.book-page {
  position: absolute;
  inset: 0.8rem;
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  transform-origin: left center;
  transform-style: preserve-3d;
  transition: transform 0.8s cubic-bezier(0.32, 0.72, 0.18, 1), box-shadow 0.8s ease;
  box-shadow: 0 10px 26px rgba(58, 38, 26, 0.2);
  background: #e8ddcf;
}

.book-page.flipped {
  transform: rotateY(-178deg);
  box-shadow: 0 4px 12px rgba(58, 38, 26, 0.12);
}

.book-page img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  backface-visibility: hidden;
}

.book-toolbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 0.7rem;
}

.book-toolbar .btn {
  width: 100%;
  padding: 0.6rem 1rem;
}

.book-counter {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
}

#map p {
  margin: 0 0 1rem;
  color: var(--muted);
}

.section-copy {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.8;
}

footer {
  text-align: center;
  color: var(--muted);
  padding: 1rem 0 2.4rem;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0);
}

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

@keyframes drift {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(2.5vmax, -1.5vmax, 0) scale(1.08);
  }
}

@keyframes heroBloom {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes cardEnter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 700px) {
  .hero {
    min-height: 82vh;
  }

  .music-toggle {
    top: auto;
    bottom: 1rem;
    right: 1rem;
  }

  .count-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .photo-grid {
    grid-template-columns: 1fr;
  }

  .book-stage {
    height: 72vw;
    min-height: 280px;
  }

  .book-toolbar {
    grid-template-columns: 1fr;
  }

  .book-toolbar .btn {
    width: auto;
    justify-self: center;
    min-width: 140px;
  }
}
