/*
Theme Name: Truth & Twine
Description: Block theme for the Truth & Twine phone case store. Warm western palette, WooCommerce-ready.
Version: 0.2.0
Requires at least: 7.0
Requires PHP: 8.1
License: GPL-2.0-or-later
Text Domain: truth-and-twine
*/

/* Only what theme.json cannot express. */

:root {
	--tt-error: #a3221b;
}

h1, h2, h3, .wp-block-post-title {
	text-wrap: balance;
}

/* Header search: icon-only, not a filled CTA. */
header .wp-block-search__button {
	background: transparent;
	color: var(--wp--preset--color--ink);
	padding: 0.35rem;
	border: 0;
}
header .wp-block-search__button:hover {
	background: var(--wp--preset--color--sand);
}

:where(.tt-card) {
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}
:where(.tt-card):hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 30px rgb(42 36 32 / 0.12);
}

/* Stitched edge used on the hero and announcement surfaces. */
.tt-stitched {
	outline: 1.5px dashed color-mix(in srgb, var(--wp--preset--color--terracotta) 55%, transparent);
	outline-offset: -10px;
}

.tt-eyebrow {
	letter-spacing: 0.14em;
	text-transform: uppercase;
}

/* Product cards */
.wc-block-product .wc-block-components-product-image img,
.wp-block-woocommerce-product-image img {
	border-radius: 10px;
	background: var(--wp--preset--color--surface);
}
.wp-block-woocommerce-product-image-gallery .woocommerce-product-gallery__image img {
	width: 100%;
	height: auto;
	border-radius: 14px;
}

/* Header icons share the ink color (account icon inherits link color otherwise). */
header .wp-block-woocommerce-customer-account a,
header .wc-block-mini-cart__button {
	color: var(--wp--preset--color--ink);
}

/* Catalog sorting */
.woocommerce-ordering select {
	min-height: 40px;
	padding: 0 2rem 0 0.75rem;
	border: 1.5px solid var(--wp--preset--color--twine);
	border-radius: 8px;
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font: inherit;
}

/* Classic variation form (device picker) */
.single-product form.cart .variations,
.single-product form.cart .variations tbody,
.single-product form.cart .variations tr,
.single-product form.cart .variations td,
.single-product form.cart .variations th {
	display: block;
	width: 100%;
	border: 0;
	padding: 0;
}
.single-product form.cart .variations {
	margin-bottom: 1rem;
}
.single-product form.cart .variations th.label {
	text-align: left;
	padding-bottom: 0.4rem;
	font-weight: 600;
}
.single-product form.cart .variations select {
	width: 100%;
	min-height: 48px;
	padding: 0 2.5rem 0 0.9rem;
	border: 1.5px solid var(--wp--preset--color--twine);
	border-radius: 8px;
	background-color: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font: inherit;
}
.single-product form.cart .variations select:focus-visible {
	outline: 2px solid var(--wp--preset--color--terracotta);
	outline-offset: 2px;
}
.single-product form.cart .reset_variations {
	font-size: var(--wp--preset--font-size--small);
}
.single-product form.cart .woocommerce-variation-add-to-cart {
	display: flex;
	gap: 0.75rem;
	align-items: stretch;
}
.single-product form.cart .quantity input.qty {
	width: 4.5rem;
	min-height: 48px;
	border: 1.5px solid var(--wp--preset--color--twine);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	text-align: center;
	font: inherit;
}
.single-product form.cart .single_add_to_cart_button {
	flex: 1;
	min-height: 48px;
}
.single-product form.cart .single_add_to_cart_button.loading {
	opacity: 0.7;
	cursor: progress;
}

/* Device picker: grouped radio buttons (functions.php, product-form.js). */
.tt-pills {
	display: none;
	border-radius: 10px;
}
.tt-pills-on .tt-pills {
	display: grid;
	gap: 0.6rem;
}
.single-product form.tt-pills-on .variations select,
.single-product form.tt-pills-on .reset_variations {
	display: none !important;
}
.tt-pills.is-invalid {
	outline: 2px solid var(--tt-error);
	outline-offset: 6px;
}
.tt-pills__error {
	margin: 0;
	color: var(--tt-error);
	font-weight: 600;
}
.tt-pills__error:empty {
	display: none;
}
.tt-pills__group {
	margin: 0;
	padding: 0;
	border: 0;
	min-width: 0;
}
.tt-pills__legend {
	padding: 0;
	line-height: 1.4;
	margin-bottom: 0.25rem;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
.tt-pills__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
}
.single-product form.cart .variations .tt-pill {
	position: relative;
	display: flex;
	margin: 0;
	line-height: 1.3;
}
.tt-pill input {
	position: absolute;
	inset: 0;
	opacity: 0;
	margin: 0;
	cursor: pointer;
}
.tt-pill > span {
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0 0.75rem;
	font-weight: 500;
	border: 1.5px solid var(--wp--preset--color--twine);
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	white-space: nowrap;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}
.tt-pill:hover > span {
	border-color: var(--wp--preset--color--ink);
}
.tt-pill input:checked + span {
	border-color: var(--wp--preset--color--ink);
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
	font-weight: 600;
}
.tt-pill input:focus-visible + span {
	outline: 2px solid var(--wp--preset--color--terracotta);
	outline-offset: 2px;
}
.tt-pills__hint {
	margin: 0.75rem 0 0;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	line-height: 1.5;
}

