/*
 * Ecom Theme — design layer (v1.2).
 * Loaded after every other theme stylesheet. Typography rhythm, calmer cards and the optional
 * "stitch" decoration (body.decor-stitch): the dashed tracing line chikankari artisans embroider over.
 */

/* ---------- Typography rhythm ---------- */

h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }

/* Small labels above headings: sentence case in the brand colour, not tracked capitals. */
.hero__eyebrow,
.media-banner__eyebrow,
.story__eyebrow,
.coupon-banner__eyebrow {
	font-size: 15px;
	font-weight: 500;
	letter-spacing: .01em;
	text-transform: none;
}

.story__eyebrow { color: var(--color-brand); }

/* ---------- Section headings ---------- */

.section__head {
	align-items: end;
	margin-bottom: clamp(24px, 3.4vw, 44px);
}

.section__title {
	font-size: calc(clamp(30px, 3.9vw, 52px) * var(--heading-scale, 1));
	line-height: 1.06;
}

.section__subtitle {
	max-width: 46ch;
	margin-top: 10px;
	font-size: 17px;
}

.section__link {
	font-size: 15px;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 6px;
}

.section__link:hover { text-decoration-thickness: 2px; }

/* ---------- Hero ---------- */

.hero__title {
	max-width: 13ch;
	font-size: calc(clamp(42px, 6.4vw, 88px) * var(--heading-scale, 1));
	line-height: 1;
}

/* Shorter heroes get a smaller headline so it never crowds the top and bottom. */
.hero--medium .hero__title { font-size: calc(clamp(36px, 4.6vw, 64px) * var(--heading-scale, 1)); }
.hero--small .hero__title { font-size: calc(clamp(30px, 3.6vw, 48px) * var(--heading-scale, 1)); }

.hero__text { max-width: 40ch; }
.hero__button { min-height: 54px; padding-inline: 36px; }

/* ---------- Product cards ---------- */

.product-card__title,
.woocommerce ul.products li.product .product-card__title {
	font-size: 15.5px;
	font-weight: 500;
	letter-spacing: 0;
}

.product-card__body { gap: 5px; padding-top: 14px; }

.price-off {
	order: 3;
	font-size: .87em;
	font-weight: 600;
	color: var(--color-sale);
}

.badge {
	padding: 5px 9px;
	border-radius: 2px;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0;
	text-transform: none;
	background: var(--color-bg);
	color: var(--color-text);
}

.badge--label { color: var(--color-brand); background: var(--color-bg); }
.badge--new { color: var(--color-text); background: var(--color-bg); }
.badge--soldout { background: var(--color-text); color: var(--color-bg); }

/* Card buttons: outlined, so a grid of products is not a wall of dark bars. */
.woocommerce ul.products li.product .button.product-card__cart:not(.product-card__cart--icon),
.product-card__cart:not(.product-card__cart--icon) {
	/* WooCommerce sets inline-block on shop pages, which leaves the label top-left. */
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border-color: var(--color-border);
	color: var(--color-text);
}

.woocommerce ul.products li.product .button.product-card__cart:not(.product-card__cart--icon):hover,
.product-card__cart:not(.product-card__cart--icon):hover {
	background: var(--color-brand);
	border-color: var(--color-brand);
	color: var(--color-brand-contrast);
	filter: none;
}

/* ---------- Features strip: icon beside text, divided columns ---------- */

.usp-row { gap: 0; }

.usp-item {
	grid-template-columns: auto 1fr;
	justify-items: start;
	align-content: center;
	column-gap: 14px;
	row-gap: 2px;
	padding: 6px 28px;
	text-align: left;
	border-left: 1px solid var(--color-border);
}

.usp-item:first-child { border-left: 0; padding-left: 0; }

.usp-item__icon {
	grid-row: span 2;
	width: auto;
	height: auto;
	margin: 0;
	background: none;
}

