:root {
  --ink: #1a2421;
  --ink-soft: #2c3a35;
  --mist: #e8efe9;
  --paper: #f7f3ec;
  --paper-deep: #efe6d8;
  --sage: #5c7a6e;
  --sage-deep: #3d564c;
  --copper: #b07a4a;
  --copper-soft: #c9946a;
  --line: rgba(26, 36, 33, 0.12);
  --shadow: 0 24px 60px rgba(18, 28, 24, 0.28);
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Outfit", system-ui, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--mist);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: var(--sage-deep);
}

/* ——— Atmosphere (create page) ——— */
.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background: linear-gradient(
    165deg,
    color-mix(in srgb, var(--theme-swatch) 12%, #e8efe9) 0%,
    #e8efe9 42%,
    color-mix(in srgb, var(--theme-accent) 10%, #f0ebe3) 100%
  );
  transition: background 0.7s ease;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.45'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* Soft theme aura — seamless, tasteful drift */
.aura {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(64px);
  will-change: transform, opacity;
}

.aura-a {
  width: min(90vw, 34rem);
  height: min(90vw, 34rem);
  left: -22%;
  top: -18%;
  background: color-mix(in srgb, var(--theme-swatch) 42%, transparent);
  opacity: 0.55;
  animation: aura-drift-a 22s ease-in-out infinite;
}

.aura-b {
  width: min(80vw, 30rem);
  height: min(80vw, 30rem);
  right: -20%;
  bottom: -12%;
  background: color-mix(in srgb, var(--theme-accent) 36%, transparent);
  opacity: 0.45;
  animation: aura-drift-b 26s ease-in-out infinite;
}

.aura-c {
  display: none;
}

.page-invite .aura-c {
  display: block;
  width: min(70vw, 26rem);
  height: min(70vw, 26rem);
  left: 28%;
  top: 38%;
  background: color-mix(in srgb, var(--theme-mute) 28%, transparent);
  opacity: 0.35;
  animation: aura-drift-c 30s ease-in-out infinite;
}

.page-create .aura {
  mix-blend-mode: multiply;
}

.page-invite .aura {
  mix-blend-mode: soft-light;
  filter: blur(72px);
}

.page-invite .aura-a {
  opacity: 0.5;
}

.page-invite .aura-b {
  opacity: 0.4;
}

@keyframes aura-drift-a {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.5;
  }
  50% {
    transform: translate3d(10%, 8%, 0) scale(1.08);
    opacity: 0.62;
  }
}

@keyframes aura-drift-b {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.4;
  }
  50% {
    transform: translate3d(-8%, -10%, 0) scale(1.1);
    opacity: 0.52;
  }
}

@keyframes aura-drift-c {
  0%,
  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.32;
  }
  50% {
    transform: translate3d(-6%, 6%, 0) scale(1.06);
    opacity: 0.42;
  }
}

/* ——— Create page ——— */
.page-create {
  --theme-swatch: #5c7a6e;
  --theme-accent: #b07a4a;
  --theme-accent-soft: #c9946a;
  --theme-mute: #5c7a6e;
  --theme-glow: rgba(92, 122, 110, 0.28);
  --theme-button: #1a2421;
  --theme-button-hover: #3d564c;
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
}

.site-header {
  padding: 1.25rem 1.5rem 0;
  max-width: 40rem;
  margin: 0 auto;
  width: 100%;
}

.brand {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand span {
  color: var(--sage);
}

.create-main {
  flex: 1;
  display: flex;
  align-items: center;
  padding: 2rem 1.25rem 3rem;
}

.hero-create {
  width: 100%;
  max-width: 28rem;
  margin: 0 auto;
  animation: rise-in 0.9s var(--ease-out) both;
}

.brand-mark {
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 0 0 1rem;
}

.display-title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 5.5vw, 2.35rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.15;
  color: var(--ink-soft);
  margin: 0 0 0.85rem;
}

.lede {
  font-weight: 300;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink-soft);
  opacity: 0.88;
  margin: 0 0 2rem;
}

.invite-form {
  display: grid;
  gap: 1.1rem;
}

.form-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.form-field .form-label,
.form-field legend.form-label {
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--theme-mute, var(--sage-deep));
  margin-bottom: 0.4rem;
  float: none;
  width: auto;
}

.form-field .form-label i,
.form-field legend.form-label i {
  margin-right: 0.35rem;
  opacity: 0.85;
  color: var(--theme-swatch, var(--sage));
}

.label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
}

.label-row .form-label {
  margin-bottom: 0;
}

.label-hint {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  opacity: 0.7;
  margin-left: 0.35rem;
}

