/* ============================================================
   Lucia & Mihai — wedding invitation
   Romantic botanical · soft tones
   ============================================================ */

/* ---- Theme tokens ---------------------------------------- */
:root {
  --bg:        #F6F2E9;
  --bg-panel:  #EFE9DC;
  --ink:       #38432F;
  --ink-soft:  #646B4D;   /* darkened for WCAG AA (~5:1 on --bg) */
  --accent:    #8B9A77;   /* sage */
  --accent-2:  #C99E96;   /* dusty blush */
  --gold:      #B08D57;
  --danger:    #A14B45;   /* legible error text */
  --line:      rgba(56,67,47,0.16);
  --line-soft: rgba(56,67,47,0.09);
  --shadow:    rgba(56,67,47,0.10);

  --font-display: 'Spectral', Georgia, serif;
  --font-script:  'Parisienne', cursive;
  --font-label:   'Jost', system-ui, sans-serif;
}

/* ---- Reset ----------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 21px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background 0.6s ease, color 0.6s ease;
}

::selection { background: var(--accent); color: var(--bg); }

/* ---- Visible keyboard focus (a11y) -----------------------
   Mouse/touch users see nothing extra; keyboard users get a
   clear sage ring on every interactive target. */
:where(a, button, textarea, [href], .stepper button):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.field input:focus-visible,
.field textarea:focus-visible,
.field select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* segmented Da/Nu controls hide the native radio — ring the label */
.seg label:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
/* fallback for engines without :has() — ring the inner span */
.seg input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 6px;
  border-radius: 3px;
}
.btn-submit:focus-visible { outline-offset: 4px; }

/* ---- Quick nav ------------------------------------------- */
.quicknav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px clamp(20px, 5vw, 56px);
  background: rgba(246, 242, 233, .86);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border-bottom: 1px solid var(--line-soft);
  transform: translateY(-110%);
  opacity: 0;
  transition: transform .5s cubic-bezier(.2,.7,.2,1), opacity .4s ease, background .6s ease;
}
.quicknav.show { transform: none; opacity: 1; }

.qn-brand {
  font-family: var(--font-script);
  font-size: clamp(1.5rem, 2vw, 1.9rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.qn-brand span { color: var(--accent); margin: 0 2px; }

.qn-links {
  list-style: none;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.6vw, 22px);
  margin: 0; padding: 0;
}
.qn-links a {
  position: relative;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.66rem;
  color: var(--ink-soft);
  text-decoration: none;
  padding: 6px 2px;
  transition: color .25s ease;
  white-space: nowrap;
}
.qn-links a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform .3s ease;
}
.qn-links a:hover { color: var(--ink); }
.qn-links a.active { color: var(--ink); }
.qn-links a.active::after { transform: scaleX(1); }

.qn-links a.qn-cta {
  color: var(--bg);
  background: var(--accent);
  border-radius: 3px;
  padding: 8px 16px;
  letter-spacing: 0.2em;
  transition: background .25s ease, color .25s ease;
}
.qn-links a.qn-cta::after { display: none; }
.qn-links a.qn-cta:hover { background: var(--ink); color: var(--bg); }
.qn-links a.qn-cta.active { color: var(--bg); }

@media (max-width: 620px) {
  .qn-links li:not(:last-child) { display: none; }
  .quicknav { justify-content: space-between; }
}

/* ---- Petals canvas --------------------------------------- */
#petals {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
}

/* ---- Botanical background ornaments ---------------------- */
.has-flora { isolation: isolate; overflow: hidden; }
/* ---- Curated watercolor bouquets (always-on background) --
   Statement blossoms anchored to section edges. They sit at
   z-index:-1 (behind content, above the section background) and
   bleed off the edge — .has-flora's overflow:hidden crops them
   into a soft frame. Decorative only; pointer-events off. */
.bouquet {
  position: absolute;
  z-index: -1;
  display: block;
  pointer-events: none;
  object-fit: contain;
  opacity: 0.66;
  filter: saturate(0.97) drop-shadow(0 12px 26px rgba(60, 50, 40, 0.10));
  transition: opacity 0.6s ease;
}
@media (max-width: 720px) {
  .bouquet { opacity: 0.42; }
  .bouquet.hide-sm { display: none !important; }
}

