/*
 * Wauw — editorial salon + shop
 */

:root {
	--wauw-fast: 180ms ease;
	--wauw-header: 4.25rem;
	--wauw-gutter: clamp(1.1rem, 3vw, 2.25rem);
}

@media (prefers-reduced-motion: no-preference) {
	html {
		scroll-behavior: smooth;
	}
}

body.wauw-theme {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
	font-variant-numeric: lining-nums;
	font-synthesis: none;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
}

.wauw-theme .wp-site-blocks {
	padding: 0 !important;
	gap: 0 !important;
}

.wauw-theme .wp-site-blocks > header,
.wauw-theme .wp-site-blocks > main,
.wauw-theme .wp-site-blocks > footer,
.wauw-theme header.wp-block-template-part,
.wauw-home,
.wauw-page,
.wauw-shop-main,
.wauw-product-main {
	display: block;
	width: 100%;
	max-width: none;
	margin: 0 !important;
	padding: 0 !important;
}

.wauw-theme header.wp-block-template-part > .wp-block-woocommerce-customer-account,
.wauw-theme header.wp-block-template-part > .wp-block-woocommerce-mini-cart {
	display: none !important;
}

:where(a, button, input, select, textarea):focus-visible {
	outline: 2px solid var(--wp--preset--color--contrast);
	outline-offset: 3px;
}

:where(button, input, select, textarea) {
	font: inherit;
}

:where(a) {
	color: inherit;
	text-underline-offset: 0.18em;
}

:where(img) {
	height: auto;
	max-width: 100%;
}

/* Faroese compounds (Hárfríðkanarstova, Hárfríðkanarstovan) can out-measure a
   narrow viewport at display sizes, so keep a last-resort break — that only
   fires when a word genuinely cannot fit.

   Never `hyphens: auto`: Safari has a Faroese dictionary and happily set
   "Hárfríðkanarsto-va" across two lines in the hero, while Chrome did not
   hyphenate at all. Stated explicitly so no UA default re-enables it. */
.wauw-theme :is(h1, h2, h3, .wauw-card__title) {
	/* `break-word` breaks the line but still reports the whole word as the
	   min-content width, which pushed the hero copy to 343px inside a 320px
	   viewport. `anywhere` shrinks min-content too, so the container can never
	   be widened by a single Faroese compound. First value is the fallback. */
	overflow-wrap: break-word;
	overflow-wrap: anywhere;
	-webkit-hyphens: manual;
	hyphens: manual;
}


/* Nothing may push the document wider than the viewport. */
body.wauw-theme {
	overflow-x: clip;
}

.wp-element-button,
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.4rem;
	min-height: 2.75rem;
	padding: 0.75rem 1.35rem;
	border: 1px solid var(--wp--preset--color--contrast);
	border-radius: 999px;
	background: var(--wp--preset--color--contrast);
	color: var(--wp--preset--color--accent-5);
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background var(--wauw-fast), color var(--wauw-fast);
}

.wp-element-button:hover {
	opacity: 0.85;
}

.wp-block-button.is-style-outline .wp-element-button {
	background: transparent;
	color: var(--wp--preset--color--contrast);
}

/* Product cards + grid
   ========================================================================== */

.wauw-grid,
ul.products {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 1.35rem 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.wauw-card,
.wc-block-product,
ul.products li.product {
	display: flex;
	flex-direction: column;
	margin: 0;
	background: transparent;
}

.wauw-card__media,
.wc-block-product .wc-block-components-product-image,
ul.products li.product img {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	background: var(--wp--preset--color--accent-2);
}

.wauw-card__media img,
.wc-block-product img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.wc-block-components-product-sale-badge {
	position: absolute;
	top: 0.6rem;
	right: 0.6rem;
	padding: 0.3rem 0.7rem;
	border-radius: 999px;
	background: #8a3a14;
	color: #f7f3ec;
	font-size: 0.9rem;
}

.wauw-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.2rem;
	padding: 0.75rem 0 0;
}

.wauw-card__brand {
	margin: 0;
	font-size: 0.9rem;
	color: var(--wp--preset--color--accent-4);
}

.wauw-card__title {
	margin: 0;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1rem;
	font-weight: 400;
	line-height: 1.25;
}

.wauw-card__title a {
	text-decoration: none;
}

.wauw-card__price,
.wc-block-components-product-price {
	font-size: 0.92rem;
}

.wauw-card__cart,
.wc-block-components-product-button .wp-element-button {
	margin-top: 0.55rem;
	align-self: start;
	min-height: 2.2rem;
	padding: 0.45rem 0.8rem;
	border: 1px solid currentColor;
	border-radius: 999px;
	background: transparent;
	color: var(--wp--preset--color--contrast);
	cursor: pointer;
}

.wauw-card__cart:hover {
	background: var(--wp--preset--color--contrast);
	color: #fff;
}

