#import "metadata.typ": author-text, format-date #import "color/rose-pine-dawn.typ": rose-pine-dawn as dawn #import "color/rose-pine-moon.typ": rose-pine-moon as moon #let code-theme = moon.codeThemePath #let rule(length: 100%, fade-both: false) = line( length: length, stroke: 1pt + if fade-both { gradient.linear( (dawn.rose.transparentize(100%), 0%), (dawn.rose, 15%), (dawn.rose, 85%), (dawn.rose.transparentize(100%), 100%), angle: 0deg, ) } else { gradient.linear( (dawn.rose, 0%), (dawn.rose, 55%), (dawn.rose.transparentize(100%), 65%), (dawn.rose.transparentize(100%), 100%), angle: 0deg, ) }, ) #let pdf-header(ctx) = { let info = ctx.page set par(spacing: 9pt) if info.title != none { text(size: 28pt, weight: "bold", fill: dawn.text, info.title) } if info.subtitle != none [ #parbreak() #text(size: 14pt, fill: dawn.subtle, info.subtitle) ] v(1em) if info.by.len() > 0 [ #parbreak() #text(size: 12pt, fill: dawn.subtle, [#author-text(info.by)]) ] if info.date != none [ #parbreak() #text(size: 12pt, fill: dawn.iris, format-date(info.date)) ] if info.description != none [ #parbreak() #v(1em) #info.description ] rule() } #let page-band(ctx, top: true) = context { set text(size: 8pt, fill: dawn.subtle) let info = ctx.page let title = if info.title == none { ctx.site.title } else { info.title } let url = ctx.page.at("url", default: none) let author = info.author.join(", ") let date = if info.date != none { format-date(info.date) } else { [] } let details = grid( columns: (1fr, auto), column-gutter: 12pt, align: (left, right), if top { if url == none { title } else { link(url, title) } } else { author }, if top { date } else { counter(page).display("1") }, ) if top { stack(dir: ttb, spacing: 6pt, details, rule(fade-both: true)) } else { stack(dir: ttb, spacing: 6pt, rule(fade-both: true), details) } } #let pdf-layout(ctx, body) = [ #show raw.where(block: true): set raw(theme: code-theme) #set text(font: "Montserrat", size: 11pt, fill: dawn.text) #show math.equation: set text(font: "Fira Math", fallback: false) #show raw.where(block: true): it => block( width: 100%, fill: moon.base, inset: 10pt, radius: 6pt, breakable: true, )[ #set text(fill: moon.text) #it ] #show heading: set text(size: 1.1em) #show heading.where(depth: 1): it => [ #it #block(above: 0pt, below: 8pt, rule(length: 55%)) ] #set page( margin: 1in, fill: dawn.base, header: page-band(ctx), footer: page-band(ctx, top: false), paper: "us-letter", ) #(ctx.site.theme.header)(ctx) #body ]