.field-hint {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  font-weight: 400;
  color: var(--theme-mute, var(--sage-deep));
  line-height: 1.35;
}

.range-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}

.range-toggle input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--sage-deep);
}

.time-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.time-row > .form-control {
  flex: 1;
  min-width: 0;
}

.time-end-wrap {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1.15;
  min-width: 0;
}

.time-end-wrap[hidden] {
  display: none !important;
}

.time-sep {
  font-size: 0.85rem;
  color: var(--ink-soft);
  opacity: 0.7;
  flex-shrink: 0;
}

.time-end-wrap .form-control {
  flex: 1;
  min-width: 0;
}

#time-error {
  display: none;
}

.note-stack {
  display: grid;
  gap: 0.45rem;
}

.color-swatches {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.5rem;
}

@media (max-width: 420px) {
  .color-swatches {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.color-swatch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  padding: 0.65rem 0.4rem 0.55rem;
  border: 1px solid var(--line);
  border-radius: 0.4rem;
  background: rgba(247, 243, 236, 0.55);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s var(--ease-out);
}

.color-swatch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.color-chip {
  width: 1.65rem;
  height: 1.65rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25), 0 2px 6px rgba(0, 0, 0, 0.12);
}

.color-name {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.color-swatch:hover {
  transform: translateY(-1px);
}

.color-swatch.is-selected {
  border-color: var(--sage-deep);
  background: var(--paper);
  box-shadow: 0 0 0 2px rgba(92, 122, 110, 0.18);
}

.method-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.method-option {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0.8rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(247, 243, 236, 0.55);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease;
}

.method-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.method-option:has(input:checked) {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.invite-form .form-control {
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  background: rgba(247, 243, 236, 0.72);
  backdrop-filter: blur(8px);
  padding: 0.85rem 1rem;
  font-size: 1.05rem;
  color: var(--ink);
  box-shadow: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.invite-form .form-control:focus {
  border-color: var(--sage);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(92, 122, 110, 0.18);
}

.invite-form .form-control.is-invalid {
  border-color: #a65d4a;
}

.btn-create {
  margin-top: 0.35rem;
  border: none;
  border-radius: 0.35rem;
  background: var(--theme-button, var(--ink));
  color: var(--paper);
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 0.95rem 1.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  transition: background 0.25s ease, transform 0.25s var(--ease-out);
}

.btn-create:hover,
.btn-create:focus-visible {
  background: var(--theme-button-hover, var(--sage-deep));
  color: var(--paper);
  transform: translateY(-1px);
}

.btn-create i {
  font-size: 0.92em;
}

.method-option span {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.result-label i {
  margin-right: 0.3rem;
  color: var(--theme-swatch, var(--sage));
}

.result-panel {
  margin-top: 1.75rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  animation: rise-in 0.55s var(--ease-out) both;
}

.result-label {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--theme-mute, var(--sage));
  margin: 0 0 0.65rem;
}

.result-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.invite-link {
  flex: 1;
  min-width: 0;
  display: block;
  padding: 0.75rem 0.9rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 0.35rem;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  word-break: break-all;
  line-height: 1.35;
}

.btn-copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: 1px solid var(--ink);
  border-radius: 0.35rem;
  background: transparent;
  color: var(--ink);
  font-weight: 500;
  padding: 0 1rem;
}

.btn-copy:hover {
  background: var(--ink);
  color: var(--paper);
}

.copy-status {
  min-height: 1.25rem;
  margin: 0.45rem 0 0;
  font-size: 0.85rem;
  color: var(--sage-deep);
}

.btn-ghost {
  display: inline-flex;
  margin-top: 0.75rem;
  border: none;
  background: transparent;
  color: var(--sage-deep);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  padding: 0;
}

.btn-ghost:hover {
  color: var(--ink);
}

.site-footer {
  padding: 1rem 1.5rem 1.75rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--ink-soft);
  opacity: 0.65;
}

/* ——— Invite reveal page ——— */
.page-invite {
  --theme-bg0: #0e1412;
  --theme-bg1: #141c19;
  --theme-bg2: #1d2a24;
  --theme-glow: rgba(92, 122, 110, 0.42);
  --theme-accent: #b07a4a;
  --theme-accent-soft: #c9946a;
  --theme-accent-deep: #8a552c;
  --theme-ink: #1a2421;
  --theme-ink-soft: #2c3a35;
  --theme-mute: #5c7a6e;
  --theme-button: #1a2421;
  --theme-button-hover: #3d564c;
  --theme-swatch: #5c7a6e;
  --env-w: min(92vw, 22.5rem);
  /* Cap envelope so closed view never forces page scroll */
  --env-h: min(calc(var(--env-w) * 1.28), calc(100dvh - 3rem));
  --ease-paper: cubic-bezier(0.22, 0.61, 0.2, 1);
  --paper-grain: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  --flap-room: calc(var(--env-h) * 0.5);
  height: 100dvh;
  max-height: 100dvh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  align-content: center;
  justify-items: center;
  padding: 1.5rem 1rem;
  padding-top: max(1.5rem, env(safe-area-inset-top));
  padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: var(--theme-bg1);
  overflow: hidden;
}

/* Opened invite may grow; scroll only when content needs it */
.page-invite.is-invite-settled {
  height: auto;
  max-height: none;
  min-height: 100dvh;
  overflow-x: clip;
  overflow-y: auto;
  align-content: safe center;
}

.invite-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: linear-gradient(
    180deg,
    var(--theme-bg0) 0%,
    var(--theme-bg1) 50%,
    var(--theme-bg2) 100%
  );
}

