/* ==========================================================================
   CONTENTS
   1. Fonts
   2. Design tokens
   3. Base / reset
   4. Typography & vertical rhythm
   5. Section color themes & links
   6. Header & navigation
   7. Sections & layout containers
   8. Split image / content layout
   9. Invitation section (incl. scroll cue)
   10. Travel section
   11. Plan section
   12. FAQ
   13. RSVP

   Mobile-first: base rules are the mobile styles; min-width: 768px layers
   on the desktop changes.
   ========================================================================== */

/* 1. FONTS ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Epilogue:ital,wght@0,100..900;1,100..900&family=La+Belle+Aurore&family=Merriweather:ital,opsz,wght@0,18..144,300..900;1,18..144,300..900&family=Space+Mono:ital,wght@0,400;0,700;1,400;1,700&display=swap');

@font-face {
  font-family: 'Baksoap';
  src: url('fonts/Baksoap.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* 2. DESIGN TOKENS ======================================================== */
:root {
  /* Colors */
  --paper: #eeeae2;
  --ink: #29251f;
  --sand: #e5c5a1;
  --pink: #d493a9;
  --light-pink: #e2b7c5;
  --red: #931f22;
  --deep-red: #56071c;
  --green: #625d25;
  --yellow: #e5cd83;

  /* Fonts */
  --font-display: 'Baksoap', serif;
  --font-invite: 'Space Mono', monospace;
  --font-subtitle: 'Epilogue', sans-serif;
  --font-body: 'Merriweather', serif;
  --font-cursive: 'La Belle Aurore', cursive;

  /* Type scale */
  --text-sm: 1.125rem;                                   /* travel list, desktop nav, location */
  --text-base: 1.25rem;                                  /* p */
  --text-md: clamp(1.5rem, 1.2rem + 1.5vw, 2rem);        /* h3, mobile nav, FAQ questions */
  --text-invite: clamp(1.75rem, 1.4rem + 2vw, 2.5rem);   /* request-line */
  --text-lg: clamp(2rem, 1.5rem + 2vw, 3rem);            /* h2 */
  --text-xl: clamp(2.25rem, 1.5rem + 3vw, 3.5rem);       /* date, section h1 */
  --text-display: clamp(3.25rem, 2rem + 5vw, 5rem);      /* invitation h1 */
  --text-script: clamp(1.6rem, 0.85rem + 3.2vw, 3.5rem); /* decorative cursive */
  --text-logo: clamp(24px, 6vw, 48px);

  /* Layout */
  --page-padding: 3%;
  --header-height: 92px; /* sticky header height: anchor offset + invitation height */
}

/* 3. BASE / RESET ========================================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  font-family: var(--font-body);
}

/* 4. TYPOGRAPHY & VERTICAL RHYTHM ========================================= */
p {
  font-size: var(--text-base);
  line-height: 1.6;
}

section h1 {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 400; /* Baksoap has one weight; avoids a faked bold */
  line-height: 1.1;
}

section h2 {
  font-family: var(--font-subtitle);
  font-size: var(--text-lg);
  font-weight: 600;
  line-height: 1.2;
}

section h3 {
  font-family: var(--font-subtitle);
  font-size: var(--text-md);
  font-weight: 500;
  line-height: 1.3;
}

.ampersand {
  display: inline-block; /* required for transform */
  font-family: var(--font-display);
  font-size: var(--text-display);
  color: var(--paper);
  transform: rotate(-10deg);
}

/* Space between a heading and the paragraph under it */
section h3 + p {
  margin-top: 0.25rem;
}

section p + p {
  margin-top: 0.5rem;
}

/* Space before the next heading that follows a paragraph or list */
section p + h3,
section ul + h3 {
  margin-top: 1rem;
}

/* 5. SECTION COLOR THEMES & LINKS ========================================= */
/* Sections cycle through themes; each rule only sets two tokens. */
section {
  background: var(--section-bg);
  color: var(--section-fg);
  --link-color: var(--section-fg);
}

