/*
Theme Name: Workbench
Description: Block theme for a laser engraved gift shop for dads, grandads, uncles and brothers. Doodle-style hand-drawn look, WooCommerce ready, with a "shop by hobby" homepage.
Version: 1.3.1
Requires at least: 6.4
Requires PHP: 7.4
Tested up to: 6.8
License: GPL-2.0-or-later
Text Domain: workbench
*/

/* Search box in the header. */
.wp-block-search__inside-wrapper {
	border: 3px solid var(--wp--preset--color--ink) !important;
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	padding: 3px;
}
.wp-block-search__input { border: 0; background: transparent; padding-left: 0.75rem; }
.wp-block-search__button { border-radius: 999px; }

.wb-plain-list { list-style: none; padding-left: 0; }

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

/* Small caps line, like a caption under a drawing. */
.wb-label {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.15rem;
	line-height: 1.15;
	text-transform: uppercase;
	letter-spacing: 0.01em;
}

/* Homepage hero: a row of doodle characters, three captions, then the shop name huge. */
.wb-doodles {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
	gap: 1rem;
}
.wb-d {
	flex: 0 1 180px;
	min-width: 0;
	aspect-ratio: 1;
	background: no-repeat center / contain;
	transform-origin: 50% 90%;
}
.wb-d:nth-child(odd) { animation: wb-bob 3.2s ease-in-out infinite; }
.wb-d:nth-child(even) { animation: wb-bob 3.2s ease-in-out -1.6s infinite; }
.wb-d--mug { background-image: url(assets/doodles/mug.svg); }
.wb-d--dad { background-image: url(assets/doodles/dad.svg); }
.wb-d--pen { background-image: url(assets/doodles/pen.svg); }
.wb-d--coaster { background-image: url(assets/doodles/coaster.svg); }
.wb-d--keyring { background-image: url(assets/doodles/keyring.svg); }
.wb-d--spanner { background-image: url(assets/doodles/spanner.svg); }
@keyframes wb-bob {
	0%, 100% { transform: rotate(-3deg); }
	50% { transform: rotate(3deg) translateY(-4px); }
}
.wb-captions { gap: 1rem; }
.wb-captions > * { flex: 1 1 0; margin: 0; }
.wb-captions > :nth-child(2) { text-align: center; }
.wb-captions > :nth-child(3) { text-align: right; }
.wb-wordmark.wp-block-site-title {
	/* Fills the content column: its width is the viewport minus root padding, capped at wideSize. */
	font-size: calc(min(100vw - 2.5rem, 1240px) * 0.114);
	line-height: 0.9;
	text-wrap: balance;
	margin: 0;
}
/* Torn-paper edge under the hero. */
.wb-hero { position: relative; z-index: 1; }
.wb-hero::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	top: 100%;
	height: 24px;
	background: url(assets/rip.svg) no-repeat center / 100% 100%;
	filter: drop-shadow(0 3px 0 rgba(27, 27, 27, 0.12));
	pointer-events: none;
}
@media (max-width: 781px) {
	.wb-d { flex-basis: 30%; }
	.wb-captions { flex-direction: column; }
	.wb-captions > * { text-align: left !important; }
	.wb-captions > :not(:first-child) { display: none; }
	.wb-wordmark.wp-block-site-title { font-size: calc((100vw - 2.5rem) * 0.2); }
}

/* Hobby picker: doodle on top, name underneath, wiggles on hover. */
.wb-hobbies ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr));
	gap: 1rem;
}
.wb-hobby {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	padding: 1rem 1rem 1.25rem;
	text-align: center;
	text-decoration: none;
	color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	border-radius: 24px;
	transition: background-color 0.15s ease;
}
.wb-hobby:hover { background: var(--wp--preset--color--orange); }
.wb-hobby:hover .wb-hobby__img { animation: wb-wiggle 0.5s ease-in-out; }
.wb-hobby__img {
	width: 100%;
	aspect-ratio: 1;
	display: grid;
	place-items: center;
	overflow: hidden;
}
.wb-hobby__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 14px;
}
.wb-hobby__img img[src$=".svg"] { object-fit: contain; border-radius: 0; }
.wb-hobby__name {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.6rem;
	line-height: 1;
	text-transform: uppercase;
	margin-top: 0.5rem;
}
.wb-hobby__meta { font-size: 0.9375rem; margin-top: 0.3rem; }
@keyframes wb-wiggle {
	0%, 100% { transform: rotate(0); }
	25% { transform: rotate(-6deg); }
	75% { transform: rotate(6deg); }
}

