/*== ShyFox Polish (content) ========================================================================
Visual polish for the documents userContent.css can reach: the Sidebery sidebar, about:home and
about:newtab, the about: / chrome: pages, and extension popups. This file is imported after
content/shy-sidebery.css, content/shy-new-tab.css, content/shy-about.css and
content/shy-global-content.css, so it extends them instead of repeating them.
Everything is scoped by @-moz-document. Nothing here may reach an ordinary web page.
Colours come from the five ShyFox variables -- --bg-col, --tb-col, --bt-col, --pp-col and
--shy-color -- exactly as in the chrome layer, and from shy-tokens.css, which userContent.css
imports. The accent, elevation and motion scales are taken from there unchanged. The only local
tokens are the neutral tints, which are the shy-tokens scales re-anchored per document (see the
token block below), plus one composite built from them.
The whole file sits behind `shyfox.disable.polish`; the one backdrop blur it adds sits behind
`shyfox.disable.blur` as well.
===================================================================================================*/
@media not -moz-pref("shyfox.disable.polish") {
/*== TOKENS ========================================================================================
One shared block for every document this file touches.
These are the same percentages shy-tokens.css uses for --shy-hairline, --shy-hover-tint,
--shy-active-tint, --shy-selected-tint, --shy-text-dim and --shy-scrollbar. What differs is only
what they are mixed from: shy-tokens anchors them to --bt-col, the *chrome's* ink. That is right
inside the Sidebery sidebar, which ShyFox repaints, and wrong on an about: page, which keeps
Firefox's own in-content palette and can be light while the chrome is dark -- a --bt-col hairline
would vanish there. So the family is anchored to --shy-c-ink instead: `currentColor` by default,
--bt-col where ShyFox owns the surface. Each scope declares --shy-c-ink on :root and the whole
family follows it, because a custom property is substituted only after the cascade has picked a
winner for its input.
*/
@-moz-document url-prefix("about:"), url-prefix("chrome:"), url-prefix("moz-extension:") {
:root {
/* what the neutral tints are mixed from; overridden per scope below */
--shy-c-ink: currentColor;
--shy-c-hairline: color-mix(in srgb, var(--shy-c-ink) 13%, transparent);
--shy-c-hairline-strong: color-mix(in srgb, var(--shy-c-ink) 22%, transparent);
/* the resting fill of a raised control: one step up from the sidebar surface */
--shy-c-fill: color-mix(in srgb, var(--bt-col) 7%, transparent);
--shy-c-hover: color-mix(in srgb, var(--shy-c-ink) 10%, transparent);
--shy-c-pressed: color-mix(in srgb, var(--shy-c-ink) 16%, transparent);
--shy-c-selected: color-mix(in srgb, var(--shy-c-ink) 22%, transparent);
/* text that is deliberately quieter than the ink, for a list's resting rows */
--shy-c-text-quiet: color-mix(in srgb, var(--shy-c-ink) 65%, transparent);
--shy-c-scroll-thumb: color-mix(in srgb, var(--shy-c-ink) 28%, transparent);
/* the one composite: the marker for "this row is the current one", a bar and not a fill.
box-shadow has no logical-property form, so the direction is flipped here rather than in
each of the rules that use it. */
--shy-c-accent-bar: inset 3px 0 0 0 var(--shy-color);
&:dir(rtl) {--shy-c-accent-bar: inset -3px 0 0 0 var(--shy-color);}
}
}
/*== SIDEBERY ======================================================================================
The sidebar is this user's tab bar, so it gets the most care.
Sidebery paints from two tiers: --s-* written as inline style on <body> from browser.theme, and a
derived tier on #root keyed by four independent data-*-color-scheme attributes. Overriding the --s-*
tier on #root is the lever that reaches both -- it feeds every derived variable *and* every direct
`var(--s-*, fallback)` read in Sidebery's sheet, in the dark and the light branch alike, whatever
the user's "Color scheme" setting is. userContent.css is a user sheet, so !important here outranks
Sidebery's author rules, its runtime <style id="custom_css">, and the inline --s-* on <body>.
*/
@-moz-document regexp("^moz-extension://.*?/sidebar/sidebar.html"){ /* wrap start */
/* inside the sidebar ShyFox owns the surface, so the neutral tints follow the theme's ink */
:root {--shy-c-ink: var(--bt-col);}
/* the loading sweep. shy-tokens.css lives in the chrome context; a content document needs its
own copy of the keyframes it animates. */
@keyframes shy-c-sweep {
from {background-position: -120% 0;}
to {background-position: 220% 0;}
}
/* the theme-injection tier. --bg-col matches #sidebar-box in shy-sidebar.css exactly, so the
document reads as part of the panel; the glass is the chrome panel's job, not the page's. */
#root.root {
--s-frame-bg: var(--bg-col) !important;
--s-frame-fg: var(--bt-col) !important;
--s-toolbar-bg: var(--tb-col) !important;
--s-toolbar-fg: var(--bt-col) !important;
--s-popup-bg: var(--pp-col) !important;
--s-popup-fg: var(--bt-col) !important;
--s-accent: var(--shy-color) !important;
--s-toolbar-border: var(--shy-c-hairline) !important;
--s-popup-border: var(--shy-c-hairline) !important;
--s-act-el-border: var(--shy-c-hairline) !important;
/* the active chip: the accent as a tint over the toolbar fill, never as the fill itself, so
--bt-col text keeps its contrast whatever luminance the user's accent has */
--s-act-el-bg: color-mix(in srgb, var(--shy-color) 14%, var(--tb-col)) !important;
--s-act-el-fg: var(--bt-col) !important;
}
/* the derived tier. Sidebery hard-codes these per colour scheme, so they cannot be reached
through --s-*; they are the four-state system for every row and button in the sidebar. */
#root.root {
--frame-el-overlay-hover-bg: var(--shy-c-hover) !important;
--frame-el-overlay-clicked-bg: var(--shy-c-pressed) !important;
--frame-el-overlay-selected-bg: var(--shy-accent-weak) !important;
--toolbar-el-overlay-hover-bg: var(--shy-c-hover) !important;
--toolbar-el-overlay-clicked-bg: var(--shy-c-pressed) !important;
--toolbar-el-overlay-active-bg: var(--shy-c-hover) !important;
--toolbar-el-overlay-selected-bg: var(--shy-accent-weak) !important;
--active-el-overlay-hover-bg: var(--shy-c-hover) !important;
--active-el-overlay-clicked-bg: var(--shy-c-pressed) !important;
/* rest: rows sit directly on the sidebar surface, with no card of their own */
--frame-el-bg: transparent !important;
--frame-el-shadow: none !important;
--tabs-normal-bg: transparent !important;
/* the title ladder: resting rows quieter than the current one */
--tabs-normal-fg: var(--shy-c-text-quiet) !important;
--tabs-activated-fg: var(--bt-col) !important;
/* active: accent bar down the leading edge plus one hairline. no accent fill. */
--tabs-activated-shadow: var(--shy-c-accent-bar),
inset 0 0 0 1px var(--shy-c-hairline) !important;
--active-el-shadow: inset 0 0 0 1px var(--shy-c-hairline) !important;
/* an unloaded tab should read as parked, not as an equal of the loaded ones */
--tabs-discarded-favicon-opacity: .38 !important;
--tabs-discarded-title-opacity: .45 !important;
/* popups and the search field, matched to the chrome material */
--ctx-menu-shadow: 0 0 0 1px var(--shy-c-hairline), var(--shy-elev-2) !important;
--popup-shadow: 0 0 0 1px var(--shy-c-hairline), var(--shy-elev-2) !important;
--ctx-menu-separator: var(--shy-c-hairline) !important;
--search-shadow: inset 0 0 0 1px var(--shy-c-hairline) !important;
--search-border-radius: var(--big-rounding) !important;
/* the open panel's button carries an accent underline, its selected sibling an accent ring */
--nav-btn-active-shadow: inset 0 -2px 0 0 var(--shy-color) !important;
/* bookmark folders that are open read as containers, not as pressed buttons */
--bookmarks-expanded-folder-bg: var(--shy-c-fill) !important;
--bookmarks-expanded-folder-shadow: inset 0 0 0 1px var(--shy-c-hairline) !important;
--bookmarks-node-activated-fg: var(--bt-col) !important;
/* scrollbars, custom and native alike */
--scroll-color: var(--shy-c-scroll-thumb) !important;
--frame-scrollbar-color: var(--shy-c-scroll-thumb) !important;
--toolbar-scrollbar-color: var(--shy-c-scroll-thumb) !important;
--popup-scrollbar-color: var(--shy-c-scroll-thumb) !important;
}
/* fade the state change instead of snapping it. .body carries the active colour, .body:before the
hover and multi-select overlay; neither had a background transition, so nothing collides. The
geometry transitions Sidebery owns are kept, on Sidebery's own duration token. */
#root .Tab > .body {
transition: background-color var(--shy-dur-fast) var(--shy-ease),
box-shadow var(--shy-dur-fast) var(--shy-ease),
opacity var(--d-fast, 160ms), transform var(--d-fast, 160ms) !important;
}
#root .Tab > .body::before {
transition: background-color var(--shy-dur-fast) var(--shy-ease),
box-shadow var(--shy-dur-fast) var(--shy-ease) !important;
}
/* a tab group, folded or not, is a header: heavier title, and a hairline round the folded row so
it reads as the container of what it hides. active groups keep their accent bar. */
#root .Tab[data-parent="true"] .title {font-weight: 600 !important;}
#root .Tab[data-parent="true"][data-folded="true"]:not([data-active="true"]) > .body {
box-shadow: inset 0 0 0 1px var(--shy-c-hairline) !important;
}
#root .BookmarkNode[data-type="folder"] > .body > .title {font-weight: 600 !important;}
/* close button: fades with the row, and outranks the row's own hover so it reads as a target */
#root .Tab .close {
transition: opacity var(--shy-dur-fast) var(--shy-ease),
background-color var(--shy-dur-fast) var(--shy-ease) !important;
}
#root .Tab .close:hover {background-color: var(--shy-c-pressed) !important;}
#root .Tab .close:active {background-color: var(--shy-c-selected) !important;}
#root .Tab .close:hover > .close-icon {opacity: 1 !important;}
/* audio button: Sidebery dims it on hover, which reads as disabled. give it a real button state. */
#root .Tab[data-pin="false"] .audio {
border-radius: calc(var(--tabs-border-radius) - 2px) !important;
transition: opacity var(--shy-dur-fast) var(--shy-ease),
background-color var(--shy-dur-fast) var(--shy-ease) !important;
}
#root .Tab[data-pin="false"]:is([data-audible="true"], [data-muted="true"], [data-paused="true"])
.audio:hover {
opacity: 1 !important;
background-color: var(--shy-c-pressed) !important;
}
/* a loading tab: accent spinner, plus one slow accent sweep along the row. gated on Sidebery's own
animation setting so `Animations: none` still means none, and on the free background-image slot
of .body so it cannot collide with the tree-level marks on .body::after. */
#root .Tab[data-loading="true"] .progress-spinner {
border-top-color: var(--shy-color) !important;
}
#root:not([data-animations="none"]) .Tab[data-loading="true"] > .body {
background-image: linear-gradient(90deg,
transparent 10%, var(--shy-accent-tint) 50%, transparent 90%) !important;
background-size: 220% 100% !important;
background-repeat: no-repeat !important;
animation: shy-c-sweep 1.2s linear infinite !important;
}
/* pinned tiles. shy-sidebery.css builds the grid; only the material changes here. */
#root .Tab[data-pin="true"] > .body {
border-color: var(--shy-c-hairline) !important;
}
#root .Tab[data-pin="true"]:hover > .body {
transform: translateY(-2px) !important;
box-shadow: var(--shy-elev-1) !important;
}
/* a square tile wants a ring, not the left bar the list rows get */
#root .Tab[data-pin="true"][data-active="true"] > .body {
border-color: var(--shy-color) !important;
box-shadow: 0 0 0 1px var(--shy-accent-strong) !important;
}
/* drag and drop: the insertion caret is already accent-coloured through --s-accent above; this
only lifts it off whatever it is crossing */
#root .pointer::after {
box-shadow: 3px 0 0 1px var(--frame-bg),
0 0 6px var(--shy-accent-strong) !important;
}
/* the search field, matched to the floating address bar: hairline at rest, accent ring and a
soft accent glow when it has focus */
#root .SearchBar[data-focused="true"]::before {
box-shadow: inset 0 0 0 1px var(--shy-color),
0 0 18px var(--shy-accent-tint) !important;
}
/* bottom-bar tool buttons need a resting surface now that --frame-el-bg is transparent */
#root.Sidebar .tool-btn {
background-color: var(--shy-c-fill) !important;
box-shadow: none !important;
}
/* one focus ring for everything keyboard-reachable in the sidebar */
#root :is(input, .nav-item, .tool-btn, .btn):focus-visible {
outline: 2px solid var(--shy-color) !important;
outline-offset: 1px !important;
}
/* the context menu is the one content surface with something worth blurring behind it -- the tab
list. it appears one at a time, so it stays well inside the blur budget. The fill below is the
finished, blur-off state; the blurred branch only makes it thinner. */
#root .CtxMenu .box::before {
background-color: var(--pp-col) !important;
}
@media not -moz-pref("shyfox.disable.blur") {
#root .CtxMenu .box::before {
background-color: color-mix(in srgb, var(--pp-col) 82%, transparent) !important;
backdrop-filter: blur(var(--blur-radius)) saturate(1.3) !important;
}
}
/*-- graceful degradation, sidebar --------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
#root .Tab > .body,
#root .Tab > .body::before,
#root .Tab .close,
#root .Tab[data-pin="false"] .audio {transition: none !important;}
#root .Tab[data-pin="true"]:hover > .body {transform: none !important;}
#root:not([data-animations="none"]) .Tab[data-loading="true"] > .body {
animation: none !important;
background-image: none !important;
}
}
@media (forced-colors: active) {
#root.root {
--s-frame-bg: Canvas !important;
--s-frame-fg: CanvasText !important;
--s-toolbar-bg: Canvas !important;
--s-toolbar-fg: CanvasText !important;
--s-popup-bg: Canvas !important;
--s-popup-fg: CanvasText !important;
--s-accent: Highlight !important;
--s-act-el-bg: Highlight !important;
--s-act-el-fg: HighlightText !important;
--tabs-normal-fg: CanvasText !important;
--tabs-activated-fg: HighlightText !important;
--tabs-activated-shadow: none !important;
--active-el-shadow: none !important;
/* the overlays paint *under* the row's label, so a solid Highlight fill here would put
Highlight behind CanvasText. Hover is marked with an outline instead; multi-select keeps
the Highlight ring Sidebery already draws from --frame-el-overlay-selected-border. */
--frame-el-overlay-hover-bg: transparent !important;
--frame-el-overlay-clicked-bg: transparent !important;
--frame-el-overlay-selected-bg: transparent !important;
--toolbar-el-overlay-hover-bg: transparent !important;
--toolbar-el-overlay-clicked-bg: transparent !important;
--toolbar-el-overlay-active-bg: transparent !important;
--toolbar-el-overlay-selected-bg: transparent !important;
--active-el-overlay-hover-bg: transparent !important;
--active-el-overlay-clicked-bg: transparent !important;
--nav-btn-active-shadow: inset 0 -2px 0 0 Highlight !important;
--ctx-menu-shadow: 0 0 0 1px CanvasText !important;
--popup-shadow: 0 0 0 1px CanvasText !important;
--search-shadow: inset 0 0 0 1px CanvasText !important;
--bookmarks-expanded-folder-shadow: inset 0 0 0 1px CanvasText !important;
}
#root .Tab:hover > .body::before {
outline: 1px solid CanvasText !important;
outline-offset: -1px !important;
}
#root .Tab[data-pin="true"] > .body,
#root .Tab[data-pin="true"][data-active="true"] > .body,
#root.Sidebar .tool-btn {
background-color: Canvas !important;
border-color: CanvasText !important;
box-shadow: none !important;
}
#root .CtxMenu .box::before {
background-color: Canvas !important;
backdrop-filter: none !important;
}
#root:not([data-animations="none"]) .Tab[data-loading="true"] > .body {
animation: none !important;
background-image: none !important;
}
}
} /* wrap end */
/*== NEW TAB / HOME ================================================================================
shy-new-tab.css owns the wallpaper, the central box and the glass search field. This adds state:
focus, hover and the contrast of text that sits over a photograph.
*/
@-moz-document url("about:home"), url("about:newtab") {
/* one focus ring for everything on the page, in the accent */
.activity-stream :is(a, button, select, input, summary, [role="button"]):focus-visible {
outline: 2px solid var(--shy-color) !important;
outline-offset: 2px !important;
}
/* top sites lift on hover. 2px, inside the 5px padding shy-new-tab.css gives the outer box, so
nothing shifts around it. */
.top-site-outer .top-site-button {
transition: translate var(--shy-dur-fast) var(--shy-ease),
box-shadow var(--shy-dur-fast) var(--shy-ease) !important;
}
.top-site-outer:is(:hover, :focus-within) .top-site-button {
translate: 0 -2px !important;
box-shadow: var(--shy-elev-2) !important;
}
/* tile titles sit on the wallpaper, so their chip has to carry the contrast on its own; the
40%-alpha --tr-col does not, over a bright photograph. With a chip that opaque the label is
no longer reading against the wallpaper, so it takes the colour that pairs with the chip
rather than --newtab-contextual-text-primary-color, which is picked for the wallpaper. */
.top-site-outer .title {
background-color: color-mix(in srgb, var(--newtab-background-color) 74%, transparent) !important;
color: var(--newtab-text-primary-color) !important;
}
/* story cards get the same material as the chrome panels: one hairline, a soft shadow, and the
page's own background as a translucent fill. Deliberately no backdrop blur -- the grid can hold
twenty of these at once, which is far outside the blur budget. */
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder) {
background-color: color-mix(in srgb, var(--newtab-background-color) 62%, transparent) !important;
border-radius: var(--big-rounding) !important;
box-shadow: 0 0 0 1px var(--shy-c-hairline), var(--shy-elev-1) !important;
transition: translate var(--shy-dur-fast) var(--shy-ease),
box-shadow var(--shy-dur-fast) var(--shy-ease) !important;
}
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder):hover {
translate: 0 -2px !important;
box-shadow: 0 0 0 1px var(--shy-c-hairline-strong), var(--shy-elev-2) !important;
}
/* Gecko 155 replaced the .search-handoff-button element with <content-search-handoff-ui> and
drives it from custom properties, so the two rules for the old class in shy-new-tab.css no
longer match anything. Same look, current hooks. */
.search-wrapper content-search-handoff-ui {
--content-search-handoff-ui-background-color: var(--tr-col) !important;
--content-search-handoff-ui-caret-color: var(--shy-color) !important;
--content-search-handoff-ui-fakefocus-border-color: var(--shy-color) !important;
--content-search-handoff-ui-fakefocus-box-shadow-inner: var(--shy-accent-tint) !important;
}
/*-- graceful degradation, new tab ---------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
.top-site-outer .top-site-button,
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder)
{transition: none !important;}
.top-site-outer:is(:hover, :focus-within) .top-site-button,
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder):hover
{translate: none !important;}
}
@media (forced-colors: active) {
.top-site-outer:is(:hover, :focus-within) .top-site-button {box-shadow: none !important;}
.top-site-outer .title {background-color: Canvas !important; color: CanvasText !important;}
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder),
.ds-card-grid:not(.ds-card-grid-hide-background) .ds-card:not(.placeholder):hover {
background-color: Canvas !important;
box-shadow: none !important;
outline: 1px solid CanvasText !important;
outline-offset: -1px !important;
}
}
}
/*== about: AND chrome: PAGES ======================================================================
shy-about.css maps the accent and rounds the corners. This adds the states: hover and focus, one
consistent hairline, and scrollbars that belong to the theme.
These pages keep Firefox's own in-content palette, so the neutral tints stay on `currentColor`
(see the token block) and only the accent comes from --shy-color.
*/
@-moz-document url-prefix("about:"), url-prefix("chrome:") {
:root {
/* one hairline everywhere a separator or a card edge is drawn. Gecko 140 and 155 renamed these
between them, so both spellings are set. */
--border-color: var(--shy-c-hairline-strong) !important;
--border-color-deemphasized: var(--shy-c-hairline) !important;
--border-color-card: var(--shy-c-hairline) !important; /* 140 */
--card-border-color: var(--shy-c-hairline) !important; /* 155 */
--panel-separator-color: var(--shy-c-hairline) !important;
/* cards already transition their shadow; this only replaces the scale */
--box-shadow-card: var(--shy-elev-1) !important; /* 140 */
--box-shadow-card-hover: var(--shy-elev-2) !important;
--card-box-shadow: var(--shy-elev-1) !important; /* 155 */
--card-box-shadow-hover: var(--shy-elev-2) !important;
scrollbar-color: var(--shy-c-scroll-thumb) transparent !important;
}
/* the preferences / add-ons category list: quiet hover, accent bar on the current one. The bar
replaces a fill so the accent never sits behind the label. */
#categories > .category {
transition: background-color var(--shy-dur-fast) var(--shy-ease),
box-shadow var(--shy-dur-fast) var(--shy-ease) !important;
}
#categories > .category:hover {background-color: var(--shy-c-hover) !important;}
#categories > .category:is([selected], .selected) {
background-color: var(--shy-accent-weak) !important;
box-shadow: var(--shy-c-accent-bar) !important;
}
/* list rows: containers, applications, languages, sites */
richlistbox > richlistitem:not([selected]):hover {
background-color: var(--shy-c-hover) !important;
}
/* links and the sidebar footer had no ring of their own */
:is(a, summary, .sidebar-footer-link):focus-visible {
outline: 2px solid var(--shy-color) !important;
outline-offset: 2px !important;
}
/*-- graceful degradation, about: ----------------------------------------------------------------*/
@media (prefers-reduced-motion: reduce) {
#categories > .category {transition: none !important;}
}
@media (forced-colors: active) {
:root {
--box-shadow-card: none !important;
--box-shadow-card-hover: none !important;
--card-box-shadow: none !important;
--card-box-shadow-hover: none !important;
--border-color: CanvasText !important;
--border-color-deemphasized: CanvasText !important;
--border-color-card: CanvasText !important;
--card-border-color: CanvasText !important;
scrollbar-color: auto !important;
}
#categories > .category:hover,
richlistbox > richlistitem:not([selected]):hover {
background-color: Highlight !important;
color: HighlightText !important;
}
#categories > .category:is([selected], .selected) {
background-color: Highlight !important;
color: HighlightText !important;
box-shadow: none !important;
}
}
}
/*== EXTENSION POPUPS ==============================================================================
shy-global-content.css rounds the body of a moz-extension document. The drop shadow of a popup
belongs to the chrome panel behind it, which the page cannot reach; what the page can add is the
hairline that makes its own rounded edge read against that panel, plus the elevation that shows in
the corners the rounding cuts away.
A WebExtension popup is capped at 800x600, so that bound keeps this off full-page extension
documents; the :has() keeps it off the Sidebery sidebar, which paints its own surface above.
*/
@-moz-document url-prefix("moz-extension:") {
@media (max-width: 800px) and (max-height: 600px) {
body:not(:has(#root.Sidebar)) {
box-shadow: inset 0 0 0 1px var(--shy-c-hairline), var(--shy-elev-2) !important;
}
@media (forced-colors: active) {
body:not(:has(#root.Sidebar)) {
box-shadow: inset 0 0 0 1px CanvasText !important;
}
}
}
}
} /* shyfox.disable.polish */