/*
 Theme Name:   Divi Child — Performance Marine
 Theme URI:    https://www.performancemarine.example/
 Description:  Divi child theme for Performance Marine. Holds the custom
               WooCommerce inventory loop template and supporting CSS so
               theme updates never overwrite customizations.
 Author:       Performance Marine
 Template:     Divi
 Version:      1.0.0
 Text Domain:  divi-child-pm
*/

/* ============================================================
   Performance Marine — WooCommerce Inventory Rows
   This styles the custom card output by woocommerce/content-product.php.
   Because the template prints exactly one of each element, there are no
   duplicates to guard against — but the guard rules are kept as a safety
   net in case any legacy snippet is still active anywhere.
   ============================================================ */

.woocommerce ul.products,
.woocommerce-page ul.products {
  display: block !important;
  margin: 0 0 32px 0 !important;
  padding: 0 !important;
  list-style: none !important;
}
.woocommerce ul.products::before,
.woocommerce ul.products::after { display: none !important; content: none !important; }

/* Card row */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  position: relative !important;
  float: none !important;
  clear: none !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 0 0 16px 0 !important;
  padding: 16px !important;
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;
  gap: 22px !important;
  background: #f5f6f7 !important;
  border: 1px solid #e3e6e8 !important;
  border-radius: 4px !important;
  box-sizing: border-box !important;
}

/* ---- Alternate sides (zigzag) ----
   Even cards mirror: image moves to the right, specs+buttons to the left,
   title/price/description stay in the middle. Odd cards keep image-left. */
.woocommerce ul.products li.product:nth-child(even),
.woocommerce-page ul.products li.product:nth-child(even) {
  flex-direction: row-reverse !important;
}

/* Hero image (left) — fluid: shrinks with the container, capped at 300px */
.woocommerce ul.products li.product a.pm-hero {
  flex: 1 1 280px !important;
  width: auto !important;
  max-width: 300px !important;
  min-width: 0 !important;
  position: relative;
  display: block !important;
  align-self: stretch;
  margin: 0 !important;
  padding: 0 !important;
  text-decoration: none;
}
.woocommerce ul.products li.product a.pm-hero img {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  height: 100% !important;
  min-height: 200px !important;
  max-height: 230px !important;
  object-fit: cover !important;
  margin: 0 !important;
  padding: 0 !important;
  border-radius: 3px !important;
}

/* Thumbs column */
/* Thumbnails sit BELOW the description, as a horizontal row inside the body.
   Extra-hardened so Divi's full-width image rules can't make them stack. */
.woocommerce ul.products li.product .pm-inventory-body .pm-inventory-thumbs {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  gap: 8px !important;
  width: 100% !important;
  margin: 12px 0 0 0 !important; padding: 0 !important;
  float: none !important;
}
.woocommerce ul.products li.product .pm-inventory-body .pm-inventory-thumb {
  flex: 0 0 92px !important;
  width: 92px !important; max-width: 92px !important; min-width: 92px !important;
  height: 70px !important; overflow: hidden !important;
  border-radius: 3px !important; border: 1px solid #d7d7d7 !important; background: #fff !important;
  margin: 0 !important; padding: 0 !important; float: none !important;
  display: block !important;
}
.woocommerce ul.products li.product .pm-inventory-body .pm-inventory-thumb img {
  display: block !important; width: 92px !important; height: 70px !important;
  max-width: 92px !important; min-width: 0 !important; object-fit: cover !important;
  margin: 0 !important; padding: 0 !important; border: none !important; border-radius: 0 !important;
}

/* Legacy selectors kept harmless (overridden by the body-scoped ones above) */
.woocommerce ul.products li.product .pm-inventory-thumbs {
  display: flex !important;
  flex-direction: row !important;
  gap: 8px !important;
  margin: 12px 0 0 0 !important; padding: 0 !important;
}
.woocommerce ul.products li.product .pm-inventory-thumb {
  width: 92px !important; height: 70px !important; overflow: hidden;
  border-radius: 3px; border: 1px solid #d7d7d7; background: #fff;
}
.woocommerce ul.products li.product .pm-inventory-thumb img {
  display: block !important; width: 92px !important; height: 70px !important;
  max-width: 92px !important; object-fit: cover !important;
  margin: 0 !important; border: none !important; border-radius: 0 !important;
}

