/*
 * Funkid base stylesheet.
 * Keep it small: theme.json carries tokens and element styles; per-block CSS
 * lives in assets/css/blocks/ and only loads when that block is on the page.
 */

/* ---------------------------------------------------------------
 * Metric-adjusted fallback fonts: keep text from shifting when the
 * self-hosted web fonts swap in. Values measured against Arial.
 * ------------------------------------------------------------- */
@font-face {
	font-family: "DM Sans Fallback";
	src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
	size-adjust: 101.18%;
	ascent-override: 98.05%;
	descent-override: 30.64%;
	line-gap-override: 0%;
}

@font-face {
	font-family: "Fredoka Fallback";
	src: local("Arial"), local("Helvetica Neue"), local("Liberation Sans");
	size-adjust: 100.07%;
	ascent-override: 97.33%;
	descent-override: 23.58%;
	line-gap-override: 0%;
}

/* ---------------------------------------------------------------
 * Tokens that are not expressible in theme.json
 * ------------------------------------------------------------- */
:root {
	--funkid-focus: var(--wp--custom--focus--color, #976fba);
	--funkid-ease: var(--wp--custom--transition, 0.2s ease);
	/* Sticky header sizes. --funkid-header-main-height is the height that stays on screen while scrolling: it keeps
	   anchors, sticky sidebars and the product page clear of the header. Compaction needs scroll-state queries. */
	--funkid-header-bar-height: 90px;
	--funkid-header-bar-compact: 66px;
	--funkid-header-nav-height: 48px;
		--funkid-header-main-height: calc(var(--funkid-header-bar-height) + var(--funkid-header-nav-height));

	/* Line icons from the mockup (24px grid, 1.65 stroke), used as masks. */
	--funkid-icon-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h15m-6-6 6 6-6 6'/%3E%3C/svg%3E");
	--funkid-icon-arrow-up-right: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 17 17 7M8 7h9v9'/%3E%3C/svg%3E");
	--funkid-icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
	--funkid-icon-plus: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M12 5v14'/%3E%3C/svg%3E");
	--funkid-icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E");
	--funkid-icon-heart: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.5 5.5a5 5 0 0 0-8 1 5 5 0 0 0-8-1c-4.5 5 2 10 8 14 6-4 12.5-9 8-14Z'/%3E%3C/svg%3E");
	--funkid-icon-gift: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='8' width='18' height='4' rx='1'/%3E%3Cpath d='M5 12v9h14v-9M12 8v13'/%3E%3Cpath d='M12 8C2 8 5 0 9 3c2 1 3 5 3 5Zm0 0c10 0 7-8 3-5-2 1-3 5-3 5Z'/%3E%3C/svg%3E");
	--funkid-icon-sun: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='4'/%3E%3Cpath d='M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.5 1.5m11 11L19 19M5 19l1.5-1.5m11-11L19 5'/%3E%3C/svg%3E");
	--funkid-icon-blocks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='12' width='9' height='9' rx='1'/%3E%3Crect x='12' y='12' width='9' height='9' rx='1'/%3E%3Crect x='7.5' y='3' width='9' height='9' rx='1'/%3E%3C/svg%3E");
	--funkid-icon-user: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8' r='4'/%3E%3Cpath d='M4 21c0-4.4 3.6-7 8-7s8 2.6 8 7'/%3E%3C/svg%3E");
	--funkid-icon-bag: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.65' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7h14l1 14H4L5 7Z'/%3E%3Cpath d='M8 8V6a4 4 0 0 1 8 0v2'/%3E%3C/svg%3E");
	--funkid-icon-asterisk: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='3' stroke-linecap='round'%3E%3Cpath d='M12 2.5v19M2.5 12h19M5.3 5.3l13.4 13.4M18.7 5.3 5.3 18.7'/%3E%3C/svg%3E");
	--funkid-icon-sparkle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 80'%3E%3Cpath d='M40 2C43 29 51 35 78 40 51 44 44 51 40 78 35 51 29 44 2 40 29 35 36 28 40 2Z'/%3E%3C/svg%3E");
	--funkid-icon-heart-solid: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M20.5 5.5a5 5 0 0 0-8 1 5 5 0 0 0-8-1c-4.5 5 2 10 8 14 6-4 12.5-9 8-14Z'/%3E%3C/svg%3E");
}

@supports (container-type: scroll-state) {
	:root {
		--funkid-header-main-height: calc(var(--funkid-header-bar-compact) + var(--funkid-header-nav-height));
	}
}

/* Header breakpoint: the full navigation row (with the mega menus) only from 1024px, where it fits on one
   line. Below that the header is the compact one: menu button, logo, search and actions. From 601px the
   search shares the row; under 601px it gets a row of its own, folded away while the header sticks. */
@media (max-width: 1023px) {
	:root {
		--funkid-header-bar-height: 60px;
		--funkid-header-main-height: 60px;
	}

	@supports (container-type: scroll-state) {
		:root {
			--funkid-header-main-height: 60px;
		}
	}
}

@media (max-width: 600px) {
	:root {
		--funkid-header-bar-height: 112px;
		--funkid-header-main-height: var(--funkid-header-bar-height);
	}

	@supports (container-type: scroll-state) {
		:root {
			--funkid-header-main-height: 60px;
		}
	}
}

/* ---------------------------------------------------------------
 * Page frame
 * ------------------------------------------------------------- */
html {
	scroll-behavior: smooth;
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--funkid-header-main-height) + 24px);
	-webkit-text-size-adjust: 100%;
}

