/* ==========================================================================
   stevengorrell.com
   An understated practice page: serif headlines, sans for reading, structure
   from hairline rules and alignment rather than boxes. Colour follows
   60-30-10 (neutral ground, navy bands, amber accent); see DESIGN.md.
   ========================================================================== */

@font-face {
	font-family: "Source Serif 4";
	src: url("../fonts/source-serif-4-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 900;
	font-style: normal;
	font-display: swap;
}
@font-face {
	font-family: "Source Sans 3";
	src: url("../fonts/source-sans-3-latin-wght-italic.woff2") format("woff2");
	font-weight: 200 900;
	font-style: italic;
	font-display: swap;
}

/* ---------- tokens ----------
   60-30-10: a soft neutral ground carries ~60% of the page, deep navy bands
   (opening, capabilities, contact, footer) ~30%, and amber the last ~10%:
   the primary action, the current-section marker and the rules that open
   each featured case. Contrast notes are against the surface each token
   actually sits on. */

:root {
	color-scheme: light;

	--ground:        #f7f6f3;   /* 60 */
	--navy:          #0f2a47;   /* 30 */
	--accent:        #e3a043;   /* 10, fills and rules */

	--ink:           #0f1b2b;   /* 16:1 on ground */
	--ink-2:         #3f4a5a;   /* 8.3:1 */
	--ink-3:         #5c6675;   /* 5.4:1 */
	--rule:          #dedbd3;
	--rule-strong:   #0f2a47;

	--brand:         #14365c;   /* links on ground, 11.4:1 */
	--brand-hover:   #0f1b2b;
	--accent-text:   #9c5f12;   /* amber as text on ground, 4.8:1 */
	--action:        #e3a043;
	--action-hover:  #ecb35c;
	--on-action:     #0f2a47;   /* 6.5:1 on --action, 7.7:1 on hover */
	--focus:         #14365c;

	--band-ink:      #ffffff;   /* 14.6:1 on navy */
	--band-ink-2:    #c9d4e3;   /* 9.7:1 */
	--band-ink-3:    #9fb0c6;   /* 6.6:1 */
	--band-rule:     #2a4466;
	--band-link:     #ecb35c;   /* 7.7:1 */
	--band-rule-strong: #5a7397;

	--serif: "Source Serif 4", Georgia, "Times New Roman", serif;
	--sans:  "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

	--measure: 68ch;
	--shell:   76rem;
	--gutter:  clamp(1.25rem, 4vw, 3rem);
	--section: clamp(4rem, 9vw, 7.5rem);
}

/* Dark keeps the same three roles: navy-black ground, a lifted navy for the
   bands, and the same amber. */
@media (prefers-color-scheme: dark) {
	:root:where(:not([data-theme="light"])) {
		color-scheme: dark;
		--ground:       #0b1626;
		--navy:         #13294a;
		--accent:       #e9a849;
		--ink:          #eef1f5;   /* 16.0:1 */
		--ink-2:        #c0c8d4;   /* 10.8:1 */
		--ink-3:        #94a0b1;   /* 6.9:1 */
		--rule:         #1f314d;
		--rule-strong:  #eef1f5;
		--brand:        #f2c27a;   /* 11:1 */
		--brand-hover:  #ffffff;
		--accent-text:  #e9a849;   /* 8.8:1 */
		--action:       #e9a849;
		--action-hover: #f2c27a;
		--on-action:    #0b1626;   /* 8.8:1 */
		--focus:        #f2c27a;
		--band-ink:     #eef1f5;   /* 12.8:1 on band navy */
		--band-ink-2:   #c6d3e6;   /* 9.6:1, tinted from the navy */
		--band-ink-3:   #a3b6d0;   /* 7.0:1 */
		--band-rule:    #2b4468;
		--band-link:    #f2c27a;
		--band-rule-strong: #5b7499;
	}
}
:root[data-theme="dark"] {
	color-scheme: dark;
	--ground:       #0b1626;
	--navy:         #13294a;
	--accent:       #e9a849;
	--ink:          #eef1f5;
	--ink-2:        #c0c8d4;
	--ink-3:        #94a0b1;
	--rule:         #1f314d;
	--rule-strong:  #eef1f5;
	--brand:        #f2c27a;
	--brand-hover:  #ffffff;
	--accent-text:  #e9a849;
	--action:       #e9a849;
	--action-hover: #f2c27a;
	--on-action:    #0b1626;
	--focus:        #f2c27a;
	--band-ink:     #eef1f5;
	--band-ink-2:   #c6d3e6;
	--band-ink-3:   #a3b6d0;
	--band-rule:    #2b4468;
	--band-link:    #f2c27a;
	--band-rule-strong: #5b7499;
}

/* A navy band re-maps the ink tokens, so everything inside it (links, rules,
   focus, the button) adapts without per-section overrides. */
.band {
	--ink:         var(--band-ink);
	--ink-2:       var(--band-ink-2);
	--ink-3:       var(--band-ink-3);
	--rule:        var(--band-rule);
	--rule-strong: var(--band-rule-strong);
	--brand:       var(--band-link);
	--brand-hover: var(--band-ink);
	--focus:       var(--band-link);
	background: var(--navy);
	color: var(--ink);
	border-top-color: transparent;
}

/* ---------- base ---------- */

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

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

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

html { scrollbar-color: var(--ink-3) var(--ground); }

body {
	margin: 0;
	background: var(--ground);
	color: var(--ink);
	font-family: var(--sans);
	font-size: clamp(1.0625rem, 1rem + 0.2vw, 1.1875rem);
	line-height: 1.6;
	font-kerning: normal;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; text-wrap: balance; }
p { margin: 0 0 1em; text-wrap: pretty; }
p:last-child { margin-bottom: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; list-style: none; }
svg { display: block; }

a {
	color: var(--brand);
	text-decoration-line: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
	transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover { color: var(--brand-hover); text-decoration-color: currentColor; }

::selection { background: var(--action); color: var(--on-action); }

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

.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: 1rem;
	z-index: 100;
	padding: 0.75rem 1.25rem;
	background: var(--action);
	color: var(--on-action);
	font-weight: 600;
	text-decoration: none;
	transform: translateY(-120%);
	transition: transform 0.18s ease;
}
.skip-link:focus { transform: none; color: var(--on-action); }

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

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

/* Twelve columns: a narrow aside (heading, meta) beside the main text. */
.grid {
	display: grid;
	gap: 1.25rem clamp(2rem, 5vw, 4.5rem);
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 60em) {
	.grid { grid-template-columns: repeat(12, minmax(0, 1fr)); }
	.grid__aside { grid-column: 1 / span 4; }
	.grid__main  { grid-column: 5 / span 8; }
}

.section {
	padding-block: var(--section);
	border-top: 1px solid var(--rule);
}

.section__head { margin-bottom: clamp(2.5rem, 5vw, 4rem); max-width: 48rem; }

.section__title {
	font-family: var(--serif);
	font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.6rem);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.01em;
}
.section__title--large { font-size: clamp(2.2rem, 1.5rem + 2.6vw, 3.6rem); }

