/* ==========================================================================
   PoloniaHub — artykuły bazy wiedzy

   To najmocniejsze strony w serwisie: przychodzi na nie cały ruch z Google.
   Dostają więc własny arkusz — czytelny spis treści, wyraźny nagłówek wpisu
   i typografia nastawiona na długi tekst czytany w drugim języku.
   ========================================================================== */

/* --- Nagłówek wpisu ------------------------------------------------------ */

body.single .entry-header {
	margin-bottom: 28px;
}

/* Kategorie jako plakietki, nie jako linia drobnego tekstu nad tytułem. */
body.single .entry-taxonomies,
body.single .entry-meta .category-links {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-bottom: 14px;
}

body.single .entry-taxonomies a,
body.single .category-links a {
	display: inline-flex;
	align-items: center;
	padding: 5px 12px;
	border-radius: 999px;
	background: #EEF3FD;
	border: 1px solid #DCE6FA;
	font-family: var(--ph-font-body);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ph-cta);
	text-decoration: none;
}

body.single .entry-taxonomies a:hover,
body.single .category-links a:hover { background: #E2EAFB; }

body.single .entry-meta {
	font-size: 0.8125rem;
	color: var(--ph-muted);
}

/* Pierwszy akapit jako wprowadzenie — prowadzi z tytułu w tekst. */
body.single .entry-content > p:first-of-type {
	font-size: 1.0625rem;
	line-height: 1.6;
	color: var(--ph-heading-3);
}

/* --- Treść --------------------------------------------------------------- */

body.single .entry-content h2 {
	padding-top: 8px;
	border-top: 2px solid var(--ph-border);
}

body.single .entry-content ul,
body.single .entry-content ol {
	max-width: var(--ph-measure);
	padding-left: 22px;
}

body.single .entry-content li::marker { color: var(--ph-cta); }

body.single .entry-content img {
	border-radius: var(--ph-radius);
	border: 1px solid var(--ph-border);
	box-shadow: 0 8px 24px rgba(13, 43, 107, 0.06);
}

body.single .entry-content blockquote {
	margin: 28px 0;
	padding: 18px 22px;
	border: 0;
	border-left: 3px solid var(--ph-cta);
	border-radius: 0 var(--ph-radius) var(--ph-radius) 0;
	background: #F4F7FD;
	font-size: 1.0625rem;
	color: var(--ph-heading-3);
}

body.single .entry-content table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
}

body.single .entry-content th,
body.single .entry-content td {
	padding: 12px 14px;
	border: 1px solid var(--ph-border);
	text-align: left;
}

body.single .entry-content th {
	background: #F4F7FD;
	font-family: var(--ph-font-body);
	font-weight: 600;
	color: var(--ph-heading);
}

/* --- Spis treści --------------------------------------------------------- */
/* Domyślnie to lista z wypunktowaniem w nagłówkowym kroju. Zmieniamy ją
   w narzędzie nawigacyjne: przyklejone do ekranu, numerowane, z wyraźnym
   stanem najechania. */

.kb-table-of-content-wrap {
	position: sticky;
	top: 110px;
	max-height: calc(100vh - 140px);
	overflow-y: auto;
	padding: 20px !important;
	border: 1px solid var(--ph-border) !important;
	border-radius: var(--ph-radius) !important;
	background: var(--ph-surface) !important;
	box-shadow: 0 6px 20px rgba(13, 43, 107, 0.05);
}

.kb-table-of-content-wrap .kb-table-of-contents-title,
.kb-table-of-content-wrap h2,
.kb-table-of-content-wrap h3 {
	margin: 0 0 14px !important;
	padding-bottom: 12px;
	border-bottom: 1px solid var(--ph-border);
	font-family: var(--ph-font-body) !important;
	font-size: 0.75rem !important;
	font-weight: 700 !important;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ph-muted) !important;
}

.kb-table-of-content-wrap ul,
.kb-table-of-content-wrap ol {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: toc;
}

.kb-table-of-content-wrap li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.kb-table-of-content-wrap li::marker { content: ""; }

