/* WooCommerce. Loaded only on Woo views. */

.shop__toolbar {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding-block: var(--s-4);
  border-block: 1px solid var(--line);
  margin-bottom: var(--s-6);
}
.shop__filter-toggle {
  border: 1px solid var(--line-firm);
  border-radius: var(--radius-sm);
  padding: 0.5em 1em;
  font-size: var(--step--1);
}
.woocommerce-result-count { font-size: var(--step--1); color: var(--ink-faint); margin: 0; }
.woocommerce-ordering { margin-left: auto; }
.woocommerce-ordering select {
  border: 1px solid var(--line-firm);
  border-radius: var(--radius-sm);
  padding: 0.5em 2em 0.5em 0.75em;
  font-size: var(--step--1);
  background: var(--ground);
}

.archive__head { max-width: var(--measure); margin-bottom: var(--s-6); }
.archive__title { font-size: var(--step-3); }
.archive__intro { margin-top: var(--s-4); color: var(--ink-soft); }
.archive__intro > * + * { margin-top: var(--s-4); }
.archive__intro h3 {
  font-size: var(--step-1);
  margin-top: var(--s-5);
  letter-spacing: var(--track-tight);
}

/* With imagery the header runs two columns, filling the space to the right of
   the description rather than leaving it empty. */
.archive__head--media {
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--s-7);
  align-items: start;
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--line);
}
.archive__head--media .archive__intro-col { max-width: var(--measure); }
.archive__media {
  position: sticky;
  top: calc(var(--header-h) + var(--s-4));
}
.archive__media img,
.archive__media .img-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .archive__head--media { grid-template-columns: 1fr; gap: var(--s-5); }
  .archive__media { position: static; order: -1; }
  .archive__media img, .archive__media .img-placeholder { aspect-ratio: 16 / 7; }
}

/* The grid.
   WooCommerce's own layout stylesheet floats products and sets a percentage
   width per column. That is dequeued in inc/performance/cleanup.php, and the
   resets below catch any that a plugin re-adds. Without both, cards end up
   floated at roughly a fifth of the row and look far too narrow. */
ul.products {
  display: grid;
  grid-template-columns: repeat(var(--shop-cols, 4), minmax(0, 1fr));
  gap: var(--s-5);
  list-style: none;
  margin: 0;
  padding: 0;
  clear: both;
}
/* WooCommerce clearfixes its product list with ::before and ::after. In a
   float layout those are invisible. In a CSS grid they become grid items, so
   ::before takes the first cell and pushes every product along by one.
   That is the blank first square.

   The reset has to out-specify `.woocommerce ul.products::after`, which is
   (0,2,1), so a bare `ul.products::after` at (0,0,1) never wins. `content: none`
   removes the box outright rather than relying on display. */
ul.products::before,
ul.products::after,
.woocommerce ul.products::before,
.woocommerce ul.products::after,
.woocommerce-page ul.products::before,
.woocommerce-page ul.products::after,
.woocommerce .related ul.products::before,
.woocommerce .related ul.products::after,
.woocommerce .up-sells ul.products::before,
.woocommerce .up-sells ul.products::after {
  content: none;
  display: none;
}

ul.products li.product,
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product {
  float: none;
  width: auto;
  min-width: 0;
  margin: 0;
  clear: none;
  display: flex;
  flex-direction: column;
}

li.product {
  background: var(--ground);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.18s var(--ease), transform 0.18s var(--ease), box-shadow 0.18s var(--ease);
}
li.product:focus-within { border-color: var(--accent); }

/* Media panel keeps a square regardless of the source image ratio, which is
   what stops a row of cards going ragged when one supplier photo is portrait. */
li.product .card__media {
  display: block;
  aspect-ratio: 1;
  background: var(--mist);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  padding: var(--s-4);
}
li.product .card__media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s var(--ease);
}
li.product:hover .card__media img { transform: scale(1.03); }

