/*
Theme Name: BIP Łukasiewicz – ITEE
Description: Motyw Biuletynu Informacji Publicznej w kolorystyce Sieci Badawczej Łukasiewicz. Współpracuje z wtyczką „BIP – Zamówienia publiczne”. Po włączeniu sam tworzy strony, menu i stronę główną.
Version: 1.3.1
Requires at least: 6.4
Requires PHP: 8.0
Author: Łukasiewicz – ITEE
Text Domain: bip-itee
License: GPL-2.0-or-later
*/

/* ---------- Tokeny ---------- */
:root {
	--zielen: #44d62c;          /* Pantone 802 C – tylko tło i akcenty, nigdy tekst na białym */
	--zielen-ciemna: #1e6b12;   /* linki i fokus na jasnym tle – kontrast 6,6:1 */
	--zielen-jasna: #eef9eb;
	--czern: #000;
	--tekst: #111;
	--szary: #595959;
	--linia: #d6d6d6;
	--tlo-jasne: #f4f6f4;
	--biel: #fff;
	--font: Verdana, Geneva, "DejaVu Sans", sans-serif;
	--szer: 1200px;
	--r: 2px;
	--skala: 1;
}

html { font-size: calc(100% * var(--skala)); }
html.bip-a1 { --skala: 1.15; }
html.bip-a2 { --skala: 1.3; }

*, *::before, *::after { box-sizing: border-box; }
body {
	margin: 0;
	font-family: var(--font);
	font-size: 1rem;
	line-height: 1.6;
	color: var(--tekst);
	background: var(--biel);
	-webkit-text-size-adjust: 100%;
}
img { max-width: 100%; height: auto; }
a { color: var(--zielen-ciemna); text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { color: var(--czern); text-decoration-color: var(--zielen); text-decoration-thickness: 3px; }
:focus-visible { outline: 3px solid var(--czern); outline-offset: 2px; box-shadow: 0 0 0 6px var(--zielen); }
h1, h2, h3, h4 { line-height: 1.25; font-weight: 700; margin: 1.6em 0 .6em; color: var(--czern); }
h1 { font-size: 1.85rem; margin-top: 0; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.12rem; }
p, ul, ol, dl, table { margin: 0 0 1.1em; }
hr { border: 0; border-top: 1px solid var(--linia); margin: 2em 0; }

.wrap { max-width: var(--szer); margin: 0 auto; padding: 0 24px; }
.screen-reader-text { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(1px,1px,1px,1px); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--czern); color: var(--biel); padding: 10px 16px; font-weight: 700; }
.skip-link:focus { top: 12px; color: var(--biel); }

/* ---------- Pasek górny ---------- */
.topbar { background: var(--czern); color: var(--biel); font-size: .8rem; }
.topbar .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; flex-wrap: wrap; }
.topbar a { color: var(--biel); text-decoration: none; }
.topbar a:hover { color: var(--zielen); }
.topbar__links { display: flex; gap: 20px; flex-wrap: wrap; }
.a11y { display: flex; align-items: center; gap: 6px; }
.a11y__label { margin-right: 4px; opacity: .85; }
.a11y button {
	font: inherit; font-weight: 700; color: var(--biel); background: transparent;
	border: 1px solid #666; border-radius: var(--r); min-width: 32px; min-height: 28px; padding: 0 8px; cursor: pointer; line-height: 1;
}
.a11y button[aria-pressed="true"] { background: var(--zielen); color: var(--czern); border-color: var(--zielen); }
.a11y button:hover { border-color: var(--zielen); }
.a11y .a11y-a1 { font-size: 1.05em; } .a11y .a11y-a2 { font-size: 1.2em; }

/* ---------- Nagłówek ---------- */
.masthead { border-bottom: 1px solid var(--linia); }
.masthead .wrap { display: flex; align-items: center; gap: 28px; padding-top: 22px; padding-bottom: 22px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 20px; text-decoration: none; color: var(--czern); flex: 1 1 auto; min-width: 260px; }
.brand:hover { color: var(--czern); }
.brand .custom-logo { max-height: 72px; width: auto; display: block; }
.brand__mark { display: flex; flex-direction: column; line-height: 1.15; }
.brand__lukasiewicz { font-weight: 700; font-size: 1.7rem; letter-spacing: -.01em; }
.brand__instytut { font-size: .95rem; }
.brand__sep { width: 2px; align-self: stretch; background: var(--zielen); }
.brand__bip { display: flex; flex-direction: column; line-height: 1.2; }
.brand__bip strong { font-size: 1.05rem; }
.brand__bip span { font-size: .82rem; color: var(--szary); }

