/**
 * Corps d'articles — Digital Mixing (thème enfant)
 * Tableaux Gutenberg, rythme vertical, médias / listes / citations.
 */

.post-content {
	--dm-accent: #3192d3;
	--dm-accent-dark: #2477b0;
	--dm-text: #3a4149;
	--dm-heading: #19232d;
	--dm-border: #d7e3ea;
	--dm-surface: #f4f8fb;
	--dm-surface-alt: #eaf3f9;
	--dm-code-bg: #eef3f7;
	--dm-space: 1.35em;
	--dm-space-lg: 1.85em;
}

/* -------------------------------------------------------------------------
   Liens dans le corps de texte
   ------------------------------------------------------------------------- */

.post-content a:not(.button):not(.sc-button):not(.wp-block-button__link) {
	color: var(--dm-accent);
	text-decoration: underline;
	text-decoration-thickness: 1.5px;
	text-underline-offset: 0.18em;
	text-decoration-color: rgba(49, 146, 211, 0.55);
	font-weight: 600;
	transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.post-content a:not(.button):not(.sc-button):not(.wp-block-button__link):hover,
.post-content a:not(.button):not(.sc-button):not(.wp-block-button__link):focus {
	color: var(--dm-accent-dark);
	text-decoration-color: var(--dm-accent-dark);
}

.post-content a:not(.button):not(.sc-button):not(.wp-block-button__link):visited {
	color: #2a6fa3;
}

/* -------------------------------------------------------------------------
   Rythme vertical entre blocs
   ------------------------------------------------------------------------- */

.post-content > *:first-child {
	margin-top: 0;
}

.post-content p,
.post-content > ul,
.post-content > ol,
.post-content > dl,
.post-content blockquote,
.post-content pre,
.post-content hr,
.post-content .wp-block-quote,
.post-content .wp-block-pullquote,
.post-content .wp-block-code,
.post-content .wp-block-preformatted,
.post-content .wp-block-verse,
.post-content .wp-block-group,
.post-content .wp-block-columns,
.post-content .wp-block-media-text {
	margin-top: 0;
	margin-bottom: var(--dm-space);
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6,
.post-content .wp-block-heading {
	color: var(--dm-heading);
	font-weight: 700;
	line-height: 1.35;
	margin-top: var(--dm-space-lg);
	margin-bottom: 0.65em;
}

.post-content h1:first-child,
.post-content h2:first-child,
.post-content h3:first-child,
.post-content h4:first-child,
.post-content h5:first-child,
.post-content h6:first-child,
.post-content .wp-block-heading:first-child {
	margin-top: 0;
}

/* Un peu plus d’air avant les H2 (sections) */
.post-content h2,
.post-content h2.wp-block-heading {
	margin-top: 2em;
	padding-bottom: 0.25em;
	border-bottom: 1px solid var(--dm-border);
}

.post-content h2:first-child,
.post-content h2.wp-block-heading:first-child {
	margin-top: 0;
}

.post-content h3,
.post-content h3.wp-block-heading {
	margin-top: 1.65em;
}

/* Figures / embeds : souvent margin:0 côté core Gutenberg */
.post-content figure,
.post-content .wp-block-image,
.post-content figure.wp-block-image:not(#individual-image),
.post-content .wp-block-embed,
.post-content .wp-block-video,
.post-content .wp-block-audio,
.post-content .wp-block-gallery,
.post-content .wp-block-table,
.post-content .aspiesoft-embed {
	display: block;
	margin: var(--dm-space-lg) 0;
	max-width: 100%;
	width: auto;
}

.post-content figure:first-child,
.post-content .wp-block-image:first-child,
.post-content figure.wp-block-image:not(#individual-image):first-child,
.post-content .wp-block-embed:first-child {
	margin-top: 0;
}

.post-content .wp-block-image img,
.post-content figure img {
	display: block;
	height: auto;
	max-width: 100%;
	margin: 0 auto;
}

.post-content figcaption,
.post-content .wp-element-caption,
.post-content .wp-caption-text {
	margin: 0.55em 0 0;
	padding: 0 0.25em;
	color: #6a7580;
	font-size: 0.92em;
	line-height: 1.45;
	text-align: center;
}

/* -------------------------------------------------------------------------
   Listes
   ------------------------------------------------------------------------- */

.post-content ul,
.post-content ol,
.post-content .wp-block-list {
	padding-left: 1.45em;
	margin-left: 0.25em;
	margin-bottom: var(--dm-space);
	color: var(--dm-text);
}

.post-content ul {
	list-style-type: disc;
}

.post-content ul ul {
	list-style-type: circle;
}

.post-content ol {
	list-style-type: decimal;
}

.post-content li {
	margin-bottom: 0.5em;
	padding-left: 0.15em;
	line-height: 1.65;
}

.post-content li::marker {
	color: var(--dm-accent);
	font-weight: 600;
}

.post-content li > ul,
.post-content li > ol {
	margin-top: 0.5em;
	margin-bottom: 0.4em;
}

.post-content li > p {
	margin-bottom: 0.4em;
}

/* -------------------------------------------------------------------------
   Citations
   ------------------------------------------------------------------------- */

.post-content blockquote,
.post-content .wp-block-quote,
.post-content .wp-block-pullquote {
	margin: var(--dm-space-lg) 0;
	padding: 1.1em 1.35em;
	border-left: 4px solid var(--dm-accent);
	background: var(--dm-surface);
	color: var(--dm-text);
	font-size: 1.04em;
	line-height: 1.7;
}

.post-content .wp-block-pullquote {
	border-left: 0;
	border-top: 3px solid var(--dm-accent);
	border-bottom: 3px solid var(--dm-accent);
	text-align: center;
	padding: 1.35em 1.5em;
}

.post-content blockquote p,
.post-content .wp-block-quote p,
.post-content .wp-block-pullquote p {
	margin-bottom: 0.75em;
}

.post-content blockquote p:last-child,
.post-content .wp-block-quote p:last-child,
.post-content .wp-block-pullquote p:last-child {
	margin-bottom: 0;
}

.post-content blockquote cite,
.post-content .wp-block-quote cite,
.post-content .wp-block-pullquote cite,
.post-content .wp-block-quote__citation,
.post-content .wp-block-pullquote__citation {
	display: block;
	margin-top: 0.75em;
	font-size: 0.88em;
	font-style: normal;
	font-weight: 600;
	color: #6a7580;
}

.post-content blockquote cite::before,
.post-content .wp-block-quote cite::before,
.post-content .wp-block-quote__citation::before {
	content: "— ";
}

/* -------------------------------------------------------------------------
   Code inline & blocs
   ------------------------------------------------------------------------- */

.post-content pre,
.post-content code,
.post-content kbd,
.post-content samp,
.post-content .wp-block-code,
.post-content .wp-block-preformatted {
	font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.post-content :not(pre) > code,
.post-content :not(pre) > kbd,
.post-content :not(pre) > samp {
	padding: 0.12em 0.4em;
	background: var(--dm-code-bg);
	border: 1px solid var(--dm-border);
	border-radius: 3px;
	color: #1e3a4f;
	font-size: 0.9em;
	white-space: break-spaces;
}

.post-content pre,
.post-content .wp-block-code,
.post-content .wp-block-preformatted {
	margin: var(--dm-space) 0;
	padding: 1em 1.2em;
	overflow-x: auto;
	background: var(--dm-code-bg);
	border: 1px solid var(--dm-border);
	border-left: 3px solid var(--dm-accent);
	border-radius: 3px;
	color: #1e3a4f;
	font-size: 0.92em;
	line-height: 1.55;
}

.post-content pre code,
.post-content .wp-block-code code {
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	font-size: inherit;
	color: inherit;
}

/* -------------------------------------------------------------------------
   Tableaux (classiques + Gutenberg .wp-block-table)
   Mobile / tablette : scroll horizontal + 1re colonne sticky
   ------------------------------------------------------------------------- */

.post-content .wp-block-table,
.post-content figure.wp-block-table,
.post-content .dm-table-scroll {
	display: block;
	width: 100%;
	max-width: 100%;
	margin: var(--dm-space-lg) 0;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-x: contain;
	border: 1px solid var(--dm-border);
	border-radius: 4px;
	background: #fff;
	position: relative;
}

/* Ombre latérale = indice de scroll quand .is-scrollable */
.post-content .wp-block-table.is-scrollable,
.post-content .dm-table-scroll.is-scrollable {
	background:
		linear-gradient(to right, #fff 30%, rgba(255, 255, 255, 0)) left center / 28px 100% no-repeat,
		linear-gradient(to left, #fff 30%, rgba(255, 255, 255, 0)) right center / 28px 100% no-repeat,
		radial-gradient(farthest-side at 0 50%, rgba(25, 35, 45, 0.18), transparent) left center / 14px 100% no-repeat,
		radial-gradient(farthest-side at 100% 50%, rgba(25, 35, 45, 0.18), transparent) right center / 14px 100% no-repeat,
		#fff;
	background-attachment: local, local, scroll, scroll;
}

.post-content .wp-block-table.is-scrollable::after,
.post-content .dm-table-scroll.is-scrollable::after {
	content: "← glisser →";
	display: block;
	padding: 0.35em 0.75em 0.55em;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #6a7580;
	text-align: center;
	background: var(--dm-surface);
	border-top: 1px solid var(--dm-border);
}

.post-content table,
.post-content .wp-block-table table,
.post-content .dm-table-scroll table {
	width: max-content;
	min-width: 100%;
	max-width: none;
	border-collapse: collapse;
	border-spacing: 0;
	background: #fff;
	font-size: 0.97em;
	line-height: 1.45;
	margin: 0;
}

.post-content table caption,
.post-content .wp-block-table figcaption {
	caption-side: bottom;
	margin-top: 0.65em;
	padding: 0 0.25em;
	color: #6a7580;
	font-size: 0.92em;
	text-align: left;
}

.post-content thead,
.post-content .wp-block-table thead {
	border-bottom: 0;
}

.post-content th,
.post-content td,
.post-content .wp-block-table th,
.post-content .wp-block-table td {
	padding: 0.7em 0.85em;
	border: 1px solid var(--dm-border) !important;
	vertical-align: top;
	text-align: left;
	color: var(--dm-text);
	background: #fff;
}

.post-content th,
.post-content .wp-block-table th,
.post-content thead th,
.post-content .wp-block-table thead th {
	background: var(--dm-accent) !important;
	color: #fff !important;
	font-weight: 600;
	border-color: #2a7fb8 !important;
	white-space: nowrap;
}

.post-content tbody tr:nth-child(even) td,
.post-content .wp-block-table tbody tr:nth-child(even) td {
	background: var(--dm-surface) !important;
}

.post-content tbody tr:hover td,
.post-content .wp-block-table tbody tr:hover td {
	background: var(--dm-surface-alt) !important;
}

/* 1re colonne sticky (tableaux larges en scroll) */
.post-content .dm-table-sticky-col table th:first-child,
.post-content .dm-table-sticky-col table td:first-child {
	position: sticky;
	left: 0;
	z-index: 2;
	box-shadow: 4px 0 8px -4px rgba(25, 35, 45, 0.22);
}

.post-content .dm-table-sticky-col table thead th:first-child {
	z-index: 3;
}

.post-content .dm-table-sticky-col table tbody td:first-child {
	background: #fff !important;
	font-weight: 600;
	color: var(--dm-heading);
}

.post-content .dm-table-sticky-col table tbody tr:nth-child(even) td:first-child {
	background: var(--dm-surface) !important;
}

/* Style stripes Gutenberg */
.post-content .wp-block-table.is-style-stripes {
	border-bottom: 0;
}

.post-content .wp-block-table.is-style-stripes tbody tr:nth-child(odd) td {
	background: var(--dm-surface) !important;
}


/* -------------------------------------------------------------------------
   Séparateurs
   ------------------------------------------------------------------------- */

.post-content hr,
.post-content .wp-block-separator {
	margin: var(--dm-space-lg) 0;
	border: 0;
	border-top: 1px solid var(--dm-border);
	height: 0;
}

/* -------------------------------------------------------------------------
   Responsive
   ------------------------------------------------------------------------- */

@media (max-width: 767px) {
	.post-content th,
	.post-content td,
	.post-content .wp-block-table th,
	.post-content .wp-block-table td {
		padding: 0.55em 0.7em;
		font-size: 0.94em;
	}

	.post-content .dm-table-sticky-col th,
	.post-content .wp-block-table th {
		white-space: nowrap;
	}

	.post-content .dm-table-sticky-col td,
	.post-content .wp-block-table td {
		white-space: normal;
		min-width: 8.5em;
	}

	.post-content .dm-table-sticky-col td:first-child,
	.post-content .wp-block-table td:first-child {
		min-width: 6.5em;
		max-width: 9em;
	}

	.post-content h2,
	.post-content h2.wp-block-heading {
		margin-top: 1.6em;
	}
}
