/* ==========================================================================
   Matteo Nurisso — personal site
   Plain CSS, no build step. Palette borrowed from the BrBG precipitation map
   used on the site: dry brown ↔ wet teal.
   ========================================================================== */

/* ---------- Tokens ---------- */
/* Solarized (Ethan Schoonover): dark is the default, light is the toggle.
   Greys are nudged slightly lighter than the canonical values for AA contrast. */
:root {
	--bg: #002b36;            /* base03 */
	--bg-alt: #00232d;
	--surface: #073642;       /* base02 */
	--surface-2: #0b414f;
	--heading: #eee8d5;       /* base2 */
	--text: #a0aeae;
	--muted: #8a9c9e;
	--border: #124a58;
	--accent: #36b3a9;        /* cyan */
	--accent-ink: #002b36;
	--accent-soft: rgba(54, 179, 169, 0.14);
	--warm: #d9a21b;          /* yellow */
	--warm-soft: rgba(217, 162, 27, 0.15);
	--ok: #9db300;            /* green */
	--ok-soft: rgba(157, 179, 0, 0.15);
	--code-bg: #00212b;
	--code-fg: #93a1a1;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 8px 24px -12px rgba(0, 0, 0, 0.55);
	--shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.45), 0 24px 48px -20px rgba(0, 0, 0, 0.75);

	--font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
	--font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

	--radius: 14px;
	--radius-sm: 8px;
	--header-h: 64px;
	--maxw: 1120px;
	color-scheme: dark;
}

:root[data-theme="light"] {
	--bg: #fdf6e3;            /* base3 */
	--bg-alt: #f5eedb;
	--surface: #fffbef;
	--surface-2: #f3ecd6;
	--heading: #073642;       /* base02 */
	--text: #586e75;          /* base01 */
	--muted: #5a6f76;
	--border: #e3dbc3;
	--accent: #187a73;
	--accent-ink: #fdf6e3;
	--accent-soft: rgba(24, 122, 115, 0.11);
	--warm: #9a6b00;
	--warm-soft: rgba(154, 107, 0, 0.12);
	--ok: #5f6d00;
	--ok-soft: rgba(95, 109, 0, 0.12);
	--code-bg: #073642;
	--code-fg: #93a1a1;
	--shadow: 0 1px 2px rgba(7, 54, 66, 0.06), 0 8px 24px -12px rgba(7, 54, 66, 0.2);
	--shadow-lg: 0 2px 4px rgba(7, 54, 66, 0.08), 0 24px 48px -20px rgba(7, 54, 66, 0.35);
	color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 16px);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 400 1.0625rem/1.65 var(--font-sans);
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	transition: background-color 0.3s, color 0.3s;
}

img, svg, canvas { display: block; max-width: 100%; }
img { height: auto; }

h1, h2, h3, h4 { color: var(--heading); font-family: var(--font-serif); line-height: 1.15; margin: 0 0 0.5em; font-weight: 600; letter-spacing: -0.01em; text-wrap: balance; }
h2 { font-size: clamp(1.9rem, 3.2vw + 0.8rem, 2.8rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }
p { margin: 0 0 1em; text-wrap: pretty; }
ul, ol { margin: 0; padding: 0; }
strong { font-weight: 650; color: var(--heading); }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.2em; text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent); transition: color 0.15s, text-decoration-color 0.15s; }
a:hover { text-decoration-color: currentColor; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
::selection { background: var(--accent); color: var(--accent-ink); }

.container { width: min(100% - 48px, var(--maxw)); margin-inline: auto; }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 200; background: var(--accent); color: var(--accent-ink); padding: 0.6rem 1rem; border-radius: var(--radius-sm); transition: top 0.2s; }
.skip-link:focus { top: 12px; }

kbd { font: 500 0.72rem/1 var(--font-mono); padding: 0.25rem 0.4rem; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }

.icon { width: 1.15em; height: 1.15em; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; display: inline-block; vertical-align: -0.2em; }
.icon-lg { width: 1.6rem; height: 1.6rem; }

