/* Lifafa, painted like the back of a truck: lacquer red, bottle green, royal blue, taxi yellow,
   keylined plaques for buttons, a chamak-patti border and a chain fringe under the crown. */
:root {
  color-scheme: light;
  --red: #b3121d;
  --red-deep: #7d0a12;
  --green: #0b7a53;
  --blue: #1d3fa8;
  --rani: #e5007d;
  --teal: #046c7a;
  --yellow: #ffc61a;
  --ink: #12100e;
  --paper: #fff6e0;
  --ground: #17338f;
  --display: 'Oi', 'Noto Nastaliq Urdu', serif;                       /* fat, odd-shaped: logo and titles */
  --sign: 'Kavoon', 'Noto Nastaliq Urdu', serif;                      /* sign-painter's brush: buttons, labels */
  --body: 'Barlow Semi Condensed', 'Noto Nastaliq Urdu', system-ui, sans-serif;
  --hand: 'Nunito', 'Noto Nastaliq Urdu', system-ui, sans-serif;      /* the note: simple and rounded */
  --verse: 'Pacifico', 'Noto Nastaliq Urdu', cursive;                 /* verses and sher slips: thick and sweet */
  --urdu: 'Noto Nastaliq Urdu', serif;
  --edge: 3px solid var(--ink);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --small: .94rem;
  --lead: 1.2rem;
  --rule: 6.6cqw;                  /* line pitch of the ruled page inside a card */
}
html[data-step=front] { --ground: #8f0d45; }
html[data-step=inside] { --ground: #0a6648; }
html[data-step=envelope], html[data-step=sent] { --ground: var(--teal); }

*, ::before, ::after { box-sizing: border-box; }
html {
  /* the faint four-point flower repeated across a truck's side panels */
  background: var(--ground) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='56'%3E%3Cg fill='%23fff' fill-opacity='.06'%3E%3Cpath d='M28 8l7 20-7 20-7-20zM8 28l20-7 20 7-20 7z'/%3E%3Ccircle r='4'/%3E%3Ccircle cx='56' r='4'/%3E%3Ccircle cy='56' r='4'/%3E%3Ccircle cx='56' cy='56' r='4'/%3E%3C/g%3E%3C/svg%3E");
  color: #fff; font: 500 1.125rem/1.5 var(--body);
  scrollbar-color: var(--yellow) var(--ink);
  -webkit-text-size-adjust: 100%;
}
body { margin: 0; min-height: 100dvh; display: flex; flex-direction: column; }
::selection { background: var(--yellow); color: var(--ink); }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
[hidden] { display: none !important; }
a { color: var(--yellow); font-weight: 700; text-underline-offset: .2em; text-decoration-thickness: 2px; }
strong { font-weight: 700; }

/* ---------- the crown: a truck's painted taj ---------- */
.masthead { background: var(--red); text-align: center; padding-top: 1rem; border-bottom: var(--edge); }
.crown { display: flex; align-items: center; justify-content: center; gap: clamp(.6rem, 3vw, 1.6rem); padding-inline: .75rem; }
.phool { width: clamp(2.6rem, 11vw, 4.6rem); flex: none; animation: spin 40s linear infinite; }
.phool:last-child { animation-direction: reverse; }
@keyframes spin { to { rotate: 360deg; } }
.brand {
  display: inline-flex; align-items: baseline; gap: .6rem; text-decoration: none;
  font: 400 clamp(2.3rem, 10.5vw, 4.4rem)/1.1 var(--display); color: var(--yellow);
  text-shadow: -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink), 2px 2px 0 var(--ink), 4px 5px 0 var(--ink), 7px 8px 0 var(--blue);
}
.brand [lang=ur] { font: 700 .42em/2.2 var(--urdu); color: #fff; text-shadow: 2px 2px 0 var(--ink); }
/* the slogan plate, after the line every truck carries: dekh magar pyaar se */
.slogan {
  display: inline-block; margin: .5rem 1rem 0; padding: .15rem 1.4rem .25rem; rotate: -1.5deg;
  font: 400 clamp(1.05rem, 4.2vw, 1.4rem)/1.3 var(--sign); color: #fff;
  background: var(--green); border: var(--edge); border-radius: 999px; box-shadow: inset 0 0 0 2.5px var(--yellow);
}
.patti { height: 44px; margin-top: 1rem; border-top: var(--edge); background: url(/assets/ui/patti.svg) center / auto 44px repeat-x; }
.jhalar { height: 60px; margin-bottom: -60px; position: relative; top: 3px; pointer-events: none; background: url(/assets/ui/jhalar.svg) center top / 48px 60px repeat-x; }
/* once a card is picked the crown steps back and gives the room to the work */
html[data-step]:not([data-step=stall]) .slogan { display: none; }
html[data-step]:not([data-step=stall]) .brand { font-size: clamp(1.8rem, 7vw, 2.6rem); }
html[data-step]:not([data-step=stall]) .phool { width: clamp(2rem, 8vw, 3rem); }
html[data-step]:not([data-step=stall]) h1 { font-size: clamp(1.4rem, 5.2vw, 2rem); }

main { width: 100%; max-width: 66rem; margin: 0 auto; padding: 4.75rem 1.25rem 4rem; flex: 1; }
h1 {
  font: 400 clamp(1.7rem, 6.6vw, 3rem)/1.15 var(--display); color: var(--yellow);
  text-shadow: 2px 2px 0 var(--ink), 4px 4px 0 var(--ink);
  margin: 0 0 .6rem; text-wrap: balance;
}
h1:focus { outline: none; }
h2, label, legend { display: block; font: 400 var(--lead)/1.3 var(--sign); color: var(--yellow); margin: 1.7rem 0 .5rem; padding: 0; }
.lede { margin: 0 0 1.25rem; max-width: 60ch; font-size: var(--lead); }
.hint { font-size: var(--small); margin: .5rem 0 0; }
.hint:empty, .error:empty { display: none; }
.error { color: var(--red-deep); font-weight: 700; background: var(--paper); border: var(--edge); border-radius: 10px; padding: .6rem .85rem; margin: 1.25rem 0 0; }

.steps { list-style: none; display: flex; justify-content: center; gap: .45rem; padding: 0; margin: 0 0 1.75rem; }
.steps li { padding: .1rem .8rem .2rem; border-radius: 8px; border: 2.5px solid var(--ink); background: rgba(18, 16, 14, .4); color: #fff; font: 400 var(--small)/1.4 var(--sign); }
.steps li[aria-current] { background: var(--yellow); color: var(--ink); box-shadow: inset 0 0 0 2px var(--yellow), inset 0 0 0 4px var(--red), 0 3px 0 var(--ink); }

/* ---------- controls: painted plaques ---------- */
.row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.row.center { justify-content: center; }
.nav { margin-top: 2.25rem; justify-content: space-between; }

/* A plaque: ink edge, a gap of its own colour, then a contrasting keyline, and a brass stud at each end. */
.btn {
  --plate: var(--yellow); --key: var(--red); --stud: var(--green);
  display: inline-flex; align-items: center; justify-content: center; min-height: 3.2rem; padding: .5rem 2.1rem .6rem;
  font: 400 1.2rem/1.1 var(--sign); color: var(--red-deep); text-decoration: none; cursor: pointer;
  border: var(--edge); border-radius: 12px;
  background: radial-gradient(circle at 15px 50%, var(--stud) 4px, var(--ink) 4.5px 6px, transparent 6.5px), radial-gradient(circle at calc(100% - 15px) 50%, var(--stud) 4px, var(--ink) 4.5px 6px, transparent 6.5px), var(--plate);
  box-shadow: inset 0 0 0 3px var(--plate), inset 0 0 0 5.5px var(--key), 0 5px 0 var(--ink);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { transform: translateY(-2px); box-shadow: inset 0 0 0 3px var(--plate), inset 0 0 0 5.5px var(--key), 0 7px 0 var(--ink); }
.btn:active { transform: translateY(4px); box-shadow: inset 0 0 0 3px var(--plate), inset 0 0 0 5.5px var(--key), 0 1px 0 var(--ink); }
.btn.primary { --plate: var(--red); --key: var(--yellow); --stud: #fff; color: var(--yellow); font-size: 1.35rem; min-height: 3.5rem; }
.btn.small { min-height: 2.7rem; padding: .3rem 1rem .4rem; font-size: 1rem; background: var(--plate); }
.btn[aria-pressed=true] { --plate: var(--green); --key: var(--yellow); color: #fff; }
.btn:disabled { opacity: .75; cursor: progress; }

.chips { display: flex; flex-wrap: wrap; gap: .6rem; margin: 0 0 1.5rem; }
.chip {
  --c: var(--yellow); --k: var(--red); --t: var(--red-deep);   /* plate, keyline, lettering */
  min-height: 2.7rem; padding: .15rem 1.1rem .3rem; font: 400 1.05rem/1.3 var(--sign); color: var(--t);
  background: var(--c); border: 2.5px solid var(--ink); border-radius: 8px; cursor: pointer;
  box-shadow: inset 0 0 0 2px var(--c), inset 0 0 0 4px var(--k), 0 3px 0 var(--ink);
  transition: transform .2s var(--ease);
}
/* painted in turn, the way no two panels on a truck share a colour */
.chip:nth-child(4n+2) { --c: var(--rani); --k: var(--yellow); --t: #fff; }
.chip:nth-child(4n+3) { --c: var(--green); --k: var(--yellow); --t: #fff; }
.chip:nth-child(4n) { --c: #f77f00; --k: var(--ink); --t: var(--ink); }
.chip:hover { transform: translateY(-2px) rotate(-2deg); }
.chip[aria-pressed=true] { --c: var(--ink); --k: var(--yellow); --t: var(--yellow); transform: rotate(-3deg) scale(1.08); }
.chips.urdu { margin: .7rem 0 0; }
.chips.urdu .chip { font-family: var(--urdu); line-height: 2.1; padding-block: 0; }

input[type=text], input[type=datetime-local], textarea {
  display: block; width: 100%; font: 500 1.1rem/1.5 var(--body); color: var(--ink); caret-color: var(--rani);
  background: var(--paper); border: var(--edge); border-radius: 10px; padding: .55rem .8rem; box-shadow: 0 4px 0 var(--ink);
}
textarea { resize: vertical; }
::placeholder { color: #6b5a45; opacity: 1; }
fieldset { border: 0; padding: 0; margin: 1.7rem 0 0; min-width: 0; }
legend { margin-top: 0; }

.swatches { display: flex; flex-wrap: wrap; gap: .9rem; }
.swatches label { margin: 0; position: relative; cursor: pointer; }
.swatches input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.swatches span { display: block; width: 2.7rem; height: 2.7rem; border-radius: 50%; border: 3px solid #fff; box-shadow: 0 0 0 3px var(--ink); }
.swatches img { display: block; width: 3.4rem; }
.swatches input:checked + span { box-shadow: 0 0 0 3px var(--ink), 0 0 0 7px var(--yellow), 0 0 0 10px var(--ink); }
.stamps label { padding: .4rem; border: 3px solid transparent; border-radius: 10px; transition: transform .3s var(--ease); }
.stamps label:has(:checked) { background: var(--yellow); border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); transform: rotate(-5deg) scale(1.08); }
.swatches input:focus-visible + * { outline: 3px solid #fff; outline-offset: 8px; }

.tray { display: grid; grid-template-columns: repeat(auto-fill, minmax(3.9rem, 1fr)); gap: .6rem; }
.tray button {
  aspect-ratio: 1; padding: .35rem; background: var(--paper); border: var(--edge); border-radius: 12px; box-shadow: 0 4px 0 var(--ink); cursor: pointer;
  transition: transform .3s var(--ease), background-color .2s;
}
.tray button:hover { transform: scale(1.1) rotate(-6deg); background: var(--yellow); }
.tray img { display: block; width: 100%; height: 100%; }
#sticker-tools { margin-top: 1.1rem; }

.rhymes { display: flex; gap: .6rem; overflow-x: auto; margin: .6rem 0 0; padding: .2rem .2rem .9rem; scroll-snap-type: x proximity; scrollbar-width: thin; }
.rhyme {
  flex: none; width: min(15rem, 72vw); scroll-snap-align: start;
  font: 400 1.05rem/1.5 var(--verse); text-align: start; white-space: pre-line; color: var(--ink);
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 10px; padding: .55rem .85rem; cursor: pointer;
  transition: transform .2s var(--ease), background-color .2s;
}
.rhyme:hover { background: var(--yellow); transform: translateY(-3px) rotate(-1deg); }

/* ---------- the stall: cards pegged to a string ---------- */
.rail { list-style: none; margin: 0; padding: 1.7rem 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 3.2rem 1.4rem; }
.rail li { position: relative; }
.rail li::before { content: ''; position: absolute; top: -1.1rem; left: -.75rem; right: -.75rem; height: 3px; background: var(--ink); }
.pick {
  position: relative; display: block; width: 100%; padding: 0; border: 0; background: none; cursor: pointer;
  font: 400 1.05rem/1.25 var(--sign); color: #fff; text-align: center;
  transform-origin: 50% -1.1rem; transition: transform .6s var(--ease);
}
.rail li:nth-child(odd) .pick { transform: rotate(-1.6deg); }
.rail li:nth-child(even) .pick { transform: rotate(1.3deg); }
.rail li .pick:hover, .rail li .pick:focus-visible { animation: swing 1.6s ease-in-out; }
.rail li .pick:active { transform: scale(.96); }
@keyframes swing { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(5deg); } 35% { transform: rotate(-4deg); } 55% { transform: rotate(3deg); } 75% { transform: rotate(-1.5deg); } }
.pick::after { /* peg */
  content: ''; position: absolute; top: -1.75rem; left: 50%; width: .85rem; height: 1.9rem; margin-left: -.42rem;
  background: var(--yellow); border: 2.5px solid var(--ink); border-radius: 3px;
}
/* the card's name on a stall tag */
.pick span {
  display: inline-block; margin-top: 1.1rem; padding: .05rem .8rem .2rem; rotate: -2deg;
  background: var(--yellow); color: var(--ink); border: 2.5px solid var(--ink); border-radius: 8px; box-shadow: 0 3px 0 var(--ink);
}
.rail li:nth-child(even) .pick span { rotate: 2deg; background: var(--rani); color: #fff; }

/* ---------- a card face: mounted with a yellow keyline, like a framed panel ---------- */
.face {
  position: relative; aspect-ratio: 3 / 4; container-type: inline-size; overflow: hidden;
  background: var(--paper); border: var(--edge); border-radius: 12px;
  box-shadow: 0 0 0 3px var(--yellow), 0 0 0 6px var(--ink), 6px 12px 0 rgba(18, 16, 14, .45);
}
.art { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.greeting {
  position: absolute; left: 50%; translate: -50% -50%; text-align: center;
  font-family: var(--sign); font-weight: 700; font-synthesis: none; line-height: 1.9; overflow-wrap: anywhere; text-wrap: balance;
}
.sticker { position: absolute; width: 22%; user-select: none; pointer-events: none; filter: drop-shadow(.5cqw .5cqw 0 rgba(18, 16, 14, .35)); }
.editing .sticker { pointer-events: auto; touch-action: none; cursor: grab; }
.editing .sticker.selected { outline: 3px dashed #fff; outline-offset: 3px; filter: drop-shadow(0 0 1px #000) drop-shadow(.5cqw .5cqw 0 rgba(18, 16, 14, .35)); }

/* inside leaves: the card's own colours as a border and a faint dot pattern, on pale paper so ink stays readable.
   --p paper, --b border, --a accent come from the card's entry in library.json. */
.leaf { background: var(--p); }
.page {
  position: absolute; inset: 0; overflow: hidden; padding: 15cqw 14cqw 0; font-family: var(--hand); font-synthesis: none; text-align: start;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--a) 70%, transparent) 1.2cqw, transparent 1.35cqw) 0 0 / 9cqw 9cqw,
    radial-gradient(circle, color-mix(in srgb, var(--p) 45%, transparent) .7cqw, transparent .85cqw) 4.5cqw 4.5cqw / 9cqw 9cqw,
    var(--b); /* taste-skill-ignore: printed dot pattern */
}
.page::before { /* the writing panel */
  content: ''; position: absolute; inset: 7.5cqw; border-radius: 5cqw; background: var(--p);
  box-shadow: 0 0 0 .8cqw var(--ink), 0 0 0 2cqw var(--a), 0 0 0 2.8cqw var(--ink);
}
.page > * { position: relative; }
.page p { margin: 0; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.page .to { font-size: 5.4cqw; font-weight: 800; margin-bottom: 4cqw; }
.note { font-size: 4.6cqw; font-weight: 600; }
.page .sign { font-size: 5.4cqw; font-weight: 800; text-align: end; margin-top: 5cqw; }
/* the left leaf carries the printed verse, as shop-bought cards did */
.verse { display: grid; align-content: center; justify-items: center; gap: 5cqw; padding: 14cqw; text-align: center; }
.bloom { width: 26cqw; }
.page .sher { font: 400 5.4cqw/1.6 var(--verse); }
.page .press { position: absolute; left: 0; right: 0; bottom: 11cqw; font: 400 3.2cqw/1.2 var(--sign); color: var(--b); }
.strokes { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; fill: none; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; }
.strokes.on { pointer-events: auto; touch-action: none; cursor: crosshair; }

/* ---------- envelope ---------- */
.envelope {
  container-type: inline-size; aspect-ratio: 3 / 2; padding: 3.4%; color: var(--ink); text-align: start;
  background: repeating-linear-gradient(-45deg, var(--e1) 0 3.5%, var(--paper) 3.5% 7%, var(--e2) 7% 10.5%, var(--paper) 10.5% 14%); /* taste-skill-ignore: the airmail border of an envelope */
  border: var(--edge); border-radius: 10px; box-shadow: 6px 12px 0 rgba(18, 16, 14, .45);
}
.envelope, .env-dot { --e1: var(--red); --e2: var(--blue); }
[data-env="1"] { --e1: var(--green); --e2: var(--yellow); }
[data-env="2"] { --e1: var(--rani); --e2: var(--teal); }
[data-env="3"] { --e1: #f77f00; --e2: var(--blue); }
.swatches .env-dot { background: linear-gradient(135deg, var(--e1) 50%, var(--e2) 50%); } /* taste-skill-ignore: a two-colour swatch */
.env-paper { position: relative; height: 100%; background: var(--paper); border: 2px solid var(--ink); border-radius: 3px; }
.stamp { position: absolute; top: 6%; right: 4.5%; width: 21%; rotate: 3deg; filter: drop-shadow(.4cqw .4cqw 0 rgba(18, 16, 14, .4)); }
.postmark {
  position: absolute; top: 11%; right: 20%; width: 27cqw; aspect-ratio: 1; padding: 2cqw; rotate: -14deg; overflow: hidden;
  display: grid; place-content: center; gap: .3cqw; text-align: center; overflow-wrap: anywhere;
  border: 1cqw double rgba(18, 16, 14, .75); border-radius: 50%; color: rgba(18, 16, 14, .8);
  font: 700 3.6cqw/1.1 var(--body);
}
.postmark span + span { font-size: 2.9cqw; }
.address { position: absolute; left: 8%; right: 34%; bottom: 7%; display: grid; font-family: var(--hand); font-synthesis: none; line-height: 1.3; }
.address small { font: 400 3.6cqw/1.3 var(--sign); color: var(--red); margin-top: 1.6cqw; }
.address strong { font: 400 8.4cqw/1.25 var(--verse); overflow-wrap: anywhere; }
.address span { font: 400 5.8cqw/1.25 var(--verse); overflow-wrap: anywhere; }

/* ---------- workbench: preview beside the tools ---------- */
.bench { display: grid; gap: 1.9rem; margin-top: 1.4rem; }
.bench > * { min-width: 0; }
.bench > div > :first-child { margin-top: 0; }
.preview { width: min(100%, 21rem); margin-inline: auto; }
.preview.wide { width: min(100%, 27rem); }
.pen { margin-top: 1.5rem; justify-content: center; }
#sent .row { margin-top: 1.5rem; }
/* a link and its copy button are one control */
.joined { display: flex; }
.joined input { flex: 1; min-width: 0; border-radius: 10px 0 0 10px; }
.joined .btn, .joined .btn:hover, .joined .btn:active { margin-left: -3px; min-height: 0; border-radius: 0 10px 10px 0; transform: none; background: var(--yellow); box-shadow: 0 4px 0 var(--ink); padding-inline: 1.1rem; font-size: 1.05rem; }
.again { margin-top: 2rem; }
@media (max-width: 51.99rem) {
  #front .preview { width: min(100%, 19rem); }
  .tray { display: flex; overflow-x: auto; margin-inline: -1.25rem; padding: .3rem 1.25rem .8rem; scroll-snap-type: x proximity; scrollbar-width: none; }
  .tray button { flex: none; width: 3.9rem; scroll-snap-align: start; }
}
@media (min-width: 52rem) {
  .rail { grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: 3.75rem 2.2rem; }
  .bench { grid-template-columns: minmax(0, 23rem) minmax(0, 1fr); gap: 3.5rem; align-items: start; }
  .preview, .preview.wide { position: sticky; top: 1.25rem; width: 100%; }
}

/* ---------- the recipient's view ---------- */
.stage { display: grid; justify-items: center; align-content: start; gap: 1.6rem; text-align: center; }
.stage h1, .stage .lede { margin: 0; }
.stage .envelope { width: min(100%, 30rem); }
.stage .envelope.sealed { cursor: pointer; animation: nudge 3.4s var(--ease) infinite; }
.count { margin: 0; font: 400 1.6rem/1.3 var(--sign); color: var(--yellow); }
@keyframes nudge {
  0%, 68%, 100% { transform: rotate(-1.5deg); }
  78% { transform: rotate(2deg) translateY(-6px); }
  88% { transform: rotate(-3deg); }
}

/* A folded card. The cover sits over the right leaf and swings on its left edge;
   its back is the left leaf. On a phone the open card is wider than the screen, so it swipes. */
.book-wrap { width: 100%; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding: 1rem 0 1.75rem; }
.book { --w: min(24rem, 84vw); position: relative; display: flex; width: calc(var(--w) * 2); margin-inline: auto; perspective: 2400px; transition: translate 1.1s var(--ease); }
.book > * { flex: none; width: var(--w); scroll-snap-align: center; }
.cover { position: absolute; top: 0; right: 0; height: 100%; z-index: 1; cursor: pointer; transform-origin: 0 50%; transform-style: preserve-3d; transition: transform 1.2s var(--ease); }
.cover .face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.cover .leaf { transform: rotateY(180deg); }
.book.open .cover { transform: rotateY(-166deg); }
.book .face { box-shadow: none; border-radius: 3px 12px 12px 3px; }
.book > .leaf { box-shadow: 8px 14px 0 rgba(18, 16, 14, .4); transform-origin: 0 50%; transition: transform 1.2s var(--ease); }
.book.open > .leaf { transform: rotateY(-9deg); }
.swipe { margin: 0; }
@media (min-width: 52rem) {
  .book:not(.open) { translate: -25% 0; }   /* a closed card sits in the middle */
  .swipe { display: none; }
}

/* sealing: an ordinary envelope, flap on top. The card turns on its side so it fills the envelope,
   drops in from above, the flap folds down, then the addressed side turns up. */
#sent-preview { overflow: hidden; padding: .5rem 0 1.25rem; }
.seal { position: relative; width: 76%; margin: 42% auto 0; aspect-ratio: 3 / 2; perspective: 1600px; }
.seal > * { position: absolute; inset: 0; border-radius: 10px; }
.seal-back { background: #ecdcb4; border: var(--edge); }
.seal > .face { inset: -14.5% 17.75% auto; z-index: 1; box-shadow: none; animation: slidein 2s .5s cubic-bezier(.45, 0, .3, 1) both; }
.seal-pocket { inset: 0 3px 3px; z-index: 2; background: var(--paper); clip-path: polygon(0 0, 50% 50%, 100% 0, 100% 100%, 0 100%); }
.seal-flap { inset: 3px 3px 0; z-index: 3; background: #f6e7c2; clip-path: polygon(0 0, 100% 0, 50% 54%); transform-origin: 50% 0; animation: shut .8s 2.6s var(--ease) both; }
.seal-front { z-index: 4; animation: turnup .6s 3.5s var(--ease) both; }
@keyframes slidein { from { transform: translateY(-62%) rotate(90deg); } to { transform: rotate(90deg); } }
@keyframes shut { 0% { transform: rotateX(180deg); z-index: 0; } 49% { z-index: 0; } 50% { z-index: 3; } 100% { transform: none; z-index: 3; } }
@keyframes turnup { from { opacity: 0; transform: rotateY(90deg); } to { opacity: 1; transform: none; } }
/* the card slides up out of the envelope */
.rise { animation: rise 1s var(--ease) both; }
@keyframes rise {
  from { opacity: 0; transform: translateY(4rem) rotate(-6deg) scale(.9); }
  to { opacity: 1; transform: none; }
}

.foot { background: var(--red); text-align: center; }
.foot .patti { margin-top: 0; border-bottom: var(--edge); }
.foot-in { display: grid; justify-items: center; gap: 1rem; padding: 1.75rem 1.25rem 2.25rem; }
/* "phir milenge": the goodbye painted on the back of trucks */
.bye { margin: 0; font: 400 clamp(1.5rem, 6vw, 2.4rem)/1.2 var(--display); color: var(--yellow); text-shadow: 2px 2px 0 var(--ink), 4px 4px 0 var(--ink); }
.how { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; counter-reset: how; font: 400 1.05rem/1.3 var(--sign); }
.how li { counter-increment: how; padding: .15rem 1.1rem .25rem; background: var(--green); border: 2.5px solid var(--ink); border-radius: 999px; box-shadow: inset 0 0 0 2px var(--yellow); }
.how li::before { content: counter(how) '. '; color: var(--yellow); }
.fine, .imprint { margin: 0; }
.imprint { font: 400 1rem/1.4 var(--sign); }

/* ---------- the fold, and the editing layout: the open card on top, its two leaves' controls below ---------- */
.leaf::after { content: ''; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(90deg, rgba(18, 16, 14, .26), transparent 13%); } /* taste-skill-ignore: shadow in the fold */
.spread .leaf:first-child::after { background: linear-gradient(270deg, rgba(18, 16, 14, .26), transparent 13%); } /* taste-skill-ignore: shadow in the fold */
.spread { display: flex; width: min(100%, 42rem); margin: 1.4rem auto 0; }
.spread .face { flex: 1 1 0; min-width: 0; border-radius: 12px 3px 3px 12px; box-shadow: 6px 12px 0 rgba(18, 16, 14, .4); }
.spread .face + .face { margin-left: -3px; border-radius: 3px 12px 12px 3px; }
/* the inside sticker shelf sits beside the open card, or right under it on a phone, never at the foot of the form */
.desk { display: grid; grid-template-columns: minmax(0, 1fr); gap: .9rem; margin-top: 1.4rem; }
.desk .spread { margin-top: 0; }
.shelf h2 { margin: 0 0 .5rem; }
.shelf .btn { margin-top: .8rem; }
.cols { display: grid; gap: 0 3rem; }
.cols > * { min-width: 0; }
.side { margin-top: 2rem; padding-bottom: .3rem; font-size: 1.5rem; color: #fff; border-bottom: 3px dotted var(--yellow); }
.hint.center { text-align: center; }
@media (min-width: 52rem) {
  .cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .desk { grid-template-columns: minmax(0, 42rem) 9.5rem; justify-content: center; gap: 1.5rem; align-items: start; }
  .shelf .tray { grid-template-columns: 1fr 1fr; }
}

/* ---------- motion ---------- */
.step:not([hidden]) { animation: stepin .5s var(--ease) both; }
@keyframes stepin { from { opacity: 0; transform: translateY(14px); } }
.jhalar { transform-origin: 50% 0; animation: sway 5s ease-in-out infinite alternate; }
@keyframes sway { from { transform: skewX(-3deg); } to { transform: skewX(3deg); } }
.tray button:active { transform: scale(.9); }

/* confetti cut in truck-art shapes: diamond, petal, disc, four-point star */
.confetti { position: fixed; z-index: 10; pointer-events: none; }
.bit { position: absolute; width: 16px; height: 16px; margin: -8px; animation: fling 2.2s cubic-bezier(.1, .7, .3, 1) both; }
.b0 { clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.b1 { border-radius: 50% 0; }
.b2 { width: 11px; height: 11px; border-radius: 50%; }
.b3 { width: 20px; height: 20px; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
@keyframes fling { 70% { opacity: 1; } to { opacity: 0; transform: translate(var(--x), calc(var(--y) + 260px)) rotate(var(--r)); } }

/* og.png source page: one envelope on royal blue, 1200 x 630 */
.og { width: 1200px; height: 630px; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.og .envelope { width: 760px; rotate: -4deg; box-shadow: 14px 16px 0 var(--ink); }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation: none !important; transition: none !important; }
}
