/**
 * Custom CSS
 *
 * This file is for your custom styles.
 * You can add any CSS rules here to customize the Ghost theme.
 *
 * Note: Changes made directly to this file may be overwritten during theme updates.
 * It's recommended to use the Code Injection feature in Ghost for persistent customizations.
 */

/* Your custom CSS goes below this line */

/*
 * Ascenseur du menu latéral : Aspect le masque avec ::-webkit-scrollbar
 * (layout/sidebar.css), que Firefox ignore. Il y affiche alors une gouttière
 * grise permanente entre le menu et le contenu. Équivalent standard,
 * appliqué seulement aux navigateurs sans ::-webkit-scrollbar.
 */
@supports not selector(::-webkit-scrollbar) {
	.sidebar {
		scrollbar-width: thin;
		scrollbar-color: transparent transparent;
	}

	.sidebar:hover {
		scrollbar-color: var(--sidebar--scrollbar--color) transparent;
	}
}

/*
 * Page Updates (custom-updates.hbs + partials/sections/updates.hbs) :
 * timeline façon thème Ida — date, rail vertical avec un point par update,
 * contenu, flèche vers le post.
 */
.section-updates {
	--update--line: 2.25rem; /* Hauteur de la première ligne, alignée sur le bouton flèche. */
	--update--dot: 8px;

	width: 100%;
}

/* Page dédiée : largeur limitée. Sur l'accueil, pleine largeur comme les autres sections. */
.page-updates-template .section-updates {
	max-width: var(--container-wide--width);
}

/* En-tête aligné sur celui d'une page tag (et non centré comme une page). */
.page-updates-template .content > .section-hero:not(.has-feature-image) {
	margin-left: 0;
	padding-top: 0;
}

.page-updates-template .title-tag-dot {
	color: var(--ghost-accent-color);
}

.updates-list {
	width: 100%;
	padding: 0;
	margin: 0;
	list-style: none;
}

.update {
	display: grid;
	grid-template-columns: 140px 24px 1fr auto;
	grid-template-areas: "meta rail body arrow";
	column-gap: var(--spacing-9);
	scroll-margin-top: calc(var(--navbar--height) + var(--spacing-9));
}

.update-meta {
	grid-area: meta;
	display: flex;
	flex-direction: column;
	gap: var(--spacing-4);
	font-size: var(--font-small);
	color: var(--color-contrast);
}

.update-meta time {
	display: flex;
	align-items: center;
	min-height: var(--update--line);
}

.update-featured {
	display: inline-flex;
	align-items: center;
	gap: var(--spacing-3);
	font-size: var(--font-x-small);
	font-weight: var(--font-weight-medium);
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--color-secondary);
}

.update-featured svg {
	width: 16px;
	height: 16px;
	color: var(--ghost-accent-color);
}

/* Rail : ligne continue d'un update à l'autre + point accentué. */
.update-rail {
	grid-area: rail;
	position: relative;
}

.update-rail::before {
	content: "";
	position: absolute;
	inset-block: 0;
	left: 50%;
	width: 1px;
	background-color: var(--color-border);
	transform: translateX(-50%);
}

.update:first-child .update-rail::before {
	top: calc(var(--update--line) / 2);
}

.update:last-child .update-rail::before {
	bottom: auto;
	height: calc(var(--update--line) / 2);
}

.update-rail::after {
	content: "";
	position: absolute;
	top: calc((var(--update--line) - var(--update--dot)) / 2);
	left: 50%;
	width: var(--update--dot);
	height: var(--update--dot);
	border-radius: 50%;
	background-color: var(--ghost-accent-color);
	box-shadow: 0 0 0 5px
		color-mix(in srgb, var(--ghost-accent-color) 20%, transparent);
	transform: translateX(-50%);
}

.update-body {
	grid-area: body;
	min-width: 0;
	padding-bottom: 1.5rem; /* 24px sur ordinateur ; mobile : --spacing-9 (30px), plus bas. */
}

.update-title {
	display: flex;
	align-items: center;
	min-height: var(--update--line);
	margin: 0;
	/* Titres des brèves non gras, taille proche des dates (14px). */
	font-size: 1rem;
	font-weight: var(--font-weight-regular);
	line-height: 1.4;
}

.update-title a {
	color: inherit;
	text-decoration: none;
}

.update-title a:hover {
	text-decoration: underline;
}

.update-excerpt {
	margin-top: var(--spacing-7);
	color: var(--color-foreground);
}

