/*
Theme Name: Portfolio Dark
Description: Thème de portfolio sombre, responsive et bilingue FR/EN : accueil, projets, pages légales et 404 construits sur la même base visuelle.
Version: 1.1.1
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: pf
*/

/* ==========================================================================
   1. VARIABLES : couleurs, espacements, typographie
   ========================================================================== */
:root {
	/* Couleurs */
	--bg: #0b0f1a;
	--surface: #121829;
	--surface-2: #1a2138;
	--text: #e8ecf5;
	--muted: #9aa4bd;
	--accent: #6c8cff;
	--accent-2: #8b5cf6;
	--border: #26304a;

	/* Conteneur */
	--container: 72rem;
	--gutter: clamp(1rem, 4vw, 2rem);

	/* Échelle d'espacement unique (utilisée partout) */
	--space-1: 0.25rem;
	--space-2: 0.5rem;
	--space-3: 0.75rem;
	--space-4: 1rem;
	--space-5: 1.5rem;
	--space-6: 2rem;
	--space-7: 3rem;
	--space-8: clamp(3rem, 8vw, 6rem); /* espacement vertical des sections */

	/* Rythme vertical entre blocs */
	--section-y: var(--space-8);
	--head-gap: clamp(1.5rem, 4vw, 2.5rem);

	/* Divers */
	--header-h: 4.5rem;
	--radius: 0.875rem;
	--read: 70ch;
	--shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.35);
	--ease: cubic-bezier(0.2, 0.7, 0.2, 1);

	/* Typographie fluide */
	--font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--fs-body: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
	--fs-h1: clamp(2rem, 1.2rem + 3.5vw, 3.5rem);
	--fs-h2: clamp(1.5rem, 1.1rem + 1.8vw, 2.25rem);
	--fs-h3: clamp(1.125rem, 1.05rem + 0.4vw, 1.3rem);
	--fs-lead: clamp(1.0625rem, 1rem + 0.5vw, 1.25rem);
}

/* ==========================================================================
   2. BASE
   ========================================================================== */
*,
*::before,
*::after {
	box-sizing: border-box;
}

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

body {
	margin: 0;
	min-height: 100vh;
	min-height: 100dvh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font-family: var(--font);
	font-size: var(--fs-body);
	line-height: 1.65;
	overflow-x: hidden;
}

body.nav-open {
	overflow: hidden;
}

.site-main {
	flex: 1 0 auto;
}

img,
video,
iframe {
	max-width: 100%;
	height: auto;
	display: block;
}

h1,
h2,
h3,
h4 {
	margin: 0 0 var(--space-4);
	line-height: 1.2;
	letter-spacing: -0.01em;
	text-wrap: balance;
}

p {
	margin: 0 0 var(--space-4);
}

a {
	color: var(--accent);
	text-decoration-thickness: 0.08em;
	text-underline-offset: 0.2em;
}

a:hover {
	color: #9db1ff;
}

:focus-visible {
	outline: 3px solid var(--accent);
	outline-offset: 3px;
	border-radius: 0.25rem;
}

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.skip-link {
	position: absolute;
	left: var(--space-4);
	top: -4rem;
	z-index: 200;
	padding: var(--space-3) var(--space-4);
	background: var(--accent);
	color: #0b0f1a;
	font-weight: 700;
	border-radius: 0.5rem;
	text-decoration: none;
	transition: top 0.2s var(--ease);
}

.skip-link:focus {
	top: var(--space-4);
	color: #0b0f1a;
}

/* ==========================================================================
   3. CONTENEUR COMMUN (même largeur et mêmes marges partout)
   ========================================================================== */
.container {
	width: 100%;
	max-width: calc(var(--container) + 2 * var(--gutter));
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* ==========================================================================
   4. BOUTONS
   ========================================================================== */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
	min-height: 2.75rem;
	padding: var(--space-3) var(--space-5);
	background: var(--accent);
	color: #0b0f1a;
	font-weight: 700;
	font-size: 1rem;
	line-height: 1.2;
	text-decoration: none;
	border: 2px solid var(--accent);
	border-radius: 999px;
	transition: transform 0.2s var(--ease), background 0.2s, color 0.2s;
}

