/* Erina · Kanagjegj — full-bleed paper envelope → invitation with folk-costume line drawings */
:root {
  --paper: #f8f4ec;
  --cream: #ebe6da;
  --wine: #7a1622;
  --wine-2: #9a3340;
  --ink: #3b2b2c;
  --ink-2: #5f4b4c;
  --ink-3: #7b6668;
  --gold: #a78a5a;
  --serif: "Cormorant Garamond", Garamond, "Times New Roman", serif;
  --sc: "Cormorant SC", "Cormorant Garamond", serif;
  --script: "Pinyon Script", "Cormorant Garamond", cursive;
  --hand: "Sacramento", "Pinyon Script", cursive;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-io: cubic-bezier(0.65, 0, 0.35, 1);
  --press: 0 1px 0 rgba(255, 255, 255, 0.7);
  --vh: 100svh;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; overflow-x: clip; }
html { background: var(--cream); -webkit-text-size-adjust: 100%; }
body { font-family: var(--serif); color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
body.is-closed { overflow: hidden; height: 100svh; }
img { display: block; max-width: 100%; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; z-index: 100; background: var(--paper); color: var(--ink); padding: .6rem 1rem; }
.skip:focus { left: .5rem; top: .5rem; }
:focus-visible { outline: 2px solid var(--wine-2); outline-offset: 3px; }
#page:focus { outline: none; }

.lang {
  position: fixed; z-index: 80; top: calc(var(--safe-t) + .7rem); right: .8rem;
  min-width: 44px; min-height: 44px; padding: 0 .6rem; border-radius: 999px; cursor: pointer;
  font: 500 .95rem/1 var(--sc); letter-spacing: .14em; color: var(--wine);
  background: rgba(248, 244, 236, .7); border: 1px solid rgba(122, 22, 34, .22);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
body.is-page .lang { position: absolute; }

/* ───────── opening: the whole screen is the envelope ───────── */
.opening { opacity: 1; transition: opacity .36s ease; position: fixed; inset: 0; z-index: 40; overflow: hidden; cursor: pointer; background: #e9e3d7; }
.env-inside {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(25, 3, 8, .55), rgba(25, 3, 8, 0) 45%),
    radial-gradient(90% 60% at 50% 30%, rgba(255, 220, 220, .08), rgba(0,0,0,0) 70%),
    url(paper.webp) 0 0 / 1200px 500px, #6f1420;
  background-blend-mode: normal, normal, multiply, normal;
  transition: opacity .9s ease;
}
.card {
  position: absolute; left: 0; top: 0; width: var(--cw); height: var(--vh); text-align: center;
  transform-origin: 0 0; transform: var(--card-in); overflow: hidden; pointer-events: none;
  box-shadow: 0 0 0 1px rgba(122,22,34,.08), 0 -14px 34px -18px rgba(20, 2, 6, .6);
  will-change: transform;
}
.paperbg { background: url(paper.webp) 0 0 / 1200px 500px, #ece6da; }
.pocket-wrap { position: absolute; inset: 0; filter: drop-shadow(0 -1px 1.5px rgba(70, 50, 35, .3)); transition: transform .7s cubic-bezier(.25,.1,.25,1); will-change: transform; }
.pocket {
  position: absolute; inset: 0; clip-path: var(--pocket-clip);
  background: linear-gradient(175deg, rgba(255,255,255,.04), rgba(90, 70, 50, .1)), url(paper.webp) 0 0 / 1200px 500px, #e8e2d5;
}
.creases { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; }
.creases path { fill: none; }
.cr-hi { stroke: rgba(255, 255, 255, .75); stroke-width: 1.4; transform: translate(.6px, 1.2px); }
.cr-lo { stroke: rgba(95, 75, 55, .22); stroke-width: 1; }
.flap-wrap { position: absolute; inset: 0; filter: drop-shadow(0 1.5px 1.5px rgba(70, 50, 35, .24)) drop-shadow(0 10px 18px rgba(70, 50, 35, .16)); pointer-events: none; }
.flap {
  position: absolute; inset: 0; clip-path: var(--flap-clip);
  background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0) 55%, rgba(120, 95, 70, .05)), url(paper.webp) 0 0 / 1200px 500px, #eee8dd;
  transform-origin: 50% 0; transform: perspective(1500px) rotateX(0deg); backface-visibility: hidden;
  transition: transform .85s cubic-bezier(.33, 0, .2, 1); will-change: transform;
}
.flap-note { position: absolute; left: 0; right: 0; top: var(--note-y); margin: 0 auto; max-width: 13ch; transform: translateY(-50%); text-align: center; font: 400 clamp(1.7rem, 7.4vw, 2.6rem)/1.05 var(--hand); color: var(--wine); opacity: .92; text-wrap: balance; }
.env-light { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(120% 80% at 28% 8%, rgba(255,255,255,.22), rgba(255,255,255,0) 55%), radial-gradient(150% 110% at 50% 45%, rgba(0,0,0,0) 55%, rgba(60, 45, 30, .16)); transition: opacity .8s ease; }
.is-open .flap { transform: perspective(1500px) rotateX(-160deg); }
.is-rise .pocket-wrap { transform: translateY(calc(var(--vh) * .2)); }
.is-rise .card { transform: var(--card-up); transition: transform .7s cubic-bezier(.25,.1,.25,1); }
.is-away .pocket-wrap { transform: translateY(calc(var(--vh) * 1.05)); transition: transform .85s cubic-bezier(.33,0,.2,1); }
.is-away .env-inside, .is-away .env-light { opacity: 0; transition-delay: .25s; }
.is-reveal .opening { opacity: 0; pointer-events: none; }
.is-away .card { transform: var(--card-full); transition: transform .85s cubic-bezier(.25,.1,.25,1); }

.seal {
  position: absolute; z-index: 6; left: var(--sx); top: var(--sy); width: var(--sd); aspect-ratio: 431 / 440;
  transform: translate(-50%, -50%); padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer;
  -webkit-tap-highlight-color: transparent; filter: drop-shadow(0 2px 2px rgba(40, 5, 8, .38)) drop-shadow(0 8px 12px rgba(40, 5, 8, .16));
}
.seal::before { content: ""; position: absolute; inset: -30%; border-radius: 50%; }
.seal::after { content: ""; position: absolute; inset: -12%; border-radius: 50%; border: 1px solid rgba(122, 22, 34, .45); opacity: 0; animation: ping 2.8s ease-out 1.4s infinite; }
@keyframes ping { 0% { transform: scale(.92); opacity: 0; } 25% { opacity: .8; } 100% { transform: scale(1.3); opacity: 0; } }
.seal-half { position: absolute; inset: 0; background: url(seal.webp) center / 100% 100% no-repeat; transition: transform .52s cubic-bezier(.25,.1,.25,1), opacity .4s ease .08s; }
.seal-l { z-index: 1; clip-path: polygon(0 0, 53% 0, 48% 14%, 56% 28%, 46% 42%, 57% 57%, 47% 71%, 54% 86%, 49% 100%, 0 100%); }
.seal-r { clip-path: polygon(52% 0, 100% 0, 100% 100%, 48% 100%, 53% 86%, 46% 71%, 56% 57%, 45% 42%, 55% 28%, 47% 14%); }
.is-press .seal { transform: translate(-50%, -53%) scale(1.025); transition: transform .22s ease-out; }
.is-crack .seal::after { animation: none; }
.is-crack .seal-l { transform: translate(-12%, 10%) rotate(-14deg); opacity: 0; }
.is-crack .seal-r { transform: translate(12%, 12%) rotate(12deg); opacity: 0; }
.hint { position: absolute; z-index: 6; left: 0; right: 0; bottom: calc(var(--safe-b) + 7svh); margin: 0; text-align: center; font: italic 500 1.35rem/1 var(--serif); color: var(--wine); opacity: .85; transition: opacity .35s; pointer-events: none; }
.is-press .hint { opacity: 0; }

/* ───────── page ───────── */
.page { position: relative; z-index: 10; min-height: 100svh; }
.page::before { content: ""; position: fixed; inset: 0; z-index: -1; background: radial-gradient(140% 100% at 50% 40%, rgba(0,0,0,0) 50%, rgba(60,45,30,.12)), url(paper.webp) 0 0 / 1200px 500px, #e6dfd2; }
.sheet {
  position: relative; width: min(100%, 640px); margin: 0 auto; overflow: hidden;
  background: url(paper-light.webp) 0 0 / 1200px 500px, var(--paper); text-align: center;
  box-shadow: 0 0 0 1px rgba(122,22,34,.06), 0 30px 80px -30px rgba(60, 30, 20, .4);
}
.hero, .card .hero { position: relative; height: var(--vh); min-height: 600px; display: flex; align-items: center; justify-content: center; overflow: hidden; background: url(paper-light.webp) 0 0 / 1200px 500px, var(--paper); }
.hero-body { position: relative; z-index: 1; padding: 0 28px; }
.mono { width: 74px; height: auto; margin: 0 auto 18px; filter: drop-shadow(0 2px 3px rgba(60, 10, 10, .3)); }
.kicker { margin: 0 0 1.1rem; font: 500 .92rem/1 var(--sc); letter-spacing: .3em; color: var(--wine); }
.greet { margin: 0; font: italic 400 1.35rem/1.4 var(--serif); color: var(--ink-2); }
.lead { margin: .4rem auto 0; max-width: 30ch; font: 400 1.15rem/1.5 var(--serif); color: var(--ink-2); text-wrap: balance; }
.names { margin: .9rem 0 0; font: 400 clamp(4rem, 20vw, 6rem)/1.05 var(--script); color: var(--wine); display: flex; flex-direction: column; align-items: center; }
.names .amp { font: italic 400 .4em/1.2 var(--serif); color: var(--gold); margin: .02em 0; }
.hero-date { margin: 1.1rem 0 0; font: 500 1.05rem/1 var(--sc); letter-spacing: .22em; color: var(--ink); }
.cue { margin: 1.6rem 0 0; font: italic 400 1rem/1 var(--serif); color: var(--ink-3); }
.cue::after { content: ""; display: block; width: 1px; height: 34px; margin: 10px auto 0; background: linear-gradient(var(--wine-2), rgba(154,51,64,0)); }

.sk { pointer-events: none; color: var(--wine); }
.sk svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Reserve artwork geometry in HTML. Hidden from the first stylesheet paint,
   including cached images, until decode completes; the mask itself starts clear. */
.sk .reveal-img { display: block; width: 100%; height: auto; }
.js .sk .reveal-img {
  visibility: hidden;
  -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 34%, transparent 40%, transparent 100%);
  mask-image: linear-gradient(to bottom, #000 0%, #000 34%, transparent 40%, transparent 100%);
  -webkit-mask-size: 100% 300%; mask-size: 100% 300%;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: 0 100%; mask-position: 0 100%;
}
.js .sk.draw-ready .reveal-img { visibility: visible; }
.js .sk.is-drawing .reveal-img { animation: ink-sweep 2.4s cubic-bezier(.3,0,.25,1) both; }
@keyframes ink-sweep {
  from { -webkit-mask-position: 0 100%; mask-position: 0 100%; }
  to { -webkit-mask-position: 0 0%; mask-position: 0 0%; }
}
/* A completed mask stays in place; never replace image, fill, filter or layer. */

.sk-orn { width: min(78%, 340px); margin: 44px auto 0; }
.sk-hero { width: min(56%, 230px); margin: 22px auto 0; }
.sk-q1 { width: min(46%, 230px); margin: 40px auto 0; }
.sk-q2 { width: min(94%, 470px); margin: 44px auto 0; }
.sk-q3 { width: min(72%, 330px); margin: 0 auto 26px; }

.sec { position: relative; padding: 56px 28px 0; }
.sec-invite { padding-top: 56px; }
.prose { margin: 0 auto; max-width: 30ch; font: italic 400 1.3rem/1.6 var(--serif); color: var(--ink-2); text-wrap: balance; }
.label { margin: 0; font: 500 .95rem/1 var(--sc); letter-spacing: .26em; color: var(--wine); }
.label.gap { margin-top: 34px; }
.date { margin: 14px 0 0; display: flex; justify-content: center; align-items: baseline; gap: .5rem; font: 500 clamp(2.5rem, 11vw, 3.2rem)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--ink); text-shadow: var(--press); }
.date i { font-style: normal; color: var(--gold); font-size: .6em; }
.time { margin: 12px 0 0; font: 500 1.05rem/1 var(--sc); letter-spacing: .2em; color: var(--ink-2); }
.venue { margin: 12px 0 0; font: 400 2.6rem/1.05 var(--script); color: var(--wine); }
.city { margin: 4px 0 0; font: italic 400 1.2rem/1.3 var(--serif); color: var(--ink-2); }
.link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 6px; padding: 0 4px; font: 500 .98rem/1 var(--sc); letter-spacing: .16em; color: var(--wine); text-decoration: underline; text-decoration-color: rgba(122,22,34,.35); text-underline-offset: 6px; }
.title { margin: 0; font: 500 1.8rem/1.2 var(--serif); color: var(--ink); }
.sec-prog { padding-top: 70px; }
.prog { list-style: none; margin: 22px auto 0; padding: 0; max-width: 290px; text-align: left; }
.prog li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; font-size: 1.15rem; line-height: 1.35; }
.prog .t { font: 500 1.05rem/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--wine); min-width: 3em; }
.prog .dots { flex: 1; min-width: 14px; border-bottom: 1px dotted rgba(122,22,34,.4); transform: translateY(-4px); }
.prog .e { text-align: right; color: var(--ink); }
.sec-count { padding-top: 64px; }
.count { display: grid; grid-template-columns: repeat(4, 1fr); max-width: 360px; margin: 20px auto 0; }
.count > div { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px 0; border-left: 1px solid rgba(122,22,34,.2); }
.count > div:first-child { border-left: 0; }
.count .n { font: 500 clamp(1.9rem, 8vw, 2.4rem)/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; color: var(--wine); }
.count .u { font: 500 .8rem/1 var(--sc); letter-spacing: .14em; color: var(--ink-3); }
.sec-rsvp { padding-top: 70px; display: flex; flex-direction: column; align-items: center; }
.note { margin: 8px 0 0; font: italic 400 1.15rem/1.5 var(--serif); color: var(--ink-2); }
.btn { margin-top: 24px; display: inline-flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 28px; border-radius: 999px; text-decoration: none; font: 500 1.05rem/1 var(--sc); letter-spacing: .14em; color: #fbf3e6; background: var(--wine); box-shadow: inset 0 0 0 1px rgba(233, 211, 166, .45), 0 10px 20px -12px rgba(60, 10, 20, .7); transition: background .2s, transform .2s; }
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.btn:hover { background: #5a1823; }
.btn:active { transform: translateY(1px); }
.sec-close { padding: 70px 28px 64px; }
.sign { margin: 0; font: italic 400 1.3rem/1.3 var(--serif); color: var(--ink-2); }
.sign-names { margin: 8px 0 0; font: 400 3.4rem/1.1 var(--script); color: var(--wine); }
.sign-names i { font: italic 400 .5em var(--serif); color: var(--gold); }
@media (min-width: 700px) { .sheet { margin: 0 auto; } }

@media (prefers-reduced-motion: reduce) {
  .seal::after { animation: none; }
  .js .sk .reveal-img { animation: none !important; -webkit-mask-position: 0 0% !important; mask-position: 0 0% !important; }
  .hero::before, .hero::after { transform: none !important; transition: none !important; }
  .opening, .flap, .seal, .seal-half, .pocket-wrap, .card { transition: none !important; }
}

/* A pair of fine stitched hems, echoing the folk costumes rather than a frame kit. */
.hero::before, .hero::after {
  content: ""; position: absolute; top: 12%; bottom: 12%; width: 5px;
  border-inline: 1px solid rgba(167,138,90,.35);
  background: repeating-linear-gradient(180deg, transparent 0 12px, rgba(122,22,34,.24) 12px 14px, transparent 14px 24px) center / 1px 100% no-repeat;
  transform: scaleY(0); transform-origin: center; transition: transform 1.3s cubic-bezier(.22,1,.36,1);
  pointer-events: none;
}
.hero::before { left: 16px; }
.hero::after { right: 16px; }
.is-page .hero::before, .is-page .hero::after { transform: scaleY(1); }
.names, .sign-names { text-shadow: .4px .6px 0 rgba(167,138,90,.36), 0 -1px 0 rgba(255,255,255,.7); }
.hero-date::after { content: ""; display: block; width: 6px; height: 6px; margin: 18px auto 0; border: 1px solid var(--gold); transform: rotate(45deg); }
@media (min-width:700px) { .hero::before { left: 28px; } .hero::after { right: 28px; } }