/* Body column */
.woocommerce ul.products li.product .pm-inventory-body {
  flex: 1 1 auto !important;
  min-width: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 6px !important;
  margin: 0 !important; padding: 2px 0 0 0 !important;
}
.woocommerce ul.products li.product a.pm-title {
  text-decoration: none !important;
  margin: 0 !important; padding: 0 !important;
  display: block !important;
}
.woocommerce ul.products li.product .pm-inventory-body .woocommerce-loop-product__title {
  font-size: 24px !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
  color: #2e2e2e !important;
  margin: 0 !important;
  padding: 0 !important;
  letter-spacing: -0.01em;
}
.woocommerce ul.products li.product .pm-inventory-body .price {
  font-size: 21px !important;
  font-weight: 700 !important;
  color: #00739c !important;
  line-height: 1.2 !important;
  margin: 2px 0 0 0 !important;
  padding: 0 !important;
  display: block !important;
}
.woocommerce ul.products li.product .pm-inventory-body .price del { color: #9aa5ad !important; font-weight: 500 !important; margin-right: 8px; font-size: 17px; }
.woocommerce ul.products li.product .pm-inventory-body .price ins { text-decoration: none !important; }
.woocommerce ul.products li.product .pm-inventory-description {
  font-size: 14px !important;
  line-height: 1.5 !important;
  color: #555 !important;
  margin: 4px 0 0 0 !important;
  padding: 0 !important;
  max-width: 420px;
}

/* Actions column (right) — fluid, capped, can shrink */
.woocommerce ul.products li.product .pm-inventory-actions {
  flex: 0 1 220px !important;
  min-width: 160px !important;
  max-width: 240px !important;
  display: flex !important; flex-direction: column !important;
  margin: 0 !important; padding: 0 !important;
  align-self: stretch !important;        /* fill card height */
  justify-content: flex-end !important;  /* push buttons to the bottom */
  height: auto !important; min-height: 100% !important;
}
.woocommerce ul.products li.product .pm-quote-button {
  display: flex !important; align-items: center; justify-content: center;
  width: 100% !important; background: #00739c !important; color: #fff !important;
  padding: 18px 12px !important; border-radius: 4px !important;
  font-size: 19px !important; font-weight: 800 !important; line-height: 1 !important;
  text-transform: uppercase !important; letter-spacing: .03em !important;
  text-decoration: none !important; box-sizing: border-box !important;
  margin: auto 0 8px 0 !important; /* margin-top:auto pushes the whole button group to the bottom */
  transition: background .15s ease;
}
.woocommerce ul.products li.product .pm-quote-button:hover { background: #005f82 !important; color: #fff !important; }
.woocommerce ul.products li.product .pm-small-buttons { display: flex !important; gap: 8px !important; margin: 0 !important; }
.woocommerce ul.products li.product .pm-small-buttons a {
  flex: 1 !important; display: block !important; background: #fff !important; color: #003b5c !important;
  text-align: center; padding: 13px 8px !important; border: 1px solid #d3d6d9 !important;
  border-radius: 3px !important; font-size: 12px !important; font-weight: 800 !important; line-height: 1 !important;
  text-transform: uppercase !important; letter-spacing: .03em !important;
  text-decoration: none !important; box-sizing: border-box !important;
  transition: background .15s ease;
}
.woocommerce ul.products li.product .pm-small-buttons a:hover { background: #f0f0f0 !important; }

/* Stock badge over hero (bottom-left) */
.woocommerce ul.products li.product.instock a.pm-hero::after,
.woocommerce ul.products li.product.outofstock a.pm-hero::after {
  position: absolute; left: 0; bottom: 0;
  color: #fff; font-size: 11px; font-weight: 700; line-height: 1;
  letter-spacing: .05em; text-transform: uppercase; padding: 8px 14px; z-index: 5;
}
.woocommerce ul.products li.product.instock a.pm-hero::after { content: "In Stock"; background: #00739c; }
.woocommerce ul.products li.product.outofstock a.pm-hero::after { content: "Out of Stock"; background: #777; }

/* Hide WooCommerce defaults that Divi may still print */
.woocommerce span.onsale { display: none !important; }
.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product .add_to_cart_button,
.woocommerce ul.products li.product .product_type_simple { display: none !important; }
.woocommerce ul.products li.product .star-rating { display: none !important; }

/* ---- Hide the "Shop" page title and the "Home / Shop" breadcrumb ----
   Scoped to the shop / product archive pages so other pages keep their titles. */
.woocommerce-page.post-type-archive-product .woocommerce-products-header__title,
.woocommerce-page.post-type-archive-product .woocommerce-breadcrumb,
.archive.woocommerce .woocommerce-products-header__title,
.archive.woocommerce .woocommerce-breadcrumb,
/* Divi's own page title bar + breadcrumb module on the shop page */
.archive.woocommerce .et_pb_title_container .entry-title,
.archive.woocommerce #breadcrumbs,
.post-type-archive-product .et_pb_title_container .entry-title,
.post-type-archive-product #breadcrumbs {
  display: none !important;
}

/* ---- Hide the "Showing all N results" count and the "Default sorting" dropdown ---- */
.woocommerce .woocommerce-result-count,
.woocommerce-page .woocommerce-result-count,
.woocommerce .woocommerce-ordering,
.woocommerce-page .woocommerce-ordering {
  display: none !important;
}

/* Safety net: hide ANY description that is NOT inside our body wrapper.
   The template only prints one (inside .pm-inventory-body), so this just
   neutralizes a stray legacy duplicate if one is ever reintroduced. */
.woocommerce ul.products li.product .pm-inventory-description { }
.woocommerce ul.products li.product > .pm-inventory-description { display: none !important; }

/* ---- Responsive (media queries only — editor/linter safe) ----
   The products sit in a column beside the Filters sidebar, so the column is
   narrower than the window. Window-based breakpoints can't see the sidebar, so
   they're set EARLY to compensate for the ~260px the sidebar takes — this makes
   the cards reflow before the column gets too tight to crush.

   Stage 1 (window <=1200px): image left, buttons drop to a row beneath.
   Stage 2 (window <=860px): fully stack — image on top, then body, actions. */

/* Never let a card push wider than its container. */
.woocommerce ul.products li.product { overflow-wrap: anywhere; }

@media screen and (max-width: 1200px) {
  .woocommerce ul.products li.product { flex-wrap: wrap !important; gap: 18px !important; }
  .woocommerce ul.products li.product a.pm-hero { flex: 0 1 260px !important; max-width: 260px !important; }
  .woocommerce ul.products li.product .pm-inventory-body { flex: 1 1 240px !important; }
  .woocommerce ul.products li.product .pm-inventory-actions {
    flex: 1 1 100% !important; max-width: 100% !important; min-width: 0 !important;
    flex-direction: row !important; flex-wrap: wrap !important;
    justify-content: flex-start !important; align-items: center !important;
    gap: 8px !important; min-height: 0 !important;
  }
  .woocommerce ul.products li.product .pm-quote-button { width: auto !important; margin: 0 !important; flex: 0 0 auto !important; }
  .woocommerce ul.products li.product .pm-small-buttons { margin: 0 !important; }
}

@media screen and (max-width: 860px) {
  .woocommerce ul.products li.product,
  .woocommerce ul.products li.product:nth-child(even) {
    flex-direction: column !important; align-items: stretch !important;
    gap: 16px !important; padding: 16px !important;
  }
  .woocommerce ul.products li.product a.pm-hero { flex: 1 1 100% !important; width: 100% !important; max-width: 100% !important; }
  .woocommerce ul.products li.product a.pm-hero img { width: 100% !important; max-width: 100% !important; height: 220px !important; max-height: none !important; }
  .woocommerce ul.products li.product .pm-inventory-body { flex: 1 1 100% !important; }
  .woocommerce ul.products li.product .pm-inventory-description { max-width: 100% !important; }
  .woocommerce ul.products li.product .pm-inventory-thumbs { flex-direction: row !important; }
  .woocommerce ul.products li.product .pm-inventory-actions {
    flex: 1 1 100% !important; max-width: 100% !important;
    flex-direction: column !important; align-items: stretch !important;
  }
  .woocommerce ul.products li.product .pm-quote-button { width: 100% !important; }
  .woocommerce ul.products li.product .woocommerce-loop-product__title { font-size: 20px !important; }
}

/* ==================================================================
   SINGLE PRODUCT PAGE — right-column buttons
   Right column order (via functions.php): price, short description,
   then these buttons.
   ================================================================== */
.pm-single-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 20px 0 0 0;
  max-width: 360px;
}
.pm-single-actions .pm-quote-button {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  background: #00739c !important;
  color: #fff !important;
  padding: 18px 16px;
  border-radius: 4px;
  font-size: 19px; font-weight: 800; line-height: 1;
  text-transform: uppercase; letter-spacing: .03em;
  text-decoration: none !important; box-sizing: border-box;
  transition: background .15s ease;
}
.pm-single-actions .pm-quote-button:hover { background: #005f82 !important; color: #fff !important; }
.pm-single-actions .pm-contact-button-single {
  display: flex; align-items: center; justify-content: center;
  width: 100%;
  background: #fff !important;
  color: #003b5c !important;
  padding: 15px 16px;
  border: 1px solid #d3d6d9;
  border-radius: 4px;
  font-size: 14px; font-weight: 800; line-height: 1;
  text-transform: uppercase; letter-spacing: .03em;
  text-decoration: none !important; box-sizing: border-box;
  transition: background .15s ease;
}
.pm-single-actions .pm-contact-button-single:hover { background: #f0f0f0 !important; }

/* Make the single-page price prominent, sitting above the description */
.single-product div.product p.price,
.single-product div.product span.price {
  color: #00739c !important;
  font-size: 28px !important;
  font-weight: 800 !important;
  margin: 6px 0 14px 0 !important;
}

/* Hide leftover default elements on the single page (belt-and-suspenders
   alongside the remove_action calls in functions.php) */
.single-product .product_meta,
.single-product .woocommerce-tabs,
.single-product .related.products,
.single-product .up-sells.upsells.products,
.single-product form.cart,
.single-product .single_add_to_cart_button { display: none !important; }

/* ==================================================================
   SINGLE PRODUCT PAGE — long description + specifications strip
   ================================================================== */

/* Long description in the right column (replaces the short excerpt) */
.single-product .pm-single-longdesc {
  color: #444;
  font-size: 15px;
  line-height: 1.6;
  margin: 12px 0 4px 0;
}
.single-product .pm-single-longdesc p { margin: 0 0 12px 0; }

/* Specifications strip below the image/summary */
.pm-specs-section {
  clear: both;
  width: 100%;
  margin: 32px 0 0 0;
  padding: 0;
}
.pm-specs-heading {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 24px;
  font-weight: 400;
  color: #1c1c1c;
  margin: 0 0 14px 0;
  padding: 0 0 10px 0;
  border-bottom: 1px solid #d9dee0;
}
.pm-specs-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: 40px;
  row-gap: 0;
}
.pm-spec-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #ededed;
  font-size: 15px;
}
.pm-spec-row .pm-spec-key { color: #5a6b6e; }
.pm-spec-row .pm-spec-val { font-weight: 700; color: #1c1c1c; text-align: right; }

@media screen and (max-width: 900px) {
  .pm-specs-grid { grid-template-columns: repeat(2, 1fr); column-gap: 28px; }
}
@media screen and (max-width: 560px) {
  .pm-specs-grid { grid-template-columns: 1fr; }
}

/* ==================================================================
   SINGLE PRODUCT — collapsible PHOTOS / SPECIFICATIONS / PAYMENTS
   Pure-CSS accordion (checkbox toggle, no JS).
   ================================================================== */
.pm-accordion { width: 100%; margin: 28px 0 0 0; }
.pm-acc-item { border: 1px solid #e2e5e7; border-radius: 3px; margin: 0 0 10px 0; overflow: hidden; background: #f0f1f2; }
.pm-acc-toggle { position: absolute; left: -9999px; opacity: 0; }  /* hide checkbox */
.pm-acc-head {
  display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none;
  padding: 18px 22px;
  font-size: 18px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: #2e2e2e; margin: 0;
}
.pm-acc-chev {
  font-size: 26px; line-height: 1; color: #4d5963;
  transform: rotate(90deg); transition: transform .2s ease;
}
.pm-acc-toggle:checked + .pm-acc-head .pm-acc-chev { transform: rotate(-90deg); }

/* Body collapsed by default, expands when the checkbox is checked */
.pm-acc-body {
  max-height: 0; overflow: hidden;
  background: #fff;
  transition: max-height .3s ease, padding .3s ease;
  padding: 0 22px;
}
.pm-acc-toggle:checked ~ .pm-acc-body {
  max-height: 2000px;
  padding: 20px 22px;
}

/* Photos grid */
.pm-acc-photos-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pm-acc-photo { display: block; }
.pm-acc-photo img { width: 100%; height: 130px; object-fit: cover; border-radius: 3px; display: block; }

/* Specifications grid inside the panel */
.pm-acc-specs-grid { display: grid; grid-template-columns: repeat(2, 1fr); column-gap: 40px; }
.pm-acc-specs-grid .pm-spec-row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0; border-bottom: 1px solid #ededed; font-size: 15px;
}
.pm-acc-specs-grid .pm-spec-key { color: #5a6b6e; }
.pm-acc-specs-grid .pm-spec-val { font-weight: 700; color: #1c1c1c; text-align: right; }

.pm-acc-payments p { margin: 0; font-size: 15px; color: #444; line-height: 1.6; }

@media screen and (max-width: 780px) {
  .pm-acc-photos-grid { grid-template-columns: repeat(2, 1fr); }
  .pm-acc-specs-grid { grid-template-columns: 1fr; }
}

/* Item attributes listed in the right column, below the long description */
.single-product .pm-single-attrs {
  list-style: none !important;
  margin: 16px 0 4px 0 !important;
  padding: 0 !important;
  max-width: 420px;
}
.single-product .pm-single-attrs li {
  font-size: 15px !important;
  line-height: 1.4 !important;
  color: #5a6b6e !important;
  margin: 0 0 8px 0 !important;
  padding: 0 0 8px 0 !important;
  border-bottom: 1px solid #ededed !important;
  list-style: none !important;
}
.single-product .pm-single-attrs li:last-child { border-bottom: none !important; }
.single-product .pm-single-attrs .pm-attr-key { font-weight: 700 !important; color: #2e2e2e !important; }
.single-product .pm-single-attrs .pm-attr-val { color: #5a6b6e !important; }
