/* ==========================================================
   jameshicks.io
   ========================================================== */

:root {
	--ink: #16181c;
	--ink-soft: #5a6270;
	--ink-faint: #8b93a1;
	--bg: #fbfaf8;
	--bg-panel: #f2efea;
	--rule: #e0dcd5;
	--accent: rgb(35, 87, 140);
	--accent-hover: rgb(222, 44, 59);
	--measure: 68ch;
	--page: 62rem;
	--gap: 2.5rem;

	/* Body text. */
	--font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
		"Helvetica Neue", Arial, sans-serif;

	/* Titles. Charter and Iowan Old Style ship with macOS; the rest are
	   fallbacks. Swap this to var(--font-sans) to go back to all-sans. */
	--font-serif: Charter, "Iowan Old Style", "Palatino Linotype", Palatino,
		"Book Antiqua", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--ink: #e8e6e2;
		--ink-soft: #a6adba;
		--ink-faint: #767e8c;
		--bg: #16181c;
		--bg-panel: #202329;
		--rule: #32363e;
		--accent: rgb(122, 173, 224);
		--accent-hover: rgb(240, 105, 112);
	}
}

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

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

body {
	margin: 0;
	padding: 0 1.5rem 6rem;
	background-color: var(--bg);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	line-height: 1.5;
	text-rendering: optimizeLegibility;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	font-kerning: normal;
}

/* ----------------------------------------------------------
   Header and navigation
   ---------------------------------------------------------- */

.site-header {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: flex-start;
	gap: 0.5rem 2.5rem;
	max-width: var(--page);
	margin: 0 auto;
	padding: 2.5rem 0 1.25rem;
	border-bottom: 1px solid var(--rule);
}

.site-header .wordmark {
	margin: 0;
	font-family: var(--font-sans);
	font-size: 1.125rem;
	font-weight: 600;
	letter-spacing: 0.01em;
}

.site-header .wordmark a {
	color: var(--ink);
	text-decoration: none;
	border: 0;
}

.site-header .wordmark a:hover {
	color: var(--accent-hover);
}

.site-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.9375rem;
}

/* Desktop: the menu sits at the right edge, opposite the wordmark. */
@media (min-width: 46.0625rem) {
	.site-nav {
		margin-left: auto;
	}
}

.site-nav a {
	color: var(--ink-soft);
	text-decoration: none;
	padding-bottom: 0.15rem;
	border-bottom: 2px solid transparent;
}

.site-nav a:hover {
	color: var(--accent-hover);
}

.site-nav a.current {
	color: var(--ink);
	border-bottom-color: var(--accent);
}

/* ----------------------------------------------------------
   Layout
   ---------------------------------------------------------- */

main {
	max-width: var(--page);
	margin: 0 auto;
}

section {
	padding: 3.5rem 0 0;
}

.intro {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	grid-template-areas:
		"lead portrait"
		"lead contact";
	/* Column gap scales with the viewport: min, preferred, max. */
	gap: 1.5rem clamp(2.5rem, 1rem + 4.5vw, 6rem);
	padding-top: 3rem;
}

.intro .lead {
	grid-area: lead;
	max-width: var(--measure);
	font-size: clamp(1.0625rem, 0.925rem + 0.45vw, 1.25rem);
	line-height: 1.5;
}

.intro .portrait {
	grid-area: portrait;
}

/* Desktop: a stacked list in the right-hand column, under the portrait.
   Narrow screens turn it into a single middot-separated line - see below. */
.intro .contact {
	grid-area: contact;
	display: flex;
	flex-direction: column;
	margin: 0;
	padding: 0;
	max-width: none;
	list-style: none;
	font-size: 0.9375rem;
	line-height: 1.75;
	color: var(--ink-soft);
}

.intro .contact li {
	margin: 0;
}

/* Email and postal address sit apart from the run of profile links. */
.intro .contact .contact-email {
	margin-bottom: 1rem;
}

/* Postal address: desktop only. Runs tighter than the list of links,
   since its lines are one block rather than separate items. */
.intro .contact .contact-address {
	margin-top: 1rem;
	line-height: 1.45;
}