/* ---------- Header ---------- */
.site-header {
	position: fixed; inset: 0 0 auto 0; z-index: 100; height: var(--header-h);
	background: color-mix(in srgb, var(--bg) 78%, transparent);
	backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
	border-bottom: 1px solid transparent;
	transition: border-color 0.25s, box-shadow 0.25s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.header-inner { height: 100%; display: flex; align-items: center; gap: 1.5rem; }

.brand { white-space: nowrap; display: inline-flex; align-items: center; gap: 0.65rem; color: var(--heading); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; font: 700 0.8rem/1 var(--font-mono); color: var(--accent-ink); background: linear-gradient(135deg, var(--accent), var(--warm)); }

.nav { display: flex; gap: 0.15rem; margin-left: auto; }
.nav a { position: relative; white-space: nowrap; padding: 0.45rem 0.7rem; border-radius: 999px; color: var(--muted); text-decoration: none; font-size: 0.95rem; font-weight: 500; transition: color 0.15s, background-color 0.15s; }
.nav a:hover { color: var(--text); background: var(--surface-2); }
.nav a.is-active, .nav a[aria-current="page"] { color: var(--accent); background: var(--accent-soft); }

.header-actions { display: flex; align-items: center; gap: 0.4rem; }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; height: 38px; min-width: 38px; padding: 0 0.6rem; border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); font: inherit; cursor: pointer; transition: border-color 0.15s, background-color 0.15s, transform 0.15s; }
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(0.96); }
.icon-btn-sm { height: 30px; min-width: 30px; padding: 0 0.4rem; border-radius: 8px; }
.kbd-btn kbd { border: 0; background: none; padding: 0; font-size: 0.75rem; }

.icon-moon { display: none; }
:root[data-theme="light"] .icon-sun { display: none; }
:root[data-theme="light"] .icon-moon { display: inline-block; }

.nav-toggle { display: none; }
.nav-toggle .icon-close { display: none; }
.nav-toggle[aria-expanded="true"] .icon-open { display: none; }
.nav-toggle[aria-expanded="true"] .icon-close { display: inline-block; }

.scroll-progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; transform-origin: 0 50%; transform: scaleX(0); background: linear-gradient(90deg, var(--accent), var(--warm)); }

@media (max-width: 1020px) {
	.kbd-btn kbd { display: none; }
	.js .nav-toggle { display: inline-flex; }
	.header-actions { margin-left: auto; }
	.js .nav {
		position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; gap: 0.25rem; margin: 0; padding: 1rem 24px 1.5rem;
		background: var(--bg); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
		transform: translateY(-12px); opacity: 0; visibility: hidden; transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
	}
	.js .nav.is-open { transform: none; opacity: 1; visibility: visible; }
	.js .nav a { padding: 0.8rem 1rem; font-size: 1.05rem; }
}

/* Without JavaScript: static header, wrapping inline nav, no JS-only buttons */
html:not(.js) .site-header { position: static; height: auto; }
html:not(.js) .header-inner { flex-wrap: wrap; padding: 0.75rem 0; gap: 0.5rem 1.5rem; }
html:not(.js) .nav { flex-wrap: wrap; margin-left: 0; }
html:not(.js) .header-actions, html:not(.js) .scroll-progress, html:not(.js) .hero-hint { display: none; }
html:not(.js) .hero { padding-top: 2rem; min-height: 0; }
html:not(.js) .tabpanel[hidden] { display: block; }
html:not(.js) .tablist { display: none; }

/* ---------- Buttons, chips, tags ---------- */
.btn { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.7rem 1.25rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font: 600 0.95rem/1.2 var(--font-sans); text-decoration: none; cursor: pointer; transition: transform 0.15s, border-color 0.15s, background-color 0.15s, box-shadow 0.15s; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); color: var(--accent-ink); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 0.45rem 0.9rem; font-size: 0.86rem; min-height: 36px; }
@media (pointer: coarse) { .btn-sm { min-height: 42px; } .icon-btn-sm { height: 40px; min-width: 40px; } .chip { padding-block: 0.6rem; } }

.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 1.25rem 0 0; }
.actions.center { justify-content: center; margin-top: 2.5rem; }

.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.25rem; }
.chips li { padding: 0.3rem 0.8rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 0.85rem; color: var(--muted); }

