/* ==========================================================================
   Mawio Woven — frame, book mechanics and component styles
   Tokens (colours, fonts, sizes) live in theme.json; this file only uses them.
   ========================================================================== */

:root {
	--woven-gold-line: rgba(230, 209, 164, .35);
	--woven-frame: 18px;
	--woven-band: 10px;
	--woven-pad-y: clamp(24px, 6vh, 56px);
	--woven-pad-x: clamp(20px, 5vw, 72px);
	--woven-turn: .9s cubic-bezier(.7, 0, .2, 1);
}

/* ---------- The frame: plum edge → woven band → carpet page ---------- */

html, body { height: 100%; }

body {
	margin: 0;
	padding: var(--woven-frame);
	box-sizing: border-box;
	height: 100vh;
	height: 100dvh;
	overflow: hidden;
	background: var(--wp--preset--color--plum);
}

body.admin-bar { height: calc(100dvh - var(--wp-admin--admin-bar--height, 32px)); }

.wp-site-blocks {
	height: 100%;
	box-sizing: border-box;
	border: 1px solid var(--wp--preset--color--gold);
	padding: var(--woven-band);
	background: repeating-linear-gradient(45deg, var(--wp--preset--color--wine) 0 6px, var(--wp--preset--color--plum) 6px 12px);
}

.woven-carpet {
	height: 100%;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	border: 1px solid var(--wp--preset--color--gold);
	background:
		linear-gradient(rgba(25, 12, 21, .4), rgba(25, 12, 21, .4)),
		url("../img/carpet.webp") center / cover no-repeat,
		var(--wp--preset--color--plum);
	margin: 0 !important;
}
.woven-carpet > * { margin-block: 0 !important; }

/* ---------- Header ---------- */

.woven-header {
	flex-shrink: 0;
	min-height: 64px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px 28px;
	padding: 0 32px;
	border-bottom: 1px solid var(--woven-gold-line);
}
.woven-header .wp-block-site-title a { color: var(--wp--preset--color--bone); }
.woven-header .wp-block-navigation a { color: var(--wp--preset--color--bone); padding-block: 12px; }
.woven-header .wp-block-navigation a:hover,
.woven-header .wp-block-navigation .current-menu-item a,
.woven-header .wp-block-navigation a[aria-current="page"] { color: var(--wp--preset--color--gold); }

/* ---------- Main area ---------- */

.woven-main {
	flex: 1;
	min-height: 0;
	position: relative;
	overflow-y: auto;
	overflow-x: hidden;
	margin: 0 !important;
}
/* Ordinary pages (shop, basket, checkout, FAQ) scroll inside the frame. */
.woven-main > .wp-block-post-content,
.woven-main > .woocommerce,
.woven-main > .wp-block-group:not(.woven-book) {
	padding: var(--woven-pad-y) var(--woven-pad-x);
}

/* ---------- Footer ---------- */

.woven-footer {
	flex-shrink: 0;
	min-height: 52px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px 24px;
	padding: 0 32px;
	border-top: 1px solid var(--woven-gold-line);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 500;
	letter-spacing: .06em;
}
.woven-footer p { margin: 0; }
.woven-footer a { color: var(--wp--preset--color--ash); }
.woven-footer a:hover { color: var(--wp--preset--color--bone); }

/* ==========================================================================
   The book
   Content: a Group with class "woven-book" containing Groups with class
   "woven-page". book.js turns those into horizontally turned pages.
   Without JS the pages simply stack and scroll.
   ========================================================================== */

/* A page template that holds a book gives the book the whole main area. */
.woven-main:has(.woven-book) { overflow: hidden; }
.woven-main:has(.woven-book) > .wp-block-post-content { padding: 0; height: 100%; }

.woven-book { position: relative; height: 100%; margin: 0 !important; }

.woven-page {
	box-sizing: border-box;
	padding: var(--woven-pad-y) var(--woven-pad-x);
	position: relative;
	margin: 0 !important;
}

