/* Shibinlal Mappidichery: editorial, minimal, light and dark. No framework. */

/* ---------- Tokens ---------- */

:root {
	--paper: #f7f5f0;
	--surface: #efebe3;
	--ink: #17181a;
	--ink-2: #3d3f44;
	--muted: #69645d;
	--line: #e0dbd1;
	--accent: #8c3a2b;
	--sphere-hi: #fffdf9;
	--sphere-mid: #f0ece4;
	--sphere-lo: #d3cab9;

	--serif: "Newsreader", Georgia, "Times New Roman", serif;
	--sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

	--wide: 68rem;
	--gutter: clamp(1.25rem, 5vw, 3rem);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--paper: #111213;
		--surface: #1a1b1d;
		--ink: #eeebe5;
		--ink-2: #c9c5be;
		--muted: #9a958d;
		--line: #27292c;
		--accent: #e3a08d;
		--sphere-hi: #2c2d30;
		--sphere-mid: #1d1e20;
		--sphere-lo: #141516;
	}
}
:root[data-theme="dark"] {
	--paper: #111213;
	--surface: #1a1b1d;
	--ink: #eeebe5;
	--ink-2: #c9c5be;
	--muted: #9a958d;
	--line: #27292c;
	--accent: #e3a08d;
	--sphere-hi: #2c2d30;
	--sphere-mid: #1d1e20;
	--sphere-lo: #141516;
}

/* ---------- Base ---------- */

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

html {
	scroll-behavior: smooth;
	scroll-padding-top: 5rem;
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--paper);
	color: var(--ink-2);
	font-family: var(--serif);
	font-size: 1.1875rem;
	line-height: 1.6;
	font-optical-sizing: auto;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--ink); margin: 0; font-weight: 400; }
