/* ============================================================
   THE ROYAL — "Le Couronnement" styles
   Scroll-snap palace chambers · living gold frame · wax crest
   envelope · velvet curtain reveal · gold dust · decree RSVP
   ============================================================ */
:root {
  --velvet: #241029;
  --velvet-deep: #190a1d;
  --purple: #3a1c43;
  --gold: #caa45a;
  --gold-bright: #ecd49a;
  --gold-dim: rgba(202, 164, 90, 0.32);
  --cream: #f3e9d6;
  --cream-soft: rgba(243, 233, 214, 0.72);
  --serif: "Cormorant Garamond", Georgia, serif;
  --script: "Great Vibes", cursive;
  --sans: "Jost", "Segoe UI", sans-serif;
}

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

body {
  font-family: var(--serif);
  font-weight: 400;
  background: var(--velvet-deep);
  color: var(--cream);
  line-height: 1.7;
  overflow-x: hidden;
}
body.locked { overflow: hidden; height: 100dvh; }
a { color: inherit; }

/* ============================================================
   PERSISTENT GOLD FRAME
   ============================================================ */
.frame { position: fixed; inset: 0; z-index: 300; pointer-events: none; }
.frame::before {
  content: "";
  position: absolute; inset: 14px;
  border: 1px solid var(--gold-dim);
  box-shadow: inset 0 0 0 4px rgba(202, 164, 90, 0.08);
}
.frame-corner {
  position: absolute; width: 64px; height: 64px;
  color: var(--gold);
  opacity: 0.85;
}
.frame-corner svg { width: 100%; height: 100%; display: block; }
.fc-tl { top: 10px; left: 10px; }
.fc-tr { top: 10px; right: 10px; transform: scaleX(-1); }
.fc-bl { bottom: 10px; left: 10px; transform: scaleY(-1); }
.fc-br { bottom: 10px; right: 10px; transform: scale(-1, -1); }

/* ============================================================
   GOLD DUST
   ============================================================ */
