/* ============================================================
   Design tokens
   ============================================================ */
:root {
  --cream:      #F5EDD8;
  --soot:       #1C1A17;
  --soot-soft:  #2A2724;
  --oxblood:    #8B1A1A;
  --rule:       rgba(28, 26, 23, 0.18);

  --font-display:     "IM Fell DW Pica SC", "Cormorant Garamond", Georgia, serif;
  --font-blackletter: "UnifrakturCook", "IM Fell DW Pica SC", serif;
  --font-body:        "EB Garamond", Georgia, "Times New Roman", serif;

  --measure: 64ch;
  --frame-max: 1100px;
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --section-gap: clamp(3rem, 8vw, 6rem);
}

/* ============================================================
   Base
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--cream);
  color: var(--soot-soft);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 1024px) {
  body { font-size: 19px; }
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--soot);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.2em;
  transition: text-decoration-color 200ms ease, color 200ms ease;
}
a:hover { text-decoration-color: var(--soot); }

button { font: inherit; cursor: pointer; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus {
  left: 1rem; top: 1rem; width: auto; height: auto;
  background: var(--soot); color: var(--cream);
  padding: 0.5rem 0.75rem; z-index: 999;
}

/* ============================================================
   Display headings
   ============================================================ */
.display-heading {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--soot);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-align: center;
  margin: 0 0 1.5rem;
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.15;
}

h1, h2, h3 { color: var(--soot); }

/* ============================================================
   Hero
   ============================================================ */
.hero {
  position: relative;
  display: grid;
  /* Two equal halves: upper half = illustration only, lower half = text.
     The .hero-content lands in row 2 with align-self: start, so its top
     edge is exactly at 50% of the hero's height. */
  grid-template-rows: 1fr 1fr;
  text-align: center;
  padding: 0 var(--gutter) clamp(2rem, 5vw, 3.5rem);
  background-color: var(--cream);
  background-image: url("/images/hero.png");
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: scroll;
  border-bottom: 1px solid var(--rule);
  /* Sized to fit hero.png (1536x1043, ~3:2 landscape) at any viewport
     width without cropping. min() caps at viewport height so very tall
     screens don't add empty space. */
  min-height: min(100vh, calc(100vw * 1024 / 1536));
}

@media (max-width: 639px) {
  .hero {
    /* On short mobile viewports, ease the text up a bit so it doesn't
       run off the bottom edge — text top now starts at ~40% of height. */
    grid-template-rows: 2fr 3fr;
  }
}