p { margin: 0 0 1em; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
em { font-style: italic; }
ol, ul, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

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

/* Small sans labels: dates, row names, kickers */
.when, .rows dt, .kicker, .sem-size {
	font-family: var(--sans);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	line-height: 1.4;
}

.skip {
	position: absolute;
	left: -999px;
	top: 0.5rem;
	padding: 0.5rem 0.75rem;
	background: var(--ink);
	color: var(--paper);
	font-family: var(--sans);
	font-size: 0.9rem;
	z-index: 20;
}
.skip:focus { left: 0.5rem; }

/* ---------- Top bar ---------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 10;
	background: color-mix(in srgb, var(--paper) 88%, transparent);
	backdrop-filter: saturate(1.3) blur(12px);
	-webkit-backdrop-filter: saturate(1.3) blur(12px);
	border-bottom: 1px solid var(--line);
}
.topbar-inner {
	max-width: var(--wide);
	margin: 0 auto;
	padding: 0.9rem var(--gutter);
	display: flex;
	align-items: center;
	gap: 1.75rem;
}
.wordmark {
	font-size: 1.15rem;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
	margin-right: auto;
}
.nav { display: flex; gap: 1.75rem; font-family: var(--sans); font-size: 0.85rem; }
.nav a {
	color: var(--muted);
	text-decoration: none;
	white-space: nowrap;
	padding: 0.2rem 0;
	border-bottom: 1px solid transparent;
	transition: color 0.2s, border-color 0.2s;
}
.nav a:hover, .nav a[aria-current="true"] { color: var(--ink); border-bottom-color: var(--ink); }

.theme-toggle {
	flex: 0 0 auto;
	width: 2.25rem;
	height: 2.25rem;
	display: grid;
	place-items: center;
	border: 1px solid var(--line);
	border-radius: 50%;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
	transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--ink); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; fill: none; stroke: currentColor; stroke-width: 1.5; }
.theme-toggle svg path { fill: currentColor; stroke: none; }

@media (max-width: 760px) {
	.topbar-inner { flex-wrap: wrap; row-gap: 0.5rem; padding-top: 0.75rem; padding-bottom: 0.6rem; }
	.nav { order: 3; width: 100%; gap: 1.4rem; overflow-x: auto; scrollbar-width: none; }
	.nav::-webkit-scrollbar { display: none; }
}
@media (max-width: 420px) { .nav-contact { display: none; } }

/* ---------- Hero ---------- */

.hero {
	max-width: var(--wide);
	margin: 0 auto;
	padding: clamp(4rem, 14vh, 8rem) var(--gutter) clamp(3.5rem, 10vh, 6rem);
}
.hero-name {
	font-weight: 300;
	font-size: clamp(2.7rem, 5.4vw, 4.5rem);
	line-height: 1.02;
	letter-spacing: -0.025em;
	margin-bottom: 1.5rem;
}
.hero-lede {
	font-size: clamp(1.3rem, 2.3vw, 1.6rem);
	line-height: 1.42;
	color: var(--ink-2);
	max-width: 34rem;
	margin-bottom: 2.25rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

.btn {
	display: inline-flex;
	align-items: center;
	padding: 0.75rem 1.4rem;
	font-family: var(--sans);
	font-size: 0.875rem;
	font-weight: 500;
	text-decoration: none;
	border: 1px solid var(--ink);
	border-radius: 999px;
	transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }
.btn-quiet { color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--ink); }

/* Schematic figures in the research section (drawn by physics.js): one slider each */
.schematic {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
	align-items: center;
	gap: 1.5rem;
	margin: 0;
	padding: 1.25rem 1.5rem;
	border: 1px solid var(--line);
	border-radius: 6px;
}
html:not(.js) .schematic { display: none; }
.schematic-art { cursor: pointer; }
.schematic-art svg { display: block; width: 100%; height: auto; overflow: visible; }
.schematic-label {
	font-family: var(--sans);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	margin: 0 0 0.75rem;
}
.schematic-ctl {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr) 4.25rem;
	align-items: center;
	gap: 0.85rem;
	margin: 0 0 0.4rem;
}
.schematic-ctl label { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.schematic-ctl input[type="range"] { margin: 0; }
.schematic-ctl output { font-size: 1.1rem; color: var(--ink); text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.schematic-read { font-size: 1rem; line-height: 1.5; color: var(--ink-2); margin: 0; min-height: 3em; }
.schematic-read strong { font-weight: 500; color: var(--ink); }
.schematic-note { font-family: var(--sans); font-size: 0.75rem; line-height: 1.5; color: var(--muted); margin: 0.75rem 0 0; }
/* Schematics start closed: a quiet hint row opens them */
.fig-toggle { margin: 1.75rem 0 0; }
html:not(.js) .fig-toggle { display: none; }
.fig-toggle + .physics-link { margin-top: 1rem; }
.fig-toggle > summary {
	display: flex;
	align-items: center;
	gap: 0.9rem;
	padding: 0.8rem 1.1rem;
	border: 1px dashed var(--line);
	border-color: color-mix(in srgb, var(--muted) 45%, transparent);
	border-radius: 6px;
	cursor: pointer;
	list-style: none;
	transition: border-color 0.2s;
}
.fig-toggle > summary::-webkit-details-marker { display: none; }
.fig-toggle > summary:hover, .fig-toggle[open] > summary { border-color: var(--accent); border-style: solid; }
.fig-toggle-icon {
	position: relative;
	flex: none;
	width: 1.6rem; height: 1.6rem;
	border: 1px solid var(--accent);
	border-radius: 50%;
}
.fig-toggle-icon::before, .fig-toggle-icon::after {
	content: "";
	position: absolute;
	left: 50%; top: 50%;
	width: 0.6rem; height: 1.5px;
	margin: -0.75px 0 0 -0.3rem;
	background: var(--accent);
	transition: transform 0.25s;
}
.fig-toggle-icon::after { transform: rotate(90deg); }
.fig-toggle[open] .fig-toggle-icon::after { transform: rotate(0deg); }
.fig-toggle-text { display: grid; gap: 0.15rem; min-width: 0; }
.fig-toggle-label { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.fig-toggle-hint { font-size: 1rem; line-height: 1.45; color: var(--ink-2); }
.fig-toggle > figure { margin-top: 0.6rem; }
.fig-toggle[open] > figure { animation: fig-in 0.45s ease both; }
@keyframes fig-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
/* MSc: the recording setup, step by step */
.setup { margin: 0; padding: 1.25rem 1.5rem 1.1rem; border: 1px solid var(--line); border-radius: 6px; }
html:not(.js) .setup { display: none; }
.setup-svg { display: block; width: 100%; height: auto; margin: 0.25rem 0 0.75rem; }
.su-holes circle { fill: var(--ink); opacity: 0.13; }
.su-beam { opacity: 0; transition: opacity 0.6s ease; }
.su-beam.is-on { opacity: 1; }
.su-band { fill: var(--accent); fill-opacity: 0.16; }
.su-ray { fill: none; stroke: var(--accent); stroke-width: 1.3; stroke-dasharray: 10 5; }
.is-flowing .su-ray { animation: su-flow 1.6s linear infinite; }
.is-paused .su-ray { animation-play-state: paused; }
@keyframes su-flow { to { stroke-dashoffset: -15; } }
.su-beam.is-faint.is-on { opacity: 0.35; }
.su-beam.is-diffracted .su-band { fill-opacity: 0.3; }
.su-beam.is-diffracted .su-ray { stroke-width: 2; }
.su-part { cursor: pointer; }
.su-body { fill: var(--paper); stroke: var(--ink); stroke-width: 1.3; stroke-opacity: 0.6; transition: stroke 0.3s; }
.su-mark { fill: var(--ink); opacity: 0.6; }
.su-mark-line, .su-plate { fill: none; stroke: var(--ink); stroke-width: 2.2; stroke-opacity: 0.6; }
.su-mark-line { stroke-width: 1.2; }
.su-mirror { fill: none; stroke: var(--ink); stroke-width: 3.5; stroke-linecap: round; stroke-opacity: 0.75; }
.su-back { fill: none; stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; stroke-opacity: 0.45; }
.su-film { fill: none; stroke: var(--ink); stroke-width: 4; stroke-opacity: 0.55; stroke-linecap: round; }
.su-block { fill: none; stroke: var(--ink); stroke-width: 6; stroke-linecap: round; }
.su-part.is-active .su-body, .su-part.is-active .su-mirror, .su-part.is-active .su-film,
.su-part.is-active .su-plate, .su-part.is-active .su-mark-line { stroke: var(--accent); stroke-opacity: 1; }
.su-meter { font-family: var(--sans); font-size: 15px; font-weight: 600; fill: var(--ink); text-anchor: middle; font-variant-numeric: tabular-nums; }
.su-later { opacity: 0; pointer-events: none; transition: opacity 0.5s; }
.is-read .su-later { opacity: 1; pointer-events: auto; }
.su-label { font-family: var(--sans); font-size: 14px; fill: var(--muted); cursor: pointer; transition: fill 0.3s; }
.su-label.is-active { fill: var(--accent); font-weight: 600; }
.su-num { display: none; cursor: pointer; }
.su-num circle { fill: var(--paper); stroke: var(--muted); stroke-width: 1.4; }
.su-num text { font-family: var(--sans); font-size: 13px; font-weight: 600; fill: var(--ink); text-anchor: middle; }
.su-num.is-active circle { stroke: var(--accent); fill: var(--accent); }
.su-num.is-active text { fill: var(--paper); }
.su-inset { opacity: 0; transition: opacity 0.6s; }
.su-inset.is-on { opacity: 1; }
.su-lens { fill: var(--paper); stroke: var(--ink); stroke-opacity: 0.4; stroke-width: 1.2; }
.su-leader { fill: none; stroke: var(--ink); stroke-opacity: 0.35; stroke-width: 1; stroke-dasharray: 3 3; }
.su-fringes.is-exposing { animation: record 3s ease-out 0.6s both; }
.su-caption { font-family: var(--sans); font-size: 13px; fill: var(--muted); }
.setup-steps { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.85rem; }
.setup-steps button {
	font-family: var(--sans);
	font-size: 0.8rem;
	color: var(--ink-2);
	background: none;
	border: 1px solid var(--line);
	border-radius: 999px;
	padding: 0.3rem 0.75rem 0.3rem 0.4rem;
	cursor: pointer;
	transition: border-color 0.2s, color 0.2s, background-color 0.2s;
}
.setup-steps button span {
	display: inline-grid; place-items: center;
	width: 1.3rem; height: 1.3rem; margin-right: 0.3rem;
	border-radius: 50%; border: 1px solid var(--line);
	font-size: 0.72rem; font-weight: 600;
}
.setup-steps button:hover { border-color: var(--ink); }
.setup-steps button[aria-pressed="true"] { border-color: var(--accent); color: var(--ink); }
.setup-steps button[aria-pressed="true"] span { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.setup-text { font-size: 1rem; line-height: 1.55; color: var(--ink-2); margin: 0; min-height: 6.2em; }
.setup-text strong { font-weight: 500; color: var(--ink); }
.setup-nav { display: flex; justify-content: space-between; margin-top: 0.6rem; }
.setup-nav .link-btn[disabled] { opacity: 0.35; cursor: default; border-bottom-color: transparent; }
@media (max-width: 560px) {
	.setup { padding: 1rem; }
	.su-label { display: none; }
	.su-num { display: inline; }
	.su-num circle { r: 15px; }
	.su-num text { font-size: 18px; }
	.su-caption { display: none; }
	.setup-text { min-height: 9em; }
}
@media (max-width: 760px) {
	.schematic { grid-template-columns: minmax(0, 1fr); gap: 0.75rem; padding: 1rem; }
	.schematic-art { width: min(100%, 15rem); margin: 0 auto; }
}
a.link-btn { display: inline-block; text-decoration: none; }

/* A grating written by light */
.gr-beam { fill: none; stroke-width: 1; stroke-linecap: round; }
.gr-fringe { fill: none; stroke: var(--ink); stroke-width: 1; stroke-linejoin: round; }
.gr-edge { fill: none; stroke: var(--ink); stroke-width: 0.8; stroke-linejoin: round; opacity: 0.28; }
.is-flowing .gr-beam { stroke-dasharray: 44 4; animation: flow-beam 6s linear infinite; }
.is-paused .gr-beam, .is-paused .gr-fringes { animation-play-state: paused; }
@keyframes flow-beam { to { stroke-dashoffset: -48; } }
/* The fringes darken as if being recorded */
.js .gr-fringes { animation: record 2.8s ease-out 0.9s both; }
@keyframes record { from { opacity: 0; } to { opacity: 1; } }

.sp-line { fill: none; stroke: var(--ink); stroke-width: 0.9; stroke-linecap: round; opacity: 0.42; }
.sp-rim { fill: none; stroke: var(--ink); stroke-width: 0.8; opacity: 0.34; }
.sp-core { fill: var(--accent); }

/* Very slow drift along the flow lines, only while the figure is in view */
.is-flowing .sp-line { stroke-dasharray: 22 5; animation: flow 11s linear infinite; }
.is-paused .sp-line { animation-play-state: paused; }
@keyframes flow { to { stroke-dashoffset: -27; } }

.link-btn {
	font: inherit;
	font-family: var(--sans);
	font-size: 0.875rem;
	color: var(--ink-2);
	background: none;
	border: 0;
	padding: 0.3rem 0;
	cursor: pointer;
	border-bottom: 1px solid var(--line);
	transition: color 0.2s, border-color 0.2s;
}
.link-btn:hover { color: var(--accent); border-bottom-color: var(--accent); }
.link-btn span { display: inline-block; transition: transform 0.25s; }
.link-btn:hover span { transform: translateX(3px); }
.physics-link { margin: 1.75rem 0 2rem; }
html:not(.js) [data-open-physics], html:not(.js) [data-open-holo] { display: none; }

/* A visible way into each physics panel */
.physics-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: 1.25rem;
	align-items: center;
	width: 100%;
	text-align: left;
	font: inherit;
	color: var(--ink-2);
	background: var(--surface);
	border: 1px solid var(--line);
	border-left: 2px solid var(--accent);
	border-radius: 0 6px 6px 0;
	padding: 1rem 1.25rem 1.05rem;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
}
.physics-card:hover { border-color: var(--accent); }
.physics-card > span { grid-column: 1; }
.physics-card-label {
	font-family: var(--sans);
	font-size: 0.8rem;
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 0.3rem;
}
.physics-card-q { font-size: 1.3rem; line-height: 1.3; color: var(--ink); }
.physics-card-sub { font-size: 1rem; line-height: 1.5; margin-top: 0.3rem; }
.physics-card .physics-card-arrow {
	grid-column: 2;
	grid-row: 1 / span 3;
	font-family: var(--sans);
	font-size: 1.25rem;
	color: var(--accent);
	transition: transform 0.25s;
}
.physics-card:hover .physics-card-arrow { transform: translateX(4px); }

/* ---------- Sections: title on the left, content on the right ---------- */

main > .section {
	max-width: var(--wide);
	margin: 0 auto;
	padding: clamp(3.5rem, 8vw, 5.5rem) var(--gutter);
	display: grid;
	grid-template-columns: 13rem minmax(0, 40rem);
	column-gap: clamp(2rem, 6vw, 5rem);
	position: relative;
}
main > .section::before {
	content: "";
	position: absolute;
	top: 0;
	left: var(--gutter);
	right: var(--gutter);
	border-top: 1px solid var(--line);
}
.section-title {
	font-size: 1.6rem;
	line-height: 1.2;
	letter-spacing: -0.01em;
	align-self: start;
	position: sticky;
	top: 6rem;
}
.section-title .amp { font-style: italic; color: var(--muted); }

@media (max-width: 860px) {
	main > .section { grid-template-columns: minmax(0, 1fr); }
	.section-title {
		position: static;
		font-size: 2rem;
		margin-bottom: 1.75rem;
	}
	.section-title::before {
		content: "";
		display: block;
		width: 1.75rem;
		border-top: 2px solid var(--accent);
		margin-bottom: 1rem;
	}
}

.lede { font-size: 1.35rem; line-height: 1.5; color: var(--ink); }
.note { margin: 2rem 0 0; font-family: var(--sans); font-size: 0.875rem; line-height: 1.6; color: var(--muted); }
.note em { font-family: var(--serif); font-size: 1.07em; color: var(--ink-2); }

/* ---------- Research feature ---------- */

.kicker { color: var(--accent); margin-bottom: 0.75rem; }
.feature-title {
	font-size: clamp(1.6rem, 3.2vw, 2.1rem);
	line-height: 1.2;
	letter-spacing: -0.01em;
	margin-bottom: 1.25rem;
}

.project { margin-top: clamp(3rem, 7vw, 4.5rem); padding-top: clamp(2.5rem, 6vw, 3.5rem); border-top: 1px solid var(--line); }
.project .rows { margin-top: 1.5rem; }
.context { margin: 1.5rem 0 0; font-style: italic; color: var(--ink); }

.sem { margin: 2.25rem 0; }
.sem-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.sem-item { position: relative; overflow: hidden; border-radius: 3px; background: var(--surface); }
.sem-item img { display: block; width: 100%; height: auto; filter: grayscale(1) contrast(1.05); }
.sem-size {
	position: absolute;
	left: 0.55rem;
	top: 0.55rem;
	padding: 0.25rem 0.55rem;
	color: #fff;
	background: rgba(17, 18, 20, 0.7);
	border-radius: 2px;
	font-size: 0.68rem;
}
.sem figcaption { margin-top: 0.75rem; font-family: var(--sans); font-size: 0.8rem; color: var(--muted); }

/* ---------- Label + text rows (research summary, skills) ---------- */

.rows > div {
	display: grid;
	grid-template-columns: 9rem minmax(0, 1fr);
	gap: 1.5rem;
	padding: 1.1rem 0;
	border-top: 1px solid var(--line);
}
.rows > div:last-child { border-bottom: 1px solid var(--line); }
.rows dt { color: var(--muted); padding-top: 0.35rem; }
.rows dd { font-size: 1.0625rem; line-height: 1.55; }
.rows .is-key dt { color: var(--accent); }
.rows .is-key dd { color: var(--ink); }
@media (max-width: 560px) {
	.rows > div { grid-template-columns: 1fr; gap: 0.35rem; }
	.rows dt { padding-top: 0; }
}

/* ---------- Dated entries: experience, education, presentations ---------- */

.entries li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	column-gap: 2rem;
	padding: 1.6rem 0;
	border-top: 1px solid var(--line);
}
.entries li:first-child { padding-top: 0.2rem; border-top: none; }
.entries li > * { grid-column: 1; margin: 0; }
.entries .when { grid-column: 2; grid-row: 1; color: var(--muted); padding-top: 0.45rem; white-space: nowrap; }
.entries h3 { font-size: 1.35rem; line-height: 1.3; font-weight: 500; margin-bottom: 0.3rem; }
.entries .where { font-family: var(--sans); font-size: 0.875rem; line-height: 1.5; color: var(--ink-2); margin-bottom: 0.6rem; }
.entries .where:last-child { margin-bottom: 0; }
.entries p:not([class]) { font-size: 1.0625rem; line-height: 1.55; margin-bottom: 0.5rem; }
.entries .meta { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); }
.grade { color: var(--muted); white-space: nowrap; }
.grade::before { content: "\00b7"; color: var(--muted); margin: 0 0.45em; }
@media (max-width: 560px) {
	.entries li { grid-template-columns: 1fr; }
	.entries .when { grid-column: 1; grid-row: auto; padding: 0 0 0.4rem; color: var(--accent); }
	.grade { display: block; margin-top: 0.1rem; }
	.grade::before { content: none; }
}

/* ---------- Contact ---------- */

.contact-email {
	font-size: clamp(1.35rem, 4vw, 2.1rem);
	line-height: 1.25;
	margin: 0 0 1rem;
	overflow-wrap: anywhere;
}
.contact-email a { color: var(--ink); text-decoration: none; background: linear-gradient(var(--accent), var(--accent)) 0 100% / 100% 1px no-repeat; transition: background-size 0.3s, color 0.2s; }
.contact-email a:hover { color: var(--accent); background-size: 100% 2px; }
.contact-meta { font-family: var(--sans); font-size: 0.875rem; color: var(--muted); margin: 0; }

/* ---------- Footer ---------- */

.footer {
	max-width: var(--wide);
	margin: 0 auto;
	padding: 2rem var(--gutter) 3rem;
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 2rem;
	font-family: var(--sans);
	font-size: 0.8rem;
	color: var(--muted);
	position: relative;
}
.footer::before { content: ""; position: absolute; top: 0; left: var(--gutter); right: var(--gutter); border-top: 1px solid var(--line); }
.footer p { margin: 0; }

/* ---------- Physics panel: slides in from the right (from below on phones) ---------- */

html.drawer-lock { overflow: hidden; }
.drawer {
	position: fixed;
	inset: 0 0 0 auto;
	width: min(36rem, 100vw);
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--line);
	background: var(--paper);
	color: var(--ink-2);
	transform: translateX(100%);
	transition: transform 0.38s cubic-bezier(0.2, 0.7, 0.2, 1);
	overflow: hidden;
}
.drawer.is-open { transform: none; }
.drawer::backdrop { background: rgba(14, 14, 15, 0); transition: background 0.38s; }
.drawer.is-open::backdrop { background: rgba(14, 14, 15, 0.32); }
.drawer-panel { display: flex; flex-direction: column; height: 100%; }

