/* The opening overlay. Rebuilt from nothing.
 *
 * Design rule that the previous version broke repeatedly: NOTHING here may
 * hide an ancestor of the WebGL canvas. The old CSS hid `.envelope-stage` to
 * put the drawn envelope away, and the canvas lived inside it, so the
 * sequence erased itself. There is now no drawn envelope to hide, and the
 * mount has no wrapper that anything toggles.
 *
 * The overlay starts hidden in the markup and is shown by JS only once there
 * is something to see. If the script never runs, the overlay never appears
 * and the page is simply itself - which is the fallback, rather than a second
 * animation pretending to be one.
 */

.intro {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ivory-deep, #F3EADA);
  opacity: 1;
  transition: opacity 0.6s ease;
}

.intro[hidden] { display: none !important; }

.intro.is-closing {
  opacity: 0;
  pointer-events: none;
}

/* The canvas fills the overlay. Not a small card in the middle: the sequence
   lifts a card out, orbits a heart around it and spins it, and all of that
   needs room. */
.intro-stage {
  position: absolute;
  inset: 0;
}

.intro-stage canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Sits above the canvas so a drag reaches it rather than the page. */
.intro-hint {
  position: absolute;
  left: 50%;
  bottom: 16%;
  transform: translateX(-50%);
  z-index: 3;
  margin: 0;
  padding: 0 1rem;
  text-align: center;
  font-size: var(--text-xs, 0.85rem);
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--blue-deep, #4A6A80);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.intro-hint.is-visible { opacity: 0.9; }

/* The way out. Always present, always reachable, from the first frame -
   including for anyone who cannot drag, tap or scratch anything. */
.intro-skip {
  position: absolute;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 1.25rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: var(--text-xs, 0.85rem);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--blue-deep, #4A6A80);
  opacity: 0.75;
  cursor: pointer;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.intro-skip:hover { color: var(--gold-deep, #96751C); opacity: 1; }
.intro-skip:focus-visible { opacity: 1; outline: 2px solid var(--blue-deep, #4A6A80); outline-offset: 3px; }

/* ---------- the scratch card ----------
   A DOM canvas centred over the stage. Deliberately NOT painted into the
   model's UVs: the text under the foil stays real markup a screen reader can
   read, and the proven scratch code is reused as-is. */
.intro-card {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) scale(0.94);
  z-index: 2;
  /* Fixed cap in px. It used to be 24rem, which follows the root font size,
     so the card grew on every browser-zoom step. 320px stays put; the vw term
     only ever shrinks it on a narrow phone. */
  width: min(86vw, 320px);
  aspect-ratio: 4 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--ivory, #FAF6ED);
  border: 1px solid var(--gold, #C9A227);
  box-shadow: 0 22px 48px rgba(44, 42, 38, 0.3);
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-card.is-in { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.intro-card-under { position: absolute; inset: 0; }

.intro-card-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  /* No blur. It was softened so white type could sit on it; the type has its
     own opaque plate now, so the photograph can be what it is. */
  transform: scale(1.02);
}

/* White panel along the bottom, so the name never depends on what happens to
   be behind it in the photograph. */
.intro-card-plate {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.7rem 1rem 0.9rem;
  background: rgba(255, 255, 255, 0.92);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
  text-align: center;
}

.intro-card-eyebrow {
  margin: 0 0 0.15rem;
  font-size: var(--text-xs, 0.85rem);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--blue-deep, #4A6A80);
}

.intro-card-name {
  margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--text-md, 1.35rem);
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink, #2C2A26);
}

.intro-foil {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;          /* the drag belongs to the foil, not the page */
  transition: opacity 0.5s ease;
}

.intro-foil:active { cursor: grabbing; }
.intro-card.is-clear .intro-foil { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .intro { transition: none; }
  .intro-card { transition: none; }
}

/* ==========================================================
   THE DOCK + SAVE-THE-DATE PANEL
   Re-homed here after css/intro-3d.css was deleted - these lost
   their styling with it, which is why the dock stopped looking
   like anything.
   ========================================================== */

/* position: fixed, so it is anchored to the VIEWPORT and stays in the
   bottom-right corner through any amount of scrolling. */
.intro-dock {
  position: fixed;
  right: max(0.9rem, env(safe-area-inset-right, 0px));
  bottom: max(0.9rem, env(safe-area-inset-bottom, 0px));
  z-index: 900;
  width: 54px;
  height: 54px;
  padding: 5px;
  background: var(--ivory, #FAF6ED);
  border: 1px solid var(--gold, #C9A227);
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(44, 42, 38, 0.22);
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px) scale(0.9);
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.intro-dock.visible { opacity: 1; transform: none; }
.intro-dock:hover { border-color: var(--gold-deep, #96751C); }
.intro-dock img { width: 100%; height: 100%; object-fit: contain; }

/* The panel is gold leaf, not cream: it is the one place on the page that
   should feel like the foil the guest just scratched. Everything inside sits
   on that, so the type is dark and the field is a pale inset. */
.save-panel {
  position: fixed;
  right: max(0.9rem, env(safe-area-inset-right, 0px));
  bottom: calc(54px + max(0.9rem, env(safe-area-inset-bottom, 0px)) + 0.5rem);
  z-index: 901;
  width: min(92vw, 20rem);
  padding: 1.25rem 1.2rem 1.35rem;
  border-radius: 10px;
  border: 1px solid #7d621b;
  color: #2C2A26;
  /* Was the full scratch-foil gradient, which read as bright yellow at this
     size. Pulled toward warm beige: same metal, much lower saturation. */
  background:
    linear-gradient(135deg,
      #a08b5e 0%, #d8c9a6 18%, #efe6cf 34%, #c9b788 50%,
      #e8dcc0 68%, #bda87d 84%, #a08b5e 100%);
  box-shadow: 0 18px 44px rgba(44, 42, 38, 0.34), inset 0 1px 0 rgba(255,255,255,0.45);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.save-panel.open { opacity: 1; transform: none; }

.save-panel-close {
  position: absolute;
  top: 2px; right: 2px;
  width: 40px; height: 40px;
  background: none; border: none;
  font-size: 1.4rem; line-height: 1;
  color: #4a3a0e;
  cursor: pointer;
}

.save-panel-title {
  font-family: var(--font-display, Georgia, serif);
  font-size: var(--text-md, 1.3rem);
  margin: 0 0 0.3rem;
  padding-right: 1.8rem;
  color: #3a2d08;
}

.save-panel-note {
  font-size: var(--text-sm, 0.95rem);
  margin: 0 0 0.85rem;
  color: #4a3a0e;
}

.save-label {
  display: block;
  font-size: var(--text-xs, 0.8rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #4a3a0e;
  margin-bottom: 0.3rem;
}

.save-input {
  width: 100%;
  min-height: 44px;
  padding: 0.55rem 0.7rem;
  font-family: inherit;
  font-size: var(--text-base, 1rem);
  color: var(--ink, #2C2A26);
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #8a6e20;
  border-radius: 4px;
}

.save-input:focus-visible { outline: 2px solid #4a3a0e; outline-offset: 2px; }
.save-input[aria-invalid='true'] { border-color: #8c2f26; }

.save-error {
  font-size: var(--text-xs, 0.8rem);
  color: #6d1f18;
  margin: 0.45rem 0 0;
  font-weight: 600;
}

.save-submit {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%; min-height: 44px;
  margin-top: 0.8rem;
  padding: 0.65rem 1rem;
  font-family: inherit;
  font-size: var(--text-xs, 0.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #F7E9BC;
  background: #3a2d08;
  border: none; border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease, opacity 0.2s ease;
}

.save-submit:hover:not(:disabled) { background: #4a3a0e; }
.save-submit:disabled { opacity: 0.65; cursor: progress; }

.save-thanks { font-size: var(--text-sm, 0.95rem); color: #3a2d08; margin: 0; }