/*
 * NEXT-A Jobs: stile pubblico.
 * Eredita i font del tema; colori e raggi si personalizzano dal tema
 * ridefinendo le variabili su .nj (es. .nj { --nj-accent: #00577a; }).
 *
 * Idea guida: la scheda riassuntiva della posizione è disegnata come il
 * cartiglio di una tavola tecnica, celle a filo con etichette piccole.
 * È l'unico elemento "forte"; tutto il resto resta sobrio.
 */

.nj {
	--nj-ink: #1a1a1a;
	--nj-text: #4b5159;
	--nj-muted: #6b7280;
	--nj-line: #c9d1da;
	--nj-line-soft: #e4e9ee;
	--nj-paper: #ffffff;
	--nj-soft: #f3f5f7;
	--nj-accent: #e8562a; /* arancio NEXT-A */
	--nj-accent-ink: #ffffff;
	--nj-ok: #2f7d4f;
	--nj-err: #a33a2c;
	--nj-radius: 2px;
	--nj-gap: clamp(1.25rem, 3vw, 2.5rem);
	color: var(--nj-ink);
	line-height: 1.6;
}

.nj *,
.nj *::before,
.nj *::after { box-sizing: border-box; }

.nj-page { overflow-x: clip; }

/* larghezza allineata alle pagine del tema (contenuti a tutta pagina con margini laterali) */
.nj-wrap {
	max-width: 1400px;
	margin-left: auto;
	margin-right: auto;
	padding-left: clamp(1rem, 3.4vw, 3rem);
	padding-right: clamp(1rem, 3.4vw, 3rem);
}

.nj-container { padding-top: clamp(2rem, 5vw, 4rem); padding-bottom: clamp(2.5rem, 6vw, 5rem); }

/* ---------- Testata con foto ---------- */

.nj-hero {
	position: relative;
	display: flex;
	align-items: flex-end;
	width: 100vw;
	margin-left: calc(50% - 50vw);
	min-height: clamp(340px, 40vw, 530px);
	background-color: #2b2e33;
	background-image: var(--nj-hero-img, none);
	background-position: center;
	background-size: cover;
	background-repeat: no-repeat;
	color: #fff;
}
/* velo scuro: in alto per header e menu bianchi, in basso per il titolo */
.nj-hero::before {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, .55) 0%, rgba(0, 0, 0, .2) 45%, rgba(0, 0, 0, .55) 100%);
}
.nj-hero__inner {
	position: relative;
	width: 100%;
	padding-top: 140px; /* spazio per l'header trasparente del tema */
	padding-bottom: clamp(2rem, 5vw, 4.5rem);
}
.nj-hero__eyebrow {
	margin: 0 0 .75rem;
	color: #fff;
	opacity: .9;
	font-size: 1rem;
	font-weight: 500;
}
.nj-hero__eyebrow::before {
	content: "";
	display: inline-block;
	width: 2rem;
	height: 2px;
	margin-right: .6rem;
	vertical-align: middle;
	background: var(--nj-accent);
}
.nj .nj-hero__title {
	max-width: 22ch;
	margin: 0;
	color: #fff;
	font-size: clamp(2rem, 4.4vw, 4rem);
	line-height: 1.06;
	letter-spacing: -.01em;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.nj-crumbs {
	width: 100vw;
	margin-left: calc(50% - 50vw);
	border-bottom: 1px solid var(--nj-line-soft);
}
.nj-crumbs ol {
	display: flex;
	flex-wrap: wrap;
	gap: .2rem .5rem;
	margin-top: 0;
	margin-bottom: 0;
	padding-top: 1.3rem;
	padding-bottom: 1.3rem;
	list-style: none;
	font-size: 1.05rem;
}
.nj-crumbs li { margin: 0; }
.nj-crumbs li + li::before { content: "/"; margin-right: .5rem; color: var(--nj-muted); }
.nj-crumbs a { color: var(--nj-muted); text-decoration: none; }
.nj-crumbs a:hover { color: var(--nj-accent); }
.nj-crumbs span { color: var(--nj-ink); text-transform: uppercase; }

@media (max-width: 782px) {
	.nj-hero__inner { padding-top: 110px; }
	.nj-crumbs ol { font-size: .95rem; padding-top: 1rem; padding-bottom: 1rem; }
	/* su telefono il titolo è già nella testata: niente ripetizione su più righe */
	.nj-crumbs li:last-child:not(:first-child) { display: none; }
}

/* ---------- Intestazione ---------- */

.nj-job__head { max-width: 46rem; }
.nj-job__head > :last-child { margin-bottom: var(--nj-gap); }

.nj-job__area {
	margin: 0 0 .5rem;
	color: var(--nj-accent);
	font-size: .95rem;
	font-weight: 600;
}

.nj-job__title {
	margin: 0;
	font-size: clamp(1.9rem, 4.2vw, 2.9rem);
	line-height: 1.12;
	letter-spacing: -.015em;
	color: var(--nj-ink);
}

.nj-job__closed {
	margin: 1rem 0 0;
	padding: .65rem .9rem;
	border-left: 3px solid var(--nj-err);
	background: #fbf1ef;
	color: var(--nj-err);
	font-size: .95rem;
}

/* ---------- Layout ----------
 * Basato sulla larghezza del contenitore, non dello schermo: funziona sia nel
 * template del plugin sia dentro la colonna stretta dei temi a blocchi.
 */

.nj-job { container: nj-job / inline-size; }

.nj-job__layout {
	display: grid;
	grid-template-columns: 1fr;
	grid-template-areas: "aside" "main";
	gap: var(--nj-gap);
	align-items: start;
}
.nj-job__main { grid-area: main; min-width: 0; }
.nj-job__aside { grid-area: aside; }

@container nj-job (min-width: 760px) {
	.nj-job__layout {
		grid-template-columns: minmax(0, 1fr) 19rem;
		grid-template-areas: "main aside";
	}
	.nj-job__aside { position: sticky; top: 1.5rem; }
}

/* ---------- Cartiglio ---------- */

.nj-sheet {
	border: 1.5px solid var(--nj-ink);
	background: var(--nj-paper);
}

.nj-sheet__grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	margin: 0;
}

