tfrere's picture
tfrere HF Staff
publish default
3ea5ceb verified
<!DOCTYPE html><html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!--
Opt out of Chrome/Edge/Firefox in-browser translation. The article
body is authored in English and contains inline math / code that
the translator would happily garble. These metas tell the browser
to never surface the translate prompt even on non-English OS
locales. The google-named tag is the historical Chrome opt-out;
most other engines read the same tag.
-->
<meta name="google" content="notranslate">
<meta name="robots" content="notranslate">
<title>default</title>
<!--
Blocking theme bootstrap (runs before any CSS is parsed).
Sets <html data-theme> to the user's preferred mode so the
FIRST paint already uses the right palette - no dark->light
flash on a "light preference" browser. Must stay:
- inline (no network dependency)
- synchronous (no async/defer)
- placed BEFORE <style> in <head>
The rest of the theme logic (toggle button, icon swap, live
media-query sync) still runs at end-of-body where it is less
critical.
-->
<script>
(function() {
try {
var saved = localStorage.getItem('theme');
var prefersDark = window.matchMedia &&
window.matchMedia('(prefers-color-scheme: dark)').matches;
var mode = saved || (prefersDark ? 'dark' : 'light');
document.documentElement.setAttribute('data-theme', mode);
document.documentElement.style.colorScheme = mode;
} catch (e) {
document.documentElement.setAttribute('data-theme', 'dark');
}
})();
</script>
<meta name="description" content="">
<meta name="author" content="test">
<!-- Open Graph -->
<meta property="og:type" content="article">
<meta property="og:title" content="default">
<meta property="og:description" content="">
<meta property="og:image" content="https://huggingface.co/datasets/tfrere/research-article-template-editor-test2-data/resolve/main/published/default/thumb.jpg">
<meta property="article:published_time" content="2026-05-20T14:23:28.586Z">
<meta property="article:author" content="test">
<!-- Twitter Card -->
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:title" content="default">
<meta name="twitter:description" content="">
<meta name="twitter:image" content="https://huggingface.co/datasets/tfrere/research-article-template-editor-test2-data/resolve/main/published/default/thumb.jpg">
<!-- KaTeX CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.21/dist/katex.min.css" integrity="sha384-zh0CIslj+VczCZtlzBcjt5ppRcsAmDnRem7ESsYwWwg3m/OaJ2l4x7YBZl9Kxxib" crossorigin="anonymous">
<!-- Code blocks are pre-highlighted at publish time with Shiki (dual-theme
via --shiki-dark CSS vars). Zero runtime JS, zero CDN dependency. -->
<!-- Mermaid (renders <pre class="mermaid"> blocks, auto-theme dark/light) -->
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs';
function getTheme() {
return document.documentElement.getAttribute('data-theme') === 'dark' ? 'dark' : 'neutral';
}
mermaid.initialize({ startOnLoad: false, theme: getTheme() });
document.querySelectorAll('pre.mermaid').forEach(function(el) {
el.setAttribute('data-mermaid-src', el.textContent || '');
});
await mermaid.run();
new MutationObserver(function(ms) {
for (var i = 0; i < ms.length; i++) {
if (ms[i].attributeName === 'data-theme') {
mermaid.initialize({ startOnLoad: false, theme: getTheme() });
document.querySelectorAll('pre.mermaid').forEach(function(el) {
var src = el.getAttribute('data-mermaid-src');
if (src) {
el.removeAttribute('data-processed');
el.textContent = src;
}
});
mermaid.run();
break;
}
}
}).observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
</script>
<style>
/* ============================================================================ */
/* Design Tokens */
/* ============================================================================ */
:root {
/* Neutrals */
--neutral-900: rgb(17, 24, 39);
--neutral-600: rgb(107, 114, 128);
--neutral-400: rgb(185, 185, 185);
--neutral-300: rgb(228, 228, 228);
--neutral-200: rgb(245, 245, 245);
--neutral-50: rgb(249, 250, 251);
--default-font-family: Source Sans Pro, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
--font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
/* Brand (OKLCH base + derived states) */
--primary-base: oklch(0.75 0.12 47);
--primary-color: var(--primary-base);
--primary-color-hover: oklch(from var(--primary-color) calc(l - 0.05) c h);
--primary-color-active: oklch(from var(--primary-color) calc(l - 0.10) c h);
--on-primary: #ffffff;
/* Semantic colors */
--danger-color: oklch(0.65 0.19 25);
--success-color: oklch(0.65 0.15 145);
--info-color: oklch(0.65 0.12 230);
/* Text & Surfaces */
--page-bg: #fff;
--surface-bg: #f9f9f9;
--text-color: rgba(0, 0, 0, .85);
--transparent-page-contrast: rgba(255, 255, 255, .85);
--muted-color: rgba(0, 0, 0, .6);
--border-color: rgba(0, 0, 0, .1);
--code-bg: #f6f8fa;
/* Links */
--link-underline: var(--primary-color);
--link-underline-hover: var(--primary-color-hover);
/* Spacing scale */
--spacing-1: 8px;
--spacing-2: 12px;
--spacing-3: 16px;
--spacing-4: 24px;
--spacing-5: 32px;
--spacing-6: 40px;
--spacing-7: 48px;
--spacing-8: 56px;
--spacing-9: 64px;
--spacing-10: 72px;
/* Responsive breakpoints (in px, consumed directly by @media rules).
Keep in sync with any @media usage across the codebase. */
--bp-xxs-px: 320px;
--bp-xs-px: 480px;
--bp-sm-px: 640px;
--bp-md-px: 768px;
--bp-lg-px: 1024px;
--bp-xl-px: 1280px;
--bp-content-collapse-px: 1100px;
/* Page gutter and block spacing */
--content-padding-x: 16px;
--block-spacing-y: var(--spacing-4);
/* Content layout (3-col grid shared by editor & publisher) */
--layout-toc-width: 260px;
--layout-content-width: 680px;
--layout-sidenote-width: 260px;
--layout-gap: 32px;
--layout-max-width: 1280px;
/* Editor uses narrower sidebars so the chat/drawer fits comfortably.
* max-width = TOC + gap + content + gap + sidenote + 2*padding
* = 200 + 32 + 680 + 32 + 200 + 32 = 1176px
* (keeps columns at their intended widths without the grid shrinking.) */
--layout-editor-toc-width: 200px;
--layout-editor-sidenote-width: 200px;
--layout-editor-max-width: 1176px;
/* Config */
--palette-count: 8;
/* Button tokens */
--button-radius: 6px;
--button-padding-x: 16px;
--button-padding-y: 10px;
--button-font-size: 14px;
--button-icon-padding: 8px;
/* Big button */
--button-big-padding-x: 16px;
--button-big-padding-y: 12px;
--button-big-font-size: 16px;
--button-big-icon-padding: 12px;
/* Table tokens */
--table-border-radius: 8px;
--table-header-bg: oklch(from var(--surface-bg) calc(l - 0.02) c h);
--table-row-odd-bg: oklch(from var(--surface-bg) calc(l - 0.01) c h);
/* Z-index */
--z-base: 0;
--z-content: 1;
--z-elevated: 10;
--z-overlay: 1000;
--z-modal: 1100;
--z-tooltip: 1200;
/* Charts (global) */
--axis-color: var(--muted-color);
--tick-color: var(--text-color);
--grid-color: rgba(0, 0, 0, .08);
}
/* ============================================================================ */
/* Dark Theme Overrides */
/* ============================================================================ */
[data-theme="dark"] {
--page-bg: #0f1115;
--surface-bg: #07080a;
--text-color: rgba(255, 255, 255, .9);
--muted-color: rgba(255, 255, 255, .7);
--border-color: rgba(255, 255, 255, .15);
--code-bg: #12151b;
--transparent-page-contrast: rgba(0, 0, 0, .85);
/* Charts (global) */
--axis-color: var(--muted-color);
--tick-color: var(--muted-color);
--grid-color: rgba(255, 255, 255, .10);
/* Primary (lower L in dark) */
--primary-color-hover: oklch(from var(--primary-color) calc(l - 0.05) c h);
--primary-color-active: oklch(from var(--primary-color) calc(l - 0.10) c h);
--on-primary: #0f1115;
color-scheme: dark;
background: var(--page-bg);
}
html { box-sizing: border-box; }
*, *::before, *::after { box-sizing: inherit; }
body {
margin: 0;
font-family: var(--default-font-family);
color: var(--text-color);
}
audio { display: block; width: 100%; }
img,
picture {
max-width: 100%;
height: auto;
display: block;
position: relative;
z-index: var(--z-elevated);
}
/* -----------------------------------------------------------------------
Design tokens - Light / Dark theming
Usage: var(--token-name)
Toggle: data-theme="light" or data-theme="dark" on <html>
Default: follows prefers-color-scheme
----------------------------------------------------------------------- */
:root,
[data-theme="light"] {
--text-primary: #1a1a1a;
--text-secondary: #555;
--text-tertiary: #888;
--text-faint: #aaa;
--text-heading: #111;
--text-heading-secondary: #222;
--text-strong: #000;
--bg-primary: #ffffff;
--bg-secondary: #f7f7f7;
--bg-tertiary: #f0f0f0;
--bg-hover: rgba(0, 0, 0, 0.03);
--bg-overlay: rgba(0, 0, 0, 0.5);
--bg-tooltip: #ffffff;
--bg-surface: #ffffff;
--bg-code: rgba(0, 0, 0, 0.04);
--bg-code-block: #fafafa;
--border: #e0e0e0;
--border-light: #eeeeee;
--border-focus: rgba(124, 58, 237, 0.5);
--accent: #7c3aed;
--accent-light: #958DF1;
--accent-bg: rgba(124, 58, 237, 0.08);
--accent-bg-hover: rgba(124, 58, 237, 0.15);
--accent-text: #6d28d9;
--code-text: #d63384;
--code-comment: #6a737d;
--code-keyword: #8250df;
--code-string: #0a6640;
--code-number: #b35900;
--code-variable: #d63384;
--code-type: #b35900;
--code-function: #0550ae;
--code-tag: #d63384;
--code-attr: #b35900;
--code-symbol: #0a6640;
--code-meta: #0550ae;
--code-deletion: #d63384;
--danger: #dc2626;
--danger-color: #dc2626;
--danger-bg: rgba(220, 38, 38, 0.08);
--danger-bg-hover: rgba(220, 38, 38, 0.15);
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1);
--shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.12);
--katex-color: #1a1a1a;
}
[data-theme="dark"] {
--text-primary: rgba(255, 255, 255, 0.85);
--text-secondary: rgba(255, 255, 255, 0.5);
--text-tertiary: rgba(255, 255, 255, 0.4);
--text-faint: rgba(255, 255, 255, 0.25);
--text-heading: #fff;
--text-heading-secondary: rgba(255, 255, 255, 0.9);
--text-strong: rgba(255, 255, 255, 0.95);
--bg-primary: #0a0a0a;
--bg-secondary: #1a1a1a;
--bg-tertiary: #1e1e1e;
--bg-hover: rgba(255, 255, 255, 0.03);
--bg-overlay: rgba(0, 0, 0, 0.5);
--bg-tooltip: #1e1e2e;
--bg-surface: #1a1a1a;
--bg-code: rgba(255, 255, 255, 0.06);
--bg-code-block: rgba(255, 255, 255, 0.03);
--border: rgba(255, 255, 255, 0.1);
--border-light: rgba(255, 255, 255, 0.06);
--border-focus: rgba(149, 141, 241, 0.5);
--accent: #7c3aed;
--accent-light: #958DF1;
--accent-bg: rgba(149, 141, 241, 0.15);
--accent-bg-hover: rgba(149, 141, 241, 0.25);
--accent-text: #b4aef7;
--code-text: #e06c75;
--code-comment: #5c6370;
--code-keyword: #c678dd;
--code-string: #98c379;
--code-number: #d19a66;
--code-variable: #e06c75;
--code-type: #e5c07b;
--code-function: #61afef;
--code-tag: #e06c75;
--code-attr: #d19a66;
--code-symbol: #56b6c2;
--code-meta: #61afef;
--code-deletion: #e06c75;
--danger: #e06c75;
--danger-color: #e06c75;
--danger-bg: rgba(224, 108, 117, 0.12);
--danger-bg-hover: rgba(224, 108, 117, 0.25);
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
--katex-color: rgba(255, 255, 255, 0.85);
}
@media (prefers-color-scheme: dark) {
:root:not([data-theme="light"]) {
--text-primary: rgba(255, 255, 255, 0.85);
--text-secondary: rgba(255, 255, 255, 0.5);
--text-tertiary: rgba(255, 255, 255, 0.4);
--text-faint: rgba(255, 255, 255, 0.25);
--text-heading: #fff;
--text-heading-secondary: rgba(255, 255, 255, 0.9);
--text-strong: rgba(255, 255, 255, 0.95);
--bg-primary: #0a0a0a;
--bg-secondary: #1a1a1a;
--bg-tertiary: #1e1e1e;
--bg-hover: rgba(255, 255, 255, 0.03);
--bg-overlay: rgba(0, 0, 0, 0.5);
--bg-tooltip: #1e1e2e;
--bg-surface: #1a1a1a;
--bg-code: rgba(255, 255, 255, 0.06);
--bg-code-block: rgba(255, 255, 255, 0.03);
--border: rgba(255, 255, 255, 0.1);
--border-light: rgba(255, 255, 255, 0.06);
--border-focus: rgba(149, 141, 241, 0.5);
--accent: #7c3aed;
--accent-light: #958DF1;
--accent-bg: rgba(149, 141, 241, 0.15);
--accent-bg-hover: rgba(149, 141, 241, 0.25);
--accent-text: #b4aef7;
--code-text: #e06c75;
--code-comment: #5c6370;
--code-keyword: #c678dd;
--code-string: #98c379;
--code-number: #d19a66;
--code-variable: #e06c75;
--code-type: #e5c07b;
--code-function: #61afef;
--code-tag: #e06c75;
--code-attr: #d19a66;
--code-symbol: #56b6c2;
--code-meta: #61afef;
--code-deletion: #e06c75;
--danger: #e06c75;
--danger-color: #e06c75;
--danger-bg: rgba(224, 108, 117, 0.12);
--danger-bg-hover: rgba(224, 108, 117, 0.25);
--shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
--shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
--shadow-lg: 0 8px 30px rgba(0, 0, 0, 0.5);
--katex-color: rgba(255, 255, 255, 0.85);
}
}
@import "https://fonts.googleapis.com/css2?family=Source+Sans+Pro:ital,wght@0,200..900;1,200..900&display=swap";
html {
font-size: 16px;
line-height: 1.6;
}
.content-grid main {
color: var(--text-color);
}
.content-grid main p {
margin: 0 0 var(--spacing-3);
}
.content-grid main h2 {
font-weight: 600;
font-size: clamp(22px, 2.6vw, 32px);
line-height: 1.2;
margin: var(--spacing-10) 0 var(--spacing-5);
padding-bottom: var(--spacing-2);
border-bottom: 1px solid var(--border-color);
}
.content-grid main h3 {
font-weight: 700;
font-size: clamp(18px, 2.1vw, 22px);
line-height: 1.25;
margin: var(--spacing-8) 0 var(--spacing-4);
}
.content-grid main h4 {
font-weight: 600;
text-transform: uppercase;
font-size: 16px;
line-height: 1.2;
margin: var(--spacing-6) 0 var(--spacing-4);
}
.content-grid main a {
color: var(--primary-color);
text-decoration: none;
background: var(--surface-bg);
border-bottom: 1px solid color-mix(in srgb, var(--primary-color, #007AFF) 40%, transparent);
}
.content-grid main a:hover {
color: var(--primary-color-hover);
border-bottom: 1px solid color-mix(in srgb, var(--primary-color, #007AFF) 40%, transparent);
}
/* Do not underline heading links inside the article (not the TOC) */
.content-grid main h2 a,
.content-grid main h3 a,
.content-grid main h4 a,
.content-grid main h5 a,
.content-grid main h6 a {
color: inherit;
background: none;
border-bottom: none;
text-decoration: none;
}
.content-grid main h2 a:hover,
.content-grid main h3 a:hover,
.content-grid main h4 a:hover,
.content-grid main h5 a:hover,
.content-grid main h6 a:hover {
color: inherit;
border-bottom: none;
text-decoration: none;
}
.content-grid main ul,
.content-grid main ol {
padding-left: 24px;
margin: 0 0 var(--spacing-3);
}
.content-grid main li {
margin-bottom: var(--spacing-2);
}
.content-grid main li:last-child {
margin-bottom: 0;
}
.content-grid main blockquote {
border-left: 2px solid var(--border-color);
padding-left: var(--spacing-4);
font-style: italic;
color: var(--muted-color);
margin: var(--spacing-4) 0;
}
.content-grid main hr {
border: none;
border-bottom: 1px solid var(--border-color);
margin: var(--spacing-5) 0;
}
.muted {
color: var(--muted-color);
}
[data-footnote-ref] {
margin-left: 4px;
}
.content-grid main mark {
background-color: color-mix(in srgb, var(--primary-color, #007AFF) 10%, transparent);
border: 1px solid color-mix(in srgb, var(--primary-color) 18%, transparent);
color: inherit;
padding: 4px 6px;
border-radius: 4px;
font-weight: 500;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
}
.feature-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 12px;
margin: 46px 0;
}
.feature-card {
display: flex;
flex-direction: column;
padding: 16px;
border: 1px solid color-mix(in srgb, var(--primary-color) 40%, transparent);
;
background: color-mix(in srgb, var(--primary-color, #007AFF) 05%, transparent) !important;
border-radius: 8px;
text-decoration: none;
color: inherit;
transition: all 0.2s ease;
}
.feature-card:hover {
transform: translateY(-2px);
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.feature-card strong {
font-size: 14px;
font-weight: 600;
color: var(--text-color);
color: var(--primary-color) !important;
margin-bottom: 0px !important;
}
.feature-card span {
font-size: 12px;
color: var(--muted-color);
color: var(--primary-color) !important;
margin-bottom: 0px !important;
opacity: 1;
}
.katex .tag {
background: none;
border: none;
opacity: 0.4;
}
/* ============================================================================ */
/* 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;
}
.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);
}
@media (max-width: 1100px) {
#theme-toggle {
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;
}
/* ============================================================================ */
/* Inline code */
/* ============================================================================ */
code {
font-size: 14px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
border-radius: 0.3em;
border: 1px solid var(--border-color);
color: var(--text-color);
font-weight: 400;
line-height: 1.5;
}
p code,
.note code {
white-space: nowrap;
padding: calc(var(--spacing-1)/3) calc(var(--spacing-1)/2);
}
/* ============================================================================ */
/* Shiki code blocks */
/* ============================================================================ */
.astro-code {
position: relative;
border: 1px solid var(--border-color);
background-color: var(--surface-bg) !important;
border-radius: 6px;
padding: 0;
font-size: 14px;
--code-gutter-width: 2.5em;
}
/* Shared sizing & horizontal scroll for code containers */
.astro-code,
section.content-grid pre {
width: 100%;
max-width: 100%;
box-sizing: border-box;
-webkit-overflow-scrolling: touch;
padding: 0;
margin-bottom: var(--block-spacing-y) !important;
overflow-x: auto;
}
section.content-grid pre.astro-code {
margin: 0;
padding: var(--spacing-1) 0;
}
section.content-grid pre code {
display: inline-block;
min-width: 100%;
}
/* Plain-text blocks: always wrap lines (prompts, prose, etc.) */
.astro-code[data-language="text"] {
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
}
.astro-code[data-language="text"] .line {
display: block;
}
/* Wrap long lines only on small screens to prevent layout overflow */
@media (max-width: 1100px) {
.astro-code,
section.content-grid pre {
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: break-word;
}
section.content-grid pre code {
white-space: pre-wrap;
display: block;
min-width: 0;
}
}
/* Themes */
[data-theme='light'] .astro-code {
background-color: var(--code-bg);
}
/* Apply token color from per-span vars exposed by Shiki dual themes */
[data-theme='light'] .astro-code span {
color: var(--shiki-light) !important;
}
[data-theme='dark'] .astro-code span {
color: var(--shiki-dark) !important;
}
/* Optional: boost contrast for light theme */
[data-theme='light'] .astro-code {
--shiki-foreground: #24292f;
--shiki-background: #ffffff;
}
/* Line numbers for Shiki-rendered code blocks */
.astro-code code {
counter-reset: astro-code-line;
display: block;
background: none;
border: none;
}
.astro-code .line {
display: inline-block;
position: relative;
padding-left: calc(var(--code-gutter-width) + var(--spacing-1));
min-height: 1.25em;
}
.astro-code .line::before {
counter-increment: astro-code-line;
content: counter(astro-code-line);
position: absolute;
left: 0;
top: 0;
bottom: 0;
width: calc(var(--code-gutter-width));
text-align: right;
color: var(--muted-color);
opacity: .3;
user-select: none;
padding-right: var(--spacing-2);
border-right: 1px solid var(--border-color);
}
.astro-code .line:empty::after {
content: "\00a0";
}
/* Hide trailing empty line added by parsers */
.astro-code code>.line:last-child:empty {
display: none;
}
/* ============================================================================ */
/* Non-Shiki pre wrapper (rehype) */
/* ============================================================================ */
.code-card {
position: relative;
}
.code-card .code-copy {
position: absolute;
top: var(--spacing-2);
right: var(--spacing-2);
z-index: 3;
display: none;
}
.code-card:hover .code-copy {
display: block;
}
.code-card .code-copy svg {
width: 16px;
height: 16px;
display: block;
fill: currentColor;
}
.code-card pre {
margin: 0 0 var(--spacing-1);
}
/* When no copy button (single-line), keep the label in the top-right corner */
.code-card.no-copy::after {
top: 8px;
right: 8px;
}
/* ============================================================================ */
/* Contextual overrides */
/* ============================================================================ */
/* Inside Accordions: remove padding and border on code containers */
.accordion .astro-code {
padding: 0;
border: none;
}
.accordion .astro-code {
margin-bottom: 0 !important;
}
.accordion .code-output {
border: none;
border-top: 1px solid var(--border-color) !important;
}
.accordion pre {
margin-bottom: 0 !important;
}
.accordion .code-card pre {
margin: 0 !important;
}
/* ============================================================================ */
/* Language/extension vignette (bottom-right, discreet) */
/* ============================================================================ */
/* .astro-code::after {
content: attr(data-language);
position: absolute;
right: 0;
bottom: 0;
font-size: 10px;
line-height: 1;
text-transform: uppercase;
color: var(--muted-color);
background: var(--surface-bg);
border-top: 1px solid var(--border-color);
border-left: 1px solid var(--border-color);
opacity: 1;
border-radius: 8px 0 0 0;
padding: 4px 6px;
pointer-events: none;
} */
/* Fallback if Shiki uses data-lang instead of data-language */
/* .astro-code[data-lang]::after { content: attr(data-lang); }
.astro-code[data-language="typescript"]::after { content: "ts"; }
.astro-code[data-language="tsx"]::after { content: "tsx"; }
.astro-code[data-language="javascript"]::after,
.astro-code[data-language="node"]::after,
.astro-code[data-language="jsx"]::after { content: "js"; }
.astro-code[data-language="python"]::after { content: "py"; }
.astro-code[data-language="bash"]::after,
.astro-code[data-language="shell"]::after,
.astro-code[data-language="sh"]::after { content: "sh"; }
.astro-code[data-language="markdown"]::after { content: "md"; }
.astro-code[data-language="yaml"]::after,
.astro-code[data-language="yml"]::after { content: "yml"; }
.astro-code[data-language="html"]::after { content: "html"; }
.astro-code[data-language="css"]::after { content: "css"; }
.astro-code[data-language="json"]::after { content: "json"; } */
/* In Accordions, keep same bottom-right placement */
.accordion .astro-code::after {
right: 0;
bottom: 0;
}
/* ============================================================================ */
/* Results blocks glued to code blocks */
/* ============================================================================ */
.code-output {
position: relative;
background: oklch(from var(--code-bg) calc(l - 0.005) c h);
border: 1px solid var(--border-color);
border-radius: 6px;
margin-top: 0;
margin-bottom: var(--block-spacing-y);
padding: 0 !important;
}
.code-output pre {
padding: calc(var(--spacing-3) + 6px) var(--spacing-3) var(--spacing-3) var(--spacing-3) !important;
}
/* If immediately following a code container, keep tight visual connection */
.code-card+.code-output,
.astro-code+.code-output,
section.content-grid pre+.code-output {
margin-top: 0;
border-top: none;
border-top-left-radius: 0;
border-top-right-radius: 0;
box-shadow: inset 0 8px 12px -12px rgba(0, 0, 0, 0.15);
}
/* Remove bottom margin on code when immediately followed by results */
.astro-code:has(+ .code-output) {
margin-bottom: 0 !important;
}
.code-card:has(+ .code-output) .astro-code {
margin-bottom: 0 !important;
}
section.content-grid pre:has(+ .code-output) {
margin-bottom: 0 !important;
}
/* Remove bottom border radius on code when followed by results */
.astro-code:has(+ .code-output) {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
.code-card:has(+ .code-output) .astro-code {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
section.content-grid pre:has(+ .code-output) {
border-bottom-left-radius: 0;
border-bottom-right-radius: 0;
}
/* Small top-left label */
.code-output::before {
content: "Output";
position: absolute;
top: 0;
right: 0;
font-size: 10px;
line-height: 1;
color: var(--muted-color);
text-transform: uppercase;
letter-spacing: 0.04em;
border-top: none;
border-right: none;
border-radius: 0 0 0 6px;
padding: 10px 10px;
}
/* Very subtle top shadow so results feels under the code */
.code-output {}
.code-output> :where(*):first-child {
margin-top: 0 !important;
}
.code-output> :where(*):last-child {
margin-bottom: 0 !important;
}
/* ============================================================================ */
/* Optional filename tag above code blocks */
/* ============================================================================ */
.code-filename {
display: inline-block;
font-size: 12px;
line-height: 1;
color: var(--muted-color);
background: var(--surface-bg);
border: 1px solid var(--border-color);
border-bottom: none;
border-radius: 6px 6px 0 0;
padding: 4px 8px;
margin: 0;
}
.code-filename+.code-card .astro-code,
.code-filename+.astro-code,
.code-filename+section.content-grid pre {
border-top-left-radius: 0;
border-top-right-radius: 6px;
}
button, .button {
appearance: none;
background: linear-gradient(15deg, var(--primary-color) 0%, var(--primary-color-hover) 35%);
color: white;
border: 1px solid transparent;
border-radius: var(--button-radius);
padding: var(--button-padding-y) var(--button-padding-x);
font-size: var(--button-font-size);
line-height: 1;
cursor: pointer;
display: inline-block;
text-decoration: none;
transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .02s ease;
}
/* Icon-only buttons: equal X/Y padding */
button:has(> svg:only-child),
.button:has(> svg:only-child) {
padding: var(--button-icon-padding);
}
button:hover, .button:hover {
filter: brightness(96%);
}
button:active, .button:active {
transform: translateY(1px);
}
button:focus-visible, .button:focus-visible {
outline: none;
}
button:disabled, .button:disabled {
opacity: .6;
cursor: not-allowed;
}
/* Ghost/Muted button: subtle outline, primary color text/border */
.button--ghost {
background: transparent !important;
color: var(--primary-color) !important;
border-color: var(--primary-color) !important;
}
.button--ghost:hover {
color: var(--primary-color-hover) !important;
border-color: var(--primary-color-hover) !important;
filter: none;
}
/* Big button: larger padding and font size */
.button.button--big {
padding: var(--button-big-padding-y) var(--button-big-padding-x);
font-size: var(--button-big-font-size);
}
.button.button--big:has(> svg:only-child) {
padding: var(--button-big-icon-padding);
}
.button-group .button {
margin: 5px;
}
.content-grid main table {
border-collapse: collapse;
table-layout: auto;
margin: 0;
background-color: var(--surface-bg);
}
.content-grid main th,
.content-grid main td {
border-bottom: 1px solid var(--border-color);
padding: 6px 8px;
font-size: 15px;
white-space: nowrap;
/* prevent squashing; allow horizontal scroll instead */
word-break: auto-phrase;
/* white-space: break-spaces; */
vertical-align: top;
}
.content-grid main thead th {
border-bottom: 1px solid var(--border-color);
}
.content-grid main thead th {
border-bottom: 1px solid var(--border-color);
}
.content-grid main thead th {
background: var(--table-header-bg);
padding-top: 10px;
padding-bottom: 10px;
font-weight: 600;
}
.content-grid main hr {
border: none;
border-bottom: 1px solid var(--border-color);
margin: var(--spacing-5) 0;
}
/* Scroll wrapper: keeps table 100% width but enables horizontal scroll when needed */
.content-grid main .table-scroll {
width: 100%;
overflow-x: auto;
-webkit-overflow-scrolling: touch;
border: 1px solid var(--border-color);
border-radius: var(--table-border-radius);
background: var(--surface-bg);
margin: 0 0 var(--block-spacing-y);
}
.content-grid main .table-scroll>table {
width: fit-content;
min-width: 100%;
max-width: none;
}
/* Vertical dividers between columns (no outer right border) */
.content-grid main .table-scroll>table th,
.content-grid main .table-scroll>table td {
border-right: 1px solid var(--border-color);
}
.content-grid main .table-scroll>table th:last-child,
.content-grid main .table-scroll>table td:last-child {
border-right: none;
}
.content-grid main .table-scroll>table thead th:first-child {
border-top-left-radius: var(--table-border-radius);
}
.content-grid main .table-scroll>table thead th:last-child {
border-top-right-radius: var(--table-border-radius);
}
.content-grid main .table-scroll>table tbody tr:last-child td:first-child {
border-bottom-left-radius: var(--table-border-radius);
}
.content-grid main .table-scroll>table tbody tr:last-child td:last-child {
border-bottom-right-radius: var(--table-border-radius);
}
/* Zebra striping for odd rows */
.content-grid main .table-scroll>table tbody tr:nth-child(odd) td {
background: var(--table-row-odd-bg);
}
/* Remove bottom border on last row */
.content-grid main .table-scroll>table tbody tr:last-child td {
border-bottom: none;
}
/* Accordion context: remove outer borders/radius and fit content flush */
.accordion .accordion__content .table-scroll {
border: none;
border-radius: 0;
margin: 0;
margin-bottom: 0 !important;
}
/* Ensure no bottom margin even if table isn't wrapped (fallback) */
.accordion .accordion__content table {
margin: 0 !important;
}
.accordion .accordion__content .table-scroll>table thead th:first-child,
.accordion .accordion__content .table-scroll>table thead th:last-child,
.accordion .accordion__content .table-scroll>table tbody tr:last-child td:first-child,
.accordion .accordion__content .table-scroll>table tbody tr:last-child td:last-child {
border-radius: 0;
}
/* Fallback for browsers without fit-content support */
@supports not (width: fit-content) {
.content-grid main .table-scroll>table {
width: max-content;
min-width: 100%;
}
}
.tag-list { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.tag {
display: inline-flex;
align-items: center;
gap: 6px;
padding: 8px 12px;
font-size: 12px;
line-height: 1;
border-radius: var(--button-radius);
background: var(--surface-bg);
border: 1px solid var(--border-color);
color: var(--text-color);
}
.card {
background: var(--surface-bg);
border: 1px solid var(--border-color) !important;
border-radius: 12px;
padding: var(--spacing-3);
z-index: calc(var(--z-elevated) + 1);
position: relative;
margin-bottom: 0;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transition: all 0.2s ease;
overflow: hidden;
text-decoration: none;
color: inherit;
display: block;
}
.card:hover {
text-decoration: none;
color: inherit;
}
.card.no-padding,
.card.card--p0 {
padding: 0;
}
.card:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.card figcaption {
color: var(--text-color) !important;
font-weight: 600 !important;
font-size: 1rem !important;
text-align: center !important;
padding: var(--spacing-3) !important;
margin: 0 !important;
}
.card .image-wrapper,
.card .image-wrapper figure {
margin: 0 !important;
width: 100% !important;
display: block !important;
}
.card img {
border-radius: 8px 8px 0 0 !important;
width: 100% !important;
max-width: 100% !important;
height: 120px !important;
object-fit: cover !important;
display: block !important;
border-bottom: 1px solid var(--border-color) !important;
transition: all 0.2s ease;
}
.card.template-card img {
height: auto !important;
object-fit: contain !important;
}
.card h3,
.card h4,
.card h5 {
margin-top: 0 !important;
font-weight: 900 !important;
width: 100%;
}
.card::after {
display: none !important;
}
.card-title-container {
padding: var(--spacing-3) var(--spacing-4) var(--spacing-4) var(--spacing-4);
}
.card-title {
color: var(--text-color);
font-size: 0.9rem;
margin: 0 0 var(--spacing-1) 0 !important;
font-weight: 600;
line-height: 1.4;
white-space: normal;
}
.card-subtitle {
color: var(--muted-color);
font-size: 0.75rem;
margin: 0 !important;
line-height: 1.5;
white-space: normal;
}
.card-cta {
flex: 1;
min-width: 0;
display: flex;
align-items: center;
justify-content: center;
background: var(--surface-bg);
border: 2px dashed var(--border-color) !important;
}
.card-cta:hover {
transform: none;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
border: 2px dashed var(--border-color) !important;
}
.card-cta-content {
text-align: center;
padding: var(--spacing-4);
}
.card-cta h3,
.card-cta h4,
.card-cta h5 {
color: var(--text-color);
font-weight: 900 !important;
margin-bottom: var(--spacing-1) !important;
}
.card-cta p {
color: var(--muted-color);
font-size: 0.9rem;
margin: 0 !important;
}
@media print {
.card,
.card-cta {
box-shadow: none;
}
}
/* ============================================================================ */
/* Form Elements - Modern Minimal Design */
/* ============================================================================ */
/* ---------- Select ---------- */
select {
-webkit-appearance: none;
-moz-appearance: none;
appearance: none;
background-color: var(--page-bg, #fff);
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
border-radius: 6px;
padding: 6px 28px 6px 10px;
font-family: inherit;
font-size: 0.875rem;
color: var(--text-color, inherit);
cursor: pointer;
outline: none;
transition: border-color 0.15s ease, box-shadow 0.15s ease;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
background-repeat: no-repeat;
background-position: right 8px center;
background-size: 10px 6px;
}
select:hover,
select:focus {
border-color: var(--primary-color, #7c3aed);
}
select:focus {
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
select:disabled {
opacity: 0.5;
cursor: not-allowed;
}
[data-theme="dark"] select {
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23999' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
/* ---------- Checkbox ---------- */
input[type="checkbox"] {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border: 2px solid var(--border-color, rgba(0, 0, 0, 0.2));
border-radius: 3px;
background-color: var(--page-bg, #fff);
cursor: pointer;
position: relative;
transition: all 0.15s ease;
flex-shrink: 0;
}
input[type="checkbox"]:hover {
border-color: var(--primary-color, #7c3aed);
}
input[type="checkbox"]:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
input[type="checkbox"]:checked {
background-color: var(--primary-color, #7c3aed);
border-color: var(--primary-color, #7c3aed);
}
input[type="checkbox"]:checked::before {
content: '';
position: absolute;
top: 1px;
left: 4px;
width: 4px;
height: 8px;
border: solid var(--on-primary, #fff);
border-width: 0 2px 2px 0;
transform: rotate(45deg);
}
input[type="checkbox"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ---------- Radio ---------- */
input[type="radio"] {
-webkit-appearance: none;
appearance: none;
width: 16px;
height: 16px;
border: 2px solid var(--border-color, rgba(0, 0, 0, 0.2));
border-radius: 50%;
background-color: var(--page-bg, #fff);
cursor: pointer;
position: relative;
transition: all 0.15s ease;
flex-shrink: 0;
}
input[type="radio"]:hover {
border-color: var(--primary-color, #7c3aed);
}
input[type="radio"]:focus {
outline: none;
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
input[type="radio"]:checked {
border-color: var(--primary-color, #7c3aed);
}
input[type="radio"]:checked::before {
content: '';
position: absolute;
top: 2px;
left: 2px;
width: 8px;
height: 8px;
border-radius: 50%;
background-color: var(--primary-color, #7c3aed);
}
input[type="radio"]:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ---------- Text inputs ---------- */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
input[type="search"],
textarea {
-webkit-appearance: none;
appearance: none;
background-color: var(--page-bg, #fff);
border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
border-radius: 6px;
padding: 6px 10px;
font-family: inherit;
font-size: 0.875rem;
color: var(--text-color, inherit);
transition: border-color 0.15s ease, box-shadow 0.15s ease;
width: 100%;
}
input[type="text"]:hover,
input[type="email"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
input[type="url"]:hover,
input[type="search"]:hover,
textarea:hover {
border-color: var(--primary-color, #7c3aed);
}
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
input[type="url"]:focus,
input[type="search"]:focus,
textarea:focus {
outline: none;
border-color: var(--primary-color, #7c3aed);
box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}
input[type="text"]:disabled,
input[type="email"]:disabled,
input[type="password"]:disabled,
input[type="number"]:disabled,
input[type="url"]:disabled,
input[type="search"]:disabled,
textarea:disabled {
opacity: 0.5;
cursor: not-allowed;
}
/* ---------- Label ---------- */
label {
display: flex;
align-items: center;
font-size: 0.875rem;
color: var(--text-color, inherit);
cursor: pointer;
margin-bottom: 0;
line-height: 1.4;
user-select: none;
}
/* ---------- Form layout helpers ---------- */
.form-group {
margin-bottom: 12px;
display: flex;
align-items: center;
gap: 8px;
}
.form-group label {
margin-bottom: 0;
}
.form-group.vertical {
flex-direction: column;
align-items: flex-start;
}
.form-group.vertical label {
margin-bottom: 4px;
}
.form-inline {
display: flex;
align-items: center;
gap: 8px;
margin-bottom: 12px;
}
.form-inline label {
margin-bottom: 0;
}
.mermaid .nodeLabel p {
color: var(--text-color) !important;
}
.mermaid .cluster-label .nodeLabel {
color: var(--text-color) !important;
}
/* Styles pour le texte des subgraphs/clusters - gérer les foreignObject */
.mermaid .cluster-label text,
.mermaid .cluster-label .nodeLabel text,
.mermaid .cluster-label foreignObject,
.mermaid .cluster-label foreignObject div,
.mermaid .cluster-label foreignObject span {
color: var(--text-color) !important;
fill: var(--text-color) !important;
}
/* Styles spécifiques pour les clusters/subgraphs */
.mermaid .cluster rect {
fill: transparent !important;
stroke: var(--border-color) !important;
stroke-width: 1px !important;
}
.mermaid .cluster-label {
color: var(--text-color) !important;
fill: var(--text-color) !important;
}
/* Masquer le flicker pendant la conversion */
.mermaid-zoom-wrapper.converting {
opacity: 0.7;
transition: opacity 0.2s ease;
}
.mermaid-zoom-wrapper.converting .mermaid {
opacity: 0.7;
transition: opacity 0.2s ease;
}
/* Assurer que les diagrammes Mermaid prennent toute la largeur */
.mermaid {
width: 100% !important;
max-width: 100% !important;
display: block !important;
background: none !important;
}
/* Dark mode: ensure Mermaid SVG elements use theme-aware colors */
[data-theme="dark"] .mermaid .edgePath .path,
[data-theme="dark"] .mermaid .flowchart-link {
stroke: rgba(255, 255, 255, .4) !important;
}
[data-theme="dark"] .mermaid .arrowheadPath,
[data-theme="dark"] .mermaid .edgePath marker path {
fill: rgba(255, 255, 255, .4) !important;
stroke: rgba(255, 255, 255, .4) !important;
}
[data-theme="dark"] .mermaid .edgeLabel,
[data-theme="dark"] .mermaid .edgeLabel rect {
background-color: transparent !important;
fill: transparent !important;
}
[data-theme="dark"] .mermaid .edgeLabel span {
color: var(--text-color) !important;
}
[data-theme="dark"] .mermaid text {
fill: var(--text-color) !important;
}
[data-theme="dark"] .mermaid .label foreignObject div {
color: var(--text-color) !important;
}
/* Styles pour les SVG Mermaid */
.mermaid svg {
width: 100% !important;
max-width: 100% !important;
height: auto !important;
}
/* Styles pour les wrappers de zoom Mermaid */
.mermaid-zoom-wrapper {
display: block !important;
width: 100% !important;
max-width: 100% !important;
cursor: zoom-in;
position: relative;
}
.mermaid-zoom-wrapper .mermaid {
width: 100% !important;
max-width: 100% !important;
display: block !important;
}
.mermaid-zoom-wrapper .mermaid svg {
width: 100% !important;
max-width: 100% !important;
height: auto !important;
display: block !important;
}
/* Styles pour les nœuds avec bords arrondis et bordure interne */
.mermaid rect:not(.flowchart-link),
.mermaid .node rect,
.mermaid .nodeLabel rect,
.mermaid .cluster rect {
rx: 8px !important;
ry: 8px !important;
stroke: color-mix(in srgb, var(--text-color) 20%, transparent) !important;
stroke-width: 1px !important;
/* Décalage pour créer l'effet de bordure interne */
}
/* Styles pour les diagrammes Mermaid zoomables */
.mermaid-zoom-wrapper:hover {
opacity: 0.95;
transition: opacity 0.2s ease;
}
/* Appliquer le même style que les images zoomables */
.mermaid-zoom-wrapper[data-zoomable="1"] {
cursor: zoom-in;
}
/* Styles pour le mode zoom ouvert */
.medium-zoom--opened .mermaid-zoom-wrapper {
cursor: zoom-out;
}
/* Exclude Mermaid images from dark mode inversion filter */
[data-theme="dark"] .mermaid-zoom-wrapper img.medium-zoom-image--opened {
filter: none !important;
}
[data-theme="dark"] .mermaid-zoom-wrapper .medium-zoom-image--opened {
filter: none !important;
}
[data-theme="dark"] .mermaid-zoom-wrapper img[data-zoomable="1"].medium-zoom-image--opened {
filter: none !important;
}
.medium-zoom-overlay {
z-index: 9999999 !important;
}
.medium-zoom-image--opened {
z-index: 10000000 !important;
}
[data-theme="dark"] .mermaid-zoom-image.medium-zoom-image--opened {
filter: none !important;
}
.medium-zoom-overlay:has(.mermaid-zoom-wrapper) {
z-index: 9999999 !important;
}
.mermaid-zoom-image.medium-zoom-image--opened {
z-index: 10000000 !important;
}
.mermaid-zoom-wrapper:has(.medium-zoom-image--opened) {
z-index: 10000000 !important;
}
.medium-zoom--opened .mermaid-zoom-wrapper {
opacity: 0;
z-index: calc(var(--z-base) - 1);
transition: opacity 0.3s ease;
}
.medium-zoom--opened .mermaid-zoom-wrapper:has(.medium-zoom--opened) {
opacity: 1;
z-index: var(--z-overlay);
}
.medium-zoom--opened .mermaid-zoom-wrapper.zoom-active {
opacity: 1 !important;
z-index: var(--z-overlay) !important;
}
/* Styles spécifiques pour différents types de diagrammes */
/* Flowchart/Graph - styles généraux */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node ellipse,
.mermaid .label rect {
rx: 8px !important;
ry: 8px !important;
}
/* Flowchart - nœuds principaux */
.mermaid .flowchart-node rect,
.mermaid .flowchart-label rect {
rx: 8px !important;
ry: 8px !important;
}
/* Sequence diagram */
.mermaid .actor rect,
.mermaid .participant rect {
rx: 8px !important;
ry: 8px !important;
}
/* ER diagram */
.mermaid .entityBox rect,
.mermaid .er .entityBox rect {
rx: 6px !important;
ry: 6px !important;
}
/* Gantt chart */
.mermaid .section0 rect,
.mermaid .section1 rect,
.mermaid .section2 rect,
.mermaid .section3 rect {
rx: 4px !important;
ry: 4px !important;
}
/* Gitgraph */
.mermaid .commit rect {
rx: 12px !important;
ry: 12px !important;
}
/* Mindmap */
.mermaid .mindmap-node rect {
rx: 10px !important;
ry: 10px !important;
}
/* Sankey */
.mermaid .sankey .node rect {
rx: 4px !important;
ry: 4px !important;
}
/* Timeline */
.mermaid .timeline rect {
rx: 6px !important;
ry: 6px !important;
}
/* Pie chart */
.mermaid .pieTitleText {
rx: 8px !important;
ry: 8px !important;
}
/* Journey */
.mermaid .journey .section0 rect,
.mermaid .journey .section1 rect,
.mermaid .journey .section2 rect,
.mermaid .journey .section3 rect {
rx: 8px !important;
ry: 8px !important;
}
/* ============================================================================ */
/* Hero + Meta bar */
/* Extracted from HeroArticle.astro scoped styles. */
/* Shared between editor (FrontmatterHero.tsx) and publisher (html-renderer). */
/* ============================================================================ */
/* ---- Hero section ---- */
.hero {
width: 100%;
padding: 64px 16px 16px;
text-align: center;
}
.hero-title {
font-size: clamp(34px, 5vw, 54px);
font-weight: 800;
line-height: 1.12;
letter-spacing: -0.02em;
margin: 0 auto 8px;
max-width: 780px;
text-wrap: balance;
}
.hero-title[data-title-size="md"] {
font-size: clamp(28px, 4vw, 44px);
}
.hero-title[data-title-size="sm"] {
font-size: clamp(24px, 3.2vw, 38px);
}
.hero-banner {
max-width: 980px;
margin: 0 auto;
aspect-ratio: 5 / 2;
overflow: hidden;
}
.hero-banner iframe {
background: transparent;
}
/* Filled banner: hosts the iframe AND the remove button overlay. */
.hero-banner--filled {
position: relative;
}
.hero-banner-remove {
position: absolute;
top: 8px;
right: 8px;
display: inline-flex;
align-items: center;
justify-content: center;
width: 28px;
height: 28px;
padding: 0;
border: 1px solid var(--border-color);
border-radius: 6px;
background: var(--surface-bg, rgba(0, 0, 0, 0.6));
color: var(--text-color);
cursor: pointer;
opacity: 0;
transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
}
.hero-banner--filled:hover .hero-banner-remove,
.hero-banner-remove:focus-visible {
opacity: 1;
}
.hero-banner-remove:hover {
border-color: var(--text-color);
background: var(--surface-bg, rgba(0, 0, 0, 0.8));
}
/* Empty-banner placeholder: shown when the article has no banner set.
Keeps the same aspect-ratio as a real banner so the layout doesn't jump
when a user uploads an image or generates a chart. */
.hero-banner--empty {
display: flex;
align-items: center;
justify-content: center;
border: 1px dashed var(--border-color);
border-radius: 8px;
background: var(--surface-bg, transparent);
transition: border-color 120ms ease, background 120ms ease;
}
.hero-banner--empty:hover {
border-color: var(--text-color);
}
.hero-banner-empty__inner {
display: flex;
flex-direction: column;
align-items: center;
gap: 14px;
padding: 24px;
text-align: center;
}
.hero-banner-empty__hint {
margin: 0;
color: var(--muted-color);
font-size: 14px;
}
.hero-banner-empty__actions {
display: flex;
gap: 8px;
flex-wrap: wrap;
justify-content: center;
}
.hero-banner-empty__actions .btn {
display: inline-flex;
align-items: center;
gap: 6px;
}
.hero-desc {
color: var(--muted-color);
font-style: italic;
margin: 0 auto 16px;
max-width: 55%;
}
@media (max-width: 768px) {
.hero-banner { aspect-ratio: auto; }
.hero-desc { max-width: 90%; }
}
/* ---- Meta bar ---- */
.meta {
border-top: 1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
padding: 1rem 0;
font-size: 0.9rem;
}
.meta-container {
max-width: 980px;
display: flex;
flex-direction: row;
justify-content: space-between;
margin: 0 auto;
padding: 0 var(--content-padding-x, 16px);
gap: 8px;
flex-wrap: wrap;
row-gap: 12px;
}
.meta-container a:not(.button) {
color: var(--primary-color);
text-decoration: underline;
text-underline-offset: 2px;
text-decoration-thickness: 0.06em;
text-decoration-color: var(--link-underline);
transition: text-decoration-color 0.15s ease-in-out;
}
.meta-container a:hover {
text-decoration-color: var(--link-underline-hover);
}
.meta-container-cell {
display: flex;
flex-direction: column;
gap: 8px;
max-width: 400px;
}
.meta-container-cell h3 {
margin: 0;
font-size: 12px;
font-weight: 400;
color: var(--muted-color);
text-transform: uppercase;
letter-spacing: 0.02em;
}
.meta-container-cell p {
margin: 0;
}
.authors {
margin: 0;
list-style-type: none;
padding-left: 0;
display: flex;
flex-wrap: wrap;
}
.authors li {
white-space: nowrap;
padding: 0;
}
.affiliations {
margin: 0;
padding-left: 1.25em;
}
.affiliations li {
margin: 0;
}
@media (max-width: 768px) {
.meta-container-cell:nth-child(even) { text-align: right; }
.meta-container-cell:last-child:nth-child(odd) {
flex-grow: 0;
flex-basis: auto;
margin-left: auto;
text-align: right;
}
}
/* ============================================================================ */
/* Table of Contents */
/* Extracted from TableOfContents.astro scoped styles. */
/* Shared between editor and publisher. */
/* ============================================================================ */
/* Loading state */
.table-of-contents.toc-loading,
.toc-mobile-sidebar.toc-loading {
opacity: 0;
transition: opacity 0.3s ease-in-out;
}
.table-of-contents.toc-loaded,
.toc-mobile-sidebar.toc-loaded {
opacity: 1;
}
/* Desktop TOC */
.table-of-contents {
position: sticky;
top: 32px;
margin-top: 12px;
}
.table-of-contents nav {
border-left: 1px solid var(--border-color);
padding-left: 16px;
font-size: 13px;
}
.table-of-contents .title {
font-weight: 600;
font-size: 14px;
margin-bottom: 8px;
}
.table-of-contents nav ul {
margin: 0 0 6px;
padding-left: 1em;
}
.table-of-contents nav li {
list-style: none;
margin: 0.25em 0;
}
.table-of-contents nav a,
.table-of-contents nav a:link,
.table-of-contents nav a:visited {
color: var(--text-color);
text-decoration: none;
border-bottom: none;
background: none;
cursor: pointer;
}
.table-of-contents nav > ul > li > a {
font-weight: 700;
}
.table-of-contents nav a:hover {
text-decoration: underline solid var(--muted-color);
}
.table-of-contents nav a.active {
color: var(--primary-color);
text-decoration: underline;
text-decoration-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
text-underline-offset: 2px;
}
/* Collapsible sub-sections.
We wrap every nested <ul> in a <div class="toc-children"> and animate via
the grid-template-rows 0fr/1fr trick (CSS can't animate height:auto).
This matches the editor-side React implementation. */
.toc-children {
display: grid;
grid-template-rows: 1fr;
opacity: 1;
overflow: hidden;
transition: grid-template-rows 200ms ease, opacity 200ms ease;
}
.toc-children > * {
overflow: hidden;
min-height: 0;
}
.toc-collapsible li.collapsed > .toc-children {
grid-template-rows: 0fr;
opacity: 0;
}
/* Applied on the nav root during init to suppress transitions for the first
paint, then removed on the next animation frame. Avoids a close-animation
flash when auto-collapse is enabled. */
.toc-collapsible.toc-no-transition .toc-children,
.toc-collapsible.toc-no-transition .toc-children > * {
transition: none !important;
}
/* ============================================================================ */
/* Mobile TOC - toggle button */
/* Hidden on desktop, shown at @media (max-width: 1100px) below. */
/* ============================================================================ */
.toc-mobile-toggle {
display: none;
position: fixed;
top: var(--spacing-4);
left: var(--spacing-4);
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);
align-items: center;
justify-content: center;
padding: 0;
cursor: pointer;
color: var(--text-color);
transition: transform 150ms ease, box-shadow 150ms ease;
}
.toc-mobile-toggle:active {
transform: scale(0.92);
}
/* ============================================================================ */
/* Mobile TOC - backdrop */
/* ============================================================================ */
.toc-mobile-backdrop {
display: none;
position: fixed;
inset: 0;
z-index: calc(var(--z-overlay) + 1);
background: rgba(0,0,0,.4);
opacity: 0;
pointer-events: none;
transition: opacity 250ms ease;
}
.toc-mobile-backdrop.open {
opacity: 1;
pointer-events: auto;
}
/* ============================================================================ */
/* Mobile TOC - sidebar panel */
/* ============================================================================ */
.toc-mobile-sidebar {
display: none;
position: fixed;
top: 0;
left: 0;
bottom: 0;
z-index: calc(var(--z-overlay) + 2);
width: min(320px, 85vw);
background: var(--page-bg);
border-right: 1px solid var(--border-color);
transform: translateX(-100%);
transition: transform 300ms cubic-bezier(.4,0,.2,1);
flex-direction: column;
}
.toc-mobile-sidebar.open {
transform: translateX(0);
}
.toc-mobile-sidebar__header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 16px;
border-bottom: 1px solid var(--border-color);
flex-shrink: 0;
}
.toc-mobile-sidebar__title {
font-weight: 700;
font-size: 15px;
color: var(--text-color);
}
.toc-mobile-sidebar__actions {
display: flex;
align-items: center;
gap: 4px;
}
.toc-mobile-sidebar__close,
.toc-mobile-sidebar__theme {
background: none;
border: none;
color: var(--muted-color);
cursor: pointer;
padding: 4px;
border-radius: 6px;
width: 32px;
height: 32px;
display: flex;
align-items: center;
justify-content: center;
transition: color 150ms ease, background 150ms ease;
}
.toc-mobile-sidebar__close:hover,
.toc-mobile-sidebar__theme:hover {
color: var(--text-color);
background: var(--surface-bg);
}
/* Theme icon visibility in sidebar */
.toc-mobile-sidebar__theme .icon.dark {
display: none;
}
[data-theme="dark"] .toc-mobile-sidebar__theme .icon.light {
display: none;
}
[data-theme="dark"] .toc-mobile-sidebar__theme .icon.dark {
display: inline;
}
.toc-mobile-sidebar__body {
flex: 1;
overflow-y: auto;
-webkit-overflow-scrolling: touch;
padding: 16px;
}
/* TOC styles inside mobile sidebar */
.toc-mobile-sidebar nav ul {
margin: 0 0 6px;
padding-left: 1em;
}
.toc-mobile-sidebar nav li {
list-style: none;
margin: 0.35em 0;
}
.toc-mobile-sidebar nav a,
.toc-mobile-sidebar nav a:link,
.toc-mobile-sidebar nav a:visited {
color: var(--text-color);
text-decoration: none;
border-bottom: none;
font-size: 14px;
line-height: 1.5;
}
.toc-mobile-sidebar nav > ul > li > a {
font-weight: 700;
}
.toc-mobile-sidebar nav a:hover {
text-decoration: underline solid var(--muted-color);
}
.toc-mobile-sidebar nav a.active {
color: var(--primary-color);
text-decoration: underline;
text-decoration-color: color-mix(in srgb, var(--primary-color) 50%, transparent);
text-underline-offset: 2px;
}
/* ============================================================================ */
/* Responsive: show mobile TOC elements on small viewports */
/* Must be AFTER default display:none rules to win in the cascade */
/* ============================================================================ */
@media (max-width: 1100px) {
.toc-mobile-toggle {
display: flex;
}
.toc-mobile-backdrop {
display: block;
}
.toc-mobile-sidebar {
display: flex;
}
}
/* -----------------------------------------------------------------------
Footer - shared between editor and published page.
Visually aligned with the research-article-template's Footer.astro.
Uses CSS variables where they compose well with the template's look,
and the template's exact rgba() values where they produce the
distinctive discreet-grey look of the appendix.
----------------------------------------------------------------------- */
.footer {
contain: layout style;
font-size: 0.8em;
line-height: 1.7em;
margin-top: 60px;
margin-bottom: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
color: rgba(0, 0, 0, 0.5);
}
.footer-inner {
max-width: 1280px;
margin: 0 auto;
padding: 60px 16px 48px;
display: grid;
grid-template-columns: 220px minmax(0, 680px) 260px;
gap: 32px;
align-items: start;
}
/* Use the parent grid (3 columns like .content-grid) */
.citation-block,
.references-block,
.reuse-block,
.doi-block {
display: contents;
}
.citation-block > .footer-heading,
.references-block > .footer-heading,
.reuse-block > .footer-heading,
.doi-block > .footer-heading {
grid-column: 1;
font-size: 15px;
font-weight: 600;
margin: 0;
text-align: right;
padding-right: 30px;
}
.citation-block > :not(.footer-heading),
.references-block > :not(.footer-heading),
.reuse-block > :not(.footer-heading),
.doi-block > :not(.footer-heading) {
grid-column: 2;
}
.citation-block .footer-heading { margin: 0 0 8px; }
.citation-block h4 {
margin: 16px 0 8px;
font-size: 14px;
text-transform: uppercase;
color: var(--muted-color);
}
.citation-block p,
.reuse-block p,
.doi-block p,
.footnotes ol,
.footnotes ol p,
.references { margin-top: 0; }
/* Preserve KaTeX rendering in footnotes - essential for math formulas.
Compensates for the footer's 0.8em font-size (1em / 0.8em = 1.25em). */
.footer .footnotes .katex {
font-size: 1.25em;
line-height: 1.21;
}
.footer .footnotes .katex-display {
margin: 1em 0;
text-align: center;
display: block;
overflow-x: auto;
overflow-y: hidden;
}
.footer .footnotes .katex-display > .katex {
display: block;
text-align: center;
}
.footer .footnotes .katex .katex-html { display: inline-block; }
.footer .footnotes .katex .base { display: inline-block; }
/* Distill-like appendix citation styling */
.citation {
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
"Liberation Mono", "Courier New", monospace;
font-size: 11px;
line-height: 15px;
border: 1px solid rgba(0, 0, 0, 0.1);
background: rgba(0, 0, 0, 0.02);
padding: 10px 18px;
border-radius: 3px;
color: rgba(150, 150, 150, 1);
overflow: hidden;
margin-top: -12px;
white-space: pre-wrap;
word-wrap: break-word;
}
.citation a {
color: rgba(0, 0, 0, 0.6);
text-decoration: underline;
}
.citation.short { margin-top: -4px; }
/* Published inline citation links */
.citation-inline {
color: var(--primary-color, #958df1);
text-decoration: none;
text-decoration-line: underline;
text-decoration-color: transparent;
text-underline-offset: 2px;
cursor: pointer;
transition: text-decoration-color 0.15s;
}
.citation-inline:hover { text-decoration-color: currentColor; }
/* Bibliography block inside footer: drop the article-body framing
(border-top, padding, margin) so the content sits cleanly next to the
footer-heading column. */
.footer .bibliography-block {
margin: 0;
padding: 0;
border: 0;
}
.footer .bibliography-title { display: none; }
/* Bibliography entries inside footer */
.footer .bibliography-content .csl-entry {
margin-bottom: 0.75em;
padding-left: 1.5em;
text-indent: -1.5em;
font-size: 0.9em;
line-height: 1.5;
}
.bibliography-content .csl-entry:target {
background: color-mix(in srgb, var(--primary-color) 10%, transparent);
border-radius: 4px;
padding: 4px 4px 4px 1.5em;
}
/* Footnote refs (published page) */
.footnote-ref a {
color: var(--primary-color, #958DF1);
text-decoration: none;
font-size: 0.8em;
}
.footnote-ref a:hover { text-decoration: underline; }
/* Footnotes list (both editor footer and published) */
.footnotes ol,
.footnotes-list {
padding-left: 1.5em;
margin: 0;
}
.footnotes li,
.footnotes-list li {
margin-bottom: 0.5em;
font-size: 0.9rem;
}
.footnotes li p,
.footnotes-list li p { margin: 0; }
.footnote-backref { text-decoration: none; margin-left: 4px; }
/* References block */
.references-block .footer-heading { margin: 0; }
.references-block ol { padding: 0 0 0 15px; }
.references-block li { margin-bottom: 1em; }
.references-block a { color: var(--text-color); }
@media (min-width: 768px) {
.references-block ol { padding: 0 0 0 30px; margin-left: -30px; }
}
/* Footer links: use primary color consistently */
.footer a {
color: var(--primary-color);
border-bottom: 1px solid var(--link-underline);
text-decoration: none;
}
.footer a:hover {
color: var(--primary-color-hover);
border-bottom-color: var(--link-underline-hover);
}
/* Dark mode overrides */
[data-theme="dark"] .footer {
border-top-color: rgba(255, 255, 255, 0.15);
color: rgba(200, 200, 200, 0.8);
}
[data-theme="dark"] .citation {
background: rgba(255, 255, 255, 0.04);
border-color: rgba(255, 255, 255, 0.15);
color: rgba(200, 200, 200, 1);
}
[data-theme="dark"] .citation a { color: rgba(255, 255, 255, 0.75); }
[data-theme="dark"] .footer a { color: var(--primary-color); }
/* Template credit - discrete at the bottom */
.template-credit { display: contents; }
.template-credit p {
grid-column: 2;
margin: 24px 0 0 0;
font-size: 0.85em;
color: rgba(0, 0, 0, 0.5);
}
.template-credit a {
color: rgba(0, 0, 0, 0.6);
border-bottom: 1px solid rgba(0, 0, 0, 0.15);
}
.template-credit a:hover {
color: rgba(0, 0, 0, 0.8);
border-bottom-color: rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .template-credit p { color: rgba(200, 200, 200, 0.6); }
[data-theme="dark"] .template-credit a {
color: rgba(200, 200, 200, 0.7);
border-bottom-color: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .template-credit a:hover {
color: rgba(200, 200, 200, 0.9);
border-bottom-color: rgba(255, 255, 255, 0.35);
}
/* -----------------------------------------------------------------------
Mobile/tablet responsive layout.
Collapse the 3-column grid (heading | content | spacer) into a single
stacked column. The sections use `display: contents` on desktop, so the
headings and paragraphs are actual DOM children of `.footer-inner`:
a child combinator like `.footer-inner > .footer-heading` never matches.
Below, we target all `.footer-heading` inside the footer and reset the
grid positioning applied to siblings.
----------------------------------------------------------------------- */
@media (max-width: 1100px) {
.footer-inner {
display: block;
padding: 40px 16px;
}
.footer .footer-heading {
grid-column: auto;
text-align: left;
padding-right: 0;
margin: 24px 0 8px;
}
.footer .footer-inner > section + section {
margin-top: 8px;
}
.citation-block > :not(.footer-heading),
.references-block > :not(.footer-heading),
.reuse-block > :not(.footer-heading),
.doi-block > :not(.footer-heading),
.template-credit p {
grid-column: auto;
}
.template-credit p {
margin-top: 32px;
}
.citation {
overflow-x: auto;
margin-top: 0;
}
.citation.short { margin-top: 0; }
.references-block ol {
padding-left: 1.5em;
}
}
@media (max-width: 480px) {
.footer-inner {
padding: 32px 14px;
}
.citation {
font-size: 10.5px;
padding: 8px 12px;
}
}
/* ============================================================================ */
/* HTML Embed NodeView */
/* ============================================================================ */
.embed-view {
border: 1px solid var(--border-color);
border-radius: 8px;
overflow: hidden;
margin: 0.75em 0;
user-select: none;
background: var(--surface-bg);
}
/* --- Header --- */
.embed-header {
display: flex;
align-items: center;
justify-content: space-between;
padding: 6px 12px;
border-bottom: 1px solid var(--border-color);
background: var(--surface-bg);
gap: 8px;
}
.embed-header-left {
display: flex;
align-items: center;
gap: 6px;
min-width: 0;
}
.embed-header-icon {
font-size: 14px;
line-height: 1;
flex-shrink: 0;
}
.embed-header-label {
font-size: 12px;
font-weight: 600;
color: var(--muted-color);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.embed-header-src {
font-size: 11px;
color: var(--muted-color);
opacity: 0.6;
font-family: var(--font-mono);
white-space: nowrap;
}
.embed-header-actions {
display: flex;
gap: 4px;
flex-shrink: 0;
}
/* --- Buttons --- */
.embed-btn {
background: none;
border: 1px solid var(--border-color);
border-radius: 4px;
padding: 2px 10px;
font-size: 11px;
color: var(--muted-color);
cursor: pointer;
white-space: nowrap;
transition: background 120ms ease, color 120ms ease;
}
.embed-btn:hover {
background: var(--border-color);
color: var(--text-color);
}
.embed-btn-primary {
background: var(--primary-color);
color: var(--on-primary);
border-color: var(--primary-color);
}
.embed-btn-primary:hover {
opacity: 0.9;
}
/* --- Settings panel --- */
.embed-settings {
padding: 8px 12px;
border-bottom: 1px solid var(--border-color);
display: flex;
flex-direction: column;
gap: 6px;
background: var(--surface-bg);
}
.embed-field-row {
display: flex;
align-items: center;
gap: 8px;
}
.embed-field-checkbox {
font-size: 12px;
color: var(--muted-color);
cursor: pointer;
gap: 6px;
}
.embed-field-checkbox input {
accent-color: var(--primary-color);
}
.embed-field-label {
font-size: 12px;
color: var(--muted-color);
min-width: 80px;
flex-shrink: 0;
}
.embed-field-input {
background: transparent;
border: 1px solid var(--border-color);
border-radius: 4px;
color: var(--text-color);
font-size: 13px;
padding: 3px 8px;
outline: none;
flex: 1;
min-width: 0;
}
.embed-field-input:focus {
border-color: var(--primary-color);
}
/* --- Preview area --- */
.embed-preview {
position: relative;
padding: 16px;
overflow: hidden;
}
.embed-iframe {
width: 100%;
border: none;
display: block;
border-radius: 4px;
background: transparent;
/* Isolate iframe layout changes so height updates from ResizeObserver
don't propagate reflows up to the scroll container. */
contain: layout style;
}
/* --- Empty state --- */
.embed-empty {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 8px;
padding: 32px 24px;
color: var(--muted-color);
font-size: 13px;
text-align: center;
}
.embed-empty-icon {
font-size: 24px;
opacity: 0.5;
}
.embed-empty code {
font-family: var(--font-mono);
font-size: 12px;
background: var(--code-bg);
padding: 1px 5px;
border-radius: 3px;
}
/* ---------------------------------------------------------------------------
Hugging Face user profile card
Shared between editor (HfUserView NodeView) and publisher (HfUser
transformer). The DOM mirrors `app/src/components/HfUser.astro`
from the upstream research-article-template so the same authored
content renders identically in both places.
<div class="hf-user">
<div class="hf-user__left">
<img class="hf-user__avatar" .../>
<span class="hf-user__text">
<a class="hf-user__name">Display Name</a>
<span class="hf-user__row">
<a class="hf-user__username">@handle</a>
</span>
</span>
</div>
</div>
--------------------------------------------------------------------------- */
.hf-user {
display: inline-flex;
align-items: center;
gap: 10px;
padding: 10px 10px 10px 12px;
border-radius: 12px;
box-shadow: none;
}
.hf-user__left {
display: flex;
align-items: center;
gap: 10px;
text-decoration: none;
color: inherit;
}
.hf-user__avatar {
display: block;
width: 44px;
height: 44px;
border-radius: 50%;
object-fit: cover;
box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.12) inset;
}
.hf-user__text {
display: flex;
flex-direction: column;
line-height: 1.1;
}
.hf-user__row {
display: inline-flex;
align-items: center;
white-space: nowrap;
}
.hf-user__name {
font-size: 14px;
font-weight: 700;
}
.hf-user__username {
font-size: 12px;
color: var(--muted-color);
text-decoration: underline !important;
text-underline-offset: 2px;
text-decoration-thickness: 0.06em;
text-decoration-color: var(--link-underline);
}
.hf-user a {
color: inherit;
text-decoration: none;
border-bottom: none;
}
.hf-user-list {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
/* -----------------------------------------------------------------------
Article content styles
Shared between editor and published version.
Uses CSS variables from tokens.css for light/dark theming.
----------------------------------------------------------------------- */
/* Base typography */
.tiptap {
outline: none;
font-family: var(--default-font-family);
font-size: 1rem;
line-height: 1.7;
color: var(--text-color);
max-width: 780px;
margin-left: auto;
margin-right: auto;
padding: 0 32px 0 64px;
min-height: 100%;
overflow-wrap: break-word;
word-break: break-word;
}
.tiptap > *:first-child {
margin-top: 0;
}
/* Headings
Sizes / weights / margins mirror the published rules
(`.content-grid main h2/h3/h4` in `_base.css`) so the editor view matches
the final rendering. In the published HTML these `.tiptap` rules are
overridden by the higher-specificity `.content-grid main ...` rules, but
the values stay identical - keeping them here is the source of truth
for the editor-only context (which lacks the `.content-grid main` wrapper). */
.tiptap h1 {
font-size: 2rem;
font-weight: 700;
color: var(--text-heading);
line-height: 1.2;
margin: 2em 0 0.4em;
letter-spacing: -0.02em;
}
.tiptap h1:first-child {
margin-top: 0;
}
.tiptap h2 {
font-weight: 600;
font-size: clamp(22px, 2.6vw, 32px);
line-height: 1.2;
margin: var(--spacing-10) 0 var(--spacing-5);
padding-bottom: var(--spacing-2);
border-bottom: 1px solid var(--border-color);
}
.tiptap h3 {
font-weight: 700;
font-size: clamp(18px, 2.1vw, 22px);
line-height: 1.25;
margin: var(--spacing-8) 0 var(--spacing-4);
}
.tiptap h4 {
font-weight: 600;
font-size: 16px;
line-height: 1.2;
margin: var(--spacing-6) 0 var(--spacing-4);
text-transform: uppercase;
}
/* Paragraphs */
.tiptap p {
margin: 0.5em 0;
}
/* Lists */
.tiptap ul,
.tiptap ol {
padding-left: 1.5rem;
margin: 0.5em 0;
}
.tiptap li {
margin: 0.25em 0;
}
.tiptap li p {
margin: 0.15em 0;
}
/* Blockquote */
.tiptap blockquote {
border-left: 3px solid var(--border-color);
padding-left: 1rem;
margin: 1em 0;
color: var(--muted-color);
}
.tiptap blockquote p {
margin: 0.4em 0;
}
/* Inline code */
.tiptap code {
font-size: 14px;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
border-radius: 0.3em;
border: 1px solid var(--border-color);
color: var(--text-color);
font-weight: 400;
line-height: 1.5;
}
.tiptap p code {
white-space: nowrap;
padding: calc(var(--spacing-1) / 3) calc(var(--spacing-1) / 2);
}
/* ============================================================================
Code blocks - Shiki-powered syntax highlighting
============================================================================
Both the editor (PM decorations, `code-block-shiki.tsx`) and the publisher
(static HTML, `transformers/highlight-code.ts`) emit the same markup:
<pre class="shiki ..." data-lang="python"
style="--shiki-light:...;--shiki-dark:...">
<code class="language-python">
<span class="code-line-num">1</span>
<span style="--shiki-light:#d73a49">const</span> foo = ...
<span class="code-line-num">2</span>
...
</code>
</pre>
- Shiki is configured with `defaultColor: false`, so tokens carry BOTH
theme colors as CSS vars. We pick the active var based on
`html[data-theme=...]` for zero-JS live theme switching.
- Line numbers are physical markup (`<span class="code-line-num">`) rather
than CSS counters. In the editor PM widget decorations inject them; in
the published HTML the highlight-code transformer does the same. Placing
them as the first child of each line means they sit on the first visual
row of soft-wrapped lines automatically - no absolute positioning math.
- The language label comes from a `::after` pseudo on `<pre>` using
`attr(data-lang)`, so no extra DOM node exists. */
.tiptap pre {
--code-line-num-width: 2.5em;
--code-line-num-gap: 1em;
--code-padding-left: calc(var(--code-line-num-width) + var(--code-line-num-gap) + var(--spacing-1));
--code-padding-right: var(--spacing-3);
position: relative;
/* Override Shiki's inline background-color with our surface color. */
background-color: var(--surface-bg) !important;
border: 1px solid var(--border-color);
border-radius: 6px;
padding: var(--spacing-2) 0;
margin: 0 0 var(--block-spacing-y);
font-size: 14px;
overflow: hidden;
}
.tiptap pre code {
display: block;
background: none;
border: none;
padding: 0 var(--code-padding-right) 0 var(--code-padding-left);
color: var(--text-color);
font-size: 14px;
line-height: 1.6;
/* Soft-wrap long lines instead of horizontal scrollbars. */
white-space: pre-wrap;
word-break: break-word;
overflow-wrap: anywhere;
}
/* Line number widget. Uses negative left margin to sit inside the padding
area, and a matching right margin that offsets the negative one so the
span is zero-width in the layout. Wrapped rows naturally align with
`padding-left` (no number prefix on continuation rows). */
.tiptap pre .code-line-num {
display: inline-block;
width: var(--code-line-num-width);
margin-left: calc(-1 * (var(--code-line-num-width) + var(--code-line-num-gap)));
margin-right: var(--code-line-num-gap);
text-align: right;
color: var(--muted-color);
opacity: 0.45;
user-select: none;
pointer-events: none;
font-variant-numeric: tabular-nums;
}
/* Shiki token colors. `var(..., inherit)` is critical so non-token spans
(line wrappers, widgets, selection highlights) inherit the parent's
color instead of falling back to black. */
.tiptap pre code span {
color: var(--shiki-light, inherit);
}
html[data-theme="dark"] .tiptap pre code span {
color: var(--shiki-dark, inherit);
}
/* Language label, top-right. Pure CSS, no DOM footprint. */
.tiptap pre[data-lang]::after {
content: attr(data-lang);
position: absolute;
top: 0.5em;
right: 0.75em;
font-size: 11px;
line-height: 1;
font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
letter-spacing: 0.04em;
text-transform: uppercase;
color: var(--muted-color);
opacity: 0.55;
user-select: none;
pointer-events: none;
}
/* Horizontal rule */
.tiptap hr {
border: none;
border-top: 1px solid var(--border-color);
margin: 2em 0;
}
/* Tables - aligned with template _table.css
Uses separate+spacing-0 instead of collapse so border-radius works on the table itself
(the template puts radius on a .table-scroll wrapper which TipTap doesn't have). */
.tiptap table {
border-collapse: separate;
border-spacing: 0;
table-layout: auto;
width: 100%;
margin: 0 0 var(--block-spacing-y);
border: 1px solid var(--border-color);
border-radius: var(--table-border-radius);
overflow: hidden;
background-color: var(--surface-bg);
}
.tiptap th,
.tiptap td {
border-bottom: 1px solid var(--border-color);
border-right: 1px solid var(--border-color);
padding: 6px 8px;
font-size: 15px;
white-space: nowrap;
word-break: auto-phrase;
vertical-align: top;
}
.tiptap th:last-child,
.tiptap td:last-child {
border-right: none;
}
.tiptap th {
background: var(--table-header-bg);
font-weight: 600;
padding-top: 10px;
padding-bottom: 10px;
}
.tiptap tbody tr:nth-child(odd) td {
background: var(--table-row-odd-bg);
}
.tiptap tbody tr:last-child td {
border-bottom: none;
}
/* Links - aligned with template (_base.css .content-grid main a) */
.tiptap a,
.tiptap .editor-link {
color: var(--primary-color);
text-decoration: none;
border-bottom: 1px solid color-mix(in srgb, var(--primary-color) 40%, transparent);
text-underline-offset: 2px;
transition: border-color 0.15s;
}
.tiptap a:hover,
.tiptap .editor-link:hover {
color: var(--primary-color-hover);
border-bottom-color: color-mix(in srgb, var(--primary-color) 70%, transparent);
}
/* Bold */
.tiptap strong {
font-weight: 600;
color: var(--text-strong);
}
/* Images */
.tiptap img {
max-width: 100%;
height: auto;
border-radius: 8px;
margin: 1em 0;
}
/* Math - inline */
.tiptap [data-type="inline-math"] .tiptap-mathematics-render {
padding: 0 0.2em;
border-radius: 3px;
transition: background 0.15s;
}
.tiptap [data-type="inline-math"] .tiptap-mathematics-render:hover {
background: var(--code-bg);
}
/* Math - block */
.tiptap [data-type="block-math"] {
margin: 1em 0;
}
.tiptap [data-type="block-math"] .tiptap-mathematics-render {
display: flex;
justify-content: center;
padding: 1rem 0;
border-radius: 8px;
transition: background 0.15s;
}
.tiptap [data-type="block-math"] .tiptap-mathematics-render:hover {
background: var(--bg-hover);
}
/* KaTeX color */
.tiptap .katex {
color: var(--katex-color);
}
/* Citation inline node */
.tiptap .citation-node,
.citation-node {
position: relative;
color: var(--primary-color);
cursor: default;
font-size: 0.9em;
white-space: nowrap;
text-decoration: underline;
text-decoration-color: color-mix(in srgb, var(--primary-color) 30%, transparent);
text-underline-offset: 2px;
transition: text-decoration-color 0.15s;
}
.tiptap .citation-node:hover,
.citation-node:hover {
text-decoration-color: color-mix(in srgb, var(--primary-color) 70%, transparent);
}
/* Citation hover tooltip */
.citation-tooltip {
position: absolute;
bottom: calc(100% + 8px);
left: 50%;
transform: translateX(-50%);
background: var(--bg-tooltip);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 0.75rem;
min-width: 240px;
max-width: 320px;
box-shadow: var(--shadow-lg);
z-index: 100;
white-space: normal;
pointer-events: auto;
}
.citation-tooltip-title {
color: var(--text-heading-secondary);
font-size: 0.8125rem;
font-weight: 500;
line-height: 1.4;
margin-bottom: 0.35rem;
}
.citation-tooltip-journal {
color: var(--muted-color);
font-size: 0.75rem;
font-style: italic;
line-height: 1.3;
}
.citation-tooltip-doi {
color: var(--text-tertiary);
font-size: 0.7rem;
font-family: "SFMono-Regular", "Fira Code", monospace;
margin-top: 0.35rem;
overflow: hidden;
text-overflow: ellipsis;
}
.citation-tooltip-remove {
display: block;
margin-top: 0.5rem;
margin-left: auto;
padding: 0.25rem 0.6rem;
border: none;
border-radius: 4px;
background: var(--danger-bg);
color: var(--danger);
font-size: 0.7rem;
font-family: inherit;
cursor: pointer;
transition: background 0.15s;
}
.citation-tooltip-remove:hover {
background: var(--danger-bg-hover);
}
/* Bibliography block - hidden in editor body, displayed in footer instead */
.tiptap .bibliography-block {
display: none;
}
.bibliography-block {
margin: 2em 0 1em;
padding-top: 1.5em;
border-top: 1px solid var(--border-color);
}
.bibliography-title {
font-size: 1.3rem;
font-weight: 600;
color: var(--text-heading-secondary);
margin: 0 0 1em;
}
.bibliography-empty {
color: var(--text-faint);
font-size: 0.875rem;
font-style: italic;
}
.bibliography-content {
font-size: 0.875rem;
line-height: 1.7;
color: var(--muted-color);
}
.bibliography-content .csl-entry {
margin-bottom: 0.75em;
padding-left: 1.5em;
text-indent: -1.5em;
}
.bibliography-content .csl-entry i {
font-style: italic;
}
/* -----------------------------------------------------------------------
Custom component blocks (shared between editor and published page)
Neutral selectors [data-component="..."] work in both contexts.
----------------------------------------------------------------------- */
.component-content > *:first-child {
margin-top: 0;
}
.component-content > *:last-child {
margin-bottom: 0;
}
/* --- Note --- */
[data-component="note"] {
background: var(--surface-bg);
border-left: 2px solid var(--border-color);
border-top-right-radius: 8px;
border-bottom-right-radius: 8px;
padding: 20px 18px;
margin: var(--block-spacing-y, 1em) 0;
}
[data-component="note"][variant="info"] {
border-left-color: #f39c12;
background: color-mix(in oklab, #f39c12 10%, var(--surface-bg));
}
[data-component="note"][variant="success"] {
border-left-color: #2ecc71;
background: color-mix(in oklab, #2ecc71 8%, var(--surface-bg));
}
[data-component="note"][variant="danger"] {
border-left-color: #e74c3c;
background: color-mix(in oklab, #e74c3c 8%, var(--surface-bg));
}
[data-component="note"] .note__title {
font-size: 16px;
font-weight: 600;
color: var(--text-color);
margin-bottom: 6px;
}
[data-component="note"] .component-content {
font-size: 0.95rem;
}
[data-component="note"] > *:first-child { margin-top: 0; }
[data-component="note"] > *:last-child { margin-bottom: 0; }
/* --- Quote block (decorative) --- */
[data-component="quoteBlock"] {
position: relative;
margin: 32px 0;
max-width: 600px;
padding: 0;
border: none;
background: none;
}
[data-component="quoteBlock"]::before {
content: '\201C';
position: absolute;
top: -24px;
left: -30px;
font-size: 8rem;
font-weight: 400;
color: var(--text-color);
opacity: 0.05;
z-index: -1;
line-height: 1;
pointer-events: none;
}
[data-component="quoteBlock"] .quote-text,
[data-component="quoteBlock"] .component-content {
font-size: 1.5rem;
line-height: 1.4;
font-weight: 400;
letter-spacing: -0.01em;
color: var(--text-color);
}
[data-component="quoteBlock"] .quote-footer {
font-size: 0.875rem;
color: var(--muted-color);
margin-top: 12px;
}
[data-component="quoteBlock"] .quote-author::before {
content: '\2014\00A0';
font-style: normal;
}
[data-component="quoteBlock"] .quote-author,
[data-component="quoteBlock"] .quote-source {
font-weight: 500;
font-style: italic;
color: var(--text-color);
opacity: 0.85;
}
[data-component="quoteBlock"] > *:first-child { margin-top: 0; }
[data-component="quoteBlock"] > *:last-child { margin-bottom: 0; }
/* --- Sidenote (margin note) --- */
[data-component="sidenote"] {
font-size: 0.9rem;
color: var(--muted-color);
margin: 0;
padding: 0;
position: relative;
}
[data-component="sidenote"] .component-content > *:first-child { margin-top: 0; }
[data-component="sidenote"] .component-content > *:last-child { margin-bottom: 0; }
/* Editor: position sidenote in the right gutter of the .content-grid.
The 3-col content-grid reserves a 200px track on the right of the
680px content column, separated by 32px gap. We float the sidenote
right and push it into that track with a negative margin.
Breakpoint is aligned with the TOC (1100px) so both collapse together. */
.editor-app .tiptap .node-sidenote {
float: right;
clear: right;
width: 200px;
margin-right: calc(-200px - 32px);
margin-top: 0;
margin-bottom: 0.5em;
margin-left: 16px;
border-radius: 6px;
transition: background 0.15s;
position: relative;
}
.editor-app .tiptap .node-sidenote:hover {
background: var(--bg-hover);
}
.editor-app .tiptap [data-component="sidenote"] .sidenote-content-area {
padding: 4px 8px;
}
.editor-app .tiptap .node-sidenote .sidenote-badge {
position: absolute;
top: 2px;
right: 4px;
font-size: 10px;
color: var(--text-faint);
opacity: 0;
transition: opacity 0.15s;
pointer-events: none;
user-select: none;
}
.editor-app .tiptap .node-sidenote:hover .sidenote-badge {
opacity: 1;
}
/* Responsive: below 1100px the TOC collapses, so the right gutter is
used by the content column. Stack sidenotes inline to match. */
@media (max-width: 1100px) {
.editor-app .tiptap .node-sidenote {
float: none;
clear: none;
width: auto;
margin: 0.75em 0;
padding: 0 30px;
border-left: 2px solid var(--border-color);
border-radius: 0;
}
.editor-app .tiptap [data-component="sidenote"] .sidenote-content-area {
padding: 0;
}
.editor-app .tiptap .node-sidenote .sidenote-badge {
display: none;
}
}
/* --- Reference / figure --- */
[data-component="reference"] {
margin: 0 0 var(--spacing-4, 1rem);
}
[data-component="reference"] .reference__caption {
text-align: left;
font-size: 0.9rem;
color: var(--muted-color);
margin-top: 6px;
}
[data-component="reference"] .component-content {
margin-bottom: 0;
}
[data-component="reference"] > *:first-child { margin-top: 0; }
[data-component="reference"] > *:last-child { margin-bottom: 0; }
/* --- Stack / multi-column layout --- */
[data-component="stack"] {
display: grid;
gap: 1rem;
margin: var(--block-spacing-y, 1.5em) 0;
width: 100%;
max-width: 100%;
box-sizing: border-box;
}
[data-component="stack"][data-layout="2-column"] { grid-template-columns: repeat(2, 1fr); }
[data-component="stack"][data-layout="3-column"] { grid-template-columns: repeat(3, 1fr); }
[data-component="stack"][data-layout="4-column"] { grid-template-columns: repeat(4, 1fr); }
[data-component="stack"][data-layout="auto"] { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
[data-component="stack"]:not([data-layout]) { grid-template-columns: repeat(2, 1fr); }
[data-component="stack"][data-gap="small"] { gap: 0.5rem; }
[data-component="stack"][data-gap="large"] { gap: 2rem; }
[data-type="stack-column"] { min-width: 0; overflow: hidden; word-wrap: break-word; overflow-wrap: break-word; }
[data-type="stack-column"] > *:first-child { margin-top: 0; }
[data-type="stack-column"] > *:last-child { margin-bottom: 0; }
@media (max-width: 768px) {
[data-component="stack"][data-layout="2-column"],
[data-component="stack"][data-layout="3-column"],
[data-component="stack"][data-layout="4-column"],
[data-component="stack"][data-layout="auto"],
[data-component="stack"]:not([data-layout]) { grid-template-columns: 1fr !important; }
}
@media (min-width: 769px) and (max-width: 1100px) {
[data-component="stack"][data-layout="3-column"],
[data-component="stack"][data-layout="4-column"],
[data-component="stack"][data-layout="auto"] { grid-template-columns: repeat(2, 1fr) !important; }
}
/* --- Accordion --- */
details[data-component="accordion"] {
border: 1px solid var(--border-color);
border-radius: var(--table-border-radius, 8px);
background: var(--surface-bg);
padding: 0;
margin: 0 0 var(--spacing-4, 1em);
transition: box-shadow 180ms ease, border-color 180ms ease;
}
details[data-component="accordion"][open] {
border-color: color-mix(in oklab, var(--border-color), var(--primary-color) 20%);
}
details[data-component="accordion"] > summary {
display: flex;
align-items: center;
justify-content: space-between;
gap: 4px;
padding: var(--spacing-2, 0.5rem) var(--spacing-3, 0.75rem);
cursor: pointer;
font-weight: 600;
color: var(--text-color);
list-style: none;
user-select: none;
}
details[data-component="accordion"][open] > summary {
border-bottom: 1px solid var(--border-color);
}
details[data-component="accordion"] > summary::-webkit-details-marker { display: none; }
details[data-component="accordion"] > summary::marker { content: ""; }
details[data-component="accordion"] > summary::after {
content: '';
display: inline-block;
width: 0.5em;
height: 0.5em;
border-right: 2px solid currentColor;
border-bottom: 2px solid currentColor;
transform: rotate(-45deg);
transition: transform 220ms ease;
opacity: 0.6;
flex-shrink: 0;
}
details[data-component="accordion"][open] > summary::after {
transform: rotate(45deg);
}
details[data-component="accordion"] > .accordion-content {
padding: 8px;
}
details[data-component="accordion"] > .accordion-content > *:first-child { margin-top: 0; }
details[data-component="accordion"] > .accordion-content > *:last-child { margin-bottom: 0; }
/* --- Wide / full-width containers (editor) ---
*
* Strategy: the breakout is applied to the OUTER TipTap node wrapper
* (`.node-wide`, `.node-fullWidth`), which is a plain <div> with no inline
* styles. The INNER `[data-component]` holds the visual chrome (padding,
* background, border-radius) and is always `width: 100%` of the breakout
* box.
*
* The content column is viewport-centered (symmetric 3-col grid with equal
* TOC/sidenote widths), so `50% ↔ 50vw` math lands on the viewport center.
*
* !important guards the horizontal margins against any future inline-style
* leak from React / NodeViewWrapper – those are a classic footgun because
* the `margin` shorthand silently resets marginLeft/marginRight to 0. */
.editor-app .tiptap .node-wide,
.editor-app .tiptap .node-fullWidth {
box-sizing: border-box;
position: relative;
z-index: var(--z-elevated);
margin-block: 1.25em;
clear: both;
}
.editor-app .tiptap .node-wide {
width: min(1100px, 100vw - var(--content-padding-x, 16px) * 4);
margin-left: 50% !important;
margin-right: 0 !important;
transform: translateX(-50%);
}
.editor-app .tiptap .node-fullWidth {
width: 100vw;
margin-left: calc(50% - 50vw) !important;
margin-right: calc(50% - 50vw) !important;
}
/* Visual chrome lives on the inner wrapper, which always fills the breakout */
.editor-app .tiptap [data-component="wide"],
.editor-app .tiptap [data-component="fullWidth"] {
box-sizing: border-box;
width: 100%;
background-color: var(--surface-bg);
padding: calc(var(--content-padding-x, 16px) * 2);
border-radius: calc(var(--button-radius, 6px) * 2);
border: 1px solid var(--border-color);
}
.editor-app .tiptap [data-component="wide"] > *:first-child,
.editor-app .tiptap [data-component="fullWidth"] > *:first-child {
margin-top: 0;
}
.editor-app .tiptap [data-component="wide"] > *:last-child,
.editor-app .tiptap [data-component="fullWidth"] > *:last-child {
margin-bottom: 0;
}
.editor-app .tiptap [data-component="fullWidth"] {
border-radius: 0;
border-left: none;
border-right: none;
}
.editor-app .tiptap [data-component="fullWidth"] figure figcaption {
text-align: center !important;
}
/* On narrow screens (≤1100px), the grid collapses to a single column and the
* content column spans the viewport minus gutters. Keep the blocks in-flow
* instead of breaking out. */
@media (max-width: 1100px) {
.editor-app .tiptap .node-wide,
.editor-app .tiptap .node-fullWidth {
width: 100%;
margin-left: 0 !important;
margin-right: 0 !important;
transform: none;
}
.editor-app .tiptap [data-component="wide"],
.editor-app .tiptap [data-component="fullWidth"] {
padding: var(--content-padding-x, 16px);
}
}
/* Glossary inline node */
.tiptap .glossary-node,
.glossary-node {
position: relative;
display: inline;
border-bottom: 1px dashed color-mix(in srgb, var(--primary-color) 50%, transparent);
color: var(--primary-color);
cursor: help;
}
.glossary-tooltip {
position: absolute;
bottom: calc(100% + 6px);
left: 50%;
transform: translateX(-50%);
background: var(--bg-tooltip);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 10px 14px;
min-width: 200px;
max-width: 320px;
z-index: 50;
box-shadow: var(--shadow-lg);
}
.glossary-tooltip-term {
font-weight: 700;
font-size: 13px;
color: var(--text-heading-secondary);
margin-bottom: 4px;
}
.glossary-tooltip-def {
font-size: 12px;
color: var(--muted-color);
line-height: 1.5;
}
.glossary-tooltip-remove {
margin-top: 8px;
background: none;
border: none;
color: var(--danger);
font-size: 11px;
cursor: pointer;
padding: 0;
opacity: 0.8;
}
.glossary-tooltip-remove:hover {
opacity: 1;
}
/* Footnote inline node */
.footnote-node {
position: relative;
display: inline;
}
.tiptap .footnote-marker,
.footnote-marker {
color: var(--primary-color);
cursor: pointer;
font-size: 0.75em;
font-weight: 700;
margin: 0 1px;
}
.footnote-tooltip {
position: absolute;
bottom: calc(100% + 6px);
left: 50%;
transform: translateX(-50%);
background: var(--bg-tooltip);
border: 1px solid var(--border-color);
border-radius: 8px;
padding: 10px 14px;
min-width: 220px;
max-width: 360px;
z-index: 50;
box-shadow: var(--shadow-lg);
}
.footnote-tooltip-content {
font-size: 12px;
color: var(--muted-color);
line-height: 1.5;
}
/* Stack wrapper - override the published [data-component="stack"] grid
because the editor uses its own StackView grid inside .stack-grid. */
.stack-wrapper {
display: block !important;
width: 100%;
}
.stack-container {
border: 1px solid rgba(255, 255, 255, 0.15);
border-radius: 8px;
background: rgba(255, 255, 255, 0.03);
margin: 0.75em 0;
overflow: hidden;
}
:root:not([data-theme="dark"]) .stack-container,
[data-theme="light"] .stack-container {
border-color: #ddd;
background: #f9f9f9;
}
.stack-header {
display: flex;
align-items: center;
gap: 8px;
padding: 6px 12px;
border-bottom: 1px solid rgba(255, 255, 255, 0.15);
user-select: none;
}
:root:not([data-theme="dark"]) .stack-header,
[data-theme="light"] .stack-header {
border-bottom-color: #ddd;
}
.stack-header-icon {
font-size: 14px;
line-height: 1;
}
.stack-header-label {
font-size: 13px;
font-weight: 600;
color: var(--text-tertiary);
}
.stack-header-select {
font-size: 12px;
padding: 3px 24px 3px 8px;
}
/* Stack columns layout:
.stack-grid is the CSS grid container (set via inline style in StackView).
Everything between .stack-grid and [data-type="stack-column"] must be
display:contents so columns become actual grid items regardless of
how many intermediate wrappers TipTap/ProseMirror/Y.js inserts. */
.stack-grid > *,
.stack-grid > * > *,
.stack-grid > * > * > * {
display: contents;
}
.stack-columns {
counter-reset: stack-col;
}
/* Editor-only: dashed borders, hover, and placeholder for stack columns */
.editor-app [data-component="stack"] [data-type="stack-column"] {
display: block !important;
border: 2px dashed rgba(255, 255, 255, 0.2);
border-radius: 6px;
padding: 12px;
min-height: 80px;
background: rgba(255, 255, 255, 0.05);
position: relative;
counter-increment: stack-col;
transition: border-color 0.15s, background 0.15s;
}
:root:not([data-theme="dark"]) .editor-app [data-component="stack"] [data-type="stack-column"],
[data-theme="light"] .editor-app [data-component="stack"] [data-type="stack-column"] {
border-color: #bbb;
background: rgba(0, 0, 0, 0.03);
}
.editor-app [data-component="stack"] [data-type="stack-column"]:hover {
border-color: var(--primary-color);
background: color-mix(in srgb, var(--primary-color) 10%, transparent);
}
.editor-app [data-component="stack"] [data-type="stack-column"]:has(> p:only-child > .ProseMirror-trailingBreak:only-child)::before,
.editor-app [data-component="stack"] [data-type="stack-column"]:has(> p:only-child:empty)::before {
content: "Column " counter(stack-col);
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: var(--text-faint);
font-size: 13px;
font-weight: 500;
pointer-events: none;
}
.editor-app [data-component="stack"] [data-type="stack-column"] > *:first-child {
margin-top: 0;
}
.editor-app [data-component="stack"] [data-type="stack-column"] > *:last-child {
margin-bottom: 0;
}
/* ============================================================================ */
/* Print styles */
/* ============================================================================ */
/*
* The .pdf-toc node is injected at print time by the PDF generator. It is
* hidden in the browser (web view of the published article) and shown only
* when emulating print media during PDF generation.
*/
.pdf-toc {
display: none;
}
@media print {
html,
body {
background: #fff;
}
/* Margins are handled by Playwright; avoid extra global margins */
body {
margin: 0;
}
/* Paragraphs: balanced break behaviour for long-form reading */
p,
li,
blockquote {
orphans: 3;
widows: 3;
}
p {
hyphens: auto;
-webkit-hyphens: auto;
}
/* Hide non-essential UI */
#theme-toggle,
.toc-mobile-toggle,
.toc-mobile-backdrop,
.toc-mobile-sidebar,
.right-aside,
.sync-indicator,
.top-bar {
display: none !important;
}
/* Sidebar TOC is replaced by .pdf-toc in print */
.table-of-contents {
display: none !important;
}
main > nav:first-of-type {
display: none !important;
}
/* Force single column to reduce widows/orphans and awkward breaks */
.content-grid {
grid-template-columns: 1fr !important;
}
/* Links: remove underline and background */
.content-grid main a {
text-decoration: none;
background: none;
border-bottom: 1px solid rgba(0, 0, 0, .2);
}
/* Soft page breaks around main headings */
.content-grid main h2 {
page-break-before: auto;
page-break-after: avoid;
break-after: avoid-page;
}
.content-grid main h3,
.content-grid main h4 {
break-after: avoid-page;
page-break-after: avoid;
}
/* Small icon labels not needed when printing */
.code-lang-chip {
display: none !important;
}
/* More contrasty colors for print */
:root {
--surface-bg: #fff;
--border-color: rgba(0, 0, 0, .2);
--link-underline: rgba(0, 0, 0, .3);
--link-underline-hover: rgba(0, 0, 0, .4);
}
/* Avoid breaks inside complex visual blocks */
.hero,
.hero-banner,
.html-embed,
.html-embed__card,
.html-embed-container,
.js-plotly-plot,
figure,
pre,
table,
blockquote,
.wide,
.full-width,
.stack > *,
.card,
.palettes,
.palette-card,
.color-picker,
.note {
break-inside: avoid;
page-break-inside: avoid;
}
/* Keep hero + meta together at the top of page 1 */
.hero {
page-break-after: avoid;
break-after: avoid;
}
/* Constrain hero banner after rasterization */
.hero-banner {
width: 100% !important;
max-width: 980px !important;
margin-left: auto !important;
margin-right: auto !important;
overflow: hidden;
}
.hero-banner > *,
.hero-banner svg,
.hero-banner canvas,
.hero-banner img,
.hero-banner video,
.html-embed-container > img {
max-width: 100% !important;
width: 100% !important;
height: auto !important;
margin-left: auto !important;
margin-right: auto !important;
display: block;
}
/* References / bibliography: start on a new page and stay together */
.references-block,
.bibliography-content {
break-before: page;
page-break-before: always;
}
.bibliography-title {
break-after: avoid;
page-break-after: avoid;
}
/* Footer: the web view uses a 3-column grid (~1160px wide) that does
not fit the ~673px printable width. Drop the grid so each block
flows naturally, headings stacked above their content. */
.footer-inner { display: block; }
.citation-block,
.references-block,
.reuse-block,
.doi-block,
.template-credit { display: block; }
.footer-heading {
text-align: left !important;
padding-right: 0 !important;
}
/* PDF TOC: visible only in print */
.pdf-toc {
display: block;
break-after: page;
page-break-after: always;
max-width: 780px;
margin: 0 auto 12mm;
padding: 0 16px;
}
.pdf-toc__title {
font-size: 1.3rem;
margin: 0 0 12px;
border-bottom: 1px solid rgba(0, 0, 0, .2);
padding-bottom: 8px;
}
.pdf-toc__list {
list-style: none;
margin: 0;
padding: 0;
}
.pdf-toc__item {
margin: 4px 0;
font-size: 0.95rem;
line-height: 1.4;
}
.pdf-toc__item--sub {
margin-left: 20px;
font-size: 0.88rem;
color: rgba(0, 0, 0, .7);
}
.pdf-toc__item a {
color: inherit;
text-decoration: none;
border-bottom: none;
}
/* Meta container (authors, affiliations, PDF link): keep tight under hero */
.meta-container,
.hero-meta {
break-after: avoid;
page-break-after: avoid;
}
/* Hide the PDF download cell in the generated PDF itself (self-referential) */
.meta-container-cell--pdf {
display: none !important;
}
/* Hide published-side tooltips in print */
.pub-tooltip {
display: none !important;
}
}
/* ============================================================================ */
/* Publisher-only CSS overrides */
/* Injected into the published static HTML on top of the shared styles. */
/* Keep this file SMALL - shared styles belong in article.css or components/. */
/* ============================================================================ */
/* Published page global reset */
body { font-family: var(--default-font-family); color: var(--text-color); }
html { font-size: 16px; line-height: 1.6; background-color: var(--page-bg); overflow-x: hidden; scroll-behavior: smooth; scroll-padding-top: 80px; }
/* Theme toggle icon wrapper (from ThemeToggle.astro) */
#theme-toggle .icon-wrapper {
display: grid;
place-items: center;
width: 20px;
height: 20px;
}
#theme-toggle .icon-wrapper .icon {
grid-area: 1 / 1;
filter: none !important;
}
#theme-toggle .icon-wrapper.animated .icon {
transition: opacity 0.35s ease;
}
#theme-toggle .icon-wrapper.spin-cw { animation: spin-cw 0.5s cubic-bezier(0.4,0,0.2,1); }
#theme-toggle .icon-wrapper.spin-ccw { animation: spin-ccw 0.5s cubic-bezier(0.4,0,0.2,1); }
@keyframes spin-cw { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-ccw { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
/* Override editor-specific .tiptap centering for published output */
.tiptap {
max-width: 100%;
padding: 0;
}
/* Wide / full-width helpers (published page uses viewport breakout) */
div[data-component="wide"],
div[data-component="fullWidth"] {
box-sizing: border-box;
position: relative;
z-index: var(--z-elevated, 10);
background-color: var(--page-bg);
}
div[data-component="wide"] {
width: min(1100px, 100vw - var(--content-padding-x, 16px) * 4);
margin-left: 50%;
transform: translateX(-50%);
padding: calc(var(--content-padding-x, 16px) * 4);
border-radius: calc(var(--button-radius, 6px) * 4);
-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;
}
div[data-component="wide"] > * {
margin-bottom: 0 !important;
}
div[data-component="fullWidth"] {
width: 100vw;
margin-left: calc(50% - 50vw);
margin-right: calc(50% - 50vw);
padding: calc(var(--content-padding-x, 16px) * 4);
border-radius: calc(var(--button-radius, 6px) * 4);
-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%);
}
div[data-component="fullWidth"] figure figcaption {
text-align: center !important;
}
@media (max-width: 768px) {
div[data-component="wide"],
div[data-component="fullWidth"] {
width: 100%;
margin-left: 0;
margin-right: 0;
padding: 0;
transform: none;
}
}
/* --- Sidenote: float into the right margin column --- */
div[data-component="sidenote"] {
float: right;
clear: right;
width: 240px;
margin-right: calc(-240px - 32px);
margin-top: 0;
margin-bottom: 0;
padding: 0;
}
@media (max-width: 1100px) {
div[data-component="sidenote"] {
float: none;
width: auto;
margin-right: 0;
margin: 0.75em 0;
padding: 0 30px;
border-left: 2px solid var(--border-color);
border-radius: 0;
}
}
/* ---------------------------------------------------------------------------
HTML embed figure (publisher output)
Structure:
<figure class="html-embed">
<div class="html-embed-container"><iframe.../></div>
<figcaption class="html-embed__desc">...</figcaption>
</figure>
--------------------------------------------------------------------------- */
figure.html-embed {
margin: 24px 0;
padding: 0;
}
figure.html-embed .html-embed-container {
width: 100%;
/* The iframe reports its height via postMessage; min-height is set inline
by the transformer to the last-known good value so the page doesn't
jump when the iframe loads (especially with loading="lazy"). */
}
figure.html-embed > .html-embed__desc {
margin: 8px 0 0;
font-size: 0.88em;
line-height: 1.5;
color: var(--muted-color);
text-align: center;
}
figure.html-embed > .html-embed__desc strong {
color: var(--text-color);
font-weight: 600;
}
/* Hugging Face user profile card styles live in
`components/_hf-user.css` so they're shared with the editor's
in-place NodeView and don't drift between author preview and
published output. */
/* PDF download button in the meta bar (inherits .button for gradient + padding) */
a.button.pdf-link {
display: inline-flex;
align-items: center;
gap: 0.45em;
text-decoration: none;
color: #fff;
}
a.button.pdf-link svg {
flex-shrink: 0;
}
.meta-container-cell--pdf p {
margin: 0;
line-height: 0;
}
/* Image lightbox dialog */
dialog.lightbox { border: none; background: transparent; padding: 0; max-width: 95vw; max-height: 95vh; }
dialog.lightbox::backdrop { background: rgba(0, 0, 0, 0.85); }
dialog.lightbox img { max-width: 95vw; max-height: 90vh; object-fit: contain; border-radius: 4px; }
/* ---------------------------------------------------------------------------
Inline tooltips for glossary terms and citation links (published page).
Mirrors the editor's GlossaryView / CitationView popovers, but rendered
as static HTML revealed via :hover / :focus-within (no JS).
--------------------------------------------------------------------------- */
.tiptap .glossary-node,
.tiptap .citation-inline {
position: relative;
}
.tiptap .glossary-node {
color: var(--primary-color);
border-bottom: 1px dashed color-mix(in srgb, var(--primary-color) 50%, transparent);
cursor: help;
}
.tiptap .pub-tooltip {
position: absolute;
bottom: calc(100% + 6px);
left: 50%;
transform: translateX(-50%) translateY(4px);
display: block;
width: max-content;
min-width: 200px;
max-width: min(320px, 90vw);
padding: 10px 14px;
background: var(--bg-tooltip);
border: 1px solid var(--border-color);
border-radius: 8px;
box-shadow: var(--shadow-lg);
z-index: 50;
text-align: left;
white-space: normal;
font-size: 12px;
font-style: normal;
font-weight: normal;
line-height: 1.45;
color: var(--text-color);
opacity: 0;
visibility: hidden;
pointer-events: none;
transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
}
.tiptap .glossary-node:hover > .pub-tooltip,
.tiptap .glossary-node:focus-visible > .pub-tooltip,
.tiptap .glossary-node:focus-within > .pub-tooltip,
.tiptap .citation-inline:hover > .pub-tooltip,
.tiptap .citation-inline:focus-visible > .pub-tooltip,
.tiptap .citation-inline:focus-within > .pub-tooltip {
opacity: 1;
visibility: visible;
transform: translateX(-50%) translateY(0);
}
.tiptap .pub-tooltip__title {
display: block;
font-weight: 700;
font-size: 13px;
color: var(--text-heading-secondary);
margin-bottom: 4px;
}
.tiptap .pub-tooltip__body {
display: block;
color: var(--muted-color);
}
.tiptap .pub-tooltip__journal {
display: block;
color: var(--muted-color);
font-style: italic;
font-size: 11.5px;
}
.tiptap .pub-tooltip__doi {
display: block;
margin-top: 6px;
color: var(--text-tertiary);
font-family: "SFMono-Regular", "Fira Code", monospace;
font-size: 11px;
overflow: hidden;
text-overflow: ellipsis;
}
/* Print: don't show tooltips */
@media print {
.tiptap .pub-tooltip { display: none !important; }
}
</style>
</head>
<body>
<button id="theme-toggle" aria-label="Toggle color theme">
<span class="icon-wrapper">
<svg class="icon icon--sun" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5" /><line x1="12" y1="1" x2="12" y2="4" /><line x1="12" y1="20" x2="12" y2="23" /><line x1="1" y1="12" x2="4" y2="12" /><line x1="20" y1="12" x2="23" y2="12" /><line x1="4.22" y1="4.22" x2="6.34" y2="6.34" /><line x1="17.66" y1="17.66" x2="19.78" y2="19.78" /><line x1="4.22" y1="19.78" x2="6.34" y2="17.66" /><line x1="17.66" y1="6.34" x2="19.78" y2="4.22" />
</svg>
<svg class="icon icon--moon" style="opacity:0" width="20" height="20" viewBox="0 0 24 24" aria-hidden="true" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
</span>
</button>
<!-- Mobile TOC toggle -->
<button class="toc-mobile-toggle" aria-label="Open table of contents" aria-expanded="false">
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="3" y1="6" x2="21" y2="6" /><line x1="3" y1="12" x2="21" y2="12" /><line x1="3" y1="18" x2="21" y2="18" />
</svg>
</button>
<div class="toc-mobile-backdrop" aria-hidden="true"></div>
<aside class="toc-mobile-sidebar" aria-label="Table of Contents">
<div class="toc-mobile-sidebar__header">
<span class="toc-mobile-sidebar__title">Table of Contents</span>
<div class="toc-mobile-sidebar__actions">
<button class="toc-mobile-sidebar__theme" aria-label="Toggle color theme">
<svg class="icon light" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="12" cy="12" r="5" /><line x1="12" y1="1" x2="12" y2="4" /><line x1="12" y1="20" x2="12" y2="23" /><line x1="1" y1="12" x2="4" y2="12" /><line x1="20" y1="12" x2="23" y2="12" /><line x1="4.22" y1="4.22" x2="6.34" y2="6.34" /><line x1="17.66" y1="17.66" x2="19.78" y2="19.78" /><line x1="4.22" y1="19.78" x2="6.34" y2="17.66" /><line x1="17.66" y1="6.34" x2="19.78" y2="4.22" />
</svg>
<svg class="icon dark" width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z" />
</svg>
</button>
<button class="toc-mobile-sidebar__close" aria-label="Close table of contents">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<line x1="18" y1="6" x2="6" y2="18" /><line x1="6" y1="6" x2="18" y2="18" />
</svg>
</button>
</div>
</div>
<div class="toc-mobile-sidebar__body" id="toc-mobile-placeholder"></div>
</aside>
<!-- Hero -->
<section class="hero">
<h1 class="hero-title">default</h1>
<div class="hero-banner"><iframe srcdoc="<!DOCTYPE html>
<html data-theme=&quot;light&quot;>
<head>
<meta charset=&quot;UTF-8&quot;>
<script>(function(){
try {
var theme = null;
var primary = null;
try {
var parentDoc = window.parent && window.parent.document;
if (parentDoc) {
theme = parentDoc.documentElement.getAttribute('data-theme') || null;
var pc = getComputedStyle(parentDoc.documentElement).getPropertyValue('--primary-color');
if (pc) primary = pc.trim();
}
} catch(e) {}
if (!theme) {
try { theme = window.localStorage && window.localStorage.getItem('theme'); } catch(e) {}
}
// Respect the srcdoc-provided data-theme before falling back to the
// OS preference. Without this, a cross-origin sandbox iframe (e.g.
// an embed-studio preview with sandbox=&quot;allow-scripts&quot; but no
// allow-same-origin) can't read the parent and the bootstrap would
// otherwise clobber the explicitly-set initial theme with
// matchMedia's guess.
if (!theme) {
theme = document.documentElement.getAttribute('data-theme') || null;
}
if (!theme) {
theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
document.documentElement.setAttribute('data-theme', theme);
document.documentElement.style.colorScheme = theme === 'dark' ? 'dark' : 'light';
if (primary) document.documentElement.style.setProperty('--primary-color', primary);
} catch(e) {}
})();</script>
<style>:root, [data-theme='light'] {
color-scheme: light;
--text-color: rgba(0,0,0,.85);
--surface-bg: #f9f9f9;
--page-bg: #fff;
--border-color: rgba(0,0,0,.1);
--muted-color: rgba(0,0,0,.6);
--axis-color: rgba(0,0,0,.6);
--tick-color: rgba(0,0,0,.85);
--grid-color: rgba(0,0,0,.08);
}
[data-theme='dark'] {
color-scheme: dark;
--text-color: rgba(255,255,255,.9);
--surface-bg: #07080a;
--page-bg: #0f1115;
--border-color: rgba(255,255,255,.15);
--muted-color: rgba(255,255,255,.7);
--axis-color: rgba(255,255,255,.7);
--tick-color: rgba(255,255,255,.7);
--grid-color: rgba(255,255,255,.10);
}
*, *::before, *::after { box-sizing: border-box; }
/* IMPORTANT: do NOT set min-height:100% on <body>. Doing so creates a
lower bound on scrollHeight equal to the iframe's rendered height, so
the reporter can never signal a smaller height and the iframe can only
ever grow (never shrink when the chart re-renders narrower on resize). */
html, body { margin: 0; padding: 0; background: transparent; }
body {
color: var(--text-color);
font-family: -apple-system, BlinkMacSystemFont, 'Inter', 'Segoe UI', sans-serif;
font-size: 13px;
padding: 16px;
/* overflow: clip clips runaway horizontal content without creating a
scroll container that would trap scroll events or inflate scrollHeight. */
overflow: clip;
}
/* SVG quirk: text/line/path do not inherit CSS color the way HTML does.
Their default fill/stroke is &quot;black&quot;, not &quot;currentColor&quot;. A chart
that only sets body color via var(--text-color) would still render
black axes/labels in dark mode. Default everything without its own
fill/stroke to currentColor so the cascaded body color drives the
look. Charts that want a specific colour just set the attribute or
inline style and win by specificity. */
svg text:not([fill]) { fill: currentColor; }
svg .axis path:not([stroke]),
svg .axis line:not([stroke]),
svg .domain:not([stroke]) { stroke: currentColor; }
svg .grid line:not([stroke]) { stroke: currentColor; opacity: 0.12; }:root{--primary-color:#4e79a7;}</style>
<script>(function(){
var palettes = {
categorical: ['#4e79a7','#f28e2b','#e15759','#76b7b2','#59a14f','#edc948','#b07aa1','#ff9da7','#9c755f','#bab0ac'],
sequential: ['#084594','#2171b5','#4292c6','#6baed6','#9ecae1','#c6dbef','#deebf7','#f7fbff'],
diverging: ['#d73027','#f46d43','#fdae61','#fee090','#ffffbf','#e0f3f8','#abd9e9','#74add1','#4575b4']
};
window.ColorPalettes = {
getColors: function(type, n) {
var p = palettes[type] || palettes.categorical;
return p.slice(0, n != null ? n : p.length);
},
getPrimary: function() {
return getComputedStyle(document.documentElement).getPropertyValue('--primary-color').trim() || '#4e79a7';
},
refresh: function() {},
getTextStyleForBackground: function() { return { fill: '#ffffff' }; }
};
})();</script>
</head>
<body>
<div class=&quot;d3-banner&quot;></div>
<style>
.d3-banner { width: 100%; height: 100%; overflow: hidden; }
.d3-banner .particle { stroke: none; }
.d3-banner .particle:hover { opacity: 0.8; }
.d3-banner .tooltip {
position: absolute;
padding: 4px 8px;
background: var(--surface-bg);
color: var(--text-color);
border: 1px solid var(--border-color);
border-radius: 3px;
pointer-events: none;
font-size: 12px;
font-family: system-ui, sans-serif;
}
</style>
<script>
(() => {
const ensureD3 = (cb) => {
if (window.d3 && typeof window.d3.select === 'function') return cb();
let s = document.getElementById('d3-cdn-script');
if (!s) { s = document.createElement('script'); s.id = 'd3-cdn-script'; s.src = 'https://cdn.jsdelivr.net/npm/d3@7/dist/d3.min.js'; document.head.appendChild(s); }
const onReady = () => { if (window.d3 && typeof window.d3.select === 'function') cb(); };
s.addEventListener('load', onReady, { once: true });
if (window.d3) onReady();
};
const bootstrap = () => {
const scriptEl = document.currentScript;
let container = scriptEl ? scriptEl.previousElementSibling : null;
if (!(container && container.classList.contains('d3-banner'))) {
const cs = Array.from(document.querySelectorAll('.d3-banner')).filter(el => el.dataset.mounted !== 'true');
container = cs[cs.length - 1] || null;
}
if (!container) return;
if (container.dataset.mounted === 'true') return;
container.dataset.mounted = 'true';
// Ensure container fills the banner area
container.style.width = '100%';
container.style.height = '100%';
container.style.overflow = 'hidden';
const svg = d3.select(container).append('svg')
.attr('width', '100%')
.attr('height', '100%')
.style('display', 'block');
const particles = 80; // number of particles
const colors = window.ColorPalettes.getColors('categorical', 6);
const reduced = window.matchMedia('(prefers-reduced-motion: reduce)').matches;
let data = d3.range(particles).map(() => ({
x: Math.random(),
y: Math.random(),
vx: (Math.random() - 0.5) * 0.0015,
vy: (Math.random() - 0.5) * 0.0015,
r: 2 + Math.random() * 3,
c: colors[Math.floor(Math.random() * colors.length)]
}));
const particlesSel = svg.selectAll('circle')
.data(data)
.enter()
.append('circle')
.attr('class', 'particle')
.attr('r', d => d.r)
.attr('fill', d => d.c);
function render() {
const w = container.clientWidth || 980;
const h = container.clientHeight || 392;
svg.attr('viewBox', `0 0 ${w} ${h}`);
}
render();
if (window.ResizeObserver) new ResizeObserver(render).observe(container);
if (!reduced) {
d3.timer(() => {
data.forEach(d => {
d.x += d.vx;
d.y += d.vy;
if (d.x < 0) d.x = 1;
if (d.x > 1) d.x = 0;
if (d.y < 0) d.y = 1;
if (d.y > 1) d.y = 0;
});
particlesSel
.attr('cx', d => d.x * (container.clientWidth || 980))
.attr('cy', d => d.y * (container.clientHeight || 392));
return false;
});
}
};
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => ensureD3(bootstrap), { once: true });
} else {
ensureD3(bootstrap);
}
})();
</script>
<script>(function(){
var lastH = 0;
var scheduled = false;
// IMPORTANT: only measure <body>. document.documentElement.scrollHeight is
// clamped to at least the iframe's viewport height, so it would never allow
// the iframe to shrink (it would always report >= current iframe height).
// body.scrollHeight reflects the actual content height plus body padding.
function measure(){
var b = document.body;
if (!b) return 0;
// getBoundingClientRect().bottom accounts for padding/margin precisely;
// fall back to scrollHeight if the rect reports 0 (detached layout).
var rectBottom = Math.ceil(b.getBoundingClientRect().bottom);
var scroll = Math.ceil(b.scrollHeight);
// body margin may push the rect down; scrollHeight ignores it. Take the
// max so we never under-report.
return Math.max(rectBottom, scroll);
}
function post(h){
try {
window.parent.postMessage({ type: 'embedResize', height: h }, '*');
} catch(e){}
}
function schedule(){
if (scheduled) return;
scheduled = true;
requestAnimationFrame(function(){
scheduled = false;
var h = measure();
if (h > 0 && Math.abs(h - lastH) >= 1) {
lastH = h;
post(h);
}
});
}
if (typeof ResizeObserver !== 'undefined') {
var ro = new ResizeObserver(schedule);
ro.observe(document.documentElement);
if (document.body) ro.observe(document.body);
}
if (typeof MutationObserver !== 'undefined' && document.body) {
var mo = new MutationObserver(schedule);
mo.observe(document.body, { childList: true, subtree: true, attributes: true, characterData: true });
}
window.addEventListener('load', function(){
schedule();
setTimeout(schedule, 300);
setTimeout(schedule, 1000);
setTimeout(schedule, 3000);
});
// Opt-in explicit ready signal for async charts
window.__embedReady = function(){
schedule();
try { window.parent.postMessage({ type: 'embedReady' }, '*'); } catch(e){}
};
})();</script>
<script>(function(){
window.addEventListener('message', function(e){
if (!e.data) return;
if (e.data.type === 'setTheme') {
document.documentElement.setAttribute('data-theme', e.data.theme);
document.documentElement.style.colorScheme = e.data.theme === 'dark' ? 'dark' : 'light';
if (e.data.primaryColor) {
document.documentElement.style.setProperty('--primary-color', e.data.primaryColor);
}
if (window.__chartRerender) try { window.__chartRerender(); } catch(err){}
} else if (e.data.type === 'updatePrimaryColor') {
document.documentElement.style.setProperty('--primary-color', e.data.color);
if (window.__chartRerender) try { window.__chartRerender(); } catch(err){}
}
});
})();</script>
</body></html>" sandbox="allow-scripts allow-same-origin" loading="lazy" style="width:100%;height:100%;border:none;display:block;background:transparent;" data-banner-src="banner.html"></iframe></div>
</section>
<!-- Meta bar -->
<header class="meta"><div class="meta-container"><div class="meta-container-cell"><h3>Authors</h3><ul class="authors"><li><a href="test" class="author-link" target="_blank" rel="noopener">test</a></li></ul></div><div class="meta-container-cell"><h3>Affiliations</h3><p>test</p></div><div class="meta-container-cell"><h3>Published</h3><p>May 20, 2026</p></div><div class="meta-container-cell meta-container-cell--pdf"><h3>PDF</h3><p><a href="https://huggingface.co/datasets/tfrere/research-article-template-editor-test2-data/resolve/main/published/default/article.pdf" class="button pdf-link" target="_blank" rel="noopener" download="" aria-label="Download PDF"><svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" /><polyline points="7 10 12 15 17 10" /><line x1="12" y1="15" x2="12" y2="3" /></svg>Download PDF</a></p></div></div></header>
<section class="content-grid">
<nav class="table-of-contents" aria-label="Table of Contents" data-auto-collapse="0">
<div class="title">Table of Contents</div>
<div id="toc-placeholder"></div>
</nav>
<main>
<div class="tiptap">
<p>dqzdqzdqz</p><h1>Coucou</h1><p>bonjour</p>
</div>
</main>
</section>
<!-- Footer -->
<footer class="footer"><div class="footer-inner">
<section class="citation-block">
<p class="footer-heading" role="heading" aria-level="2">Citation</p>
<p>For attribution in academic contexts, please cite this work as</p>
<pre class="citation short">test (2026). "default".</pre>
<p>BibTeX citation</p>
<pre class="citation long">@misc{test2026_default,
title={default},
author={test},
year={2026}
}</pre>
</section>
<section class="references-block"></section>
<div class="template-credit">
<p>Made with ❤️ with <a href="https://huggingface.co/spaces/tfrere/research-article-template" target="_blank" rel="noopener noreferrer">research article template</a></p>
</div></div></footer>
<!-- Image lightbox -->
<dialog class="lightbox" id="lightbox">
<img id="lightbox-img" src="" alt="">
</dialog>
<script>
(function() {
// Theme toggle (matches template ThemeToggle.astro)
var btn = document.getElementById('theme-toggle');
var sunIcon = btn && btn.querySelector('.icon--sun');
var moonIcon = btn && btn.querySelector('.icon--moon');
var wrapper = btn && btn.querySelector('.icon-wrapper');
var media = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)');
var prefersDark = media && media.matches;
var saved = localStorage.getItem('theme');
function applyTheme(mode) {
document.documentElement.dataset.theme = mode;
if (sunIcon && moonIcon) {
sunIcon.style.opacity = mode === 'dark' ? '0' : '1';
moonIcon.style.opacity = mode === 'dark' ? '1' : '0';
}
}
applyTheme(saved || (prefersDark ? 'dark' : 'light'));
requestAnimationFrame(function() { if (wrapper) wrapper.classList.add('animated'); });
if (!saved && media) {
var syncSystem = function(e) { applyTheme(e.matches ? 'dark' : 'light'); };
if (media.addEventListener) media.addEventListener('change', syncSystem);
}
if (btn) {
btn.addEventListener('click', function() {
var next = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
localStorage.setItem('theme', next);
if (wrapper) {
var cls = next === 'dark' ? 'spin-cw' : 'spin-ccw';
wrapper.classList.remove('spin-cw', 'spin-ccw');
void wrapper.offsetWidth;
wrapper.classList.add(cls);
wrapper.addEventListener('animationend', function() { wrapper.classList.remove(cls); }, { once: true });
}
applyTheme(next);
});
}
// Lightbox
document.querySelectorAll('.tiptap img').forEach(function(img) {
img.style.cursor = 'zoom-in';
img.addEventListener('click', function() {
var lbImg = document.getElementById('lightbox-img');
var lbDlg = document.getElementById('lightbox');
if (lbImg) lbImg.src = img.src;
if (lbDlg && lbDlg.showModal) lbDlg.showModal();
});
});
var lb = document.getElementById('lightbox');
if (lb) lb.addEventListener('click', function(e) { if (e.target === this) this.close(); });
// Glossary
document.querySelectorAll('[data-type="glossary"]').forEach(function(el) { el.setAttribute('tabindex', '0'); });
// ---- Table of Contents ----
var holder = document.getElementById('toc-placeholder');
var holderMobile = document.getElementById('toc-mobile-placeholder');
var articleRoot = document.querySelector('.content-grid main');
if (!articleRoot) return;
var headings = articleRoot.querySelectorAll('h2, h3, h4');
if (!headings.length) return;
var headingsArr = Array.from(headings);
// Unique IDs
var usedIds = {};
var slugify = function(s) { return String(s||'').toLowerCase().trim().replace(/\s+/g,'_').replace(/[^a-z0-9_-]/g,''); };
headingsArr.forEach(function(h) {
var id = (h.id||'').trim() || slugify(h.textContent) || 'section';
var c = id, n = 2;
while (usedIds[c]) c = id+'-'+(n++);
if (h.id !== c) h.id = c;
usedIds[c] = true;
});
// Build nested nav with data-heading-idx
// Each nested <ul> is wrapped in <div class="toc-children"> so we can
// animate expand/collapse via the grid-template-rows 0fr/1fr trick
// (CSS cannot interpolate height:auto).
var nav = document.createElement('nav');
var ulStack = [document.createElement('ul')];
nav.appendChild(ulStack[0]);
var levelOf = function(tag) { return tag==='H2'?2:tag==='H3'?3:4; };
var prev = 2, hIdx = 0;
headingsArr.forEach(function(h) {
var lvl = levelOf(h.tagName);
while (lvl > prev) {
var wrap = document.createElement('div');
wrap.className = 'toc-children';
var ul = document.createElement('ul');
wrap.appendChild(ul);
var last = ulStack[ulStack.length-1].lastElementChild;
if (last) last.appendChild(wrap);
ulStack.push(ul);
prev++;
}
while (lvl < prev) { ulStack.pop(); prev--; }
var li = document.createElement('li');
var a = document.createElement('a');
a.href = '#'+h.id; a.textContent = h.textContent;
li.appendChild(a);
li.setAttribute('data-heading-idx', String(hIdx++));
ulStack[ulStack.length-1].appendChild(li);
});
if (holder) holder.appendChild(nav);
var navClone = nav.cloneNode(true);
if (holderMobile) holderMobile.appendChild(navClone);
// Mark navs as collapsible
nav.classList.add('toc-collapsible');
navClone.classList.add('toc-collapsible');
var allLinks = [].concat(
holder ? Array.from(holder.querySelectorAll('a')) : [],
holderMobile ? Array.from(holderMobile.querySelectorAll('a')) : []
);
// Click handler for smooth scroll with offset
var SCROLL_OFFSET = 80;
allLinks.forEach(function(link) {
link.addEventListener('click', function(e) {
var href = link.getAttribute('href');
if (!href || href.charAt(0) !== '#') return;
var el = document.getElementById(href.slice(1));
if (!el) return;
e.preventDefault();
var top = el.getBoundingClientRect().top + window.scrollY - SCROLL_OFFSET;
window.scrollTo({ top: top, behavior: 'smooth' });
history.pushState(null, '', href);
});
});
// ---- Auto-collapse logic ----
var isMobile = window.matchMedia('(max-width: 1100px)');
var tocNav = document.querySelector('.table-of-contents');
var autoCollapseEnabled = tocNav && tocNav.getAttribute('data-auto-collapse') === '1';
function getItemsWithChildren(navEl) {
if (!navEl) return [];
return Array.from(navEl.querySelectorAll('li[data-heading-idx]')).filter(function(li) {
return li.querySelector(':scope > .toc-children');
});
}
function getAncestorIndices(items, targetIdx) {
var toExpand = {};
var activeLi = null;
function find(li) {
if (Number(li.getAttribute('data-heading-idx')) === targetIdx) return li;
var wrap = li.querySelector(':scope > .toc-children');
if (!wrap) return null;
var ul = wrap.querySelector(':scope > ul');
if (!ul) return null;
var children = ul.querySelectorAll(':scope > li[data-heading-idx]');
for (var i = 0; i < children.length; i++) { var f = find(children[i]); if (f) return f; }
return null;
}
for (var i = 0; i < items.length; i++) { activeLi = find(items[i]); if (activeLi) break; }
if (!activeLi) return toExpand;
toExpand[targetIdx] = true;
var cur = activeLi;
while (cur) {
var parent = cur.parentElement ? cur.parentElement.closest('li[data-heading-idx]') : null;
if (parent) { toExpand[Number(parent.getAttribute('data-heading-idx'))] = true; cur = parent; }
else break;
}
return toExpand;
}
// Just toggle the .collapsed class on the li. The CSS rule
// .toc-collapsible li.collapsed > .toc-children { grid-template-rows: 0fr }
// drives the actual animation (no JS height math).
function applyCollapseState(navEl, activeIdx) {
if (!navEl) return;
var items = getItemsWithChildren(navEl);
var ancestors = getAncestorIndices(items, activeIdx);
items.forEach(function(li) {
var idx = Number(li.getAttribute('data-heading-idx'));
var allDesc = li.querySelectorAll('li[data-heading-idx]');
var related = [idx];
allDesc.forEach(function(d) { related.push(Number(d.getAttribute('data-heading-idx'))); });
var shouldExpand = related.some(function(i) { return ancestors[i]; });
li.classList.toggle('collapsed', !shouldExpand);
});
}
function expandAll(navEl) {
if (!navEl) return;
getItemsWithChildren(navEl).forEach(function(li) {
li.classList.remove('collapsed');
});
}
// Initial state: collapse only if auto-collapse is enabled.
// We suppress transitions for the first paint so the user doesn't see
// a close-animation at page load when auto-collapse is on.
function initCollapse() {
if (!autoCollapseEnabled) return;
if (nav) nav.classList.add('toc-no-transition');
if (navClone) navClone.classList.add('toc-no-transition');
if (isMobile.matches) {
expandAll(holder ? holder.querySelector('nav') : null);
expandAll(holderMobile ? holderMobile.querySelector('nav') : null);
} else {
applyCollapseState(holder ? holder.querySelector('nav') : null, 0);
applyCollapseState(holderMobile ? holderMobile.querySelector('nav') : null, 0);
}
requestAnimationFrame(function(){
requestAnimationFrame(function(){
if (nav) nav.classList.remove('toc-no-transition');
if (navClone) navClone.classList.remove('toc-no-transition');
});
});
}
initCollapse();
isMobile.addEventListener('change', function() {
if (!autoCollapseEnabled) return;
if (isMobile.matches) {
expandAll(holder ? holder.querySelector('nav') : null);
expandAll(holderMobile ? holderMobile.querySelector('nav') : null);
} else {
applyCollapseState(holder ? holder.querySelector('nav') : null, prevActiveIdx);
applyCollapseState(holderMobile ? holderMobile.querySelector('nav') : null, prevActiveIdx);
}
});
// ---- Scroll tracking (IntersectionObserver-driven) ----
// Semantics: active heading = the last one whose top has crossed the
// OFFSET line ("section I'm currently reading"). This matches typical
// documentation UX (MDN, Docusaurus, etc.) and is intentionally different
// from the editor-side TOC which picks the topmost visible heading in its
// scroll container (better suited to non-linear editing navigation).
//
// We use IntersectionObserver only as a trigger: it fires precisely when
// a heading crosses the OFFSET boundary, which are the only moments the
// active heading can change. No per-frame scroll handler, no throttling.
var OFFSET = 60, prevActiveIdx = -1, prevActiveId = null, rafPending = false;
function findActiveHeading() {
for (var i = headingsArr.length - 1; i >= 0; i--) {
var h = headingsArr[i];
// Skip headings removed from DOM or moved outside article (e.g. footnotes moved to footer)
if (!h.isConnected || !articleRoot.contains(h)) continue;
if (h.getBoundingClientRect().top - OFFSET <= 0) {
return { idx: i, id: h.id };
}
}
return { idx: -1, id: null };
}
function updateActive() {
if (rafPending) return;
rafPending = true;
requestAnimationFrame(function() {
rafPending = false;
var result = findActiveHeading();
var activeIdx = result.idx, activeId = result.id;
if (activeId === prevActiveId && activeIdx === prevActiveIdx) return;
allLinks.forEach(function(l) { l.classList.remove('active'); });
if (activeId) {
var href = '#' + activeId;
allLinks.forEach(function(l) {
if (l.getAttribute('href') === href) l.classList.add('active');
});
}
if (activeIdx >= 0 && activeIdx !== prevActiveIdx) {
if (autoCollapseEnabled && !isMobile.matches) {
applyCollapseState(holder ? holder.querySelector('nav') : null, activeIdx);
}
}
prevActiveIdx = activeIdx;
prevActiveId = activeId;
});
}
if (typeof IntersectionObserver !== 'undefined') {
var spyObserver = new IntersectionObserver(updateActive, {
rootMargin: '-' + OFFSET + 'px 0px 0px 0px',
threshold: 0,
});
headingsArr.forEach(function(h) {
if (articleRoot.contains(h)) spyObserver.observe(h);
});
// rootMargin changes on resize (viewport height affects the bottom edge
// of the root), but the top offset is fixed, so no need to recreate.
} else {
// Fallback for browsers without IntersectionObserver (very old).
window.addEventListener('scroll', updateActive, { passive: true });
}
updateActive();
// ---- Mobile sidebar ----
var sidebar = document.querySelector('.toc-mobile-sidebar');
var backdrop = document.querySelector('.toc-mobile-backdrop');
var toggleBtn = document.querySelector('.toc-mobile-toggle');
var closeBtn = document.querySelector('.toc-mobile-sidebar__close');
function openSidebar() {
sidebar.classList.add('open'); backdrop.classList.add('open');
toggleBtn.setAttribute('aria-expanded','true');
document.body.style.overflow = 'hidden';
requestAnimationFrame(function() {
var active = sidebar.querySelector('a.active');
if (active) {
var body = sidebar.querySelector('.toc-mobile-sidebar__body');
if (body) body.scrollTop = Math.max(0, active.offsetTop - body.offsetTop - body.clientHeight/3);
}
});
}
function closeSidebar() {
sidebar.classList.remove('open'); backdrop.classList.remove('open');
toggleBtn.setAttribute('aria-expanded','false');
document.body.style.overflow = '';
}
if (toggleBtn) toggleBtn.addEventListener('click', openSidebar);
if (closeBtn) closeBtn.addEventListener('click', closeSidebar);
if (backdrop) backdrop.addEventListener('click', closeSidebar);
if (holderMobile) holderMobile.addEventListener('click', function(e) { if (e.target.closest && e.target.closest('a')) closeSidebar(); });
document.addEventListener('keydown', function(e) { if (e.key==='Escape' && sidebar.classList.contains('open')) closeSidebar(); });
// Sidebar theme toggle
var sidebarThemeBtn = document.querySelector('.toc-mobile-sidebar__theme');
if (sidebarThemeBtn) {
sidebarThemeBtn.addEventListener('click', function() {
var next = document.documentElement.dataset.theme === 'dark' ? 'light' : 'dark';
localStorage.setItem('theme', next);
applyTheme(next);
});
}
// ---- Footer: move references & footnotes ----
(function() {
var footer = document.querySelector('footer.footer');
if (!footer) return;
var target = footer.querySelector('.references-block');
if (!target) return;
var contentRoot = document.querySelector('.content-grid main') || document.body;
var ensureHeading = function(text) {
var exists = Array.from(target.children).some(function(c) {
return c.classList.contains('footer-heading') && c.textContent.trim().toLowerCase() === text.toLowerCase();
});
if (!exists) {
var h = document.createElement('p');
h.className = 'footer-heading';
h.setAttribute('role', 'heading');
h.setAttribute('aria-level', '2');
h.textContent = text;
target.appendChild(h);
}
};
var moveIntoFooter = function(el, headingText) {
if (!el) return false;
var firstH = el.querySelector(':scope > h1, :scope > h2, :scope > h3, :scope > .footer-heading, :scope > .bibliography-title');
if (firstH) {
var t = (firstH.textContent || '').trim().toLowerCase();
if (t === headingText.toLowerCase() || t.includes('reference') || t.includes('bibliograph')) firstH.remove();
}
ensureHeading(headingText);
target.appendChild(el);
return true;
};
var findAllOutsideFooter = function(selectors) {
var results = [];
for (var i = 0; i < selectors.length; i++) {
var els = contentRoot.querySelectorAll(selectors[i]);
els.forEach(function(el) { if (!footer.contains(el) && results.indexOf(el) === -1) results.push(el); });
}
return results;
};
var findFirst = function(selectors) { var a = findAllOutsideFooter(selectors); return a.length ? a[0] : null; };
var run = function() {
if (footer.dataset.processed === 'true') return;
var refs = findAllOutsideFooter(['[data-type="bibliography"]', '#bibliography-references-list', '#references', '#refs', '.bibliography']);
var notes = findFirst(['.footnotes', 'section.footnotes', 'div.footnotes']);
var moved = false;
refs.forEach(function(el) { if (moveIntoFooter(el, 'References')) moved = true; });
if (moveIntoFooter(notes, 'Footnotes')) moved = true;
if (moved) footer.dataset.processed = 'true';
};
run();
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', run, { once: true });
window.addEventListener('load', function() { setTimeout(run, 100); }, { once: true });
setTimeout(run, 300);
})();
// Sync theme with embed iframes (body embeds + hero banner)
function syncEmbedThemes() {
var theme = document.documentElement.dataset.theme || 'dark';
document.querySelectorAll('.html-embed-container iframe, .hero-banner iframe').forEach(function(iframe) {
try { iframe.contentWindow.postMessage({ type: 'setTheme', theme: theme }, '*'); } catch(e) {}
});
}
var obs = new MutationObserver(function(ms) {
for (var i = 0; i < ms.length; i++) {
if (ms[i].attributeName === 'data-theme') { syncEmbedThemes(); break; }
}
});
obs.observe(document.documentElement, { attributes: true, attributeFilter: ['data-theme'] });
// Auto-size embed iframes from postMessage height reports.
// Dedupe: only apply when the new height differs from the last applied
// (prevents style thrash during tight ResizeObserver bursts).
var _lastEmbedHeight = new WeakMap();
window.addEventListener('message', function(e) {
if (!e.data || e.data.type !== 'embedResize') return;
var h = Math.max(0, Math.ceil(e.data.height));
if (!h) return;
document.querySelectorAll('.html-embed-container iframe').forEach(function(iframe) {
try {
if (iframe.contentWindow !== e.source) return;
if (_lastEmbedHeight.get(iframe) === h) return;
_lastEmbedHeight.set(iframe, h);
iframe.style.height = h + 'px';
} catch(ex) {}
});
});
// Initial theme sync after iframes load
window.addEventListener('load', function() { setTimeout(syncEmbedThemes, 200); });
// Hash navigation
if (window.location.hash) {
var target = document.querySelector(window.location.hash);
if (target) setTimeout(function() { target.scrollIntoView({block:'start'}); }, 100);
}
window.addEventListener('popstate', function() {
var h = window.location.hash;
if (h) { var t = document.querySelector(h); if (t) t.scrollIntoView({block:'start'}); }
else window.scrollTo({top:0});
});
})();
</script>
</body>
</html>