/*
 * Ayman's Digital 2.0: design system and header of the public portfolio (inc/portfolio.php).
 * Loaded on every page while "Public portfolio" is on. Dark first, accent #44C4BC, Poppins.
 * Light mode follows the preferences menu (html.light-mode). Motion is reduced on request.
 */

:root {
	--pf-bg: #07090c;
	--pf-bg-2: #0b0f14;
	--pf-surface: #10151b;
	--pf-surface-2: #151b23;
	--pf-border: rgba(255, 255, 255, .08);
	--pf-border-strong: rgba(68, 196, 188, .45);
	--pf-text: #e8edf1;
	--pf-muted: #a3afba;
	--pf-accent: #44c4bc;
	--pf-accent-2: #6fd8d1;
	--pf-accent-soft: rgba(68, 196, 188, .1);
	--pf-on-accent: #04201e;
	--pf-shadow: 0 18px 40px -18px rgba(0, 0, 0, .65);
	--pf-radius: 14px;
	--pf-radius-lg: 22px;
	--pf-pill: 999px;
	--pf-font: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
	--pf-max: 1180px;
	--pf-gutter: clamp(16px, 4vw, 40px);
	--pf-header: 72px;
	--pf-ease: cubic-bezier(.2, .7, .2, 1);
	--pf-focus: 0 0 0 3px var(--pf-bg), 0 0 0 5px var(--pf-accent);
}

html.light-mode {
	--pf-bg: #f5f7f9;
	--pf-bg-2: #edf1f4;
	--pf-surface: #ffffff;
	--pf-surface-2: #f3f6f8;
	--pf-border: rgba(13, 17, 23, .1);
	--pf-border-strong: rgba(22, 122, 116, .45);
	--pf-text: #0d1117;
	--pf-muted: #4a5763;
	--pf-accent: #157a74;
	--pf-accent-2: #0f625d;
	--pf-accent-soft: rgba(21, 122, 116, .09);
	--pf-on-accent: #ffffff;
	--pf-shadow: 0 18px 40px -22px rgba(13, 17, 23, .35);
}

html { scroll-padding-top: calc(var(--pf-header) + 16px); }
body.ad-pf { background: var(--pf-bg); }

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

.pf-skip {
	position: absolute;
	left: 16px;
	top: -100px;
	z-index: 10001;
	padding: 10px 18px;
	border-radius: var(--pf-pill);
	background: var(--pf-accent);
	color: var(--pf-on-accent);
	font: 600 14px/1.2 var(--pf-font);
	text-decoration: none;
	transition: top .2s var(--pf-ease);
}
.pf-skip:focus { top: 12px; outline: none; box-shadow: var(--pf-focus); }

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

.ad-hd {
	position: sticky;
	top: 0;
	z-index: 1000;
	background: rgba(7, 9, 12, .92);
	-webkit-backdrop-filter: saturate(140%) blur(14px);
	backdrop-filter: saturate(140%) blur(14px);
	border-bottom: 1px solid var(--pf-border);
	font-family: var(--pf-font);
	transition: background-color .3s var(--pf-ease), box-shadow .3s var(--pf-ease);
}
html.light-mode .ad-hd { background: rgba(245, 247, 249, .85); }
.ad-hd.is-scrolled { box-shadow: 0 10px 30px -18px rgba(0, 0, 0, .8); }
html.light-mode .ad-hd.is-scrolled { box-shadow: 0 10px 30px -20px rgba(13, 17, 23, .35); }
.admin-bar .ad-hd { top: 32px; }
@media (max-width: 782px) { .admin-bar .ad-hd { top: 0; } }

.ad-hd__bar {
	display: flex;
	align-items: center;
	gap: 24px;
	max-width: 1280px;
	height: var(--pf-header);
	margin: 0 auto;
	padding: 0 var(--pf-gutter);
}

.ad-hd__brand {
	display: inline-flex;
	align-items: center;
	flex: none;
	border-radius: 10px;
}
.ad-hd__brand img { display: block; width: 48px; height: 48px; object-fit: contain; }
.ad-hd__brand:focus-visible { outline: none; box-shadow: var(--pf-focus); }