li.product .card__body {
  display: flex;
  flex-direction: column;
  gap: var(--s-2);
  padding: var(--s-4);
  flex: 1;
}
li.product:hover { border-color: var(--line-firm); transform: translateY(-2px); box-shadow: var(--shadow-1); }
li.product .card__title { font-size: var(--step-0); line-height: 1.35; }
li.product .price {
  font-size: var(--step-0);
  color: var(--ink);
  margin-top: auto;
}
li.product .price del { color: var(--ink-faint); margin-right: 0.4em; }
li.product .card__badges { display: flex; flex-wrap: wrap; gap: var(--s-1); }
li.product .add_to_cart_button,
li.product .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: var(--s-3);
  padding: 0.7em 1em;
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  font-size: var(--step--1);
  font-weight: 600;
}
li.product .button:hover { background: var(--accent); }
li.product .added_to_cart { display: none; }

/* Single product */
.product__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: var(--s-7);
  align-items: start;
  padding-block: var(--s-5) var(--s-7);
}

.product_title { font-size: var(--step-3); margin-bottom: var(--s-3); }
.summary .price { font-size: var(--step-2); font-weight: 600; letter-spacing: var(--track-tight); display: block; margin-block: var(--s-4); font-variant-numeric: tabular-nums; }
.summary .woocommerce-product-details__short-description { color: var(--ink-soft); }
.summary form.cart { margin-block: var(--s-5); display: flex; gap: var(--s-3); align-items: stretch; flex-wrap: wrap; }
.summary .quantity input {
  width: 84px; height: 100%;
  min-height: 48px;
  border: 1px solid var(--line-firm);
  border-radius: var(--radius-sm);
  text-align: center;
}
.summary .single_add_to_cart_button {
  flex: 1;
  min-height: 48px;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  border: 0;
  padding-inline: var(--s-5);
}
.summary .single_add_to_cart_button:hover { background: var(--accent-deep); }
.summary .stock { font-size: var(--step--1); font-weight: 500; }
.summary .stock.in-stock { color: var(--ok); }
.summary .stock.out-of-stock { color: var(--stop); }

.product__section { padding-block: var(--s-6); border-top: 1px solid var(--line); }
.product__section-title { font-size: var(--step-2); margin-bottom: var(--s-4); }

.doc-list { display: grid; gap: var(--s-3); }
.doc-list__item { display: flex; align-items: center; gap: var(--s-3); }
.doc-list__label { font-size: var(--step--1); color: var(--ink-faint); }

.related.products { border-top: 1px solid var(--line); padding-top: var(--s-6); }
.related.products > h2 { font-size: var(--step-2); margin-bottom: var(--s-5); }

