/* The peel card pages: /peel-card (make the link) and /peel-card/open (the card they tear open).
   Loaded after /valentine/valentine.css, which gives the sky, form, buttons, phone preview, app box and footer. */
body[data-theme="red"]  { --sky-top: hsl(355 80% 87%); --sky-mid: hsl(0 100% 96%); }
body[data-theme="mint"] { --sky-top: hsl(158 48% 82%); --sky-mid: hsl(155 60% 95%); }

/* ----- /peel-card: the maker ----- */
.swatches.five { grid-template-columns: repeat(5, 1fr); }
.swatches.five .swatch { font-size: 13px; }
.shapes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shape { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 2px 8px; border: 2px solid var(--line); border-radius: 16px; cursor: pointer; font-weight: 800; font-size: 14px; background: var(--cream); }
.shape svg { width: 44px; height: 44px; }
.shape input { position: absolute; opacity: 0; pointer-events: none; }
.shape:has(input:checked), .chip:has(input:checked) { border-color: var(--orange); background: hsl(24 100% 96%); box-shadow: 0 3px 0 var(--orange); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; padding: 8px 14px; border: 2px solid var(--line); border-radius: 99px; cursor: pointer; font-weight: 800; font-size: 15px; background: var(--cream); }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.own-field { margin-top: 10px; }
.own-field input { width: 100%; font: inherit; font-size: 17px; padding: 10px 12px; border: 2px solid var(--line); border-radius: 14px; background: var(--cream); color: var(--navy); }
.count { display: block; text-align: right; font-size: 13px; font-weight: 700; color: var(--soft); margin-top: 4px; }
.steps { padding-left: 1.2em; margin: 0 0 12px; }
.steps li { margin-bottom: 6px; }

/* ----- /peel-card/open: the card ----- */
.from-pill { text-transform: none; letter-spacing: 0; font-size: 14px; }
.stage { width: min(100%, 330px); margin: 20px auto 0; perspective: 1400px; }
.pcard { position: relative; width: 100%; aspect-ratio: 3 / 4; transform-style: preserve-3d; transition: transform .75s cubic-bezier(.3,1.25,.5,1); }
.pcard.flipped { transform: rotateY(180deg); }
.face { position: absolute; inset: 0; border-radius: 18px; -webkit-backface-visibility: hidden; backface-visibility: hidden; }
.front { z-index: 1; touch-action: none; cursor: grab; -webkit-tap-highlight-color: transparent; }
.front:active { cursor: grabbing; }
.pcard.opened .front { touch-action: auto; cursor: auto; }
/* The note under the paper: lined, cream, handwritten */
.inside { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 26px 24px;
  border-radius: 18px; text-align: center; color: var(--navy); background-color: hsl(45 100% 98%);
  background-image: repeating-linear-gradient(transparent 0 31px, hsl(214 45% 89%) 31px 32px);
  box-shadow: 0 10px 26px hsl(345 40% 40% / .22), inset 0 0 0 1px hsl(214 32% 88%); overflow: hidden; }
.inside p { margin: 0; overflow-wrap: anywhere; }
.in-occ { font-family: "Fredoka One", "Nunito", sans-serif; font-size: 15px; color: var(--orange-dark); }
.in-photo { display: block; width: 86px; height: 86px; border-radius: 50%; overflow: hidden; border: 4px solid #fff; box-shadow: 0 3px 0 var(--tint-edge); margin: 2px 0 4px; flex: none; }
.in-photo img { display: block; width: 100%; height: 100%; object-fit: cover; }
.in-dear, .in-note, .in-sign { font-family: "Caveat", "Segoe Print", "Bradley Hand", cursive; }
.in-dear { font-size: 29px; font-weight: 700; line-height: 1.1; }
.in-note { font-size: 26px; font-weight: 500; line-height: 1.22; white-space: pre-line; }
.in-note.long { font-size: 22px; }
.in-sign { font-size: 28px; font-weight: 700; color: var(--orange-dark); align-self: flex-end; margin-top: 4px !important; }
/* The paper on top: drawn by peel.js. Its drop shadow also falls into every hole, so the paper looks lifted. */
#paper { position: absolute; z-index: 2; pointer-events: none; filter: drop-shadow(0 2px 2px hsl(345 50% 25% / .3)); }
#paper:focus-visible { outline: none; }
.pcard:has(#paper:focus-visible) .inside { outline: 3px solid var(--orange); outline-offset: 4px; }
#paper.fall-away { pointer-events: none; animation: fall-away .9s cubic-bezier(.55,0,.85,.55) forwards; }
@keyframes fall-away { 0% { transform: none; opacity: 1; } 18% { transform: translateY(-8px) rotate(-2deg); opacity: 1; } 100% { transform: translateY(75vh) rotate(16deg); opacity: 0; } }
.pcard.opened .inside { animation: glow-in .8s ease-out; }
@keyframes glow-in { from { box-shadow: 0 0 0 0 hsl(24 95% 53% / .5), 0 10px 26px hsl(345 40% 40% / .22); } to { box-shadow: 0 0 0 18px hsl(24 95% 53% / 0), 0 10px 26px hsl(345 40% 40% / .22); } }
/* The back of the card. The bears never move. */
.back { transform: rotateY(180deg); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; cursor: pointer;
  background-color: hsl(45 100% 98%); box-shadow: 0 10px 26px hsl(345 40% 40% / .22), inset 0 0 0 1px hsl(214 32% 88%);
  background-image: radial-gradient(hsl(345 60% 80% / .35) 1.5px, transparent 1.6px); background-size: 18px 18px; }
.back img { width: 120px; height: 120px; }
.back p { margin: 0; font-family: "Fredoka One", "Nunito", sans-serif; font-size: 20px; color: var(--navy); }
.back small { font-weight: 700; color: var(--soft); }
.peel-hint { min-height: 1.6em; margin: 52px 0 8px; font-weight: 800; color: var(--soft); }
.peel-hint.nudge { animation: nudge .45s ease-in-out; }
@keyframes nudge { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
.peel-controls { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; align-items: center; }
.peel-controls .btn { min-height: 44px; padding: 8px 18px; font-size: 16px; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 8px 14px; font: inherit; font-weight: 800; font-size: 15px; color: var(--navy); background: white; border: 2px solid var(--line); border-radius: 99px; cursor: pointer; }
.icon-btn[aria-pressed="false"]#btn-sound { color: var(--soft); }
.peel-done { display: flex; flex-direction: column; gap: 10px; align-items: center; margin: 14px 0 0; }
.peel-done .btn { width: min(100%, 340px); }

body.demo .peel-controls, body.demo .peel-done { display: none !important; }
body.demo .peel-sky { min-height: 100vh; background:
    radial-gradient(64px 26px at 10% 24%, #fff 98%, transparent), radial-gradient(46px 22px at 14% 19%, #fff 98%, transparent),
    radial-gradient(84px 30px at 90% 16%, #fff 98%, transparent), radial-gradient(52px 24px at 85% 11%, #fff 98%, transparent),
    linear-gradient(180deg, var(--sky-top), var(--sky-mid)); }
body.demo .stage { width: 300px; }

@media (prefers-reduced-motion: reduce) {
  .pcard { transition: none; }
  #paper.fall-away { animation: none; opacity: 0; }
  .pcard.opened .inside, .peel-hint.nudge { animation: none; }
}
