/*
Theme Name: TPD Stable Baseline
Theme URI: https://thepartsdistributors.com/
Author: OpenAI
Description: Minimal stable WooCommerce theme baseline for The Parts Distributors.
Version: 1.0.0
Requires at least: 6.0
Tested up to: 6.8
Requires PHP: 7.4
Text Domain: tpd-stable
*/

:root{
  --tpd-bg:#f4f6f8; --tpd-card:#fff; --tpd-line:#d8dde6; --tpd-text:#1b2738;
  --tpd-muted:#637083; --tpd-blue:#2f5fe8; --tpd-red:#e11818; --tpd-red-dark:#c71414;
  --tpd-green:#12843d; --tpd-radius:3px; --tpd-container:1580px;
}
*,*::before,*::after{box-sizing:border-box}
html{scroll-behavior:smooth}
body{margin:0;font-family:Arial,Helvetica,sans-serif;background:var(--tpd-bg);color:var(--tpd-text);line-height:1.45;overflow-x:hidden}
img{max-width:100%;height:auto;display:block}
a{color:var(--tpd-text);text-decoration:none} a:hover{color:var(--tpd-blue)}
button,input,select,textarea{font:inherit}
.site-wrap{min-height:100vh;display:flex;flex-direction:column}
.top-strip{height:6px;background:#000}
.tpd-container{width:min(96%, var(--tpd-container));margin-inline:auto}
.site-main{flex:1;padding:18px 0 26px}

.site-header{background:#fff;border-bottom:1px solid var(--tpd-line)}
.header-main{display:grid;grid-template-columns:220px minmax(0,1fr) 140px auto;gap:10px;align-items:center;padding:10px 0}
.site-branding img{max-height:48px;width:auto}
.site-title-text{display:inline-block;font-size:18px;font-weight:900;line-height:.95;letter-spacing:-.3px}
.header-search input[type="search"]{width:100%;height:40px;border:1px solid #c8d1e2;border-radius:var(--tpd-radius);padding:0 12px;background:#fff;color:var(--tpd-text);font-size:14px}
.tpd-btn,button,input[type="submit"],.woocommerce a.button,.woocommerce button.button,.woocommerce input.button{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 14px;border:0;border-radius:var(--tpd-radius);background:var(--tpd-red);color:#fff !important;font-size:13px;font-weight:800;cursor:pointer}
.tpd-btn:hover,button:hover,input[type="submit"]:hover,.woocommerce a.button:hover,.woocommerce button.button:hover,.woocommerce input.button:hover{background:var(--tpd-red-dark)}
.header-find .tpd-btn{width:100%}
.header-cart a{display:inline-flex;align-items:center;justify-content:center;min-height:36px;padding:0 14px;border:1px solid #c8d1e2;border-radius:var(--tpd-radius);background:#fff;font-size:13px;font-weight:700;white-space:nowrap}

.nav-wrap{background:#fff;border-bottom:1px solid var(--tpd-line)}
.primary-nav{display:flex;align-items:center;gap:22px;overflow-x:auto;white-space:nowrap;scrollbar-width:none;padding:11px 0;font-size:13px;font-weight:800}
.primary-nav::-webkit-scrollbar{display:none}
.primary-nav ul,.primary-nav li,.footer-links ul,.footer-links li{list-style:none;margin:0;padding:0}
.primary-nav .menu,.footer-links .menu{display:contents}

.section{margin-bottom:22px}
.section-title{margin:0 0 10px;font-size:20px;font-weight:900;line-height:1.1}
.brand-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:10px}
.brand-chip{min-height:46px;display:flex;align-items:center;justify-content:center;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);background:#fff;padding:8px;text-align:center;font-size:14px;font-weight:800}
.brand-chip:hover{border-color:var(--tpd-red);color:var(--tpd-text)}
.home-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(240px,1fr));gap:12px}
.home-card{border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);background:#fff;padding:10px;display:flex;flex-direction:column}
.home-card .thumb{width:100%;aspect-ratio:1/1;border:1px solid #e3e7ef;border-radius:var(--tpd-radius);background:#fafbfd;overflow:hidden;display:flex;align-items:center;justify-content:center;margin-bottom:8px}
.home-card .thumb img{max-height:160px;object-fit:contain}
.home-card .title{font-size:13px;font-weight:700;line-height:1.32;min-height:34px;margin-bottom:6px}
.home-card .price{font-size:15px;font-weight:900;margin:0 0 8px}
.home-card .tpd-btn{width:100%;min-height:34px;font-size:12px;margin-top:auto}
.guides-list{columns:2;column-gap:48px;padding-left:20px;margin:0}
.guides-list li{margin:0 0 8px;break-inside:avoid}
.guides-list a{font-size:13px;font-weight:700;text-decoration:underline;text-underline-offset:2px}

.article-shell{background:#fff;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);padding:20px}
.article-shell.narrow{max-width:980px;margin-inline:auto}
.page-title,.entry-title{margin:0 0 12px;font-size:clamp(30px,4vw,46px);line-height:1.08;letter-spacing:-.4px}
.entry-meta{margin-bottom:12px;color:var(--tpd-muted);font-size:13px}
.entry-content{font-size:17px;line-height:1.7}
.entry-content > *:first-child{margin-top:0}
.entry-content h2,.entry-content h3,.entry-content h4{margin:1.35em 0 .55em;line-height:1.2}
.entry-content p,.entry-content ul,.entry-content ol{margin:0 0 1em}

.archive-shell{background:#fff;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);padding:16px}
.archive-intro{display:flex;justify-content:space-between;align-items:flex-start;gap:16px;margin-bottom:12px}
.archive-meta{color:var(--tpd-muted);font-size:14px}
.archive-meta strong{display:block;color:var(--tpd-text);font-size:15px;margin-top:4px}
.archive-ordering select,.woocommerce .woocommerce-ordering select{min-height:36px;border:1px solid #c8d1e2;border-radius:var(--tpd-radius);background:#fff;padding:0 10px;font-size:13px}
.archive-shell ul.products,.woocommerce-page ul.products,.woocommerce ul.products{display:grid !important;grid-template-columns:repeat(auto-fit,minmax(255px,1fr));gap:10px !important;margin:0 !important;padding:0 !important;width:100% !important}
.archive-shell ul.products li.product,.woocommerce-page ul.products li.product,.woocommerce ul.products li.product{width:auto !important;float:none !important;margin:0 !important;padding:8px !important;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);background:#fff}
.archive-shell ul.products li.product .button,.woocommerce-page ul.products li.product .button,.woocommerce ul.products li.product .button{min-height:30px;padding:0 10px;font-size:12px}
.product-tile{display:grid;grid-template-columns:72px 1fr auto;gap:10px;align-items:start}
.product-tile-image{width:72px;height:72px;border:1px solid #e3e7ef;border-radius:var(--tpd-radius);background:#fafbfd;display:flex;align-items:center;justify-content:center;overflow:hidden}
.product-tile-image img{max-width:64px;max-height:64px;object-fit:contain}
.sku-title{font-size:13px;font-weight:800;line-height:1.28;margin-bottom:4px}
.short-title{font-size:12px;line-height:1.32;color:var(--tpd-muted);margin-bottom:4px}
.product-tile-side{min-width:74px;text-align:right}
.product-tile-price{font-size:14px;font-weight:900;margin-bottom:4px}
.product-stock{font-size:12px;color:var(--tpd-green);margin-bottom:8px}
.product-actions{display:flex;gap:8px;justify-content:flex-end}
.view-link{font-size:12px;font-weight:800;align-self:center}

.woocommerce-pagination,.nav-links{width:100%;margin-top:16px;text-align:center}
.woocommerce-pagination ul.page-numbers,.nav-links{display:flex !important;flex-wrap:wrap !important;justify-content:center !important;gap:6px !important;list-style:none;padding:0}
.woocommerce-pagination ul.page-numbers li{display:inline-block !important}
.page-numbers,.page-numbers a,.page-numbers span,.nav-links a,.nav-links span{display:inline-flex;align-items:center;justify-content:center;min-width:30px;min-height:30px;padding:0 8px;border-radius:var(--tpd-radius);background:#f2f5f8;font-size:12px}

.woocommerce div.product{background:#fff;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);padding:16px}
@media (min-width:821px){
  .woocommerce div.product::after{content:"";display:block;clear:both}
  .woocommerce div.product div.images{float:left !important;width:40% !important;margin-right:4% !important;max-width:40% !important}
  .woocommerce div.product div.summary{float:right !important;width:56% !important;max-width:56% !important;margin:0 !important}
}
.woocommerce div.product .product_title{font-size:clamp(24px,3vw,34px);line-height:1.08;letter-spacing:-.3px;margin-bottom:10px;word-break:break-word;overflow-wrap:anywhere}
.woocommerce div.product .summary .price{font-size:24px;font-weight:900;margin-bottom:12px}
.woocommerce div.product form.cart{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.woocommerce div.product form.cart .single_add_to_cart_button{min-height:36px}
.woocommerce div.product .woocommerce-tabs{margin-top:20px}
.woocommerce div.product .woocommerce-tabs ul.tabs{margin:0 0 12px;padding:0;white-space:nowrap;overflow-x:auto;scrollbar-width:none}
.woocommerce div.product div.images .flex-control-thumbs{display:flex !important;gap:8px;margin-top:10px;padding:0;list-style:none}
.woocommerce div.product div.images .flex-control-thumbs li{width:58px !important;float:none !important}
.woocommerce div.product div.images .flex-control-thumbs img{width:100%;height:auto;border:1px solid var(--tpd-line);border-radius:var(--tpd-radius);opacity:1 !important;cursor:pointer}

/* v1.3 related products rebuilt */
.related.products{
  margin-top:20px;
}
.related.products > h2{
  margin:0 0 10px;
  font-size:16px;
  font-weight:900;
}
.related.products ul.products{
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));
  gap:16px !important;
  align-items:stretch;
}
.related.products ul.products li.product{
  display:flex !important;
  flex-direction:column !important;
  border:1px solid var(--tpd-line);
  border-radius:var(--tpd-radius);
  background:#fff;
  padding:10px !important;
  min-height:0 !important;
  height:auto !important;
}
.related.products ul.products li.product a.woocommerce-LoopProduct-link{
  display:flex !important;
  flex-direction:column !important;
  gap:6px;
  height:100%;
}
.related.products ul.products li.product img{
  height:120px !important;
  max-height:120px !important;
  width:100%;
  object-fit:contain;
  margin:0 0 8px;
}
.related.products ul.products li.product .woocommerce-loop-product__title{
  font-size:13px !important;
  font-weight:700;
  line-height:1.3;
  height:34px;
  min-height:34px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  margin:0 0 6px;
}
.related.products ul.products li.product .product_meta,
.related.products ul.products li.product .sku,
.related.products ul.products li.product .posted_in,
.related.products ul.products li.product .short-title{
  display:none !important;
}
.related.products ul.products li.product .price{
  font-size:14px !important;
  font-weight:900;
  margin:0 0 6px !important;
}
.related.products ul.products li.product .stock,
.related.products ul.products li.product .product-stock{
  font-size:12px;
  color:var(--tpd-green);
  margin:0 0 8px;
}
.related.products ul.products li.product .button{
  width:100%;
  margin-top:auto !important;
  min-height:30px !important;
  font-size:11px !important;
  padding:6px 8px !important;
}

.product-guides{margin-top:20px;border-top:1px solid var(--tpd-line);padding-top:14px}
.product-guides h2{margin:0 0 8px;font-size:16px;font-weight:900}
.product-guides ul{margin:0;padding-left:18px}
.product-guides li{margin:0 0 6px}
.product-guides a{font-size:13px;font-weight:700;text-decoration:underline;text-underline-offset:2px}

.site-footer{background:#fff;border-top:1px solid var(--tpd-line)}
.footer-inner{padding:16px 0 22px}
.footer-copy{color:var(--tpd-muted);font-size:12px;margin-bottom:10px}

@media (max-width:1100px){
  .brand-grid{grid-template-columns:repeat(4,1fr)}
  .guides-list{columns:1}
}
@media (max-width:820px){
  .header-main{grid-template-columns:1fr}
  .site-branding img{max-height:42px}
  .header-find .tpd-btn,.header-cart a{width:100%}
  .brand-grid{grid-template-columns:repeat(2,1fr)}
  .home-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .product-tile{grid-template-columns:64px 1fr}
  .product-tile-side{grid-column:2;text-align:left;min-width:0}
  .product-actions{justify-content:flex-start}
  .archive-intro{flex-direction:column}
  .woocommerce div.product div.images,.woocommerce div.product div.summary{float:none !important;width:100% !important;max-width:100% !important;margin:0 0 14px 0 !important;clear:both !important}
}
@media (max-width:540px){
  .tpd-container{width:min(100% - 18px, var(--tpd-container))}
  .primary-nav{gap:16px}
  .home-grid,.archive-shell ul.products,.woocommerce-page ul.products,.woocommerce ul.products,.related.products ul.products{grid-template-columns:1fr !important}
  .entry-content{font-size:16px}
}


/* v1.1 fixes */
.primary-nav > div,
.footer-links > div{display:contents}
.primary-nav a,
.footer-links a{font-weight:800}
.primary-nav{flex-wrap:nowrap}
.footer-links{display:flex;gap:14px 18px;flex-wrap:wrap;white-space:normal}
.footer-links a{font-size:13px}
.related.products ul.products li.product{
  display:flex !important;
  flex-direction:column;
  min-height:0 !important;
}
.related.products ul.products li.product a.woocommerce-LoopProduct-link{
  display:flex !important;
  flex-direction:column;
  gap:6px;
}
.related.products ul.products li.product .woocommerce-loop-product__title{
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:32px;
}
.related.products ul.products li.product .price{
  margin:0 0 6px;
  font-size:13px;
  font-weight:900;
}
.related.products ul.products li.product .button{
  margin-top:auto !important;
  width:100%;
}
.woocommerce div.product .related.products ul.products{
  align-items:stretch;
}


/* v1.2 WooCommerce enforcement fixes */
.related.products ul.products li.product{
  padding:8px !important;
  height:auto !important;
  min-height:0 !important;
}
.related.products ul.products li.product .woocommerce-loop-product__title{
  font-size:12px !important;
  line-height:1.3;
  max-height:32px;
  overflow:hidden;
}
.related.products ul.products li.product img{
  max-height:110px;
  object-fit:contain;
}
.related.products ul.products li.product .button{
  font-size:11px !important;
  padding:4px 8px !important;
}


/* v1.4 related products compact rebuild */
.related.products ul.products{
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr)) !important;
  gap:12px !important;
}
.related.products ul.products li.product{
  display:grid !important;
  grid-template-rows:auto auto auto 1fr auto !important;
  align-content:start !important;
  padding:8px !important;
  min-height:0 !important;
  height:auto !important;
}
.related.products ul.products li.product a.woocommerce-LoopProduct-link{
  display:block !important;
  height:auto !important;
}
.related.products ul.products li.product img{
  display:block;
  width:100%;
  height:96px !important;
  max-height:96px !important;
  margin:0 0 6px 0 !important;
  object-fit:contain;
}
.related.products ul.products li.product .woocommerce-loop-product__title{
  height:34px !important;
  min-height:34px !important;
  max-height:34px !important;
  margin:0 0 6px 0 !important;
}
.related.products ul.products li.product .price{
  display:block !important;
  margin:0 0 6px 0 !important;
}
.related.products ul.products li.product .stock,
.related.products ul.products li.product .product-stock{
  display:block !important;
  margin:0 0 6px 0 !important;
}
.related.products ul.products li.product p,
.related.products ul.products li.product .yith-wcwl-add-to-wishlist,
.related.products ul.products li.product .star-rating,
.related.products ul.products li.product .posted_in,
.related.products ul.products li.product .sku_wrapper,
.related.products ul.products li.product .product-brands,
.related.products ul.products li.product .brand,
.related.products ul.products li.product .excerpt,
.related.products ul.products li.product small,
.related.products ul.products li.product br{
  display:none !important;
}
.related.products ul.products li.product .button{
  align-self:end !important;
  justify-self:stretch !important;
  margin-top:0 !important;
}


/* v1.5 hard related-products override */
.related.products .tpd-related-grid{
  display:grid !important;
  grid-template-columns:repeat(auto-fit,minmax(180px,1fr)) !important;
  gap:12px !important;
  margin:0 !important;
  padding:0 !important;
}
.related.products .tpd-related-card{
  list-style:none;
  border:1px solid var(--tpd-line);
  border-radius:var(--tpd-radius);
  background:#fff;
  padding:8px !important;
  display:grid !important;
  grid-template-rows:auto auto auto auto auto;
  align-content:start;
  min-height:0 !important;
  height:auto !important;
}
.related.products .tpd-related-thumb{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:96px;
  border:1px solid #e3e7ef;
  border-radius:var(--tpd-radius);
  background:#fafbfd;
  overflow:hidden;
  margin:0 0 6px 0;
}
.related.products .tpd-related-thumb img{
  width:100%;
  height:90px !important;
  max-height:90px !important;
  object-fit:contain;
  margin:0 !important;
}
.related.products .tpd-related-title{
  font-size:12px;
  font-weight:800;
  line-height:1.28;
  min-height:32px;
  max-height:32px;
  overflow:hidden;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  margin:0 0 5px 0;
  color:var(--tpd-text);
}
.related.products .tpd-related-price{
  font-size:13px;
  font-weight:900;
  margin:0 0 4px 0;
}
.related.products .tpd-related-stock{
  font-size:12px;
  color:var(--tpd-green);
  margin:0 0 6px 0;
}
.related.products .tpd-related-actions{
  display:grid;
  grid-template-columns:1fr auto;
  gap:8px;
  align-items:center;
  margin-top:0;
}
.related.products .tpd-related-actions .button{
  min-height:28px !important;
  font-size:11px !important;
  padding:4px 8px !important;
  width:100%;
  margin:0 !important;
}
.related.products .tpd-related-view{
  font-size:12px;
  font-weight:800;
  white-space:nowrap;
}


/* v1.6 shop/search dense catalog rebuild */
.archive-shell{
  padding:12px;
}
.archive-intro{
  margin-bottom:10px;
}
.archive-meta,
.archive-meta strong{
  font-size:13px !important;
}
.archive-shell ul.products,
.woocommerce-page ul.products,
.woocommerce ul.products{
  grid-template-columns:repeat(auto-fit,minmax(210px,1fr)) !important;
  gap:8px !important;
}
.archive-shell ul.products li.product,
.woocommerce-page ul.products li.product,
.woocommerce ul.products li.product{
  padding:6px !important;
  border-radius:2px !important;
}
.product-tile{
  grid-template-columns:58px 1fr auto !important;
  gap:8px !important;
  align-items:start !important;
}
.product-tile-image{
  width:58px !important;
  height:58px !important;
  border-radius:2px !important;
}
.product-tile-image img{
  max-width:52px !important;
  max-height:52px !important;
}
.sku-title{
  font-size:12px !important;
  line-height:1.22 !important;
  margin-bottom:3px !important;
  display:-webkit-box;
  -webkit-line-clamp:3;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.short-title{
  font-size:11px !important;
  line-height:1.22 !important;
  margin-bottom:3px !important;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
}
.product-tile-side{
  min-width:62px !important;
}
.product-tile-price{
  font-size:13px !important;
  margin-bottom:2px !important;
}
.product-stock{
  font-size:11px !important;
  margin-bottom:5px !important;
}
.product-actions{
  gap:6px !important;
}
.product-actions .button{
  min-height:24px !important;
  padding:0 8px !important;
  font-size:10px !important;
  border-radius:2px !important;
}
.product-actions .view-link{
  font-size:11px !important;
}
.woocommerce-pagination,
.nav-links{
  margin-top:12px !important;
}
.page-numbers,
.page-numbers a,
.page-numbers span,
.nav-links a,
.nav-links span{
  min-width:26px !important;
  min-height:26px !important;
  font-size:11px !important;
  border-radius:2px !important;
}
@media (min-width:1400px){
  .archive-shell ul.products,
  .woocommerce-page ul.products,
  .woocommerce ul.products{
    grid-template-columns:repeat(auto-fit,minmax(190px,1fr)) !important;
  }
}
@media (max-width:900px){
  .archive-shell ul.products,
  .woocommerce-page ul.products,
  .woocommerce ul.products{
    grid-template-columns:repeat(auto-fit,minmax(180px,1fr)) !important;
  }
  .product-tile{
    grid-template-columns:52px 1fr !important;
  }
  .product-tile-side{
    grid-column:2;
    min-width:0 !important;
    text-align:left !important;
  }
  .product-actions{
    justify-content:flex-start !important;
  }
}


/* v1.7 Marcone-style clean tiles (no buttons) */
.product-actions,
.related.products .button,
.related.products .tpd-related-actions {
  display: none !important;
}

/* Make entire card clickable */
.tpd-related-full-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.tpd-related-full-link:hover {
  text-decoration: none;
}

/* Slight hover effect for confidence */
.tpd-related-card:hover {
  border-color: #e60000;
  box-shadow: 0 0 0 1px rgba(230,0,0,0.15);
}
