:root {
  --ink: #171513;
  --paper: #f4efc9;
  --paper-light: #fffbe2;
  --peach: #e2ba92;
  --peach-deep: #ca956c;
  --gray: #858278;
  --gray-dark: #4f4c46;
  --line: rgba(31, 29, 27, 0.58);
  --shadow: 0 22px 48px rgba(69, 57, 37, 0.19), 0 4px 12px rgba(69, 57, 37, 0.13);
  --display: "Fraunces", Georgia, serif;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  color-scheme: light;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--mono);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 12% 20%, rgba(255, 255, 255, 0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 78%, rgba(80, 68, 45, 0.09) 0 1px, transparent 2px),
    repeating-linear-gradient(7deg, rgba(93, 78, 49, 0.025) 0 1px, transparent 1px 7px),
    repeating-linear-gradient(97deg, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 11px),
    linear-gradient(92deg, rgba(255, 255, 255, 0.22), transparent 32%, rgba(124, 106, 72, 0.06));
  background-size: 22px 22px, 29px 29px, 100% 100%, 100% 100%, 100% 100%;
  overflow-x: hidden;
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.skip-link {
  position: fixed;
  top: 0;
  left: 50%;
  z-index: 100;
  transform: translate(-50%, -140%);
  padding: 0.75rem 1rem;
  background: var(--ink);
  color: var(--paper-light);
}

.skip-link:focus {
  transform: translate(-50%, 0.5rem);
}

.paper-nav {
  position: relative;
  z-index: 10;
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.1rem 0 0.75rem;
}

.paper-nav nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: clamp(0.45rem, 2vw, 1.1rem);
}

.paper-nav-group {
  display: flex;
  align-items: center;
  gap: clamp(0.45rem, 2vw, 1.1rem);
}

.paper-nav a {
  display: inline-flex;
  min-height: 2.65rem;
  align-items: center;
  justify-content: center;
  padding: 0.55rem clamp(0.75rem, 2.8vw, 1.25rem) 0.45rem;
  color: var(--ink);
  font-size: clamp(0.76rem, 2.2vw, 0.92rem);
  font-weight: 700;
  text-decoration: none;
  box-shadow: 3px 4px 0 rgba(89, 76, 55, 0.18);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.paper-nav .nav-invitation {
  background: rgba(255, 255, 255, 0.78);
  transform: rotate(-1.2deg);
}

.paper-nav .nav-rsvp {
  background: rgba(226, 186, 146, 0.96);
  transform: rotate(0.8deg);
}

.paper-nav .nav-registry {
  background: rgba(133, 130, 120, 0.72);
  transform: rotate(-0.55deg);
}

.paper-nav a:hover {
  transform: translateY(-2px) rotate(0deg);
  box-shadow: 5px 6px 0 rgba(89, 76, 55, 0.2);
}

.paper-nav a:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.topbar {
  position: relative;
  z-index: 10;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.3rem 0.25rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.95rem;
}

.wordmark,
.topbar nav a {
  text-decoration: none;
}

.wordmark {
  padding: 0.45rem 0.65rem 0.35rem;
  background: rgba(232, 198, 164, 0.8);
  transform: rotate(-1.2deg);
  font-weight: 700;
}

.wordmark span {
  display: inline-block;
  padding: 0 0.2rem;
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 1.2rem;
}

.topbar nav a {
  border-bottom: 1px solid transparent;
  padding: 0.35rem 0;
}

.topbar nav a:hover,
.topbar nav a:focus-visible {
  border-bottom-color: currentColor;
}

main {
  width: 100%;
}

.invitation-section {
  position: relative;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem) 0 clamp(5rem, 10vw, 8.5rem);
}

.intro-copy {
  max-width: 700px;
  margin: 0 auto clamp(1.6rem, 4vw, 2.8rem);
  text-align: center;
}

.eyebrow {
  width: fit-content;
  margin: 0 auto 0.75rem;
  padding: 0.35rem 0.65rem 0.25rem;
  background: rgba(151, 149, 139, 0.5);
  font-size: 0.88rem;
  line-height: 1;
  transform: rotate(-1deg);
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-family: var(--display);
  margin-bottom: 1rem;
  font-size: clamp(2rem, 7vw, 4.85rem);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.07em;
}