/* Cart, checkout, account */
.woocommerce-cart-form table, .shop_table {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.shop_table th {
  text-align: left;
  font-size: var(--step--2);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: var(--track-label);
  color: var(--ink-faint);
  padding: var(--s-3) var(--s-4);
  background: var(--mist);
  border-bottom: 1px solid var(--line);
}
.shop_table td { padding: var(--s-4); border-bottom: 1px solid var(--line); }
.shop_table .amount { font-variant-numeric: tabular-nums; font-weight: 500; }

/* Cart and checkout messages. Same treatment as the research notice: a tinted
   panel with no border, so the two do not sit next to each other with
   different chrome. Error state is carried by the text colour rather than by
   a rule down the side. */
.woocommerce-message, .woocommerce-info, .woocommerce-error {
  border: 0;
  background: var(--mist);
  color: var(--ink);
  padding: var(--s-4);
  border-radius: var(--radius);
  margin-bottom: var(--s-5);
  list-style: none;
  font-size: var(--step--1);
}
.woocommerce-error { background: color-mix(in srgb, var(--stop) 7%, var(--ground)); color: var(--stop); }
.woocommerce-error a { color: var(--stop); }
.woocommerce-message .button, .woocommerce-info .button {
  float: right;
  margin-left: var(--s-4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 0.4em 0.9em;
  font-size: var(--step--1);
  text-decoration: none;
}

.nad-ack { margin-block: var(--s-4); font-size: var(--step--1); }
.nad-ack label { display: flex; gap: var(--s-3); align-items: flex-start; }

form .form-row input[type="text"],
form .form-row input[type="email"],
form .form-row input[type="tel"],
form .form-row input[type="password"],
form .form-row textarea,
form .form-row select {
  width: 100%;
  border: 1px solid var(--line-firm);
  border-radius: var(--radius-sm);
  padding: 0.7em 0.85em;
  background: var(--ground);
}
form .form-row label { display: block; font-size: var(--step--1); margin-bottom: var(--s-2); color: var(--ink-soft); }

/* Quantity stepper on the add to cart form. */
.qty-stepper--form { border: 1px solid var(--line-firm); border-radius: var(--radius-sm); min-height: 48px; }
.qty-stepper--form .qty-stepper__btn { width: 44px; height: 46px; font-size: var(--step-1); }
.summary .quantity { display: flex; }
.summary .qty-stepper--form input.qty {
  width: 56px;
  border: 0;
  border-inline: 1px solid var(--line-firm);
  border-radius: 0;
  min-height: 46px;
  text-align: center;
  -moz-appearance: textfield;
}
.summary .qty-stepper--form input.qty::-webkit-outer-spin-button,
.summary .qty-stepper--form input.qty::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Key specifications under the product title. The three values that decide
   whether the compound is a candidate at all. */
.key-specs {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-5);
  padding-block: var(--s-4);
  margin-bottom: var(--s-4);
  border-block: 1px solid var(--line);
}
.key-specs__item { display: grid; gap: 2px; }
.key-specs dt { font-size: var(--step--2); font-weight: 600; letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-faint); }
.key-specs dd { margin: 0; font-size: var(--step-0); color: var(--ink); }

/* Purchase box */
.purchase-box {
  border: 1px solid var(--line-firm);
  border-radius: var(--radius);
  padding: var(--s-5);
  background: var(--ground);
}
.purchase-box .price { margin-top: 0; }
.purchase-box .notice { margin-block: var(--s-4); }
.purchase-box__points {
  display: grid;
  gap: var(--s-3);
  margin-top: var(--s-5);
  padding-top: var(--s-4);
  border-top: 1px solid var(--line);
}
.purchase-box__points li { display: grid; grid-template-columns: 110px 1fr; gap: var(--s-3); font-size: var(--step--1); }
.purchase-box__point-label { color: var(--ink-faint); }

/* Jump links across the top of the detail sections */
.jump-links { border-bottom: 1px solid var(--line); margin-bottom: var(--s-2); }
.jump-links ul { display: flex; flex-wrap: wrap; gap: var(--s-5); list-style: none; padding: 0; }
.jump-links a {
  display: inline-block;
  padding: var(--s-3) 0;
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--ink-soft);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.jump-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.product__section { scroll-margin-top: calc(var(--header-h) + var(--s-4)); }

@media (max-width: 620px) {
  .purchase-box { padding: var(--s-4); }
  .purchase-box__points li { grid-template-columns: 1fr; gap: 2px; }
  .jump-links ul { gap: var(--s-4); overflow-x: auto; flex-wrap: nowrap; }
  .jump-links a { white-space: nowrap; }
}

/* Category strip above the grid */
.cat-strip { margin-bottom: var(--s-5); }
.cat-strip__list { display: flex; flex-wrap: wrap; gap: var(--s-2); list-style: none; padding: 0; }
.cat-strip__link {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  padding: 0.45em 0.9em;
  border: 1px solid var(--line-firm);
  border-radius: 999px;
  font-size: var(--step--1);
  text-decoration: none;
  color: var(--ink);
  background: var(--ground);
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}
.cat-strip__link:hover { border-color: var(--accent); background: var(--accent-wash); color: var(--accent); }
.cat-strip__count { color: var(--ink-faint); font-size: 0.78em; }

