/*
 * Single product (apparel/mugs + books/PDFs) — design/Product-Tee.dc.html and
 * design/Product-Book.dc.html. Built on WooCommerce classic single markup.
 */

.tt-single-product {
	max-width: var(--tt-container, 1200px);
	margin-inline: auto;
	padding: 24px;
	box-sizing: border-box;
}

/* Breadcrumb */
.tt-breadcrumb {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
	margin-bottom: 8px;
}
.tt-breadcrumb a {
	color: var(--wp--preset--color--primary);
}

/* Two-column layout */
.tt-single-product div.product {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(360px, 100%), 1fr));
	gap: 48px;
	align-items: start;
}
.tt-single-product div.product .summary,
.tt-single-product div.product .entry-summary {
	/* Override WooCommerce's default .summary{width:48%;float:right} (specificity
	   0,3,0), which shrank the grid cell to ~265px and stacked the format cards. */
	width: 100% !important;
	float: none !important;
	margin: 0;
	display: flex;
	flex-direction: column;
	gap: 12px;
	min-width: 0;
}
/* Zero every direct child's margin so only the flex `gap` (12px) controls
   spacing. WooCommerce's own `.woocommerce div.product div.summary > *` rule
   sets `margin-bottom: var(--wp--style--block-gap)` (24px) at specificity
   (0,3,2) — higher than a plain `.entry-summary > *` — so it must be beaten
   with `!important`, otherwise 12px gap + 24px margin = 36px between every row. */
.tt-single-product div.product div.summary > *,
.tt-single-product div.product .entry-summary > * {
	margin-top: 0 !important;
	margin-bottom: 0 !important;
}

/* Gallery */
.tt-single-product .woocommerce-product-gallery {
	position: relative;
	width: 100% !important; /* Override Woo's inline per-column width. */
	float: none !important;
}
.tt-single-product .woocommerce-product-gallery__wrapper {
	margin: 0;
	width: 100%;
}
.tt-single-product .woocommerce-product-gallery__image,
.tt-single-product .woocommerce-product-gallery__image--placeholder {
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: 24px;
	overflow: hidden;
	background: var(--wp--preset--color--tint-slate);
	display: flex;
	align-items: center;
	justify-content: center;
}
.tt-single-product .woocommerce-product-gallery__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
/* Centered, muted placeholder when the product has no image yet. */
.tt-single-product .woocommerce-product-gallery--without-images .woocommerce-product-gallery__image--placeholder img {
	width: 38%;
	height: auto;
	opacity: 0.45;
}
.tt-single-product .flex-control-thumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	list-style: none;
	margin: 12px 0 0;
	padding: 0;
}
.tt-single-product .flex-control-thumbs li {
	flex: 0 0 auto;
	width: 40px !important; /* beat flexslider's inline per-column width */
}
.tt-single-product .flex-control-thumbs li img {
	display: block;
	width: 40px !important; /* flexslider sets inline width based on data-columns */
	height: 40px !important;
	object-fit: contain;
	background: #fff;
	border-radius: 8px;
	border: 2px solid var(--wp--preset--color--line);
	cursor: pointer;
	opacity: 1;
}
.tt-single-product .flex-control-thumbs li img.flex-active {
	border-color: var(--wp--preset--color--primary);
}

/* Title / price */
.tt-single-product .product_title {
	margin: 0;
	font-size: var(--wp--preset--font-size--xx-large);
	font-weight: 900;
	line-height: 1.12;
	color: var(--wp--preset--color--brand-purple);
}
.tt-single-product .entry-summary .price {
	font-size: 30px;
	font-weight: 900;
	color: var(--wp--preset--color--ink);
	margin: 0;
}
.tt-single-product .entry-summary .price del {
	color: var(--wp--preset--color--muted);
	font-weight: 700;
	font-size: 20px;
}
.tt-price-note {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--muted);
}
/* Trim WooCommerce's excerpt + rating spacing (a source of the big gaps). */
.tt-single-product .woocommerce-product-details__short-description {
	margin: 0;
}
.tt-single-product .woocommerce-product-details__short-description:empty {
	display: none;
}
.tt-single-product .entry-summary .woocommerce-product-rating {
	margin: 0;
}

/* Variations form */
.tt-single-product .variations {
	width: 100%;
	border: 0;
	margin: 0;
}
.tt-single-product .variations tbody,
.tt-single-product .variations tr,
.tt-single-product .variations td,
.tt-single-product .variations th {
	display: block;
	padding: 0;
	border: 0;
}
.tt-single-product .variations tr {
	margin-bottom: 14px;
}
.tt-single-product .variations tr:last-child {
	margin-bottom: 0;
}
/* Restore real table layout for the size guide (the display:block reset above
   is only meant for the variation form rows, not this table). */
