/* ==========================================================================
   Tėvų biblioteka – viešoji dalis
   Spalva valdoma iš nustatymų (--tb-accent). Išdėstymas prisitaiko prie
   turinio srities pločio (container queries), ne tik ekrano.
   ========================================================================== */

.tb-wrap {
	--tb-accent: #2e7d32;
	--tb-accent-dark: color-mix(in srgb, var(--tb-accent) 76%, #000);
	--tb-soft: color-mix(in srgb, var(--tb-accent) 9%, #fff);
	--tb-soft-2: color-mix(in srgb, var(--tb-accent) 20%, #fff);
	--tb-line: color-mix(in srgb, var(--tb-accent) 14%, transparent);
	--tb-text: #1f2a20;
	--tb-muted: #66706a;
	--tb-border: #e2e8e3;
	--tb-radius: 8px;
	--tb-shadow: 0 1px 2px rgba(16, 40, 20, .06), 0 4px 14px rgba(16, 40, 20, .07);
	--tb-shadow-hover: 0 2px 4px rgba(16, 40, 20, .07), 0 12px 26px rgba(16, 40, 20, .12);

	container-type: inline-size;
	container-name: tb;
	color: var(--tb-text);
	font-size: 16px;
	line-height: 1.5;
	margin: 0 0 2.5rem;
}

@supports not (color: color-mix(in srgb, red, blue)) {
	.tb-wrap {
		--tb-accent-dark: #1b5e20;
		--tb-soft: #e8f5e9;
		--tb-soft-2: #c8e6c9;
		--tb-line: rgba(46, 125, 50, .15);
	}
}

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

.tb-wrap a { text-decoration: none; box-shadow: none; }
.tb-wrap h1, .tb-wrap h2, .tb-wrap h3 { margin: 0; padding: 0; border: 0; text-transform: none; letter-spacing: normal; }
.tb-wrap .dashicons { vertical-align: middle; }

.tb-wrap .screen-reader-text {
	position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
	overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* ---------- Mygtukai ---------- */

.tb-wrap .tb-btn {
	display: inline-flex; align-items: center; gap: 6px;
	background: var(--tb-accent); color: #fff;
	font-weight: 600; font-size: 14.5px; line-height: 1.3;
	padding: 8px 15px; border: 0; border-radius: 5px; cursor: pointer;
	transition: background-color .15s ease, color .15s ease;
}
.tb-wrap .tb-btn:hover,
.tb-wrap .tb-btn:focus-visible { background: var(--tb-accent-dark); color: #fff; }
.tb-wrap .tb-btn .dashicons { font-size: 17px; width: 17px; height: 17px; }

.tb-wrap .tb-btn-ghost {
	background: transparent; color: var(--tb-accent-dark);
	box-shadow: inset 0 0 0 1.5px var(--tb-accent);
}
.tb-wrap .tb-btn-ghost:hover,
.tb-wrap .tb-btn-ghost:focus-visible { background: var(--tb-soft); color: var(--tb-accent-dark); }

.tb-wrap a:focus-visible,
.tb-wrap button:focus-visible { outline: 3px solid var(--tb-soft-2); outline-offset: 2px; }

/* ---------- Antraštė ---------- */

.tb-head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 16px; flex-wrap: wrap; margin: 0 0 22px;
}
.tb-wrap .tb-head-title {
	display: inline-flex; align-items: center; gap: 10px;
	color: var(--tb-accent); font-size: 28px; font-weight: 700; line-height: 1.2;
}
.tb-head-icon.dashicons { font-size: 28px; width: 28px; height: 28px; }
.tb-wrap .tb-logout {
	display: inline-flex; align-items: center; gap: 5px;
	font-size: 14px; color: var(--tb-muted);
	padding: 6px 13px; border: 1px solid var(--tb-border); border-radius: 999px; background: #fff;
}
.tb-wrap .tb-logout:hover { color: var(--tb-accent-dark); border-color: var(--tb-accent); }
.tb-logout .dashicons { font-size: 16px; width: 16px; height: 16px; }

.tb-staff-note {
	display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
	background: #fff8e1; border: 1px solid #ffe08a; color: #6b5200;
	padding: 8px 12px; border-radius: 6px; font-size: 14px; margin: -6px 0 20px;
}
.tb-wrap .tb-staff-note a { color: #6b5200; font-weight: 600; margin-left: auto; }

/* ---------- Išdėstymas ---------- */

.tb-layout {
	display: grid;
	grid-template-columns: 270px minmax(0, 1fr);
	gap: 28px;
	align-items: start;
}
.tb-main { min-width: 0; }

/* ---------- Kairė juosta ---------- */

.tb-sidebar { display: flex; flex-direction: column; gap: 20px; }

.tb-search {
	display: flex; background: #fff;
	border: 1px solid var(--tb-border); border-radius: 6px; overflow: hidden;
	box-shadow: var(--tb-shadow);
}
.tb-search:focus-within { border-color: var(--tb-accent); }
.tb-wrap .tb-search input[type="search"] {
	flex: 1; min-width: 0; margin: 0; height: auto;
	border: 0; border-radius: 0; box-shadow: none; outline: none; background: transparent;
	padding: 10px 12px; font-size: 15px; color: var(--tb-text);
}
.tb-wrap .tb-search button {
	flex: none; margin: 0; border: 0; border-radius: 0; cursor: pointer;
	background: var(--tb-accent); color: #fff; padding: 0 14px;
}
.tb-wrap .tb-search button:hover { background: var(--tb-accent-dark); }

.tb-panel {
	background: var(--tb-soft);
	border-left: 4px solid var(--tb-accent);
	border-radius: 0 var(--tb-radius) var(--tb-radius) 0;
	box-shadow: var(--tb-shadow);
	overflow: hidden;
}
.tb-panel-title {
	background: var(--tb-accent); color: #fff;
	font-weight: 700; font-size: 15.5px; letter-spacing: .02em; text-transform: uppercase;
	padding: 11px 16px;
}

.tb-wrap .tb-cats,
.tb-wrap .tb-cats-sub,
.tb-wrap .tb-pinned,
.tb-wrap .tb-files ul,
.tb-wrap .tb-pagination ul { list-style: none; margin: 0; padding: 0; }

.tb-wrap .tb-cats { padding: 8px; }
.tb-wrap .tb-cats li { margin: 0; padding: 0; }
.tb-wrap .tb-cats > li + li { border-top: 1px solid var(--tb-line); }
.tb-wrap .tb-cats-sub { padding: 2px 0 6px 18px; }
.tb-cats li:not(.is-open) > .tb-cats-sub { display: none; }

.tb-wrap .tb-cat {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 10px; margin: 2px 0; border-radius: 6px;
	color: var(--tb-accent-dark); font-weight: 600; font-size: 15px; line-height: 1.3;
	transition: background-color .12s ease;
}
.tb-wrap .tb-cats-sub .tb-cat { font-size: 14.5px; font-weight: 500; padding: 7px 10px; }
.tb-wrap .tb-cat:hover { background: rgba(255, 255, 255, .75); color: var(--tb-accent-dark); }
.tb-wrap .tb-cat.is-active,
.tb-wrap .tb-cat.is-active:hover { background: var(--tb-accent); color: #fff; }
.tb-cat .dashicons { flex: none; font-size: 18px; width: 18px; height: 18px; }
.tb-cat-name { flex: 1; min-width: 0; }
.tb-cat-count {
	flex: none; min-width: 26px; text-align: center;
	font-size: 12px; font-weight: 700; padding: 1px 7px; border-radius: 999px;
	background: #fff; color: var(--tb-accent-dark);
}
.tb-cat.is-active .tb-cat-count { background: rgba(255, 255, 255, .22); color: #fff; }

.tb-wrap .tb-pinned { padding: 2px 16px 8px; }
.tb-wrap .tb-pinned li { padding: 11px 0; margin: 0; border-bottom: 1px solid var(--tb-line); }
.tb-wrap .tb-pinned li:last-child { border-bottom: 0; }
.tb-wrap .tb-pinned a { display: block; color: var(--tb-accent); font-weight: 600; font-size: 15.5px; line-height: 1.35; }
.tb-wrap .tb-pinned a:hover { color: var(--tb-accent-dark); text-decoration: underline; }
.tb-pinned-date { display: block; margin-top: 3px; font-size: 12.5px; color: var(--tb-muted); }

/* ---------- Turinio antraštė ---------- */

.tb-main-head {
	display: flex; align-items: center; justify-content: space-between;
	gap: 12px; flex-wrap: wrap; margin: 0 0 16px;
}
.tb-wrap .tb-section-title {
	display: flex; align-items: center; gap: 9px;
	color: var(--tb-accent); font-size: 24px; font-weight: 700; line-height: 1.25;
}
.tb-section-title .dashicons { font-size: 24px; width: 24px; height: 24px; }
.tb-wrap .tb-section-title-sm { font-size: 20px; margin-bottom: 14px; }
.tb-found {
	font-size: 13.5px; color: var(--tb-muted);
	background: #fff; border: 1px solid var(--tb-border); border-radius: 999px; padding: 3px 11px;
}

.tb-intro,
.tb-term-desc {
	background: #fff; border-left: 4px solid var(--tb-accent);
	border-radius: 0 6px 6px 0; box-shadow: var(--tb-shadow);
	padding: 14px 18px; margin: 0 0 22px; font-size: 15.5px;
}
.tb-intro p, .tb-term-desc p { margin: 0 0 .6em; }
.tb-intro p:last-child, .tb-term-desc p:last-child { margin-bottom: 0; }

.tb-alert {
	background: #fdecea; color: #8a1c1c; border: 1px solid #f5c2c0;
	padding: 10px 14px; border-radius: 6px; font-size: 14.5px; margin: 0 0 16px; text-align: left;
}
.tb-alert-info { background: var(--tb-soft); color: var(--tb-accent-dark); border-color: var(--tb-soft-2); }

.tb-empty {
	text-align: center; padding: 48px 20px; color: var(--tb-muted);
	background: #fff; border-radius: var(--tb-radius); box-shadow: var(--tb-shadow);
}
.tb-empty .dashicons { font-size: 42px; width: 42px; height: 42px; color: var(--tb-soft-2); }
.tb-empty p { margin: 10px 0 16px; }

/* ---------- Kortelės ---------- */

.tb-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 22px;
}
.tb-grid-related { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }

.tb-card {
	display: flex; flex-direction: column;
	background: #fff; border-radius: var(--tb-radius); box-shadow: var(--tb-shadow);
	overflow: hidden; transition: transform .15s ease, box-shadow .15s ease;
}
.tb-card:hover { transform: translateY(-2px); box-shadow: var(--tb-shadow-hover); }
.tb-card.is-pinned { box-shadow: 0 0 0 2px #f2c94c, var(--tb-shadow); }

.tb-card-media {
	position: relative; display: block; aspect-ratio: 16 / 9;
	background: var(--tb-soft); overflow: hidden;
}
.tb-card-media img {
	display: block; width: 100%; height: 100%; object-fit: cover;
	margin: 0; border-radius: 0; transition: transform .35s ease;
}
.tb-card:hover .tb-card-media img { transform: scale(1.035); }
.tb-card-ph {
	display: flex; width: 100%; height: 100%; align-items: center; justify-content: center;
	background:
		radial-gradient(circle at 85% 15%, rgba(255, 255, 255, .55) 0 18%, transparent 19%),
		linear-gradient(135deg, var(--tb-soft) 0%, var(--tb-soft-2) 100%);
}
.tb-card-ph .dashicons { font-size: 58px; width: 58px; height: 58px; color: var(--tb-accent); opacity: .5; }

.tb-badges { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; }
.tb-badge {
	display: inline-flex; align-items: center; gap: 3px;
	font-size: 12px; font-weight: 700; line-height: 1.4;
	padding: 3px 9px; border-radius: 999px;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .18);
}
.tb-badge .dashicons { font-size: 13px; width: 13px; height: 13px; }
.tb-badge-pin { background: #fff8e1; color: #7a5d00; }
.tb-badge-new { background: var(--tb-accent); color: #fff; }

.tb-card-body { display: flex; flex-direction: column; gap: 8px; flex: 1; padding: 15px 16px 18px; }

.tb-wrap .tb-chip {
	align-self: flex-start; display: inline-flex; align-items: center; gap: 4px;
	font-size: 12.5px; font-weight: 600; line-height: 1.4;
	color: var(--tb-accent-dark); background: var(--tb-soft);
	padding: 3px 10px 3px 7px; border-radius: 999px;
}
.tb-wrap a.tb-chip:hover { background: var(--tb-soft-2); }
.tb-chip .dashicons { font-size: 15px; width: 15px; height: 15px; }

.tb-wrap .tb-card-title { font-size: 18px; line-height: 1.3; font-weight: 600; }
.tb-wrap .tb-card-title a { color: var(--tb-text); }
.tb-wrap .tb-card-title a:hover { color: var(--tb-accent); }

.tb-card-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13.5px; color: var(--tb-muted); }
.tb-card-files { display: inline-flex; align-items: center; gap: 2px; color: var(--tb-accent-dark); font-weight: 600; }
.tb-card-files .dashicons { font-size: 16px; width: 16px; height: 16px; }

.tb-wrap .tb-card-excerpt {
	margin: 0; font-size: 14.5px; line-height: 1.5; color: #3b453d;
	display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
.tb-card .tb-btn { margin-top: auto; align-self: flex-start; }
.tb-card-body > :nth-last-child(2) { margin-bottom: 6px; }

/* ---------- Puslapiavimas ---------- */

.tb-pagination { margin-top: 28px; }
.tb-wrap .tb-pagination ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.tb-wrap .tb-pagination li { margin: 0; }
.tb-wrap .tb-pagination li > .page-numbers {
	display: inline-flex; align-items: center; justify-content: center;
	min-width: 38px; height: 38px; padding: 0 10px; border-radius: 6px;
	background: #fff; box-shadow: var(--tb-shadow);
	color: var(--tb-accent-dark); font-weight: 600;
}
.tb-wrap .tb-pagination li > a.page-numbers:hover { background: var(--tb-soft); }
.tb-wrap .tb-pagination li > .current { background: var(--tb-accent); color: #fff; }
.tb-wrap .tb-pagination li > .dots { background: transparent; box-shadow: none; }

/* ---------- Vienas įrašas ---------- */

.tb-crumbs {
	display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
	font-size: 14px; color: var(--tb-muted); margin: 0 0 14px;
}
.tb-wrap .tb-crumbs a { color: var(--tb-accent); font-weight: 500; }
.tb-wrap .tb-crumbs a:hover { text-decoration: underline; }
.tb-crumbs-current { color: var(--tb-text); max-width: 46ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tb-article {
	background: #fff; border-radius: var(--tb-radius); box-shadow: var(--tb-shadow);
	padding: 28px 32px 24px;
}
.tb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 12px; }
.tb-wrap .tb-article-title {
	font-size: 30px; line-height: 1.22; font-weight: 700; color: var(--tb-text); margin: 0 0 8px;
}
.tb-article-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 14px; color: var(--tb-muted); margin: 0 0 22px; }

.tb-article-image { margin: 0 0 24px; }
.tb-article-image img { display: block; width: 100%; max-height: 460px; object-fit: cover; border-radius: 6px; }

.tb-content { font-size: 16.5px; line-height: 1.7; overflow-wrap: break-word; }
.tb-content > :first-child { margin-top: 0; }
.tb-content > :last-child { margin-bottom: 0; }
.tb-wrap .tb-content p { margin: 0 0 1em; }
.tb-wrap .tb-content h2 { font-size: 22px; line-height: 1.3; margin: 1.5em 0 .5em; color: var(--tb-accent-dark); }
.tb-wrap .tb-content h3 { font-size: 19px; line-height: 1.35; margin: 1.3em 0 .45em; color: var(--tb-text); }
.tb-wrap .tb-content ul,
.tb-wrap .tb-content ol { margin: 0 0 1em 1.4em; padding: 0; }
.tb-wrap .tb-content ul { list-style: disc; }
.tb-wrap .tb-content ol { list-style: decimal; }
.tb-wrap .tb-content li { margin: .3em 0; }
.tb-wrap .tb-content a { color: var(--tb-accent); text-decoration: underline; text-underline-offset: 2px; }
.tb-wrap .tb-content a:hover { color: var(--tb-accent-dark); }
.tb-wrap .tb-content img { max-width: 100%; height: auto; border-radius: 6px; }
.tb-wrap .tb-content table { width: 100%; border-collapse: collapse; margin: 0 0 1em; font-size: 15px; }
.tb-wrap .tb-content th,
.tb-wrap .tb-content td { border: 1px solid var(--tb-border); padding: 8px 10px; text-align: left; vertical-align: top; }
.tb-wrap .tb-content th { background: var(--tb-soft); }
.tb-wrap .tb-content blockquote {
	margin: 1em 0; padding: 12px 18px; border-left: 4px solid var(--tb-accent);
	background: var(--tb-soft); border-radius: 0 6px 6px 0; font-style: normal;
}

/* Dokumentai */
.tb-files { margin-top: 30px; padding-top: 22px; border-top: 1px solid var(--tb-border); }
.tb-wrap .tb-files h2 { display: flex; align-items: center; gap: 8px; font-size: 19px; color: var(--tb-text); margin: 0 0 14px; }
.tb-files h2 .dashicons { color: var(--tb-accent); }
.tb-files-count {
	font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 999px;
	background: var(--tb-soft); color: var(--tb-accent-dark);
}
.tb-wrap .tb-files ul { display: flex; flex-direction: column; gap: 10px; }
.tb-wrap .tb-file {
	display: flex; align-items: center; gap: 14px; margin: 0;
	padding: 12px 14px; border: 1px solid var(--tb-border); border-radius: 8px; background: #fafcfa;
	transition: border-color .15s ease, background-color .15s ease;
}
.tb-wrap .tb-file:hover { border-color: var(--tb-accent); background: #fff; }
.tb-file-ext {
	flex: none; display: flex; align-items: flex-end; justify-content: center;
	width: 44px; height: 52px; padding-bottom: 8px; border-radius: 5px;
	font-size: 10.5px; font-weight: 800; letter-spacing: .03em; color: #fff;
	background: #78909c;
	clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
}
.tb-kind-pdf { background: #d32f2f; }
.tb-kind-doc { background: #1565c0; }
.tb-kind-xls { background: #2e7d32; }
.tb-kind-ppt { background: #e65100; }
.tb-kind-zip { background: #6d4c41; }
.tb-kind-img { background: #7b1fa2; }
.tb-kind-av  { background: #00838f; }
.tb-file-info { flex: 1; min-width: 0; }
.tb-wrap .tb-file-info a { display: block; color: var(--tb-text); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.tb-wrap .tb-file-info a:hover { color: var(--tb-accent); }
.tb-file-info small { display: block; margin-top: 2px; font-size: 13px; color: var(--tb-muted); }
.tb-file-actions { flex: none; display: flex; gap: 8px; }
.tb-wrap .tb-file-actions .tb-btn { padding: 7px 12px; font-size: 14px; }

.tb-article-foot { margin-top: 26px; }
.tb-wrap .tb-back { color: var(--tb-accent); font-weight: 600; }
.tb-wrap .tb-back:hover { text-decoration: underline; }
.tb-related { margin-top: 34px; }

/* ---------- Prisijungimas ---------- */

.tb-login { display: flex; justify-content: center; padding: 24px 0; }
.tb-login-card {
	width: 100%; max-width: 440px; text-align: center;
	background: #fff; border-radius: 12px; box-shadow: var(--tb-shadow);
	border-top: 5px solid var(--tb-accent); padding: 34px 32px 28px;
}
.tb-login-icon {
	display: flex; align-items: center; justify-content: center;
	width: 66px; height: 66px; margin: 0 auto 14px; border-radius: 50%; background: var(--tb-soft);
}
.tb-login-icon .dashicons { font-size: 30px; width: 30px; height: 30px; color: var(--tb-accent); }
.tb-wrap .tb-login-title { font-size: 24px; font-weight: 700; color: var(--tb-accent); margin: 0 0 8px; }
.tb-wrap .tb-login-text { font-size: 15px; color: var(--tb-muted); margin: 0 0 20px; }
.tb-pw-row { display: flex; gap: 8px; }
.tb-wrap .tb-pw-row input[type="password"] {
	flex: 1; min-width: 0; margin: 0; height: auto;
	padding: 11px 14px; font-size: 16px; color: var(--tb-text);
	background: #fff; border: 1.5px solid var(--tb-border); border-radius: 6px; box-shadow: none;
}
.tb-wrap .tb-pw-row input[type="password"]:focus { border-color: var(--tb-accent); outline: 3px solid var(--tb-soft-2); outline-offset: 0; }
.tb-wrap .tb-pw-row .tb-btn { padding: 11px 18px; font-size: 15px; }
.tb-remember {
	display: flex; align-items: center; justify-content: center; gap: 7px;
	margin-top: 14px; font-size: 14px; color: var(--tb-muted); cursor: pointer;
}
.tb-remember input { margin: 0; accent-color: var(--tb-accent); }

/* ---------- Prisitaikymas prie pločio ---------- */

@container tb (max-width: 760px) {
	.tb-layout { grid-template-columns: minmax(0, 1fr); gap: 18px; }
	.tb-sidebar { gap: 12px; }
	.tb-panel-pinned { display: none; }

	/* Kategorijos tampa horizontalia „čipsų“ juosta */
	.tb-panel-cats { background: transparent; border: 0; box-shadow: none; border-radius: 0; overflow: visible; }
	.tb-panel-cats .tb-panel-title { display: none; }
	.tb-wrap .tb-cats {
		display: flex; gap: 8px; padding: 2px 2px 10px;
		overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch;
	}
	.tb-wrap .tb-cats li,
	.tb-wrap .tb-cats li.is-open > .tb-cats-sub { display: contents; }
	.tb-wrap .tb-cats > li + li { border: 0; }
	.tb-wrap .tb-cat,
	.tb-wrap .tb-cats-sub .tb-cat {
		flex: none; white-space: nowrap; margin: 0;
		padding: 7px 12px; border-radius: 999px; font-size: 14px;
		background: #fff; box-shadow: var(--tb-shadow);
	}
	.tb-wrap .tb-cats-sub .tb-cat { background: var(--tb-soft); }
	.tb-cat .dashicons { font-size: 16px; width: 16px; height: 16px; }

	.tb-wrap .tb-head-title { font-size: 24px; }
	.tb-article { padding: 22px 20px; }
	.tb-wrap .tb-article-title { font-size: 25px; }
}

@container tb (max-width: 520px) {
	.tb-grid { grid-template-columns: minmax(0, 1fr); }
	.tb-wrap .tb-file { flex-wrap: wrap; }
	.tb-file-actions { width: 100%; }
	.tb-wrap .tb-file-actions .tb-btn { flex: 1; justify-content: center; }
	.tb-login-card { padding: 28px 20px 22px; }
	.tb-pw-row { flex-direction: column; }
	.tb-wrap .tb-pw-row .tb-btn { justify-content: center; }
	.tb-crumbs-current { max-width: 100%; }
}
