/* Gëzim & Elsa — corded envelope → invitation. Ivory paper + wine, gold only on the envelope name and hairlines. */
@font-face { font-family: "Marcellus"; src: url(fonts/marcellus.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jost"; src: url(fonts/jost.woff2) format("woff2"); font-weight: 400 500; font-display: swap; }

:root {
  --ivory: #f3ede4;        /* page paper */
  --ivory-2: #ebe3d8;      /* quiet band */
  --wine: #6b1621;         /* primary: cord, seal, buttons, sketches */
  --wine-deep: #4c0e16;
  --gold: #9a7b4b;         /* accent: hairlines + envelope foil only */
  --ink: #2f1d1f;          /* body text */
  --ink-2: #5d4747;        /* muted text (≈7:1 on ivory) */
  --env-a: #d5ccc5; --env-b: #d1c8c0; --env-c: #ccc2ba; --env-d: #cfc5bd; --env-e: #d3c9c1;
  --table: #b9ada3;
  --display: "Marcellus", "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --text: "Jost", "Avenir Next", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --sh: 100vh; --sw: 100vw;
  --ease: cubic-bezier(.22, .7, .2, 1);
}
@supports (height: 100dvh) { :root { --sh: 100dvh; } }
/* Wider than a portrait envelope: keep the reference proportions, centred on a linen table */
@media (min-aspect-ratio: 4/5) { :root { --sw: calc(var(--sh) * .74); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--ivory); color: var(--ink); font: 400 1.125rem/1.65 var(--text); -webkit-font-smoothing: antialiased; }
body.is-closed, body.is-opening { overflow: hidden; }
/* While the envelope is shown, the whole canvas (also behind iOS status bar, toolbars and safe areas) is envelope paper, so there is no light band top or bottom */
html:has(body.is-closed), html:has(body.is-opening), body.is-closed, body.is-opening { background: var(--env-c) url(grain.webp) 0 0 / 128px 128px; }
img, svg { display: block; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--wine); outline-offset: 3px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.skip { position: fixed; left: 12px; top: -60px; z-index: 90; background: var(--wine); color: var(--ivory); 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(107, 22, 33, .35);
  background: rgba(243, 237, 228, .92); color: var(--wine); font: 500 .875rem/1 var(--text); letter-spacing: .04em; cursor: pointer;
  touch-action: manipulation; transition: background-color .2s, border-color .2s;
}
.lang:hover { background: #fffaf3; border-color: var(--wine); }

/* ───────────────────────── Envelope (closed) ───────────────────────── */
.opening {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; overflow: hidden;
  background: var(--table) url(grain.webp) 0 0 / 160px 160px; cursor: pointer; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; outline: none;
}
.opening:focus-visible .stage { outline: 2px solid var(--wine); outline-offset: -6px; }
.stage { position: absolute; inset: 0; perspective: 1100px; }
/* Phones: the closed envelope always fills the whole screen, edge to edge, top to bottom (no table strips) */
@media (max-aspect-ratio: 4/5) { .opening { background: var(--env-c) url(grain.webp) 0 0 / 128px 128px; } }
@media (min-aspect-ratio: 4/5) { .stage { position: relative; inset: auto; width: var(--sw); height: var(--sh); box-shadow: 0 2px 4px rgba(50, 30, 20, .18), 0 24px 60px -20px rgba(50, 30, 20, .45); } }
.lay, .liner, .card, .paper, .edges { position: absolute; inset: 0; }
.edges { width: 100%; height: 100%; overflow: visible; pointer-events: none; }
body.is-closed .lay, body.is-closed .cord, body.is-closed .bow, body.is-closed .seal, body.is-closed .card,
body.is-opening .lay, body.is-opening .cord, body.is-opening .bow, body.is-opening .seal, body.is-opening .card { will-change: transform, opacity; }
.lay { backface-visibility: hidden; -webkit-backface-visibility: hidden; transform-style: flat; }

.paper {
  background-image: url(grain.webp),
    radial-gradient(120% 80% at 18% 8%, rgba(255, 252, 246, .34), rgba(255, 252, 246, 0) 62%),
    radial-gradient(90% 70% at 100% 100%, rgba(70, 48, 36, .12), rgba(70, 48, 36, 0) 70%);
  background-size: 128px 128px, 100% 100%, 100% 100%;
}
/* Polygons in % of the stage — same geometry as the reference fold lines */
.p-base { background-color: var(--env-c); clip-path: polygon(38% 0, 100% 0, 100% 100%, 38% 100%); }
.p-f2   { background-color: var(--env-b); clip-path: polygon(76.4% 38%, 100% 31%, 100% 100%, 40% 100%, 40% 81.1%); }
.p-f3   { background-color: var(--env-d); clip-path: polygon(59.8% 57.6%, 100% 98.6%, 100% 100%, 40% 100%, 40% 81.1%); }
.p-top  { background-color: var(--env-e); clip-path: polygon(36% 0, 83% 0, 61% 24.4%); }
.p-left { background-color: var(--env-a); clip-path: polygon(0 0, 40% 0, 40% 100%, 0 100%); }

/* Gold debossed name, reading bottom→top like the reference */
.env-name {
  position: absolute; left: 20%; top: 46%;
  height: min(58%, calc(var(--sw) * 1.22)); width: auto; aspect-ratio: 117.3 / 1000;
  transform: translate(-50%, -50%);
}

/* Waxed cord */
.cord { position: absolute; --cw: max(3px, calc(var(--sw) * 7.6 / 753)); border-radius: 3px; }
.cord-v {
  left: calc(40.5% - var(--cw) / 2); top: -1%; height: 102%; width: var(--cw);
  background: repeating-linear-gradient(62deg, rgba(255, 220, 220, .09) 0 1.2px, rgba(0, 0, 0, 0) 1.2px 3.4px),
    linear-gradient(90deg, #24040a, #521018 45%, #33060c);
  box-shadow: 1.5px 2px 1.5px rgba(40, 18, 12, .32), 3px 5px 7px rgba(40, 18, 12, .12);
}
.cord-h {
  top: calc(79.3% - var(--cw) / 2); left: -1%; width: 102%; height: var(--cw);
  background: repeating-linear-gradient(-28deg, rgba(255, 220, 220, .09) 0 1.2px, rgba(0, 0, 0, 0) 1.2px 3.4px),
    linear-gradient(180deg, #24040a, #521018 45%, #33060c);
  box-shadow: 1.5px 2.5px 1.5px rgba(40, 18, 12, .32), 3px 6px 7px rgba(40, 18, 12, .12);
}
.bow {
  position: absolute; width: calc(var(--sw) * 560 / 753); height: calc(var(--sw) * 340 / 753);
  left: calc(40.5% - var(--sw) * 275 / 753); top: calc(79.3% - var(--sw) * 140 / 753);
  transform-origin: 49.1% 41.2%; overflow: visible;
}

/* Wax seal (vector) */
.seal, .seal-shadow {
  position: absolute; width: calc(var(--sw) * .315); height: calc(var(--sw) * .315);
  left: calc(76.4% - var(--sw) * .1575); top: calc(38% - var(--sw) * .1575);
}
.seal svg { width: 100%; height: 100%; overflow: visible; }
.seal-shadow {
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(45, 15, 12, .34), rgba(45, 15, 12, .16) 78%, rgba(45, 15, 12, 0));
  transform: translate(3%, 6%) scale(1.1);
}

/* Inside: wine liner + the card */
.liner { background: var(--wine-deep) url(grain.webp) 0 0 / 128px 128px; opacity: 0; }
.card {
  background: var(--ivory) url(grain.webp) 0 0 / 128px 128px; opacity: 0;
  display: grid; place-items: center; transform-origin: 50% 60%;
}
.card-frame { position: absolute; inset: 4.5%; border: 1px solid rgba(154, 123, 75, .55); outline: 1px solid rgba(154, 123, 75, .3); outline-offset: 5px; }
.card-mono { width: min(44%, 200px); height: auto; }

.hint {
  position: absolute; left: 50%; bottom: max(20px, calc(env(safe-area-inset-bottom) + 12px)); margin: 0;
  transform: translateX(-50%); pointer-events: none; white-space: nowrap;
}
.hint span {
  display: block; padding: 10px 18px; border-radius: 22px; background: rgba(243, 237, 228, .9); color: var(--wine);
  font: 500 .9375rem/1.2 var(--text); box-shadow: 0 1px 2px rgba(60, 30, 20, .14), 0 6px 18px -8px rgba(60, 30, 20, .3);
  animation: hint 2.4s ease-in-out 1.2s infinite;
}
@keyframes hint { 0%, 100% { opacity: 1; } 50% { opacity: .62; } }

body.is-page .opening { display: none !important; }

/* ───────────────────────── Invitation page ───────────────────────── */
.page { position: relative; min-height: 100vh; outline: none; background: var(--ivory); isolation: isolate; }
.page::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: url(grain.webp) 0 0 / 192px 192px; opacity: .32; }
.hero {
  min-height: 100vh; min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: max(76px, calc(env(safe-area-inset-top) + 64px)) 24px 40px; gap: 0;
}
.hero-seal { width: 64px; height: 64px; margin-bottom: 28px; filter: none; }
.hero-lead { margin: 0 0 14px; color: var(--ink-2); font-size: 1.0625rem; max-width: 26ch; text-wrap: balance; }
.names {
  margin: 0; font: 400 clamp(3.25rem, 15vw, 6.75rem)/.98 var(--display); color: var(--wine); letter-spacing: .01em;
  display: flex; flex-direction: column; align-items: center;
}
.names .amp { font-size: .5em; line-height: 1.15; color: var(--wine); }
.hero-when { margin: 30px 0 4px; font: 400 clamp(1.25rem, 5vw, 1.5rem)/1.35 var(--display); color: var(--ink); }
.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;
}
.btn-primary { background: var(--wine); color: #fbf6ef; box-shadow: 0 1px 2px rgba(76, 14, 22, .25), 0 10px 24px -12px rgba(76, 14, 22, .55); }
.btn-primary:hover { background: var(--wine-deep); }
.btn-primary:active { transform: scale(.98); }
.btn .ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; }
.hero-knot { width: min(300px, 74vw); margin-top: 44px; }

/* Sketches: burgundy line drawings that draw on scroll */
.sk { overflow: visible; }
.sk path { fill: none; stroke: var(--wine); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sk-spine path { stroke-width: 2.2; }
.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(.55, .08, .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 14px; font: 400 clamp(1.875rem, 6vw, 2.5rem)/1.15 var(--display); color: var(--wine); }
.big { margin: 0; font: 400 clamp(1.375rem, 5vw, 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: 14px; color: var(--wine); font-weight: 500;
  text-decoration: underline; text-decoration-color: rgba(107, 22, 33, .4); text-underline-offset: 5px; text-decoration-thickness: 1px;
}
.link:hover { text-decoration-color: var(--wine); }

.sec-invite { display: grid; justify-items: center; text-align: center; padding-top: 24px; }
.sk-rose { width: 150px; height: auto; margin-bottom: 18px; }
.invite-text { margin: 0; max-width: 30ch; font: 400 clamp(1.375rem, 5.4vw, 1.875rem)/1.45 var(--display); color: var(--ink); text-wrap: balance; }

.split { display: grid; gap: 28px; align-items: center; }
.split > .sk { width: min(260px, 70%); height: auto; justify-self: center; }
.sec-when, .sec-prog { border-top: 1px solid rgba(154, 123, 75, .35); }
.sec-where { background: var(--ivory-2); max-width: none; }
.sec-where > * { max-width: 992px; margin-left: auto; margin-right: auto; }
.sk-venue { width: min(520px, 100%); height: auto; margin-bottom: 26px; }

.count { margin: 26px 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: 400 2.5rem/1 var(--display); color: var(--wine); font-variant-numeric: tabular-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 { position: absolute; left: 0; top: 6px; bottom: 6px; width: 12px; height: calc(100% - 12px); }
.prog { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.prog li { position: relative; display: grid; grid-template-columns: 4.2rem 1fr; align-items: baseline; }
.prog li::before {
  content: ""; position: absolute; left: -29px; top: .62em; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ivory); border: 1.6px solid var(--wine);
}
.prog .t { font-weight: 500; font-variant-numeric: tabular-nums; color: var(--wine); }
.prog .e { font: 400 1.3125rem/1.35 var(--display); color: var(--ink); }

.sec-rsvp { display: grid; justify-items: center; text-align: center; padding-bottom: 96px; border-top: 1px solid rgba(154, 123, 75, .35); }
.sk-env { width: 190px; height: auto; margin-bottom: 18px; }
.rsvp-note { margin: 0 0 26px; color: var(--ink-2); max-width: 32ch; }

.foot { background: var(--wine); color: #f4ebe0; text-align: center; padding: 64px 24px calc(96px + env(safe-area-inset-bottom)); }
.foot-love { margin: 0 0 6px; color: #e2cfc0; }
.foot-names { margin: 0; font: 400 clamp(2rem, 8vw, 2.75rem)/1.2 var(--display); color: #e7cf9f; }

.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(--wine); color: #fbf6ef; font: 500 1rem/1 var(--text);
  box-shadow: 0 2px 4px rgba(76, 14, 22, .2), 0 12px 28px -12px rgba(76, 14, 22, .6);
  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; }

@media (min-width: 768px) {
  .sec { padding: 104px 40px; }
  .split { grid-template-columns: 1.1fr .9fr; gap: 56px; }
  .split-rev { grid-template-columns: .9fr 1.1fr; }
  .split-rev .split-text { order: 2; }
  .split > .sk { width: min(300px, 100%); }
  .sec-where { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; gap: 48px; padding-left: max(40px, calc((100% - 992px) / 2)); padding-right: max(40px, calc((100% - 992px) / 2)); }
  .sec-where > * { margin: 0; max-width: none; }
  .sk-venue { margin: 0; }
  .hero-seal { width: 72px; height: 72px; }
}
@media (min-width: 1024px) {
  body { font-size: 1.1875rem; }
  .names { flex-direction: row; gap: .28em; align-items: baseline; } .names .amp { font-size: .6em; }
  .hero { min-height: min(100vh, 860px); }
  .sec { padding-top: 120px; padding-bottom: 120px; }
  .split > .sk { width: min(360px, 100%); }
  .sk-rose { width: 180px; }
  .invite-text { font-size: 2.125rem; max-width: 32ch; }
  .sk-venue { width: 100%; }
  .count .n { font-size: 3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .hint span { animation: none; }
  .js .sk.is-armed path { stroke-dashoffset: 0; transition: none; }
  .pill, .btn { transition: none; }
}
