tfrere's picture
tfrere HF Staff
feat(layout)!: make the grid layout the default article template
dd194bf
Raw History Blame Contribute Delete
7.97 kB
/* ============================================================================ */
/* Page grid (tokens in _grid.css) */
/* ---------------------------------------------------------------------------- */
/* .content-grid holds the TOC rail and <main> on the same row; <main> spans */
/* the screen and repeats the same named lines, so every block picks a column: */
/* body by default, .wide and .full-width break out, sidenotes go to margin. */
/* ============================================================================ */
.content-grid {
display: grid;
grid-template-columns: var(--layout-cols);
align-items: start;
margin-top: var(--layout-content-top);
}
.content-grid > main {
grid-column: screen;
grid-row: 1;
display: grid;
grid-template-columns: var(--layout-cols);
align-content: start;
min-width: 0;
margin: 0;
padding: 0;
}
.content-grid > main > * {
grid-column: body;
min-width: 0;
}
/* The first body line, the first TOC line and the first sidenote share a top edge */
.content-grid > main > :first-child {
margin-top: 0;
}
/* Prose measure */
.content-grid > main > :is(p, ul, ol, h2, h3, h4, blockquote) {
max-width: var(--layout-prose);
}
.content-grid > main :is(p, li) {
font-size: var(--layout-prose-font-size);
}
/* Long references, URLs and DOIs wrap inside their column; inline citations never break */
.sidenote,
.footer li,
.meta-col {
overflow-wrap: anywhere;
}
.content-grid main a[href^="#bib-"] {
white-space: nowrap;
}
/* ============================================================================ */
/* Width helpers */
/* ============================================================================ */
.wide,
.full-width {
box-sizing: border-box;
position: relative;
z-index: var(--z-elevated);
}
.content-grid > main > .wide,
.content-grid > main > .html-embed--wide {
grid-column: body-start / margin-end;
}
/* <HtmlEmbed wide> follows the grid instead of its own centered 1100px box */
.content-grid > main > .html-embed--wide {
width: auto;
margin-left: 0;
padding: 0;
transform: none;
border-radius: 0;
-webkit-mask: none;
mask: none;
}
.content-grid > main > .full-width {
grid-column: screen;
padding: var(--spacing-5);
background: color-mix(in srgb, var(--primary-color) 5%, var(--surface-bg));
border-block: 1px solid var(--border-color);
}
.full-width > * {
max-width: 1800px;
margin-inline: auto;
}
.full-width figure figcaption {
text-align: center !important;
}
@media (--bp-content-collapse) {
.content-grid > main > :is(.wide, .html-embed--wide) {
grid-column: screen;
padding-inline: var(--layout-outer);
}
.content-grid > main > .full-width {
padding: var(--spacing-4) var(--layout-outer);
}
}
/* ============================================================================ */
/* Theme toggle placement */
/* ============================================================================ */
#theme-toggle {
position: absolute;
top: var(--spacing-4);
left: var(--spacing-4);
margin: 0;
z-index: var(--z-overlay);
width: 40px;
height: 40px;
border-radius: 50%;
border: 1px solid var(--border-color);
background: var(--page-bg);
box-shadow: 0 2px 12px rgba(0, 0, 0, .08);
display: flex;
align-items: center;
justify-content: center;
padding: 0;
cursor: pointer;
color: var(--text-color);
transition: transform 150ms ease, box-shadow 150ms ease;
}
#theme-toggle:active {
transform: scale(0.92);
}
@media (--bp-content-collapse) {
#theme-toggle {
top: var(--spacing-2);
left: var(--spacing-2);
width: 36px;
height: 36px;
}
}
/* ------------------------------------------------------------------------- */
/* D3 neural embed responsiveness */
/* Stack canvas (left) over network (right) on small screens */
/* ------------------------------------------------------------------------- */
@media (--bp-md) {
.d3-neural .panel {
flex-direction: column;
}
.d3-neural .panel .left {
flex: 0 0 auto;
width: 100%;
}
.d3-neural .panel .right {
flex: 0 0 auto;
width: 100%;
min-width: 0;
}
}
/* ============================================================================ */
/* Auto figure numbering */
/* Applies a CSS counter across all figure-bearing components: */
/* Reference (.reference-wrapper), Image (.image-wrapper figure), */
/* and HtmlEmbed (.html-embed) */
/* ============================================================================ */
.content-grid > main {
counter-reset: figure;
}
/* Increment on every figure-like component */
.content-grid > main .reference-wrapper,
.content-grid > main .image-wrapper > figure,
.content-grid > main figure.html-embed {
counter-increment: figure;
}
/* Display "Figure N · " before each figcaption */
.content-grid > main .reference-wrapper .reference__caption::before,
.content-grid > main .image-wrapper > figure > figcaption::before,
.content-grid > main figure.html-embed > .html-embed__desc::before {
content: "Figure " counter(figure) " · ";
font-weight: 600;
}
/* ============================================================================ */
/* "paper" template - academic project-page layout (single centered column) */
/* Activated by frontmatter `template: "paper"` -> data-template="paper" */
/* The single column itself comes from the paper tokens in _grid.css. */
/* ============================================================================ */
/* ---- Paper hero banner: placed between meta and content in index.astro ---- */
.paper-hero-banner {
max-width: 920px;
margin: 32px auto 0;
padding: 0 16px;
}
.paper-hero-banner .html-embed {
border-radius: 8px;
overflow: hidden;
}
.paper-hero-banner .html-embed__card {
border-radius: 8px;
}
/* Thin separator between banner area and content */
[data-template="paper"] .paper-hero-banner + .content-grid {
margin-top: 48px;
border-top: 1px solid var(--border-color);
padding-top: 40px;
}
/* When no banner, separator is directly below meta */
[data-template="paper"] .hero-paper-meta + .content-grid {
margin-top: 32px;
border-top: 1px solid var(--border-color);
padding-top: 40px;
}
[data-template="paper"] .table-of-contents,
[data-template="paper"] .toc-topbar {
display: none;
}
/* ---- Typography: clean left-aligned headings ---- */
[data-template="paper"] .content-grid > main h2 {
text-align: left;
font-size: 1.75em;
font-weight: 700;
margin-top: 2.5em;
margin-bottom: 0.8em;
border-bottom: none;
padding-bottom: 0;
}
[data-template="paper"] .content-grid > main > h2:first-child {
margin-top: 0;
}
[data-template="paper"] .content-grid > main h3 {
font-size: 1.3em;
font-weight: 600;
margin-top: 2em;
margin-bottom: 0.6em;
}
[data-template="paper"] .content-grid > main :is(p, li) {
font-size: inherit;
}
/* ---- No figure numbering ---- */
[data-template="paper"] .content-grid > main {
counter-reset: none;
}
[data-template="paper"] .content-grid > main .reference-wrapper .reference__caption::before,
[data-template="paper"] .content-grid > main .image-wrapper > figure > figcaption::before,
[data-template="paper"] .content-grid > main figure.html-embed > .html-embed__desc::before {
content: none;
}
/* ---- Footer: headings above their content ---- */
[data-template="paper"] .footer-inner > * > .footer-heading {
grid-column: body;
justify-self: start;
text-align: left;
padding-right: 0;
margin-top: 16px;
margin-bottom: 8px;
}
[data-template="paper"] .template-credit p {
margin-top: 32px;
}