/* ==========================================================================
   AS PHARM — composants globaux
   Tokens : voir theme.json (--wp--preset--* et --wp--custom--*)
   ========================================================================== */

/* --- Accessibilité ------------------------------------------------------ */

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 1000;
	padding: 0.75rem 1.25rem;
	background: var(--wp--preset--color--navy);
	color: #fff;
	border-radius: 0 0 10px 0;
}

.skip-link:focus {
	left: 0;
}

:where(a, button, input, select, textarea, summary):focus-visible {
	outline: 3px solid var(--wp--preset--color--green);
	outline-offset: 2px;
	border-radius: 4px;
}

/* --- Typographie display -------------------------------------------------- */

/* Signature typographique : Bricolage Grotesque condensé (axe de largeur
   75–125 % de la fonte variable ; theme.json ne gère pas fontStretch). */
h1,
h2,
h3,
h4,
h5,
h6 {
	font-stretch: 87%;
}

/* --- Boutons ------------------------------------------------------------ */

.wp-block-button__link {
	transition: background-color var(--wp--custom--transition), color var(--wp--custom--transition), border-color var(--wp--custom--transition), transform var(--wp--custom--transition);
}

.wp-block-button__link:hover {
	transform: translateY(-1px);
}

/* Variante ghost (style "Contour" de l'éditeur) */
.wp-block-button.is-style-outline .wp-block-button__link {
	background: transparent;
	border: 1.5px solid currentColor;
	color: var(--wp--preset--color--green-dark);
}

.wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: var(--wp--preset--color--green-dark);
	border-color: var(--wp--preset--color--green-dark);
	color: #fff;
}

/* Ghost sur fond sombre (hero, bandes CTA) */
.ap-on-dark .wp-block-button.is-style-outline .wp-block-button__link {
	color: #fff;
	border-color: rgba(255, 255, 255, 0.55);
}

.ap-on-dark .wp-block-button.is-style-outline .wp-block-button__link:hover {
	background: rgba(255, 255, 255, 0.12);
	border-color: #fff;
	color: #fff;
}

/* --- Sections ------------------------------------------------------------ */

.ap-section {
	padding-top: var(--wp--custom--section-padding);
	padding-bottom: var(--wp--custom--section-padding);
}

.ap-section--surface {
	background: var(--wp--preset--color--surface);
}

/* --- Eyebrow / badge ------------------------------------------------------ */

.ap-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.35rem 0.9rem;
	border-radius: 999px;
	background: rgba(17, 132, 61, 0.1);
	color: var(--wp--preset--color--green-dark);
	font-size: 0.82rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ap-on-dark .ap-eyebrow {
	background: rgba(255, 255, 255, 0.12);
	color: #fff;
}

/* --- Cartes ---------------------------------------------------------------- */

.ap-card {
	background: #fff;
	border-radius: var(--wp--custom--radius--card);
	box-shadow: var(--wp--custom--shadow--card);
	padding: 2rem;
	transition: transform var(--wp--custom--transition), box-shadow var(--wp--custom--transition);
}

.ap-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--wp--custom--shadow--cardHover);
}

/* --- Motif croix de pharmacie ---------------------------------------------- */

.ap-cross {
	width: 1em;
	height: 1em;
	flex: none;
}

.ap-watermark {
	position: absolute;
	inset: auto -6% -18% auto;
	width: clamp(240px, 34vw, 460px);
	aspect-ratio: 1;
	color: currentColor;
	opacity: 0.05;
	pointer-events: none;
	z-index: 0;
}

.ap-watermark__svg {
	width: 100%;
	height: 100%;
	transform: rotate(12deg);
}

/* Listes à puces croix */
ul.ap-checklist {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}

ul.ap-checklist li {
	position: relative;
	padding-left: 1.9rem;
	margin-bottom: 0.65rem;
}