/* The header and footer parts carry their own spacing. */
.wp-site-blocks > * {
	margin-block-start: 0;
}

/* The footer ends the page: on short pages (order confirmation, an almost empty page) the content area grows
   and the footer sits at the bottom, so no strip of page background shows under it. */
.wp-site-blocks {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
	min-height: 100dvh;
}

.wp-site-blocks > footer {
	margin-top: auto;
}

/* Cart on phone: WooCommerce fixes the "Gå til kassen" bar (16px padding + 56px button) to the bottom of the
   screen. The footer gets the same height as bottom padding, so its seller line can be scrolled clear of the bar. */
@media (max-width: 782px) {
	body:has(.wp-block-woocommerce-cart .wc-block-cart__submit-container) .funkid-footer {
		/* !important: the footer group carries an inline padding-bottom: 0. */
		padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
	}

	.wc-block-cart .wc-block-cart__submit-container--sticky {
		padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
	}
}

/* Long Danish compounds wrap instead of being cut off or pushing the page wider (the page language is da-DK). */
:where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, td, th, figcaption, label, summary) {
	overflow-wrap: break-word;
	hyphens: auto;
}

/* Small phones: the two biggest heading sizes come down a step, so "Handelsbetingelser" and
   "Virksomhedsoplysninger" fit a 320px screen without breaking in the middle of a word. */
@media (max-width: 400px) {
	body {
		--wp--preset--font-size--display: clamp(1.75rem, 8.4vw, 2.625rem);
		--wp--preset--font-size--xl: clamp(1.375rem, 6.4vw, 1.75rem);
	}
}

/* Listing pages: the product-collection scroll helper (funkid-core) lands on the grid, which sits below the
   result count and the active-filter chips. It reads scroll-padding-top, so shop pages reserve room for them. */
html:has(.funkid-shop__body) {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--funkid-header-main-height) + 24px + 4.5rem);
}

html:has(.funkid-shop__body .wc-block-product-filter-removable-chips__item) {
	scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--funkid-header-main-height) + 24px + 4.5rem + 3.5rem);
}

/* Below 1024px the filter button and sorting row sits above the count: a little more room. */
@media (max-width: 1023px) {
	html:has(.funkid-shop__body) {
		scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--funkid-header-main-height) + 24px + 5.5rem);
	}

	html:has(.funkid-shop__body .wc-block-product-filter-removable-chips__item) {
		scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--funkid-header-main-height) + 24px + 5.5rem + 3.5rem);
	}
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	overflow-x: clip;
}

