/* ==========================================================================
   tripoint-shop.css — WooCommerce: Teaching Resources archive, product page,
   cart and checkout.

   Loaded by gotb_uses_shop_sections() in functions.php on
   is_woocommerce() || is_cart() || is_checkout() || is_account_page(),
   after tripoint-base.css (which defines --tp-teal / --tp-dark-teal and the
   Kadence palette tokens). Everything here is scoped, so loading it
   site-wide would also be safe.

   Cart and checkout need the body class tp-wcpage on those two pages
   (Kadence page settings): the block cart/checkout is Woo's own markup with
   nothing of ours to key off.
   ========================================================================== */

/* ---------- Shared: pill buttons in the tp-btn style ---------- */
/* Scoped to Woo's own buttons: Kadence blocks (header "Get in touch" etc.) also carry .button */
.woocommerce .site-main .button:not(.kb-button),
.woocommerce .site-main button.button:not(.kb-button),
.woocommerce .single_add_to_cart_button,
.wc-block-components-button:not(.is-link),
.wc-block-cart__submit-button,
.wc-block-components-checkout-place-order-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 24px;
  border: 0;
  border-radius: 999px !important;
  background: var(--tp-teal);
  color: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: none;
  transition: background-color .2s, color .2s;
}
.woocommerce .site-main .button:not(.kb-button):hover,
.woocommerce .single_add_to_cart_button:hover,
.wc-block-components-button:not(.is-link):hover,
.wc-block-cart__submit-button:hover,
.wc-block-components-checkout-place-order-button:hover {
  background: var(--tp-dark-teal);
  color: #fff;
}
/* The outlined ring around "Proceed to checkout" */
.wc-block-cart__submit,
.wc-block-cart__submit-container,
.wc-block-cart__submit-container:focus-within {
  background: none !important;
  border-radius: 0 !important;
  border: 0 !important;
  box-shadow: none !important;
  outline: 0 !important;
  padding: 0 !important;
}
.wc-block-cart__submit-button { width: 100%; }

/* ---------- Archive (Teaching Resources) ---------- */
/* Keep the toolbar and grid at content width under the full-width hero */
body.post-type-archive-product .site-main > .woocommerce-notices-wrapper,
body.post-type-archive-product .site-main > .kadence-shop-top-row,
body.post-type-archive-product .site-main > ul.products,
body.post-type-archive-product .site-main > .woocommerce-pagination,
body.tax-product_cat .site-main > .kadence-shop-top-row,
body.tax-product_cat .site-main > ul.products {
  max-width: calc(var(--global-content-width) + 2 * var(--global-content-edge-padding));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--global-content-edge-padding);
  padding-right: var(--global-content-edge-padding);
  box-sizing: border-box;
}
body.post-type-archive-product .site-main > ul.products { margin-bottom: 120px; }

/* Toolbar: result count left, sort right, divider like the Knowledge Library */
.woocommerce .kadence-shop-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 72px;
  margin-bottom: 32px;
}
.woocommerce .woocommerce-result-count {
  margin: 0;
  font-size: 14px;
  color: var(--global-palette4);
}
/* Sort dropdown: white pill field, same as the Knowledge Library filters */
.woocommerce .woocommerce-ordering { margin: 0; }
.woocommerce .woocommerce-ordering select.orderby {
  appearance: none;
  -webkit-appearance: none;
  min-width: 220px;
  height: 46px;
  padding: 0 48px 0 22px;
  border: 1px solid var(--global-palette7);
  border-radius: 999px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23185766' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 16px;
  box-shadow: none;
  color: var(--global-palette2);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.woocommerce .woocommerce-ordering select.orderby:focus {
  outline: 2px solid var(--tp-teal);
  outline-offset: 2px;
}

/* Product cards: palette8, radius 20, like the Knowledge Library cards */
.woocommerce ul.products li.product {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  background: var(--global-palette8);
  box-shadow: none;
}
.woocommerce ul.products li.product .woocommerce-loop-image-link {
  display: block;
  padding: 24px 24px 0;
}
.woocommerce ul.products li.product .woocommerce-loop-image-link { position: relative; }
/* Hover preview (Kadence image hover switch): keep it inside the same 24px padding */
.woocommerce ul.products li.product .woocommerce-loop-image-link img.secondary-product-image {
  top: 24px !important;
  left: 24px !important;
  right: auto !important;
  bottom: auto !important;
  width: calc(100% - 48px) !important;
  height: calc(100% - 24px) !important;
  min-width: 0 !important;
  min-height: 0 !important;
  max-width: none !important;
  border-radius: 12px;
  object-fit: cover;
  object-position: top;
  transform: none !important;
}
.woocommerce ul.products li.product .woocommerce-loop-image-link img {
  transform: none !important; /* no Kadence hover zoom: it pushed the cover past the padding */
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(24, 87, 102, .08), 0 8px 24px rgba(24, 87, 102, .08);
}
.woocommerce ul.products li.product .product-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 !important;
  padding: 24px 28px 28px !important;
  background: transparent !important;
}
/* Title on top; price left and Add to cart right on one row, pinned to the foot of the card */
.woocommerce ul.products li.product .product-details {
  display: grid !important;
  grid-template-columns: 1fr auto;
  grid-template-rows: 1fr auto;
  column-gap: 16px;
  row-gap: 16px;
}
.woocommerce ul.products li.product .product-details > * { grid-column: 1 / -1; }
.woocommerce ul.products li.product .product-details > .price {
  grid-column: 1;
  grid-row: 2;
  align-self: center;
}
.woocommerce ul.products li.product .product-details > .product-action-wrap {
  grid-column: 2;
  grid-row: 2;
  align-self: center;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  margin: 0;
  padding: 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--global-palette2);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title a { color: inherit; text-decoration: none; }