.invite-bg::after {
  display: none;
}

.page-invite .paper::before {
  display: none;
}

.invite-stage {
  position: relative;
  z-index: 1;
  width: min(100%, var(--env-w));
  max-width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  overflow: visible;
  margin-inline: auto;
}

/* Above the wax seal — two-line label, then centered finger pointing down */
.open-hint {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 21;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  transform: translate(-50%, calc(-100% - 3.6rem));
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
  transition: opacity 0.45s var(--ease-paper), transform 0.45s var(--ease-paper);
}

.open-hint-label {
  display: block;
  white-space: normal;
}

.open-hint .hint-icon {
  display: block;
  font-size: 1.1rem;
  color: currentColor;
  animation: hint-bob 2.4s ease-in-out infinite;
}

.open-hint.is-gone {
  opacity: 0;
  transform: translate(-50%, calc(-100% - 4.4rem));
  pointer-events: none;
}

@keyframes hint-bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(4px);
  }
}

.scene {
  position: relative;
  width: 100%;
  height: var(--env-h);
  overflow: visible;
  perspective: 1600px;
  perspective-origin: 50% 0%;
  transform-style: preserve-3d;
}

.scene.is-settled {
  height: auto;
  perspective: none;
}

.env-ground-shadow {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0;
  height: 14%;
  border-radius: 50%;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.55), transparent 70%);
  filter: blur(8px);
  z-index: 0;
  pointer-events: none;
  transition: opacity 0.7s var(--ease-paper);
}

.open-btn {
  position: absolute;
  inset: 0;
  z-index: 50;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.open-btn:focus-visible {
  outline: 2px solid var(--theme-accent-soft);
  outline-offset: 8px;
  border-radius: 0.35rem;
}

.open-btn:disabled {
  cursor: default;
}

/* Shared paper grain overlay */
.paper::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--paper-grain);
  opacity: 0.18;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* ——— One envelope unit so layers stay aligned ——— */
.envelope {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-style: preserve-3d;
  animation: envelope-idle 6s ease-in-out infinite;
  transition: opacity 0.75s var(--ease-paper), transform 0.75s var(--ease-paper);
}

.scene.is-opening .envelope {
  animation: none;
}