.woven-book.is-turning {
	display: flex;
	overflow: hidden;
}
/* Wrappers emptied when pages move into the track (e.g. a Query Loop). */
.woven-book.is-turning > :not(.woven-track):not(.woven-tabs):not(.woven-pager) { display: none; }
.woven-book.is-turning > .woven-track {
	flex: 1;
	min-width: 0;
	display: flex;
	height: 100%;
	transition: transform var(--woven-turn);
	will-change: transform;
}
.woven-book.is-turning .woven-page {
	flex: 0 0 100%;
	height: 100%;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	justify-content: center;
}
.woven-book.is-turning .woven-page > * { width: 100%; max-width: none; }

/* Thumb-index tabs down the right edge */
.woven-tabs {
	width: 56px;
	flex-shrink: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 6px;
	border-left: 1px solid var(--woven-gold-line);
}
.woven-tabs button {
	width: 56px;
	height: 64px;
	border: 0;
	background: transparent;
	color: var(--wp--preset--color--gold);
	font-family: var(--wp--preset--font-family--display);
	font-size: 20px;
	cursor: pointer;
}
.woven-tabs button[aria-current="page"] { background: var(--wp--preset--color--gold); color: var(--wp--preset--color--plum); }
.woven-tabs button:focus-visible { outline: 2px solid var(--wp--preset--color--bone); outline-offset: -4px; }

/* Pager injected into the footer */
.woven-pager { display: flex; align-items: center; gap: 16px; }
.woven-pager__label { color: var(--wp--preset--color--ash); margin: 0; }
.woven-pager button {
	min-height: 44px;
	padding: 0 14px;
	border: 0;
	background: none;
	color: var(--wp--preset--color--bone);
	font: inherit;
	cursor: pointer;
}
.woven-pager button.is-next { color: var(--wp--preset--color--gold); }
.woven-pager button:disabled { opacity: .35; cursor: default; }

/* Huge outlined numeral behind each page */
.woven-page__glyph {
	position: absolute;
	right: -2vw;
	top: -4vh;
	font-family: var(--wp--preset--font-family--display);
	font-size: min(48vw, 80vh);
	line-height: .8;
	color: transparent;
	-webkit-text-stroke: 1.5px rgba(230, 209, 164, .15);
	pointer-events: none;
	user-select: none;
	z-index: 0;
}
.woven-page > *:not(.woven-page__glyph) { position: relative; z-index: 1; }

/* ---------- Components ---------- */

.is-style-label,
.woven-label {
	color: var(--wp--preset--color--gold);
	font-size: var(--wp--preset--font-size--label);
	font-weight: 500;
	letter-spacing: .06em;
}

.is-style-leaf,
.wp-block-group.is-style-leaf {
	background: rgba(25, 12, 21, .78);
	padding: clamp(28px, 4vh, 48px) clamp(24px, 3.6vw, 52px);
}

.wp-block-image.is-style-mount img {
	outline: 1px solid var(--wp--preset--color--gold);
	outline-offset: 10px;
}
.woven-book .wp-block-image img {
	max-height: calc(100dvh - 300px);
	width: auto;
	max-width: 100%;
	object-fit: contain;
	margin-inline: auto;
	display: block;
}

.wp-block-button.is-style-ghost .wp-block-button__link {
	background: transparent;
	color: var(--wp--preset--color--bone);
	border: 1px solid var(--wp--preset--color--gold);
}
.wp-block-button.is-style-ghost .wp-block-button__link:hover { background: rgba(230, 209, 164, .12); }

.has-ash-color { color: var(--wp--preset--color--ash); }
.woven-measure { max-width: 40ch; }
.woven-measure-tight { max-width: 12ch; }

/* Headline sizes never wrap one word per line */
.has-hero-font-size { line-height: .92; }
.has-headline-font-size { line-height: .95; }

/* Price rows */
.woven-price { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--heading-m); line-height: 1; margin: 0; }

