/* Theme and portfolio overrides loaded after main.css. */

:root,
:root[data-theme="dark"] {
	--bg-base: #111512;
	--bg-raise: #191f1b;
	--surface: rgba(255, 255, 255, 0.04);
	--card-bg: rgba(255, 255, 255, 0.04);
	--well: rgba(255, 255, 255, 0.04);
	--well-border: rgba(255, 255, 255, 0.09);
	--border: rgba(255, 255, 255, 0.09);
	--text: #dce3dc;
	--text-dim: #8b98a6;
	--text-bright: #ffffff;

	--grid-line: rgba(255, 255, 255, 0.025);
	--grid-opacity: 0.28;

	--accent: #c5ed68;
	--accent-contrast: #151a10;
	--accent-soft: rgba(197, 237, 104, 0.10);
	--accent-border: rgba(197, 237, 104, 0.45);
	--accent-border-dim: rgba(197, 237, 104, 0.32);
	--accent-glow: rgba(197, 237, 104, 0.18);

	--shadow-card: 0 8px 24px rgba(0, 0, 0, 0.28);
	--shadow-card-hover: 0 14px 34px rgba(0, 0, 0, 0.40);
	--shadow-photo: 0 12px 32px rgba(0, 0, 0, 0.45);

	--thumb-filter: saturate(0.9) brightness(0.92);
	--background-wash-top: 74%;
	--background-wash-mid: 82%;
	--background-wash-bottom: 88%;
	--header-image-wash: 78%;

	color-scheme: dark;
}

:root[data-theme="light"] {
	/* Base sits a shade below white so white cards read as raised. */
	--bg-base: #e6e9e3;
	--bg-raise: #f1f3ed;
	--surface: rgba(15, 23, 42, 0.05);
	--card-bg: #ffffff;
	--well: #eef2f8;
	--well-border: rgba(15, 23, 42, 0.18);
	--border: rgba(15, 23, 42, 0.14);
	--text: #344039;
	--text-dim: #58645b;
	--text-bright: #172019;

	--grid-line: rgba(23, 32, 25, 0.045);
	--grid-opacity: 0.42;

	--accent: #527516;
	--accent-contrast: #ffffff;
	--accent-soft: rgba(82, 117, 22, 0.09);
	--accent-border: rgba(82, 117, 22, 0.40);
	--accent-border-dim: rgba(82, 117, 22, 0.28);
	--accent-glow: rgba(82, 117, 22, 0.18);

	--shadow-card: 0 4px 14px rgba(15, 23, 42, 0.10);
	--shadow-card-hover: 0 12px 28px rgba(15, 23, 42, 0.16);
	--shadow-photo: 0 10px 28px rgba(15, 23, 42, 0.18);

	/* contrast() would push these pale tones further toward white. */
	--thumb-filter: saturate(1.08);
	--background-wash-top: 62%;
	--background-wash-mid: 68%;
	--background-wash-bottom: 74%;
	--header-image-wash: 68%;

	color-scheme: light;
}

/* ---------- One continuous base for the whole page ---------- */

html {
	scroll-behavior: smooth;
}

body {
	background: var(--bg-base);
	color: var(--text);
}

/* Fixed texture layer: felt, not seen. */
body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -2;
	background:
		linear-gradient(
			180deg,
			color-mix(in srgb, var(--bg-base) var(--background-wash-top), transparent) 0%,
			color-mix(in srgb, var(--bg-base) var(--background-wash-mid), transparent) 48%,
			color-mix(in srgb, var(--bg-base) var(--background-wash-bottom), transparent) 100%
		),
		url("../images/DarkPaladin1.jpg") center 34% / cover no-repeat,
		linear-gradient(180deg, var(--bg-base) 0%, var(--bg-raise) 55%, var(--bg-base) 100%);
}

body::after {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	pointer-events: none;
	opacity: var(--grid-opacity);
	background-image:
		linear-gradient(var(--grid-line) 1px, transparent 1px),
		linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
	background-size: 46px 46px;
}

/* ---------- Sections: no more per-section backgrounds ---------- */

#main > section {
	position: relative;
	background-image: none;
	background-color: transparent;
	box-shadow: none;
	border-top: 0;
	padding: 6em 0;
}

/* Hairline that fades out at both ends, so sections read as one surface
   instead of stacked panels. Skips the first section (the hero). */