.intro .lead p:first-child {
	margin-top: 0;
}

/* ----------------------------------------------------------
   Typography
   ---------------------------------------------------------- */

h1 {
	margin: 0 0 1.5rem;
	font-family: var(--font-serif);
	font-size: clamp(2.125rem, 1.5rem + 2.2vw, 3.25rem);
	font-weight: 600;
	line-height: 1.08;
	letter-spacing: -0.015em;
}

h2 {
	margin: 2.75rem 0 1.75rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid var(--rule);
	font-size: 0.9375rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-soft);
}

/* A heading opening a section already has the section padding above it. */
section > h2:first-child {
	margin-top: 0;
}

h3 {
	margin: 0 0 0.35rem;
	font-family: var(--font-serif);
	font-size: 1.1875rem;
	font-weight: 600;
	line-height: 1.35;
}

p {
	margin: 0 0 1rem;
	max-width: var(--measure);
}

/* Bulleted lists in body copy. The nav list lives in <header>, not <main>. */
main ul {
	margin: 0 0 1rem;
	padding-left: 1.15rem;
	max-width: var(--measure);
}

main li {
	margin-bottom: 0.3rem;
}

main li::marker {
	color: var(--ink-faint);
}

a {
	color: var(--accent);
	text-decoration: none;
	border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

a:hover {
	color: var(--accent-hover);
	border-bottom-color: currentColor;
}

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

/* Out-link indicator on publication and sidebar links that leave the site.
   The empty alt text ("/ \"\"") keeps screen readers from announcing it.
   Scoped to http(s) targets only, so locally hosted PDFs and the mailto:
   address don't get an arrow. */
.compact h3 a[href^="http"]::after,
.entry h3 a[href^="http"]::after,
.contact a[href^="http"]::after {
	content: "\2197" / "";
	display: inline-block;
	margin-left: 0.2em;
	font-family: var(--font-sans);
	font-style: normal;
	font-size: 0.75em;
	line-height: 1;
	vertical-align: 0.25em;
	opacity: 0.65;
}

a[href^="http"]:hover::after {
	opacity: 1;
}

.citation {
	margin: 0 0 0.75rem;
	font-size: 0.9375rem;
	font-variant-caps: all-small-caps;
	letter-spacing: 0.04em;
	font-weight: 500;
	color: var(--ink-soft);
}

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

.citation a:hover {
	color: var(--accent-hover);
}

/* Credit line under a title. Plain text, not small caps like .citation. */
.coauthors {
	margin: 0 0 0.75rem;
	font-size: 0.9375rem;
	color: var(--ink-soft);
}

/* Pair the credit line with the citation above it, when there is one. */
.citation + .coauthors {
	margin-top: -0.5rem;
}

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

.coauthors a:hover {
	color: var(--accent-hover);
}

.note {
	font-size: 0.9375rem;
	color: var(--ink-soft);
}

.entries + .note,
.compact + .note {
	margin-top: 2rem;
}

/* Present for screen readers and search engines, invisible on screen. */
.visually-hidden {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* ----------------------------------------------------------
   Portrait
   ---------------------------------------------------------- */

.portrait {
	display: block;
	width: 100%;
	max-width: 168px;
	height: auto;
	margin: 0;
	border-radius: 50%;
}

/* ----------------------------------------------------------
   Entry lists (publications, courses, datasets)
   ---------------------------------------------------------- */

.entries {
	display: grid;
	gap: 2rem;
}

.entry {
	display: grid;
	grid-template-columns: 148px minmax(0, 1fr);
	gap: var(--gap);
	align-items: start;
}

.entry.no-figure {
	grid-template-columns: minmax(0, 1fr);
}

/* A figure-less entry that still lines up with the text column of the
   illustrated entries above or below it: same grid, empty first cell. */
.entry.indented {
	grid-template-columns: 148px minmax(0, 1fr);
}

.entry.indented > div {
	grid-column: 2;
}

.entry figure {
	margin: 0;
}

.entry figure img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--rule);
	border-radius: 3px;
	background-color: var(--bg-panel);
}

.entry p:last-child {
	margin-bottom: 0;
}

