/*
 * kazuko.pl – wersja mobilna (telefony i tablety).
 * Ładowana tylko, gdy w private/config.php jest WERSJA_MOBILNA = true.
 */

/* --- węższe ekrany (laptopy, tablety poziomo): układ płynny ----------------- */
@media (max-width: 1270px) {
	.k-wrap { width: 100%; }
	.k-tresc td[nowrap], .k-tresc td[NOWRAP] { white-space: normal; }
	.listPlikTop td.k-kol-status { min-width: 0; }
	tr.listPlik a { overflow-wrap: break-word; }
	tr.listPlik td { padding-left: 5px; padding-right: 5px; }
	.listPlikTop td { font-size: 11px; letter-spacing: 0; }
	.k-tresc [style*="width:"], .k-tresc [width] { max-width: 100% !important; }
}

/* --- tablety pionowo i telefony: jedna kolumna, menu pod przyciskiem -------- */
@media (max-width: 860px) {
	body { font-size: 16px; }
	.k-wrap { padding: 0 14px; }

	/* nagłówek */
	.k-naglowek-in { flex-wrap: wrap; gap: 0 12px; min-height: 60px; }
	.k-logo img { height: 44px; }
	.k-ikony { margin-left: auto; gap: 12px; }
	.k-ikony img { width: 26px; height: 26px; }
	/* na telefonie: Facebook, YouTube i koszyk; ikony RSS tylko w wersji komputerowej */
	.k-ikony a[href="/rss"], .k-ikony a[href="/rss/files"] { display: none; }

	.k-burger {
		display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
		order: 3; width: 44px; height: 44px; margin-left: 6px; padding: 0 10px;
		background: transparent; border: 1px solid rgba(255, 255, 255, .25); border-radius: 8px; cursor: pointer;
	}
	.k-burger span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform .2s, opacity .2s; }
	.k-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
	.k-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
	.k-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
	.k-ikony { order: 2; }

	.k-menu {
		order: 4; flex: 1 0 100%; margin: 0 -14px; padding: 6px 8px 10px;
		flex-direction: column; align-items: stretch; gap: 2px;
		border-top: 1px solid rgba(255, 255, 255, .12);
	}
	.k-menu p a { padding: 12px 14px; font-size: 16px; }
	/* menu zwinięte, gdy działa JavaScript (bez JS zawsze widoczne) */
	.k-js .k-menu:not(.k-otwarte) { display: none; }

	/* pasek „Polecane” przewijany w poziomie */
	.k-polecane .k-wrap { flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
	.k-polecane .k-wrap::-webkit-scrollbar { display: none; }
	.k-polecane a { white-space: nowrap; }

	/* jedna kolumna: menu działu nad treścią, zwijane */
	.k-glowna { flex-direction: column; align-items: stretch; gap: 14px; padding-top: 14px; padding-bottom: 14px; }
	.k-bok { flex: none; width: 100%; }
	.k-bok-przycisk {
		display: flex; justify-content: space-between; align-items: center; width: 100%;
		padding: 12px 16px; border: 0; border-radius: var(--k-promien); box-shadow: var(--k-cien);
		background: var(--k-karta); color: var(--k-tekst); font: 700 15px var(--k-czcionka); cursor: pointer;
	}
	.k-bok-przycisk::after {
		content: ""; width: 8px; height: 8px; margin: 0 4px 4px 0;
		border-right: 2px solid var(--k-akcent); border-bottom: 2px solid var(--k-akcent);
		transform: rotate(45deg); transition: transform .2s;
	}
	.k-bok-przycisk[aria-expanded="true"]::after { transform: rotate(-135deg); margin-bottom: -4px; }
	.k-bok-tresc { margin-top: 8px; }
	.k-js .k-bok:not(.k-otwarte) .k-bok-tresc { display: none; }

	/* strona nigdy nie przesuwa się w bok – zbyt szeroki element przewija się w swojej karcie */
	html, body { overflow-x: hidden; }
	@supports (overflow-x: clip) { html, body { overflow-x: clip; } }
	.k-wrap, .k-glowna, .k-tresc { max-width: 100vw; }

	/* karta z treścią jako zwykły blok: obcinanie (overflow) w tabelach nie działa w każdej przeglądarce */
	.k-tresc table:has(> tbody > tr > td:is(.pRight, .nRight, .fRight)),
	.k-tresc table:has(> tbody > tr > td:is(.pRight, .nRight, .fRight)) > tbody,
	.k-tresc table:has(> tbody > tr > td:is(.pRight, .nRight, .fRight)) > tbody > tr,
	.k-tresc table:has(> tbody > tr > td:is(.pRight, .nRight, .fRight)) > tbody > tr > td { display: block; width: auto !important; max-width: 100%; }
	.k-tresc :is(.pRight, .nRight, .fRight) { min-width: 0; overflow-x: auto; overflow-wrap: break-word; }
	/* tabele w treści (np. zrzuty ekranu obok siebie) mieszczą się w karcie */
	.k-tresc :is(.pRight, .nRight, .fRight) table:not(:has(tr.listPlik)):not(form table) { width: 100% !important; table-layout: fixed; }
	.k-tresc :is(.pRight, .nRight, .fRight) td img { max-width: 100%; height: auto; }
	/* kod, pola formularzy w treści */
	.k-tresc pre { overflow-x: auto; max-width: 100%; }
	.k-tresc code { overflow-wrap: anywhere; }
	.k-tresc textarea, .k-tresc input { max-width: 100%; }

	/* karty i treść */
	.k-tresc :is(.pRight, .nRight, .fRight) { padding: 16px 16px 12px; }
	.k-tresc :is(.nRightBottom, .pRightBottom, .fRightBottom) { padding: 0 16px 14px; }
	.k-tresc h1, .pRight h1, .nRight h1, .fRight h1 { font-size: 20px; }

	/* elementy o stałej szerokości w treści */
	.k-tresc [style*="width:"], .k-tresc [width] { max-width: 100% !important; }
	.k-tresc div[style*="width: 700px"], .k-tresc .ramkaall { width: auto !important; }
	.k-tresc p[style*="width: 800px"] { width: auto !important; }
	.k-tresc img { max-width: 100%; height: auto; }
	.k-tresc iframe, .k-tresc video { max-width: 100%; }
	.k-tresc td[nowrap], .k-tresc td[NOWRAP] { white-space: normal; }
	.k-tresc pre.k-kod code.hljs { font-size: 12px; padding: 10px 12px; }

	/* lista plików: ukryte mniej ważne kolumny */
	tr.listPlik > td:nth-child(3),
	tr.listPlik > td:nth-child(5) { display: none; }
	tr.listPlik td { padding: 9px 4px; font-size: 14px; }
	tr.listPlik > td:nth-child(1) a { overflow-wrap: anywhere; word-break: normal; }
	/* nagłówek „najnowsza wersja” skrócony do „wersja” */
	.listPlikTop > td:nth-child(2) b:first-of-type, .listPlikTop > td:nth-child(2) br { display: none; }
	.listPlikTop td { white-space: normal !important; }
	.listPlikTop td { font-size: 10px; letter-spacing: 0; }
	.listPlikTop td.k-kol-status { min-width: 0; }

	/* strona pliku: przycisk pobierania pod opisem */
	.k-tresc .pRight > table > tbody > tr:has(> td[width="300"]) > td { display: block; width: auto !important; }
	.k-tresc .pRight > table > tbody > tr > td[width="300"] { padding-top: 12px; }

	/* formularze */
	.k-tresc input[type="text"], .k-tresc textarea, .k-tresc select { width: 100% !important; font-size: 16px; }
	.k-tresc form table[style*="width: 600px"] { width: 100% !important; }
	.k-tresc form td[style*="padding: 0px 30px"] { padding-left: 0 !important; padding-right: 0 !important; }
	.button { padding: 10px 22px; }

	/* koszyk i podsumowanie: mniejsze odstępy w tabelach */
	.k-tresc form td[style*="padding"] { padding-left: 5px !important; padding-right: 5px !important; }
	.k-tresc form td[style*="font-size: 17px"] { font-size: 15px !important; }
	/* koszyk i podsumowanie: tabela pozycji w pionie */
	.k-tresc form > table > tbody > tr > td[width="50%"] { display: block; width: 100% !important; padding-left: 0 !important; padding-right: 0 !important; }

	#scrollUp { bottom: 14px; right: 14px; }
}

