/* ═══════════════════════════════════════════════════════════════
   POLISH #14 — 2026-05-28
   #168 Related categories cards
   #169 Sidebar ideal UX/UI
   #170 Grid / List view toggle
   #171 Custom sort dropdown polish
   ═══════════════════════════════════════════════════════════════ */

/* ─── #169 SIDEBAR — anti-overflow + group polish ─── */
@media (min-width: 1024px) {
	body.gk-archive-v5-body .gk-archive-sidebar {
		max-width: 280px;
		min-width: 240px;
	}
}

body.gk-archive-v5-body .gk-archive-sidebar > * { min-width: 0; }
body.gk-archive-v5-body .gk-archive-sidebar__group { overflow: hidden; }

body.gk-archive-v5-body .gk-archive-sidebar__list-label {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	word-break: break-word;
	flex: 1 1 auto;
	min-width: 0;
}

/* #169 — clean section title (no group-icon SVG, just label + badge) */
body.gk-archive-v5-body .gk-archive-sidebar__group-title {
	color: var(--gk-v5-primary);
	letter-spacing: 0.14em;
	font-size: 12px;
}

/* Custom checkbox/toggle for in-stock / on-sale rows (#169) */
body.gk-archive-v5-body .gk-archive-sidebar__toggle {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	padding: 9px 10px;
	margin: 0 -10px;
	border-radius: 8px;
	font-family: 'Inter', sans-serif;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--gk-v5-text-muted);
	text-decoration: none;
	transition: color 0.2s ease, background 0.2s ease;
	cursor: pointer;
}
body.gk-archive-v5-body .gk-archive-sidebar__toggle:hover {
	background: var(--gk-v5-cream);
	color: var(--gk-v5-primary);
}
body.gk-archive-v5-body .gk-archive-sidebar__toggle-box {
	width: 18px;
	height: 18px;
	border: 2px solid var(--gk-v5-border);
	border-radius: 5px;
	background: #fff;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	color: transparent;
	flex-shrink: 0;
	transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
body.gk-archive-v5-body .gk-archive-sidebar__toggle:hover .gk-archive-sidebar__toggle-box {
	border-color: var(--gk-v5-primary-light);
}
body.gk-archive-v5-body .gk-archive-sidebar__toggle.is-active {
	color: var(--gk-v5-primary);
	background: var(--gk-v5-soft);
	font-weight: 700;
}
body.gk-archive-v5-body .gk-archive-sidebar__toggle.is-active .gk-archive-sidebar__toggle-box {
	background: var(--gk-v5-primary-light);
	border-color: var(--gk-v5-primary-light);
	color: #fff;
}

/* ─── #170 — Grid/List view toggle in toolbar ─── */
.gk-archive-view-toggle {
	display: inline-flex;
	align-items: center;
	gap: 0;
	border: 1px solid var(--gk-v5-border);
	border-radius: var(--gk-v5-radius-pill);
	background: var(--gk-v5-surface);
	padding: 3px;
	overflow: hidden;
}
.gk-archive-view-toggle__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	background: transparent;
	border: 0;
	border-radius: var(--gk-v5-radius-pill);
	color: var(--gk-v5-text-soft);
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease;
}
.gk-archive-view-toggle__btn:hover {
	color: var(--gk-v5-primary);
	background: var(--gk-v5-cream);
}
.gk-archive-view-toggle__btn.is-active {
	background: var(--gk-v5-primary-light);
	color: #fff;
}
.gk-archive-view-toggle__btn:focus-visible {
	outline: 2px solid var(--gk-v5-primary-light);
	outline-offset: 2px;
}

@media (max-width: 639px) {
	.gk-archive-view-toggle { display: none; }
}

/* ─── #170 — LIST VIEW overrides ───
   Active when ul.products has class .gk-archive-grid--list */
body.gk-archive-v5-body .gk-archive-v5__main ul.products.gk-archive-grid--list {
	grid-template-columns: 1fr !important;
	gap: 20px;
	grid-auto-rows: auto;
}
body.gk-archive-v5-body .gk-archive-v5__main ul.products.gk-archive-grid--list .gk-product-card-wrap--featured {
	grid-column: 1 / -1 !important;
}

@media (min-width: 640px) {
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card-wrap > .gk-product-card,
	body.gk-archive-v5-body ul.products.gk-archive-grid--list li.product > .gk-product-card {
		flex-direction: row;
		align-items: stretch;
		gap: 24px;
	}
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card__media {
		width: 240px;
		flex: 0 0 240px;
		aspect-ratio: 4 / 5;
	}
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card__body {
		flex: 1 1 auto;
		padding: 24px 28px;
		display: flex;
		flex-direction: column;
	}
	/* Show excerpt in list view (normally truncated/hidden by clamping) */
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card__excerpt {
		display: -webkit-box !important;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
		font-size: 14px;
		margin: 0 0 16px;
	}
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card--featured {
		grid-template-columns: none;
	}
}

/* Mobile list view = stacked (image top, content bottom) — fallback to grid behavior but show excerpt */
@media (max-width: 639px) {
	body.gk-archive-v5-body ul.products.gk-archive-grid--list .gk-product-card__excerpt {
		display: -webkit-box !important;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
		overflow: hidden;
		font-size: 14px;
	}
}

