/* =========================================================
   Samuel & Josephine — mobile app shell
   Screens: seal break, envelope welcome, home, story, events
   ========================================================= */

:root{
  --paper:#f7efe4;
  --paper-2:#f3e7d6;
  --cream:#faf4ea;
  --champagne:#e7ceb0;
  --gold:#a97c2c;
  --gold-deep:#8a6220;
  --deep-gold:#765015;
  --gold-light:#d4ab5f;
  --brown:#4a3a24;
  --ink:#4a3a24;
  --muted:#8b7355;
  --line:rgba(169,124,44,.22);
  --shadow:0 18px 50px rgba(88,58,20,.14);
  --tabbar-h:64px;
}

*{ box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html{ -webkit-text-size-adjust:100%; overflow-x:hidden; }
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:"Montserrat",system-ui,sans-serif;
  overflow-x:hidden;
}
body.locked{ overflow:hidden; }
img{ display:block; max-width:100%; }
button{ font:inherit; cursor:pointer; }
.hidden{ display:none !important; }

.script{ font-family:"Parisienne",cursive; font-weight:400; }
.heart{ color:var(--gold); }

/* soft floral corner wash used across screens */
.floral-bg{
  position:absolute;
  inset:0;
  pointer-events:none;
  background:
    radial-gradient(120% 60% at 0% 0%, rgba(214,188,148,.35), transparent 55%),
    radial-gradient(120% 60% at 100% 0%, rgba(214,188,148,.32), transparent 55%),
    radial-gradient(120% 55% at 0% 100%, rgba(206,178,136,.28), transparent 55%),
    radial-gradient(120% 55% at 100% 100%, rgba(206,178,136,.26), transparent 55%);
}

/* =========================================================
   SCREEN 1 — invitation + seal break
   ========================================================= */
.opening{
  position:fixed;
  inset:0;
  z-index:1000;
  display:grid;
  place-items:center;
  background:#e7d5bf;
  overflow:hidden;
}
/* .guest-in is set by the inline head script when a checked-in guest
   returns — the invitation must not paint at all for them */
.guest-in .opening{ display:none; }
.landing-frame{
  position:relative;
  /* fit inside the viewport in BOTH dimensions so the art is never cropped */
  aspect-ratio:320/531;
  height:min(100dvh, calc(100vw * 531 / 320));
  max-width:100vw;
  cursor:pointer;
  animation:landingIn 1.1s ease both;
}
.landing-frame picture,
.landing-art{ display:block; width:100%; height:100%; }
.landing-art{ object-fit:contain; user-select:none; -webkit-user-drag:none; }