/* Text-only cells (e.g. "What we design") */
.woven-cells { gap: 1px !important; background: var(--woven-gold-line); border: 1px solid var(--woven-gold-line); }
.woven-cells > .wp-block-column { background: rgba(25, 12, 21, .72); padding: clamp(20px, 2.4vw, 36px); margin: 0 !important; }

/* Forms on carpet (Mailchimp, WooCommerce) */
.woven-carpet input[type="email"],
.woven-carpet input[type="text"],
.woven-carpet input[type="tel"],
.woven-carpet input[type="number"],
.woven-carpet select,
.woven-carpet textarea {
	background: rgba(25, 12, 21, .55);
	color: var(--wp--preset--color--bone);
	border: 1px solid var(--wp--preset--color--gold);
	border-radius: 0;
	min-height: 52px;
	padding: 0 16px;
	font-family: var(--wp--preset--font-family--body);
	font-size: 16px;
}
.mc4wp-form-fields { display: flex; flex-wrap: wrap; gap: 0; max-width: 520px; }
.mc4wp-form-fields p { margin: 0; }
.mc4wp-form-fields input[type="email"] { min-width: 240px; flex: 1; }
.mc4wp-form-fields input[type="submit"] {
	min-height: 52px; padding: 0 28px; border: 0; cursor: pointer;
	background: var(--wp--preset--color--clay); color: #fff; font: 600 15px var(--wp--preset--font-family--body);
}

/* ---------- WooCommerce on carpet ---------- */

.woocommerce .woven-leaf-wrap,
.woocommerce-cart .wp-block-post-content,
.woocommerce-checkout .wp-block-post-content { background: rgba(25, 12, 21, .78); }
.woocommerce ul.products li.product .woocommerce-loop-product__title { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--heading-s); }
.woocommerce .price, .woocommerce-Price-amount { color: var(--wp--preset--color--gold); }
.woocommerce div.product .product_title { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--hero); line-height: .92; }
.woocommerce a.button, .woocommerce button.button, .woocommerce .button.alt {
	background: var(--wp--preset--color--clay) !important; color: #fff !important; border-radius: 0 !important;
	font-family: var(--wp--preset--font-family--body); font-weight: 600; padding: 16px 28px !important;
}
.woocommerce-tabs, .woocommerce .related { background: rgba(25, 12, 21, .78); padding: 32px; }

/* ---------- Phones and small tablets ---------- */

@media (max-width: 781px) {
	:root { --woven-frame: 6px; --woven-band: 5px; }
	.woven-header { padding: 0 16px; min-height: 56px; }
	.woven-footer { padding: 0 16px; }
	.woven-footer:has(.woven-pager) > :not(.woven-pager-slot) { display: none; }
	.woven-footer .woven-pager-slot { width: 100%; }
	.woven-pager { width: 100%; justify-content: space-between; gap: 4px; }
	.woven-pager__label { font-size: 11px; }
	.woven-tabs { display: none; }
	/* On phones each page may scroll vertically; turning is sideways. */
	.woven-book.is-turning .woven-page { overflow-y: auto; justify-content: flex-start; }
	.woven-book .wp-block-image img { max-height: 46dvh; }
	.woven-page__glyph { font-size: 80vw; }
}

@media (prefers-reduced-motion: reduce) {
	.woven-book.is-turning > .woven-track { transition: none; }
}

/* ---------- Editor: show pages stacked, framed, so they're easy to edit ---------- */

.editor-styles-wrapper .woven-page {
	min-height: 70vh;
	border-bottom: 1px dashed var(--woven-gold-line);
	background:
		linear-gradient(rgba(25, 12, 21, .55), rgba(25, 12, 21, .55)),
		url("../img/carpet.webp") center / cover no-repeat;
}

/* ---------- Additions: measures, single pages, product images ---------- */