img,
svg {
	max-width: 100%;
}

/* Skip link: visible on focus. */
.skip-link.screen-reader-text:focus {
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	border-radius: var(--wp--custom--radius--sm);
	box-shadow: var(--wp--preset--shadow--soft);
	clip: auto;
	clip-path: none;
	height: auto;
	left: 8px;
	top: 8px;
	padding: 12px 20px;
	width: auto;
	z-index: 100001;
}

/* ---------------------------------------------------------------
 * Focus: one clear ring for everything operable.
 * ------------------------------------------------------------- */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
	outline: var(--wp--custom--focus--width, 3px) solid var(--funkid-focus);
	outline-offset: var(--wp--custom--focus--offset, 4px);
	border-radius: 4px;
}

:where(.funkid-footer) :where(a, button):focus-visible {
	outline-color: var(--wp--preset--color--yellow);
}

/* ---------------------------------------------------------------
 * Shared building blocks
 * ------------------------------------------------------------- */
.funkid-wrap {
	width: 100%;
	max-width: 1280px;
	margin-inline: auto;
}

/* Eyebrow: small uppercase line above a heading. */
.is-style-eyebrow {
	margin-block-end: 0.9375rem;
	color: var(--wp--preset--color--contrast);
	font-size: var(--wp--preset--font-size--xs);
	font-weight: 700;
	letter-spacing: 0.17em;
	line-height: 1.4;
	text-transform: uppercase;
}

/* Pastel card (block style). */
.is-style-pastel-card {
	border-radius: var(--wp--custom--radius--md);
	padding: var(--wp--preset--spacing--md);
}

/* Logo: coloured letters and smile. Scales from one font-size. */
.funkid-logo {
	--funkid-logo-size: 57px;
	--funkid-logo-lilac: #7351aa;
	--funkid-logo-yellow: #eab643;
	--funkid-logo-coral: #df7f67;
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	padding-bottom: 0.158em;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--heading);
	font-size: var(--funkid-logo-size);
	font-weight: 600;
	letter-spacing: -0.0614em;
	line-height: 0.9;
	text-decoration: none;
}

.funkid-logo:hover {
	text-decoration: none;
}

/* 44px tall touch area (the logo itself is a little lower). */
.funkid-logo::after {
	content: "";
	position: absolute;
	inset: -4px -4px -2px;
}

.funkid-logo__f,
.funkid-logo__i {
	color: var(--funkid-logo-lilac);
}

.funkid-logo__u,
.funkid-logo__k {
	color: var(--funkid-logo-yellow);
}

.funkid-logo__n,
.funkid-logo__d {
	color: var(--funkid-logo-coral);
}

.funkid-logo small {
	align-self: flex-end;
	margin: 0 0 0.09em 0.07em;
	color: var(--wp--preset--color--contrast);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.21em;
	font-weight: 600;
	letter-spacing: -0.025em;
	line-height: 1;
}

.funkid-logo__smile {
	position: absolute;
	bottom: -0.04em;
	left: 0.65em;
	width: 0.63em;
	height: auto;
	fill: none;
	stroke: var(--funkid-logo-lilac);
	stroke-width: 3;
	stroke-linecap: round;
	transition: transform 0.25s ease;
	transform-origin: 50% 0;
}

.funkid-logo:hover .funkid-logo__smile {
	transform: scaleY(1.25);
}