.tt-single-product .variations .tt-size-table {
	display: table;
	border-collapse: collapse;
}
.tt-single-product .variations .tt-size-table thead {
	display: table-header-group;
}
.tt-single-product .variations .tt-size-table tbody {
	display: table-row-group;
}
.tt-single-product .variations .tt-size-table tr {
	display: table-row;
	margin: 0;
}
/* Full grid border on every cell so each size value is easy to read across
   rows and columns (border-collapse merges adjacent borders into single lines).
   `!important` beats WooCommerce core's `.woocommerce div.product form.cart
   .variations td { border: 0 }` (specificity 0,4,3) — the size table renders
   inside a variation <td>, so that framework rule otherwise wins. */
.tt-single-product .variations .tt-size-table th,
.tt-single-product .variations .tt-size-table td {
	display: table-cell;
	padding: 10px 14px;
	border: 1px solid var(--wp--preset--color--field-border) !important;
	white-space: nowrap;
}
/* Space the size guide off the size buttons below it. */
.tt-single-product .tt-sizeguide__panel {
	margin-bottom: 16px;
}
/* Trim WooCommerce's spacing around the selected-variation price block. */
.tt-single-product .single_variation_wrap {
	margin-top: 4px;
}
.tt-single-product .woocommerce-variation {
	margin: 0;
}
.tt-single-product .variations th.label {
	display: none; /* Our wrapper renders its own label. */
}
.tt-single-product .reset_variations {
	display: inline-block;
	margin-top: 8px;
	font-size: var(--wp--preset--font-size--small);
}

.tt-variation__title {
	display: block;
	font-weight: 800;
	margin-bottom: 10px;
}
.tt-variation__label {
	font-weight: 600;
}
/* Hide the native select but keep it available to WooCommerce JS. */
.tt-variation--color .tt-variation__select,
.tt-variation--size .tt-variation__select {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.tt-variation--format .tt-variation__select {
	display: none;
}

/* Swatches */
.tt-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}
.tt-swatch {
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: var(--tt-hex, #ccc);
	border: 4px solid #fff;
	box-shadow: 0 0 0 3px var(--wp--preset--color--field-border);
	cursor: pointer;
	padding: 0;
}
.tt-swatch[aria-pressed="true"] {
	box-shadow: 0 0 0 3px var(--wp--preset--color--primary);
}

/* Size buttons */
.tt-sizes {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 10px;
}
.tt-size {
	min-height: 52px;
	border-radius: 12px;
	border: 2px solid var(--wp--preset--color--field-border);
	background: var(--wp--preset--color--surface);
	color: var(--wp--preset--color--ink);
	font-family: inherit;
	font-size: 18px;
	font-weight: 800;
	cursor: pointer;
}
.tt-size[aria-pressed="true"] {
	background: var(--wp--preset--color--brand-purple);
	border-color: var(--wp--preset--color--brand-purple);
	color: #fff;
}

/* Size guide */
.tt-sizeguide {
	margin-top: 12px;
}
.tt-sizeguide__toggle {
	background: none;
	border: 0;
	padding: 6px 0;
	font-family: inherit;
	font-size: 17px;
	font-weight: 800;
	color: var(--wp--preset--color--primary);
	text-decoration: underline;
	cursor: pointer;
}
.tt-sizeguide__panel {
	margin-top: 14px;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 14px;
	overflow-x: auto;
	background: var(--wp--preset--color--surface);
}
.tt-size-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 16px;
	text-align: center;
}
.tt-size-table caption {
	text-align: left;
	padding: 12px 14px;
	font-weight: 800;
	color: var(--wp--preset--color--brand-purple);
}
.tt-size-table th,
.tt-size-table td {
	padding: 10px 14px;
	/* Full grid on every cell so sizes are easy to read across rows/columns. */
	border: 1px solid var(--wp--preset--color--field-border);
}
.tt-size-table thead th {
	background: #f6f3ea;
}
.tt-size-table tbody th[scope="row"],
.tt-size-table thead th:first-child {
	text-align: left;
}

/* Format cards (books) */
.tt-formats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 12px;
}
.tt-format {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 4px;
	padding: 16px 18px;
	border-radius: 16px;
	border: 3px solid var(--wp--preset--color--line);
	background: var(--wp--preset--color--surface);
	font-family: inherit;
	text-align: left;
	cursor: pointer;
	color: var(--wp--preset--color--ink);
}
.tt-format[aria-pressed="true"] {
	border-color: var(--wp--preset--color--primary);
	background: #f1f8ff;
}
.tt-format__name {
	font-size: 19px;
	font-weight: 900;
}
.tt-format__desc {
	font-size: 16px;
}
.tt-format__price {
	font-size: 18px;
	font-weight: 900;
	color: var(--wp--preset--color--brand-purple);
}

/* Quantity + add to cart */
.tt-single-product form.cart {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: stretch; /* qty box matches the add-to-cart button's height */
	margin: 0;
}
/* The quantity field takes no fixed height — it stretches to whatever height
   the add-to-cart button is, so the two always line up. */