#main > section ~ section::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: min(68%, 46rem);
	height: 1px;
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--border) 25%,
		var(--border) 75%,
		transparent 100%
	);
}

#main > section.two,
#main > section.three,
#main > section.four {
	background-color: transparent;
	background-image: none;
	color: var(--text);
}

#main > section h2,
#main > section h3,
#main > section h4 {
	color: var(--text-bright);
}

#main > section p {
	color: var(--text);
}

/* ---------- Header ---------- */

#header {
	background-image: none;
	background: color-mix(in srgb, var(--bg-base) 94%, transparent);
	border-bottom: 1px solid var(--border);
	box-shadow: none;
	color: var(--text);
	backdrop-filter: blur(16px);
}

:root[data-theme="light"] #header {
	background: var(--bg-raise);
	background-image: none;
}

#header .brand-name {
	color: var(--text-bright);
	font-size: 1.1rem;
	font-weight: 600;
	text-decoration: none;
}

#header .brand-role {
	color: var(--text-dim);
	font-size: 0.78rem;
	margin-left: 0.55rem;
}

#header .name h1,
#header #title {
	color: var(--text-bright);
}

#header .name p {
	color: var(--text-dim);
}

#nav ul li a {
	color: var(--text-dim);
	border: 0;
	padding: 0.55rem 0.75rem;
	transition: color 0.2s ease, background-color 0.2s ease;
}

#nav ul li a:hover {
	color: var(--text-bright);
	background: var(--surface);
}

#nav ul li a.active {
	background: var(--accent-soft);
	box-shadow: none;
	color: var(--text-bright);
	border-radius: 4px;
}

#nav ul li a.active span:before,
#nav ul li a:hover span:before {
	color: var(--accent);
}

#header .icons a {
	color: var(--text-dim);
}

#header .icons a:hover {
	color: var(--accent);
}

/* ---------- Theme toggle (markup injected by theme-toggle.js) ---------- */

.theme-toggle-wrap {
	text-align: center;
	margin-top: 0.9em;
}

.theme-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0.55em;
	padding: 0.5em 1.1em;
	font-size: 0.62em;
	letter-spacing: 0.09em;
	text-transform: uppercase;
	background: var(--surface);
	background-image: none;
	border: 1px solid var(--border);
	border-radius: 999px;
	color: var(--text-dim) !important;
	cursor: pointer;
	transition: color 0.25s ease, border-color 0.25s ease, background-color 0.25s ease;
}

.theme-toggle:hover {
	color: var(--text-bright) !important;
	border-color: var(--accent-border-dim);
	background-color: var(--accent-soft);
	box-shadow: none;
}

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

.theme-toggle__icon:before {
	font-family: "Font Awesome 5 Free";
	font-weight: 900;
	font-size: 1.25em;
	content: "\f185"; /* sun */
}

:root[data-theme="light"] .theme-toggle__icon:before {
	content: "\f186"; /* moon */
}

.theme-toggle__label:after {
	content: "Light mode";
}

:root[data-theme="light"] .theme-toggle__label:after {
	content: "Dark mode";
}

/* ---------- Cards do the work the backgrounds were doing ---------- */

.item {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: 12px;
	overflow: hidden;
	box-shadow: var(--shadow-card);
	transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.item:hover {
	transform: translateY(-4px);
	border-color: var(--accent-border);
	box-shadow: var(--shadow-card-hover);
}

.item header {
	background: transparent;
	padding: 1.25em 1.25em 1.5em;
}

.item header p {
	color: var(--text-dim);
	font-size: 1em;
	line-height: 1.6;
}

.image.fit img {
	border-radius: 8px;
}

/* ---------- Equal-height portfolio cards ---------- */

#portfolio .row > .col-4 {
	display: flex;
	margin-bottom: 40px;
}

#portfolio .item {
	display: flex;
	flex-direction: column;
	flex: 1;
	margin-bottom: 0;
}

/* Push copy to a consistent baseline regardless of text length. */
#portfolio .item header {
	margin-top: auto;
}

/* ---------- Tame the light thumbnails ---------- */

#portfolio .portfolio-preview {
	background: var(--well);
	border: 1px solid var(--well-border);
	border-radius: 10px;
	padding: 1.25rem;
	margin-block: 1.25rem;
	transition: background-color 0.25s ease, border-color 0.25s ease;
}