.woocommerce ul.products li.product .woocommerce-loop-product__title a:hover { color: var(--tp-teal); }
.woocommerce ul.products li.product .price {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  color: var(--global-palette1);
}
/* Add to cart (Customizer: Always visible, Button) */
.woocommerce ul.products li.product .product-action-wrap {
  margin: 0 !important;
  padding: 0 !important;
}
.woocommerce ul.products li.product .product-action-wrap .button {
  min-height: 42px;
  padding: 10px 20px;
}
.woocommerce ul.products li.product .product-action-wrap .button .kadence-svg-iconset { display: none; }
.woocommerce ul.products li.product .added_to_cart {
  margin-left: 12px;
  font-size: 14px;
  color: var(--tp-teal);
}

@media (max-width: 767px) {
  body.post-type-archive-product .site-main > ul.products { margin-bottom: 72px; }
  .woocommerce .kadence-shop-top-row { margin-top: 48px; flex-wrap: wrap; }
  .woocommerce .woocommerce-ordering select.orderby { min-width: 0; width: 100%; }
  .woocommerce .kadence-woo-ordering { flex: 1 1 100%; }
}

/* ---------- Single product ---------- */
.single-product .site-main .product .content-bg,
.single-product div.product {
  border-radius: 24px;
}
.single-product div.product .product_title {
  margin-bottom: 12px;
  font-size: 40px;
  font-weight: 500;
  line-height: 1.1;
  color: var(--global-palette2);
}
.single-product div.product .summary .price {
  margin-bottom: 24px;
  font-size: 24px;
  font-weight: 500;
  color: var(--global-palette1);
}
.single-product div.product .woocommerce-product-details__short-description {
  font-size: 16px;
  line-height: 1.5;
  color: var(--global-palette4);
}
.single-product div.product .woocommerce-product-details__short-description h3 {
  margin: 28px 0 12px;
  font-size: 22px;
  font-weight: 500;
  color: var(--global-palette2);
}
.single-product div.product .woocommerce-product-details__short-description ul {
  margin: 0 0 20px;
  padding: 0;
  list-style: none;
}
.single-product div.product .woocommerce-product-details__short-description li {
  position: relative;
  margin: 0 0 8px;
  padding-left: 22px;
}
.single-product div.product .woocommerce-product-details__short-description li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .6em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--global-palette6);
}
.single-product div.product form.cart { margin: 28px 0 20px; }
.single-product div.product .product_meta { font-size: 14px; color: var(--global-palette4); }
.single-product div.product .product_meta a { color: var(--tp-teal); }

/* Gallery: main image rounded, thumbnails in a neat row under it */
.single-product .woocommerce-product-gallery__wrapper img,
.single-product .woocommerce-product-gallery .flex-viewport { border-radius: 16px; }
.single-product .woocommerce-product-gallery .flex-control-thumbs {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0 0 !important;
  padding: 0;
}
.single-product .woocommerce-product-gallery .flex-control-thumbs li {
  width: auto !important;
  height: auto !important;
  margin: 0 !important;
  float: none !important;
}
.single-product .woocommerce-product-gallery .flex-control-thumbs img {
  width: 100% !important;
  height: auto !important;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  object-position: top;
  border-radius: 8px;
  border: 2px solid transparent;
  opacity: .7;
  transition: opacity .2s, border-color .2s;
}
.single-product .woocommerce-product-gallery .flex-control-thumbs img.flex-active,
.single-product .woocommerce-product-gallery .flex-control-thumbs img:hover {
  opacity: 1;
  border-color: var(--tp-teal);
}
@media (max-width: 767px) {
  .single-product div.product .product_title { font-size: 30px; }
}