.date-strip {
  width: fit-content;
  margin: 0 auto;
  padding: 0.45rem 0.8rem 0.35rem;
  background: rgba(255, 255, 255, 0.55);
  font-size: clamp(0.82rem, 2vw, 1rem);
  transform: rotate(0.7deg);
}

.invitation-shell {
  position: relative;
  z-index: 1;
  width: min(760px, 86vw);
  margin: 0 auto;
  perspective: 1900px;
}

.flip-card {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  perspective: inherit;
}

.flip-card-inner {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform 900ms cubic-bezier(0.2, 0.75, 0.22, 1);
  filter: drop-shadow(var(--shadow));
}

.flip-card.is-flipped .flip-card-inner {
  transform: rotateY(180deg);
}

.card-face {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-face img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.card-back {
  transform: rotateY(180deg);
}

.flip-card:focus-visible,
.flip-control:focus-visible,
.submit-button:focus-visible,
.registry-button:focus-visible,
.paper-link:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 4px;
}

.flip-control {
  position: absolute;
  right: -7.5rem;
  top: 50%;
  display: flex;
  width: 6.5rem;
  flex-direction: column;
  align-items: center;
  gap: 0.55rem;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.2;
  text-align: center;
  transform: translateY(-50%) rotate(1.5deg);
}

.flip-control svg {
  width: 2.5rem;
  height: 2.5rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 350ms ease;
}

.flip-control:hover svg {
  transform: rotate(24deg);
}

.quick-links {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(1rem, 4vw, 3.2rem);
  width: min(880px, 92%);
  margin: -1rem auto 0;
}

.paper-link {
  display: flex;
  min-height: 7rem;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1.3rem;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 12px 28px rgba(69, 57, 37, 0.12);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.paper-link:hover {
  transform: translateY(-4px) rotate(0deg);
  box-shadow: 0 18px 36px rgba(69, 57, 37, 0.16);
}

.paper-link span {
  font-size: clamp(1.2rem, 3vw, 1.65rem);
  font-weight: 700;
}

.paper-link small {
  font-size: 0.85rem;
}

.paper-link-location {
  background: rgba(151, 149, 139, 0.58);
  transform: rotate(-1.5deg);
}

.paper-link-rsvp {
  background: rgba(232, 198, 164, 0.88);
  transform: rotate(1deg);
}

.rsvp-section {
  position: relative;
  padding: clamp(5rem, 10vw, 8rem) 1rem clamp(5rem, 10vw, 8rem);
  background-color: var(--peach);
  background-image:
    radial-gradient(circle at 18% 30%, rgba(255,255,255,0.28) 0 1px, transparent 2px),
    linear-gradient(100deg, transparent, rgba(255,255,255,0.14) 43%, transparent 70%);
  background-size: 27px 27px, 100% 100%;
  border-top: 1px solid rgba(31, 29, 27, 0.15);
  border-bottom: 1px solid rgba(31, 29, 27, 0.15);
}

.rsvp-section::before,
.rsvp-section::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 12px;
  opacity: 0.28;
  background: repeating-linear-gradient(92deg, transparent 0 19px, rgba(31,29,27,0.35) 20px 21px, transparent 22px 33px);
}

.rsvp-section::before {
  top: -6px;
}

.rsvp-section::after {
  bottom: -6px;
}

.section-heading,
.rsvp-form,
.registry-note {
  width: min(760px, 100%);
  margin-left: auto;
  margin-right: auto;
}

.section-heading {
  position: relative;
  z-index: 1;
  margin-bottom: 2.5rem;
  text-align: center;
}

.section-heading h2,
.registry-note h2 {
  font-family: var(--display);
  margin-bottom: 0;
  font-size: clamp(2rem, 6vw, 4rem);
  font-weight: 400;
  line-height: 1.02;
  letter-spacing: -0.065em;
}

#rsvp-title {
  font-family: var(--mono);
  letter-spacing: -0.035em;
}

