@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/instrument.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Instrument Serif";
  src: url("/assets/instrument-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Luxurious Script";
  src: url("/assets/luxurious.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("/assets/work-sans-light.woff2") format("woff2");
  font-weight: 300;
  font-display: swap;
}

@font-face {
  font-family: "Work Sans";
  src: url("/assets/work-sans-regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  background: #283528;
  color: #fff;
  --screen-height: 100vh;
  --cream: #efe5d1;
  --olive: #455031;
  --lace-height: clamp(3.35rem, 8.35vw, 8.25rem);
  --story-unit: clamp(.62px, .05794vw, 1px);
  --story-copy-size: max(1rem, calc(20 * var(--story-unit)));
  --serif: "Instrument Serif", Georgia, serif;
  --script: "Luxurious Script", "Snell Roundhand", cursive;
}

/* Keep the hero framed as mobile browser controls show and hide. */
@supports (height: 100svh) {
  :root { --screen-height: 100svh; }
}

* { box-sizing: border-box; }

body, h1, p { margin: 0; }

.site-nav {
  position: fixed;
  z-index: 10;
  inset-block-start: max(clamp(.75rem, 2.2vw, 1.75rem), env(safe-area-inset-top));
  inset-inline-end: max(clamp(.75rem, 2.6vw, 2rem), env(safe-area-inset-right));
  color: var(--cream);
  font: 400 .9375rem / 1.35 "Work Sans", system-ui, sans-serif;
}

body:has(.invite-gate[open]) .site-nav { visibility: hidden; }

.site-nav summary {
  display: flex;
  align-items: center;
  gap: .55rem;
  min-block-size: 2.75rem;
  padding: .5rem .85rem;
  border: 1px solid rgb(239 229 209 / 55%);
  border-radius: 3px;
  background: #283528;
  cursor: pointer;
  list-style: none;
}

.site-nav summary::-webkit-details-marker { display: none; }
.site-nav summary:hover { background: #39412b; }

.site-nav-icon {
  display: block;
  inline-size: .9rem;
  block-size: .65rem;
  border-block: 1px solid currentColor;
  background: linear-gradient(currentColor, currentColor) center / 100% 1px no-repeat;
}

.site-nav-links {
  position: absolute;
  inset-block-start: calc(100% + .45rem);
  inset-inline-end: 0;
  inline-size: min(14rem, calc(100vw - 1.5rem));
  margin: 0;
  padding: .35rem;
  list-style: none;
  border-radius: 3px;
  background: var(--cream);
  box-shadow: 0 .35rem 1.25rem rgb(22 28 17 / 25%);
  color: #283528;
}

.site-nav-links li + li { border-block-start: 1px solid rgb(57 65 43 / 18%); }

.site-nav-links a {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  align-content: center;
  gap: .25rem .55rem;
  min-block-size: 2.75rem;
  padding: .55rem .65rem;
  color: inherit;
  text-decoration: none;
}

.site-nav-links a:hover { background: rgb(57 65 43 / 9%); }
.site-nav-links small { color: #4c573d; font-size: .8125rem; }
.site-nav :focus-visible { outline: 2px solid currentColor; outline-offset: -3px; }


main {
  /* Extend the painting under the transparent stitches at the first seam. */
  --art-top: calc(var(--screen-height) * .0024);
  --art-width: max(101.15vw, calc((var(--screen-height) + var(--art-top)) * 2048 / 1323));
  --art-overhang: calc(var(--art-width) * 1323 / 2048 - var(--screen-height) - var(--art-top));
  --lace-overlap: max(0px, calc(var(--lace-height) * .88 - var(--art-overhang)));
  --story-top-edge: calc(var(--lace-height) - var(--lace-overlap));
  overflow: clip;
}

.hero {
  position: relative;
  isolation: isolate;
  display: grid;
  min-block-size: var(--screen-height);
  place-items: center;
  padding: 2rem .65rem;
}

.hero-art {
  position: absolute;
  z-index: -1;
  inset-block-start: calc(-1 * var(--art-top));
  inset-inline-start: 50.125%;
  display: block;
  inline-size: var(--art-width);
  block-size: auto;
  /* Cover the background through the lace, with overlap for pixel rounding. */
  min-block-size: calc(100% + var(--art-top) + var(--story-top-edge) + 2px);
  object-fit: cover;
  object-position: center top;
  transform: translateX(-50%);
}

.hero-copy {
  /* Keep the Figma type sizes proportional as the composition scales. */
  --unit: clamp(.42px, .05794vw, 1px);
  display: grid;
  justify-items: center;
  transform: translateY(calc(2.5 * var(--unit)));
  text-align: center;
}

.celebrating {
  transform: translateX(calc(-10 * var(--unit)));
  font: italic 400 calc(48 * var(--unit)) / 1 var(--serif);
  letter-spacing: -.05em;
}

h1 {
  margin-block-start: calc(35 * var(--unit));
  transform: translate(calc(-13 * var(--unit)), calc(2 * var(--unit)));
  font: 400 calc(90 * var(--unit)) / 1.12 var(--serif);
  letter-spacing: calc(-3 * var(--unit));
  white-space: nowrap;
}

/* The title receives focus when the invite closes so reading starts here. */
#couple:focus { outline: none; }

.initial {
  font-family: var(--script);
  font-size: calc(200 * var(--unit));
  line-height: 0;
}

.location {
  margin-block-start: calc(28 * var(--unit));
  transform: translateX(calc(9 * var(--unit)));
  font: 300 max(.95rem, calc(26 * var(--unit))) / 1.25 "Work Sans", system-ui, sans-serif;
  letter-spacing: -.05em;
}

.invitation-paper {
  --bottom-edge: calc(100% - var(--lace-height) + 1px);
  --story-padding: clamp(3rem, 5vw, 5rem);
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  min-block-size: var(--screen-height);
  padding-block: calc(var(--story-top-edge) + var(--story-padding)) calc(var(--lace-height) + var(--story-padding));
  color: #000;
  background: linear-gradient(
    to bottom,
    transparent var(--story-top-edge),
    var(--cream) var(--story-top-edge) var(--bottom-edge),
    transparent var(--bottom-edge)
  );
}

.invitation-paper::before,
.invitation-paper::after {
  position: absolute;
  inset-inline: 0;
  block-size: var(--lace-height);
  background: url("/assets/lace-border.png") center / auto 100% repeat-x;
  pointer-events: none;
  content: "";
}

.invitation-paper::before {
  inset-block-start: calc(-1 * var(--lace-overlap));
}

.invitation-paper::after {
  inset-block-end: 0;
  transform: scaleY(-1);
}

.story-layout {
  --unit: var(--story-unit);
  display: grid;
  grid-template-areas: "collage story";
  grid-template-columns: minmax(0, .388fr) minmax(0, .612fr);
  align-items: center;
  gap: clamp(2.25rem, 6.55vw, 7rem);
  inline-size: min(86.7%, 94rem);
  margin-inline: auto;
}

.story-content { grid-area: story; }

.story-title {
  margin: 0 0 calc(28 * var(--unit));
  scroll-margin-block-start: 2rem;
  color: var(--olive);
  font: 400 calc(70 * var(--unit)) / 1.3 var(--serif);
  letter-spacing: -.015em;
  word-spacing: .12em;
}

.story-title .initial { font-size: calc(150 * var(--unit)); }

.story-columns {
  --paragraph-gap: 1.25em;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--paragraph-gap) clamp(1.5rem, 2.5vw, 2.75rem);
  font: 300 var(--story-copy-size) / 1.24 "Work Sans", system-ui, sans-serif;
  letter-spacing: -.05em;
}

.story-column {
  display: grid;
  align-content: start;
  gap: var(--paragraph-gap);
}

.story-collage {
  grid-area: collage;
  display: block;
  inline-size: 100%;
  block-size: auto;
}

.celebrations {
  display: grid;
  align-items: center;
  /* Bring the pond up behind the scalloped edge of the paper. */
  margin-block-start: calc(-1 * var(--lace-height));
  padding-block: calc(var(--lace-height) + 150px) 200px;
  color: #fff;
  background: #283528 url("/assets/lotus-pond.png") center / cover no-repeat;
}

.celebration-layout {
  --unit: clamp(.56px, .05794vw, 1px);
  inline-size: min(82%, 94rem);
  margin-inline: auto;
}

.celebration-heading {
  display: grid;
  justify-items: center;
  row-gap: 35px;
  margin-block-end: 90px;
}

.celebration-invite {
  margin: 0;
  scroll-margin-block-start: 2rem;
  text-align: center;
  font: italic 400 calc(40 * var(--unit)) / 1.15 var(--serif);
  letter-spacing: -.05em;
  word-spacing: .16em;
}

.celebration-swans {
  display: block;
  inline-size: clamp(5.25rem, 8.5vw, 7rem);
  block-size: auto;
}

.celebration-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(2.5rem, 9.4vw, 8.125rem);
}

@media (width > 960px) {
  .celebration {
    display: grid;
    grid-row: span 5;
    grid-template-rows: subgrid;
  }
}

.celebration-title {
  margin: 0;
  text-align: center;
  text-wrap: balance;
  font: 400 calc(70 * var(--unit) * .8) / 1.25 var(--serif);
  letter-spacing: -.015em;
  word-spacing: .12em;
}

.celebration-title .initial { font-size: calc(150 * var(--unit) * .8); }

.celebration-dates {
  margin-block-start: calc(23 * var(--unit));
  text-align: center;
  font: 300 max(1.0625rem, calc(26 * var(--unit))) / 1.25 "Work Sans", system-ui, sans-serif;
  letter-spacing: -.035em;
}

.celebration-dates time { white-space: nowrap; }

.celebration-inclusions,
.celebration-description,
.celebration-closing {
  margin-block-start: .7em;
  text-align: center;
  text-wrap: pretty;
  font: 300 max(1rem, calc(20 * var(--unit))) / 1.22 "Work Sans", system-ui, sans-serif;
  letter-spacing: -.025em;
}

.celebration-inclusions {
  margin-block-start: .3em;
  font-weight: 400;
}

@media (max-width: 960px) {
  .story-layout {
    grid-template-areas: "story" "collage";
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(2rem, 6vw, 3.5rem);
    max-inline-size: 39rem;
  }

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

  .story-collage {
    max-inline-size: 27rem;
    justify-self: center;
  }

  .celebrations {
    padding-block: calc(var(--lace-height) + 3.75rem) 4.5rem;
    background-position: 55% center;
  }

  .celebration-layout {
    --unit: clamp(.42px, .146vw, .66px);
    inline-size: min(86.7%, 35rem);
  }

  .celebration-invite {
    font-size: max(1.5rem, calc(40 * var(--unit)));
  }

  .celebration-columns {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(6.5rem, 18vw, 10rem);
  }

  .celebration-title {
    text-wrap: wrap;
    white-space: nowrap;
  }

  .celebration-inclusions,
  .celebration-description,
  .celebration-closing { line-height: 1.35; }
}

@media (max-aspect-ratio: 5/6) {
  main {
    --art-top: 0px;
    --art-width: max(100vw, calc(var(--screen-height) * 2048 / 1323));
  }

  .hero-art {
    inset-inline-start: 68%;
    transform: translateX(-68%);
  }
}

@media (max-width: 360px) {
  .hero-copy { --unit: min(.42px, .13125vw); }
}

@media (prefers-reduced-motion: no-preference) {
  [data-scroll-reveal] {
    transition:
      opacity 750ms cubic-bezier(.22, .61, .36, 1),
      translate 750ms cubic-bezier(.22, .61, .36, 1);
  }

  .scroll-reveal-pending:not(:focus-within, :target, :has(:target)) {
    opacity: 0;
    translate: 0 18px;
    transition: none;
  }
}