/* Empty state */
.empty-state {
  border: 1px dashed var(--line-firm);
  border-radius: var(--radius);
  padding: var(--s-8) var(--s-5);
  text-align: center;
  background: var(--mist);
}
.empty-state__title { font-size: var(--step-2); margin-bottom: var(--s-3); }
.empty-state .hero__actions { justify-content: center; }

/* Synonyms line under the compound profile. */
.synonyms {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2) var(--s-3);
  align-items: baseline;
  font-size: var(--step--1);
  color: var(--ink-soft);
  margin-bottom: var(--s-4);
}

/* Same defence for the other Woo containers the theme turns into grid or flex.
   Any of these picking up a clearfix pseudo element produces a phantom cell. */
.woocommerce .col2-set::before,
.woocommerce .col2-set::after,
.woocommerce-page .col2-set::before,
.woocommerce-page .col2-set::after,
.woocommerce div.product::before,
.woocommerce div.product::after,
.woocommerce .woocommerce-ordering::before,
.woocommerce .woocommerce-ordering::after,
.woocommerce .flex-control-thumbs::before,
.woocommerce .flex-control-thumbs::after,
.woocommerce form.cart::before,
.woocommerce form.cart::after,
.woocommerce .related::before,
.woocommerce .related::after,
.woocommerce .up-sells::before,
.woocommerce .up-sells::after {
  content: none;
  display: none;
}

/* Related products and recently viewed run through the same grid, so they
   inherit the column count rather than Woo's own float widths. */
.related ul.products,
.up-sells ul.products,
.product-grid ul.products {
  grid-template-columns: repeat(var(--shop-cols, 4), minmax(0, 1fr));
}

/* Catalogue two column layout. Heading and description stay full width above,
   only the grid and the aside are columned. */
.shop__layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: var(--s-7);
  align-items: start;
}
.shop__main { min-width: 0; }
.shop__layout .shop-aside { position: sticky; top: calc(var(--header-h) + var(--s-5)); }

/* With the aside taking 300px, four columns of products becomes cramped, so
   the catalogue drops to three unless the site is set wider. */
.shop__layout ul.products { grid-template-columns: repeat(var(--shop-cols-aside, 3), minmax(0, 1fr)); }

@media (max-width: 1180px) {
  .shop__layout { grid-template-columns: minmax(0, 1fr) 270px; gap: var(--s-6); }
  .shop__layout ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .shop__layout { grid-template-columns: 1fr; gap: var(--s-7); }
  .shop__layout .shop-aside { position: static; }
  .shop__layout ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* On a phone the aside is reference material, not navigation, so it sits
     under the products rather than pushing them below the fold. */
  .shop-aside { order: 2; }
}
@media (max-width: 560px) {
  .shop__layout ul.products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
}

/* Evidence note in the summary column. Deliberately plain and deliberately
   above the fold: a long research section needs its counterweight somewhere
   people will actually read it. */
.evidence-note {
  font-size: var(--step--1);
  color: var(--ink-soft);
  line-height: 1.55;
  padding: var(--s-4);
  background: var(--mist);
  border-radius: var(--radius);
  margin-top: var(--s-4);
}

/* Archive header. Two columns so the description is not floating in a column
   of empty space, with the image sticky against the long category text. */
.archive__head {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: var(--s-7);
  align-items: start;
  margin-bottom: var(--s-7);
  padding-bottom: var(--s-6);
  border-bottom: 1px solid var(--line);
}
.archive__content { max-width: var(--measure); }
.archive__title { font-size: var(--step-3); }
.archive__count {
  font-size: var(--step--2);
  font-weight: 600;
  letter-spacing: var(--track-label);
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: var(--s-3);
}
.archive__intro { margin-top: var(--s-4); color: var(--ink-soft); }
.archive__intro > * + * { margin-top: var(--s-4); }
.archive__intro h3 {
  font-size: var(--step-0);
  color: var(--ink);
  margin-top: var(--s-5);
  letter-spacing: var(--track-tight);
}

