/* ==========================================================================
   stevengorrell.com — design tokens
   Surfaces, ink and accents follow a validated palette. Accent-as-text steps
   are chosen per mode so link text clears 4.5:1 against its own surface.
   ========================================================================== */

:root {
	color-scheme: light;

	--plane:            #f9f9f7;
	--surface:          #fcfcfb;
	--surface-raised:   #ffffff;

	--ink:              #0b0b0b;
	--ink-secondary:    #52514e;
	--ink-muted:        #63625d;

	--rule:             #e1e0d9;
	--rule-strong:      #c3c2b7;
	--ring:             rgba(11, 11, 11, 0.10);

	--accent:           #2a78d6; /* marks, rules, fills */
	--accent-text:      #1f66bd; /* 5.5:1 on --surface */
	--accent-soft:      rgba(42, 120, 214, 0.10);
	--accent-2:         #1baf7a;

	--shadow-sm:        0 1px 2px rgba(11, 11, 11, 0.06);
	--shadow-md:        0 4px 16px -4px rgba(11, 11, 11, 0.12), 0 1px 3px rgba(11, 11, 11, 0.06);

	--font-sans:        "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono:        ui-monospace, SFMono-Regular, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;

	--measure:          64ch;
	--gutter:           clamp(1.25rem, 4vw, 3rem);
	--shell:            72rem;
	--radius:           10px;
	--radius-lg:        16px;
}

/* Dark values are selected for the dark surface, not an automatic flip.
   Declared under both the OS query and the toggle scope so the toggle wins. */
@media (prefers-color-scheme: dark) {
	:root:where(:not([data-theme="light"])) {
		color-scheme: dark;
		--plane:          #0d0d0d;
		--surface:        #1a1a19;
		--surface-raised: #222221;
		--ink:            #ffffff;
		--ink-secondary:  #c3c2b7;
		--ink-muted:      #a3a29a;
		--rule:           #2c2c2a;
		--rule-strong:    #383835;
		--ring:           rgba(255, 255, 255, 0.10);
		--accent:         #3987e5;
		--accent-text:    #5b9ff0; /* 6.4:1 on dark --surface */
		--accent-soft:    rgba(57, 135, 229, 0.14);
		--accent-2:       #199e70;
		--shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.4);
		--shadow-md:      0 4px 20px -6px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.4);
	}
}

:root[data-theme="dark"] {
	color-scheme: dark;
	--plane:          #0d0d0d;
	--surface:        #1a1a19;
	--surface-raised: #222221;
	--ink:            #ffffff;
	--ink-secondary:  #c3c2b7;
	--ink-muted:      #a3a29a;
	--rule:           #2c2c2a;
	--rule-strong:    #383835;
	--ring:           rgba(255, 255, 255, 0.10);
	--accent:         #3987e5;
	--accent-text:    #5b9ff0;
	--accent-soft:    rgba(57, 135, 229, 0.14);
	--accent-2:       #199e70;
	--shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.4);
	--shadow-md:      0 4px 20px -6px rgba(0, 0, 0, 0.6), 0 1px 3px rgba(0, 0, 0, 0.4);
}

/* ---------- reset ---------- */

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

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

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

body {
	margin: 0;
	background: var(--plane);
	color: var(--ink);
	font-family: var(--font-sans);
	font-size: clamp(1rem, 0.97rem + 0.15vw, 1.0625rem);
	line-height: 1.65;
	font-feature-settings: "kern" 1, "liga" 1, "cv11" 1;
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
	margin: 0;
	line-height: 1.15;
	letter-spacing: -0.02em;
	font-weight: 650;
	text-wrap: balance;
}

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }

a {
	color: var(--accent-text);
	text-decoration: none;
	text-underline-offset: 0.18em;
	text-decoration-thickness: 1px;
	transition: color 0.15s ease;
}
a:hover { color: var(--ink); text-decoration: underline; }

:where(a, button, summary, [tabindex]):focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 4px;
}

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

.skip-link {
	position: absolute;
	top: 0; left: 50%;
	transform: translate(-50%, -120%);
	z-index: 100;
	padding: 0.7rem 1.25rem;
	background: var(--accent);
	color: #fff;
	border-radius: 0 0 var(--radius) var(--radius);
	font-weight: 600;
	transition: transform 0.18s ease;
}
.skip-link:focus { transform: translate(-50%, 0); color: #fff; }

/* ---------- layout ---------- */

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

.section {
	padding-block: clamp(3.5rem, 8vw, 6.5rem);
	border-top: 1px solid var(--rule);
}

.section--surface { background: var(--surface); }

.section__head { margin-bottom: clamp(2rem, 4vw, 3rem); }

.eyebrow {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0 0 0.85rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--ink-muted);
}
.eyebrow::before {
	content: "";
	width: 1.5rem;
	height: 2px;
	background: var(--accent);
	flex: none;
}

