/* ==========================================================================
   Nuno Domingues - site styles, 2026
   One stylesheet for every page. Design tokens first, then components.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Tokens
   -------------------------------------------------------------------------- */

:root {
	/* The signature magenta, carried over from every previous version. */
	--accent:          rgb(176, 11, 102);
	--accent-strong:   rgb(140, 8, 82);
	--accent-wash:     rgba(176, 11, 102, 0.08);
	--accent-line:     rgba(176, 11, 102, 0.28);

	--ink:             #171310;
	--ink-soft:        #4e4540;
	--ink-faint:       #8a7d76;

	--bg:              #fbf8f6;
	--surface:         #ffffff;
	--surface-sunk:    #f4efeb;
	--line:            #e7ddd6;
	--line-strong:     #d5c8bf;

	--serif: "EB Garamond", Garamond, "Adobe Garamond Pro", "Times New Roman", Times, serif;
	--sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

	/* Fluid type scale - shrinks on phones, grows on desktop, no breakpoints. */
	--step--1: clamp(0.83rem, 0.80rem + 0.15vw, 0.92rem);
	--step-0:  clamp(1.05rem, 1.00rem + 0.25vw, 1.20rem);
	--step-1:  clamp(1.25rem, 1.15rem + 0.45vw, 1.50rem);
	--step-2:  clamp(1.55rem, 1.35rem + 0.90vw, 2.15rem);
	--step-3:  clamp(2.00rem, 1.60rem + 1.90vw, 3.25rem);
	--step-4:  clamp(2.50rem, 1.80rem + 3.40vw, 5.00rem);

	--measure: 34rem;      /* comfortable reading width */
	--gutter:  clamp(1.25rem, 4vw, 3rem);
	--shell:   72rem;      /* max page width */

	--radius:  4px;
	--ease:    cubic-bezier(0.22, 0.61, 0.36, 1);
}

@media (prefers-color-scheme: dark) {
	:root {
		--accent:        #ff6bb0;
		--accent-strong: #ff96c8;
		--accent-wash:   rgba(255, 107, 176, 0.10);
		--accent-line:   rgba(255, 107, 176, 0.30);

		--ink:           #f2ece8;
		--ink-soft:      #c0b4ad;
		--ink-faint:     #8c7f78;

		--bg:            #141110;
		--surface:       #1c1817;
		--surface-sunk:  #221d1b;
		--line:          #332c29;
		--line-strong:   #453b37;
	}
}

/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */

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

html {
	-webkit-text-size-adjust: 100%;
	scroll-behavior: smooth;
}

body {
	margin: 0;
	background-color: var(--bg);
	color: var(--ink);
	font-family: var(--serif);
	font-size: var(--step-0);
	line-height: 1.65;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
	font-weight: 500;
	line-height: 1.15;
	margin: 0;
	text-wrap: balance;
}

p { margin: 0 0 1.1em; }
p:last-child { margin-bottom: 0; }

a {
	color: var(--accent);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.18em;
	text-decoration-color: var(--accent-line);
	transition: color 160ms var(--ease), text-decoration-color 160ms var(--ease);
}

a:hover,
a:focus-visible {
	color: var(--accent-strong);
	text-decoration-color: currentColor;
}

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

::selection {
	background: var(--accent);
	color: #fff;
}

hr {
	border: 0;
	border-top: 1px solid var(--line);
	margin: 3rem 0;
}

/* Skip link - visible only when tabbed to. */
.skip {
	position: absolute;
	left: -9999px;
	top: 0;
	background: var(--accent);
	color: #fff;
	padding: 0.6rem 1rem;
	z-index: 100;
	font-family: var(--sans);
	font-size: var(--step--1);
}
.skip:focus { left: 0; }

/* --------------------------------------------------------------------------
   3. Shell
   -------------------------------------------------------------------------- */

