fixing the site

This commit is contained in:
2025-12-28 20:41:18 +00:00
parent 5db24213bd
commit bb6b6c5768
487 changed files with 94631 additions and 8059 deletions

0
assets/Big-O-Notation-3130482830.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 232 KiB

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

BIN
assets/gr.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

1
assets/scripts/bigger-picture.min.js vendored Executable file

File diff suppressed because one or more lines are too long

255
assets/scripts/gallery-init.js Executable file
View File

@@ -0,0 +1,255 @@
document.addEventListener('DOMContentLoaded', () => {
if (typeof window.BiggerPicture !== 'function') {
console.error('[gallery-init] BiggerPicture not found. Check script path.');
return;
}
// 1) Wrap Org-exported images so theyre clickable
const imgs = document.querySelectorAll('.figure img, img.org-svg');
imgs.forEach((img) => {
if (img.closest('a')) return; // already wrapped
const a = document.createElement('a');
const href = img.currentSrc || img.src;
a.href = href;
a.dataset.img = href; // lets BP pre-size/raster slides
a.dataset.alt = img.alt || '';
const setDims = () => {
a.dataset.width = img.naturalWidth || img.width || 1920;
a.dataset.height = img.naturalHeight || img.height || 1080;
};
if (img.complete) setDims(); else img.addEventListener('load', setDims);
img.style.cursor = 'zoom-in';
img.parentElement.insertBefore(a, img);
a.appendChild(img);
});
// 2) One global BP instance
const bp = BiggerPicture({ target: document.body });
// SVG pan/zoom handle
let activePanZoom = null;
const destroyPanZoom = () => { try { activePanZoom?.destroy(); } catch(_){} activePanZoom = null; };
// Simple rotate state (for non-SVG images)
let activeContainer = null;
let currentRotation = 0;
let rotateControls = null;
// 3) Build galleries per content container
const containers = document.querySelectorAll('main, article, .content, body');
containers.forEach((container) => {
const links = Array.from(container.querySelectorAll('.figure a, a:has(img.org-svg)'));
if (!links.length) return;
// Start the lightbox on click
links.forEach((link, index) => {
link.addEventListener('click', (e) => {
e.preventDefault();
document.querySelectorAll(".theme-toggle").forEach(el => {
el.classList.add("hidden");
});
bp.open({
// IMPORTANT: pass the anchor ELEMENTS, not custom objects
items: links,
el: link,
caption: (el) => el.querySelector('img')?.alt || el.title || '',
maxZoom: 40, // for raster images (PNG/JPG); SVG handled separately
// Fade-out polish + cleanup
onClose(containerEl) {
destroyPanZoom();
teardownRotation();
if (containerEl) containerEl.classList.add('bp-fadeout');
const themeToggle = document.querySelector(".theme-toggle");
if (themeToggle) {
themeToggle.classList.remove("hidden");
}
},
// Called once after open and on every slide change
onOpen(containerEl) { setupRotation(containerEl); enhanceSVG(containerEl); },
onUpdate(containerEl){ setupRotation(containerEl); enhanceSVG(containerEl); }
});
});
});
});
// 4) Simple rotate buttons for raster images
function ensureRotateControls() {
if (rotateControls) return rotateControls;
const wrapper = document.createElement('div');
wrapper.className = 'bp-rotate-controls';
Object.assign(wrapper.style, {
position: 'fixed',
bottom: '1.5rem',
right: '1.5rem',
display: 'flex',
gap: '0.5rem',
zIndex: '9999',
pointerEvents: 'auto'
});
const mkBtn = (label, title) => {
const btn = document.createElement('button');
btn.type = 'button';
btn.textContent = label;
btn.title = title;
btn.setAttribute('aria-label', title);
Object.assign(btn.style, {
padding: '0.4rem 0.6rem',
borderRadius: '999px',
border: 'none',
fontSize: '1.2rem',
cursor: 'pointer',
background: 'rgba(30,30,30,0.8)',
color: '#fff'
});
return btn;
};
const left = mkBtn('⟲', 'Rotate image 90° left');
const right = mkBtn('⟳', 'Rotate image 90° right');
left.addEventListener('click', (e) => {
e.stopPropagation(); // dont close the lightbox
if (!activeContainer) return;
currentRotation = (currentRotation - 90 + 360) % 360;
applyRotation();
});
right.addEventListener('click', (e) => {
e.stopPropagation();
if (!activeContainer) return;
currentRotation = (currentRotation + 90) % 360;
applyRotation();
});
wrapper.append(left, right);
document.body.appendChild(wrapper);
rotateControls = wrapper;
return rotateControls;
}
function ensureRotateWrapper() {
if (!activeContainer) return null;
const imgRoot = activeContainer.querySelector('.bp-img');
if (!imgRoot) return null;
let imgEl = imgRoot.querySelector('img');
if (!imgEl) return null;
const src = (imgEl.currentSrc || imgEl.src || '').toLowerCase();
// We only rotate raster images; SVGs are handled via svg-pan-zoom
if (src.endsWith('.svg')) return null;
let wrapper = imgRoot.querySelector('.bp-rotate-wrapper');
if (!wrapper) {
wrapper = document.createElement('div');
wrapper.className = 'bp-rotate-wrapper';
wrapper.style.display = 'inline-block';
wrapper.style.transformOrigin = 'center center';
imgRoot.appendChild(wrapper);
wrapper.appendChild(imgEl);
} else if (!wrapper.contains(imgEl)) {
// Slide changed and BiggerPicture replaced the <img>
wrapper.innerHTML = '';
wrapper.appendChild(imgEl);
}
return wrapper;
}
function applyRotation() {
const wrapper = ensureRotateWrapper();
if (!wrapper) return;
wrapper.style.transform = `rotate(${currentRotation}deg)`;
}
function setupRotation(containerEl) {
activeContainer = containerEl;
currentRotation = 0;
const controls = ensureRotateControls();
controls.style.display = 'flex';
applyRotation();
}
function teardownRotation() {
activeContainer = null;
currentRotation = 0;
if (rotateControls) {
rotateControls.style.display = 'none';
}
}
// 4) If current slide is an SVG, swap to inline + enable svg-pan-zoom
async function enhanceSVG(containerEl) {
try {
destroyPanZoom();
const imgEl = containerEl.querySelector('.bp-img img');
if (!imgEl) return;
const src = imgEl.currentSrc || imgEl.src || '';
const isSVG = src.toLowerCase().endsWith('.svg');
const htmlLayer = containerEl.querySelector('.bp-html');
if (!isSVG || !htmlLayer) {
// ensure any previous holder is removed and bitmap is visible
const old = htmlLayer?.querySelector('.bp-svg-holder');
if (old) old.remove();
imgEl.style.visibility = '';
return;
}
// Create/clear holder
let holder = htmlLayer.querySelector('.bp-svg-holder');
if (!holder) {
holder = document.createElement('div');
holder.className = 'bp-svg-holder';
holder.style.maxWidth = '95vw';
holder.style.maxHeight = '95vh';
htmlLayer.appendChild(holder);
}
holder.innerHTML = '';
// Hide the bitmap so only the inline SVG shows
imgEl.style.visibility = 'hidden';
// Inline the SVG
const res = await fetch(src, { cache: 'force-cache' });
const text = await res.text();
holder.innerHTML = text;
const svg = holder.querySelector('svg');
if (!svg) { imgEl.style.visibility = ''; return; }
svg.style.maxWidth = '95vw';
svg.style.maxHeight = '95vh';
svg.style.display = 'block';
if (typeof window.svgPanZoom === 'function') {
activePanZoom = svgPanZoom(svg, {
zoomEnabled: true,
controlIconsEnabled: true,
fit: true,
center: true,
minZoom: 0.05,
maxZoom: 400, // effectively "unlimited"
zoomScaleSensitivity: 0.25,
dblClickZoomEnabled: true
});
// Keep wheel inside lightbox
holder.addEventListener('wheel', (e) => e.stopPropagation(), { passive: true });
} else {
console.warn('[gallery-init] svg-pan-zoom not loaded');
}
} catch (err) {
console.error('[gallery-init] SVG enhance failed:', err);
}
}
});

434
assets/scripts/script.js Executable file
View File