.scene.is-card-out .envelope {
  /* Shell fades; card is moved out in JS before this class applies */
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  pointer-events: none;
  transition:
    opacity 1.2s cubic-bezier(0.22, 0.61, 0.2, 1),
    transform 1.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.scene.is-card-out .env-ground-shadow {
  opacity: 0;
  transition: opacity 1s var(--ease-paper);
}

.scene.is-settled .envelope,
.scene.is-settled .env-ground-shadow {
  display: none;
}

.env-back {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 0.22rem;
  background:
    linear-gradient(155deg, #f6eee2 0%, #eadcc8 42%, #dcc9af 100%);
  box-shadow:
    inset 0 0 0 1px rgba(90, 70, 45, 0.12),
    inset 0 0 0 2px rgba(255, 248, 236, 0.35),
    0 24px 50px rgba(0, 0, 0, 0.35);
}

.env-back::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.18;
  background-image: var(--paper-grain);
  background-size: 180px 180px;
  pointer-events: none;
  mix-blend-mode: multiply;
}

/* Liner only peeks once the top flap opens */
.env-liner {
  position: absolute;
  left: 3%;
  right: 3%;
  top: 3%;
  height: 46%;
  z-index: 2;
  border-radius: 0.1rem 0.1rem 0 0;
  background:
    linear-gradient(
      180deg,
      color-mix(in srgb, var(--theme-accent) 28%, #f3e7d6),
      color-mix(in srgb, var(--theme-mute) 18%, #efe2d0)
    );
  opacity: 0;
  clip-path: polygon(0 0, 100% 0, 100% 70%, 50% 100%, 0 70%);
  transition: opacity 0.55s var(--ease-paper);
}

.scene.is-flap-open .env-liner {
  opacity: 0.92;
}

.env-clip {
  position: absolute;
  inset: 0;
  z-index: 5;
  overflow: hidden;
  border-radius: 0.22rem;
  pointer-events: none;
}

/* Side folds — tips meet under the seal */
.env-side {
  position: absolute;
  top: 0;
  width: 50%;
  height: 100%;
  overflow: hidden;
}

.env-side-left {
  left: 0;
  background:
    linear-gradient(145deg, #f2e6d4 0%, #e4d2b8 48%, #d5c0a1 100%);
  clip-path: polygon(0 0, 100% 50%, 0 100%);
  box-shadow: inset -6px 0 14px rgba(70, 50, 30, 0.1);
}

.env-side-left::after,
.env-side-right::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      transparent 0%,
      rgba(255, 248, 236, 0.18) 42%,
      transparent 70%
    );
  opacity: 0.7;
  pointer-events: none;
}

.env-side-right {
  right: 0;
  background:
    linear-gradient(-145deg, #f2e6d4 0%, #e4d2b8 48%, #d5c0a1 100%);
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  box-shadow: inset 6px 0 14px rgba(70, 50, 30, 0.1);
}

/* Front panel — shallow V under the seal (no bottom flap) */
.env-front {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 50%;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 36%),
    linear-gradient(168deg, #f3e7d5 0%, #e4d1b7 55%, #d6c0a2 100%);
  clip-path: polygon(0 16%, 50% 0, 100% 16%, 100% 100%, 0 100%);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 15%;
  box-shadow:
    0 -10px 22px rgba(50, 35, 20, 0.08),
    inset 0 1px 0 rgba(255, 248, 236, 0.45);
}

.env-front::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: var(--paper-grain);
  background-size: 160px 160px;
  mix-blend-mode: multiply;
  pointer-events: none;
}

.env-bevel {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 42%;
  bottom: 10%;
  border: 1px solid rgba(120, 92, 58, 0.14);
  border-top: none;
  border-radius: 0 0 0.15rem 0.15rem;
  box-shadow:
    inset 1px 0 0 rgba(255, 248, 236, 0.28),
    inset -1px 0 0 rgba(255, 248, 236, 0.28),
    inset 0 -1px 0 rgba(255, 248, 236, 0.28);
  pointer-events: none;
}

.env-frame {
  position: absolute;
  left: 11%;
  right: 11%;
  top: 48%;
  bottom: 14%;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 22%, rgba(140, 110, 70, 0.2));
  border-top: none;
  border-radius: 0 0 0.1rem 0.1rem;
  opacity: 0.55;
  pointer-events: none;
}

.env-corner {
  position: absolute;
  bottom: 12%;
  width: 1.35rem;
  height: 1.35rem;
  opacity: 0.42;
  pointer-events: none;
}

.env-corner::before,
.env-corner::after {
  content: "";
  position: absolute;
  background: color-mix(in srgb, var(--theme-accent) 35%, #8a6a42);
}

.env-corner-bl {
  left: 12%;
}

.env-corner-br {
  right: 12%;
  transform: scaleX(-1);
}

.env-corner::before {
  left: 0;
  bottom: 0;
  width: 100%;
  height: 1px;
}

.env-corner::after {
  left: 0;
  bottom: 0;
  width: 1px;
  height: 100%;
}

.env-address {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
  text-align: center;
  margin-bottom: 0.35rem;
}

.env-script {
  display: block;
  max-width: 12rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.05rem, 4.2vw, 1.45rem);
  font-weight: 500;
  line-height: 1.25;
  color: rgba(48, 36, 26, 0.52);
  letter-spacing: 0.02em;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.28);
  overflow-wrap: anywhere;
}