.ad-hd__nav { margin-left: auto; }

.ad-hd__list {
	display: flex;
	align-items: center;
	gap: 4px;
	margin: 0;
	padding: 0;
	list-style: none;
}
.ad-hd__list li { margin: 0; padding: 0; }
.ad-hd__list a {
	position: relative;
	display: inline-flex;
	align-items: center;
	min-height: 40px;
	padding: 8px 14px;
	border-radius: var(--pf-pill);
	color: var(--pf-text);
	font: 500 15px/1.2 var(--pf-font);
	letter-spacing: .01em;
	text-decoration: none;
	transition: color .2s var(--pf-ease), background-color .2s var(--pf-ease);
}
.ad-hd__list a::after {
	content: '';
	position: absolute;
	left: 14px;
	right: 14px;
	bottom: 3px;
	height: 2px;
	border-radius: 2px;
	background: var(--pf-accent);
	transform: scaleX(0);
	transform-origin: left;
	transition: transform .25s var(--pf-ease);
}
.ad-hd__list a:hover { color: var(--pf-accent); background: var(--pf-accent-soft); }
.ad-hd__list a:focus-visible { outline: none; box-shadow: var(--pf-focus); }
.ad-hd__list .current-menu-item > a,
.ad-hd__list a[aria-current="page"] { color: var(--pf-accent); }
.ad-hd__list .current-menu-item > a::after,
.ad-hd__list a[aria-current="page"]::after { transform: scaleX(1); }

.ad-hd__tools {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: none;
}

/* EN / FR */
.ad-lang {
	display: inline-flex;
	align-items: center;
	padding: 3px;
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-pill);
	background: var(--pf-surface);
	font: 600 13px/1 var(--pf-font);
	letter-spacing: .06em;
}
.ad-lang__item {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	min-height: 32px;
	padding: 0 10px;
	border-radius: var(--pf-pill);
	color: var(--pf-muted);
	text-decoration: none;
	transition: color .2s var(--pf-ease), background-color .2s var(--pf-ease);
}
a.ad-lang__item:hover { color: var(--pf-text); background: var(--pf-accent-soft); }
a.ad-lang__item:focus-visible { outline: none; box-shadow: var(--pf-focus); }
.ad-lang__item.is-current { background: var(--pf-accent); color: var(--pf-on-accent); }
.ad-lang__item.is-fallback span[aria-hidden="true"] { text-decoration: underline dotted; text-underline-offset: 3px; }

/* Preferences: the user menu's trigger becomes a round button with an icon. */
.ad-hd__prefs .custom-menu-wrapper { padding: 0; position: relative; }
.ad-hd__prefs .menu-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border: 1px solid var(--pf-border);
	border-radius: 50%;
	background: var(--pf-surface);
	color: var(--pf-accent);
}
.ad-hd__prefs .menu-icon > div { display: none; }
.ad-hd__prefs .menu-icon::before {
	content: '\f1de';
	font: var(--fa-font-solid, normal 900 1em/1 'Font Awesome 6 Free');
	font-weight: 900;
	font-size: 15px;
}
.ad-hd__prefs .menu-icon:hover { border-color: var(--pf-border-strong); }
.ad-hd__prefs .menu-icon:focus-visible { outline: none; box-shadow: var(--pf-focus); }
.ad-hd__prefs .menu-list { top: calc(var(--pf-header) + 8px); }