.lede {
	margin-bottom: 1.5rem;
	font-family: var(--serif);
	font-size: clamp(1.3rem, 1.1rem + 0.7vw, 1.65rem);
	line-height: 1.35;
	color: var(--ink);
}

.section__intro {
	margin-top: 1.1rem;
	max-width: var(--measure);
	color: var(--ink-2);
	font-size: 1.125em;
}

.prose { max-width: var(--measure); }
.prose p { color: var(--ink-2); }
.prose strong { color: var(--ink); font-weight: 600; }

.bullets { display: grid; gap: 0.6rem; margin-top: 1.25rem; }
.prose p + .bullets { margin-top: 0; }
.bullets li {
	position: relative;
	padding-left: 1.25rem;
	color: var(--ink-2);
}
.bullets li::before {
	content: "";
	position: absolute;
	left: 0; top: 0.78em;
	width: 0.55rem; height: 1px;
	background: var(--ink-3);
}

.meta-label {
	display: block;
	margin-bottom: 0.35rem;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--ink);
}

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

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--ground);
	border-bottom: 1px solid var(--rule);
}

.nav {
	display: flex;
	align-items: center;
	gap: 0.5rem 1.75rem;
	min-height: 4.25rem;
}

.wordmark {
	margin-right: auto;
	font-family: var(--serif);
	font-size: 1.3rem;
	font-weight: 600;
	letter-spacing: -0.005em;
	color: var(--ink);
	text-decoration: none;
}
.wordmark:hover { color: var(--ink); }

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

.nav__link {
	display: block;
	padding-block: 0.4rem;
	color: var(--ink-2);
	font-size: 1rem;
	font-weight: 500;
	text-decoration: none;
	box-shadow: inset 0 -2px 0 transparent;
	transition: color 0.15s ease, box-shadow 0.15s ease;
}
.nav__link:hover { color: var(--ink); }
.nav__link[aria-current="location"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }

.icon-button {
	display: grid;
	place-items: center;
	width: 2.75rem; height: 2.75rem;
	flex: none;
	padding: 0;
	border: 1px solid var(--rule);
	border-radius: 2px;
	background: transparent;
	color: var(--ink-2);
	cursor: pointer;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.icon-button:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-button svg { width: 1.1rem; height: 1.1rem; }

[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; }
}