.env-flourish {
  display: block;
  width: 4.75rem;
  height: 0.55rem;
  background:
    radial-gradient(circle at 50% 50%, color-mix(in srgb, var(--theme-accent) 55%, #8a6a42) 0 1.1px, transparent 1.3px),
    linear-gradient(
      90deg,
      transparent 0%,
      color-mix(in srgb, var(--theme-accent) 40%, #8a6a42) 18%,
      color-mix(in srgb, var(--theme-accent) 40%, #8a6a42) 82%,
      transparent 100%
    );
  background-size: 100% 100%, 100% 1px;
  background-position: center, center;
  background-repeat: no-repeat;
  opacity: 0.55;
}

/* Top flap — tip meets the front panel under the seal */
.env-flap {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 50%;
  z-index: 12;
  overflow: visible;
  transform-origin: top center;
  transform-style: preserve-3d;
  transition: transform 1.05s cubic-bezier(0.22, 0.7, 0.25, 1);
  will-change: transform;
}

.env-flap-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.env-flap-front {
  /* Wide at hinge (top), point at seal (bottom) */
  clip-path: polygon(0 0, 100% 0, 50% 100%);
  background:
    linear-gradient(180deg, #f8f0e5 0%, #ebdcc7 62%, #dfcbb0 100%);
  box-shadow: 0 14px 30px rgba(40, 28, 16, 0.18);
}

.env-flap-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.38), transparent 42%),
    linear-gradient(180deg, transparent 68%, rgba(70, 50, 30, 0.09)),
    linear-gradient(
      180deg,
      transparent 0%,
      transparent 88%,
      color-mix(in srgb, var(--theme-accent) 18%, transparent) 100%
    );
  clip-path: inherit;
}

.env-flap-crease {
  position: absolute;
  left: 18%;
  right: 18%;
  top: 14%;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(90, 70, 45, 0.16) 20%,
    rgba(90, 70, 45, 0.16) 80%,
    transparent
  );
  pointer-events: none;
}

.env-flap-crease::after {
  content: "";
  position: absolute;
  left: 22%;
  right: 22%;
  top: 0.55rem;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 248, 236, 0.45) 30%,
    rgba(255, 248, 236, 0.45) 70%,
    transparent
  );
}

