/*
 * Shared page chrome: header and footer.
 *
 * Loaded on every page. The header and footer are the same template parts on
 * all views, so their responsive rules must not live in a page-specific file
 * (they used to be in home.css, which broke the header on every other page).
 */

:root {
  --wns-desktop-header-gap-multiplier:  1.3;   /* multiplied against --wns-tablet-header-menus-spacing */
  --wns-header-logo-padding-tablet:     0 30%;
  --wns-header-padding-tablet:          30px;
}

/* -------- HEADER BREAKPOINT: 1100 px --------
 * The one-row header (logo, social icons, search, language, cart, account,
 * menu) needs about 1040 px; narrower, the social icons wrapped into two rows.
 * Up to 1100 px the header is the two-row phone/tablet header. The same width
 * is used in global.css and modules/translations/translations.css; the rest of
 * the page keeps its own 900 px breakpoint.
 */

/* -------- DESKTOP -------------- */

@media(min-width: 1101px) {
	.main-page-header > .wp-block-group {
		gap: calc(var(--wns-tablet-header-menus-spacing) * var(--wns-desktop-header-gap-multiplier)) !important;
	}
}

/* -------- TABLET AND MOBILE ----
 * Two compact rows: logo left, social icons and the cart, account and menu
 * right; the search field under them. (It was three rows with a centred logo:
 * about 280 px on a phone, the first product of the shop below the screen.)
 * The inner group is "display: contents", so its children sit in the header's
 * grid. Phones: the social icons behind a button (assets/js/sticky-header.js),
 * a panel under the header as in the pinned header. */

@media(max-width: 1100px) {
	.main-page-header:not(.is-stuck) {
		position: relative;
		display: grid !important;
		grid-template-columns: auto minmax(0, 1fr) auto;
		align-items: center;
		gap: 12px 16px;
		padding: 14px var(--wns-header-padding-tablet) !important;
	}

	.main-page-header:not(.is-stuck) > .wp-block-group {
		display: contents !important;
	}

	.main-page-header:not(.is-stuck) .wp-block-site-logo {
		grid-column: 1;
		grid-row: 1;
		width: auto;
		padding: 0;
	}

	.main-page-header:not(.is-stuck) .wp-block-site-logo img {
		width: 96px !important;
		height: auto !important;
	}

	.main-page-header:not(.is-stuck) .main-page-header-socials,
	.main-page-header:not(.is-stuck) .wns-header-toggle--socials {
		grid-column: 2;
		grid-row: 1;
		justify-self: end;
	}

	.main-page-header:not(.is-stuck) .main-page-header-nav {
		grid-column: 3;
		grid-row: 1;
	}

	.main-page-header:not(.is-stuck) .main-page-header-search {
		grid-column: 1 / -1;
		grid-row: 2;
		width: 100% !important;
		max-width: 100% !important;
		min-width: 0;
		box-sizing: border-box;
	}

	.main-page-header .main-page-header-search .wp-block-search__input {
		max-width: unset !important;
	}
}

@media(max-width: 600px) {
	.main-page-header:not(.is-stuck) {
		gap: 10px 8px;
		padding: 10px 20px 14px !important;
	}

	.main-page-header:not(.is-stuck) .wp-block-site-logo img {
		width: 64px !important;
	}

	.main-page-header:not(.is-stuck) .main-page-header-socials {
		display: none !important;
	}

	.main-page-header:not(.is-stuck) .wns-header-toggle--socials {
		display: inline-flex;
	}

	/* The open panel: positioned against the whole header, not its grid cell. */
	.main-page-header:not(.is-stuck).wns-show-socials .main-page-header-socials {
		grid-area: auto;
	}
}

/* Small phones: the row (logo, share button, language, cart, account, menu)
 * did not fit and the share button covered the logo. 44 px tap targets
 * instead of 50; the gaps between the icons stay even. */
@media(max-width: 380px) {
	.main-page-header:not(.is-stuck) {
		--wns-header-nav-btn-size: 44px;
	}

	.main-page-header:not(.is-stuck) .wp-block-site-logo img {
		width: 56px !important;
	}

	.main-page-header:not(.is-stuck) .main-page-header-nav > .wns-lang-switch {
		margin-right: 7px;
	}
}

/* Narrowest phones (320 px and less): no room for the share button, in the
 * header's place or pinned; the social links stay in the footer. */
@media(max-width: 340px) {
	.main-page-header .wns-header-toggle--socials {
		display: none !important;
	}
}

@media(max-width: 900px) {
	footer nav > button {
		display: none !important;
	}
	
	footer nav > div {
		display: flex !important;
		position: relative !important;
	}
	
	footer nav > div  .wp-block-navigation__responsive-container-content ul {
		display: flex !important;
		flex-direction: column !important;
	}
	
	footer nav > div .wp-block-navigation__responsive-container-close {
		display: none !important;
	}
}