.hero-content {
  position: relative;
  grid-row: 2;
  align-self: start;
  justify-self: center;
  width: 100%;
  max-width: 52rem;
  padding-top: clamp(0.75rem, 2vw, 1.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.names {
  font-family: var(--font-display);
  font-weight: 400;
  color: var(--soot);
  margin: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: clamp(1.75rem, 4.5vw, 3.5rem);
  line-height: 1.1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1em;
  word-break: normal;
  overflow-wrap: break-word;
  max-width: 100%;
}
.names .name {
  display: block;
  max-width: 100%;
}
.names .amp {
  font-family: var(--font-blackletter);
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  font-size: 0.6em;
  color: var(--soot-soft);
  line-height: 1;
}
@media (min-width: 640px) {
  .names {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35em;
    align-items: baseline;
  }
}

.hero-monogram {
  width: 96px;
  height: auto;
  margin-top: 0.75rem;
  filter: drop-shadow(0 2px 6px rgba(28, 26, 23, 0.18));
}
@media (min-width: 1024px) {
  .hero-monogram {
    width: 140px;
    margin-top: 1rem;
  }
}

.hero-date {
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin: 0;
  font-size: clamp(0.8rem, 1.3vw, 0.95rem);
  color: var(--soot);
}

.hero-line {
  margin: 0;
  font-style: italic;
  color: var(--soot-soft);
  font-size: clamp(0.85rem, 1.4vw, 1rem);
}

/* ============================================================
   Frame & corners
   ============================================================ */
main.frame {
  position: relative;
  max-width: var(--frame-max);
  margin: 0 auto;
  padding: var(--section-gap) var(--gutter);
}

.corner {
  display: none;
  position: absolute;
  width: 110px;
  height: auto;
  pointer-events: none;
  user-select: none;
}
@media (min-width: 1024px) {
  .corner { display: block; }
  .corner-tl { top: 0; left: 0; }
  .corner-tr { top: 0; right: 0; }
  .corner-bl { bottom: 0; left: 0; }
  .corner-br { bottom: 0; right: 0; }
}

/* ============================================================
   Sections
   ============================================================ */
.section {
  position: relative;
  padding: var(--section-gap) 0;
  scroll-margin-top: 2rem;
}

.section::before,
.section::after {
  content: "";
  position: absolute;
  top: 1rem;
  bottom: 1rem;
  width: 22px;
  background: url("/images/dividersidevertical.png") center / contain repeat-y;
  pointer-events: none;
  display: none;
}
.section::before { left: -2.25rem; }
.section::after  { right: -2.25rem; transform: scaleX(-1); }

@media (min-width: 1024px) {
  .section::before,
  .section::after { display: block; }
}

.section > * { max-width: var(--measure); margin-left: auto; margin-right: auto; }

/* ============================================================
   Horizontal divider
   ============================================================ */
.divider-h {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.25rem var(--gutter);
}
.divider-h img {
  max-width: 720px;
  width: 100%;
  height: auto;
  opacity: 0.85;
}

/* ============================================================
   Section 2 — How We Met
   ============================================================ */
.story-grid {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  max-width: 100%;
}
.story-portrait {
  margin: 0;
  flex: 0 0 auto;
}
.story-img {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  display: block;
}
.story-content { max-width: 60ch; }
.story-text p {
  margin: 0 0 1em;
  text-align: justify;
  hyphens: auto;
}
.story-text p:last-child { margin-bottom: 0; }

@media (min-width: 1024px) {
  .story-grid {
    flex-direction: row;
    align-items: flex-start;
    gap: 3rem;
    max-width: var(--measure);
  }
  .story-portrait {
    flex: 0 0 38%;
  }
  .story-img { max-width: 100%; }
}

/* ============================================================
   Section 3 — Events
   ============================================================ */
.events-list {
  list-style: none;
  padding: 0;
  margin: 1rem auto 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  max-width: 32rem;
}
.event {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  text-align: left;
}
.event-icon {
  width: 64px;
  height: auto;
  flex: 0 0 auto;
}
.event-text { flex: 1; }
.event-title {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  color: var(--soot);
}
.event-line { margin: 0.15rem 0; }
.events-meta { text-align: center; margin-top: 1.5rem; }

.link-button {
  background: none;
  border: none;
  border-bottom: 1px solid var(--rule);
  padding: 0.25em 0;
  font-family: var(--font-display);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--soot);
  font-size: 0.95rem;
  transition: border-color 200ms ease;
}
.link-button:hover, .link-button:focus-visible {
  border-bottom-color: var(--soot);
  outline: none;
}

/* ============================================================
   Section 4 — Instagram
   ============================================================ */
.section-instagram { text-align: center; }
.instagram-intro {
  font-style: italic;
  margin: 0 0 0.75rem;
}
.hashtag {
  font-family: var(--font-blackletter);
  font-weight: 700;
  font-size: clamp(2rem, 5vw, 3rem);
  color: var(--soot);
  margin: 0;
  letter-spacing: 0.02em;
  word-break: break-word;
}

/* ============================================================
   Section 6 — Ornamental band (cityscape replacement)
   ============================================================ */
.ornamental-band {
  position: relative;
  height: 280px;
  background-color: var(--cream);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 120 120'><g fill='none' stroke='%231C1A17' stroke-width='1' opacity='0.12'><circle cx='30' cy='30' r='10'/><circle cx='30' cy='30' r='4'/><path d='M30 16 L30 20 M30 40 L30 44 M16 30 L20 30 M40 30 L44 30 M20 20 L23 23 M37 37 L40 40 M40 20 L37 23 M20 40 L23 37'/><path d='M85 60 L95 70 L85 80 L75 70 Z'/><circle cx='95' cy='100' r='6'/><circle cx='95' cy='100' r='2'/><path d='M55 95 L60 100 L55 105 L50 100 Z'/></g></svg>");
  background-repeat: repeat;
  background-size: 120px 120px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: var(--section-gap) calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  max-width: none;
}
.band-focal {
  max-width: 720px;
  width: 80%;
  height: auto;
  position: relative;
  z-index: 1;
}

/* ============================================================
   Section 7 — Venue
   ============================================================ */
.section-venue { text-align: center; }
.venue-illustration {
  max-width: 360px;
  width: 100%;
  margin: 0 auto 1.5rem;
}
.venue-address {
  font-style: normal;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin: 0 auto 1.5rem;
  line-height: 1.5;
}
.venue-name {
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin-bottom: 0.35rem;
  color: var(--soot);
}
.map-wrap {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto 1rem;
  aspect-ratio: 16 / 10;
  border: 1px solid var(--rule);
  background: var(--cream);
  overflow: hidden;
}
.map-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}
.map-link-wrap { margin: 0; }
.map-link {
  font-family: var(--font-display);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.9rem;
}