.ad-hd__toggle {
	display: none;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--pf-border);
	border-radius: 12px;
	background: var(--pf-surface);
	color: var(--pf-text);
	cursor: pointer;
}
.ad-hd__toggle:focus-visible { outline: none; box-shadow: var(--pf-focus); }
.ad-hd__bars { position: relative; display: block; width: 20px; height: 14px; }
.ad-hd__bars span {
	position: absolute;
	left: 0;
	width: 100%;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
	transition: transform .25s var(--pf-ease), opacity .2s var(--pf-ease), top .25s var(--pf-ease);
}
.ad-hd__bars span:nth-child(1) { top: 0; }
.ad-hd__bars span:nth-child(2) { top: 6px; }
.ad-hd__bars span:nth-child(3) { top: 12px; }
.ad-hd__toggle[aria-expanded="true"] .ad-hd__bars span:nth-child(1) { top: 6px; transform: rotate(45deg); }
.ad-hd__toggle[aria-expanded="true"] .ad-hd__bars span:nth-child(2) { opacity: 0; }
.ad-hd__toggle[aria-expanded="true"] .ad-hd__bars span:nth-child(3) { top: 6px; transform: rotate(-45deg); }

@media (max-width: 959px) {
	.ad-hd__bar { gap: 12px; }
	.ad-hd__nav { order: 3; margin-left: 0; }
	.ad-hd__tools { margin-left: auto; gap: 8px; }
	.ad-hd__toggle { display: inline-flex; }
	.ad-hd__panel {
		position: fixed;
		left: 0;
		right: 0;
		top: var(--pf-header);
		max-height: calc(100vh - var(--pf-header));
		max-height: calc(100dvh - var(--pf-header));
		overflow-y: auto;
		padding: 12px var(--pf-gutter) 28px;
		background: var(--pf-bg);
		border-bottom: 1px solid var(--pf-border);
		box-shadow: 0 30px 40px -30px rgba(0, 0, 0, .8);
		visibility: hidden;
		opacity: 0;
		transform: translateY(-8px);
		transition: opacity .22s var(--pf-ease), transform .22s var(--pf-ease), visibility 0s linear .22s;
	}
	.admin-bar .ad-hd__panel { top: calc(var(--pf-header) + 46px); }
	.ad-hd.is-open .ad-hd__panel {
		visibility: visible;
		opacity: 1;
		transform: none;
		transition: opacity .22s var(--pf-ease), transform .22s var(--pf-ease);
	}
	.ad-hd__list { flex-direction: column; align-items: stretch; gap: 2px; }
	.ad-hd__list a {
		display: flex;
		min-height: 52px;
		padding: 12px 16px;
		border-radius: 12px;
		font-size: 17px;
	}
	.ad-hd__list a::after { left: 0; right: auto; top: 14px; bottom: 14px; width: 3px; height: auto; transform: scaleY(0); }
	.ad-hd__list .current-menu-item > a,
	.ad-hd__list a[aria-current="page"] { background: var(--pf-accent-soft); }
	.ad-hd__list .current-menu-item > a::after,
	.ad-hd__list a[aria-current="page"]::after { transform: scaleY(1); }
	html.pf-menu-open { overflow: hidden; }
}
@media (max-width: 400px) {
	.ad-hd__brand img { width: 42px; height: 42px; }
	.ad-lang__item { min-width: 36px; padding: 0 8px; }
}

/* ---------- Layout ---------- */

.pf-page {
	background: var(--pf-bg);
	color: var(--pf-text);
	font: 400 16px/1.7 var(--pf-font);
	overflow-x: clip;
}
.pf-page *, .pf-page *::before, .pf-page *::after { box-sizing: border-box; }
/* Resets without specificity, so that every component class wins over them. */
:where(.pf-page) a { color: var(--pf-accent); }
:where(.pf-page) :where(h1, h2, h3, h4) { color: var(--pf-text); font-family: var(--pf-font); margin: 0; }
:where(.pf-page) p { margin: 0; }
:where(.pf-page) img { max-width: 100%; height: auto; }
.pf-page a:focus-visible, .pf-page button:focus-visible { outline: none; box-shadow: var(--pf-focus); border-radius: 6px; }

.pf-container { width: 100%; max-width: var(--pf-max); margin: 0 auto; padding: 0 var(--pf-gutter); }

.pf-section { padding: clamp(56px, 8vw, 104px) 0; position: relative; }
.pf-section--alt { background: var(--pf-bg-2); border-top: 1px solid var(--pf-border); border-bottom: 1px solid var(--pf-border); }
.pf-section--tight { padding-top: clamp(24px, 4vw, 48px); }