.bip-logo { display: inline-flex; align-items: center; text-decoration: none; }
.bip-logo img { height: 56px; width: auto; display: block; }
.bip-logo__txt { display: inline-flex; align-items: center; justify-content: center; font-weight: 700; color: var(--biel); background: #c8102e; height: 48px; padding: 0 14px; border-radius: var(--r); letter-spacing: .04em; }

.search { display: flex; flex: 0 1 340px; }
.search input[type="search"] {
	flex: 1; min-width: 0; font: inherit; font-size: .95rem; padding: 10px 12px;
	border: 2px solid var(--czern); border-right: 0; border-radius: var(--r) 0 0 var(--r); background: var(--biel); color: var(--tekst);
}
.search button {
	font: inherit; font-weight: 700; font-size: .95rem; background: var(--zielen); color: var(--czern);
	border: 2px solid var(--czern); border-radius: 0 var(--r) var(--r) 0; padding: 0 18px; cursor: pointer;
}
.search button:hover { background: var(--czern); color: var(--zielen); }

/* ---------- Menu ---------- */
.nav { background: var(--tlo-jasne); border-bottom: 4px solid var(--zielen); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.nav li { margin: 0; }
.nav a { display: block; padding: 14px 13px; color: var(--czern); text-decoration: none; font-weight: 700; font-size: .88rem; border-bottom: 4px solid transparent; margin-bottom: -4px; }
.nav a:hover { background: var(--biel); border-bottom-color: var(--czern); color: var(--czern); }
.nav .current-menu-item > a, .nav .current_page_item > a, .nav a[aria-current="page"] { background: var(--biel); border-bottom-color: var(--czern); }
.nav__toggle { display: none; }

/* ---------- Treść ---------- */
.site-main { padding: 28px 0 56px; min-height: 50vh; }
.home .site-main { padding-top: 0; }
.breadcrumbs { font-size: .82rem; color: var(--szary); margin-bottom: 18px; }
.breadcrumbs ol { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px 0; }
.breadcrumbs li + li::before { content: "›"; margin: 0 8px; color: var(--szary); }
.breadcrumbs a { color: var(--szary); }
.page-title { padding-bottom: 14px; margin-bottom: 24px; border-bottom: 2px solid var(--czern); }
.entry > *:first-child { margin-top: 0; }
.entry ul, .entry ol { padding-left: 1.4em; }
.entry li { margin: .25em 0; }
.entry table:not(.bipz-tabela):not(.bipz-dane) { border-collapse: collapse; width: 100%; }
.entry table:not(.bipz-tabela):not(.bipz-dane) th, .entry table:not(.bipz-tabela):not(.bipz-dane) td { border: 1px solid var(--linia); padding: .5em .7em; text-align: left; }

/* ---------- Strona główna ---------- */
.hero { background: var(--zielen-jasna); border-bottom: 1px solid var(--linia); }
.hero .wrap { padding-top: 40px; padding-bottom: 40px; display: grid; grid-template-columns: 1fr auto; gap: 32px; align-items: center; }
.hero h1 { font-size: 2.1rem; margin: 0 0 .35em; }
.hero__podmiot { font-size: 1.05rem; margin: 0 0 .9em; }
.hero__intro { max-width: 62ch; margin: 0; }
.hero__intro p:last-child { margin-bottom: 0; }
.hero__badge { border-left: 6px solid var(--zielen); background: var(--biel); padding: 16px 20px; font-size: .9rem; min-width: 260px; }
.hero__badge strong { display: block; font-size: 1.6rem; line-height: 1.1; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; margin: 36px 0 44px; padding: 0; list-style: none; }
.tile { margin: 0; }
.tile a {
	display: flex; flex-direction: column; height: 100%; padding: 22px 22px 20px; text-decoration: none; color: var(--tekst);
	border: 1px solid var(--linia); border-top: 6px solid var(--zielen); background: var(--biel); transition: border-color .15s, box-shadow .15s;
}
.tile a:hover { border-color: var(--czern); border-top-color: var(--czern); box-shadow: 0 6px 18px rgba(0,0,0,.08); color: var(--tekst); }
.tile__name { font-weight: 700; font-size: 1.1rem; color: var(--czern); margin-bottom: 6px; display: flex; justify-content: space-between; gap: 8px; }
.tile__name::after { content: "→"; }
.tile__desc { font-size: .88rem; color: var(--szary); }
.tile__count { margin-top: auto; padding-top: 12px; font-size: .82rem; font-weight: 700; }

.home-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 36px; align-items: start; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 2px solid var(--czern); margin-bottom: 18px; }
.section-head h2 { margin: 0 0 10px; }
.section-head a { font-size: .88rem; font-weight: 700; white-space: nowrap; }
.box { background: var(--tlo-jasne); border-left: 6px solid var(--zielen); padding: 20px 22px; margin-bottom: 24px; }
.box h2 { margin-top: 0; font-size: 1.15rem; }
.box p:last-child, .box dl:last-child { margin-bottom: 0; }

.latest { list-style: none; margin: 0; padding: 0; }
.latest li { border-bottom: 1px solid var(--linia); padding: 16px 0; display: grid; grid-template-columns: 110px 1fr; gap: 16px; }
.latest li:first-child { padding-top: 0; }
.latest__date { font-size: .88rem; font-weight: 700; }
.latest__title { font-weight: 700; display: block; margin-bottom: 4px; }
.latest__meta { font-size: .82rem; color: var(--szary); }
.latest__meta a { color: var(--szary); }

/* ---------- Wtyczka BIP: dopasowanie ---------- */
.bipz-tabela, .bipz-dane { font-size: .92rem; }
.bipz-tabela th, .bipz-tabela td, .bipz-dane th, .bipz-dane td { border-color: var(--linia); padding: .7em .85em; }
.bipz-tabela thead th { background: var(--czern); color: var(--biel); font-weight: 700; border-color: var(--czern); }
.bipz-tabela tbody tr:nth-child(even) { background: var(--tlo-jasne); }
.bipz-tabela td a { font-weight: 700; }
.bipz-tabela small { color: var(--szary); }
.bipz-dane th { background: var(--tlo-jasne); color: var(--czern); }
.bipz-filtry { background: var(--tlo-jasne); padding: 14px 16px; border-left: 6px solid var(--zielen); }
.bipz-filtry label { font-weight: 700; font-size: .82rem; gap: 4px; }
.bipz-filtry select, .bipz-filtry input { font: inherit; font-size: .92rem; font-weight: 400; border: 2px solid var(--czern); border-radius: var(--r); background: var(--biel); padding: 7px 10px; }
.bipz-filtry button { font: inherit; font-weight: 700; font-size: .92rem; background: var(--czern); color: var(--biel); border: 2px solid var(--czern); border-radius: var(--r); padding: 8px 18px; cursor: pointer; }
.bipz-filtry button:hover { background: var(--zielen); color: var(--czern); }
.bipz-status { border-radius: var(--r); font-weight: 700; font-size: .8rem; }
.bipz-info { background: var(--zielen-jasna); border-left: 6px solid var(--zielen); padding: 14px 18px; }
.bipz-metryczka { border-top: 2px solid var(--czern); background: var(--tlo-jasne); padding: 18px 20px; margin-top: 2.5em; }
.bipz-metryczka .bipz-naglowek { margin-top: 0; font-size: 1.05rem; }
.bipz-metryczka dt { color: var(--szary); font-weight: 400; }
.bipz-metryczka dd { font-weight: 700; }
.bipz-historia summary { padding: 10px 0; }
.bipz-stronicowanie .page-numbers { border-color: var(--czern); color: var(--czern); text-decoration: none; min-width: 2.2em; text-align: center; }
.bipz-stronicowanie .current { background: var(--czern); color: var(--biel); }
.bipz-redakcja dt { color: var(--szary); font-weight: 400; }
.bipz-redakcja dd { font-weight: 700; }

/* ---------- Wyniki wyszukiwania ---------- */
.results { list-style: none; padding: 0; margin: 0; }
.results li { padding: 16px 0; border-bottom: 1px solid var(--linia); }
.results a { font-weight: 700; font-size: 1.05rem; }
.results__type { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--szary); display: block; margin-bottom: 2px; }
.pagination { margin-top: 24px; }
.pagination .page-numbers { display: inline-block; padding: 6px 12px; border: 1px solid var(--czern); margin-right: 4px; text-decoration: none; color: var(--czern); }
.pagination .current { background: var(--czern); color: var(--biel); }