.drawer-head { padding: 1.25rem clamp(1.25rem, 4vw, 2.25rem) 0; border-bottom: 1px solid var(--line); }
.drawer-top { display: flex; justify-content: space-between; align-items: center; }
.drawer-top .kicker { margin: 0; }
.drawer-close {
	width: 2.25rem; height: 2.25rem;
	display: grid; place-items: center;
	margin-right: -0.4rem;
	background: none; border: 1px solid transparent; border-radius: 50%;
	color: var(--ink); cursor: pointer;
	transition: border-color 0.2s;
}
.drawer-close:hover { border-color: var(--line); }
.drawer-close svg { width: 1.1rem; height: 1.1rem; stroke: currentColor; stroke-width: 1.5; fill: none; stroke-linecap: round; }
.drawer-head h2 { font-size: clamp(1.6rem, 4vw, 2rem); line-height: 1.15; letter-spacing: -0.01em; margin: 0.4rem 0 1rem; }

.zoom { display: flex; gap: 1.5rem; }
.zoom button {
	font-family: var(--sans);
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--muted);
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	padding: 0 0 0.7rem;
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s;
}
.zoom button span { font-weight: 400; margin-left: 0.2rem; }
.zoom button:hover { color: var(--ink); }
.zoom button[aria-current] { color: var(--ink); border-bottom-color: var(--accent); }
@media (max-width: 420px) { .zoom { gap: 1rem; } .zoom button span { display: none; } }