.woven-measure-wide { max-width: 18ch; }
p.woven-measure-wide { max-width: 52ch; }
.woven-measure-quote { max-width: 22ch; margin: 0; padding: 0; }
.woven-measure-quote p { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--headline); line-height: 1; }

/* A one-screen page that doesn't turn (About) */
.woven-single { height: 100%; box-sizing: border-box; display: flex; align-items: center; padding: var(--woven-pad-y) var(--woven-pad-x); }
.woven-single > .wp-block-columns { width: 100%; }
.woven-single .wp-block-image img { max-height: calc(100dvh - 260px); width: auto; max-width: 100%; display: block; margin-inline: auto; }
.woven-main:has(.woven-single) > .wp-block-post-content { padding: 0; height: 100%; }

.wp-block-post-featured-image.is-style-mount img { outline: 1px solid var(--wp--preset--color--gold); outline-offset: 10px; }
.woven-book .wp-block-post-featured-image img {
	max-height: calc(100dvh - 300px);
	width: auto !important;
	max-width: 100%;
	object-fit: contain;
	display: block;
	margin-inline: auto;
}
.woven-book .wp-block-post-title a { color: var(--wp--preset--color--bone); }
.woven-book .wp-block-woocommerce-product-price { font-family: var(--wp--preset--font-family--display); }

/* Single product page */
.woven-product { padding: var(--woven-pad-y) var(--woven-pad-x); }
.woven-product .woocommerce-product-gallery img { max-height: calc(100dvh - 280px); width: auto; margin-inline: auto; }

@media (max-width: 781px) {
	.woven-single { height: auto; align-items: flex-start; }
	.woven-main:has(.woven-single) { overflow-y: auto; }
}

/* Header/footer children sit flush; paragraphs set at heading sizes use the display face */
.woven-header > *, .woven-footer > * { margin-block: 0 !important; }
p.has-hero-font-size, p.has-headline-font-size, p.has-heading-l-font-size, p.has-heading-m-font-size, p.has-heading-s-font-size {
	font-family: var(--wp--preset--font-family--display);
	line-height: 1.04;
	letter-spacing: -.01em;
}
.wp-block-column > .woven-cells + .woven-cells { margin-top: -1px !important; }
.woven-cells .wp-block-column > * + * { margin-top: 12px; }

/* v0.1.1 — product pages in the book: button sits under the price, not centred */
.woven-book .wc-block-components-product-button { justify-content: flex-start; align-items: flex-start; }
.woven-book .wc-block-components-product-button .wp-block-button__link { width: auto; }
.woven-book .wp-block-post-featured-image { width: fit-content; max-width: 100%; margin-inline: auto; }

/* ==========================================================================
   v0.1.2 — ordinary pages (FAQ, account, basket, checkout) and WooCommerce's
   own templates
   ========================================================================== */

/* Any non-book page gets a readable plum panel, centred. */
.woven-main > .wp-block-post-content:not(:has(.woven-book, .woven-single)),
.woven-panel {
	box-sizing: border-box;
	width: min(1180px, calc(100% - 2 * var(--woven-pad-x)));
	margin: var(--woven-pad-y) auto !important;
	padding: clamp(28px, 4vw, 64px) !important;
	background: rgba(25, 12, 21, .82);
	border: 1px solid var(--woven-gold-line);
}
.woven-panel .wp-block-post-content { padding: 0 !important; width: auto; margin: 0 !important; background: none; border: 0; }
.woven-main > .wp-block-post-content:not(:has(.woven-book, .woven-single)) h1,
.woven-panel h1 { font-size: var(--wp--preset--font-size--heading-l); }
.woven-main > .wp-block-post-content:not(:has(.woven-book, .woven-single)) h2 { font-size: var(--wp--preset--font-size--heading-m); }
/* Old page-builder boxes inside panels shouldn't add a second background. */
.woven-main .bBlocksContainer { background: transparent !important; box-shadow: none !important; }

/* WooCommerce templates the theme doesn't ship (order received, coming soon…):
   recreate the frame around their header / main / footer. */