.section__title {
	font-size: clamp(1.65rem, 1.2rem + 1.6vw, 2.4rem);
}

.section__intro {
	margin-top: 1rem;
	max-width: var(--measure);
	color: var(--ink-secondary);
	font-size: 1.05rem;
}

/* ---------- header / nav ---------- */

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

.nav {
	display: flex;
	align-items: center;
	gap: 1rem;
	min-height: 4rem;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 0.7rem;
	margin-right: auto;
	color: var(--ink);
	font-weight: 650;
	letter-spacing: -0.01em;
}
.brand:hover { color: var(--ink); text-decoration: none; }

.brand__mark {
	display: grid;
	place-items: center;
	width: 2.1rem; height: 2.1rem;
	flex: none;
	border-radius: 7px;
	background: var(--accent);
	color: #fff;
	font-family: var(--font-mono);
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.nav__list {
	display: flex;
	align-items: center;
	gap: 0.25rem;
}

.nav__link {
	display: block;
	padding: 0.45rem 0.7rem;
	border-radius: 7px;
	color: var(--ink-secondary);
	font-size: 0.9375rem;
	font-weight: 500;
}
.nav__link:hover {
	color: var(--ink);
	background: var(--accent-soft);
	text-decoration: none;
}
.nav__link[aria-current="true"] {
	color: var(--accent-text);
	background: var(--accent-soft);
}

.icon-button {
	display: grid;
	place-items: center;
	width: 2.35rem; height: 2.35rem;
	flex: none;
	padding: 0;
	border: 1px solid var(--rule);
	border-radius: 8px;
	background: var(--surface);
	color: var(--ink-secondary);
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-button:hover { color: var(--ink); border-color: var(--rule-strong); }
.icon-button svg { width: 1.05rem; height: 1.05rem; }

[data-theme="dark"] .icon-button__sun,
.icon-button__moon { display: none; }
[data-theme="dark"] .icon-button__moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:where(:not([data-theme="light"])) .icon-button__sun { display: none; }
	:root:where(:not([data-theme="light"])) .icon-button__moon { display: block; }
}

.nav__toggle { display: none; }

@media (max-width: 47.99em) {
	.nav__toggle { display: grid; }
	.nav__list {
		position: absolute;
		inset: 100% 0 auto;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 0.5rem var(--gutter) 1rem;
		background: var(--plane);
		border-bottom: 1px solid var(--rule);
		box-shadow: var(--shadow-md);
	}
	.nav__list[hidden] { display: none; }
	.nav__link { padding: 0.7rem 0.75rem; font-size: 1rem; }
}

/* ---------- hero ---------- */

.hero {
	position: relative;
	padding-block: clamp(3.5rem, 9vw, 7rem) clamp(3rem, 6vw, 5rem);
	overflow: hidden;
}

.hero::before {
	content: "";
	position: absolute;
	inset: -30% -10% auto;
	height: 34rem;
	background: radial-gradient(60% 60% at 25% 40%, var(--accent-soft), transparent 70%);
	pointer-events: none;
}

.hero__inner { position: relative; }

.hero__positioning {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.5rem 0.9rem;
	margin: 0 0 1.4rem;
	font-family: var(--font-mono);
	font-size: 0.78rem;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ink-muted);
}
.hero__positioning li { display: flex; align-items: center; gap: 0.9rem; }

/* The role leads; the specialities are supporting detail. */
.hero__positioning li:first-child {
	color: var(--ink-secondary);
	font-weight: 600;
}
/* Separator trails its own item rather than leading the next one, so a
   wrapped line starts with a word instead of a dangling dot. */
.hero__positioning li:not(:last-child)::after {
	content: "";
	width: 3px; height: 3px;
	border-radius: 50%;
	background: var(--rule-strong);
}

.hero__name {
	font-size: clamp(2.6rem, 1.5rem + 4.6vw, 4.5rem);
	letter-spacing: -0.035em;
	font-weight: 700;
}

.hero__role {
	margin: 0.9rem 0 0;
	max-width: 34ch;
	font-size: clamp(1.25rem, 1rem + 1vw, 1.75rem);
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: -0.02em;
	color: var(--ink-secondary);
	text-wrap: balance;
}
.hero__role strong { color: var(--ink); font-weight: 600; }

