/*
Theme Name: Ophir Pelimo
Theme URI: https://pelimo.pet/
Author: Ophir Trade LLC
Description: Pelimo child of the Ophir house theme. Soot, fawn, mist and oat palette; Jost for body and UI, Cormorant Garamond for display. Homepage remains the [pelimo_home] shortcode so the holiday/collection hero variant and `wp pelimo hero` command keep working.
Template: ophir
Version: 1.0.4
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ophir-pelimo
Tags: e-commerce, block-patterns, full-site-editing, custom-colors
*/

/*
 * Set semantic tokens directly. Do not rely only on --wp--preset--color-*
 * (those are emitted by theme.json at runtime). Without these, the parent
 * :root fallbacks are Tarshish navy/gold and leak into previews and any
 * context where global styles have not loaded.
 */
:root {
	--oh-ink: #2A2B2D;
	--oh-ink-deep: #2A2B2D;
	--oh-accent: #B98B63;
	--oh-accent-deep: #B98B63;
	--oh-canvas: #F2ECE1;
	--oh-paper: #FAF7F1;
	--oh-line: #E4D5C4;
	--oh-mute: #6D6A64;
	--oh-mist: #8B9EA6;
	--oh-hair: color-mix(in srgb, var(--oh-accent) 28%, transparent);
	--oh-body: "Jost", "Futura", "Avenir Next", system-ui, sans-serif;
	--oh-display: "Cormorant Garamond", "Palatino Linotype", Palatino, serif;

	--pelimo-soot: #2A2B2D;
	--pelimo-fawn: #B98B63;
	--pelimo-mist: #8B9EA6;
	--pelimo-oat: #F2ECE1;
	--pelimo-sub: #6D6A64;

	--wp--preset--color--ink: var(--oh-ink);
	--wp--preset--color--ink-deep: var(--oh-ink-deep);
	--wp--preset--color--accent: var(--oh-accent);
	--wp--preset--color--accent-deep: var(--oh-accent-deep);
	--wp--preset--color--canvas: var(--oh-canvas);
	--wp--preset--color--paper: var(--oh-paper);
	--wp--preset--color--line: var(--oh-line);
	--wp--preset--color--mute: var(--oh-mute);
	--wp--preset--color--mist: var(--oh-mist);
	--wp--preset--color--navy: var(--oh-ink);
	--wp--preset--color--navy-deep: var(--oh-ink-deep);
	--wp--preset--color--gold: var(--oh-accent);
	--wp--preset--color--gold-deep: var(--oh-accent-deep);
	--wp--preset--color--cream: var(--oh-canvas);
	--wp--preset--color--slate: var(--oh-mute);
}

/* Utility classes for static previews and when global styles have not loaded. */
.has-ink-background-color,
.has-ink-deep-background-color,
.has-navy-background-color,
.has-navy-deep-background-color { background-color: var(--oh-ink) !important; }
.has-canvas-background-color,
.has-paper-background-color,
.has-cream-background-color { background-color: var(--oh-canvas) !important; }
.has-ink-color,
.has-ink-deep-color,
.has-navy-color,
.has-navy-deep-color { color: var(--oh-ink) !important; }
.has-canvas-color,
.has-paper-color,
.has-cream-color { color: var(--oh-canvas) !important; }
.has-accent-color,
.has-accent-deep-color,
.has-gold-color,
.has-gold-deep-color { color: var(--oh-accent) !important; }

html { background: var(--oh-canvas); }
body,
body.woocommerce,
body.woocommerce-page,
.wp-site-blocks {
	font-family: var(--oh-body);
	background: var(--oh-canvas);
	color: var(--oh-ink);
	-webkit-font-smoothing: antialiased;
}

/* Display face for headings; Jost stays on UI (nav, buttons, prices, body). */
h1, h2, h3,
.wp-block-heading,
.wp-block-post-title,
.wp-block-query-title,
.pelimo-photo-hero__kicker,
.pelimo-photo-hero__headline,
.pelimo-collection h2,
.pelimo-how h2,
.pelimo-tile__title,
.pelimo-kicker,
.is-style-eyebrow,
.ts-footer__head,
.ts-logo__word,
.ts-logo__tagline {
	font-family: var(--oh-display);
}

.wp-block-navigation,
.wp-block-navigation a,
.wp-element-button,
.wp-block-button__link,
button.single_add_to_cart_button,
.woocommerce-button,
a.checkout-button,
.woocommerce-Price-amount,
.wc-block-components-product-price,
.pelimo-btn,
.pelimo-product-row__name,
.pelimo-product-row__price {
	font-family: var(--oh-body) !important;
}

/* Keep house button geometry (uppercase, tracked) but set Pelimo's UI face. */
.wp-element-button,
.wp-block-button__link {
	border-radius: 1px !important;
}

/* Header: oat ground, soot type — same 3-column geometry as the parent. */
.ts-header,
.pelimo-site-header {
	background: var(--oh-canvas) !important;
	color: var(--oh-ink) !important;
	border-bottom: 1px solid var(--oh-hair);
}