ul.ap-checklist li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.28em;
	width: 1.1em;
	height: 1.1em;
	background-color: var(--wp--preset--color--green);
	-webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="8" y="2" width="8" height="20" rx="4"/><rect x="2" y="8" width="20" height="8" rx="4"/></svg>') center / contain no-repeat;
	mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="8" y="2" width="8" height="20" rx="4"/><rect x="2" y="8" width="20" height="8" rx="4"/></svg>') center / contain no-repeat;
}

.ap-on-dark ul.ap-checklist li::before {
	background-color: #66BC46;
}

/* Citation en exergue (pullquote — manifeste À propos) */
.wp-block-pullquote {
	border: 0;
	padding: 0.5rem 0;
	margin-bottom: 1.5rem;
}

.wp-block-pullquote blockquote {
	border: 0;
	margin: 0;
	padding: 0;
}

.wp-block-pullquote p {
	font-family: var(--wp--preset--font-family--display);
	font-stretch: 87%;
	font-weight: 700;
	font-size: clamp(1.35rem, 2.6vw, 1.8rem);
	line-height: 1.3;
	letter-spacing: -0.015em;
	color: var(--wp--preset--color--navy);
	margin: 0;
}

.wp-block-pullquote p::before {
	content: "« ";
	color: var(--wp--preset--color--green);
}

.wp-block-pullquote p::after {
	content: " »";
	color: var(--wp--preset--color--green);
}

/* Timeline verticale (page À propos) */
.ap-timeline {
	position: relative;
	max-width: 38rem;
	margin: 2.5rem auto 0;
	padding-left: 2.2rem;
}

.ap-timeline::before {
	content: "";
	position: absolute;
	left: 0.5rem;
	top: 0.4rem;
	bottom: 0.4rem;
	width: 2px;
	background: rgba(17, 132, 61, 0.25);
}

.ap-timeline__item {
	position: relative;
	padding-bottom: 1.8rem;
}

.ap-timeline__item:last-child {
	padding-bottom: 0;
}

.ap-timeline__item::before {
	content: "";
	position: absolute;
	left: -2.2rem;
	top: 0.32em;
	width: 1.1em;
	height: 1.1em;
	background-color: var(--wp--preset--color--green);
	-webkit-mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="8" y="2" width="8" height="20" rx="4"/><rect x="2" y="8" width="20" height="8" rx="4"/></svg>') center / contain no-repeat;
	mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><rect x="8" y="2" width="8" height="20" rx="4"/><rect x="2" y="8" width="20" height="8" rx="4"/></svg>') center / contain no-repeat;
}

.ap-timeline__year {
	display: block;
	font-family: var(--wp--preset--font-family--display);
	font-stretch: 87%;
	font-weight: 800;
	font-size: 1.35rem;
	letter-spacing: -0.02em;
	color: var(--wp--preset--color--navy);
	margin-bottom: 0.2rem;
}

.ap-timeline__item p {
	margin: 0;
	color: var(--wp--preset--color--text-soft);
}

/* Pastilles pays (page À propos) */
ul.ap-countries {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6rem;
	padding: 0;
	margin: 1.5rem 0 0;
}

ul.ap-countries li {
	padding: 0.35rem 1.1rem;
	border: 1.5px solid rgba(17, 132, 61, 0.35);
	border-radius: 999px;
	background: #fff;
	font-size: 0.9rem;
	font-weight: 600;
	color: var(--wp--preset--color--navy);
}

/* Liste « Avant » (points de douleur) — pendant de ap-checklist */
ul.ap-painlist {
	list-style: none;
	padding-left: 0;
	margin-left: 0;
}

ul.ap-painlist li {
	position: relative;
	padding-left: 1.9rem;
	margin-bottom: 0.65rem;
	color: var(--wp--preset--color--text-soft);
}

ul.ap-painlist li::before {
	content: "✕";
	position: absolute;
	left: 0.15em;
	top: 0;
	font-weight: 700;
	color: #C25B5B;
}

/* Tableaux larges : défilement horizontal interne */
.ap-table-scroll {
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
}

.ap-table-scroll table {
	min-width: 40rem;
	border-collapse: collapse;
}

.ap-table-scroll th,
.ap-table-scroll td {
	border: 1px solid #E3EAF0;
	padding: 0.7rem 1rem;
	text-align: left;
}