@@ -0,0 +1,434 @@
/* =========================================================
BOOTSTRAP
========================================================= */
document.addEventListener("DOMContentLoaded", () => {
initCopyButtons();
initFootnoteSidenotes();
initThemeToggle();
initCountdowns();
initTOCHighlighting();
initStackedNavigation();
restoreStackFromURL();
initClearPanesButton();
initInitialPaneControls();
});
/* =========================================================
COPY BUTTONS (code blocks)
========================================================= */
function initCopyButtons() {
document.querySelectorAll("pre.src").forEach(codeBlock => {
if (codeBlock.querySelector(".copy-btn")) return; // idempotent
const button = document.createElement("button");
button.className = "copy-btn";
button.textContent = "Copy";
codeBlock.appendChild(button);
button.addEventListener("click", async () => {
const text = codeBlock.innerText.replace(button.innerText, "").trim();
try {
await navigator.clipboard.writeText(text);
button.textContent = "Copied!";
setTimeout(() => (button.textContent = "Copy"), 1500);
} catch {
button.textContent = "Failed";
setTimeout(() => (button.textContent = "Copy"), 1500);
}
});
});
}
/* =========================================================
FOOTNOTES → SIDENOTES
========================================================= */
function initFootnoteSidenotes() {
document.querySelectorAll('a.footref[href^="#fn"]').forEach(ref => {
const sup = ref.closest("sup") || ref;
if (sup.nextElementSibling?.classList.contains("footnote-sidenote")) return;
const targetId = ref.getAttribute("href").slice(1);
const anchor = document.getElementById(targetId);
if (!anchor) return;
const footdef = anchor.closest(".footdef") || anchor.parentElement;
if (!footdef) return;
let paras = footdef.querySelectorAll("p.footpara");
if (!paras.length) {
paras = footdef.querySelectorAll(".footpara:not(:has(.footpara))");
}
let parts = [];
if (paras.length) {
const seen = new Set();
parts = [...paras]
.map(p => {
const txt = p.textContent.trim().replace(/\s+/g, " ");
if (seen.has(txt)) return "";
seen.add(txt);
return p.innerHTML.trim();
})
.filter(Boolean);
}
if (!parts.length) {
const clone = footdef.cloneNode(true);
clone
.querySelectorAll("sup.footnum, a[role='doc-backlink']")
.forEach(n => n.remove());
parts = [clone.innerHTML.trim()];
}
const sidenote = document.createElement("span");
sidenote.className = "sidenote footnote-sidenote";
sidenote.dataset.fn = ref.textContent.trim();
sidenote.innerHTML = parts.join(" ");
sup.insertAdjacentElement("afterend", sidenote);
});
}
/* =========================================================
THEME TOGGLE
========================================================= */
function initThemeToggle() {
const root = document.documentElement;
const key = "theme";
const saved = localStorage.getItem(key);
if (saved === "dark" || saved === "light") {
root.setAttribute("data-theme", saved);
}
const btn = document.getElementById("theme-toggle");
if (!btn) return;
btn.addEventListener("click", () => {
const current = root.getAttribute("data-theme");
const next = current === "dark" ? "light" : "dark";
root.setAttribute("data-theme", next);
localStorage.setItem(key, next);
});
}
/* =========================================================
COUNTDOWNS
========================================================= */
function initCountdowns() {
const els = document.querySelectorAll("time.countdown");
if (!els.length) return;
const plural = (n, w) => `${n} ${w}${n === 1 ? "" : "s"}`;
const render = el => {
const raw = el.getAttribute("datetime");
const label = el.dataset.label || "";
const target = new Date(raw);
if (isNaN(target)) {
el.textContent = "—";
return;
}
let diff = target - new Date();
if (diff <= 0) {
el.textContent = `${label ? label + " " : ""}today`;
el.classList.add("expired");
return;
}
const d = Math.floor(diff / 86400000); diff %= 86400000;
const h = Math.floor(diff / 3600000); diff %= 3600000;
const m = Math.floor(diff / 60000); diff %= 60000;
const s = Math.floor(diff / 1000);
const parts = [];
if (d) parts.push(plural(d, "day"));
parts.push(`${h}h ${m}m ${s}s`);
el.textContent = `${label ? label + " in: " : ""}${parts.join(" ")}`;
};
const tick = () => els.forEach(render);
tick();
setInterval(tick, 1000);
}
/* =========================================================
TABLE OF CONTENTS HIGHLIGHTING
========================================================= */
function initTOCHighlighting() {
const toc = document.querySelector("#text-table-of-contents");
if (!toc) return;
const links = [...toc.querySelectorAll('a[href^="#"]')];
if (!links.length) return;
const linkById = new Map();
links.forEach(a => {
const id = decodeURIComponent(a.hash.slice(1));
const el = document.getElementById(id);
if (el) linkById.set(id, a);
});
const headings = [...document.querySelectorAll("h2[id], h3[id], h4[id]")]
.filter(h => linkById.has(h.id));
const setActive = id => {
links.forEach(a => {
const active = a.hash === `#${id}`;
a.classList.toggle("is-active", active);
a.toggleAttribute("aria-current", active);
});
};
const headerOffset =
6.5 * parseFloat(getComputedStyle(document.documentElement).fontSize);
const visible = new Map();
const observer = new IntersectionObserver(entries => {
entries.forEach(entry => {
const id = entry.target.id;
if (entry.isIntersecting) {
visible.set(id, entry.target.getBoundingClientRect().top - headerOffset);
} else {
visible.delete(id);
}
});
if (visible.size) {
const [id] = [...visible.entries()]
.sort((a, b) => Math.abs(a[1]) - Math.abs(b[1]))[0];
setActive(id);
}
}, {
rootMargin: `-${headerOffset}px 0px -70% 0px`,
threshold: [0, 0.01, 0.1]
});
headings.forEach(h => observer.observe(h));
toc.addEventListener("click", e => {
const a = e.target.closest('a[href^="#"]');
if (!a) return;
const id = decodeURIComponent(a.hash.slice(1));
const el = document.getElementById(id);
if (!el) return;
e.preventDefault();
el.scrollIntoView({ behavior: "smooth", block: "start" });
el.setAttribute("tabindex", "-1");
el.focus({ preventScroll: true });
history.pushState(null, "", `#${id}`);
});
}
let fullscreenSnapshot = null;
/* =========================================================
STACKED NAVIGATION (PANES)
========================================================= */
function initStackedNavigation() {
document.addEventListener("click", e => {
const link = e.target.closest("a");
if (!link) return;
const href = link.getAttribute("href");
if (!href || href.startsWith("#")) return;
const url = new URL(href, location.href);
if (url.origin !== location.origin) return;
if (!url.pathname.endsWith(".html")) return;
e.preventDefault();
pushPane(url.pathname + url.hash);
});
}
async function pushPane(urlWithHash) {
const track = document.querySelector(".stack-track");
if (!track) return;
const existing = [...track.children].find(p => p.dataset.url === urlWithHash);
if (existing) {
existing.scrollIntoView({ behavior: "smooth", inline: "end" });
return;
}
const [url, hash] = urlWithHash.split("#");
const res = await fetch(url);
const doc = new DOMParser().parseFromString(await res.text(), "text/html");
const content = doc.querySelector("#content");
if (!content) return;
const pane = document.createElement("article");
pane.className = "stack-pane";
pane.dataset.url = urlWithHash;
pane.appendChild(content);
track.appendChild(pane);
pane.scrollIntoView({ behavior: "smooth", inline: "end" });
if (hash) {
requestAnimationFrame(() => {
pane.querySelector(`#${CSS.escape(hash)}`)
?.scrollIntoView({ behavior: "smooth", block: "start" });
});
}
// Find the title-section and attach event listeners to the controls
const titleSection = pane.querySelector(".title-section");
if (titleSection) {
const closeBtn = titleSection.querySelector(".pane-close");
const fullscreenBtn = titleSection.querySelector(".pane-fullscreen");
if (closeBtn) {
closeBtn.addEventListener("click", () => {
if (document.body.classList.contains("pane-fullscreen")) {
exitFullscreen({ removePane: pane });
return;
}
pane.remove();
updateURL();
});
}
if (fullscreenBtn) {
fullscreenBtn.addEventListener("click", () => {
if (pane.classList.contains("is-fullscreen")) {
exitFullscreen();
} else {
enterFullscreen(pane);
}
});
}
}
updateURL();
}
function initInitialPaneControls() {
// Initialize controls for the initial pane (pane-root) that's already in the HTML
const initialPane = document.querySelector(".pane-root");
if (!initialPane) return;
const titleSection = initialPane.querySelector(".title-section");
if (!titleSection) return;
const closeBtn = titleSection.querySelector(".pane-close");
const fullscreenBtn = titleSection.querySelector(".pane-fullscreen");
if (closeBtn) {
closeBtn.addEventListener("click", () => {
if (document.body.classList.contains("pane-fullscreen")) {
exitFullscreen({ removePane: initialPane });
return;
}
initialPane.remove();
updateURL();
});
}
if (fullscreenBtn) {
fullscreenBtn.addEventListener("click", () => {
if (initialPane.classList.contains("is-fullscreen")) {
exitFullscreen();
} else {
enterFullscreen(initialPane);
}
});
}
}
document.addEventListener("keydown", e => {
if (e.key === "Escape" && document.body.classList.contains("pane-fullscreen")) {
exitFullscreen();
}
});
function enterFullscreen(pane) {
if (!fullscreenSnapshot) {
fullscreenSnapshot = [...document.querySelectorAll(".stack-pane")]
.map(p => p.dataset.url);
}
document.querySelectorAll(".stack-pane").forEach(p => {
if (p !== pane) p.remove();
});
document.body.classList.add("pane-fullscreen");
pane.classList.add("is-fullscreen");
updateURL();
}
async function exitFullscreen({ removePane } = {}) {
if (!fullscreenSnapshot) return;
const removeUrl = removePane?.dataset.url;
document.body.classList.remove("pane-fullscreen");
document
.querySelectorAll(".stack-pane.is-fullscreen")
.forEach(p => p.remove());
// Restore stack EXCEPT the removed pane
for (const url of fullscreenSnapshot) {
if (url === removeUrl) continue;
await pushPane(url);
}
fullscreenSnapshot = null;
updateURL();
}
function clearAllPanes() {
const panes = [...document.querySelectorAll(".stack-pane")];
panes.slice(1).forEach(pane => pane.remove());
updateURL();
}
function updateURL() {
const urls = [...document.querySelectorAll(".stack-pane")]
.map(p => p.dataset.url);
const params = new URLSearchParams(location.search);
params.set("stackedNotes", urls.join("|"));
history.replaceState({}, "", "?" + params.toString());
}
async function restoreStackFromURL() {
const params = new URLSearchParams(location.search);
const stack = params.get("stackedNotes");
if (!stack) return;
for (const url of stack.split("|").slice(1)) {
await pushPane(url);
}
}
function initClearPanesButton() {
const btn = document.getElementById("close-all");
if (!btn) return;
btn.addEventListener("click", () => {
clearAllPanes();
});
}