.section--bg-surface .usp-item__icon,
.section--bg-brand .usp-item__icon { background: none; }

@media (max-width: 767px) {
	.usp-row { gap: 20px 12px; }
	.usp-item { padding: 0; border-left: 0; }
}

/* ---------- Coupon: a compact strip, not a tall block ---------- */

.coupon-banner:not(.has-image) .coupon-banner__body {
	grid-template-columns: 1fr auto;
	align-items: center;
	justify-items: start;
	gap: 12px 40px;
	text-align: left;
}

.coupon-banner:not(.has-image) .coupon-banner__body > :not(.coupon-banner__actions) { grid-column: 1; }

.coupon-banner:not(.has-image) .coupon-banner__actions {
	grid-column: 2;
	grid-row: 1 / span 4;
	margin: 0;
}

@media (max-width: 767px) {
	.coupon-banner:not(.has-image) .coupon-banner__body { grid-template-columns: 1fr; }
	.coupon-banner:not(.has-image) .coupon-banner__actions { grid-column: 1; grid-row: auto; }
}

/* With an image: the text sets the height; the photo fills its column instead of stretching the panel. */
@media (min-width: 768px) {
	.coupon-banner.has-image { grid-template-columns: 1.3fr 1fr; }
	.coupon-banner.has-image .coupon-banner__media { position: relative; min-height: 320px; }
	.coupon-banner.has-image .coupon-banner__media img {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		min-height: 0;
		object-fit: cover;
	}
}

/* ---------- Category stories: an Instagram-style row right under the header ---------- */

.section--categories:has(.cat-tiles--stories) {
	padding-block: 18px 14px;
	border-bottom: 1px solid var(--color-border);
}

.section--categories:has(.cat-tiles--stories) .section__head { margin-bottom: 12px; }
.section--categories:has(.cat-tiles--stories) .section__title { font-size: 20px; }
.section--categories:has(.cat-tiles--stories) .section__subtitle { display: none; }

.cat-tiles--stories {
	display: flex;
	gap: 16px;
	margin: 0;
	padding: 2px 0;
	list-style: none;
	overflow-x: auto;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
}

.cat-tiles--stories::-webkit-scrollbar { display: none; }
.cat-tiles--stories > li { flex: 0 0 auto; scroll-snap-align: start; }

.cat-tiles--stories .cat-tile { width: 78px; gap: 7px; }

/* Ring in the brand's own colours (not Instagram's), with a gap between ring and photo. */
.cat-tiles--stories .cat-tile__media {
	width: 74px;
	height: 74px;
	padding: 3px;
	border-radius: 50%;
	background: conic-gradient(from 200deg, var(--color-brand), var(--color-accent), var(--color-sale), var(--color-brand));
}

.cat-tiles--stories .cat-tile__media img,
.cat-tiles--stories .cat-tile__initial {
	display: grid;
	place-items: center;
	width: 100%;
	height: 100%;
	border: 3px solid var(--color-bg);
	border-radius: 50%;
	object-fit: cover;
	background: var(--color-surface);
}

.cat-tiles--stories .cat-tile__initial { font-size: 24px; }

