/* =====================================================================
   Árvores e Arbustos de Portugal — fiche espèce, nouveau design
   (étiquette d'herbier). Couleurs et polices : variables --aa-* de
   assets/css/aap-design.css, chargé avant ce fichier.
   Les classes .aap-toc-*, .aap-ficha-section, .aap-side-card… sont
   créées par assets/fiche-espece.js à partir du contenu WPBakery.
   ===================================================================== */

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
	html { scroll-behavior: auto; }
}

/* En-tête commun avec l'accueil et l'Arboretum. */
.aap-fiche-page .aap-home-header {
	position: sticky;
	top: 0;
	background: rgba(21, 36, 27, .97);
	color: #fff;
	border-color: rgba(255, 255, 255, .18);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
}

.aap-fiche-page.admin-bar .aap-home-header {
	top: 32px;
}

.aap-fiche-page .aap-home-brand,
.aap-fiche-page .aap-home-nav a,
.aap-fiche-page .aap-home-menu-toggle {
	color: #fff !important;
}

.aap-fiche-page .aap-home-nav a {
	opacity: .78;
}

.aap-fiche-page .aap-home-nav a:hover,
.aap-fiche-page .aap-home-nav a:focus-visible,
.aap-fiche-page .aap-home-nav a[aria-current='page'] {
	opacity: 1;
}

.aap-fiche-main {
	background: var(--aa-paper);
}

@media (max-width: 900px) {
	.aap-fiche-page.admin-bar .aap-home-header {
		top: 46px;
	}
}

/* Le bandeau-titre standard de Betheme fait doublon avec l'en-tête
   ci-dessous : on le masque uniquement sur les fiches concernées. */
.single-portfolio #Subheader { display: none !important; }

.single-portfolio #Content,
.single-portfolio .aap-fiche-body { background: var(--aa-paper); }

.aap-wrap {
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 32px);
	box-sizing: border-box;
}

/* ---------- Grille commune : colonne principale + colonne de 400 px ---------- */
.aap-grid-main-side {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 400px;
	gap: 80px;
	align-items: start;
}
@media (max-width: 1100px) {
	.aap-grid-main-side { grid-template-columns: minmax(0, 1fr) 340px; gap: 48px; }
}
@media (max-width: 900px) {
	.aap-grid-main-side { grid-template-columns: minmax(0, 1fr); gap: 32px; }
}

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

/* ---------- Fil d'Ariane + espèces voisines ---------- */
.aap-crumb {
	background: var(--aa-paper);
	border-bottom: 1px solid var(--aa-rule);
	font-family: var(--aa-font-body);
	font-size: 14px;
	color: var(--aa-moss);
}
.aap-crumb-inner {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	align-items: center;
	gap: 10px 24px;
	padding-block: 20px;
}
.aap-crumb-path,
.aap-crumb-adjacent {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}
.aap-crumb-adjacent { gap: 24px; }
.aap-crumb a { color: var(--aa-heather); }
.aap-crumb .aap-crumb-familia { font-family: var(--aa-font-mono); font-size: 13px; }
.aap-crumb-path .aa-latin { color: var(--aa-ink); }

/* ---------- Rangée 1 : titre + étiquette d'herbier ---------- */
.aap-fiche-hero {
	background: var(--aa-paper);
	padding-block: 64px 48px;
}
.aap-fiche-hero-info {
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}
.aap-eyebrow { margin: 0; }

.aap-fiche-title {
	display: flex;
	flex-direction: column;
	gap: 20px;
	margin: 0;
	font-weight: 400;
	color: var(--aa-ink);
}
.aap-fiche-latin {
	font-size: clamp(2.6rem, 5.8vw, 5.25rem);
	line-height: 1;
	overflow-wrap: anywhere;
}
.aap-fiche-autor {
	font-family: var(--aa-font-latin);
	font-style: normal;
	font-size: .48em;
	color: var(--aa-moss);
}
.aap-fiche-autor:not(:empty)::before { content: " "; }
.aap-fiche-vernaculo {
	font-family: var(--aa-font-display);
	font-size: clamp(1.6rem, 2.6vw, 2.25rem);
	line-height: 1.1;
}