/* ---------- Stopka ---------- */
.site-footer { background: #111; color: #e6e6e6; font-size: .88rem; border-top: 6px solid var(--zielen); }
.site-footer .wrap { padding-top: 40px; padding-bottom: 24px; }
.site-footer a { color: var(--biel); }
.site-footer a:hover { color: var(--zielen); text-decoration-color: var(--zielen); }
.footer-cols { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; }
.footer-cols h2 { color: var(--zielen); font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; margin: 0 0 12px; }
.footer-cols ul { list-style: none; margin: 0; padding: 0; }
.footer-cols li { margin: 0 0 8px; }
.footer-cols p { margin: 0 0 6px; }
.footer-bottom { border-top: 1px solid #333; margin-top: 32px; padding-top: 16px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: #bdbdbd; font-size: .8rem; }

/* ---------- Wysoki kontrast ---------- */
html.bip-kontrast, html.bip-kontrast body { background: #000 !important; color: #ffe600 !important; }
html.bip-kontrast *:not(img) { background-color: #000 !important; color: #ffe600 !important; border-color: #ffe600 !important; box-shadow: none !important; }
html.bip-kontrast a, html.bip-kontrast a * { color: #fff !important; text-decoration: underline !important; }
html.bip-kontrast button[aria-pressed="true"] { background: #ffe600 !important; color: #000 !important; }
html.bip-kontrast :focus-visible { outline-color: #fff !important; }

/* ---------- Telefony i tablety ---------- */
@media (max-width: 900px) {
	.tiles { grid-template-columns: repeat(2, 1fr); }
	.home-grid { grid-template-columns: 1fr; }
	.footer-cols { grid-template-columns: 1fr 1fr; }
	.hero .wrap { grid-template-columns: 1fr; }
	.hero__badge { min-width: 0; }
}
@media (max-width: 640px) {
	.wrap { padding: 0 16px; }
	h1, .hero h1 { font-size: 1.5rem; }
	.topbar__links { display: none; }
	.topbar .wrap { justify-content: flex-end; }
	.masthead .wrap { gap: 16px; padding-top: 16px; padding-bottom: 16px; }
	.brand { min-width: 0; gap: 12px; }
	.brand__lukasiewicz { font-size: 1.3rem; }
	.brand__sep, .brand__bip { display: none; }
	.bip-logo img { height: 44px; } .bip-logo__txt { height: 40px; }
	.brand { flex: 1 1 0; }
	.bip-logo { order: 2; }
	.search { flex: 1 1 100%; order: 3; }
	.section-head { flex-wrap: wrap; }
	.section-head a { margin-bottom: 10px; }
	.nav__toggle {
		display: flex; width: 100%; align-items: center; justify-content: space-between; font: inherit; font-weight: 700;
		background: transparent; border: 0; padding: 14px 16px; cursor: pointer; color: var(--czern);
	}
	.nav__toggle::after { content: "☰"; font-size: 1.3rem; }
	.nav__toggle[aria-expanded="true"]::after { content: "✕"; }
	.nav .wrap { padding: 0; }
	.nav ul { display: none; flex-direction: column; border-top: 1px solid var(--linia); }
	.nav.is-open ul { display: flex; }
	.nav a { border-bottom: 1px solid var(--linia); margin: 0; }
	.tiles { grid-template-columns: 1fr; gap: 12px; margin: 24px 0 32px; }
	.latest li { grid-template-columns: 1fr; gap: 4px; }
	.footer-cols { grid-template-columns: 1fr; }
}

/* ---------- Druk ---------- */
@media print {
	.topbar, .nav, .search, .site-footer, .bipz-filtry, .bipz-stronicowanie, .skip-link { display: none !important; }
	a { color: #000; }
	.bipz-historia { display: block; }
}

.hero__badge { display: block; color: var(--tekst); text-decoration: none; }
.hero__badge:hover { color: var(--tekst); outline: 2px solid var(--czern); }
