/**
 * BlogiBotti fallback style (varatyyli) for BlogiBotti's own articles.
 *
 * Applies only inside the .bb-article wrapper, and only to the parts BlogiBotti
 * builds itself (part classes bb-summary, bb-toc, bb-list, bb-quote, bb-figure,
 * bb-table-wrap, bb-faq, bb-cta) and to the article modules bb-article--column
 * (the column) and bb-article--text (spacing and links). The site's own parts
 * copied from its template are never touched.
 *
 * Fonts and the text color come from the theme. Neutral tones are mixed from the
 * text color (currentColor), so the style works on light and dark themes. The
 * site values come as variables in the page head (Blogibotti_Site_Style):
 * --bb-accent (the site's main color, only with 4.5:1 contrast), --bb-column and
 * --bb-gutter. Nothing of this is written into the article itself.
 */

.bb-article {
	--bb-soft: color-mix(in srgb, currentColor 6%, transparent);
	--bb-softer: color-mix(in srgb, currentColor 2.5%, transparent);
	--bb-line: color-mix(in srgb, currentColor 16%, transparent);
	--bb-muted: color-mix(in srgb, currentColor 85%, transparent);
}

/*
 * Hyphenation (K34, 10.11.2026): long words are split with a hyphen on a phone,
 * by the rules of the article's language (lang on the wrapper, Blogibotti_Site_Style).
 * Only words of at least 8 letters, at least 4 letters on each line. A word that still does
 * not fit is wrapped as a last resort, so the page never scrolls sideways.
 */
.bb-article {
	-webkit-hyphens: auto;
	hyphens: auto;
	hyphenate-limit-chars: 8 4 4;
	overflow-wrap: break-word;
}

/* Older browsers without color-mix(): grey tints that suit light and dark themes alike. */
@supports not (color: color-mix(in srgb, red 50%, blue)) {

	.bb-article {
		--bb-soft: rgba(128, 128, 128, 0.12);
		--bb-softer: rgba(128, 128, 128, 0.06);
		--bb-line: rgba(128, 128, 128, 0.4);
		--bb-muted: currentColor;
	}
}

/* Column: at most 44rem and centred, never wider than the theme's own column. */
.bb-article--column {
	box-sizing: border-box;
	max-width: min(var(--bb-column, 44rem), var(--wp--style--global--content-size, 100%));
	margin-inline: auto;
	padding-inline: var(--bb-gutter, 0);
}

/*
 * Classic themes print an inner wrapper (.wp-block-group__inner-container) inside group
 * blocks, and some give it padding and a max-width (GeneratePress: 40px). In BlogiBotti's
 * own groups the wrapper is neutral; the rules below reach the blocks through it.
 */
.bb-article--column > .wp-block-group__inner-container,
.bb-article .bb-summary > .wp-block-group__inner-container,
.bb-article .bb-toc > .wp-block-group__inner-container,
.bb-article .bb-cta > .wp-block-group__inner-container {
	max-width: none;
	margin-inline: 0;
	padding: 0;
}

/*
 * BlogiBotti's own parts inside a section copied from the site's template (erä F osa F3):
 * the site's sections may be flex columns that shrink their items to the content (e.g.
 * GenerateBlocks with align-items: flex-start). The parts take the column's width, never
 * more, so a wide table scrolls in its own frame on a phone.
 */
.bb-article .bb-summary,
.bb-article .bb-toc,
.bb-article .bb-quote,
.bb-article .bb-figure,
.bb-article .bb-table-wrap,
.bb-article .bb-faq,
.bb-article .bb-cta {
	box-sizing: border-box;
	align-self: stretch;
	max-width: 100%;
	min-width: 0;
}

/* Text: calm rhythm and clear headings. */
.bb-article--text {
	line-height: 1.7;
}

.bb-article--text > * + *,
.bb-article--text > .wp-block-group__inner-container > * + * {
	margin-block-start: 1.25em;
}

.bb-article--text > p,
.bb-article--text > .wp-block-group__inner-container > p {
	margin-block: 0 1.1em;
}

.bb-article--text > h2,
.bb-article--text > .wp-block-group__inner-container > h2 {
	margin-block: 2.2em 0.5em;
	line-height: 1.25;
}

.bb-article--text > h3,
.bb-article--text > .wp-block-group__inner-container > h3 {
	margin-block: 1.8em 0.4em;
	line-height: 1.3;
}

/* Links: underlined, so they never depend on color alone. Buttons are left to the theme. */
.bb-article--text a:not([class*="button"]) {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 0.2em;
	text-decoration-color: var(--bb-accent, currentColor);
}

.bb-article--text a:not([class*="button"]):hover,
.bb-article--text a:not([class*="button"]):focus-visible {
	text-decoration-thickness: 2px;
}