.hero__lede {
	margin: 1.6rem 0 0;
	max-width: var(--measure);
	font-size: 1.075rem;
	color: var(--ink-secondary);
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.7rem;
	margin-top: 2rem;
}

/* ---------- buttons ---------- */

.button {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.68rem 1.15rem;
	border: 1px solid transparent;
	border-radius: 9px;
	font-size: 0.9375rem;
	font-weight: 550;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}
.button:hover { text-decoration: none; transform: translateY(-1px); }
.button svg { width: 1.05em; height: 1.05em; flex: none; }

.button--primary {
	background: var(--accent);
	color: #fff;
}
.button--primary:hover { background: var(--accent-text); color: #fff; }
[data-theme="dark"] .button--primary:hover { background: #5b9ff0; color: #0d0d0d; }

.button--ghost {
	background: var(--surface);
	border-color: var(--rule-strong);
	color: var(--ink);
}
.button--ghost:hover { border-color: var(--accent); color: var(--accent-text); }

/* ---------- KPI row (stat tiles) ---------- */

.kpi-row {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
	gap: 1px;
	margin-top: clamp(2.5rem, 5vw, 3.5rem);
	background: var(--rule);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	overflow: hidden;
}

.kpi {
	padding: 1.15rem 1.25rem 1.25rem;
	background: var(--surface);
}

.kpi__value {
	font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem);
	font-weight: 600;
	letter-spacing: -0.035em;
	line-height: 1;
	font-variant-numeric: tabular-nums;
	color: var(--ink);
}
.kpi__value span { font-size: 0.6em; font-weight: 500; color: var(--ink-muted); }

.kpi__label {
	margin: 0.55rem 0 0;
	font-size: 0.8125rem;
	line-height: 1.4;
	color: var(--ink-secondary);
}

.kpi__note {
	display: block;
	margin-top: 0.15rem;
	font-size: 0.75rem;
	color: var(--ink-muted);
}

/* ---------- prose + two-column ---------- */

.split {
	display: grid;
	gap: clamp(2rem, 5vw, 4rem);
	grid-template-columns: 1fr;
}
@media (min-width: 56em) {
	.split { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); align-items: start; }
}

.prose { max-width: var(--measure); }
.prose p { margin-bottom: 1.15rem; font-size: 1.05rem; color: var(--ink-secondary); }
.prose strong { color: var(--ink); font-weight: 600; }

.callout {
	padding: 1.5rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
}
.callout__title {
	margin-bottom: 0.9rem;
	font-size: 0.78rem;
	font-family: var(--font-mono);
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-muted);
}
.callout ul { display: grid; gap: 0.7rem; }
.callout li {
	position: relative;
	padding-left: 1.3rem;
	font-size: 0.9375rem;
	color: var(--ink-secondary);
}
.callout li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.6em;
	width: 6px; height: 6px;
	border-radius: 2px;
	background: var(--accent);
}

/* ---------- capability grid ---------- */

.cards {
	display: grid;
	gap: 1rem;
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
}

.card {
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	padding: 1.4rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	box-shadow: var(--shadow-sm);
	transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.card:hover {
	border-color: var(--rule-strong);
	transform: translateY(-2px);
	box-shadow: var(--shadow-md);
}

.card__icon {
	display: grid;
	place-items: center;
	width: 2.25rem; height: 2.25rem;
	margin-bottom: 0.3rem;
	border-radius: 8px;
	background: var(--accent-soft);
	color: var(--accent-text);
}
.card__icon svg { width: 1.15rem; height: 1.15rem; }

.card__title { font-size: 1.0625rem; font-weight: 600; }
.card__body { font-size: 0.9375rem; color: var(--ink-secondary); }

/* ---------- work / project entries ---------- */

.work-list { display: grid; gap: 1.25rem; }

.work {
	padding: clamp(1.4rem, 3vw, 2rem);
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow-sm);
	transition: border-color 0.18s ease, box-shadow 0.18s ease;
}
.work:hover { border-color: var(--rule-strong); box-shadow: var(--shadow-md); }

.work__head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5rem 1rem;
	margin-bottom: 0.35rem;
}

.work__title {
	font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
	font-weight: 620;
}

.work__meta {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem 0.9rem;
	margin-bottom: 1rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.04em;
	color: var(--ink-muted);
}
.work__meta li { display: flex; align-items: center; gap: 0.9rem; }
.work__meta li + li::before {
	content: "";
	width: 3px; height: 3px;
	border-radius: 50%;
	background: var(--rule-strong);
}

.work__body {
	max-width: var(--measure);
	font-size: 0.9875rem;
	color: var(--ink-secondary);
}