.drawer-body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 1.5rem clamp(1.25rem, 4vw, 2.25rem) 3rem;
	font-size: 1.0625rem;
	line-height: 1.6;
	position: relative;
}
.drawer-body h3 { font-size: 1.3rem; margin: 2rem 0 0.6rem; }
.drawer-body .level-inner > h3:first-child { margin-top: 0.5rem; }

/* Each level unfolds below the one before */
.level { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.5s cubic-bezier(0.2, 0.7, 0.2, 1); }
.level.is-open { grid-template-rows: 1fr; }
.level-inner { overflow: hidden; min-height: 0; }
.level + .level.is-open { border-top: 1px solid var(--line); margin-top: 1.75rem; padding-top: 1.25rem; }
.level.is-open .level-inner { animation: unfold 0.6s ease both; }
@keyframes unfold { from { opacity: 0; } to { opacity: 1; } }

.zoom-in {
	display: flex;
	align-items: baseline;
	gap: 0.75rem;
	width: 100%;
	margin-top: 1.5rem;
	padding: 1rem 1.1rem;
	font: inherit;
	font-size: 1.05rem;
	color: var(--ink);
	text-align: left;
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 6px;
	cursor: pointer;
	transition: border-color 0.2s, background 0.2s;
}
.zoom-in span { font-family: var(--sans); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.zoom-in:hover { border-color: var(--accent); }
.zoom-in[hidden] { display: none; }

/* Glossary terms and their definitions */
.term {
	font: inherit;
	color: var(--ink);
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	text-decoration: underline dotted var(--accent);
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.22em;
}
.term:hover, .term[aria-expanded="true"] { color: var(--accent); }
.def {
	font-family: var(--sans);
	font-size: 0.86rem;
	line-height: 1.55;
	color: var(--ink-2);
	background: var(--surface);
	border-left: 2px solid var(--accent);
	padding: 0.7rem 0.9rem;
	margin: -0.35rem 0 1.1rem;
	animation: unfold 0.3s ease both;
}
.def strong { color: var(--ink); font-weight: 600; }

/* ×1 sketch */
.sketch { margin: 1.25rem 0 1.5rem; }
.sketch svg { display: block; width: 100%; height: auto; }
.sketch figcaption { display: grid; grid-template-columns: 1fr 1.25fr; gap: 1rem; text-align: center; font-family: var(--sans); font-size: 0.78rem; line-height: 1.45; color: var(--muted); margin-top: 0.5rem; }

/* MSc panel: recording and playback, side by side */
.sketch-holo-figure { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.sketch-holo figcaption { grid-template-columns: 1fr 1fr; }
.sketch-holo .gr-beam { stroke-width: 2.2; }
.sketch-holo .gr-fringe { stroke-width: 2; }
.sketch-holo .gr-edge { stroke-width: 1.8; opacity: 0.35; }
.js .gr-fringes.is-set { animation: none; }
.spot-line { fill: none; stroke: var(--ink); stroke-width: 1; }

/* ×10 explorer */
.explorer {
	display: grid;
	grid-template-columns: 9.5rem minmax(0, 1fr);
	gap: 0.5rem 1.5rem;
	align-items: center;
	margin: 1.5rem 0;
	padding: 1.25rem;
	border: 1px solid var(--line);
	border-radius: 6px;
}
.explorer-figure svg { display: block; width: 100%; height: auto; }
.lex-bar { display: flex; align-items: center; gap: 0.4rem; justify-content: center; margin: 0.4rem 0 0; font-size: 0.8rem; color: var(--muted); }
.lex-bar i { display: block; height: 2px; background: var(--ink); }
.explorer-controls p { margin: 0; }
.explorer-head { display: flex; justify-content: space-between; align-items: baseline; }
.explorer-head label { font-family: var(--sans); font-size: 0.72rem; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.explorer-head output { font-size: 1.5rem; color: var(--ink); }
.explorer-scale { display: flex; justify-content: space-between; font-family: var(--sans); font-size: 0.7rem; color: var(--muted); margin-bottom: 0.75rem !important; }
.explorer-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem; font-family: var(--sans); font-size: 0.75rem; color: var(--muted); }
.explorer-jump button {
	font: inherit; color: var(--ink);
	background: none; border: 1px solid var(--line); border-radius: 999px;
	padding: 0.1rem 0.55rem; cursor: pointer;
	transition: border-color 0.2s;
}
.explorer-jump button:hover { border-color: var(--accent); }
.explorer-state { grid-column: 1 / -1; font-size: 0.98rem; line-height: 1.55; min-height: 4.8em; margin: 0.5rem 0 0; }
.explorer-state strong { color: var(--ink); font-weight: 500; }
.explorer-ratio { display: block; font-family: var(--sans); font-size: 0.78rem; color: var(--muted); margin-top: 0.2rem; }
@media (max-width: 480px) {
	.explorer { grid-template-columns: 1fr; padding: 1rem; }
	.explorer-visual { width: 9rem; margin: 0 auto; }
}

/* Sliders: a hairline track, shaded where the vortex is expected, and a round thumb */
input[type="range"] {
	-webkit-appearance: none;
	appearance: none;
	width: 100%;
	height: 1.6rem;
	margin: 0.2rem 0 0;
	background: transparent;
	cursor: pointer;
	--track: linear-gradient(90deg, var(--line) var(--b1, 30%), var(--accent) var(--b2, 40%));
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--track); border-radius: 2px; }
input[type="range"]::-moz-range-track { height: 2px; background: var(--track); border-radius: 2px; }
input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 1.05rem; height: 1.05rem; margin-top: calc(-0.525rem + 1px);
	border-radius: 50%; background: var(--paper); border: 2px solid var(--accent);
}
input[type="range"]::-moz-range-thumb { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--paper); border: 2px solid var(--accent); }

