:root {
  --bg-dark: #3f4338;
  --olive: #a8ae98;
  --olive-dark: #7e856f;
  --paper: #f7f5ef;
  --paper-soft: #fbfaf6;
  --text: #7a786f;
  --text-dark: #5f5d55;
  --white: #ffffff;
  --gate-speed: 1.55s;
  --ease-gate: cubic-bezier(0.77, 0, 0.175, 1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  font-family: "Manrope", "Inter", sans-serif;
  background: var(--bg-dark);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: -18px;
  z-index: -4;
  background:
    radial-gradient(circle at 24% 20%, rgba(235, 221, 181, 0.58), transparent 28%),
    radial-gradient(circle at 70% 28%, rgba(246, 242, 223, 0.3), transparent 22%),
    radial-gradient(circle at 40% 72%, rgba(115, 126, 96, 0.5), transparent 32%),
    linear-gradient(135deg, #2d342b, #7c8068 42%, #343a31 78%);
  filter: blur(5px);
  transform: scale(1.04);
  animation: backgroundDrift 18s ease-in-out infinite alternate;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -3;
  background: rgba(35, 38, 30, 0.43);
  opacity: 0.86;
  pointer-events: none;
}

.background {
  position: fixed;
  inset: 0;
  z-index: -2;
  /* Replace with url("./assets/background.jpg") when the final garden photo is ready. */
  background-image: none;
  background-position: center;
  background-size: cover;
  opacity: 0;
  pointer-events: none;
}

.page {
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px max(28px, env(safe-area-inset-bottom));
}

.section {
  position: relative;
  margin: 0 0 22px;
}

.hero {
  min-height: 100dvh;
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 16px 0;
}

.top-label {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.26em;
  text-align: center;
  text-indent: 0.26em;
}

.invite-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(251, 250, 246, 0.80), rgba(247, 245, 239, 0.89)),
    url("./assets/paper-frame.jpg") center top / cover no-repeat,
    rgba(250, 248, 241, 0.94);
  border: 1px solid rgba(168, 174, 152, 0.35);
  border-radius: 4px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.18);
}

.gate-card {
  min-height: min(620px, calc(100dvh - 104px));
  display: grid;
  place-items: center;
  padding: 40px 22px 46px;
  background:
    linear-gradient(rgba(251, 250, 246, 0.74), rgba(247, 245, 239, 0.88)),
    url("./assets/paper-frame.jpg") center top / cover no-repeat,
    rgba(250, 248, 241, 0.94);
}

.gate-card::before,
.gate-card::after,
.wishes-section::before,
.final-section::before {
  content: "";
  position: absolute;
  left: 22px;
  right: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(168, 174, 152, 0.7), transparent);
  z-index: 1;
}

.gate-card::before,
.wishes-section::before,
.final-section::before {
  top: 24px;
}

.gate-card::after {
  bottom: 24px;
}

.gate {
  position: absolute;
  z-index: 4;
  top: 120px;
  bottom: 30px;
  width: 50%;
  background-repeat: no-repeat;
  background-size: 100% 100%;
  opacity: 0.78;
  transition:
    transform var(--gate-speed) var(--ease-gate),
    opacity calc(var(--gate-speed) * 0.8) ease;
  will-change: transform, opacity;
}

.gate-left {
  left: 0;
  transform-origin: left center;
  background-image: url("./assets/gate-left.svg");
}

.gate-right {
  right: 0;
  transform-origin: right center;
  background-image: url("./assets/gate-right.svg");
}

.open-button {
  position: relative;
  z-index: 8;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  color: var(--paper-soft);
  background: rgba(126, 133, 111, 0.91);
  box-shadow:
    inset 0 0 0 5px rgba(255, 255, 255, 0.18),
    0 12px 28px rgba(69, 74, 61, 0.3);
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  letter-spacing: 0.06em;
  cursor: pointer;
  animation: pulseButton 2.2s ease-in-out infinite;
}

.open-button::before {
  content: "";
  position: absolute;
  left: 50%;
  top: -48px;
  border-left: 24px solid rgba(255, 255, 255, 0.42);
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  transform: translateX(-34%);
  filter: blur(0.2px);
}

