/* Erion & Bora — a dusty-blue lace letter on cream painted drapery.
   Closed envelope = Beatrika's reference photo split into layers; real type on top.
   Open: transform/opacity only (WAAPI). No mask-image, no backdrop-filter, no filters. */
@font-face { font-family: "Cormorant SC"; src: url(fonts/cormorant-sc.woff2) format("woff2"); font-weight: 500; font-display: block; }
@font-face { font-family: "Ms Madi"; src: url(fonts/msmadi.woff2) format("woff2"); font-weight: 400; font-display: block; }
@font-face { font-family: "Cormorant Garamond"; src: url(fonts/cormorant.woff2) format("woff2"); font-weight: 300 700; font-display: swap; }
@font-face { font-family: "Jost"; src: url(fonts/jost.woff2) format("woff2"); font-weight: 300 600; font-display: swap; }

:root {
  /* two bases: drapery cream + envelope dusty blue; one accent: the calla stem green */
  --cream: #f4eee4;
  --cream-2: #ebe2d4;
  --drape: #e4d9c8;
  --blue: #7d93ab;        /* line drawings, hairlines */
  --blue-ink: #44596f;    /* headings, primary button (6.3:1 on cream, 6.8:1 for its label) */
  --blue-deep: #34475b;
  --stem: #66734f;        /* accent: lily stems only */
  --ink: #33302d;
  --ink-2: #5e5852;       /* muted text, 6.1:1 on cream */
  --print: #3d3935;       /* the envelope's printed ink */
  --display: "Cormorant Garamond", "Cormorant", Garamond, "Times New Roman", serif;
  --text: "Jost", "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --script: "Ms Madi", "Snell Roundhand", cursive;
  --ease: cubic-bezier(.22, .7, .2, 1);
  /* closed-scene geometry: the plate (1000×2000 px) scales with the stage */
  --vh: 100vh;
  --stw: min(100vw, calc(var(--vh) * .6));
  --wp: max(calc(var(--stw) * 1.2), calc(var(--vh) * .5));
  --hp: calc(var(--wp) * 2);
}
@supports (height: 100dvh) { :root { --vh: 100dvh; } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--cream); }
body { margin: 0; background: var(--cream); color: var(--ink); font: 400 1.125rem/1.65 var(--text); -webkit-font-smoothing: antialiased; }
/* iOS: while the envelope shows, everything behind the status bar / toolbars is the drapery tone, so no light bands */
html.is-closed, html.is-opening, html.is-closed body, html.is-opening body { background: var(--drape); overflow: hidden; }
img, svg { display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue-ink); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 90; background: var(--blue-ink); color: #fff; padding: 10px 14px; border-radius: 6px; text-decoration: none; }
.skip:focus { top: 12px; }