.wp-site-blocks:not(:has(.woven-carpet)) {
	display: flex;
	flex-direction: column;
	position: relative;
	isolation: isolate;
}
.wp-site-blocks:not(:has(.woven-carpet))::before {
	content: "";
	position: absolute;
	inset: var(--woven-band);
	z-index: -1;
	border: 1px solid var(--wp--preset--color--gold);
	background:
		linear-gradient(rgba(25, 12, 21, .4), rgba(25, 12, 21, .4)),
		url("../img/carpet.webp") center / cover no-repeat,
		var(--wp--preset--color--plum);
}
.wp-site-blocks:not(:has(.woven-carpet)) > header {
	flex-shrink: 0; min-height: 64px; display: flex; align-items: center; justify-content: space-between;
	gap: 16px 28px; padding: 0 32px; border-bottom: 1px solid var(--woven-gold-line); margin: 1px 1px 0;
}
.wp-site-blocks:not(:has(.woven-carpet)) > header > header { width: 100%; background: none; }
.wp-site-blocks:not(:has(.woven-carpet)) > main {
	flex: 1; min-height: 0; overflow-y: auto; margin: 0 1px !important;
	padding: var(--woven-pad-y) var(--woven-pad-x) !important;
}
.wp-site-blocks:not(:has(.woven-carpet)) > main > * {
	background: rgba(25, 12, 21, .82);
	padding: clamp(20px, 3vw, 48px);
	max-width: 1180px; margin-inline: auto !important; box-sizing: border-box;
}
.wp-site-blocks:not(:has(.woven-carpet)) > footer {
	flex-shrink: 0; min-height: 52px; display: flex; align-items: center; justify-content: space-between;
	padding: 0 32px; border-top: 1px solid var(--woven-gold-line); margin: 0 1px 1px;
	font-size: var(--wp--preset--font-size--label);
}

/* Architecture "four kinds of room": both rows line up as one grid */
.woven-cells { align-items: stretch !important; }
.woven-cells > .wp-block-column { align-self: stretch !important; }
.wp-block-column:has(> .woven-cells) { display: flex; flex-direction: column; gap: 0 !important; }
.wp-block-column:has(> .woven-cells) > .woven-cells { margin: 0 !important; }
.wp-block-column:has(> .woven-cells) > .woven-cells + .woven-cells { border-top: 0; }

/* v0.1.3 — single product: WooCommerce wraps the whole template in a product div */
.wp-site-blocks > .woocommerce.product,
.wp-site-blocks > div:has(> .woven-carpet) { height: 100%; margin: 0 !important; }

/* Jetpack subscribe form on carpet */
.wp-block-jetpack-subscriptions { max-width: 560px; }
.wp-block-jetpack-subscriptions input[type="email"] { background: rgba(25, 12, 21, .55) !important; color: var(--wp--preset--color--bone) !important; border: 1px solid var(--wp--preset--color--gold) !important; border-radius: 0 !important; }
.wp-block-jetpack-subscriptions button { background: var(--wp--preset--color--clay) !important; border-radius: 0 !important; }

/* v0.1.4 — phone pager: label truncates, buttons never wrap */
.woven-pager__label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.woven-pager > div { display: flex; flex-shrink: 0; white-space: nowrap; }
@media (max-width: 781px) {
	.woven-pager__label { flex: 1; }
	.woven-pager button { padding: 0 10px; }
	.woven-main, .woven-page { scrollbar-width: none; }
	.woven-main::-webkit-scrollbar, .woven-page::-webkit-scrollbar { display: none; }
}
@media (max-width: 781px) {
	/* Keep the price and Add to basket on screen without scrolling */
	.woven-book .wp-block-image img,
	.woven-book .wp-block-post-featured-image img { max-height: 36dvh !important; }
	.woven-book .wp-block-columns:not(.woven-cells) { gap: 20px !important; }
	.woven-book .has-hero-font-size { font-size: clamp(48px, 15vw, 72px) !important; }
}