/* ---------- designed landing card (default; replaces the JPEG artwork) ---------- */
.landing-card{
  position:absolute;
  inset:0;
  display:grid;
  place-items:center;
  padding:clamp(10px,3.5vw,30px);
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255,251,240,.9), transparent 60%),
    radial-gradient(140% 110% at 50% 105%, rgba(196,149,77,.28), transparent 55%),
    linear-gradient(165deg, #f8eeda 0%, #f0dfc0 52%, #e8d2ad 100%);
}
.landing-card-inner{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  text-align:center;
  gap:0;
  /* text sits in the top half — the wax seal owns the lower zone */
  padding:clamp(56px,15%,110px) clamp(26px,7vw,60px) clamp(26px,7vw,60px);
  border:1px solid rgba(169,124,44,.55);
  outline:1px solid rgba(169,124,44,.25);
  outline-offset:-9px;
}
.landing-eyebrow{
  font:600 .68rem "Montserrat",sans-serif;
  letter-spacing:.34em;
  text-transform:uppercase;
  color:#8a6d34;
}
.landing-pre{
  margin-top:14px;
  font-family:"Parisienne",cursive;
  font-size:clamp(1.5rem,5.6vw,2.2rem);
  color:#7a5c2a;
}
.landing-names{
  margin-top:6px;
  font-family:"Cormorant Garamond",Georgia,serif;
  font-weight:600;
  font-size:clamp(2.3rem,9vw,3.8rem);
  line-height:1.05;
  color:#573c14;
}
.landing-amp{
  padding:0 .14em;
  font-family:"Parisienne",cursive;
  font-weight:400;
  color:#b98c33;
}
.landing-rule{
  margin-top:20px;
  width:min(52%,220px);
  height:1px;
  background:linear-gradient(90deg, transparent, #b98c33, transparent);
}
.landing-hashtag{
  margin-top:18px;
  font-family:"Parisienne",cursive;
  font-size:clamp(1.2rem,4.6vw,1.7rem);
  color:#8a6d34;
}
.landing-tap{
  position:absolute;
  left:50%;
  bottom:5.5%;
  transform:translateX(-50%);
  font:700 .6rem "Montserrat",sans-serif;
  letter-spacing:.32em;
  text-transform:uppercase;
  color:#8a6d34;
  white-space:nowrap;
}
/* seal artwork lives inside the tap hotspot in card mode;
   the PNG is an opaque square with the round seal ~97% of it,
   so clip to the disc — drop-shadow then follows the round shape */
.landing-seal{
  display:block;
  width:100%;
  height:100%;
  object-fit:cover;
  clip-path:circle(48.5% at 48.7% 50.5%);
  pointer-events:none;
  filter:drop-shadow(0 12px 20px rgba(80,50,10,.38));
}
.landing-frame--card .seal-hotspot{ top:71%; width:44%; }
/* mode switch — uploaded art replaces the whole card */
.landing-frame--card .landing-art{ display:none; }
.landing-frame:not(.landing-frame--card) .landing-card{ display:none; }
.landing-frame:not(.landing-frame--card) .landing-seal{ display:none; }
.landing-frame:not(.landing-frame--card) .landing-tap{ display:none; }
/* press feedback while the invitation opens */
.opening.breaking .landing-seal{ animation:sealCrack .8s ease forwards; }
@keyframes sealCrack{
  30%{ transform:scale(.9) rotate(-3deg); filter:drop-shadow(0 4px 8px rgba(80,50,10,.5)); }
  100%{ transform:scale(1.06); opacity:.4; }
}

.seal-hotspot{
  position:absolute;
  left:50%;
  top:75%;           /* lands on the wax seal baked into landing-invite.jpg */
  width:36%;
  aspect-ratio:1;
  transform:translate(-50%,-50%);
  border:0;
  padding:0;
  border-radius:50%;
  background:transparent;
  z-index:5;
  cursor:pointer;
}
.seal-hotspot::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:rgba(255,255,255,0.001);
}
.seal-hotspot .seal-ripple{
  position:absolute;
  inset:-8%;
  border-radius:50%;
  box-shadow:0 0 0 0 rgba(202,153,78,.34);
  animation:sealRipple 2s infinite;
}
.seal-hotspot:focus-visible{ outline:2px solid rgba(255,236,200,.9); outline-offset:6px; }
.seal-hotspot:active{ transform:translate(-50%,-50%) scale(.96); }
.opening.breaking .seal-hotspot{ animation:sealPress .45s cubic-bezier(.2,.8,.3,1); }
.opening.breaking .seal-hotspot .seal-ripple{ animation:none; box-shadow:none; }

.opening.opening-envelope .landing-frame{ animation:openInvite .65s ease forwards; }
.opening.opening-envelope{ animation:openingExit .65s ease forwards; }
.opening.exit{ animation:openingExit .65s ease forwards; }

@keyframes landingIn{
  from{ opacity:0; transform:scale(1.03); filter:blur(6px); }
  to{ opacity:1; transform:none; filter:none; }
}
@keyframes sealRipple{ 70%,100%{ box-shadow:0 0 0 24px rgba(202,153,78,0); } }
@keyframes sealPress{
  0%{ transform:translate(-50%,-50%) scale(1); }
  35%{ transform:translate(-50%,-50%) scale(.92); }
  100%{ transform:translate(-50%,-50%) scale(1); }
}
@keyframes openInvite{ to{ opacity:0; transform:scale(1.08); filter:blur(7px); } }
@keyframes openingExit{ to{ opacity:0; filter:blur(7px); transform:scale(1.02); } }