/* -------- RIGHT-HAND ICONS: EVEN SPACING --------
 * The cart, account and menu icons are 30 px glyphs in 50 px tap targets
 * (10 px on each side), the language tag is a 40 px outlined box: with the
 * group's 8 px gap the tag sat 18 px from the cart and the icons 28 px from
 * each other. 10 px more after the tag: 28 px everywhere, tap targets kept. */
.main-page-header .main-page-header-nav > .wns-lang-switch {
	margin-right: 10px;
}

/* -------- STICKY HEADER (assets/js/sticky-header.js) --------
 * Below the header's own place the same header is pinned to the top in a
 * compact form: small logo; on phones one row (logo left, cart, account and
 * menu right) without the search field and the social icons (no room).
 * No transform, filter or backdrop-filter on the stuck header: they would trap
 * the mini-cart drawer and the menu overlay (position: fixed children).
 */

.wns-header-spacer {
	height: 0;
}

.main-page-header.is-stuck {
	position: fixed;
	top: var(--wp-admin--admin-bar--height, 0px);
	left: 0;
	right: 0;
	z-index: 1000;
	box-sizing: border-box;
	padding: 10px 40px !important;
	background: var(--wp--preset--color--background, #000);
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--secondary) 35%, transparent);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
	animation: wns-header-in 0.22s ease-out;
}

@keyframes wns-header-in {
	from { opacity: 0; translate: 0 -100%; }
	to   { opacity: 1; translate: 0 0; }
}

/* Pinned again after measuring (rotation, page load): already in place. */
.main-page-header.is-stuck.is-restuck {
	animation: none;
}

@media (prefers-reduced-motion: reduce) {
	.main-page-header.is-stuck {
		animation: none;
	}
}

.main-page-header.is-stuck .wp-block-site-logo img {
	width: 110px !important;
	height: auto !important;
}

/* Phones: the pinned row has no room for the social icons; wider, they stay as in the header. */
@media (max-width: 600px) {
	.main-page-header.is-stuck .main-page-header-socials {
		display: none !important;
	}
}

/* -------- PINNED: SEARCH AND SOCIAL ICONS IN PANELS --------
 * Where the pinned row hides them (search up to 1100 px, social icons up to
 * 600 px), a button each (assets/js/sticky-header.js) shows them in a panel
 * under the header. Hidden elsewhere and in the header's own place. */
.wns-header-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: none;
	color: var(--wp--preset--color--foreground);
	cursor: pointer;
}

.wns-header-toggle[aria-expanded="true"] {
	color: var(--wp--preset--color--secondary);
}

.wns-header-toggle:focus-visible {
	outline: 2px solid var(--wp--preset--color--secondary);
	outline-offset: 2px;
}

@media (max-width: 1100px) {
	.main-page-header.is-stuck .wns-header-toggle--search {
		display: inline-flex;
	}

	.main-page-header.is-stuck.wns-show-search > .wp-block-group > .main-page-header-search {
		display: flex !important;
	}
}

@media (max-width: 600px) {
	.main-page-header.is-stuck .wns-header-toggle--socials {
		display: inline-flex;
	}

	.main-page-header.wns-show-socials .main-page-header-socials {
		display: flex !important;
		justify-content: center;
		gap: 32px;
	}
}

/* Phones, pinned: logo, the two panel buttons, language, cart, account, menu in
 * one row. 24 px icons in 36 px tap targets (WCAG minimum 24 px), 8 px apart:
 * 20 px between every two icons, as in the header (28 px there, larger icons). */
@media (max-width: 600px) {
	.main-page-header.is-stuck .wp-block-site-logo img.custom-logo {
		width: 56px !important;
	}

	.main-page-header.is-stuck .wp-block-site-logo,
	.main-page-header.is-stuck .wp-block-site-logo a {
		width: auto !important;
	}

	.main-page-header.is-stuck > .wp-block-group,
	.main-page-header.is-stuck .main-page-header-nav {
		gap: 8px !important;
	}

	.main-page-header.is-stuck .wns-header-toggle,
	.main-page-header.is-stuck .main-page-header-nav > :not(.wns-lang-switch) {
		flex: 0 0 36px;
		width: 36px !important;
		min-width: 0 !important;
	}

	.main-page-header.is-stuck .main-page-header-nav > :not(.wns-lang-switch) :is(a, button) {
		justify-content: center;
		min-width: 0 !important;
		padding: 0 !important;
	}

	.main-page-header.is-stuck .wns-header-toggle svg,
	.main-page-header.is-stuck .main-page-header-nav svg {
		width: 24px !important;
		height: 24px !important;
	}

	.main-page-header.is-stuck .main-page-header-nav > .wns-lang-switch {
		margin-right: 6px;
	}
}

@media (max-width: 380px) {
	.main-page-header.is-stuck .wp-block-site-logo img.custom-logo {
		width: 46px !important;
	}

	.main-page-header.is-stuck .main-page-header-nav > .wns-lang-switch {
		margin-right: 0;
	}
}