/* Compact list used for "Selected work" on the home page */

.compact {
	display: grid;
	gap: 1rem;
}

.compact h3 {
	font-size: 1.0625rem;
}

.compact .citation {
	margin-bottom: 0;
}

/* ----------------------------------------------------------
   Narrow screens
   ---------------------------------------------------------- */

@media (max-width: 46rem) {
	:root {
		--gap: 1.75rem;
	}

	body {
		padding-bottom: 4rem;
	}

	.site-header {
		padding-top: 2rem;
	}

	.intro {
		grid-template-columns: minmax(0, 1fr);
		grid-template-rows: none;
		grid-template-areas:
			"portrait"
			"lead"
			"contact";
	}

	.intro .contact {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: baseline;
		column-gap: 0.5rem;
		padding-top: 1.25rem;
		border-top: 1px solid var(--rule);
	}

	.intro .contact li + li::before {
		content: "\00B7";
		margin-right: 0.5rem;
		color: var(--ink-faint);
	}

	.intro .contact .contact-email {
		margin-bottom: 0;
	}

	.intro .contact .contact-address {
		display: none;
	}

	.entry,
	.entry.indented {
		grid-template-columns: minmax(0, 1fr);
		gap: 1.25rem;
	}

	/* No figure column to align to on narrow screens, so drop the indent. */
	.entry.indented > div {
		grid-column: 1;
	}

	.entry figure {
		max-width: 220px;
	}
}

/* ----------------------------------------------------------
   Charts (data pages; drawn by charts.js)
   ---------------------------------------------------------- */

/* One hue per measure, the same on every chart and in the PDFs. Validated as
   adjacent pairs against --bg in both modes; aqua and yellow sit under 3:1 on
   the light surface, which is why every chart carries a legend and a table. */
:root {
	--chart-grid: #e9e6e0;
	--chart-base: #c9c3b8;
	--s-ipr_petitions: #2a78d6;
	--s-reexam_requests: #eb6834;
	--s-instituted: #1baf7a;
	--s-denied_merits: #eda100;
	--s-denied_discretionary: #4a3aa7;
	--s-patent_cases: #008300;
	--s-other_civil: #898781;   /* context series: neutral by design */
	/* Districts reuse measure hues on charts of their own, so they follow each
	   mode's value. Dark green-yellow is CVD dE 6.9: legal only because these
	   charts carry direct labels. */
	--s-txed: var(--s-ipr_petitions);
	--s-ded: var(--s-denied_merits);
	--s-txwd: var(--s-patent_cases);
	--s-other_districts: var(--s-other_civil);
}

@media (prefers-color-scheme: dark) {
	:root {
		--chart-grid: #2a2e35;
		--chart-base: #474c56;
		--s-ipr_petitions: #3987e5;
		--s-reexam_requests: #d95926;
		--s-instituted: #199e70;
		--s-denied_merits: #c98500;
		--s-denied_discretionary: #9085e9;
		--s-patent_cases: #008300;
		--s-other_civil: #8b93a1;
	}
}

.figure {
	margin: 0 0 4rem;
}

.figure .dek {
	margin: 0;
	color: var(--ink-soft);
	font-size: 0.9375rem;
}

.chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem 1.25rem;
	margin: 1rem 0 0.5rem;
	padding: 0;
	max-width: none;
	list-style: none;
	font-size: 0.875rem;
	color: var(--ink-soft);
}

.chart-legend li {
	margin: 0;
}

.key {
	display: inline-block;
	margin-right: 0.45rem;
	background: var(--c);
	vertical-align: middle;
}

.key-line {
	width: 16px;
	height: 3px;
	border-radius: 2px;
}

.key-rect {
	width: 11px;
	height: 11px;
	border-radius: 2px;
}

.key-dot,
.key-dot-open {
	width: 10px;
	height: 10px;
	border-radius: 50%;
}

.key-dot-open {
	background: var(--bg);
	border: 2px solid var(--c);
	box-sizing: border-box;
}

.chart-plot {
	position: relative;
	border-radius: 4px;
}

.chart-plot:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 4px;
}

