/* ==========================================================================
   Portfolio Mehdi Aberkane — feuille de style (sans framework)
   ========================================================================== */

:root {
	--bg: #0b0f14;
	--bg-alt: #10161e;
	--surface: #141c26;
	--border: #233040;
	--text: #e6edf3;
	--muted: #8b9bab;
	--accent: #3ddc97;
	--accent-2: #4cc2ff;
	--accent-contrast: #04110b;
	--grid: rgba(61, 220, 151, 0.06);
	--shadow: 0 10px 30px rgba(0, 0, 0, 0.35);

	--font-sans: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
	--font-mono: "JetBrains Mono", "Cascadia Code", "Fira Code", Consolas, "SFMono-Regular", Menlo, monospace;

	--radius: 14px;
	--container: 1120px;
	--header-h: 64px;

	color-scheme: dark;
}

@media (prefers-color-scheme: light) {
	:root {
		--bg: #f6f8fa;
		--bg-alt: #eef2f6;
		--surface: #ffffff;
		--border: #d7dee6;
		--text: #0d1620;
		--muted: #536271;
		--accent: #0b8f5c;
		--accent-2: #0a6fb8;
		--accent-contrast: #ffffff;
		--grid: rgba(11, 143, 92, 0.07);
		--shadow: 0 10px 30px rgba(13, 22, 32, 0.08);
		color-scheme: light;
	}
}

/* Base ------------------------------------------------------------------- */

*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--header-h) + 16px);
	-webkit-text-size-adjust: 100%;
}

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font-sans);
	font-size: 1.0625rem;
	line-height: 1.65;
	-webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
	line-height: 1.15;
	margin: 0;
	letter-spacing: -0.02em;
}

h2 {
	font-size: clamp(1.75rem, 1.2rem + 2vw, 2.6rem);
	margin-bottom: 1.5rem;
}

h3 {
	font-size: 1.2rem;
}

p {
	margin: 0 0 1rem;
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 3px;
	border-radius: 6px;
}

ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

svg {
	display: block;
}

