diff --git a/client/scripts/rtl-baseline.json b/client/scripts/rtl-baseline.json index 3cf884e2f..78a6ade35 100644 --- a/client/scripts/rtl-baseline.json +++ b/client/scripts/rtl-baseline.json @@ -35,7 +35,6 @@ "components/Map/nightPauseMarker.ts": 4, "components/Map/ratingBadge.ts": 1, "components/Map/switcherRow.ts": 1, - "components/PDF/TripPDF.tsx": 7, "components/PDF/tripMapImage.ts": 1, "components/Packing/PackingListPanelBagCard.tsx": 1, "components/Packing/PackingListPanelCategoryGroup.tsx": 3, diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json index 9edd21dac..f65b81a19 100644 --- a/client/scripts/theme-baseline.json +++ b/client/scripts/theme-baseline.json @@ -72,7 +72,6 @@ "components/Map/ratingBadge.ts": 2, "components/Map/reservationsMapbox.ts": 1, "components/Map/switcherRow.ts": 1, - "components/PDF/TripPDF.tsx": 44, "components/Packing/PackingListPanelBagModal.tsx": 2, "components/Packing/PackingListPanelCategoryGroup.tsx": 5, "components/Packing/PackingListPanelHeader.tsx": 3, diff --git a/client/src/components/PDF/TripPDF.tsx b/client/src/components/PDF/TripPDF.tsx index 087d11ba2..474578de3 100644 --- a/client/src/components/PDF/TripPDF.tsx +++ b/client/src/components/PDF/TripPDF.tsx @@ -18,11 +18,11 @@ import { drawTripRoute, type TripPdfRouteOptions } from './tripPdfRoute' import { fetchExchangeRates } from '../../hooks/useExchangeRates' import { onlyMyPlan, planAssignments } from './pdfScope' import { createPdfMarkdown } from './pdfMarkdown' -import { STRIP_PX, shrinkPdfImages } from './pdfImages' +import { STRIP_PX, bakePdfCover, shrinkPdfImages } from './pdfImages' import { absUrl, escHtml, hexColour, longDateRange, safeImg, shortDate } from './tripPdfHtml' import { bookingIcon, bookingTint, glyph } from './tripPdfIcons' import { bookingItem, bookingLinesHtml, dayHeader, noteItem, photoStrip, placeItem, staysBlock, type PdfBooking, type PdfDayContext } from './tripPdfDay' -import { coverHtml, glanceHtml, ledgerHtml, type CoverStat, type GlanceRow, type LedgerRow } from './tripPdfOverview' +import { COVER_SHADE, coverHtml, glanceHtml, ledgerHtml, type CoverStat, type GlanceRow, type LedgerRow } from './tripPdfOverview' import { tripPdfCss } from './tripPdfStyles' /** A day's colour when the route gave it none: the same palette entry the map would use. */ @@ -291,6 +291,8 @@ export async function downloadTripPDF({ trip, days, places, assignments: allStor }) return [day.id, photos.slice(0, 3)] })) + // The cover photo and its shade as one picture at print size (null: printed as before). + const bakedCover = coverImg ? await bakePdfCover(coverImg, COVER_SHADE, signal).catch(() => null) : null const stripCopies = await shrinkPdfImages([...stripPhotos.values()].flat().map(p => p.url), signal, STRIP_PX) .catch(() => new Map()) @@ -426,7 +428,8 @@ ${coverHtml({ title: trip?.title || 'My Trip', description: trip?.description || null, range, - image: coverImg, + image: bakedCover ?? coverImg, + baked: bakedCover != null, logo: absUrl('/logo-light.svg'), stats, route: (tripRoute?.days || []).filter(d => d.lines.length).map(d => ({ colour: hexColour(d.color.line, '#ffffff'), lines: d.lines })), diff --git a/client/src/components/PDF/pdfImages.test.ts b/client/src/components/PDF/pdfImages.test.ts index 1abb92d86..b66a15d19 100644 --- a/client/src/components/PDF/pdfImages.test.ts +++ b/client/src/components/PDF/pdfImages.test.ts @@ -8,13 +8,15 @@ import { http, HttpResponse } from 'msw'; import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'; import { server } from '../../../tests/helpers/msw/server'; -import { shrinkPdfImages, STRIP_PX } from './pdfImages'; +import { bakePdfCover, shrinkPdfImages, STRIP_PX } from './pdfImages'; const origin = window.location.origin; const JPEG = 'data:image/jpeg;base64,c21hbGw='; let bitmapSize = { width: 1200, height: 800 }; let drawn: { width: number; height: number }[] = []; +let drawCalls: unknown[][] = []; +let stops: [number, string][] = []; let inFlight = 0; let mostInFlight = 0; @@ -24,7 +26,11 @@ function fakeContext(this: HTMLCanvasElement, type: string) { return { fillStyle: '', fillRect: vi.fn(), - drawImage: vi.fn(() => drawn.push({ width: this.width, height: this.height })), + drawImage: vi.fn((...args: unknown[]) => { + drawCalls.push(args); + drawn.push({ width: this.width, height: this.height }); + }), + createLinearGradient: vi.fn(() => ({ addColorStop: (at: number, colour: string) => stops.push([at, colour]) })), }; } @@ -35,6 +41,8 @@ function imageResponse(type = 'image/jpeg') { beforeEach(() => { bitmapSize = { width: 1200, height: 800 }; drawn = []; + drawCalls = []; + stops = []; inFlight = 0; mostInFlight = 0; vi.stubGlobal( @@ -143,3 +151,35 @@ describe('shrinkPdfImages', () => { expect(shrunk.has(url)).toBe(false); }); }); + +describe('bakePdfCover', () => { + it('FE-PDFIMAGES-010: the photo is cropped to the page and the shade painted into one JPEG', async () => { + bitmapSize = { width: 4000, height: 2252 }; + const url = `${origin}/uploads/places/cover.jpg`; + const baked = await bakePdfCover(url, [ + [0, 0.35], + [0.92, 0.82], + ]); + + expect(baked).toBe(JPEG); + // Decoded at the page's height, not in full. + expect(createImageBitmap).toHaveBeenCalledWith(expect.any(Blob), { resizeHeight: 1754, resizeQuality: 'medium' }); + // A4 at 150 dpi, the landscape photo scaled to the page height and centred. + expect(drawn).toEqual([{ width: 1240, height: 1754 }]); + const [, x, y, width, height] = drawCalls[0] as number[]; + expect(height).toBeCloseTo(1754, 0); + expect(width).toBeCloseTo((4000 * 1754) / 2252, 0); + expect(x).toBeCloseTo((1240 - width) / 2, 3); + expect(y).toBeCloseTo(0, 3); + expect(stops).toEqual([ + [0, 'rgba(10, 10, 14, 0.35)'], + [0.92, 'rgba(10, 10, 14, 0.82)'], + ]); + }); + + it('FE-PDFIMAGES-011: a cover from another origin or one that cannot be read is left to print as before', async () => { + expect(await bakePdfCover('https://elsewhere.example/cover.jpg', [[0, 0.5]])).toBeNull(); + expect(await bakePdfCover(`${origin}/uploads/missing.jpg`, [[0, 0.5]])).toBeNull(); + expect(drawn).toEqual([]); + }); +}); diff --git a/client/src/components/PDF/pdfImages.ts b/client/src/components/PDF/pdfImages.ts index 2f793c22d..40d0a4020 100644 --- a/client/src/components/PDF/pdfImages.ts +++ b/client/src/components/PDF/pdfImages.ts @@ -66,6 +66,23 @@ function canShrink(): boolean { } async function shrinkImage(url: string, shortSide: number, signal?: AbortSignal): Promise { + // Decoded at twice the short side, so a portrait photo still has room to shrink. + const bitmap = await fetchBitmap(url, shortSide * 2, signal); + if (!bitmap) return null; + try { + return toJpeg(bitmap, shortSide); + } finally { + bitmap.close(); + } +} + +/** + * The photo at `url` decoded at `height` pixels, or null when it cannot be had. Decoded + * near the size it is drawn at: a 48 MP phone photo decoded in full holds about 190 MB, + * which can end the web view on a phone. Browsers without the option decode in full and + * the canvas scales down as before. + */ +async function fetchBitmap(url: string, height: number, signal?: AbortSignal): Promise { // A controller and a timer rather than AbortSignal.timeout/any, which Safari only // has from 16 and 17.4 on; a throw there would cost the whole export. const fetching = new AbortController(); @@ -77,16 +94,7 @@ async function shrinkImage(url: string, shortSide: number, signal?: AbortSignal) if (!res.ok || Number(res.headers.get('content-length') ?? 0) > MAX_BYTES) return null; const blob = await res.blob(); if (!blob.type.startsWith('image/') || blob.size > MAX_BYTES) return null; - // Decoded near thumbnail size: a 48 MP phone photo decoded in full holds about - // 190 MB, which can end the web view on a phone. Browsers without the option - // decode in full and toJpeg scales down as before. - // Decoded at twice the short side, so a portrait photo still has room to shrink. - const bitmap = await createImageBitmap(blob, { resizeHeight: shortSide * 2, resizeQuality: 'medium' }); - try { - return toJpeg(bitmap, shortSide); - } finally { - bitmap.close(); - } + return await createImageBitmap(blob, { resizeHeight: height, resizeQuality: 'medium' }); } catch { // Offline, timed out, aborted or undecodable: the photo prints from its URL. return null; @@ -96,6 +104,51 @@ async function shrinkImage(url: string, shortSide: number, signal?: AbortSignal) } } +/** The cover page in pixels: A4 at 150 dpi, enough for a photo behind the type. */ +const COVER_W = 1240; +const COVER_H = 1754; +const COVER_QUALITY = 0.82; + +/** One stop of the shade over the cover photo: how far down the page, 0 to 1, and how dark. */ +export type ShadeStop = readonly [at: number, alpha: number]; + +/** + * The cover photo cropped to the page with its shade painted in, as one JPEG at print + * size. A page-sized photo under a translucent gradient is composited again by every + * viewer on every redraw, which made the first pages stutter in the preview and in the + * saved file; one flat picture is drawn once. Null for a photo from another origin or + * one that cannot be read: the cover then prints the photo and the shade as before. + */ +export async function bakePdfCover( + url: string, + shade: readonly ShadeStop[], + signal?: AbortSignal +): Promise { + if (!isSameOrigin(url) || !canShrink()) return null; + const bitmap = await fetchBitmap(url, COVER_H, signal); + if (!bitmap) return null; + try { + const canvas = document.createElement('canvas'); + canvas.width = COVER_W; + canvas.height = COVER_H; + const ctx = canvas.getContext('2d'); + if (!ctx) return null; + // Cropped the way background-size: cover crops it, around the middle. + const scale = Math.max(COVER_W / bitmap.width, COVER_H / bitmap.height); + const width = bitmap.width * scale; + const height = bitmap.height * scale; + ctx.drawImage(bitmap, (COVER_W - width) / 2, (COVER_H - height) / 2, width, height); + const gradient = ctx.createLinearGradient(0, 0, 0, COVER_H); + for (const [at, alpha] of shade) gradient.addColorStop(at, `rgba(10, 10, 14, ${alpha})`); + ctx.fillStyle = gradient; + ctx.fillRect(0, 0, COVER_W, COVER_H); + const baked = canvas.toDataURL('image/jpeg', COVER_QUALITY); + return baked.startsWith('data:image/jpeg') ? baked : null; + } finally { + bitmap.close(); + } +} + /** The bitmap with its short side at `shortSide`, or null when it is that small already. */ function toJpeg(bitmap: ImageBitmap, shortSide: number): string | null { const scale = shortSide / Math.min(bitmap.width, bitmap.height); diff --git a/client/src/components/PDF/tripMapSvg.test.ts b/client/src/components/PDF/tripMapSvg.test.ts index 637e96acb..8f5c8b57a 100644 --- a/client/src/components/PDF/tripMapSvg.test.ts +++ b/client/src/components/PDF/tripMapSvg.test.ts @@ -1,5 +1,5 @@ import { describe, it, expect } from 'vitest' -import { buildTripMapSvg } from './tripMapSvg' +import { buildTripMapSvg, drawnPoints } from './tripMapSvg' import type { TripOverviewDay } from '../Map/tripRouteGeometry' const day = (over: Partial = {}): TripOverviewDay => ({ @@ -78,3 +78,25 @@ describe('buildTripMapSvg', () => { expect(svg).toContain('width="720"') }) }) + +// A routed road carries a point every few metres; drawn as it came, a trip map held +// tens of thousands of them and stuttered in every viewer. +describe('drawnPoints', () => { + // One degree is one map pixel, so the tolerance reads in degrees here. + const flat = (lat: number, lng: number): [number, number] => [lng, -lat] + + it('FE-PDF-MAPSVG-020: a dense straight road keeps only its ends', () => { + const road = Array.from({ length: 5000 }, (_, i) => [0, i / 10] as [number, number]) + expect(drawnPoints(road, flat)).toBe('0,0 499.9,0') + }) + + it('FE-PDF-MAPSVG-021: a turn is kept, a wobble under the tolerance is not', () => { + const road: [number, number][] = [[0, 0], [-0.1, 50], [0, 100], [-60, 100], [-0.2, 100.1]] + expect(drawnPoints(road, flat)).toBe('0,0 100,0 100,60 100.1,0.2') + }) + + it('FE-PDF-MAPSVG-022: points that round onto the same pixel are drawn once', () => { + const road: [number, number][] = [[0, 0], [0, 0.01], [0, 0.02], [0, 0.04]] + expect(drawnPoints(road, flat)).toBe('0,0') + }) +}) diff --git a/client/src/components/PDF/tripMapSvg.ts b/client/src/components/PDF/tripMapSvg.ts index f8abb4f58..d4a3e21e5 100644 --- a/client/src/components/PDF/tripMapSvg.ts +++ b/client/src/components/PDF/tripMapSvg.ts @@ -125,6 +125,55 @@ export interface RouteOverlayOptions { formatDistance: (km: number) => string } +/** How far, in map pixels, a point may sit off the line its neighbours make before it is kept. */ +const SIMPLIFY_TOLERANCE = 0.35 + +/** + * A run projected onto the map and thinned for drawing. A routed road carries a point + * every few metres: at the scale of a trip map that is tens of thousands of points, most + * rounding onto the same pixel, each drawn twice (casing and line) and drawn again by + * every viewer on every scroll, which made the page stutter. Points that round onto the + * one before are dropped, then every point closer than SIMPLIFY_TOLERANCE to the line + * through the points kept around it (Douglas-Peucker). The shape on paper is the same. + */ +export function drawnPoints(line: [number, number][], project: (lat: number, lng: number) => [number, number]): string { + const round = (n: number) => Math.round(n * 10) / 10 + const pts: [number, number][] = [] + for (const [lat, lng] of line) { + const [x, y] = project(lat, lng) + const point: [number, number] = [round(x), round(y)] + const prev = pts[pts.length - 1] + if (!prev || prev[0] !== point[0] || prev[1] !== point[1]) pts.push(point) + } + const keep = new Uint8Array(pts.length) + keep[0] = 1 + keep[pts.length - 1] = 1 + const ranges: [number, number][] = [[0, pts.length - 1]] + for (let range = ranges.pop(); range; range = ranges.pop()) { + const [from, to] = range + if (to - from < 2) continue + const [ax, ay] = pts[from] + const [bx, by] = pts[to] + const dx = bx - ax + const dy = by - ay + const length = Math.hypot(dx, dy) + let farthest = -1 + let distance = 0 + for (let i = from + 1; i < to; i++) { + const [px, py] = pts[i] + const d = length === 0 ? Math.hypot(px - ax, py - ay) : Math.abs(dy * px - dx * py + bx * ay - by * ax) / length + if (d > distance) { + distance = d + farthest = i + } + } + if (farthest < 0 || distance <= SIMPLIFY_TOLERANCE) continue + keep[farthest] = 1 + ranges.push([from, farthest], [farthest, to]) + } + return pts.filter((_, i) => keep[i]).map(p => p.join(',')).join(' ') +} + /** * The routes, their stops and the scale bar — everything drawn *over* the ground. * @@ -138,7 +187,7 @@ export function buildRouteOverlay(days: TripOverviewDay[], opts: RouteOverlayOpt const drawn = days.filter(d => [...d.lines, ...(d.tourLines ?? [])].some(line => line.length > 1)) const routes = drawn.flatMap(day => day.lines.filter(l => l.length > 1).map(line => { - const pts = line.map(([lat, lng]) => project(lat, lng).map(round).join(',')).join(' ') + const pts = drawnPoints(line, project) // The day's own darkened casing rather than a flat white one: it is what keeps a // warm colour readable over water and forest, and it matches what the map draws. return `` @@ -147,7 +196,7 @@ export function buildRouteOverlay(days: TripOverviewDay[], opts: RouteOverlayOpt // Where each run starts and ends — the stops, rather than every vertex of the road. const tours = drawn.flatMap(day => (day.tourLines ?? []).filter(line => line.length > 1).map(line => { - const pts = line.map(([lat, lng]) => project(lat, lng).map(round).join(',')).join(' ') + const pts = drawnPoints(line, project) return `` + `` })) diff --git a/client/src/components/PDF/tripPdfDay.ts b/client/src/components/PDF/tripPdfDay.ts index 91b17011a..0cae2413a 100644 --- a/client/src/components/PDF/tripPdfDay.ts +++ b/client/src/components/PDF/tripPdfDay.ts @@ -73,14 +73,15 @@ function item(kind: string, time: string, marker: string, body: string, style = /** "Departure", "Pick-up" and the like, for a booking that spans days; null on its single day. */ function spanLabel(r: PdfBooking, phase: string, tr: Translate): string | null { if (phase === 'single') return null; - const at = (start: string, end: string, middle: string) => - tr(`reservations.span.${phase === 'start' ? start : phase === 'end' ? end : middle}`); - if (r.type === 'flight') return at('departure', 'arrival', 'inTransit'); - if (r.type === 'car') return at('pickup', 'return', 'active'); + // Each key spelled out, so the key check can follow every branch to its string. + const start = phase === 'start'; + const end = phase === 'end'; + if (r.type === 'flight') return tr(`reservations.span.${start ? 'departure' : end ? 'arrival' : 'inTransit'}`); + if (r.type === 'car') return tr(`reservations.span.${start ? 'pickup' : end ? 'return' : 'active'}`); // Parking reuses span.pickup for its end day: you drop the car off and collect it // again later, so the rental car's wording carries over without a second key. - if (r.type === 'parking') return at('dropOff', 'pickup', 'ongoing'); - return at('start', 'end', 'ongoing'); + if (r.type === 'parking') return tr(`reservations.span.${start ? 'dropOff' : end ? 'pickup' : 'ongoing'}`); + return tr(`reservations.span.${start ? 'start' : end ? 'end' : 'ongoing'}`); } function stopsOf(r: PdfBooking, label: 'code' | 'name'): string[] { @@ -194,7 +195,8 @@ export function bookingItem(r: PdfBooking, day: Day, ctx: PdfDayContext, flags: if (note) flags.transportNote = true; const meta = metadataOf(r); const location = r.location || text(meta.location); - const status = r.status === 'confirmed' || r.status === 'pending' ? tr(`reservations.${r.status}`) : ''; + const status = + r.status === 'confirmed' ? tr('reservations.confirmed') : r.status === 'pending' ? tr('reservations.pending') : ''; const tint = hexColour(bookingTint(r.type), NEUTRAL); const extras = [ @@ -386,7 +388,7 @@ export function staysBlock(stays: readonly Accommodation[], day: Day, ctx: PdfDa // ── Header ──────────────────────────────────────────────────────────────── -export interface DayHeaderFacts { +interface DayHeaderFacts { stops: number; distance: string | null; cost: string | null; @@ -412,7 +414,7 @@ export function dayHeader(day: Day, facts: DayHeaderFacts, ctx: PdfDayContext): // ── Photo strip ─────────────────────────────────────────────────────────── -export interface StripPhoto { +interface StripPhoto { url: string; caption: string; } diff --git a/client/src/components/PDF/tripPdfIcons.ts b/client/src/components/PDF/tripPdfIcons.ts index 2030ce5c1..89e7df222 100644 --- a/client/src/components/PDF/tripPdfIcons.ts +++ b/client/src/components/PDF/tripPdfIcons.ts @@ -79,7 +79,7 @@ const GLYPHS = { key: KeyRound, } satisfies Record; -export type PdfGlyph = keyof typeof GLYPHS; +type PdfGlyph = keyof typeof GLYPHS; export function glyph(name: PdfGlyph, size = 10): string { return iconSvg(GLYPHS[name], size); diff --git a/client/src/components/PDF/tripPdfOverview.ts b/client/src/components/PDF/tripPdfOverview.ts index 3073725e4..57ed8a29f 100644 --- a/client/src/components/PDF/tripPdfOverview.ts +++ b/client/src/components/PDF/tripPdfOverview.ts @@ -1,3 +1,4 @@ +import type { ShadeStop } from './pdfImages'; import { cssUrl, escHtml } from './tripPdfHtml'; import { glyph } from './tripPdfIcons'; @@ -14,17 +15,19 @@ export interface CoverStat { } /** One day of the route as the cover draws it: its colour and its roads, `[lat, lng]`. */ -export interface CoverRouteDay { +interface CoverRouteDay { colour: string; lines: readonly (readonly [number, number])[][]; } -export interface CoverInput { +interface CoverInput { title: string; description: string | null; range: string | null; /** The cover photo, already checked to be one the document may load. */ image: string | null; + /** Whether the shade is already painted into `image`, so none is laid over it. */ + baked?: boolean; /** The light TREK logo, absolute. */ logo: string | null; stats: readonly CoverStat[]; @@ -37,6 +40,23 @@ export interface CoverInput { tr: Translate; } +/** + * The shade over the cover photo, top to bottom: a little at the top for the logo, clear + * through the middle, dark at the foot for the title and the figures. Painted into the + * photo when the export could bake it, laid over it as a gradient when not. + */ +export const COVER_SHADE: readonly ShadeStop[] = [ + [0, 0.35], + [0.22, 0], + [0.36, 0], + [0.92, 0.82], +]; + +/** The cover shade as a CSS gradient, for a photo the export could not bake. */ +export function coverShadeCss(): string { + return `linear-gradient(180deg, ${COVER_SHADE.map(([at, alpha]) => `rgba(10, 10, 14, ${alpha}) ${at * 100}%`).join(', ')})`; +} + const ROUTE_W = 240; const ROUTE_H = 170; const ROUTE_PAD = 14; @@ -85,7 +105,7 @@ export function coverRouteSvg(days: readonly CoverRouteDay[]): string { const start = first.points[0]; const end = last.points[last.points.length - 1]; return `
-
+ ${baked ? '' : '
'}
${logo ? `TREK` : ''} ${escHtml(tr('pdf.travelPlan'))} diff --git a/client/src/components/PDF/tripPdfStyles.ts b/client/src/components/PDF/tripPdfStyles.ts index 1c58bee2d..999c5ce4d 100644 --- a/client/src/components/PDF/tripPdfStyles.ts +++ b/client/src/components/PDF/tripPdfStyles.ts @@ -3,6 +3,7 @@ import geist500 from '@fontsource/geist-sans/files/geist-sans-latin-500-normal.w import geist600 from '@fontsource/geist-sans/files/geist-sans-latin-600-normal.woff2?url'; import { PDF_MARKDOWN_CSS } from './pdfMarkdown'; +import { coverShadeCss } from './tripPdfOverview'; /* * The trip PDF's stylesheet. A print document has a fixed palette rather than the @@ -41,15 +42,11 @@ export function tripPdfCss(): string { --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); --glass-tile: rgba(18, 18, 24, 0.34); --glass-deep: rgba(12, 12, 16, 0.5); - --route-glow: rgba(255, 255, 255, 0.5); --on-night: rgba(255, 255, 255, 0.78); --on-night-2: rgba(255, 255, 255, 0.56); --gold: #b7791f; @@ -96,7 +93,7 @@ export function tripPdfCss(): string { } .cover-shade { position: absolute; inset: 0; - background: linear-gradient(180deg, var(--shade-mid) 0%, var(--shade-none) 22%, var(--shade-none) 36%, var(--shade) 92%); + background: ${coverShadeCss()}; } .cover-top { position: absolute; inset-block-start: 14mm; inset-inline: var(--gutter); @@ -123,7 +120,7 @@ export function tripPdfCss(): string { text-transform: uppercase; color: var(--on-night-2); } .cover-route-svg { display: block; width: 100%; height: auto; } - .cover-route-glow { color: var(--route-glow); } + .cover-route-glow { color: var(--paper); } .cover-route-start { fill: var(--paper); } .cover-route-end { stroke: var(--paper); } .cover-ribbon { display: flex; gap: 2px; height: 5px; margin-block-start: 8mm; } @@ -148,11 +145,8 @@ export function tripPdfCss(): string { text-transform: uppercase; color: var(--on-night-2); margin-block-start: 5px; } - /* The blur behind the glass shows in the preview; print engines leave it out. */ - @media screen { - .cover-dates, .cover-stat, .glass-label { -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); } - .cover-route { -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); } - } + /* The glass is a tinted fill, not a backdrop blur: print engines leave a blur out, and + in the preview a blur over the full-page photo had to be redrawn on every scroll. */ /* ── Overview: route map, the days at a glance, bookings and stays ─────── */ .overview { padding: 2mm var(--gutter) 0; }