/*
 * Archive: post type funded_project + taxonomy funding_source.
 * Magazine "wow" layout: animated hero, featured-first card, glass tabs,
 * staggered reveal, hover tilt + grayscale-to-color media.
 */

body.sefp-funded-project-archive .avada-page-titlebar-wrapper { display: none; }
body.sefp-funded-project-archive #post-area { padding-top: 0; }
body.sefp-funded-project-archive #content {
	padding: 0 !important;
	max-width: none !important;
	width: 100% !important;
}

/* ─── HERO ────────────────────────────────────────────────────────── */

.sefp-archive-hero {
	position: relative;
	overflow: hidden;
	background:
		radial-gradient(1100px 600px at 80% 0%, rgba(0, 159, 227, 0.30), transparent 60%),
		radial-gradient(900px 500px at 0% 100%, rgba(101, 188, 123, 0.22), transparent 60%),
		linear-gradient(135deg, var(--awb-color-7, #212934) 0%, var(--awb-color-custom-13, #26303e) 60%, var(--awb-color-custom-14, #1d242d) 100%);
	background-size: 200% 200%;
	color: var(--awb-color-1, #ffffff);
	padding: 120px 0 96px;
	animation: sefp-bg-shift 24s ease-in-out infinite alternate;
	isolation: isolate;
}

@keyframes sefp-bg-shift {
	0%   { background-position: 0% 0%; }
	100% { background-position: 100% 100%; }
}

.sefp-archive-hero__pattern {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	opacity: 0.85;
	pointer-events: none;
	mix-blend-mode: screen;
}

.sefp-archive-hero__inner {
	position: relative;
	z-index: 1;
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 24px;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 32px;
}

.sefp-archive-hero__eyebrow {
	margin: 0;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.22em;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.78);
	display: inline-flex;
	align-items: center;
	gap: 14px;
	animation: sefp-fade-up 700ms ease both;
}
.sefp-archive-hero__eyebrow-bar {
	display: inline-block;
	width: 48px;
	height: 2px;
	background: var(--awb-color-5, #009fe3);
	border-radius: 1px;
}

.sefp-archive-hero__stat {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 36px;
	align-items: center;
	max-width: 1100px;
	animation: sefp-fade-up 800ms 120ms ease both;
}

.sefp-archive-hero__count {
	font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
	font-size: clamp(7rem, 14vw, 12rem);
	line-height: 0.85;
	font-weight: 800;
	letter-spacing: -0.04em;
	background: linear-gradient(180deg, rgba(255,255,255,0.95) 0%, rgba(255,255,255,0.55) 100%);
	-webkit-background-clip: text;
	background-clip: text;
	color: transparent;
	text-shadow: 0 0 40px rgba(0, 159, 227, 0.30);
	display: block;
}

.sefp-archive-hero__stat-text { display: flex; flex-direction: column; gap: 14px; }

.sefp-archive-hero__title {
	margin: 0;
	font-size: clamp(2rem, 4.4vw, 3.4rem);
	font-weight: 800;
	line-height: 1.05;
	letter-spacing: -0.015em;
	color: var(--awb-color-1, #ffffff);
}

.sefp-archive-hero__sub {
	margin: 0;
	font-size: clamp(1rem, 1.4vw, 1.1rem);
	line-height: 1.55;
	color: rgba(255, 255, 255, 0.78);
	max-width: 720px;
}

/* ─── Filter tabs (glass morph) ───────────────────────────────────── */

.sefp-archive-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: 4px;
	animation: sefp-fade-up 800ms 240ms ease both;
}

.sefp-tab {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 20px;
	background: rgba(255, 255, 255, 0.06);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 999px;
	color: rgba(255, 255, 255, 0.88);
	font-size: 0.92rem;
	font-weight: 600;
	text-decoration: none;
	transition: background 200ms ease, border-color 200ms ease, transform 200ms ease, box-shadow 200ms ease;
}
.sefp-tab:hover {
	background: rgba(255, 255, 255, 0.14);
	border-color: rgba(255, 255, 255, 0.36);
	transform: translateY(-2px);
	box-shadow: 0 8px 22px rgba(0, 159, 227, 0.18);
}
.sefp-tab.is-active {
	background: var(--awb-color-1, #ffffff);
	border-color: var(--awb-color-1, #ffffff);
	color: var(--awb-color-7, #212934);
	box-shadow: 0 10px 28px rgba(255, 255, 255, 0.18);
}
.sefp-tab.is-active.sefp-tab--eu       { background: var(--awb-color-5, #009fe3); border-color: var(--awb-color-5, #009fe3); color: #fff; box-shadow: 0 10px 28px rgba(0, 159, 227, 0.40); }
.sefp-tab.is-active.sefp-tab--regional { background: var(--awb-color-custom-10, #65bc7b); border-color: var(--awb-color-custom-10, #65bc7b); color: #fff; box-shadow: 0 10px 28px rgba(101, 188, 123, 0.40); }
.sefp-tab.is-active.sefp-tab--national { background: var(--awb-color-custom-13, #26303e); border-color: var(--awb-color-custom-13, #26303e); color: #fff; }

.sefp-tab__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 24px;
	height: 24px;
	padding: 0 7px;
	border-radius: 12px;
	font-size: 0.74rem;
	font-weight: 700;
	background: rgba(255, 255, 255, 0.16);
	color: inherit;
}
.sefp-tab.is-active .sefp-tab__count { background: rgba(0, 0, 0, 0.12); }

/* ─── Grid wrapper ────────────────────────────────────────────────── */

.sefp-archive-grid-wrap {
	background:
		radial-gradient(1000px 500px at 0% 0%, rgba(0, 159, 227, 0.05), transparent 60%),
		var(--awb-color-2, #f9f9fb);
	padding: 80px 0 100px;
	position: relative;
}

.sefp-container {
	max-width: 1180px;
	margin: 0 auto;
	padding: 0 24px;
}

.sefp-archive-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: 28px;
}

/* ─── Project card ────────────────────────────────────────────────── */

.sefp-card {
	margin: 0;
	padding: 0;
	background: var(--awb-color-1, #ffffff);
	border-radius: 18px;
	overflow: hidden;
	box-shadow: 0 2px 8px rgba(33, 41, 52, 0.06);
	transition: transform 320ms cubic-bezier(.2,.7,.2,1), box-shadow 320ms ease;
	display: flex;
	flex-direction: column;
	position: relative;
	opacity: 0;
	transform: translateY(20px);
	animation: sefp-card-reveal 680ms cubic-bezier(.2,.7,.2,1) forwards;
	animation-delay: var(--sefp-reveal-delay, 0ms);
}
.sefp-card::after {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 18px;
	pointer-events: none;
	box-shadow: inset 0 0 0 1px rgba(33, 41, 52, 0.04);
}
.sefp-card:hover {
	transform: translateY(-8px) rotate(-0.4deg);
	box-shadow:
		0 32px 60px -16px rgba(33, 41, 52, 0.28),
		0 0 0 1px rgba(0, 159, 227, 0.10);
}

.sefp-card__link {
	display: flex;
	flex-direction: column;
	height: 100%;
	text-decoration: none;
	color: inherit;
}

/* Media block (4:3) — always a branded gradient panel; the project logo
   sits on a white "chip" so logos of any shape/colour read cleanly without
   being cropped (cover) or desaturated. Acronym fallback when no logo. */
.sefp-card__media {
	position: relative;
	aspect-ratio: 4 / 3;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	padding: 22px;
	background:
		radial-gradient(400px 300px at 30% 30%, rgba(0, 159, 227, 0.32), transparent 65%),
		radial-gradient(400px 300px at 80% 80%, rgba(101, 188, 123, 0.20), transparent 65%),
		linear-gradient(135deg, var(--awb-color-7, #212934) 0%, var(--awb-color-custom-13, #26303e) 100%);
}

/* White chip holding the logo, full colour, contained (no crop) */
.sefp-card__logo-chip {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 78%;
	max-width: 240px;
	aspect-ratio: 16 / 9;
	padding: 16px 22px;
	background: var(--awb-color-1, #ffffff);
	border-radius: 14px;
	box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
	transition: transform 600ms cubic-bezier(.2,.7,.2,1), box-shadow 380ms ease;
}
.sefp-card__logo-chip img {
	max-width: 100%;
	max-height: 100%;
	width: auto;
	height: auto;
	object-fit: contain;
	display: block;
}
.sefp-card:hover .sefp-card__logo-chip {
	transform: scale(1.05);
	box-shadow: 0 18px 40px rgba(0, 0, 0, 0.30);
}

/* Acronym overlay (only when no featured image) */
.sefp-card__media-acronym {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: clamp(1.8rem, 3.4vw, 2.6rem);
	font-weight: 800;
	letter-spacing: 0.04em;
	color: rgba(255, 255, 255, 0.92);
	text-shadow: 0 4px 24px rgba(0, 0, 0, 0.45);
}

/* Floating funding-source badge */
.sefp-card__badge {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 2;
	font-size: 0.68rem;
	padding: 5px 13px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

/* Featured "in evidenza" pill */
.sefp-card__feature-tag {
	position: absolute;
	top: 14px;
	left: 14px;
	z-index: 2;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 13px;
	font-size: 0.68rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	border-radius: 999px;
	background: rgba(0, 0, 0, 0.55);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
	color: var(--awb-color-1, #ffffff);
	border: 1px solid rgba(255, 255, 255, 0.20);
}
.sefp-card__feature-tag::before {
	content: "★";
	font-size: 0.82rem;
	letter-spacing: 0;
	color: var(--awb-color-5, #009fe3);
}

/* Badges */
.sefp-badge {
	display: inline-block;
	padding: 5px 14px;
	font-size: 0.74rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	border-radius: 999px;
	background: var(--awb-color-5, #009fe3);
	color: var(--awb-color-1, #ffffff);
}
.sefp-badge--eu       { background: var(--awb-color-5, #009fe3); }
.sefp-badge--national { background: var(--awb-color-7, #212934); border: 1px solid rgba(255,255,255,0.30); }
.sefp-badge--regional { background: var(--awb-color-custom-10, #65bc7b); }

/* Body */
.sefp-card__body {
	padding: 24px 26px 26px;
	display: flex;
	flex-direction: column;
	gap: 8px;
	flex: 1;
}

.sefp-card__acronym {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	color: var(--awb-color-5, #009fe3);
	text-transform: uppercase;
}

.sefp-card__title {
	margin: 0;
	font-size: 1.28rem;
	line-height: 1.28;
	font-weight: 700;
	color: var(--awb-color-7, #212934);
	letter-spacing: -0.01em;
}

.sefp-card__programme {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.5;
	color: var(--awb-color-custom-17, #9ea0a4);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.sefp-card__cta {
	margin-top: auto;
	padding-top: 14px;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--awb-color-5, #009fe3);
	display: inline-flex;
	align-items: center;
	gap: 8px;
}
.sefp-card__cta-label {
	position: relative;
}
.sefp-card__cta-label::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: -2px;
	height: 2px;
	width: 0%;
	background: var(--awb-color-5, #009fe3);
	transition: width 380ms cubic-bezier(.2,.7,.2,1);
}
.sefp-card__cta-arrow {
	display: inline-block;
	transition: transform 280ms cubic-bezier(.2,.7,.2,1);
}
.sefp-card__link:hover .sefp-card__cta-label::after { width: 100%; }
.sefp-card__link:hover .sefp-card__cta-arrow { transform: translateX(6px); }

/* ─── FEATURED card (full-width, image|content) ───────────────────── */

.sefp-card--featured {
	grid-column: 1 / -1;
	display: grid;
	grid-template-columns: 1.2fr 1fr;
	border-radius: 22px;
	background: linear-gradient(135deg, var(--awb-color-1, #ffffff) 0%, var(--awb-color-2, #f9f9fb) 100%);
	box-shadow: 0 12px 32px -8px rgba(33, 41, 52, 0.16);
}
.sefp-card--featured::after { border-radius: 22px; }
.sefp-card--featured:hover {
	transform: translateY(-6px) rotate(0deg); /* no rotate on featured — too big */
}
.sefp-card--featured .sefp-card__link {
	display: contents;
}
.sefp-card--featured .sefp-card__media {
	aspect-ratio: auto;
	min-height: 380px;
	border-radius: 22px 0 0 22px;
}
.sefp-card--featured .sefp-card__logo-chip {
	width: 64%;
	max-width: 360px;
	padding: 28px 36px;
}
.sefp-card--featured .sefp-card__body {
	padding: 48px 56px;
	justify-content: center;
	gap: 14px;
}
.sefp-card--featured .sefp-card__acronym { font-size: 0.92rem; letter-spacing: 0.18em; }
.sefp-card--featured .sefp-card__title {
	font-size: clamp(1.6rem, 2.8vw, 2.4rem);
	line-height: 1.15;
}
.sefp-card--featured .sefp-card__programme {
	font-size: 1rem;
	-webkit-line-clamp: 3;
	color: var(--awb-color-6, #4a4e57);
}
.sefp-card--featured .sefp-card__cta {
	margin-top: 18px;
	padding-top: 0;
	font-size: 1.05rem;
}
.sefp-card--featured .sefp-card__cta-label {
	padding-bottom: 4px;
}

/* ─── Pagination ──────────────────────────────────────────────────── */

.sefp-pagination {
	margin-top: 64px;
	display: flex;
	justify-content: center;
}
.sefp-pagination .nav-links {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}
.sefp-pagination a, .sefp-pagination span {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 44px;
	height: 44px;
	padding: 0 16px;
	border-radius: 12px;
	background: var(--awb-color-1, #ffffff);
	color: var(--awb-color-7, #212934);
	border: 1px solid var(--awb-color-4, #e2e2e2);
	font-weight: 600;
	font-size: 0.95rem;
	text-decoration: none;
	transition: background 200ms ease, color 200ms ease, border-color 200ms ease, transform 150ms ease;
}
.sefp-pagination a:hover {
	background: var(--awb-color-5, #009fe3);
	color: #fff;
	border-color: var(--awb-color-5, #009fe3);
	transform: translateY(-2px);
}
.sefp-pagination .current {
	background: var(--awb-color-7, #212934);
	color: #fff;
	border-color: var(--awb-color-7, #212934);
}

/* ─── Empty state ─────────────────────────────────────────────────── */

.sefp-empty {
	background: var(--awb-color-1, #ffffff);
	border: 1px dashed var(--awb-color-4, #e2e2e2);
	border-radius: 18px;
	padding: 56px 32px;
	text-align: center;
	color: var(--awb-color-6, #4a4e57);
}
.sefp-empty p { margin: 0 0 12px; font-size: 1rem; }
.sefp-empty .sefp-cta-link {
	color: var(--awb-color-5, #009fe3);
	text-decoration: none;
	font-weight: 600;
}

/* ─── Animations ──────────────────────────────────────────────────── */

@keyframes sefp-fade-up {
	from { opacity: 0; transform: translateY(16px); }
	to   { opacity: 1; transform: translateY(0); }
}

@keyframes sefp-card-reveal {
	from { opacity: 0; transform: translateY(20px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.sefp-archive-hero { animation: none; }
	.sefp-archive-hero__eyebrow,
	.sefp-archive-hero__stat,
	.sefp-archive-tabs,
	.sefp-card { animation: none; opacity: 1; transform: none; }
	.sefp-card:hover { transform: none; }
	.sefp-card:hover .sefp-card__media { transform: none; }
}

/* ─── Tablet (≤1024px) ────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.sefp-archive-hero { padding: 88px 0 72px; }
	.sefp-archive-hero__stat { gap: 24px; }
	.sefp-archive-grid-wrap { padding: 56px 0 80px; }
	.sefp-archive-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 22px; }

	.sefp-card--featured { grid-template-columns: 1fr 1fr; }
	.sefp-card--featured .sefp-card__media { min-height: 320px; }
	.sefp-card--featured .sefp-card__body { padding: 36px 36px; }
}

/* ─── Mobile (≤640px) ─────────────────────────────────────────────── */

@media (max-width: 640px) {
	.sefp-archive-hero { padding: 64px 0 52px; }
	.sefp-archive-hero__inner { gap: 24px; padding: 0 18px; }
	.sefp-archive-hero__stat {
		grid-template-columns: 1fr;
		gap: 8px;
	}
	.sefp-archive-hero__count {
		font-size: clamp(5.5rem, 22vw, 8rem);
	}
	.sefp-archive-hero__title { font-size: clamp(1.6rem, 7vw, 2rem); }
	.sefp-archive-grid-wrap { padding: 40px 0 64px; }
	.sefp-container { padding: 0 18px; }
	.sefp-archive-grid { grid-template-columns: 1fr; gap: 18px; }
	.sefp-archive-tabs { gap: 6px; }
	.sefp-tab { padding: 8px 14px; font-size: 0.85rem; }
	.sefp-card__media { aspect-ratio: 16 / 10; }
	.sefp-card__body { padding: 20px 22px 22px; }
	.sefp-card__title { font-size: 1.12rem; }

	/* Featured collapses into a normal stacked card on mobile */
	.sefp-card--featured { grid-template-columns: 1fr; }
	.sefp-card--featured .sefp-card__media {
		aspect-ratio: 16 / 10;
		min-height: 0;
		border-radius: 22px 22px 0 0;
	}
	.sefp-card--featured .sefp-card__body { padding: 24px 22px 26px; }
	.sefp-card--featured .sefp-card__title { font-size: 1.4rem; }
}