.ap-table-scroll thead th {
	background: var(--wp--preset--color--surface);
	font-family: var(--wp--preset--font-family--display);
	color: var(--wp--preset--color--navy);
}

.ap-table-scroll td:not(:first-child),
.ap-table-scroll th:not(:first-child) {
	text-align: center;
}

/* --- Header sticky translucide --------------------------------------------- */

.ap-header {
	position: sticky;
	top: 0;
	z-index: 100;
	background: rgba(255, 255, 255, 0.72);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	border-bottom: 1px solid transparent;
	transition: background-color var(--wp--custom--transition), box-shadow var(--wp--custom--transition), border-color var(--wp--custom--transition);
}

/* ⚠️ backdrop-filter fait du header le « containing block » des position:fixed
   qu'il contient — il emprisonnait le menu overlay mobile de WordPress (ouvert
   mais écrasé dans la barre, page verrouillée). Sous le point de rupture du
   menu (600px) : fond plein, sans flou. */
@media (max-width: 599px) {
	.ap-header {
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
		background: rgba(255, 255, 255, 0.97);
	}
}

/* Connecté : la barre d'admin WP chevauche le header sticky — on décale
   (desktop) ou on rend le header non collant (mobile, où la barre est absolute). */
.admin-bar .ap-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

@media (max-width: 782px) {
	.admin-bar .ap-header {
		position: static;
	}
}

.ap-header.is-scrolled {
	background: rgba(255, 255, 255, 0.94);
	border-bottom-color: rgba(11, 27, 52, 0.06);
	box-shadow: 0 4px 20px rgba(11, 27, 52, 0.07);
}

.ap-header .wp-block-navigation a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
	font-weight: 500;
}

.ap-header .wp-block-navigation a:hover,
.ap-header .wp-block-navigation a[aria-current="page"] {
	color: var(--wp--preset--color--green-dark);
}

.ap-header .wp-block-site-logo img {
	max-height: 2.5rem;
	width: auto;
}

/* Boutons compacts dans le header */
.ap-header .wp-block-button__link {
	padding: 0.55rem 1.35rem;
	font-size: 0.9rem;
	white-space: nowrap;
}

@media (max-width: 640px) {
	.ap-header .wp-block-button.is-style-outline {
		display: none;
	}
}

/* --- Footer ------------------------------------------------------------------ */

.ap-footer {
	position: relative;
	overflow: hidden;
}

.ap-footer a {
	color: rgba(255, 255, 255, 0.78);
	text-decoration: none;
}

.ap-footer a:hover {
	color: #fff;
	text-decoration: underline;
}

.ap-footer .wp-block-heading {
	color: #fff;
	font-size: 1rem;
	letter-spacing: 0.02em;
}

/* --- Reveal au scroll ---------------------------------------------------------- */

.ap-reveal {
	opacity: 0;
	transform: translateY(22px);
	transition: opacity 550ms ease, transform 550ms ease;
}

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

/* Pas de motion : tout visible, aucune animation */
.ap-no-motion .ap-reveal,
html.ap-no-motion .ap-reveal {
	opacity: 1;
	transform: none;
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.ap-reveal {
		opacity: 1;
		transform: none;
		transition: none;
	}

	.ap-card:hover,
	.wp-block-button__link:hover {
		transform: none;
	}

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

/* Fallback sans JS : tout reste visible */
html:not(.js) .ap-reveal {
	opacity: 1;
	transform: none;
}

/* --- Centre d'aide & blog -------------------------------------------------------- */

.ap-breadcrumb {
	font-size: 0.85rem;
	color: var(--wp--preset--color--text-soft);
	margin-bottom: 1.5rem;
}

.ap-breadcrumb ol {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0;
	margin: 0;
}

.ap-breadcrumb li:not(:last-child)::after {
	content: "›";
	margin-left: 0.4rem;
}

.ap-breadcrumb a {
	color: var(--wp--preset--color--green-dark);
	text-decoration: none;
}

.ap-breadcrumb a:hover {
	text-decoration: underline;
}

.ap-kb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 1.25rem;
	margin-top: 2.5rem;
}