/* Announcement bar: soot ground, oat type. Never inherit a navy fallback. */
.ts-announce,
.ts-header .ts-announce,
.pelimo-site-header .ts-announce {
	background: var(--oh-ink) !important;
	color: var(--oh-canvas) !important;
	border-bottom-color: color-mix(in srgb, var(--oh-accent) 18%, transparent) !important;
}
.ts-header .ts-announce a,
.pelimo-site-header .ts-announce a { color: inherit; }

.ts-header .ts-logo--gold .ts-logo__word,
.ts-header .ts-logo--gold .ts-logo__tagline,
.ts-header .ts-logo { color: var(--oh-ink); }
.ts-header .ts-logo__mark { width: auto; height: 28px; }
.ts-header .wp-block-navigation-item__content::after { background: var(--oh-accent); }
.ts-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--oh-ink-deep) !important;
	color: var(--oh-canvas) !important;
}

/* BAG / mini-cart: full soot contrast, same weight as the nav. */
.ts-header .ts-header__tools,
.ts-header .bag-label,
.ts-header .wc-block-mini-cart__button,
.pelimo-site-header .bag-label {
	color: var(--oh-ink) !important;
	opacity: 1 !important;
	font-family: var(--oh-body);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.2em;
	text-transform: uppercase;
}
.ts-header .wc-block-mini-cart__badge {
	background: var(--oh-accent) !important;
	color: var(--oh-ink) !important;
}

/* Category eyebrow and petal divider use accent (fawn) via parent tokens. */
.is-style-eyebrow,
.ts-eyebrow {
	color: var(--oh-accent) !important;
}

/* Product title: large italic Cormorant in soot, beating pelimo-brand's Jost h1 rule. */
body.single-product h1,
body.single-product h1.wp-block-post-title,
body.single-product h1.product_title,
body.single-product .ts-product__summary .wp-block-post-title,
body.single-product .product_title {
	font-family: var(--oh-display) !important;
	font-style: italic;
	font-weight: 500 !important;
	font-size: 2.85rem !important;
	line-height: 1.08 !important;
	letter-spacing: 0.01em !important;
	color: var(--oh-ink) !important;
	margin: 0.3rem 0 0.65rem !important;
}
@media (max-width: 781px) {
	body.single-product h1,
	body.single-product h1.wp-block-post-title,
	body.single-product h1.product_title,
	body.single-product .ts-product__summary .wp-block-post-title,
	body.single-product .product_title {
		font-size: 2rem !important;
	}
}

body.single-product .woocommerce-Price-amount,
body.single-product .wc-block-components-product-price,
body.single-product .ts-product__summary .price {
	font-family: var(--oh-body) !important;
	color: var(--oh-ink) !important;
	font-size: 1.25rem;
}

/* Footer uses the house band layout, colored soot, with Pelimo lockup. */
.ts-footer,
.pelimo-site-footer {
	background: var(--oh-ink) !important;
	color: var(--oh-canvas) !important;
}
.ts-footer a,
.pelimo-site-footer a { color: var(--oh-canvas) !important; text-decoration: none; }
.ts-footer a:hover,
.pelimo-site-footer a:hover { color: var(--oh-accent) !important; }
.pelimo-footer-logo img { width: 275px; height: auto; margin-inline: auto; display: block; }
/* Center the footer lockup (shortcode outputs a.pelimo-footer-logo-link, possibly inside a <p>). */
.pelimo-site-footer .pelimo-footer-logo-link { display: block; width: fit-content; max-width: 100%; margin-inline: auto !important; text-align: center; }
.pelimo-site-footer .pelimo-footer-logo-link img { display: block; width: 275px; max-width: 70vw; height: auto; margin-inline: auto; }
.pelimo-site-footer p:has(> .pelimo-footer-logo-link) { text-align: center; margin-inline: auto; }
.pelimo-footer-links,
.pelimo-footer-meta { text-align: center; }
.pelimo-footer-contact { display: flex; gap: 0.85rem; justify-content: center; align-items: center; flex-wrap: wrap; }

/* Narrow screens: stack the product gallery above the summary, and keep
   the wordmark from colliding with "Holiday delivery" in the 3-col header. */
@media (max-width: 781px) {
	.product-cols {
		display: grid !important;
		grid-template-columns: 1fr !important;
		gap: 1.5rem !important;
	}
	.shop-grid {
		display: grid !important;
		grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
		gap: 1.5rem 1rem !important;
	}
	/* Compact single-row header: Shop | wordmark | Bag.
	   "Holiday delivery" stays in the announcement bar and footer. */
	.ts-header__bar { padding: 0.45rem 0 !important; }
	.ts-header__row {
		grid-template-columns: 1fr auto 1fr !important;
		grid-template-areas: none;
		row-gap: 0;
	}
	.ts-header__row > .ts-header__nav { grid-area: auto; justify-self: start; }
	.ts-header__row > .ts-header__brand { grid-area: auto; justify-self: center; }
	.ts-header__row > .ts-header__tools { grid-area: auto; justify-self: end; }
	.ts-header .ts-logo__mark { height: 22px; }
	.ts-header__nav { font-size: 0.6875rem; letter-spacing: 0.14em; gap: 0.8rem !important; }
	.ts-header__nav a[href*="holiday-delivery"] { display: none; }
	.ts-announce,
	.ts-header .ts-announce,
	.pelimo-site-header .ts-announce {
		padding-top: 0.4rem !important;
		padding-bottom: 0.4rem !important;
		font-size: 0.5625rem;
		letter-spacing: 0.1em;
	}
}

