/* =========================================================
   Cengizhan Bayram — "the genius's blackboard" theme
   Slate, chalk dust and half-erased lectures; the research written
   out as real formulas, circled and argued over in yellow and red chalk.
   ========================================================= */

:root {
  --slate: #1c2320;
  --slate-2: #232b28;
  --chalk: #f1f0ea;
  --chalk-2: rgba(236, 235, 228, 0.84);
  --muted: rgba(236, 235, 228, 0.6);
  --faint: rgba(236, 235, 228, 0.38);
  --dim: rgba(236, 235, 228, 0.5);
  --line: rgba(236, 235, 228, 0.16);
  --yellow: #f3d36b;
  --pink: #f08a7a;
  --blue: #8cc4e6;

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --serif: "Source Serif 4", "Iowan Old Style", Georgia, serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --hand: "Caveat", "Segoe Print", cursive;

  --maxw: 1180px;
  --gutter: clamp(16px, 4vw, 48px);
  --nav-h: 64px;
  --ease: cubic-bezier(0.2, 0.7, 0.1, 1);
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  background: var(--slate);
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 20px);
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0;
  color: var(--chalk-2);
  font: 400 1.1rem/1.66 var(--serif);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
@supports (overflow: clip) { html, body { overflow-x: clip; } }

html[data-lang="tr"] body [lang="en"],
html[data-lang="en"] body [lang="tr"] { display: none !important; }

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
p { margin: 0 0 1em; }
h1, h2, h3 { margin: 0; font-weight: 400; }
ul, ol { margin: 0; padding: 0; list-style: none; }
strong { font-weight: 600; color: var(--chalk); }
em { font-style: italic; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
::selection { background: var(--yellow); color: var(--slate); }
:focus-visible { outline: 2px dashed var(--yellow); outline-offset: 4px; }

.defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.chalk { filter: url(#chalk); }
.mono { font-family: var(--mono); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; }
.hand { font-family: var(--hand); }
.ic { width: 1.05em; height: 1.05em; fill: currentColor; flex: none; }
.wrap { width: min(var(--maxw), 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip { position: fixed; left: 16px; top: -60px; z-index: 100; background: var(--yellow); color: var(--slate); padding: 8px 14px; font: 500 0.85rem var(--mono); text-decoration: none; transition: top 0.2s; }
.skip:focus { top: 12px; }

/* ---------- the slate: chalk dust, eraser swipes, a darker frame ---------- */
.board {
  position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(ellipse 120% 95% at 50% 45%, transparent 50%, rgba(0, 0, 0, 0.5)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1400' height='900' viewBox='0 0 1400 900'%3E%3Cfilter id='b'%3E%3CfeGaussianBlur stdDeviation='26'/%3E%3C/filter%3E%3Cg filter='url(%23b)' fill='none' stroke='%23fff' stroke-opacity='.045' stroke-width='120' stroke-linecap='round'%3E%3Cpath d='M80 220C300 160 520 260 760 200'/%3E%3Cpath d='M620 640C860 580 1060 700 1320 610'/%3E%3Cpath d='M140 760C280 720 360 780 520 740'/%3E%3C/g%3E%3C/svg%3E") center / cover no-repeat,
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .42 -.24'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    var(--slate);
}

/* ---------- nav ---------- */
.nav {
  position: fixed; inset: 0 0 auto; z-index: 50; height: var(--nav-h);
  background: rgba(24, 30, 27, 0.86);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.progress { position: absolute; left: 0; bottom: -1px; height: 2px; width: 100%; background: var(--yellow); transform-origin: 0 50%; transform: scaleX(0); }
.nav-inner { height: 100%; width: min(1320px, 100% - 2 * var(--gutter)); margin-inline: auto; display: flex; align-items: center; gap: 24px; }
.brand { display: inline-flex; align-items: baseline; gap: 12px; text-decoration: none; color: var(--chalk); }
.brand-name { font: italic 400 1.55rem/1 var(--display); }
.brand-sub { color: var(--yellow); font-size: 0.64rem; text-transform: none; letter-spacing: 0.04em; }
.nav-links { display: flex; gap: 2px; margin-left: auto; }
.nav-links a { position: relative; padding: 8px 11px; font: 500 0.74rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-decoration: none; transition: color 0.2s; }
.nav-links a:hover, .nav-links a.active { color: var(--chalk); }
.nav-links a.active::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 0; height: 2px; background: var(--yellow); border-radius: 2px; filter: url(#chalk); }
.nav-tools { display: flex; align-items: center; gap: 10px; }
.lang { display: inline-flex; gap: 4px; padding: 7px 10px; font: 500 0.74rem/1 var(--mono); letter-spacing: 0.1em; border: 1px solid var(--line); color: var(--faint); }
.lang-sep { opacity: 0.5; }
html[data-lang="tr"] .lang [data-l="tr"], html[data-lang="en"] .lang [data-l="en"] { color: var(--yellow); }
.burger { display: none; width: 40px; height: 40px; position: relative; }
.burger span { position: absolute; left: 9px; right: 9px; height: 2px; background: var(--chalk); transition: transform 0.35s var(--ease), top 0.35s var(--ease); }
.burger span:nth-child(1) { top: 15px; }
.burger span:nth-child(2) { top: 23px; }
.nav.open .burger span:nth-child(1) { top: 19px; transform: rotate(45deg); }
.nav.open .burger span:nth-child(2) { top: 19px; transform: rotate(-45deg); }

/* ---------- chalk marks drawn by the script ---------- */
.board-layer { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.ghost {
  position: absolute; white-space: nowrap;
  color: var(--chalk); opacity: 0.13;
  transform: rotate(var(--r, 0deg));
  font-size: var(--s, 1.6rem);
  filter: url(#chalk);
}
.ghost.fresh { opacity: 0.75; color: var(--yellow); }
.ghost.pink { opacity: 0.7; color: var(--pink); }
.scrib { position: absolute; max-width: none; overflow: visible; pointer-events: none; filter: url(#chalk); }
.scrib path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.scrib.yellow { color: var(--yellow); }
.scrib.pink { color: var(--pink); }
.scrib.white { color: var(--chalk); }
.js .scrib path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js .drawn .scrib path, .js .scrib.drawn path { transition: stroke-dashoffset 0.9s var(--ease); transition-delay: calc(var(--k, 0) * 0.18s + 0.2s); stroke-dashoffset: 0; }

/* ---------- buttons, tags, links ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 0.6em;
  padding: 0.95em 1.4em;
  font: 500 0.76rem/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase;
  text-decoration: none; transition: transform 0.2s var(--ease), color 0.2s;
}
.btn::before { content: ""; position: absolute; inset: 0; border-radius: 4px 7px 5px 6px; transition: background 0.2s, border-color 0.2s; }
.btn > * { position: relative; }
.btn-chalk { color: var(--slate); }
.btn-chalk::before { background: var(--yellow); }
.btn-chalk:hover { transform: translateY(-2px) rotate(-0.6deg); }
.btn-line { color: var(--chalk); }
.btn-line::before { border: 2px solid var(--dim); }
.btn-line:hover::before { border-color: var(--chalk); }
.btn-line:hover { transform: translateY(-2px); }

.link-chip {
  display: inline-flex; align-items: center; gap: 0.45em;
  padding: 7px 2px; font: 500 0.74rem/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--chalk); text-decoration: none;
  background: linear-gradient(var(--yellow), var(--yellow)) 0 100% / 100% 2px no-repeat;
  transition: color 0.2s, gap 0.2s;
}
.link-chip:hover { color: var(--yellow); gap: 0.7em; }

.tag { display: inline-block; padding: 3px 8px; font: 500 0.68rem/1.3 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; border-radius: 3px; }
.tag-red { color: var(--pink); border: 1.5px solid rgba(240, 138, 122, 0.6); }
.tag-gold { color: var(--yellow); border: 1.5px solid rgba(243, 211, 107, 0.6); }
.topic { font: italic 400 1rem var(--serif); color: var(--blue); text-transform: none; letter-spacing: 0; }
.topic::before { content: "— "; }

/* ---------- panels outlined in chalk ---------- */
.card { position: relative; background: rgba(255, 255, 255, 0.022); transition: transform 0.4s var(--ease), background 0.4s; }
.card::before { content: ""; position: absolute; inset: 0; border: 2px solid rgba(236, 235, 228, 0.34); border-radius: 6px 10px 7px 9px; filter: url(#chalk); pointer-events: none; transition: border-color 0.3s; }
.card:hover { background: rgba(255, 255, 255, 0.04); transform: translateY(-3px); }
.card:hover::before { border-color: var(--yellow); }

/* ---------- reveal ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); transition-delay: var(--d, 0s); }
.js .reveal.in { opacity: 1; transform: none; }

/* ---------- hero ---------- */
.chapter { position: relative; isolation: isolate; }
.hero { min-height: 100vh; min-height: 100svh; display: flex; align-items: center; padding: calc(var(--nav-h) + 48px) 0 80px; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr); gap: clamp(28px, 5vw, 80px); align-items: center; }

.latest { display: inline-flex; align-items: baseline; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; text-decoration: none; color: var(--chalk); }
.latest-tag { font-size: 1.5rem; line-height: 1; color: var(--pink); transform: rotate(-2deg); display: inline-block; }
.latest-title { font: italic 400 1.05rem/1.3 var(--serif); border-bottom: 1px dashed var(--dim); }
.latest .ic { align-self: center; color: var(--pink); }
.latest:hover .latest-title { color: var(--yellow); border-bottom-color: var(--yellow); }

.hero-name { position: relative; margin: 0 0 24px; color: var(--chalk); }
.hero-name .line { display: block; font: 400 clamp(3.6rem, 9.6vw, 8.6rem)/0.92 var(--display); letter-spacing: -0.01em; }
.hero-name .accent { font-style: italic; padding-left: 0.45em; }
.hero-name .ch { display: inline-block; }
.js .hero-name .ch { opacity: 0; animation: write 0.5s var(--ease) forwards; animation-delay: calc(var(--i) * 55ms + 0.15s); }
@keyframes write { from { opacity: 0; transform: translateY(0.12em) rotate(-3deg); } to { opacity: 1; transform: none; } }
.slashes { position: absolute; right: 4%; bottom: -4%; width: clamp(90px, 12vw, 160px); color: var(--pink); }

.hero-role { color: var(--yellow); margin-bottom: 22px; letter-spacing: 0.14em; min-height: 1.4em; }
.hero-lead { max-width: 33em; font-size: clamp(1.1rem, 1.5vw, 1.22rem); color: var(--chalk-2); }
.hero-lead em { color: var(--yellow); }
.hero-cta { display: flex; flex-wrap: wrap; gap: 14px; margin: 30px 0; }
.socials { display: flex; gap: 4px; }
.socials a { display: grid; place-items: center; width: 42px; height: 42px; color: var(--muted); transition: color 0.2s, transform 0.2s var(--ease); }
.socials a:hover { color: var(--yellow); transform: translateY(-2px) rotate(-6deg); }
.socials .ic { width: 20px; height: 20px; }

/* the portrait, in colour: set as a matrix of square pixels first, then resolved into the photo (as the coin did) */
.portrait { position: relative; justify-self: center; width: min(380px, 100% - 90px); margin: 0 0 0 60px; }
.portrait-stage { position: relative; cursor: crosshair; -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.portrait-img, .portrait-tiles {
  -webkit-mask-image: linear-gradient(to bottom, #000 66%, transparent 98%);
  mask-image: linear-gradient(to bottom, #000 66%, transparent 98%);
}
.portrait-img { display: block; width: 100%; height: auto; transition: opacity 1s var(--ease), transform 1.2s var(--ease); }
.portrait-tiles { position: absolute; inset: 0; width: 100%; height: 100%; transition: opacity 0.8s var(--ease); }
.js .portrait:not(.show-photo):not(.no-tiles) .portrait-img { opacity: 0; transform: scale(1.015); }
.portrait.show-photo .portrait-tiles, .portrait.no-tiles .portrait-tiles { opacity: 0; }
.mat-label { position: absolute; right: calc(100% + 34px); top: 46%; translate: 0 -50%; font: italic 400 2.6rem/1 var(--display); color: var(--chalk); white-space: nowrap; }
.portrait-stage .scrib path { stroke-width: 3; }
.portrait figcaption { margin-top: -14px; text-align: center; font: 600 1.55rem/1 var(--hand); color: var(--yellow); transform: rotate(-2deg); }
.tape { position: absolute; z-index: 2; top: -14px; width: 92px; height: 30px; background: rgba(232, 222, 190, 0.78); box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25); clip-path: polygon(3% 0, 100% 6%, 97% 100%, 0 92%); }
.tape-l { left: -22px; transform: rotate(-32deg); }
.tape-r { right: -22px; transform: rotate(28deg); }

/* ---------- a strip of formulas, like the ledge of the board ---------- */
.strip { position: relative; overflow: hidden; padding: 16px 0; border-block: 1px solid var(--line); background: rgba(0, 0, 0, 0.18); }
.marquee-track { display: flex; width: max-content; animation: marquee 60s linear infinite; }
.marquee-list { display: flex; flex: none; }
.marquee-list li { white-space: nowrap; font: italic 400 1.35rem/1 var(--display); color: var(--chalk); filter: url(#chalk); }
.marquee-list li::after { content: "·"; margin: 0 1.3em; color: var(--yellow); }
@keyframes marquee { to { transform: translateX(-50%); } }

/* ---------- the motto, glossed word by word; folded away until mad-genius mode writes it on the board ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
main .chapter.motto { display: grid; grid-template-rows: 0fr; padding: 0; visibility: hidden; transition: grid-template-rows 0.7s var(--ease) 0.3s, visibility 0s linear 1s; }
.mad .chapter.motto { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows 0.9s var(--ease), visibility 0s; }
.motto-fold { min-height: 0; overflow: hidden; }
.motto .wrap { padding: clamp(70px, 9vw, 120px) 0 clamp(10px, 2vw, 30px); }
/* each word is chalked in from the left, one after another, then the glosses and the translation */
.motto-tag, .m-gl, .motto-tr { opacity: 0; transition: opacity 0.4s var(--ease); }
.m-la { clip-path: inset(-30px calc(100% + 30px) -30px -30px); transition: clip-path 0.4s cubic-bezier(0.6, 0, 0.3, 1); }
.mad .motto-tag, .mad .m-gl, .mad .motto-tr { opacity: 1; transition: opacity 0.7s var(--ease) var(--d, 0.3s); }
.mad .m-la { clip-path: inset(-30px -30px -30px -30px); transition: clip-path 0.55s cubic-bezier(0.6, 0, 0.3, 1) var(--d, 0.4s); }
.mad .m-w:nth-child(2) .m-la { --d: 0.65s; }
.mad .m-w:nth-child(3) .m-la { --d: 0.9s; }
.mad .m-w:nth-child(4) .m-la { --d: 1.15s; }
.mad .m-w:nth-child(5) .m-la { --d: 1.4s; }
.mad .m-gl { --d: 1.5s; }
.mad .motto-tr { --d: 1.8s; }
.motto-tag { display: flex; align-items: baseline; gap: 14px; margin: 0 0 clamp(26px, 4vw, 44px); color: var(--faint); }
.motto-ex { font: italic 400 1.7rem/1 var(--display); letter-spacing: 0; text-transform: none; color: var(--yellow); }
.motto-line { margin: 0; }
.m-words { display: flex; flex-wrap: wrap; align-items: flex-start; column-gap: clamp(14px, 2.2vw, 32px); row-gap: 26px; }
.m-w { position: relative; display: flex; flex-direction: column; align-items: flex-start; }
.m-la { position: relative; font: 400 clamp(3rem, 8.2vw, 7.2rem)/0.92 var(--display); color: var(--chalk); letter-spacing: -0.01em; }
.m-gl { margin-top: 22px; padding-left: 2px; font: 500 clamp(0.68rem, 1.05vw, 0.82rem)/1.2 var(--mono); letter-spacing: 0.04em; color: var(--chalk-2); white-space: nowrap; }
.motto-tr { margin: clamp(26px, 3.6vw, 40px) 0 0; font: italic 400 clamp(1.45rem, 2.6vw, 2.1rem)/1.2 var(--display); color: var(--chalk-2); }
/* the aside, written last: feri is also the imperative of ferire */
.m-pun { position: absolute; left: 66%; bottom: calc(100% + 18px); white-space: nowrap; font: 700 1.55rem/1 var(--hand); color: var(--pink); transform: rotate(-7deg); transform-origin: left bottom; }
.m-pun-sm { display: none; margin: 14px 0 0; white-space: nowrap; font: 700 1.4rem/1 var(--hand); color: var(--pink); transform: rotate(-3deg); transform-origin: left; }
.m-pun, .m-pun-sm { opacity: 0; clip-path: inset(0 100% 0 0); transition: clip-path 0.3s, opacity 0.3s; }
.mad .m-pun, .mad .m-pun-sm { opacity: 1; clip-path: inset(0 0 0 0); transition: clip-path 0.9s cubic-bezier(0.6, 0, 0.3, 1) 2.2s, opacity 0.2s 2.2s; }

/* ---------- chapters ---------- */
.chapter:not(.hero) { padding: clamp(84px, 11vw, 140px) 0; }
.sec-head { position: relative; display: flex; flex-direction: column; align-items: flex-start; margin-bottom: clamp(36px, 5vw, 60px); }
.sec-no { margin: 0 0 14px 4px; font: italic 400 1.7rem/1 var(--display); color: var(--yellow); display: inline-block; position: relative; }
.sec-title { font: 400 clamp(2.8rem, 6.4vw, 5.2rem)/0.98 var(--display); color: var(--chalk); letter-spacing: -0.01em; display: inline-block; position: relative; }
.sec-note { position: absolute; right: 0; top: 18px; max-width: 16em; text-align: right; font: 600 1.45rem/1.1 var(--hand); color: var(--pink); transform: rotate(-3deg); }

/* ---------- the mad genius's corrections, beside some section titles ---------- */
.genius-fix { position: absolute; right: 0; top: 64px; display: grid; justify-items: end; gap: 2px; max-width: 52%; text-align: right; pointer-events: none; }
.genius-fix .katex { font-size: 1.45rem; }
.fix-wrong { position: relative; color: var(--chalk); opacity: 0.8; filter: url(#chalk); }
.fix-wrong .strike { left: 0; top: 0; }
.fix-wrong .strike path { stroke-width: 3; }
.fix-no { font: 700 1.9rem/1 var(--hand); color: var(--pink); margin: 2px 10px 0 0; filter: url(#chalk); }
.fix-right { display: flex; align-items: baseline; gap: 10px; color: var(--yellow); filter: url(#chalk); }
.fix-arrow { font: 700 1.6rem/1 var(--hand); }
.fix-right .katex { font-size: 1.55rem; }

/* the sequence: written, struck out, shouted at, corrected */
.js .genius-fix .fix-wrong, .js .genius-fix .fix-right { clip-path: inset(0 100% 0 0); transition: clip-path 0.75s cubic-bezier(0.6, 0, 0.3, 1); }
.js .genius-fix.go .fix-wrong { clip-path: inset(0 0 0 0); }
.js .genius-fix.go .fix-right { clip-path: inset(0 0 0 0); transition-delay: 1.75s; transition-duration: 0.9s; }
.js .genius-fix .strike path { stroke-dashoffset: 1; transition: stroke-dashoffset 0.3s cubic-bezier(0.7, 0, 0.3, 1); }
.js .genius-fix.go .strike path { stroke-dashoffset: 0; transition-delay: calc(0.85s + var(--k, 0) * 0.22s); }
.js .genius-fix .fix-no { opacity: 0; transform: scale(1.7) rotate(-14deg); }
.js .genius-fix.go .fix-no { animation: slam-no 0.5s cubic-bezier(0.2, 1.5, 0.4, 1) 1.35s forwards; }
@keyframes slam-no {
  0% { opacity: 0; transform: scale(1.7) rotate(-14deg); }
  55% { opacity: 1; transform: scale(0.92) rotate(-6deg); }
  70% { transform: translateX(-3px) rotate(-7deg); }
  85% { transform: translateX(3px) rotate(-5deg); }
  100% { opacity: 1; transform: rotate(-6deg); }
}

/* ---------- §1 research profile ---------- */
.about-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: clamp(28px, 5vw, 64px); align-items: start; }
.pull { position: relative; margin: 0; padding-top: 0.5em; font: italic 400 clamp(2rem, 3.4vw, 2.8rem)/1.1 var(--display); color: var(--chalk); }
.pull-mark { position: absolute; top: -0.25em; left: -0.06em; font: 400 3.4em/1 var(--display); color: var(--yellow); opacity: 0.85; filter: url(#chalk); }
.about-text p { color: var(--chalk-2); }
.about-text a, .tl-points a { color: var(--chalk); text-decoration: none; background: linear-gradient(var(--yellow), var(--yellow)) 0 100% / 100% 1.5px no-repeat; transition: color 0.2s; }
.about-text a:hover, .tl-points a:hover { color: var(--yellow); }

.focus { margin-top: clamp(52px, 7vw, 84px); }
.focus-head { color: var(--yellow); margin-bottom: 18px; }
.focus-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.pillar { display: flex; flex-direction: column; padding: 26px 24px 22px; text-decoration: none; }
.pillar-num { font: italic 400 2.4rem/1 var(--display); color: var(--yellow); margin-bottom: 12px; filter: url(#chalk); }
.pillar-kicker { display: block; color: var(--pink); font-size: 0.64rem; margin: -4px 0 8px; }
.pillar h3 { font: 400 1.85rem/1.05 var(--display); color: var(--chalk); margin-bottom: 10px; }
.pillar-main h3 { font-size: 2.3rem; }
.pillar p { color: var(--chalk-2); font-size: 1rem; }
.pillar-topics { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 2px 0 18px; }
.pillar-topics li { font: 500 0.72rem/1.4 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk); border-bottom: 1.5px solid var(--yellow); }
.pillar-ref { margin-top: auto; padding-top: 14px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 0.64rem; text-transform: none; letter-spacing: 0.03em; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(52px, 7vw, 84px); border-top: 1px solid var(--line); }
.stat { display: flex; flex-direction: column; gap: 6px; padding: 22px 18px 4px; border-right: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat:last-child { border-right: 0; }
.stat-num { font: 400 clamp(3rem, 5.4vw, 4.6rem)/1 var(--display); color: var(--chalk); filter: url(#chalk); }
.stat-num > span:not(.count) { color: var(--yellow); }
.stat-label { color: var(--muted); font-size: 0.95rem; line-height: 1.45; }

/* ---------- §2 interests ---------- */
.interests { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.interest { display: grid; grid-template-columns: 54px minmax(0, 1fr); column-gap: 18px; padding: 24px 24px 22px; }
.interest .glyph { grid-row: 1 / span 3; width: 54px; height: 54px; fill: none; stroke: var(--chalk); stroke-width: 1.6; stroke-linejoin: round; filter: url(#chalk); }
.interest .glyph .g-accent { stroke: var(--yellow); }
.interest > :not(.glyph) { grid-column: 2; }
.card-idx { color: var(--yellow); margin-bottom: 4px; }
.interest h3 { font: 400 1.85rem/1.05 var(--display); color: var(--chalk); margin-bottom: 8px; }
.interest p:not(.card-idx) { color: var(--chalk-2); font-size: 1rem; margin: 0; }

/* ---------- §3 publications ---------- */
.pub-featured { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 0.95fr); gap: clamp(26px, 4vw, 48px); padding: clamp(22px, 3.5vw, 40px); margin-bottom: 26px; }
.pub-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; color: var(--muted); margin-bottom: 14px; }
.pub-title { font: 400 clamp(1.85rem, 3vw, 2.5rem)/1.06 var(--display); color: var(--chalk); margin-bottom: 10px; }
.pub-title.sm { font-size: clamp(1.5rem, 2.2vw, 1.8rem); line-height: 1.1; }
.pub-trans { font: italic 400 1.05rem/1.4 var(--serif); color: var(--muted); margin-bottom: 8px; }
.pub-venue { color: var(--yellow); margin-bottom: 16px; font-size: 0.72rem; }
.pub-venue em { text-transform: none; font: italic 400 1.15em var(--serif); letter-spacing: 0; }
.pub-authors { font-size: 0.98rem; color: var(--chalk-2); }
.pub-abs { color: var(--chalk-2); }
.findings { display: grid; gap: 12px; margin: 20px 0; }
.findings li { display: grid; grid-template-columns: 34px 1fr; gap: 12px; align-items: start; }
.findings p { margin: 0; font-size: 1.02rem; }
.f-n { display: grid; place-items: center; width: 34px; height: 34px; font: italic 400 1.2rem/1 var(--display); color: var(--yellow); position: relative; }
.f-n::before { content: ""; position: absolute; inset: 0; border: 2px solid var(--yellow); border-radius: 50% 46% 52% 48%; filter: url(#chalk); }
.kw { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 20px; }
.kw li { font: 500 0.7rem/1.5 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.kw li::before { content: "#"; color: var(--yellow); }
.pub-links { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-top: auto; }

.fig-rope { position: relative; margin: 0; align-self: start; display: flex; flex-direction: column; gap: 14px; padding: clamp(14px, 2.2vw, 22px); background: rgba(0, 0, 0, 0.16); }
.fig-rope::before { content: ""; position: absolute; inset: 0; border: 2px dashed rgba(236, 235, 228, 0.3); border-radius: 6px; pointer-events: none; }
.fig-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.fig-tabs button { padding: 8px 11px; font: 500 0.68rem/1.2 var(--mono); letter-spacing: 0.06em; text-transform: uppercase; color: var(--chalk); border: 1.5px solid var(--dim); border-radius: 4px; transition: background 0.2s, color 0.2s, border-color 0.2s; }
.fig-tabs button:hover { border-color: var(--chalk); }
.fig-tabs button[aria-pressed="true"] { background: var(--chalk); color: var(--slate); border-color: var(--chalk); }
.fig-tabs button[data-mode="mask"][aria-pressed="true"] { background: var(--pink); border-color: var(--pink); }
.fig-tabs button[data-mode="rope"][aria-pressed="true"] { background: var(--blue); border-color: var(--blue); }
.fig-plot { display: grid; grid-template-columns: 16px 1fr; gap: 6px; }
.axis-y { writing-mode: vertical-rl; transform: rotate(180deg); color: var(--faint); font-size: 0.6rem; text-align: right; }
.axis-x { grid-column: 2; color: var(--faint); font-size: 0.6rem; }
.head-grid { display: grid; grid-template-columns: repeat(32, 1fr); gap: 2px; aspect-ratio: 1; }
.head-grid i { display: block; aspect-ratio: 1; border-radius: 1px; background: rgba(236, 235, 228, var(--a, 0.1)); transition: background 0.4s, opacity 0.4s; transition-delay: var(--dl, 0s); }
.head-grid i.rh { background: var(--yellow); }
.fig-rope[data-mode="mask"] .head-grid i.rh {
  background:
    linear-gradient(45deg, transparent 38%, var(--pink) 38% 62%, transparent 62%),
    linear-gradient(-45deg, transparent 38%, var(--pink) 38% 62%, transparent 62%);
}
.fig-rope[data-mode="rope"] .head-grid i { opacity: 0.5; }
.dims-strip { display: grid; grid-template-columns: repeat(128, 1fr); gap: 1px; height: 18px; }
.dims-strip i { display: block; background: rgba(236, 235, 228, var(--a, 0.5)); transition: background 0.4s; transition-delay: var(--dl, 0s); }
.fig-rope[data-mode="rope"] .dims-strip i.low { background: rgba(140, 196, 230, 0.22); }
.dims-legend { display: flex; justify-content: space-between; margin-top: 6px; color: var(--faint); font-size: 0.58rem; }
.recall { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 6px 12px; }
.recall-label { color: var(--muted); font-size: 0.66rem; }
.recall-num { grid-row: span 2; font: 400 3rem/0.9 var(--display); color: var(--chalk); font-variant-numeric: tabular-nums; transition: color 0.3s; }
.fig-rope[data-mode="mask"] .recall-num { color: var(--pink); }
.fig-rope[data-mode="rope"] .recall-num { color: var(--blue); }
.recall-bar { height: 5px; background: rgba(236, 235, 228, 0.12); position: relative; border-radius: 3px; }
.recall-bar span { position: absolute; inset: 0; background: var(--yellow); border-radius: 3px; transform-origin: 0 50%; transition: transform 1s var(--ease); }
.fig-rope figcaption { display: flex; flex-wrap: wrap; gap: 8px; color: var(--faint); font-size: 0.6rem; line-height: 1.6; }
.fig-no { color: var(--yellow); text-transform: none; }

.pub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.pub-card { display: flex; flex-direction: column; padding: clamp(20px, 2.6vw, 28px); }
.pub-card > p:not(.pub-meta):not(.pub-venue):not(.pub-trans):not(.pub-authors) { color: var(--chalk-2); font-size: 1rem; }
.viz-bits, .viz-bars, .viz-dots { margin: 6px 0 18px; padding: 14px; border: 1px dashed var(--line); border-radius: 4px; }
.viz-note { color: var(--faint); font-size: 0.6rem; margin: 10px 0 0; }
.bits-row { display: grid; grid-template-columns: 44px 1fr; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--muted); }
.bits-row .mono { font-size: 0.66rem; }
.bits { --c: var(--chalk); height: 14px; width: calc(var(--n) / 16 * 100%); background: repeating-linear-gradient(90deg, var(--c) 0 calc(100% / var(--n) - 2px), transparent 0 calc(100% / var(--n))); transform-origin: 0 50%; filter: url(#chalk); }
.bits-row:nth-child(2) .bits { --c: var(--yellow); }
.bits-row:nth-child(3) .bits { --c: var(--pink); }
.js .viz-bits .bits, .js .viz-bars .bar { transform: scaleX(0); transition: transform 1.3s var(--ease) 0.3s; }
.js .in .viz-bits .bits, .js .in .viz-bars .bar { transform: scaleX(1); }
.bar-row { display: grid; gap: 4px; margin-bottom: 10px; }
.bar-row .mono { font-size: 0.64rem; color: var(--muted); text-transform: none; letter-spacing: 0.04em; }
.bar { position: relative; height: 22px; width: calc(var(--v) * 100%); background: rgba(236, 235, 228, 0.2); transform-origin: 0 50%; border-radius: 3px; }
.bar b { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font: 500 0.72rem var(--mono); color: var(--chalk); }
.bar-row.hl .bar { background: var(--yellow); }
.bar-row.hl .bar b { color: var(--slate); }
.bar-row.hl .mono { color: var(--yellow); }
.plateaus { display: flex; gap: 6px; margin-bottom: 14px; }
.plateaus li { padding: 3px 8px; font-size: 0.64rem; color: var(--pink); border: 1px dashed rgba(240, 138, 122, 0.6); border-radius: 3px; }
.dots-row { display: grid; grid-template-columns: 74px repeat(8, 14px) auto; align-items: center; gap: 6px; margin-bottom: 8px; }
.dots-row .mono { font-size: 0.62rem; color: var(--muted); }
.dots-row b { margin-left: 8px; color: var(--yellow); font-size: 0.72rem; }
.dset { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--dim); }
.dset.on { background: var(--chalk); border-color: var(--chalk); }

/* ---------- §4 projects ---------- */
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.project { display: flex; flex-direction: column; padding: 24px 24px 18px; text-decoration: none; }
.project-tag { color: var(--pink); margin-bottom: 12px; font-size: 0.68rem; }
.project h3 { font: 400 1.85rem/1.05 var(--display); color: var(--chalk); margin-bottom: 10px; }
.project p:not(.project-tag) { color: var(--chalk-2); font-size: 1rem; }
.project-links { display: flex; gap: 20px; margin-top: auto; }
.project-go { margin-top: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 0; font-size: 0.7rem; color: var(--yellow); text-decoration: none; align-self: flex-start; }
.project-links .project-go { margin-top: 0; }
.project:hover .project-go, .project-go:hover { color: var(--chalk); }

/* ---------- §5 education ---------- */
.edu { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.edu-card { padding: clamp(22px, 3vw, 32px); }
.edu-date { color: var(--yellow); margin-bottom: 12px; font-size: 0.72rem; }
.edu-card h3 { font: 400 clamp(1.7rem, 2.6vw, 2.1rem)/1.06 var(--display); color: var(--chalk); margin-bottom: 8px; }
.edu-school { margin-bottom: 16px; color: var(--chalk-2); }
.edu-school .mono { color: var(--faint); }
.edu-focus { color: var(--chalk-2); font-size: 1rem; padding-left: 14px; border-left: 2px solid var(--yellow); margin: 0; }
.focus-label { display: block; color: var(--yellow); font-size: 0.64rem; margin-bottom: 4px; }
.edu-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.edu-badges li { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1.5px solid var(--dim); border-radius: 4px; font-size: 0.95rem; }
.edu-badges b { font: 400 1.5rem/1 var(--display); color: var(--yellow); }
.edu-badges .ic { fill: var(--yellow); width: 14px; height: 14px; }
.edu-note { color: var(--chalk-2); font-size: 1rem; margin: 0; }

/* ---------- §6 experience ---------- */
.timeline { position: relative; }
.timeline::before { content: ""; position: absolute; left: 172px; top: 10px; bottom: 10px; width: 2px; background: var(--dim); filter: url(#chalk); }
.tl-item { position: relative; display: grid; grid-template-columns: 150px 46px minmax(0, 1fr); padding-bottom: clamp(36px, 5vw, 56px); }
.tl-item:last-child { padding-bottom: 0; }
.tl-date { color: var(--yellow); padding-top: 10px; text-align: right; font-size: 0.72rem; }
.tl-node { justify-self: center; margin-top: 10px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--chalk); background: var(--slate); }
.tl-item:first-child .tl-node { background: var(--yellow); border-color: var(--yellow); }
.tl-role { font: 400 clamp(1.7rem, 2.8vw, 2.2rem)/1.06 var(--display); color: var(--chalk); }
.tl-org { margin: 6px 0 14px; font-size: 1.05rem; color: var(--chalk-2); }
.tl-org .mono { color: var(--faint); }
.tl-points { display: grid; gap: 10px; max-width: 62em; }
.tl-points li { position: relative; padding-left: 24px; color: var(--chalk-2); font-size: 1.02rem; }
.tl-points li::before { content: "→"; position: absolute; left: 0; color: var(--yellow); }
.metrics { display: flex; flex-wrap: wrap; gap: 8px 20px; margin-bottom: 14px; }
.metrics li { display: inline-flex; align-items: baseline; gap: 8px; font-size: 0.95rem; color: var(--muted); }
.metrics b { font: 400 1.8rem/1 var(--display); color: var(--yellow); filter: url(#chalk); }

/* ---------- §7 skills ---------- */
.skills-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 0.8fr); gap: clamp(26px, 4vw, 50px); align-items: start; }
.skills { margin: 0; }
.skill-row { display: grid; grid-template-columns: 140px 1fr; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.skill-row:first-child { border-top: 1px solid var(--line); }
.skill-row dt { color: var(--yellow); padding-top: 6px; font-size: 0.72rem; }
.skill-row dd { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips li { padding: 4px 10px; font: 500 0.76rem/1.5 var(--mono); letter-spacing: 0.02em; color: var(--chalk); border: 1px solid var(--line); border-radius: 4px; transition: background 0.2s, color 0.2s; }
.chips li:hover { background: var(--chalk); color: var(--slate); }
.langs { padding: 24px 24px 22px; }
.langs-title { font: 400 1.85rem/1.05 var(--display); color: var(--chalk); margin-bottom: 18px; }
.lang-list { display: grid; gap: 16px; }
.lang-list li { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.lang-lv { color: var(--muted); font-size: 0.66rem; text-align: right; }
.cefr { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.cefr i { height: 7px; border-radius: 2px; background: rgba(236, 235, 228, 0.12); }
.cefr[data-lv="6"] i, .cefr[data-lv="5"] i:nth-child(-n + 5), .cefr[data-lv="2"] i:nth-child(-n + 2) { background: var(--yellow); }
.cefr-scale { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 8px 0 0; color: var(--faint); font-size: 0.58rem; text-align: center; }

/* ---------- §8 contact ---------- */
.contact-inner { max-width: 900px; }
.contact-big { font: italic 400 clamp(2.8rem, 7vw, 5.8rem)/1 var(--display); color: var(--chalk); margin-bottom: 20px; }
.contact-big em { color: var(--yellow); }
.contact-sub { color: var(--chalk-2); max-width: 36em; font-size: 1.15rem; margin-bottom: 30px; }
.email-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 40px; }
.email { font: italic 400 clamp(1.5rem, 3.6vw, 2.4rem)/1.3 var(--display); color: var(--chalk); text-decoration: none; word-break: break-all; padding-bottom: 2px; background: linear-gradient(var(--yellow), var(--yellow)) 0 100% / 100% 2px no-repeat; }
.email:hover { color: var(--yellow); }
.copy { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1.5px solid var(--dim); border-radius: 4px; font: 500 0.7rem/1 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; color: var(--chalk); transition: border-color 0.2s, color 0.2s; }
.copy:hover { border-color: var(--yellow); color: var(--yellow); }
.copy-done { display: none; color: var(--yellow); }
.copy.done .copy-label { display: none; }
.copy.done .copy-done { display: inline; }
.contact-links { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 24px; border-top: 1px solid var(--line); }
.contact-links li { border-bottom: 1px solid var(--line); min-width: 0; }
.contact-links a { display: flex; align-items: center; gap: 12px; padding: 16px 0; color: var(--chalk); text-decoration: none; transition: color 0.2s, padding 0.3s var(--ease); }
.contact-links a .mono { margin-left: auto; color: var(--faint); font-size: 0.62rem; text-transform: none; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.contact-links a:hover { color: var(--yellow); padding-left: 6px; }
.contact-links .ic { width: 18px; height: 18px; }

/* ---------- the last board: a theorem, its proof, and the block it all runs on ---------- */
.footer { padding: clamp(70px, 9vw, 110px) 0 36px; border-top: 1px solid var(--line); }
.final { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: clamp(30px, 5vw, 70px); align-items: center; margin-bottom: clamp(50px, 7vw, 80px); }
.thm-head { font: italic 400 clamp(2.4rem, 4.6vw, 3.6rem)/1 var(--display); color: var(--yellow); margin: 0 0 14px; }
.thm-claim { font: italic 400 clamp(1.6rem, 2.8vw, 2.25rem)/1.2 var(--display); color: var(--chalk); margin-bottom: 26px; max-width: 26em; }
.thm-claim em { color: var(--yellow); }
.thm-proof { font: italic 400 1.4rem/1 var(--display); color: var(--chalk); margin-bottom: 12px; }
.proof { display: grid; gap: 12px; counter-reset: none; }
.proof li { display: grid; grid-template-columns: 40px 1fr; gap: 10px; color: var(--chalk-2); font-size: 1.02rem; }
.p-n { font: italic 400 1.25rem/1.3 var(--display); color: var(--yellow); }
.proof cite { display: block; margin-top: 2px; font: 500 0.66rem/1.4 var(--mono); letter-spacing: 0.08em; text-transform: uppercase; font-style: normal; color: var(--faint); }
/* the tombstone that ends a proof: a chalk square right after its last sentence */
.qed { display: inline-block; width: 0.6em; height: 0.6em; margin-left: 0.45em; background: var(--chalk); border-radius: 1px; }
.sig { margin: 28px 0 0; text-align: right; font: 700 2.4rem/1 var(--hand); color: var(--yellow); transform: rotate(-4deg); }

.block-fig { margin: 0; text-align: center; }
.t-block.scrib { position: relative; width: 100%; max-width: 440px; height: auto; margin-inline: auto; }
.t-block path { stroke-width: 2.2; }
.t-block path.pink { stroke: var(--pink); }
.t-block text { font: 700 22px var(--hand); fill: var(--chalk); stroke: none; opacity: 0; transition: opacity 0.8s var(--ease) 1.6s; }
.t-block text.sm { font-size: 20px; fill: var(--muted); }
.t-block text.big { font: italic 400 30px var(--display); fill: var(--yellow); }
.t-block text.pink { fill: var(--pink); }
.t-block.drawn text { opacity: 1; }
.block-fig figcaption { margin-top: 4px; font: 600 1.35rem/1 var(--hand); color: var(--yellow); transform: rotate(-2deg); }

.colophon { color: var(--faint); margin-bottom: 24px; }
.footer-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; margin: 0; color: var(--faint); font-size: 0.95rem; }
.to-top { color: var(--yellow); text-decoration: none; padding: 4px 0; }

/* ---------- easter egg: one axiom ---------- */
.egg { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; align-content: center; gap: 24px; padding: 24px; background: rgba(20, 25, 23, 0.86); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); cursor: pointer; }
.egg[hidden] { display: none; }
.egg-card { position: relative; margin: 0; width: min(300px, 76vw); padding: 18px 18px 60px; background: #f3f1ea; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, 0.9); transform: rotate(-3deg); }
.egg.on .egg-card { animation: slam 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) both; }
@keyframes slam { from { transform: scale(1.5) rotate(8deg); opacity: 0; } to { transform: scale(1) rotate(-3deg); opacity: 1; } }
.egg-card img { width: 100%; height: auto; }
.egg-card figcaption { position: absolute; left: 0; right: 0; bottom: 16px; text-align: center; font: 600 1.45rem/1 var(--hand); color: #2a2a28; }
.egg-note { margin: 0; text-align: center; font-size: 1.9rem; line-height: 1.1; color: var(--yellow); transform: rotate(-2deg); }

/* ---------- mad genius mode ---------- */
.mad-toggle {
  position: fixed; z-index: 60; right: 22px; bottom: 22px;
  display: flex; align-items: center; gap: 10px; flex-direction: row-reverse;
}
.mad-ico {
  display: grid; place-items: center; width: 54px; height: 54px;
  font: italic 400 2.1rem/1 var(--display); color: var(--yellow);
  border: 2px solid rgba(243, 211, 107, 0.7); border-radius: 50% 46% 52% 48%;
  background: rgba(24, 30, 27, 0.85);
  transition: transform 0.4s var(--ease), color 0.2s, border-color 0.2s;
}
.mad-toggle:hover .mad-ico { transform: rotate(-12deg) scale(1.06); }
.mad-label { font-size: 1.35rem; color: var(--yellow); opacity: 0; transform: translateX(8px); transition: opacity 0.3s, transform 0.3s var(--ease); white-space: nowrap; }
.mad-toggle:hover .mad-label, .mad-toggle:focus-visible .mad-label { opacity: 1; transform: none; }
.mad .mad-ico { color: var(--slate); background: var(--pink); border-color: var(--pink); }
.mad-clock {
  position: fixed; z-index: 55; right: 26px; top: calc(var(--nav-h) + 18px);
  font-size: 2.6rem; line-height: 1; color: var(--pink);
  opacity: 0; transform: rotate(-6deg) scale(0.6); transition: opacity 0.4s, transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
  pointer-events: none;
}
.mad .mad-clock { opacity: 0.9; transform: rotate(-6deg); }
.mad .board { filter: brightness(0.8); }
.board { transition: filter 0.8s var(--ease); }

.mad-layer { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.mad-item { position: absolute; transform: rotate(var(--r, 0deg)); white-space: nowrap; transition: opacity 0.7s var(--ease), filter 0.7s var(--ease), clip-path 0.45s cubic-bezier(0.6, 0, 0.3, 1), scale 0.35s cubic-bezier(0.2, 1.6, 0.4, 1); }
.mad-tex, .mad-note { font-size: var(--s, 1.4rem); filter: url(#chalk); clip-path: inset(0 100% 0 0); }
.mad-tex.white, .mad-note.white { color: rgba(241, 240, 234, 0.62); }
.mad-tex.yellow, .mad-note.yellow { color: var(--yellow); opacity: 0.8; }
.mad-tex.pink, .mad-note.pink { color: var(--pink); opacity: 0.85; }
.mad-note { font-weight: 700; }
.mad-item.on { clip-path: inset(0 0 0 0); }
.mad-svg .scrib { position: relative; }
.mad-svg .scrib.white { color: rgba(241, 240, 234, 0.55); }
.mad-svg .scrib path { stroke-width: 2.6; }
.js .mad-svg .scrib.drawn path { transition-delay: calc(var(--k, 0) * 0.08s); transition-duration: 0.45s; }
.mad-layer.erase .mad-item { opacity: 0; filter: blur(6px); transition-delay: 0s; }

/* =========================================================
   responsive
   ========================================================= */
@media (max-width: 1100px) {
  .pub-featured { grid-template-columns: 1fr; }
  .fig-rope { max-width: 560px; }
  .pub-grid, .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .focus-grid { grid-template-columns: 1fr 1fr; }
  .focus-grid .pillar-main { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(3) { padding-left: 0; }
  .stat:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .contact-links { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  :root { --nav-h: 58px; }
  .burger { display: block; }
  .brand-sub { display: none; }
  .nav-links {
    position: fixed; inset: var(--nav-h) 0 auto 0;
    height: calc(100vh - var(--nav-h)); height: calc(100dvh - var(--nav-h));
    flex-direction: column; justify-content: center; gap: 0;
    padding: 24px var(--gutter) 80px;
    background: var(--slate);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 0.3s, transform 0.4s var(--ease), visibility 0.3s;
  }
  .nav.open .nav-links { opacity: 1; visibility: visible; transform: none; }
  .nav-links a { font: italic 400 2.4rem/1.15 var(--display); letter-spacing: 0; text-transform: none; color: var(--chalk); padding: 10px 0; border-bottom: 1px solid var(--line); }
  .nav-links a.active { color: var(--yellow); }
  .nav-links a.active::after { display: none; }
  .nav-tools { margin-left: auto; }
  .lang { padding: 11px 12px; }

  .hero { min-height: 0; padding-top: calc(var(--nav-h) + 32px); }
  .hero-grid { grid-template-columns: 1fr; }
  .portrait { width: min(290px, 100% - 70px); margin-left: 52px; }
  .mat-label { font-size: 2rem; right: calc(100% + 22px); }
  .sec-note { position: static; text-align: left; margin: 10px 0 0; max-width: none; }
  .genius-fix { position: static; justify-items: start; text-align: left; max-width: 100%; margin-top: 18px; }
  .genius-fix .katex { font-size: 1.15rem; }
  .fix-right .katex { font-size: 1.22rem; }
  .fix-no { font-size: 1.55rem; margin: 2px 0 0 8px; }
  .about-grid, .skills-grid, .edu, .final { grid-template-columns: 1fr; }
  .block-fig { max-width: 380px; margin-inline: auto; }

  .timeline::before { left: 6px; }
  .tl-item { grid-template-columns: 14px minmax(0, 1fr); column-gap: 18px; }
  .tl-date { grid-column: 2; grid-row: 1; text-align: left; padding-top: 0; margin-bottom: 4px; }
  .tl-node { grid-column: 1; grid-row: 1 / span 2; margin-top: 4px; }
  .tl-body { grid-column: 2; }
}

@media (max-width: 640px) {
  body { font-size: 1.04rem; }
  .chapter:not(.hero) { padding: 64px 0; }
  .motto .wrap { padding: 56px 0 8px; }
  .m-pun { display: none; }
  .m-pun-sm { display: block; }
  .sec-head { margin-bottom: 32px; }
  .slashes { width: 80px; right: 0; }
  .interests, .projects, .pub-grid, .focus-grid, .contact-links { grid-template-columns: 1fr; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat { padding: 18px 12px 4px; }
  .interest { grid-template-columns: 44px minmax(0, 1fr); padding: 20px 18px; }
  .interest .glyph { width: 44px; height: 44px; }
  .skill-row { grid-template-columns: 1fr; gap: 8px; }
  .skill-row dt { padding-top: 0; }
  .dots-row { grid-template-columns: 64px repeat(8, 12px) auto; gap: 5px; }
  .dset { width: 12px; height: 12px; }
  .head-grid { gap: 1px; }
  .link-chip, .project-go { padding: 13px 2px; }
  .fig-tabs button { padding: 11px 12px; }
  .copy { padding: 12px 14px; }
  .to-top { padding: 12px 0; }
  .latest .ic { display: none; }
  .mad-toggle { right: 14px; bottom: 14px; }
  .footer { padding-bottom: 92px; } /* room for the ∞ button */
  .mad-ico { width: 48px; height: 48px; font-size: 1.8rem; }
  .mad-label { display: none; }
  .mad-clock { right: 16px; font-size: 2rem; }
  .ghost { font-size: calc(var(--s, 1.6rem) * 0.62); }
  .ghost.hide-sm, .scrib.hide-sm { display: none; }
}

@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; transition-delay: 0s !important; }
  .marquee-track { animation: none; }
  .js .scrib path { stroke-dashoffset: 0; }
  .js .genius-fix .fix-wrong, .js .genius-fix .fix-right { clip-path: none; }
  .js .genius-fix .fix-no { opacity: 1; transform: rotate(-6deg); animation: none; }
}