/* ---------- Cart and checkout blocks (pages with .tp-wcpage) ---------- */
.tp-wcpage .wc-block-cart,
.tp-wcpage .wc-block-checkout {
  font-family: inherit;
  color: var(--global-palette4);
}
/* Column headings: small caps label style, not grey uppercase defaults */
.tp-wcpage .wc-block-cart-items__header,
.tp-wcpage .wc-block-cart__totals-title {
  font-size: 13px !important;
  font-weight: 600 !important;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--global-palette1) !important;
}
.tp-wcpage .wc-block-cart-items td,
.tp-wcpage .wc-block-cart-items th,
.tp-wcpage .wc-block-components-totals-wrapper,
.tp-wcpage .wc-block-cart-items__header,
.tp-wcpage .wc-block-cart .wc-block-cart-items {
  border-color: var(--global-palette7) !important;
}
.tp-wcpage .wc-block-components-product-name,
.tp-wcpage table.wc-block-cart-items .wc-block-components-product-name {
  font-size: 18px !important;
  font-weight: 500 !important;
  line-height: 1.3;
  color: var(--global-palette2) !important;
  text-decoration: none;
}
.tp-wcpage .wc-block-components-product-name:hover { color: var(--tp-teal); }
.tp-wcpage .wc-block-cart-item__image img { border-radius: 8px; }
.tp-wcpage .wc-block-components-product-metadata__description { font-size: 14px; }
.tp-wcpage .wc-block-cart-item__remove-link { color: var(--global-palette4) !important; }
.tp-wcpage .wc-block-cart-item__remove-link:hover { color: var(--tp-dark-teal) !important; }
.tp-wcpage .wc-block-components-totals-footer-item,
.tp-wcpage .wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
  font-size: 22px;
  font-weight: 500;
  color: var(--global-palette2);
}
.tp-wcpage .wc-block-components-panel__button,
.tp-wcpage .wc-block-components-totals-coupon-link { color: var(--global-palette2); font-size: 15px; }

/* Checkout fields: 12px radius like the contact form */
.tp-wcpage .wc-block-components-text-input input,
.tp-wcpage .wc-block-components-combobox .components-combobox-control__input,
.tp-wcpage .wc-blocks-components-select .wc-blocks-components-select__select,
.tp-wcpage .wc-block-components-textarea {
  border: 1px solid var(--global-palette7) !important;
  border-radius: 12px !important;
  background: #fff;
  color: var(--global-palette2);
}
.tp-wcpage .wc-block-components-text-input.is-active input:focus,
.tp-wcpage .wc-block-components-text-input input:focus {
  border-color: var(--tp-teal) !important;
  box-shadow: 0 0 0 1px var(--tp-teal) !important;
}
.tp-wcpage .wc-block-components-checkout-step__title,
.tp-wcpage .wc-block-components-title {
  font-size: 22px !important;
  font-weight: 500 !important;
  color: var(--global-palette2) !important;
}
.tp-wcpage .wc-block-components-order-summary-item__quantity { display: none; }
.tp-wcpage .wc-block-components-checkout-return-to-cart-button { color: var(--tp-teal); }

/* ---------- Teaching Resources category filter ----------
   Matches the Knowledge Library filters: label + white pill dropdown. */
body.post-type-archive-product .site-main > .tp-cat-filter {
  display: flex;
  align-items: center;
  gap: 16px;
  max-width: calc(var(--global-content-width) + 2 * var(--global-content-edge-padding));
  margin: 72px auto 0;
  padding: 0 var(--global-content-edge-padding);
  box-sizing: border-box;
}
.tp-cat-filter__label {
  font-size: 15px;
  font-weight: 500;
  color: var(--global-palette2);
}
.tp-cat-filter__select {
  appearance: none;
  -webkit-appearance: none;
  min-width: 260px;
  height: 46px;
  padding: 0 48px 0 22px;
  border: 1px solid var(--global-palette7);
  border-radius: 999px;
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23185766' stroke-width='2' stroke-linecap='round' stroke-linejoin='round' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 20px center;
  background-size: 16px;
  color: var(--global-palette2);
  font-family: inherit;
  font-size: 15px;
  cursor: pointer;
}
.tp-cat-filter__select:focus {
  outline: 2px solid var(--tp-teal);
  outline-offset: 2px;
}
/* When the filter shows, the count/sort row sits under it with a divider, like the KL result count */
body.post-type-archive-product .site-main > .tp-cat-filter + .woocommerce-notices-wrapper + .kadence-shop-top-row,
body.post-type-archive-product .site-main > .tp-cat-filter + .kadence-shop-top-row {
  position: relative;
  margin-top: 32px;
  padding-top: 24px;
}
/* Divider at content width (the row's side padding would stretch a border-top) */
body.post-type-archive-product .site-main > .tp-cat-filter + .woocommerce-notices-wrapper + .kadence-shop-top-row::before,
body.post-type-archive-product .site-main > .tp-cat-filter + .kadence-shop-top-row::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--global-content-edge-padding);
  right: var(--global-content-edge-padding);
  border-top: 1px solid var(--global-palette7);
}
@media (max-width: 767px) {
  body.post-type-archive-product .site-main > .tp-cat-filter {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 48px;
  }
  .tp-cat-filter__select {
    min-width: 0;
    width: 100%;
  }
}
