:root {
  color-scheme: light;
  --background: #e9e1d2;
  --paper: #fbf7ee;
  --ink: #2a2730;
  --muted: #555060;
  --accent: #7a2632;
  --line: #cfc4b1;
  --serif: "Libre Caslon Text", Georgia, serif;
  --display: "Libre Caslon Display", Georgia, serif;
  --mono: "Courier Prime", monospace;
  --handwritten: "Homemade Apple", cursive;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--background); color: var(--ink); font: 400 17px/1.65 var(--serif); }
body::before { content: ""; position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0.05; background: url("assets/grain.svg"); mix-blend-mode: multiply; }
a { color: inherit; text-underline-offset: 4px; }
a:hover { color: var(--accent); }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 5px; }
img { display: block; max-width: 100%; }
figure, h1, h2, h3, p { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1; }
h1, h2, h3, p, a { overflow-wrap: anywhere; }
h2 { font-size: clamp(44px, 5vw, 64px); }
h3 { font-size: 28px; font-style: italic; font-weight: 400; line-height: 1.3; }
section { scroll-margin-top: 24px; }
.container { width: 100%; max-width: 1148px; margin-inline: auto; padding-inline: 24px; }
.eyebrow { font: 14px/1.6 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; }
.handwritten { font-family: var(--handwritten); font-weight: 400; }
.skip-link { position: absolute; top: -100px; left: 20px; z-index: 10; padding: 12px; background: var(--paper); }
.skip-link:focus { top: 12px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.site-header { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: center; justify-content: space-between; padding-block: 28px; font: 14px/1.5 var(--mono); }
.header-names { text-decoration: none; letter-spacing: 0.08em; text-transform: uppercase; }
.site-header nav { display: flex; flex-wrap: wrap; gap: 8px 28px; }
.site-header a { display: inline-flex; align-items: center; min-height: 44px; }
.hero { padding-top: 24px; padding-bottom: 72px; text-align: center; }
.envelope { position: relative; width: min(820px, 100%); margin: 36px auto 0; aspect-ratio: 16 / 10; background: #e0c9a2; box-shadow: 0 2px 3px rgb(42 39 48 / 15%), 0 40px 60px -30px rgb(42 39 48 / 50%); }
.envelope-folds { position: absolute; inset: 0; width: 100%; height: 100%; }
.wax-seal { color: var(--accent); width: 72px; height: 72px; }
.envelope > .wax-seal { position: absolute; left: 50%; top: 58%; width: 18%; height: auto; transform: translate(-50%, -50%) rotate(-8deg); }
.envelope-stamp { position: absolute; right: 5%; top: 7%; width: 16%; padding: 6px; border: 5px dotted #e0c9a2; background: var(--paper); transform: rotate(3deg); }
.hero-photo { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; filter: saturate(0.8) sepia(0.15); }
.envelope-stamp p { margin-top: 2px; font: 10px/1.2 var(--mono); text-align: right; }
.postmark { position: absolute; right: 11%; top: 16%; width: 24%; opacity: 0.6; font-family: var(--mono); }
.envelope-address { position: absolute; left: 8%; bottom: 9%; max-width: 70%; text-align: left; font: clamp(11px, 1.3vw, 16px)/1.6 var(--mono); }
h1 { margin-top: 56px; font-size: clamp(60px, 9vw, 116px); letter-spacing: -0.01em; }
h1 em { color: var(--accent); font: italic 0.6em/1 var(--serif); }
.wedding-date { margin-top: 18px; font-size: 22px; font-style: italic; }

.letter-section { padding-top: 24px; padding-bottom: 120px; }
.letter-paper { max-width: 864px; margin-inline: auto; padding: clamp(32px, 6vw, 72px); background: var(--paper); transform: rotate(-0.6deg); box-shadow: 0 1px 2px rgb(42 39 48 / 12%), 0 30px 50px -30px rgb(42 39 48 / 45%); }
.letter-date { text-align: right; font: 14px/1.6 var(--mono); }
.letter-salutation { margin-top: 36px; font-size: 28px; font-style: italic; }
.letter-message { font-size: 20px; line-height: 1.75; }
.letter-message p { margin-top: 20px; }
.letter-signoff { margin-top: 40px; font-size: 20px; font-style: italic; }
.letter-signature { margin-top: 6px; color: var(--accent); font-size: 30px; line-height: 1.5; }
.countdown { margin-top: 40px; padding-top: 20px; border-top: 1px dashed #bfb4a2; font: 15px/1.7 var(--mono); }
.countdown span { font-variant-numeric: tabular-nums; }

.couple-section { padding-bottom: 120px; text-align: center; }
.couple-portraits { display: flex; flex-wrap: wrap; justify-content: center; gap: 48px 80px; margin-top: 56px; }
.person { flex: 0 1 260px; min-width: 0; }
.portrait { padding: 10px; background: var(--paper); border: 8px dotted var(--background); transform: rotate(-2deg); box-shadow: 0 16px 28px -18px rgb(42 39 48 / 50%); }
.person--groom .portrait { transform: rotate(2deg); }
.portrait img { width: 100%; height: auto; aspect-ratio: 4 / 5; object-fit: cover; object-position: top; filter: saturate(0.85) sepia(0.1); }
.stamp-caption { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font: 12px/1.5 var(--mono); text-transform: uppercase; }
.person figcaption { margin-top: 24px; }
.person h3 { font-size: 30px; }
.person figcaption p { margin-top: 6px; color: var(--muted); font-size: 16px; }
.family { display: flex; flex-wrap: wrap; justify-content: center; gap: 32px; margin-top: 72px; padding-top: 40px; border-top: 1px solid #c9beab; }
.family-pair { flex: 1 1 240px; }
.family-pair .eyebrow { font-size: 13px; }
.family-pair h3 { margin-top: 6px; font-size: 24px; }

.story-section { padding-block: 104px 112px; background: #d8c19c; }
.story-section h2 { text-align: center; font-size: clamp(28px, 3.2vw, 40px); line-height: 1.6; }
.story-section .invitation-story-gallery { max-width: 1100px; margin-top: 48px; }
.story-section .invitation-story-gallery__grid { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: 48px 40px; padding: 8px; }
.story-section .invitation-story-gallery__photo { position: relative; flex: 0 1 380px; max-width: 100%; border-radius: 0; overflow: visible; transform: rotate(-1.5deg); }
.story-section .invitation-story-gallery__photo img { filter: saturate(0.8) sepia(0.12); }
.story-section .invitation-story-gallery__photo::after { content: ""; position: absolute; inset: -8px; pointer-events: none; background: linear-gradient(135deg, var(--ink) 50%, transparent 51%) top left, linear-gradient(225deg, var(--ink) 50%, transparent 51%) top right, linear-gradient(45deg, var(--ink) 50%, transparent 51%) bottom left, linear-gradient(315deg, var(--ink) 50%, transparent 51%) bottom right; background-size: 30px 30px; background-repeat: no-repeat; }
.story-section .invitation-story-gallery__photo:nth-child(2) { flex-basis: 280px; aspect-ratio: 4 / 5; margin-top: 40px; transform: rotate(2deg); }
.story-section .invitation-story-gallery__photo:nth-child(3) { flex-basis: 300px; aspect-ratio: 1; transform: rotate(1deg); }
.story-section .invitation-story-gallery__photo:nth-child(4) { flex-basis: 420px; transform: rotate(-2deg); }
.story-section .invitation-story-gallery__photo:nth-child(5) { flex-basis: 300px; aspect-ratio: 4 / 5; margin-top: 24px; transform: rotate(2.5deg); }
.story-video { margin-top: 40px; text-align: center; }

.events-section { max-width: 988px; padding-block: 112px; }
.events-section > h2, .events-date { text-align: center; }
.events-date { margin-top: 14px; }
.event-list { display: flex; flex-direction: column; gap: 24px; margin-top: 48px; }
.event-card { position: relative; display: grid; grid-template-columns: 200px minmax(0, 1fr); background: var(--paper); box-shadow: 0 16px 30px -22px rgb(42 39 48 / 50%); }
.event-stub { position: relative; padding: 28px 24px; border-right: 2px dashed var(--line); text-align: center; }
.event-stub::before { content: ""; position: absolute; right: -13px; top: -12px; width: 24px; height: 24px; border-radius: 50%; background: var(--background); }
.event-stub .eyebrow { font-size: 12px; }
.event-time { display: block; margin-top: 2px; color: var(--accent); font: 44px/1.1 var(--display); }
.event-date { margin-top: 10px; font: 13px/1.4 var(--mono); }
.event-details { min-width: 0; padding: 28px 32px; }
.event-details > p { margin-top: 6px; color: var(--muted); }
.event-description { font-size: 15px; }
.event-photo { grid-column: 1 / -1; width: 72%; height: auto; aspect-ratio: 7 / 4; object-fit: cover; filter: saturate(0.75) sepia(0.12); }
.event-card .invitation-navigation { justify-content: flex-start; gap: 8px 24px; font-family: var(--mono); }
.event-card .invitation-navigation a { padding: 0; border: 0; border-radius: 0; text-decoration: underline; }
.event-card .invitation-navigation a::before { content: "→"; margin-right: 5px; }

.rsvp-section { padding-top: 24px; padding-bottom: 112px; }
.postcard { padding: clamp(28px, 4vw, 48px); background: var(--paper); transform: rotate(0.5deg); box-shadow: 0 1px 2px rgb(42 39 48 / 12%), 0 36px 60px -34px rgb(42 39 48 / 50%); }
.rsvp-form { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; }
.postcard-message, .postcard-address { min-width: 0; }
.postcard .eyebrow { font-size: 13px; }
.postcard h2 { margin-top: 10px; font: italic 44px/1.1 var(--serif); }
.rsvp-intro, .rsvp-deadline, .guest-greeting { margin-top: 12px; color: var(--muted); font-size: 16px; }
.attendance-field { display: flex; flex-direction: column; gap: 10px; margin: 24px 0 0; padding: 0; border: 0; }
.attendance-field label { display: flex; align-items: center; gap: 12px; min-height: 44px; font-size: 19px; cursor: pointer; }
.attendance-field input { flex: 0 0 20px; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.postcard-address { display: flex; flex-direction: column; gap: 18px; padding-left: 40px; border-left: 1px solid var(--line); }
.postcard-stamp { align-self: flex-end; display: flex; align-items: center; justify-content: center; width: 84px; height: 100px; margin-bottom: 4px; border: 1.5px dashed #9c927f; color: var(--muted); font: 11px/1.4 var(--mono); text-transform: uppercase; }
.form-field { display: flex; flex-direction: column; }
.form-field[hidden] { display: none; }
.form-field > label { font: 12px/1.6 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; }
.form-field input, .form-field textarea { min-width: 0; max-width: 100%; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid #9c927f; border-radius: 0; background: transparent; color: var(--ink); font: 18px/1.6 var(--serif); }
.form-field input::placeholder, .form-field textarea::placeholder { color: #706a62; opacity: 1; }
.message-field { margin-top: 20px; }
.message-field textarea { margin-top: 4px; padding: 0; border: 0; background: repeating-linear-gradient(transparent 0 31px, var(--line) 31px 32px); font: 15px/32px var(--handwritten); resize: vertical; }
.submit-button { margin-top: 12px; min-height: 52px; padding: 14px; border: 0; background: var(--accent); color: var(--paper); font: 15px/1.5 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; }
.submit-button:hover { background: #5d1d27; }
.form-status { margin-bottom: 24px; padding: 16px; border: 1px solid #7a8560; }
.form-status--error { border-color: var(--accent); }
.form-feedback { font-size: 14px; }
.form-feedback:empty { display: none; }
.invitation-footer { padding-bottom: 72px; text-align: center; }
.invitation-footer .wax-seal { transform: rotate(10deg); }
.footer-names { margin-top: 8px; font-size: 28px; line-height: 1.6; }
.footer-note { margin-top: 14px; font-size: 16px; font-style: italic; }
.wedday-credit { display: inline-block; margin-top: 20px; font: 12px/1.5 var(--mono); }

@media (max-width: 760px) {
  .site-header { justify-content: center; gap: 8px; padding-block: 16px; text-align: center; }
  .site-header nav { justify-content: center; column-gap: 20px; }
  .header-names { width: 100%; justify-content: center; }
  .hero { padding-top: 24px; padding-bottom: 48px; }
  .envelope-stamp { padding: 3px; border-width: 3px; width: 18%; }
  .envelope-stamp p { font-size: 8px; }
  .envelope-address { bottom: 7%; max-width: 76%; font-size: 11px; line-height: 1.4; }
  h1 { margin-top: 40px; }
  .wedding-date { font-size: 18px; }
  .letter-section, .couple-section { padding-bottom: 72px; }
  .letter-paper { transform: none; }
  .letter-date { font-size: 12px; }
  .letter-salutation { font-size: 23px; }
  .letter-message { font-size: 17px; }
  .letter-signature { font-size: 24px; }
  .couple-portraits { gap: 36px; margin-top: 36px; }
  .person { flex-basis: 220px; }
  .family { margin-top: 48px; }
  .story-section { padding-block: 64px 72px; }
  .story-section .invitation-story-gallery__grid { gap: 32px; }
  .story-section .invitation-story-gallery__photo:nth-child(n) { flex-basis: min(380px, 90%); margin-top: 0; }
  .events-section { padding-block: 72px; }
  .event-card { grid-template-columns: 118px minmax(0, 1fr); }
  .event-stub { padding: 24px 12px; }
  .event-details { padding: 24px 20px; }
  .event-details h3 { font-size: 23px; }
  .event-details > p { font-size: 15px; }
  .event-photo { width: 100%; }
  .rsvp-section { padding-bottom: 72px; }
  .postcard { transform: none; }
  .rsvp-form { grid-template-columns: 1fr; gap: 28px; }
  .postcard h2 { font-size: 36px; }
  .postcard-address { padding: 28px 0 0; border: 0; border-top: 1px solid var(--line); }
  .postcard-stamp { width: 64px; height: 76px; }
}

@media (max-width: 420px) {
  .container { padding-inline: 20px; }
  .hero h1 { font-size: 56px; }
  .envelope { aspect-ratio: 1.45; }
  .envelope-address { font-size: 10px; }
  .letter-paper, .postcard { padding: 28px 22px; }
  .event-card { grid-template-columns: 90px minmax(0, 1fr); }
  .event-stub { padding: 24px 6px; }
  .event-time { font-size: 36px; }
  .event-date { font-size: 11px; }
  .event-details { padding: 24px 16px; }
}

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