@media (max-width: 1100px) {
	.wauw-grid,
	ul.products {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@media (max-width: 760px) {
	.wauw-grid,
	ul.products {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Show more, and nothing found */
.wauw-more { padding: 2rem var(--wauw-gutter) 0; text-align: center; }
.wauw-more [hidden] { display: none; }

.wauw-empty {
	grid-column: 1 / -1;
	padding: 4rem 1rem;
	text-align: center;
}

/* Product page
   ========================================================================== */

/* Gallery: one large square slide + a thumbnail row.
   flexslider sizes the track inline, so we only contain it and set the crop —
   no competing layout on `__wrapper`, or the slides land outside the viewport. */
.wauw-product-gallery .woocommerce-product-gallery {
	position: relative;
	max-width: 100%;
}

.wauw-product-gallery .flex-viewport {
	max-width: 100%;
	overflow: hidden;
}

.wauw-product-gallery .woocommerce-product-gallery__wrapper {
	margin: 0;
	padding: 0;
	list-style: none;
}

.wauw-product-gallery .woocommerce-product-gallery__image img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	background: var(--wp--preset--color--accent-2);
}

.wauw-product-gallery .flex-control-thumbs {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0.5rem;
	margin: 0.5rem 0 0;
	padding: 0;
	list-style: none;
}

/* WooCommerce sizes these thumbs for a float row with `li { width: 25% }`.
   Inside a grid track that resolves to 25% *of the track* (~30px), and its
   selector is more specific than anything sane here — hence !important. */
.wauw-product-gallery .flex-control-thumbs li {
	float: none !important;
	width: 100% !important;
	margin: 0 !important;
}

.wauw-product-gallery .flex-control-thumbs img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	background: var(--wp--preset--color--accent-2);
	cursor: pointer;
	opacity: 0.5;
	transition: opacity var(--wauw-fast);
}

.wauw-product-gallery .flex-control-thumbs img.flex-active,
.wauw-product-gallery .flex-control-thumbs img:hover {
	opacity: 1;
}

/* Zoom trigger: keep it, but quiet */
.wauw-product-gallery .woocommerce-product-gallery__trigger {
	top: 0.75rem;
	right: 0.75rem;
	z-index: 3;
}

/* CookieHub
   ==========================================================================
   CookieHub is configured as a cookie *wall*: `.ch2-container.ch2-block` is a
   fixed rgba(255,255,255,0.8) sheet at z-index 2147483647 and it sets
   body{overflow:hidden}. That is what made the whole site look washed out and
   unscrollable. We keep the consent dialog fully visible and clickable, and
   drop only the page-blocking sheet. JS re-asserts this if CookieHub repaints.
   ========================================================================== */

.ch2 .ch2-container,
.ch2-container.ch2-block,
.ch2-container {
	background: transparent !important;
	backdrop-filter: none !important;
	pointer-events: none !important;
}

.ch2 .ch2-container > *,
#ch2-dialog,
.ch2-settings {
	pointer-events: auto !important;
}

/* CookieHub sizes its buttons with content-box, so width:100% overflows the
   card. Normalise the box model inside the dialog only. */
#ch2-dialog,
#ch2-dialog *,
.ch2-settings,
.ch2-settings * {
	box-sizing: border-box !important;
}

/* Quiet bottom-right card. Id + class so we out-specify CookieHub's own CSS. */
#ch2-dialog.ch2-dialog,
.ch2 #ch2-dialog.ch2-dialog,
#ch2-dialog.ch2-dialog-center {
	position: fixed !important;
	inset: auto 1rem 1rem auto !important;
	width: min(23rem, calc(100vw - 2rem)) !important;
	max-width: min(23rem, calc(100vw - 2rem)) !important;
	min-width: 0 !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 1.15rem 1.25rem 1.25rem !important;
	transform: none !important;
	font-family: var(--wp--preset--font-family--body) !important;
	background: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--contrast) 12%, transparent) !important;
	border-radius: 1rem !important;
	box-shadow: 0 16px 48px rgb(22 21 19 / 20%) !important;
}

.ch2-settings {
	font-family: var(--wp--preset--font-family--body) !important;
	background: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
	border-radius: 1rem !important;
}

#ch2-dialog .ch2-dialog-content,
#ch2-dialog .ch2-dialog-content p {
	max-width: none !important;
	margin: 0 0 0.6rem !important;
	font-size: 0.85rem !important;
	line-height: 1.45 !important;
}

/* CookieHub's own icon is decorative and eats width in a narrow card. */
#ch2-dialog .ch2-icon {
	display: none !important;
}

#ch2-dialog .ch2-dialog-actions {
	display: flex !important;
	flex-direction: column !important;
	gap: 0.4rem !important;
	width: 100% !important;
	margin-top: 0.9rem !important;
}

#ch2-dialog .ch2-btn,
#ch2-dialog .ch2-allow-all-btn,
#ch2-dialog .ch2-deny-all-btn,
#ch2-dialog .ch2-open-settings-btn {
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	width: 100% !important;
	height: auto !important;
	min-height: 2.75rem !important;
	margin: 0 !important;
	padding: 0.7rem 0.85rem !important;
	overflow: visible !important;
	border-radius: 999px !important;
	font-size: 0.95rem !important;
	font-weight: 600 !important;
	letter-spacing: 0 !important;
	line-height: 1.25 !important;
	text-align: center !important;
	text-transform: none !important;
	text-overflow: clip !important;
	white-space: normal !important;
}

#ch2-dialog .ch2-allow-all-btn {
	border: 1px solid var(--wp--preset--color--contrast) !important;
	background: var(--wp--preset--color--contrast) !important;
	color: #fff !important;
}

#ch2-dialog .ch2-deny-all-btn,
#ch2-dialog .ch2-open-settings-btn {
	border: 1px solid var(--wp--preset--color--contrast) !important;
	background: transparent !important;
	color: var(--wp--preset--color--contrast) !important;
}

@media (max-width: 560px) {
	#ch2-dialog.ch2-dialog,
	.ch2 #ch2-dialog.ch2-dialog,
	#ch2-dialog.ch2-dialog-center {
		inset: auto 0.75rem 0.75rem 0.75rem !important;
		width: auto !important;
		max-width: none !important;
	}
}

/* Hide leftover plugin chrome if still present */
.aws-container,
.aws-search-form,
.aws-overlay {
	display: none !important;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}