/* v0.1.4 — phone menu overlay in the Woven look */
.wp-block-navigation__responsive-container.is-menu-open {
	background:
		linear-gradient(rgba(25, 12, 21, .75), rgba(25, 12, 21, .75)),
		url("../img/carpet.webp") center / cover no-repeat,
		var(--wp--preset--color--plum) !important;
	color: var(--wp--preset--color--bone) !important;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation-item__content {
	font-family: var(--wp--preset--font-family--display);
	font-size: clamp(32px, 9vw, 44px);
	letter-spacing: 0;
	color: var(--wp--preset--color--bone) !important;
}
.wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__responsive-container-content { gap: 18px !important; }

@media (max-width: 781px) {
	/* Single product: picture smaller so title, price and button come into view */
	.woven-product .woocommerce-product-gallery img { max-height: 40dvh; width: auto; margin-inline: auto; }
	.woven-product .flex-control-thumbs li { width: 18% !important; }
	.woven-footer p { white-space: nowrap; }
}

/* Product tabs in the Woven look */
.woocommerce div.product .woocommerce-tabs ul.tabs li { background: transparent !important; border-color: var(--woven-gold-line) !important; border-radius: 0 !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li a { color: var(--wp--preset--color--ash) !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { background: var(--wp--preset--color--gold) !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active a { color: var(--wp--preset--color--plum) !important; }
.woocommerce div.product .woocommerce-tabs ul.tabs li::before, .woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none !important; }
@media (max-width: 781px) { .woocommerce-tabs, .woocommerce .related { padding: 20px !important; } }
@media (max-width: 781px) {
	.woven-cells { gap: 1px !important; row-gap: 1px !important; }
	.woven-cells > .wp-block-column { margin: 0 !important; flex-basis: 100% !important; }
	.wp-block-columns:has(.woven-cells) { gap: 20px !important; }
}
@media (max-width: 781px) {
	/* Text panels use the full phone width; old page-builder columns don't squeeze text */
	.woven-main > .wp-block-post-content:not(:has(.woven-book, .woven-single)),
	.woven-panel { padding: 24px 20px !important; width: calc(100% - 24px); }
	.woven-main .bBlocksContainerContent,
	.woven-main .bBlocksContainerContent > *,
	.woven-main .is-layout-constrained > * { max-width: 100% !important; }
	.woven-main > .wp-block-post-content:not(:has(.woven-book, .woven-single)) h1 { font-size: clamp(36px, 10vw, 48px); }
}

/* ==========================================================================
   v0.2.0 — review feedback
   - no hatched border: header at the very top, footer at the very bottom
   - no big outlined numerals
   - no offset borders around images
   - shop and project gallery: 9 thumbnails + selected item
   ========================================================================== */

:root { --woven-frame: 0px; --woven-band: 0px; }
body, body.admin-bar { padding: 0 !important; }
.wp-site-blocks { border: 0 !important; padding: 0 !important; background: none !important; }
.woven-carpet { border: 0 !important; }
.wp-site-blocks:not(:has(.woven-carpet))::before { inset: 0 !important; border: 0 !important; }
.woven-page__glyph { display: none !important; }

.wp-block-image.is-style-mount img,
.wp-block-post-featured-image.is-style-mount img,
.woven-book .wp-block-image img,
.woven-single .wp-block-image img { outline: none !important; }

/* ---------- Catalogue ---------- */

.woven-catalogue {
	box-sizing: border-box;
	height: 100%;
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: clamp(32px, 4.5vw, 80px);
	align-items: center;
	padding: var(--woven-pad-y) var(--woven-pad-x);
	margin: 0 !important;
}
.woven-page > .woven-catalogue { padding: 0; height: auto; width: 100%; }
.woven-main:has(> .woven-catalogue) { overflow: hidden; }

.woven-catalogue__detail { display: flex; gap: clamp(20px, 2.4vw, 40px); align-items: center; min-height: 0; }
.woven-catalogue__image { margin: 0; flex: 0 1 auto; }
.woven-catalogue__image img { display: block; max-width: min(100%, 34vw); max-height: calc(100dvh - 260px); width: auto; height: auto; object-fit: contain; }
.woven-catalogue__body { flex: 1 1 260px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.woven-catalogue__body > * { margin: 0 !important; }
.woven-catalogue__body .wp-block-post-title,
.woven-catalogue__body h2, .woven-catalogue__body h3 { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--heading-l) !important; line-height: .95; }
.woven-catalogue__body .wp-block-post-excerpt,
.woven-catalogue__body p { color: var(--wp--preset--color--ash); max-width: 46ch; }
.woven-catalogue__body .wp-block-woocommerce-product-price { font-family: var(--wp--preset--font-family--display); font-size: var(--wp--preset--font-size--heading-m) !important; color: var(--wp--preset--color--gold); }
.woven-catalogue__body .wp-block-post-excerpt__more-text { display: none; }

.woven-catalogue__side { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.woven-catalogue__side > * { margin: 0 !important; }
.woven-catalogue__grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(10px, 1.2vw, 18px); }
.woven-thumb {
	position: relative; display: block; padding: 0; border: 0; cursor: pointer;
	aspect-ratio: 1 / 1; background: rgba(25, 12, 21, .6); overflow: hidden; color: var(--wp--preset--color--bone);
	max-height: calc((100dvh - 330px) / 3);
	width: 100%;
}
.woven-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease, opacity .3s; opacity: .82; }
.woven-thumb:hover img, .woven-thumb.is-selected img { opacity: 1; transform: scale(1.03); }
.woven-thumb.is-selected { box-shadow: inset 0 0 0 2px var(--wp--preset--color--gold); }
.woven-thumb:focus-visible { outline: 2px solid var(--wp--preset--color--bone); outline-offset: 2px; }
.woven-thumb__title {
	position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 10px 8px;
	background: linear-gradient(transparent, rgba(25, 12, 21, .85));
	font-size: var(--wp--preset--font-size--label); font-weight: 500; letter-spacing: .04em; text-align: left;
}
.woven-thumb.is-empty { cursor: default; background: rgba(25, 12, 21, .25); border: 1px dashed var(--woven-gold-line); }

.woven-catalogue__pager { display: flex; gap: 4px; align-items: center; }
.woven-catalogue__pager button {
	min-width: 44px; min-height: 44px; border: 0; background: none; cursor: pointer;
	color: var(--wp--preset--color--ash); font-family: var(--wp--preset--font-family--display); font-size: 20px;
}
.woven-catalogue__pager button[aria-current="page"] { color: var(--wp--preset--color--plum); background: var(--wp--preset--color--gold); }
.woven-catalogue__pager button:disabled { opacity: .3; cursor: default; }

@media (max-width: 1100px) {
	.woven-catalogue__detail { flex-direction: column; align-items: flex-start; }
	.woven-catalogue__image img { max-width: 100%; max-height: 42dvh; }
}
@media (max-width: 781px) {
	.woven-catalogue { grid-template-columns: 1fr; height: auto; align-items: start; gap: 28px; padding: 24px 20px; }
	.woven-main:has(> .woven-catalogue) { overflow-y: auto; }
	.woven-catalogue__image img { max-height: 40dvh; }
	.woven-thumb { max-height: none; }
}

/* Selected item: big image on top, words underneath */
.woven-catalogue__detail { flex-direction: column; align-items: flex-start; justify-content: center; gap: 22px; }
.woven-catalogue__image img { max-width: 100%; max-height: calc(100dvh - 430px); }
.woven-catalogue__body { flex: 0 0 auto; gap: 12px; }
.woven-catalogue__body .wp-block-post-title,
.woven-catalogue__body h2, .woven-catalogue__body h3 { font-size: var(--wp--preset--font-size--heading-m) !important; }
.woven-catalogue__body .wp-block-woocommerce-product-price { font-size: var(--wp--preset--font-size--heading-s) !important; }

/* v0.2.1 — catalogue polish */
.woven-thumb, .woven-thumb__title { font-family: var(--wp--preset--font-family--body); }
.woven-catalogue__actions { display: flex !important; flex-wrap: wrap; gap: 12px; align-items: center; }
.woven-catalogue__actions .wp-block-button { margin: 0 !important; }
.woven-catalogue__actions .wp-block-button__link { display: inline-block; padding: 16px 28px; text-decoration: none; }

/* ==========================================================================
   v0.2.2 — square thumbnails; tablets and short screens
   ========================================================================== */

/* Thumbnails are always square. To change the shape, change 1 / 1 (e.g. 4 / 5 for portrait). */
.woven-catalogue__grid {
	--woven-thumb: clamp(120px, calc((100dvh - 330px) / 3), 260px);
	grid-template-columns: repeat(3, minmax(0, var(--woven-thumb)));
}
.woven-thumb { aspect-ratio: 1 / 1; max-height: none; height: auto; }

/* A page that is taller than the screen scrolls inside itself instead of
   sliding under the header and footer. Shorter pages stay centred. */
.woven-book.is-turning .woven-page { overflow-y: auto; justify-content: flex-start; scrollbar-width: none; }
.woven-book.is-turning .woven-page::-webkit-scrollbar { display: none; }
.woven-book.is-turning .woven-page > :first-child { margin-top: auto !important; }
.woven-book.is-turning .woven-page > :last-child { margin-bottom: auto !important; }
.woven-main:has(> .woven-catalogue) { overflow-y: auto; scrollbar-width: none; }
.woven-main:has(> .woven-catalogue)::-webkit-scrollbar { display: none; }
.woven-catalogue { height: auto; min-height: 100%; }

/* Pictures never shrink to a stamp on short screens. */
.woven-book .wp-block-image img { max-height: max(240px, calc(100dvh - 300px)); }
.woven-single .wp-block-image img { max-height: max(240px, calc(100dvh - 260px)); }
.woven-product .woocommerce-product-gallery img { max-height: max(240px, calc(100dvh - 280px)); }
.woven-catalogue__image img { max-height: max(220px, calc(100dvh - 430px)); }

/* Short screens (tablets on their side, small laptops): slimmer header, footer and padding. */
@media (min-width: 782px) and (max-height: 720px) {
	:root { --woven-pad-y: 18px; }
	.woven-header { min-height: 52px; }
	.woven-footer { min-height: 44px; }
	.woven-tabs button { height: 48px; }
	.woven-catalogue { align-items: start; }
}

/* Tablets held upright: one column, like a phone, but keep the page tabs. */
@media (min-width: 782px) and (max-width: 1100px) and (orientation: portrait) {
	.woven-book .wp-block-columns:not(.woven-cells) { flex-wrap: wrap !important; gap: 28px; }
	.woven-book .wp-block-columns:not(.woven-cells) > .wp-block-column { flex-basis: 100% !important; }
	.woven-book .wp-block-image img { max-height: 40dvh; }
	.woven-catalogue { grid-template-columns: 1fr; gap: 32px; align-items: start; }
	.woven-catalogue__image img { max-height: 38dvh; }
	.woven-catalogue__grid { --woven-thumb: 220px; }
}

@media (max-width: 781px) {
	.woven-book.is-turning .woven-page > :first-child { margin-top: 0 !important; }
	.woven-book.is-turning .woven-page > :last-child { margin-bottom: 0 !important; }
	.woven-catalogue__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	.woven-catalogue { min-height: 0; }
}

/* Next page never peeks out beside the page tabs on narrower screens. */
@media (min-width: 782px) { :root { --woven-pad-x: clamp(60px, 5vw, 72px); } }