.open-button span {
  position: relative;
  z-index: 1;
}

.open-hint {
  position: absolute;
  z-index: 8;
  bottom: 36px;
  left: 24px;
  right: 24px;
  margin: 0;
  color: rgba(126, 133, 111, 0.8);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-align: center;
  text-transform: uppercase;
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 310px;
  display: grid;
  justify-items: center;
  gap: 17px;
  text-align: center;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.45s ease, transform 0.45s ease;
}

.eyebrow,
h2,
h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow {
  font-size: 12px;
  color: var(--olive-dark);
}

h1,
h2 {
  color: var(--text-dark);
  font-family: "Cormorant Garamond", "Playfair Display", serif;
}

h1 {
  margin: 0;
  font-family: "Great Vibes", "Cormorant Garamond", serif;
  font-size: clamp(42px, 12vw, 54px);
  font-weight: 400;
  line-height: 1.05;
}

.hero-copy,
.invite-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.72;
}

.date-block {
  display: grid;
  justify-items: center;
  gap: 3px;
  min-width: 108px;
  padding: 12px 18px 14px;
  color: var(--olive-dark);
  border: 1px solid rgba(168, 174, 152, 0.42);
  background: rgba(255, 255, 255, 0.28);
}

.date-block span {
  font-family: "Cormorant Garamond", serif;
  font-size: 19px;
  line-height: 1;
}

.date-block strong {
  color: var(--text-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 46px;
  font-weight: 500;
  line-height: 0.95;
}

body.is-opened .gate-left {
  transform: translateX(-88%) rotateY(-8deg);
  opacity: 0.58;
}

body.is-opened .gate-right {
  transform: translateX(88%) rotateY(8deg);
  opacity: 0.58;
}

body.is-opened .open-button,
body.is-opened .open-hint {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px) scale(0.96);
}

body.is-opened .hero-content {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.9s ease 0.76s, transform 0.9s ease 0.76s;
}

.location-section,
.timeline-section,
.wishes-section,
.final-section {
  padding: 28px 24px 30px;
}

h2 {
  position: relative;
  z-index: 1;
  margin-bottom: 18px;
  font-size: clamp(29px, 9vw, 40px);
  line-height: 1.02;
  text-align: center;
}

h3 {
  position: relative;
  z-index: 1;
  margin-bottom: 14px;
  color: var(--olive-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  text-align: center;
}

.location-section > p,
.wishes-section > p,
.final-section > p,
.final-section > span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.place-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 18px;
  margin-top: 22px;
}

.place-list div {
  padding-top: 16px;
  border-top: 1px solid rgba(168, 174, 152, 0.32);
  text-align: center;
}