.chart-plot svg {
	display: block;
	overflow: visible;
	font-family: var(--font-sans);
	font-size: 12px;
	font-variant-numeric: tabular-nums;
}

.chart-plot .grid {
	stroke: var(--chart-grid);
	stroke-width: 1;
	shape-rendering: crispEdges;
}

.chart-plot .baseline {
	stroke: var(--chart-base);
	stroke-width: 1;
	shape-rendering: crispEdges;
}

.chart-plot .tick {
	fill: var(--ink-faint);
}

.chart-plot .direct {
	fill: var(--ink);
	font-size: 13px;
}

.chart-plot .series-line {
	fill: none;
	stroke-width: 2;
	stroke-linejoin: round;
	stroke-linecap: round;
}

/* To a part-year shown at an annual rate: an estimate, not a count. */
.chart-plot .series-line.partial {
	stroke-width: 1.5;
	stroke-dasharray: 3 4;
}

/* 2px surface ring, so markers stay distinct where the lines cross. */
.chart-plot .dot {
	stroke: var(--bg);
	stroke-width: 1.5;
}

/* Raw values under a fitted line: present, but receded behind the trend. */
.chart-plot .dot-raw {
	stroke: none;
	opacity: 0.4;
}

.chart-plot .dot-raw.on {
	opacity: 1;
	stroke: var(--bg);
}

.chart-plot .event {
	stroke: var(--chart-base);
	stroke-width: 1;
	stroke-dasharray: 2 3;
}

.chart-plot .event-label {
	fill: var(--ink-faint);
	font-size: 11px;
}

.chart-plot .crosshair {
	stroke: var(--ink-faint);
	stroke-width: 1;
	stroke-dasharray: 2 3;
}

.chart-plot .segment {
	stroke: var(--bg);
	stroke-width: 2;
}

.chart-plot .focused .col {
	opacity: 0.45;
	transition: opacity 120ms;
}

.chart-plot .focused .col.on {
	opacity: 1;
}

/* Dumbbell: before is an open dot, after a filled one, joined by a quiet bar. */
.chart-plot .dumbbell-bar {
	stroke: var(--chart-base);
	stroke-width: 2;
}

.chart-plot .dot-open {
	fill: var(--bg);
	stroke-width: 2;
}

.chart-plot .focused .row {
	opacity: 0.45;
	transition: opacity 120ms;
}

.chart-plot .focused .row.on {
	opacity: 1;
}

.chart-tip {
	position: absolute;
	top: 0;
	z-index: 1;
	min-width: 11rem;
	padding: 0.55rem 0.75rem;
	background: var(--bg);
	border: 1px solid var(--rule);
	border-radius: 6px;
	box-shadow: 0 4px 16px rgb(0 0 0 / 0.08);
	font-size: 0.8125rem;
	line-height: 1.45;
	pointer-events: none;
}

.chart-tip-title {
	margin-bottom: 0.3rem;
	color: var(--ink-soft);
}

.chart-tip-row {
	display: grid;
	grid-template-columns: auto 2.5rem 1fr;
	align-items: center;
	gap: 0.5rem;
	white-space: nowrap;
	color: var(--ink-soft);
}

.chart-tip-row .key {
	margin: 0;
}

.chart-tip-row strong {
	color: var(--ink);
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: right;
}

.chart-table {
	margin-top: 0.75rem;
	font-size: 0.875rem;
}

.chart-table summary {
	cursor: pointer;
	color: var(--ink-soft);
}

.chart-table summary:hover {
	color: var(--accent-hover);
}

.chart-table table {
	margin-top: 0.75rem;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
}

.chart-table th,
.chart-table td {
	padding: 0.2rem 0.9rem 0.2rem 0;
	border-bottom: 1px solid var(--rule);
	text-align: right;
}

.chart-table th:first-child {
	text-align: left;
	font-weight: 400;
}

.chart-table thead th {
	color: var(--ink-soft);
	font-weight: 600;
	vertical-align: bottom;
}

.figure .note {
	margin-top: 0.75rem;
}

.chart-tip-detail {
	grid-column: 3;
	margin-top: -0.2rem;
	font-size: 0.75rem;
	color: var(--ink-faint);
}
