/**
 * BEFO — Gutenberg-blokkok stílusa (Tudástár cikkek).
 *
 * EGY forrás a frontendnek és a blokkszerkesztőnek:
 * - frontend: a cikk Post Content widgetje (.befo-post) — functions.php tölti be;
 * - szerkesztő: add_editor_style() — a WordPress a „body”-t .editor-styles-wrapper-re
 *   cseréli, a tartalom gyökere ott .is-root-container.
 * Ezért minden szabály ezzel a hatókörrel kezdődik: body :is(.befo-post, .is-root-container)
 *
 * Színek: Elementor kit globális színei; a fallback a szerkesztőben él (ott nincs kit).
 */

:root {
	--befo-primary: var(--e-global-color-primary, #FF6700);
	--befo-primary-hover: var(--e-global-color-60acad7, #D95400);
	--befo-orange-text: var(--e-global-color-ac04b00, #C04B00); /* kis narancs szöveg, 4,9:1 */
	--befo-text: var(--e-global-color-text, #020100);
	--befo-black: var(--e-global-color-8394c26, #27221F);
	--befo-muted: var(--e-global-color-a5f5a56, #5F5A56);
	--befo-tint: var(--e-global-color-afff3eb, #FFF3EB);
	--befo-surface: #F7F7F7;
	--befo-line: #E4E3E1;
	--befo-shadow: 0 12px 22px -20px rgba(0, 0, 0, .5);
	--befo-sticky-top: 140px;
}

/* ===== Alap ===== */
body :is(.befo-post, .is-root-container) {
	max-width: 720px;
	font-size: 17px;
	line-height: 1.7;
	color: var(--befo-text);
}
body .befo-post > .elementor-widget-container > :first-child,
body .befo-post > :first-child { margin-top: 0; }
body :is(.befo-post, .is-root-container) p { margin: 0 0 20px; }
body :is(.befo-post, .is-root-container) strong { font-weight: 700; }

/* ===== Címsorok ===== */
body :is(.befo-post, .is-root-container) :is(h2, h3, h4) {
	color: var(--befo-text);
	scroll-margin-top: var(--befo-sticky-top);
}
body :is(.befo-post, .is-root-container) h2 {
	font-size: 24px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.95px;
	margin: 48px 0 16px;
}
body :is(.befo-post, .is-root-container) h3 {
	font-size: 19px;
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: -.3px;
	margin: 32px 0 12px;
}
body :is(.befo-post, .is-root-container) h4 {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	letter-spacing: 0;
	margin: 24px 0 8px;
}

/* ===== Link ===== */
body :is(.befo-post, .is-root-container) a:not(.wp-block-button__link):not(.wp-block-file__button) {
	color: var(--befo-text);
	text-decoration: underline;
	text-decoration-color: var(--befo-primary);
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
}
body :is(.befo-post, .is-root-container) a:not(.wp-block-button__link):not(.wp-block-file__button):hover { color: var(--befo-orange-text); }

/* ===== Felsorolás: narancs vonalas lista ===== */
body :is(.befo-post, .is-root-container) ul:not(.blocks-gallery-grid) { list-style: none; padding: 0; margin: 0 0 24px; }
body :is(.befo-post, .is-root-container) ul:not(.blocks-gallery-grid) > li {
	position: relative;
	padding: 10px 0 10px 22px;
	margin: 0;
	border-top: 1px solid var(--befo-line);
}
body :is(.befo-post, .is-root-container) ul:not(.blocks-gallery-grid) > li:last-child { border-bottom: 1px solid var(--befo-line); }
body :is(.befo-post, .is-root-container) ul:not(.blocks-gallery-grid) > li::before {
	content: "";
	position: absolute;
	left: 0;
	top: 23px;
	width: 9px;
	height: 2px;
	background: var(--befo-primary);
}
/* beágyazott lista: vonal nélkül, kisebb jel */
body :is(.befo-post, .is-root-container) li > ul:not(.blocks-gallery-grid) { margin: 6px 0 0; }
body :is(.befo-post, .is-root-container) li > ul:not(.blocks-gallery-grid) > li,
body :is(.befo-post, .is-root-container) li > ul:not(.blocks-gallery-grid) > li:last-child { border: 0; padding: 3px 0 3px 18px; }
body :is(.befo-post, .is-root-container) li > ul:not(.blocks-gallery-grid) > li::before { top: 16px; width: 6px; }

/* ===== Számozott lista ===== */
body :is(.befo-post, .is-root-container) ol { padding-left: 24px; margin: 0 0 24px; }
body :is(.befo-post, .is-root-container) ol > li { padding: 4px 0 4px 4px; }
body :is(.befo-post, .is-root-container) ol > li::marker { color: var(--befo-orange-text); font-weight: 800; }

/* „Lépések” blokkstílus */
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek {
	list-style: none;
	padding: 0;
	margin: 8px 0 28px;
	counter-reset: befo-lepes;
}
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li {
	counter-increment: befo-lepes;
	position: relative;
	padding: 18px 0 18px 56px;
	border-top: 1px solid var(--befo-line);
}
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li:last-child { border-bottom: 1px solid var(--befo-line); }
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li::before {
	content: counter(befo-lepes, decimal-leading-zero);
	position: absolute;
	left: 0;
	top: 16px;
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -.95px;
	line-height: 1.2;
	color: var(--befo-orange-text);
}
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li > strong:first-child,
body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li > .rich-text > strong:first-child { display: block; } /* a szerkesztőben a szöveget .rich-text csomagolja */

/* ===== „Kiemelés” blokkstílus (csoport) ===== */
body :is(.befo-post, .is-root-container) .is-style-befo-kiemeles {
	background: var(--befo-tint);
	border-left: 2px solid var(--befo-primary);
	padding: 20px 24px;
	margin: 28px 0;
}
body :is(.befo-post, .is-root-container) .is-style-befo-kiemeles::before {
	content: "Jó tudni";
	display: block;
	margin-bottom: 8px;
	font-size: 11px;
	font-weight: 800;
	line-height: 1;
	text-transform: uppercase;
	color: var(--befo-orange-text);
}
body :is(.befo-post, .is-root-container) .is-style-befo-kiemeles > :last-child { margin-bottom: 0; }
body :is(.befo-post, .is-root-container) .is-style-befo-kiemeles p { font-size: 16px; }

/* ===== Idézet (minden változata) ===== */
body :is(.befo-post, .is-root-container) blockquote.wp-block-quote {
	margin: 28px 0;
	padding: 0 0 0 24px;
	border-left: 2px solid var(--befo-primary);
	font-size: 19px;
	font-style: normal;
	font-weight: 600;
	line-height: 1.5;
	letter-spacing: -.3px;
}
body :is(.befo-post, .is-root-container) blockquote p { margin-bottom: 8px; font-size: inherit; }
body :is(.befo-post, .is-root-container) blockquote cite,
body :is(.befo-post, .is-root-container) .wp-block-pullquote cite {
	display: block;
	font-size: 13px;
	font-style: normal;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	color: var(--befo-muted);
}

/* ===== Kiemelt idézet (Pullquote) ===== */
body :is(.befo-post, .is-root-container) .wp-block-pullquote {
	margin: 36px 0;
	padding: 28px 0;
	border-top: 2px solid var(--befo-primary);
	border-bottom: 1px solid var(--befo-line);
	text-align: left;
}
body :is(.befo-post, .is-root-container) .wp-block-pullquote blockquote {
	margin: 0;
	padding: 0;
	border: 0;
}
body :is(.befo-post, .is-root-container) .wp-block-pullquote :is(blockquote, p) { font-style: normal; }
body :is(.befo-post, .is-root-container) .wp-block-pullquote p {
	font-size: 24px;
	font-weight: 800;
	line-height: 1.3;
	letter-spacing: -.95px;
	margin: 0 0 12px;
}

/* ===== Táblázat (minden változata) ===== */
body :is(.befo-post, .is-root-container) figure.wp-block-table { margin: 0 0 24px; overflow-x: auto; }
body :is(.befo-post, .is-root-container) table { width: 100%; border-collapse: collapse; font-size: 15px; }
body :is(.befo-post, .is-root-container) .wp-block-table :is(table, thead, tbody, tfoot, tr) { border: 0; }
body :is(.befo-post, .is-root-container) table :is(th, thead td) {
	text-align: left;
	font-size: 11px;
	font-weight: 800;
	text-transform: uppercase;
	color: var(--befo-muted);
	padding: 10px 12px;
	border: 0;
	border-bottom: 2px solid var(--befo-primary);
	background: none;
}
body :is(.befo-post, .is-root-container) table td { padding: 12px; border: 0; border-bottom: 1px solid var(--befo-line); }
body :is(.befo-post, .is-root-container) table tbody > tr:nth-child(odd) > td { background: none; }
body :is(.befo-post, .is-root-container) .wp-block-table.is-style-stripes { border-bottom: 0; }
body :is(.befo-post, .is-root-container) .wp-block-table.is-style-stripes tbody > tr:nth-child(odd) > td { background: var(--befo-surface); }
body :is(.befo-post, .is-root-container) .wp-block-table tfoot td { font-weight: 700; border-top: 2px solid var(--befo-line); }

/* ===== Kép, galéria, képaláírás ===== */
body :is(.befo-post, .is-root-container) figure { margin: 28px 0; }
body :is(.befo-post, .is-root-container) figure img { border-radius: 3px; height: auto; }
body :is(.befo-post, .is-root-container) .wp-block-image.is-style-rounded img { border-radius: 9999px; }
body :is(.befo-post, .is-root-container) .wp-block-gallery { gap: 12px; }
body :is(.befo-post, .is-root-container) .wp-block-gallery figure { margin: 0; }
body :is(.befo-post, .is-root-container) :is(figcaption, .wp-element-caption) {
	font-size: 13px;
	font-style: normal;
	line-height: 1.5;
	color: var(--befo-muted);
	margin-top: 8px;
	text-align: left;
}
/* galérián belül a képre kerülő aláírás maradjon olvasható */
body :is(.befo-post, .is-root-container) .wp-block-gallery figure.wp-block-image figcaption { color: #fff; text-align: center; }

/* ===== Gomb ===== */
body :is(.befo-post, .is-root-container) .wp-block-buttons { gap: 12px; margin: 28px 0; }
body :is(.befo-post, .is-root-container) .wp-block-button__link {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 10px 18px;
	border: 1px solid var(--befo-primary);
	border-radius: 4px;
	background: var(--befo-primary);
	color: #fff;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: none;
	transition: background-color .2s, border-color .2s, color .2s;
}
body :is(.befo-post, .is-root-container) .wp-block-button__link::after {
	content: "→";
	font-weight: 600;
}
body :is(.befo-post, .is-root-container) .wp-block-button__link:hover,
body :is(.befo-post, .is-root-container) .wp-block-button__link:focus-visible {
	background: var(--befo-primary-hover);
	border-color: var(--befo-primary-hover);
	color: #fff;
}
body :is(.befo-post, .is-root-container) .wp-block-button__link:focus-visible { outline: 2px solid var(--befo-text); outline-offset: 2px; }
body :is(.befo-post, .is-root-container) .wp-block-button.is-style-outline > .wp-block-button__link {
	background: #fff;
	color: var(--befo-primary);
	padding: 10px 18px;
	border: 1px solid var(--befo-primary);
}
body :is(.befo-post, .is-root-container) .wp-block-button.is-style-outline > .wp-block-button__link:hover {
	background: var(--befo-primary);
	color: #fff;
}

/* ===== Elválasztó (minden változata) ===== */
body :is(.befo-post, .is-root-container) hr.wp-block-separator {
	width: 40px;
	max-width: 40px;
	height: 0;
	margin: 40px 0;
	border: 0;
	border-top: 2px solid var(--befo-primary);
	background: none;
	opacity: 1;
}
/* a szerkesztő középre tenné (margin: auto) — a rövid vonal balra igazodik, mint a frontenden */
body :is(.befo-post, .is-root-container) hr.wp-block-separator:not(.is-style-wide):not(.is-style-dots) { margin-left: 0 !important; margin-right: auto !important; }
body :is(.befo-post, .is-root-container) hr.wp-block-separator.is-style-wide {
	width: 100%;
	max-width: none;
	border-top: 1px solid var(--befo-line);
}
body :is(.befo-post, .is-root-container) hr.wp-block-separator.is-style-dots {
	width: auto;
	max-width: none;
	border: 0;
	text-align: center;
}
body :is(.befo-post, .is-root-container) hr.wp-block-separator.is-style-dots::before {
	color: var(--befo-primary);
	font-size: 20px;
	letter-spacing: 2em;
}

/* ===== Lenyíló (Details) — a GYIK harmonika mintájára ===== */
body :is(.befo-post, .is-root-container) .wp-block-details {
	margin: 0;
	padding: 0;
	border-top: 1px solid var(--befo-line);
}
body :is(.befo-post, .is-root-container) .wp-block-details + :not(.wp-block-details) { margin-top: 24px; }
body :is(.befo-post, .is-root-container) .wp-block-details:has(+ :not(.wp-block-details)),
body :is(.befo-post, .is-root-container) .wp-block-details:last-child { border-bottom: 1px solid var(--befo-line); }
body :is(.befo-post, .is-root-container) .wp-block-details summary {
	position: relative;
	padding: 18px 32px 18px 0;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.4;
	cursor: pointer;
	list-style: none;
}
body :is(.befo-post, .is-root-container) .wp-block-details summary::-webkit-details-marker { display: none; }
body :is(.befo-post, .is-root-container) .wp-block-details summary::after {
	content: "";
	position: absolute;
	right: 4px;
	top: 22px;
	width: 8px;
	height: 8px;
	border-right: 2px solid var(--befo-primary);
	border-bottom: 2px solid var(--befo-primary);
	transform: rotate(45deg);
	transition: transform .2s;
}
body :is(.befo-post, .is-root-container) .wp-block-details[open] summary::after { transform: rotate(-135deg); top: 26px; }
body :is(.befo-post, .is-root-container) .wp-block-details > :not(summary) { margin: 0 0 18px; }

/* ===== Csoport, oszlopok, kép-szöveg ===== */
body :is(.befo-post, .is-root-container) .wp-block-group.has-background:not(.is-style-befo-kiemeles) { padding: 20px 24px; margin: 28px 0; }
body :is(.befo-post, .is-root-container) .wp-block-columns { gap: 24px; margin: 28px 0; }
body :is(.befo-post, .is-root-container) .wp-block-column > :last-child { margin-bottom: 0; }
body :is(.befo-post, .is-root-container) .wp-block-media-text { margin: 28px 0; gap: 0; }
body :is(.befo-post, .is-root-container) .wp-block-media-text .wp-block-media-text__content { padding: 0 0 0 24px; }
body :is(.befo-post, .is-root-container) .wp-block-media-text.has-media-on-the-right .wp-block-media-text__content { padding: 0 24px 0 0; }
body :is(.befo-post, .is-root-container) .wp-block-media-text figure { margin: 0; }

/* ===== Fájl (letöltés) ===== */
body :is(.befo-post, .is-root-container) .wp-block-file {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 24px 0;
	padding: 14px 16px;
	border: 1px solid var(--befo-line);
	border-left: 2px solid var(--befo-primary);
	border-radius: 3px;
	font-size: 15px;
	font-weight: 600;
}
body :is(.befo-post, .is-root-container) .wp-block-file__button {
	margin: 0;
	padding: 8px 14px;
	border-radius: 4px;
	background: var(--befo-primary);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	white-space: nowrap;
}
body :is(.befo-post, .is-root-container) .wp-block-file__button:hover { background: var(--befo-primary-hover); color: #fff; }

/* ===== Kód, előformázott szöveg ===== */
body :is(.befo-post, .is-root-container) :is(.wp-block-code, .wp-block-preformatted, pre) {
	margin: 24px 0;
	padding: 16px 20px;
	border: 0;
	border-left: 2px solid var(--befo-line);
	border-radius: 0;
	background: var(--befo-surface);
	font-family: Consolas, Monaco, "Courier New", monospace;
	font-size: 14px;
	line-height: 1.6;
	white-space: pre-wrap;
	color: var(--befo-text);
}
body :is(.befo-post, .is-root-container) :not(pre) > code {
	padding: 1px 5px;
	border-radius: 3px;
	background: var(--befo-surface);
	font-size: .9em;
}

/* ===== Beágyazás (videó stb.) ===== */
body :is(.befo-post, .is-root-container) .wp-block-embed { margin: 28px 0; }
body :is(.befo-post, .is-root-container) .wp-block-embed iframe { border-radius: 3px; }

/* ===== Mobil ===== */
@media (max-width: 767px) {
	body :is(.befo-post, .is-root-container) { font-size: 16px; }
	body :is(.befo-post, .is-root-container) h2 { font-size: 22px; margin-top: 40px; }
	body :is(.befo-post, .is-root-container) h3 { font-size: 18px; }
	body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li { padding-left: 44px; }
	body :is(.befo-post, .is-root-container) ol.is-style-befo-lepesek > li::before { font-size: 20px; top: 18px; }
	body :is(.befo-post, .is-root-container) .wp-block-pullquote p { font-size: 20px; }
	body :is(.befo-post, .is-root-container) .wp-block-media-text .wp-block-media-text__content { padding: 16px 0 0; }
}
