/* ===== Design tokens (inspired by the watercolor invitation) ===== */
:root {
  --bg: #fbf8f2;          /* warm cream */
  --panel: #ffffff;        /* card surface */
  --border: #e3d9c6;       /* soft tan hairline */
  --gold: #c2a360;         /* frame / accent line */
  --gold-soft: #d8c391;
  --text: #3f3b36;         /* warm charcoal */
  --muted: #8a8076;        /* faded ink */
  --accent: #e08a7b;       /* coral rose */
  --accent-hover: #d4715f;
  --ok: #6f9168;
  --err: #c0584b;

  --serif: "Cormorant Garamond", "Playfair Display", Georgia, "Times New Roman", serif;
  --sans: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Fonts are loaded via <link> tags in index.html <head>. */

* { box-sizing: border-box; }

/* The `hidden` attribute must win over component `display` rules (e.g.
   `.screen { display: flex }`), otherwise gated panels stay visible. */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 300;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* ===== Centered screen (access gate) ===== */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.screen.wide { justify-content: flex-start; }

/* ===== Floral accents ===== */
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.floral {
  display: block;
  aspect-ratio: 240 / 100;
}
.floral--lg { width: 300px; margin: 0 auto 0; }     /* hero centerpiece */
.floral--md { width: 180px; margin: 0 auto -6px; }   /* gate */
.floral--sm { width: 160px; margin: 0 auto -4px; }   /* RSVP card */

/* ===== The J&N mark (traced from the logo; centre diamond is open) ===== */
.mark {
  display: block;
  aspect-ratio: 700 / 775;
  color: var(--gold);
}
.mark--xl { width: 56px; margin: 0 auto 10px; }   /* hero, above the bouquet */
.mark--lg { width: 72px; margin: 0 auto 20px; }   /* gate card */
.mark--md { width: 44px; margin: 0 auto 14px; color: var(--gold-soft); }  /* footer */
.mark--sm {
  width: 20px;
  margin: 0;
  color: var(--accent);
  flex: none;
}
/* The sidebar is narrow, so the mark sits above the names rather than beside them. */
.sidebar-title .mark { width: 26px; margin: 0 0 10px; }

/* ===== Unlock celebration burst ===== */
.celebrate {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}
.celebrate-bit {
  position: absolute;
  left: 50%;
  top: 50%;
  opacity: 0;
  will-change: transform, opacity;
  transform: translate(-50%, -50%) scale(0.2);
  animation: celebrate-burst var(--dur, 2s) cubic-bezier(0.16, 0.84, 0.3, 1) var(--delay, 0s) forwards;
}
.celebrate-spark {
  display: inline-block;
  line-height: 1;
  color: var(--gold);
  text-shadow: 0 0 8px rgba(194, 163, 96, 0.6);
}
@keyframes celebrate-burst {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.2) rotate(0deg); }
  12%  { opacity: 1; }
  75%  { opacity: 1; }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(1) rotate(var(--rot));
  }
}
@media (prefers-reduced-motion: reduce) {
  .celebrate { display: none; }
}

/* small sprig tucked into a card corner */
.floral--corner {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 56px;
  aspect-ratio: 1 / 1;
  opacity: 0.55;
}

/* ===== Card surface with gold double-line frame ===== */
.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  padding: 48px 40px;
  width: 100%;
  max-width: 460px;
  box-shadow: 0 16px 50px rgba(120, 100, 60, 0.12);
}
/* inner hairline of the double frame */
.card::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid var(--border);
  border-radius: 2px;
  pointer-events: none;
}

/* ===== Landing page layout =====
   .site is the full-width shell; .page is the centered reading column.
   The nav bar itself spans the viewport so its background is edge to edge,
   while .nav-inner keeps its contents aligned with the column below. */
.site { padding-bottom: 72px; }
.page { max-width: 920px; margin: 0 auto; padding: 0 24px; }