.ap-kb-cat {
	display: flex;
	flex-direction: column;
	gap: 0.4rem;
	text-decoration: none;
	color: inherit;
}

.ap-kb-cat__icon {
	width: 1.6rem;
	height: 1.6rem;
	color: var(--wp--preset--color--green);
	margin-bottom: 0.4rem;
}

.ap-kb-cat__name {
	font-family: var(--wp--preset--font-family--display);
	font-weight: 700;
	font-size: 1.1rem;
	color: var(--wp--preset--color--navy);
}

.ap-kb-cat__desc {
	font-size: 0.88rem;
	color: var(--wp--preset--color--text-soft);
}

.ap-kb-cat__count {
	font-size: 0.8rem;
	font-weight: 600;
	color: var(--wp--preset--color--green-dark);
}

.ap-kb-search {
	max-width: 36rem;
	margin: 2rem auto 0;
	display: flex;
	gap: 0.6rem;
}

.ap-kb-search input[type="search"] {
	box-sizing: border-box;
	flex: 1;
	min-width: 0;
	padding: 0.9rem 1.2rem;
	border: 1.5px solid #D5DEE6;
	border-radius: 999px;
	font: inherit;
}

.ap-kb-search input[type="search"]:focus {
	border-color: var(--wp--preset--color--green);
	box-shadow: 0 0 0 3px rgba(17, 132, 61, 0.18);
	outline: none;
}

.ap-kb-vote {
	margin: 3rem 0 0;
	padding: 1.5rem;
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--card);
	text-align: center;
}

.ap-kb-vote__question {
	margin: 0 0 0.8rem;
	font-weight: 600;
	color: var(--wp--preset--color--navy);
}

.ap-kb-vote__actions {
	display: flex;
	justify-content: center;
	gap: 0.8rem;
}

.ap-kb-vote__btn {
	font: inherit;
	font-weight: 600;
	padding: 0.55rem 1.4rem;
	border-radius: 999px;
	border: 1.5px solid #D5DEE6;
	background: #fff;
	cursor: pointer;
	transition: border-color var(--wp--custom--transition), background-color var(--wp--custom--transition);
}

.ap-kb-vote__btn:hover {
	border-color: var(--wp--preset--color--green);
}

.ap-kb-vote__thanks {
	margin: 0;
	font-weight: 600;
	color: var(--wp--preset--color--green-dark);
}

.ap-kb-related {
	margin-top: 2.5rem;
}

.ap-kb-related__title {
	font-size: 1.15rem;
	margin: 0 0 1rem;
}

.ap-kb-support {
	margin-top: 2.5rem;
	padding: 1.5rem 2rem;
	border: 1.5px solid rgba(17, 132, 61, 0.3);
	border-radius: var(--wp--custom--radius--card);
	align-items: center;
}

.ap-share {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.8rem;
	margin-top: 2.5rem;
	font-size: 0.9rem;
}

.ap-share__label {
	font-weight: 600;
	color: var(--wp--preset--color--navy);
}

.ap-share a {
	padding: 0.35rem 1rem;
	border: 1.5px solid #D5DEE6;
	border-radius: 999px;
	text-decoration: none;
	color: var(--wp--preset--color--ink);
	transition: border-color var(--wp--custom--transition), color var(--wp--custom--transition);
}

.ap-share a:hover {
	border-color: var(--wp--preset--color--green);
	color: var(--wp--preset--color--green-dark);
}

/* Table des matières (single blog) */
.ap-toc {
	background: var(--wp--preset--color--surface);
	border-radius: var(--wp--custom--radius--card);
	padding: 1.25rem 1.5rem;
	margin: 2rem 0;
	font-size: 0.92rem;
}

.ap-toc[hidden] {
	display: none;
}

.ap-toc__title {
	font-weight: 700;
	font-family: var(--wp--preset--font-family--display);
	color: var(--wp--preset--color--navy);
	margin: 0 0 0.6rem;
}

