Skip to content

Commit 8d2c438

Browse files
fix: rebalance mobile certificate scale and spacing
Tune viewport-based scaling to a readable premium preview size on phones, and clean up old CSS scale overrides to prevent conflicting behavior. Made-with: Cursor
1 parent be0295f commit 8d2c438

2 files changed

Lines changed: 8 additions & 11 deletions

File tree

src/app/globals.css

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,26 +596,18 @@ a.subpage-inline-mail {
596596
}
597597

598598

599-
/* ── Certificate UI scale (fixed 794x1123 render scaled visually) ── */
600-
:root { --cert-ui-scale: 0.604; }
601-
602-
@media (max-width: 640px) {
603-
/* Scale only the fixed canvas visually; layout stays pixel-locked. */
604-
:root { --cert-ui-scale: clamp(0.20, calc((100vw - 148px) / 794), 0.30); }
605-
}
606-
607599
/* ── Mobile ── */
608600

609601
@media (max-width: 640px) {
610602
/* Page padding */
611603
main { padding-left: 16px !important; padding-right: 16px !important; }
612604
.page-shell-main { padding-top: calc(env(safe-area-inset-top) + 28px); }
613605

614-
/* Certificate: handled by CSS var --cert-ui-scale */
606+
/* Certificate wrapper spacing only; scale is handled in CertificateCard.tsx */
615607
.certificate-scroll-zone {
616608
width: 100%;
617609
margin-left: 0;
618-
padding: 14px 28px 0;
610+
padding: 12px 20px 0;
619611
box-sizing: border-box;
620612
overflow-x: hidden;
621613
}

src/components/CertificateCard.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ function clamp(value: number, min: number, max: number) {
2121

2222
function getCertificateUiScale(viewportWidth: number) {
2323
if (viewportWidth > 900) return DESKTOP_CERT_UI_SCALE
24-
return clamp((viewportWidth - 170) / CERT_RENDER_WIDTH, 0.18, 0.32)
24+
if (viewportWidth <= 640) {
25+
// Mobile: keep certificate intentionally smaller but still comfortably readable.
26+
return clamp((viewportWidth * 0.76) / CERT_RENDER_WIDTH, 0.30, 0.40)
27+
}
28+
// Tablet / small desktop: gradual ramp to desktop size.
29+
return clamp((viewportWidth * 0.72) / CERT_RENDER_WIDTH, 0.42, DESKTOP_CERT_UI_SCALE)
2530
}
2631

2732
const SOCIAL_BG = '#E8E8E8'

0 commit comments

Comments
 (0)