:root {
  --paper: #f7f3ea;
  --paper-deep: #ebe4d6;
  --ink: #2d3128;
  --muted: #717164;
  --green: #586742;
  --green-deep: #3f4d32;
  --yellow: #d7b85b;
  --coffee: #8a694b;
  --line: rgba(63, 77, 50, 0.32);
  --shadow: 0 20px 80px rgba(71, 64, 50, 0.14);
  color-scheme: light;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", Georgia, serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: #d9d2c2;
  color: var(--ink);
}

button,
input,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  position: relative;
  width: min(100vw, 430px);
  margin: 0 auto;
  background: var(--paper);
  min-height: 100dvh;
  overflow: hidden;
  box-shadow: 0 0 80px rgba(43, 38, 29, 0.18);
}

main {
  scroll-snap-type: y proximity;
}

.page {
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  padding: max(28px, env(safe-area-inset-top)) 28px max(28px, env(safe-area-inset-bottom));
  scroll-snap-align: start;
  background:
    radial-gradient(circle at 20% 16%, rgba(255, 255, 255, 0.8), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(224, 215, 195, 0.16)),
    var(--paper);
}

.paper-noise {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.48;
  background-image:
    radial-gradient(circle at 18% 22%, rgba(77, 73, 57, 0.06) 0 1px, transparent 1.5px),
    radial-gradient(circle at 72% 44%, rgba(92, 103, 63, 0.07) 0 1px, transparent 1.6px),
    radial-gradient(circle at 38% 78%, rgba(138, 105, 75, 0.06) 0 1px, transparent 1.5px);
  background-size: 37px 41px, 53px 47px, 71px 61px;
  mix-blend-mode: multiply;
}

.top-actions {
  position: fixed;
  z-index: 30;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  width: min(100vw, 430px);
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 18px;
  pointer-events: none;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(63, 77, 50, 0.18);
  border-radius: 50%;
  background: rgba(247, 243, 234, 0.72);
  color: var(--green-deep);
  backdrop-filter: blur(10px);
  cursor: pointer;
  pointer-events: auto;
}

.icon-button:active {
  transform: translateY(1px) scale(0.98);
}

.menu-toggle {
  display: grid;
  place-content: center;
  gap: 5px;
}

.menu-toggle span {
  display: block;
  width: 18px;
  height: 1px;
  background: currentColor;
}

.music-note {
  position: relative;
  display: inline-block;
  width: 14px;
  height: 20px;
  border-right: 2px solid currentColor;
  border-top: 2px solid currentColor;
  transform: rotate(2deg);
}

.music-note::after {
  content: "";
  position: absolute;
  right: -3px;
  bottom: -3px;
  width: 9px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.music-toggle[data-state="playing"] {
  background: var(--green);
  color: var(--paper);
}

.drawer {
  position: fixed;
  z-index: 40;
  top: 0;
  right: calc((100vw - min(100vw, 430px)) / 2);
  width: min(78vw, 310px);
  height: 100dvh;
  padding: 72px 28px 28px;
  background: rgba(247, 243, 234, 0.94);
  border-left: 1px solid rgba(63, 77, 50, 0.16);
  transform: translateX(110%);
  transition: transform 420ms cubic-bezier(0.2, 0.8, 0.2, 1);
  backdrop-filter: blur(18px);
}

.drawer.is-open {
  transform: translateX(0);
}

.drawer a,
.drawer-close {
  display: block;
  width: 100%;
  padding: 16px 0;
  color: var(--ink);
  text-decoration: none;
  border: 0;
  border-bottom: 1px solid rgba(63, 77, 50, 0.16);
  background: transparent;
  text-align: left;
  letter-spacing: 0.18em;
}

.drawer-close {
  color: var(--muted);
}

.wind-line {
  position: absolute;
  pointer-events: none;
  fill: none;
  stroke: var(--green);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.8;
}

.wind-line path {
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
}

.is-visible .wind-line path,
.wind-line.is-visible path {
  animation: drawWind 2600ms ease forwards;
}

.torn-photo {
  position: relative;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: var(--shadow);
  overflow: hidden;
  clip-path: polygon(3% 9%, 13% 2%, 32% 4%, 51% 1%, 76% 5%, 96% 3%, 99% 18%, 96% 36%, 100% 56%, 95% 78%, 99% 96%, 72% 98%, 56% 94%, 34% 99%, 14% 95%, 3% 99%, 0 76%, 3% 58%, 0 38%, 4% 23%);
}

.torn-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border: 11px solid rgba(247, 243, 234, 0.78);
  filter: blur(3px);
  mix-blend-mode: screen;
}