.shell {
	width: 100%;
	max-width: var(--shell);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

.shell--narrow { max-width: 54rem; }

main { display: block; }

.page {
	padding-block: clamp(2.5rem, 6vw, 5rem) clamp(4rem, 10vw, 7rem);
}

/* --------------------------------------------------------------------------
   4. Header / navigation
   -------------------------------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 20;
	background: color-mix(in srgb, var(--bg) 88%, transparent);
	backdrop-filter: saturate(180%) blur(12px);
	-webkit-backdrop-filter: saturate(180%) blur(12px);
	border-bottom: 1px solid var(--line);
}

/* Browsers without color-mix still get a solid, readable bar. */
@supports not (background: color-mix(in srgb, red 50%, blue)) {
	.site-header { background: var(--bg); }
}

.site-header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem 2rem;
	flex-wrap: wrap;
	padding-block: 0.9rem;
}

.brand {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink);
	text-decoration: none;
	white-space: nowrap;
}

.brand:hover,
.brand:focus-visible { color: var(--accent); }

.nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.6rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.nav a {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: lowercase;
	color: var(--ink-soft);
	text-decoration: none;
	padding-block: 0.2rem;
	position: relative;
}

.nav a::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: -2px;
	height: 1.5px;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform 220ms var(--ease);
}

.nav a:hover,
.nav a:focus-visible { color: var(--ink); }
.nav a:hover::after,
.nav a:focus-visible::after { transform: scaleX(1); }

.nav a[aria-current="page"] { color: var(--accent); }
.nav a[aria-current="page"]::after { transform: scaleX(1); }

/* --------------------------------------------------------------------------
   5. Footer
   -------------------------------------------------------------------------- */

.site-footer {
	border-top: 1px solid var(--line);
	padding-block: 2.5rem 3rem;
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-faint);
}

.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1.25rem 2rem;
}

.site-footer a { color: var(--ink-soft); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* --------------------------------------------------------------------------
   6. Social links
   -------------------------------------------------------------------------- */

.social {
	display: flex;
	gap: 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
	font-family: var(--sans);
	font-size: var(--step--1);
	letter-spacing: 0.06em;
}

.social a {
	text-decoration: none;
	color: var(--ink-soft);
	border-bottom: 1px solid transparent;
	padding-bottom: 2px;
	transition: color 160ms var(--ease), border-color 160ms var(--ease);
}

.social a:hover,
.social a:focus-visible {
	color: var(--accent);
	border-bottom-color: var(--accent);
}

/* --------------------------------------------------------------------------
   7. Section headings
   -------------------------------------------------------------------------- */

.page-title {
	font-size: var(--step-3);
	letter-spacing: -0.015em;
	margin-bottom: 0.4em;
}

.page-lede {
	font-size: var(--step-1);
	line-height: 1.5;
	color: var(--ink-soft);
	max-width: 42rem;
	margin-bottom: 0;
}

.eyebrow {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent);
	margin: 0 0 1rem;
}

.section {
	margin-top: clamp(3rem, 7vw, 5rem);
}

.section__title {
	display: flex;
	align-items: baseline;
	gap: 1.25rem;
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-bottom: 1.75rem;
}

/* The rule replaces the rows of backslashes the old pages used as dividers. */
.section__title::after {
	content: "";
	flex: 1;
	height: 1px;
	background: var(--line);
}

/* --------------------------------------------------------------------------
   8. Home
   -------------------------------------------------------------------------- */

.home {
	min-height: 100svh;
	display: flex;
	flex-direction: column;
}

.home .site-header {
	border-bottom: 0;
	background: transparent;
	backdrop-filter: none;
	-webkit-backdrop-filter: none;
}

.hero {
	flex: 1;
	display: flex;
	align-items: center;
	padding-block: clamp(3rem, 10vw, 7rem);
}

.hero__inner {
	display: grid;
	gap: clamp(2.5rem, 6vw, 5rem);
	grid-template-columns: 1fr;
	align-items: center;
	width: 100%;
}

@media (min-width: 56rem) {
	.hero__inner { grid-template-columns: 1.35fr 1fr; }
}

.hero__name {
	font-size: var(--step-4);
	line-height: 0.95;
	letter-spacing: -0.03em;
	margin-bottom: 0.35em;
}