.nj-sheet__cell {
	padding: .7rem .85rem .8rem;
	border-bottom: 1px solid var(--nj-line);
	min-width: 0;
}
.nj-sheet__cell:nth-child(odd) { border-right: 1px solid var(--nj-line); }
/* l'ultima cella dispari occupa la riga intera */
.nj-sheet__cell:last-child:nth-child(odd) { grid-column: 1 / -1; border-right: 0; }

.nj-sheet__cell dt {
	display: flex;
	align-items: center;
	gap: .35rem;
	margin: 0 0 .2rem;
	color: var(--nj-muted);
	font-size: .78rem;
	font-weight: 500;
	line-height: 1.3;
}
.nj-sheet__cell dt .nj-ico { width: 15px; height: 15px; flex: none; }

.nj-sheet__cell dd {
	margin: 0;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.nj-sheet__foot { padding: .9rem .85rem 1rem; }

/* sopra il testo (colonna unica) il cartiglio si distende su più celle per riga */
@container nj-job (max-width: 759px) {
	.nj-sheet__grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
	.nj-sheet__cell,
	.nj-sheet__cell:nth-child(odd) { border-right: 1px solid var(--nj-line); }
	.nj-sheet__cell:last-child:nth-child(odd) { grid-column: auto; }
	.nj-sheet__foot { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; }
	.nj-sheet__foot .nj-btn--block { width: auto; }
	.nj-share { margin-top: 0; }
}
@container nj-job (max-width: 520px) {
	.nj-sheet__foot .nj-btn--block { width: 100%; }
	.nj-sheet__cell { padding: .55rem .75rem .6rem; }
}

/* ---------- Pulsanti ---------- */

.nj-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	min-height: 2.9rem;
	padding: .65rem 1.4rem;
	border: 1.5px solid var(--nj-ink);
	border-radius: var(--nj-radius);
	background: transparent;
	color: var(--nj-ink);
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
.nj-btn--primary {
	background: var(--nj-accent);
	border-color: var(--nj-accent);
	color: var(--nj-accent-ink);
}
.nj-btn--primary:hover { background: var(--nj-ink); border-color: var(--nj-ink); color: #fff; }
.nj-btn--block { width: 100%; }
.nj-btn[disabled] { opacity: .6; cursor: progress; }

.nj a:focus-visible,
.nj button:focus-visible,
.nj input:focus-visible,
.nj select:focus-visible,
.nj textarea:focus-visible,
.nj .nj-file:focus-within {
	outline: 2px solid var(--nj-accent);
	outline-offset: 2px;
}

.nj-share {
	display: flex;
	flex-wrap: wrap;
	gap: .25rem 1rem;
	margin-top: .8rem;
}
.nj-share__link {
	padding: 0;
	border: 0;
	background: none;
	color: var(--nj-muted);
	font: inherit;
	font-size: .88rem;
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}
.nj-share__link:hover { color: var(--nj-accent); }

/* ---------- Sezioni di testo ---------- */

.nj-section { max-width: 44rem; margin: 0 0 2.25rem; }

.nj .nj-section__title {
	margin: 0 0 .9rem;
	padding-top: 1rem;
	border-top: 1.5px solid var(--nj-ink);
	color: var(--nj-ink);
	font-size: clamp(1.25rem, 2vw, 1.6rem);
	line-height: 1.25;
	letter-spacing: .01em;
	text-transform: uppercase;
}

/* il tema colora i paragrafi di grigio chiaro: qui serve più contrasto */
.nj .nj-prose,
.nj .nj-prose p,
.nj .nj-prose li { color: var(--nj-text); }
.nj .nj-prose strong,
.nj .nj-prose b { color: var(--nj-ink); }
.nj-prose img { max-width: 100%; height: auto; }
.nj-prose > :first-child { margin-top: 0; }
.nj-prose > :last-child { margin-bottom: 0; }
.nj-prose ul { padding-left: 1.2rem; }
.nj-prose li { margin: .3rem 0; }
.nj-prose li::marker { color: var(--nj-accent); }

/* ---------- Candidatura ---------- */

.nj-apply {
	max-width: 44rem;
	margin-top: 3rem;
	padding: clamp(1.25rem, 3vw, 2rem);
	background: var(--nj-soft);
	border-top: 3px solid var(--nj-accent);
	scroll-margin-top: 1.5rem;
}
.nj-apply:focus { outline: none; }

.nj .nj-apply__title { margin: 0 0 .35rem; color: var(--nj-ink); font-size: clamp(1.3rem, 2.2vw, 1.7rem); line-height: 1.2; text-transform: uppercase; }
.nj-apply__lead { margin: 0 0 1.5rem; color: var(--nj-muted); }

.nj-form { display: grid; gap: 1.1rem; }

.nj-row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.1rem;
}
@container nj-job (max-width: 520px) { .nj-row { grid-template-columns: 1fr; } }

.nj-field { display: grid; gap: .35rem; min-width: 0; }

.nj-field label,
.nj-label { font-size: .92rem; font-weight: 600; }

.nj-req { color: var(--nj-err); }

.nj-field input[type="text"],
.nj-field input[type="email"],
.nj-field input[type="tel"],
.nj-field input[type="url"],
.nj-field textarea {
	width: 100%;
	padding: .7rem .8rem;
	border: 1px solid var(--nj-line);
	border-radius: var(--nj-radius);
	background: var(--nj-paper);
	color: var(--nj-ink);
	font: inherit;
	line-height: 1.4;
}
.nj-field textarea { resize: vertical; min-height: 7rem; }
.nj-field input:focus,
.nj-field textarea:focus { border-color: var(--nj-accent); }

.nj-field.is-invalid input,
.nj-field.is-invalid textarea,
.nj-field.is-invalid .nj-file { border-color: var(--nj-err); }

/* campo file */
.nj-file {
	position: relative;
	display: flex;
	align-items: center;
	gap: .9rem;
	padding: .55rem .6rem;
	border: 1px dashed var(--nj-line);
	border-radius: var(--nj-radius);
	background: var(--nj-paper);
	cursor: pointer;
}
.nj-file input[type="file"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}
.nj-file__btn {
	flex: none;
	padding: .45rem .9rem;
	border: 1px solid var(--nj-ink);
	border-radius: var(--nj-radius);
	font-size: .9rem;
	font-weight: 600;
}
.nj-file__name { color: var(--nj-muted); font-size: .9rem; overflow-wrap: anywhere; }
.nj-file.has-file { border-style: solid; border-color: var(--nj-accent); }
.nj-file.has-file .nj-file__name { color: var(--nj-ink); }

/* consenso */
.nj-check {
	grid-template-columns: auto 1fr;
	align-items: start;
	gap: .6rem;
}
.nj-check input { width: 1.1rem; height: 1.1rem; margin: .2rem 0 0; accent-color: var(--nj-accent); }
.nj-check label { font-weight: 400; font-size: .9rem; color: var(--nj-muted); }
.nj-check a { color: var(--nj-accent); }

.nj-submit {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: .75rem 1.25rem;
	margin-top: .25rem;
}
.nj-hint { color: var(--nj-muted); font-size: .85rem; }

/* honeypot */
.nj-hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* messaggi */
.nj-result { padding: .9rem 1rem; border-left: 3px solid var(--nj-line); background: var(--nj-paper); }
.nj-result p { margin: 0; }
.nj-result--ok { border-left-color: var(--nj-ok); color: var(--nj-ok); font-weight: 600; }
.nj-result--error { border-left-color: var(--nj-err); color: var(--nj-err); }
.nj-result--muted { color: var(--nj-muted); }
.nj-result[hidden] { display: none; }

.cf-turnstile { min-height: 65px; }

/* ---------- CTA mobile ---------- */

.nj-mobile-cta {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 50;
	display: none;
	align-items: center;
	gap: 1rem;
	padding: .65rem 1rem calc(.65rem + env(safe-area-inset-bottom));
	background: var(--nj-paper);
	border-top: 1px solid var(--nj-line);
	box-shadow: 0 -6px 18px rgba(29, 39, 51, .08);
}
.nj-mobile-cta__title {
	flex: 1;
	min-width: 0;
	font-weight: 600;
	font-size: .92rem;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
@media (max-width: 900px) {
	.nj-mobile-cta.is-visible { display: flex; }
}
/* il CTA fisso è fuori dal flusso: niente container query qui */

/* ---------- Elenco posizioni ---------- */

.nj-archive-head { max-width: 46rem; margin-bottom: 2rem; }
.nj-archive-head__title { margin: 0 0 .5rem; font-size: clamp(2rem, 4.5vw, 3rem); line-height: 1.1; letter-spacing: -.015em; }
.nj-archive-head__lead { margin: 0; color: var(--nj-muted); font-size: 1.1rem; }

.nj-filters {
	display: flex;
	flex-wrap: wrap;
	gap: .75rem 1.5rem;
	margin: 0 0 1.5rem;
}
.nj-filters__item { display: flex; align-items: center; gap: .5rem; font-size: .92rem; }
.nj-filters__item span { color: var(--nj-muted); }
.nj-filters select {
	padding: .45rem 2rem .45rem .7rem;
	border: 1px solid var(--nj-line);
	border-radius: var(--nj-radius);
	background-color: var(--nj-paper);
	color: var(--nj-ink);
	font: inherit;
}

.nj-list__count { margin: 0 0 .5rem; color: var(--nj-muted); font-size: .92rem; }

.nj-list__items { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid var(--nj-ink); }

.nj-item {
	position: relative;
	display: grid;
	grid-template-columns: minmax(0, 1fr) auto;
	grid-template-areas:
		"area     deadline"
		"title    deadline"
		"excerpt  excerpt"
		"facts    facts";
	column-gap: 2rem;
	padding: 1.35rem .25rem 1.4rem;
	border-bottom: 1px solid var(--nj-line);
}
.nj-item:hover { background: var(--nj-soft); }

.nj-item__area { grid-area: area; margin: 0 0 .2rem; color: var(--nj-accent); font-size: .88rem; font-weight: 600; }
.nj-item__title { grid-area: title; margin: 0; font-size: 1.3rem; line-height: 1.3; }
.nj-item__title a { color: var(--nj-ink); text-decoration: none; }
.nj-item__title a::after { content: ""; position: absolute; inset: 0; }
.nj-item__title a:hover { color: var(--nj-accent); }
.nj-item__excerpt { grid-area: excerpt; margin: .5rem 0 0; color: var(--nj-muted); max-width: 46rem; }
.nj-item__deadline { grid-area: deadline; align-self: start; margin: .15rem 0 0; color: var(--nj-muted); font-size: .88rem; white-space: nowrap; }

.nj-item__facts {
	grid-area: facts;
	display: flex;
	flex-wrap: wrap;
	gap: .4rem 1.4rem;
	margin: .75rem 0 0;
	padding: 0;
	list-style: none;
	font-size: .92rem;
}
.nj-item__facts li { display: inline-flex; align-items: center; gap: .35rem; }
.nj-item__facts .nj-ico { width: 16px; height: 16px; color: var(--nj-muted); }

@media (max-width: 600px) {
	.nj-item {
		grid-template-columns: 1fr;
		grid-template-areas: "area" "title" "excerpt" "facts" "deadline";
	}
	.nj-item__deadline { margin-top: .6rem; white-space: normal; }
}

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

@media (prefers-reduced-motion: reduce) {
	.nj * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
	.nj-apply, .nj-mobile-cta, .nj-share, .nj-sheet__foot .nj-btn { display: none !important; }
	.nj-job__layout { display: block; }
	.nj-job__aside { margin-bottom: 1.5rem; }
}