.btn:hover {
	background: #9db1ff;
	border-color: #9db1ff;
	color: #0b0f1a;
	transform: translateY(-2px);
}

.btn--ghost {
	background: transparent;
	color: var(--text);
	border-color: var(--border);
}

.btn--ghost:hover {
	background: var(--surface-2);
	border-color: var(--accent);
	color: var(--text);
}

/* ==========================================================================
   5. EN-TÊTE (hauteur constante sur toutes les pages)
   ========================================================================== */
.site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	height: var(--header-h);
	background: rgba(11, 15, 26, 0.92);
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}

.header-inner {
	height: 100%;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--space-5);
}

.site-logo {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--text);
	font-weight: 800;
	font-size: 1.25rem;
	letter-spacing: -0.02em;
	text-decoration: none;
	white-space: nowrap;
}

.site-logo:hover {
	color: var(--text);
}

.site-logo-img {
	max-height: 2.5rem;
	width: auto;
}

.header-right {
	display: flex;
	align-items: center;
	gap: var(--space-5);
}

/* Menu principal */
.site-nav .menu,
.footer-nav .menu,
.lang-list {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: var(--space-1) var(--space-5);
	margin: 0;
	padding: 0;
	list-style: none;
}

.site-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	padding-inline: var(--space-1);
	color: var(--muted);
	font-weight: 600;
	text-decoration: none;
	border-bottom: 2px solid transparent;
}

.site-nav a:hover,
.site-nav .current-menu-item > a,
.site-nav .current_page_item > a {
	color: var(--text);
	border-bottom-color: var(--accent);
}

/* Sélecteur de langue */
.lang-list {
	gap: var(--space-1);
}

.lang-item a,
.lang-disabled {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding-inline: var(--space-2);
	font-size: 0.875rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
	text-decoration: none;
	border-radius: 0.5rem;
}

.lang-item a:hover {
	color: var(--text);
	background: var(--surface-2);
}

.lang-item.current-lang a {
	color: var(--text);
	background: var(--surface-2);
}

.lang-disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Bouton du menu mobile */
.nav-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	background: transparent;
	border: 1px solid var(--border);
	border-radius: 0.625rem;
	color: var(--text);
	cursor: pointer;
}

.nav-toggle-bars,
.nav-toggle-bars::before,
.nav-toggle-bars::after {
	display: block;
	width: 1.25rem;
	height: 2px;
	background: currentColor;
	border-radius: 2px;
	transition: transform 0.25s var(--ease), opacity 0.2s;
}

.nav-toggle-bars {
	position: relative;
}

.nav-toggle-bars::before,
.nav-toggle-bars::after {
	content: "";
	position: absolute;
	left: 0;
}

.nav-toggle-bars::before {
	top: -0.4rem;
}