/* --- małe telefony ---------------------------------------------------------- */
@media (max-width: 420px) {
	.button { padding: 10px 14px; white-space: normal; }
	.k-tresc form td[style*="padding"] { padding-left: 3px !important; padding-right: 3px !important; }
	.k-tresc form td[style*="font-size: 15px"], .k-tresc form td[style*="font-size: 14px"] { font-size: 13px !important; }
	/* nagłówek w jednej linii: logo, lupka, Facebook, YouTube, koszyk i ☰ */
	.k-naglowek .k-wrap { padding-left: 12px; padding-right: 12px; }
	.k-naglowek-in { gap: 0 8px; }
	.k-logo img { height: 32px; }
	.k-ikony { gap: 8px; }
	.k-ikony img, .k-ikony a.k-szukaj-przycisk { width: 24px; height: 24px; }
	.k-burger { width: 40px; height: 40px; margin-left: 2px; padding: 0 9px; }
	.k-menu { margin: 0 -12px; }
	tr.listPlik > td:nth-child(4) { display: none; }
	/* numery stron newsów: węższe przyciski, żeby wszystkie mieściły się w jednej linii */
	#nrpage a, #nrpage .current, #nrpage .k-nieaktywny { padding: 5px 8px; margin-left: 1px; }
	.k-tresc :is(.pRight, .nRight, .fRight) { padding: 14px 12px 10px; }
}

/* --- najwęższe telefony (do 360 px) ------------------------------------------ */
@media (max-width: 360px) {
	.k-naglowek .k-wrap { padding-left: 10px; padding-right: 10px; }
	.k-naglowek-in { gap: 0 6px; }
	.k-logo img { height: 27px; }
	.k-ikony { gap: 6px; }
	.k-ikony img, .k-ikony a.k-szukaj-przycisk { width: 22px; height: 22px; }
	.k-ikony a.k-szukaj-przycisk svg { width: 20px; height: 20px; }
	.k-burger { width: 38px; height: 38px; padding: 0 8px; }
	.k-menu { margin: 0 -10px; }
	.k-licznik { right: -7px; }
	#nrpage a, #nrpage .current, #nrpage .k-nieaktywny { padding: 4px 6px; }
	#nrpage { font-size: 12px; }
}
