/* Direction: Royal Udaipur stationery — ivory letterpress paper, dusty rose,
   antique champagne gold, muted sage, burgundy wax seal. Serif + handwritten script. */
/* Completed by the platform from the short form: both modes, every
   palette token, each text-on-ground pair at its floor. To restyle, write the
   short form again (the decisions in one :root) and it is completed again. */

:root {
  --canvas: #faf5ea;
  --surface: #fffdf6;
  --surface-2: #f2e9d6;
  --border: #e1d5bd;
  --border-strong: #b6afa7;
  --ink: #2f271f;
  --muted: #6b6050;
  --accent: #9c4854;
  --accent-hover: #853d47;
  --accent-ink: #ffffff;
  --accent-text: #8b3d49;
  --accent-strong: #6a2430;
  --accent-soft: #f6e3e2;
  --accent-border: #d0a7a7;
  --success: #4f6a44;
  --success-ink: #ffffff;
  --success-soft: #e5e4d6;
  --success-strong: #4f6a44;
  --warning: #8a6418;
  --warning-ink: #ffffff;
  --warning-soft: #ede4d1;
  --warning-strong: #7f5c16;
  --danger: #973a32;
  --danger-ink: #ffffff;
  --danger-soft: #eedfd4;
  --danger-strong: #973a32;
  --chart-1: #9c4854;
  --chart-2: #ab741a;
  --chart-3: #345d04;
  --chart-4: #1d8c8a;
  --chart-5: #004d92;
  --chart-6: #9964b4;

  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "Jost", system-ui, sans-serif;
  --display-weight: 500;
  --display-tracking: -0.01em;
  --radius-card: 6px;
  --radius-btn: 999px;
  --radius-input: 4px;
  --card-pad: 1.75rem;
  --shadow-card: 0 18px 50px -32px rgba(47, 39, 31, 0.45);
  --x-sage: #7e8f74;
  --x-sage-soft: #e7ece0;
  --x-gold: #a8822f;
  --x-gold-soft: #ecdfc2;
  --x-burgundy: #5e1f2b;
  --x-on-photo: #fffaf1;
  --x-font-script: "Parisienne", "Cormorant Garamond", cursive;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --font-sans: "Jost", system-ui, sans-serif;
  --eyebrow-tracking: 0.08em;
}

html[data-theme="dark"] {
  --canvas: #160a0c;
  --surface: #2d2324;
  --surface-2: #221618;
  --border: #372c2e;
  --border-strong: #5c5455;
  --ink: #faf5ea;
  --muted: #9f9791;
  --accent: #9c4854;
  --accent-hover: #ab636e;
  --accent-ink: #ffffff;
  --accent-text: #b87b86;
  --accent-strong: #b87b86;
  --accent-soft: #33181c;
  --accent-border: #52262c;
  --success: #4f6a44;
  --success-ink: #ffffff;
  --success-soft: #231f18;
  --success-strong: #81947a;
  --warning: #8a6418;
  --warning-ink: #ffffff;
  --warning-soft: #301e0f;
  --warning-strong: #a4864b;
  --danger: #973a32;
  --danger-ink: #ffffff;
  --danger-soft: #321514;
  --danger-strong: #ba7c78;
  --chart-1: #b05a65;
  --chart-2: #c38523;
  --chart-3: #609038;
  --chart-4: #01a2a0;
  --chart-5: #4282cb;
  --chart-6: #ac77c8;
}

/* ---------- paper, frames, ornaments ---------- */
.script {
  font-family: var(--x-font-script);
  font-weight: 400;
  line-height: 1.18;
}

.paper {
  background-color: var(--canvas);
  background-image:
    radial-gradient(circle at 12% 18%, color-mix(in srgb, var(--x-gold) 13%, transparent), transparent 55%),
    radial-gradient(circle at 88% 78%, color-mix(in srgb, var(--x-sage) 13%, transparent), transparent 52%),
    repeating-linear-gradient(0deg, color-mix(in srgb, var(--ink) 4%, transparent) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(90deg, color-mix(in srgb, var(--ink) 3%, transparent) 0 1px, transparent 1px 5px);
}

.gold-frame {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--x-gold) 70%, transparent);
  box-shadow: 0 24px 60px -42px rgba(47, 39, 31, 0.55);
}
.gold-frame::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid color-mix(in srgb, var(--x-gold) 34%, transparent);
  pointer-events: none;
}

.arch-top {
  border-top-left-radius: 48% 22%;
  border-top-right-radius: 48% 22%;
}