.cat-tiles--stories .cat-tile__name {
	max-width: 78px;
	overflow: hidden;
	font-size: 13px;
	line-height: 1.25;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.cat-tiles--stories .cat-tile:hover .cat-tile__name,
.cat-tiles--stories .cat-tile[aria-current] .cat-tile__name { color: var(--color-brand); }

.cat-tiles--stories .cat-tile:focus-visible { outline: none; }
.cat-tiles--stories .cat-tile:focus-visible .cat-tile__media { outline: 2px solid var(--color-brand); outline-offset: 3px; }

@media (max-width: 767px) {
	/* Scroll edge to edge on phones, like a stories tray. */
	.cat-tiles--stories {
		margin-inline: calc(var(--gutter) * -1);
		padding-inline: var(--gutter);
		gap: 14px;
	}
}

/* Inside the rail: stay a flex row (the rail sets grid), and centre only when it all fits.
   Auto margins centre a short row without cutting off the start of a long one. */
.rail .cat-tiles--stories { display: flex; padding: 2px 0; scroll-snap-type: x proximity; }
.cat-tiles--stories > li:first-child { margin-inline-start: auto; }
.cat-tiles--stories > li:last-child { margin-inline-end: auto; }
.rail--stories .rail__nav { top: 26px; width: 36px; height: 36px; }
.rail--stories .rail__nav--prev { left: -6px; }
.rail--stories .rail__nav--next { right: -6px; }

@media (min-width: 1025px) {
	.cat-tiles--stories { gap: 30px; }
	.cat-tiles--stories .cat-tile { width: 92px; }
	.cat-tiles--stories .cat-tile__media { width: 88px; height: 88px; }
	.cat-tiles--stories .cat-tile__name { max-width: 92px; font-size: 14px; }
}

/* ---------- Slim strips (features under the hero, scrolling text) ---------- */

.section--usp.section--space-compact { padding-block: 16px; border-bottom: 1px solid var(--color-border); }
.section--usp.section--space-compact .usp-item__title { font-size: 14px; }
.section--usp.section--space-compact .usp-item__text { font-size: 13px; }
.section--usp.section--space-compact .usp-item__icon .icon { width: 22px; height: 22px; }

.section--marquee.section--space-compact { padding-block: 10px; }
.text-marquee--normal .text-marquee__list li { font-size: clamp(16px, 1.5vw, 19px); }

/* ---------- Full-width split story: photo edge to edge, text panel beside it ---------- */

@media (min-width: 900px) {
	.section--story:has(.container--full) { padding-block: 0; }
	.section--story .container--full { padding-inline: 0; }
	.section--story .container--full .story { gap: 0; align-items: stretch; }
	/* The text panel sets the row height (at least 560px); the photo fills its half. */
	.section--story .container--full .story__media { position: relative; min-height: 560px; }
	.section--story .container--full .story__media img {
		position: absolute;
		inset: 0;
		width: 100%;
		height: 100%;
		max-height: none;
		aspect-ratio: auto;
		border-radius: 0;
	}
	.section--story .container--full .story__media img { object-position: 50% 20%; }
	/* A full-width story is edge to edge, so the next tinted section still needs its own top space. */
	.section--story:has(.container--full) + .section { padding-top: clamp(40px, 6vw, 72px); }
	.section--story .container--full .story__body {
		align-self: center;
		max-width: 620px;
		padding: clamp(40px, 6vw, 96px);
	}
}

/* ---------- Large category cards ---------- */

.cat-tiles--card { gap: 14px; }
.cat-tiles--card .cat-tile__media { aspect-ratio: 4 / 5; border-radius: var(--radius); }
.cat-tiles--card .cat-tile__name { font-size: calc(clamp(19px, 1.9vw, 25px) * var(--heading-scale, 1)); }

/* ---------- Product tabs follow the heading alignment ---------- */

@media (min-width: 768px) {
	.section__head:not(.section__head--center) + .ptabs .ptabs__list { justify-content: flex-start; }
}

/* ---------- Card bag button: outlined circle, fills on hover ---------- */

.woocommerce ul.products li.product .button.product-card__cart--icon,
.product-card__cart--icon {
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	color: var(--color-brand);
}

.woocommerce ul.products li.product .button.product-card__cart--icon:hover,
.product-card__cart--icon:hover {
	background: var(--color-brand);
	border-color: var(--color-brand);
	color: var(--color-brand-contrast);
	filter: none;
}

/* On shop pages WooCommerce makes buttons inline-block, which collapses the icon; keep it a centred box. */
.woocommerce ul.products li.product .button.product-card__cart--icon,
.product-card__cart--icon { display: inline-grid; place-items: center; }
.product-card__cart--icon::before { display: block; }

/* A bag icon on a sold-out product would suggest it can be bought; the tag already says sold out. */
.product-card.is-soldout .product-card__cart--icon { display: none; }

/* WooCommerce colours loop and product prices olive and drops the flex order; use the theme's. */
.woocommerce ul.products li.product .price,
.woocommerce div.product p.price,
.woocommerce div.product span.price {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 2px 8px;
	color: var(--color-text);
}

/* ---------- Filters: sentence-case group titles ---------- */

.filter-group__title {
	font-size: 15px;
	letter-spacing: 0;
	text-transform: none;
}

/* ---------- Newsletter: light band above the footer ---------- */

.newsletter-band {
	background: var(--color-surface);
	color: var(--color-text);
	border-bottom: 1px solid var(--color-border);
}

.newsletter-band__copy p { color: var(--color-muted); opacity: 1; }

.newsletter-band .newsletter-form input[type="email"] { border-color: var(--color-border); }

.newsletter-band .newsletter-form .button {
	background: var(--color-brand);
	border-color: var(--color-brand);
	color: var(--color-brand-contrast);
}

/* ---------- Wordmark (when no logo image is uploaded) ---------- */

.site-header .site-title {
	font-size: clamp(26px, 2.6vw, 34px);
	letter-spacing: .08em;
	text-transform: uppercase;
	line-height: 1;
}

.site-footer .footer-col--brand .site-title {
	font-size: 28px;
	letter-spacing: .08em;
	text-transform: uppercase;
}

/* Running stitch under the wordmark: the brand mark in the stitch decoration. */
.decor-stitch .site-title::after {
	content: "";
	display: block;
	width: 70%;
	height: 2px;
	margin: 7px auto 0;
	background: var(--stitch);
	color: var(--color-brand);
}

.decor-stitch .site-header--logo-left .site-title::after,
.decor-stitch .site-footer .site-title::after { margin-left: 0; }

/* ---------- Header (logo centred) ---------- */

.site-header--logo-center .site-title { font-size: clamp(24px, 2.4vw, 32px); }
.primary-nav--below .menu-item--depth-0 > .menu-link { font-size: 15px; padding-inline: 14px; }

/* =========================================================================
 * Stitch decoration (body.decor-stitch)
 * A running stitch: short dashes in the brand colour, like the traced pattern on fabric.
 * ========================================================================= */

.decor-stitch {
	--stitch: repeating-linear-gradient(90deg, currentColor 0 7px, transparent 7px 12px);
}

/* The one orchestrated motion: a stitch line draws under the hero headline. */
.decor-stitch .hero__title::after {
	content: "";
	display: block;
	width: 0;
	height: 2px;
	margin-top: .32em;
	background: var(--stitch);
	opacity: .9;
}

.decor-stitch .hero__slide--center .hero__title::after { margin-inline: auto; }
.decor-stitch .hero__slide.is-active .hero__title::after { animation: stitch-draw 1.3s .4s var(--ease) forwards; }

@keyframes stitch-draw { to { width: min(240px, 60%); } }

/* Tags on product images read as stitched fabric labels. */
.decor-stitch .badge:not(.badge--soldout) {
	outline: 1px dashed currentColor;
	outline-offset: -4px;
	padding: 6px 11px;
}

/* Category circles: a stitched ring on hover and focus. */
.decor-stitch .cat-tiles--circle .cat-tile__media { outline-style: solid; transition: outline-color .2s; }

.decor-stitch .cat-tiles--circle .cat-tile:hover .cat-tile__media,
.decor-stitch .cat-tiles--circle .cat-tile:focus-visible .cat-tile__media {
	outline: 1.5px dashed var(--color-brand);
	outline-offset: 5px;
}

/* Coupon: stitched edge inside the panel, and a stitched code tag. */
.decor-stitch .coupon-banner { position: relative; }

.decor-stitch .coupon-banner::after {
	content: "";
	position: absolute;
	inset: 10px;
	border: 1.5px dashed currentColor;
	border-radius: max(0px, calc(var(--radius) - 4px));
	opacity: .5;
	pointer-events: none;
}

/* Section dividers under the main heading of image + text and spotlight stories. */
.decor-stitch .story__title::after,
.decor-stitch .spotlight__title::after {
	content: "";
	display: block;
	width: 88px;
	height: 2px;
	margin-top: 18px;
	background: var(--stitch);
	color: var(--color-brand);
}

@media (prefers-reduced-motion: reduce) {
	.decor-stitch .hero__title::after { width: min(240px, 60%); animation: none; }
}

/* ---------- Footer colours ----------
   The footer re-points the shared colour tokens, so links, icons, borders and the
   wordmark stitch all follow Customizer → Colours → Footer. The newsletter band keeps the page colours. */

.site-footer { background: var(--color-footer-bg); }

.site-footer__main,
.site-footer__bottom,
.site-footer__seo {
	--color-text: var(--color-footer-text);
	--color-muted: var(--color-footer-muted);
	--color-border: var(--color-footer-border);
	--color-brand: var(--color-footer-accent);
	color: var(--color-text);
}


.site-footer .site-title,
.site-footer .widget-title { color: var(--color-text); }

.site-footer .social-links a { color: var(--color-text); }
.site-footer .social-links a:hover { color: var(--color-brand); }

.site-footer a:focus-visible { outline-color: var(--color-brand); }

/* Payment logos sit on white chips, so drop their border on a dark footer. */
.site-footer__bottom .payment-badge { border-color: transparent; }

/* Wordmark on phones and tablets: always one line, sized from the name's length so long
   names (e.g. "Bagaan Tea Co.") shrink instead of wrapping, and stay centred between the icons. */
@media (max-width: 1024px) {
	.site-header .site-title,
	.site-header--logo-center .site-title {
		display: block;
		white-space: nowrap;
		letter-spacing: .04em;
		font-size: clamp(15px, calc((100vw - 232px) / (var(--title-chars, 10) * .74)), 24px);
	}
	.site-header .site-branding { max-width: calc(100vw - 216px); overflow: hidden; }
	.decor-stitch .site-header .site-title::after { margin-top: 5px; }
}

/* Card buttons on phones: one line ("Choose options" no longer wraps into two). */
@media (max-width: 767px) {
	.woocommerce ul.products li.product .button.product-card__cart:not(.product-card__cart--icon),
	.product-card__cart:not(.product-card__cart--icon) {
		min-height: 38px;
		padding-inline: 6px;
		font-size: 13px;
		white-space: nowrap;
		letter-spacing: 0;
	}
}

/* Laptops (1025–1400px) with the logo on the left: tighter wordmark and menu so the
   menu stays on one line instead of dropping its last item below. */
@media (min-width: 1025px) and (max-width: 1400px) {
	.site-header--logo-left .site-title { font-size: clamp(22px, 2vw, 28px); letter-spacing: .05em; }
	.site-header--logo-left .site-header__bar { gap: 12px; }
	.site-header--logo-left .primary-nav .nav-menu { gap: 2px; }
	.site-header--logo-left .primary-nav .menu-item--depth-0 > .menu-link { padding-inline: 8px; font-size: 14px; }
}

/* Feature chips on product cards ("Eggless", "No palm oil") */
.product-card__chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 6px 0 2px; padding: 0; list-style: none; }
.product-card--align-center .product-card__chips { justify-content: center; }
.product-card__chips li { padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--color-brand) 8%, var(--color-bg)); color: var(--color-brand); font-size: 11px; font-weight: 600; line-height: 1.6; white-space: nowrap; }

/* Which pack the one-tap Add button adds (Product cards: "One-tap add"). */
.product-card__pack { margin: 0; font-size: 12px; color: var(--color-muted); }