/* The panel: full width under the pinned header, its own background and border. */
.main-page-header.is-stuck.wns-show-search > .wp-block-group > .main-page-header-search,
.main-page-header.wns-show-socials .main-page-header-socials {
	position: absolute;
	z-index: 5;
	top: 100%;
	left: 0;
	right: 0;
	box-sizing: border-box;
	width: 100% !important;
	max-width: none !important;
	margin: 0 !important;
	padding: 14px 20px;
	background: var(--wp--preset--color--background, #000);
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--secondary) 35%, transparent);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
}

/* The phone admin bar scrolls away with the page. */
@media (max-width: 600px) {
	.main-page-header.is-stuck {
		top: 0;
	}
}

@media (max-width: 1100px) {
	.main-page-header.is-stuck {
		flex-direction: row;
		align-items: center;
		padding: 8px 20px !important;
	}

	.main-page-header.is-stuck .wp-block-site-logo {
		width: auto;
		height: auto;
		padding: 0;
		flex: 0 0 auto;
	}

	.main-page-header.is-stuck .wp-block-site-logo img {
		width: 72px !important;
	}

	.main-page-header.is-stuck > .wp-block-group {
		display: flex;
		justify-content: flex-end;
		width: auto !important;
		flex: 1 1 auto;
	}

	.main-page-header.is-stuck > .wp-block-group > .main-page-header-search {
		display: none !important;
	}
}

/* -------- WHOLE PIXELS FOR THE OUTLINED CONTROLS --------
 * A 1px rounded gold border on a fractional position (the logo's height was
 * 113.23px, the search field 49.02px, the language tag 40.22px wide) is
 * smeared over two pixels and its corners look soft. Whole-pixel sizes keep
 * the header's controls on the pixel grid: (160 − 48) / 2 = 56. */
@media (min-width: 1101px) {
	.main-page-header:not(.is-stuck) .wp-block-site-logo img {
		height: 112px !important;
		width: auto !important;
	}

	.main-page-header.is-stuck .wp-block-site-logo img {
		height: 70px !important;
		width: auto !important;
	}

	.main-page-header .main-page-header-search .wp-block-search__input,
	.main-page-header .main-page-header-search .wp-block-search__button {
		height: 48px !important;
		min-height: 48px !important;
		box-sizing: border-box !important;
	}
}

/* Folded phones (280 px), pinned: logo, search, cart, account and menu only;
 * the language tag is in the header at the top of the page. */
@media(max-width: 300px) {
	.main-page-header.is-stuck .main-page-header-nav > .wns-lang-switch {
		display: none !important;
	}
}

/* The quantity bubble sits in the header and otherwise inherits whatever
 * font the surrounding navigation happens to use. It is UI data, so keep it
 * on the same Lato face with a size independent of the navigation button.
 * A minimum width (rather than fixed width) also accommodates multi-digit counts.
 * Here, not in mini-cart.css: that file styles the drawer only and loads
 * without blocking the first paint (modules/storefront/css-loading.php). */
.main-page-header .wc-block-mini-cart__badge {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: auto;
	min-width: 20px;
	height: 20px;
	padding: 0 3px !important;
	font-size: 12px !important;
	box-sizing: border-box;
	font-family: "Lato", Arial, sans-serif !important;
	font-style: normal !important;
	font-weight: 600 !important;
	line-height: 1 !important;
}

/* Social icons in the services' colours (Media społecznościowe, "Kolory
 * serwisów"): WordPress paints TikTok's and Threads' logos black (#000), which
 * vanishes on the black header and footer (owner, TODO 2026-11-27). On our
 * dark background: white, TikTok with its cyan and red edges as in its dark
 * logo; in a circle or oval their black shape gets a light ring. Own colours
 * (has-icon-color, inline style on the icon) are left alone. The panel's
 * preview has the same rules (modules/social/social-admin.css). */
.wp-block-social-links.is-style-logos-only:not(.has-icon-color) :is(.wp-social-link-tiktok, .wp-social-link-threads) {
	color: #fff;
}
.wp-block-social-links.is-style-logos-only:not(.has-icon-color) .wp-social-link-tiktok svg {
	filter: drop-shadow(-.05em -.05em 0 #25f4ee) drop-shadow(.05em .05em 0 #fe2c55);
}
.wp-block-social-links:not(.is-style-logos-only, .has-icon-color) :is(.wp-social-link-tiktok, .wp-social-link-threads) {
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .45);
}
/* WordPress's TikTok logo fills its whole box (0-32 of a 32 viewBox); the
 * others fill about 20 of 24, so TikTok looked a size bigger next to them
 * (owner, 2026-11-27). Same visual size: 80 %. */
.wp-block-social-links .wp-social-link-tiktok svg {
	transform: scale(.8);
}