335
assets/scripts/script.js~ Executable file
View File

@@ -0,0 +1,335 @@
/* Event listener function for the COPY BUTTON */
document.addEventListener("DOMContentLoaded", function () {
document.querySelectorAll("pre.src").forEach(function (codeBlock) {
const button = document.createElement("button");
button.innerText = "Copy";
button.className = "copy-btn";
// Append button inside <pre>
codeBlock.appendChild(button);
button.addEventListener("click", function () {
const text = codeBlock.innerText.replace(button.innerText, ""); // exclude button text
navigator.clipboard.writeText(text.trim()).then(() => {
button.innerText = "Copied!";
setTimeout(() => (button.innerText = "Copy"), 1500);
});
});
});
});
/* Event listener for footnotes and sidenotes*/
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll('a.footref[href^="#fn"]').forEach(ref => {
const sup = ref.closest("sup") || ref;
// idempotent: don't insert twice
if (sup.nextElementSibling && sup.nextElementSibling.classList?.contains("footnote-sidenote")) return;
const targetId = ref.getAttribute("href").replace(/^#/, ""); // works for fn.2 or fn2
const anchor = document.getElementById(targetId);
if (!anchor) return;
const footdef = anchor.closest(".footdef") || anchor.parentElement;
if (!footdef) return;
// 1) Prefer leaf paragraphs to avoid div+p duplication
let paras = footdef.querySelectorAll("p.footpara");
if (!paras.length) {
// fallback: any .footpara elements that don't contain another .footpara
paras = footdef.querySelectorAll(".footpara:not(:has(.footpara))");
}
// 2) Build HTML, de-duplicating by text content
let parts = [];
if (paras.length) {
const seen = new Set();
parts = Array.from(paras).map(p => {
const txt = p.textContent.trim().replace(/\s+/g, " ");
if (seen.has(txt)) return "";
seen.add(txt);
return p.innerHTML.trim();
}).filter(Boolean);
}
// 3) Fallback: clean full block if no paras found
if (!parts.length) {
const clone = footdef.cloneNode(true);
clone.querySelectorAll("sup.footnum, a[role='doc-backlink']").forEach(n => n.remove());
parts = [clone.innerHTML.trim()];
}
// 4) Insert the sidenote
const sn = document.createElement("span");
sn.className = "sidenote footnote-sidenote";
sn.setAttribute("data-fn", (ref.textContent || "").trim());
sn.innerHTML = parts.join(" ");
sup.insertAdjacentElement("afterend", sn);
});
});
/* Function for setting the theme */
(function(){
const root = document.documentElement;
const storageKey = "theme";
const saved = localStorage.getItem(storageKey);
if (saved === "dark" || saved === "light") {
root.setAttribute("data-theme", saved);
}
const btn = document.getElementById("theme-toggle");
if (!btn) return;
btn.addEventListener("click", () => {
const current = root.getAttribute("data-theme");
const next = current === "dark" ? "light" : "dark";
// If no current (auto), assume were toggling to dark first
const target = current ? next : "dark";
root.setAttribute("data-theme", target);
localStorage.setItem(storageKey, target);
});
})();
// Simple, timezone-safe if you pass UTC (…Z) in the datetime
document.addEventListener('DOMContentLoaded', () => {
const els = document.querySelectorAll('time.countdown');
if (!els.length) return;
const plural = (n, w) => `${n} ${w}${n === 1 ? '' : 's'}`;
const render = (el) => {
const raw = el.getAttribute('datetime');
const label = el.dataset.label || '';
const target = new Date(raw); // Prefer ISO like 2025-12-31T00:00:00Z
if (isNaN(target)) { el.textContent = '—'; return; }
const now = new Date();
let diff = target - now;
if (diff <= 0) {
el.textContent = `${label ? label + ' ' : ''}today`;
el.classList.add('expired');
return;
}
const d = Math.floor(diff / 86400000); diff -= d * 86400000;
const h = Math.floor(diff / 3600000); diff -= h * 3600000;
const m = Math.floor(diff / 60000); diff -= m * 60000;
const s = Math.floor(diff / 1000);
const pieces = [];
if (d) pieces.push(plural(d, 'day'));
pieces.push(`${h}h ${m}m ${s}s`);
el.textContent = `${label ? label + ' in : ' : ''}${pieces.join(' ')}`;
};
const tick = () => els.forEach(render);
tick();
setInterval(tick, 1000); // update every second
});
/* Event listener for scrolling and changing the active label on the TOC */
document.addEventListener("DOMContentLoaded", () => {
const toc = document.querySelector("#text-table-of-contents");
if (!toc) { console.warn("No #text-table-of-contents found"); return; }
const links = toc.querySelectorAll('a[href^="#"]'); // '^=' is a starts with operator.
// <a href="#introduction">Intro</a> matches
if (!links.length) { console.warn("No ToC links found"); return; }
// Map: id -> link
const linkById = new Map();
links.forEach(a => {
const id = decodeURIComponent(a.getAttribute("href").slice(1));
const el = document.getElementById(id);
if (el) linkById.set(id, a);
});
if (!linkById.size) { console.warn("No matching headings with IDs"); return; }
// Headings to observe (h2h4 usually)
const headings = [...document.querySelectorAll("h2[id], h3[id], h4[id]")]
.filter(h => linkById.has(h.id));
// Helper to mark active
const setActive = (id) => {
links.forEach(a => {
const active = a.getAttribute("href") === `#${id}`;
a.classList.toggle("is-active", active);
if (active) a.setAttribute("aria-current", "true");
else a.removeAttribute("aria-current");
});
};
// Calculate sticky header offset in px
const headerOffsetPx = 6.5 * parseFloat(getComputedStyle(document.documentElement).fontSize);
// Track visible headings (id -> distance from top)
const visible = new Map();
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
const id = entry.target.id;
if (entry.isIntersecting) {
// How far from the top (after header offset)
const dist = entry.target.getBoundingClientRect().top - headerOffsetPx;
visible.set(id, dist);
} else {
visible.delete(id);
}
});
if (visible.size) {
// Choose the heading closest to the top (>= -headerOffset)
const topMost = [...visible.entries()]
.sort((a,b) => Math.abs(a[1]) - Math.abs(b[1]))[0][0];
setActive(topMost);
// console.log("Active:", topMost, visible);
}
}, {
root: null, // track relative to viewport
rootMargin: `-${headerOffsetPx}px 0px -70% 0px`,
threshold: [0, 0.01, 0.1] // fire as soon as it enters
});
headings.forEach(h => observer.observe(h));
// Initial highlight (in case load midpage)
let bestId = null, bestDist = Infinity;
headings.forEach(h => {
const top = h.getBoundingClientRect().top - headerOffsetPx;
const dist = top < 0 ? Math.abs(top) : top + 1e6;
if (dist < bestDist) { bestDist = dist; bestId = h.id; }
});
if (bestId) setActive(bestId);
// smooth-scroll ToC clicks
toc.addEventListener("click", (e) => {
const a = e.target.closest('a[href^="#"]');
if (!a) return;
const id = decodeURIComponent(a.hash.slice(1));
const el = document.getElementById(id);
if (!el) return;
e.preventDefault();
el.scrollIntoView({ behavior: "smooth", block: "start" });
el.setAttribute("tabindex", "-1");
el.focus({ preventScroll: true });
history.pushState(null, "", `#${id}`);
});
});
document.addEventListener("click", (e) => {
const link = e.target.closest("a");
if (!link) return;
const href = link.getAttribute("href");
if (!href) return;
// Ignore pure fragment links (#foo)
if (href.startsWith("#")) return;
// Resolve relative → absolute
const url = new URL(href, window.location.href);
// Only intercept same-origin HTML pages
if (url.origin !== window.location.origin) return;
if (!url.pathname.endsWith(".html")) return;
e.preventDefault();
pushPane(url.pathname + url.hash);
});
async function pushPane(urlWithHash) {
const [url, hash] = urlWithHash.split("#");
const track = document.querySelector(".stack-track");
const existing = [...track.children].find(p => p.dataset.url === urlWithHash);
if (existing) {
existing.scrollIntoView({ behavior: "smooth", inline: "end" });
return;
}
const res = await fetch(url);
const html = await res.text();
const doc = new DOMParser().parseFromString(html, "text/html");
const content = doc.querySelector("#content");
if (!content) return;
const pane = document.createElement("article");
pane.className = "stack-pane";
pane.dataset.url = urlWithHash;
pane.innerHTML = `
<div class="pane-header">
<button class="pane-close" aria-label="Close pane">×</button>
</div>
`;
pane.appendChild(content);
track.appendChild(pane);
pane.scrollIntoView({ behavior: "smooth", inline: "end" });
// Scroll to the anchor if present
if (hash) {
requestAnimationFrame(() => {
const target = pane.querySelector(`#${CSS.escape(hash)}`);
target?.scrollIntoView({ behavior: "smooth", block: "start" });
});
}
pane.querySelector(".pane-close").addEventListener("click", () => {
pane.remove();
updateURL();
});
updateURL();
}
function updateURL() {
const panes = [...document.querySelectorAll(".stack-pane")];
const urls = panes.map(p => p.dataset.url);
const params = new URLSearchParams(window.location.search);
params.set("stackedNotes", urls.join("|"));
history.replaceState({}, "", "?" + params.toString());
}
window.addEventListener("DOMContentLoaded", async () => {
const params = new URLSearchParams(window.location.search);
const stack = params.get("stackedNotes");
if (!stack) return;
const urls = stack.split("|");
// First pane is already rendered by Org
const base = urls[0];
const current = window.location.pathname + window.location.hash;
// Only continue if URL matches base
if (base !== current && !base.startsWith(window.location.pathname)) {
console.warn("Stack base mismatch:", base, current);
return;
}
// Load remaining panes sequentially
for (const url of urls.slice(1)) {
await pushPane(url);
}
// Scroll to last pane
const panes = document.querySelectorAll(".stack-pane");
panes[panes.length - 1]?.scrollIntoView({
behavior: "auto",
inline: "end"
});
});

