:root {
  --ink: #2b2320;
  --cream: #faf6f0;
  --accent: #859983;        /* deep sage sampled from the artwork */
  --accent-soft: #b7c5b2;

  /* Palette sampled directly from the invitation artwork so every background
     on the site matches it. */
  --art-cream: #e7e4d9;   /* paper / cream */
  --art-tan:   #d1ceae;   /* warm sage-tan */
  --art-sage:  #b7c5b2;   /* soft sage-green */
  --art-mid:   #aab9a9;   /* mid sage */
  --art-deep:  #859983;   /* deep sage */

  /* A soft diagonal wash built from the artwork tones, used site-wide. */
  --art-bg: linear-gradient(160deg,
      var(--art-cream) 0%,
      var(--art-tan) 32%,
      var(--art-sage) 66%,
      var(--art-mid) 100%);

  /* How much of the screen height the invite image is allowed to use.
     Higher = bigger image, less blur showing. */
  --img-max-h: 96vh;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  /* Navigation smoothness is handled by a custom JS tween (see script.js).
     We intentionally do NOT use native smooth scroll or scroll-snap here,
     because they fight the JS animation and feel abrupt. */
}

body {
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--cream);
  /* Site-wide background sampled from the invitation artwork. */
  background: var(--art-bg);
  background-attachment: fixed;
  line-height: 1.5;
  overflow-x: hidden;
}

/* -----------------------------------------------------------------
   Scroll cue (shown on load, hidden once the user scrolls)
------------------------------------------------------------------ */
.scroll-cue {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: #4a4436;
  pointer-events: none;
  /* Entrance on load */
  opacity: 0;
  animation: cue-in 0.9s ease 0.4s forwards;
  transition: opacity 0.5s ease;
}

.scroll-cue.hidden { opacity: 0 !important; animation: none; }

.scroll-cue__label {
  font-size: 0.85rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.scroll-cue__mouse {
  width: 26px;
  height: 42px;
  border: 2px solid #4a4436;
  border-radius: 14px;
  display: block;
  position: relative;
  /* Gentle up/down bob */
  animation: cue-bob 1.8s ease-in-out infinite;
}

.scroll-cue__dot {
  position: absolute;
  left: 50%;
  top: 8px;
  width: 4px;
  height: 8px;
  margin-left: -2px;
  background: #4a4436;
  border-radius: 2px;
  animation: cue-dot 1.8s ease-in-out infinite;
}

@keyframes cue-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to   { opacity: 0.85; transform: translate(-50%, 0); }
}

@keyframes cue-bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

@keyframes cue-dot {
  0%   { opacity: 0; transform: translateY(0); }
  40%  { opacity: 1; }
  100% { opacity: 0; transform: translateY(14px); }
}

/* -----------------------------------------------------------------
   Scroll progress bar
------------------------------------------------------------------ */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 4px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), #e8c98f);
  z-index: 100;
  transition: width 0.1s linear;
}

/* -----------------------------------------------------------------
   Invite pages: a centered vertical column. The tall 1:2 pages are
   sized by WIDTH and stacked seamlessly so they read as one flowing
   invitation. No text is overlaid on the artwork.
------------------------------------------------------------------ */
.pages {
  display: block;
  width: 100%;
}

/* Each panel fills the screen and snaps into place, so ONE image shows per
   scroll. Instead of empty bezels, the margins are filled with a blurred,
   zoomed copy of the same image (a "letterbox blur") so the panel looks
   edge-to-edge and intentional on both phones and wide desktops. */
.page-panel {
  position: relative;
  min-height: 100vh;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: clamp(4px, 1.5vh, 16px);
  overflow: hidden;
  background: var(--art-bg);
}

/* Blurred fill layer: the same image, scaled to cover the whole panel and
   heavily blurred, sitting behind the sharp image. The bg image URL is set
   per-panel by a small script (reads each panel's <img src>). */
.page-panel .blur-fill {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(28px) brightness(0.9) saturate(1.05);
  transform: scale(1.15); /* hides blurred edges */
  z-index: 0;
}

/* A soft wash over the blur so the centered image pops and text stays readable */
.page-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(60, 66, 48, 0.18);
  z-index: 1;
}

/* The sharp, full image, centered on top. Preserves the 1:2 ratio (contain),
   never cropped, never distorted. It grows to fill as much of the screen as
   possible: on phones it uses ~full width, on desktops ~full height. */
.page-panel img {
  position: relative;
  z-index: 2;
  display: block;
  max-width: 100%;
  max-height: var(--img-max-h);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
}

