/* 30 Days of Christmas (js/gifts.js): the Pass tab's hub, the calendar, the present up close, the unwrap, the tab badge.
   Red, black and white with field-journal frames (docs/ui/theme.md); gold for what is earned. No emoji: the presents are SVG.
   Motion: a small wobble on waiting presents, the shake, the lid and the plate rising. Kit.calm (body.calm, .calm) and
   prefers-reduced-motion hold everything still. */

/* ---------- the tab badge: a little present with the count, left of the icon (the Pass tab's tier badge sits right) ---------- */
.tabbar button { position: relative; }
/* The Pass tab's gift badge (Holiday.badges): one pixel plate, a pixel present and the count, hard edges and a hard drop, the
   same type as the tab's tier badge; it sits left of the icon, the tier badge right. */
.hol-badge { position: absolute; top: 1px; right: calc(50% + 12px); display: flex; align-items: center; gap: 2px; height: 17px; padding: 0 4px 0 3px; pointer-events: none; z-index: 2;
  background: #121113; border: 2px solid #0b0b0b; box-shadow: 0 2px 0 #050505, inset 0 1px 0 #ffffff1f, inset 0 0 0 1px #c8202a; font-style: normal; animation: hb-hop 2.6s steps(6) infinite; }
.hol-badge[hidden] { display: none; }
.hol-badge svg { width: 11px; height: 11px; display: block; image-rendering: pixelated; }
.hol-badge b { font: 400 13px/13px var(--display); color: #f2eee6; letter-spacing: .02em; min-width: 7px; text-align: center; transform: translateY(1px); }
.hol-badge.calm { animation: none; }
@keyframes hb-hop { 0%, 84%, 100% { transform: none; } 90% { transform: translateY(-2px); } 95% { transform: translateY(0); } }
body:not(.pc-menu) #home .tabbar .hol-badge { top: 1px; }
body.pc-menu #home .tabbar .hol-badge { top: 6px; right: auto; left: 7px; }

/* ---------- the pixel plate (the bottom tabs' recipe: a lit 2 px top rule, the body, a darker 4 px foot, a 2 px ink ring and a
   hard drop) with brass corner ticks (css/plates.css). Every holiday box wears it. ---------- */
.gift-hub, .gift-cal, .gift-sheet { --gk: #d9a441; --gl: #57503f; --gm: #26231e; --gd: #16140f; }
.gh-btn, .gc-cell, .gc-stat span, .gs-stage, .gift-back .btn {
  background:
    linear-gradient(var(--gk), var(--gk)) 4px 4px / 8px 2px no-repeat, linear-gradient(var(--gk), var(--gk)) 4px 4px / 2px 8px no-repeat,
    linear-gradient(var(--gk), var(--gk)) calc(100% - 4px) 4px / 8px 2px no-repeat, linear-gradient(var(--gk), var(--gk)) calc(100% - 4px) 4px / 2px 8px no-repeat,
    linear-gradient(var(--gk), var(--gk)) 4px calc(100% - 6px) / 8px 2px no-repeat, linear-gradient(var(--gk), var(--gk)) 4px calc(100% - 6px) / 2px 8px no-repeat,
    linear-gradient(var(--gk), var(--gk)) calc(100% - 4px) calc(100% - 6px) / 8px 2px no-repeat, linear-gradient(var(--gk), var(--gk)) calc(100% - 4px) calc(100% - 6px) / 2px 8px no-repeat,
    linear-gradient(180deg, var(--gl) 0 2px, var(--gm) 2px calc(100% - 4px), var(--gd) calc(100% - 4px));
  border: 0; border-radius: 0; box-shadow: 0 0 0 2px #0b0b0b, 0 4px 0 2px #050505; }
.gift-svg { image-rendering: pixelated; }

/* ---------- the hub: two giant buttons ---------- */
.gift-hub { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 14px 22px; min-height: min(560px, calc(100dvh - 190px)); align-content: center; }
.gh-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; gap: 10px; min-height: 360px; padding: 26px 12px 18px; color: #f2eee6; text-align: center; cursor: pointer; isolation: isolate; overflow: hidden; }
.gh-btn::before { content: ''; position: absolute; inset: 2px 0 4px; z-index: -1; background: url(../assets/ui/command-etch.svg) center 18% / 150% auto no-repeat; opacity: .07; }
.gh-btn::after { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: #c8202a; }
.gh-btn:active { transform: translateY(3px); box-shadow: 0 0 0 2px #0b0b0b, 0 1px 0 2px #050505; }
.gh-pass { --gk: #b9ad9a; }
.gh-gifts { --gl: #7a2a2e; --gm: #3a1517; --gd: #1d0b0c; }
.gh-gifts::after { background: repeating-linear-gradient(90deg, #c8202a 0 8px, #f2eee6 8px 16px); }
.gh-gifts.waiting { box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 4px #d9a441, 0 6px 0 4px #050505; }
.gh-art { display: grid; place-items: center; width: 120px; height: 120px; flex: none; }
.gh-art .pass-mark, .gh-art .gh-mark { width: 108px; height: 108px; }
.gh-art .gift-svg { width: 120px; height: 120px; }
.gh-text { display: flex; flex-direction: column; gap: 6px; align-items: center; width: 100%; }
.gh-text small { font: 400 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #f27661; }
.gh-text > b { font: 400 28px/.95 var(--display); letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 #000; text-wrap: balance; }
.gh-text em { font-style: normal; font-size: 12.5px; line-height: 1.3; color: #cfc6b6; max-width: 24ch; text-wrap: balance; min-height: 2.6em; }
/* a progress bar of pixel cells: on (gold), waiting (red, the gifts), half (a tier under way) */
.gh-bar { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; width: min(100%, 170px); height: 10px; margin-top: 2px; padding: 2px; background: #0b0b0b; box-shadow: 0 2px 0 #050505; }
.gh-bar.g30 { grid-auto-flow: row; grid-template-columns: repeat(15, 1fr); grid-auto-rows: 1fr; grid-auto-columns: unset; height: 16px; }
.gh-bar i { background: #2b2722; }
.gh-bar i.on { background: #d9a441; box-shadow: inset 0 1px 0 #ffe08a; }
.gh-bar i.wait { background: #c8202a; box-shadow: inset 0 1px 0 #ff6b5f; }
.gh-bar i.half { background: linear-gradient(90deg, #d9a441 50%, #2b2722 50%); }
.gh-sub { font: 400 13px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: #b9ad9a; }
.gh-line { margin-top: 4px; padding: 6px 10px 5px; background: linear-gradient(180deg, #3a352c 0 2px, #1b1915 2px); box-shadow: 0 0 0 2px #0b0b0b, 0 3px 0 2px #050505;
  font: 400 15px/1 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #e8dfcd; white-space: nowrap; }
.gh-line b { font: inherit; color: #ffe08a; }
.gh-line em { font: inherit; color: #fff; font-variant-numeric: tabular-nums; }
.gh-count { position: absolute; top: 12px; right: 12px; min-width: 28px; height: 26px; padding: 0 6px; background: linear-gradient(180deg, #ed987f 0 2px, #c9383c 2px calc(100% - 3px), #8a1a1e calc(100% - 3px));
  color: #fff; box-shadow: 0 0 0 2px #0b0b0b, 0 3px 0 2px #050505; font: 400 19px/26px var(--display); font-style: normal; text-align: center; transform: rotate(3deg); }
@media (max-width: 380px), (max-height: 640px) {
  .gift-hub { grid-template-columns: 1fr; min-height: 0; align-content: start; gap: 14px; padding-top: 12px; }
  .gh-btn { min-height: 0; flex-direction: row; align-items: center; text-align: left; padding: 18px 14px 16px; gap: 14px; }
  .gh-art, .gh-art .gift-svg { width: 80px; height: 80px; }
  .gh-art .pass-mark, .gh-art .gh-mark { width: 74px; height: 74px; }
  .gh-text { align-items: flex-start; gap: 5px; }
  .gh-text { padding-right: 30px; }
  .gh-text > b { font-size: 23px; }
  .gh-text em { display: none; }
  .gh-bar { width: 100%; }
}
@media (min-width: 900px) { .gift-hub { max-width: 920px; margin: 0 auto; gap: 26px; } .gh-btn { min-height: 460px; padding-top: 36px; } .gh-art, .gh-art .gift-svg { width: 176px; height: 176px; } .gh-art .pass-mark, .gh-art .gh-mark { width: 156px; height: 156px; } .gh-text > b { font-size: 38px; } .gh-bar { width: 220px; } }

/* ---------- the back line over a view ---------- */
.gift-back { display: flex; align-items: center; gap: 12px; padding: 10px 14px 6px; }
.gift-back .btn { --gk: transparent; display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px 8px 10px; min-height: 34px; color: #e8dfcd; font: 400 15px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; }
.gift-back .btn svg { width: 6px; height: 8px; transform: scale(1.5); }
.gift-back b { font: 400 18px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: #f27661; }

/* ---------- the calendar ---------- */
.gift-cal { padding: 6px 14px 24px; max-width: 980px; margin: 0 auto; }
.gc-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; padding: 8px 0 12px; border-bottom: 2px solid #0b0b0b; box-shadow: 0 2px 0 #5a4d4044; }
.gc-title small { font: 400 12px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: #f27661; }
.gc-title h2 { margin: 4px 0 5px; font: 400 30px/.95 var(--display); letter-spacing: .04em; text-transform: uppercase; color: #fff; text-shadow: 0 2px 0 #000; }
.gc-title p { margin: 0; font-size: 12.5px; line-height: 1.35; color: #cfc6b6; }
.gc-stat { display: flex; gap: 10px; flex: none; padding: 0 2px 4px; }
.gc-stat span { --gk: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; width: 58px; height: 54px; }
.gc-stat b { font: 400 26px/1 var(--display); color: #ffe08a; font-variant-numeric: tabular-nums; }
.gc-stat small { font: 400 10.5px/1 var(--display); letter-spacing: .1em; text-transform: uppercase; color: #b9ad9a; }
.gc-note { margin: 12px 0 0; padding: 7px 10px; font-size: 12.5px; color: #e8dfcd; background: #2a1517; box-shadow: inset 4px 0 0 #c8202a, 0 0 0 2px #0b0b0b; }
.gc-next { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; margin: 14px 0 2px; min-height: 46px; }
.gc-next small { font: 400 13px/1 var(--display); letter-spacing: .06em; padding: 2px 6px; background: #0b0b0b66; }
.gc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 16px; }
@media (min-width: 600px) { .gc-grid { grid-template-columns: repeat(6, 1fr); gap: 12px; } }
@media (min-width: 900px) { .gc-grid { grid-template-columns: repeat(10, 1fr); } }
.gc-cell { --gk: #5a4d40; position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; aspect-ratio: 1 / 1.16; padding: 4px 3px 8px; color: #f2eee6; overflow: hidden; }
button.gc-cell { cursor: pointer; }
button.gc-cell:active { transform: translateY(2px); box-shadow: 0 0 0 2px #0b0b0b, 0 2px 0 2px #050505; }
.gc-cell .gift-svg { position: absolute; left: 12%; top: 14%; width: 76%; height: 66%; }
/* the day: a small tab plate in the top left corner */
.gc-day { position: absolute; top: 0; left: 0; min-width: 20px; height: 18px; padding: 0 4px; z-index: 1; background: #0b0b0b; font: 400 14px/19px var(--display); color: #e8dfcd; text-align: center; font-variant-numeric: tabular-nums; }
.gc-cell.ready { --gk: #d9a441; --gl: #6a4a1e; --gm: #2e1d12; --gd: #160d08; box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 3px #d9a44166, 0 4px 0 2px #050505; }
.gc-cell.ready .gc-day { background: #d9a441; color: #0b0b0b; }
.gc-new { position: relative; z-index: 1; padding: 2px 6px 1px; background: linear-gradient(180deg, #ed987f 0 1px, #c9383c 1px calc(100% - 2px), #8a1a1e calc(100% - 2px)); box-shadow: 0 0 0 1px #0b0b0b, 0 2px 0 1px #050505;
  font: 400 12px/1.15 var(--display); font-style: normal; letter-spacing: .1em; text-transform: uppercase; transform: rotate(-3deg); }
.gc-cell.locked { --gk: #3a342c; --gl: #3a362f; --gm: #1b1916; --gd: #0f0e0c; }
.gc-cell.locked .gift-svg { filter: grayscale(.9) brightness(.42) contrast(1.1); }
.gc-clock, .gc-date { position: relative; z-index: 1; font: 400 12px/1 var(--display); font-style: normal; letter-spacing: .06em; text-transform: uppercase; color: #a79f92; background: #0b0b0b; padding: 3px 5px 2px; font-variant-numeric: tabular-nums; }
.gc-clock { color: #ffe08a; box-shadow: 0 0 0 1px #d9a44188; }
.gc-cell.got { --gk: var(--rc, #5a4d40); }
.gc-cell.got .gc-day { background: var(--rc, #5a4d40); color: #0b0b0b; }
.gc-plate { position: absolute; left: 6%; right: 6%; top: 16%; bottom: 28%; display: grid; place-items: center; background: radial-gradient(circle at 50% 60%, color-mix(in srgb, var(--rc, #d9a441) 28%, transparent), transparent 70%); }
.gc-plate img { width: 100%; height: 100%; object-fit: contain; }
.gc-ph .wi { width: 26px; height: 26px; }
.gc-name { position: relative; max-width: 100%; padding: 0 2px; font: 400 10.5px/1.05 var(--display); letter-spacing: .03em; text-transform: uppercase; text-align: center; color: #f2eee6; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.gc-foot { margin: 16px 0 0; padding: 8px 10px 7px; text-align: center; font: 400 15px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #b9ad9a; background: #0b0b0b55; box-shadow: 0 0 0 2px #0b0b0b; }
.gc-foot b { font: inherit; color: #ffe08a; font-variant-numeric: tabular-nums; }
@media (max-width: 380px) { .gc-grid { gap: 8px; } .gc-title h2 { font-size: 26px; } .gc-stat span { width: 52px; } }

/* a waiting present hops now and then in three pixel steps, each a little out of step with its neighbours */
.gift-svg.wob { transform-origin: 50% 92%; animation: g-wob 3.4s steps(1, end) infinite; }
.gift-svg.wob.w1 { animation-delay: -1.1s; } .gift-svg.wob.w2 { animation-delay: -2.3s; }
@keyframes g-wob { 0%, 72%, 100% { transform: none; } 76% { transform: rotate(-5deg); } 80% { transform: rotate(4deg) translateY(-2px); } 84% { transform: rotate(-2deg); } 88% { transform: none; } }

/* ---------- the present up close ---------- */
.gift-sheet { text-align: center; --rc: #d9a441; }
.gs-kick { display: block; width: max-content; max-width: 100%; margin: 0 auto; padding: 4px 9px 3px; background: #0b0b0b; font: 400 12px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: #f27661; }
.gift-sheet h2 { margin: 8px 0 4px; font: 400 30px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; text-shadow: 0 2px 0 #000; }
.gs-line { margin: 0 auto; max-width: 34ch; font-size: 13.5px; line-height: 1.35; color: #cfc6b6; min-height: 1.35em; text-wrap: balance; }
.gs-stage { --gk: var(--rc); position: relative; height: 240px; margin: 14px 2px 10px; display: grid; place-items: center; overflow: hidden; }
.gs-present { background: none; border: 0; padding: 0; width: 192px; height: 192px; cursor: grab; touch-action: none; }
.gs-present .gift-svg { width: 100%; height: 100%; overflow: visible; }
.gs-light { position: absolute; inset: 0; margin: auto; width: 300px; height: 300px; opacity: 0; pointer-events: none;
  background: repeating-conic-gradient(from 0deg, color-mix(in srgb, var(--rc) 50%, transparent) 0 8deg, transparent 8deg 22deg); -webkit-mask: radial-gradient(circle, #000 16%, transparent 66%); mask: radial-gradient(circle, #000 16%, transparent 66%); }
.gift-sheet.lit .gs-light { opacity: 1; animation: gs-spin 14s steps(56) infinite; }
@keyframes gs-spin { to { transform: rotate(360deg); } }
.gs-msg { min-height: 1.3em; margin: 4px 0 12px; font: 400 16px/1.2 var(--display); letter-spacing: .06em; text-transform: uppercase; color: #ffe08a; }
/* the buttons: one row of equal plates */
.gs-row { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; max-width: 420px; margin: 0 auto; }
.gs-row .btn { min-width: 0; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; margin: 0; }
.gs-row .btn.ghost { color: #e8dfcd; background: linear-gradient(180deg, #57503f 0 2px, #322e27 2px calc(100% - 4px), #1d1a16 calc(100% - 4px)); box-shadow: 0 0 0 2px #0b0b0b, 0 3px 0 2px #050505; border: 0; }
.gs-row .btn.ghost:active { transform: translateY(2px); box-shadow: 0 0 0 2px #0b0b0b, 0 1px 0 2px #050505; }
.gs-row .btn small { display: block; font-size: 11px; letter-spacing: .06em; opacity: .85; }
/* the shake: squash and stretch, the lid hopping on its bow */
.gift-svg .g-box, .gift-svg .g-lid { transform-box: fill-box; transform-origin: 50% 100%; }
.gift-svg.shk { transform-origin: 50% 92%; animation: g-shk .42s cubic-bezier(.3,.6,.4,1); }
.gift-svg.shk2 { transform-origin: 50% 92%; animation: g-shk2 .42s cubic-bezier(.3,.6,.4,1); }
.gift-svg.shk .g-lid, .gift-svg.shk2 .g-lid { animation: g-hop .42s ease-out; }
@keyframes g-shk { 0% { transform: none; } 15% { transform: rotate(-11deg) scale(1.06, .9); } 35% { transform: rotate(9deg) scale(.94, 1.08) translateY(-6px); } 55% { transform: rotate(-6deg) scale(1.03, .96); } 75% { transform: rotate(3deg); } 100% { transform: none; } }
@keyframes g-shk2 { 0% { transform: none; } 15% { transform: rotate(10deg) scale(1.05, .92); } 35% { transform: rotate(-9deg) scale(.95, 1.07) translateY(-7px); } 55% { transform: rotate(5deg) scale(1.02, .97); } 75% { transform: rotate(-2deg); } 100% { transform: none; } }
@keyframes g-hop { 0%, 100% { transform: none; } 30% { transform: translateY(-7px) rotate(-5deg); } 55% { transform: translateY(-2px) rotate(4deg); } }

/* the unwrap: the ribbon slips off, the lid flies, the box sinks away, the plate rises */
.gift-svg.untie .g-rib, .gift-svg.untie .g-bow { transition: opacity .25s, transform .3s; opacity: 0; transform: translateY(-10px) scaleX(.4); }
.gift-svg.lidoff .g-lid { transition: transform .45s cubic-bezier(.2,.8,.3,1), opacity .45s; transform: translate(26px, -70px) rotate(32deg); opacity: 0; }
.gift-svg.lidoff .g-box { transition: transform .5s .2s ease-in, opacity .5s .2s; transform: translateY(30px) scale(.9); opacity: 0; }
.gs-plate { position: absolute; inset: 0; margin: auto; width: 250px; height: 170px; display: grid; place-items: center; padding: 22px 8px 8px; box-sizing: border-box;
  background: linear-gradient(var(--rc), var(--rc)) 4px 4px / 8px 2px no-repeat, linear-gradient(var(--rc), var(--rc)) 4px 4px / 2px 8px no-repeat,
    linear-gradient(var(--rc), var(--rc)) calc(100% - 4px) calc(100% - 4px) / 8px 2px no-repeat, linear-gradient(var(--rc), var(--rc)) calc(100% - 4px) calc(100% - 4px) / 2px 8px no-repeat,
    radial-gradient(ellipse at 50% 58%, color-mix(in srgb, var(--rc) 24%, transparent), transparent 70%), linear-gradient(180deg, #3a352c 0 2px, #1d1a16 2px calc(100% - 4px), #121010 calc(100% - 4px));
  box-shadow: 0 0 0 2px #0b0b0b, 0 0 0 4px var(--rc), 0 6px 0 4px #050505; }
.gs-plate[hidden] { display: none; }
.gs-plate img { width: 100%; height: 100%; object-fit: contain; }
.gs-plate.rise { animation: gs-rise .5s steps(6) both; }
@keyframes gs-rise { from { transform: translateY(46px) scale(.7); opacity: 0; } to { transform: none; opacity: 1; } }
.gs-tag { position: absolute; left: 0; top: 0; padding: 3px 8px 2px; background: var(--rc); color: #0b0b0b; font: 400 13px/1.1 var(--display); letter-spacing: .1em; text-transform: uppercase; box-shadow: 2px 2px 0 #0b0b0b; }
.gs-ph .wi { width: 56px; height: 56px; }
.gift-sheet.opening .gs-present { cursor: default; pointer-events: none; }
.gift-sheet.opening .gs-row .btn[data-gs="shake"] { display: none; }

/* stills: calm and reduced motion */
body.calm .gift-svg, body.calm .gs-light, body.calm .gs-plate, body.calm .hol-badge,
body.calm .gift-svg .g-lid, body.calm .gift-svg .g-box, body.calm .gift-svg .g-rib, body.calm .gift-svg .g-bow { animation: none !important; transition: none !important; }
@media (prefers-reduced-motion: reduce) {
  .gift-svg, .gs-light, .gs-plate, .hol-badge, .gift-svg .g-lid, .gift-svg .g-box, .gift-svg .g-rib, .gift-svg .g-bow { animation: none !important; transition: none !important; }
}