.dust { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.mote {
  position: absolute; bottom: -10px;
  width: 3px; height: 3px; border-radius: 50%;
  background: var(--gold-bright);
  box-shadow: 0 0 8px 2px rgba(236, 212, 154, 0.45);
  opacity: 0;
  animation: rise var(--dur, 14s) linear var(--del, 0s) infinite;
}
@keyframes rise {
  0% { transform: translateY(0) translateX(0); opacity: 0; }
  12% { opacity: 0.9; }
  80% { opacity: 0.5; }
  100% { transform: translateY(-104vh) translateX(var(--dx, 30px)); opacity: 0; }
}

/* ============================================================
   GATE — wax crest envelope
   ============================================================ */
.gate {
  position: fixed; inset: 0; z-index: 1000;
  background:
    radial-gradient(120% 80% at 50% 30%, rgba(58, 28, 67, 0.9), transparent 65%),
    var(--velvet-deep);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 2rem;
  transition: opacity 0.8s ease 0.6s, visibility 0.8s ease 0.6s;
}
.gate.opening { opacity: 0; visibility: hidden; pointer-events: none; }

.gate-langs { display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; z-index: 2; }
.lang-pill {
  background: none; border: 1px solid var(--gold-dim); color: var(--cream-soft);
  font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.24em; text-transform: uppercase;
  padding: 0.42rem 1.1rem; border-radius: 999px; cursor: pointer; transition: all 0.3s ease;
}
.lang-pill.active, .lang-pill:hover { border-color: var(--gold); color: var(--gold-bright); background: rgba(202, 164, 90, 0.08); }

.envelope {
  position: relative; width: min(350px, 82vw); aspect-ratio: 16 / 11;
  cursor: pointer; z-index: 2;
  filter: drop-shadow(0 26px 54px rgba(0, 0, 0, 0.6));
  transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.45s ease;
  animation: envFloat 6s ease-in-out infinite;
}
@keyframes envFloat { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
.envelope:hover { transform: scale(1.025); }

.env-back { position: absolute; inset: 0; border-radius: 7px; background: linear-gradient(160deg, #3a1c43, #241029); }
.env-card {
  position: absolute; left: 8%; right: 8%; top: 7%; bottom: 16%;
  border-radius: 3px;
  background: linear-gradient(170deg, #fbf4e4, #f0e3c8);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.15rem;
  z-index: 2; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  transition: transform 0.95s cubic-bezier(0.22, 1, 0.36, 1) 0.45s;
}
.envelope.open .env-card { transform: translateY(-56%); }
.env-c-mono { font-size: 1rem; color: var(--purple); letter-spacing: 0.1em; }
.env-c-names { font-family: var(--script); font-size: clamp(1rem, 4.4vw, 1.55rem); color: var(--velvet); line-height: 1.2; }
.env-c-date { font-family: var(--sans); font-size: 0.52rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--purple); margin-top: 0.15rem; }

.env-front {
  position: absolute; inset: 0; border-radius: 7px; z-index: 3;
  background:
    linear-gradient(120deg, transparent 49.4%, rgba(0,0,0,0.16) 49.4%, rgba(0,0,0,0.16) 50.6%, transparent 50.6%),
    linear-gradient(-120deg, transparent 49.4%, rgba(0,0,0,0.16) 49.4%, rgba(0,0,0,0.16) 50.6%, transparent 50.6%),
    linear-gradient(165deg, #3f1f49, #2a1330);
  clip-path: polygon(0 0, 50% 48%, 100% 0, 100% 100%, 0 100%);
}
.env-flap {
  position: absolute; inset: 0; border-radius: 7px 7px 0 0; z-index: 4;
  background: linear-gradient(190deg, #4a2455, #311639);
  clip-path: polygon(0 0, 100% 0, 50% 58%);
  transform-origin: top center;
  transition: transform 0.75s cubic-bezier(0.55, 0, 0.45, 1);
}
.envelope.open .env-flap { transform: rotateX(190deg); z-index: 1; }

.wax-seal {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 6;
  width: 74px; height: 74px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #d9b46a, var(--gold) 52%, #8a6526 100%);
  box-shadow: 0 5px 16px rgba(0,0,0,0.45), inset 0 2px 5px rgba(255,255,255,0.4), inset 0 -3px 8px rgba(70,48,12,0.5);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-size: 1.5rem; color: #2a1330;
  animation: sealPulse 2.8s ease-in-out infinite;
  transition: transform 0.5s ease, opacity 0.4s ease;
}
@keyframes sealPulse {
  0%, 100% { box-shadow: 0 5px 16px rgba(0,0,0,0.45), inset 0 2px 5px rgba(255,255,255,0.4), inset 0 -3px 8px rgba(70,48,12,0.5), 0 0 0 0 rgba(202,164,90,0.45); }
  50% { box-shadow: 0 5px 16px rgba(0,0,0,0.45), inset 0 2px 5px rgba(255,255,255,0.4), inset 0 -3px 8px rgba(70,48,12,0.5), 0 0 0 18px rgba(202,164,90,0); }
}
.envelope.open .wax-seal { transform: translate(-50%, -50%) scale(0.3) rotate(45deg); opacity: 0; }

.gate-hint {
  font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.38em; text-transform: uppercase;
  color: var(--cream-soft); z-index: 2; animation: hintBreathe 2.6s ease-in-out infinite;
}
@keyframes hintBreathe { 0%, 100% { opacity: 0.45; } 50% { opacity: 1; } }

/* ============================================================
   VELVET CURTAIN REVEAL
   ============================================================ */
.curtains { position: fixed; inset: 0; z-index: 950; pointer-events: none; }
.curtain {
  position: absolute; top: 0; bottom: 0; width: 52%;
  background:
    repeating-linear-gradient(90deg, #2a1330 0, #3a1c43 22px, #491f54 40px, #3a1c43 58px, #2a1330 80px);
  box-shadow: inset 0 0 60px rgba(0,0,0,0.55);
  transition: transform 1.3s cubic-bezier(0.76, 0, 0.24, 1);
}
.curtain::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 8px;
  background: linear-gradient(90deg, rgba(202,164,90,0.5), transparent);
}
.curtain-l { left: 0; }
.curtain-l::after { right: -8px; }
.curtain-r { right: 0; }
.curtain-r::after { left: -8px; transform: scaleX(-1); }
.curtains.part .curtain-l { transform: translateX(-101%); }
.curtains.part .curtain-r { transform: translateX(101%); }
.curtains.gone { display: none; }

/* ============================================================
   FLOATING CONTROLS
   ============================================================ */
.float-controls {
  position: fixed; top: 1.4rem; right: 1.4rem; z-index: 400;
  display: flex; gap: 0.55rem;
  opacity: 0; pointer-events: none; transition: opacity 0.6s ease 1.4s;
}
body.invite-open .float-controls { opacity: 1; pointer-events: auto; }
.float-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(25, 10, 29, 0.7); border: 1px solid var(--gold-dim); color: var(--gold-bright);
  font-family: var(--sans); font-size: 0.72rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center; backdrop-filter: blur(8px);
  transition: border-color 0.3s;
}
.float-btn:hover { border-color: var(--gold); }
.float-btn[hidden] { display: none; }
.float-btn.playing { animation: spin 6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CHAPTER NAV RAIL
   ============================================================ */
.rail {
  position: fixed; top: 50%; right: 1.5rem; transform: translateY(-50%);
  z-index: 400; display: flex; flex-direction: column; gap: 1rem; align-items: center;
  opacity: 0; pointer-events: none; transition: opacity 0.6s ease 1.6s;
}
body.invite-open .rail { opacity: 1; pointer-events: auto; }
.rail-dot {
  position: relative; width: 9px; height: 9px; border-radius: 50%;
  border: 1px solid var(--gold-dim); background: transparent; cursor: pointer;
  transition: all 0.3s ease;
}
.rail-dot::after {
  content: attr(data-label);
  position: absolute; right: 20px; top: 50%; transform: translateY(-50%);
  font-family: var(--sans); font-size: 0.6rem; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold-bright); white-space: nowrap; opacity: 0; transition: opacity 0.3s ease;
  pointer-events: none;
}
.rail-dot:hover::after { opacity: 1; }
.rail-dot.active { background: var(--gold); border-color: var(--gold); transform: scale(1.3); }

/* ============================================================
   CHAMBERS (scroll-snap)
   ============================================================ */
.chambers {
  height: 100dvh; overflow-y: scroll; overflow-x: hidden;
  scroll-snap-type: y mandatory; scroll-behavior: smooth;
  position: relative; z-index: 2;
}
.chambers::-webkit-scrollbar { display: none; }
.chambers { scrollbar-width: none; }

.chamber {
  min-height: 100dvh; scroll-snap-align: start; scroll-snap-stop: always;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 5rem 1.8rem; position: relative; overflow: hidden;
}
.ch-inner {
  max-width: 620px; width: 100%;
  opacity: 0; transform: translateY(34px) scale(0.985);
  transition: opacity 1s ease, transform 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}
.chamber.in .ch-inner { opacity: 1; transform: none; }

/* parallax bg image for image chambers */
.ch-bg {
  position: absolute; inset: -8% 0; width: 100%; height: 116%;
  object-fit: cover; z-index: -2;
  transform: scale(1.08); transition: transform 1.4s ease;
}
.ch-veil { position: absolute; inset: 0; z-index: -1; }

/* ---- chapter label + drawn divider ---- */
.ch-label {
  font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.46em; text-transform: uppercase;
  color: var(--gold-bright); margin-bottom: 1.1rem;
}
.crest-div { display: flex; align-items: center; justify-content: center; gap: 0.8rem; margin: 1.2rem auto 0; color: var(--gold); }
.crest-div .cd-line { height: 1px; width: 0; background: linear-gradient(90deg, transparent, var(--gold)); transition: width 1s ease 0.3s; }
.crest-div .cd-line.r { background: linear-gradient(90deg, var(--gold), transparent); }
.chamber.in .crest-div .cd-line { width: clamp(40px, 12vw, 90px); }
.crest-div .cd-mark { font-size: 0.9rem; opacity: 0; transition: opacity 0.6s ease 0.6s; }
.chamber.in .crest-div .cd-mark { opacity: 1; }

/* ---- hero chamber ---- */
.hero-kicker { font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.46em; text-transform: uppercase; color: var(--cream); }
.hero-names {
  font-weight: 500; font-size: clamp(2.8rem, 11vw, 5rem); line-height: 1.14; margin: 1.2rem 0 0.5rem;
  background: linear-gradient(100deg, var(--gold) 20%, var(--gold-bright) 38%, #fff7e4 48%, var(--gold-bright) 58%, var(--gold) 78%);
  background-size: 220% auto;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: shimmer 7s linear infinite;
}
@keyframes shimmer { to { background-position: 220% center; } }
.hero-names .amp { display: block; font-family: var(--script); font-size: 0.42em; -webkit-text-fill-color: var(--gold); margin: 0.1em 0; }
.hero-date { font-style: italic; font-size: 1.35rem; color: var(--cream); }
.hero-city { font-family: var(--sans); font-size: 0.66rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--cream-soft); margin-top: 0.55rem; }
.scroll-cue { position: absolute; bottom: 2.2rem; left: 50%; transform: translateX(-50%); color: var(--gold-bright); font-size: 1.1rem; animation: cue 2.2s ease-in-out infinite; }
@keyframes cue { 0%,100% { transform: translate(-50%,0); opacity: 0.5; } 50% { transform: translate(-50%, 9px); opacity: 1; } }

/* ---- generic heading / text ---- */
.ch-title { font-weight: 500; font-size: clamp(1.9rem, 6vw, 2.6rem); line-height: 1.2; }
.story-text { font-style: italic; font-size: clamp(1.15rem, 3.6vw, 1.42rem); line-height: 1.85; max-width: 540px; margin: 1.6rem auto 0; }
.story-hash { font-family: var(--script); font-size: 1.7rem; color: var(--gold-bright); margin-top: 1.4rem; }

/* ---- countdown ---- */
.count-grid { display: flex; justify-content: center; gap: clamp(0.8rem, 3vw, 1.9rem); margin-top: 2rem; }
.cd-cell { min-width: clamp(64px, 17vw, 92px); }
.cd-num { font-weight: 500; font-size: clamp(2.4rem, 8vw, 3.6rem); color: var(--gold-bright); line-height: 1; }
.cd-lab { font-family: var(--sans); font-size: 0.58rem; letter-spacing: 0.26em; text-transform: uppercase; color: var(--cream-soft); margin-top: 0.5rem; }
.cd-sep { font-size: clamp(2rem, 7vw, 3rem); color: var(--gold-dim); align-self: flex-start; }

/* ---- programme ---- */
.prog-list { margin-top: 1.8rem; display: flex; flex-direction: column; gap: 1.3rem; width: 100%; max-width: 480px; margin-inline: auto; }
.prog-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 1rem; align-items: center; text-align: left;
  padding-bottom: 1.2rem; border-bottom: 1px solid var(--gold-dim);
}
.prog-row:last-child { border-bottom: none; }
.prog-num { font-size: 1.3rem; color: var(--gold); letter-spacing: 0.05em; text-align: center; }
.prog-name { font-size: 1.3rem; font-weight: 500; line-height: 1.2; }
.prog-detail { font-style: italic; font-size: 0.9rem; color: var(--cream-soft); }
.prog-when { font-family: var(--sans); font-size: 0.72rem; letter-spacing: 0.18em; color: var(--gold-bright); white-space: nowrap; }

/* ---- venue ---- */
.venue-frame {
  position: relative; margin: 1.8rem auto 0; width: 100%; max-width: 560px;
  border: 1px solid var(--gold-dim); outline: 1px solid var(--gold-dim); outline-offset: 6px;
  padding: 8px; background: rgba(25, 10, 29, 0.5); box-shadow: 0 24px 56px rgba(0,0,0,0.5);
}
.venue-window { overflow: hidden; aspect-ratio: 16 / 10; position: relative; }
.venue-window img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; animation: kenburns 26s ease-in-out infinite alternate; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.13) translate(-2%, -1.5%); } }
.venue-name { font-weight: 500; font-size: 1.7rem; margin-top: 1.4rem; }
.venue-addr { font-family: var(--sans); font-size: 0.68rem; letter-spacing: 0.28em; text-transform: uppercase; color: var(--cream-soft); margin-top: 0.2rem; }
.venue-note { font-style: italic; font-size: 0.96rem; color: var(--cream-soft); max-width: 460px; margin: 1.1rem auto 0; }
.btn-line {
  display: inline-block; margin-top: 1.5rem; font-family: var(--sans);
  font-size: 0.66rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--cream);
  border: 1px solid var(--gold); padding: 0.85rem 2.1rem; text-decoration: none; transition: all 0.3s ease;
}
.btn-line:hover { background: var(--gold); color: var(--velvet); }