@media(max-width:520px){
  .landing-frame{ width:100vw; height:auto; max-height:100dvh; }
  .landing-art{ object-fit:contain; background:#e7d5bf; }
}

/* =========================================================
   SCREEN 2 — Welcome to our forever (envelope)
   ========================================================= */
/* =========================================================
   SCREEN 2 — Invitation with canvas seal break
   ========================================================= */
.invitation-screen{
  position:fixed;
  inset:0;
  z-index:999;
  background:#17120d;
  display:grid;
  place-items:center;
  overflow:hidden;
  animation:gateIn .7s cubic-bezier(.2,.8,.3,1) both;
}
.invitation-screen.exit{ animation:gateExit .7s cubic-bezier(.4,0,.2,1) forwards; }

.invitation{
  position:relative;
  /* width is capped so the derived height never exceeds the viewport —
     keeps the artwork fully visible and the hotspots aligned */
  aspect-ratio:740 / 1600;
  width:min(100vw, 592px, calc(100dvh * 740 / 1600));
  overflow:hidden;
  background:#d7bea0;
}

.invitation-image{
  width:100%;
  height:100%;
  display:block;
  object-fit:cover;
  user-select:none;
  -webkit-user-drag:none;
}

/* Seal hit area — positioned over the seal on the 740x1600 artwork.
   x 90/740 = 12.16%  |  y 603/1600 = 37.69%  |  w 560/740 = 75.68% */
.seal-hit-area{
  position:absolute;
  left:12.16%;
  top:37.69%;
  width:75.68%;
  aspect-ratio:1;
  border-radius:50%;
  cursor:pointer;
  z-index:12;
  touch-action:manipulation;
  outline:none;
  -webkit-tap-highlight-color:transparent;
}
.seal-hit-area:focus-visible{
  outline:2px solid #f7d77c;
  outline-offset:7px;
}

#sealCanvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  display:block;
  border-radius:50%;
  pointer-events:none;
  transition:opacity 300ms ease;
}

.particle-canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  z-index:30;
  pointer-events:none;
}

/* screen-reader-only helper */
.sr-only{
  position:absolute;
  width:1px; height:1px;
  padding:0; margin:-1px;
  overflow:hidden;
  clip:rect(0 0 0 0);
  white-space:nowrap;
  border:0;
}

/* The artwork already says "TAP THE SEAL TO OPEN", so instead of repeating
   the text we breathe a soft gold halo over the seal to signal it is tappable. */
.seal-hit-area::after{
  content:"";
  position:absolute;
  inset:-6%;
  border-radius:50%;
  pointer-events:none;
  box-shadow:0 0 0 0 rgba(247,215,124,.55);
  animation:sealBreathe 2.4s ease-in-out infinite;
}
.seal-hit-area.is-breaking::after{ animation:none; opacity:0; }
@keyframes sealBreathe{
  0%,100%{ box-shadow:0 0 14px 2px rgba(247,215,124,.16); }
  50%{ box-shadow:0 0 34px 8px rgba(247,215,124,.42); }
}
.seal-hit-area:active{ transform:scale(.985); }

/* impact rings */
.impact-ring{
  position:absolute;
  left:50%;
  top:50%;
  width:30%;
  height:30%;
  border-radius:50%;
  border:1px solid rgba(247,215,124,.75);
  transform:translate(-50%,-50%) scale(.2);
  opacity:0;
  pointer-events:none;
}
.seal-hit-area.is-breaking .impact-ring--1{ animation:impactRing 700ms ease-out forwards; }
.seal-hit-area.is-breaking .impact-ring--2{ animation:impactRing 850ms 75ms ease-out forwards; }
@keyframes impactRing{
  0%{ opacity:.9; transform:translate(-50%,-50%) scale(.25); }
  100%{ opacity:0; transform:translate(-50%,-50%) scale(4.5); }
}

