/*
 Theme Name:   GeneratePress Child
 Theme URI:    https://generatepress.com
 Description:  Motyw potomny GeneratePress — sidebar bloga (popularne, komentowane, disclaimer).
 Author:       Blog Rowery
 Template:     generatepress
 Version:      1.1.6
*/

/*
 * Nagłówki w sidebarze: dopisz w GB klasę .sidebar-heading-styles (np. na bloku nagłówka / gb-text).
 * Widżety BR doklejają ją w PHP — style poniżej obowiązują wszystkie tak oznaczone nagłówki.
 * Lista: --accent. Ramka disclaimer: theme.json.
 *
 * Odstępy między widżetami: theme.json → settings.custom.sidebar.widgetGap (np. 24px, 2rem).
 */

/* Wyrównanie góry kolumny sidebara (edytuj --wp--custom--sidebar--margin-top w theme.json) */
.separate-containers .inside-right-sidebar {
	margin-top: var(--wp--custom--sidebar--margin-top, 20px);
}

/* Odstęp pionowy między widżetami w prawym sidebarze (nadpisuje domyślne 30px z GeneratePress) */
.inside-right-sidebar .widget {
	margin-bottom: var(--wp--custom--sidebar--widget-gap, 30px);
}

.inside-right-sidebar .widget:last-child {
	margin-bottom: 0;
}

/* Nagłówki sekcji w sidebarze — klasa .sidebar-heading-styles (GB + widżety) */
.sidebar .sidebar-heading-styles,
.inside-right-sidebar .sidebar-heading-styles {
	color: var(--contrast-3, inherit);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 1.5px;
	line-height: 1.5em;
	margin-bottom: 1rem;
	text-transform: uppercase;
}

/* Lista linków — jak tekst / linki GB w sidebarze */
.sidebar .widget.widget_br_popular_posts .br-sidebar-post-list,
.sidebar .widget.widget_br_most_commented .br-sidebar-post-list {
	font-size: 0.9375rem;
	line-height: 1.5em;
	color: var(--accent, inherit);
}

.sidebar .widget.widget_br_popular_posts .br-sidebar-post-list a,
.sidebar .widget.widget_br_most_commented .br-sidebar-post-list a {
	color: var(--accent, inherit);
}

.sidebar .widget.widget_br_review_disclaimer .br-sidebar-disclaimer {
	font-size: 0.9375rem;
	line-height: 1.5em;
	color: var(--accent, inherit);
}

/* Lista: układ i numeracja */
.br-sidebar-post-list {
	list-style: none;
	margin: 0 0 1em;
	padding: 0;
	counter-reset: br-rank;
}

.br-sidebar-post-list li {
	counter-increment: br-rank;
	margin: 0 0 0.75rem;
	padding-left: 2em;
	position: relative;
	line-height: inherit;
}

.br-sidebar-post-list li:last-child {
	margin-bottom: 0;
}

.br-sidebar-post-list li::before {
	content: counter(br-rank) ".";
	position: absolute;
	left: 0;
	font-weight: 700;
	color: var(--contrast-3, inherit);
	opacity: 0.9;
}

.br-sidebar-post-list a {
	text-decoration: none;
}

.br-sidebar-post-list a:hover,
.br-sidebar-post-list a:focus {
	text-decoration: underline;
}