.archive__media { position: sticky; top: calc(var(--header-h) + var(--s-5)); }
.archive__media img,
.archive__media .img-placeholder {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

@media (max-width: 980px) {
  .archive__head { grid-template-columns: 1fr; gap: var(--s-5); }
  .archive__media { position: static; order: -1; }
  .archive__media img, .archive__media .img-placeholder { aspect-ratio: 16 / 7; }
}

/* ==========================================================================
   Product gallery

   One image. Deliberately.

   WooCommerce ships a flexslider carousel whose layout rules live in
   woocommerce-layout.css, and the theme dequeues that stylesheet because it
   also floats the product grid. Rather than reimplement a carousel to replace
   one that was fighting the layout, the gallery shows the featured image and
   hides the rest. Additional images are still reachable through the lightbox.

   A research catalogue is not a fashion store. Six angles of a white vial adds
   nothing, and one clean image that always renders correctly is worth more
   than a gallery that sometimes does not.
   ========================================================================== */

.woocommerce-product-gallery {
  position: relative;
  margin: 0;
  padding: 0;
  max-width: 100%;
}

.woocommerce-product-gallery__wrapper {
  display: block;
  margin: 0;
  padding: 0;
  list-style: none;
  width: 100%;
  transform: none !important;
}

/* Featured image only. */
.woocommerce-product-gallery__image {
  display: none;
  margin: 0;
  padding: 0;
  width: 100% !important;
  float: none !important;
}
.woocommerce-product-gallery__image:first-child { display: block; }

/* Contain rather than cover.

   Product photography here is square or portrait, and forcing a 4:3 landscape
   crop cut the top and bottom off the vial. Contain shows the whole product
   whatever ratio it was shot at, and the padded mist panel behind it means a
   portrait image looks framed rather than stranded. */
.woocommerce-product-gallery__image img,
.woocommerce-product-gallery__image a img {
  display: block;
  width: 100% !important;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.woocommerce-product-gallery__image:first-child {
  display: block;
  aspect-ratio: 1;
  padding: var(--s-5);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--mist);
  overflow: hidden;
}

/* Woo's own thumbnail strip, from either implementation. */
.flex-control-thumbs,
.woocommerce-product-gallery .flex-control-nav,
.woocommerce-product-gallery .flex-direction-nav { display: none !important; }

/* Lightbox trigger. */
.woocommerce-product-gallery__trigger {
  position: absolute;
  top: var(--s-4);
  right: var(--s-4);
  z-index: 2;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--ground);
  border: 1px solid var(--line-firm);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: var(--ink);
  font-size: 0;
  box-shadow: var(--shadow-1);
}
.woocommerce-product-gallery__trigger:hover { border-color: var(--accent); color: var(--accent); }
.woocommerce-product-gallery__trigger::before {
  content: "";
  width: 13px; height: 13px;
  border: 1.6px solid currentColor;
  border-radius: 50%;
}
.woocommerce-product-gallery__trigger::after {
  content: "";
  position: absolute;
  right: 11px; bottom: 11px;
  width: 6px; height: 1.6px;
  background: currentColor;
  transform: rotate(45deg);
}

@media (max-width: 560px) {
  .woocommerce-product-gallery__image:first-child { padding: var(--s-4); }
}

/* Displayed rating on the card and product page. */
.card__rating { display: flex; align-items: center; gap: var(--s-2); }
.card__reviews { font-size: var(--step--2); color: var(--ink-faint); font-variant-numeric: tabular-nums; }

.product__rating { display: flex; align-items: center; gap: var(--s-3); flex-wrap: wrap; margin-bottom: var(--s-3); }
.product__rating-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.product__rating-count { font-size: var(--step--1); color: var(--ink-faint); }