.pf-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	color: var(--pf-accent);
	font: 600 12px/1.2 var(--pf-font);
	letter-spacing: .16em;
	text-transform: uppercase;
}
.pf-eyebrow::before { content: ''; width: 22px; height: 2px; border-radius: 2px; background: currentColor; }

.pf-heading { max-width: 720px; margin-bottom: clamp(28px, 4vw, 48px); }
.pf-heading h2 { font-size: clamp(26px, 3.4vw, 38px); font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.pf-heading p { margin-top: 14px; color: var(--pf-muted); font-size: 17px; }
.pf-heading--row { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 32px; max-width: none; }
.pf-heading--row > div { max-width: 720px; }

/* Hero */
.pf-hero {
	position: relative;
	padding: clamp(48px, 9vw, 112px) 0 clamp(48px, 7vw, 88px);
	background:
		radial-gradient(60% 80% at 85% 0%, rgba(68, 196, 188, .16), transparent 60%),
		radial-gradient(40% 60% at 0% 100%, rgba(68, 196, 188, .07), transparent 70%),
		var(--pf-bg);
	border-bottom: 1px solid var(--pf-border);
	overflow: hidden;
}
.pf-hero::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image: linear-gradient(var(--pf-border) 1px, transparent 1px), linear-gradient(90deg, var(--pf-border) 1px, transparent 1px);
	background-size: 56px 56px;
	-webkit-mask-image: radial-gradient(70% 70% at 70% 20%, #000, transparent 75%);
	mask-image: radial-gradient(70% 70% at 70% 20%, #000, transparent 75%);
	opacity: .5;
	pointer-events: none;
}
.pf-hero > .pf-container { position: relative; }
.pf-hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 700; line-height: 1.08; letter-spacing: -.02em; }
.pf-hero__lead { max-width: 680px; margin-top: 18px; color: var(--pf-muted); font-size: clamp(17px, 1.6vw, 19px); }
.pf-hero__actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }

/* Breadcrumb */
.pf-crumbs { margin-bottom: 22px; font-size: 14px; }
.pf-crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; color: var(--pf-muted); }
.pf-crumbs li { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.pf-crumbs li + li::before { content: '/'; opacity: .5; }
.pf-crumbs a { color: var(--pf-muted); text-decoration: none; }
.pf-crumbs a:hover { color: var(--pf-accent); }
.pf-crumbs [aria-current] { color: var(--pf-text); }

/* Buttons */
.pf-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 48px;
	padding: 12px 24px;
	border: 1px solid transparent;
	border-radius: var(--pf-pill);
	font: 600 15px/1.2 var(--pf-font);
	text-decoration: none;
	cursor: pointer;
	transition: transform .2s var(--pf-ease), background-color .2s var(--pf-ease), border-color .2s var(--pf-ease), color .2s var(--pf-ease), box-shadow .2s var(--pf-ease);
}
.pf-page .pf-btn--primary, .pf-btn--primary { background: var(--pf-accent); color: var(--pf-on-accent); box-shadow: 0 10px 30px -12px rgba(68, 196, 188, .6); }
.pf-page .pf-btn--primary:hover { background: var(--pf-accent-2); transform: translateY(-1px); }
.pf-page .pf-btn--ghost, .pf-btn--ghost { border-color: var(--pf-border); background: var(--pf-surface); color: var(--pf-text); }
.pf-page .pf-btn--ghost:hover { border-color: var(--pf-border-strong); color: var(--pf-accent); transform: translateY(-1px); }
.pf-btn i { font-size: 14px; }
.pf-link {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	font-weight: 600;
	text-decoration: none;
}
.pf-link i { transition: transform .2s var(--pf-ease); }
.pf-link:hover i { transform: translateX(3px); }