/*
  Underside: point at the hinge after the fold-back so the open flap
  isn’t an upside-down triangle floating above the envelope.
*/
.env-flap-back {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background:
    linear-gradient(180deg, #d0b896 0%, #dcc6aa 45%, #e8d7c0 100%);
  box-shadow: inset 0 10px 20px rgba(70, 50, 30, 0.14);
  transform: rotateX(180deg);
}

/* Fold back away from the viewer */
.scene.is-flap-open .env-flap {
  transform: rotateX(178deg);
}

/* Wax seal — centered where the top flap meets the front panel */
.wax-seal {
  --wax: var(--theme-swatch);
  --wax-lit: color-mix(in srgb, var(--theme-swatch) 62%, #ffffff);
  --wax-deep: color-mix(in srgb, var(--theme-swatch) 58%, #14100e);
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 20;
  width: 4.55rem;
  height: 4.55rem;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  transition:
    transform 1.15s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 1.05s cubic-bezier(0.22, 0.61, 0.2, 1),
    filter 1.15s cubic-bezier(0.22, 0.61, 0.2, 1);
  animation: seal-breathe 3.2s ease-in-out infinite;
  filter: drop-shadow(0 3px 2px color-mix(in srgb, var(--wax-deep) 40%, transparent))
    drop-shadow(0 12px 18px color-mix(in srgb, var(--wax-deep) 45%, transparent));
  pointer-events: none;
  will-change: transform, opacity, filter;
}

/* Soft outer wax overflow / drip edge */
.wax-splat {
  position: absolute;
  inset: -0.2rem -0.28rem -0.35rem -0.18rem;
  border-radius: 58% 42% 60% 40% / 44% 56% 48% 52%;
  background:
    radial-gradient(
      circle at 62% 70%,
      color-mix(in srgb, var(--wax-deep) 88%, transparent),
      transparent 58%
    ),
    radial-gradient(
      circle at 28% 30%,
      color-mix(in srgb, var(--wax) 70%, transparent),
      transparent 55%
    );
  opacity: 0.9;
  z-index: 0;
}

.wax-blob {
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: 47% 53% 49% 51% / 52% 46% 54% 48%;
  background:
    radial-gradient(
      circle at 32% 26%,
      color-mix(in srgb, var(--wax-lit) 70%, #fff) 0%,
      var(--wax-lit) 18%,
      var(--wax) 48%,
      var(--wax-deep) 100%
    );
  box-shadow:
    inset 0 3px 5px color-mix(in srgb, var(--wax-lit) 35%, transparent),
    inset 0 -10px 16px color-mix(in srgb, var(--wax-deep) 55%, transparent),
    inset 2px 0 6px color-mix(in srgb, var(--wax-deep) 22%, transparent),
    0 1px 0 color-mix(in srgb, var(--wax-lit) 28%, transparent);
}

/* Stamped depression in the center */
.wax-press {
  position: absolute;
  inset: 0.62rem;
  z-index: 2;
  border-radius: 50%;
  background:
    radial-gradient(
      circle at 50% 42%,
      color-mix(in srgb, var(--wax-deep) 82%, #1a1210) 0%,
      var(--wax-deep) 42%,
      color-mix(in srgb, var(--wax) 55%, var(--wax-deep)) 100%
    );
  box-shadow:
    inset 0 4px 8px color-mix(in srgb, var(--wax-deep) 70%, #000),
    inset 0 -2px 3px color-mix(in srgb, var(--wax-lit) 18%, transparent),
    0 1px 1px color-mix(in srgb, var(--wax-lit) 22%, transparent);
}

.wax-ring {
  position: absolute;
  inset: 0.72rem;
  z-index: 3;
  border: 1px solid color-mix(in srgb, var(--wax-lit) 40%, transparent);
  border-radius: 50%;
  box-shadow:
    inset 0 0 0 1px color-mix(in srgb, var(--wax-deep) 40%, transparent),
    0 0 0 1px color-mix(in srgb, var(--wax-deep) 25%, transparent);
}

.wax-mark {
  position: relative;
  z-index: 4;
  display: grid;
  place-items: center;
  width: 1.55rem;
  height: 1.55rem;
  color: color-mix(in srgb, var(--wax-deep) 72%, #120e0c);
  font-size: 0.95rem;
  opacity: 0.9;
  text-shadow:
    0 1px 0 color-mix(in srgb, var(--wax-lit) 22%, transparent),
    0 -1px 0 color-mix(in srgb, var(--wax-deep) 55%, transparent);
}

/* Luxurious dissolve — soft lift, gentle ease, no harsh shrink/blur */
.scene.is-opening .wax-seal {
  animation: none;
  transform: translate(-50%, -58%) scale(1.04);
  opacity: 0;
  filter: drop-shadow(0 8px 20px color-mix(in srgb, var(--wax-deep) 0%, transparent));
  pointer-events: none;
}

.scene.is-flap-open .wax-seal {
  opacity: 0;
  pointer-events: none;
  transition: none;
}

/* Card stays fully behind the envelope until reveal */
.invite-card {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.94);
  transform-origin: center top;
  transition:
    transform 1.35s cubic-bezier(0.16, 1, 0.3, 1),
    opacity 1s cubic-bezier(0.22, 0.61, 0.2, 1);
  pointer-events: none;
}

/* After JS reparents the card onto .scene */
.scene > .invite-card {
  left: 0;
  right: 0;
  top: 0;
  width: 100%;
  height: auto;
  overflow: visible;
  opacity: 1;
  transform: none;
  z-index: 20;
  pointer-events: auto;
}

.scene.is-settled > .invite-card {
  position: relative;
  z-index: 1;
}

.card-face {
  position: relative;
  width: 100%;
  height: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  text-align: center;
  border-radius: 0.18rem;
  background:
    linear-gradient(180deg, #fcf8f1 0%, #f5eee3 48%, #ebe0d0 100%);
  border: 1px solid rgba(90, 70, 45, 0.12);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.75) inset,
    0 2px 3px rgba(255, 255, 255, 0.35) inset,
    0 12px 28px rgba(20, 16, 10, 0.16);
  /* Tighter than Bootstrap p-4 */
  padding: 1.1rem !important;
}

.card-edge {
  position: absolute;
  inset: 0.5rem;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 28%, transparent);
  border-radius: 0.08rem;
  pointer-events: none;
}

.card-ornament {
  position: relative;
  flex-shrink: 0;
  width: 2.15rem;
  height: 2.15rem;
  margin: 0 0 0.55rem;
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--theme-accent) 55%, transparent);
  border-radius: 50%;
  color: var(--theme-accent);
  animation: ornament-float 3.6s ease-in-out infinite;
}

.card-ornament-icon {
  font-size: 0.95rem;
}

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

.scene.is-settled .card-face {
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 2px 4px rgba(255, 255, 255, 0.35) inset,
    0 28px 60px rgba(0, 0, 0, 0.38),
    0 8px 18px rgba(0, 0, 0, 0.18);
}

.card-eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--theme-mute);
}

.card-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.55rem, 6.2vw, 2.2rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--theme-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  hyphens: auto;
}

.card-title.is-long {
  font-size: clamp(1.35rem, 5.4vw, 1.85rem);
}

.card-title.is-xlong {
  font-size: clamp(1.2rem, 4.8vw, 1.6rem);
  line-height: 1.2;
}

.card-when {
  position: relative;
  margin: 0.85rem 0 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.45rem;
}

.card-when-btn {
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  color: var(--theme-ink-soft);
  line-height: 1.35;
  overflow-wrap: anywhere;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card-when-btn:hover #card-date-text,
.card-when-btn:hover #card-time-text,
.card-when-btn:focus-visible #card-date-text,
.card-when-btn:focus-visible #card-time-text,
.card-when-btn[aria-expanded="true"] #card-date-text,
.card-when-btn[aria-expanded="true"] #card-time-text {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--theme-accent) 55%, transparent);
  text-underline-offset: 0.18em;
}