.scale-rules > div { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; padding: 0.65rem 0; border-top: 1px solid var(--line); }
.scale-rules > div:last-child { border-bottom: 1px solid var(--line); }
.scale-rules dt { font-family: var(--sans); font-size: 0.8rem; font-weight: 500; color: var(--ink); padding-top: 0.15rem; }
.scale-rules dd { font-size: 0.98rem; }

.drawer-body math[display="block"] { margin: 0.9rem 0 1.1rem; font-size: 1.25rem; color: var(--ink); text-align: left; }
.refs li { font-size: 0.92rem; line-height: 1.5; padding: 0.5rem 0 0.5rem 1rem; border-left: 1px solid var(--line); margin-bottom: 0.5rem; }
.drawer-note { font-family: var(--sans); font-size: 0.8rem; color: var(--muted); margin-top: 1.5rem; }

@media (max-width: 640px) {
	.drawer {
		inset: auto 0 0 0;
		width: 100%;
		height: 90dvh;
		border-left: 0;
		border-top: 1px solid var(--line);
		border-radius: 14px 14px 0 0;
		transform: translateY(100%);
	}
	.drawer-head { padding-top: 0.6rem; }
	.drawer-head::before { content: ""; display: block; width: 2.5rem; height: 4px; border-radius: 2px; background: var(--line); margin: 0 auto 0.5rem; }
}