#portfolio .portfolio-preview img,
#portfolio .portfolio-preview dotlottie-player {
	filter: var(--thumb-filter);
	transition: filter 0.25s ease;
}

/* Direct child only — the Lottie player is transparent and needs no frame. */
#portfolio .portfolio-preview > img {
	border: 1px solid var(--well-border);
	border-radius: 6px;
	background: #ffffff;
}

/* Deepen the pale logo tones in the current project-image markup. */
:root[data-theme="light"] #portfolio .project-image > img[src*="WikishmediA"] {
		filter: url(#tm-deepen) contrast(1.25) saturate(1.35);
	background: #ffffff;
	border: 1px solid var(--well-border);
	border-radius: 6px;
}

.tm-filters {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
}

.item:hover .portfolio-preview {
	border-color: var(--accent-border-dim);
}

.item:hover .portfolio-preview img,
.item:hover .portfolio-preview dotlottie-player {
	filter: none;
}

/* ---------- About Me portrait ---------- */

.image.featured img {
	border-radius: 12px;
	border: 1px solid var(--border);
	box-shadow: var(--shadow-photo);
}

/* ---------- One accent, used consistently ---------- */

input[type="button"],
input[type="submit"],
input[type="reset"],
button,
.button {
	background-color: transparent;
	background-image: none;
	border: 1px solid var(--accent);
	color: var(--accent) !important;
	border-radius: 8px;
	transition: background-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

input[type="button"]:hover,
input[type="submit"]:hover,
input[type="reset"]:hover,
button:hover,
.button:hover {
	background-color: var(--accent);
	color: var(--accent-contrast) !important;
	box-shadow: 0 6px 20px var(--accent-glow);
}

.portfolio,
.technology {
	color: var(--accent);
}

/* ---------- Technology icons ---------- */

.techIcon a {
	color: var(--text-dim);
	transition: color 0.25s ease, transform 0.25s ease;
}

.techIcon a:hover {
	color: var(--accent);
	transform: translateY(-4px);
}

/* ---------- Contemporary portfolio layout ---------- */

#header {
	position: sticky;
	top: 0;
	left: auto;
	width: 100%;
	height: auto;
	min-height: 76px;
	overflow: visible;
	display: grid;
	grid-template-columns: minmax(13rem, 1fr) auto minmax(13rem, 1fr);
	align-items: center;
	gap: 1.5rem;
	padding: 0.65rem clamp(1.25rem, 5vw, 5rem);
	text-align: left;
	z-index: 10000;
}

#header .top,
#header .middle,
#header .bottom {
	min-width: 0;
	padding: 0;
	margin: 0;
	border: 0;
	box-shadow: none;
}

#header .top {
	flex: initial;
}

#header .middle {
	flex: initial;
}

#header .bottom {
	justify-self: end;
	display: flex;
	align-items: center;
	gap: 0.9rem;
}

#header .name {
	text-align: left;
}

#header .top .name {
	text-align: left;
	padding: 0;
}

#header .icons {
	display: flex;
	align-items: center;
	gap: 0.8rem;
	margin: 0;
	font-size: 0.95rem;
}

#header .icons li {
	padding: 0;
}

#header .icons a {
	color: var(--text-dim);
}

#nav ul {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

#nav ul li a span {
	font-size: 0.9rem;
}

.theme-toggle-wrap {
	margin: 0;
}

.theme-toggle {
	width: 2.5rem;
	height: 2.5rem;
	justify-content: center;
	padding: 0;
	font-size: 0.9rem;
	text-transform: none;
}

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

#headerToggle {
	display: none !important;
}

#main,
#footer {
	margin-left: 0;
}

#main > section {
	padding: clamp(4.5rem, 9vw, 8rem) 0;
}

#main > section .container {
	width: min(100% - 3rem, 1120px);
	margin-inline: auto;
	padding: 0;
}

#main > section.one .container {
	width: min(100% - 3rem, 1280px);
}

#main > section.one {
	min-height: min(760px, calc(100svh - 76px));
	display: grid;
	align-items: center;
	background: transparent;
	text-align: left;
}

.hero-layout {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(250px, 0.72fr);
	align-items: center;
	gap: clamp(3rem, 9vw, 8rem);
}

.hero-copy {
	max-width: 670px;
}

