/* 2 · Invitation. A letterpress card with a reply sentence to fill in; each blank opens a small
   picker from the blank itself (origin-aware on desktop, a sheet on phones). Sealing: the card
   becomes a reply card, slides into an envelope, the flap closes and a navy wax seal is pressed.
   Emil: popovers 180ms ease-out from their trigger, exits 120ms; sealing is a one-time
   celebratory sequence (~2.6s), skipped for reduced motion. */
/* The atelier at night (generated for GW after the Marsanti / Amiri campaign mood): walnut panelling,
   a navy chalk-stripe suit on a dummy under a lamp, a leather Chesterfield, and a calm dark middle
   where the invitation sits. The photo is softened and darkened behind the card so it stays quiet. */
.iv { position: relative; min-height: 100svh; display: grid; grid-template-rows: auto 1fr; overflow: hidden; color: var(--navy); background-color: #120c08; }
.iv::before { content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(ellipse 34% 52% at 50% 50%, rgba(10,6,3,.45), transparent 100%),
    radial-gradient(ellipse 90% 85% at 50% 45%, transparent 50%, rgba(6,4,2,.7) 100%),
    url(assets/site/gw-atelier.webp) center 40% / cover no-repeat; }
.iv > * { position: relative; z-index: 1; }
@media (max-width: 820px) { .iv::before { background:
    linear-gradient(180deg, rgba(8,5,3,.15), rgba(8,5,3,.55)),
    url(assets/site/gw-atelier.webp) 14% center / cover no-repeat; } }
.iv__top { position: relative; z-index: 5; display: flex; justify-content: center; align-items: center; padding: 20px 26px; }
.iv__top .iv__x { position: absolute; right: 26px; top: 50%; margin-top: -18px; }
.iv__top .logo { height: 22px; width: auto; color: var(--cream-ink); }
.iv__x { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); color: var(--cream-ink); font-size: 18px; }
.iv__stage { position: relative; display: grid; place-items: center; padding: 8px 18px 60px; }

/* the card */
.inv { position: relative; z-index: 2; width: min(640px, 100%); padding: clamp(30px, 5vw, 56px) clamp(22px, 5vw, 60px) clamp(28px, 4vw, 44px); text-align: center;
  background: #f8f3e8; box-shadow: 0 1px 1px rgba(0,0,0,.2), 0 40px 80px -30px rgba(0,0,0,.7), 0 18px 30px -18px rgba(0,0,0,.5);
  transform: rotate(-.5deg); transition: opacity 420ms ease, transform 600ms var(--ease-in-out), filter 420ms ease; }