.ap-toc ol {
	margin: 0;
	padding-left: 1.2rem;
}

.ap-toc a {
	text-decoration: none;
}

.ap-toc a:hover {
	text-decoration: underline;
}

/* Grille blog */
.ap-blog-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
}

@media (max-width: 980px) {
	.ap-blog-grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

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

.ap-blog-grid .ap-card :where(h2, h3) {
	font-size: 1.15rem;
	margin: 0.4rem 0;
}

.ap-blog-grid .ap-card a {
	text-decoration: none;
	color: var(--wp--preset--color--navy);
}

.ap-blog-grid .ap-card a:hover {
	color: var(--wp--preset--color--green-dark);
}

/* Filtres catégories (pills) */
.ap-cat-pills .wp-block-categories {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.6rem;
	padding: 0;
	margin: 1.5rem 0 0;
}

.ap-cat-pills .wp-block-categories a {
	display: inline-block;
	padding: 0.35rem 1.1rem;
	border: 1.5px solid #D5DEE6;
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.88rem;
	font-weight: 600;
	color: var(--wp--preset--color--ink);
	transition: border-color var(--wp--custom--transition), color var(--wp--custom--transition);
}

.ap-cat-pills .wp-block-categories a:hover {
	border-color: var(--wp--preset--color--green);
	color: var(--wp--preset--color--green-dark);
}

/* Sélecteur de langue */
.ap-lang {
	display: flex;
	gap: 0.15rem;
	font-size: 0.82rem;
	font-weight: 600;
}

.ap-lang a {
	padding: 0.25rem 0.5rem;
	border-radius: 6px;
	text-decoration: none;
	color: var(--wp--preset--color--text-soft);
}

.ap-lang a[aria-current="true"] {
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--navy);
}

/* --- Formulaires (base, réutilisée J2) ------------------------------------------ */

.ap-form input:not([type="checkbox"]):not([type="radio"]),
.ap-form select,
.ap-form textarea {
	box-sizing: border-box;
	width: 100%;
	padding: 0.8rem 1rem;
	border: 1.5px solid #D5DEE6;
	border-radius: var(--wp--custom--radius--input);
	background: #fff;
	color: var(--wp--preset--color--ink);
	font: inherit;
	transition: border-color var(--wp--custom--transition), box-shadow var(--wp--custom--transition);
}

.ap-form input:focus,
.ap-form select:focus,
.ap-form textarea:focus {
	border-color: var(--wp--preset--color--green);
	box-shadow: 0 0 0 3px rgba(17, 132, 61, 0.18);
	outline: none;
}

.ap-form label {
	display: block;
	font-weight: 600;
	font-size: 0.92rem;
	margin-bottom: 0.35rem;
	color: var(--wp--preset--color--navy);
}

.ap-form p {
	margin: 0 0 1.1rem;
}

.ap-form__row {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0 1rem;
}

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

.ap-form__req {
	color: var(--wp--preset--color--green-dark);
}

/* Honeypot : visuellement hors écran, jamais display:none (les bots le détectent) */
.ap-form__hp {
	position: absolute !important;
	left: -9999px !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ap-form__feedback {
	padding: 0.9rem 1.2rem;
	border-radius: var(--wp--custom--radius--input);
	margin-bottom: 1.25rem;
	font-weight: 500;
}

.ap-form__feedback--ok {
	background: rgba(17, 132, 61, 0.1);
	color: var(--wp--preset--color--green-dark);
	border: 1px solid rgba(17, 132, 61, 0.35);
}

.ap-form__feedback--err {
	background: rgba(190, 30, 45, 0.08);
	color: #A11A28;
	border: 1px solid rgba(190, 30, 45, 0.3);
}

.ap-form button[type="submit"] {
	border: 0;
	cursor: pointer;
	width: 100%;
}

.ap-form__privacy {
	margin: 0.8rem 0 0;
	font-size: 0.78rem;
	color: var(--wp--preset--color--text-soft);
}

.ap-form__privacy a {
	color: inherit;
}
