:root {
  color-scheme: light;
  --paper: #f6f3eb;
  --ink: #383a34;
  --muted: #686b61;
  --red: #a64b3d;
  --line: #c9c9bc;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: #e9e6de;
  font-synthesis: none;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { scroll-snap-type: y mandatory; }
body { margin: 0; }
h1, h2, p, figure, dl, dd { margin: 0; }
button { font: inherit; }
img { display: block; max-width: 100%; height: auto; }

.invitation {
  position: relative;
  isolation: isolate;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  background: var(--paper);
}

/* One stretched, faint texture; no tiled pattern or image dependency online. */
.invitation::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: url("assets/textures/paper.svg") center / 100% 100% no-repeat;
  opacity: 0.14;
}

.page {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100svh;
  padding: max(32px, env(safe-area-inset-top)) max(30px, env(safe-area-inset-right)) max(28px, env(safe-area-inset-bottom)) max(30px, env(safe-area-inset-left));
}

.page-label {
  font-size: 10px;
  line-height: 1.6;
  font-weight: 400;
  letter-spacing: 0.13em;
  color: var(--muted);
}
.page-label span[lang] { margin-left: 7px; }
.art { flex-shrink: 0; }
.art img { width: 100%; object-fit: contain; }
.handwriting { width: 100%; font-size: inherit; font-weight: 400; }
.handwriting img { width: 100%; object-fit: contain; }

.cover-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(30px, 5vh, 48px);
  padding-block: 46px;
}
.handwriting-cover { max-width: 260px; }
.handwriting-cover img { transform: scale(1.08); }
.art-cover { width: 176px; }
/* Preserve the group's height so tightening its gap does not move the illustration. */
.cover-signature { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-bottom: 4px; }
.cover-names { color: var(--ink); font-size: 12px; line-height: 1.6; letter-spacing: 0.14em; }
.cover-date {
  color: var(--red);
  font-size: 13px;
  line-height: 1.6;
  letter-spacing: 0.18em;
  font-variant-numeric: tabular-nums;
}
.scroll-hint {
  text-align: center;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
  letter-spacing: 0.12em;
}
.scroll-hint span { display: block; margin-top: 8px; }

.story-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 40px;
  padding-block: 52px;
}
.art-proposal { width: 224px; max-width: 90%; align-self: flex-start; margin-left: 4%; }
.story-copy { align-self: center; color: var(--ink); font-size: 14px; font-weight: 400; line-height: 2.1; letter-spacing: 0.12em; text-align: center; }
.art-daily { width: 206px; max-width: 90%; align-self: flex-end; margin-right: 4%; }

.wedding-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 38px;
  padding-block: 42px;
}
.wedding.is-overflowing { height: 100vh; height: 100svh; overflow-y: auto; }
.wedding.is-overflowing.is-handoff { overflow-y: hidden; }
.art-wedding { width: calc(248px * 2 / 3); max-width: 100%; }
.wedding-details { width: 100%; max-width: 280px; text-align: center; font-weight: 400; }
.wedding-date { color: var(--red); font-size: 20px; line-height: 1.6; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }
.wedding-time { margin-top: 8px; font-size: 13px; line-height: 1.8; letter-spacing: 0.05em; }
.wedding-names { margin-top: 16px; font-size: 12px; line-height: 1.8; letter-spacing: 0.14em; }
.wedding-venue { margin-top: 24px; font-size: 15px; line-height: 1.8; letter-spacing: 0.03em; }
.wedding-hall { margin-top: 8px; font-size: 12px; line-height: 1.8; letter-spacing: 0.08em; }
.wedding-address { margin: 18px 0 0; color: var(--muted); font-size: 12px; font-style: normal; line-height: 1.9; overflow-wrap: anywhere; }
.map-button {
  display: block;
  width: max-content;
  min-height: 44px;
  margin: 24px auto 0;
  padding: 10px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.06em;
  text-decoration: none;
}
.map-button:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }
.map-button span[aria-hidden] { margin-left: 16px; }
.map-note { margin-top: 10px; color: var(--muted); font-size: 10px; line-height: 1.8; text-align: center; }

.ending-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 56px;
  padding-block: 64px;
}
.art-ending { width: 186px; }
.handwriting-ending { max-width: 280px; aspect-ratio: 3000 / 640; display: flex; align-items: center; position: relative; top: -15px; }

.erase-scene {
  position: relative;
  width: 100%;
  /* Feather widths and edge alpha (0 = transparent, 1 = no fade). */
  --photo-feather-x: 14%;
  --photo-feather-top: 3%;
  --photo-feather-bottom: 12%;
  --photo-edge-alpha: 0;
  --photo-background-alpha: 1;
  --photo-align-x: 50%;
}
.erase-scene::before { content: ""; display: block; }
.erase-01::before { padding-top: 150%; }
.erase-02::before { padding-top: 150%; }
.erase-scene .original-photo {
  position: absolute;
  top: 0;
  left: var(--photo-align-x);
  transform: translateX(calc(0% - var(--photo-align-x)));
  width: auto;
  height: 100%;
  object-fit: contain;
  /* The box follows the actual photo, so a contained portrait has no hard inner edge. */
  --photo-mask-x: linear-gradient(to right,
    rgba(0, 0, 0, var(--photo-edge-alpha)) 1px,
    rgba(0, 0, 0, var(--photo-background-alpha)) var(--photo-feather-x),
    rgba(0, 0, 0, var(--photo-background-alpha)) calc(100% - var(--photo-feather-x)),
    rgba(0, 0, 0, var(--photo-edge-alpha)) calc(100% - 1px));
  --photo-mask-y: linear-gradient(to bottom,
    rgba(0, 0, 0, var(--photo-edge-alpha)) 1px,
    #000 var(--photo-feather-top),
    #000 calc(100% - var(--photo-feather-bottom)),
    rgba(0, 0, 0, var(--photo-edge-alpha)) calc(100% - 1px));
  -webkit-mask-image: var(--photo-mask-x), var(--photo-mask-y);
  mask-image: var(--photo-mask-x), var(--photo-mask-y);
  -webkit-mask-composite: source-in;
  mask-composite: intersect;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-size: 100% 100%;
  mask-size: 100% 100%;
}
/* 06 and original 01 now share a full portrait viewport. */
.erase-01 {
  --photo-align-x: 50%;
  --photo-feather-top: 12%;
  --photo-feather-bottom: 3%;
}
/* Fade the full photo at its perimeter; preserve the original studio background. */
.erase-02 {
  --photo-background-alpha: 1;
  --photo-feather-x: 9%;
  --photo-feather-top: 8%;
  --photo-feather-bottom: 12%;
}
.illustration-layer { position: absolute; inset: 0; width: 100%; height: 100%; }
.erase-scene[data-erase-state="complete"] .illustration-layer { visibility: hidden; }

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

/* Content is visible by default, including without JavaScript. */
@media (prefers-reduced-motion: no-preference) {
  [data-reveal].reveal-pending { opacity: 0; transform: translateY(8px); }
  [data-reveal].reveal-ready {
    opacity: 1;
    transform: none;
    transition: opacity 1.1s ease, transform 1.1s ease;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-snap-type: none; }
  [data-reveal] { opacity: 1; transform: none; transition: none; }
}

@media (max-width: 360px) {
  .page { padding-inline: max(22px, env(safe-area-inset-left)) max(22px, env(safe-area-inset-right)); }
}
