@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/cormorant-garamond.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Cormorant Garamond";
  src: url("assets/fonts/cormorant-garamond-italic.ttf") format("truetype");
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Allura";
  src: url("assets/fonts/allura.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: only light;
  --paper: #f1f1ef;
  --ink: #242321;
  --muted: #68655f;
  --rule: #d4d0c8;
  --tint: #eeece6;
  --surface: #faf9f6;
  --selection: #dcd7cc;
  --menu-shadow: #2423210d;
  --popover-shadow: #24232126;
  --backdrop: #24232133;
  --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --sans: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --script: "Allura", "Brush Script MT", cursive;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--selection); color: var(--ink); }

h1, h2, h3, p, figure { margin: 0; }
h1, h2, h3 { font-weight: 400; }
a { color: inherit; text-underline-offset: 0.3em; }
a:focus-visible, summary:focus-visible, button:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 7px;
}

.page-width {
  width: min(560px, calc(100% - 3rem));
  margin-inline: auto;
}

.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
  padding-block: 3.5rem 4rem;
}
.paper-sheet {
  position: relative;
  isolation: isolate;
  width: 100%;
  padding-block: clamp(1.75rem, 4vw, 2.5rem) clamp(1.5rem, 3vw, 2rem);
  filter: drop-shadow(0 1px 1px #5e493326) drop-shadow(0 8px 12px #5e49331c);
}
.paper-sheet::before {
  --paper-cut: 5px;
  --paper-tooth: 10px;
  --paper-edge:
    linear-gradient(#000 0 0) center / calc(100% - var(--paper-tooth)) calc(100% - var(--paper-tooth)) no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'%3E%3Cpath d='M0 5 5 0 10 5Z'/%3E%3C/svg%3E") top / var(--paper-tooth) var(--paper-cut) round no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 5'%3E%3Cpath d='M0 0 5 5 10 0Z'/%3E%3C/svg%3E") bottom / var(--paper-tooth) var(--paper-cut) round no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 10'%3E%3Cpath d='M5 0 0 5 5 10Z'/%3E%3C/svg%3E") left / var(--paper-cut) var(--paper-tooth) no-repeat round,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 5 10'%3E%3Cpath d='M0 0 5 5 0 10Z'/%3E%3C/svg%3E") right / var(--paper-cut) var(--paper-tooth) no-repeat round;
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0 calc(-1 * clamp(0.75rem, 2.5vw, 2rem));
  pointer-events: none;
  background-color: #f5eee2;
  background-image:
    url("assets/invitation-paper.svg"),
    radial-gradient(ellipse at 18% 12%, #fffdf8bd, transparent 70%),
    linear-gradient(145deg, #f7f1e6, #f0e6d5);
  background-size: 256px 256px, 100% 100%, 100% 100%;
  box-shadow: inset 0 0 24px #fffdf640;
  -webkit-mask: var(--paper-edge);
  mask: var(--paper-edge);
}
.paper-invitation {
  display: flex;
  flex-direction: column;
  gap: clamp(1.5rem, 4vw, 2.25rem);
}
.hero-copy { width: 100%; text-align: center; }

h1 {
  font-family: var(--serif);
  font-size: clamp(3rem, 10vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.055em;
  white-space: nowrap;
}
.invitation-intro { display: block; margin-bottom: 0.6rem; font-family: var(--serif); font-size: clamp(1.5rem, 3.5vw, 1.875rem); font-style: italic; line-height: 1.25; letter-spacing: normal; }
h1 em { display: block; font-weight: 400; letter-spacing: -0.065em; }
.couple-names {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  column-gap: 0.25em;
  margin-top: 1rem;
  font-family: var(--script);
  font-size: clamp(2.1rem, 5.5vw, 2.75rem);
  line-height: 1.2;
}
.given-names, .surname-group { white-space: nowrap; }
.surname-group { display: inline-flex; align-items: baseline; }
.surname-note-button {
  align-self: flex-start;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.surname-note-button:hover { color: var(--muted); }
.invitation-details { font-size: 1rem; }
.invitation-card { text-align: center; }
.event-date { display: flex; flex-direction: column; align-items: center; padding-inline: 1rem; font-size: clamp(0.875rem, 3.65vw, 1rem); }
.event-date > span { white-space: nowrap; font-weight: 700; }
.calendar-picker { position: relative; display: inline-block; margin-top: 0.5rem; }
.calendar-picker summary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 36px;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 0.8125rem;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}
.calendar-picker summary::-webkit-details-marker { display: none; }
.calendar-picker summary:hover { background: var(--tint); }
.calendar-picker[open] .calendar-chevron { transform: rotate(180deg); }
.calendar-options {
  position: absolute;
  z-index: 2;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  top: calc(100% + 0.4rem);
  min-width: 170px;
  padding: 0.25rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  background: var(--surface);
  box-shadow: 0 4px 14px var(--menu-shadow);
  text-align: center;
}
.calendar-options a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding-inline: 0.7rem; font-size: 0.875rem; text-decoration: none; }
.calendar-options a:hover, .calendar-options a:focus-visible { background: var(--tint); }
.extra-details { margin-top: 2rem; padding-inline: clamp(0.5rem, 2vw, 1rem); color: var(--ink); text-align: left; }
.extra-details-list { margin: 0; padding-left: 1rem; }
.extra-details-list > li { padding-left: 0.3rem; }
.extra-details-list > li + li { margin-top: 1rem; }
.extra-details-list li::marker { color: currentColor; font-size: 0.8em; }
.venue-map {
  width: 100%;
  margin-top: 1.5rem;
  border: 1px solid var(--rule);
}
.venue-map iframe { display: block; width: 100%; height: 220px; border: 0; }

.portrait { width: min(100%, 380px); margin-inline: auto; }
.photo-frame { position: relative; mix-blend-mode: multiply; }
.photo-frame img {
  display: block;
  width: 100%;
  height: auto;
}

.text-button {
  display: inline;
  max-width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 0.3em;
  cursor: pointer;
}
.text-button:hover { text-decoration-thickness: 2px; }
.info-popover {
  position: fixed;
  inset: 0;
  width: min(390px, calc(100% - 3rem));
  max-height: calc(100dvh - 3rem);
  margin: auto;
  padding: 1.5rem 1.5rem 2rem;
  border: 1px solid var(--rule);
  background: var(--surface);
  color: var(--ink);
  text-align: center;
  box-shadow: 0 16px 64px var(--popover-shadow);
}
.info-popover::backdrop { background: var(--backdrop); }
.popover-heading { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; margin-bottom: 1.5rem; }
.popover-heading h2 { grid-column: 2; grid-row: 1; font-family: var(--serif); font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.1; }
.close-popover { grid-column: 3; grid-row: 1; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: inherit; cursor: pointer; }
.close-popover:focus-visible { outline-offset: 2px; }
.close-popover:hover { background: var(--tint); }
.bank-popover dl { display: grid; gap: 1rem; margin: 0; }
.bank-popover dl > div { display: grid; gap: 0.15rem; }
.bank-popover dt { color: var(--muted); font-size: 0.875rem; }
.bank-popover dd { margin: 0; font-size: 1rem; font-variant-numeric: tabular-nums; }
.surname-popover {
  width: min(440px, calc(100% - 2rem));
}
.surname-equation { display: grid; justify-items: center; gap: 0.6rem; line-height: 1.5; }
.surname-parts { display: flex; align-items: baseline; justify-content: center; gap: 0.6rem; }
.surname-person, .surname-result > span { white-space: nowrap; }
.surname-operator { color: var(--muted); font-size: 1.125rem; }
.surname-result { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; column-gap: 0.3em; }
.surname-equation strong { font-weight: 700; white-space: nowrap; }

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 10;
  padding: 0.6rem 1rem;
  background: var(--ink);
  color: var(--paper);
  transform: translateY(-180%);
}
.skip-link:focus { transform: translateY(0); }
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 760px) {
  .hero { gap: 2rem; padding-block: 2.5rem 3rem; }
}

@media (pointer: coarse) {
  .calendar-picker summary { min-height: 44px; }
}

@media (max-width: 380px) {
  .info-popover { padding-inline: 1rem; }
  .popover-heading { margin-inline: -0.5rem; }
  .surname-parts { flex-direction: column; align-items: center; gap: 0.15rem; }
}

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

@media print {
  body { background: white; color: black; }
  .skip-link, .calendar-picker, .surname-note-button, .info-popover { display: none; }
  .page-width { width: 100%; }
  .hero { padding-block: 1rem 2rem; }
  .portrait { max-width: 230px; }
  .venue-map iframe { display: none; }
}