.hero__name span {
	display: block;
	color: var(--accent);
}

.hero__tagline {
	font-size: var(--step-1);
	color: var(--ink-soft);
	max-width: 30rem;
	margin-bottom: 2.25rem;
}

.hero__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.25rem;
	list-style: none;
	margin: 0 0 2.5rem;
	padding: 0;
}

.hero__links a {
	display: inline-block;
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 500;
	letter-spacing: 0.08em;
	text-transform: lowercase;
	text-decoration: none;
	color: var(--ink);
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	padding: 0.5rem 1.15rem;
	transition: border-color 180ms var(--ease), color 180ms var(--ease), background-color 180ms var(--ease);
}

.hero__links a:hover,
.hero__links a:focus-visible {
	color: var(--accent);
	border-color: var(--accent);
	background: var(--accent-wash);
}

/* --- Hero artwork: the motif network ------------------------------------- */

.hero__art {
	justify-self: center;
	width: 100%;
	max-width: 27rem;
}

@media (min-width: 56rem) {
	/* Tie the width to the viewport height too, so the tall artwork never
	   pushes the hero off a short laptop screen. */
	.hero__art {
		justify-self: end;
		max-width: min(27rem, 52vh);
	}
}

.motif-art {
	display: block;
	width: 100%;
	height: auto;
	color: var(--ink-soft);
	overflow: visible;
}

/* Node-link scaffolding */
.motif-art .edges line {
	stroke: var(--accent);
	stroke-width: 1.2;
	opacity: 0.3;
}

/* Painted in the page background so edges stop cleanly at each node. */
.motif-art .halos circle { fill: var(--bg); }

/* Two pens: ink for the drawing, accent for the highlights. */
.motif-art .ink,
.motif-art .pop {
	fill: none;
	stroke-width: 2.2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.motif-art .ink { stroke: currentColor; }
.motif-art .pop { stroke: var(--accent); }
.motif-art .pop-fill { fill: var(--accent); stroke: none; }

/* Residues sit on the backbone, so they carry the page background to hide it. */
.motif-art .residue circle {
	fill: var(--bg);
	stroke: currentColor;
	stroke-width: 2.2;
}

/* Each motif fades up in turn as the page loads. */
.motif-art .node {
	animation: motif-in 620ms var(--ease) backwards;
	transform-box: fill-box;
}

.motif-art .edges { animation: motif-fade 900ms var(--ease) 520ms backwards; }

.motif-art .node:nth-of-type(1)  { animation-delay:  60ms; }
.motif-art .node:nth-of-type(2)  { animation-delay: 120ms; }
.motif-art .node:nth-of-type(3)  { animation-delay: 180ms; }
.motif-art .node:nth-of-type(4)  { animation-delay: 240ms; }
.motif-art .node:nth-of-type(5)  { animation-delay: 300ms; }
.motif-art .node:nth-of-type(6)  { animation-delay: 360ms; }
.motif-art .node:nth-of-type(7)  { animation-delay: 420ms; }
.motif-art .node:nth-of-type(8)  { animation-delay: 480ms; }
.motif-art .node:nth-of-type(9)  { animation-delay: 540ms; }
.motif-art .node:nth-of-type(10) { animation-delay: 600ms; }
.motif-art .node:nth-of-type(11) { animation-delay: 660ms; }

@keyframes motif-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}

@keyframes motif-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

/* --------------------------------------------------------------------------
   9. Prose
   -------------------------------------------------------------------------- */

.prose {
	max-width: var(--measure);
	font-size: var(--step-0);
	line-height: 1.7;
}

.prose--lead > p:first-of-type {
	font-size: var(--step-1);
	line-height: 1.5;
	color: var(--ink);
}

/* --------------------------------------------------------------------------
   10. About
   -------------------------------------------------------------------------- */

.about-grid {
	display: grid;
	gap: clamp(2rem, 5vw, 4rem);
	grid-template-columns: 1fr;
	align-items: start;
	margin-top: clamp(2.5rem, 6vw, 4rem);
}