.update-arrow {
	--button--color: var(--ghost-accent-color);
	--button-hover--color: var(--ghost-accent-color);

	grid-area: arrow;
	align-self: start;
}

@media (max-width: 767px) {
	.update {
		grid-template-columns: 24px 1fr auto;
		grid-template-areas:
			"rail meta arrow"
			"rail body body";
		column-gap: var(--spacing-7);
	}

	.update-meta {
		flex-direction: row;
		align-items: center;
		gap: var(--spacing-6);
	}

	.update-rail {
		grid-row: 1 / -1;
	}

	.update-body {
		padding-bottom: var(--spacing-9);
	}
}

/*
 * Carte newsletter d'auteur (partials/components/author-newsletter-card.hbs).
 * Masquée pour un membre connecté tant que ses abonnements ne sont pas lus (is-pending),
 * puis s'il est déjà abonné (is-subscribed) ; le champ prénom n'a pas de bouton à droite.
 */
.form-author-newsletter.is-pending,
.form-author-newsletter.is-subscribed {
	display: none;
}

.form-author-newsletter > input[data-members-name] {
	padding-right: var(--spacing-8);
}

.form-author-newsletter input[readonly] {
	color: var(--color-secondary);
}

/*
 * Inter hébergée dans le thème (sous-ensemble latin, licence OFL : fonts/Inter-LICENSE.txt).
 * Remplace le choix de police de Ghost Admin, que Ghost charge depuis fonts.bunny.net :
 * laisser Design & branding sur « Theme default ». Même déclaration dans private.hbs.
 */
@font-face {
	font-family: "Inter";
	font-style: normal;
	font-display: swap;
	font-weight: 100 900;
	src: url("fonts/Inter-Variable.woff2") format("woff2");
}

@font-face {
	font-family: "Inter";
	font-style: italic;
	font-display: swap;
	font-weight: 100 900;
	src: url("fonts/Inter-Variable-Italic.woff2") format("woff2");
}

:root {
	--font-family-headings: "Inter", sans-serif;
	--font-family-body: "Inter", sans-serif;
	--font-family-button: "Inter", sans-serif;
}

/* Callouts : couleurs de la charte LTDR.
   Ghost ne stocke que le nom de la pastille (kg-callout-card-<nom>) ; le sélecteur
   de l'éditeur garde ses couleurs d'origine, le site affiche celles-ci.
   blue = Anticiper, yellow = Comprendre, red = Confronter, green = Appliquer,
   purple = Mesurer. grey, white, pink, accent : rendu Ghost/Aspect inchangé. */
:root {
	--ltdr-anticiper: #b0c9d7;
	--ltdr-comprendre: #fff482;
	--ltdr-confronter: #d1674d;
	--ltdr-appliquer: #3a8a73;
	--ltdr-mesurer: #af9dcc;
}

/* « À lire aussi » sous un post : filet épais contrasté.
   Filet aux couleurs du pilier si le post porte un tag pilier
   (Ghost ajoute tag-<slug> au body ; si plusieurs, la dernière règle gagne). */
.section-read-next {
	--read-next-rule: var(--color-contrast);

	border-top: 4px solid var(--read-next-rule);
}

.tag-anticiper .section-read-next {
	--read-next-rule: var(--ltdr-anticiper);
}

.tag-comprendre .section-read-next {
	--read-next-rule: var(--ltdr-comprendre);
}

.tag-confronter .section-read-next {
	--read-next-rule: var(--ltdr-confronter);
}

.tag-appliquer .section-read-next {
	--read-next-rule: var(--ltdr-appliquer);
}

.tag-mesurer .section-read-next {
	--read-next-rule: var(--ltdr-mesurer);
}

/* Pastilles de tags en haut des posts : fond aux couleurs des piliers.
   Repérées par la fin de leur lien (/tag/<slug>/), sans modifier le template.
   Texte noir sur ces fonds, même en mode sombre (contraste WCAG AA ≥ 5:1 ;
   le blanc échoue partout). Survol éclairci, pas assombri : assombrir faisait
   passer confronter et appliquer sous 4,5:1. */