180
assets/scripts/search.js Executable file
View File

@@ -0,0 +1,180 @@
/* =========================================================
STATE
========================================================= */
let index = [];
let activeIndex = -1;
const box = document.getElementById("search-box");
const results = document.getElementById("search-results");
/* =========================================================
LOAD SEARCH INDEX
========================================================= */
fetch("/search-index.json")
.then(r => r.json())
.then(data => {
index = Array.isArray(data) ? data : [];
})
.catch(err => {
console.error("Failed to load search index:", err);
});
/* =========================================================
RENDER RESULTS
========================================================= */
function renderResults(items) {
clearResults();
items.forEach((entry, i) => {
const row = document.createElement("div");
row.dataset.index = i;
const link = document.createElement("a");
link.href = entry.url;
link.textContent = entry.title;
link.addEventListener("click", ev => {
ev.preventDefault();
ev.stopPropagation();
clearSearch();
pushPane(entry.url);
});
row.appendChild(link);
row.addEventListener("mouseenter", () => setActive(i));
row.addEventListener("mouseleave", clearActive);
results.appendChild(row);
});
}
/* =========================================================
ACTIVE ITEM HANDLING
========================================================= */
function setActive(i) {
const items = [...results.children];
items.forEach(el => el.classList.remove("active"));
if (items[i]) {
items[i].classList.add("active");
activeIndex = i;
}
}
function clearActive() {
[...results.children].forEach(el => el.classList.remove("active"));
activeIndex = -1;
}
/* =========================================================
INPUT HANDLER
========================================================= */
box.addEventListener("input", () => {
const query = box.value.trim().toLowerCase();
clearResults();
if (query.length < 2) return;
const matches = index
.map(entry => ({
...entry,
score: fuzzyScore(query, entry.title)
}))
.filter(entry => entry.score > 0)
.sort((a, b) => b.score - a.score)
.slice(0, 20); // optional cap
renderResults(matches);
});
/* =========================================================
KEYBOARD NAVIGATION
========================================================= */
box.addEventListener("keydown", e => {
const items = [...results.children];
if (!items.length) return;
switch (e.key) {
case "ArrowDown":
e.preventDefault();
setActive((activeIndex + 1) % items.length);
break;
case "ArrowUp":
e.preventDefault();
setActive((activeIndex - 1 + items.length) % items.length);
break;
case "Enter":
if (activeIndex < 0) return;
e.preventDefault();
e.stopPropagation();
const link = items[activeIndex].querySelector("a");
if (link) {
clearSearch();
pushPane(link.getAttribute("href"));
}
break;
case "Escape":
clearSearch();
break;
}
});
/* =========================================================
CLICK OUTSIDE TO CLOSE
========================================================= */
document.addEventListener("click", e => {
if (!e.target.closest(".banner-search")) {
clearSearch();
}
});
/* =========================================================
HELPERS
========================================================= */
function clearResults() {
results.innerHTML = "";
}
function clearSearch() {
clearResults();
activeIndex = -1;
}
function fuzzyScore(query, text) {
query = query.toLowerCase();
text = text.toLowerCase();
let score = 0;
let qi = 0;
let consecutive = 0;
for (let ti = 0; ti < text.length && qi < query.length; ti++) {
if (text[ti] === query[qi]) {
qi++;
consecutive++;
score += 5 + consecutive * 2; // reward runs
} else {
consecutive = 0;
}
}
if (qi !== query.length) return 0;
score += Math.max(0, 20 - text.length);
return score;
}

34
assets/scripts/search.js~ Executable file
View File

@@ -0,0 +1,34 @@
let index = [];
fetch("/search-index.json")
.then(r => r.json())
.then(data => index = data);
const box = document.getElementById("search-box");
const results = document.getElementById("search-results");
document.addEventListener("click", (e) => {
const searchBox = document.getElementById("search-box");
const results = document.getElementById("search-results");
});
box.addEventListener("input", () => {
const q = box.value.toLowerCase();
results.innerHTML = "";
if (q.length < 2) return;
index
.filter(e =>
e.title.toLowerCase().includes(q)
)
//.slice(0, 10)
.forEach(e => {
const div = document.createElement("div");
div.innerHTML = `<a href="${e.url}">${e.title}</a>`;
results.appendChild(div);
});
});

27
assets/scripts/svg-pan-zoom.min.js vendored Executable file

File diff suppressed because one or more lines are too long

8
assets/styles/bigger-picture.min.css vendored Executable file
View File