@media (min-width: 56rem) {
	.about-grid { grid-template-columns: 18rem 1fr; }
	.about-grid__aside { position: sticky; top: 6rem; }
}

.portrait {
	border-radius: var(--radius);
	/* The headshot sits on near-white; the hairline keeps it from bleeding
	   into the page in light mode and from glaring in dark mode. */
	border: 1px solid var(--line);
	filter: grayscale(100%) contrast(1.04);
	transition: filter 500ms var(--ease);
	width: 100%;
}

.portrait:hover { filter: grayscale(0%) contrast(1); }

.facts {
	list-style: none;
	margin: 2rem 0 0;
	padding: 0;
	font-family: var(--sans);
	font-size: var(--step--1);
	border-top: 1px solid var(--line);
}

.facts li {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 1rem;
	padding: 0.7rem 0;
	border-bottom: 1px solid var(--line);
}

.facts__key {
	color: var(--ink-faint);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	font-size: 0.8em;
	white-space: nowrap;
}

.facts__val {
	color: var(--ink);
	text-align: right;
}

/* --------------------------------------------------------------------------
   11. CV - year / content pairs
   -------------------------------------------------------------------------- */

.entries {
	list-style: none;
	margin: 0;
	padding: 0;
}

.entry {
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.15rem 2rem;
	padding: 1.1rem 0;
	border-top: 1px solid var(--line);
}

.entry:last-child { border-bottom: 1px solid var(--line); }

@media (min-width: 44rem) {
	.entry { grid-template-columns: 9rem 1fr; gap: 0.25rem 2rem; }
}

.entry__year {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-variant-numeric: tabular-nums;
	color: var(--ink-faint);
	letter-spacing: 0.04em;
	padding-top: 0.25em;
}

.entry__role {
	font-weight: 600;
	color: var(--ink);
}

.entry__where {
	color: var(--ink-soft);
}

.entry__note {
	display: block;
	font-size: var(--step--1);
	font-family: var(--sans);
	color: var(--ink-faint);
	line-height: 1.55;
	margin-top: 0.35rem;
}

/* Bulleted blocks (summary, skills) */
.bullets {
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: 48rem;
}

.bullets li {
	position: relative;
	padding-left: 1.5rem;
	margin-bottom: 1rem;
	line-height: 1.65;
}

.bullets li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.72em;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--accent);
}

.skill-block {
	padding: 1.25rem 0;
	border-top: 1px solid var(--line);
	display: grid;
	grid-template-columns: 1fr;
	gap: 0.35rem 2rem;
}

.skill-block:last-child { border-bottom: 1px solid var(--line); }

@media (min-width: 44rem) {
	.skill-block { grid-template-columns: 9rem 1fr; }
}

.skill-block__label {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--ink-faint);
	padding-top: 0.3em;
}

.skill-block__body {
	color: var(--ink-soft);
	line-height: 1.7;
}

/* Publications & conferences */
.refs {
	list-style: none;
	margin: 0;
	padding: 0;
	max-width: 50rem;
}

.refs li {
	padding: 1rem 0;
	border-top: 1px solid var(--line);
	line-height: 1.6;
}

.refs li:last-child { border-bottom: 1px solid var(--line); }

.refs cite {
	font-style: normal;
	font-weight: 600;
	color: var(--ink);
}

.refs__meta {
	display: block;
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-faint);
	margin-top: 0.3rem;
}

/* --------------------------------------------------------------------------
   12. Document lists (Science)
   -------------------------------------------------------------------------- */

.docs {
	list-style: none;
	margin: 0;
	padding: 0;
}

.docs li { break-inside: avoid; }

@media (min-width: 60rem) {
	.docs--split { columns: 2; column-gap: 3rem; }
}

.docs a {
	display: block;
	padding: 0.7rem 0 0.7rem 1.6rem;
	border-bottom: 1px solid var(--line);
	text-decoration: none;
	color: var(--ink);
	font-size: var(--step--1);
	font-family: var(--sans);
	line-height: 1.5;
	position: relative;
	transition: color 160ms var(--ease), padding-left 200ms var(--ease);
}