section:nth-child(4n + 1) {
  --section-bg: var(--red);
  --section-fg: var(--light-pink);
}

section:nth-child(4n + 2) {
  --section-bg: var(--pink);
  --section-fg: var(--deep-red);
}

section:nth-child(4n + 3) {
  --section-bg: var(--green);
  --section-fg: var(--yellow);
}

section:nth-child(4n + 4) {
  --section-bg: var(--yellow);
  --section-fg: var(--deep-red);
}

section:nth-child(4n + 5) {
  --section-bg: var(--deep-red);
  --section-fg: var(--yellow);
}

section a {
  color: var(--link-color);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 6px;
  font-weight: 700;
  font-style: italic;
}

section a:not(.scroll-cue)::after {
  content: "";
  display: inline-block;
  width: 0.75em;
  height: 0.75em;
  margin-left: 0.15em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19 19 5M8 5h11v11' stroke='black' fill='none' stroke-width='3'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 19 19 5M8 5h11v11' stroke='black' fill='none' stroke-width='3'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform 150ms ease;
}

section a:hover::after {
  transform: translate(0.1em, -0.1em);
}

/* 6. HEADER & NAVIGATION ================================================== */
.header {
  position: sticky;
  top: 0;
  z-index: 100;

  display: flex;
  align-items: center;
  justify-content: space-between;

  padding: 22px var(--page-padding);
  background: var(--paper);
}

.logo {
  color: var(--red);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: var(--text-logo);
  letter-spacing: 0.04em;
}

/* Visually hidden, but still focusable/toggleable by its label */
.menu-checkbox {
  position: absolute;
  opacity: 0;
}

/* Hamburger button */
.menu-button {
  z-index: 102; /* above the open overlay */
  width: 54px;
  height: 48px;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 6px;

  cursor: pointer;
}

.menu-button span {
  width: 34px;
  height: 2px;
  background: var(--red);
  transition:
    transform 0.4s cubic-bezier(0.65, 0, 0.35, 1),
    opacity 0.25s ease;
}

.menu-checkbox:focus-visible + .menu-button {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}

/* Hamburger -> X (8px = span height 2px + gap 6px) */
.menu-checkbox:checked + .menu-button span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

.menu-checkbox:checked + .menu-button span:nth-child(2) {
  opacity: 0;
}

.menu-checkbox:checked + .menu-button span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

/* Mobile: full-screen overlay navigation */
.navigation {
  position: fixed;
  inset: 0;
  z-index: 101;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2rem;

  background-color: var(--paper);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 0.5s ease,
    visibility 0s linear 0.5s;

  counter-reset: nav;
}

.menu-checkbox:checked ~ .navigation {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition:
    opacity 0.5s ease,
    visibility 0s linear 0s;
}

.nav-item {
  color: var(--green);
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 2rem;
}

.navigation a {
  counter-increment: nav;
}

.navigation a::before {
  content: counter(nav, decimal-leading-zero);
  margin-right: 1.25rem;
  font-size: 0.65em;
  font-weight: 400;
  vertical-align: 0.15em;
  opacity: 0.85;
}

/* Desktop: inline navigation */
@media (min-width: 768px) {
  .menu-checkbox,
  .menu-button {
    display: none;
  }

  .navigation {
    position: static;
    z-index: auto;
    flex-direction: row;
    justify-content: flex-end;
    gap: 32px;

    background: transparent;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: none;
  }

  .navigation a::before {
    content: none;
  }

  .nav-item {
    color: var(--red);
    font-family: var(--font-subtitle);
    font-size: var(--text-sm);
    font-weight: 500;
  }
}

/* 7. SECTIONS & LAYOUT CONTAINERS ========================================= */
section[id] {
  scroll-margin-top: var(--header-height);
  min-height: 100vh;
  padding: 2.5rem var(--page-padding);
}

