@import 'tailwindcss'; /* This sheet ships INSIDE the chrome package, so consumers importing it sit outside Tailwind's automatic content detection (node_modules is ignored). Point the scanner at our own sources explicitly — relative to this file. */ @source './'; /* Dark mode is class-driven (we toggle `.dark` on ), not media-driven, so the `theme` preference is authoritative over the OS setting. */ @custom-variant dark (&:where(.dark, .dark *)); /* A floating bar's pill (places.tsx): on its toolbar, styles the section that holds the bar's items, the toolbar's child with an item (`data-epdf-toolbar-item`) that draws something. */ @custom-variant float-pill (& > div:has(> [data-epdf-toolbar-item]:not(:empty))); /* The viewer's look, as the `--epdf-*` variables the Theming page lists: its accent, the colors of its surfaces, text and lines, the corner radius and the font. Every other color the chrome draws with is mixed from them in `@theme inline` below, so setting one restyles everything made of it. They turn into Tailwind utilities there: `bg-surface`, `text-fg-muted`, `border-border-subtle`, `rounded-md` and the rest. */ /* The page's own value of each public variable this sheet gives a default, read on the host, where the page's CSS arrives (set on the element or inherited from around it). Nothing public is declared on the host: a value there would hide one set around the viewer. */ :host { --embedpdf-host-accent: var(--epdf-accent); --embedpdf-host-background: var(--epdf-background); --embedpdf-host-surface: var(--epdf-surface); --embedpdf-host-surface-raised: var(--epdf-surface-raised); --embedpdf-host-text: var(--epdf-text); --embedpdf-host-text-muted: var(--epdf-text-muted); --embedpdf-host-border: var(--epdf-border); --embedpdf-host-hover: var(--epdf-hover); --embedpdf-host-canvas: var(--epdf-canvas); --embedpdf-host-page-background: var(--epdf-page-background); --embedpdf-host-page-shadow: var(--epdf-page-shadow); --embedpdf-host-tooltip: var(--epdf-tooltip); --embedpdf-host-tooltip-text: var(--epdf-tooltip-text); --embedpdf-host-radius: var(--epdf-radius); --embedpdf-host-font: var(--epdf-font); --embedpdf-host-scrollbar-thumb: var(--epdf-scrollbar-thumb); --embedpdf-host-toolbar-surface: var(--epdf-toolbar-surface); --embedpdf-host-toolbar-border: var(--epdf-toolbar-border); --embedpdf-host-toolbar-active: var(--epdf-toolbar-active); } /* The variables live on the viewer's root: the element's shadow wrapper (`data-embedpdf-root`), or the document when the chrome is the page. Each is the page's value when it set one, else this mode's default, so the parts drawn on the pages (which read the same variables) and your own components in the viewer always agree with the chrome. The dark defaults are a plain `.dark` class, which the element puts on its wrapper and apps on . */ :root, [data-embedpdf-root] { --epdf-accent: var(--embedpdf-host-accent, #3b82f6); --epdf-background: var(--embedpdf-host-background, #f3f4f6); --epdf-surface: var(--embedpdf-host-surface, #ffffff); --epdf-surface-raised: var(--embedpdf-host-surface-raised, #ffffff); --epdf-text: var(--embedpdf-host-text, #111827); --epdf-text-muted: var(--embedpdf-host-text-muted, #6b7280); --epdf-border: var(--embedpdf-host-border, #d1d5db); --epdf-hover: var(--embedpdf-host-hover, #f3f4f6); --epdf-canvas: var(--embedpdf-host-canvas, #f3f4f6); /* A page before its picture arrives, and the shadow under it, the same in both modes: the pages are paper. The Stage and a page view read them over their `page` settings. */ --epdf-page-background: var(--embedpdf-host-page-background, #ffffff); --epdf-page-shadow: var(--embedpdf-host-page-shadow, 0 6px 18px rgb(0 0 0 / 0.18)); /* A tooltip in the other mode's colors, so it stands off what it's over, in either mode. */ --epdf-tooltip: var(--embedpdf-host-tooltip, var(--epdf-text)); --epdf-tooltip-text: var(--embedpdf-host-tooltip-text, var(--epdf-surface)); --epdf-radius: var(--embedpdf-host-radius, 6px); --epdf-font: var( --embedpdf-host-font, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji' ); /* The headless parts' own variables (the headless docs' "Colors & theming"), defaulting to the viewer's look. */ --epdf-scrollbar-thumb: var( --embedpdf-host-scrollbar-thumb, color-mix(in srgb, var(--epdf-text) 35%, transparent) ); --epdf-toolbar-surface: var(--embedpdf-host-toolbar-surface, var(--epdf-surface-raised)); --epdf-toolbar-border: var(--embedpdf-host-toolbar-border, var(--epdf-border)); --epdf-toolbar-active: var( --embedpdf-host-toolbar-active, color-mix(in srgb, var(--epdf-hover) 90%, var(--epdf-text)) ); /* The pressed and chosen look: a tint of the accent on the surface, stronger in dark, where a light tint barely shows. */ --embedpdf-accent-tint: color-mix(in srgb, var(--epdf-accent) 8%, var(--epdf-surface)); } .dark { --epdf-accent: var(--embedpdf-host-accent, #60a5fa); --epdf-background: var(--embedpdf-host-background, #111827); --epdf-surface: var(--embedpdf-host-surface, #1f2937); --epdf-surface-raised: var(--embedpdf-host-surface-raised, #1f2937); --epdf-text: var(--embedpdf-host-text, #f9fafb); --epdf-text-muted: var(--embedpdf-host-text-muted, #9ca3af); --epdf-border: var(--embedpdf-host-border, #4b5563); --epdf-hover: var(--embedpdf-host-hover, #374151); --epdf-canvas: var(--embedpdf-host-canvas, #0d1117); --epdf-tooltip: var(--embedpdf-host-tooltip, var(--epdf-text)); --epdf-tooltip-text: var(--embedpdf-host-tooltip-text, var(--epdf-surface)); --epdf-scrollbar-thumb: var( --embedpdf-host-scrollbar-thumb, color-mix(in srgb, var(--epdf-text) 28%, transparent) ); --embedpdf-accent-tint: color-mix(in srgb, var(--epdf-accent) 25%, var(--epdf-surface)); } /* Each utility reads the variables where it's used, so a variable set in a part of the viewer (or for one of your components) restyles that part. The shades between two tokens are mixes, which follow both. Corners scale with `--epdf-radius`: `rounded-md` is the radius itself. */ @theme inline { --color-app: var(--epdf-background); --color-surface: var(--epdf-surface); --color-surface-alt: color-mix(in srgb, var(--epdf-surface), var(--epdf-text) 6%); --color-elevated: var(--epdf-surface-raised); --color-fg: var(--epdf-text); --color-fg-secondary: color-mix(in srgb, var(--epdf-text) 65%, var(--epdf-text-muted)); --color-fg-muted: var(--epdf-text-muted); --color-fg-disabled: color-mix(in srgb, var(--epdf-text-muted) 60%, var(--epdf-surface)); --color-on-accent: var(--epdf-surface); --color-border: var(--epdf-border); --color-border-subtle: color-mix(in srgb, var(--epdf-border) 50%, var(--epdf-surface)); --color-border-strong: color-mix(in srgb, var(--epdf-border) 75%, var(--epdf-text)); --color-accent: var(--epdf-accent); --color-accent-hover: color-mix(in srgb, var(--epdf-accent) 80%, black); --color-accent-active: color-mix(in srgb, var(--epdf-accent) 65%, black); --color-accent-light: var(--embedpdf-accent-tint); --color-hover: var(--epdf-hover); --color-active: color-mix(in srgb, var(--epdf-hover) 90%, var(--epdf-text)); --color-selected: var(--embedpdf-accent-tint); --color-canvas: var(--epdf-canvas); --color-tooltip: var(--epdf-tooltip); --color-tooltip-fg: var(--epdf-tooltip-text); --radius: calc(var(--epdf-radius) * 2 / 3); --radius-xs: calc(var(--epdf-radius) / 2); --radius-sm: calc(var(--epdf-radius) * 2 / 3); --radius-md: var(--epdf-radius); --radius-lg: calc(var(--epdf-radius) * 4 / 3); --radius-xl: calc(var(--epdf-radius) * 2); --radius-2xl: calc(var(--epdf-radius) * 8 / 3); } html, body, #root { height: 100%; margin: 0; } body { font-family: var(--epdf-font); color: var(--epdf-text); background: var(--epdf-background); } /* The measurement layer in is aria-hidden + visibility:hidden; make doubly sure it never intercepts pointer events or shows a scrollbar. */ [data-measure-layer] { pointer-events: none; } /* Headless scrollbar theming. The component ships geometry + behavior only (thumb drag, track paging, auto-hide → data-state); its color is `--epdf-scrollbar-thumb` above, and everything else is these few rules — restyle or replace them freely. */ [data-embedpdf-scrollbar-thumb] { transition: background 150ms; } [data-embedpdf-scrollbar-thumb]:hover, [data-embedpdf-scrollbar][data-dragging] [data-embedpdf-scrollbar-thumb] { background: var(--epdf-text-muted); } /* Full Screen where the browser has no full screen for the viewer (ui/fullscreen.ts): its box over the whole window, from the top layer, so the page around it can't hold it in. Two parts, so it wins over the element's own sizing of its root. */ [data-epdf-fills-window]:popover-open { position: fixed; inset: 0; width: auto; height: auto; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; } /* With a finger as the main way of pointing (`data-touch` on the viewer's root, from its env), every button in a bar, document tab, panel header button and menu row, in a sheet or not, is at least 44 px tall: the size a fingertip hits. It follows the viewer's env, not a media query, like the rest of its layout. */ [data-touch] [role='toolbar'] button, [data-touch] [role='tab'], [data-touch] [data-epdf-panel-header] button, [data-touch] [role='menu'] :is([role='menuitem'], [role='menuitemradio'], [role='menuitemcheckbox']) { min-height: 44px; } [data-touch] [role='toolbar'] button, [data-touch] [data-epdf-panel-header] button { min-width: 44px; } /* With a finger as the main way of pointing, the chrome's own fields write in 16 px text: iOS Safari zooms the page in when a field with smaller text takes focus. The fields on the pages (a form field, a text box) size their text inline, which wins over this, and are laid out at a legible size instead (`legible-text.ts` in `@embedpdf/web`). */ [data-touch] :is(input, textarea, select) { font-size: 16px; } /* A floating bar that rests out of sight while nothing moves (places.tsx, its place's `hideWhenIdle`): it fades out slowly and comes back quickly. Out of sight it takes no presses, so a press there reaches the page and wakes it, but it keeps its place in the keyboard's order: focus coming into it brings it back. */ [data-float] [data-bar] { transition: opacity 150ms; } [data-float] [data-idle-hidden] { opacity: 0; transition: opacity 500ms; } [data-idle-hidden] * { pointer-events: none; } @media (prefers-reduced-motion: reduce) { [data-float] [data-bar] { transition: none; } }