/* ==========================================================================
   Arnold Julian - coding portfolio

   A one-page CV. Fonts and base colours come from the main site's theme.
   Muted is darker than the main site's #a8a8a8 so it passes 4.5:1. The accent
   is the main site's maroon, lightened in dark mode where #800000 is 1.75:1.
   ========================================================================== */

@font-face {
	font-family: "Cinzel";
	src: url("fonts/cinzel.woff2") format("woff2");
	font-weight: 400 900;
	font-display: swap;
}

@font-face {
	font-family: "Nunito";
	src: url("fonts/nunito.woff2") format("woff2");
	font-weight: 200 1000;
	font-display: swap;
}

@font-face {
	font-family: "Open Sans";
	src: url("fonts/open-sans.woff2") format("woff2");
	font-weight: 300 800;
	font-display: swap;
}

:root {
	--canvas: #ffffff;
	--panel:  #ffffff;
	--ink:    #000000;
	--body:   #4a4a4a;
	--muted:  #6b6b6b;
	--line:   #e2e2e2;
	--accent: #800000;
	--on-accent: #ffffff;

	--display: "Cinzel", Georgia, serif;
	--nav:     "Nunito", system-ui, sans-serif;
	--text:    "Open Sans", system-ui, sans-serif;
	--mono:    ui-monospace, SFMono-Regular, Menlo, monospace;

	--gutter:  clamp(16px, 4vw, 48px);
	--section: clamp(64px, 9vw, 112px);
	--header:  72px;

	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--canvas: #0f0f0f;
		--panel:  #181818;
		--ink:    #f2f2f2;
		--body:   #b4b4b4;
		--muted:  #9a9a9a;
		--line:   #2c2c2c;
		--accent: #e8737b;
		--on-accent: #0f0f0f;
		color-scheme: dark;
	}
}

:root[data-theme="dark"] {
	--canvas: #0f0f0f;
	--panel:  #181818;
	--ink:    #f2f2f2;
	--body:   #b4b4b4;
	--muted:  #9a9a9a;
	--line:   #2c2c2c;
	--accent: #e8737b;
	--on-accent: #0f0f0f;
	color-scheme: dark;
}

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

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

body {
	margin: 0;
	background: var(--canvas);
	color: var(--body);
	font: 400 16px/1.75 var(--text);
	overflow-wrap: break-word;
}

h1,
h2,
h3 {
	margin: 0;
	color: var(--ink);
	font-family: var(--display);
	font-weight: 500;
	line-height: 1.2;
}

p {
	margin: 0 0 1em;
}

a {
	color: inherit;
}

code {
	font-family: var(--mono);
	font-size: 0.88em;
}

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

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

[hidden] {
	display: none !important;
}

.skip {
	position: absolute;
	left: -9999px;
	z-index: 30;
	padding: 8px 16px;
	background: var(--ink);
	color: var(--canvas);
}

.skip:focus {
	left: 8px;
	top: 8px;
}

/* Header
   ========================================================================== */

.site-header {
	position: sticky;
	top: 0;
	z-index: 10;
	display: flex;
	align-items: center;
	gap: 24px;
	min-height: var(--header);
	padding-inline: var(--gutter);
	background: var(--canvas);
	border-bottom: 1px solid var(--line);
}

.site-title {
	margin-right: auto;
	color: var(--ink);
	font-family: var(--display);
	font-size: 19px;
	font-weight: 500;
	letter-spacing: 1.2px;
	text-decoration: none;
	text-transform: uppercase;
	white-space: nowrap;
}

.site-header nav {
	display: flex;
	gap: 24px;
	font: 500 15px var(--nav);
}

.site-header nav a {
	padding-block: 12px;
	color: var(--body);
	text-decoration: none;
}

.site-header nav a[aria-current] {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-underline-offset: 5px;
}

.site-header nav a:hover {
	color: var(--ink);
	text-decoration: underline;
	text-decoration-color: var(--accent);
	text-underline-offset: 5px;
}

.theme-toggle {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	margin-right: -12px;
	padding: 0;
	border: 0;
	background: none;
	color: var(--ink);
	cursor: pointer;
}