.eyebrow {
	margin: 0 0 1.15rem;
	color: var(--accent) !important;
	font-family: "Source Sans Pro", sans-serif;
	font-size: 0.76rem;
	font-weight: 600;
	letter-spacing: 0.12em;
	line-height: 1.5;
	text-transform: uppercase;
}

.eyebrow span {
	color: var(--text-dim);
	padding-inline: 0.35rem;
}

.hero-copy h1 {
	max-width: 16ch;
	margin: 0;
	color: var(--text-bright);
	font-family: Georgia, "Times New Roman", serif;
	font-size: 5rem;
	font-weight: 400;
	line-height: 0.99;
}

.hero-copy h1 span {
	display: block;
	white-space: nowrap;
}

.hero-intro {
	max-width: 35rem;
	margin: 1.5rem 0 0;
	color: var(--text-dim) !important;
	font-size: 1.15rem;
	line-height: 1.65;
}

.hero-actions {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin-top: 2rem;
}

.hero-actions .button {
	margin: 0;
	padding: 0.8rem 1.15rem;
	font-size: 0.9rem;
}

.text-link,
.project-link {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--text-bright);
	font-size: 0.92rem;
	font-weight: 600;
	text-decoration: none;
}

.text-link span,
.project-link span {
	color: var(--accent);
	font-size: 1.2em;
}

.hero-portrait {
	position: relative;
	width: 100%;
	max-width: 390px;
	margin: 0 auto;
}

.hero-portrait img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 12px;
	filter: saturate(0.78);
}

.section-heading {
	max-width: 700px;
	margin: 0 auto 3rem;
	text-align: left;
}

.section-heading h2 {
	margin: 0;
	color: var(--text-bright);
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(2.4rem, 4vw, 3.5rem);
	font-weight: 400;
	line-height: 1.08;
}

.section-intro {
	margin: 0.8rem 0 0;
	color: var(--text-dim) !important;
	font-size: 1.05rem;
}

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

.project-item {
	display: grid;
	grid-template-columns: minmax(220px, 0.85fr) minmax(0, 1.15fr);
	align-items: center;
	gap: clamp(1.5rem, 5vw, 4rem);
	padding: 1.25rem;
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: 8px;
	text-align: left;
}

.project-image {
	display: grid;
	place-items: center;
	min-height: 220px;
	padding: 1.1rem;
	background: var(--well);
	border: 1px solid var(--well-border);
	border-radius: 5px;
}

.project-image img {
	display: block;
	width: 100%;
	max-height: 250px;
	object-fit: contain;
	border-radius: 3px;
}

.project-copy {
	padding: 0.65rem clamp(0rem, 3vw, 2rem) 0.65rem 0;
}

.project-index {
	margin: 0 0 0.5rem;
	color: var(--accent) !important;
	font-size: 0.77rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.project-index span {
	color: var(--text-dim);
	padding-inline: 0.35rem;
}

.project-copy h3 {
	margin: 0;
	color: var(--text-bright);
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(1.8rem, 3vw, 2.5rem);
	font-weight: 400;
}

.project-copy > p:not(.project-index) {
	max-width: 35rem;
	margin: 0.65rem 0 1rem;
	color: var(--text-dim) !important;
	font-size: 1rem;
	line-height: 1.6;
}

.tag-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.45rem;
	padding: 0;
	margin: 0 0 1.25rem;
	list-style: none;
}

.tag-list li {
	padding: 0.32rem 0.55rem;
	color: var(--text-dim);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 3px;
	font-size: 0.72rem;
	line-height: 1.3;
}

.about-copy {
	max-width: 700px;
	margin: 0 auto;
	text-align: left;
}

.about-copy p {
	margin: 0 0 1.25rem;
	color: var(--text) !important;
	font-family: Georgia, "Times New Roman", serif;
	font-size: clamp(1.3rem, 2.3vw, 1.75rem);
	line-height: 1.55;
}

.skill-groups {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
	text-align: left;
}

.skill-group {
	padding: 1.35rem;
	margin-bottom: 0;
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: 6px;
}