@@ -0,0 +1,8 @@
/**
* Minified by jsDelivr using clean-css v5.3.2.
* Original file: /npm/bigger-picture@1.1.19/dist/bigger-picture.css
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
@keyframes bp-fadein{from{opacity:.01}to{opacity:1}}@keyframes bp-bar{from{transform:translateX(-100%)}to{transform:translateX(0)}}@keyframes bp-o{from{transform:rotate(0)}to{transform:rotate(360deg)}}.bp-wrap{top:0;left:0;width:100%;height:100%;position:fixed;z-index:999;contain:strict;touch-action:none;-webkit-tap-highlight-color:transparent}.bp-wrap>div:first-child{position:absolute;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.75);animation:bp-fadein .48s cubic-bezier(.215,.61,.355,1)}.bp-vid audio{position:absolute;left:14px;width:calc(100% - 28px);bottom:14px;height:50px}.bp-inner{top:0;left:0;width:100%;height:100%;position:absolute;display:flex}.bp-html{display:contents}.bp-html>:first-child{margin:auto}.bp-img-wrap{top:0;left:0;width:100%;height:100%;position:absolute;contain:strict}.bp-img-wrap .bp-canzoom{cursor:zoom-in}.bp-img-wrap .bp-drag{cursor:grabbing}.bp-close{contain:layout size}.bp-img{position:absolute;top:50%;left:50%;user-select:none;background-size:100% 100%}.bp-img div,.bp-img img{position:absolute;top:0;left:0;width:100%;height:100%}.bp-img .bp-o{display:none}.bp-zoomed .bp-img:not(.bp-drag){cursor:grab}.bp-zoomed .bp-cap{opacity:0;animation:none!important}.bp-zoomed.bp-small .bp-controls{opacity:0}.bp-zoomed.bp-small .bp-controls button{pointer-events:none}.bp-controls{position:absolute;top:0;left:0;width:100%;height:100%;pointer-events:none;text-align:left;transition:opacity .3s;animation:bp-fadein .3s}.bp-controls button{pointer-events:auto;cursor:pointer;position:absolute;border:0;background:rgba(0,0,0,.15);opacity:.9;transition:all .1s;contain:content}.bp-controls button:hover{background-color:rgba(0,0,0,.2);opacity:1}.bp-controls svg{fill:#fff}.bp-count{position:absolute;color:rgba(255,255,255,.9);line-height:1;margin:16px;height:50px;width:100px}.bp-next,.bp-prev{top:50%;right:0;margin-top:-32px;height:64px;width:58px;border-radius:3px 0 0 3px}.bp-next:hover:before,.bp-prev:hover:before{transform:translateX(-2px)}.bp-next:before,.bp-prev:before{content:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'%3E%3Cpath d='M8.59 16.34l4.58-4.59-4.58-4.59L10 5.75l6 6-6 6z'/%3E%3C/svg%3E");position:absolute;left:7px;top:9px;width:46px;transition:all .2s}.bp-prev{right:auto;left:0;transform:scalex(-1)}.bp-x{top:0;right:0;height:55px;width:58px;border-radius:0 0 0 3px}.bp-x:before{content:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 32 32' fill='%23fff'%3E%3Cpath d='M24 10l-2-2-6 6-6-6-2 2 6 6-6 6 2 2 6-6 6 6 2-2-6-6z'/%3E%3C/svg%3E");position:absolute;width:37px;top:8px;right:10px}.bp-if,.bp-vid{position:relative;margin:auto;background:#000;background-size:100% 100%}.bp-if div,.bp-if iframe,.bp-if video,.bp-vid div,.bp-vid iframe,.bp-vid video{top:0;left:0;width:100%;height:100%;position:absolute;border:0}.bp-load{display:flex;background-size:100% 100%;overflow:hidden;z-index:1}.bp-bar{position:absolute;top:0;left:0;height:3px;width:100%;transform:translateX(-100%);background:rgba(255,255,255,.9);border-radius:0 3px 3px 0;animation:bp-bar 4s both}.bp-o,.bp-o:after{border-radius:50%;width:90px;height:90px}.bp-o{margin:auto;border:10px solid rgba(255,255,255,.2);border-left-color:rgba(255,255,255,.9);animation:bp-o 1s infinite linear}.bp-cap{position:absolute;bottom:2%;background:rgba(9,9,9,.8);color:rgba(255,255,255,.9);border-radius:4px;max-width:95%;line-height:1.3;padding:.6em 1.2em;left:50%;transform:translateX(-50%);width:fit-content;width:-moz-fit-content;display:table;transition:opacity .3s;animation:bp-fadein .2s}.bp-cap a{color:inherit}.bp-inline{position:absolute}.bp-lock{overflow-y:hidden}.bp-lock body{overflow:scroll}.bp-noclose .bp-x{display:none}.bp-noclose:not(.bp-zoomed){touch-action:pan-y}.bp-noclose:not(.bp-zoomed) .bp-img-wrap{cursor:zoom-in}@media (prefers-reduced-motion){.bp-wrap *{animation-duration:0s!important}}@media (max-width:500px){.bp-x{height:47px;width:47px}.bp-x:before{width:34px;top:6px;right:6px}.bp-next,.bp-prev{margin-top:-27px;height:54px;width:45px}.bp-next:before,.bp-prev:before{top:7px;left:2px;width:43px}.bp-o,.bp-o:after{border-width:6px;width:60px;height:60px}.bp-count{margin:12px 10px}}
/*# sourceMappingURL=/sm/15e96278e1e731ce40eef8d6284cefc81b81dda67c3a0aa386ec893f183bd57f.map */

78
assets/styles/media.css Executable file
View File

@@ -0,0 +1,78 @@
@media (max-width: 600px){
.banner-header{ flex-direction: column; align-items: center; text-align: center; }
.banner-left{ margin: 0 0 .5rem 0; }
.banner-logo{ margin: 0; }
nav{ flex-wrap: wrap; justify-content: center; gap: .5rem; font-size: 1rem; }
.theme-toggle {
position: static;
order: 2;
margin-left: .5rem;
padding: .3rem .6rem;
background: transparent;
}
.banner-header {
flex-wrap: wrap;
justify-content: center;
}
.banner-header nav {
display: flex;
align-items: center;
flex-wrap: wrap;
}
body.no-sidenotes {
margin-left: 1em;
margin-right: 1em;
}
#mobile-move-panel {
display: block;
}
}
@media (max-width: 1250px){
#preamble.status{
padding-right: var(--body-pad);
}
#content.content{
padding-right: var(--body-pad);
}
.sidenote,
.marginnote{
float: none;
clear: both;
width: auto;
display: block;
margin: 0.5rem 0 0.75rem;
padding-left: 0.75rem;
border-left: 3px dotted color-mix(in oklab, var(--fg) 8%, transparent);
margin-right: 0;
}
.fullwidth{
max-width: calc(100vw - 2 * var(--body-pad));
}
.sidenote, .marginnote{
border-left: 3px dotted color-mix(in oklab, var(--fg) 12%, transparent);
}
.sidenote .mn-img,
.marginnote .mn-img{
border-color: color-mix(in oklab, var(--fg) 12%, transparent);
}
#table-of-contents{
float: none;
position: static;
width: auto;
margin: 0 0 1rem;
padding: .5rem .75rem;
border-right: 0;
border-left: 3px dotted color-mix(in oklab, var(--fg) 12%, transparent);
background: color-mix(in oklab, var(--bg) 96%, var(--fg) 4%);
border-radius: 4px;
}
}

106
assets/styles/media.css~ Executable file
View File