/* ---------------------------------------------------------------
   WHEN YOU SWAP IN EDGE-BLEED 4:5 CANVA IMAGES:
   add class="edge-bleed" to <body> in index.html. Panels then fill the
   whole screen edge-to-edge (no blur frame, no bezels), cropping only the
   background art. Everything else stays the same.
------------------------------------------------------------------ */
body.edge-bleed .page-panel { padding: 0; }
body.edge-bleed .page-panel .blur-fill,
body.edge-bleed .page-panel::after { display: none; }
body.edge-bleed .page-panel img {
  max-width: none;
  max-height: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  box-shadow: none;
}

/* -----------------------------------------------------------------
   RSVP section (separate from the images, on its own backdrop)
------------------------------------------------------------------ */
/* RSVP section uses the SAME sage edge-gradient background as the invite
   pages, so it blends seamlessly with the rest of the site. */
.rsvp-section {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  background: var(--art-bg);
}

/* Card sized to match the invite image footprint: same height as the images
   (var(--img-max-h)) and the same 1:2 portrait proportion, so the RSVP panel
   reads as another "page" in the set. Text and fields inside are enlarged. */
.rsvp-card {
  background: rgba(247, 245, 236, 0.86);
  border: 1px solid rgba(124, 138, 90, 0.5);
  backdrop-filter: blur(3px);
  padding: clamp(1.75rem, 4vh, 3rem);
  border-radius: 10px;
  /* Match the image: height drives, width follows the 1:2 ratio. */
  height: var(--img-max-h);
  width: calc(var(--img-max-h) / 2);
  max-width: 100%;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
  /* Center content vertically when it fits; scroll from the top if the form
     is taller than the card (so nothing gets clipped out of reach). */
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  overflow-y: auto;
}

h2 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(3rem, 9vw, 4.5rem);
  font-weight: 400;
  margin-bottom: 0.75rem;
  color: #5c6a3d;
}

.rsvp-sub {
  margin-bottom: 0.5rem;
  font-style: italic;
  opacity: 0.85;
  color: #4a4436;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
}