/* Buy 2, Get 1 Free under the product page price. */
.tt-offer {
	margin: 0.5rem 0 0;
	font-size: var(--wp--preset--font-size--small);
}
.tt-offer strong {
	display: inline-block;
	margin-right: 0.35rem;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: var(--wp--preset--color--terracotta);
	color: var(--wp--preset--color--surface);
}

/* Product page assurance lines. */
.tt-assure {
	display: grid;
	gap: 0.6rem;
	margin: var(--wp--preset--spacing--30) 0 0;
	padding: var(--wp--preset--spacing--30);
	border: 1px solid var(--wp--preset--color--twine);
	border-radius: 10px;
	background: var(--wp--preset--color--surface);
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
}
.tt-assure li {
	display: flex;
	align-items: flex-start;
	gap: 0.6rem;
}
.tt-assure svg {
	flex: none;
	color: var(--wp--preset--color--sage-dark);
}

/* Mobile sticky add-to-cart bar (product-form.js toggles .is-visible). */
.tt-sticky-cart {
	position: fixed;
	inset: auto 0 0;
	z-index: 90;
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 0.6rem var(--wp--preset--spacing--30) calc(0.6rem + env(safe-area-inset-bottom));
	border-top: 1px solid var(--wp--preset--color--twine);
	background: var(--wp--preset--color--surface);
	box-shadow: 0 -4px 16px rgb(42 36 32 / 0.08);
	transform: translateY(110%);
	transition: transform 0.2s ease;
}
.tt-sticky-cart.is-visible {
	transform: none;
}
.tt-sticky-cart[hidden] {
	display: none;
}
.tt-sticky-cart__info {
	flex: 1;
	min-width: 0;
}
.tt-sticky-cart__info p {
	margin: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: var(--wp--preset--font-size--small);
}
.tt-sticky-cart__name {
	font-weight: 600;
}
.tt-sticky-cart__device:not(:empty)::before {
	content: " · ";
}
.tt-sticky-cart__button {
	flex: none;
	min-height: 44px;
}
@media (min-width: 782px) {
	.tt-sticky-cart {
		display: none;
	}
	/* Wide screens: series label beside its row keeps add to cart in the first screen. */
	.tt-pills__legend {
		float: left;
		width: 7.5rem;
		margin: 0;
		line-height: 44px;
	}
}
@media (min-width: 782px) and (pointer: fine) {
	.tt-pills-on .tt-pills {
		gap: 0.4rem;
	}
	.tt-pill > span {
		min-height: 38px;
	}
	.tt-pills__legend {
		line-height: 38px;
	}
}
@media (prefers-reduced-motion: reduce) {
	.tt-sticky-cart {
		transition: none;
	}
}

/* Secure checkout strip: under add to cart and under the checkout payment section. */
.tt-secure-pay {
	margin-top: var(--wp--preset--spacing--30);
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem 1rem;
}
.tt-secure-pay p {
	margin: 0;
	display: flex;
	align-items: center;
	gap: 0.4rem;
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	color: var(--wp--preset--color--sage-dark);
}
.tt-lock {
	flex: none;
}
.tt-pay-icons {
	display: flex;
	gap: 0.35rem;
	margin: 0;
	padding: 0;
	list-style: none;
}
.tt-pay-icons img {
	display: block;
	width: 42px;
	height: auto;
	aspect-ratio: 38 / 24;
}
.tt-secure-pay--checkout {
	padding: 0.75rem 1rem;
	border: 1px solid var(--wp--preset--color--twine);
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	margin-bottom: var(--wp--preset--spacing--30);
}
.tt-secure-pay--checkout p {
	align-items: flex-start;
	font-weight: 500;
	color: var(--wp--preset--color--ink);
}
.tt-secure-pay--checkout .tt-lock {
	margin-top: 0.15em;
	color: var(--wp--preset--color--sage-dark);
}

/* Product details tabs */
.wp-block-woocommerce-product-details .wc-tabs {
	border-bottom: 1px solid var(--wp--preset--color--twine);
}

.woocommerce-Tabs-panel--description {
	max-width: 72ch;
}
.woocommerce-Tabs-panel--description blockquote {
	margin: 1.5rem 0;
	padding: 0.25rem 0 0.25rem 1.25rem;
	border-left: 3px solid var(--wp--preset--color--terracotta);
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--large);
	line-height: 1.45;
}
.woocommerce-Tabs-panel--description blockquote p {
	margin: 0;
}
.woocommerce-Tabs-panel--description blockquote cite {
	display: block;
	margin-top: 0.5rem;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--x-small);
	font-style: normal;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--wp--preset--color--muted);
}