.nav {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 20px 0;
  /* Translucent + frosted: the ambient gradient still reads through the bar,
     while content scrolling under the sticky nav is masked instead of
     colliding with the brand and the CTA. */
  background: rgba(251, 248, 242, 0.72);   /* var(--bg) at 72% */
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
/* Without backdrop-filter the translucent fill alone lets scrolled content
   show through, so fall back to the opaque page colour. */
@supports not (backdrop-filter: blur(1px)) {
  .nav { background: var(--bg); }
}
.nav-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Keep anchored sections clear of the sticky nav when scrolled to. */
#home, #details, #join, #contact, #faq { scroll-margin-top: 88px; }
.brand {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.nav-cta {
  color: var(--text);
  text-decoration: none;
  border: 1px solid var(--gold);
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: all 0.18s ease;
}
.nav-cta:hover { background: var(--gold); color: #fff; }

/* ===== Hamburger toggle ===== */
.sidebar-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  padding: 8px;
  background: none;
  border: none;
  cursor: var(--cursor-heart-bright), pointer;
}
.sidebar-toggle span {
  display: block;
  height: 1.5px;
  width: 100%;
  background: var(--text);
  transition: background 0.18s ease;
}
.sidebar-toggle:hover span { background: var(--accent); }

/* ===== Quick-access sidebar ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 50;
  width: 264px;
  max-width: 82vw;
  height: 100%;
  padding: 40px 32px;
  background: var(--panel);
  border-right: 1px solid var(--gold-soft);
  box-shadow: 4px 0 28px rgba(63, 59, 54, 0.12);
  transform: translateX(-100%);
  transition: transform 0.28s ease;
  overflow-y: auto;
}
.sidebar.is-open { transform: translateX(0); }
.sidebar-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  margin: 0 0 8px;
  color: var(--text);
}
.sidebar-title::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--gold);
  margin-top: 18px;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 24px;
}
.sidebar-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  transition: color 0.18s ease, padding-left 0.18s ease;
}
.sidebar-nav a:hover {
  color: var(--accent);
  padding-left: 6px;
}
.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(63, 59, 54, 0.38);
  opacity: 0;
  transition: opacity 0.28s ease;
}
.sidebar-overlay.is-open { opacity: 1; }

/* ===== Hero ===== */
.hero { text-align: center; max-width: 720px; margin: 72px auto 64px; }
.hero h1 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.4rem);
  line-height: 1.08;
  letter-spacing: 0.02em;
  margin: 0 0 20px;
}
.hero .accent { color: var(--text); font-style: italic; }
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  color: var(--gold);
  margin: 0 0 18px;
}
/* small decorative divider */
.divider {
  width: 64px;
  height: 1px;
  background: var(--gold);
  border: none;
  margin: 28px auto;
  position: relative;
}
.divider::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  background: var(--gold);
  transform: translate(-50%, -50%) rotate(45deg);
}

.btn-primary {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  padding: 14px 34px;
  border-radius: 999px;
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: background 0.18s ease;
}
.btn-primary:hover { background: var(--accent-hover); }

/* ===== Features ===== */
.features {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  gap: 24px;
  margin: 0 auto 72px;
}
.feature {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 36px 28px;
  text-align: center;
}
.feature-icon {
  font-size: 1.5rem;
  color: var(--accent);
  margin-bottom: 14px;
}
.feature h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.4rem;
  letter-spacing: 0.02em;
  margin: 0 0 8px;
}
.feature p { margin: 0; color: var(--muted); }

/* Two by two on wider screens; stacked below. grid-auto-rows: 1fr keeps
   every panel the same height regardless of how much copy it holds. */
@media (min-width: 760px) {
  .features { grid-template-columns: repeat(2, 1fr); }
}

/* ===== Contact ===== */
/* The heading wraps onto two lines on narrow screens; the body's 1.6
   line-height leaves too big a gap between them there. */
@media (max-width: 480px) {
  .contact h2 { line-height: 1.15; }
}
.contact-reach {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
/* One row per person: e-mail then phone. Collapses to a single column on
   phones, where two columns would wrap mid-address. */
.contact-links {
  display: grid;
  grid-template-columns: repeat(2, auto);
  justify-content: center;
  justify-items: start;
  gap: 16px 36px;
  margin-top: 24px;
}
@media (max-width: 560px) {
  .contact-links { grid-template-columns: auto; justify-items: center; }
}
.contact-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
  font-size: 0.98rem;
  letter-spacing: 0.02em;
  transition: color 0.18s ease;
}
.contact-link:hover { color: var(--accent); }
.contact-icon {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--accent);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  color: var(--muted);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}
.footer p { margin: 6px 0; }
.footer-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
}
.footer-link:hover { opacity: 1; color: var(--gold); }

/* ===== Headings ===== */
h1, h2 {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: 0.02em;
}
h1 { margin: 0 0 8px; }
h2 { margin: 0 0 4px; font-size: 1.9rem; }