.nav-toggle-bars::after {
	top: 0.4rem;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars {
	background: transparent;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::before {
	transform: translateY(0.4rem) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bars::after {
	transform: translateY(-0.4rem) rotate(-45deg);
}

@media (max-width: 860px) {
	.nav-toggle {
		display: inline-flex;
	}

	.header-right {
		gap: var(--space-3);
	}

	/* Panneau pleine largeur */
	.site-nav {
		position: fixed;
		top: var(--header-h);
		left: 0;
		right: 0;
		width: 100%;
		max-height: calc(100dvh - var(--header-h));
		overflow-y: auto;
		padding: var(--space-4) var(--gutter) var(--space-6);
		background: var(--surface);
		border-bottom: 1px solid var(--border);
		box-shadow: var(--shadow);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-0.5rem);
		transition: opacity 0.25s var(--ease), transform 0.25s var(--ease), visibility 0s linear 0.25s;
	}

	.site-nav.is-open {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition-delay: 0s;
	}

	.site-nav .menu {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.site-nav li {
		border-bottom: 1px solid var(--border);
	}

	.site-nav li:last-child {
		border-bottom: 0;
	}

	.site-nav a {
		display: flex;
		width: 100%;
		min-height: 3rem;
		padding: var(--space-3) var(--space-1);
		font-size: 1.0625rem;
		border-bottom: 0;
	}

	.site-nav .current-menu-item > a {
		color: var(--accent);
	}

	/* Sans JavaScript : le menu reste visible sous l'en-tête */
	html:not(.js) .nav-toggle {
		display: none;
	}

	html:not(.js) .site-nav {
		position: static;
		visibility: visible;
		opacity: 1;
		transform: none;
		max-height: none;
		box-shadow: none;
		padding-block: 0;
	}

	html:not(.js) .site-header {
		height: auto;
	}
}

@media (max-width: 380px) {
	.site-logo {
		font-size: 1.0625rem;
	}

	.header-inner {
		gap: var(--space-3);
	}
}

/* ==========================================================================
   6. BANDEAU DE TITRE (pages internes) : même alignement que le hero
   ========================================================================== */
.page-hero {
	padding-block: var(--section-y) var(--space-6);
	background:
		radial-gradient(60rem 24rem at 12% -20%, rgba(108, 140, 255, 0.16), transparent 60%),
		var(--bg);
	border-bottom: 1px solid var(--border);
}

.page-title {
	margin-bottom: var(--space-3);
	font-size: var(--fs-h1);
	font-weight: 800;
}

.page-lead {
	max-width: var(--read);
	margin-bottom: 0;
	color: var(--muted);
	font-size: var(--fs-lead);
}

/* ==========================================================================
   7. SECTIONS (structure identique : titre, contenu, espacement)
   ========================================================================== */
.section {
	padding-block: var(--section-y);
}

.section--alt {
	background: var(--surface);
	border-block: 1px solid var(--border);
}

.section-head {
	max-width: var(--read);
	margin-bottom: var(--head-gap);
}

.section-title {
	font-size: var(--fs-h2);
	font-weight: 800;
	margin-bottom: var(--space-3);
}

.section-lead {
	color: var(--muted);
	font-size: var(--fs-lead);
	margin-bottom: 0;
}

.section-more {
	margin: var(--head-gap) 0 0;
	text-align: center;
}

.empty {
	padding: var(--space-6);
	text-align: center;
	color: var(--muted);
	background: var(--surface);
	border: 1px dashed var(--border);
	border-radius: var(--radius);
}

/* ==========================================================================
   8. HERO (accueil)
   ========================================================================== */
.hero {
	display: flex;
	align-items: center;
	min-height: min(80vh, 46rem);
	min-height: min(80svh, 46rem);
	padding-block: var(--section-y);
	background:
		radial-gradient(60rem 28rem at 85% -10%, rgba(139, 92, 246, 0.18), transparent 60%),
		radial-gradient(50rem 26rem at 5% 0%, rgba(108, 140, 255, 0.16), transparent 60%),
		var(--bg);
}

.hero .container {
	width: 100%;
}

.hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	align-items: center;
	gap: clamp(2rem, 6vw, 4.5rem);
}

.kicker {
	margin-bottom: var(--space-3);
	color: var(--accent);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
}

.hero-title {
	font-size: var(--fs-h1);
	font-weight: 800;
	margin-bottom: var(--space-4);
}

.hero-lead {
	max-width: 52ch;
	margin-bottom: var(--space-6);
	color: var(--muted);
	font-size: var(--fs-lead);
}

.hero-visual {
	aspect-ratio: 4 / 3;
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: calc(var(--radius) * 1.5);
	background: var(--surface);
	box-shadow: var(--shadow);
}

.hero-visual img,
.hero-placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.hero-placeholder {
	display: block;
	background:
		radial-gradient(circle at 30% 30%, rgba(108, 140, 255, 0.45), transparent 55%),
		radial-gradient(circle at 75% 70%, rgba(139, 92, 246, 0.45), transparent 55%),
		var(--surface-2);
}

@media (max-width: 860px) {
	.hero {
		min-height: 0;
	}

	.hero-grid {
		grid-template-columns: 1fr;
	}

	.hero-visual {
		order: -1;
		aspect-ratio: 16 / 9;
	}
}

/* ==========================================================================
   9. GRILLES ET CARTES (accueil et liste des projets : même grille)
   ========================================================================== */
.grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: clamp(1rem, 2.5vw, 1.75rem);
}

@media (max-width: 1024px) {
	.grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 640px) {
	.grid {
		grid-template-columns: 1fr;
	}
}

/* Cartes de hauteur égale */
.card {
	display: flex;
	flex-direction: column;
	height: 100%;
	overflow: hidden;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	transition: transform 0.25s var(--ease), border-color 0.25s, box-shadow 0.25s;
}

.section--alt .card {
	background: var(--bg);
}

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

.card-media {
	display: block;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--surface-2);
}

