package main import ( "bytes" "context" "fmt" "git.dev.alexdunmow.com/block/core/templates" ) // MagazineBoldEmailWrapper wraps body content in the Magazine Bold email template. // The template is a 600px paper-toned table with a PP Editorial New wordmark, // an ink hairline, body in Inter 16/24, and a mono colophon strip. func MagazineBoldEmailWrapper(body string, emailCtx templates.EmailContext) string { var buf bytes.Buffer _ = magazineBoldEmailTemplate(emailCtx, body).Render(context.Background(), &buf) return buf.String() } // Hex defaults map onto the paper-pink light preset so wallets / clients that // don't ship custom colours still resolve to the brand's paper tone. // Spec §4 paper-pink light: background `38 30% 96%` → ~#F7F2EB // foreground `0 0% 8%` → ~#141414 // border `0 0% 88%` → ~#E0E0E0 // muted `38 20% 92%`→ ~#EEE9E0 // mutedFg `0 0% 40%` → ~#666666 // accent `330 95% 58%` → ~#F0298A func mbEmailBg(ctx templates.EmailContext) string { if ctx.Colors.Background != "" { return ctx.Colors.Background } return "#F7F2EB" } func mbEmailFg(ctx templates.EmailContext) string { if ctx.Colors.Foreground != "" { return ctx.Colors.Foreground } return "#141414" } func mbEmailMuted(ctx templates.EmailContext) string { if ctx.Colors.Muted != "" { return ctx.Colors.Muted } return "#EEE9E0" } func mbEmailMutedFg(ctx templates.EmailContext) string { if ctx.Colors.MutedForeground != "" { return ctx.Colors.MutedForeground } return "#666666" } func mbEmailBorder(ctx templates.EmailContext) string { if ctx.Colors.Border != "" { return ctx.Colors.Border } return "#E0E0E0" } func mbEmailCard(ctx templates.EmailContext) string { if ctx.Colors.Card != "" { return ctx.Colors.Card } return "#FFFFFF" } // mbEmailDisplayStack is the serif fallback the wordmark falls back to in // clients that strip @font-face (Outlook 365 web). System serifs only. const mbEmailDisplayStack = `'PP Editorial New', Georgia, 'Times New Roman', serif` // mbEmailBodyStack is the sans fallback used for body copy in clients that // strip @font-face. const mbEmailBodyStack = `'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif` // mbEmailMonoStack is the mono fallback used for the colophon strip. const mbEmailMonoStack = `'JetBrains Mono', 'Courier New', Courier, monospace` // mbEmailStyleBody styles the outer body tag. func mbEmailStyleBody(ctx templates.EmailContext) string { return fmt.Sprintf("background-color: %s; margin: 0; padding: 0; font-family: %s;", mbEmailBg(ctx), mbEmailBodyStack) } func mbEmailStyleHeader(ctx templates.EmailContext) string { return fmt.Sprintf("padding: 32px 40px; background-color: %s; border-bottom: 1px solid %s;", mbEmailCard(ctx), mbEmailBorder(ctx)) } func mbEmailStyleWordmark(ctx templates.EmailContext) string { return fmt.Sprintf("margin: 0; font-family: %s; font-style: italic; font-weight: 200; font-size: 42px; line-height: 1; letter-spacing: -0.02em; color: %s;", mbEmailDisplayStack, mbEmailFg(ctx)) } func mbEmailStyleBodyContent(ctx templates.EmailContext) string { return fmt.Sprintf("padding: 40px 48px; background-color: %s; color: %s; font-family: %s; font-size: 16px; line-height: 24px;", mbEmailCard(ctx), mbEmailFg(ctx), mbEmailBodyStack) } func mbEmailStyleColophon(ctx templates.EmailContext) string { return fmt.Sprintf("padding: 24px 48px; background-color: %s; border-top: 1px solid %s; font-family: %s; font-size: 12px; line-height: 18px; color: %s; letter-spacing: 0.08em; text-transform: uppercase;", mbEmailMuted(ctx), mbEmailBorder(ctx), mbEmailMonoStack, mbEmailMutedFg(ctx)) }