/* ---- Shared layout --------------------------------------- */
.section {
  position: relative;
  z-index: 1;
  padding: clamp(64px, 11vh, 132px) clamp(22px, 6vw, 80px);
}
.wrap { max-width: 940px; margin: 0 auto; }
.wrap-wide { max-width: 1180px; margin: 0 auto; }
.center { text-align: center; }

.eyebrow {
  font-family: var(--font-label);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--accent);
  display: inline-block;
}

.section-title {
  font-size: clamp(2.4rem, 5.5vw, 3.9rem);
  font-weight: 500;
  line-height: 1.05;
  letter-spacing: 0.01em;
}

.lede {
  font-size: clamp(1.2rem, 2.4vw, 1.55rem);
  color: var(--ink-soft);
  font-weight: 400;
  line-height: 1.55;
}

/* ---- Botanical divider (simple line + leaf shapes) ------- */
.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 26px auto;
  color: var(--accent);
}
.divider .stem {
  height: 1px;
  width: clamp(40px, 12vw, 110px);
  background: linear-gradient(90deg, transparent, currentColor);
}
.divider .stem.right { background: linear-gradient(270deg, transparent, currentColor); }
.divider .leaf {
  width: 11px; height: 22px;
  background: currentColor;
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
  opacity: 0.85;
}
.divider .leaf.a { transform: rotate(-26deg); }
.divider .leaf.b { transform: rotate(26deg);  margin-left: -4px; }
.divider .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent-2); }

/* tweak: hide the decorative dividers (keep a small spacer) */
body[data-dividers="off"] .divider > * { display: none; }
body[data-dividers="off"] .divider { margin: 9px auto; gap: 0; }
/* …and the decorative seal/circle above the RSVP "Mulțumim" message */
body[data-dividers="off"] .rsvp-done .seal { display: none; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 22px 56px;
  position: relative;
}
.hero-frame {
  position: absolute;
  inset: clamp(16px, 3vw, 38px);
  border: 1px solid var(--line);
  pointer-events: none;
}
.hero-frame::before, .hero-frame::after {
  content: '';
  position: absolute;
  width: 54px; height: 54px;
  border: 1px solid var(--accent);
  opacity: 0.6;
}
.hero-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.hero-frame::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.hero .kicker {
  font-family: var(--font-label);
  letter-spacing: 0.46em;
  text-transform: uppercase;
  font-size: 0.7rem;
  color: var(--ink-soft);
  margin-bottom: 30px;
}
.names {
  font-family: var(--font-script);
  font-size: clamp(4.2rem, 16vw, 11rem);
  line-height: 0.92;
  color: var(--ink);
  font-weight: 400;
}
.names .amp {
  display: block;
  font-size: 0.42em;
  color: var(--accent);
  margin: 0.06em 0;
}
.hero-meta {
  margin-top: 34px;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.82rem;
  color: var(--ink);
  display: flex;
  gap: 18px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}
.hero-meta .sep { width: 5px; height: 5px; background: var(--accent-2); border-radius: 50%; }

.scroll-cue {
  position: absolute;
  bottom: 30px; left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-label);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  font-size: 0.6rem;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.scroll-cue .bar {
  width: 1px; height: 42px;
  background: linear-gradient(var(--accent), transparent);
  animation: cue 2.4s ease-in-out infinite;
  transform-origin: top;
}
@keyframes cue { 0%,100%{transform:scaleY(0.4);opacity:.4} 50%{transform:scaleY(1);opacity:1} }

/* ============================================================
   COUNTDOWN
   ============================================================ */
.countdown { background: var(--bg-panel); transition: background .6s ease; }
.count-grid {
  display: flex;
  justify-content: center;
  gap: clamp(14px, 5vw, 56px);
  margin-top: 38px;
  flex-wrap: wrap;
}
.count-cell { min-width: 88px; }
.count-num {
  font-size: clamp(3rem, 8vw, 5.4rem);
  font-weight: 400;
  line-height: 1;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  color: var(--ink);
}
.count-label {
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.66rem;
  color: var(--accent);
  margin-top: 12px;
}
.count-msg {
  margin-top: 30px;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.3rem;
}

/* ============================================================
   INVITATION line
   ============================================================ */