.torn-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition:
    opacity 780ms ease,
    transform 780ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.reveal.is-visible,
.is-visible > .reveal {
  opacity: 1;
  transform: translateY(0);
}

.delay-1 { transition-delay: 110ms; }
.delay-2 { transition-delay: 210ms; }
.delay-3 { transition-delay: 310ms; }
.delay-4 { transition-delay: 410ms; }

.cover-page {
  padding-top: 52px;
}

.cover-copy {
  position: absolute;
  z-index: 3;
  left: 32px;
  top: 164px;
}

.small-en {
  margin: 0 0 16px;
  font-family: Georgia, serif;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
}

.cover-title {
  position: absolute;
  z-index: 3;
  right: 32px;
  top: 78px;
  text-align: right;
}

.cover-title h1 {
  margin: 0;
  writing-mode: vertical-rl;
  font-size: clamp(52px, 15vw, 74px);
  line-height: 0.95;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.08em;
}

.cover-title p {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.16em;
}

.cover-wind {
  z-index: 2;
  inset: 0;
}

.cover-mountain {
  left: 20px;
  top: 282px;
  width: 260px;
  stroke: rgba(63, 77, 50, 0.23);
  stroke-width: 1;
  fill: none;
}

.hero-photo {
  position: absolute;
  z-index: 1;
  left: -20px;
  right: -18px;
  bottom: 42px;
  height: min(56dvh, 520px);
  clip-path: polygon(0 12%, 15% 8%, 32% 10%, 50% 5%, 68% 9%, 100% 3%, 100% 100%, 0 100%);
}

.hero-photo img {
  object-position: 50% 42%;
}

.date-place {
  position: absolute;
  z-index: 3;
  right: 32px;
  bottom: 52px;
  display: grid;
  gap: 4px;
  text-align: right;
  font-size: 14px;
  letter-spacing: 0.16em;
  color: var(--green-deep);
}

.next-link,
.back-home {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  color: var(--green-deep);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: 0.22em;
}

.page-heading {
  position: relative;
  z-index: 3;
  padding-top: 54px;
}

.page-heading span {
  display: block;
  margin-bottom: 20px;
  font-size: 34px;
  color: var(--green);
  letter-spacing: 0.08em;
}

.page-heading h2 {
  margin: 0;
  font-size: 43px;
  line-height: 1.05;
  font-weight: 500;
  color: var(--green);
  letter-spacing: 0.14em;
}

.page-heading p {
  width: 16em;
  margin: 18px 0 0;
  font-size: 15px;
  line-height: 1.9;
  color: var(--muted);
}

.gallery-wind {
  inset: 0;
}

.gallery {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.gallery-item {
  position: absolute;
  cursor: zoom-in;
}

.item-large {
  left: 28px;
  top: 326px;
  width: 218px;
  height: 266px;
}

.item-window {
  right: 28px;
  top: 212px;
  width: 150px;
  height: 130px;
}

.item-jump {
  right: 20px;
  top: 506px;
  width: 176px;
  height: 130px;
}

.item-bride {
  left: 42px;
  bottom: 64px;
  width: 168px;
  height: 198px;
}

.page-note {
  position: absolute;
  z-index: 3;
  right: 28px;
  bottom: 76px;
  width: 11em;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
}

.story-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
}

.story-photo {
  position: absolute;
}

.story-photo.groom {
  left: 30px;
  top: 330px;
  width: 180px;
  height: 260px;
}

.story-photo.bride {
  right: 28px;
  top: 188px;
  width: 178px;
  height: 248px;
}

.story-photo figcaption {
  position: absolute;
  left: 8px;
  bottom: 10px;
  padding: 4px 8px;
  background: rgba(247, 243, 234, 0.74);
  color: var(--green-deep);
  font-size: 13px;
  letter-spacing: 0.16em;
}

.story-wind {
  inset: 0;
  z-index: 1;
}

.story-copy {
  position: absolute;
  z-index: 3;
  left: 34px;
  bottom: 154px;
  width: 14em;
  color: var(--muted);
  font-size: 15px;
  line-height: 2.1;
}

.story-copy p {
  margin: 0 0 6px;
}

.memory-photo {
  position: absolute;
  z-index: 2;
  right: 30px;
  bottom: 58px;
  width: 150px;
  height: 112px;
  transform: rotate(-2deg);
}