.bb-article--text a:focus-visible {
	outline: 2px solid var(--bb-accent, currentColor);
	outline-offset: 2px;
	border-radius: 2px;
}

/* Lists. */
.bb-article .bb-list {
	margin-block: 0 1.25em;
	margin-inline: 0;
	padding-inline-start: 1.4em;
}

.bb-article .bb-list > li {
	margin-block: 0.45em;
	padding-inline-start: 0.2em;
}

.bb-article .bb-list > li::marker {
	color: var(--bb-accent, currentColor);
}

.bb-article ol.bb-list > li::marker {
	font-weight: 700;
}

/* Quote: a vertical line, no box. */
.bb-article .bb-quote {
	margin: 2em 0;
	padding: 0.1em 0 0.1em 1.25em;
	border: 0;
	border-inline-start: 3px solid var(--bb-accent, currentColor);
	border-radius: 0;
	background: none;
	font-size: 1.15em;
	font-style: italic;
	line-height: 1.55;
}

.bb-article .bb-quote::before,
.bb-article .bb-quote::after {
	content: none;
}

.bb-article .bb-quote p {
	margin: 0;
	font-size: inherit;
}

.bb-article .bb-quote p + p {
	margin-block-start: 0.5em;
}

.bb-article .bb-quote cite {
	display: block;
	margin-block-start: 0.6em;
	font-size: 0.8em;
	font-style: normal;
	color: var(--bb-muted);
}

/* Summary: a grey box. */
.bb-article .bb-summary {
	margin-block: 0 1em;
	padding: 1.1em 1.35em;
	border-radius: 10px;
	background: var(--bb-soft);
}

.bb-article .bb-summary__title {
	margin: 0 0 0.5em;
	font-size: 0.95em;
	letter-spacing: 0.02em;
}

.bb-article .bb-summary ul {
	margin: 0;
	padding-inline-start: 1.2em;
}

.bb-article .bb-summary li {
	margin-block: 0.3em;
}

.bb-article .bb-summary li:last-child {
	margin-block-end: 0;
}

/* Table of contents: lighter background and a border, so it never looks like the summary. */
.bb-article .bb-toc {
	margin-block: 0 1.75em;
	padding: 0.9em 1.35em;
	border: 1px solid var(--bb-line);
	border-radius: 10px;
	background: var(--bb-softer);
}

.bb-article .bb-toc__title {
	margin: 0 0 0.5em;
	font-size: 0.95em;
}

.bb-article .bb-toc ul {
	margin: 0.2em 0;
	padding-inline-start: 1.2em;
}

.bb-article .bb-toc li {
	margin-block: 0.3em;
}

.bb-article .bb-toc a:not([class*="button"]) {
	text-decoration: none;
}

.bb-article .bb-toc a:not([class*="button"]):hover,
.bb-article .bb-toc a:not([class*="button"]):focus-visible {
	text-decoration: underline;
}

/* Images: rounded, with a grey caption. */
.bb-article .bb-figure {
	margin-block: 2em;
}

.bb-article .bb-figure img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: var(--bb-radius, 8px);
}

.bb-article .bb-figure figcaption {
	margin-block: 0.55em 0;
	font-size: 0.85em;
	text-align: start;
	color: var(--bb-muted);
}

/* Tables: scroll sideways on a phone; on the page the wrapper can be focused and scrolled with the keyboard. */
.bb-article .bb-table-wrap {
	margin-block: 1.75em;
	overflow-x: auto;
}

/*
 * A table wider than the column fades out at the right edge, so a phone shows that there
 * is more to scroll; the fade is gone at the end of the table. Only in browsers with
 * scroll-driven animations; a table that does not scroll has no timeline and no fade.
 * The fade does not depend on the page background.
 */
@property --bb-fade {
	syntax: "<length>";
	inherits: false;
	initial-value: 0px;
}

@keyframes bb-table-fade {

	from {
		--bb-fade: 2.5rem;
	}

	to {
		--bb-fade: 0px;
	}
}

@supports (animation-timeline: scroll()) {

	.bb-article .bb-table-wrap:not(:focus-visible) {
		-webkit-mask-image: linear-gradient(to left, transparent, black var(--bb-fade));
		mask-image: linear-gradient(to left, transparent, black var(--bb-fade));
		animation: bb-table-fade linear both;
		animation-timeline: scroll(self inline);
	}
}

.bb-article .bb-table-wrap:focus-visible {
	outline: 2px solid var(--bb-accent, currentColor);
	outline-offset: 2px;
}

.bb-article .bb-table-wrap table {
	width: 100%;
	min-width: 30rem;
	table-layout: auto;
	border-collapse: collapse;
	font-size: 0.95em;
}

/*
 * Words are never split in the middle without a hyphen: WordPress's own table style breaks
 * words anywhere in a fixed-layout table (word-break: break-word), so a phone showed
 * "materiaalie / n". A cell hyphenates or grows, and the table scrolls. Two element names
 * in the selector so the rule wins over the core style whichever loads last.
 */