.card-media img,
.card-media-placeholder {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s var(--ease);
}

.card:hover .card-media img {
	transform: scale(1.04);
}

.card-media-placeholder {
	display: block;
	background:
		radial-gradient(circle at 30% 30%, rgba(108, 140, 255, 0.3), transparent 55%),
		radial-gradient(circle at 75% 70%, rgba(139, 92, 246, 0.3), transparent 55%),
		var(--surface-2);
}

.card-body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	padding: var(--space-5);
}

.card-title {
	font-size: var(--fs-h3);
	margin-bottom: var(--space-2);
}

.card-title a {
	color: var(--text);
	text-decoration: none;
}

.card-title a:hover {
	color: var(--accent);
}

.card-text {
	margin-bottom: var(--space-4);
	color: var(--muted);
}

.card-link {
	margin-top: auto;
	font-weight: 700;
	text-decoration: none;
}

.card--skill {
	border-top: 3px solid var(--accent);
}

.card--skill .card-text {
	margin-bottom: 0;
}

/* ==========================================================================
   10. PAGINATION (alignée sur la grille)
   ========================================================================== */
.pagination {
	margin-top: var(--head-gap);
}

.pagination .nav-links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--space-2);
}

.pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 2.75rem;
	min-height: 2.75rem;
	padding-inline: var(--space-3);
	color: var(--text);
	font-weight: 700;
	text-decoration: none;
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: 0.625rem;
}

.pagination a.page-numbers:hover {
	border-color: var(--accent);
	color: var(--accent);
}

.pagination .page-numbers.current {
	background: var(--accent);
	border-color: var(--accent);
	color: #0b0f1a;
}

/* ==========================================================================
   11. CONTACT (accueil)
   ========================================================================== */
.contact-box {
	max-width: 40rem;
	margin-inline: auto;
	text-align: center;
}

.contact-box .section-lead {
	margin-bottom: var(--space-6);
}

/* ==========================================================================
   12. ARTICLE : page projet et pages légales (colonne de lecture)
   ========================================================================== */
.article {
	max-width: var(--read);
	margin-inline: auto;
}

