/*
 * Stickerly — spis treści wpisu, styl B v2.
 *
 * ⚠️ Prefiks klas: `st2-spis`.
 *
 * ⚠️ DWIE KOLUMNY ROBI `grid-auto-flow: column` PLUS LICZBA WIERSZY Z PHP.
 * `column-count` układałby pozycje po kolumnach w sposób zależny od wysokości
 * każdego wiersza — a że tytuły mają różną długość, kolumny wychodziły
 * nierówne. Tu liczba wierszy jest policzona (`ceil(n/2)`) i podana zmienną,
 * więc podział wypada zawsze w tym samym miejscu.
 */

.st2-spis {
	container-type: inline-size;
	margin: 0 0 clamp(1.2rem, 2.6vw, 1.8rem);
	border: 1px solid var(--st2-obwodka);
	border-radius: var(--st2-r-karta);
	background: #fff;
	box-shadow: var(--st2-cien-spok);
	overflow: hidden;
}

/* ---------- głowa ---------- */

.st2-spis-glowa {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.8rem;
	padding: 0.75rem clamp(0.85rem, 2vw, 1.2rem);
	background: var(--st2-blekit-mgla);
	cursor: pointer;
	list-style: none;
	user-select: none;
}

/* Domyślny trójkąt `<summary>` — mamy własną strzałkę po prawej. */
.st2-spis-glowa::-webkit-details-marker { display: none; }
.st2-spis-glowa::marker { content: ""; }

.st2-spis-etykieta { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }

.st2-spis-etykieta strong {
	font-size: 0.82rem;
	font-weight: 700;
	letter-spacing: 0.11em;
	text-transform: uppercase;
	color: var(--st2-grafit);
}

.st2-spis-ile { font-size: 0.74rem; letter-spacing: 0.06em; color: var(--st2-szary); }

.st2-spis-ikona {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px;
	height: 30px;
	border-radius: var(--st2-r-znacznik);
	background: var(--st2-blekit-jasny);
	color: var(--st2-granat);
	flex: 0 0 auto;
}

.st2-spis-ikona svg { width: 16px; height: 16px; }

.st2-spis-przelacz {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	font-size: 0.82rem;
	font-weight: 600;
	color: var(--st2-granat);
	flex: 0 0 auto;
}

.st2-spis-przelacz svg { width: 16px; height: 16px; transition: transform 0.2s ease; }

/* ⚠️ Napis i kierunek strzałki sterowane atrybutem `open`, nie skryptem. */
.st2-spis-rozwin { display: none; }
.st2-spis:not([open]) .st2-spis-zwin { display: none; }
.st2-spis:not([open]) .st2-spis-rozwin { display: inline; }
.st2-spis:not([open]) .st2-spis-przelacz svg { transform: rotate(180deg); }

/* ---------- lista ---------- */

.st2-spis-srodek { padding: clamp(0.6rem, 1.6vw, 0.9rem) clamp(0.6rem, 1.6vw, 0.9rem) 0; }

.st2-spis-lista {
	display: grid;
	grid-auto-flow: column;
	grid-template-rows: repeat(var(--wiersze, 11), auto);
	grid-template-columns: repeat(2, minmax(0, 1fr));
	column-gap: clamp(0.6rem, 2vw, 1.6rem);
	margin: 0;
	padding: 0;
	list-style: none;
}

.st2-spis-lista li { margin: 0; }

.st2-spis-lista a {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.42rem 0.5rem;
	border-radius: var(--st2-r-znacznik);
	/* ⚠️ Kolor i brak podkreślenia JAWNIE — spis stoi w treści wpisu, gdzie
	   `.st-wpis-tresc a` nadaje granat i podkreślenie każdemu odnośnikowi. */
	color: var(--st2-grafit);
	text-decoration: none;
	transition: background-color 0.14s ease;
}

.st2-spis-lista a:hover { background: var(--st2-blekit-mgla); color: var(--st2-granat); text-decoration: none; }

/* Cienka kreska między wierszami — bez niej lista zlewa się w blok. */
.st2-spis-lista li + li a { box-shadow: 0 -1px 0 var(--st2-obwodka) inset; }
.st2-spis-lista li:nth-child(1) a { box-shadow: none; }

.st2-spis-nr {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 26px;
	height: 22px;
	padding: 0 0.3rem;
	border-radius: var(--st2-r-znacznik);
	background: var(--st2-blekit-jasny);
	font-size: 0.72rem;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: var(--st2-granat);
	flex: 0 0 auto;
}

.st2-spis-mysl { min-width: 26px; text-align: center; color: var(--st2-blekit); flex: 0 0 auto; }

.st2-spis-tytul {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 0.88rem;
	line-height: 1.35;
	/* Jedna linia na wiersz — dwie łamią rytm siatki i rozjeżdżają kolumny. */
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.st2-spis-p3 .st2-spis-tytul { font-size: 0.83rem; color: var(--st2-szary); }

.st2-spis-strzalka { width: 15px; height: 15px; flex: 0 0 auto; color: var(--st2-obwodka); }
.st2-spis-lista a:hover .st2-spis-strzalka { color: var(--st2-granat); }

/* ---------- stopka ---------- */

.st2-spis-stopka {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	margin: clamp(0.5rem, 1.4vw, 0.8rem) 0 0;
	padding: 0.7rem clamp(0.3rem, 1vw, 0.6rem);
	border-top: 1px solid var(--st2-obwodka);
	font-size: 0.79rem;
	color: var(--st2-szary);
}

.st2-spis-stopka-ikona { color: var(--st2-blekit); flex: 0 0 auto; }
.st2-spis-stopka-ikona svg { width: 17px; height: 17px; display: block; }

/* ============================================================== WĘŻSZE */

@container (max-width: 700px) {
	/* ⚠️ Jedna kolumna i kolejność wierszowa. Przy dwóch kolumnach na wąskim
	   ekranie tytuł schodzi do ~110 px i wszystko kończy się wielokropkiem. */
	.st2-spis-lista { grid-auto-flow: row; grid-template-rows: none; grid-template-columns: 1fr; }
	.st2-spis-lista li + li a { box-shadow: 0 -1px 0 var(--st2-obwodka) inset; }
	.st2-spis-tytul { white-space: normal; }
	.st2-spis-lista a { align-items: flex-start; }
	.st2-spis-nr { margin-top: 0.05rem; }
}

@media (prefers-reduced-motion: reduce) {
	.st2-spis-przelacz svg,
	.st2-spis-lista a { transition: none; }
}