.tt-single-product form.cart .quantity {
	display: inline-flex;
	align-items: stretch;
	align-self: stretch;
	box-sizing: border-box;
	border: 2px solid var(--wp--preset--color--field-border);
	border-radius: 12px;
	background: var(--wp--preset--color--surface);
	overflow: hidden;
	flex: none;
}
.tt-single-product form.cart .quantity input.qty {
	width: 42px;
	height: auto;
	min-height: 0;
	padding: 0 !important; /* no inner padding — the box controls the height */
	align-self: stretch;
	/* Kill the base-input border/radius so there's no inner box. */
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-align: center;
	font-size: 19px;
	font-weight: 800;
	background: transparent;
	-moz-appearance: textfield;
	appearance: textfield;
}
.tt-single-product form.cart .quantity input.qty::-webkit-outer-spin-button,
.tt-single-product form.cart .quantity input.qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}
.tt-qty-btn {
	width: 46px;
	height: auto;
	min-height: 0;
	align-self: stretch;
	border: 0;
	background: transparent;
	font-size: 24px;
	font-weight: 800;
	line-height: 1;
	color: var(--wp--preset--color--brand-purple);
	cursor: pointer;
}
.tt-qty-btn:hover {
	background: var(--wp--preset--color--line);
}
.tt-single-product .single_add_to_cart_button {
	flex: 1 1 220px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	min-height: 48px;
	padding: 0 24px;
	border: 0;
	border-radius: 12px;
	background: var(--wp--preset--color--primary);
	color: #fff;
	font-family: inherit;
	font-weight: 900;
	font-size: 18px;
	cursor: pointer;
}
.tt-single-product .single_add_to_cart_button:hover,
.tt-single-product .single_add_to_cart_button:focus {
	background: var(--wp--preset--color--primary-dark);
}
.tt-single-product .single_add_to_cart_button.disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Printables: free-sample button (secondary/outline) + reassurance line.
   Accessible: full-width >=48px tap target, 17px label, AA contrast, clear
   focus ring (BUILD_SPEC §2). */
.tt-single-product .tt-sample-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	box-sizing: border-box;
	min-height: 48px;
	margin-top: 12px;
	padding: 10px 24px;
	border: 2px solid var(--wp--preset--color--primary);
	border-radius: 12px;
	background: #fff;
	color: var(--wp--preset--color--primary);
	font-weight: 800;
	font-size: 17px;
	text-decoration: none;
}
.tt-single-product .tt-sample-btn:hover {
	background: var(--wp--preset--color--tint-blue);
}
.tt-single-product .tt-sample-btn:focus-visible {
	outline: 3px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}
.tt-single-product .tt-sample-note {
	margin: 8px 0 0;
	font-size: 16px;
	color: var(--wp--preset--color--ink);
}
.tt-addcart-total {
	font-weight: 900;
}
.tt-single-product .woocommerce-variation-add-to-cart {
	display: flex;
	flex-wrap: nowrap; /* qty + button stay on one row */
	gap: 12px;
	align-items: stretch; /* qty box matches the button height */
	width: 100%;
}
.tt-single-product .woocommerce-variation-add-to-cart .single_add_to_cart_button {
	flex: 1 1 auto;
	min-width: 0;
}
.tt-single-product .woocommerce-variation-price {
	width: 100%;
	font-size: 22px;
	font-weight: 900;
	color: var(--wp--preset--color--ink);
	margin-bottom: 6px;
}

/* Delivery box */
.tt-delivery-box {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 20px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 16px;
	font-size: 17px;
}

/* Book details table */
.tt-bookdetails {
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 16px;
	overflow: hidden;
	background: var(--wp--preset--color--surface);
}
.tt-book-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 17px;
}
.tt-book-table caption {
	text-align: left;
	padding: 14px 18px;
	font-weight: 900;
	font-size: 19px;
	color: var(--wp--preset--color--brand-purple);
}
.tt-book-table th,
.tt-book-table td {
	text-align: left;
	padding: 12px 18px;
	border-top: 1px solid var(--wp--preset--color--line);
}
.tt-book-table th[scope="row"] {
	width: 40%;
}

/* Related */
.tt-related {
	grid-column: 1 / -1;
	background: var(--wp--preset--color--surface);
	border-top: 1px solid var(--wp--preset--color--line);
	margin-top: 32px;
	/* Break out of the 1200px product container to span the full viewport. */
	width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}
.tt-related__inner {
	/* Keep the cards aligned with the rest of the page content. */
	max-width: var(--tt-container, 1200px);
	margin-inline: auto;
	padding: 40px 24px 8px;
}
.tt-related__title {
	margin: 0 0 22px;
	font-size: var(--wp--preset--font-size--x-large);
	font-weight: 900;
	color: var(--wp--preset--color--brand-purple);
}
.tt-related .tt-card-grid {
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}
/* Card image: 10px inset (tinted frame) + rounded corners. */
.tt-related .tt-card__media {
	padding: 10px;
}
.tt-related .tt-card__media img {
	border-radius: 8px;
}
/* Footer: price on its own row, button full-width below. */
.tt-related .tt-card__footer {
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
}
.tt-related .tt-card__footer .tt-card__cta {
	width: 100%;
	box-sizing: border-box;
	justify-content: center;
}