/* ─── #171 — Custom sort dropdown enhancement ───
   Replaces inline rule (line 382) with sharper hover + focus emerald ring */
body.gk-archive-v5-body .gk-archive-toolbar .woocommerce-ordering select,
body.gk-archive-v5-body .gk-archive-toolbar .orderby {
	min-width: 220px;
	padding: 10px 40px 10px 16px;
	background-color: #ffffff;
	color: var(--gk-v5-primary);
	font-family: 'Inter', sans-serif;
	font-size: 14px;
	font-weight: 600;
	border: 1px solid rgba(31, 61, 20, 0.15);
	border-radius: var(--gk-v5-radius-pill);
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%231F3D14' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
	background-repeat: no-repeat;
	background-position: right 16px center;
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	cursor: pointer;
	transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
body.gk-archive-v5-body .gk-archive-toolbar .woocommerce-ordering select:hover,
body.gk-archive-v5-body .gk-archive-toolbar .orderby:hover {
	border-color: var(--gk-v5-primary-light);
	background-color: #F0F4EC;
}
body.gk-archive-v5-body .gk-archive-toolbar .woocommerce-ordering select:focus-visible,
body.gk-archive-v5-body .gk-archive-toolbar .orderby:focus-visible {
	outline: 2px solid var(--gk-v5-primary-light);
	outline-offset: 2px;
	border-color: var(--gk-v5-primary-light);
	box-shadow: 0 0 0 4px rgba(93, 169, 53, 0.18);
}

@media (max-width: 639px) {
	body.gk-archive-v5-body .gk-archive-toolbar .woocommerce-ordering select,
	body.gk-archive-v5-body .gk-archive-toolbar .orderby {
		min-width: 0;
		width: 100%;
	}
}

/* ─── #168 — "Może Cię też zainteresować" related cards ─── */
.gk-archive-related {
	margin-top: 96px;
	margin-bottom: 96px;
}
.gk-archive-related__title {
	font-family: 'Playfair Display', 'Inter', serif;
	font-size: clamp(1.75rem, 3.5vw, 2.5rem);
	font-weight: 700;
	letter-spacing: -0.02em;
	color: var(--gk-v5-primary);
	text-align: center;
	margin: 0 0 12px;
}
.gk-archive-related__subtitle {
	font-family: 'Inter', sans-serif;
	font-size: 1rem;
	color: var(--gk-v5-text-muted);
	text-align: center;
	margin: 0 0 48px;
}
.gk-archive-related__grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 24px;
}
@media (min-width: 768px) {
	.gk-archive-related__grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 28px;
	}
}

.gk-archive-related__card {
	display: flex;
	flex-direction: column;
	background: #ffffff;
	border: 1px solid var(--gk-v5-border);
	border-radius: 20px;
	overflow: hidden;
	text-decoration: none;
	color: var(--gk-v5-text);
	box-shadow: var(--gk-v5-shadow-soft);
	transition: transform 0.25s var(--gk-v5-ease), box-shadow 0.25s ease, border-color 0.25s ease;
}
.gk-archive-related__card:hover {
	transform: translateY(-4px);
	box-shadow: var(--gk-v5-shadow-hover);
	border-color: var(--gk-v5-primary-light);
}
.gk-archive-related__card:focus-visible {
	outline: 2px solid var(--gk-v5-primary-light);
	outline-offset: 4px;
}

.gk-archive-related__media {
	aspect-ratio: 4 / 5;
	background: var(--gk-v5-cream);
	overflow: hidden;
	position: relative;
}
.gk-archive-related__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.45s var(--gk-v5-ease);
}
.gk-archive-related__card:hover .gk-archive-related__media img {
	transform: scale(1.04);
}

.gk-archive-related__body {
	padding: 24px 24px 28px;
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex: 1 1 auto;
}
.gk-archive-related__eyebrow {
	display: inline-block;
	font-family: 'Inter', sans-serif;
	font-size: 11px;
	font-weight: 800;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	color: var(--gk-v5-accent);
}
.gk-archive-related__name {
	font-family: 'Inter', sans-serif;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.35;
	color: var(--gk-v5-primary);
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}
.gk-archive-related__price {
	font-family: 'Inter', sans-serif;
	font-size: 1.0625rem;
	font-weight: 800;
	color: var(--gk-v5-text);
}
.gk-archive-related__cta {
	margin-top: auto;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding-top: 4px;
	font-family: 'Inter', sans-serif;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--gk-v5-accent);
	transition: color 0.2s ease;
}
.gk-archive-related__cta svg {
	transition: transform 0.25s var(--gk-v5-ease);
}
.gk-archive-related__card:hover .gk-archive-related__cta {
	color: var(--gk-v5-primary-light);
}
.gk-archive-related__card:hover .gk-archive-related__cta svg {
	transform: translateX(4px);
}

/* ═══════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
	.gk-archive-sidebar,
	.gk-archive-curated__science-pick,
	.gk-archive-related__card,
	.gk-archive-related__media img,
	.gk-archive-related__cta svg,
	.gk-archive-seo-block__cat-card,
	.gk-archive-seo-block__tag,
	.gk-archive-seo-block__faq-item summary svg {
		transition: none !important;
		animation: none !important;
		transform: none !important;
	}
}

