/**
 * TREJKA Elements – style front-endu (to, co widzi odwiedzający stronę).
 *
 * Kolor akcentu bierze się ze zmiennej --tre-accent (wstrzykiwanej w <head>
 * na podstawie ustawień wtyczki). Jeśli jej nie ma, używamy #bc0000.
 *
 * Wszystkie klasy mają prefiks .tre- żeby nie kolidować z motywem klienta.
 */

/* Kolor akcentu pochodzi ze zmiennej --tre-accent wstrzykiwanej w <head>
   (per strona). NIE nadpisujemy jej lokalnie – używamy fallbacku w var(),
   żeby ustawienie z panelu faktycznie działało. */
.tre-btn,
.tre-columns,
.tre-list,
.tre-gallery,
.tre-divider,
.tre-heading {
	--tre-accent-dark: color-mix(in srgb, var(--tre-accent, #bc0000) 80%, #000);
	--tre-radius: 6px;
	box-sizing: border-box;
}
.tre-columns *,
.tre-list *,
.tre-gallery * { box-sizing: border-box; }

/* ============================================================
   PRZYCISK  [tr_button]
============================================================ */
.tre-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	text-align: center;
	border-radius: var(--tre-radius);
	border: 2px solid transparent;
	cursor: pointer;
	transition: background-color .15s ease, color .15s ease, border-color .15s ease, transform .05s ease, box-shadow .15s ease;
	-webkit-appearance: none;
	appearance: none;
}
.tre-btn:hover  { text-decoration: none; }
.tre-btn:active { transform: translateY(1px); }
.tre-btn:focus-visible { outline: 3px solid color-mix(in srgb, var(--tre-accent, #bc0000) 35%, transparent); outline-offset: 2px; }

/* Rozmiary */
.tre-btn--sm { padding: 7px 16px;  font-size: 14px; }
.tre-btn--md { padding: 11px 24px; font-size: 16px; }
.tre-btn--lg { padding: 15px 34px; font-size: 18px; }

/* Warianty */
.tre-btn--primary {
	background: var(--tre-accent, #bc0000);
	color: #fff;
	border-color: var(--tre-accent, #bc0000);
}
.tre-btn--primary:hover {
	background: var(--tre-accent-dark);
	border-color: var(--tre-accent-dark);
	color: #fff;
	box-shadow: 0 4px 14px color-mix(in srgb, var(--tre-accent, #bc0000) 35%, transparent);
}
.tre-btn--secondary {
	background: #1d2327;
	color: #fff;
	border-color: #1d2327;
}
.tre-btn--secondary:hover { background: #000; border-color: #000; color: #fff; }

.tre-btn--outline {
	background: transparent;
	color: var(--tre-accent, #bc0000);
	border-color: var(--tre-accent, #bc0000);
}
.tre-btn--outline:hover {
	background: var(--tre-accent, #bc0000);
	color: #fff;
}

/* Wyrównanie */
.tre-btn-wrap { display: block; }
.tre-align-left   { text-align: left; }
.tre-align-center { text-align: center; }
.tre-align-right  { text-align: right; }

/* ============================================================
   KOLUMNY  [tr_columns] / [tr_col]
============================================================ */
.tre-columns {
	display: grid;
	grid-template-columns: repeat(var(--tre-cols, 2), minmax(0, 1fr));
	gap: var(--tre-gap, 24px);
	margin: 1.2em 0;
}
.tre-col { min-width: 0; }
.tre-col > :first-child { margin-top: 0; }
.tre-col > :last-child  { margin-bottom: 0; }

/* Tablet – maks. 2 kolumny */
@media (max-width: 900px) {
	.tre-columns { grid-template-columns: repeat(min(var(--tre-cols, 2), 2), minmax(0, 1fr)); }
}
/* Telefon – jedna kolumna */
@media (max-width: 600px) {
	.tre-columns { grid-template-columns: 1fr; }
}

/* ============================================================
   LISTY  [tr_list] / [tr_item]
============================================================ */
.tre-list {
	list-style: none;
	margin: 1em 0;
	padding: 0;
}
.tre-list .tre-list-item {
	position: relative;
	padding: 4px 0 4px 30px;
	margin: 0;
	line-height: 1.55;
}
.tre-list .tre-list-item::before {
	content: "";
	position: absolute;
	left: 0;
	top: 0.35em;
	width: 18px;
	height: 18px;
	background-color: var(--tre-accent, #bc0000);
	-webkit-mask-repeat: no-repeat;
	        mask-repeat: no-repeat;
	-webkit-mask-position: center;
	        mask-position: center;
	-webkit-mask-size: contain;
	        mask-size: contain;
}

/* Ikony jako maski SVG (kolor = --tre-accent) */
.tre-list--check .tre-list-item::before {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20.285 6.709a1 1 0 0 0-1.414-1.418l-8.99 8.99-3.74-3.74A1 1 0 0 0 4.727 12l4.447 4.447a1 1 0 0 0 1.414 0z'/></svg>");
	        mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M20.285 6.709a1 1 0 0 0-1.414-1.418l-8.99 8.99-3.74-3.74A1 1 0 0 0 4.727 12l4.447 4.447a1 1 0 0 0 1.414 0z'/></svg>");
}
.tre-list--arrow .tre-list-item::before {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z'/></svg>");
	        mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M8.59 16.59 13.17 12 8.59 7.41 10 6l6 6-6 6z'/></svg>");
}
.tre-list--star .tre-list-item::before {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/></svg>");
	        mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/></svg>");
}
.tre-list--dot .tre-list-item::before {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='6'/></svg>");
	        mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><circle cx='12' cy='12' r='6'/></svg>");
}
.tre-list--dash .tre-list-item::before {
	-webkit-mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='11' width='16' height='2.5' rx='1.25'/></svg>");
	        mask-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><rect x='4' y='11' width='16' height='2.5' rx='1.25'/></svg>");
}

/* Listy w kilku kolumnach */
.tre-list--cols-2, .tre-list--cols-3 { display: grid; gap: 0 30px; }
.tre-list--cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tre-list--cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 600px) {
	.tre-list--cols-2, .tre-list--cols-3 { grid-template-columns: 1fr; }
}

/* ============================================================
   GALERIA  [tr_gallery]
============================================================ */
.tre-gallery {
	display: grid;
	grid-template-columns: repeat(var(--tre-gcols, 3), minmax(0, 1fr));
	gap: 12px;
	margin: 1.2em 0;
}
.tre-gallery-item {
	display: block;
	position: relative;
	overflow: hidden;
	border-radius: var(--tre-radius);
	line-height: 0;
	background: #f0f0f1;
}
.tre-gallery-item .tre-gallery-img {
	width: 100%;
	height: 100%;
	aspect-ratio: var(--tre-ratio, 1 / 1);
	object-fit: cover;
	display: block;
	transition: transform .3s ease;
}
/* Format oryginalny – bez kadrowania, zdjęcia zachowują naturalne proporcje. */
.tre-gallery--orig .tre-gallery-item { background: transparent; }
.tre-gallery--orig .tre-gallery-item .tre-gallery-img {
	aspect-ratio: auto;
	height: auto;
	object-fit: contain;
}
a.tre-gallery-item { cursor: zoom-in; }
a.tre-gallery-item::after {
	content: "";
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0);
	transition: background .2s ease;
}
a.tre-gallery-item:hover .tre-gallery-img { transform: scale(1.06); }
a.tre-gallery-item:hover::after { background: rgba(0,0,0,.12); }

@media (max-width: 600px) {
	.tre-gallery { grid-template-columns: repeat(min(var(--tre-gcols, 3), 2), minmax(0, 1fr)); }
}

.tre-gallery-empty {
	padding: 20px;
	border: 1px dashed #c3c4c7;
	border-radius: var(--tre-radius);
	color: #646970;
	background: #f6f7f7;
	font-size: 14px;
	text-align: center;
}

/* ============================================================
   LIGHTBOX (budowany przez frontend.js)
============================================================ */
.tre-lb {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(15, 17, 20, .92);
	opacity: 0;
	visibility: hidden;
	transition: opacity .2s ease, visibility .2s ease;
}
.tre-lb.is-open { opacity: 1; visibility: visible; }
.tre-lb__img {
	max-width: 92vw;
	max-height: 82vh;
	border-radius: 4px;
	box-shadow: 0 10px 40px rgba(0,0,0,.5);
	background: #222;
}
.tre-lb__cap {
	position: absolute;
	bottom: 18px;
	left: 0;
	right: 0;
	text-align: center;
	color: #fff;
	font-size: 14px;
	padding: 0 20px;
	text-shadow: 0 1px 3px rgba(0,0,0,.8);
}
.tre-lb__btn {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
	border: none;
	border-radius: 50%;
	background: rgba(255,255,255,.12);
	color: #fff;
	font-size: 26px;
	line-height: 48px;
	cursor: pointer;
	transition: background .15s ease;
}
.tre-lb__btn:hover { background: rgba(255,255,255,.25); }
.tre-lb__prev { left: 18px; }
.tre-lb__next { right: 18px; }
.tre-lb__close {
	top: 18px;
	right: 18px;
	transform: none;
	width: 44px;
	height: 44px;
	line-height: 44px;
	font-size: 22px;
}
.tre-lb__prev, .tre-lb__next, .tre-lb__close { position: absolute; }
@media (max-width: 600px) {
	.tre-lb__btn { width: 40px; height: 40px; line-height: 40px; font-size: 22px; }
	.tre-lb__prev { left: 8px; }
	.tre-lb__next { right: 8px; }
}

/* ============================================================
   LINIA ROZDZIELAJĄCA  [tr_divider]
============================================================ */
.tre-divider {
	border: 0;
	border-top: var(--tre-dv-size, 2px) solid var(--tre-dv-color, var(--tre-accent, #bc0000));
	width: var(--tre-dv-width, 100%);
	height: 0;
	margin-top: var(--tre-dv-gap, 24px);
	margin-bottom: var(--tre-dv-gap, 24px);
	background: none;
}
.tre-divider--dashed { border-top-style: dashed; }
.tre-divider--dotted { border-top-style: dotted; }
.tre-divider--double { border-top-style: double; border-top-width: calc(var(--tre-dv-size, 2px) + 2px); }
/* Wyrównanie (istotne, gdy szerokość < 100%) */
.tre-divider--center { margin-left: auto;  margin-right: auto; }
.tre-divider--left   { margin-left: 0;     margin-right: auto; }
.tre-divider--right  { margin-left: auto;  margin-right: 0; }

/* ============================================================
   NAGŁÓWKI  [tr_heading]
============================================================ */
.tre-heading {
	--tre-hd-color: var(--tre-accent, #bc0000);
	margin: 1.1em 0 .6em;
	line-height: 1.25;
}
.tre-heading.tre-align-center { text-align: center; }
.tre-heading.tre-align-right  { text-align: right; }

/* Wariant: krótki akcent pod tekstem */
.tre-heading--underline { padding-bottom: .38em; }
.tre-heading--underline::after {
	content: "";
	display: block;
	width: 56px;
	height: 3px;
	margin-top: .38em;
	border-radius: 3px;
	background: var(--tre-hd-color);
}
.tre-heading--underline.tre-align-center::after { margin-left: auto; margin-right: auto; }
.tre-heading--underline.tre-align-right::after  { margin-left: auto; }

/* Wariant: cienka linia na całej szerokości pod tekstem */
.tre-heading--underline-full {
	padding-bottom: .32em;
	border-bottom: 2px solid var(--tre-hd-color);
}

/* Wariant: akcent nad tekstem */
.tre-heading--overline { padding-top: .1em; }
.tre-heading--overline::before {
	content: "";
	display: block;
	width: 56px;
	height: 3px;
	margin-bottom: .4em;
	border-radius: 3px;
	background: var(--tre-hd-color);
}
.tre-heading--overline.tre-align-center::before { margin-left: auto; margin-right: auto; }
.tre-heading--overline.tre-align-right::before  { margin-left: auto; }

/* Wariant: linia ciągnąca się do końca wiersza (tytuł sekcji) */
.tre-heading--sideline {
	display: flex;
	align-items: center;
	gap: 16px;
}
.tre-heading--sideline::after {
	content: "";
	flex: 1 1 auto;
	height: 2px;
	background: var(--tre-hd-color);
}
/* Wyśrodkowany: linia z obu stron */
.tre-heading--sideline.tre-align-center::before {
	content: "";
	flex: 1 1 auto;
	height: 2px;
	background: var(--tre-hd-color);
}
/* Do prawej: linia tylko z lewej */
.tre-heading--sideline.tre-align-right::before {
	content: "";
	flex: 1 1 auto;
	height: 2px;
	background: var(--tre-hd-color);
}
.tre-heading--sideline.tre-align-right::after { display: none; }