/*
 * Photo hero — holiday (current) and collection (Dec 26 variant).
 * Mirrors Pelimo Brand 1.0.15 so the layout survives a theme switch
 * even if plugin CSS order changes. Desktop composition is unchanged:
 * holiday keeps type on the left cream field, image right-aligned;
 * collection keeps type at the top and the flatlay pinned center-bottom.
 */
.pelimo-photo-hero picture,
.pelimo-photo-hero img,
.pelimo-photo-hero__img {
	position: absolute !important;
	inset: 0 !important;
	width: 100% !important;
	height: 100% !important;
	max-width: none !important;
	max-height: none !important;
	object-fit: cover !important;
}

@media (max-width: 782px) {
	.pelimo-photo-hero,
	.pelimo-photo-hero--holiday {
		aspect-ratio: auto;
		min-height: 85vh;
		height: 85vh;
		max-height: none;
		align-items: flex-start;
		justify-content: flex-start;
	}
	.pelimo-photo-hero--holiday .pelimo-photo-hero__img,
	.pelimo-photo-hero:not(.pelimo-photo-hero--collection) .pelimo-photo-hero__img {
		object-fit: cover !important;
		object-position: 70% center !important;
	}
	.pelimo-photo-hero--holiday .pelimo-photo-hero__veil,
	.pelimo-photo-hero:not(.pelimo-photo-hero--collection) .pelimo-photo-hero__veil {
		background:
			linear-gradient(to bottom,
				rgba(242,236,225,.88) 0%,
				rgba(242,236,225,.72) 28%,
				rgba(242,236,225,.28) 52%,
				rgba(242,236,225,0) 72%) !important;
	}
	.pelimo-photo-hero--holiday .pelimo-photo-hero__copy,
	.pelimo-photo-hero:not(.pelimo-photo-hero--collection) .pelimo-photo-hero__copy {
		align-self: flex-start;
		max-width: 100%;
		width: 100%;
		text-align: left;
		padding: 28px 20px 24px !important;
	}
	.pelimo-photo-hero--holiday .pelimo-photo-hero__headline,
	.pelimo-photo-hero:not(.pelimo-photo-hero--collection) .pelimo-photo-hero__headline {
		font-size: clamp(44px, 12vw, 64px) !important;
		margin-bottom: 20px !important;
		color: #1f1f1f !important;
	}
	.pelimo-photo-hero--holiday .pelimo-photo-hero__kicker,
	.pelimo-photo-hero:not(.pelimo-photo-hero--collection) .pelimo-photo-hero__kicker {
		color: var(--oh-accent, #B98B63) !important;
		text-shadow: none;
	}

	/* Collection variant: cream field is at the TOP of the flatlay.
	   Keep products visible (center bottom) and park type at the top. */
	.pelimo-photo-hero--collection {
		aspect-ratio: auto;
		min-height: 78vh;
		height: 78vh;
		max-height: none;
		align-items: flex-start;
	}
	.pelimo-photo-hero--collection .pelimo-photo-hero__img {
		object-fit: cover !important;
		object-position: center bottom !important;
	}
	.pelimo-photo-hero--collection .pelimo-photo-hero__veil {
		background:
			linear-gradient(to bottom,
				rgba(242,236,225,.86) 0%,
				rgba(242,236,225,.55) 36%,
				rgba(242,236,225,.12) 58%,
				rgba(242,236,225,0) 72%) !important;
	}
	.pelimo-photo-hero--collection .pelimo-photo-hero__copy {
		align-self: flex-start;
		max-width: 100%;
		width: 100%;
		text-align: center;
		padding: 28px 20px 20px !important;
	}
	.pelimo-photo-hero--collection .pelimo-photo-hero__headline {
		font-size: clamp(44px, 12vw, 64px) !important;
		margin-bottom: 20px !important;
	}
	.pelimo-photo-hero a.pelimo-btn,
	.pelimo-photo-hero a.pelimo-btn-outline {
		box-sizing: border-box !important;
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
		width: max-content !important;
		height: auto !important;
		min-height: 46px !important;
		max-height: 48px !important;
		padding: 0 28px !important;
		line-height: 1.2 !important;
	}
	.pelimo-photo-hero__actions { width: auto !important; }
}

/* Reinforce parent gallery failsafe so a child-only zip replace still shows photos. */
.woocommerce-product-gallery {
	opacity: 1 !important;
}
.woocommerce-product-gallery .flex-viewport {
	aspect-ratio: 1 / 1;
	min-height: 12rem;
}
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery__image .wp-post-image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: cover;
}