.card-when-btn:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-accent) 55%, transparent);
  outline-offset: 4px;
  border-radius: 0.2rem;
}

.card-date {
  font-size: 1.05rem;
  font-style: italic;
}

.card-time {
  font-size: 1rem;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.02em;
  color: var(--theme-ink);
}

.cal-menu {
  position: absolute;
  left: 50%;
  top: calc(100% + 0.55rem);
  z-index: 8;
  min-width: 11.5rem;
  padding: 0.45rem;
  border-radius: 0.35rem;
  border: 1px solid color-mix(in srgb, var(--theme-ink) 10%, transparent);
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, #fffaf3 88%, var(--theme-accent) 12%),
      #f4ebe0 100%
    );
  box-shadow:
    0 10px 28px rgba(20, 16, 12, 0.16),
    0 1px 0 rgba(255, 255, 255, 0.45) inset;
  transform: translateX(-50%) translateY(4px);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 0.2s var(--ease-paper, ease),
    transform 0.22s var(--ease-paper, ease);
}

.cal-menu.is-open {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

.cal-menu-label {
  margin: 0;
  padding: 0.2rem 0.55rem 0.35rem;
  font-family: var(--font-body, inherit);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--theme-ink-soft) 72%, transparent);
}

.cal-menu-item {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  margin: 0;
  padding: 0.48rem 0.55rem;
  border: none;
  border-radius: 0.22rem;
  background: transparent;
  color: var(--theme-ink);
  font-family: var(--font-body, inherit);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.2;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.cal-menu-item i {
  width: 1rem;
  text-align: center;
  color: var(--theme-mute);
  font-size: 0.95rem;
}

.cal-menu-item:hover,
.cal-menu-item:focus-visible {
  background: color-mix(in srgb, var(--theme-accent) 14%, transparent);
  outline: none;
}

.cal-menu-item:focus-visible {
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--theme-accent) 40%, transparent);
}

.card-location {
  margin: 0.55rem 0 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
}

.card-place {
  position: relative;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  background: transparent;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--theme-ink);
  overflow-wrap: anywhere;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.card-place:hover #card-location-text,
.card-place:focus-visible #card-location-text {
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--theme-accent) 55%, transparent);
  text-underline-offset: 0.18em;
}

.card-place:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--theme-accent) 55%, transparent);
  outline-offset: 4px;
  border-radius: 0.2rem;
}

.place-tip {
  position: absolute;
  left: 50%;
  bottom: calc(100% + 0.45rem);
  transform: translateX(-50%) translateY(4px);
  padding: 0.28rem 0.55rem;
  border-radius: 0.22rem;
  background: var(--theme-ink);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 5;
}

.place-tip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -4px;
  border: 4px solid transparent;
  border-top-color: var(--theme-ink);
}

.card-place.is-copied .place-tip {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.location-actions {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-maps {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-height: 0;
  padding: 0.28rem 0.55rem;
  border-radius: 0.22rem;
  border: 1px solid color-mix(in srgb, var(--theme-swatch) 50%, transparent);
  background: color-mix(in srgb, var(--theme-swatch) 12%, transparent);
  color: var(--theme-ink);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

.btn-maps i {
  font-size: 0.62rem;
}

.btn-maps:hover,
.btn-maps:focus-visible {
  background: color-mix(in srgb, var(--theme-swatch) 22%, transparent);
  border-color: color-mix(in srgb, var(--theme-swatch) 70%, transparent);
  color: var(--theme-ink);
}

.meta-icon {
  flex-shrink: 0;
  margin-top: 0;
  font-size: 0.82rem;
  font-style: normal;
  color: var(--theme-accent);
  opacity: 0.9;
  line-height: 1;
}

.card-notes {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  width: 100%;
  display: grid;
  gap: 0.3rem;
}

.card-notes li {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 500;
  font-style: normal;
  letter-spacing: 0.02em;
  line-height: 1.35;
  color: var(--theme-ink);
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: center;
}

.card-rule {
  width: 2.75rem;
  height: 1px;
  margin: 0.85rem 0 0.75rem;
  background: var(--theme-accent);
  opacity: 0.72;
  flex-shrink: 0;
}

.card-note {
  margin: 0 0 0.75rem;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--theme-ink-soft);
  line-height: 1.4;
}

.btn-rsvp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 10.5rem;
  min-height: 2.75rem;
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 0.28rem;
  background: var(--theme-button);
  color: var(--paper);
  font-weight: 500;
  letter-spacing: 0.05em;
  text-decoration: none;
  transition: background 0.25s ease, transform 0.25s var(--ease-out), box-shadow 0.25s ease;
  animation: rsvp-pulse 3.2s ease-in-out infinite;
}

.btn-rsvp:hover,
.btn-rsvp:focus-visible {
  background: var(--theme-button-hover);
  color: var(--paper);
  transform: translateY(-1px);
  animation: none;
}

@keyframes rsvp-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--theme-swatch) 0%, transparent);
  }
  50% {
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--theme-swatch) 18%, transparent);
  }
}

