:root {
  --serif: "Cormorant Garamond", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --script: "Pinyon Script", "Snell Roundhand", "Apple Chancery", cursive;

  /* The invitation card keeps its own colours in both themes */
  --card: #fbf8f1;
  --card-back: #8a9a82;
  --card-ink: #3a3832;
  --gold: #a8894f;

  color-scheme: light;
  --paper: #f3eee2;
  --paper-light: #f6f1e6;
  --glow: rgba(255, 252, 244, 0.35);
  --vignette: rgba(120, 100, 70, 0.14);
  --ink: #23221f;
  --ink-soft: #5f5b52;
  --edge: rgba(35, 34, 31, 0.22);
  --emboss: rgba(255, 255, 255, 0.7);
  --accent: #8a6d35;
  --accent-soft: rgba(138, 109, 53, 0.4);
  --field: rgba(255, 253, 247, 0.55);
  --field-shadow: inset 0 1px 2px rgba(60, 50, 30, 0.12), 0 1px 0 rgba(255, 255, 255, 0.65);
  --button: #23221f;
  --button-hover: #35332e;
  --button-ink: #f6f1e6;
  --button-shadow: 0 1px 0 rgba(255, 255, 255, 0.5), 0 6px 14px -6px rgba(35, 34, 31, 0.55);
  --card-shadow: 0 1px 2px rgba(60, 45, 20, 0.2), 0 22px 40px -18px rgba(60, 45, 20, 0.5);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #24231f;
  --paper-light: #e4e7ea;
  --glow: rgba(255, 240, 210, 0.05);
  --vignette: rgba(0, 0, 0, 0.32);
  --ink: #ece6d8;
  --ink-soft: #b3ad9f;
  --edge: rgba(236, 230, 216, 0.2);
  --emboss: rgba(0, 0, 0, 0.55);
  --accent: #d4b77c;
  --accent-soft: rgba(212, 183, 124, 0.45);
  --field: rgba(0, 0, 0, 0.2);
  --field-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 255, 255, 0.05);
  --button: #ece6d8;
  --button-hover: #fbf6ea;
  --button-ink: #23221f;
  --button-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7);
  --card-shadow: 0 1px 2px rgba(0, 0, 0, 0.5), 0 24px 44px -16px rgba(0, 0, 0, 0.8);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 21px;
  line-height: 1.55;
  background: var(--paper);
}

.defs {
  position: absolute;
}

/* ---------- Paper texture ---------- */

.paper {
  position: fixed;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
}

.paper feDiffuseLighting {
  lighting-color: var(--paper-light);
}

/* Lighting a dark colour flattens the grain, so dark mode lights a pale sheet
   and inverts it; --paper-light is the inverse of the colour you end up with */
:root[data-theme="dark"] .paper {
  filter: invert(1);
}

/* Soft falloff toward the corners, like light on an uneven sheet */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 35%, var(--glow), transparent 55%, var(--vignette) 100%);
}

/* ---------- Theme switch ---------- */

.theme {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  color: var(--ink-soft);
  background: var(--field);
  border: 1px solid var(--edge);
  border-radius: 50%;
  box-shadow: var(--field-shadow);
  cursor: pointer;
  transition: color 0.15s;
}

.theme:hover {
  color: var(--ink);
}

.theme svg {
  width: 18px;
  height: 18px;
}

/* Show the icon for the theme you would switch to */
.theme .sun,
:root[data-theme="dark"] .theme .moon {
  display: none;
}

:root[data-theme="dark"] .theme .sun {
  display: block;
}

/* ---------- Layout ---------- */

.page {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  align-items: center;
  gap: 72px;
  max-width: 1120px;
  min-height: 100vh;
  margin: 0 auto;
  padding: 72px 40px;
}

/* ---------- Text side ---------- */