/* ============================================================
   Section 2 — RSVP
   ============================================================ */
.section-rsvp {
  text-align: center;
}
.section-rsvp > * {
  /* Override the generic .section > * max-width so the inner wrapper
     drives sizing. */
  max-width: none;
}
.rsvp-inner {
  max-width: 540px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 1.25rem;
  text-align: center;
}
.rsvp-icon {
  width: 64px;
  height: auto;
  margin: 0 auto;
}
.rsvp-heading {
  margin: 0;
}
.rsvp-line {
  margin: 0;
  max-width: 32rem;
}

.rsvp-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  background-color: var(--oxblood);
  color: var(--cream);
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 1rem 2.25rem;
  position: relative;
  box-shadow:
    inset 0 0 0 1px var(--cream),
    inset 0 0 0 3px var(--oxblood),
    inset 0 0 0 4px var(--cream),
    0 4px 14px rgba(28, 26, 23, 0.18);
  transition: transform 200ms ease, box-shadow 200ms ease;
}
.rsvp-cta:hover, .rsvp-cta:focus-visible {
  transform: translateY(-2px);
  box-shadow:
    inset 0 0 0 1px var(--cream),
    inset 0 0 0 3px var(--oxblood),
    inset 0 0 0 4px var(--cream),
    0 8px 22px rgba(28, 26, 23, 0.28);
  outline: none;
}
.rsvp-cta .heart { color: var(--cream); font-size: 0.9em; }
.rsvp-cta-label { line-height: 1; }

.registry-line {
  margin: 0;
  font-style: italic;
  color: var(--soot-soft);
}

/* ============================================================
   Closing seal
   ============================================================ */
.closing-seal {
  display: flex;
  justify-content: center;
  padding: var(--section-gap) 0 1rem;
}
.closing-seal img { width: 110px; opacity: 0.85; }

/* ============================================================
   Dress code modal
   ============================================================ */
.dress-modal {
  border: 1px solid var(--rule);
  background: var(--cream);
  color: var(--soot-soft);
  padding: clamp(1.5rem, 4vw, 2.5rem);
  max-width: 32rem;
  width: calc(100% - 2rem);
  border-radius: 2px;
  box-shadow: 0 18px 48px rgba(28, 26, 23, 0.35);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}
.dress-modal::backdrop {
  background: rgba(28, 26, 23, 0.55);
  backdrop-filter: blur(2px);
}
.dress-modal[open] {
  animation: dc-fade 200ms ease;
}
@keyframes dc-fade {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.modal-close {
  position: absolute;
  top: 0.5rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1.75rem;
  color: var(--soot);
  line-height: 1;
  padding: 0.25rem 0.5rem;
}
.modal-close:hover { color: var(--oxblood); }
.dc-illustrations {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 1.25rem;
  margin-bottom: 0.75rem;
}
.dc-illustrations img { width: 72px; height: auto; }
.dc-title { margin: 0.5rem 0 0.75rem; }
.dc-intro {
  text-align: center;
  font-style: italic;
  margin: 0 0 1.25rem;
}
.dc-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem 1rem;
  margin: 0;
}
.dc-list dt {
  font-family: var(--font-display);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.85rem;
  color: var(--soot);
  margin-top: 0.5rem;
}
.dc-list dd { margin: 0 0 0.5rem; }
@media (min-width: 640px) {
  .dc-list {
    grid-template-columns: max-content 1fr;
    align-items: baseline;
  }
  .dc-list dt { margin-top: 0; }
}

/* ============================================================
   Reduced motion
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    transition-duration: 150ms !important;
    animation-duration: 150ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ============================================================
   Responsive — tighter type and stacking on narrow viewports
   ============================================================ */
@media (max-width: 639px) {
  .event { flex-direction: row; gap: 0.9rem; }
  .event-icon { width: 48px; }
  .ornamental-band { height: 220px; }
}