section[id]:not(.invitation) h2 {
  padding-top: clamp(1.5rem, 4vw, 2.5rem);
  padding-bottom: clamp(0.75rem, 2vw, 1.25rem);
}

.section-container {
  width: 100%;
  padding-inline: 1rem;
}

.section-container > h1 {
  align-self: center;
  text-align: center;
}

@media (min-width: 768px) {
  section[id] {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
  }

  section h1 {
    align-self: center;
  }

  .section-container {
    width: 75%;
    align-self: center;
  }
}

/* 8. SPLIT IMAGE / CONTENT LAYOUT ========================================= */
.split-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "image content"
                       "image aside";
  gap: 0 2rem;
  width: 100%;
}

.split-heading {
  grid-area: heading;
}

.split-image {
  grid-area: image;
  position: relative;
  margin-top: calc(clamp(1.5rem, 4vw, 2.5rem) + 0.5rem);
}

.split-image img {
  display: block;
  position: absolute; /* the text column sets the height */
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
}

.split-content {
  grid-area: content;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  align-self: start;
  gap: 2rem;
  text-align: left;
}

.split-aside {
  grid-area: aside;
}

@media (max-width: 1199px) {
  .split-layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "heading"
      "content"
      "image"
      "aside";
    gap: 1rem;
    margin-bottom: 1.5rem;
  }

  .split-image {
    margin-top: 0;
  }

  .split-image img {
    position: static;
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: 400px;
  }

  .split-content {
    gap: 0.5rem;
  }
}

/* Phones: center the stacked photo */
@media (max-width: 767px) {
  .split-image {
    display: flex;
    justify-content: center;
  }
}