@@ -0,0 +1,106 @@
@media (max-width: 600px){
.banner-header{ flex-direction: column; align-items: center; text-align: center; }
.banner-logo{ margin: 0 0 .5rem 0; }
nav{ flex-wrap: wrap; justify-content: center; gap: .5rem; font-size: 1rem; }
.theme-toggle {
position: static;
order: 2;
margin-left: .5rem;
padding: .3rem .6rem;
background: transparent;
}
.banner-header {
flex-wrap: wrap;
justify-content: center;
}
.banner-header nav {
display: flex;
align-items: center;
flex-wrap: wrap;
}
body.no-sidenotes {
margin-left: 1em;
margin-right: 1em;
}
#mobile-move-panel {
display: block;
}
}
@media (prefers-color-scheme: dark){
:root:not([data-theme="light"]){
--bg: #0f1115;
--fg: #e6e6e6;
--link: #8ab4ff;
--heading: #9ecbff;
--code-bg: #1a1d24;
--note-color: #c2c7cf;
--note-bg: transparent;
--border: #2a2f3a;
--chip-bg: #1f2330;
--chip-fg: #cfd3da;
--muted: #a9b0bb;
}
.countdown-wrap {
color: var(--fg, #ddd);
}
time.countdown {
color: var(--accent, #7abfff);
background: color-mix(in srgb, var(--accent, #7abfff) 15%, transparent);
box-shadow: 0 0 6px rgba(255,255,255,0.05);
}
time.countdown.expired {
color: #777;
}
}
@media (max-width: 1250px){
#preamble.status{
padding-right: var(--body-pad);
}
#content.content{
padding-right: var(--body-pad);
}
.sidenote,
.marginnote{
float: none;
clear: both;
width: auto;
display: block;
margin: 0.5rem 0 0.75rem;
padding-left: 0.75rem;
border-left: 3px solid rgba(0,0,0,.08);
margin-right: 0;
}
.fullwidth{
max-width: calc(100vw - 2 * var(--body-pad));
}
.sidenote, .marginnote{
border-left: 3px solid color-mix(in oklab, var(--fg) 12%, transparent);
}
.sidenote .mn-img,
.marginnote .mn-img{
border-color: color-mix(in oklab, var(--fg) 12%, transparent);
}
#table-of-contents{
float: none;
position: static;
width: auto;
margin: 0 0 1rem;
padding: .5rem .75rem;
border-right: 0;
border-left: 3px solid color-mix(in oklab, var(--fg) 12%, transparent);
background: color-mix(in oklab, var(--bg) 96%, var(--fg) 4%);
border-radius: 4px;
}
}

2459
assets/styles/org.css Executable file

File diff suppressed because it is too large Load Diff

2462
assets/styles/org.css~ Executable file

File diff suppressed because it is too large Load Diff

716
assets/styles/style.css Executable file
View File

@@ -0,0 +1,716 @@
/* =========================================================
TOKENS / CUSTOM PROPERTIES
========================================================= */
:root {
--gutter: 2rem;
--margin: 420px;
--body-pad: 1rem;
--content-min: 60ch;
--content-max: 880px;
--content: clamp(
var(--content-min),
calc(100vi - (2 * var(--body-pad)) - (2 * (var(--margin) + var(--gutter)))),
var(--content-max)
);
--bleed: 48px;
--fullwidth-cap: 860px;
--bg: #333;
--page-bg: #444;
--fg: #f3f3f3;
--heading: #f9f9f9;
--link: lightblue;
--link-2: var(--link);
--code-bg: #f0f0f0;
--border: #d7d7d7;
--active-toc: #cacaca;
--muted: #666;
--note-color: #555;
--note-bg: transparent;
--chip-bg: #f0f0f0;
--chip-fg: #444;
/* Compatibility aliases (you reference these later) */
--border-color: var(--border);
--text-color: var(--fg);
--muted-text: var(--muted);
--link-color: var(--link);
--link-hover-color: var(--fg);
--bg-alt: #2a2a2a;
}
/* =========================================================
BASE / TYPOGRAPHY
========================================================= */
html,
body {
margin: 0;
background-color: var(--page-bg);
color: var(--fg);
transition: background-color 0.3s, color 0.3s;
font-family: Inter, sans-serif;
}
/* Keep your layout intent (column app shell) */
body {
display: flex;
flex-direction: column;
}
h1,
h2,
h3 {
color: var(--heading);
}
a {
color: var(--link-2);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* =========================================================
PREAMBLE / HEADER
========================================================= */
#preamble {
top: 0;
z-index: 20;
background: var(--bg);
border-bottom: 1px dotted var(--border);
}
#preamble .banner-header,
#preamble #updated {
max-width: 100%;
}
.banner-header {
position: relative; /* anchor for Close All */
display: flex;
justify-content: flex-start; /* align to left */
align-items: center;
gap: 1rem;
padding: 0.5rem 1rem;
}
.banner-left {
display: flex;
flex-direction: column;
align-items: center;
gap: 0.5rem;
}
.banner-logo {
height: 80px;
width: auto;
border-radius: 50%;
}
nav {
display: flex;
gap: 1rem;
font-weight: 600;
font-size: 1.1rem;
}
#updated {
font-size: 0.75rem;
color: color-mix(in oklab, var(--muted) 30%, var(--fg) 70%);
white-space: nowrap;
text-align: center;
}
#close-all {
position: absolute;
right: 1rem;
top: 50%;
transform: translateY(-50%);
background: transparent;
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.25rem 0.5rem; /* smaller so it doesn't dominate */
font-size: 0.8rem;
color: color-mix(in oklab, var(--muted) 40%, var(--fg) 60%);
cursor: pointer;
}
#close-all:hover {
color: var(--fg);
border-color: var(--fg);
}
.banner-header > a {
display: flex;
align-items: center;
}
@media (max-width: 768px) {
.banner-header {
flex-direction: column;
gap: 0.75rem;
text-align: center;
align-items: center;
}
.banner-left {
margin: 0 auto;
}
.banner-logo {
margin: 0;
}
#close-all {
position: static;
transform: none;
}
}
/* =========================================================
CONTENT WRAPPER
========================================================= */
#content.content {
max-width: var(--content);
margin-left: auto !important;
margin-right: auto !important;
padding-left: var(--body-pad);
padding-right: var(--body-pad);
box-sizing: content-box;
position: relative;
}
/* =========================================================
TITLE SECTION
========================================================= */
.title-section {
border: 1px solid var(--border);
border-radius: 6px;
padding: 1.5rem;
padding-right: 8rem; /* Extra padding on right for controls */
margin-bottom: 2rem;
background-color: color-mix(in oklab, var(--bg) 96%, var(--fg) 4%);
position: relative; /* For absolute positioning of controls */
}
.title-section .title {
margin: 0 0 1rem 0;
padding-bottom: 1rem;
border-bottom: 1px dotted var(--border);
}
.title-metadata {
display: flex;
flex-wrap: wrap;
gap: 1.5rem;
font-size: 0.9rem;
}
.metadata-item {
display: flex;
align-items: baseline;
gap: 0.5rem;
}
.metadata-label {
color: var(--muted);
font-style: italic;
font-weight: 500;
}
.metadata-value {
color: var(--fg);
font-weight: 400;
}
#content .figure,
#content img:not(.fullwidth) {
max-width: 100%;
height: auto;
}
/* =========================================================
STACKED PANE LAYOUT
========================================================= */
#stack-root {
position: relative;
width: 100vw;
height: calc(100vh - 120px);
overflow-x: auto;
overflow-y: hidden;
flex: 1 1 auto;
scroll-snap-type: x proximity;
}
.stack-track {
display: flex;
flex-direction: row;
align-items: stretch;
width: max-content;
height: 100%;
}
.stack-pane {
flex: 0 0 auto;
width: clamp(420px, 33vw, 860px);
max-width: 100vw;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
position: relative; /* needed for ::after positioning */
background-color: var(--bg);
border-right: 1px dotted var(--border);
}
.stack-pane::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 12px;
height: 100%;
pointer-events: none;
opacity: 0.15;
}
.stack-pane:last-child {
box-shadow: -4px 0 16px color-mix(in oklab, var(--fg) 6%, transparent);
}
/* Scrollbar (WebKit) */
.stack-pane::-webkit-scrollbar {
width: 8px;
}
.stack-pane::-webkit-scrollbar-thumb {
background-color: color-mix(in oklab, var(--fg) 25%, transparent);
border-radius: 4px;
}
/* =========================================================
PANE HEADER + CLOSE BUTTON
========================================================= */
.pane-root {
background-color: var(--bg);
}
.pane-header {
display: none; /* Hide the old pane-header */
}
/* Title section controls */
.title-controls {
position: absolute;
top: 1.5rem;
right: 1.5rem;
display: flex;
gap: 0.5rem;
z-index: 10;
}
.title-controls button {
background: none;
border: 1px solid var(--border);
border-radius: 4px;
font-size: 0.9rem;
line-height: 1;
cursor: pointer;
color: var(--muted);
padding: 0.3rem 0.6rem;
transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}
.title-controls button:hover {
color: var(--fg);
border-color: var(--fg);
background-color: color-mix(in oklab, var(--bg) 90%, var(--fg) 10%);
}
.pane-close {
font-size: 1.2rem;
}
.pane-fullscreen,
.pane-edit {
font-weight: 500;
}
/* =========================================================
FOOTER
========================================================= */
footer {
color: var(--fg);
padding: 1rem;
border-radius: 6px;
text-align: center;
font-size: 0.9rem;
font-style: italic;
flex-shrink: 0;
margin-top: 0;
border-top: 1px dotted var(--border);
background: var(--bg);
/* If you want it sticky later, use:
position: sticky;
bottom: 0;
*/
bottom: 0;
z-index: 10;
}
/* =========================================================
LISTS
========================================================= */
ul,
ol {
margin: 1rem 0 1.5rem 1.5rem;
padding: 0;
line-height: 1.5;
}
ul {
list-style: none;
}
ul li {
position: relative;
padding-left: 1.2em;
}
ul li::before {
content: "•";
position: absolute;
left: 0;
top: 0;
color: var(--heading);
font-weight: bold;
}
ol {
counter-reset: list-counter;
list-style: none;
}
ol li {
counter-increment: list-counter;
position: relative;
padding-left: 1.8em;
}
ol li::before {
content: counter(list-counter) ".";
position: absolute;
left: 0;
top: 0;
color: var(--heading);
font-weight: bold;
}
li {
margin-bottom: 8px;
display: flow-root;
}
li::after {
content: none;
}
li ul,
li ol {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
li ul li::before {
content: "";
font-weight: normal;
color: var(--note-color);
}
li ol li::before {
font-weight: normal;
color: var(--note-color);
}
/* =========================================================
EPIGRAPH
========================================================= */
.epigraph {
margin: 2rem auto;
max-width: 80%;
font-style: italic;
}
.epigraph blockquote {
margin: 0;
padding: 1rem 1.5rem;
border-left: 4px dotted var(--heading);
background-color: color-mix(in oklab, var(--bg) 94%, var(--fg) 6%);
color: var(--fg);
line-height: 1.6;
}
.epigraph blockquote footer {
margin-top: 0.75rem;
font-style: normal;
font-size: 0.9em;
color: var(--muted);
text-align: right;
}
.epigraph blockquote cite {
font-style: italic;
font-weight: 500;
color: var(--link);
}
.epigraph blockquote::before,
.epigraph blockquote::after {
content: none;
}
/* =========================================================
UTILITIES / MISC
========================================================= */
.hidden {
display: none !important;
}
/* bigger-picture.js controls */
.bp-x {
right: 72px;
}
.bp-next,
.bp-prev {
right: 8px;
}
.bp-prev {
left: 8px;
}
.bp-wrap {
transition: opacity 0.18s ease;
}
.bp-wrap.bp-fadeout {
opacity: 0;
}
.bp-controls {
padding-top: env(safe-area-inset-top, 0);
padding-right: calc(env(safe-area-inset-right, 0) + 8px);
}
/* code copy button */
.copy-btn {
position: absolute;
top: 0.4em;
right: 0.4em;
background-color: var(--code-bg);
color: var(--heading);
border: 1px dotted var(--heading);
border-radius: 4px;
padding: 0.2em 0.6em;
font-size: 0.8rem;
cursor: pointer;
z-index: 10;
transition: background-color 0.3s;
}
/* =========================================================
BACKLINKS
========================================================= */
.backlinks-section {
margin-top: 4rem;
padding-top: 1.5rem;
border-top: 1px dotted var(--border);
opacity: 0.95;
color: var(--muted);
}
.backlinks-list {
margin-top: 0.75rem;
padding-left: 0;
}
.backlinks-list li {
margin-bottom: 0.4rem;
font-size: 0.9rem;
list-style: none;
}
.backlinks-list li::before {
content: "↩ ";
opacity: 0.5;
margin-right: 0.2rem;
}
.backlinks-list li a {
text-decoration: none;
font-weight: 500;
color: var(--link);
border-bottom: 1px dotted color-mix(in oklab, var(--fg) 20%, transparent);
padding-bottom: 0.05em;
transition: color 0.15s ease, border-color 0.15s ease;
}
.backlinks-list li a:hover,
.backlinks-list li a:focus {
color: var(--fg);
border-bottom-color: currentColor;
}
/* =========================================================
SEARCH
========================================================= */
.banner-search {
position: relative;
max-width: 28rem;
}
#search-box {
width: 100%;
padding: 0.55rem 0.75rem;
font-size: 0.95rem;
font-family: inherit;
background-color: var(--bg-alt);
color: var(--fg);
border: 1px solid var(--border);
border-radius: 4px;
transition: border-color 0.15s ease, box-shadow 0.15s ease,
background-color 0.15s ease;
}
#search-box:focus {
outline: none;
background-color: var(--bg);
border-color: var(--link);
box-shadow: 0 0 0 2px color-mix(in oklab, var(--link) 20%, transparent);
}
#search-box::placeholder {
color: color-mix(in oklab, var(--muted) 30%, var(--fg) 70%);
font-style: italic;
}
#search-results {
position: absolute;
top: calc(100% + 0.3rem);
left: 0;
right: 0;
background-color: var(--bg);
border: 1px dotted var(--border);
border-radius: 4px;
box-shadow: 0 8px 24px color-mix(in oklab, var(--fg) 8%, transparent);
max-height: 18rem;
overflow-y: auto;
z-index: 1000;
}
#search-results > * {
padding: 0.45rem 0.65rem;
font-size: 0.9rem;
line-height: 1.3;
cursor: pointer;
border-bottom: 1px dotted color-mix(in oklab, var(--fg) 5%, transparent);
}
#search-results > *:last-child {
border-bottom: none;
}
#search-results > *:hover,
#search-results > *.active {
background-color: color-mix(in oklab, var(--link) 12%, transparent);
}
/* =========================================================
RESPONSIVE
========================================================= */
@media (max-width: 768px) {
#stack-root {
overflow-x: hidden;
overflow-y: auto;
}
.stack-track {
flex-direction: column;
width: 100%;
}
.stack-pane {
width: 100%;
height: auto;
border-right: none;
border-bottom: 1px dotted var(--border);
}
}
/* =========================================================
FULLSCREEN PANE MODE
========================================================= */
body.pane-fullscreen #stack-root {
overflow: hidden;
}
body.pane-fullscreen .stack-track {
width: 100%;
}
body.pane-fullscreen .stack-pane {
width: 100% !important;
max-width: none;
border-right: none;
}
body.pane-fullscreen .stack-pane::after {
display: none;
}
/* Only the active fullscreen pane remains */
body.pane-fullscreen .stack-pane:not(.is-fullscreen) {
display: none;
}
/* Optional: make content breathe more in fullscreen */
body.pane-fullscreen #content.content {
max-width: 900px;
}