/* ---- details (dress + gifts) ---- */
.detail-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; margin-top: 1.8rem; }
.detail-card { border: 1px solid var(--gold-dim); padding: 2rem 1.6rem; background: rgba(58, 28, 67, 0.28); }
.detail-card h3 { font-weight: 500; font-size: 1.35rem; }
.detail-card h3::after { content: ""; display: block; width: 30px; height: 1px; background: var(--gold); margin: 0.6rem auto 0.8rem; }
.detail-card p { font-style: italic; font-size: 0.95rem; color: var(--cream-soft); }

/* ---- RSVP decree ---- */
.decree {
  margin-top: 1.6rem; width: 100%; max-width: 460px; margin-inline: auto;
  background: linear-gradient(170deg, rgba(243,233,214,0.97), rgba(236,224,200,0.97));
  color: var(--velvet); border: 1px solid var(--gold);
  box-shadow: 0 24px 60px rgba(0,0,0,0.5); padding: 2.4rem 2rem; text-align: left; position: relative;
}
.decree::before {
  content: ""; position: absolute; top: -14px; left: 50%; transform: translateX(-50%);
  width: 30px; height: 30px; border-radius: 50%;
  background: radial-gradient(circle at 36% 30%, #d9b46a, var(--gold) 55%, #8a6526);
  box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}
.decree-mono { text-align: center; font-size: 1.05rem; letter-spacing: 0.28em; color: var(--purple); margin-bottom: 1.5rem; }
.r-field { margin-bottom: 1.1rem; }
.r-field label { display: block; font-family: var(--sans); font-size: 0.6rem; letter-spacing: 0.3em; text-transform: uppercase; color: #7a5a82; margin-bottom: 0.32rem; }
.r-field input, .r-field select, .r-field textarea {
  width: 100%; background: transparent; border: none; border-bottom: 1px solid rgba(58,28,67,0.3);
  border-radius: 0; font-family: var(--serif); font-size: 1.08rem; color: var(--velvet); padding: 0.4rem 0.1rem;
  transition: border-color 0.3s;
}
.r-field input:focus, .r-field select:focus, .r-field textarea:focus { outline: none; border-color: var(--gold); }
.r-field textarea { min-height: 64px; resize: vertical; }
.r-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.attend-toggle { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; margin-bottom: 1.1rem; }
.attend-btn {
  background: none; border: 1px solid rgba(58,28,67,0.3); font-family: var(--serif); font-style: italic; font-size: 1rem;
  color: #7a5a82; padding: 0.8rem 0.5rem; cursor: pointer; transition: all 0.3s ease;
}
.attend-btn.selected { border-color: var(--gold); color: var(--velvet); background: rgba(202,164,90,0.16); }
.rsvp-submit {
  width: 100%; background: var(--velvet); border: 1px solid var(--velvet); color: var(--cream);
  font-family: var(--sans); font-size: 0.7rem; letter-spacing: 0.32em; text-transform: uppercase;
  padding: 1rem; cursor: pointer; margin-top: 0.4rem; transition: all 0.3s ease;
}
.rsvp-submit:hover { background: transparent; color: var(--velvet); }
.rsvp-submit:disabled { opacity: 0.5; cursor: wait; }
.rsvp-deadline { font-style: italic; font-size: 0.95rem; color: var(--cream-soft); margin-top: 0.4rem; }
.rsvp-status { margin-top: 1rem; text-align: center; font-size: 0.92rem; display: none; font-family: var(--sans); color: var(--velvet); }
.rsvp-status.ok { display: block; }
.rsvp-status.err { display: block; color: #8a2b2b; }

/* footer chamber */
.footer-script { font-family: var(--script); font-size: clamp(2rem, 7vw, 2.8rem); color: var(--gold-bright); }
.footer-brand { margin-top: 1.6rem; font-family: var(--sans); font-size: 0.62rem; letter-spacing: 0.32em; text-transform: uppercase; color: var(--cream-soft); }
.footer-brand a { color: var(--gold-bright); text-decoration: none; }

/* admin panel */
.admin-panel {
  position: fixed; inset: auto 0 0 0; z-index: 1100; background: #15080f;
  border-top: 1px solid var(--gold); padding: 1.4rem 1.6rem 1.8rem; max-height: 50vh; overflow: auto;
  display: none; font-family: var(--sans);
}
.admin-panel.show { display: block; }
.admin-panel h3 { font-family: var(--serif); color: var(--gold-bright); margin-bottom: 0.7rem; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.admin-table th, .admin-table td { border: 1px solid var(--gold-dim); padding: 0.45rem 0.65rem; text-align: left; }
.admin-table th { color: var(--gold-bright); font-weight: 400; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.66rem; }
.admin-actions { margin-top: 0.9rem; display: flex; gap: 0.8rem; }
.admin-actions button {
  background: none; border: 1px solid var(--gold-dim); color: var(--gold-bright);
  font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; padding: 0.5rem 1.2rem; cursor: pointer;
}

@media (max-width: 560px) {
  .rail { right: 0.7rem; }
  .r-row, .attend-toggle, .detail-cards, .count-grid { }
  .detail-cards { grid-template-columns: 1fr; }
  .prog-row { grid-template-columns: 34px 1fr; }
  .prog-when { grid-column: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-bg, .venue-window img, .mote, .hero-names { animation: none; }
  .hero-names { -webkit-text-fill-color: var(--gold-bright); color: var(--gold-bright); background: none; }
  .chambers { scroll-snap-type: none; scroll-behavior: auto; }
  .ch-inner { opacity: 1; transform: none; }
}