.eyebrow {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

h1 {
  margin: 0 0 20px;
  font-family: var(--script);
  font-size: clamp(64px, 8vw, 104px);
  font-weight: 400;
  line-height: 1.05;
  text-shadow: 0 1px 0 var(--emboss);
}

.amp {
  color: var(--accent);
}

.lead {
  max-width: 30em;
  margin: 0 0 36px;
  color: var(--ink-soft);
  font-size: 23px;
}

.details {
  display: flex;
  gap: 48px;
  margin: 0 0 40px;
  padding: 24px 0;
  border-top: 1px solid var(--edge);
  border-bottom: 1px solid var(--edge);
}

.details dt {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.details dd {
  margin: 0;
  line-height: 1.4;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
}

.button {
  padding: 13px 40px;
  color: var(--button-ink);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-decoration: none;
  text-transform: uppercase;
  background: var(--button);
  border-radius: 999px;
  box-shadow: var(--button-shadow);
  transition: background-color 0.15s, transform 0.05s;
}

.button:hover {
  background: var(--button-hover);
}

.button:active {
  transform: translateY(1px);
}

.link {
  color: var(--ink);
  font-style: italic;
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 4px;
}

.link:hover {
  text-decoration-color: currentColor;
}

.theme:focus-visible,
.button:focus-visible,
.link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ---------- Invitation card ---------- */

.invite {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 0;
  justify-self: center;
  /* Card type is sized in cqw so the whole card scales as one piece */
  container-type: inline-size;
}

.card {
  aspect-ratio: 5 / 7;
  border-radius: 3px;
  box-shadow: var(--card-shadow);
}

.card-back {
  position: absolute;
  inset: 0;
  transform: rotate(-7deg) translate(-4%, 1%);
  background: var(--card-back);
}

.card-front {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 11cqw 9cqw;
  transform: rotate(2.5deg);
  color: var(--card-ink);
  text-align: center;
  background: linear-gradient(145deg, #fffdf8, var(--card) 45%, #f3eee2);
}

/* Double gold keyline */
.card-front::before,
.card-front::after {
  content: "";
  position: absolute;
  inset: 4cqw;
  pointer-events: none;
  border: 1px solid var(--gold);
}

.card-front::after {
  inset: 5.5cqw;
  opacity: 0.45;
}

.card-front p {
  margin: 0;
}

.sprig {
  width: 34cqw;
  height: 11cqw;
  margin-bottom: 3cqw;
  color: var(--card-back);
}

.card-small {
  font-size: 3.7cqw;
  font-style: italic;
  line-height: 1.45;
}

.card-names {
  padding: 3cqw 0 4cqw;
  font-family: var(--script);
  font-size: 14.5cqw;
  line-height: 1.1;
}

.card-names span {
  color: var(--gold);
}

.card-date {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 3.5cqw;
  width: 100%;
  margin: 5cqw 0 3cqw;
  font-size: 3.4cqw;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.card-date span {
  padding: 1.6cqw 0;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--gold);
}

.card-date strong {
  font-size: 11cqw;
  font-weight: 500;
  line-height: 1;
  letter-spacing: 0;
}

.card-venue {
  padding-top: 4cqw;
  font-size: 4.4cqw;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.08em;
}

.card-foot {
  padding-top: 5cqw;
  color: var(--gold);
  font-size: 3.1cqw;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

@media (prefers-reduced-motion: no-preference) {
  .card {
    transition: transform 0.4s ease;
  }

  .invite:hover .card-front {
    transform: rotate(0.5deg) translateY(-4px);
  }

  .invite:hover .card-back {
    transform: rotate(-9deg) translate(-6%, 1%);
  }
}

/* ---------- Small screens ---------- */

@media (max-width: 860px) {
  .page {
    grid-template-columns: 1fr;
    gap: 56px;
    padding: 80px 24px 64px;
    text-align: center;
  }

  .lead {
    margin-left: auto;
    margin-right: auto;
  }

  .details,
  .actions {
    justify-content: center;
  }

  .invite {
    max-width: 340px;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 19px;
  }

  .lead {
    font-size: 20px;
  }

  .details {
    flex-direction: column;
    gap: 20px;
  }
}