/* Icons that are drawn with CSS masks inherit currentColor. */
.funkid-icon {
	width: 22px;
	height: 22px;
	flex-shrink: 0;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.65;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* 404 */
.funkid-404__smile {
	display: block;
	width: 120px;
	height: auto;
	margin: 0 auto 1.5rem;
	fill: var(--wp--preset--color--lilac);
	stroke: var(--wp--preset--color--lilac);
	stroke-width: 5;
	stroke-linecap: round;
	transform: rotate(-8deg);
}

.funkid-404__smile path {
	fill: none;
}

.funkid-404 .wp-block-buttons {
	margin-block-start: var(--wp--preset--spacing--lg);
}

.funkid-404 .funkid-search {
	margin-block-start: var(--wp--preset--spacing--lg);
}

/* ---------------------------------------------------------------
 * Horizontal scrollers (header chips, subcategory chips, front-page category cards).
 * No scrollbar, scroll snapping, and a fade at the edge where there is more to see. The fade is driven by the
 * scroll position (scroll-driven animation): left edge fades in once scrolled, right edge fades out at the end,
 * nothing at all when everything fits. They stay ordinary scroll containers: focus scrolls items into view,
 * the links keep their order, nothing is hidden from assistive technology.
 * ------------------------------------------------------------- */
@property --funkid-fade-start {
	syntax: "<length>";
	inherits: false;
	initial-value: 0px;
}

@property --funkid-fade-end {
	syntax: "<length>";
	inherits: false;
	initial-value: 0px;
}

@keyframes funkid-fade-start {
	from {
		--funkid-fade-start: 0px;
	}

	to {
		--funkid-fade-start: 32px;
	}
}

@keyframes funkid-fade-end {
	from {
		--funkid-fade-end: 32px;
	}

	to {
		--funkid-fade-end: 0px;
	}
}

.funkid-chips:not(ul),
.funkid-subcats .funkid-category-chips__list,
.woocommerce-MyAccount-navigation ul,
.funkid-category-grid {
	scrollbar-width: none;
	scroll-snap-type: x proximity;
	overscroll-behavior-x: contain;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--funkid-fade-start), #000 calc(100% - var(--funkid-fade-end)), transparent);
	mask-image: linear-gradient(90deg, transparent, #000 var(--funkid-fade-start), #000 calc(100% - var(--funkid-fade-end)), transparent);
}

.funkid-chips:not(ul)::-webkit-scrollbar,
.funkid-subcats .funkid-category-chips__list::-webkit-scrollbar,
.woocommerce-MyAccount-navigation ul::-webkit-scrollbar,
.funkid-category-grid::-webkit-scrollbar {
	display: none;
}

@supports (animation-timeline: scroll()) {
	.funkid-chips:not(ul),
	.funkid-subcats .funkid-category-chips__list,
	.woocommerce-MyAccount-navigation ul,
	.funkid-category-grid {
		animation: funkid-fade-start linear both, funkid-fade-end linear both;
		animation-timeline: scroll(self inline), scroll(self inline);
		animation-range: 0 32px, calc(100% - 32px) 100%;
	}
}

@supports not (animation-timeline: scroll()) {
	@media (max-width: 1100px) {
		.funkid-chips:not(ul),
		.funkid-subcats .funkid-category-chips__list,
		.funkid-category-grid {
			--funkid-fade-end: 28px;
		}
	}
}

/* ---------------------------------------------------------------
 * Motion: everything above is short; switch it off when asked.
 * ------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	*,
	*::before,
	*::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		scroll-behavior: auto !important;
		transition-duration: 0.001ms !important;
	}
}

/* ---------------------------------------------------------------
 * "Åbner snart" (B-044): WooCommerce's coming soon mode with the theme's own look.
 * ------------------------------------------------------------- */
.funkid-coming-soon {
	min-height: 100vh;
	min-height: 100dvh;
	text-align: center;
}

.funkid-coming-soon__logo {
	margin-block-end: var(--wp--preset--spacing--lg);
}

.funkid-coming-soon__image {
	display: block;
	width: min(320px, 70vw);
	height: auto;
	margin: 0 auto var(--wp--preset--spacing--lg);
	border-radius: 50%;
	aspect-ratio: 1;
	object-fit: cover;
}

.funkid-coming-soon__lead {
	font-size: var(--wp--preset--font-size--lg, 1.25rem);
}

.funkid-coming-soon__seller {
	margin-block-start: var(--wp--preset--spacing--sm);
	font-size: var(--wp--preset--font-size--sm, 0.875rem);
}
