/*
Theme Name: Prekių tema
Description: Tema prekių palyginimo katalogui. Veikia kartu su įskiepiu „Prekių katalogas (affiliate)“.
Version: 1.0.0
Author: Rokas Butnorius
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: prekiu-tema
*/

:root {
	--pk-ink: #17212b;
	--pk-muted: #5e6875;
	--pk-line: #e2e6ea;
	--pk-surface: #f4f6f8;
	--pk-accent: #0b5d66;
	--pk-accent-hover: #084850;
	--pk-tag: #ffd400;
	--pk-font: "Onest", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	background: #fff;
	color: var(--pk-ink);
	font: 400 16px/1.6 var(--pk-font);
}
img { max-width: 100%; height: auto; }
a { color: var(--pk-accent); }
a:hover { color: var(--pk-accent-hover); }
:focus-visible { outline: 3px solid var(--pk-tag); outline-offset: 2px; }

.screen-reader-text {
	position: absolute !important;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}
.skip-link:focus {
	position: absolute; left: 8px; top: 8px; z-index: 100;
	width: auto; height: auto; clip: auto;
	padding: 8px 14px; background: #fff; border: 2px solid var(--pk-ink);
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------- Viršutinė juosta ---------- */

.site-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: #fff;
	border-bottom: 1px solid var(--pk-line);
}
.site-header .wrap {
	display: flex;
	align-items: center;
	gap: 20px;
	min-height: 64px;
}
.site-logo {
	font-weight: 800;
	font-size: 1.25rem;
	color: var(--pk-ink) !important;
	text-decoration: none;
	white-space: nowrap;
	letter-spacing: -0.02em;
}
.site-logo span { color: var(--pk-accent); }
.site-logo img { max-height: 40px; width: auto; display: block; }

.header-search { flex: 1; max-width: 520px; }
.header-search .pk-search { max-width: none; }
.header-search .pk-search input[type="search"] { padding: 9px 14px; border-width: 1px; border-color: #c7ced5; }
.header-search .pk-search button { padding: 9px 14px; }

.main-nav { margin-left: auto; }
.menu-toggle { display: none; }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; }
.main-nav a {
	display: block;
	padding: 8px 12px;
	border-radius: 6px;
	color: var(--pk-ink);
	text-decoration: none;
	font-weight: 500;
}
.main-nav a:hover,
.main-nav .current-menu-item > a { background: var(--pk-surface); }
.main-nav .sub-menu { display: none; }

/* ---------- Pradinis puslapis ---------- */

.hero { padding: 40px 0 28px; }
.hero h1 {
	margin: 0 0 8px;
	font-size: clamp(1.7rem, 5vw, 2.8rem);
	font-weight: 800;
	line-height: 1.15;
	letter-spacing: -0.02em;
	max-width: 20ch;
}
.hero p { margin: 0 0 20px; color: var(--pk-muted); font-size: 1.05rem; }

.home-section { padding: 28px 0; }
.home-section h2 {
	margin: 0 0 16px;
	font-size: 1.45rem;
	font-weight: 800;
	letter-spacing: -0.01em;
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}
.home-section h2 a { font-size: .95rem; font-weight: 500; white-space: nowrap; }

/* ---------- Puslapiai ir įrašai ---------- */