/* ---------- Phone: slightly smaller body text ---------- */

@media (max-width: 560px) {
	body { font-size: 1.125rem; }
	.lede { font-size: 1.25rem; }
}

/* ---------- Motion ---------- */

.js .reveal { opacity: 0; transform: translateY(12px); transition: opacity 0.8s ease, transform 0.8s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	.js .reveal { opacity: 1; transform: none; transition: none; }
	.is-flowing .sp-line, .is-flowing .gr-beam, .js .gr-fringes, .is-flowing .su-ray, .su-fringes.is-exposing, .fig-toggle[open] > figure, .level.is-open .level-inner, .def { animation: none; }
	.drawer, .drawer::backdrop, .level { transition: none; }
}

/* ---------- Print: reads like a CV ---------- */

@media print {
	:root { --paper: #fff; --ink: #000; --ink-2: #222; --muted: #555; --line: #ccc; --accent: #000; }
	body { font-size: 10.5pt; line-height: 1.45; }
	.topbar, .hero-actions, .theme-toggle, .skip, .sem, .fig-toggle, .drawer, .physics-link { display: none !important; }
	.hero { padding: 0 0 1rem; }
	.hero-name { font-size: 26pt; }
	.hero-lede { font-size: 12pt; margin-bottom: 0; }
	main > .section { padding: 1rem 0; grid-template-columns: 9rem 1fr; }
	.section-title { position: static; font-size: 14pt; }
	.js .reveal { opacity: 1; transform: none; }
	.entries li, .rows > div { break-inside: avoid; }
	a { color: inherit; text-decoration: none; }
}