.tag, .pill { display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px; font: 600 0.72rem/1.5 var(--font-mono); letter-spacing: 0.02em; text-transform: uppercase; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.tag-ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.tag-warn, .pill-now { background: var(--warm-soft); color: var(--warm); border-color: transparent; }
.tag-conference { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag-talk { background: var(--warm-soft); color: var(--warm); border-color: transparent; }
.tag-workshop { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pill-now { background: var(--accent-soft); color: var(--accent); }

.chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.45rem 0.95rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--muted); font: 500 0.9rem/1.2 var(--font-sans); cursor: pointer; transition: all 0.15s; }
.chip:hover { color: var(--text); border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip .count { font: 600 0.72rem/1 var(--font-mono); opacity: 0.75; }

.eyebrow { display: inline-flex; align-items: center; gap: 0.5rem; margin: 0 0 0.9rem; font: 600 0.8rem/1 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.eyebrow a { color: inherit; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 var(--accent); animation: pulse 2.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }

.grad { background: linear-gradient(100deg, var(--accent), var(--warm)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Hero ---------- */
.hero, .page-hero { position: relative; overflow: hidden; isolation: isolate; }
.hero { min-height: min(100svh, 860px); display: flex; align-items: center; padding: calc(var(--header-h) + 2rem) 0 4rem; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; opacity: 0.9; -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent); mask-image: linear-gradient(to bottom, #000 55%, transparent); pointer-events: none; }
.hero::after, .page-hero::after { content: ""; position: absolute; inset: 0; z-index: -2; background:
	radial-gradient(60% 50% at 85% 20%, var(--accent-soft), transparent 70%),
	radial-gradient(50% 45% at 5% 90%, var(--warm-soft), transparent 70%); }

.hero-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr); gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(3rem, 7.5vw, 5.6rem); letter-spacing: -0.03em; margin-bottom: 0.3em; }
.lead { font-size: clamp(1.12rem, 1vw + 0.9rem, 1.35rem); line-height: 1.55; color: var(--muted); max-width: 40em; }
.lead strong { color: var(--heading); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 2rem; }

.social { list-style: none; display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; margin-top: 1.75rem; }
.social a { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.55rem 0.25rem; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 0.95rem; }
.social a:hover { color: var(--accent); }

.portrait { position: relative; margin: 0; justify-self: center; width: min(100%, 360px); }
.portrait::before { content: ""; position: absolute; inset: -14px; border-radius: 36px; background: conic-gradient(from 200deg, var(--accent), var(--warm), var(--accent)); filter: blur(22px); opacity: 0.35; z-index: -1; }
.portrait img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 28px; border: 1px solid var(--border); box-shadow: var(--shadow-lg); transition: transform 0.5s cubic-bezier(.2,.8,.2,1); }
.portrait:hover img { transform: rotate(-1.5deg) scale(1.02); }
.portrait-tag { position: absolute; left: 14px; bottom: 14px; display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; border-radius: 999px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--border); font-size: 0.8rem; font-weight: 500; }

.hero-hint { position: absolute; left: 50%; bottom: 1.2rem; transform: translateX(-50%); margin: 0; font: 500 0.75rem/1 var(--font-mono); letter-spacing: 0.04em; color: var(--muted); opacity: 0.7; white-space: nowrap; }
@media (hover: none) { .hero-hint { display: none; } }

.page-hero { padding: calc(var(--header-h) + 3rem) 0 3.5rem; }
.page-hero h1 { font-size: clamp(2.6rem, 6vw, 4.4rem); letter-spacing: -0.03em; }
.breadcrumb { margin-bottom: 1.5rem; font: 500 0.82rem/1 var(--font-mono); color: var(--muted); }
.breadcrumb a { color: var(--muted); }
.breadcrumb a:hover { color: var(--accent); }

@media (max-width: 860px) {
	.hero-grid { grid-template-columns: 1fr; gap: 2.5rem; }
	.portrait { order: -1; width: min(60%, 240px); justify-self: start; }
	.hero { align-items: flex-start; }
}

/* ---------- Sections ---------- */
.section { padding: clamp(4rem, 8vw, 7rem) 0; }
.section-alt { background: var(--bg-alt); border-block: 1px solid var(--border); }
.section-head { margin-bottom: 2.5rem; }
.section-head h2 { margin-bottom: 0.3em; }
.section-sub { max-width: 40em; color: var(--muted); font-size: 1.1rem; margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); gap: clamp(2rem, 5vw, 5rem); align-items: start; }
.split > .section-head { margin: 0; }
.sticky { position: sticky; top: calc(var(--header-h) + 2rem); }
@media (max-width: 860px) { .split { grid-template-columns: minmax(0, 1fr); gap: 1.5rem; } .sticky { position: static; } }

.prose p { font-size: 1.1rem; }
.prose-lead { font-size: 1.15rem; max-width: 46em; }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin: 3.5rem 0 0; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.stats > div { background: var(--surface); padding: 1.4rem 1.25rem; }
.stats dt { order: 2; font-size: 0.85rem; color: var(--muted); line-height: 1.35; }
.stats dd { margin: 0 0 0.3rem; white-space: nowrap; font: 600 clamp(1.4rem, 1rem + 2.2vw, 2.6rem)/1 var(--font-serif); color: var(--heading); font-variant-numeric: tabular-nums; }
.stats > div { display: flex; flex-direction: column; }
.stats-inline { margin-top: 2.5rem; }
.stats-3 { grid-template-columns: repeat(3, 1fr); }
.stats-note { margin: 0.9rem 0 0; font-size: 0.88rem; color: var(--muted); }
@media (max-width: 760px) {
	.stats { grid-template-columns: repeat(2, 1fr); }
	.stats-3 { grid-template-columns: repeat(3, 1fr); }
	.stats-3 > div { padding: 1rem 0.75rem; }
	.stats-3 dt { font-size: 0.78rem; }
}

/* ---------- Tabs ---------- */
.tablist { display: inline-flex; gap: 0.25rem; padding: 0.3rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); margin-bottom: 2rem; max-width: 100%; overflow-x: auto; }
.tablist button { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.55rem 1.1rem; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: 600 0.95rem/1.2 var(--font-sans); cursor: pointer; white-space: nowrap; transition: background-color 0.2s, color 0.2s; }
.tablist button:hover { color: var(--text); }
.tablist button[aria-selected="true"] { background: var(--accent); color: var(--accent-ink); }
.tablist button[aria-selected="true"] .pill { background: rgba(255,255,255,0.2); color: inherit; }
.tablist-sm { margin: 0; }
.tablist-sm button { padding: 0.55rem 0.9rem; font-size: 0.85rem; }
.tabpanel { animation: fade-up 0.4s cubic-bezier(.2,.8,.2,1); }
.tabpanel[hidden] { display: none; }
@keyframes fade-up { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.notice { padding: 1rem 1.25rem; margin-bottom: 2rem; border-left: 3px solid var(--warm); background: var(--warm-soft); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ---------- Feature (text + figure) ---------- */
.feature { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(2rem, 5vw, 4rem); align-items: center; margin-top: 3rem; }
.feature:first-child { margin-top: 0; }
.feature-flip .feature-text { order: 2; }
.feature-single { grid-template-columns: minmax(0, 46rem); }
.feature-fig { margin: 0; }
.feature-fig img { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); background: var(--surface); }
.feature-fig figcaption { margin-top: 0.75rem; font-size: 0.88rem; color: var(--muted); }
.zoom-btn { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: var(--radius); }
.zoom-btn img { transition: transform 0.3s, box-shadow 0.3s; }
.zoom-btn:hover img { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
@media (max-width: 860px) { .feature { grid-template-columns: minmax(0, 1fr); } .feature-flip .feature-text { order: 0; } .zoomable { max-width: 420px; } }

.checks { list-style: none; margin: 1.25rem 0 0; display: grid; gap: 0.5rem; }
.checks li { position: relative; padding-left: 1.8rem; }
.checks li::before { content: ""; position: absolute; left: 0; top: 0.45em; width: 1.05rem; height: 1.05rem; border-radius: 50%; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a7a74' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E") center / 62% no-repeat; }

/* Inline code */
code { font: 0.88em var(--font-mono); padding: 0.1em 0.4em; border-radius: 6px; background: var(--surface-2); color: var(--heading); }
pre code { padding: 0; background: none; color: inherit; font-size: inherit; }

/* ---------- Cards ---------- */
.cards { display: grid; gap: 1.25rem; margin-top: 2.5rem; }
.cards:first-child { margin-top: 0; }
.cards-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cards-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 960px) { .cards-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 680px) { .cards-2, .cards-3 { grid-template-columns: 1fr; } }

.card { display: flex; flex-direction: column; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s; }
.card:hover { transform: translateY(-3px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow); }
.card h3, .card h4 { margin-bottom: 0.5rem; }
.card > p:not(.actions) { color: var(--muted); }
.card-sub { color: var(--muted); margin-bottom: 0.75rem; }
.card .actions { margin-top: auto; padding-top: 1rem; }
.card[hidden] { display: none; }

.repo header { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0.35rem 0.6rem; margin-bottom: 0.75rem; }
.repo header h3 { margin: 0; min-width: 0; font-size: 1.05rem; font-family: var(--font-mono); font-weight: 600; letter-spacing: -0.02em; overflow-wrap: break-word; }
.repo header h3 a { color: var(--heading); text-decoration: none; }
.repo header h3 a:hover { color: var(--accent); }
.repo header .tag { grid-column: 2; justify-self: start; }
.repo-meta { list-style: none; display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin: 0.25rem 0 0; font-size: 0.84rem; color: var(--muted); }
.repo-meta:empty { display: none; }
.repo-meta li { display: inline-flex; align-items: center; gap: 0.35rem; animation: fade-up 0.4s both; }
.repo-meta .icon { width: 1em; height: 1em; }
.repo-meta strong { color: var(--text); font-variant-numeric: tabular-nums; }
.lang-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.lang-Python .lang-dot { background: #3572a5; }
.lang-Shell .lang-dot { background: #89e051; }
.lang-Jupyter-Notebook .lang-dot { background: #da5b0b; }
.lang-CSS .lang-dot { background: #563d7c; }

/* ---------- Toolbar / search ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 2rem; }
.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.search { display: flex; align-items: center; gap: 0.5rem; padding: 0 0.9rem; min-width: min(100%, 320px); border: 1px solid var(--border); border-radius: 999px; background: var(--surface); transition: border-color 0.15s, box-shadow 0.15s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search .icon { color: var(--muted); }
.search input { flex: 1; min-width: 0; border: 0; background: none; padding: 0.6rem 0; color: var(--text); font: inherit; font-size: 0.95rem; outline: none; }

.empty { padding: 2rem; text-align: center; color: var(--muted); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty[hidden] { display: none; }
.note { margin-top: 2rem; color: var(--muted); font-size: 0.95rem; }

/* ---------- Publications ---------- */
.pubs { list-style: none; display: grid; gap: 1rem; counter-reset: pub; }
.pub { padding: 1.5rem 1.6rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s; }
.pub:hover { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow); }
.pub[hidden] { display: none; }
.pub-meta { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.6rem; }
.pub-year { font: 500 0.82rem/1 var(--font-mono); color: var(--muted); }
.pub-title { font-size: 1.2rem; line-height: 1.3; margin-bottom: 0.6rem; }
.pub-authors { font-size: 0.95rem; color: var(--muted); margin-bottom: 0.5rem; }
.pub-authors strong { color: var(--heading); background: var(--accent-soft); padding: 0 0.25em; border-radius: 4px; }
.pub-venue { font-size: 0.95rem; margin-bottom: 0.5rem; }
.pub-venue .journal { font-style: italic; }
.pub-links { margin: 0; font: 500 0.88rem/1.4 var(--font-mono); }
.pub-links a { text-decoration: none; }
.pub-links a:hover { text-decoration: underline; }
mark { background: color-mix(in srgb, var(--warm) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 0.1em; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; position: relative; padding-left: 2rem; }
.timeline::before { content: ""; position: absolute; left: 6px; top: 0.5rem; bottom: 0.5rem; width: 2px; background: linear-gradient(var(--accent), var(--warm), var(--border)); border-radius: 2px; }
.timeline li { position: relative; padding-bottom: 2.25rem; }
.timeline li:last-child { padding-bottom: 0; }
.timeline li::before { content: ""; position: absolute; left: -2rem; top: 0.55rem; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--accent); transform: translateX(0); }
.timeline li.now::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.tl-date { display: inline-block; font: 600 0.8rem/1 var(--font-mono); color: var(--accent); letter-spacing: 0.04em; margin-bottom: 0.45rem; }
.timeline h3 { margin-bottom: 0.2rem; font-size: 1.25rem; }
.tl-org { margin: 0; font-weight: 500; }
.tl-place { margin: 0; color: var(--muted); font-size: 0.95rem; }
.side-fig { margin: 2rem 0 0; }
.side-fig img { border-radius: var(--radius); aspect-ratio: 4 / 3; object-fit: cover; width: 100%; border: 1px solid var(--border); }
.side-fig figcaption { font-size: 0.85rem; color: var(--muted); margin-top: 0.5rem; }
@media (max-width: 860px) { .side-fig { display: none; } }

/* ---------- Events ---------- */
.events { list-style: none; border-top: 1px solid var(--border); }
.event { display: grid; grid-template-columns: 4.5rem minmax(0, 1fr) auto; gap: 1rem; align-items: baseline; padding: 1rem 0; border-bottom: 1px solid var(--border); animation: fade-up 0.35s both; }
.event[hidden] { display: none; }
.event-year { font: 600 0.95rem/1.4 var(--font-mono); color: var(--accent); }
.event.repeat .event-year { visibility: hidden; }
.event-title { display: block; }
.event-title a { color: inherit; text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.event-title a:hover { color: var(--accent); }
.event-place { display: block; margin-top: 0.15rem; font-size: 0.9rem; color: var(--muted); }
@media (max-width: 640px) {
	.event { grid-template-columns: 3.4rem minmax(0, 1fr); }
	.event .tag { grid-column: 2; justify-self: start; }
}

/* ---------- Lists inside cards ---------- */
.list { list-style: none; display: grid; gap: 0.75rem; }
.list li { display: grid; grid-template-columns: 4.2rem 1fr; gap: 0.75rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.98rem; }
.list li:last-child { border: 0; padding-bottom: 0; }
.li-year { font: 600 0.8rem/1.8 var(--font-mono); color: var(--accent); }

.activism h4 { margin-top: 1.5rem; }
.mini-timeline { list-style: none; margin: 1rem 0 0; border-left: 2px solid var(--border); padding-left: 1.25rem; display: grid; gap: 0.7rem; }
.mini-timeline li { position: relative; }
.mini-timeline li::before { content: ""; position: absolute; left: calc(-1.25rem - 5px); top: 0.6em; width: 8px; height: 8px; border-radius: 50%; background: var(--warm); }
.mini-timeline li > span:first-child { font: 600 0.82rem/1 var(--font-mono); color: var(--warm); margin-right: 0.5rem; }

/* ---------- Evaluation charts ---------- */
.auth-note { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.95rem; }
.auth-note .icon { color: var(--warm); }
.fig-link { display: block; border-radius: var(--radius); }
.fig-link img { transition: transform 0.3s, box-shadow 0.3s; }
.fig-link:hover img { transform: translateY(-3px); box-shadow: var(--shadow-lg); }

.callout { margin: 1.5rem 0 0; padding: 1.25rem 1.4rem; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); }
.callout h3 { margin-bottom: 0.4rem; font-size: 1.15rem; }
.callout p:not(.actions) { margin-bottom: 0.6rem; color: var(--muted); font-size: 0.97rem; }
.callout .actions { margin-top: 0.75rem; }

/* ---------- Software page ---------- */
:root:has(.subnav) { scroll-padding-top: calc(var(--header-h) + 72px); }
.subnav { position: sticky; top: var(--header-h); z-index: 50; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-block: 1px solid var(--border); }
.subnav-inner { display: flex; gap: 0.4rem; padding-block: 0.55rem; overflow-x: auto; scrollbar-width: none; }
.subnav-inner::-webkit-scrollbar { display: none; }
.subnav a { flex: none; padding: 0.55rem 0.95rem; border-radius: 999px; color: var(--muted); text-decoration: none; font: 500 0.9rem/1.3 var(--font-sans); transition: color 0.15s, background-color 0.15s; }
.subnav a:hover { color: var(--text); background: var(--surface-2); }
.subnav a.is-active { color: var(--accent); background: var(--accent-soft); }
html:not(.js) .subnav { position: static; }
@media (max-width: 560px) {
	.tablist:not(.tablist-sm) { display: flex; width: 100%; }
	.tablist:not(.tablist-sm) button { flex: 1; justify-content: center; padding-inline: 0.6rem; }
	.tablist:not(.tablist-sm) .pill { display: none; }
	.subnav-inner { width: 100%; padding-inline: 12px; gap: 0.15rem; }
	.subnav a { padding: 0.55rem 0.7rem; }
	.install { padding: 1.1rem; }
	.tablist-sm { width: 100%; }
	.tablist-sm button { flex: 1; justify-content: center; padding: 0.55rem 0.4rem; }
}

.install { margin-top: 3rem; padding: 1.5rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.install-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.install-head h3 { margin: 0; }
.code { position: relative; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); color: var(--code-fg); }
.code pre { margin: 0; padding: 1.1rem 3.5rem 1.1rem 1.25rem; overflow-x: auto; font: 0.9rem/1.7 var(--font-mono); }
.code pre code::before { content: "$ "; color: #586e75; }
.code .icon-btn { position: absolute; top: 0.6rem; right: 0.6rem; background: color-mix(in srgb, var(--code-bg) 82%, #fff); border-color: rgba(255,255,255,0.14); color: var(--code-fg); }
.code-inline { margin-top: 1.5rem; }
.install-note { margin: 1rem 0 0; font-size: 0.92rem; color: var(--muted); }
.checks + .actions { margin-top: 1.75rem; }

.flow { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.5rem; counter-reset: flow; position: relative; }
.flow-node { position: relative; display: flex; flex-direction: column; padding: 1.5rem 1.25rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s; }
.flow-node:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); }
.flow-node-main { border-color: var(--accent); background: linear-gradient(180deg, var(--accent-soft), var(--surface) 60%); }
.flow-node:not(:last-child)::after { content: ""; position: absolute; top: 50%; right: -1.5rem; width: 1.5rem; height: 2px; background: repeating-linear-gradient(90deg, var(--accent) 0 5px, transparent 5px 9px); background-size: 18px 2px; animation: dash 1s linear infinite; }
@keyframes dash { to { background-position: 18px 0; } }
.flow-step { display: grid; place-items: center; width: 28px; height: 28px; margin-bottom: 0.9rem; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 0.8rem/1 var(--font-mono); }
.flow-node h3 { font-size: 1.15rem; }
.flow-node p { font-size: 0.93rem; color: var(--muted); }
.flow-links { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: auto 0 0; padding-top: 0.75rem; }
.link-chip { display: inline-flex; align-items: center; gap: 0.4rem; min-height: 36px; padding: 0.25rem 0.7rem 0.25rem 0.55rem; border: 1px solid var(--border); border-radius: 999px; background: var(--surface-2); color: var(--text); text-decoration: none; font: 500 0.8rem/1.2 var(--font-mono); transition: border-color 0.15s, color 0.15s; }
.link-chip:hover { border-color: var(--accent); color: var(--accent); }
.link-chip .icon { color: var(--accent); }
.lc-kind { padding: 0.1rem 0.4rem; border-radius: 5px; background: var(--accent-soft); color: var(--accent); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
@media (pointer: coarse) { .link-chip { min-height: 42px; } }
@media (max-width: 960px) {
	.flow { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.flow-node:not(:last-child)::after { display: none; }
}
@media (max-width: 560px) { .flow { grid-template-columns: 1fr; } }

.stack { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem 2rem; }
.stack h3 { font: 600 0.8rem/1 var(--font-mono); text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin-bottom: 0.25rem; }
.stack .chips { margin-top: 0.6rem; }
@media (max-width: 560px) { .stack { grid-template-columns: 1fr; } }

/* ---------- Contact / footer ---------- */
.section-contact { padding-bottom: 5rem; }
.contact-card { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 2.5rem; align-items: center; padding: clamp(1.75rem, 4vw, 3.25rem); border: 1px solid var(--border); border-radius: 24px; background:
	radial-gradient(70% 90% at 100% 0%, var(--accent-soft), transparent 70%),
	radial-gradient(60% 80% at 0% 100%, var(--warm-soft), transparent 70%), var(--surface); }
.contact-list { list-style: none; display: grid; gap: 1rem; }
.contact-list li { display: flex; align-items: center; gap: 0.85rem; min-height: 44px; }
.contact-list a { padding: 0.5rem 0; }
.contact-list .icon { width: 1.3rem; height: 1.3rem; color: var(--accent); }
.contact-list a { color: var(--heading); text-decoration-color: color-mix(in srgb, var(--accent) 50%, transparent); font-weight: 500; }
.contact-list a:hover { color: var(--accent); }
@media (max-width: 760px) { .contact-card { grid-template-columns: 1fr; } }

.site-footer { padding: 1.75rem 0 2.5rem; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.9rem; }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.footer-inner p { margin: 0; }
.footer-inner a { color: var(--muted); }

/* ---------- Command palette / lightbox / toast ---------- */
dialog { padding: 0; border: 0; color: var(--text); background: transparent; max-width: none; max-height: none; }
dialog::backdrop { background: rgba(0, 20, 26, 0.6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
dialog[open] { animation: pop 0.18s cubic-bezier(.2,.8,.2,1); }
@keyframes pop { from { opacity: 0; transform: translateY(-8px) scale(0.98); } to { opacity: 1; transform: none; } }

.palette { width: min(600px, 92vw); margin: 12vh auto auto; }
.palette-box { margin: 0; border: 1px solid var(--border); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-lg); overflow: hidden; }
.palette-input { display: flex; align-items: center; gap: 0.75rem; padding: 0.9rem 1.1rem; border-bottom: 1px solid var(--border); }
.palette-input .icon { color: var(--muted); }
.palette-input input { flex: 1; border: 0; background: none; color: var(--text); font: inherit; font-size: 1.05rem; outline: none; min-width: 0; }
#palette-list { list-style: none; max-height: min(50vh, 380px); overflow-y: auto; padding: 0.4rem; }
#palette-list li { display: flex; align-items: center; gap: 0.75rem; padding: 0.65rem 0.8rem; border-radius: 10px; cursor: pointer; font-size: 0.98rem; }
#palette-list li .icon { color: var(--muted); }
#palette-list li small { margin-left: auto; font: 500 0.72rem/1 var(--font-mono); color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
#palette-list li[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
#palette-list li[aria-selected="true"] .icon { color: inherit; }
.palette-foot { display: flex; align-items: center; gap: 0.4rem; margin: 0; padding: 0.6rem 1rem; border-top: 1px solid var(--border); font-size: 0.78rem; color: var(--muted); }
.palette-empty { padding: 1.25rem; text-align: center; color: var(--muted); cursor: default !important; justify-content: center; }

.lightbox { width: 100vw; height: 100vh; display: none; place-items: center; }
.lightbox[open] { display: grid; }
.lightbox img { max-width: min(94vw, 900px); max-height: 92vh; width: auto; height: auto; border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-lg); }
.lightbox-close { position: fixed; top: 16px; right: 16px; }
.lightbox form { margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 300; transform: translate(-50%, 20px); padding: 0.65rem 1.1rem; border-radius: 999px; background: var(--text); color: var(--bg); font-size: 0.9rem; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s cubic-bezier(.2,.8,.2,1), transform 0.6s cubic-bezier(.2,.8,.2,1); }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
	.js .reveal { opacity: 1; transform: none; }
}

@media print {
	.site-header, .hero-canvas, .hero-hint, .toolbar, .palette, .lightbox, .toast, .scroll-progress { display: none !important; }
	body { background: #fff; color: #000; }
	.section { padding: 1.5rem 0; }
	.js .reveal { opacity: 1; transform: none; }
}

/* ---------- Citation badges ---------- */
.pub-links { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 1.25rem; }
.cites { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font: 500 0.8rem/1.4 var(--font-mono); }
.cites strong { color: inherit; }
.cites[hidden] { display: none; }