.rule-gold {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--x-gold);
}
.rule-gold::before,
.rule-gold::after {
  content: "";
  height: 1px;
  flex: 1;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--x-gold) 80%, transparent), transparent);
}

.monogram {
  font-family: var(--font-display);
  border: 1px solid color-mix(in srgb, var(--x-gold) 70%, transparent);
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.timeline-rail::before {
  content: "";
  position: absolute;
  left: 11px;
  top: 12px;
  bottom: 12px;
  width: 1px;
  background: linear-gradient(180deg, transparent, color-mix(in srgb, var(--x-gold) 70%, transparent), transparent);
}
@media (min-width: 768px) {
  .timeline-rail::before { left: 50%; }
}

/* ---------- envelope opening ---------- */
#gate { transition: opacity 0.9s ease, visibility 0.9s ease; }
#gate.is-gone { opacity: 0; visibility: hidden; }

.envelope { perspective: 1400px; }
.env-flap {
  transform-origin: top center;
  transition: transform 1s cubic-bezier(0.5, 0, 0.3, 1), opacity 0.6s ease 0.45s;
  clip-path: polygon(0 0, 100% 0, 50% 90%);
}
.envelope.is-open .env-flap { transform: rotateX(177deg); opacity: 0.2; }
.env-card { transition: transform 0.95s cubic-bezier(0.2, 0.9, 0.2, 1) 0.2s; }
.envelope.is-open .env-card { transform: translateY(-10%) scale(1.02); }
.wax {
  background: radial-gradient(circle at 32% 28%, color-mix(in srgb, var(--x-burgundy) 70%, var(--surface)), var(--x-burgundy) 72%);
  box-shadow: 0 6px 18px -8px rgba(0, 0, 0, 0.55);
  transition: transform 0.5s ease, opacity 0.5s ease;
}
.envelope.is-open .wax { transform: scale(0.7) rotate(-18deg); opacity: 0; }

/* ---------- petals + confetti ---------- */
#petal-layer, #confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 60;
}
.petal {
  position: absolute;
  top: 0;
  width: 13px;
  height: 13px;
  border-radius: 64% 4% 64% 4%;
  background: linear-gradient(140deg, color-mix(in srgb, var(--accent) 72%, var(--surface)), color-mix(in srgb, var(--x-gold) 55%, var(--surface)));
  opacity: 0.7;
  animation: petal-fall linear forwards;
}
@keyframes petal-fall {
  from { transform: translate3d(0, -10vh, 0) rotate(0deg); }
  to { transform: translate3d(var(--drift, 40px), 112vh, 0) rotate(620deg); }
}
.bit {
  position: absolute;
  top: 0;
  width: 7px;
  height: 13px;
  background: var(--x-gold);
  opacity: 0.95;
  animation: bit-fall cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
.bit.rose { background: var(--accent); }
.bit.sage { background: var(--x-sage); }
@keyframes bit-fall {
  from { transform: translate3d(0, -6vh, 0) rotate(0deg); }
  to { transform: translate3d(var(--drift, 0px), 108vh, 0) rotate(900deg); }
}

/* ---------- escaping buttons ---------- */
.escape-zone { position: relative; }
.escape-btn {
  position: relative;
  z-index: 2;
  transition: transform 0.19s cubic-bezier(0.22, 1, 0.36, 1), font-size 0.2s ease;
  will-change: transform;
  touch-action: manipulation;
}
.yes-btn { transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.is-wobble { animation: wobble 0.42s ease; }
@keyframes wobble {
  0%, 100% { rotate: 0deg; }
  20% { rotate: -7deg; }
  45% { rotate: 6deg; }
  70% { rotate: -4deg; }
}
.quiz-step { transition: opacity 0.4s ease, transform 0.4s ease; }
.quiz-step.is-entering { opacity: 0.25; transform: translateY(14px); }

html.reduced-motion .petal,
html.reduced-motion .bit { display: none; }
html.reduced-motion .escape-btn,
html.reduced-motion .env-flap,
html.reduced-motion .env-card,
html.reduced-motion .wax,
html.reduced-motion .quiz-step { transition: none; }
html.reduced-motion .is-wobble { animation: none; }

/* ---------- gallery viewer + faq ---------- */
#viewer { backdrop-filter: blur(6px); }
#viewer img { user-select: none; }

details.faq summary { cursor: pointer; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq[open] summary .faq-plus { rotate: 45deg; }
.faq-plus { transition: rotate 0.25s ease; }