.work__points {
	display: grid;
	gap: 0.5rem;
	margin: 1.1rem 0 0;
	max-width: var(--measure);
}
.work__points li {
	position: relative;
	padding-left: 1.3rem;
	font-size: 0.9375rem;
	color: var(--ink-secondary);
}
.work__points li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.6em;
	width: 6px; height: 6px;
	border-radius: 2px;
	background: var(--accent);
}

.tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin-top: 1.25rem;
	padding-top: 1.1rem;
	border-top: 1px solid var(--rule);
}

.tag {
	padding: 0.22rem 0.6rem;
	border: 1px solid var(--rule);
	border-radius: 5px;
	background: var(--plane);
	font-family: var(--font-mono);
	font-size: 0.7188rem;
	letter-spacing: 0.02em;
	color: var(--ink-secondary);
	white-space: nowrap;
}

/* ---------- timeline ---------- */

.timeline {
	display: grid;
	gap: 0;
	max-width: 56rem;
	border-left: 2px solid var(--rule);
	padding-left: clamp(1.25rem, 3vw, 2rem);
	margin-left: 0.35rem;
}

.role { position: relative; padding-block: 0.9rem 1.6rem; }
.role:last-child { padding-bottom: 0; }

.role::before {
	content: "";
	position: absolute;
	left: calc(-1 * clamp(1.25rem, 3vw, 2rem) - 6px);
	top: 1.55rem;
	width: 10px; height: 10px;
	border-radius: 50%;
	background: var(--accent);
	box-shadow: 0 0 0 4px var(--plane);
}
.section--surface .role::before { box-shadow: 0 0 0 4px var(--surface); }

.role__period {
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.08em;
	color: var(--ink-muted);
}

.role__title {
	margin: 0.35rem 0 0.15rem;
	font-size: 1.075rem;
	font-weight: 600;
}

.role__org { font-size: 0.9rem; color: var(--ink-muted); }

.role__body {
	margin-top: 0.6rem;
	max-width: var(--measure);
	font-size: 0.9375rem;
	color: var(--ink-secondary);
}

.role__points { display: grid; gap: 0.4rem; margin-top: 0.7rem; max-width: var(--measure); }
.role__points li {
	position: relative;
	padding-left: 1.2rem;
	font-size: 0.9063rem;
	color: var(--ink-secondary);
}
.role__points li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.62em;
	width: 5px; height: 5px;
	border-radius: 2px;
	background: var(--rule-strong);
}

/* ---------- credential lists ---------- */

.cred-group + .cred-group { margin-top: 2rem; }

.cred-group__title {
	margin-bottom: 0.9rem;
	font-family: var(--font-mono);
	font-size: 0.75rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--ink-muted);
}

.creds {
	display: grid;
	gap: 0.5rem;
	grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
}

.cred {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 0.7rem;
	align-items: start;
	padding: 0.7rem 0.9rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: 8px;
	font-size: 0.9063rem;
	color: var(--ink-secondary);
}
.cred svg { width: 1rem; height: 1rem; margin-top: 0.25em; color: var(--accent-text); flex: none; }
.cred strong { display: block; color: var(--ink); font-weight: 550; }
.cred span { font-size: 0.8125rem; color: var(--ink-muted); }

/* ---------- contact ---------- */

.contact-grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
	margin-top: 2rem;
	max-width: 52rem;
}

.contact-link {
	display: flex;
	align-items: center;
	gap: 0.85rem;
	padding: 1rem 1.15rem;
	background: var(--surface);
	border: 1px solid var(--rule);
	border-radius: var(--radius);
	color: var(--ink);
	font-weight: 550;
	box-shadow: var(--shadow-sm);
	transition: border-color 0.18s ease, transform 0.18s ease;
}
.contact-link:hover {
	border-color: var(--accent);
	color: var(--ink);
	text-decoration: none;
	transform: translateY(-2px);
}
.contact-link svg { width: 1.15rem; height: 1.15rem; flex: none; color: var(--accent-text); }
.contact-link small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--ink-muted); }

/* ---------- footer ---------- */

.site-footer {
	padding-block: 2.5rem;
	border-top: 1px solid var(--rule);
	font-size: 0.875rem;
	color: var(--ink-muted);
}

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

/* ---------- reveal ---------- */

/* Gated on .js so content is never hidden by CSS alone — if the script
   fails to run, everything simply renders without the entrance animation. */
@media (prefers-reduced-motion: no-preference) {
	.js .reveal {
		opacity: 0;
		transform: translateY(12px);
		transition: opacity 0.5s ease, transform 0.5s ease;
	}
	.js .reveal.is-visible { opacity: 1; transform: none; }
}