/* Both controls need site.js; without it they would be dead buttons. */
html:not(.js) [data-theme-toggle] { display: none; }

.nav__toggle { display: none; }

@media (max-width: 47.99em) {
	/* Without JavaScript the links wrap onto their own row in normal flow,
	   so nothing can cover the page. */
	.nav { flex-wrap: wrap; column-gap: 0.75rem; }
	html:not(.js) .site-header { position: static; }
	html:not(.js) .nav__list {
		flex-basis: 100%;
		flex-wrap: wrap;
		gap: 0.25rem 1.25rem;
		padding-bottom: 0.75rem;
	}
	.js .nav__toggle { display: grid; }
	/* With JavaScript it is a dropdown, closed until site.js opens it. */
	.js .nav__list {
		position: absolute;
		inset: 100% 0 auto;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		padding: 0.5rem var(--gutter) 1rem;
		background: var(--ground);
		border-bottom: 1px solid var(--rule);
	}
	.js .nav__list:not(.is-open) { display: none; }
	.js .nav__link { padding-block: 0.8rem; font-size: 1.0625rem; border-bottom: 1px solid var(--rule); box-shadow: none; }
	.js .nav__list li:last-child .nav__link { border-bottom: 0; }
	.js .nav__link[aria-current="location"] { color: var(--ink); font-weight: 600; }
}

/* ---------- opening ---------- */

.opening { padding-block: clamp(4.5rem, 11vw, 9rem) clamp(4.5rem, 10vw, 8rem); }

.opening__statement {
	max-width: 21ch;
	font-family: var(--serif);
	font-size: clamp(2.3rem, 1.4rem + 3.8vw, 4.5rem);
	font-weight: 450;
	line-height: 1.06;
	letter-spacing: -0.02em;
	text-wrap: pretty;
}

.opening__subline {
	margin-top: clamp(1.5rem, 3vw, 2.25rem);
	max-width: 46ch;
	color: var(--ink-2);
	font-size: clamp(1.15rem, 1rem + 0.5vw, 1.4rem);
	line-height: 1.5;
}

.opening__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 2rem;
	margin-top: clamp(2rem, 4vw, 2.75rem);
}

.button {
	display: inline-flex;
	align-items: center;
	min-height: 3rem;
	padding: 0.7rem 1.6rem;
	background: var(--action);
	color: var(--on-action);
	border-radius: 2px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.15s ease;
}
.button:hover { background: var(--action-hover); color: var(--on-action); }

.text-link {
	font-weight: 600;
	text-decoration-color: currentColor;
}

/* ---------- capabilities ---------- */