.container {
	width: 100%;
	max-width: var(--container);
	margin-inline: auto;
	padding-inline: 1.25rem;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.skip-link {
	position: absolute;
	left: 1rem;
	top: -100px;
	z-index: 100;
	padding: 0.6rem 1rem;
	background: var(--accent);
	color: var(--accent-contrast);
	border-radius: 8px;
	font-weight: 600;
}

.skip-link:focus {
	top: 1rem;
}

.eyebrow {
	font-family: var(--font-mono);
	font-size: 0.85rem;
	color: var(--accent);
	letter-spacing: 0.04em;
	margin-bottom: 0.75rem;
}

/* Header / navigation ---------------------------------------------------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	height: var(--header-h);
	background: color-mix(in srgb, var(--bg) 80%, transparent);
	backdrop-filter: saturate(160%) blur(12px);
	-webkit-backdrop-filter: saturate(160%) blur(12px);
	border-bottom: 1px solid transparent;
	transition: border-color 0.2s;
}

.site-header.is-scrolled {
	border-bottom-color: var(--border);
}

.nav {
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.nav__brand {
	font-family: var(--font-mono);
	font-weight: 600;
	color: var(--text);
	font-size: 0.95rem;
}

.nav__brand:hover {
	text-decoration: none;
	color: var(--accent);
}

.nav__prompt {
	color: var(--accent);
}

.nav__menu {
	display: flex;
	gap: 0.25rem;
}

.nav__menu a {
	display: block;
	padding: 0.5rem 0.85rem;
	border-radius: 8px;
	color: var(--muted);
	font-size: 0.95rem;
	font-weight: 500;
	transition: color 0.15s, background-color 0.15s;
}

.nav__menu a:hover,
.nav__menu a.is-active {
	color: var(--text);
	background: var(--surface);
	text-decoration: none;
}

.nav__toggle {
	display: none;
	width: 44px;
	height: 44px;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface);
	cursor: pointer;
	position: relative;
}

.nav__bar,
.nav__bar::before,
.nav__bar::after {
	position: absolute;
	left: 50%;
	width: 18px;
	height: 2px;
	margin-left: -9px;
	background: var(--text);
	border-radius: 2px;
	transition: transform 0.2s, opacity 0.2s;
}

.nav__bar {
	top: 50%;
	margin-top: -1px;
}

.nav__bar::before,
.nav__bar::after {
	content: "";
	left: 0;
	margin-left: 0;
}

.nav__bar::before { top: -6px; }
.nav__bar::after { top: 6px; }

.nav__toggle[aria-expanded="true"] .nav__bar { background: transparent; }
.nav__toggle[aria-expanded="true"] .nav__bar::before { transform: translateY(6px) rotate(45deg); }
.nav__toggle[aria-expanded="true"] .nav__bar::after { transform: translateY(-6px) rotate(-45deg); }

@media (max-width: 720px) {
	.nav__toggle {
		display: block;
	}

	.nav__menu {
		position: absolute;
		top: var(--header-h);
		left: 0;
		right: 0;
		flex-direction: column;
		padding: 0.75rem 1.25rem 1.25rem;
		background: var(--bg);
		border-bottom: 1px solid var(--border);
		box-shadow: var(--shadow);
		display: none;
	}

	.nav__menu.is-open {
		display: flex;
	}

	.nav__menu a {
		padding: 0.8rem 0.75rem;
		font-size: 1.05rem;
	}
}

/* Hero ------------------------------------------------------------------- */

.hero {
	position: relative;
	overflow: hidden;
	padding: clamp(4rem, 12vh, 8rem) 0 clamp(4rem, 10vh, 7rem);
	background-image:
		radial-gradient(60rem 30rem at 85% -10%, color-mix(in srgb, var(--accent-2) 18%, transparent), transparent 70%),
		radial-gradient(40rem 30rem at 0% 110%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%),
		linear-gradient(var(--grid) 1px, transparent 1px),
		linear-gradient(90deg, var(--grid) 1px, transparent 1px);
	background-size: auto, auto, 40px 40px, 40px 40px;
}

.hero__inner > * {
	max-width: 880px;
}

.hero__whoami {
	font-family: var(--font-mono);
	color: var(--muted);
	font-size: 0.95rem;
	margin-bottom: 1rem;
}

.hero__whoami span {
	color: var(--accent);
	margin-right: 0.4rem;
}

.hero__whoami::after {
	content: "";
	display: inline-block;
	width: 0.55em;
	height: 1.1em;
	margin-left: 0.35rem;
	vertical-align: -0.2em;
	background: var(--accent);
	animation: blink 1.1s steps(1) infinite;
}

@keyframes blink {
	50% { opacity: 0; }
}

.hero__title {
	font-size: clamp(2.6rem, 1.5rem + 5.5vw, 5.25rem);
	font-weight: 800;
	letter-spacing: -0.035em;
	margin-bottom: 0.75rem;
}

.hero__role {
	font-size: clamp(1.15rem, 1rem + 0.8vw, 1.5rem);
	color: var(--muted);
	margin-bottom: 1.25rem;
}

.hero__role strong {
	color: var(--text);
	background: linear-gradient(90deg, var(--accent), var(--accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.hero__lead {
	max-width: 36rem;
	font-size: 1.125rem;
	margin-bottom: 2rem;
}

.hero__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	margin-bottom: 2.25rem;
}

.hero__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.hero__tags li {
	font-family: var(--font-mono);
	font-size: 0.8rem;
	color: var(--muted);
	padding: 0.25rem 0.6rem;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: color-mix(in srgb, var(--surface) 70%, transparent);
}

/* Buttons ---------------------------------------------------------------- */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0.75rem 1.4rem;
	border-radius: 10px;
	font-weight: 600;
	font-size: 1rem;
	border: 1px solid transparent;
	transition: transform 0.15s, background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
	text-decoration: none;
	transform: translateY(-1px);
}

.btn--primary {
	background: var(--accent);
	color: var(--accent-contrast);
}

.btn--primary:hover {
	background: color-mix(in srgb, var(--accent) 88%, white);
}

.btn--ghost {
	border-color: var(--border);
	color: var(--text);
	background: var(--surface);
}

.btn--ghost:hover {
	border-color: var(--accent);
	color: var(--accent);
}

/* Sections --------------------------------------------------------------- */

.section {
	padding: clamp(4rem, 10vw, 6.5rem) 0;
}

.section--alt {
	background: var(--bg-alt);
	border-block: 1px solid var(--border);
}

.about {
	display: grid;
	grid-template-columns: 1fr 1.4fr;
	gap: 2rem 4rem;
	align-items: start;
}

.about__text {
	font-size: 1.125rem;
	color: var(--muted);
}

.about__text strong {
	color: var(--text);
}

@media (max-width: 820px) {
	.about {
		grid-template-columns: 1fr;
	}

	.about h2 {
		margin-bottom: 0;
	}
}

/* Cards (expertise) ------------------------------------------------------ */

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 1.25rem;
}

.card {
	padding: 1.75rem;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
}

.card:hover {
	border-color: color-mix(in srgb, var(--accent) 55%, var(--border));
	transform: translateY(-3px);
	box-shadow: var(--shadow);
}

.card__icon {
	width: 44px;
	height: 44px;
	display: grid;
	place-items: center;
	margin-bottom: 1.25rem;
	border-radius: 10px;
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	color: var(--accent);
}

.card__icon svg {
	width: 24px;
	height: 24px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.card h3 {
	margin-bottom: 0.6rem;
}

.card p {
	color: var(--muted);
	margin: 0;
	font-size: 1rem;
}

/* Skills ----------------------------------------------------------------- */

.skills {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 1.25rem;
}

@media (max-width: 720px) {
	.skills {
		grid-template-columns: 1fr;
	}
}

.skill {
	padding: 1.5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
}

.skill h3 {
	font-size: 1.05rem;
	margin-bottom: 1rem;
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
}

.chips li {
	font-size: 0.875rem;
	padding: 0.3rem 0.7rem;
	border-radius: 8px;
	background: var(--bg-alt);
	border: 1px solid var(--border);
	color: var(--text);
}

.subhead {
	margin: 3rem 0 1rem;
	font-size: 1.05rem;
	font-family: var(--font-mono);
	font-weight: 500;
	color: var(--muted);
}

.links {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 1rem;
}

.links a {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.15rem 1rem;
	padding: 1.1rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--surface);
	color: var(--text);
	transition: border-color 0.2s;
}

.links a:hover {
	text-decoration: none;
	border-color: var(--accent);
}

.links__label {
	font-weight: 600;
}

.links__desc {
	grid-column: 1;
	color: var(--muted);
	font-size: 0.95rem;
}

.links__arrow {
	grid-column: 2;
	grid-row: 1 / span 2;
	align-self: center;
	color: var(--accent);
	font-size: 1.25rem;
	transition: transform 0.2s;
}

.links a:hover .links__arrow {
	transform: translate(2px, -2px);
}

/* Contact ---------------------------------------------------------------- */

.contact {
	text-align: center;
}

.contact__lead {
	color: var(--muted);
	font-size: 1.125rem;
	margin-top: -0.5rem;
	margin-bottom: 2rem;
}

.socials {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
}

.socials a {
	display: inline-flex;
	align-items: center;
	gap: 0.6rem;
	min-height: 48px;
	padding: 0.7rem 1.2rem;
	border: 1px solid var(--border);
	border-radius: 10px;
	background: var(--surface);
	color: var(--text);
	font-weight: 600;
	transition: border-color 0.15s, color 0.15s;
}

.socials a:hover {
	text-decoration: none;
	border-color: var(--accent);
	color: var(--accent);
}

.socials svg {
	width: 20px;
	height: 20px;
}

.socials .fill {
	fill: currentColor;
}

/* Footer ----------------------------------------------------------------- */

.site-footer {
	padding: 2rem 0;
	font-size: 0.9rem;
	color: var(--muted);
}

.site-footer .container {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem 1.5rem;
}

.site-footer p {
	margin: 0;
}

.to-top {
	color: var(--muted);
}

/* Apparition au défilement ---------------------------------------------- */

.js .reveal {
	opacity: 0;
	transform: translateY(16px);
	transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible {
	opacity: 1;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}

	.js .reveal {
		opacity: 1;
		transform: none;
	}
}