.lang {
  position: fixed; z-index: 80; top: max(12px, env(safe-area-inset-top)); right: max(12px, env(safe-area-inset-right));
  min-width: 44px; min-height: 44px; padding: 0 12px; border-radius: 22px; border: 1px solid rgba(68, 89, 111, .32);
  background: rgba(244, 238, 228, .9); color: var(--blue-ink); font: 500 .875rem/1 var(--text); letter-spacing: .04em; cursor: pointer;
  touch-action: manipulation; transition: background-color .2s, border-color .2s;
}
.lang:hover { background: #fbf7f0; border-color: var(--blue-ink); }

/* ───────────── Closed envelope ───────────── */
.opening {
  position: fixed; inset: 0; z-index: 60; overflow: hidden; cursor: pointer; outline: none;
  background: linear-gradient(rgba(74, 62, 48, .16), rgba(74, 62, 48, .16)), var(--drape) url(img/room.webp) center / cover no-repeat;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.opening:focus-visible .stage { outline: 2px solid var(--blue-ink); outline-offset: -6px; }
.stage { position: absolute; top: 0; bottom: 0; left: 50%; width: var(--stw); margin-left: calc(var(--stw) / -2); overflow: hidden; background: var(--drape); }
@media (min-aspect-ratio: 3/5) { .stage { box-shadow: 0 0 0 1px rgba(90, 76, 58, .08), 0 30px 80px -30px rgba(70, 58, 42, .45); } }
.scene {
  position: absolute; left: 50%; width: var(--wp); height: var(--hp); margin-left: calc(var(--wp) / -2);
  /* envelope centre (plate y 1131) at mid-screen, never showing past the plate's top or bottom */
  top: clamp(calc(var(--vh) - var(--hp)), calc(var(--vh) / 2 - var(--hp) * .5655), 0px);
}
.plate { position: absolute; inset: 0; width: 100%; height: 100%; }
.flap, .flap-back, .pocket, .card, .seal { position: absolute; }
/* plate px → %: x/10, y/20 */
.flap, .flap-back { left: 11.2%; top: 43.7%; width: 78.1%; height: 20.55%; transform-origin: 50% 1.95%; background: 0 0 / 100% 100% no-repeat; z-index: 4; }
.flap { background-image: url(img/flap.webp); }
.flap-back { z-index: 1; opacity: 0; transform: perspective(1600px) rotateX(-90deg); }
.pocket { left: 11.2%; top: 43.7%; width: 78.1%; height: 25.7%; background: url(img/pocket.webp) 0 0 / 100% 100% no-repeat; z-index: 3; }
.seal { left: 42.8%; top: 54.2%; width: 15.4%; height: 9.7%; z-index: 5; }
.seal i { position: absolute; inset: 0; background: url(img/seal.webp) 0 0 / 100% 100% no-repeat; }
.seal-l, .seal-r { visibility: hidden; }
html.is-opening .seal-l, html.is-opening .seal-r { visibility: visible; }
html.is-opening .seal-full { visibility: hidden; }
.seal-l { clip-path: polygon(0 0, 54% 0, 47% 22%, 55% 41%, 44% 63%, 52% 82%, 46% 100%, 0 100%); }
.seal-r { clip-path: polygon(54% 0, 100% 0, 100% 100%, 46% 100%, 52% 82%, 44% 63%, 55% 41%, 47% 22%); }

/* printed lines, set in real type so they stay sharp (sizes follow the plate) */
.env-from, .env-names, .env-cta { position: absolute; left: 50.3%; margin: 0; white-space: nowrap; color: var(--print); transform: translate(-50%, -50%); }
.env-from { top: 13.9%; font: 500 calc(var(--wp) * .0262)/1 "Cormorant SC", var(--display); letter-spacing: .035em; }
.env-names { top: 26.2%; font: 400 calc(var(--wp) * .071)/1 var(--script); letter-spacing: .01em; opacity: .92; }
.env-cta { top: 87.2%; font: 500 calc(var(--wp) * .0232)/1 "Cormorant SC", var(--display); letter-spacing: .05em; }

/* the letter card waiting inside */
.card {
  left: 20.5%; top: 48%; width: 59%; height: 21%; z-index: 2; background: #f6f1e8;
  box-shadow: 0 1px 2px rgba(60, 70, 85, .18); transform-origin: 50% 50%;
}
.card-in::before { content: ""; position: absolute; inset: 4.5% 3.2%; border: 1px solid rgba(125, 147, 171, .55); }
.card-in { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; text-align: center; }
.card-seal { width: calc(var(--wp) * .07); height: auto; margin-bottom: calc(var(--wp) * .012); }
.card-names { margin: 0; font: 400 calc(var(--wp) * .066)/1.05 var(--script); color: var(--blue-ink); }
.card-date { margin: calc(var(--wp) * .012) 0 0; font: 500 calc(var(--wp) * .026)/1 var(--display); color: var(--ink-2); letter-spacing: .02em; }
html.is-closed .flap-back, html.is-closed .card { visibility: hidden; }

/* ───────────── Page ───────────── */
.page { outline: none; }
html.is-closed .page { visibility: hidden; }
.hero {
  position: relative; min-height: 100vh; min-height: 100svh; display: grid; align-content: center; justify-items: center; text-align: center;
  padding: calc(56px + env(safe-area-inset-top)) 24px 72px; overflow: hidden;
  background: var(--cream);
}
/* a band of the same painted drapery, dissolving into the paper */
.hero-drape {
  position: absolute; left: 0; right: 0; top: 0; height: 300px; pointer-events: none;
  background: linear-gradient(to bottom, rgba(244, 238, 228, 0) 0, rgba(244, 238, 228, .5) 150px, var(--cream) 290px) no-repeat,
              url(img/drape.webp) top center / max(100%, 760px) auto no-repeat;
}
@media (min-width: 768px) { .hero-drape { height: 420px; background-size: auto, max(100%, 1100px) auto; } }
.hero-in { position: relative; z-index: 1; display: grid; justify-items: center; }
.hero-seal { width: 64px; height: auto; margin-bottom: 22px; }
.hero-lead { margin: 0 0 6px; font: 400 clamp(1.25rem, 5vw, 1.5rem)/1.35 var(--display); font-style: italic; color: var(--ink-2); max-width: 24ch; text-wrap: balance; }
.names { margin: 0; font: 400 clamp(3.75rem, 17vw, 6.5rem)/1.05 var(--script); color: var(--blue-ink); letter-spacing: .005em; }
.names .amp { font-size: .78em; }
.hero-when { margin: 22px 0 2px; font: 500 clamp(1.25rem, 5vw, 1.5rem)/1.4 var(--display); color: var(--ink); display: flex; flex-wrap: wrap; justify-content: center; column-gap: 14px; }
.hero-when .sep { width: 1px; height: 1em; align-self: center; background: var(--blue); opacity: .7; }
.hero-where { margin: 0 0 30px; color: var(--ink-2); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 52px; padding: 0 26px;
  border-radius: 26px; text-decoration: none; font: 500 1.0625rem/1.2 var(--text); letter-spacing: .01em;
  touch-action: manipulation; transition: background-color .2s, transform .2s, border-color .2s;
}
.btn-primary { background: var(--blue-ink); color: #fbf8f2; box-shadow: 0 1px 2px rgba(40, 54, 70, .22), 0 10px 24px -12px rgba(40, 54, 70, .5); }
.btn-primary:hover { background: var(--blue-deep); }
.btn-primary:active { transform: scale(.98); }
.btn-secondary { margin-top: 18px; border: 1px solid rgba(68, 89, 111, .45); color: var(--blue-ink); min-height: 48px; }
.btn-secondary:hover { border-color: var(--blue-ink); background: rgba(255, 255, 255, .35); }
.btn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.sk-calla { position: absolute; right: max(2px, calc(50% - 300px)); bottom: -6px; width: 78px; height: auto; opacity: .95; }

/* fine-line drawings in envelope blue that draw on scroll */
.sk { overflow: visible; }
.sk path { fill: none; stroke: var(--blue); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sk path.stem { stroke: var(--stem); }
.js .sk.is-armed path { stroke-dasharray: 1 1.02; stroke-dashoffset: 1.01; }
.js .sk.is-armed.is-drawn path { stroke-dashoffset: 0; transition: stroke-dashoffset var(--dur, .9s) cubic-bezier(.5, .1, .3, 1) var(--d, 0s); }

.sec { position: relative; max-width: 1040px; margin: 0 auto; padding: 72px 24px; }
.sec h2 { text-wrap: balance; margin: 0 0 12px; font: 500 clamp(1.875rem, 6.4vw, 2.5rem)/1.15 var(--display); color: var(--blue-ink); }
.big { margin: 0; font: 500 clamp(1.375rem, 5.2vw, 1.75rem)/1.3 var(--display); color: var(--ink); }
.muted { margin: 4px 0 0; color: var(--ink-2); }
.link {
  display: inline-flex; align-items: center; min-height: 44px; margin-top: 12px; color: var(--blue-ink); font-weight: 500;
  text-decoration: underline; text-decoration-color: rgba(68, 89, 111, .4); text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.link:hover { text-decoration-color: var(--blue-ink); }

.sec-invite { display: grid; justify-items: center; text-align: center; padding-top: 32px; }
.sk-muguet { width: 150px; height: auto; margin-bottom: 14px; }
.invite-text { margin: 0; max-width: 28ch; font: 400 clamp(1.4rem, 5.6vw, 1.9rem)/1.45 var(--display); color: var(--ink); text-wrap: balance; }

.lace { width: min(360px, 78vw); height: 12px; margin: 0 auto; }
.lace path { stroke-width: 1.1; }

.split { display: grid; gap: 28px; align-items: center; }
.split > .sk { width: min(230px, 64%); height: auto; justify-self: center; }
.sec-where { background: var(--cream-2); max-width: none; display: grid; gap: 26px; }
.sec-where > * { width: 100%; max-width: 992px; margin-left: auto; margin-right: auto; }
.sk-venue { max-width: 460px; height: auto; }

.count { margin: 24px 0 4px; }
.count-cap { margin: 0 0 8px; color: var(--ink-2); font-size: 1rem; }
.count-row { display: flex; gap: 28px; }
.count-row div { display: grid; }
.count .n { font: 500 2.5rem/1 var(--display); color: var(--blue-ink); font-variant-numeric: tabular-nums lining-nums; }
.count .u { margin-top: 6px; font-size: .9375rem; color: var(--ink-2); }

.prog-wrap { position: relative; margin-top: 18px; padding-left: 30px; }
.sk-spine path { stroke-width: 1.4; }
.sk-spine { position: absolute; left: 0; top: 8px; bottom: 8px; width: 12px; height: calc(100% - 16px); }
.prog { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.prog li { position: relative; display: grid; grid-template-columns: 4.4rem 1fr; align-items: baseline; }
.prog li::before { content: ""; position: absolute; left: -29px; top: .6em; width: 10px; height: 10px; border-radius: 50%; background: var(--cream); border: 1.4px solid var(--blue); }
.prog .t { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--blue-ink); }
.prog .e { font: 500 1.3125rem/1.35 var(--display); color: var(--ink); }

.sec-rsvp { display: grid; justify-items: center; text-align: center; padding-bottom: 96px; }
.sk-env { width: 170px; height: auto; margin-bottom: 18px; }
.rsvp-note { margin: 0 0 26px; color: var(--ink-2); max-width: 32ch; }

.foot { background: var(--cream-2); text-align: center; padding: 56px 24px calc(96px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(125, 147, 171, .35); }
.foot-love { margin: 0; color: var(--ink-2); font: 400 1.25rem/1.3 var(--display); font-style: italic; }
.foot-names { margin: 0; font: 400 clamp(2.75rem, 12vw, 3.5rem)/1.2 var(--script); color: var(--blue-ink); }

.pill {
  position: fixed; z-index: 70; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, calc(env(safe-area-inset-bottom) + 10px));
  display: inline-flex; align-items: center; min-height: 48px; padding: 0 20px; border-radius: 24px; text-decoration: none;
  background: var(--blue-ink); color: #fbf8f2; font: 500 1rem/1 var(--text);
  box-shadow: 0 2px 4px rgba(40, 54, 70, .2), 0 12px 28px -12px rgba(40, 54, 70, .55);
  opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.pill.is-on { opacity: 1; transform: none; pointer-events: auto; }
html.is-closed .pill, html.is-opening .pill { display: none; }

/* page arrival: only the hero content settles in */
.js .page .hero-in { opacity: 1; }
html.is-arrive .hero-in { animation: arrive .42s var(--ease) both; }
html.is-arrive .hero-drape { animation: fade .5s linear both; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes arrive { from { opacity: 0; transform: translate3d(0, 10px, 0); } to { opacity: 1; transform: none; } }

@media (min-width: 768px) {
  .sec { padding: 104px 40px; }
  .split { grid-template-columns: 1.1fr .9fr; gap: 56px; }
  .split > .sk { width: min(280px, 100%); }
  .sec-where { grid-template-columns: 1.15fr .85fr; align-items: center; gap: 56px; padding-left: max(40px, calc((100% - 992px) / 2)); padding-right: max(40px, calc((100% - 992px) / 2)); }
  .sec-where > * { margin: 0; max-width: none; }
  .hero-seal { width: 72px; }
  .sk-calla { width: 120px; }
}
@media (min-width: 1024px) {
  body { font-size: 1.1875rem; }
  .sec { padding-top: 120px; padding-bottom: 120px; }
  .invite-text { font-size: 2.125rem; max-width: 30ch; }
  .count .n { font-size: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .js .sk.is-armed path { stroke-dashoffset: 0; transition: none; }
  .pill, .btn, .lang { transition: none; }
  html.is-arrive .hero-in, html.is-arrive .hero-drape { animation: none; }
}

/* Beatrika (t184u): after the envelope opens, every text block is centred */
.sec, .sec-where > *, .split > * { text-align: center; }
.split, .sec-where { justify-items: center; }
.split > *, .sec-where > * { margin-left: auto; margin-right: auto; }
.count-row { justify-content: center; }
.prog-wrap { padding-left: 0; display: grid; justify-items: center; }
.prog-wrap .sk-spine { display: none; }
.prog { justify-items: center; gap: 20px; }
.prog li { grid-template-columns: none; justify-items: center; gap: 2px; }
.prog li::before { display: none; }
@media (min-width: 760px) {
  .split, .sec-where { grid-template-columns: none; }
  .sec-where { max-width: none; }
  .sec-where > * { max-width: 720px; }
}
