/* BADGES (goals/badges.js): a goal finished; its medal, its card of stats, and its certificate */
.gb { position: fixed; inset: 0; z-index: 2147483400; display: grid; place-items: center; padding: 16px; overflow-y: auto; background: rgba(20, 16, 12, 0.5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); opacity: 0; transition: opacity 0.25s ease; font-family: var(--sans); }
.gb[hidden], .gb-cert-w[hidden] { display: none; }
.gb.is-on { opacity: 1; }
html.gb-open, html.gb-open body { overflow: hidden; }
.gb-card { position: relative; width: 100%; max-width: 400px; margin: auto; padding: 22px 18px 16px; border-radius: 24px; background: linear-gradient(180deg, #FFF8E4 0%, var(--bg-raised) 40%); color: var(--ink); text-align: center; box-shadow: 0 0 0 1px rgba(176, 122, 38, 0.35), 0 30px 60px -20px rgba(0, 0, 0, 0.6); transform: translateY(14px) scale(0.95); transition: transform 0.4s cubic-bezier(0.34, 1.4, 0.64, 1); }
body.site-dark .gb-card { background: linear-gradient(180deg, #3A2F1A 0%, var(--bg-raised) 40%); }
.gb.is-on .gb-card { transform: none; }
.gb-x { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; padding: 0; border: none; border-radius: 50%; background: color-mix(in srgb, var(--ink) 7%, transparent); color: var(--ink); font: 22px/1 var(--sans); cursor: pointer; }
.gb-top { position: relative; display: grid; place-items: center; height: 100px; }
.gb-medal-big { width: 74px; height: 89px; filter: drop-shadow(0 8px 12px rgba(120, 80, 20, 0.38)); animation: gb-medal-in 0.75s cubic-bezier(0.34, 1.5, 0.64, 1) both 0.1s; }
@keyframes gb-medal-in { from { transform: translateY(-16px) rotate(-16deg) scale(0.4); opacity: 0; } to { transform: none; opacity: 1; } }
.gb-burst { position: absolute; left: 50%; top: 40%; width: 0; height: 0; }
.gb-burst i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 2px; background: var(--c); opacity: 0; transform: rotate(var(--a)); animation: gb-burst 1s ease-out both; animation-delay: calc(0.2s + var(--d)); }
.gb-burst i:nth-child(odd) { width: 6px; height: 6px; border-radius: 50%; }
@keyframes gb-burst { 0% { opacity: 1; transform: rotate(var(--a)) translateY(0) scale(1); } 100% { opacity: 0; transform: rotate(var(--a)) translateY(-78px) scale(0.6); } }
.gb-k { display: block; margin-top: 2px; font: 800 11px var(--sans); letter-spacing: 0.16em; text-transform: uppercase; color: #A06E00; }
body.site-dark .gb-k { color: #E3AE45; }
.gb-card h3 { margin: 4px 0 4px; font: italic 400 25px/1.2 var(--serif); }
.gb-goal { margin: 0 0 14px; font: 14.5px/1.5 var(--sans); color: var(--muted); }
.gb-goal b { color: var(--ink); }
.gb-tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 0 10px; }
.gb-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 8px 10px; border-radius: 16px; background: color-mix(in srgb, #E3AE45 13%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, #E3AE45 30%, transparent); opacity: 0; transform: translateY(8px); animation: gb-tile 0.45s ease-out both; animation-delay: calc(0.35s + var(--i) * 0.08s); }
@keyframes gb-tile { to { opacity: 1; transform: none; } }
.gb-tile:last-child:nth-child(odd) { grid-column: span 2; }
.gb-tile b { font: 700 26px/1.1 var(--serif); color: #A06E00; font-variant-numeric: tabular-nums; }
body.site-dark .gb-tile b { color: #E9C46A; }
.gb-tile span { font: 600 12px/1.3 var(--sans); }
.gb-tile small { font-size: 11.5px; color: var(--muted); }
.gb-when { margin: 0 0 10px; font: italic 14px var(--serif); color: var(--muted); }
.gb-verse { margin: 0 0 14px; padding: 10px 12px; border-radius: 12px; background: color-mix(in srgb, var(--ink) 4%, transparent); font: italic 14px/1.5 var(--serif); }
.gb-verse cite { display: block; margin-top: 4px; font: normal 700 12px var(--sans); color: var(--muted); }
.gb-go, .gb-ok { display: block; width: 100%; margin-top: 8px; padding: 12px 14px; border-radius: 999px; font: 700 15px var(--sans); cursor: pointer; }
.gb-go { border: none; background: linear-gradient(135deg, #E9B850, #C68F2E); color: #2A1E08; }
.gb-ok { border: 1px solid var(--rule); background: var(--bg); color: var(--ink); }
@media (prefers-reduced-motion: reduce) { .gb, .gb-card { transition: none; } .gb-medal-big, .gb-burst i, .gb-tile { animation: none; opacity: 1; transform: none; } .gb-burst { display: none; } }

/* in Goals: the shelf of badges, and a small medal on a goal's ring */
.gb-medal { width: 30px; height: 36px; }
.gb-shelf { margin: 0 0 16px; padding: 12px 14px; border-radius: 18px; background: linear-gradient(135deg, #FFF6DC, #F5DC9A); color: #3A2A0A; box-shadow: inset 0 0 0 1px rgba(176, 122, 38, 0.35); }
body.site-dark .gb-shelf { background: linear-gradient(135deg, #3A2F1A, #4A3A1C); color: var(--ink); }
.gb-shelf-h { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.gb-shelf-h b { font: 800 11px var(--sans); letter-spacing: 0.14em; text-transform: uppercase; }
.gb-shelf-h small { font: 700 12px var(--sans); opacity: 0.65; }
.gb-shelf-r { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.gb-shelf-b { flex: none; display: flex; flex-direction: column; align-items: center; gap: 4px; width: 86px; padding: 4px 2px; border: none; background: none; color: inherit; cursor: pointer; }
.gb-shelf-b .gb-medal { width: 40px; height: 48px; filter: drop-shadow(0 3px 4px rgba(120, 80, 20, 0.3)); transition: transform 0.15s ease; }
.gb-shelf-b:hover .gb-medal { transform: translateY(-2px) rotate(-4deg); }
.gb-shelf-b span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font: 600 11px/1.25 var(--sans); text-align: center; }
.gl-card-ring, .gl-goal-ring { position: relative; }
.gb-mini { position: absolute; right: -8px; bottom: -10px; display: block; cursor: pointer; }
.gb-mini .gb-medal { width: 20px; height: 24px; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35)); }
.gl-goal-ring .gb-mini { right: -6px; bottom: -8px; }
.gl-goal-ring .gb-mini .gb-medal { width: 30px; height: 36px; }

/* the certificate: chosen, then printed (goals/print.js GoalPrint.sheet) */
.gb-cert-w { position: fixed; inset: 0; z-index: 2147483400; display: flex; flex-direction: column; background: var(--bg); color: var(--ink); opacity: 0; transition: opacity 0.2s ease; font-family: var(--sans); }
.gb-cert-w.is-on { opacity: 1; }
.gb-cert-bar { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--bg-raised); border-bottom: 1px solid var(--rule); }
.gb-cert-bar b { flex: 1; font: italic 19px var(--serif); }
.gb-cert-back { min-height: 40px; padding: 0 14px; border: 1px solid var(--rule); border-radius: 999px; background: var(--bg); color: var(--ink); font: 700 14px var(--sans); cursor: pointer; }
.gb-cert-print { min-height: 42px; padding: 0 20px; border: none; border-radius: 999px; background: var(--gold); color: var(--on-gold, #1c1a17); font: 800 15px var(--sans); cursor: pointer; }
.gb-cert-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 16px calc(32px + env(safe-area-inset-bottom)); }
.gb-cert-opts { display: flex; flex-wrap: wrap; gap: 12px; max-width: 760px; margin: 0 auto 16px; }
.gb-cert-f { flex: 1 1 220px; display: block; min-width: 0; }
.gb-cert-f span { display: block; margin-bottom: 6px; font: 700 13px var(--sans); }
.gb-cert-f input, .gb-cert-f select { display: block; width: 100%; min-width: 0; min-height: 46px; box-sizing: border-box; padding: 10px 12px; border: 1.5px solid var(--rule); border-radius: 12px; background: var(--bg-raised); color: var(--ink); font: 16px var(--sans); }
.gb-cert-view { display: grid; justify-items: center; }
.gb-cert-view .gb-cert-page { box-shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.5); }
.gb-cert-page { box-sizing: border-box; padding: 0.4in; background: #fff; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.gb-cert { height: 100%; box-sizing: border-box; padding: 0.12in; border: 3px solid #B07A26; color: #2A241B; font-family: -apple-system, "Segoe UI", system-ui, sans-serif; }
.gb-cert-in { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: space-between; height: 100%; box-sizing: border-box; padding: 0.35in 0.6in 0.3in; border: 1px solid #D8B66A; text-align: center; background: radial-gradient(ellipse at 50% 0%, #FFF8E4 0%, #fff 60%); }
.gb-cert-k { font: 800 10pt sans-serif; letter-spacing: 0.3em; text-transform: uppercase; color: #A06E00; }
.gb-cert h1 { margin: 0.08in 0 0.12in; font: italic 400 34pt/1.1 Georgia, "Times New Roman", serif; color: #6E4A12; }
.gb-cert-l { margin: 0; font: italic 13pt Georgia, serif; color: #6b655c; }
.gb-cert-name { min-width: 5in; margin: 0.06in 0 0.1in; padding: 0 0.2in 0.04in; border-bottom: 1.5px solid #B07A26; font: 600 28pt/1.2 Georgia, serif; color: #2A241B; }
.gb-cert-goal { margin: 0.05in 0 0.04in; font: italic 600 20pt/1.2 Georgia, serif; color: #2A241B; }
.gb-cert-dates { margin: 0; font: 11pt sans-serif; color: #6b655c; }
.gb-cert-top { display: flex; flex-direction: column; align-items: center; }
.gb-cert-mid { display: flex; flex-direction: column; align-items: center; gap: 0.16in; }
.gb-cert-card { display: flex; align-items: center; gap: 0.16in; min-width: 4.2in; padding: 0.12in 0.24in 0.12in 0.14in; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px #E2CC93, 0 6px 14px -8px rgba(120, 80, 20, 0.35); text-align: left; }
.gb-cert-ring svg { display: block; width: 0.75in; height: 0.75in; }
.gb-cert-card > span:last-child { display: flex; flex-direction: column; gap: 0.02in; }
.gb-cert-card small { font: 800 7.5pt sans-serif; letter-spacing: 0.14em; text-transform: uppercase; color: #A06E00; }
.gb-cert-card b { font: italic 600 15pt/1.2 Georgia, serif; color: #2A241B; }
.gb-cert-card em { font: normal 600 9.5pt sans-serif; color: #3E7A4C; }
.gb-cert-stats { display: flex; justify-content: center; gap: 0.18in; }
.gb-cert-stats div { display: flex; flex-direction: column; align-items: center; width: 1.6in; padding: 0.1in 0.06in; border-radius: 10px; background: #FBF1D6; }
.gb-cert-stats b { font: 700 22pt/1.1 Georgia, serif; color: #8C5A10; }
.gb-cert-stats span { font: 600 8.5pt/1.25 sans-serif; color: #4a4339; }
.gb-cert-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 0.3in; width: 100%; }
.gb-cert-sig { display: flex; flex-direction: column; align-items: center; justify-self: start; min-width: 2.2in; }
.gb-cert-sig span { width: 100%; padding-bottom: 0.03in; border-bottom: 1px solid #8f877b; font: 12pt Georgia, serif; }
.gb-cert-sig small { margin-top: 0.03in; font: 8.5pt sans-serif; color: #6b655c; }
.gb-cert-medal { width: 0.95in; height: 1.14in; }
.gb-cert-foot blockquote { justify-self: end; max-width: 2.8in; margin: 0; font: italic 10pt/1.4 Georgia, serif; color: #4a4339; text-align: right; }
.gb-cert-foot cite { display: block; margin-top: 0.03in; font: normal 700 8pt sans-serif; color: #6b655c; }
.gb-cert-credit { position: absolute; left: 0; right: 0; bottom: 0.08in; font: 600 7pt sans-serif; letter-spacing: 0.06em; color: #9a9387; }
@media print { .gp-sheet .gb-cert-page { padding: 0.15in; } } /* (printed: the paper's margin is around it already) */
