/*
 * TSD 1.0.39 — staging QA fixes. Every block is scoped by a body class that the matching kill switch removes
 * (tsd39-loop-buttons, tsd39-nodates-cleanup, tsd39-play-button, tsd39-mobile, tsd39-video-tiles, tsd39-review-grid).
 */

/* ---------------------------------------------------------------- 1. Loop buttons (cross-sells, upsells, related, shop, blocks) */
body.tsd39-loop-buttons :is(ul.products li.product, .wc-block-grid__product, .wc-block-product, li.wp-block-post.product, .wp-block-woocommerce-product-template > li) :is(a.button, button.button, .add_to_cart_button, .product_type_variable, .product_type_simple, .product_type_external, .wp-block-button__link, .wc-block-components-product-button__button) {
	display: inline-flex !important;
	align-items: center !important;
	justify-content: center !important;
	box-sizing: border-box;
	height: auto !important;
	min-height: 2.9rem;
	max-height: none;
	padding: .75rem 1.25rem !important;
	line-height: 1.2 !important;
	text-align: center;
	white-space: normal;
	vertical-align: middle;
	flex: 0 0 auto !important;
	align-self: stretch;
	margin-top: auto;
}
/* Cards: title/price grow, the button sits at the bottom of the card (equal rows). */
body.tsd39-loop-buttons :is(ul.products li.product) { display: flex; flex-direction: column; }
body.tsd39-loop-buttons ul.products li.product > a.woocommerce-LoopProduct-link { flex: 0 0 auto; }
body.tsd39-loop-buttons :is(ul.products li.product) .added_to_cart { align-self: center; margin-top: .5rem; }
body.tsd39-loop-buttons .wc-block-components-product-button { display: flex; flex-direction: column; align-items: stretch; margin-top: auto; }

/* ---------------------------------------------------------------- 2. No upcoming dates: no hint, no empty box */
body.tsd39-nodates-cleanup .tt-product__summary:has(.tsd-upcoming) .tsd-actions__hint { display: none; }
body.tsd39-nodates-cleanup .tt-product__buy.tsd39-empty,
body.tsd39-nodates-cleanup .tt-product__summary:has(.tsd-upcoming) .tt-product__buy:not(:has(form, .single_add_to_cart_button, a, button, input, select, img, p)) {
	display: none !important;
}