/* Cards */
.pf-card {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: clamp(22px, 2.4vw, 30px);
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-radius-lg);
	background: linear-gradient(180deg, var(--pf-surface-2), var(--pf-surface));
	box-shadow: var(--pf-shadow);
	transition: transform .25s var(--pf-ease), border-color .25s var(--pf-ease);
}
.pf-card--hover:hover { transform: translateY(-3px); border-color: var(--pf-border-strong); }
.pf-card h3 { font-size: 19px; font-weight: 600; line-height: 1.35; }
.pf-card p { color: var(--pf-muted); font-size: 15.5px; }

.pf-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	border: 1px solid var(--pf-border-strong);
	border-radius: 14px;
	background: var(--pf-accent-soft);
	color: var(--pf-accent);
	font-size: 19px;
}

.pf-grid { display: grid; gap: clamp(16px, 2vw, 24px); }
.pf-grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.pf-grid--2 { grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); }

/* Badges */
.pf-badges { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.pf-badge {
	margin: 0;
	padding: 5px 12px;
	border: 1px solid var(--pf-border);
	border-radius: var(--pf-pill);
	background: var(--pf-surface-2);
	color: var(--pf-text);
	font: 500 13px/1.3 var(--pf-font);
}
.pf-badges--accent .pf-badge { border-color: var(--pf-border-strong); background: var(--pf-accent-soft); color: var(--pf-accent); }

.pf-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 10px;
	border-radius: var(--pf-pill);
	background: var(--pf-accent-soft);
	color: var(--pf-accent);
	font: 600 11.5px/1.3 var(--pf-font);
	letter-spacing: .08em;
	text-transform: uppercase;
}

.pf-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--pf-muted); font-size: 14px; }
.pf-meta span { display: inline-flex; align-items: center; gap: 7px; }
.pf-meta i { color: var(--pf-accent); font-size: 13px; }

/* Call to action */
.pf-cta {
	position: relative;
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	gap: 24px 40px;
	padding: clamp(28px, 5vw, 56px);
	border: 1px solid var(--pf-border-strong);
	border-radius: 28px;
	background:
		radial-gradient(80% 140% at 100% 0%, rgba(68, 196, 188, .22), transparent 60%),
		linear-gradient(180deg, var(--pf-surface-2), var(--pf-surface));
	overflow: hidden;
}
.pf-cta h2 { font-size: clamp(24px, 3.2vw, 36px); font-weight: 700; line-height: 1.2; }
.pf-cta p { margin-top: 10px; color: var(--pf-muted); font-size: 17px; }
.pf-cta .pf-eyebrow { margin-bottom: 10px; }
@media (max-width: 720px) { .pf-cta { grid-template-columns: 1fr; } }

/* Empty state */
.pf-empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	padding: 48px 24px;
	border: 1px dashed var(--pf-border);
	border-radius: var(--pf-radius-lg);
	color: var(--pf-muted);
	text-align: center;
}
.pf-empty i { color: var(--pf-accent); font-size: 26px; }

/* Revealed on scroll, only when scripts run, never with reduced motion. */
html.pf-js .ad-reveal { opacity: 0; transform: translateY(16px); transition: opacity .6s var(--pf-ease), transform .6s var(--pf-ease); }
html.pf-js .ad-reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
	html.pf-js .ad-reveal { opacity: 1; transform: none; transition: none; }
	.ad-hd, .ad-hd *, .pf-page *, .pf-skip { transition: none !important; animation: none !important; }
	html { scroll-behavior: auto; }
}

/* Footer: service names from the library keep their own capitals (French titles are not Title Case). */
.ad-pf .ad-site-footer .ad-icon-list__text { text-transform: none; }
/* Footer links to the legal pages: the footer's own font, not the browser's serif default, and
   white like the links, so that the underline of their wrapper shows on every page (it takes
   the wrapper's colour, which the portfolio pages would otherwise leave black). */
.ad-pf .ad-site-footer .ad-footer__plain { font-family: var(--pf-font); color: #fff; }

/* Legal pages: long French titles wrap on small phones. */
@media (max-width: 420px) { .ad-pf .terms-header h1 { font-size: 26px; overflow-wrap: break-word; hyphens: auto; } }
