:root {
  color-scheme: light;
  --paper: #f3f0e7;
  --ink: #34351e;
  --green: #4b633c;
  --green-dark: #34492e;
  --green-light: #718054;
  --gold: #b49a5c;
  --serif: Georgia, "Times New Roman", serif;
  --script: "Symphony", "Snell Roundhand", "Segoe Script", "Brush Script MT", cursive;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  overflow: hidden;
}

body,
.envelope-screen {
  background: var(--paper);
}

button {
  font: inherit;
}

.site {
  min-height: 100vh;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
}

.envelope-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 42px;
  overflow: hidden;
  text-align: center;
  transition: opacity 300ms ease, transform 400ms ease;
}

.invitation__eyebrow {
  margin: 0;
  color: #79785c;
  font-family: var(--serif);
  font-size: 12px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.invitation__names span {
  color: var(--green-light);
  font-style: italic;
}

.envelope-button {
  position: relative;
  z-index: 1;
  display: block;
  width: min(86vw, 570px, 105svh);
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.envelope-button:focus-visible {
  outline: 2px solid var(--green-light);
  outline-offset: 12px;
}

.envelope {
  position: relative;
  display: block;
  container-type: inline-size;
  filter: drop-shadow(0 28px 30px rgba(51, 57, 35, 0.18));
}

.envelope__image,
.opened-envelope__image {
  display: block;
  width: 100%;
  height: auto;
}

.envelope__inscription {
  position: absolute;
  top: 33%;
  left: 50%;
  width: 44%;
  transform: translate(-50%, -50%);
}

.envelope__floral-frame {
  display: block;
  width: 100%;
  height: auto;
  /* The seal is part of the envelope image and sits in front of the ring. */
  mask-image: radial-gradient(ellipse 16% 28% at 50% 113%, transparent 96%, #000 100%);
}

.envelope__save-date {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 100%;
  color: #f3ebcd;
  font-family: var(--script);
  font-size: clamp(18px, 9.5cqi, 52px);
  line-height: 0.87;
  text-shadow: 0 1px 2px rgba(27, 39, 23, 0.45);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.envelope__monogram {
  position: absolute;
  z-index: 7;
  top: 81%;
  left: 50%;
  color: #f3ebcd;
  font-family: var(--script);
  font-size: clamp(20px, 8cqi, 43px);
  letter-spacing: -0.06em;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(25, 34, 21, 0.58);
  transform: translate(-50%, -50%);
  white-space: nowrap;
}

.envelope-screen__hint {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 31px 0 0;
  color: #77765c;
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.envelope-screen__hint span {
  width: 26px;
  height: 1px;
  background: #aaa789;
}

.envelope-flowers {
  position: absolute;
  z-index: 0;
  height: auto;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.envelope-flowers--left {
  bottom: 7%;
  left: 4%;
  width: clamp(112px, 15vw, 185px);
}

.envelope-flowers--right {
  top: 10%;
  right: 4%;
  width: min(clamp(70px, 13.5vw, 175px), 25svh);
}

.invitation {
  position: fixed;
  z-index: 4;
  inset: 0;
  overflow: hidden;
  background: var(--paper);
  opacity: 0;
  pointer-events: none;
  transform: translateY(28px) scale(0.97);
  transition: opacity 750ms ease, transform 900ms cubic-bezier(0.22, 0.75, 0.2, 1);
}

.invitation::before,
.invitation::after {
  position: fixed;
  z-index: 0;
  inset: 18px;
  border: 1px solid rgba(115, 119, 79, 0.24);
  content: "";
  pointer-events: none;
}

.invitation::after {
  inset: 24px;
  border-color: rgba(181, 157, 95, 0.25);
}

.invitation__scroll {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(38px, 5vh, 64px) clamp(24px, 6vw, 90px) 26px;
  overflow: hidden;
  overscroll-behavior-y: contain;
}

.invitation__scroll:focus-visible {
  outline: 2px solid var(--green-light);
  outline-offset: -4px;
}

.invitation__close {
  position: absolute;
  z-index: 2;
  top: 34px;
  right: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  gap: 7px;
  padding: 0 8px;
  border: 0;
  border-radius: 4px;
  background: var(--paper);
  color: var(--green-dark);
  cursor: pointer;
  opacity: 0;
  transition: opacity 300ms ease 700ms;
}

.invitation__close > span:first-child {
  font-family: system-ui, sans-serif;
  font-size: 24px;
  font-weight: 200;
}

.invitation__close-label {
  font-family: system-ui, sans-serif;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.invitation__close:focus-visible {
  outline: 2px solid var(--green-light);
  outline-offset: 4px;
}

.invitation__layout {
  position: relative;
  display: grid;
  flex-shrink: 0;
  width: min(100%, 1160px);
  min-height: min(72vh, 720px);
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 0.98fr);
  align-items: center;
  gap: clamp(34px, 7vw, 100px);
  margin: auto;
  padding: 10px 0 0;
}

.opened-envelope {
  position: relative;
  width: min(110%, 595px, 75svh);
  justify-self: center;
}

.photo-strips {
  position: absolute;
  inset: 0;
  pointer-events: none;
  /* Keep the photos behind the flowers, pocket, wax seal, and lace heart. */
  clip-path: polygon(
    0 0, 100% 0, 100% 28%, 79% 28%,
    75.1% 29.7%, 72.4% 32.1%, 70.8% 35.2%, 70.4% 37%,
    71.6% 39.5%, 74.9% 41.9%, 73% 45.4%, 71.6% 46.8%, 71% 50.5%, 71.6% 52.4%,
    54.9% 67.9%, 53.6% 69%, 53.6% 66.5%, 52.8% 64.3%, 51.4% 62.1%,
    49.6% 60.9%, 47.8% 60.2%, 45.7% 60.1%, 43.6% 60.8%, 41.9% 62.3%, 40% 64.6%,
    40.5% 61%, 40.8% 57.7%, 40.3% 54.9%, 39.2% 51.5%, 37.8% 49.1%,
    35.8% 47.1%, 33% 46.1%, 30.5% 45.7%, 27.5% 46.5%, 23% 49.3%, 0 49.3%
  );
}

.photo-strip {
  position: absolute;
  display: grid;
  width: 17%;
  gap: clamp(3px, 0.5vw, 6px);
  padding: 1.2% 1.1% 8%;
  background: #f8f5ed;
  box-shadow: 0 4px 10px rgba(47, 59, 33, 0.23);
  opacity: 0;
  translate: 0 23%;
  transform-origin: center top;
  transition: translate 720ms cubic-bezier(0.2, 0.75, 0.25, 1), opacity 400ms ease;
}

.photo-strip--left {
  top: 9%;
  left: 34%;
  transform: rotate(-8deg);
}

.photo-strip--right {
  top: 8.5%;
  left: 58%;
  transform: rotate(8deg);
}

.photo-strip img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 0.88;
  object-fit: cover;
}

.photo-strip--left img:nth-child(2) {
  object-position: center 15%;
}

.photo-strip--left img:nth-child(3) {
  object-position: center 30%;
}

.photo-strip--right img:nth-child(2) {
  object-position: center 56%;
}

.invitation__copy {
  position: relative;
  padding: 25px 0 20px;
  text-align: center;
}

.invitation__eyebrow {
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.2em;
}

.invitation__names {
  margin: 20px 0 12px;
  font-size: clamp(32px, 4vw, 57px);
  font-weight: 400;
  letter-spacing: 0.045em;
  line-height: 1.15;
  text-transform: uppercase;
}

.invitation__ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin: 6px 0 17px;
  color: var(--gold);
}

.invitation__ornament span {
  width: clamp(35px, 5vw, 66px);
  height: 1px;
  background: rgba(174, 151, 91, 0.72);
}

.invitation__ornament b {
  font-size: 28px;
  font-weight: 400;
}

.invitation__lead {
  margin: 0;
  color: #77765d;
  font-size: clamp(14px, 1.4vw, 18px);
  font-style: italic;
}

.invitation__title {
  margin: 8px 0 0;
  color: var(--green-dark);
  font-size: clamp(30px, 4vw, 52px);
  font-style: italic;
  line-height: 1;
}

.invitation__date {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(21px, 2.3vw, 31px);
  letter-spacing: 0.025em;
}

.invitation__date span {
  color: #77765d;
  font-size: 11px;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.invitation__rule {
  width: 66px;
  height: 1px;
  margin: 20px auto;
  background: var(--gold);
}

.invitation__venue {
  margin: 0;
  color: var(--green-dark);
  font-size: clamp(20px, 2vw, 27px);
}

.invitation__location {
  margin: 6px 0 0;
  color: #66664f;
  font-size: clamp(14px, 1.4vw, 18px);
}

.invitation__note {
  margin: 19px 0 0;
  color: #85826a;
  font-size: 12px;
  font-style: italic;
}

.invitation__monogram {
  margin: 24px 0 0;
  color: var(--green);
  font-family: var(--script);
  font-size: 24px;
  letter-spacing: -0.06em;
}

.invitation__footer {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  margin: 14px 0 0;
  color: #77765d;
  font-size: 13px;
  font-style: italic;
  letter-spacing: 0.04em;
  text-align: center;
}

.site[data-state="opening"] .envelope-screen,
.site[data-state="open"] .envelope-screen {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.98);
}

.site[data-state="open"] .invitation {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.site[data-state="open"] .invitation__scroll {
  overflow-y: auto;
}

.site[data-state="open"] .invitation__close {
  opacity: 1;
}

.site[data-state="open"] .photo-strip {
  opacity: 1;
  translate: 0 0;
  transition-delay: 180ms;
}

.site[data-state="open"] .photo-strip--right {
  transition-delay: 260ms;
}

@media (max-width: 760px) {
  .envelope-screen {
    padding: 34px 20px;
  }

  .envelope-screen__hint {
    margin-top: 26px;
  }

  .envelope-flowers--left {
    bottom: 5%;
    max-width: 18.5svh;
  }

  .envelope-flowers--right {
    top: 4%;
    width: min(20vw, 105px, 14svh);
  }

  .invitation__scroll {
    padding: 64px 27px 32px;
  }

  .invitation::before {
    inset: 10px;
  }

  .invitation::after {
    inset: 15px;
  }

  .invitation__close {
    top: 19px;
    right: 26px;
  }

  .invitation__layout {
    width: min(100%, 470px);
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 18px;
    margin: 0 auto;
    padding: 0;
  }

  .opened-envelope {
    width: min(108%, calc(100vw - 36px), 420px, 75svh);
  }

  .invitation__copy {
    padding: 15px 0 4px;
  }

  .invitation__names {
    margin-top: 13px;
    font-size: clamp(29px, 8vw, 41px);
  }

  .invitation__ornament {
    margin: 1px 0 9px;
  }

  .invitation__ornament b {
    font-size: 22px;
  }

  .invitation__title {
    font-size: 36px;
  }

  .invitation__rule {
    margin: 14px auto;
  }

  .invitation__note {
    margin-top: 13px;
  }

  .invitation__monogram {
    margin-top: 14px;
  }

  .invitation__footer {
    margin: 16px 0 0;
  }
}

@media (max-width: 390px) {
  .invitation__eyebrow {
    font-size: 9px;
  }

  .invitation__scroll {
    padding-right: 22px;
    padding-left: 22px;
  }
}

@media (max-width: 760px) and (orientation: portrait) {
  .envelope-button {
    width: min(86vw, 430px, 67svh);
  }
}

@media (max-height: 500px) and (orientation: landscape) {
  .envelope-button {
    width: min(86vw, 570px, 90svh);
  }

  .invitation__scroll {
    padding-block: 72px 28px;
  }

  .invitation__close {
    top: 25px;
    right: 24px;
  }

  .invitation__layout {
    width: min(100%, 850px);
    min-height: auto;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
    gap: clamp(18px, 4vw, 44px);
    padding: 0;
  }

  .opened-envelope {
    width: min(100%, 72svh);
  }

  .invitation__copy {
    padding: 0;
  }

  .invitation__names {
    margin: 8px 0;
    font-size: clamp(23px, 4vw, 34px);
  }

  .invitation__title {
    font-size: clamp(27px, 4vw, 38px);
  }

  .invitation__ornament {
    margin: 0 0 8px;
  }

  .invitation__ornament b {
    font-size: 22px;
  }

  .invitation__date {
    gap: 4px;
  }

  .invitation__rule {
    margin: 10px auto;
  }

  .invitation__monogram {
    margin-top: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