/* gold explosion flash */
.seal-flash{
  position:absolute;
  left:50%;
  top:50%;
  width:55%;
  height:55%;
  border-radius:50%;
  transform:translate(-50%,-50%) scale(.1);
  opacity:0;
  pointer-events:none;
  background:radial-gradient(circle,
    rgba(255,255,238,1) 0%,
    rgba(255,224,144,.95) 20%,
    rgba(226,170,66,.58) 47%,
    rgba(217,174,82,0) 73%);
  filter:blur(2px);
  mix-blend-mode:screen;
}
.seal-hit-area.is-breaking .seal-flash{ animation:sealFlash 650ms ease-out forwards; }
@keyframes sealFlash{
  0%{ opacity:0; transform:translate(-50%,-50%) scale(.1); }
  16%{ opacity:1; }
  42%{ opacity:.95; }
  100%{ opacity:0; transform:translate(-50%,-50%) scale(3.8); }
}

.invitation.is-shaking{ animation:invitationShake 360ms ease-out; }
@keyframes invitationShake{
  0%,100%{ transform:translate3d(0,0,0) rotate(0); }
  12%{ transform:translate3d(-4px,1px,0) rotate(-.15deg); }
  26%{ transform:translate3d(5px,-2px,0) rotate(.18deg); }
  42%{ transform:translate3d(-4px,2px,0) rotate(-.12deg); }
  58%{ transform:translate3d(3px,-1px,0) rotate(.1deg); }
  74%{ transform:translate3d(-2px,1px,0); }
  88%{ transform:translate3d(1px,0,0); }
}

@media(prefers-reduced-motion:reduce){
  .invitation-screen,.invitation,.seal-hit-area,.seal-hit-area::after,.impact-ring,.seal-flash{ animation:none; }
}

/* =========================================================
   SCREEN 3 & 4 — Gate screens (attend question + guest login)
   ========================================================= */