/* Two-column invitation: photo left, text right, vertically centered */
.invite-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(36px, 6vw, 80px);
  text-align: left;
}
.invite-body { min-width: 0; }
.invite-text {
  font-size: clamp(1.5rem, 3.4vw, 2.3rem);
  line-height: 1.5;
  font-weight: 400;
  color: var(--ink);
  max-width: 560px;
  text-wrap: pretty;
}
.invite-text em { color: var(--accent); font-style: italic; }
.invite-grid .divider { margin-left: 0; }

/* nași — godparents line under the invitation text */
.invite-nasi {
  margin-top: 26px;
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.9vw, 1.9rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.4;
  color: var(--ink);
  text-wrap: pretty;
}
.invite-nasi .amp { font-style: italic; color: var(--accent); }
.invite-nasi-label {
  display: block;
  font-family: var(--font-label);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.66rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}

.photo-slot {
  width: min(420px, 42vw);
  height: min(520px, 58vh);
  margin: 0;
  display: block;
  object-fit: cover;
  object-position: center;
  border-radius: 4px;
  box-shadow: 0 30px 60px -28px var(--shadow);
}


@media (max-width: 720px) {
  .invite-grid { grid-template-columns: 1fr; text-align: center; gap: 36px; justify-items: center; }
  .photo-slot { width: min(420px, 80vw); height: min(520px, 64vh); }
  .invite-text { margin: 0 auto; }
  .invite-grid .divider { margin-left: auto; }
}

/* ============================================================
   SCHEDULE / TIMELINE
   ============================================================ */
.schedule { background: var(--bg-panel); transition: background .6s ease; }

/* schedule + map side by side */
.day-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(28px, 4vw, 56px);
  align-items: stretch;
  text-align: left;
  margin-top: clamp(40px, 6vh, 68px);
}
.day-col { min-width: 0; }
/* Map column spans the full height of the event list: the map box starts level
   with the first event card and the legend ends level with the last card's
   bottom. The map fills the space above the legend. */
.day-col.map-block { display: flex; flex-direction: column; justify-content: flex-start; margin-top: 0; }
.day-col.map-block .map-shell { flex: 1 1 auto; min-height: 0; margin-top: 0; width: 100%; }
.day-col.map-block #map { height: 100%; min-height: 320px; }
.day-col.map-block .map-legend { justify-content: center; margin-top: 20px; }
@media (max-width: 860px) {
  .day-grid { grid-template-columns: 1fr; gap: 40px; }
  .day-col.map-block .map-legend { justify-content: center; }
  .day-col.map-block #map { min-height: 380px; }
}
.timeline {
  margin-top: 0;
  display: grid;
  gap: 26px;
  align-content: start;
}
.event {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: clamp(28px, 4vw, 46px);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(18px, 2.6vw, 36px);
  align-items: center;
  position: relative;
  overflow: hidden;
  transition: transform .5s ease, box-shadow .5s ease, background .6s ease;
}
.event::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--accent);
}
/* match each event's accent bar to its map-pin color */
.timeline .event:nth-of-type(2)::before { background: var(--accent-2); }
.timeline .event:nth-of-type(2) .event-time { color: var(--accent-2); }
.event:hover {
  transform: translateY(-4px);
  box-shadow: 0 26px 46px -26px var(--shadow);
}
.event-time {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 2.4vw, 1.9rem);
  letter-spacing: 0.02em;
  color: var(--accent);
  font-weight: 500;
  font-variant-numeric: lining-nums tabular-nums;
  font-feature-settings: "lnum" 1, "tnum" 1;
  white-space: nowrap;
}
.event-name { font-size: clamp(1.7rem, 3vw, 2.3rem); font-weight: 500; line-height: 1.1; }
.event-place { font-family: var(--font-label); font-size: 0.82rem; letter-spacing: 0.06em; color: var(--ink-soft); margin-top: 10px; text-transform: uppercase; }
.event-note  { color: var(--ink-soft); font-style: italic; margin-top: 10px; font-size: 1.05rem; }

@media (max-width: 560px) {
  .event { grid-template-columns: 1fr; gap: 12px; }
  .event-time { font-size: 1.4rem; }
}

/* ============================================================
   MAP
   ============================================================ */
