/*
Theme Name: TFP
Theme URI: https://permadigital.co.uk
Author: Perma Digital
Author URI: https://permadigital.co.uk
Version: 1.0.1
Requires at least: 5.2
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: tfp
*/

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline}html{scroll-behavior:smooth}body{line-height:1}a{text-decoration-skip-ink:auto}a[href^="tel"]{color:inherit;text-decoration:none}button{outline:0}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}q{display:inline;font-style:italic}q:before{content:'"';font-style:normal}q:after{content:'"';font-style:normal}textarea,input[type="text"],input[type="button"],input[type="submit"],input[type="reset"],input[type="search"],input[type="password"]{-webkit-appearance:none;appearance:none;border-radius:0}input[type="search"]{-webkit-appearance:textfield}table{border-collapse:collapse;border-spacing:0}th,td{padding:2px}big{font-size:120%}small,sup,sub{font-size:80%}sup{vertical-align:super}sub{vertical-align:sub}dd{margin-left:20px}kbd,tt{font-family:courier;font-size:12px}ins{text-decoration:underline}del,strike,s{text-decoration:line-through}dt{font-weight:bold}address,cite,var{font-style:italic}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
.sticky{}.bypostauthor{}.wp-caption{}.wp-caption-text{}.gallery-caption{}.alignright{}.alignleft{}.aligncenter{}
.screen-reader-text{border:0;clip:rect(1px,1px,1px,1px);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute!important;width:1px;word-wrap:normal!important;word-break:normal}
.screen-reader-text:focus{background-color:#f7f7f7;border-radius:3px;box-shadow:0 0 2px 2px rgba(0,0,0,.6);clip:auto!important;-webkit-clip-path:none;clip-path:none;color:#007acc;display:block;font-size:14px;font-size:.875rem;font-weight:700;height:auto;right:5px;line-height:normal;padding:15px 23px 14px;text-decoration:none;top:5px;width:auto;z-index:100000}
.skip-link{left:-9999rem;top:2.5rem;z-index:999999999;text-decoration:underline}
.skip-link:focus{display:block;left:6px;top:7px;font-size:14px;font-weight:600;text-decoration:none;line-height:normal;padding:15px 23px 14px;z-index:100000;right:auto}
.visually-hidden:not(:focus):not(:active), .form-allowed-tags:not(:focus):not(:active){position:absolute !important;height:1px;width:1px;overflow:hidden;clip:rect(1px 1px 1px 1px);clip:rect(1px, 1px, 1px, 1px);white-space:nowrap}

.wooArchive-image img {
    min-width: 50%;
    width: 100%;
}

.wooArchive-image {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 10px 10px #0000000f;
    width: fit-content;
    min-width: 50%;
    max-width: 100%;
}

.archive .pageHeader .col-lg-4 {
    justify-content: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.productCard__info {
	background: transparent !important;
	box-shadow: 0 0 10px 10px #0000000f;
}
.tabs__items {
	background-color: #D9D9D9 !important;
	color: black !important;
}
.tabs__headers__item:not(.active) {
    border-bottom: 2px solid white;
}

.tabs__headers__item.active {
    border-bottom: 2px solid var(--color-blue);
}

/* ==========================================================================
   TFP – mobile & tablet patch
   Load AFTER assets/style/snagging.css, e.g.
     wp_enqueue_style('tfp-responsive', get_template_directory_uri() . '/assets/style/responsive-patch.css', ['tfp-snagging'], '1.0');
   (use whatever handle snagging.css is registered under)

   Everything is inside max-width: 991px – desktop is untouched.
   Selectors prefixed with `body` are beating the inline <style> blocks the
   product / archive templates print further down the page.
   ========================================================================== */


/* ==========================================================================
   1. TABLET + MOBILE (<= 991px)
   ========================================================================== */
@media screen and (max-width: 991px) {

	/* --- Page overflow guard (root causes are fixed below as well) --- */
	html,
	body {
		overflow-x: hidden;
		overflow-x: clip;
	}

	/* --- Product tabs: equal height, text centred, never wider than the page --- */
	.tabs__headers {
		align-items: stretch;
		overflow-x: auto;
		scrollbar-width: none;
	}
	.tabs__headers::-webkit-scrollbar {
		display: none;
	}
	.tabs__headers .tabs__headers__item {
		display: flex;
		align-items: center;
		justify-content: center;
		text-align: center;
		line-height: 1.25;
	}

	/* Anything dropped into a tab stays inside it */
	.tabs__items__item {
		overflow-wrap: break-word;
	}
	.tabs__items__item img {
		max-width: 100%;
		height: auto;
	}
	.tabs__items__item iframe {
		max-width: 100%;
	}
	.tabs__items__item table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
	}

	/* --- Buttons: bring the 15px/45px desktop padding down --- */
	.button,
	.woocommerce .button {
		padding: 12px 22px !important;
		font-size: 15px;
	}

	/* --- Video play button: 100px is too heavy on a ~350px image --- */
	body .productInfo__image__main__play {
		top: calc(50% - 32px);
		left: calc(50% - 32px);
		width: 64px;
		height: 64px;
		padding: 18px 18px 18px 22px;
	}

	/* --- Product cards: equal height per row, buttons pinned to the bottom ---
	   (height:auto overrides the inline heights main.js writes on load, which
	   go stale on rotate; flexbox does the equalising instead) */
	.productCatArchive__items > .row > .productCard,
	.productCard__row > .productCard {
		display: flex;
		flex-direction: column;
		flex: 0 0 auto;
		height: auto !important;
	}
	.productCard .productCard__info {
		height: auto !important;
		flex: 1;
		justify-content: flex-start;
	}
	.productCard__price {
		margin-bottom: 12px;
	}
	.productCard__info__actions {
		margin-top: auto;
	}
	.productCard__info__actions__heart {
		flex: 0 0 auto;
	}
	.productCard__info__actions__view {
		flex: 1;
		align-self: stretch;
	}

	/* --- Category header + filter panel: line up with the product cards --- */
	body section.pageheader2 .row,
	body .archiveProductDesc .row {
		margin-left: 0;
		margin-right: 0;
	}
	body section.pageheader2.old .row {
		min-height: 0;
	}
	.productCatArchive .productCatArchive__filters {
		flex: 0 0 auto;
		width: calc(100% - var(--bs-gutter-x));
		margin: 0 calc(var(--bs-gutter-x) * .5) 24px;
	}

	/* Empty blue description bar under the grid.
	   ponytail: relies on the description always being wrapped in tags (wpautop
	   does this); a bare-text description would be hidden too. */
	.archiveProductDesc:not(:has(.written > *)) {
		display: none;
	}
}


/* ==========================================================================
   2. TABLET ONLY (768px – 991px)
   ========================================================================== */
@media screen and (min-width: 768px) and (max-width: 991px) {

	/* Product page: gallery and details side by side instead of a 700px image */
	section.section.productInfo .container > .row {
		gap: 0;
	}
	section.section.productInfo .container > .row > .col {
		flex: 0 0 auto;
		width: 50%;
	}
	.productInfo h1 {
		margin-top: 12px;
		font-size: 1.5rem;
	}

	/* Product grids: 3 per row */
	.productCatArchive__items > .row > .productCard,
	.productCard__row > .productCard {
		width: 33.3333%;
	}
	.productCard__row {
		--bs-gutter-y: 1.5rem;
	}
	.productCard__info h3 {
		font-size: 1rem;
		line-height: 1.3;
		margin-bottom: 6px;
	}
	.productCard .productCard__info {
		padding: 14px 16px;
	}
	.productCard__info__actions {
		gap: 10px;
	}
	.productCard__info__actions__heart {
		width: 42px;
		height: 42px;
	}
	.productCard__info__actions__view {
		font-size: 14px;
	}

	.productSpecification__item {
		width: calc(50% - 16px);
	}
}


/* ==========================================================================
   3. MOBILE ONLY (<= 767px)
   ========================================================================== */
@media screen and (max-width: 767px) {

	/* --- Product page --- */
	.productInfo h1 {
		margin: 12px 0;
		font-size: 1.375rem;
		line-height: 1.25;
	}
	.productInfo__pricing {
		flex-wrap: wrap;
		gap: 2px 12px;
	}
	body .productInfo__addToCart {
		margin-top: 24px;
	}
	body .productInfo__addToCart form {
		gap: 12px;
	}
	body .productInfo__taglist {
		margin-top: 20px;
	}

	/* Video lightbox: use the full width, not 60% of a phone */
	body .videoLightbox__content {
		width: 100%;
		padding: 16px;
	}
	body .videoLightbox__content iframe {
		width: 100%;
	}

	/* Tabs */
	.tabs__headers {
		gap: 6px;
	}
	.tabs__headers .tabs__headers__item {
		flex: 1 1 auto;
		padding: 10px;
		font-size: 12px;
	}
	.tabs__items {
		padding: 20px 16px 16px;
	}
	.productSpecification {
		gap: 16px;
	}
	.productSpecification__item {
		width: 100%;
	}

	/* --- Category page --- */
	body section.pageheader2 {
		margin: 16px 0;
	}
	body section.pageheader2 .row .col2 {
		padding: 20px;
	}
	.productCatArchive .productCatArchive__filters {
		padding: 14px 16px;
		margin-bottom: 16px;
	}
	.productCatArchive__filters .productCatArchive__filters__header {
		font-size: 16px;
	}
	/* proper chevron instead of the letter "V" */
	.productCatArchive__filters .productCatArchive__filters__header::after {
		content: '';
		width: 9px;
		height: 9px;
		margin-right: 4px;
		border-right: 2px solid currentColor;
		border-bottom: 2px solid currentColor;
		transform: rotate(-135deg);
	}
	.productCatArchive__filters .productCatArchive__filters__header.toggled::after {
		transform: rotate(45deg);
	}
	body .productCatArchive__filters__group:not(.toggled) {
		margin-bottom: 4px;
	}

	/* --- Product grids: 2 per row, compact cards --- */
	.productCatArchive__items > .row,
	.productCard__row {
		--bs-gutter-x: 12px;
		--bs-gutter-y: 12px;
	}
	.productCatArchive__items > .row > .productCard,
	.productCard__row > .productCard {
		width: 50%;
	}
	.productCard .productCard__info {
		padding: 12px;
	}
	.productCard__info h3 {
		font-size: .875rem;
		line-height: 1.3;
		margin-bottom: 6px;
	}
	.productCard__price {
		font-size: .875rem;
	}
	.productCard__info__actions {
		gap: 8px;
	}
	.productCard__info__actions__heart {
		width: 38px;
		height: 38px;
		padding: 8px;
		border-radius: 6px;
	}
	.productCard__info__actions__view {
		min-height: 38px;
		font-size: 13px;
		border-radius: 6px;
	}

	/* Pagination: finger-sized targets */
	.woocommerce nav.woocommerce-pagination ul li a,
	.woocommerce nav.woocommerce-pagination ul li span {
		min-width: 44px;
		padding: 12px 8px;
	}

	/* --- Footer: breathing room between the stacked columns --- */
	footer .footer__top > .col {
		margin-bottom: 24px;
	}
	footer .footer__bottom {
		margin-top: 24px;
	}
}