.gate-screen{
  position:fixed;
  inset:0;
  z-index:998;
  /* flex + margin:auto on the card: centered when it fits, top-anchored
     and fully scrollable when it's taller than the viewport — the old
     place-items:center clipped the top of tall forms beyond reach */
  display:flex;
  flex-direction:column;
  align-items:center;
  overflow-y:auto;
  padding:24px;
  background:
    radial-gradient(120% 60% at 50% 0%, #f7efe4, transparent 55%),
    linear-gradient(180deg,#f0dfc6,#e6d2b6);
  animation:gateIn .6s cubic-bezier(.2,.8,.3,1) both;
}
.gate-screen.exit{
  animation:gateExit .7s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes gateIn{
  from{ opacity:0; transform:translateY(20px) scale(.97); filter:blur(6px); }
  to{ opacity:1; transform:none; filter:none; }
}
@keyframes gateExit{
  to{ opacity:0; transform:scale(1.04); filter:blur(8px); visibility:hidden; }
}

.gate-card{
  width:min(100%,460px);
  margin:auto;
  flex-shrink:0;
  padding:40px 28px 32px;
  text-align:center;
  border-radius:24px;
  background:rgba(255,255,255,.78);
  border:1px solid rgba(255,255,255,.9);
  backdrop-filter:blur(22px);
  box-shadow:0 25px 70px rgba(70,43,17,.15),
             inset 0 1px 0 rgba(255,255,255,.6);
  animation:cardRise .7s .15s cubic-bezier(.2,.7,.2,1) both;
  position:relative;
}
.gate-card::before{
  content:"";
  position:absolute;
  inset:6px;
  border:1px solid rgba(169,124,44,.18);
  border-radius:18px;
  pointer-events:none;
}
@keyframes cardRise{
  from{ opacity:0; transform:translateY(30px) scale(.96); }
  to{ opacity:1; transform:none; }
}

.gate-card--form{ padding:36px 28px 28px; }

/* ---- Screen 3: "ENTER OUR WEDDING" hotspot over the artwork ----
   The button is painted into assets/attend-bg.jpg; this transparent
   button sits exactly on top of it so the artwork stays pristine. */
.invitation--welcome2{ position:relative; }
.enter-hotspot{
  position:absolute;
  left:13%;
  top:85.4%;
  width:74%;
  height:6.4%;
  z-index:15;
  pointer-events:auto;
  border:0;
  padding:0;
  background:transparent;
  border-radius:999px;
  cursor:pointer;
  touch-action:manipulation;
  -webkit-tap-highlight-color:transparent;
  animation:enterBreathe 2.6s ease-in-out infinite;
}
/* invisible-but-clickable overlay ensures the hit area is always
   registered even when the button background is fully transparent */
.enter-hotspot::before{
  content:"";
  position:absolute;
  inset:0;
  border-radius:inherit;
  background:rgba(255,255,255,0.001);
}
.enter-hotspot:active{ transform:scale(.98); }
.enter-hotspot:focus-visible{
  outline:2px solid #f7d77c;
  outline-offset:4px;
}
@keyframes enterBreathe{
  0%,100%{ box-shadow:0 0 12px 1px rgba(247,215,124,.14); }
  50%{ box-shadow:0 0 28px 6px rgba(247,215,124,.38); }
}
.invitation--welcome2.is-entering{ animation:invitationShake 300ms ease-out; }

/* small S&J emblem */
.mini-monogram{
  width:61px;
  height:61px;
  margin:0 auto 13px;
  border:1px solid rgba(141,99,24,.6);
  border-radius:50%;
  display:flex;
  justify-content:center;
  align-items:center;
  gap:2px;
  color:#8d6318;
  font-family:"Cormorant Garamond",serif;
  font-size:21px;
  box-shadow:inset 0 0 0 4px rgba(217,174,82,.08);
}
.mini-monogram__amp{
  margin-top:4px;
  font-family:"Parisienne",cursive;
  font-size:14px;
}

.gate-date{
  margin:0 0 6px;
  color:#593e18;
  font-size:clamp(15px,4vw,19px);
  font-weight:700;
  letter-spacing:.07em;
}

/* decline panel */
.decline-panel{
  text-align:center;
  animation:revealDecline .65s cubic-bezier(.22,.72,.24,1) both;
}
.decline-panel__heart{
  margin-bottom:7px;
  color:#b8862c;
  font-size:20px;
}
.decline-panel h2{
  margin:0 0 8px;
  color:#77541b;
  font-family:"Parisienne",cursive;
  font-size:clamp(31px,8vw,42px);
  font-weight:400;
}
.decline-panel p{
  margin:0 auto 20px;
  max-width:310px;
  color:#5b5045;
  font-size:.92rem;
  line-height:1.45;
}
@keyframes revealDecline{
  from{ opacity:0; transform:translateY(15px) scale(.985); }
  to{ opacity:1; transform:none; }
}

.text-button{
  margin-top:13px;
  border:0;
  padding:9px 15px;
  cursor:pointer;
  background:transparent;
  color:#816327;
  font-size:.82rem;
  text-decoration:underline;
  text-underline-offset:4px;
}

@media(max-height:680px){
  .mini-monogram{ width:48px; height:48px; margin-bottom:8px; font-size:17px; }
}

.gate-seal{
  width:72px;
  height:72px;
  margin:0 auto 14px;
  animation:sealFloat 2.8s ease-in-out infinite;
}
.gate-seal img{ width:100%; height:100%; object-fit:contain; }

.gate-eyebrow{
  margin:0;
  font-size:.7rem;
  font-weight:600;
  letter-spacing:.22em;
  color:var(--muted);
}
.gate-title{
  margin:6px 0 4px;
  font-family:"Cormorant Garamond",Georgia,serif;
  font-size:clamp(1.8rem,6vw,2.4rem);
  font-weight:600;
  color:var(--ink);
}
.gate-sub{
  margin:0 0 4px;
  font-size:.82rem;
  color:var(--muted);
  line-height:1.5;
}

.gate-buttons{
  display:flex;
  flex-direction:column;
  gap:12px;
  margin-top:18px;
}
.gate-btn{
  padding:15px 24px;
  border:0;
  border-radius:999px;
  font-size:.78rem;
  font-weight:700;
  letter-spacing:.12em;
  cursor:pointer;
  transition:transform .2s ease, box-shadow .2s ease, opacity .2s ease;
  -webkit-tap-highlight-color:transparent;
}
.gate-btn:active{ transform:scale(.97); }
.gate-btn:disabled{ opacity:.6; cursor:default; }
.gate-btn--yes{
  background:linear-gradient(135deg,#c79c48,#8a6220);
  color:#fff7e4;
  box-shadow:0 12px 30px rgba(105,71,22,.32),
             inset 0 1px 0 rgba(255,240,205,.3);
}
.gate-btn--yes:hover{ box-shadow:0 14px 36px rgba(105,71,22,.4); }
.gate-btn--no{
  background:rgba(255,255,255,.7);
  color:var(--muted);
  border:1px solid rgba(169,124,44,.25);
}
.gate-btn--no:hover{ background:rgba(255,255,255,.9); }
.gate-btn--browse{
  background:transparent;
  color:var(--gold);
  font-size:.72rem;
  padding:12px 20px;
  border:1px solid rgba(169,124,44,.3);
}
.gate-btn--submit{
  margin-top:18px;
  background:linear-gradient(135deg,#c79c48,#8a6220);
  color:#fff7e4;
  box-shadow:0 12px 30px rgba(105,71,22,.32);
}

.gate-decline{
  margin-top:16px;
  font-size:.85rem;
  color:var(--muted);
  line-height:1.6;
  animation:fadeUp .5s ease both;
}
@keyframes fadeUp{
  from{ opacity:0; transform:translateY(10px); }
  to{ opacity:1; transform:none; }
}

/* guest login form */
.gate-form{
  text-align:left;
  margin-top:18px;
  display:flex;
  flex-direction:column;
  gap:14px;
}
.gate-error{
  color:#b03a2e;
  font-size:.8rem;
  margin:0;
  min-height:1em;
}
/* secondary text actions under the big submit buttons */
.gate-link{
  align-self:center;
  background:none; border:0; padding:2px;
  font-family:Montserrat,sans-serif;
  font-size:.7rem; font-weight:600;
  letter-spacing:.1em; text-transform:uppercase;
  color:#9a7b45; cursor:pointer;
}
.gate-link:active{ color:var(--ink); }
.gate-sub--otp{ text-align:center; }
.gate-sub--otp b{ color:#8a5a00; }
.otp-input{
  text-align:center !important;
  font-size:1.5rem !important;
  font-weight:700;
  letter-spacing:.4em;
  font-family:Montserrat,sans-serif;
}
.gate-form .field{
  display:block;
  font-size:.72rem;
  font-weight:600;
  letter-spacing:.1em;
  color:var(--muted);
  text-transform:uppercase;
}
.gate-form .field input,
.gate-form .field select{
  display:block;
  width:100%;
  margin-top:6px;
  padding:13px 14px;
  border:1px solid rgba(169,124,44,.25);
  border-radius:12px;
  background:rgba(255,255,255,.85);
  font-size:.9rem;
  color:var(--ink);
  font-family:inherit;
}
.gate-form .field input:focus,
.gate-form .field select:focus{
  outline:0;
  border-color:var(--gold);
  box-shadow:0 0 0 3px rgba(169,124,44,.12);
}

@media(prefers-reduced-motion:reduce){
  .gate-screen,
  .gate-card,
  .gate-seal{ animation-duration:.01s; animation-delay:0s; transition-duration:.01s; }
}

/* ---------- full-bleed invitation gates on phones ----------
   Portrait screens: the artwork covers the whole viewport instead of
   letterboxing inside a fixed-ratio frame with dark bars. The art's own
   ratio (≈0.46) matches phone viewports almost exactly, so cover crops
   nearly nothing and the % hotspots stay on their buttons. Landscape /
   desktop keeps the fitted frame so nothing important is cropped away. */
@media (max-aspect-ratio: 3/4){
  .landing-frame{ width:100vw; height:100dvh; aspect-ratio:auto; }
  .landing-art{ object-fit:cover; }
  .invitation{ width:100vw; height:100dvh; aspect-ratio:auto; }
}