.map-block { margin-top: clamp(58px, 9vh, 104px); }
.map-shell {
  margin-top: 36px;
  border: 1px solid var(--line);
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 30px 60px -34px var(--shadow);
}
#map { width: 100%; height: clamp(360px, 56vh, 560px); background: var(--bg-panel); }
.leaflet-container { font-family: var(--font-label) !important; }
.map-legend {
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 26px;
  font-family: var(--font-label);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
}
.map-legend a { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; transition: color .25s ease; }
.map-legend a:hover { color: var(--ink); }
.map-legend span { display: inline-flex; align-items: center; gap: 9px; }
.map-legend .pin { width: 13px; height: 13px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); }
.map-pop b { font-family: var(--font-display); font-size: 1.15rem; }
.map-pop small { font-family: var(--font-label); letter-spacing: 0.04em; color: #777; }
.map-pop .map-link {
  display: inline-block;
  margin-top: 9px;
  font-family: var(--font-label);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 1px;
}
.map-pop .map-link:hover { color: var(--ink); }

/* ============================================================
   RSVP
   ============================================================ */
.rsvp { background: var(--bg); transition: background .6s ease; }
.rsvp-card {
  margin-top: 46px;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: clamp(30px, 5vw, 62px);
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
  box-shadow: 0 34px 64px -38px var(--shadow);
}
.field { margin-bottom: 26px; text-align: left; }
.field label {
  display: block;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.68rem;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 10px 2px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  color: var(--ink);
  transition: border-color .3s ease;
}
.field textarea { resize: vertical; min-height: 70px; line-height: 1.5; }
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field input::placeholder, .field textarea::placeholder { color: var(--ink-soft); opacity: 0.55; }
.field.err input, .field.err select { border-color: var(--danger); }
.field .msg { font-family: var(--font-label); font-size: 0.7rem; letter-spacing: 0.04em; color: var(--danger); margin-top: 8px; min-height: 0; display:none; }
.field.err .msg { display: block; }

/* attendance segmented */
.seg { display: flex; gap: 12px; }
.seg label {
  flex: 1;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  letter-spacing: 0.16em;
  transition: all .25s ease;
  color: var(--ink-soft);
}
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label:hover { border-color: var(--accent); color: var(--ink); }
.seg input:checked + span { color: var(--ink); }
.seg label.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }

.stepper { display: flex; align-items: center; gap: 18px; }.stepper button {
  width: 44px; height: 44px;
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 50%;
  font-size: 1.4rem;
  color: var(--ink);
  cursor: pointer;
  font-family: var(--font-display);
  transition: all .2s ease;
  display: flex; align-items: center; justify-content: center;
}
.stepper button:hover { border-color: var(--accent); color: var(--accent); }
.stepper .val { font-family: var(--font-display); font-size: 1.9rem; min-width: 40px; text-align: center; font-variant-numeric: lining-nums tabular-nums; font-feature-settings: "lnum" 1, "tnum" 1; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(18px, 5vw, 44px); margin-bottom: 26px; }
#attend-extra { margin-bottom: 26px; }
@media (max-width: 460px) { .two-col { grid-template-columns: 1fr; gap: 22px; } }

.btn-submit {
  width: 100%;
  margin-top: 8px;
  background: var(--ink);
  color: var(--bg);
  border: 0;
  padding: 19px;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.32em;
  font-size: 0.78rem;
  cursor: pointer;
  border-radius: 4px;
  transition: background .3s ease, transform .2s ease, letter-spacing .3s ease;
}
.btn-submit:hover { background: var(--accent); letter-spacing: 0.4em; }
.btn-submit:active { transform: scale(0.99); }

/* confirmation */
.rsvp-done { text-align: center; display: none; }
.rsvp-card.done .rsvp-form { display: none; }
.rsvp-card.done .rsvp-done { display: block; }
.rsvp-done .seal {
  width: 86px; height: 86px;
  margin: 0 auto 26px;
  border: 1px solid var(--accent);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent);
  font-size: 2.4rem;
  position: relative;
}
.rsvp-done .seal::after {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid var(--line);
  border-radius: 50%;
}
.rsvp-done h3 { font-size: 2.3rem; font-weight: 500; }
.rsvp-done p { color: var(--ink-soft); margin-top: 12px; font-size: 1.2rem; }
.rsvp-contact-note {
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(161,75,69,.4);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--line));
  border-radius: 12px;
  background: rgba(161,75,69,.08);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  color: var(--danger) !important;
  font-family: var(--font-label);
  font-size: 0.92rem !important;
  line-height: 1.5;
  text-wrap: pretty;
}
.rsvp-contact-note[hidden] { display: none; }
.rsvp-done .reset {
  margin-top: 24px;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-label); text-transform: uppercase;
  letter-spacing: 0.2em; font-size: 0.66rem; color: var(--accent);
  border-bottom: 1px solid var(--line); padding-bottom: 4px;
}