/* "Why order from us": accordion on the left, matching picture on the right. */
.wb-why__item {
	border-bottom: 3px solid var(--wp--preset--color--ink);
	padding: 1rem 0;
}
.wb-why__item:first-child { border-top: 3px solid var(--wp--preset--color--ink); }
.wb-why__item summary {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	cursor: pointer;
	list-style: none;
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(1.5rem, 3vw, 2.25rem);
	line-height: 1.05;
	text-transform: uppercase;
}
.wb-why__item summary::-webkit-details-marker { display: none; }
.wb-why__item summary::after { content: "+"; }
.wb-why__item[open] summary::after { content: "–"; }
.wb-why__item p { margin: 0.75rem 0 0; max-width: 46ch; }
.wb-why__art {
	position: relative;
	aspect-ratio: 1;
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	border-radius: 24px;
	overflow: hidden;
}
.wb-why__art .wb-why__img {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	transition: opacity 0.4s ease;
}
.wb-why__art .wb-why__img.is-active { opacity: 1; }
.wb-why__img img { width: 100%; height: 100%; object-fit: cover; }
.wb-why__img img[src$=".svg"] { object-fit: contain; padding: 14%; box-sizing: border-box; }
@media (max-width: 781px) {
	.wb-why__art { aspect-ratio: 4 / 3; }
}

/* Shop sidebar filters. */
.wb-filters {
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	border-radius: 24px;
	padding: 1.25rem;
}
@media (min-width: 782px) {
	.wb-shop__sidebar { position: sticky; top: 1rem; align-self: flex-start; }
}
.wb-filters summary {
	cursor: pointer;
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.5rem;
	text-transform: uppercase;
}
.wb-filters fieldset { border: 0; padding: 0; margin: 1.25rem 0 0; }
.wb-filters legend {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.15rem;
	text-transform: uppercase;
	margin-bottom: 0.4rem;
}
.wb-filters li { margin: 0.2rem 0; }
.wb-filters a { text-decoration: none; }
.wb-filters a[aria-current] { font-weight: 600; text-decoration: underline 3px var(--wp--preset--color--orange); text-underline-offset: 4px; }
.wb-filters label { display: block; margin: 0.25rem 0; cursor: pointer; }
.wb-filters__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1rem; margin-top: 1.25rem; }
.wb-filters__actions .wp-element-button { cursor: pointer; white-space: nowrap; }
.wb-filters input[type=radio] { accent-color: var(--wp--preset--color--ink); }

/* Two-handled price slider made from a pair of range inputs. */
.wb-price__track {
	position: relative;
	height: 28px;
	margin: 0.5rem 0;
	background: linear-gradient(to right,
		var(--wp--preset--color--paper) var(--lo, 0%), var(--wp--preset--color--orange) var(--lo, 0%),
		var(--wp--preset--color--orange) var(--hi, 100%), var(--wp--preset--color--paper) var(--hi, 100%)) center / 100% 8px no-repeat;
	border-radius: 999px;
}
.wb-price__track input {
	position: absolute;
	inset: 0;
	width: 100%;
	margin: 0;
	background: none;
	pointer-events: none;
	-webkit-appearance: none;
	appearance: none;
}
.wb-price__track input::-webkit-slider-thumb {
	-webkit-appearance: none;
	pointer-events: auto;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	cursor: grab;
}
.wb-price__track input::-moz-range-thumb {
	pointer-events: auto;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	cursor: grab;
}
.wb-price__label { font-weight: 600; }

/* Product page: SKU, categories and tags stacked instead of in a row. */
.wp-block-woocommerce-product-meta .is-layout-flex,
[data-type="woocommerce/product-meta"] .is-layout-flex {
	flex-direction: column;
	align-items: flex-start;
	gap: 0.35rem;
}

/* Note from the maker, with the dad doodle peeking over the corner. */
.wb-note {
	position: relative;
	background: var(--wp--preset--color--white);
	border: 3px solid var(--wp--preset--color--ink);
	border-radius: 24px;
}
.wb-note::before {
	content: "";
	position: absolute;
	top: -70px;
	right: 18px;
	width: 120px;
	height: 120px;
	background: url(assets/doodles/dad.svg) no-repeat center / contain;
}
.wb-signature {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.6rem;
	text-transform: uppercase;
}

@media (prefers-reduced-motion: reduce) {
	.wb-d, .wb-hobby:hover .wb-hobby__img { animation: none !important; }
}

/* Classic WooCommerce product grids (shortcodes) in the same style. */
.woocommerce ul.products li.product .button,
.woocommerce a.button,
.woocommerce button.button {
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--paper);
	font-family: var(--wp--preset--font-family--body);
	font-weight: 600;
	border-radius: 999px;
}
.woocommerce ul.products li.product .button:hover,
.woocommerce a.button:hover,
.woocommerce button.button:hover {
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--ink);
}
.woocommerce ul.products li.product a img {
	border: 3px solid var(--wp--preset--color--ink);
	border-radius: 24px;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
	font-family: var(--wp--preset--font-family--display);
	font-size: 1.35rem;
	text-transform: uppercase;
	color: var(--wp--preset--color--ink);
}
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price {
	color: var(--wp--preset--color--ink);
	font-weight: 600;
}
.woocommerce span.onsale {
	background: var(--wp--preset--color--orange);
	color: var(--wp--preset--color--ink);
}