.rsvp-via {
  margin: 0.5rem 0 0;
  width: 100%;
  font-size: 0.74rem;
  font-weight: 300;
  color: var(--theme-mute);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.invite-error {
  position: relative;
  z-index: 1;
  width: min(100%, var(--env-w));
  max-width: 20rem;
  margin-inline: auto;
  text-align: center;
  color: var(--paper);
  animation: rise-in 0.7s var(--ease-out) both;
}

.invite-error .brand-mark {
  color: var(--paper);
  font-size: 2rem;
}

.invite-error h1 {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 500;
  margin: 0 0 0.75rem;
}

.invite-error p {
  font-weight: 300;
  opacity: 0.8;
  margin: 0;
}

.invite-error a {
  color: var(--theme-accent-soft);
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes envelope-idle {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-6px);
  }
}

@keyframes seal-breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.045);
  }
}

/* Mobile: envelope + opened invite fill the screen — no phantom scroll */
@media (max-width: 767px) {
  .page-invite {
    --stage-pad-top: max(0.5rem, env(safe-area-inset-top, 0px));
    --stage-pad-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px));
    --env-w: 100%;
    --env-h: 100%;
    --scene-fill: 100%;
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    min-height: 100dvh;
    padding: 0;
    place-items: stretch;
    align-content: stretch;
    overflow: hidden;
  }

  .invite-stage {
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
    gap: 0;
    padding: var(--stage-pad-top) 0.5rem var(--stage-pad-bottom);
    box-sizing: border-box;
    justify-content: center;
    overflow: hidden;
  }

  .open-hint {
    transform: translate(-50%, calc(-100% - 3.85rem));
    font-size: 0.72rem;
  }

  .wax-seal {
    width: 4.9rem;
    height: 4.9rem;
  }

  .scene,
  .scene > .invite-card {
    width: 100%;
  }

  /* Fill the padded stage exactly — never 100vh + padding */
  .scene {
    flex: 1 1 auto;
    width: 100%;
    height: 100%;
    min-height: 0;
    max-height: 100%;
  }

  .scene .envelope {
    height: 100%;
    min-height: 100%;
  }

  .scene.is-card-out > .invite-card,
  .scene.is-settled > .invite-card,
  .scene.is-card-out > .invite-card .card-face,
  .scene.is-settled > .invite-card .card-face {
    width: 100%;
    min-height: 100%;
  }

  .scene.is-card-out > .invite-card .card-face,
  .scene.is-settled > .invite-card .card-face {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 1rem 0.95rem !important;
    box-sizing: border-box;
  }

  /* After open: page can grow; scroll only if invite is taller than the screen */
  .page-invite.is-invite-settled {
    height: auto;
    max-height: none;
    min-height: 100dvh;
    overflow-x: clip;
    overflow-y: auto;
  }

  .page-invite.is-invite-settled .invite-stage {
    height: auto;
    min-height: 100dvh;
    max-height: none;
    overflow: visible;
  }

  .page-invite.is-invite-settled .scene {
    flex: none;
    height: auto;
    min-height: calc(100dvh - var(--stage-pad-top) - var(--stage-pad-bottom));
    max-height: none;
  }

  .page-invite.is-invite-settled .scene.is-settled > .invite-card .card-face {
    min-height: calc(100dvh - var(--stage-pad-top) - var(--stage-pad-bottom));
  }
}

@media (min-width: 768px) {
  .create-main {
    padding-top: 3rem;
  }

  .page-invite {
    --env-w: min(90vw, 24rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .hero-create,
  .result-panel,
  .invite-error,
  .envelope,
  .wax-seal,
  .aura,
  .aura-a,
  .aura-b,
  .aura-c,
  .hint-icon,
  .wax-mark,
  .card-ornament,
  .btn-rsvp {
    animation: none !important;
  }

  .env-flap,
  .invite-card,
  .envelope,
  .open-hint,
  .wax-seal,
  .env-ground-shadow,
  .scene {
    transition-duration: 0.01ms !important;
  }

  .envelope {
    transform: none;
  }

  .scene.is-flap-open .env-flap {
    transform: none;
  }

  .scene > .invite-card,
  .scene.is-settled > .invite-card {
    transform: none;
    transition: none;
  }
}