/* ============================================================
   CONTACTS
   ============================================================ */
.contacts { margin-top: 54px; }
.contacts-intro {
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.72rem;
  color: var(--ink-soft);
}
.contacts-grid {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(26px, 7vw, 64px);
  margin-top: 24px;
  flex-wrap: wrap;
}
.contact { display: flex; flex-direction: column; gap: 6px; }
.contact-name {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
  color: var(--ink);
}
/* tweak: contact names in calligraphy (Parisienne) vs the current serif */
body[data-contactnames="script"] .contact-name {
  font-family: 'Parisienne', cursive;
  font-weight: 400;
  font-size: 2.4rem;
  line-height: 1;
}
.contact-phone {
  font-family: var(--font-label);
  letter-spacing: 0.1em;
  font-size: 0.92rem;
  color: var(--accent);
  text-decoration: none;
  transition: color .25s ease;
}
.contact-phone:hover { color: var(--ink); }
.contact-div { width: 1px; height: 44px; background: var(--line); }
@media (max-width: 480px) { .contact-div { display: none; } }

/* ============================================================
   FOOTER
   ============================================================ */
.footer {
  text-align: center;
  padding: clamp(70px, 12vh, 130px) 22px;
  position: relative;
  z-index: 1;
  background: var(--bg-panel);
  transition: background .6s ease;
}
.footer .names { font-size: clamp(3rem, 9vw, 5.6rem); }
.footer .closing {
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: 0.34em;
  font-size: 0.72rem;
  color: var(--ink-soft);
  margin-top: 26px;
}

/* ---- Scroll reveal --------------------------------------- */
.reveal { opacity: 0; transform: translateY(26px); transition: opacity .7s cubic-bezier(.2,.7,.2,1), transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal.d1 { transition-delay: .09s; }
.reveal.d2 { transition-delay: .18s; }
.reveal.d3 { transition-delay: .27s; }
/* safety: committed final state (no transition) so reveals never stick hidden */
.reveal.shown { opacity: 1 !important; transform: none !important; transition: none !important; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(20px);} to { opacity:1; transform:none;} }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1 !important; transform: none !important; }
  .scroll-cue .bar { animation: none; }
  html { scroll-behavior: auto; }
}

/* ============================================================
   Envelope intro
   ============================================================ */
#envelope-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: grid;
  place-items: center;
  padding: 24px;
  /* solid fallback first, in case color-mix() isn't supported (older browsers) */
  background-color: #F3EEE3;
  background-image:
    radial-gradient(130% 110% at 50% 38%,
      color-mix(in srgb, var(--bg) 94%, #fff) 0%,
      var(--bg) 52%,
      var(--bg-panel) 100%);
  perspective: 1600px;
  overflow: hidden;
}
#envelope-overlay.is-done {
  opacity: 0;
  pointer-events: none;
  transition: opacity .9s ease;
}

.env-stage {
  position: relative;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  animation: envFloatIn 1s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes envFloatIn {
  from { opacity: 0; transform: translateY(30px) scale(.95); }
  to   { opacity: 1; transform: none; }
}

.env {
  position: relative;
  width: min(540px, 86vw);
  aspect-ratio: 1.5 / 1;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  cursor: pointer;
  -webkit-filter: drop-shadow(0 38px 52px rgba(56,67,47,.28));
  filter: drop-shadow(0 38px 52px rgba(56,67,47,.28));
  animation: envBob 4.5s ease-in-out infinite;
}
@keyframes envBob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-9px); }
}
#envelope-overlay.opening .env { animation: none; }

