import geist400 from '@fontsource/geist-sans/files/geist-sans-latin-400-normal.woff2?url'; import geist500 from '@fontsource/geist-sans/files/geist-sans-latin-500-normal.woff2?url'; import geist600 from '@fontsource/geist-sans/files/geist-sans-latin-600-normal.woff2?url'; import { PDF_MARKDOWN_CSS } from './pdfMarkdown'; /* * The trip PDF's stylesheet. A print document has a fixed palette rather than the * reader's scheme, so its colours are declared once, as the custom properties at the * top, and every rule below names them. The type follows the app: Poppins for words, * Geist for figures, times and the small capitals. * * Every switch of the preview is one class on
(pdfPreview.ts), so turning one * over is instant and needs no rebuild: * pdf-flow days run on instead of each starting a page * pdf-large-text larger type and darker greys * pdf-no-transport-notes the notes of flights, trains and rentals left out * pdf-no-photos no photos on the places and stays * pdf-no-overview no route map, day overview or booking list * pdf-no-coords no coordinates under the addresses * pdf-no-details no contact lines, opening hours or companions */ export function tripPdfCss(): string { return ` @font-face { font-family: 'Poppins'; font-style: normal; font-weight: 400; src: url('/fonts/Poppins-Regular.ttf') format('truetype'); } @font-face { font-family: 'Poppins'; font-style: italic; font-weight: 400; src: url('/fonts/Poppins-Italic.ttf') format('truetype'); } @font-face { font-family: 'Poppins'; font-style: normal; font-weight: 500; src: url('/fonts/Poppins-Medium.ttf') format('truetype'); } @font-face { font-family: 'Poppins'; font-style: normal; font-weight: 600; src: url('/fonts/Poppins-SemiBold.ttf') format('truetype'); } @font-face { font-family: 'Poppins'; font-style: normal; font-weight: 700; src: url('/fonts/Poppins-Bold.ttf') format('truetype'); } @font-face { font-family: 'Geist PDF'; font-weight: 400; src: url('${geist400}') format('woff2'); } @font-face { font-family: 'Geist PDF'; font-weight: 500; src: url('${geist500}') format('woff2'); } @font-face { font-family: 'Geist PDF'; font-weight: 600; src: url('${geist600}') format('woff2'); } :root { --ink: #17171c; --ink-2: #3e3e47; --ink-3: #6a6a74; --ink-4: #9a9aa4; --hair: #e7e5e0; --paper: #ffffff; --wash: #f6f5f2; --wash-2: #eeede8; --night: #141418; --shade: rgba(10, 10, 14, 0.82); --shade-mid: rgba(10, 10, 14, 0.35); --shade-none: rgba(10, 10, 14, 0); --glass: rgba(255, 255, 255, 0.13); --glass-edge: rgba(255, 255, 255, 0.22); --glass-dark: rgba(14, 14, 18, 0.42); --on-night: rgba(255, 255, 255, 0.78); --on-night-2: rgba(255, 255, 255, 0.56); --gold: #b7791f; --day: var(--ink); --t: 1; --sans: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif; --num: 'Geist PDF', 'Poppins', system-ui, sans-serif; --gutter: 14mm; } body.pdf-large-text { --t: 1.3; --ink-2: #2b2b33; --ink-3: #4b4b55; --ink-4: #62626c; } @page { size: A4; margin: 12mm 0 14mm; } @page :first { margin: 0; } *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; } html, body { background: var(--paper); } body { font-family: var(--sans); color: var(--ink); font-size: calc(9.5px * var(--t)); line-height: 1.5; -webkit-print-color-adjust: exact; print-color-adjust: exact; } img { display: block; } svg { flex-shrink: 0; } .num { font-family: var(--num); font-variant-numeric: tabular-nums; } .eyebrow { font-family: var(--num); font-size: calc(7.5px * var(--t)); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); } .page-break { break-before: page; } @media screen { html { background: var(--wash-2); } .doc { max-width: 210mm; margin: 0 auto; background: var(--paper); box-shadow: 0 0 0 1px var(--hair); } } /* ── Cover ───────────────────────────────────────────────── */ .cover { position: relative; height: 297mm; overflow: hidden; background: var(--night); color: var(--paper); break-after: page; } .cover-bg { position: absolute; inset: 0; background-size: cover; background-position: center; } .cover-plain .cover-bg { background: radial-gradient(120% 80% at 85% 10%, var(--ink-2) 0%, var(--night) 60%); } .cover-shade { position: absolute; inset: 0; background: linear-gradient(180deg, var(--shade-mid) 0%, var(--shade-none) 24%, var(--shade-none) 40%, var(--shade) 100%); } .cover-top { position: absolute; inset-block-start: 14mm; inset-inline: var(--gutter); display: flex; align-items: center; justify-content: space-between; } .cover-top img { height: 22px; } .cover-top .eyebrow { color: var(--on-night); } .cover-body { position: absolute; inset-inline: var(--gutter); inset-block-end: 16mm; } .cover-dates { font-family: var(--num); font-size: 11px; font-weight: 500; letter-spacing: 0.04em; color: var(--on-night); } .cover-title { font-size: 46px; font-weight: 700; line-height: 1.04; letter-spacing: -0.02em; margin: 6px 0 10px; } .cover-desc { max-width: 135mm; font-size: 12px; line-height: 1.6; color: var(--on-night); } .cover-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(30mm, 1fr)); gap: 8px; margin-block-start: 10mm; } .cover-stat { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: 16px; padding: 12px 14px 11px; -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); } .cover-stat-num { font-family: var(--num); font-size: 20px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; } .cover-stat-lbl { font-family: var(--num); font-size: 7.5px; font-weight: 500; letter-spacing: 0.14em; text-transform: uppercase; color: var(--on-night-2); margin-block-start: 5px; } /* ── Overview: route map, the days at a glance, bookings and stays ─────── */ .overview { padding: 2mm var(--gutter) 0; } .pdf-no-overview .overview { display: none; } .sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-block-end: 4mm; } .sec-title { font-size: calc(17px * var(--t)); font-weight: 600; letter-spacing: -0.01em; } .sec-block { break-inside: avoid; margin-block-end: 9mm; } .trip-map { margin-block-end: 9mm; } .trip-map-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-block-end: 4mm; } .trip-map-title { font-size: calc(17px * var(--t)); font-weight: 600; letter-spacing: -0.01em; } .trip-map-total { font-family: var(--num); font-size: calc(9px * var(--t)); font-weight: 600; color: var(--ink-2); background: var(--wash); border-radius: 99px; padding: 4px 10px; } .trip-map-note { font-size: 9px; font-weight: 600; color: var(--gold); margin: -2mm 0 3mm; } .trip-map-svg { width: 100%; height: auto; border-radius: 16px; border: 1px solid var(--hair); display: block; overflow: hidden; } .trip-map-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px 14px; margin-block-start: 4mm; } .trip-map-leg { display: flex; align-items: center; gap: 6px; min-width: 0; font-size: calc(8.5px * var(--t)); color: var(--ink-2); } .trip-map-leg-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .trip-map-dot { width: 8px; height: 8px; border-radius: 50%; } .trip-map-leg-dist { font-family: var(--num); color: var(--ink-4); white-space: nowrap; } .trip-map-credit { font-size: 7px; color: var(--ink-4); margin-block-start: 3mm; } .glance { width: 100%; border-collapse: collapse; font-size: calc(8.5px * var(--t)); } .glance th { font-family: var(--num); font-size: calc(7px * var(--t)); font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-4); text-align: start; padding: 0 6px 6px; border-block-end: 1px solid var(--hair); } .glance td { padding: 6px; border-block-end: 1px solid var(--wash-2); vertical-align: top; color: var(--ink-2); } .glance tr { break-inside: avoid; } .glance-day { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 6px; background: var(--day); color: var(--paper); font-family: var(--num); font-weight: 600; font-size: calc(8px * var(--t)); } .glance-title { color: var(--ink); font-weight: 500; } .glance .num, .glance-end { text-align: end; white-space: nowrap; } .ledger { display: grid; gap: 5px; } .ledger-row { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px; border: 1px solid var(--hair); border-radius: 12px; break-inside: avoid; } .ledger-icon { width: 26px; height: 26px; border-radius: 8px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--kind) 14%, var(--paper)); color: var(--kind); } .ledger-title { font-weight: 600; font-size: calc(9.5px * var(--t)); } .ledger-sub { font-size: calc(8px * var(--t)); color: var(--ink-3); } .ledger-when { font-family: var(--num); font-size: calc(8px * var(--t)); color: var(--ink-3); text-align: end; white-space: nowrap; } /* ── Day ─────────────────────────────────────────────────── */ /* A real