.rsvp-deadline {
  display: inline-block;
  margin: 0 auto 1.75rem;
  padding: 0.4rem 1.1rem;
  border: 1px solid rgba(124, 138, 90, 0.6);
  border-radius: 999px;
  background: rgba(124, 138, 90, 0.12);
  color: #5c6a3d;
  font-size: clamp(1rem, 2vw, 1.2rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

form { display: grid; gap: 1.35rem; text-align: left; }

/* Conditional RSVP fields must actually collapse when hidden (the grid
   layout would otherwise still show them). */
#rsvp-form [hidden] { display: none !important; }

/* Guest-name inputs stack with the same spacing as the rest of the form. */
#guest-names {
  display: grid;
  gap: 1.35rem;
}

label {
  display: grid;
  gap: 0.5rem;
  font-size: clamp(1.15rem, 2.2vw, 1.4rem);
  letter-spacing: 0.02em;
  color: #3f3a2e;
}

input,
select,
textarea {
  font-family: inherit;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  padding: 0.9rem 1rem;
  border: 1px solid rgba(124, 138, 90, 0.5);
  border-radius: 8px;
  background: #fbfaf4;
  color: var(--ink);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button {
  margin-top: 0.75rem;
  padding: 1.05rem 1.25rem;
  font-family: inherit;
  font-size: clamp(1.2rem, 2.4vw, 1.5rem);
  letter-spacing: 0.05em;
  color: var(--cream);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
}

button:hover { transform: translateY(-1px); background: #6b784d; }
button:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

#rsvp-status { min-height: 1.4rem; text-align: center; font-style: italic; }
#rsvp-status.success { color: #5c6a3d; }
#rsvp-status.error { color: #b3453f; }

/* -----------------------------------------------------------------
   RSVP confirmation popup (modal)
------------------------------------------------------------------ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(34, 39, 28, 0.55);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal-overlay[hidden] { display: none; }
.modal-overlay.is-open { opacity: 1; }

.modal-card {
  background: var(--art-cream);
  border: 1px solid rgba(124, 138, 90, 0.5);
  border-radius: 14px;
  padding: 2.75rem 2.25rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  transform: translateY(16px) scale(0.96);
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.modal-overlay.is-open .modal-card { transform: translateY(0) scale(1); }

.modal-check { margin-bottom: 1rem; }

/* Animate the check drawing in */
.modal-check circle {
  stroke-dasharray: 151;
  stroke-dashoffset: 151;
  animation: draw-circle 0.5s ease forwards;
}
.modal-check path {
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw-check 0.35s ease 0.4s forwards;
}
@keyframes draw-circle { to { stroke-dashoffset: 0; } }
@keyframes draw-check { to { stroke-dashoffset: 0; } }

.modal-card h2 {
  font-family: "Great Vibes", cursive;
  font-size: clamp(2.4rem, 7vw, 3.2rem);
  color: #5c6a3d;
  margin-bottom: 0.5rem;
}

.modal-card p {
  font-size: clamp(1.05rem, 2.2vw, 1.25rem);
  color: #4a4436;
  margin-bottom: 1.75rem;
}

.modal-card button {
  margin-top: 0;
  width: 100%;
  padding: 0.9rem 1.25rem;
  font-size: 1.15rem;
  color: var(--cream);
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
}
.modal-card button:hover { background: #6b784d; transform: translateY(-1px); }

/* Yes/No row shown when confirming an update to an existing RSVP */
.modal-actions {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
.modal-actions[hidden] { display: none; }
.modal-actions button { margin: 0; }

/* Secondary "ghost" button used for the No / keep option */
.modal-card button.ghost {
  background: transparent;
  color: #5c6a3d;
  border: 1px solid rgba(124, 138, 90, 0.6);
}
.modal-card button.ghost:hover { background: rgba(124, 138, 90, 0.14); color: #5c6a3d; }

@media (prefers-reduced-motion: reduce) {
  .modal-overlay, .modal-card { transition: none; }
  .modal-check circle, .modal-check path { animation: none; stroke-dashoffset: 0; }
}

footer {
  padding: 3rem 2rem;
  text-align: center;
  font-family: "Great Vibes", cursive;
  font-size: 1.8rem;
  color: #4a4436;
  background: var(--art-bg);
}

/* -----------------------------------------------------------------
   Scroll-reveal + flowing transitions between pages
   Each page rises and fades in as it enters view.
------------------------------------------------------------------ */
[data-reveal] {
  opacity: 0;
  transform: translateY(60px);
  transition: opacity 1.1s cubic-bezier(0.22, 1, 0.36, 1),
    transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

[data-reveal][data-reveal-scale] { transform: scale(0.92); }

/* Invite pages fade + gently scale in for a smooth page-to-page transition.
   Applied to the panel's image so the whole panel background never shifts. */
[data-reveal][data-reveal-fade] { transform: none; }
[data-reveal][data-reveal-fade] img {
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 0.85s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
  will-change: opacity, transform;
}
[data-reveal][data-reveal-fade].is-visible img {
  opacity: 1;
  transform: scale(1);
}
/* The fade panel container itself stays fully visible so its blurred
   background is always present (no flash of empty background). */
[data-reveal][data-reveal-fade] { opacity: 1; }

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  [data-reveal],
  [data-reveal-fade] img {
    opacity: 1 !important;
    transform: none !important;
    transition: none;
  }
  .scroll-cue,
  .scroll-cue__mouse,
  .scroll-cue__dot { animation: none !important; }
  .scroll-cue { opacity: 0.85; }
}

/* -----------------------------------------------------------------
   Responsive image sizing across common device ratios.
   The image always shows in full (no crop); these tune how much of the
   screen it fills so it looks large and intentional everywhere.
------------------------------------------------------------------ */

/* Phones (portrait): a phone (~0.56 ratio) is close to the image's 0.5 ratio,
   so fill the whole screen edge-to-edge with almost no cropping. The image
   covers the panel completely — no gaps, no bezels. Only a tiny bit of the
   very top/bottom background art is trimmed. */
@media (max-width: 600px) {
  .page-panel { padding: 0; }
  .page-panel .blur-fill,
  .page-panel::after { display: none; }
  .page-panel img {
    width: 100%;
    height: 100vh;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
    border-radius: 0;
    box-shadow: none;
  }

  /* RSVP fills the phone screen like the images do — full width and height,
     no side gaps, larger touch-friendly fields. */
  .rsvp-section { padding: 0; }
  .rsvp-card {
    width: 100%;
    height: 100vh;
    max-width: none;
    border-radius: 0;
    border-left: none;
    border-right: none;
    padding: 2rem 1.5rem;
  }
}

/* Short/landscape phones and small landscape windows: height is tight, so
   pull the cap down a touch so the whole page still fits without scrolling. */
@media (max-height: 500px) {
  :root { --img-max-h: 92vh; }
}

/* Tablets and up: plenty of height, so let the image use nearly the full
   height (width follows the 1:2 ratio). */
@media (min-width: 601px) {
  :root { --img-max-h: 94vh; }
}