.env-back {
  position: absolute; inset: 0; z-index: 1;
  border-radius: 0;
  background: linear-gradient(155deg, #EFE7D6, #E2D6BF);
  box-shadow:
    inset 0 0 0 1px rgba(176,141,87,.18),
    inset 0 18px 28px -16px rgba(110,82,46,.45);
}

.env-letter {
  position: absolute;
  left: 7%; right: 7%;
  top: 12%; bottom: 9%;            /* fully contained inside the envelope when closed */
  z-index: 2;
  border-radius: 8px 8px 4px 4px;
  background: linear-gradient(180deg, #EFE5D2 0%, #E8DDC7 100%);
  box-shadow: 0 12px 26px -14px rgba(56,67,47,.4);
  transform: translateY(0);        /* tucked behind flap (top) & front pocket (bottom) */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 7% 9%;
  overflow: hidden;
  transition: transform 1s cubic-bezier(.2,.8,.2,1);
}
.env-letter .el-kicker {
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: .38em;
  font-size: .54rem;
  color: var(--ink-soft);
  opacity: 0;
  transition: opacity .5s ease;
}
.env-letter .el-names {
  font-family: var(--font-script);
  font-size: clamp(1.9rem, 4.6vw, 2.9rem);
  line-height: 0.92;
  font-weight: 400;
  color: var(--ink);
  margin-top: 20px;
  opacity: 0;
  transition: opacity .5s ease;
}
.env-letter .el-names .amp {
  display: block;
  font-size: 0.42em;
  color: var(--accent);
  margin: 0.06em 0;
}
.env-letter .el-meta {
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: .3em;
  font-size: .58rem;
  color: var(--ink);
  margin-top: 20px;
  opacity: 0;
  transition: opacity .5s ease;
}
.env-letter .amp { color: var(--accent); }

/* inset frame mirroring the hero's .hero-frame */
.env-letter .el-frame {
  position: absolute;
  inset: 11px;
  border: 1px solid var(--line);
  pointer-events: none;
  opacity: 0;
  transition: opacity .5s ease;
}
.env-letter .el-frame::before,
.env-letter .el-frame::after {
  content: '';
  position: absolute;
  width: 22px; height: 22px;
  border: 1px solid var(--accent);
  opacity: 0.6;
}
.env-letter .el-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.env-letter .el-frame::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* corner bouquet echoing the hero's top-right blossom — sits behind the
   text (z-index:-1, above the letter's own background) and bleeds off the
   corner just like the hero, cropped by the letter's overflow:hidden. */
.env-letter .el-bouquet {
  position: absolute;
  top: 0; right: 0;
  width: 30%;
  max-width: 132px;
  z-index: -1;
  pointer-events: none;
  transform: translate(17%, -15%) rotate(5deg);
  opacity: 0;
  filter: saturate(0.97) drop-shadow(0 12px 26px rgba(60, 50, 40, 0.10));
  transition: opacity .6s ease;
}
/* balancing spray, bottom-left — mirrors the hero's diagonal composition:
   larger top-right answered by a smaller, lighter one bottom-left */
.env-letter .el-bouquet-2 {
  top: auto; right: auto;
  left: 0; bottom: 0;
  width: 22%;
  max-width: 96px;
  transform: translate(-15%, 15%) rotate(184deg);
}

.env-front {
  position: absolute; inset: 0; z-index: 3;
  border-radius: 4px;
  background: #F6EFE1;
  box-shadow:
    inset 0 0 0 1px rgba(176,141,87,.20),
    inset 0 2px 0 rgba(255,255,255,.55);
  overflow: hidden;
}

/* three static flaps (left / right / bottom) meeting the top flap at centre */
.env-fold {
  position: absolute; inset: 0; z-index: 3;
  border-radius: 0;
  box-shadow: inset 0 0 0 1px rgba(176,141,87,.16);
}
.env-fold-l { -webkit-clip-path: polygon(0 0, 0 100%, 50% 50%); clip-path: polygon(0 0, 0 100%, 50% 50%); background: linear-gradient(100deg, #F2E7D3, #ECE1CC); }
.env-fold-r { -webkit-clip-path: polygon(100% 0, 100% 100%, 50% 50%); clip-path: polygon(100% 0, 100% 100%, 50% 50%); background: linear-gradient(260deg, #F2E7D3, #ECE1CC); }
.env-fold-b { -webkit-clip-path: polygon(0 100%, 100% 100%, 50% 50%); clip-path: polygon(0 100%, 100% 100%, 50% 50%); background: linear-gradient(0deg, #E7DCC5, #EFE4CF); }

.env-flap {
  position: absolute; inset: 0;
  z-index: 4;
  transform-origin: top center;
  transform: rotateX(0deg);
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 50%);
  clip-path: polygon(0 0, 100% 0, 50% 50%);
  background: linear-gradient(180deg, #E8DCC2 0%, #D6C5A4 100%);
  -webkit-filter: drop-shadow(0 6px 6px rgba(56,67,47,.2));
  filter: drop-shadow(0 6px 6px rgba(56,67,47,.2));
  transition: transform .9s cubic-bezier(.6,.05,.3,1);
}
/* crisp fold lines along the flap's diagonal edges */
.env-flap::after {
  content: "";
  position: absolute; inset: 0;
  -webkit-clip-path: polygon(0 0, 100% 0, 50% 50%);
  clip-path: polygon(0 0, 100% 0, 50% 50%);
  box-shadow: inset 0 0 0 1px rgba(140,108,60,.3);
}

.env-seal {
  position: absolute; left: 50%; top: 50%;
  z-index: 5;
  width: 150px; height: auto;
  transform: translate(-50%, -50%);
  -webkit-filter: drop-shadow(0 8px 14px rgba(90,20,20,.4));
  filter: drop-shadow(0 8px 14px rgba(90,20,20,.4));
  transition: transform .45s ease, opacity .45s ease;
  pointer-events: none;
  user-select: none;
}

.env-hint {
  position: absolute; left: 0; right: 0; bottom: -62px;
  text-align: center;
  font-family: var(--font-label);
  text-transform: uppercase;
  letter-spacing: .24em;
  font-size: .7rem;
  color: var(--ink-soft);
  animation: hintPulse 2.2s ease-in-out infinite;
  transition: opacity .4s ease;
}
@keyframes hintPulse { 0%,100% { opacity: .45; } 50% { opacity: 1; } }

/* ---- open sequence ---- */
#envelope-overlay.opening .env-seal { opacity: 0; transform: translate(-50%,-50%) scale(.35) rotate(-12deg); }
#envelope-overlay.opening .env-hint { opacity: 0; }
#envelope-overlay.opening .env-flap { transform: rotateX(179deg); }
#envelope-overlay.flap-open .env-flap { z-index: 1; }
#envelope-overlay.rising .env-letter { transform: translateY(-66%); }
#envelope-overlay.rising .env-letter .el-bouquet { opacity: 0.66; transition: opacity .6s ease .06s; }
#envelope-overlay.rising .env-letter .el-bouquet-2 { opacity: 0.38; transition: opacity .6s ease .12s; }
#envelope-overlay.rising .env-letter .el-frame  { opacity: 1; transition: opacity .5s ease .12s; }
#envelope-overlay.rising .env-letter .el-kicker { opacity: 1; transition: opacity .5s ease .20s; }
#envelope-overlay.rising .env-letter .el-names  { opacity: 1; transition: opacity .5s ease .35s; }
#envelope-overlay.rising .env-letter .el-meta   { opacity: 1; transition: opacity .5s ease .50s; }
#envelope-overlay.expanding .env-stage {
  transform: scale(1.16);
  transition: transform 1s cubic-bezier(.4,0,.2,1);
}
#envelope-overlay.expanding .env-letter {
  transform: translateY(-66%) scale(1.26);
  opacity: 0;
  box-shadow: none;
  transition: transform 1s cubic-bezier(.4,0,.2,1), opacity .8s ease .15s;
}
#envelope-overlay.expanding .env-back,
#envelope-overlay.expanding .env-fold,
#envelope-overlay.expanding .env-flap,
#envelope-overlay.expanding .env-seal { opacity: 0; transition: opacity .55s ease; }

@media (prefers-reduced-motion: reduce) {
  #envelope-overlay { display: none; }
}

/* On small screens the envelope (and its letter) shrink a lot. Scale the
   letter's content down and tighten the frame so the kicker no longer
   overflows above the top border. */
@media (max-width: 600px) {
  .env-letter { padding: 5% 7%; }
  .env-letter .el-frame { inset: 7px; }
  .env-letter .el-kicker { letter-spacing: .2em; font-size: .46rem; }
  .env-letter .el-names { font-size: clamp(1.5rem, 7.2vw, 2.1rem); margin-top: 12px; }
  .env-letter .el-meta { letter-spacing: .18em; font-size: .5rem; margin-top: 12px; }
  .env-letter .el-bouquet { width: 34%; transform: translate(17%, -15%) rotate(5deg); }
  .env-letter .el-bouquet-2 { width: 25%; transform: translate(-15%, 15%) rotate(184deg); }
}