.timeline {
  position: relative;
  z-index: 2;
  list-style: none;
  margin: 42px 0 26px 68px;
  padding: 0;
  border-left: 1px solid var(--green);
}

.timeline li {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 3px 14px;
  padding: 0 0 28px 22px;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -6px;
  top: 6px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--paper);
  border: 1px solid var(--green);
}

.timeline time {
  grid-row: span 2;
  color: var(--green);
  font-size: 23px;
}

.timeline strong {
  font-weight: 500;
  font-size: 19px;
}

.timeline span {
  color: var(--muted);
  font-size: 13px;
}

.guide-block,
.map-block,
.dress-block {
  position: relative;
  z-index: 2;
  border-top: 1px solid rgba(63, 77, 50, 0.18);
  padding: 18px 0;
}

.guide-block p,
.map-block p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.75;
}

.guide-block b,
.map-block b,
.dress-block b {
  display: inline-block;
  min-width: 74px;
  color: var(--green-deep);
  font-weight: 500;
}

.map-block {
  display: grid;
  gap: 14px;
}

.map-block a {
  justify-self: start;
  padding: 10px 16px;
  color: var(--green-deep);
  border: 1px solid rgba(63, 77, 50, 0.45);
  text-decoration: none;
  background: rgba(247, 243, 234, 0.6);
}

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
}

.swatches span {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.swatches span::before {
  content: "";
  display: block;
  aspect-ratio: 1;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px rgba(63, 77, 50, 0.08);
  clip-path: polygon(4% 10%, 25% 2%, 50% 6%, 76% 1%, 98% 8%, 94% 42%, 99% 68%, 92% 96%, 56% 92%, 24% 98%, 2% 90%, 6% 56%, 1% 31%);
}

.guide-photo {
  position: absolute;
  z-index: 1;
  left: 24px;
  right: 24px;
  bottom: 18px;
  height: 94px;
  opacity: 0.92;
}

.rsvp-photo {
  position: absolute;
  top: 76px;
  right: -4px;
  width: 156px;
  height: 126px;
  z-index: 2;
}

.rsvp-form {
  position: relative;
  z-index: 3;
  display: grid;
  gap: 16px;
  margin-top: 70px;
}

.rsvp-form label,
.rsvp-form fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.rsvp-form span,
.rsvp-form legend {
  color: var(--green-deep);
  font-size: 15px;
  letter-spacing: 0.16em;
}

.rsvp-form input,
.rsvp-form textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(45, 49, 40, 0.44);
  border-radius: 0;
  padding: 10px 2px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--ink);
  outline: none;
}

.rsvp-form input:focus,
.rsvp-form textarea:focus {
  border-color: var(--green);
  box-shadow: 0 2px 0 rgba(88, 103, 66, 0.24);
}

.segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid rgba(45, 49, 40, 0.38);
}

.segment label {
  display: block;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  color: var(--muted);
}

.segment label + label {
  border-left: 1px solid rgba(45, 49, 40, 0.28);
}

.segment input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segment label:has(input:checked),
.segment label.is-selected {
  background: rgba(88, 103, 66, 0.14);
  color: var(--green-deep);
}

.submit-button {
  width: min(240px, 100%);
  justify-self: center;
  margin-top: 8px;
  padding: 13px 22px;
  border: 0;
  background: var(--green);
  color: var(--paper);
  cursor: pointer;
  letter-spacing: 0.18em;
  clip-path: polygon(3% 10%, 24% 2%, 50% 5%, 78% 1%, 98% 10%, 95% 91%, 72% 98%, 45% 94%, 18% 99%, 2% 90%);
}

.submit-button:active {
  transform: translateY(1px) scale(0.99);
}

.form-status {
  min-height: 22px;
  margin: 0;
  color: var(--green-deep);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.lightbox {
  position: fixed;
  z-index: 60;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(24, 26, 21, 0.82);
  padding: 24px;
}

.lightbox[hidden] {
  display: none;
}

.lightbox button {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
}

.lightbox img {
  position: relative;
  z-index: 1;
  max-width: 100%;
  max-height: 82dvh;
  object-fit: contain;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.4);
}

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

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

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 360px) {
  .page {
    padding-inline: 22px;
  }

  .page-heading h2 {
    font-size: 38px;
  }

  .timeline {
    margin-left: 42px;
  }

  .timeline li {
    grid-template-columns: 68px 1fr;
  }
}