/* Little arrow that slides on hover - replaces the old blue underlines. */
.docs a::before {
	content: "\2192";
	position: absolute;
	left: 0;
	color: var(--accent);
	opacity: 0.55;
	transition: opacity 200ms var(--ease), transform 200ms var(--ease);
}

.docs a:hover,
.docs a:focus-visible {
	color: var(--accent);
	padding-left: 2rem;
}

.docs a:hover::before,
.docs a:focus-visible::before {
	opacity: 1;
	transform: translateX(3px);
}

.docs em { font-style: italic; }

/* --------------------------------------------------------------------------
   13. Portfolio
   -------------------------------------------------------------------------- */

.work-grid {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.work {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface);
	padding: 1.5rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	transition: border-color 200ms var(--ease), transform 200ms var(--ease);
}

.work:hover {
	border-color: var(--accent-line);
	transform: translateY(-2px);
}

.work h3 {
	font-size: var(--step-1);
	line-height: 1.25;
}

.work p {
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-soft);
	line-height: 1.55;
	margin: 0;
}

.work__link {
	margin-top: auto;
	padding-top: 1rem;
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: lowercase;
	text-decoration: none;
}

.work__link::after {
	content: " \2192";
	display: inline-block;
	transition: transform 200ms var(--ease);
}

.work:hover .work__link::after { transform: translateX(3px); }

.gallery {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.gallery img {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: var(--surface-sunk);
}

.caption {
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-faint);
	margin-top: 0.6rem;
}

/* --------------------------------------------------------------------------
   14. Contacts
   -------------------------------------------------------------------------- */

.contact-list {
	list-style: none;
	margin: clamp(2rem, 5vw, 3rem) 0 0;
	padding: 0;
	max-width: 40rem;
}

.contact-list li {
	padding: 1.4rem 0;
	border-top: 1px solid var(--line);
}

.contact-list li:last-child { border-bottom: 1px solid var(--line); }

.contact__label {
	display: block;
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ink-faint);
	margin-bottom: 0.35rem;
}

.contact__value {
	font-size: var(--step-1);
	color: var(--ink);
}

.contact-list a { color: var(--accent); text-decoration: none; }
.contact-list a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------
   15. Misc utilities
   -------------------------------------------------------------------------- */

.note {
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-faint);
	line-height: 1.6;
}

.figure {
	margin: 2rem 0 0;
	max-width: 46rem;
}

.figure img {
	border: 1px solid var(--line);
	border-radius: var(--radius);
	width: 100%;
}

.figure figcaption {
	font-family: var(--sans);
	font-size: var(--step--1);
	color: var(--ink-faint);
	margin-top: 0.6rem;
}

.subject-groups {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 15rem), 1fr));
	list-style: none;
	margin: 0;
	padding: 0;
}

.subject-group {
	border-top: 2px solid var(--accent-line);
	padding-top: 0.9rem;
}

.subject-group h3 {
	font-family: var(--sans);
	font-size: var(--step--1);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--accent);
	margin-bottom: 0.6rem;
}

.subject-group ul {
	list-style: none;
	margin: 0;
	padding: 0;
	color: var(--ink-soft);
}

.subject-group li {
	padding: 0.2rem 0;
	line-height: 1.5;
}

.visually-hidden {
	position: absolute;
	width: 1px; height: 1px;
	padding: 0; margin: -1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
	border: 0;
}

/* --------------------------------------------------------------------------
   16. Motion & print
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}

@media print {
	:root {
		--ink: #000;
		--ink-soft: #222;
		--ink-faint: #555;
		--bg: #fff;
		--surface: #fff;
		--line: #ccc;
		--accent: #000;
	}
	.site-header, .site-footer, .social, .skip { display: none; }
	body { font-size: 10.5pt; line-height: 1.45; }
	.page { padding-block: 0; }
	.entry, .refs li, .skill-block { break-inside: avoid; }
	a { text-decoration: none; }
	.docs a::before, .work__link::after { content: ""; }
}