.aap-fiche-lead {
	max-width: 680px;
	font-family: var(--aa-font-body);
	font-size: 18px;
	line-height: 1.65;
	color: var(--aa-ink-soft);
}
.aap-fiche-lead:empty { display: none; }
.aap-fiche-lead p { margin: 0 0 .8em; }
.aap-fiche-lead p:last-child { margin-bottom: 0; }
.aap-fiche-lead a { color: var(--aa-heather); }
.aap-fiche-lead em { font-family: var(--aa-font-latin); }

/* Étiquette d'herbier (remplie par le JS avec la fiche technique) */
.aap-herbario {
	padding: 24px 26px;
	background: var(--aa-card);
	border: 1px solid var(--aa-ink);
	font-size: 15px;
}
.aap-herbario-titulo {
	margin: 0;
	padding-bottom: 14px;
	border-bottom: 1px solid var(--aa-ink);
	font-family: var(--aa-font-mono);
	font-size: 11px;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--aa-ink);
}
.aap-herbario-linhas { margin: 0; }
.aap-herbario-linhas > div,
.aap-herbario .aap-spec-row {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr);
	gap: 12px;
	padding-block: 12px;
	border-bottom: 1px dashed var(--aa-rule);
	font-family: var(--aa-font-body);
	font-size: 15px;
	line-height: 1.5;
}
.aap-herbario-linhas > div:last-child,
.aap-herbario .aap-spec-row:last-child { border-bottom: 0; padding-bottom: 0; }
.aap-herbario dt,
.aap-herbario .aap-spec-row > span:first-child {
	font-weight: 400;
	font-family: var(--aa-font-mono);
	font-size: 12px;
	color: var(--aa-moss);
}
.aap-herbario dd { margin: 0; color: var(--aa-ink); }
.aap-herbario .is-mono { font-family: var(--aa-font-mono); font-size: 14px; }
.aap-herbario em { font-family: var(--aa-font-latin); font-style: italic; }

/* ---------- Rangée 2 : grande photo + données clés ---------- */
.aap-fiche-media { padding-bottom: 56px; }
.aap-fiche-foto {
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}
.aap-fiche-foto img.aap-fiche-hero-img {
	display: block;
	width: 100%;
	height: 580px;
	object-fit: cover;
}
.aap-fiche-foto-placeholder {
	width: 100%;
	height: 580px;
	display: grid;
	place-content: center;
	justify-items: center;
	gap: 14px;
	background:
		radial-gradient(circle at 50% 42%, rgba(255, 255, 255, .24), transparent 22%),
		var(--aa-lichen);
	color: var(--aa-moss);
}
.aap-fiche-foto-placeholder span {
	width: 76px;
	height: 92px;
	display: grid;
	place-items: center;
	border: 1px solid currentColor;
	border-radius: 50% 50% 46% 54% / 62% 58% 42% 38%;
	font-family: var(--aa-font-latin);
	font-size: 48px;
	font-style: italic;
	transform: rotate(-4deg);
}
.aap-fiche-foto-placeholder small {
	font-family: var(--aa-font-mono);
	font-size: 10px;
	letter-spacing: .14em;
	text-transform: uppercase;
}
.aap-fiche-foto figcaption {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 16px;
	font-family: var(--aa-font-body);
	font-size: 14px;
	color: var(--aa-moss);
}
.aap-botao {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 18px;
	border-radius: var(--aa-radius-pill);
	font-family: var(--aa-font-body);
	font-size: 15px;
	font-weight: 600;
	text-decoration: none !important;
	white-space: nowrap;
}
.aap-botao-contorno { border: 1px solid var(--aa-ink); color: var(--aa-ink) !important; }
.aap-botao-contorno:hover { background: var(--aa-lichen); }
.aap-botao[hidden] { display: none; }

.aap-factos {
	margin: 0;
	border-top: 1px solid var(--aa-ink);
}
.aap-factos > div {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
	padding-block: 16px;
	border-bottom: 1px solid var(--aa-rule);
}
.aap-factos dt {
	font-weight: 400;
	font-family: var(--aa-font-body);
	font-size: 14px;
	color: var(--aa-moss);
}
.aap-factos dd {
	margin: 0;
	font-family: var(--aa-font-display);
	font-size: 26px;
	line-height: 1.15;
	text-align: right;
	color: var(--aa-ink);
}
.aap-factos dd.is-mono { font-family: var(--aa-font-mono); font-size: 16px; }