.bb-article .bb-table-wrap table th,
.bb-article .bb-table-wrap table td {
	word-break: normal;
	overflow-wrap: normal;
	min-width: 6rem;
}

.bb-article .bb-table-wrap th,
.bb-article .bb-table-wrap td {
	padding: 0.6em 0.8em;
	border: 0;
	border-block-end: 1px solid var(--bb-line);
	text-align: start;
	vertical-align: top;
}

.bb-article .bb-table-wrap thead th {
	border-block-end-width: 2px;
	background: var(--bb-soft);
	font-weight: 700;
}

.bb-article .bb-table-wrap thead {
	border: 0;
}

/* FAQ: lines between the questions, + and − in front of the answer. */
.bb-article .bb-faq {
	margin: 0;
	padding-block: 0.9em;
	border-block-end: 1px solid var(--bb-line);
}

.bb-article :not(.bb-faq) + .bb-faq {
	margin-block-start: 1em;
	border-block-start: 1px solid var(--bb-line);
}

.bb-article .bb-faq > summary {
	display: flex;
	justify-content: space-between;
	gap: 1em;
	list-style: none;
	cursor: pointer;
	font-weight: 700;
}

.bb-article .bb-faq > summary::-webkit-details-marker {
	display: none;
}

.bb-article .bb-faq > summary::after {
	content: "+";
	flex-shrink: 0;
	font-weight: 400;
	font-size: 1.3em;
	line-height: 1;
	color: var(--bb-accent, currentColor);
}

.bb-article .bb-faq[open] > summary::after {
	content: "−";
}

.bb-article .bb-faq > summary:focus-visible {
	outline: 2px solid var(--bb-accent, currentColor);
	outline-offset: 4px;
}

.bb-article .bb-faq > :not(summary) {
	margin: 0.6em 0 0;
}

/* Call to action: a framed box. The button keeps the theme's own look. */
.bb-article .bb-cta {
	margin-block-start: 2.5em;
	padding: 1.4em 1.5em;
	border: 1px solid var(--bb-line);
	border-radius: 12px;
}

.bb-article .bb-cta p {
	margin: 0 0 1em;
}

.bb-article .bb-cta .wp-block-buttons {
	margin: 0;
}

/* The AI mark at the end of the article (K15, K37): the EU's icon alone, added on the page
   as the last element of the article's text column (old articles: after the text). */
.bb-ai-label {
	display: flex;
	align-items: center;
	margin-block: 2em 0;
	font-size: 0.875em;
	line-height: 1.4;
}

/* The EU's file has empty space around its pill (viewBox 1790 × 567, the pill 1384 × 266):
   the negative margins leave only the pill in the line, about 1.4 times the text's height.
   Its size is !important like the badge's (0.4.2): a theme's img { width: 100% } stretched it. */
.bb-ai-label .bb-ai-label__icon {
	flex: none;
	width: auto !important;
	min-width: 0 !important;
	max-width: none !important;
	height: 3em !important;
	max-height: none !important;
	margin: -0.76em -1.05em -0.83em -1.1em !important;
	border: 0;
	box-shadow: none;
}

/* The AI badge in the bottom right corner of an AI image (K37): the EU's half-transparent "AI" file,
   a little more transparent still, never in the way of a click. It is anchored to its image
   (CSS anchor positioning, 0.4.6): no box around the image and no rule for the image or its
   parents, so the theme lays the image out exactly as without BlogiBotti (0.4.3's box kept a
   full-width hero image at its own size). It is position: absolute in its own style too.
   Its size and place are !important (0.4.2): a theme's rule for the images in an article
   (e.g. .entry-content figure img { width: 100% }) is more specific and stretched it. */
img.bb-ai-badge {
	position: absolute !important;
	top: auto !important;
	right: calc(anchor(right) + 8px) !important;
	bottom: calc(anchor(bottom) + 8px) !important;
	left: auto !important;
	z-index: 1;
	width: 32px !important;
	min-width: 0 !important;
	max-width: 32px !important;
	height: 32px !important;
	max-height: 32px !important;
	margin: 0 !important;
	padding: 0 !important;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	opacity: 0.85;
	object-fit: contain;
	pointer-events: none;
	position-visibility: anchors-valid;
}

@media (max-width: 600px) {

	img.bb-ai-badge {
		width: 28px !important;
		max-width: 28px !important;
		height: 28px !important;
		max-height: 28px !important;
	}
}

/* A browser without anchor positioning (before Chrome 125, Safari 26, Firefox 147) could not
   place the badge on the image: it is not shown; the article's mark stays. */
@supports not (anchor-name: --bb-ai) {

	img.bb-ai-badge {
		display: none !important;
	}
}