/* Kwadrat — disclaimer recenzji */
.br-sidebar-disclaimer {
	aspect-ratio: 1 / 1;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	gap: 16px;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 1rem 1.1rem;
	box-sizing: border-box;
	border: 2px solid var(--wp--preset--color--br-disclaimer-border, #e5e7eb);
	border-radius: 4px;
	background-color: var(--wp--preset--color--br-disclaimer-surface, #f9fafb);
	margin-top: 0.5rem;
}

.br-sidebar-disclaimer p {
	margin: 0;
	font-size: inherit;
	line-height: inherit;
}

.inside-right-sidebar .br-sidebar-disclaimer {
	margin-bottom: 0;
}

@media (max-width: 768px) {
	.br-sidebar-disclaimer {
		aspect-ratio: auto;
		min-height: 120px;
	}
}

/* -------------------------------------------------------------------------
   Formularz komentarzy — jak reszta strony (GB: --accent, --contrast-3)
   ------------------------------------------------------------------------- */
.comments-area {
	margin-top: 2.5rem;
	padding-top: 2rem;
	border-top: 1px solid var(--wp--preset--color--br-disclaimer-border, #e5e7eb);
}

.comments-area .comments-title,
.comment-respond .comment-reply-title {
	color: var(--contrast-3, #374151);
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 1.5px;
	line-height: 1.5;
	text-transform: uppercase;
	margin: 0 0 1.25rem;
}

.comment-respond {
	margin-bottom: 0;
}

#commentform.comment-form {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	max-width: 100%;
}

#commentform.comment-form p {
	margin: 0;
}

#commentform textarea,
#commentform input[type="text"],
#commentform input[type="email"],
#commentform input[type="url"] {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0.65rem 0.9rem;
	font-family: inherit;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: var(--accent, #1f2937);
	background-color: #fff;
	border: 1px solid var(--wp--preset--color--br-disclaimer-border, #e5e7eb);
	border-radius: 4px;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

#commentform textarea {
	min-height: 140px;
	resize: vertical;
	vertical-align: top;
}

#commentform textarea:focus,
#commentform input[type="text"]:focus,
#commentform input[type="email"]:focus,
#commentform input[type="url"]:focus {
	outline: none;
	border-color: var(--accent, #5036d1);
	box-shadow: 0 0 0 3px rgba(80, 54, 209, 0.18);
}

#commentform textarea::placeholder,
#commentform input::placeholder {
	color: var(--contrast-3, #6b7280);
	opacity: 0.85;
}

/* Checkbox „zapamiętaj” */
.comment-form-cookies-consent {
	font-size: 0.8125rem;
	line-height: 1.45;
	color: var(--contrast-3, #4b5563);
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
}

.comment-form-cookies-consent input[type="checkbox"] {
	margin-top: 0.2rem;
	flex-shrink: 0;
	accent-color: var(--accent, #5036d1);
}

.comment-form-cookies-consent label {
	cursor: pointer;
}

/* Przycisk wyślij */
#commentform .form-submit {
	margin: 0;
	padding-top: 0.25rem;
}

/* Zapas: pole URL (GP dodaje je w generate_filter_comment_fields) */
#commentform #url,
#commentform label[for="url"] {
	display: none !important;
}

#commentform input[type="submit"].submit,
#commentform .submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.75rem;
	padding: 0.6rem 1.75rem;
	font-family: inherit;
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #fff !important;
	background: var(--accent, #5036d1) !important;
	border: none !important;
	border-radius: 4px;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
	box-shadow: none;
}

#commentform input[type="submit"].submit:hover,
#commentform .submit:hover {
	opacity: 0.94;
	filter: brightness(1.03);
}

#commentform input[type="submit"].submit:focus-visible,
#commentform .submit:focus-visible {
	outline: 2px solid var(--accent, #5036d1);
	outline-offset: 3px;
}

/* Trzy pola meta obok siebie na szerszym ekranie (standardowe klasy WP) */
@media (min-width: 640px) {
	#commentform .comment-form-author,
	#commentform .comment-form-email,
	#commentform .comment-form-url {
		display: inline-block;
		width: calc(33.333% - 0.67rem);
		margin-right: 1rem;
		vertical-align: top;
	}

	#commentform .comment-form-url {
		margin-right: 0;
	}
}

@media (max-width: 639px) {
	#commentform .comment-form-author,
	#commentform .comment-form-email,
	#commentform .comment-form-url {
		width: 100%;
	}
}

/* -------------------------------------------------------------------------
   Formularz kontaktowy w stopce (Contact Form 7) — kompaktowy, spójny z motywem
   ------------------------------------------------------------------------- */
.site-footer .wpcf7 {
	width: 100%;
	margin: 0;
	color: #e5e7eb;
}

.site-footer .wpcf7-form {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.85rem 1rem;
	width: 100%;
}

.site-footer .wpcf7-form .hidden-fields-container {
	display: none;
}

/* Rząd imię + e-mail (CF7 renderuje to jako <div style="display:flex"> z dwoma <p>) */
.site-footer .wpcf7-form > div[style*="flex"] {
	display: contents !important;
}