/* ---------- Rangée 3 : calendrier fenológico, pleine largeur ---------- */
.aap-fenologia {
	margin: 0 0 40px;
	padding: 32px 36px;
	background: var(--aa-card);
	border: 1px solid var(--aa-rule);
	display: flex;
	flex-direction: column;
	gap: 18px;
}
.aap-fenologia-cabecalho {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 16px;
}
.aap-fenologia-cabecalho .aa-label { color: var(--aa-ink); letter-spacing: .18em; }
.aap-fenologia-legenda {
	white-space: nowrap;
	display: flex;
	align-items: center;
	gap: 8px;
	font-family: var(--aa-font-body);
	font-size: 13px;
	color: var(--aa-moss);
}
.aap-fenologia-amostra { width: 14px; height: 14px; background: var(--aa-heather); }
.aap-fenologia-grelha {
	display: grid;
	grid-template-columns: 140px repeat(12, minmax(0, 1fr));
	gap: 4px;
	align-items: center;
}
.aap-fenologia-mes {
	font-family: var(--aa-font-mono);
	font-size: 12px;
	text-align: center;
	color: var(--aa-moss);
}
.aap-fenologia-rotulo {
	font-family: var(--aa-font-body);
	font-size: 13px;
	font-weight: 600;
	color: var(--aa-ink);
}
.aap-fenologia-barra { height: 28px; background: #E4E8DE; }
.aap-fenologia-barra.is-on { background: var(--aa-heather); }

@media (max-width: 900px) {
	.aap-fiche-hero { padding-block: 36px 32px; }
	.aap-fiche-foto img.aap-fiche-hero-img { height: auto; max-height: 460px; }
	.aap-fiche-foto-placeholder { height: 420px; }
	.aap-factos dd { font-size: 22px; }
	.aap-fenologia { padding: 22px 18px; margin-bottom: 48px; }
	.aap-fenologia-grelha { grid-template-columns: 76px repeat(12, minmax(0, 1fr)); gap: 3px; }
	.aap-fenologia-mes { font-size: 10px; }
	.aap-fenologia-barra { height: 22px; }
}
@media (max-width: 480px) {
	.aap-herbario { padding: 18px 16px; }
	.aap-herbario-linhas > div,
	.aap-herbario .aap-spec-row { grid-template-columns: 96px minmax(0, 1fr); }
	.aap-fiche-foto figcaption { flex-direction: column; align-items: flex-start; }
}

/* ---------- Rangée 4 : texte + « O género » ---------- */
.aap-fiche-body .aap-body-main { min-width: 0; }
/* Neutralise la largeur/marges de Betheme dans la colonne principale :
   la grille .aap-grid-main-side gère déjà la largeur. */
.aap-fiche-body .aap-body-main .mcb-section,
.aap-fiche-body .aap-body-main .section_wrapper {
	width: auto !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 0 !important;
	float: none !important;
}
/* La colonne « fiche technique » de WPBakery est vidée (déplacée dans
   l'étiquette) : la colonne de texte prend toute la largeur. */
.aap-fiche-body .aap-col-vazia { display: none !important; }
.aap-fiche-body .aap-col-texto { width: 100% !important; }

.aap-body-aside {
	position: sticky;
	top: calc(var(--aap-header-h, 0px) + 24px);
	display: flex;
	flex-direction: column;
	gap: 20px;
	padding-top: 32px;
}
.aap-body-aside:empty { display: none; }
.aap-body-aside .aa-label { margin: 0; }
.aap-body-aside .aa-label .aa-latin { text-transform: none; letter-spacing: 0; font-size: 14px; }
.aap-genero { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 18px; }
.aap-genero li { margin: 0; }
.aap-genero a {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr);
	gap: 16px;
	align-items: center;
	color: var(--aa-ink) !important;
	text-decoration: none !important;
}
.aap-genero img,
.aap-genero-sem-foto {
	width: 120px;
	height: 96px;
	object-fit: cover;
	display: block;
}
.aap-genero-sem-foto {
	box-sizing: border-box;
	border: 1px dashed var(--aa-rule-strong);
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: var(--aa-font-mono);
	font-size: 11px;
	color: var(--aa-moss);
}
.aap-genero-nomes { display: flex; flex-direction: column; gap: 4px; }
.aap-genero-nomes .aa-latin { font-size: 20px; }
.aap-genero-nomes span:last-child { font-family: var(--aa-font-body); font-size: 14px; color: var(--aa-moss); }
.aap-genero a:hover .aa-latin { color: var(--aa-heather); }
@media (max-width: 900px) {
	.aap-body-aside { position: static; padding-top: 0; }
}