.article-cover {
	margin: 0 0 var(--space-6);
	overflow: hidden;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.article-cover img {
	width: 100%;
	height: auto;
}

.prose {
	font-size: var(--fs-body);
}

.prose > * + * {
	margin-top: var(--space-4);
}

.prose h2 {
	margin-top: var(--space-7);
	font-size: var(--fs-h2);
}

.prose h3 {
	margin-top: var(--space-6);
	font-size: var(--fs-h3);
}

.prose ul,
.prose ol {
	padding-left: var(--space-5);
}

.prose li + li {
	margin-top: var(--space-2);
}

.prose img,
.prose figure {
	margin-block: var(--space-5);
	border-radius: var(--radius);
}

.prose figcaption {
	margin-top: var(--space-2);
	color: var(--muted);
	font-size: 0.875rem;
	text-align: center;
}

.prose blockquote {
	margin-inline: 0;
	padding: var(--space-2) var(--space-5);
	color: var(--muted);
	border-left: 3px solid var(--accent);
}

.prose table {
	display: block;
	max-width: 100%;
	overflow-x: auto;
	border-collapse: collapse;
}

.prose th,
.prose td {
	padding: var(--space-2) var(--space-3);
	border: 1px solid var(--border);
	text-align: left;
}

.prose pre {
	max-width: 100%;
	overflow-x: auto;
	padding: var(--space-4);
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

.prose code {
	overflow-wrap: anywhere;
}

.article-back {
	margin: var(--space-7) 0 0;
}

/* ==========================================================================
   13. PAGE 404 (centrée verticalement)
   ========================================================================== */
.not-found {
	display: flex;
	align-items: center;
	min-height: calc(100vh - var(--header-h) - 12rem);
	min-height: calc(100dvh - var(--header-h) - 12rem);
	padding-block: var(--section-y);
	text-align: center;
}

.not-found-inner {
	display: flex;
	flex-direction: column;
	align-items: center;
}

.not-found-code {
	margin: 0 0 var(--space-3);
	font-size: clamp(4rem, 3rem + 8vw, 9rem);
	font-weight: 800;
	line-height: 1;
	background: linear-gradient(135deg, var(--accent), var(--accent-2));
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
}

.not-found .page-lead {
	margin-bottom: var(--space-6);
}

/* ==========================================================================
   14. PIED DE PAGE (même grille que le reste du site)
   ========================================================================== */
.site-footer {
	margin-top: auto;
	padding-block: var(--space-7);
	background: var(--surface);
	border-top: 1px solid var(--border);
}

.footer-grid {
	display: grid;
	grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
	align-items: start;
	gap: var(--space-6);
}

.footer-tagline {
	max-width: 32ch;
	margin: var(--space-2) 0 0;
	color: var(--muted);
}

.footer-nav .menu {
	flex-direction: column;
	align-items: flex-start;
	gap: var(--space-1);
}

.footer-nav a {
	display: inline-flex;
	align-items: center;
	min-height: 2.75rem;
	color: var(--muted);
	text-decoration: none;
}

.footer-nav a:hover {
	color: var(--text);
	text-decoration: underline;
}

.footer-copy {
	margin: 0;
	color: var(--muted);
	font-size: 0.9rem;
	white-space: nowrap;
}

@media (max-width: 860px) {
	.footer-grid {
		grid-template-columns: 1fr;
		gap: var(--space-5);
	}

	.footer-copy {
		white-space: normal;
	}
}

/* ==========================================================================
   15. ANIMATIONS D'APPARITION
   ========================================================================== */
.js .reveal {
	opacity: 0;
	transform: translateY(1.25rem);
	transition: opacity 0.6s var(--ease), transform 0.6s var(--ease);
}

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

/* Décalage léger entre cartes d'une même grille */
.grid .reveal:nth-child(3n + 2) {
	transition-delay: 0.08s;
}

.grid .reveal:nth-child(3n + 3) {
	transition-delay: 0.16s;
}

/* ==========================================================================
   16. RESPONSIVE : ajustements grands écrans
   ========================================================================== */
@media (min-width: 1440px) {
	:root {
		--container: 76rem;
	}
}

@media (min-width: 1900px) {
	:root {
		--container: 80rem;
		--fs-body: 1.125rem;
	}
}

/* ==========================================================================
   17. ACCESSIBILITÉ : mouvement réduit
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		transition-delay: 0s !important;
	}

	.js .reveal {
		opacity: 1;
		transform: none;
	}
}