/* ---------------------------------------------------------------- 5. Brand play button */
body.tsd39-play-button .tt-video__play svg.tsd39-play,
body.tsd39-play-button .gp-video__play svg.tsd39-play { width: 76px; height: 76px; filter: drop-shadow(0 6px 18px rgba(0, 0, 0, .45)); transition: transform .2s ease; }
body.tsd39-play-button .tsd39-play__ring { transition: fill .2s ease; }
body.tsd39-play-button :is(.tt-video__play, .gp-video__play):is(:hover, :focus-visible) svg.tsd39-play { transform: scale(1.08); }
body.tsd39-play-button :is(.tt-video__play, .gp-video__play):is(:hover, :focus-visible) .tsd39-play__ring { fill: #fff; }
body.tsd39-play-button .tt-video__label, body.tsd39-play-button .gp-video__label {
	font-family: var(--tt-head, Montserrat, Arial, sans-serif); font-weight: 700; letter-spacing: .16em; text-transform: uppercase; font-size: .72rem;
	color: #fff; text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
}
@media (max-width: 600px) { body.tsd39-play-button :is(.tt-video__play, .gp-video__play) svg.tsd39-play { width: 60px; height: 60px; } }

/* ---------------------------------------------------------------- 3. Video testimonials: b/w by default, colour + names on hover */
body.tsd39-video-tiles .tsd38-vt__still { display: none; }
body.tsd39-video-tiles .tsd38-vt__tile .tsd38-vt__color,
body.tsd39-video-tiles .tsd38-vt__tile.is-active .tsd38-vt__color {
	opacity: 1; filter: grayscale(1) contrast(1.06) brightness(.92); transform: none;
	transition: filter .55s ease, transform .9s ease;
}
body.tsd39-video-tiles .tsd38-vt__tile .tsd38-vt__txt,
body.tsd39-video-tiles .tsd38-vt__tile.is-active .tsd38-vt__txt { opacity: 0; transform: translateY(8px); }
body.tsd39-video-tiles .tsd38-vt__tile:is(:hover, :focus-visible) .tsd38-vt__color { filter: none; transform: scale(1.03); }
body.tsd39-video-tiles .tsd38-vt__tile:is(:hover, :focus-visible) .tsd38-vt__txt { opacity: 1; transform: none; }
/* Touch screens (no hover): the tile in the middle of the screen turns colour (JS adds .is-active); the caption pill stays visible. */
@media (hover: none) and (pointer: coarse) {
	body.tsd39-video-tiles .tsd38-vt__tile.is-active .tsd38-vt__color { filter: none; }
	body.tsd39-video-tiles .tsd38-vt__tile .tsd38-vt__txt { opacity: 1; transform: none; background: linear-gradient(0deg, rgba(0, 0, 0, .7), rgba(0, 0, 0, 0) 70%); }
	body.tsd39-video-tiles .tsd38-vt__tile .tsd38-vt__kick { display: none; }
}
@media (prefers-reduced-motion: reduce) { body.tsd39-video-tiles .tsd38-vt__tile .tsd38-vt__color { transition: none; transform: none !important; } }

/* ---------------------------------------------------------------- 4. Review wall: grid, all 12 cards on desktop */
body.tsd39-review-grid .tsd38-rv__wall {
	columns: auto; column-count: auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: stretch;
}
body.tsd39-review-grid .tsd38-rv__card { display: flex; flex-direction: column; margin: 0; height: 100%; }
body.tsd39-review-grid .tsd38-rv__card figcaption { margin-top: auto; padding-top: 1rem; }
body.tsd39-review-grid .tsd38-rv__card:hover { transform: none; }
body.tsd39-review-grid .tsd38-rv__more { display: none; }
@media (max-width: 1023px) { body.tsd39-review-grid .tsd38-rv__wall { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 781px) {
	body.tsd39-review-grid .tsd38-rv__card:nth-child(n+7) { display: flex; }
}
@media (max-width: 600px) {
	body.tsd39-review-grid .tsd38-rv__wall { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
	/* With JS: 6 cards and a "Show all reviews" button. Without JS every card shows. */
	html.tsd39-js body.tsd39-review-grid .tsd38-rv__wall:not(.is-open) .tsd38-rv__card:nth-child(n+7) { display: none; }
	html.tsd39-js body.tsd39-review-grid .tsd38-rv__more { display: flex; justify-content: center; margin: 1.25rem 0 0; }
}
body.tsd39-review-grid .tsd38-rv__more button {
	appearance: none; cursor: pointer; background: transparent; color: #fff; border: 2px solid rgba(255, 255, 255, .6); border-radius: 4px;
	padding: .8rem 1.4rem; min-height: 3rem; font: 700 .74rem/1.2 var(--tt-head, Montserrat, Arial, sans-serif); letter-spacing: .14em; text-transform: uppercase;
}
body.tsd39-review-grid .tsd38-rv__more button:is(:hover, :focus-visible) { background: #fff; color: #111; }

/* ---------------------------------------------------------------- 6. Mobile polish (CCW page + product) */
@media (max-width: 781px) {
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-rv__hero blockquote p { font-size: 1.05rem; line-height: 1.6; }
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-rv__cta { flex-direction: column; align-items: stretch; }
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-rv__cta .tsd38-btn { justify-content: center; text-align: center; }
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-bio__chips { flex-wrap: wrap; }
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-ol__body { padding-left: 1.25rem; padding-right: 1.25rem; }
	/* Long bare URLs in variation descriptions wrap at "/" instead of mid-word. */
	body.tsd39-mobile .woocommerce-variation-description a { overflow-wrap: anywhere; word-break: normal; }
	body.tsd39-mobile .single-product .variations select, body.tsd39-mobile .variations select { max-width: 100%; min-height: 3rem; font-size: 16px; }
}

/* Cross-sells / upsells / related: equal-height cards with the buttons on one line (the lists were floats). */
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products {
	display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; margin: 0; padding: 0;
}
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products.columns-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products::before,
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products::after { content: none; display: none; }
body.tsd39-loop-buttons :is(.cross-sells, .upsells, .related) ul.products li.product { width: auto !important; float: none !important; margin: 0 !important; height: 100%; }
@media (max-width: 781px) {
	body.tsd39-loop-buttons :is(.upsells, .related) ul.products:is(.columns-3, .columns-4) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------------------------------------------------------------- 6b. Cart on phones / small tablets */
@media (max-width: 768px) {
	body.tsd39-mobile .woocommerce-cart-form td.product-name { display: block !important; text-align: left !important; }
	body.tsd39-mobile .woocommerce-cart-form td.product-name::before { display: block; float: none; margin: 0 0 .35rem; text-align: left; }
	body.tsd39-mobile .woocommerce-cart-form td.product-name > a { display: block; width: auto; text-align: left; font-weight: 700; margin-bottom: .5rem; }
	body.tsd39-mobile .woocommerce-cart-form td.product-name dl.variation {
		display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .2rem .6rem; width: auto; margin: 0; text-align: left; font-size: .85rem;
	}
	body.tsd39-mobile .woocommerce-cart-form td.product-name dl.variation :is(dt, dd) { float: none; margin: 0; padding: 0; text-align: left; }
	body.tsd39-mobile .woocommerce-cart-form td.product-name dl.variation dd p { margin: 0; }
	body.tsd39-mobile .woocommerce-cart-form td.actions { flex-direction: column !important; align-items: stretch !important; gap: .75rem; text-align: left !important; }
	body.tsd39-mobile .woocommerce-cart-form td.actions .coupon { display: flex !important; flex-direction: row; gap: .5rem; width: 100% !important; float: none !important; }
	body.tsd39-mobile .woocommerce-cart-form td.actions .coupon input { flex: 1 1 auto; min-width: 0; width: auto !important; min-height: 3rem; font-size: 16px; }
	body.tsd39-mobile .woocommerce-cart-form td.actions .coupon button { flex: 0 0 auto; width: auto !important; min-height: 3rem; white-space: nowrap; padding: .75rem 1rem; display: inline-flex; align-items: center; }
	body.tsd39-mobile .woocommerce-cart-form td.actions > button[name="update_cart"] { width: 100% !important; float: none !important; min-height: 3rem; }
}

/* ---------------------------------------------------------------- 6c. Concealed Carry page on phones / tablets */
/* The old builder's phone-only hero repeated the theme hero right below it ("Concealed Carry Class" twice). */
@media (max-width: 1199.98px) {
	body.tsd39-mobile.tsd-v1038-ccw .tt-sec.tt-hide-pc.tt-sec--tall.has-bg.tt-scheme-dark:not(.tsd38) { display: none !important; }
}
/* Small tablets: two video tiles per row instead of one huge tile. */
@media (min-width: 601px) and (max-width: 781px) {
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-vt__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	body.tsd39-mobile.tsd-v1038-ccw .tsd38-vt__txt strong { font-size: 1rem; }
}
