tfrere's picture
tfrere HF Staff
fix(toc): scope the hide-on-mobile rule to the desktop TOC only
bf08f85
/* ============================================================================ */
/* Layout – 3-column grid (Table of Contents / Article / Aside) */
/* ============================================================================ */
.content-grid {
max-width: var(--layout-max-width);
margin: 0 auto;
padding: 0 var(--content-padding-x);
margin-top: 40px;
display: grid;
grid-template-columns:
var(--layout-toc-width)
minmax(0, var(--layout-content-width))
var(--layout-sidenote-width);
gap: var(--layout-gap);
align-items: start;
}
.content-grid>main {
max-width: 100%;
margin: 0;
padding: 0;
}
.content-grid>main>*:first-child {
margin-top: 0;
}
@media (max-width: 1100px) {
.content-grid {
overflow: hidden;
display: block;
margin-top: var(--spacing-2);
grid-template-columns: 1fr;
}
/* Hide only the desktop TOC (the one rendered inside .content-grid).
We must NOT match the editor's mobile drawer, which renders the same
React TableOfContents component inside .toc-mobile-sidebar - matching
it here would empty the hamburger menu on narrow viewports. */
.content-grid .table-of-contents {
position: static;
display: none;
}
/* Footer responsive styles live in components/_footer.css to keep all
footer-related selectors in one place (the heading selectors need to
descend past `display: contents` wrappers, so they cannot use a direct
child combinator). */
}
/* ============================================================================ */
/* Width helpers – slightly wider than main column, and full-width to viewport */
/* ---------------------------------------------------------------------------- */
.wide,
.full-width {
box-sizing: border-box;
position: relative;
z-index: var(--z-elevated);
background-color: var(--page-bg);
}
.wide {
/* Target up to ~1100px while staying within viewport minus page gutters */
width: min(1100px, 100vw - var(--content-padding-x) * 4);
margin-left: 50%;
transform: translateX(-50%);
padding: calc(var(--content-padding-x)*4);
border-radius: calc(var(--button-radius)*4);
background-color: var(--page-bg);
-webkit-mask:
linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%),
linear-gradient(to bottom, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
-webkit-mask-composite: intersect;
mask:
linear-gradient(to right, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%),
linear-gradient(to bottom, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
mask-composite: intersect;
}
.wide>* {
margin-bottom: 0 !important;
}
.full-width {
/* Span the full viewport width and center relative to viewport */
width: 100vw;
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
padding: calc(var(--content-padding-x)*4);
border-radius: calc(var(--button-radius)*4);
background-color: var(--page-bg);
-webkit-mask:
linear-gradient(to bottom, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
mask:
linear-gradient(to bottom, transparent 0px, black 20px, black calc(100% - 20px), transparent 100%);
}
.full-width figure figcaption {
text-align: center !important;
}
@media (max-width: 1100px) {
.wide,
.full-width {
width: 100%;
margin-left: 0;
margin-right: 0;
padding: 0;
transform: none;
}
}
/* ============================================================================ */
/* 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);
}
/* Editor quick-access pill (published page only). The element ships
with `hidden` and the inline script in the published page reveals
it only when /api/auth/status returns canEdit=true, after also
filling in the avatar / handle. We split the rules across the
element + a class so the JS can target the id (it's stable across
page exports) while the styles live on the class. */
#edit-link.edit-pill {
position: absolute;
top: var(--spacing-4);
right: var(--spacing-4);
margin: 0;
z-index: var(--z-overlay);
display: inline-flex;
align-items: center;
gap: 10px;
padding: 4px 4px 4px 6px;
border-radius: 999px;
border: 1px solid var(--border-color);
background: var(--page-bg);
color: var(--text-color);
text-decoration: none;
box-shadow: 0 2px 12px rgba(0,0,0,.08);
font-size: 13px;
line-height: 1.2;
transition: transform 150ms ease, box-shadow 150ms ease,
border-color 150ms ease;
}
#edit-link.edit-pill:hover {
border-color: color-mix(in srgb, var(--primary-color) 50%, var(--border-color));
box-shadow: 0 4px 16px rgba(0,0,0,.12);
}
#edit-link.edit-pill:active {
transform: scale(0.98);
}
#edit-link.edit-pill[hidden] {
display: none;
}
.edit-pill__avatar {
width: 24px;
height: 24px;
border-radius: 50%;
object-fit: cover;
flex-shrink: 0;
background: var(--surface-bg);
}
.edit-pill__text {
color: var(--muted-color);
white-space: nowrap;
}
.edit-pill__name {
color: var(--text-color);
font-weight: 600;
}
.edit-pill__cta {
display: inline-flex;
align-items: center;
gap: 5px;
padding: 4px 10px;
border-radius: 999px;
background: var(--primary-color);
color: #fff;
font-weight: 600;
font-size: 12px;
white-space: nowrap;
flex-shrink: 0;
}
.edit-pill__cta svg {
stroke: currentColor;
}
@media (max-width: 1100px) {
#theme-toggle,
#edit-link.edit-pill {
display: none;
}
}
/* ------------------------------------------------------------------------- */
/* Hero meta bar responsiveness */
/* Two columns at md breakpoint, then one column on very small screens. */
/* ------------------------------------------------------------------------- */
@media (max-width: 768px) {
header.meta .meta-container {
display: flex;
flex-wrap: wrap;
row-gap: 12px;
column-gap: 8px;
max-width: 100%;
padding: 0 var(--spacing-4);
}
header.meta .meta-container .meta-container-cell {
flex: 1 1 calc(50% - 8px);
min-width: 0;
}
}
@media (max-width: 320px) {
header.meta .meta-container .meta-container-cell {
flex-basis: 100%;
text-align: center;
}
header.meta .affiliations {
list-style-position: inside;
padding-left: 0;
margin-left: 0;
}
header.meta .affiliations li {
text-align: center;
}
}
/* ------------------------------------------------------------------------- */
/* D3 neural embed responsiveness */
/* Stack canvas (left) over network (right) on small screens. */
/* ------------------------------------------------------------------------- */
@media (max-width: 768px) {
.d3-neural .panel {
flex-direction: column;
}
.d3-neural .panel .left,
.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" */
/* Reference: academic project pages like diffusion-cot.github.io */
/* ============================================================================ */
/* ---- 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 :global(.html-embed) {
border-radius: 8px;
overflow: hidden;
}
.paper-hero-banner :global(.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"] .meta + .content-grid,
[data-template="paper"] .hero-paper-meta + .content-grid {
margin-top: 32px;
border-top: 1px solid var(--border-color);
padding-top: 40px;
}
/* ---- Content grid: single centered column, no TOC ---- */
[data-template="paper"] .content-grid {
grid-template-columns: minmax(0, 780px);
justify-content: center;
margin-top: 0;
}
[data-template="paper"] .table-of-contents {
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 a {
background: none;
}
[data-template="paper"] .content-grid > main h2:first-child,
[data-template="paper"] .content-grid > main > *:first-child h2 {
margin-top: 0;
}
[data-template="paper"] .content-grid > main h3 {
font-size: 1.3em;
font-weight: 600;
margin-top: 2em;
margin-bottom: 0.6em;
}
/* ---- 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: simple single-column block layout ---- */
[data-template="paper"] .footer-inner {
display: block;
max-width: 780px;
}
[data-template="paper"] .references-block > .footer-heading,
[data-template="paper"] .reuse-block > .footer-heading {
text-align: left;
padding-right: 0;
margin-top: 16px;
margin-bottom: 8px;
}
[data-template="paper"] .template-credit p {
margin-top: 32px;
}