/* Hero: in-hand photo. */
.tt-hero .wp-block-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
}
.tt-card .wp-block-image img {
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

/* Collection intro and sub-collection chips */
.wp-block-term-description {
	max-width: 68ch;
}
.tt-chips {
	gap: 0.5rem;
	margin-top: var(--wp--preset--spacing--20);
}
.tt-chips p {
	margin: 0;
}
.tt-chip {
	display: inline-block;
	padding: 0.45rem 1rem;
	border: 1.5px solid var(--wp--preset--color--twine);
	border-radius: 999px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 500;
	text-decoration: none;
}
.tt-chip:hover {
	border-color: var(--wp--preset--color--ink);
}
.tt-chip.is-active {
	background: var(--wp--preset--color--ink);
	border-color: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
}

/* Product cards */
.tt-card-sub {
	margin: 0 0 0.25rem;
	color: var(--wp--preset--color--muted);
	font-size: var(--wp--preset--font-size--x-small);
}
.wp-block-woocommerce-product-image {
	position: relative;
}
.tt-badge {
	position: absolute;
	z-index: 1;
	top: 0.6rem;
	left: 0.6rem;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	background: var(--wp--preset--color--ink);
	color: var(--wp--preset--color--base);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.04em;
}

/* Phone finder */
.tt-finder h2 {
	margin: 0;
}
.tt-finder__form {
	display: flex;
	flex-wrap: wrap;
	gap: 0.6rem;
	flex: 1 1 420px;
	justify-content: flex-end;
}
.tt-finder__form select {
	flex: 1 1 240px;
	max-width: 360px;
	min-height: 48px;
	padding: 0 0.9rem;
	border: 0;
	border-radius: 8px;
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font: inherit;
}
.tt-finder__form button {
	min-height: 48px;
}
.tt-device-notice {
	padding: 0.6rem 0.9rem;
	border-radius: 8px;
	background: var(--wp--preset--color--sand);
}

/* Shop by theme: round artwork tiles, horizontal scroll on small screens. */
.tt-themes {
	display: grid;
	grid-template-columns: repeat(7, minmax(0, 1fr));
	gap: var(--wp--preset--spacing--30);
	margin: 0;
	padding: 0;
	list-style: none;
}
.tt-themes a {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.6rem;
	color: var(--wp--preset--color--ink);
	font-size: var(--wp--preset--font-size--small);
	font-weight: 600;
	text-align: center;
	text-decoration: none;
}
.tt-themes img {
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
	border-radius: 50%;
	border: 3px solid var(--wp--preset--color--surface);
	box-shadow: 0 0 0 1.5px var(--wp--preset--color--twine);
	transition: transform 0.2s ease;
}
.tt-themes a:hover img {
	transform: scale(1.04);
}

/* BOGO band and gift tiles */
.tt-bogo .wp-block-image img {
	width: 100%;
	height: auto;
}
.tt-gift .wp-block-image img {
	aspect-ratio: 1;
}
.tt-gift h3 a {
	color: var(--wp--preset--color--ink);
	text-decoration: none;
}

/* Header dropdowns */
header .wp-block-navigation__submenu-container {
	padding: 0.4rem 0;
	border: 1px solid var(--wp--preset--color--twine) !important;
	border-radius: 10px;
	background: var(--wp--preset--color--surface) !important;
	box-shadow: var(--wp--preset--shadow--soft);
}
header .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	padding: 0.45rem 1rem;
}

/* FAQ accordions (collection guides and the product FAQ tab) */
.tt-faq {
	border-top: 1px solid var(--wp--preset--color--twine);
}
.tt-faq__item {
	border-bottom: 1px solid var(--wp--preset--color--twine);
}
.tt-faq__item summary {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	padding: 1rem 0;
	font-weight: 600;
	cursor: pointer;
	list-style: none;
}
.tt-faq__item summary::-webkit-details-marker {
	display: none;
}
.tt-faq__item summary::after {
	content: "+";
	font-weight: 400;
}
.tt-faq__item[open] summary::after {
	content: "–";
}
.tt-faq__item p {
	margin: 0 0 1rem;
	color: var(--wp--preset--color--muted);
}

/* Collection buying guide */
.tt-guide h2 {
	font-size: var(--wp--preset--font-size--x-large);
}
.tt-device-links {
	columns: 3 12rem;
	padding-left: 0;
	list-style: none;
	font-size: var(--wp--preset--font-size--small);
	line-height: 2;
}

@media (max-width: 781px) {
	.tt-hero {
		padding-left: var(--wp--preset--spacing--30) !important;
		padding-right: var(--wp--preset--spacing--30) !important;
	}
	.tt-hero .wp-block-column {
		padding-left: 0 !important;
	}
	.wp-block-term-description {
		font-size: var(--wp--preset--font-size--small);
	}
	.tt-themes {
		display: flex;
		overflow-x: auto;
		scroll-snap-type: x mandatory;
		padding-bottom: 0.5rem;
	}
	.tt-themes li {
		flex: 0 0 104px;
		scroll-snap-align: start;
	}
	.tt-finder__form {
		justify-content: stretch;
	}
	.tt-finder__form select {
		max-width: none;
	}
}