a.post-tag:is(
	[href$="/tag/anticiper/"],
	[href$="/tag/comprendre/"],
	[href$="/tag/confronter/"],
	[href$="/tag/appliquer/"],
	[href$="/tag/mesurer/"]
) {
	background-color: var(--post-tag-bg);
	color: #000;

	&:hover,
	&:focus {
		background-color: color-mix(in srgb, var(--post-tag-bg) 70%, #fff);
		color: #000;
	}
}

a.post-tag[href$="/tag/anticiper/"] {
	--post-tag-bg: var(--ltdr-anticiper);
}

a.post-tag[href$="/tag/comprendre/"] {
	--post-tag-bg: var(--ltdr-comprendre);
}

a.post-tag[href$="/tag/confronter/"] {
	--post-tag-bg: var(--ltdr-confronter);
}

a.post-tag[href$="/tag/appliquer/"] {
	--post-tag-bg: var(--ltdr-appliquer);
}

a.post-tag[href$="/tag/mesurer/"] {
	--post-tag-bg: var(--ltdr-mesurer);
}

/* Menu (sidebar et popup mobile) : point aux couleurs du pilier à droite du
   libellé des liens Anticiper… Mesurer. Les liens sont repérés par la classe
   nav-link-<slug> que le thème déduit du libellé du lien dans Navigation.
   Exclut la liste de tags (.navigation-tags), qui a ses propres points.
   Le point est sur .label : il disparaît avec lui en sidebar repliée. */
:is(.navigation-sidebar, .navigation-popup):not(.navigation-tags)
	:is(
		.nav-link-anticiper,
		.nav-link-comprendre,
		.nav-link-confronter,
		.nav-link-appliquer,
		.nav-link-mesurer
	)
	> .label::after {
	content: "";
	display: inline-block;
	width: 0.5rem;
	height: 0.5rem;
	margin-left: 0.5rem;
	border-radius: 50%;
	background-color: var(--nav-dot);
	vertical-align: 0.1em;
}

.nav-link-anticiper {
	--nav-dot: var(--ltdr-anticiper);
}

.nav-link-comprendre {
	--nav-dot: var(--ltdr-comprendre);
}

.nav-link-confronter {
	--nav-dot: var(--ltdr-confronter);
}

.nav-link-appliquer {
	--nav-dot: var(--ltdr-appliquer);
}

.nav-link-mesurer {
	--nav-dot: var(--ltdr-mesurer);
}

/* Cartes d'articles sans image mise en avant : fond aux couleurs du pilier
   au lieu du gris d'Aspect, titre en noir (même en mode sombre).
   Ghost pose tag-<slug> sur la carte ({{post_class}}) ; si plusieurs piliers,
   la dernière règle gagne, pas le tag principal. */
.card-post:not(.card-has-image) .card-post-image[data-placeholder] {
	--placeholder--background-color: var(
		--card-pillar-bg,
		var(--color-background-200)
	);

	background-color: var(--card-pillar-bg, var(--color-background-200));
}

.card-post:is(
		.tag-anticiper,
		.tag-comprendre,
		.tag-confronter,
		.tag-appliquer,
		.tag-mesurer
	):not(.card-has-image)
	.card-post-image[data-placeholder] {
	--placeholder--color: #000;
}

.card-post.tag-anticiper {
	--card-pillar-bg: var(--ltdr-anticiper);
}

.card-post.tag-comprendre {
	--card-pillar-bg: var(--ltdr-comprendre);
}

.card-post.tag-confronter {
	--card-pillar-bg: var(--ltdr-confronter);
}

.card-post.tag-appliquer {
	--card-pillar-bg: var(--ltdr-appliquer);
}

.card-post.tag-mesurer {
	--card-pillar-bg: var(--ltdr-mesurer);
}

.post-content .kg-callout-card-blue {
	background: var(--ltdr-anticiper);
}

.post-content .kg-callout-card-yellow {
	background: var(--ltdr-comprendre);
}

.post-content .kg-callout-card-red {
	background: var(--ltdr-confronter);
}

.post-content .kg-callout-card-green {
	background: var(--ltdr-appliquer);
}

.post-content .kg-callout-card-purple {
	background: var(--ltdr-mesurer);
}

/* Fonds pleins : texte noir et liens hérités, y compris en mode sombre. */
.post-content
:is(
	.kg-callout-card-blue,
	.kg-callout-card-yellow,
	.kg-callout-card-red,
	.kg-callout-card-green,
	.kg-callout-card-purple
) {
	color: #000;
}

.post-content
	:is(
		.kg-callout-card-blue,
		.kg-callout-card-yellow,
		.kg-callout-card-red,
		.kg-callout-card-green,
		.kg-callout-card-purple
	)
	a {
	color: inherit;
	text-decoration-color: currentcolor;
}