.skill-group h3 {
	margin: 0 0 0.8rem;
	color: var(--accent);
	font-size: 0.8rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.skill-group p {
	margin: 0;
	color: var(--text-bright) !important;
	font-size: 1rem;
	line-height: 1.7;
}

.skill-group p strong {
	display: block;
	margin: 0.8rem 0 0.1rem;
	color: var(--text-dim);
	font-size: 0.68rem;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.4;
	text-transform: uppercase;
}

.skill-group p strong:first-child {
	margin-top: 0;
}

.skill-group p span {
	color: var(--accent);
	padding-inline: 0.18rem;
}

#footer {
	padding-top: 2rem;
}

@media screen and (max-width: 1200px) {
	.hero-copy h1 {
		font-size: 4rem;
	}
}

@media screen and (max-width: 960px) {
	#header {
		position: sticky;
		left: auto;
		width: 100%;
		height: auto;
		min-height: 0;
		transform: none;
		grid-template-columns: minmax(0, 1fr) auto;
		gap: 0.5rem 1rem;
		padding: 0.8rem 1.25rem 0.55rem;
	}

	#header .top {
		grid-column: 1;
		grid-row: 1;
	}

	#header .middle {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	#header .bottom {
		grid-column: 2;
		grid-row: 1;
	}

	#header .icons {
		gap: 0.55rem;
	}

	#nav ul {
		justify-content: flex-start;
	}

	#main,
	#footer,
	body.header-visible #main {
		margin-left: 0;
		transform: none;
	}

	.hero-layout {
		grid-template-columns: minmax(0, 1fr) minmax(210px, 0.72fr);
		gap: 2rem;
	}

	.hero-copy h1 {
		font-size: 3rem;
	}

	.project-item {
		grid-template-columns: minmax(190px, 0.8fr) minmax(0, 1.2fr);
		gap: 1.5rem;
	}
}

@media screen and (max-width: 700px) {
	.hero-copy h1 {
		font-size: 2.7rem;
	}
}

@media screen and (max-width: 640px) {
	#header {
		padding: 0.55rem 1rem 0.35rem;
		gap: 0.3rem 0.75rem;
	}

	#header .brand-role {
		display: block;
		margin: 0;
		font-size: 0.7rem;
	}

	#header .icons {
		gap: 0.35rem;
	}

	#header .icons a {
		font-size: 0.9rem;
	}

	.theme-toggle {
		width: 2.25rem;
		height: 2.25rem;
	}

	#nav ul {
		gap: 0.1rem;
	}

	#nav ul li a {
		padding: 0.3rem 0.6rem;
	}

	#main > section .container {
		width: min(100% - 2rem, 1120px);
	}

	#main > section.one .container {
		width: min(100% - 2rem, 1280px);
	}

	#main > section {
		padding: 3.25rem 0;
	}

	#main > section.one {
		min-height: 0;
	}

	.hero-layout {
		grid-template-columns: 1fr;
		gap: 2rem;
	}

	.hero-copy h1 {
		font-size: 2.8rem;
	}

	.hero-intro {
		font-size: 1.05rem;
	}

	.hero-portrait {
		width: min(78%, 330px);
	}

	.hero-portrait img {
		height: auto;
	}

	.section-heading {
		margin-bottom: 2rem;
	}

	.project-item {
		grid-template-columns: 1fr;
		gap: 1.1rem;
		padding: 0.85rem;
	}

	.project-image {
		min-height: 190px;
	}

	.project-copy {
		padding: 0.3rem 0.3rem 0.5rem;
	}

	.skill-groups {
		grid-template-columns: 1fr;
	}
}

@media screen and (max-width: 360px) {
	.hero-copy h1 {
		font-size: 2.3rem;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hero-portrait img,
	.project-item,
	.project-image img,
	.text-link,
	.project-link {
		transition: none;
	}
}

/* ---------- Footer blends instead of repeating the photo ---------- */

#footer {
	background-image: none;
	background-color: transparent;
	border-top: 0;
	box-shadow: none;
	color: var(--text-dim);
	position: relative;
}

#footer::before {
	content: "";
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: min(68%, 46rem);
	height: 1px;
	background: linear-gradient(
		90deg,
		transparent 0%,
		var(--border) 25%,
		var(--border) 75%,
		transparent 100%
	);
}

#footer .copyright li {
	border-left-color: var(--border);
}

/* ---------- Respect reduced motion ---------- */

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

	.item,
	.techIcon a,
	.button,
	.theme-toggle,
	#portfolio .portfolio-preview,
	#portfolio .portfolio-preview img {
		transition: none;
	}

	.item:hover {
		transform: none;
	}
}