.place-list span {
  display: block;
  margin-bottom: 7px;
  color: var(--olive-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 25px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 8px;
  color: var(--olive-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
}

.timeline {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 24px;
  margin-top: 8px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 74px;
  width: 1px;
  background: rgba(168, 174, 152, 0.55);
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 58px 34px 1fr;
  gap: 12px;
  align-items: start;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.timeline-item.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-time {
  padding-top: 6px;
  color: var(--olive-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  line-height: 1;
  text-align: right;
}

.timeline-icon {
  position: relative;
  z-index: 1;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--olive-dark);
  background: var(--paper);
  border: 1px solid rgba(168, 174, 152, 0.5);
  border-radius: 50%;
}

.timeline-icon svg {
  width: 18px;
  height: 18px;
  stroke-width: 1.5;
}

.timeline-copy h4 {
  margin: 0 0 5px;
  color: var(--text-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 23px;
  font-weight: 500;
  line-height: 1.05;
}

.timeline-copy p {
  font-size: 13px;
  line-height: 1.55;
}

.wishes-section {
  min-height: 430px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
}

.wishes-section h2 {
  margin-top: 42px;
  margin-bottom: 0;
}

.envelope {
  position: relative;
  z-index: 1;
  width: 130px;
  height: 84px;
  margin: 10px auto 6px;
  border: 1px solid rgba(126, 133, 111, 0.58);
}

.envelope::before,
.envelope::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, transparent 49%, rgba(126, 133, 111, 0.58) 50%, transparent 51%),
    linear-gradient(35deg, transparent 49%, rgba(126, 133, 111, 0.58) 50%, transparent 51%);
}

.soft-note {
  color: var(--olive-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 19px !important;
}

.final-section {
  min-height: 360px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 14px;
  margin-bottom: 0;
  text-align: center;
}

.final-section h2 {
  margin-bottom: 0;
}

.final-section p {
  color: var(--text-dark);
  font-family: "Great Vibes", "Cormorant Garamond", serif;
  font-size: 42px;
  line-height: 1.05;
}

.final-section span {
  color: var(--olive-dark);
  font-family: "Cormorant Garamond", serif;
  font-size: 23px;
}

.reset-button {
  position: relative;
  z-index: 1;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 4px;
  color: rgba(126, 133, 111, 0.78);
  background: transparent;
  border: 0;
  border-bottom: 1px solid currentColor;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

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

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

.screen-frame {
  position: fixed;
  inset: 16px;
  z-index: 20;
  pointer-events: none;
}

.corner {
  position: absolute;
  width: 72px;
  height: 72px;
  opacity: 0.86;
}

.corner::before,
.corner::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.76);
}

.corner::before {
  width: 100%;
  height: 1px;
}

.corner::after {
  width: 1px;
  height: 100%;
}

.corner-tl {
  top: 0;
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
  border-top-left-radius: 12px;
}

.corner-tr {
  top: 0;
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
}

.corner-bl {
  bottom: 0;
  left: max(12px, calc((100vw - 430px) / 2 + 12px));
}

.corner-br {
  right: max(12px, calc((100vw - 430px) / 2 + 12px));
  bottom: 0;
}

.corner-tr::before,
.corner-br::before {
  right: 0;
}

.corner-bl::after,
.corner-br::after {
  bottom: 0;
}

.corner-tl::before,
.corner-tr::before {
  top: 0;
}

.corner-tl::after,
.corner-tr::after {
  top: 0;
}

.corner-bl::before,
.corner-br::before {
  bottom: 0;
}

.corner-tl::after,
.corner-bl::after {
  left: 0;
}

.corner-tr::after,
.corner-br::after {
  right: 0;
}

.corner::marker {
  display: none;
}

.spark {
  position: absolute;
  width: 10px;
  height: 10px;
  animation: twinkle 2.8s ease-in-out infinite;
}

.spark::before,
.spark::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  background: rgba(255, 255, 255, 0.9);
}

.spark::before {
  width: 1px;
  height: 100%;
}

.spark::after {
  width: 100%;
  height: 1px;
}

.spark-a {
  top: 70px;
  left: max(26px, calc((100vw - 430px) / 2 + 26px));
}

.spark-b {
  top: 36px;
  right: max(80px, calc((100vw - 430px) / 2 + 80px));
  animation-delay: 0.7s;
}

.spark-c {
  bottom: 86px;
  right: max(22px, calc((100vw - 430px) / 2 + 22px));
  animation-delay: 1.3s;
}

@keyframes pulseButton {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.045);
  }
}

@keyframes twinkle {
  0%,
  100% {
    opacity: 0.35;
    transform: scale(0.86);
  }
  50% {
    opacity: 1;
    transform: scale(1.12);
  }
}

@keyframes backgroundDrift {
  from {
    transform: scale(1.04) translate3d(-5px, -4px, 0);
  }
  to {
    transform: scale(1.08) translate3d(7px, 5px, 0);
  }
}

@media (min-width: 700px) {
  body {
    display: grid;
    place-items: start center;
  }

  .page {
    max-width: 410px;
  }
}

@media (max-width: 374px) {
  .page {
    padding-left: 14px;
    padding-right: 14px;
  }

  .location-section,
  .timeline-section,
  .wishes-section,
  .final-section {
    padding-left: 20px;
    padding-right: 20px;
  }

  .timeline {
    margin-left: -4px;
  }

  .timeline-item {
    grid-template-columns: 52px 32px 1fr;
    gap: 10px;
  }

  .timeline::before {
    left: 68px;
  }

  .timeline-time {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