.capabilities {
	display: grid;
	gap: 0 clamp(2rem, 5vw, 4.5rem);
	margin-top: clamp(2.5rem, 5vw, 3.5rem);
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 44em) { .capabilities { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68em) { .capabilities { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.capability {
	padding-block: 1.5rem 2rem;
	border-top: 1px solid var(--rule-strong);
}
.capability dt {
	font-family: var(--serif);
	font-size: 1.3rem;
	font-weight: 600;
	line-height: 1.25;
}
.capability dd { margin-top: 0.7rem; color: var(--ink-2); font-size: 0.97em; }

/* ---------- case studies ---------- */

.case {
	position: relative;
	padding-block: clamp(2.5rem, 5vw, 3.5rem);
	border-top: 1px solid var(--rule);
}
/* The 10%: a short amber rule opens each featured case. */
.case::before {
	content: "";
	position: absolute;
	top: -1px; left: 0;
	width: 4rem; height: 3px;
	background: var(--accent);
}

.case__title {
	font-family: var(--serif);
	font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2.3rem);
	font-weight: 500;
	line-height: 1.15;
	letter-spacing: -0.01em;
	max-width: 22ch;
}
.case__body { font-size: 1.05em; }
.case__head .meta-label { margin-top: 2rem; color: var(--accent-text); }

/* The stack is a real column: one item per line on a hairline, so the left
   side carries weight against the write-up instead of a footnote. */
.stack { border-top: 1px solid var(--rule-strong); }
.stack li {
	padding-block: 0.55rem;
	border-bottom: 1px solid var(--rule);
	color: var(--ink);
	font-size: 1.0625rem;
}
@media (max-width: 59.99em) {
	.stack { display: flex; flex-wrap: wrap; gap: 0 1.25rem; border-top: 0; }
	.stack li { border-bottom: 0; padding-block: 0.15rem; color: var(--ink-2); }
	.case__body { margin-top: 1.5rem; }
}

/* ---------- more systems ---------- */

.subhead {
	margin-top: clamp(3rem, 6vw, 4.5rem);
	margin-bottom: 1rem;
	font-family: var(--serif);
	font-size: 1.4rem;
	font-weight: 600;
}

.more { border-bottom: 1px solid var(--rule); }
.more > li { border-top: 1px solid var(--rule); }

.more__item summary {
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	gap: 0.3rem 1.5rem;
	align-items: baseline;
	padding-block: 1.3rem;
	cursor: pointer;
	list-style: none;
}
.more__item summary::-webkit-details-marker { display: none; }
.more__item summary::after {
	content: "";
	grid-column: 2;
	grid-row: 1 / span 2;
	align-self: center;
	width: 0.6rem; height: 0.6rem;
	border-right: 1.5px solid var(--ink-2);
	border-bottom: 1.5px solid var(--ink-2);
	transform: rotate(45deg) translateY(-25%);
	transition: transform 0.2s ease;
}
.more__item[open] summary::after { transform: rotate(-135deg) translateY(-25%); }

.more__title { grid-column: 1; font-weight: 600; font-size: 1.1em; color: var(--ink); }
.more__outcome { grid-column: 1; color: var(--ink-2); }
.more__item summary:hover .more__title { color: var(--brand); }

@media (min-width: 60em) {
	.more__item summary { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(2rem, 5vw, 4.5rem); }
	.more__title { grid-column: 1 / span 4; }
	.more__outcome { grid-column: 5 / span 7; }
	.more__item summary::after { grid-column: 12; grid-row: 1; justify-self: end; }
	.more__body { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: clamp(2rem, 5vw, 4.5rem); }
	.more__body > * { grid-column: 5 / span 8; }
}

.more__body { padding-bottom: 2rem; }
.more__body.prose { max-width: none; }
.more__body > * { max-width: var(--measure); }
.more__stack { margin-top: 1.25rem; color: var(--ink-2); font-size: 0.95rem; }
.more__stack .meta-label { display: inline; margin-right: 0.4rem; }

/* ---------- public work ---------- */

.entries { border-bottom: 1px solid var(--rule); }
.entry { padding-block: 1.75rem; border-top: 1px solid var(--rule); }
.entries .entry:first-child { border-top-color: var(--rule-strong); }

.entry__title {
	font-family: var(--serif);
	font-size: 1.3rem;
	font-weight: 600;
	line-height: 1.25;
}
.entry__title a { color: var(--ink); text-decoration-color: color-mix(in srgb, var(--ink) 30%, transparent); }
.entry__title a:hover { color: var(--brand); text-decoration-color: currentColor; }
.entry__meta { margin-top: 0.4rem; color: var(--ink-3); font-size: 0.95rem; }
.entry__body { color: var(--ink-2); max-width: var(--measure); }

/* ---------- certifications ---------- */

.cert-groups {
	display: grid;
	gap: 0 clamp(2rem, 5vw, 4.5rem);
	margin-top: clamp(2.5rem, 5vw, 3.5rem);
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 44em) { .cert-groups { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 68em) { .cert-groups { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.cert-group { padding-block: 1.5rem 2rem; border-top: 1px solid var(--rule-strong); }
.cert-group__title { font-size: 1rem; font-weight: 600; margin-bottom: 1rem; }
.certs { display: grid; gap: 0.85rem; }
.certs li { display: grid; line-height: 1.35; }
.cert__name { color: var(--ink); }
.cert__sub { color: var(--ink-3); font-size: 0.9rem; font-variant-numeric: tabular-nums; }

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


.contact__intro { max-width: var(--measure); color: var(--ink-2); font-size: 1.125em; }

.contact__email {
	display: inline-block;
	margin-top: 2rem;
	font-family: var(--serif);
	font-size: clamp(1.5rem, 1.1rem + 1.8vw, 2.4rem);
	font-weight: 500;
	line-height: 1.2;
	overflow-wrap: anywhere;
	text-decoration-thickness: 2px;
	text-underline-offset: 0.18em;
}

.contact__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 2rem;
	margin-top: 2.25rem;
}
.contact__links a {
	display: inline-flex;
	align-items: center;
	gap: 0.55rem;
	min-height: 2.75rem;
	color: var(--ink-2);
	font-weight: 600;
	text-decoration: none;
}
.contact__links a:hover { color: var(--brand); }
.contact__links svg { width: 1.1rem; height: 1.1rem; }

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

.site-footer {
	padding-block: 2rem;
	border-top: 1px solid var(--band-rule);
	color: var(--ink-3);
	font-size: 0.95rem;
}
.site-footer__inner {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	justify-content: space-between;
}
.site-footer a { color: var(--ink-2); }

/* .section's border-top shorthand comes later and would undo .band's. */
.section.band { border-top-color: transparent; }