.site-footer .wpcf7-form > div[style*="flex"] > p {
	margin: 0;
}

/* Cały komunikat + przycisk — pełna szerokość */
.site-footer .wpcf7-form > p {
	grid-column: 1 / -1;
	margin: 0;
}

.site-footer .wpcf7-form label {
	display: block;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: rgba(229, 231, 235, 0.75);
	line-height: 1.4;
}

.site-footer .wpcf7-form label br {
	display: none;
}

.site-footer .wpcf7-form-control-wrap {
	display: block;
	margin-top: 0.35rem;
}

.site-footer .wpcf7-form input[type="text"],
.site-footer .wpcf7-form input[type="email"],
.site-footer .wpcf7-form input[type="url"],
.site-footer .wpcf7-form textarea {
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
	padding: 0.55rem 0.75rem;
	font-family: inherit;
	font-size: 0.875rem;
	line-height: 1.4;
	color: #f9fafb;
	background-color: rgba(255, 255, 255, 0.06);
	border: 1px solid rgba(255, 255, 255, 0.18);
	border-radius: 6px;
	transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.site-footer .wpcf7-form textarea {
	min-height: 96px;
	max-height: 180px;
	resize: vertical;
	display: block;
}

.site-footer .wpcf7-form input::placeholder,
.site-footer .wpcf7-form textarea::placeholder {
	color: rgba(229, 231, 235, 0.45);
}

.site-footer .wpcf7-form input:hover,
.site-footer .wpcf7-form textarea:hover {
	border-color: rgba(255, 255, 255, 0.28);
	background-color: rgba(255, 255, 255, 0.08);
}

.site-footer .wpcf7-form input:focus,
.site-footer .wpcf7-form textarea:focus {
	outline: none;
	border-color: var(--accent, #5036d1);
	background-color: rgba(255, 255, 255, 0.1);
	box-shadow: 0 0 0 3px rgba(80, 54, 209, 0.35);
}

/* Autofill: bez białego tła, jasny tekst */
.site-footer .wpcf7-form input:-webkit-autofill,
.site-footer .wpcf7-form textarea:-webkit-autofill {
	-webkit-text-fill-color: #f9fafb;
	-webkit-box-shadow: 0 0 0 1000px rgba(255, 255, 255, 0.06) inset;
	caret-color: #f9fafb;
	transition: background-color 9999s ease-in-out 0s;
}

/* Przycisk wyślij */
.site-footer .wpcf7-form .wpcf7-submit {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 2.25rem;
	padding: 0.5rem 1.5rem;
	font-family: inherit;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #fff;
	background: var(--accent, #5036d1);
	border: 1px solid var(--accent, #5036d1);
	border-radius: 6px;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.site-footer .wpcf7-form .wpcf7-submit:hover {
	background: color-mix(in srgb, var(--accent, #5036d1) 88%, #fff);
	border-color: color-mix(in srgb, var(--accent, #5036d1) 88%, #fff);
}

.site-footer .wpcf7-form .wpcf7-submit:active {
	transform: translateY(1px);
}

.site-footer .wpcf7-form .wpcf7-submit:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

/* Komunikaty walidacji / odpowiedzi — czytelne na ciemnym tle */
.site-footer .wpcf7 .wpcf7-not-valid-tip {
	font-size: 0.75rem;
	margin-top: 0.35rem;
	color: #fca5a5;
}

.site-footer .wpcf7 .wpcf7-response-output {
	grid-column: 1 / -1;
	margin: 0.5rem 0 0;
	padding: 0.6rem 0.85rem;
	font-size: 0.8125rem;
	border-radius: 6px;
	border-width: 1px;
	border-style: solid;
}

.site-footer .wpcf7 form.invalid .wpcf7-response-output,
.site-footer .wpcf7 form.unaccepted .wpcf7-response-output {
	color: #fecaca;
	background-color: rgba(220, 38, 38, 0.12);
	border-color: rgba(220, 38, 38, 0.5);
}

.site-footer .wpcf7 form.sent .wpcf7-response-output {
	color: #bbf7d0;
	background-color: rgba(22, 163, 74, 0.14);
	border-color: rgba(22, 163, 74, 0.5);
}

/* Responsywność — jedna kolumna na wąskich ekranach */
@media (max-width: 600px) {
	.site-footer .wpcf7-form {
		grid-template-columns: 1fr;
	}

	.site-footer .wpcf7-form > div[style*="flex"] {
		display: contents !important;
	}
}

/* -------------------------------------------------------------------------
   Reklamy — desktop (sidebar) + mobile (co 7. wpis w pętli)
   ------------------------------------------------------------------------- */

/* Sidebar: format 300x600 — wyśrodkowane, bez rozciągania ponad 300 px */
.inside-right-sidebar .widget_media_image img,
.inside-right-sidebar .wp-block-image img {
	max-width: 300px;
	width: 100%;
	height: auto;
	display: block;
	margin-left: auto;
	margin-right: auto;
}

/* Klasa pomocnicza — dodaj w „Additional CSS class(es)" widgetu,
   aby ukryć reklamę sidebara na mobile (gdy in-stream przejmuje rolę). */
.ads-desktop-only {
	display: block;
}

/* In-stream reklama mobilna — domyślnie ukryta (desktop) */
.br-inline-ad {
	display: none;
	margin: 1.5rem auto;
	text-align: center;
}

.br-inline-ad .widget {
	margin: 0 auto;
}

.br-inline-ad img {
	max-width: 100%;
	height: auto;
	display: inline-block;
}

.br-inline-ad .br-inline-ad__title {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	white-space: nowrap;
}

/* Breakpoint mobilny — zgodny z GP (sidebar chowa się poniżej 768 px) */
@media (max-width: 768px) {
	.br-inline-ad {
		display: block;
	}

	.ads-desktop-only {
		display: none !important;
	}

	/* Automatycznie ukryj reklamowe widgety (obrazki) w prawym sidebarze —
	   na mobile rolę przejmują reklamy in-stream. */
	.inside-right-sidebar > .widget_media_image,
	.inside-right-sidebar > .widget_block.widget_media_image,
	.sidebar .widget_media_image,
	.sidebar .widget_block.widget_media_image,
	/* Nagłówek sekcji „Reklamy" nad ukrytymi kreacjami — zbędny bez reklam. */
	.inside-right-sidebar > #block-7,
	.sidebar #block-7 {
		display: none !important;
	}

	/* Na mobile sidebar zjeżdża pod treść i traci wcięcia — dajemy własne,
	   spójne z paddingiem treści głównej, żeby widgety nie przyklejały się
	   do krawędzi ekranu. */
	.inside-right-sidebar,
	.inside-left-sidebar {
		padding-left: 20px;
		padding-right: 20px;
		box-sizing: border-box;
	}
}

/* -------------------------------------------------------------------------
   Mobile header — wszystko w jednej linii (logo + wyszukiwarka + hamburger).
   GP domyślnie używa flex-wrap i wymusza flex-basis:100% na #site-navigation,
   przez co powstaje druga, pusta linia pod logo. Wyrównujemy to.
   ------------------------------------------------------------------------- */
@media (max-width: 992px) {
	.has-inline-mobile-toggle .inside-header {
		flex-wrap: nowrap !important;
		align-items: center;
		gap: 0.75rem;
	}

	/* Menu w tej wersji motywu siedzi w slide-out (klasy slideout-enabled),
	   więc inline #site-navigation jest pusty — ukrywamy, żeby nie dokładał
	   kolejnego rzędu pod logo. */
	.has-inline-mobile-toggle #site-navigation {
		display: none !important;
	}

	.site-logo {
		flex: 1 1 auto;
		min-width: 0;
		margin: 0;
	}

	.site-logo img.header-image {
		max-height: 48px;
		width: auto;
		height: auto;
		max-width: 100%;
	}

	.has-inline-mobile-toggle .mobile-menu-control-wrapper {
		flex: 0 0 auto;
		margin-left: auto;
		flex-wrap: nowrap;
	}

	.has-inline-mobile-toggle .mobile-menu-control-wrapper .menu-bar-items,
	.has-inline-mobile-toggle .mobile-menu-control-wrapper .menu-toggle {
		flex: 0 0 auto;
	}
}