.theme-toggle__mark {
	width: 20px;
	height: 20px;
	border: 2px solid currentColor;
	border-radius: 50%;
	background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.progress {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 2px;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: left;
}

/* Hero
   ========================================================================== */

.hero {
	display: flex;
	flex-direction: column;
	justify-content: flex-end;
	min-height: calc(100vh - var(--header));
	min-height: calc(100svh - var(--header));
}

.hero__inner {
	width: 100%;
	max-width: 1000px;
	margin-block: auto;
	padding: 56px var(--gutter) 32px;
}

.eyebrow {
	margin-bottom: 18px;
	color: var(--accent);
	font: 700 15px/1.4 var(--nav);
}

.eyebrow span {
	display: inline-block;
	padding-bottom: 2px;
	background: linear-gradient(currentColor, currentColor) left bottom / 0 2px no-repeat;
	animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both, sweep 6s ease-in-out infinite;
}

.eyebrow span:nth-child(2) {
	animation-delay: 0.15s, 3s;
}

@keyframes sweep {
	0% {
		background-position: left bottom;
		background-size: 0 2px;
	}

	15%,
	39% {
		background-position: left bottom;
		background-size: 100% 2px;
	}

	50%,
	100% {
		background-position: right bottom;
		background-size: 0 2px;
	}
}

.hero h1 {
	max-width: 17ch;
	font-size: clamp(38px, 6.4vw, 78px);
	line-height: 1.12;
}

.hero h1 .word {
	display: inline-block;
	animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.hero h1 .swap-line {
	display: block;
}

.swap {
	display: inline-block;
	color: var(--accent);
	transition: opacity 0.3s ease, transform 0.3s ease;
}

.swap.is-out {
	opacity: 0;
	transform: translateY(-0.25em);
}

@keyframes rise {
	from {
		opacity: 0;
		transform: translateY(0.5em);
	}
}

.lede {
	max-width: 58ch;
	margin-top: 26px;
	font-size: clamp(17px, 1.9vw, 20px);
}

.hero__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 28px 0 0;
	padding: 0;
	list-style: none;
}

.hero__tags li {
	padding: 5px 13px;
	border: 1px solid var(--line);
	border-radius: 99px;
	color: var(--ink);
	font: 600 14px var(--nav);
}

/* Monitors stay dark in both themes, as real ones do.
   ========================================================================== */

.monitor {
	--row: clamp(52px, 8vh, 72px);
	margin: 0 var(--gutter) var(--gutter);
	padding: 12px 16px 8px;
	border: 1px solid var(--line);
	background: #0f0f0f;
	color: #b4b4b4;
}

.monitor__row {
	display: grid;
	grid-template-columns: 52px minmax(0, 1fr) 96px;
	grid-template-rows: var(--row);
	gap: 12px;
	align-items: center;
}

.monitor__row + .monitor__row {
	border-top: 1px solid #2c2c2c;
}

.monitor__row canvas {
	display: block;
	width: 100%;
	height: var(--row);
}

.monitor__row--ecg {
	color: #e8737b;
}

.monitor__row--pleth {
	color: #f2f2f2;
}

.monitor__row--resp {
	color: #b4b4b4;
}

.monitor__label {
	font: 600 12px var(--mono);
}

.monitor__value {
	font: 400 clamp(26px, 3.6vw, 38px)/1 var(--mono);
	text-align: right;
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.monitor__value small {
	margin-left: 4px;
	font-size: 11px;
}

.monitor__beat {
	display: inline-block;
	width: 9px;
	height: 9px;
	margin-right: 8px;
	border-radius: 50%;
	background: currentColor;
	vertical-align: middle;
	animation: beat 0.833s ease-out infinite;
}

@keyframes beat {
	0%,
	12% {
		opacity: 1;
		transform: scale(1.25);
	}

	60%,
	100% {
		opacity: 0.2;
		transform: scale(0.8);
	}
}

.monitor__note {
	margin: 6px 0 0;
	color: #9a9a9a;
	font: 11px var(--mono);
	text-align: right;
}

.strip {
	position: relative;
	height: 64px;
	margin-bottom: 14px;
	background: #0f0f0f;
	color: #b4b4b4;
	font: 11px var(--mono);
}

.strip canvas {
	display: block;
	width: 100%;
	height: 100%;
}

.strip span {
	position: absolute;
	top: 5px;
	left: 8px;
}

.strip span:last-child {
	left: calc(42% + 8px);
	color: #e8737b;
}

.pulse {
	height: 56px;
	border-top: 1px solid var(--line);
	background: #0f0f0f;
	color: #e8737b;
}

.pulse canvas {
	display: block;
	width: 100%;
	height: 100%;
}

/* Sections
   ========================================================================== */

.section {
	display: grid;
	grid-template-columns: minmax(150px, 240px) minmax(0, 820px);
	gap: clamp(24px, 6vw, 96px);
	justify-content: center;
	padding: var(--section) var(--gutter);
	border-top: 1px solid var(--line);
}

.section__title {
	align-self: start;
	position: sticky;
	top: calc(var(--header) + 24px);
	font-size: clamp(24px, 2.6vw, 30px);
}

.prose {
	max-width: 66ch;
}

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

.belief {
	margin: 44px 0 0;
	padding-left: 24px;
	border-left: 2px solid var(--accent);
}

.belief .fade-word {
	display: inline-block;
	color: var(--muted);
	opacity: 0.55;
	transform: translateY(0.3em);
	transition: color 0.3s ease, opacity 0.3s ease, transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.belief .fade-word.is-lit {
	color: var(--ink);
	opacity: 1;
	transform: none;
}

.belief p {
	margin: 0;
	color: var(--ink);
	font-family: var(--display);
	font-size: clamp(21px, 2.6vw, 28px);
	line-height: 1.4;
}

.link {
	color: var(--ink);
	font-weight: 600;
	text-decoration-color: var(--accent);
	text-underline-offset: 4px;
}

.note {
	margin: 20px 0 0;
	color: var(--muted);
	font-size: 15px;
}

/* Skills
   ========================================================================== */

.skills {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 40px;
	margin: 0;
}

.skills div {
	padding-block: 16px;
	border-bottom: 1px solid var(--line);
}

.skills dt {
	color: var(--ink);
	font: 700 16px/1.4 var(--nav);
	transition: color 0.2s ease, transform 0.2s ease;
}

.skills div:hover dt {
	color: var(--accent);
	transform: translateX(6px);
}

.skills dd {
	margin: 4px 0 0;
	font-size: 15px;
	line-height: 1.6;
}

/* Projects
   ========================================================================== */

.project + .project {
	margin-top: 72px;
	padding-top: 72px;
	border-top: 1px solid var(--line);
}

.project__kind {
	margin-bottom: 8px;
	color: var(--accent);
	font: 700 14px/1.4 var(--nav);
}

.project h3 {
	margin-bottom: 18px;
	font-size: clamp(25px, 3.4vw, 36px);
}

.project__link {
	margin: 20px 0 0;
}

.tables {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1px;
	margin: 28px 0 0;
	padding: 1px;
	background: var(--line);
	list-style: none;
}

.tables li {
	display: flex;
	align-items: center;
	min-height: 60px;
	padding: 8px 10px;
	background: var(--canvas);
	color: var(--ink);
	font: 12px/1.35 var(--mono);
	overflow-wrap: anywhere;
	transition: background-color 0.35s ease, color 0.35s ease;
}

.tables li.is-lit {
	background: var(--accent);
	color: var(--on-accent);
}

.scrub {
	border: 1px solid var(--line);
	margin-block: 32px;
	padding: clamp(20px, 3vw, 32px);
	background: var(--panel);
}

.scrub__readouts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin-bottom: 20px;
}

.scrub__readouts p {
	margin: 0;
	font-size: 14px;
	line-height: 1.4;
}

.scrub__value {
	display: block;
	color: var(--ink);
	font-family: var(--display);
	font-size: clamp(38px, 6vw, 64px);
	line-height: 1.15;
	font-variant-numeric: tabular-nums;
}

.scrub__control {
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 44px;
}

.scrub__label {
	color: var(--muted);
	font: 600 14px var(--nav);
}

.scrub input {
	flex: 1;
	min-width: 0;
	accent-color: var(--accent);
	cursor: ew-resize;
}

table {
	width: 100%;
	border-collapse: collapse;
	font-size: 15px;
}

caption {
	margin-bottom: 8px;
	color: var(--muted);
	font: 600 14px/1.4 var(--nav);
	text-align: left;
}

th,
td {
	padding: 12px 0 12px 12px;
	border-bottom: 1px solid var(--line);
	text-align: right;
	font-weight: 400;
}

th:first-child {
	padding-left: 0;
	text-align: left;
}

thead th {
	color: var(--muted);
	font-weight: 600;
}

tbody th {
	color: var(--ink);
}

tbody td:last-child {
	color: var(--ink);
	font-weight: 700;
}

.captions {
	border: 1px solid var(--line);
	margin: 28px 0 0;
	background: var(--panel);
}

.captions__screen {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 200px;
	padding: clamp(20px, 4vw, 40px);
	text-align: center;
}

.captions__line {
	margin: 0;
	color: var(--ink);
	font-family: var(--display);
	font-size: clamp(20px, 3.2vw, 32px);
	font-weight: 600;
	line-height: 1.4;
}

.captions__line span {
	padding-inline: 4px;
}

.captions__line .is-current {
	background: var(--accent);
	color: var(--on-accent);
}

.captions__track {
	position: relative;
	display: flex;
	height: 38px;
	border-block: 1px solid var(--line);
}

.captions__word {
	display: grid;
	place-items: center;
	overflow: hidden;
	border-right: 1px solid var(--panel);
	background: var(--line);
	color: var(--ink);
	font: 11px var(--mono);
}

.captions__word.is-current {
	background: var(--accent);
	color: var(--on-accent);
}

.captions__head {
	position: absolute;
	top: 0;
	bottom: 0;
	left: 0;
	width: 2px;
	background: var(--ink);
}

.captions__bar {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 14px;
}

.captions figcaption {
	color: var(--muted);
	font-size: 14px;
	line-height: 1.5;
}

.button {
	flex: none;
	min-width: 72px;
	min-height: 44px;
	padding: 0 18px;
	border: 0;
	background: var(--accent);
	color: var(--on-accent);
	font: 700 15px var(--nav);
	cursor: pointer;
}

.scripts {
	margin: 24px 0 0;
	padding: 0;
	list-style: none;
}

.scripts li {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 16px;
	padding-block: 12px;
	border-bottom: 1px solid var(--line);
	font-size: 15px;
}

.scripts code {
	color: var(--ink);
}

.stats {
	border: 1px solid var(--line);
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin: 28px 0 0;
	padding: clamp(20px, 3vw, 32px);
	background: #0f0f0f;
	color: #b4b4b4;
	list-style: none;
	font-size: 14px;
	line-height: 1.45;
}

.stats strong {
	display: block;
	color: #f2f2f2;
	font: 400 clamp(38px, 6vw, 60px)/1.15 var(--mono);
}

.stats li:first-child strong {
	color: #e8737b;
}

.stats li:last-child strong {
	color: #b4b4b4;
}

/* Debugging and contact
   ========================================================================== */

.fixes {
	display: grid;
	gap: 36px;
	margin: 36px 0 0;
	padding: 0;
	list-style: none;
}

.fixes li {
	padding-top: 16px;
	border-top: 1px solid var(--line);
}

.fixes h3 {
	margin-bottom: 12px;
	font-size: clamp(20px, 2.4vw, 24px);
}

.fixes p {
	margin-bottom: 6px;
	font-size: 15px;
}

.links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 32px;
	margin: 24px 0 0;
	padding: 0;
	list-style: none;
}

.site-footer {
	padding: 28px var(--gutter);
	border-top: 1px solid var(--line);
	color: var(--muted);
	font-size: 14px;
}

/* Reveal: only applies once the script has confirmed it can undo it.
   ========================================================================== */

.js-motion .reveal {
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.6s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.js-motion .reveal.is-in {
	opacity: 1;
	transform: none;
}

/* Not found
   ========================================================================== */

.not-found {
	padding: var(--section) var(--gutter);
}

.not-found h1 {
	margin-bottom: 20px;
	font-size: clamp(30px, 5vw, 52px);
}

/* Responsive
   ========================================================================== */

@media (max-width: 860px) {
	.section {
		grid-template-columns: minmax(0, 1fr);
		gap: 24px;
	}

	.section__title {
		position: static;
	}

	.tables {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	:root {
		--header: 60px;
	}

	.site-header {
		gap: 12px;
	}

	.site-title {
		font-size: 14px;
		letter-spacing: 0.5px;
	}

	.site-header nav {
		gap: 10px;
		font-size: 13px;
	}

	.site-header nav a:nth-child(3) {
		display: none;
	}

	.theme-toggle {
		width: 32px;
		margin-right: -6px;
	}

	.skills,
	.scripts li {
		grid-template-columns: minmax(0, 1fr);
	}

	.scripts li {
		gap: 2px;
	}

	.tables {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.captions__bar {
		flex-wrap: wrap;
	}

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

	.monitor {
		padding-inline: 10px;
	}

	.monitor__row {
		grid-template-columns: 38px minmax(0, 1fr) 92px;
		gap: 8px;
	}

	.monitor__label {
		font-size: 11px;
	}
}

@media (max-width: 400px) {
	.site-header {
		gap: 8px;
	}

	.site-title {
		font-size: 13px;
		letter-spacing: 0.3px;
	}

	.site-header nav {
		gap: 8px;
		font-size: 12.5px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.monitor__beat,
	.eyebrow span {
		animation: none;
	}
}