/* ---------- Navigation « Nesta página » (pastilles, collante) ---------- */

/* Betheme met « overflow-x: hidden » sur <body> en mobile : le body devient
   alors un conteneur de défilement et position: sticky ne colle plus.
   « clip » coupe aussi le débordement horizontal, sans cet effet de bord. */
body.single-portfolio {
	overflow-x: clip !important;
	overflow-y: visible !important;
}
.aap-fiche-body { padding-top: 0; }
/* Nouveau template : la barre ouvre directement la colonne de texte. */
.aap-body-main .aap-toc-nav { margin-top: 0; }

.aap-toc-nav {
	position: sticky;
	top: var(--aap-header-h, 0px);
	z-index: 90;
	margin: 24px 0 8px;
	background: color-mix(in srgb, var(--aa-paper) 94%, transparent);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
	border-top: 1px solid var(--aa-ink);
	border-bottom: 1px solid var(--aa-rule);
}
.aap-toc-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	overflow: visible;
	max-width: 1200px;
	margin-inline: auto;
	/* Pas de marge latérale : la barre est déjà dans la colonne de texte,
	   les pastilles s'alignent ainsi sur le bord du texte. */
	padding: 12px 0;
	box-sizing: border-box;
}
.aap-toc-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 1 auto;
	min-height: 40px;
	padding: 0 18px;
	border: 1px solid var(--aa-ink);
	border-radius: var(--aa-radius-pill);
	font-family: var(--aa-font-body);
	font-size: 14px;
	font-weight: 600;
	color: var(--aa-ink) !important;
	text-decoration: none !important;
	white-space: nowrap;
	transition: background-color .15s ease, color .15s ease;
}
.aap-toc-link:hover { background: var(--aa-lichen); }
.aap-toc-link.is-current {
	background: var(--aa-ink);
	color: var(--aa-paper) !important;
}

@media (max-width: 640px) {
	.aap-toc-wrap {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 7px;
		padding-block: 10px;
	}

	.aap-toc-link {
		width: 100%;
		min-height: 38px;
		padding: 7px 10px;
		font-size: 13px;
		line-height: 1.15;
		text-align: center;
	}
}

/* ---------- Corps de la fiche ---------- */
.aap-fiche-body .the_content_wrapper {
	font-family: var(--aa-font-body);
	color: var(--aa-ink);
}
.aap-fiche-body .the_content_wrapper p { line-height: 1.7; }
.aap-fiche-body .the_content_wrapper a { color: var(--aa-heather); }
.aap-fiche-body .the_content_wrapper em,
.aap-fiche-body .the_content_wrapper i { font-family: var(--aa-font-latin); }

/* Fonds de rangée WPBakery (« Options de design » › couleur de fond,
   ex. .vc_custom_1533590999989 { background-color: #f2f2f2 !important })
   : on les rend transparents pour que tout le texte repose sur le fond
   papier du design, sans avoir à modifier chaque fiche dans l'éditeur.
   Sélecteur à deux classes + !important = plus fort que la règle WPBakery. */
.aap-fiche-body .vc_row-has-fill,
.aap-fiche-body .vc_row-has-fill > .vc_column_container > .vc_column-inner {
	background-color: transparent !important;
}

/* Slider Revolution en tête de contenu : la photo principale est déjà dans
   l'en-tête de fiche. On masque uniquement le slider — jamais sa rangée — car
   plusieurs anciennes fiches placent le slider et tout leur texte dans la
   même rangée WPBakery. */
.aap-fiche-body .wpb_revslider_element {
	display: none !important;
}