.kb-table-of-content-wrap a {
	display: flex;
	gap: 10px;
	padding: 7px 8px;
	border-radius: 8px;
	font-family: var(--ph-font-body);
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--ph-body);
	text-decoration: none;
	transition: background-color var(--ph-transition), color var(--ph-transition);
}

/* Numeracja z licznika, nie z treści — działa niezależnie od tego,
   ile pozycji ma spis i w jakiej kolejności. */
.kb-table-of-content-wrap a::before {
	counter-increment: toc;
	content: counter(toc);
	flex: 0 0 auto;
	min-width: 20px;
	font-size: 0.75rem;
	font-weight: 600;
	color: var(--ph-cta);
	text-align: right;
}

.kb-table-of-content-wrap a:hover {
	background: #F2F6FE;
	color: var(--ph-heading);
}

/* Pasek przewijania w spisie — cienki, żeby nie dominował nad treścią. */
.kb-table-of-content-wrap::-webkit-scrollbar { width: 6px; }
.kb-table-of-content-wrap::-webkit-scrollbar-thumb {
	background: #D7DFEC;
	border-radius: 3px;
}

@media (max-width: 1024px) {
	.kb-table-of-content-wrap {
		position: static;
		max-height: none;
	}
}

/* --- Wezwanie na końcu artykułu ------------------------------------------ */

.ph-post-cta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	margin: 26px 0 0;
	padding: 20px;
	border: 1px solid #DCE6FA;
	border-radius: var(--ph-radius);
	background: #F4F7FD;
}

.ph-post-cta__text { flex: 1 1 300px; min-width: 0; }

body.single .ph-post-cta .ph-post-cta__title,
.ph-post-cta .ph-post-cta__title {
	margin: 0 0 6px;
	font-family: var(--ph-font-body);
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--ph-heading);
}

.ph-post-cta p {
	margin: 0;
	max-width: 52ch;
	font-size: 0.9375rem;
	color: var(--ph-body);
}

/* --- Powiązane artykuły --------------------------------------------------- */

.ph-related { margin-top: 26px; }

.ph-related .ph-related__title {
	margin: 0 0 14px;
	font-family: var(--ph-font-body);
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ph-muted);
}

.ph-related ul {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
	gap: 12px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ph-related li { margin: 0; padding: 0; list-style: none; }

body.single .entry-content .ph-related a,
.ph-related a {
	display: block;
	height: 100%;
	padding: 14px 16px;
	border: 1px solid var(--ph-border);
	border-radius: var(--ph-radius-input);
	background: var(--ph-surface);
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.4;
	color: var(--ph-heading);
	text-decoration: none !important;
	transition: border-color var(--ph-transition), box-shadow var(--ph-transition);
}

body.single .entry-content .ph-related a:hover,
.ph-related a:hover {
	border-color: var(--ph-accent-light);
	box-shadow: 0 8px 22px rgba(13, 43, 107, 0.08);
	text-decoration: none;
}

/* --- Strony prawne -------------------------------------------------------
   Długi tekst prawny bez rytmu jest nieczytelny. Miara linii, wyraźne
   nagłówki i oznaczenia miejsc wymagających uzupełnienia. */

.ph-legal { max-width: 72ch; }

.ph-legal h2 {
	margin: 24px 0 8px;
	padding-top: 8px;
	border-top: 2px solid var(--ph-border);
	font-size: clamp(1.25rem, 1.15rem + 0.5vw, 1.5rem);
}

.ph-legal h2:first-child { margin-top: 0; border-top: 0; padding-top: 0; }
.ph-legal p { margin: 0 0 14px; }
.ph-legal ul { margin: 0 0 16px; padding-left: 22px; }
.ph-legal li { margin-bottom: 8px; }
.ph-legal li::marker { color: var(--ph-cta); }

.ph-legal__todo {
	padding: 12px 16px;
	border-left: 3px solid var(--ph-warning);
	border-radius: 0 var(--ph-radius-input) var(--ph-radius-input) 0;
	background: #FEF6E7;
	font-size: 0.9375rem;
	color: #7A5200;
}