.content { padding: 32px 0 56px; }
.entry { max-width: 72ch; }
.entry h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); font-weight: 800; line-height: 1.2; margin: 0 0 16px; letter-spacing: -0.02em; }
.entry h2 { font-size: 1.45rem; font-weight: 800; margin: 2em 0 .5em; }
.entry h3 { font-size: 1.15rem; font-weight: 700; margin: 1.6em 0 .4em; }
.entry .meta { color: var(--pk-muted); font-size: .9rem; margin: -8px 0 20px; }
.entry-list { display: grid; gap: 24px; max-width: 72ch; }
.entry-list h2 { margin: 0 0 4px; font-size: 1.3rem; }
.entry-list h2 a { color: var(--pk-ink); text-decoration: none; }
.entry-list h2 a:hover { text-decoration: underline; }
.entry-list p { margin: 0; color: var(--pk-muted); }
.pagination { margin-top: 32px; display: flex; gap: 6px; flex-wrap: wrap; }
.pagination .page-numbers { padding: 8px 12px; border: 1px solid var(--pk-line); border-radius: 6px; text-decoration: none; }
.pagination .current { background: var(--pk-ink); border-color: var(--pk-ink); color: #fff; }

/* ---------- Poraštė ---------- */

.site-footer {
	margin-top: 40px;
	background: var(--pk-surface);
	border-top: 1px solid var(--pk-line);
	padding: 32px 0;
	font-size: .92rem;
	color: var(--pk-muted);
}
.site-footer .wrap { display: grid; gap: 16px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.site-footer a { color: var(--pk-ink); }
.site-footer p { margin: 0; }

/* ---------- Mobilus ---------- */

@media (max-width: 860px) {
	.site-header .wrap { flex-wrap: wrap; gap: 10px; padding-top: 10px; padding-bottom: 10px; }
	.header-search { order: 3; flex-basis: 100%; max-width: none; }
	.header-search .pk-search { flex-direction: row; }
	.main-nav { position: relative; }
	.menu-toggle {
		display: flex; align-items: center; justify-content: center;
		width: 44px; height: 44px; border: 0; border-radius: 8px;
		background: transparent; color: var(--pk-ink); cursor: pointer;
	}
	.menu-toggle svg { width: 24px; height: 24px; }
	.main-nav ul {
		display: none;
		position: absolute; right: 0; top: 48px;
		flex-direction: column; min-width: 220px;
		background: #fff; border: 1px solid var(--pk-line); border-radius: 10px; padding: 6px;
	}
	.main-nav.is-open ul { display: flex; }
	.hero { padding: 24px 0 12px; }
}

/* Pradinio puslapio kategorijų kortelės */
.pt-cats {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
	margin-top: 28px;
}
.pt-cat {
	display: flex;
	background: #fff;
	border: 1px solid var(--pk-line);
	border-radius: 12px;
	overflow: hidden;
	transition: box-shadow .15s, border-color .15s;
}
.pt-cat:hover {
	border-color: #cfd6dc;
	box-shadow: 0 6px 18px rgba(23, 33, 43, .08);
}
.pt-cat__img {
	flex: 0 0 120px;
	background: var(--pk-surface);
	display: block;
}
.pt-cat__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
}
.pt-cat__body {
	flex: 1;
	min-width: 0;
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.pt-cat__name {
	font-weight: 700;
	font-size: 17px;
	line-height: 1.3;
	color: var(--pk-ink);
	text-decoration: none;
}
.pt-cat__name:hover { color: var(--pk-accent); }
.pt-cat__n {
	font-size: 13px;
	color: var(--pk-muted);
}
.pt-cat__kids {
	list-style: none;
	margin: 10px 0 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.pt-cat__kids a {
	display: inline-block;
	padding: 3px 10px;
	font-size: 13px;
	line-height: 1.5;
	color: var(--pk-ink);
	background: var(--pk-surface);
	border-radius: 999px;
	text-decoration: none;
	white-space: nowrap;
}
.pt-cat__kids li { max-width: 100%; }
.pt-cat__kids a { max-width: 100%; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.pt-cat__kids a:hover { background: var(--pk-accent); color: #fff; }
.pt-cat__kids .pt-cat__more { background: none; color: var(--pk-accent); padding-left: 4px; }
@media (max-width: 960px) {
	.pt-cats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.pt-cats { grid-template-columns: 1fr; gap: 12px; }
	.pt-cat__img { flex-basis: 96px; }
}

/* „Prekių katalogas“ meniu */
.pt-catbtn {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 10px 16px;
	border: 0;
	border-radius: 8px;
	background: var(--pk-accent);
	color: #fff;
	font: 700 15px/1.2 var(--pk-font);
	cursor: pointer;
	white-space: nowrap;
}
.pt-catbtn:hover, .pt-catbtn[aria-expanded="true"] { background: var(--pk-accent-hover); }
.pt-catbtn svg { width: 18px; height: 18px; flex: none; }
.pt-catpanel[hidden], .pt-catoverlay[hidden], .pt-catsub__panel[hidden] { display: none !important; }
.pt-catpanel {
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	z-index: 60;
}
.pt-catpanel__in { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.pt-catbox {
	display: flex;
	background: #fff;
	border: 1px solid var(--pk-line);
	border-top: 0;
	border-radius: 0 0 14px 14px;
	box-shadow: 0 18px 40px rgba(23, 33, 43, .16);
	height: min(560px, calc(100vh - 90px));
	overflow: hidden;
}
.pt-catoverlay {
	position: fixed;
	inset: 0;
	z-index: 40;
	background: rgba(23, 33, 43, .35);
}
.pt-catnav {
	flex: 0 0 300px;
	list-style: none;
	margin: 0;
	padding: 8px;
	border-right: 1px solid var(--pk-line);
	overflow-y: auto;
}
.pt-catnav__a {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 8px 10px;
	border-radius: 8px;
	color: var(--pk-ink);
	text-decoration: none;
	font-weight: 500;
	font-size: 15px;
}
.pt-catnav__a:hover, .pt-catnav__a.is-active { background: var(--pk-surface); color: var(--pk-accent); }
.pt-catnav__img {
	flex: 0 0 38px;
	height: 38px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--pk-surface);
}
.pt-catnav__img img, .pt-catsub__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center top;
	display: block;
}
.pt-catnav__name { flex: 1; min-width: 0; line-height: 1.3; }
.pt-catnav__n { font-size: 12px; color: var(--pk-muted); }
.pt-catnav__chev { width: 16px; height: 16px; flex: none; color: var(--pk-muted); }
.pt-catsub {
	flex: 1;
	min-width: 0;
	padding: 20px 24px 24px;
	overflow-y: auto;
}
.pt-catsub__back { display: none; }
.pt-catsub__head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 16px;
}
.pt-catsub__head h3 { margin: 0; font-size: 20px; font-weight: 800; line-height: 1.25; }
.pt-catsub__head a { color: var(--pk-accent); font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; }
.pt-catsub__head a:hover { text-decoration: underline; }
.pt-catsub__grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
	gap: 12px;
}
.pt-catsub__grid a {
	display: flex;
	flex-direction: column;
	height: 100%;
	border: 1px solid var(--pk-line);
	border-radius: 10px;
	overflow: hidden;
	color: var(--pk-ink);
	text-decoration: none;
	transition: border-color .15s, box-shadow .15s;
}
.pt-catsub__grid a:hover { border-color: var(--pk-accent); box-shadow: 0 6px 16px rgba(23, 33, 43, .08); }
.pt-catsub__img { display: block; flex: none; height: 160px; overflow: hidden; background: var(--pk-surface); }
.pt-catsub__name { padding: 8px 10px 0; font-weight: 600; font-size: 14px; line-height: 1.3; }
.pt-catsub__n { padding: 2px 10px 10px; font-size: 12px; color: var(--pk-muted); }
.pt-catsub__empty a { color: var(--pk-accent); font-weight: 600; }

@media (max-width: 860px) {
	.pt-catpanel__in { padding: 0; }
	.pt-catbox {
		display: block;
		height: auto;
		max-height: calc(100vh - 130px);
		overflow-y: auto;
		border-radius: 0 0 12px 12px;
	}
	.pt-catnav { border-right: 0; overflow: visible; }
	.pt-catsub { display: none; padding: 16px; overflow: visible; }
	.pt-catbox.is-sub .pt-catnav { display: none; }
	.pt-catbox.is-sub .pt-catsub { display: block; }
	.pt-catnav__a.is-active { background: none; color: var(--pk-ink); }
	.pt-catsub__back {
		display: inline-block;
		margin: 0 0 12px;
		padding: 0;
		border: 0;
		background: none;
		color: var(--pk-accent);
		font: 600 15px/1.4 var(--pk-font);
		cursor: pointer;
	}
	.pt-catsub__head { flex-direction: column; gap: 4px; }
	.pt-catsub__grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
	.pt-catsub__img { height: 130px; }
}
@media (max-width: 480px) {
	.pt-catbtn { padding: 10px 12px; }
	.pt-catbtn span { display: none; }
}