/* 9. INVITATION SECTION =================================================== */
.invitation {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.invitation::before,
.invitation::after {
  content: "";
  position: absolute;
  z-index: 2;
  border: 1px solid var(--light-pink);
  pointer-events: none;
}

.invitation::before {
  inset: 12px;
}

.invitation::after {
  inset: 22px;
  border-color: color-mix(in srgb, var(--light-pink) 65%, transparent);
}

.invitation > * {
  text-align: center;
}

.invitation h1 {
  position: relative;
  z-index: 3;
  margin-top: 2.5rem;
  color: var(--light-pink);
  font-size: var(--text-display);
  letter-spacing: 0.08em;
  transform: rotate(-1deg);
}

.invitation h2 {
  font-family: var(--font-body);
}

.decorator {
  position: absolute;
  z-index: -1;
  left: 50%;

  width: max-content;

  font-family: var(--font-cursive);
  font-size: var(--text-script);
  line-height: 1;
  color: var(--paper);
  opacity: 0.35;
  white-space: nowrap;
  pointer-events: none;

  --decorator-drop: 0.9em;
  transform: translate(-50%, var(--decorator-drop)) rotate(-4deg);
}

.invitation p {
  font-family: var(--font-invite);
  color: var(--sand);
  text-transform: uppercase;
}

.invite-details {
  margin-top: 2.8rem;
}

.request-line {
  font-size: var(--text-invite);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.invitation .date {
  font-size: var(--text-xl);
  font-weight: 700;
}

.invitation .location {
  font-size: var(--text-sm);
}

/* Fill the visible screen under the sticky header. Phones leave a sliver
   of the next section showing as a hint to scroll. */
section[id].invitation {
  min-height: calc(100svh - var(--header-height) - 0.5rem);
}

/* Scroll cue (phones only) */
.scroll-cue {
  position: absolute;
  bottom: .7rem;
  left: 50%;
  translate: -50% 0;

  display: grid;
  justify-items: center;
  gap: 0.25rem;

  color: var(--light-pink);
  font-family: var(--font-subtitle);
  font-size: var(--text-sm);
  text-decoration: none;
}

.scroll-cue svg {
  animation: scroll-nudge 1.6s ease-in-out infinite;
}

@keyframes scroll-nudge {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(0.4rem); }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue svg {
    animation: none;
  }
}

@media (min-width: 768px) {
  .invitation::after {
    inset: 26px;
  }

  .invitation > * {
    align-self: center;
  }

  .invitation h1 {
    font-size: clamp(4rem, 2.3rem + 6.5vw, 6.3rem)
  }

  .ampersand {
    font-size: clamp(4.2rem, 2.8rem + 6.8vw, 6.8rem);
  }

  .decorator {
    --decorator-drop: 2.2em;
  }

  .invitation .location {
    font-size: var(--text-md);
  }

  section[id].invitation {
    min-height: calc(100svh - var(--header-height));
  }

  .request-line {
    margin-top: 2rem;
  }

  .scroll-cue {
    display: none;
  }
}

/* 10. TRAVEL SECTION ====================================================== */
.travel ul {
  margin-left: 1rem;
  padding-left: 1rem;
  font-size: var(--text-base);
  line-height: 1.6;
}

section[id].travel p + h3 {
  padding-top: clamp(1.25rem, 2vw, 2rem);
}

@media (min-width: 768px) {
  .travel ul {
    padding-left: 1.4rem;
  }
}

@media (max-width: 768px) {
  section[id].travel ul + h3 {
    padding-top: clamp(1.25rem, 2.3vw, 2rem);
  }
}

/* 11. PLAN SECTION ======================================================== */
.plan-list {
  display: grid;
  gap: 1.5rem;
}

@media (min-width: 768px) {
  .plan-list {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column; /* fills the left column first, then the right */
    gap: 2rem 3rem;

    width: min(100%, 52rem);
    margin-inline: auto;
  }

  .plan-item:nth-child(1),
  .plan-item:nth-child(2) {
    text-align: left;
    justify-self: start;
  }

  .plan-item:nth-child(3),
  .plan-item:nth-child(4) {
    text-align: right;
    justify-self: end;
  }
}

/* 12. FAQ ================================================================= */
.faq-item {
  border-bottom: 1px solid var(--yellow);
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item h2 {
  position: relative;
  padding: 24px 40px 24px 0;
  font-size: var(--text-md);
  cursor: pointer;
}

section[id].faq {
  min-height: auto;
}

/* Plus / minus icon */
.faq-item h2::before,
.faq-item h2::after {
  content: "";
  position: absolute;
  right: 1rem;
  top: 50%;
  width: 16px;
  height: 3px;
  background: currentColor;
  transition: transform 0.3s ease;
}

.faq-item h2::before {
  transform: rotate(90deg);
}

.faq-item.active h2::before {
  transform: rotate(0deg);
}

.faq-answer {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.4s ease, opacity 0.3s ease;
}

.faq-answer p {
  overflow: hidden;
  min-height: 0;
  margin: 0;
  padding-bottom: 0;
  transition: padding 0.4s ease;
}

.faq-item.active .faq-answer {
  grid-template-rows: 1fr;
  opacity: 1;
}

.faq-item.active .faq-answer p {
  padding-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .faq-item h2 {
    font-size: var(--text-lg);
  }

  section[id].faq {
    min-height: 100vh;
  }
}

/* 13. RSVP ================================================================ */
.rsvp-screen {
  align-self: center;
  width: min(100%, 36rem);
  margin: clamp(1.5rem, 4vw, 2.5rem) auto 0;
}

.rsvp-screen > div {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;

  padding: clamp(1.75rem, 5vw, 3rem);
  border: 1px solid color-mix(in srgb, var(--section-fg) 25%, transparent);
  border-radius: 1.25rem;
  background: color-mix(in srgb, var(--paper) 55%, transparent);
  box-shadow: 0 1.5rem 3rem -2rem color-mix(in srgb, var(--section-fg) 45%, transparent);

  text-align: center;
  animation: rsvp-fade-in 0.35s ease both;
}

@keyframes rsvp-fade-in {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .rsvp-screen > div {
    animation: none;
  }
}

section[id]:not(.invitation) .rsvp-screen h2 {
  padding: 0;
  font-size: clamp(1.75rem, 1.4rem + 1.5vw, 2.5rem);
}

.rsvp-screen h3 {
  font-size: clamp(1.25rem, 1.1rem + 0.75vw, 1.6rem);
}

.rsvp-screen p {
  font-size: 1.05rem;
}

.rsvp-screen form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.name-fields {
  display: grid;
  gap: 1rem;
}

@media (min-width: 540px) {
  .name-fields {
    grid-template-columns: 1fr 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  text-align: left;
}

.rsvp-screen label {
  font-family: var(--font-subtitle);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

.rsvp-screen input,
.rsvp-screen textarea {
  width: 100%;
  padding: 0.8rem 1rem;

  border: 1px solid color-mix(in srgb, var(--section-fg) 40%, transparent);
  border-radius: 0.6rem;
  background: var(--paper);
  color: var(--ink);

  font: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rsvp-screen textarea {
  min-height: 6rem;
  resize: vertical;
}

.rsvp-screen input:focus,
.rsvp-screen textarea:focus {
  outline: none;
  border-color: var(--section-fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--section-fg) 25%, transparent);
}

.rsvp-screen .form-error {
  margin: 0;
  padding: 0.75rem 1rem;
  border-radius: 0.6rem;
  background: color-mix(in srgb, var(--red) 12%, transparent);
  color: var(--red);
  font-size: 0.95rem;
  text-align: left;
}

.rsvp-screen button,
.back-button {
  font-family: var(--font-subtitle);
  font-size: 1.05rem;
  cursor: pointer;
  transition:
    background-color 0.2s ease,
    color 0.2s ease,
    border-color 0.2s ease,
    transform 0.1s ease;
}

.rsvp-screen button {
  padding: 0.85rem 1.75rem;
  border: 1.5px solid var(--section-fg);
  border-radius: 999px;
}

.rsvp-screen button:active:not(:disabled) {
  transform: translateY(1px);
}

.rsvp-screen button:focus-visible,
.back-button:focus-visible {
  outline: 2px solid var(--section-fg);
  outline-offset: 3px;
}

.rsvp-screen button:disabled {
  opacity: 0.55;
  cursor: wait;
}

.primary-button {
  background: var(--section-fg);
  color: var(--section-bg);
}

.primary-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--section-fg) 85%, black);
}

.secondary-button,
.choice-button {
  background: transparent;
  color: var(--section-fg);
}

.secondary-button:hover:not(:disabled),
.choice-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--section-fg) 10%, transparent);
}