.rsvp-form {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.3rem;
  padding: clamp(1.2rem, 4vw, 2.8rem);
  background: rgba(255, 251, 226, 0.86);
  border: 1px solid rgba(23, 21, 19, 0.45);
  box-shadow: 12px 14px 0 rgba(104, 96, 79, 0.18);
  transform: rotate(-0.25deg);
}

.full-width {
  grid-column: 1 / -1;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.field label,
.field legend {
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: lowercase;
}

.field label span {
  font-weight: 400;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 0.75rem 0.2rem 0.6rem;
  background: rgba(255, 255, 255, 0.35);
  color: var(--ink);
  font-size: 1rem;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #514b42;
  opacity: 1;
}

.field select {
  min-height: 3rem;
}

.field textarea {
  resize: vertical;
  min-height: 7rem;
}

.attendance-field {
  margin: 0;
  border: 0;
  padding: 0;
}

.attendance-field legend {
  margin-bottom: 0.65rem;
}

.radio-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.radio-group-three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.radio-group label {
  position: relative;
  cursor: pointer;
}

.radio-group input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-group label > span {
  display: flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  padding: 0.7rem 0.8rem;
  text-align: center;
  transition: background-color 180ms ease, color 180ms ease;
}

.response-face {
  display: none;
  margin-left: 0.45rem;
  font-size: 1rem;
  line-height: 1;
}

.attendance-field input:checked + span .response-face {
  display: inline;
}

.radio-group input:checked + span {
  background: var(--ink);
  color: var(--paper-light);
}

.radio-group input:focus-visible + span {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.field.is-disabled {
  opacity: 0.58;
}

.form-footer {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-wrap: wrap;
}

.submit-button,
.calendar-button,
.registry-button {
  display: inline-flex;
  min-height: 3.2rem;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  padding: 0.75rem 1.2rem 0.65rem;
  background: var(--ink);
  color: var(--paper-light);
  text-decoration: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.submit-button:hover,
.calendar-button:hover,
.registry-button:hover {
  transform: translate(-2px, -2px);
  box-shadow: 4px 4px 0 var(--gray-dark);
}

.calendar-button {
  background: var(--peach);
  color: var(--ink);
}

.calendar-button[hidden] {
  display: none;
}

.submit-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.form-status {
  flex: 1;
  min-width: 14rem;
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.45;
}

.registry-section {
  position: relative;
  padding: clamp(5rem, 11vw, 9rem) 1rem;
}

.registry-note {
  position: relative;
  z-index: 1;
  padding: clamp(2rem, 6vw, 4.5rem);
  background: rgba(255, 255, 255, 0.58);
  text-align: center;
  box-shadow: 9px 12px 0 rgba(151, 149, 139, 0.32);
  transform: rotate(0.45deg);
}

/* Screen-printed motifs live in existing margins and section padding. */
.floral-sprinkles {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
}

.sprinkle {
  position: absolute;
  display: block;
  width: clamp(3.5rem, 7vw, 6.5rem);
  height: auto;
  opacity: 0.88;
}

.invitation-flower-1 { top: 7%; left: 3%; transform: rotate(-19deg); }
.invitation-flower-2 { top: 23%; right: 4%; width: 4.4rem; transform: rotate(21deg); }
.invitation-flower-3 { top: 43%; left: 5%; width: 5.5rem; transform: rotate(-33deg); }
.invitation-flower-4 { top: 62%; right: 3%; width: 5rem; transform: rotate(37deg); }
.invitation-flower-5 { bottom: 0.6rem; left: 11%; width: 4.2rem; transform: rotate(16deg); }
.invitation-flower-6 { bottom: 0.8rem; right: 11%; width: 5rem; transform: rotate(-28deg); }

.rsvp-flower-1 { top: 0.6rem; left: 9%; width: 4.5rem; transform: rotate(-27deg); }
.rsvp-flower-2 { top: 0.3rem; right: 8%; width: 5.4rem; transform: rotate(24deg); }
.rsvp-flower-3 { bottom: 0.6rem; left: 15%; width: 4.4rem; transform: rotate(31deg); }
.rsvp-flower-4 { bottom: 0.5rem; right: 14%; width: 4.5rem; transform: rotate(-18deg); }

.registry-flower-1 { top: 19%; left: max(2%, calc(50% - 34rem)); width: 5rem; transform: rotate(-23deg); }
.registry-flower-2 { top: 12%; right: max(2%, calc(50% - 35rem)); width: 5rem; transform: rotate(24deg); }
.registry-flower-3 { bottom: 0.8rem; right: 17%; width: 4rem; transform: rotate(-35deg); }

@media (max-width: 1180px) {
  .invitation-flower-1,
  .invitation-flower-2,
  .invitation-flower-3,
  .invitation-flower-4 {
    display: none;
  }
}

.registry-note::before {
  content: "";
  position: absolute;
  top: -1.2rem;
  left: 50%;
  width: 9rem;
  height: 2.4rem;
  background: rgba(232, 198, 164, 0.68);
  transform: translateX(-50%) rotate(-1.8deg);
}

.registry-note p:not(.eyebrow) {
  max-width: 560px;
  margin: 1.4rem auto 1.8rem;
  font-size: 1rem;
  line-height: 1.65;
}

.registry-button {
  gap: 0.7rem;
}

footer {
  display: flex;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 1.5rem 0.25rem 2.2rem;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid rgba(31, 29, 27, 0.25);
  font-size: 0.78rem;
}

footer p {
  margin: 0;
}

footer a {
  overflow-wrap: anywhere;
}

@media (max-width: 1040px) {
  .invitation-shell {
    width: min(760px, 82vw);
  }

  .flip-control {
    right: -4.8rem;
    width: 4.3rem;
  }
}

@media (max-width: 760px) {
  .invitation-flower-5,
  .invitation-flower-6 {
    width: 3.2rem;
  }

  .rsvp-sprinkles .sprinkle,
  .registry-sprinkles .sprinkle {
    width: 2.3rem;
  }

  .rsvp-flower-1 { left: 8%; }
  .rsvp-flower-2 { right: 8%; }
  .rsvp-flower-3 { left: 12%; }
  .rsvp-flower-4 { right: 12%; }
  .registry-flower-1 { top: 0.5rem; left: 12%; }
  .registry-flower-2 { top: 0.4rem; right: 13%; }
  .registry-flower-3 { bottom: 0.5rem; right: 20%; }

  .topbar {
    align-items: flex-start;
  }

  .topbar nav {
    gap: 0.8rem;
  }

  h1 {
    letter-spacing: -0.055em;
  }

  .invitation-shell {
    width: 100%;
    padding-bottom: 4.5rem;
  }

  .flip-control {
    top: auto;
    right: 50%;
    bottom: 0;
    width: auto;
    flex-direction: row;
    transform: translateX(50%) rotate(0.5deg);
  }

  .flip-control svg {
    width: 2rem;
    height: 2rem;
  }

  .quick-links {
    width: 100%;
    margin-top: 0;
  }

  .rsvp-form {
    grid-template-columns: 1fr;
  }

  .full-width {
    grid-column: auto;
  }

  footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 520px) {
  .paper-nav {
    width: calc(100% - 1rem);
    padding-top: 0.75rem;
  }

  .paper-nav nav {
    gap: 0.35rem;
  }

  .paper-nav-group {
    gap: 0.35rem;
  }

  .paper-nav a {
    min-height: 2.5rem;
    padding-left: 0.6rem;
    padding-right: 0.6rem;
  }

  .invitation-section {
    width: calc(100% - 0.75rem);
  }

  .rsvp-form {
    gap: 1rem;
    padding: 1rem;
  }

  .radio-group label > span {
    min-height: 2.95rem;
    padding: 0.6rem 0.7rem;
  }

  .submit-button {
    min-height: 3rem;
  }

  .topbar {
    font-size: 0.76rem;
  }

  .wordmark {
    max-width: 9.5rem;
  }

  .intro-copy {
    margin-bottom: 1.2rem;
  }

  .quick-links {
    grid-template-columns: 1fr;
    gap: 0.8rem;
  }

  .paper-link {
    min-height: 5.5rem;
  }

  .radio-group {
    grid-template-columns: 1fr;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .form-status {
    min-width: 0;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
  }
}