.lead { font-size: 1.1rem; color: var(--text); font-weight: 300; }
.date-accent {
  display: block;
  margin-top: 10px;
  font-family: "Pinyon Script", "Cormorant Garamond", Georgia, serif;
  font-size: 3.4rem;
  line-height: 1.1;
  color: var(--accent);
}
.date-sep { margin: 0 0.18em; }
.save-the-date { font-size: 1.7rem; }
/* Half the script date's size, in the body charcoal. */
.date-written {
  display: block;
  margin-top: 4px;
  font-family: var(--serif);
  font-size: 1.7rem;
  line-height: 1.2;
  color: var(--text);
}
.muted { color: var(--muted); margin-top: 0; letter-spacing: 0.04em; }

/* ===== Countdown ===== */
.countdown {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 28px 0 32px;
}
.countdown-unit {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 56px;
}
.countdown-num {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(2rem, 6vw, 2.8rem);
  line-height: 1;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.countdown-label {
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.6rem;
  color: var(--gold);
}
.countdown.is-past {
  font-family: var(--serif);
  font-size: 1.2rem;
  color: var(--accent);
}

/* ===== Forms ===== */
form { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }

input, textarea {
  background: #fffdf9;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 13px 15px;
  color: var(--text);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 300;
}
input::placeholder, textarea::placeholder { color: #b3a99c; }
input:focus, textarea:focus {
  outline: none;
  border-color: var(--gold);
}
textarea { resize: vertical; }

button {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 0.82rem;
  font-family: var(--sans);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: var(--cursor-heart-bright), pointer;
  transition: background 0.18s ease;
}
button:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.55; cursor: default; }

.link {
  background: none;
  color: var(--accent);
  padding: 0;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
  text-decoration: underline;
}
.link:hover { background: none; color: var(--accent-hover); }

.error { color: var(--err); margin: 4px 0 0; font-size: 0.9rem; }
.status { margin: 4px 0 0; font-size: 0.9rem; }
.status.ok { color: var(--ok); }
.status.error { color: var(--err); }

main.card, main .card { max-width: 600px; margin: 0 auto 48px; }

/* ===== Admin table ===== */
.table-wrap { width: 100%; max-width: 1100px; margin: 0 auto; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td {
  text-align: left;
  padding: 11px 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th {
  color: var(--gold);
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.74rem;
  white-space: nowrap;
}
td.msg { white-space: pre-wrap; max-width: 360px; }

/* ===== Admin section nav ===== */
.admin-nav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto 32px;
  padding: 12px 4px;
  background: var(--bg, #faf7f2);
  border-bottom: 1px solid var(--border);
}
.admin-brand {
  font-family: var(--serif);
  color: var(--gold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-size: 0.82rem;
  margin-right: auto;
}
.admin-nav-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  border-radius: 3px;
}
.admin-nav-link:hover { color: var(--gold); background: var(--panel); }

.admin-section { width: 100%; scroll-margin-top: 72px; }
.admin-section + .admin-section { margin-top: 48px; }

/* ===== Broadcast panel ===== */
.broadcast { margin: 0 auto 40px; text-align: left; }
.broadcast h2 { margin: 0 0 4px; }
.broadcast form { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.broadcast .check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--muted);
}
.broadcast .check input { width: auto; margin: 0; }

/* ===== Puzzles (secret page) ===== */
.puzzle-wrap { max-width: 480px; margin: 0 auto; }
.puzzle-wrap .card { max-width: 480px; margin: 0 auto 24px; text-align: center; }
.puzzle-title { font-family: var(--serif); font-weight: 600; margin: 0 0 4px; }

.wordle-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 6px;
  width: 100%;
  max-width: 300px;
  margin: 22px auto;
}
.wordle-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wordle-tile {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 3px;
  background: #fffdf9;
  color: var(--text);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.6rem;
  text-transform: uppercase;
  user-select: none;
}
.wordle-tile.filled { border-color: var(--gold-soft); }
.wordle-tile.revealed {
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}
.wordle-tile.correct { background: var(--ok); border-color: var(--ok); color: #fff; }
.wordle-tile.present { background: var(--gold); border-color: var(--gold); color: #fff; }
.wordle-tile.absent { background: #cfc7ba; border-color: #cfc7ba; color: #fff; }

.wordle-keyboard { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; }
.wordle-krow { display: flex; justify-content: center; gap: 5px; }
.wordle-key {
  flex: 1 1 auto;
  min-width: 26px;
  max-width: 40px;
  padding: 14px 0;
  background: #efe7d8;
  color: var(--text);
  border: none;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
  cursor: var(--cursor-heart-bright), pointer;
}
.wordle-key.wide { max-width: 56px; font-size: 0.78rem; }
.wordle-key:hover { background: #e6dcc8; }
.wordle-key.correct { background: var(--ok); color: #fff; }
.wordle-key.present { background: var(--gold); color: #fff; }
.wordle-key.absent { background: #cfc7ba; color: #fff; }

.pictogram { display: block; width: 100%; max-width: 280px; margin: 20px auto 8px; }

.cx-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 16px auto;
  max-width: 420px;
}
.cx-tile {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 54px;
  padding: 12px 5px;
  background: #efe7d8;
  color: var(--text);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 0.78rem;
  line-height: 1.1;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  cursor: var(--cursor-heart-bright), pointer;
}
.cx-tile:hover { background: #e6dcc8; }
.cx-tile.sel { background: var(--text); color: #fff; border-color: var(--text); }
.cx-tile.correct {
  background: var(--ok);
  color: #fff;
  border-color: var(--ok);
  animation: cx-pop 0.42s ease;
}
@keyframes cx-pop {
  0% { transform: scale(1); }
  45% { transform: scale(1.09); }
  100% { transform: scale(1); }
}
.cx-solved {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 auto 8px;
  max-width: 420px;
}
.cx-group {
  border-radius: 4px;
  padding: 10px 12px;
  text-align: center;
  color: #3f3b36;
  animation: cx-drop 0.45s cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes cx-drop {
  0% { opacity: 0; transform: translateY(-10px) scale(0.96); }
  60% { opacity: 1; transform: translateY(2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.cx-group-theme {
  display: block;
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.8rem;
}
.cx-group-note {
  font-style: italic;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--err);
}
.cx-group-words { display: block; font-size: 0.85rem; }
@media (prefers-reduced-motion: reduce) {
  .cx-tile.correct,
  .cx-group { animation: none; }
}
.cx-group-0 { background: #e7cf7a; }
.cx-group-1 { background: #a9c99b; }
.cx-group-2 { background: #f0b3a6; }
.cx-group-3 { background: #bca9d0; }
@media (max-width: 420px) {
  .cx-tile { font-size: 0.68rem; padding: 12px 3px; }
}

.nm-expr {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-family: var(--serif);
  font-size: 1.45rem;
  color: var(--text);
  background: #fffdf9;
  border: 1px solid var(--gold-soft);
  border-radius: 3px;
  padding: 10px 14px;
  margin: 18px auto;
  max-width: 340px;
}
.nm-numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px auto;
  max-width: 240px;
}
.nm-ops {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 12px auto;
  max-width: 340px;
}
.nm-tile {
  min-width: 54px;
  padding: 12px 10px;
  background: #efe7d8;
  color: var(--text);
  border: 1px solid var(--gold-soft);
  border-radius: 4px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: 0;
  text-transform: none;
  cursor: var(--cursor-heart-bright), pointer;
}
.nm-tile:hover { background: #e6dcc8; }
.nm-tile:disabled { opacity: 0.32; cursor: default; }
.nm-op {
  min-width: 46px;
  padding: 12px 10px;
  background: #ffffff;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  cursor: var(--cursor-heart-bright), pointer;
}
.nm-op:hover { background: #faf3ef; }
.nm-controls {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
}
.nm-ctrl {
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 20px;
  font-size: 0.72rem;
  text-transform: none;
  letter-spacing: 0.04em;
}
.nm-ctrl:hover { background: none; color: var(--accent); }
.nm-check { padding: 9px 28px; }

.reveal-pop { animation: reveal-pop 0.6s cubic-bezier(0.2, 0.8, 0.3, 1); }
@keyframes reveal-pop {
  0% { opacity: 0; transform: translateY(14px) scale(0.96); }
  60% { opacity: 1; transform: translateY(-2px) scale(1.01); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-pop { animation: none; }
}

.riddle-text {
  font-family: var(--serif);
  font-size: 1.18rem;
  line-height: 1.75;
  color: var(--text);
  margin: 18px auto 8px;
  max-width: 400px;
}
.riddle-text em { color: var(--accent); font-style: italic; }

.conundrum-letters {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: center;
  gap: 8px;
  margin: 22px auto;
}
.letter-tile {
  width: 38px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fffdf9;
  border: 1px solid var(--gold-soft);
  border-radius: 3px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.5rem;
  text-transform: uppercase;
  color: var(--text);
  user-select: none;
}
@media (max-width: 380px) {
  .letter-tile { width: 30px; height: 36px; font-size: 1.2rem; gap: 6px; }
}
.pictogram-form { align-items: center; }
.pictogram-form input {
  width: 100%;
  max-width: 260px;
  text-align: center;
  text-transform: none;
}
.pictogram-form button[type="submit"] { width: 100%; max-width: 200px; }

.puzzle-retry {
  margin-top: 18px;
  background: none;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 24px;
  font-size: 0.72rem;
}
.puzzle-retry:hover { background: none; color: var(--accent); border-color: var(--gold-soft); }

/* ===== Side flower section indicator (secret page) ===== */
.section-dots {
  position: fixed;
  top: 50%;
  right: 18px;
  transform: translateY(-50%);
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}
.section-dot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 0;
  color: var(--gold-soft);
  opacity: 0.4;
  cursor: var(--cursor-heart-bright), pointer;
  transition: opacity 0.25s ease, color 0.25s ease;
}
.section-dot:hover { opacity: 0.75; background: none; }
.section-dot-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
  transition: color 0.25s ease;
}
.section-dot-mark {
  display: block;
  width: 22px;
  height: 22px;
  line-height: 0;
  flex-shrink: 0;
  transform: scale(0.82);
  transition: transform 0.25s ease, filter 0.25s ease;
}
.section-dot-mark svg { display: block; width: 100%; height: 100%; }
.section-dot.active { opacity: 1; color: var(--gold); }
.section-dot.active .section-dot-label { color: var(--gold); }
.section-dot.active .section-dot-mark {
  transform: scale(1.15);
  filter: drop-shadow(0 0 4px rgba(194, 163, 96, 0.5));
}
@media (max-width: 600px) {
  .section-dot-label { display: none; }
}
@media (max-width: 480px) {
  .section-dots { right: 8px; gap: 10px; }
  .section-dot-mark { width: 19px; height: 19px; }
}

/* ===== "What made this year special?" prompt ===== */
.year-prompt {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(30, 22, 30, 0.55);
  animation: yp-fade 0.3s ease;
}
.year-prompt-card {
  position: relative;
  width: 100%;
  max-width: 380px;
  background: var(--panel);
  border: 1px solid var(--gold-soft);
  border-radius: 6px;
  padding: 36px 28px 32px;
  text-align: center;
  box-shadow: 0 22px 60px rgba(60, 40, 30, 0.32);
  animation: yp-pop 0.4s cubic-bezier(0.2, 0.8, 0.3, 1);
}
.yp-hide {
  position: absolute;
  top: 8px;
  right: 10px;
  padding: 5px 8px;
  background: none;
  color: var(--muted);
  border: none;
  border-radius: 0;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: var(--cursor-heart-bright), pointer;
}
.yp-hide:hover { background: none; color: var(--accent); }
.yp-reopen {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%);
  z-index: 69;
  padding: 11px 22px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  box-shadow: 0 8px 24px rgba(60, 40, 30, 0.28);
  cursor: var(--cursor-heart-bright), pointer;
}
.yp-reopen:hover { background: var(--accent-hover); }
.year-prompt-theme {
  margin: 0 0 12px;
  font-family: var(--serif);
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.74rem;
}
.year-prompt-q {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--text);
}
.year-prompt .error { text-align: center; }
@keyframes yp-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes yp-pop {
  0% { opacity: 0; transform: translateY(12px) scale(0.96); }
  100% { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .year-prompt, .year-prompt-card { animation: none; }
}

/* ===== Ring box (secret page finale) ===== */
.ringbox-backdrop {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: radial-gradient(circle at 50% 42%, rgba(46, 32, 50, 0.6), rgba(18, 12, 20, 0.92));
  opacity: 0;
  transition: opacity 0.9s ease;
  pointer-events: none;
}
.ringbox-backdrop.show { opacity: 1; }

.ringbox {
  position: fixed;
  left: 96px;
  bottom: 30px;
  z-index: 60;
  width: 150px;
  height: 116px;
  transform: translateX(-50%) scale(0.55);
  transform-origin: center bottom;
  perspective: 700px;
  pointer-events: none;
  opacity: 0;
  transition: left 1s cubic-bezier(0.2, 0.8, 0.25, 1),
    bottom 1s cubic-bezier(0.2, 0.8, 0.25, 1),
    transform 1s cubic-bezier(0.2, 0.8, 0.25, 1), opacity 0.7s ease;
}
.ringbox.is-in { opacity: 1; }

.ringbox-base {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 60px;
  background: linear-gradient(#4a2f3f, #2b1b25);
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.06);
}
.ringbox-base::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 9px;
  transform: translateX(-50%);
  width: 22px;
  height: 6px;
  border-radius: 3px;
  background: #1a1017;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.25);
}

.ringbox-lid {
  position: absolute;
  left: 11px;
  right: 11px;
  top: 0;
  height: 50px;
  transform-origin: top center;
  transform: rotateX(calc(var(--open) * -118deg));
  transition: transform 1.1s cubic-bezier(0.34, 1.15, 0.4, 1);
}
.ringbox-lid-front {
  position: absolute;
  inset: 0;
  background: linear-gradient(#5a3a4c, #392530);
  border: 2px solid var(--gold);
  border-radius: 6px 6px 4px 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.08);
}

.ringbox-glow {
  position: absolute;
  left: 50%;
  top: 14px;
  width: 130px;
  height: 130px;
  transform: translateX(-50%) scale(0.4);
  background: radial-gradient(circle, rgba(255, 240, 205, 0.9), rgba(255, 220, 150, 0) 65%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 1s ease 0.4s, transform 1s ease 0.4s;
}

.ringbox-ring {
  position: absolute;
  left: 50%;
  bottom: 38px;
  z-index: 1;
  opacity: 0;
  transform: translateX(-50%) translateY(18px) scale(0.5);
  transition: transform 1.1s cubic-bezier(0.2, 1.3, 0.4, 1) 0.35s, opacity 0.6s ease 0.35s;
}
.ringbox-band {
  width: 40px;
  height: 40px;
  border: 6px solid;
  border-color: #f2d57e #d9b24f #c9a23f #e6c46a;
  border-radius: 50%;
  box-shadow: 0 0 14px rgba(230, 196, 106, 0.75), inset 0 0 6px rgba(255, 255, 255, 0.4);
}
.ringbox-gem {
  position: absolute;
  top: -11px;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translateX(-50%) rotate(45deg);
  background: linear-gradient(135deg, #ffffff, #cfe8ff 55%, #9cc7f5);
  box-shadow: 0 0 14px rgba(200, 230, 255, 0.95), 0 0 26px rgba(200, 230, 255, 0.55);
}

.ringbox-caption {
  position: absolute;
  left: 50%;
  top: 100%;
  margin: 26px 0 0;
  transform: translateX(-50%);
  white-space: nowrap;
  font-family: "Pinyon Script", "Cormorant Garamond", Georgia, serif;
  font-size: 2.2rem;
  color: var(--gold);
  text-shadow: 0 0 12px rgba(230, 196, 106, 0.6);
  opacity: 0;
  transition: opacity 1.2s ease 1s;
}

.ringbox.is-final {
  left: 50%;
  bottom: 50%;
  transform: translate(-50%, 50%) scale(1.4);
}
.ringbox.is-final .ringbox-glow {
  opacity: 0.9;
  transform: translateX(-50%) scale(1.2);
  animation: ring-pulse 2.4s ease-in-out 0.9s infinite;
}
.ringbox.is-final .ringbox-ring {
  opacity: 1;
  transform: translateX(-50%) translateY(-34px) scale(1.18);
}
.ringbox.is-final .ringbox-caption { opacity: 1; }
@keyframes ring-pulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 0.95; }
}
@media (max-width: 480px) {
  .ringbox { left: 68px; bottom: 18px; transform: translateX(-50%) scale(0.44); }
  .ringbox.is-final { left: 50%; bottom: 50%; transform: translate(-50%, 50%) scale(1.02); }
  .ringbox-caption { font-size: 1.9rem; }
}
@media (prefers-reduced-motion: reduce) {
  .ringbox, .ringbox-lid, .ringbox-ring, .ringbox-glow, .ringbox-caption, .ringbox-backdrop {
    transition: none;
  }
  .ringbox.is-final .ringbox-glow { animation: none; }
}

/* ===== Small phones ===== */
@media (max-width: 380px) {
  .brand { font-size: 1.05rem; letter-spacing: 0.02em; }
  .mark--xl { width: 46px; margin-bottom: 8px; }
  .mark--lg { width: 60px; }
  .nav-cta { padding: 8px 14px; letter-spacing: 0.08em; }
  .date-accent { font-size: 2.8rem; }
  .date-written, .save-the-date { font-size: 1.4rem; }
  .countdown { gap: 16px; }
  .countdown-unit { min-width: 44px; }
}

/* ===== Ambient background: drifting color streams ===== */
/* Sits behind all page content (z-index:-1) so the streams glow softly through
   the cream background and around the cards, on the gate and the landing page. */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}
.streams { position: absolute; inset: 0; }
.stream {
  position: absolute;
  width: 62vmax;
  height: 62vmax;
  border-radius: 46% 54% 48% 52% / 52% 46% 54% 48%;
  filter: blur(72px);
  opacity: 0.42;
  will-change: transform;
}
.stream--coral {
  top: -18vmax; left: -14vmax;
  background: radial-gradient(circle at 40% 40%, rgba(224, 138, 123, 0.55), rgba(224, 138, 123, 0) 68%);
  animation: drift-a 26s ease-in-out infinite;
}
.stream--gold {
  bottom: -22vmax; right: -16vmax;
  background: radial-gradient(circle at 40% 40%, rgba(216, 195, 145, 0.5), rgba(216, 195, 145, 0) 68%);
  animation: drift-b 32s ease-in-out infinite;
}
.stream--blush {
  top: 26%; right: -22vmax;
  background: radial-gradient(circle at 40% 40%, rgba(230, 162, 180, 0.42), rgba(230, 162, 180, 0) 68%);
  animation: drift-c 30s ease-in-out infinite;
}
.stream--blue {
  bottom: -18vmax; left: -12vmax;
  background: radial-gradient(circle at 40% 40%, rgba(166, 194, 222, 0.4), rgba(166, 194, 222, 0) 68%);
  animation: drift-d 34s ease-in-out infinite;
}
@keyframes drift-a {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(15vmax, 11vmax) rotate(40deg); }
}
@keyframes drift-b {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-13vmax, -9vmax) rotate(-38deg); }
}
@keyframes drift-c {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-16vmax, 8vmax) rotate(30deg); }
}
@keyframes drift-d {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(12vmax, -12vmax) rotate(-30deg); }
}

/* ===== Ambient floating petals ===== */
.petals { position: absolute; inset: 0; }
.petal {
  position: absolute;
  top: -12vh;
  opacity: 0.5;
  will-change: transform, opacity;
  animation: petal-fall var(--dur, 18s) linear var(--delay, 0s) infinite;
}
.petal svg, .petal use { display: block; width: 100%; height: 100%; }
@keyframes petal-fall {
  0%   { transform: translate3d(0, -12vh, 0) rotate(0deg); opacity: 0; }
  12%  { opacity: 0.55; }
  88%  { opacity: 0.55; }
  100% { transform: translate3d(var(--sway, 4vw), 114vh, 0) rotate(var(--rot, 360deg)); opacity: 0; }
}

/* ===== Envelope transition (plays after a correct access key) ===== */
.envelope-transition {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  perspective: 1100px;
  background: radial-gradient(circle at 50% 42%, rgba(46, 32, 50, 0.5), rgba(18, 12, 20, 0.86));
  animation: et-fade-in 0.5s ease;
}
.envelope-transition.is-closing {
  animation: et-fade-out 0.6s ease forwards;
}
@keyframes et-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes et-fade-out {
  to { opacity: 0; }
}

/* The envelope is a <button>; reset the global button styling. */
.envelope {
  --w: min(84vw, 360px);
  --h: calc(var(--w) * 0.62);
  position: relative;
  width: var(--w);
  height: var(--h);
  background: none;
  border: none;
  border-radius: 0;
  padding: 0;
  text-transform: none;
  letter-spacing: normal;
  cursor: var(--cursor-heart-bright), pointer;
  transform-style: preserve-3d;
  animation: env-float 5s ease-in-out infinite;
}
.envelope:hover { background: none; }
.envelope > span {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
}
.envelope-shadow {
  top: auto;
  bottom: -6%;
  left: 8%;
  width: 84%;
  height: 22%;
  background: radial-gradient(ellipse at center, rgba(120, 100, 60, 0.28), rgba(120, 100, 60, 0) 70%);
  filter: blur(6px);
}
.envelope-back {
  background: linear-gradient(#fdfaf3, #f3ead7);
  border: 1px solid var(--gold-soft);
  border-radius: 8px;
  box-shadow: 0 24px 52px rgba(120, 100, 60, 0.22);
}
/* The letter tucked inside; rises out when the envelope opens. */
.envelope-letter {
  left: 9%;
  top: 8%;
  width: 82%;
  height: 82%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(#ffffff, #fffdf8);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 6px 16px rgba(120, 100, 60, 0.14);
  transform: translateY(6%) scale(0.99);
  z-index: 1;
  /* Starts rising only once the flap has begun to open. */
  /* z-index is held back so the letter only jumps in front of the flap once
     the flap has actually lifted clear, instead of popping at frame one. */
  transition: transform 1.6s cubic-bezier(0.22, 0.61, 0.24, 1) 0.35s,
    box-shadow 1.6s ease 0.35s, opacity 0.5s ease, z-index 0s linear 0.5s;
}
.envelope-letter-eyebrow {
  font-size: 0.6rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
}
.envelope-letter-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  color: var(--text);
}
.envelope-letter-rule { width: 40px; height: 1px; background: var(--gold); }
/* Front pocket (masks the letter's lower half). */
.envelope-front {
  z-index: 3;
  background: linear-gradient(#f6edda, #ede1c9);
  border-radius: 8px;
  clip-path: polygon(0 33%, 50% 73%, 100% 33%, 100% 100%, 0 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
}
/* Triangular top flap; hinges open on the top edge. */
.envelope-flap {
  z-index: 4;
  height: 64%;
  background: linear-gradient(#f3e9d4, #e7d9ba);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  transform-origin: top center;
  transform: rotateX(0deg);
  backface-visibility: hidden;
  /* Slight overshoot on the way open, like a real hinged flap settling. */
  transition: transform 1.5s cubic-bezier(0.45, 0.02, 0.25, 1.02) 0.05s,
    filter 0.7s ease, z-index 0s linear 0.5s;
  box-shadow: 0 2px 8px rgba(120, 100, 60, 0.12);
}
/* Opening: flap lifts back, letter slides up and out. The idle float keeps
   running — cutting it dead here snapped the envelope down by up to 7px. */
.envelope.is-opening .envelope-flap {
  transform: rotateX(178deg);
  filter: brightness(0.92);
  z-index: 1;
}
.envelope.is-opening .envelope-letter {
  transform: translateY(-64%) scale(1.05);
  z-index: 6;
  box-shadow: 0 26px 46px rgba(120, 100, 60, 0.28);
}

@keyframes env-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-7px); }
}

@media (prefers-reduced-motion: reduce) {
  .stream,
  .petal,
  .envelope,
  .envelope-flap,
  .envelope-letter,
  .envelope-transition { animation: none !important; transition: none !important; }
  .petals { display: none; }
}

/* ===== Custom cursor: a coral heart with a thick gold border =====
   Plain solid fills only — no gradient, and no url(#id) paint reference,
   which renders black wherever it fails to resolve in a cursor image.
   The brighter variant stands in wherever pointer would have been. */
:root {
  --cursor-heart: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2248%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%20transform%3D%22translate%2816%2016%29%20scale%280.82%29%20translate%28-16%20-16%29%22%3E%3Cpath%20d%3D%22M16%2024.6C7.6%2018.4%205.3%2013.8%207.3%2010.5C9%207.6%2013%207.7%2014.9%2010.3L16%2011.8L17.1%2010.3C19%207.7%2023%207.6%2024.7%2010.5C26.7%2013.8%2024.4%2018.4%2016%2024.6Z%22%20fill%3D%22%23e08a7b%22%20stroke%3D%22%23e8b73f%22%20stroke-width%3D%222.4%22%20stroke-opacity%3D%221%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 24 24;
  --cursor-heart-bright: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2248%22%20viewBox%3D%220%200%2032%2032%22%3E%3Cg%20transform%3D%22translate%2816%2016%29%20scale%280.95%29%20translate%28-16%20-16%29%22%3E%3Cpath%20d%3D%22M16%2024.6C7.6%2018.4%205.3%2013.8%207.3%2010.5C9%207.6%2013%207.7%2014.9%2010.3L16%2011.8L17.1%2010.3C19%207.7%2023%207.6%2024.7%2010.5C26.7%2013.8%2024.4%2018.4%2016%2024.6Z%22%20fill%3D%22%23e08a7b%22%20stroke%3D%22%23e8b73f%22%20stroke-width%3D%222.6%22%20stroke-opacity%3D%221%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fg%3E%3C%2Fsvg%3E") 24 24;
}
body { cursor: var(--cursor-heart), auto; }
/* Typing in a field still wants the usual I-beam. */
input, textarea, select { cursor: auto; }

/* ===== Heart trail that follows the pointer ===== */
.cursor-trail {
  position: fixed;
  z-index: 120;
  pointer-events: none;
  margin: -7px 0 0 -7px;
  font-size: 14px;
  line-height: 1;
  color: var(--accent);
  text-shadow: 0 0 4px rgba(255, 211, 94, 0.95), 0 0 11px rgba(248, 198, 51, 0.75);
  animation: trail-fade 900ms cubic-bezier(0.25, 0.6, 0.3, 1) forwards;
  will-change: transform, opacity;
}
@keyframes trail-fade {
  0% { opacity: 0.85; transform: translate(0, 0) scale(0.6) rotate(var(--rot, 0deg)); }
  30% { opacity: 0.7; transform: translate(var(--dx, 0px), -4px) scale(1) rotate(var(--rot, 0deg)); }
  100% { opacity: 0; transform: translate(var(--dx, 0px), 22px) scale(0.35) rotate(var(--rot, 0deg)); }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-trail { display: none; }
}