/* Sections Descrição, Ecologia… */
.aap-fiche-body .ficha-container {
	max-width: 1200px;
	margin-inline: auto;
	padding-inline: clamp(16px, 4vw, 32px);
}
.aap-ficha-section {
	padding-block: 44px;
	border-top: 1px solid var(--aa-rule);
	scroll-margin-top: calc(var(--aap-header-h, 0px) + var(--aap-toc-h, 66px) + 16px);
}
.aap-ficha-section:first-of-type { border-top: 0; padding-top: 32px; }
.aap-section-kicker { margin-bottom: 20px; }
.aap-section-kicker h2 {
	margin: 0;
	font-family: var(--aa-font-display);
	font-weight: 400;
	font-size: clamp(1.8rem, 3vw, 2.4rem);
	line-height: 1.1;
	color: var(--aa-ink);
}
.aap-content-grid {
	display: grid;
	grid-template-columns: 1.3fr .7fr;
	gap: 48px;
	align-items: start;
}
.aap-content-grid.no-side { grid-template-columns: 1fr; }
.aap-measure { max-width: 68ch; font-family: var(--aa-font-body); }
.aap-measure h3,
.aap-measure h4 {
	margin: 28px 0 0;
	font-family: var(--aa-font-display);
	font-weight: 400;
	font-size: 1.45rem;
	color: var(--aa-ink);
}
.aap-measure h3:first-child,
.aap-measure h4:first-child { margin-top: 0; }
.aap-measure p { margin-top: 10px; font-size: 1.05rem; line-height: 1.7; color: var(--aa-ink); }
.aap-measure ul,
.aap-measure ol { margin-top: 10px; padding-left: 20px; }
.aap-measure li { margin-bottom: 6px; }
.aap-measure strong { font-weight: 600; }
@media (max-width: 980px) {
	.aap-content-grid { grid-template-columns: 1fr; }
}

/* ---------- Fiche technique = étiquette d'herbier ---------- */
.aap-side-card {
	padding: 22px 24px !important;
	background: var(--aa-card);
	border: 1px solid var(--aa-ink);
}
.aap-side-card h4 {
	margin: 0 0 6px;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--aa-ink);
	font-family: var(--aa-font-mono);
	font-size: 11px;
	font-weight: 500;
	letter-spacing: .2em;
	text-transform: uppercase;
	color: var(--aa-ink);
}
.aap-spec-row {
	display: grid;
	grid-template-columns: 120px minmax(0, 1fr);
	gap: 12px;
	padding-block: 11px;
	border-bottom: 1px dashed var(--aa-rule);
	font-family: var(--aa-font-body);
	font-size: 15px;
}
.aap-spec-row:last-child { border-bottom: 0; }
.aap-spec-row span:first-child {
	font-family: var(--aa-font-mono);
	font-size: 12px;
	color: var(--aa-moss);
}
.aap-spec-row span:last-child { color: var(--aa-ink); }
.aap-spec-row em { font-family: var(--aa-font-latin); font-style: italic; }

/* ---------- Galerie photo ---------- */
.aap-fiche-body .wpb_gallery {
	padding: 20px;
	background: var(--aa-card);
	border: 1px solid var(--aa-rule);
}
.aap-fiche-body .wpb_gallery_heading {
	margin: 0 0 14px;
	font-family: var(--aa-font-mono);
	font-size: 12px;
	font-weight: 500;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--aa-moss);
}
.aap-fiche-body .wpb_image_grid_ul li a { display: block; overflow: hidden; }

/* ---------- Commentaires ---------- */
.aap-fiche-comments {
	max-width: 1200px;
	margin: 0 auto 64px;
	padding: 32px clamp(16px, 4vw, 32px);
	box-sizing: border-box;
	border: 1px solid var(--aa-ink);
	background: var(--aa-paper);
}

/* ---------- Avertissement éventuel ---------- */
.aap-disclaimer {
	margin-top: 40px;
	padding: 16px 18px;
	border: 1px dashed var(--aa-rule-strong);
	background: var(--aa-card);
	font-family: var(--aa-font-body);
	font-size: .9rem;
	color: var(--aa-ink-soft);
}