.rsvp-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
}

.rsvp-actions button {
  flex: 1 1 12rem;
}

.guest-response {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;

  padding: 1rem 0;
  border-bottom: 1px solid color-mix(in srgb, var(--section-fg) 20%, transparent);
  text-align: left;
}

.guest-response:first-of-type {
  border-top: 1px solid color-mix(in srgb, var(--section-fg) 20%, transparent);
}

.rsvp-screen .guest-name {
  font-family: var(--font-subtitle);
  font-size: 1.15rem;
}

.choice-group {
  display: flex;
  gap: 0.5rem;
}

.rsvp-screen .choice-button {
  padding: 0.5rem 1.1rem;
  font-size: 0.95rem;
}

.rsvp-screen .choice-button.selected {
  background: var(--section-fg);
  color: var(--section-bg);
}

.guest-details {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid color-mix(in srgb, var(--section-fg) 20%, transparent);
  text-align: left;
}

.rsvp-summary {
  display: grid;
  gap: 0.25rem;
  padding: 1.25rem;
  border-radius: 0.75rem;
  background: color-mix(in srgb, var(--paper) 60%, transparent);
}

.rsvp-summary h3:not(:first-child) {
  margin-top: 0.75rem;
}

.back-button {
  display: block;
  align-self: center;
  margin: 1.25rem auto 0;
  padding: 0.5rem 1rem;
  border: none;
  background: none;
  color: var(--section-fg);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

.back-button:hover {
  text-decoration-thickness: 2px;
}

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