.inv::before { content: ""; position: absolute; inset: 12px; border: 1px solid rgba(138,106,58,.55); pointer-events: none; }
.inv::after { content: ""; position: absolute; inset: 16px; border: 1px solid rgba(138,106,58,.28); pointer-events: none; }
.foil { width: 64px; height: 64px; margin: 0 auto; position: relative; overflow: hidden; -webkit-mask: url(assets/brand/gw-mark.svg) center / contain no-repeat; mask: url(assets/brand/gw-mark.svg) center / contain no-repeat; background: linear-gradient(135deg, #8a6a3a, #e3c98d 40%, #a98544 62%, #e8d4a0 82%, #8a6a3a); }
.foil i { position: absolute; top: -20%; bottom: -20%; width: 40%; left: 0; background: linear-gradient(90deg, rgba(255,255,255,0), rgba(255,252,240,.9), rgba(255,255,255,0)); transform: translateX(-180%) skewX(-18deg); animation: foil 1400ms cubic-bezier(.45,.05,.35,1) 1150ms forwards; }
@keyframes foil { to { transform: translateX(380%) skewX(-18deg); } }
.inv__house { margin-top: 18px; font-size: 10.5px; font-weight: 600; letter-spacing: .34em; text-transform: uppercase; color: var(--brass-3); }
.inv__req { margin: 10px auto 0; max-width: 30ch; font-family: "Cormorant Garamond", serif; font-style: italic; font-size: clamp(20px, 2.2vw, 25px); line-height: 1.35; color: rgba(22,33,61,.85); }
.inv__orn { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 20px 0 16px; color: rgba(138,106,58,.7); }
.inv__orn i { width: 56px; height: 1px; background: currentColor; }
.inv__orn b { width: 6px; height: 6px; transform: rotate(45deg); border: 1px solid currentColor; }
.inv__rsvp { font-size: 10px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: rgba(22,33,61,.5); }
.reply { margin: 14px auto 0; max-width: 34em; font-family: "Cormorant Garamond", serif; font-size: clamp(19px, 2.05vw, 24px); line-height: 2.05; color: rgba(22,33,61,.78); text-align: center; text-wrap: pretty; }
.blank { position: relative; display: inline; padding: 0 2px; font: inherit; font-style: italic; color: rgba(22,33,61,.38); border-bottom: 1px dashed rgba(138,106,58,.7); transition: color 200ms ease, background-color 160ms ease; cursor: pointer; border-radius: 2px; }
.blank[data-filled] { color: var(--navy); font-weight: 600; border-bottom: 1px solid rgba(22,33,61,.55); }
.blank[data-filled] span { animation: ink 520ms var(--ease-out); }
@keyframes ink { from { opacity: 0; filter: blur(3px); } }
.blank[aria-expanded="true"] { background: rgba(201,164,92,.16); }
@media (hover: hover) and (pointer: fine) { .blank:hover { background: rgba(201,164,92,.12); } }
.blank-in { display: inline-block; min-width: 6ch; max-width: 16ch; padding: 0 2px; border: 0; border-bottom: 1px dashed rgba(138,106,58,.7); background: transparent; font: inherit; font-style: italic; font-weight: 600; color: var(--navy); text-align: center; outline: none; border-radius: 0; field-sizing: content; }
.blank-in::placeholder { color: rgba(22,33,61,.38); font-weight: 400; }
.blank-in:focus { border-bottom: 1px solid var(--brass-3); background: rgba(201,164,92,.1); }
.blank-in[data-bad] { border-bottom-color: #b4442f; }
.inv__foot { margin-top: 26px; display: grid; justify-items: center; gap: 10px; }
.seal-btn { height: 48px; padding: 0 28px; border-radius: 24px; background: var(--navy); color: #fff; font-size: 11.5px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; transition: transform 160ms var(--ease-out), opacity 200ms ease; }
.seal-btn[aria-disabled="true"] { opacity: .3; cursor: not-allowed; }
.seal-btn:not([aria-disabled="true"]):active { transform: scale(.97); }
.inv__count { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 14px; color: rgba(22,33,61,.55); }

/* the picker: grows from the blank on desktop, a sheet on phones */
.pk-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(5,8,18,.0); visibility: hidden; transition: background-color 200ms ease, visibility 0s linear 200ms; }
.pk-scrim[data-on] { visibility: visible; background: rgba(5,8,18,.18); transition: background-color 200ms ease, visibility 0s; }
.pk { position: fixed; z-index: 41; width: 340px; max-height: min(420px, 70svh); overflow: auto; overscroll-behavior: contain; scrollbar-width: none; padding: 12px; border-radius: 16px; background: #fffdf8; color: var(--navy); box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 24px 50px -20px rgba(0,0,0,.55);
  opacity: 0; transform: scale(.96); transform-origin: var(--origin, 50% 0); visibility: hidden; transition: opacity 120ms ease, transform 120ms ease, visibility 0s linear 120ms; }
.pk[data-on] { opacity: 1; transform: none; visibility: visible; transition: opacity 180ms var(--ease-out), transform 180ms var(--ease-out), visibility 0s; }
.pk::-webkit-scrollbar { display: none; }
.pk__h { display: flex; justify-content: space-between; align-items: center; padding: 2px 4px 10px; font-size: 10px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: rgba(22,33,61,.5); }
.pk__h button { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: none; color: var(--brass-3); }
.pk__grab { display: none; }
.pk__list { display: grid; gap: 2px; }
.pk__o { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 6px; border-radius: 10px; text-align: left; font-family: "Cormorant Garamond", serif; font-size: 19px; transition: background-color 150ms ease, transform 160ms var(--ease-out); }
.pk__o--plain { grid-template-columns: 1fr auto; padding: 10px 10px; }
.pk__o img, .pk__o .sw { width: 40px; height: 48px; border-radius: 6px; object-fit: cover; object-position: 50% 20%; background-size: 900%; background-position: 50% 42%; }
.pk__o .sw--advise { background: linear-gradient(135deg, #1a2850, #2b3c6c); color: var(--brass-2); display: grid; place-items: center; font-family: "Mrs Saint Delafield", cursive; font-size: 26px; }
.pk__o small { display: block; font-family: "Inter", sans-serif; font-size: 11px; color: rgba(22,33,61,.55); }
.pk__o em { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--navy); opacity: 0; transform: scale(.6); transition: opacity 150ms ease, transform 200ms var(--ease-out); }
.pk__o em svg { width: 11px; height: 11px; }
.pk__o[aria-checked="true"] em, .pk__o[aria-pressed="true"] em { opacity: 1; transform: none; }
.pk__o:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .pk__o:hover { background: rgba(22,33,61,.05); } }
.pk__o:disabled { color: rgba(22,33,61,.3); text-decoration: line-through; cursor: not-allowed; }
.pk__days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.pk__days small { text-align: center; font-size: 9px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: rgba(22,33,61,.4); padding: 4px 0; }
.pk__d { height: 40px; border-radius: 10px; font-family: "Playfair Display", serif; font-size: 16px; transition: background-color 150ms ease, color 150ms ease, transform 160ms var(--ease-out); }
.pk__d[aria-checked="true"] { background: var(--navy); color: #fff; }
.pk__d:active { transform: scale(.94); }
@media (hover: hover) and (pointer: fine) { .pk__d:not([aria-checked="true"]):hover { background: rgba(22,33,61,.06); } }
.pk__t { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.pk__done { margin-top: 10px; width: 100%; height: 42px; border-radius: 21px; background: var(--navy); color: #fff; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; }

/* the envelope */
.env { position: absolute; z-index: 1; left: 50%; top: 50%; --W: min(520px, 88vw); --H: calc(var(--W) * .64); width: var(--W); height: var(--H); margin: calc(var(--H) / -2 + 40px) 0 0 calc(var(--W) / -2); pointer-events: none; }
.env > * { position: absolute; inset: 0; opacity: 0; transform: translateY(40px); transition: opacity 400ms ease, transform 600ms var(--ease-out); }
.env__back { background: #e5dac4; border-radius: 4px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.7); z-index: 1; }
.env__card { z-index: 2; left: 5%; right: 5%; top: -78%; height: 86%; bottom: auto; background: #f8f3e8; border-radius: 2px; padding: 8% 8%; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.12);
  display: grid; align-content: start; justify-items: center; gap: 6px; }
.env__card::before { content: ""; position: absolute; inset: 8px; border: 1px solid rgba(138,106,58,.45); }
.env__card .foil { width: 34px; height: 34px; }
.env__card small { font-size: 8.5px; font-weight: 600; letter-spacing: .3em; text-transform: uppercase; color: var(--brass-3); }
.env__card b { font-family: "Playfair Display", serif; font-weight: 600; font-size: clamp(16px, 2.4vw, 22px); line-height: 1.15; }
.env__card p { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: clamp(13px, 1.8vw, 16px); color: rgba(22,33,61,.7); }
.env__front { z-index: 3; background: transparent; }
.env__front svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.env__flap { z-index: 0; transform-origin: 50% 0; transform-style: preserve-3d; height: 60%; }
.env__flap i { position: absolute; inset: 0; backface-visibility: hidden; clip-path: polygon(0 0, 100% 0, 50% 100%); }
.env__flap .out { background: linear-gradient(180deg, #e9dfca, #ddd1b8); }
.env__flap .in { background: linear-gradient(0deg, #d7caae, #cdbf9f); transform: rotateY(180deg) rotateZ(180deg); }
.env__seal { z-index: 6; left: 50%; top: 60%; right: auto; bottom: auto; width: 74px; height: 74px; margin: -40px 0 0 -37px; border-radius: 48% 52% 46% 54% / 52% 47% 53% 48%;
  background: radial-gradient(circle at 38% 32%, #3b4f86 0%, #22325f 45%, #131d3c 80%); box-shadow: 0 3px 6px rgba(0,0,0,.45), inset 0 -3px 6px rgba(0,0,0,.35), inset 0 2px 3px rgba(255,255,255,.16); }
.env__seal::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; box-shadow: inset 0 0 0 2px rgba(255,255,255,.08), inset 0 2px 3px rgba(0,0,0,.4); }
.env__seal::after { content: ""; position: absolute; inset: 17px; -webkit-mask: url(assets/brand/gw-mark.svg) center / contain no-repeat; mask: url(assets/brand/gw-mark.svg) center / contain no-repeat; background: linear-gradient(160deg, rgba(255,255,255,.35), rgba(255,255,255,.08)); }
.env__after { position: absolute; z-index: 7; top: calc(100% + 26px); bottom: auto; left: calc(50% - min(420px, 88vw) / 2); right: auto; width: min(420px, 88vw); display: grid; gap: 8px; justify-items: center; text-align: center; color: var(--cream-ink); pointer-events: auto; }
.env__after p { font-family: "Cormorant Garamond", serif; font-style: italic; font-size: 19px; }
.env__after .row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.env__after a, .env__after button { height: 44px; padding: 0 20px; border-radius: 22px; display: inline-flex; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; transition: transform 160ms var(--ease-out); }
.env__after a { background: var(--cream-ink); color: var(--navy); }
.env__after button { box-shadow: inset 0 0 0 1px rgba(241,234,217,.4); color: var(--cream-ink); }
.env__after a:active, .env__after button:active { transform: scale(.97); }
.env__after .open { box-shadow: none; opacity: .7; text-transform: none; letter-spacing: 0; font-size: 12px; font-weight: 500; text-decoration: underline; text-underline-offset: 3px; }

/* sealing sequence */
.iv[data-seal] .inv { opacity: 0; transform: translateY(-30px) scale(.86) rotate(-.5deg); filter: blur(4px); pointer-events: none; }
.iv[data-seal] .env { pointer-events: auto; }
.iv[data-seal] .env > * { opacity: 1; transform: none; }
.iv[data-seal] .env__back, .iv[data-seal] .env__front, .iv[data-seal] .env__flap { transition-delay: 380ms; }
.iv[data-seal] .env__flap { transform: rotateX(180deg); }
.iv[data-seal] .env__card { transition: opacity 400ms ease 300ms, transform 760ms var(--ease-in-out) 950ms; transform: translateY(100%); }
.iv[data-seal] .env__flap { animation: flap 2400ms forwards; }
@keyframes flap { 0%, 70% { transform: rotateX(180deg); z-index: 0; } 71% { z-index: 5; } 100% { transform: rotateX(0deg); z-index: 5; } }
.iv[data-seal] .env__seal { opacity: 0; transform: scale(1.6); transition: none; animation: press 520ms cubic-bezier(.2, .9, .3, 1.15) 2350ms forwards; }
@keyframes press { 0% { opacity: 0; transform: scale(1.6) rotate(-8deg); } 60% { opacity: 1; transform: scale(.92) rotate(0deg); } 100% { opacity: 1; transform: scale(1) rotate(0deg); } }
.iv[data-seal] .env__after { opacity: 0; transform: translateY(10px); transition: none; }
.iv[data-seal][data-sealed] .env__after { opacity: 1; transform: none; transition: opacity 400ms ease, transform 500ms var(--ease-out); }
.iv[data-seal] .env__card { z-index: 2; }
@media (max-width: 820px) {
  .iv__top { padding: 14px 16px; }
  .iv__x { display: none; }
  .iv { grid-template-rows: 1fr; }
  .iv__top { position: absolute; top: 0; left: 0; right: 0; }
  .iv__stage { min-height: 100svh; padding: 64px 12px; align-items: safe center; justify-items: center; }
  .inv { transform: none; }
  .reply { line-height: 2.1; }
  .pk { left: 0 !important; right: 0; top: auto !important; bottom: 0; width: auto; max-height: 72svh; border-radius: 20px 20px 0 0; padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); opacity: 1; transition: transform 240ms var(--ease-out), visibility 0s linear 240ms; }
  .pk[data-on] { transform: none; transition: transform 420ms var(--ease-drawer), visibility 0s; }
  .pk__grab { display: block; width: 36px; height: 4px; border-radius: 2px; margin: 0 auto 10px; background: rgba(22,33,61,.18); }
  .env { top: 40%; }
}
@media (prefers-reduced-motion: reduce) {
  .iv[data-seal] .env__flap, .iv[data-seal] .env__seal { animation-duration: 1ms; animation-delay: 0ms; }
  .iv[data-seal] .env__card, .iv[data-seal] .env > *, .iv[data-seal] .env__after { transition-duration: 1ms; transition-delay: 0ms; }
  .foil i { animation: none; }
}

/* ── Arrival: the atelier settles into view (light comes up, a slow pull back), then the
   invitation lifts onto the table and its lines appear in reading order. Plays once on load. */
.iv::before { animation: room-in 2200ms cubic-bezier(0.23, 1, 0.32, 1) both; }
@keyframes room-in { from { opacity: 0; transform: scale(1.08); filter: brightness(.5) blur(6px); } 40% { opacity: 1; } }
.iv__top { animation: fade-down 900ms cubic-bezier(0.23, 1, 0.32, 1) 500ms both; }
@keyframes fade-down { from { opacity: 0; transform: translateY(-8px); filter: blur(3px); } }
.inv { animation: card-in 1100ms cubic-bezier(0.23, 1, 0.32, 1) 300ms both; }
@keyframes card-in { from { opacity: 0; transform: translateY(36px) rotate(-1.6deg) scale(.97); filter: blur(6px); } 55% { opacity: 1; } }
.inv > .foil, .inv__house, .inv__req, .inv__orn, .inv__rsvp, .reply, .inv__foot { animation: line-in 700ms cubic-bezier(0.23, 1, 0.32, 1) both; }
@keyframes line-in { from { opacity: 0; transform: translateY(10px); filter: blur(3px); } }
.inv > .foil { animation-delay: 620ms; } .inv__house { animation-delay: 700ms; } .inv__req { animation-delay: 780ms; }
.inv__orn { animation-delay: 860ms; } .inv__rsvp { animation-delay: 920ms; } .reply { animation-delay: 1000ms; } .inv__foot { animation-delay: 1120ms; }
@media (prefers-reduced-motion: reduce) {
  .iv::before, .iv__top, .inv, .inv > .foil, .inv__house, .inv__req, .inv__orn, .inv__rsvp, .reply, .inv__foot { animation: line-fade 300ms ease both; }
  @keyframes line-fade { from { opacity: 0; } }
}
