Fixes #3168. (Implemented by [jules.google](https://jules.google).) This commit resolves issues with footnote and citation styling in Distill posts, particularly ensuring that pop-up contents and the numbers themselves respect the site's light/dark theme via shadow DOM style definitions. Key changes: 1. **`d-hover-box` Internal Styling (template.v2.js):** The `<style>` tag within the `d-hover-box` component's template in `assets/js/distillpub/template.v2.js` has been updated. Styles for `.panel` (the main pop-up container) now define: - `background-color: var(--global-card-bg-color);` - `border: 1px solid var(--global-divider-color);` - `color: var(--global-text-color);` (for default text) - Links within the panel are styled with `color: var(--global-theme-color);` and `color: var(--global-hover-color);` on hover. This ensures pop-up content is correctly themed from within its shadow DOM. 2. **Footnote/Citation Number Color (template.v2.js):** The hardcoded `hsla(206, 90%, 20%, 0.7)` color previously used for footnote numbers (in `d-footnote` template) and citation numbers (in `d-cite` template) in `assets/js/distillpub/template.v2.js` has been replaced with `color: var(--global-theme-color);`. 3. **Cleaned `_sass/_distill.scss`:** Removed the (now redundant) global CSS overrides for `d-hover-box` from `_sass/_distill.scss`, as these styles are now correctly encapsulated within the `d-hover-box` component itself. These changes ensure that all aspects of Distill footnotes and citations (numbers, pop-up background, pop-up text, and links within pop-ups) are styled using theme-aware CSS variables, providing correct visual appearance and readability in both light and dark modes. --------- Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
186 lines
3.8 KiB
SCSS
186 lines
3.8 KiB
SCSS
/*******************************************************************************
|
|
* Style overrides for distill blog posts.
|
|
******************************************************************************/
|
|
|
|
d-byline {
|
|
border-top-color: var(--global-divider-color) !important;
|
|
}
|
|
|
|
d-byline h3 {
|
|
color: var(--global-text-color) !important;
|
|
}
|
|
|
|
d-byline a,
|
|
d-article d-byline a {
|
|
color: var(--global-text-color) !important;
|
|
&:hover {
|
|
color: var(--global-hover-color) !important;
|
|
}
|
|
}
|
|
|
|
d-article {
|
|
border-top-color: var(--global-divider-color) !important;
|
|
p,
|
|
h1,
|
|
h2,
|
|
h3,
|
|
h4,
|
|
h5,
|
|
h6,
|
|
li,
|
|
table {
|
|
color: var(--global-text-color) !important;
|
|
}
|
|
h1,
|
|
h2,
|
|
hr,
|
|
table,
|
|
table th,
|
|
table td {
|
|
border-bottom-color: var(--global-divider-color) !important;
|
|
}
|
|
a {
|
|
color: var(--global-theme-color) !important;
|
|
&:hover {
|
|
color: var(--global-theme-color) !important;
|
|
}
|
|
}
|
|
b i {
|
|
display: inline;
|
|
}
|
|
blockquote {
|
|
border-left: 2px solid var(--global-theme-color) !important;
|
|
}
|
|
|
|
// Style taken from code blocks
|
|
details {
|
|
color: var(--global-text-color);
|
|
background-color: var(--global-code-bg-color);
|
|
margin-top: 0;
|
|
padding: 8px 12px;
|
|
position: relative;
|
|
border-radius: 6px;
|
|
display: block;
|
|
margin-bottom: 20px;
|
|
grid-column: text;
|
|
overflow: auto;
|
|
max-width: 100%;
|
|
summary {
|
|
color: var(--global-theme-color);
|
|
}
|
|
p {
|
|
margin-top: 0.5rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
}
|
|
|
|
d-contents {
|
|
align-self: start;
|
|
grid-column: 1 / 4;
|
|
grid-row: auto / span 4;
|
|
justify-self: end;
|
|
margin-top: 0em;
|
|
padding-left: 2em;
|
|
padding-right: 3em;
|
|
border-right: 1px solid var(--global-divider-color);
|
|
width: calc(max(70%, 300px));
|
|
margin-right: 0px;
|
|
margin-top: 0em;
|
|
display: grid;
|
|
grid-template-columns:
|
|
minmax(8px, 1fr) [toc] auto
|
|
minmax(8px, 1fr) [toc-line] 1px
|
|
minmax(32px, 2fr);
|
|
|
|
nav {
|
|
grid-column: toc;
|
|
a {
|
|
border-bottom: none !important;
|
|
&:hover {
|
|
border-bottom: 1px solid var(--global-text-color) !important;
|
|
}
|
|
}
|
|
h3 {
|
|
margin-top: 0;
|
|
margin-bottom: 1em;
|
|
}
|
|
div {
|
|
display: block;
|
|
outline: none;
|
|
margin-bottom: 0.8em;
|
|
color: rgba(0, 0, 0, 0.8);
|
|
font-weight: bold;
|
|
}
|
|
ul {
|
|
padding-left: 1em;
|
|
margin-top: 0;
|
|
margin-bottom: 6px;
|
|
list-style-type: none;
|
|
li {
|
|
margin-bottom: 0.25em;
|
|
}
|
|
}
|
|
}
|
|
.figcaption {
|
|
line-height: 1.4em;
|
|
}
|
|
toc-line {
|
|
border-right: 1px solid var(--global-divider-color);
|
|
grid-column: toc-line;
|
|
}
|
|
}
|
|
|
|
d-footnote {
|
|
scroll-margin-top: 66px;
|
|
color: var(--global-theme-color) !important; /* Footnote text color */
|
|
&:hover {
|
|
color: var(--global-hover-color) !important; /* Footnote hover color */
|
|
}
|
|
}
|
|
|
|
/* Citations */
|
|
d-cite a,
|
|
a.citation {
|
|
/* Target citations within d-cite and also general .citation links */
|
|
color: var(--global-theme-color) !important;
|
|
&:hover {
|
|
color: var(--global-hover-color) !important;
|
|
}
|
|
}
|
|
}
|
|
|
|
d-appendix {
|
|
border-top-color: var(--global-divider-color) !important;
|
|
color: var(--global-distill-app-color) !important;
|
|
h3,
|
|
li,
|
|
span {
|
|
color: var(--global-distill-app-color) !important;
|
|
}
|
|
a,
|
|
a.footnote-backlink {
|
|
color: var(--global-distill-app-color) !important;
|
|
&:hover {
|
|
color: var(--global-hover-color) !important;
|
|
}
|
|
}
|
|
}
|
|
|
|
@media (max-width: 1024px) {
|
|
d-article {
|
|
d-contents {
|
|
display: block;
|
|
grid-column-start: 2;
|
|
grid-column-end: -2;
|
|
padding-bottom: 0.5em;
|
|
margin-bottom: 1em;
|
|
padding-top: 0.5em;
|
|
width: 100%;
|
|
border: 1px solid var(--global-divider-color);
|
|
nav {
|
|
grid-column: none;
|
|
}
|
|
}
|
|
}
|
|
}
|