647
assets/styles/style.css~ Executable file
View File

@@ -0,0 +1,647 @@
/* =========================================================
TOKENS / CUSTOM PROPERTIES
========================================================= */
:root {
--gutter: 2rem;
--margin: 420px;
--body-pad: 1rem;
--content-min: 60ch;
--content-max: 880px;
--content: clamp(
var(--content-min),
calc(100vi - (2 * var(--body-pad)) - (2 * (var(--margin) + var(--gutter)))),
var(--content-max)
);
--bleed: 48px;
--fullwidth-cap: 860px;
--bg: #fff;
--page-bg: #fafafc;
--fg: #000;
--heading: #004c99;
--link: #0a84ff;
--link-2: var(--link);
--code-bg: #f0f0f0;
--border: #d7d7d7;
--active-toc: #cacaca;
--muted: #666;
--note-color: #555;
--note-bg: transparent;
--chip-bg: #f0f0f0;
--chip-fg: #444;
/* Compatibility aliases (you reference these later) */
--border-color: var(--border);
--text-color: var(--fg);
--muted-text: var(--muted);
--link-color: var(--link);
--link-hover-color: var(--fg);
--bg-alt: #fafafa;
}
/* =========================================================
BASE / TYPOGRAPHY
========================================================= */
html,
body {
margin: 0;
background-color: var(--page-bg);
color: var(--fg);
transition: background-color 0.3s, color 0.3s;
font-family: Inter, sans-serif;
}
/* Keep your layout intent (column app shell) */
body {
display: flex;
flex-direction: column;
}
h1,
h2,
h3 {
color: var(--heading);
}
a {
color: var(--link-2);
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
/* =========================================================
PREAMBLE / HEADER
========================================================= */
#preamble {
top: 0;
z-index: 20;
background: var(--bg);
border-bottom: 1px solid var(--border);
}
#preamble .banner-header,
#preamble #updated {
max-width: 100%;
}
.banner-header {
position: relative; /* anchor for Close All */
display: flex;
justify-content: center; /* center main group */
align-items: center;
gap: 1rem;
padding: 0.5rem 1rem;
}
.banner-logo {
height: 80px;
width: auto;
margin-right: 1.5rem;
border-radius: 50%;
}
nav {
display: flex;
gap: 1rem;
font-weight: 600;
font-size: 1.1rem;
}
#updated {
font-size: 0.75rem;
color: var(--muted);
opacity: 0.7;
white-space: nowrap;
}
#close-all {
position: absolute;
right: 1rem;
top: 50%;
transform: translateY(-50%);
background: transparent;
border: 1px solid var(--border);
border-radius: 4px;
padding: 0.25rem 0.5rem; /* smaller so it doesnt dominate */
font-size: 0.8rem;
color: var(--muted);
cursor: pointer;
}
#close-all:hover {
color: var(--fg);
border-color: var(--fg);
}
.banner-header > a {
display: flex;
align-items: center;
}
@media (max-width: 768px) {
.banner-header {
grid-template-columns: 1fr;
gap: 0.75rem;
text-align: center;
}
.banner-logo {
margin: 0 auto;
}
#close-all {
justify-self: center;
}
}
/* =========================================================
CONTENT WRAPPER
========================================================= */
#content.content {
max-width: var(--content);
margin-left: auto !important;
margin-right: auto !important;
padding-left: var(--body-pad);
padding-right: var(--body-pad);
box-sizing: content-box;
position: relative;
}
#content .figure,
#content img:not(.fullwidth) {
max-width: 100%;
height: auto;
}
/* =========================================================
STACKED PANE LAYOUT
========================================================= */
#stack-root {
position: relative;
width: 100vw;
height: calc(100vh - 120px);
overflow-x: auto;
overflow-y: hidden;
flex: 1 1 auto;
scroll-snap-type: x proximity;
}
.stack-track {
display: flex;
flex-direction: row;
align-items: stretch;
width: max-content;
height: 100%;
}
.stack-pane {
flex: 0 0 auto;
width: clamp(420px, 33vw, 860px);
max-width: 100vw;
height: 100%;
overflow-y: auto;
overflow-x: hidden;
position: relative; /* needed for ::after positioning */
background-color: var(--bg);
border-right: 1px solid var(--border);
}
.stack-pane::after {
content: "";
position: absolute;
top: 0;
right: 0;
width: 12px;
height: 100%;
pointer-events: none;
opacity: 0.15;
}
.stack-pane:last-child {
box-shadow: -4px 0 16px rgba(0, 0, 0, 0.06);
}
/* Scrollbar (WebKit) */
.stack-pane::-webkit-scrollbar {
width: 8px;
}
.stack-pane::-webkit-scrollbar-thumb {
background-color: color-mix(in oklab, var(--fg) 25%, transparent);
border-radius: 4px;
}
/* =========================================================
PANE HEADER + CLOSE BUTTON
========================================================= */
.pane-root {
background-color: var(--bg);
}
.pane-header {
position: sticky;
top: 0;
z-index: 5;
display: flex;
justify-content: flex-end;
background: inherit;
padding: 0.25rem 0.5rem;
border-bottom: 1px solid var(--border);
}
.pane-close {
background: none;
border: none;
font-size: 1.4rem;
line-height: 1;
cursor: pointer;
color: var(--muted);
padding: 0.1rem 0.4rem;
}
.pane-close:hover {
color: var(--fg);
}
/* =========================================================
FOOTER
========================================================= */
footer {
color: var(--fg);
padding: 1rem;
border-radius: 6px;
text-align: center;
font-size: 0.9rem;
font-style: italic;
flex-shrink: 0;
margin-top: 0;
border-top: 1px solid var(--border);
background: var(--bg);
/* If you want it sticky later, use:
position: sticky;
bottom: 0;
*/
bottom: 0;
z-index: 10;
}
/* =========================================================
LISTS
========================================================= */
ul,
ol {
margin: 1rem 0 1.5rem 1.5rem;
padding: 0;
line-height: 1.5;
}
ul {
list-style: none;
}
ul li {
position: relative;
padding-left: 1.2em;
}
ul li::before {
content: "•";
position: absolute;
left: 0;
top: 0;
color: var(--heading);
font-weight: bold;
}
ol {
counter-reset: list-counter;
list-style: none;
}
ol li {
counter-increment: list-counter;
position: relative;
padding-left: 1.8em;
}
ol li::before {
content: counter(list-counter) ".";
position: absolute;
left: 0;
top: 0;
color: var(--heading);
font-weight: bold;
}
li {
margin-bottom: 8px;
display: flow-root;
}
li::after {
content: none;
}
li ul,
li ol {
margin-top: 0.5rem;
margin-bottom: 0.5rem;
}
li ul li::before {
content: "";
font-weight: normal;
color: var(--note-color);
}
li ol li::before {
font-weight: normal;
color: var(--note-color);
}
/* =========================================================
EPIGRAPH
========================================================= */
.epigraph {
margin: 2rem auto;
max-width: 80%;
font-style: italic;
}
.epigraph blockquote {
margin: 0;
padding: 1rem 1.5rem;
border-left: 4px solid var(--heading);
background-color: color-mix(in oklab, var(--bg) 94%, var(--fg) 6%);
color: var(--fg);
line-height: 1.6;
}
.epigraph blockquote footer {
margin-top: 0.75rem;
font-style: normal;
font-size: 0.9em;
color: var(--muted);
text-align: right;
}
.epigraph blockquote cite {
font-style: italic;
font-weight: 500;
color: var(--link);
}
.epigraph blockquote::before,
.epigraph blockquote::after {
content: none;
}
/* =========================================================
UTILITIES / MISC
========================================================= */
.hidden {
display: none !important;
}
/* bigger-picture.js controls */
.bp-x {
right: 72px;
}
.bp-next,
.bp-prev {
right: 8px;
}
.bp-prev {
left: 8px;
}
.bp-wrap {
transition: opacity 0.18s ease;
}
.bp-wrap.bp-fadeout {
opacity: 0;
}
.bp-controls {
padding-top: env(safe-area-inset-top, 0);
padding-right: calc(env(safe-area-inset-right, 0) + 8px);
}
/* code copy button */
.copy-btn {
position: absolute;
top: 0.4em;
right: 0.4em;
background-color: var(--code-bg);
color: var(--heading);
border: 1px solid var(--heading);
border-radius: 4px;
padding: 0.2em 0.6em;
font-size: 0.8rem;
cursor: pointer;
z-index: 10;
transition: background-color 0.3s;
}
/* =========================================================
BACKLINKS
========================================================= */
.backlinks-section {
margin-top: 4rem;
padding-top: 1.5rem;
border-top: 1px solid var(--border);
opacity: 0.95;
color: var(--muted);
}
.backlinks-list {
margin-top: 0.75rem;
padding-left: 0;
}
.backlinks-list li {
margin-bottom: 0.4rem;
font-size: 0.9rem;
list-style: none;
}
.backlinks-list li::before {
content: "↩ ";
opacity: 0.5;
margin-right: 0.2rem;
}
.backlinks-list li a {
text-decoration: none;
font-weight: 500;
color: var(--link);
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
padding-bottom: 0.05em;
transition: color 0.15s ease, border-color 0.15s ease;
}
.backlinks-list li a:hover,
.backlinks-list li a:focus {
color: var(--fg);
border-bottom-color: currentColor;
}
/* =========================================================
SEARCH
========================================================= */
.banner-search {
position: relative;
max-width: 28rem;
}
#search-box {
width: 100%;
padding: 0.55rem 0.75rem;
font-size: 0.95rem;
font-family: inherit;
background-color: var(--bg-alt);
color: var(--fg);
border: 1px solid var(--border);
border-radius: 4px;
transition: border-color 0.15s ease, box-shadow 0.15s ease,
background-color 0.15s ease;
}
#search-box:focus {
outline: none;
background-color: #fff;
border-color: var(--link);
box-shadow: 0 0 0 2px rgba(42, 93, 176, 0.15);
}
#search-box::placeholder {
color: #888;
font-style: italic;
}
#search-results {
position: absolute;
top: calc(100% + 0.3rem);
left: 0;
right: 0;
background-color: #fff;
border: 1px solid var(--border);
border-radius: 4px;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
max-height: 18rem;
overflow-y: auto;
z-index: 1000;
}
#search-results > * {
padding: 0.45rem 0.65rem;
font-size: 0.9rem;
line-height: 1.3;
cursor: pointer;
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
#search-results > *:last-child {
border-bottom: none;
}
#search-results > *:hover,
#search-results > *.active {
background-color: rgba(42, 93, 176, 0.08);
}
/* =========================================================
RESPONSIVE
========================================================= */
@media (max-width: 768px) {
#stack-root {
overflow-x: hidden;
overflow-y: auto;
}
.stack-track {
flex-direction: column;
width: 100%;
}
.stack-pane {
width: 100%;
height: auto;
border-right: none;
border-bottom: 1px solid var(--border);
}
}
/* =========================================================
FULLSCREEN PANE MODE
========================================================= */
body.pane-fullscreen #stack-root {
overflow: hidden;
}
body.pane-fullscreen .stack-track {
width: 100%;
}
body.pane-fullscreen .stack-pane {
width: 100% !important;
max-width: none;
border-right: none;
}
body.pane-fullscreen .stack-pane::after {
display: none;
}
/* Only the active fullscreen pane remains */
body.pane-fullscreen .stack-pane:not(.is-fullscreen) {
display: none;
}
/* Optional: make content breathe more in fullscreen */
body.pane-fullscreen #content.content {
max-width: 900px;
}

0
assets/swappy-20250805-152411.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 114 KiB

After

Width:  |  Height:  |  Size: 114 KiB