/*
 * WooCommerce's own markup, restyled to match the old site: the sorting select, product cards, pagination,
 * the product page's gallery and add to basket form, related products, and a tidy basket, checkout and
 * my account.
 *
 * Not in a layer, and loaded after WooCommerce's general stylesheet, so these rules win over it. Its
 * layout and small screen stylesheets aren't loaded (includes/woocommerce/woocommerce.php): the grids
 * here replace their floats. Most selectors start with .woocommerce to match WooCommerce's own.
 * The theme's own shop components (colour filter, calculator, extras, quantity buttons, page heads) are
 * in shop.css. The --shop-* custom properties are in tokens.css.
 */

/* The light panels (--shop-panel-light): body grey fails contrast on them, so text there is a shade darker, as on .section--light */
.woocommerce :is(div.product form.cart, .cart-collaterals .cart_totals, form.checkout > #order_review) {
  --color-text: var(--color-text-on-paper); --color-muted: var(--color-text-on-paper); --wc-subtext: var(--color-text-on-paper); color: var(--color-text);
}

/* ---------------------------------------------------------------- shared */

.woocommerce {
  /* WooCommerce's own colour variables, set to the theme's */
  --wc-form-color-background: var(--color-white);
  --wc-form-color-text: var(--color-ink);
  --wc-form-border-color: var(--color-field-border);
  --wc-form-border-radius: 0;
  --wc-form-border-width: 1px;
  --wc-primary: var(--color-accent);
  --wc-primary-text: var(--color-white);
  --wc-secondary: var(--color-paper);
  --wc-secondary-text: var(--color-ink);
  --wc-highlight: var(--color-ink);
  --wc-content-bg: var(--color-white);
  --wc-subtext: var(--color-muted);
  --wc-red: var(--color-error);
  --wc-green: var(--color-field-border); /* no green border on a field that passes */
}

/* Buttons: primary buttons, filled, with the same size, padding, type and focus ring as .btn--primary (components.css) */
.woocommerce :is(a, button, input).button {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2xs);
  min-height: var(--button-height); padding: var(--button-padding); border: 1px solid var(--color-accent); border-radius: 0;
  background: var(--color-accent); color: var(--color-white); font-family: inherit; font-size: var(--text-button); font-weight: var(--weight-normal); line-height: var(--leading-tight);
  letter-spacing: var(--tracking-label); text-decoration: none; text-transform: uppercase;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
  &:hover { border-color: var(--color-accent-hover); background: var(--color-accent-hover); color: var(--color-white); }
  /* WooCommerce's own box-shadow: none would drop the white halo inside the ring (base.css) */
  &:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); box-shadow: 0 0 0 var(--focus-offset) var(--color-focus-halo); }
}
.woocommerce :is(a, button, input).button.alt {
  background: var(--color-accent); color: var(--color-white);
  &:hover { background: var(--color-accent-hover); color: var(--color-white); }
}
/* Disabled ("Update cart" until a quantity changes, "Add to cart" until a variation is chosen): the same button,
   faded, and nothing changes on hover. :disabled[disabled] matches WooCommerce's selector, so this one wins. */
.woocommerce :is(a, button, input).button:is(.disabled, :disabled[disabled], :disabled),
.woocommerce :is(a, button, input).button.alt:is(.disabled, :disabled[disabled], :disabled) {
  padding: var(--button-padding); border-color: var(--color-accent); background: var(--color-accent); color: var(--color-white); opacity: 0.5; cursor: not-allowed;
  &:hover { border-color: var(--color-accent); background: var(--color-accent); color: var(--color-white); }
}
/* WooCommerce adds "added" and a tick after an AJAX add to basket; the theme's cards link to the product */
.woocommerce a.button.added::after { content: none; }

/* Secondary buttons, outlined like .btn--secondary: the basket's "Apply coupon" and "Update cart", and the small
   buttons in notices and the orders table. The page's main action ("Proceed to checkout", "Place order") stays filled. */
.woocommerce :is(td.actions, .woocommerce-message, .woocommerce-info, .woocommerce-error, .woocommerce-orders-table, .checkout_coupon, .shipping-calculator-form) :is(a, button).button {
  background: transparent; color: var(--color-accent);
  &:hover { border-color: var(--color-accent-hover); background: var(--color-accent-hover); color: var(--color-white); }
  &:is(.disabled, :disabled) { background: transparent; color: var(--color-accent); }
}
/* Small, like .btn--small: a button inside a notice or a table row */
.woocommerce :is(.woocommerce-message, .woocommerce-info, .woocommerce-error, .woocommerce-orders-table) :is(a, button).button {
  min-height: 2rem; padding: var(--space-3xs) var(--space-s); font-size: var(--text-xsmall);
  @media (pointer: coarse) { min-height: var(--target-size); }
}

/* Notices: a light bordered panel with an icon (a tick, an "i" or, in red, an exclamation mark), instead of
   WooCommerce's coloured bar. A button or link in the notice sits on the right. */
.woocommerce :is(.woocommerce-message, .woocommerce-info, .woocommerce-error) {
  --notice-icon: url("../../icons/circle-info.svg");
  position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-2xs) var(--space-m);
  margin: 0 0 var(--space-m); padding: var(--space-s) var(--space-m) var(--space-s) calc(var(--space-s) + var(--icon-m) + var(--space-xs));
  border: 1px solid var(--color-line); border-radius: var(--radius);
  background: var(--shop-panel-light); color: var(--color-ink); line-height: var(--leading-snug); list-style: none;
  &::before {
    content: ""; position: absolute; top: calc(var(--space-s) + (1lh - var(--icon-m)) / 2); left: var(--space-s);
    width: var(--icon-m); height: var(--icon-m); background: var(--color-ink); mask: var(--notice-icon) center / contain no-repeat;
  }
  /* Beside a button the row is the button's height (2rem), so the icon centres on that. On phones the
     button drops below the text, and the icon stays with the text's first line. */
  &:has(> .button)::before { @media (min-width: 40rem) { top: calc(var(--space-s) + (max(1lh, 2rem) - var(--icon-m)) / 2); } }
  &::after { content: none; }
  & .button { order: 2; margin: 0; }
  & a:not(.button) { color: var(--color-ink); text-decoration: underline; text-decoration-thickness: 1px; &:hover { text-decoration-thickness: 2px; } }
  & li { margin: 0; }
}
.woocommerce .woocommerce-message { --notice-icon: url("../../icons/circle-check.svg"); }
/* A notice fades in and drops a little as it appears (the keyframes are in motion.css) */
@media (prefers-reduced-motion: no-preference) {
  .woocommerce :is(.woocommerce-message, .woocommerce-info, .woocommerce-error) { animation: appear var(--duration-s) var(--ease-out) backwards; }
}
.woocommerce .woocommerce-error {
  --notice-icon: url("../../icons/circle-exclamation.svg");
  flex-direction: column; align-items: flex-start; border-color: color-mix(in srgb, var(--color-error) 35%, var(--color-white)); background: color-mix(in srgb, var(--color-error) 4%, var(--color-white));
  &::before { background: var(--color-error); }
  /* Each checkout error links to its field: underlined on hover only, so a long list stays readable */
  .woocommerce-NoticeGroup & a:not(.button) { text-decoration: none; &:hover { text-decoration: underline; text-decoration-thickness: 1px; } }
}
/* Inside the order summary panel, a notice is white so it shows as a box */
.woocommerce #order_review :is(.woocommerce-message, .woocommerce-info, .woocommerce-error) { background: var(--color-white); }
.woocommerce-notices-wrapper:empty { display: none; }
/* WooCommerce moves focus to new notices so screen readers hear them; no ring is needed for that */
.woocommerce-notices-wrapper :focus:not(:focus-visible),
:is(.woocommerce-notices-wrapper, .woocommerce) :is(.woocommerce-message, .woocommerce-info, .woocommerce-error, [tabindex="-1"]):focus { outline: none; box-shadow: none; }

/* Fields: the same as .field (components.css) and Forminator's, with the shared focus ring */
.woocommerce :is(select, input.input-text, textarea, .qty),
.woocommerce form .form-row :is(.input-text, select) {
  min-height: var(--target-size); padding: var(--field-padding); border: 1px solid var(--color-field-border); border-radius: 0;
  background-color: var(--color-white); color: var(--color-ink); font: inherit; font-size: var(--text-base); line-height: var(--leading-snug);
  &:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); box-shadow: 0 0 0 var(--focus-offset) var(--color-focus-halo); }
}
.woocommerce select {
  appearance: none; padding-right: var(--space-xl); cursor: pointer;
  background-image: var(--field-chevron); background-repeat: no-repeat; background-position: right 0.875rem center; background-size: 0.75rem;
}
/* Checkboxes and radios: one size, in ink */
.woocommerce input:is([type="checkbox"], [type="radio"]) { flex: none; width: 1.125rem; height: 1.125rem; margin: 0; accent-color: var(--color-ink); }

/* ---------------------------------------------------------------- product lists and cards */

.woocommerce ul.products {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-s); margin: 0; padding: 0; list-style: none; clear: none;
  &::before, &::after { content: none; display: none; }
  /* One to a row on small phones (a 360 or 375 wide screen), where two leave a price range on two lines and the
     "View product" cue filling the card. From 390 wide, two fit. */
  @media (width < 24rem) { grid-template-columns: minmax(0, 1fr); }
  /* The same gaps as the bordered cards sections (sections.css), so product and category cards line up on a page */
  @media (min-width: 40rem) { gap: var(--space-m); }
  @media (min-width: 64rem) {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    &.columns-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  }
}

/* A card, as on the old site: a thin light border round it, the photo edge to edge at the top, then the name
   and prices inset under it, with no button. The whole card is the link to the product page; hovering fades
   the photo a little and underlines the name, like the theme's cards. The bordered category cards match. */
.woocommerce ul.products li.product {
  position: relative; display: flex; flex-direction: column; width: auto; margin: 0; padding: 0; float: none;
  overflow: hidden; border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-white); text-align: left;
}
.woocommerce ul.products li.product .woocommerce-loop-product__link {
  display: flex; flex-direction: column; flex: 1; padding-bottom: var(--space-m); color: inherit; text-decoration: none;
  & > :not(.product-card__media, .onsale) { margin-inline: var(--space-m); }
  @media (width < 40rem) { padding-bottom: var(--space-s); & > :not(.product-card__media, .onsale) { margin-inline: var(--space-s); } }
  @media (hover: hover) { &:hover .woocommerce-loop-product__title { text-decoration: underline; text-underline-offset: 0.2em; } }
  /* On hover or keyboard focus the photo grows a little inside its frame and the cue's arrow moves right.
     With reduced motion the photo fades a little instead, as it always did. */
  @media (prefers-reduced-motion: no-preference) {
    &:focus-visible { & img { scale: var(--zoom); } & .product-card__more .icon { translate: var(--nudge) 0; } }
    @media (hover: hover) { &:hover { & img { scale: var(--zoom); } & .product-card__more .icon { translate: var(--nudge) 0; } } }
  }
  @media (prefers-reduced-motion: reduce) and (hover: hover) { &:hover img { opacity: 0.85; } }
}
/* The frame round the photo (includes/woocommerce/product-list.php), so the photo can grow without leaving its square */
.woocommerce ul.products li.product .product-card__media { display: block; overflow: hidden; }
.woocommerce ul.products li.product a img {
  width: 100%; height: auto; aspect-ratio: 1; margin: 0; border-radius: 0; object-fit: cover; box-shadow: none;
  transition: opacity var(--transition), scale var(--duration-m) var(--ease-out);
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  margin: var(--space-s) 0 0; padding: 0; color: var(--color-ink); font-size: var(--text-base); font-weight: var(--weight-normal); line-height: var(--leading-snug); letter-spacing: 0;
  @media (24rem <= width < 40rem) { margin-top: var(--space-xs); font-size: var(--text-small); } /* two to a row on phones */
}
.woocommerce ul.products li.product .price {
  display: block; margin: var(--space-3xs) 0 0; padding: 0;
  color: var(--color-ink); font-size: var(--text-small); font-weight: var(--weight-normal);
  & del { color: var(--color-muted); opacity: 1; }
  & ins { text-decoration: none; font-weight: inherit; }
}
.woocommerce ul.products li.product .price-per-m2 { margin: var(--space-3xs) 0 0; padding: 0; color: var(--color-muted); font-size: var(--text-small); }
/* The "View product" cue: at the foot of the card, so the cues in a row line up, and filled when the card is
   hovered, as the category cards' */
.woocommerce ul.products li.product .product-card__more {
  align-self: flex-start; margin-top: auto;
  /* Two to a row on phones: the card's full width, on one line, without the arrow, which doesn't fit */
  @media (24rem <= width < 40rem) { align-self: stretch; justify-content: center; padding-inline: var(--space-2xs); font-size: var(--text-xsmall); white-space: nowrap; & .icon { display: none; } }
}
.woocommerce ul.products li.product .woocommerce-loop-product__link > :has(+ .product-card__more) { margin-bottom: var(--space-s); }
@media (hover: hover) {
  .woocommerce ul.products li.product .woocommerce-loop-product__link:hover .product-card__more { border-color: var(--color-accent-hover); background: var(--color-accent-hover); color: var(--color-white); }
}
.woocommerce ul.products li.product .onsale {
  position: absolute; top: var(--space-2xs); left: var(--space-2xs); right: auto; z-index: 1; min-width: 0; min-height: 0; margin: 0;
  padding: var(--space-3xs) var(--space-2xs); border-radius: 0; background: var(--color-ink); color: var(--color-white);
  font-size: var(--text-xsmall); font-weight: var(--weight-bold); line-height: var(--leading-tight);
}

/* Related products and upsells: a heading like a section's (.section__head), over a row of four */
.woocommerce :is(.related, .upsells).products {
  & > h2 { margin-bottom: var(--space-head); text-align: center; }
  & + .products { margin-top: var(--space-2xl); }
}

/* Numbered pages, shown when the "Load more" script hasn't run */
.woocommerce nav.woocommerce-pagination {
  text-align: center;
  & ul { display: inline-flex; flex-wrap: wrap; gap: var(--space-3xs); margin: 0; border: 0; white-space: normal; }
  & ul li { float: none; border: 0; overflow: visible; }
  & ul li :is(a, span) {
    display: grid; place-items: center; min-width: var(--target-size); min-height: var(--target-size); padding: 0 var(--space-2xs);
    border: 1px solid var(--color-line); font-size: var(--text-small); line-height: 1; text-decoration: none;
  }
  & ul li a:hover { border-color: var(--color-ink); background: transparent; color: var(--color-ink); }
  & ul li span.current { border-color: var(--color-ink); background: var(--color-ink); color: var(--color-white); }
}
.woocommerce .product-list__button { min-width: var(--button-min-width); }

/* ---------------------------------------------------------------- product page */

/* The gallery: a bordered main image and one row of thumbnails that scrolls sideways */
.woocommerce div.product div.images {
  float: none; width: auto; margin: 0;
  & .woocommerce-product-gallery__wrapper { margin: 0; }
  & img { border: 1px solid var(--color-line); border-radius: var(--radius); }
  & .flex-viewport { margin-bottom: var(--space-2xs); border-radius: var(--radius); }
}
/* Before the slider starts, show only the first image, so the page doesn't jump */
.woocommerce div.product div.images:not(:has(.flex-viewport)) .woocommerce-product-gallery__image:nth-child(n+2) { display: none; }
.woocommerce div.product div.images .flex-control-thumbs {
  display: flex; gap: var(--space-2xs); margin: calc(var(--focus-width) * -1); padding: var(--focus-width); overflow-x: auto; overscroll-behavior-x: contain; /* room for the focus ring */
  scroll-snap-type: x proximity; scroll-padding-inline: var(--focus-width); scrollbar-width: thin;
  & li {
    flex: 0 0 calc((100% - (var(--shop-thumbs) - 1) * var(--space-2xs)) / var(--shop-thumbs)); width: auto; float: none; scroll-snap-align: start;
  }
  & li img {
    opacity: 0.55; transition: opacity var(--transition);
    &:hover, &.flex-active { opacity: 1; }
    &.flex-active { border-color: var(--color-ink); }
    &:focus-visible { opacity: 1; outline: var(--focus-width) solid var(--color-focus); outline-offset: 0; }
  }
}
/* Arrows at the ends of the thumbnail row, when it holds more than fit (added by assets/scripts/shop.js).
   Round white buttons like the full-screen one; an arrow fades out at its end of the row. */
.gallery-thumbs { position: relative; }
.gallery-thumbs__control {
  position: absolute; top: 50%; z-index: 2; display: none; place-items: center;
  width: 2.25rem; height: 2.25rem; padding: 0; border: 0; border-radius: 50%; translate: 0 -50%;
  background: var(--color-white); box-shadow: var(--shadow-small); color: var(--color-ink); cursor: pointer;
  transition: opacity var(--transition), background-color var(--transition);
  [data-overflow] > & { display: grid; }
  &::before { content: ""; position: absolute; inset: calc((var(--target-size) - 2.25rem) / -2); } /* a 44px target */
  & .icon { width: var(--icon-xs); height: var(--icon-xs); transition: translate var(--transition); }
  &:disabled { opacity: 0; pointer-events: none; }
  @media (hover: hover) { &:hover { background: var(--color-paper); } }
}
.gallery-thumbs__control--previous { left: var(--space-2xs); }
.gallery-thumbs__control--next { right: var(--space-2xs); }
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .gallery-thumbs__control--previous:hover .icon { translate: calc(var(--nudge) * -1) 0; }
  .gallery-thumbs__control--next:hover .icon { translate: var(--nudge) 0; }
}

/* The full-screen button over the main image (added by assets/scripts/shop.js) */
.woocommerce div.product div.images .woocommerce-product-gallery__trigger {
  position: absolute; top: var(--space-s); right: var(--space-s); z-index: 9; display: grid; place-items: center;
  width: var(--target-size); height: var(--target-size); padding: 0; border: 0; border-radius: 50%;
  background: var(--color-white); box-shadow: var(--shadow-small); color: var(--color-ink); font-size: 0; cursor: pointer;
  &::before, &::after { content: none; }
  & svg { width: var(--icon-s); height: var(--icon-s); }
  &:hover { background: var(--color-paper); }
}

/* The summary: the category, title and price, kept tight so the options and the add to basket button fit
   above the fold on a laptop. A tile's price per m² sits under its price. */
.woocommerce div.product .product_title { margin: 0; }
.woocommerce div.product .summary > p.price {
  margin: var(--space-xs) 0 var(--space-m); color: var(--color-ink); font-size: var(--text-h3); line-height: var(--leading-heading);
  & del { color: var(--color-muted); opacity: 1; }
  & ins { font-weight: inherit; text-decoration: none; }
}
.woocommerce div.product .summary > .price-per-m2 { margin: calc(var(--space-m) * -1 + var(--space-3xs)) 0 var(--space-m); }
.woocommerce div.product p.stock { margin: 0 0 var(--space-s); color: var(--color-muted); font-size: var(--text-small); }
.woocommerce div.product p.stock.out-of-stock { color: var(--color-error); }

/* The add to basket form: a light panel. Every row starts at the same left edge: the variations (a label
   above each select, side by side where two fit), the extras, then the quantity and the button. Tiles put
   the calculator beside the quantity, and the button on its own row. */
.woocommerce div.product form.cart {
  margin: 0; padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--shop-panel-light);
  &::before, &::after { content: none; }
  @media (width < 40rem) { padding: var(--space-s); }
}
.woocommerce div.product form.cart:not(.variations_form),
.woocommerce div.product form.cart .woocommerce-variation-add-to-cart {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--form-gap) var(--space-xs);
  & > .extras { grid-column: 1 / -1; }
  & > :is(.quantity, .tile-calculator__tiles) { grid-column: 1; }
  & > .single_add_to_cart_button { grid-column: 2; }
  & > .tile-calculator { grid-column: 2; }
  &:has(> .tile-calculator) > .single_add_to_cart_button { grid-column: 1 / -1; }
}
/* By the summary's width: on phones the button takes its own row (beside the quantity, "Add to cart" in
   capitals wraps), and in a narrower summary (a small tablet) the calculator does too */
@container (width < 24rem) {
  .woocommerce div.product form.cart :is(.quantity, .tile-calculator) ~ .single_add_to_cart_button { grid-column: 1 / -1; }
}
@container (width < 20rem) {
  .woocommerce div.product form.cart .tile-calculator__tiles ~ .tile-calculator { grid-column: 1 / -1; }
}
.woocommerce div.product form.cart .variations {
  display: block; width: 100%; margin: 0 0 var(--form-gap); border: 0;
  & tbody { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--form-gap) var(--space-xs); }
  & tr { display: grid; gap: var(--field-gap); align-content: start; min-width: 0; }
  & th, & td { display: block; padding: 0; border: 0; line-height: var(--leading-snug); text-align: left; }
  & th.label { color: var(--color-ink); font-size: var(--text-small); font-weight: var(--weight-normal); }
  & th.label label { display: block; margin: 0; }
  & td.value { min-width: 0; }
  /* WooCommerce's background shorthand here drops the white and swaps in its own arrow */
  & select {
    display: block; width: 100%; max-width: none; min-width: 0; margin: 0; padding-right: var(--space-xl);
    background: var(--color-white) var(--field-chevron) no-repeat right 0.875rem center / 0.75rem;
  }
  & label { font-weight: var(--weight-normal); }
}
/* "Clear" sits at the panel's right edge, on the chosen variation's price line, so it adds no line */
.woocommerce div.product form.cart .variations tbody { position: relative; }
.woocommerce div.product form.cart .reset_variations {
  position: absolute; top: calc(100% + var(--space-xs)); right: 0; z-index: 1; margin: 0; color: var(--color-ink); font-size: var(--text-small); line-height: var(--leading);
  /* On touch screens, ::before grows what can be tapped to 44px tall, without moving the text */
  @media (pointer: coarse) { &::before { content: ""; position: absolute; inset: min(0px, (1lh - var(--target-size)) / 2) calc(var(--space-2xs) * -1); } }
}
/* WooCommerce hides "Clear" with visibility, which would keep a blank line under the select */
.woocommerce div.product form.cart .reset_variations[style*="hidden"] { display: none; }
.woocommerce div.product form.cart .single_variation_wrap .woocommerce-variation:not(:empty) {
  margin: calc(var(--space-xs) - var(--form-gap)) 0 var(--form-gap); padding-right: 4rem; /* room for "Clear" */
}
.woocommerce div.product form.cart .woocommerce-variation-price .price {
  color: var(--color-ink); font-size: var(--text-base);
  & del { color: var(--color-muted); opacity: 1; }
  & ins { font-weight: inherit; text-decoration: none; }
}
.woocommerce div.product form.cart .woocommerce-variation-price .price-per-m2 { display: inline-block; margin: 0 0 0 0.5em; white-space: nowrap; }
.woocommerce div.product form.cart .woocommerce-variation-description { margin-bottom: var(--space-2xs); }
.woocommerce div.product form.cart .woocommerce-variation-availability p.stock { margin: var(--space-3xs) 0 0; }
.woocommerce div.product form.cart .extras__select { width: 100%; margin: 0; }

/* Quantity: the field between minus and plus buttons */
.woocommerce .quantity {
  display: inline-flex; align-items: stretch;
  & .qty { width: 3.5rem; min-height: var(--target-size); padding-inline: var(--space-3xs); text-align: center; -moz-appearance: textfield; }
  & .qty::-webkit-inner-spin-button, & .qty::-webkit-outer-spin-button { margin: 0; -webkit-appearance: none; }
}
.woocommerce div.product form.cart div.quantity { float: none; margin: 0; }

.woocommerce div.product form.cart .button { float: none; }
.woocommerce div.product form.cart .single_add_to_cart_button { min-width: 0; min-height: var(--target-size); }


/* ---------------------------------------------------------------- tables */

/* WooCommerce's tables (orders, an order's details): rows with a line under each, as in .table (components.css).
   The basket, its totals and the checkout's order summary are laid out as rows of their own, further down. */
.woocommerce table.shop_table {
  margin: 0 0 var(--space-l); border: 0; border-top: 1px solid var(--color-line); border-radius: 0; border-collapse: collapse;
  & :is(th, td) { padding: var(--space-s) var(--space-xs); border: 0; border-bottom: 1px solid var(--color-line); vertical-align: middle; }
  & :is(th, td):first-child { padding-left: 0; }
  & :is(th, td):last-child { padding-right: 0; }
  /* Row headings bold and their cells at the normal weight (WooCommerce makes totals 700); only the order total
     is bold. Column headings: small capitals, as in .table (components.css). */
  & :is(tbody th, tfoot th) { color: var(--color-ink); font-weight: var(--weight-bold); }
  & tfoot td { font-weight: var(--weight-normal); }
  & .order-total .amount { font-weight: var(--weight-bold); }
  & .order-total small .amount { font-weight: var(--weight-normal); } /* the VAT in the note after it */
  & thead th { color: var(--color-muted); font-size: var(--text-xsmall); font-weight: var(--weight-normal); letter-spacing: var(--tracking-label); text-transform: uppercase; }
  & :is(td.product-name, td.product-price, td.product-subtotal, td.product-total) { color: var(--color-ink); }
  & :is(td.product-name, th) a { color: var(--color-ink); text-decoration: none; &:hover { text-decoration: underline; } }
  /* An item's options and extras: a small grey line each, the label then the choice */
  & .variation, & dl.variation, & ul.wc-item-meta { margin: var(--space-3xs) 0 0; padding: 0; color: var(--color-muted); font-size: var(--text-small); line-height: var(--leading-snug); list-style: none; }
  & dl.variation :is(dt, dd) { float: none; display: inline; margin: 0; padding: 0; font-weight: var(--weight-normal); }
  & dl.variation dd::after { content: ""; display: block; }
  & :is(dl.variation dd, ul.wc-item-meta li) p { display: inline; margin: 0; }
  & ul.wc-item-meta :is(li, strong) { float: none; margin: 0; font-weight: var(--weight-normal); }
}
/* On phones the account's tables stack: each row is a block, and each cell a line labelled from its column (data-title) */
@media (width < 48rem) {
  .woocommerce-account table.shop_table_responsive {
    & thead { display: none; }
    & tr { display: block; padding-block: var(--space-2xs); border-bottom: 1px solid var(--color-line); }
    & tr :is(th, td) { display: flex; justify-content: space-between; align-items: center; gap: var(--space-s); padding: var(--space-3xs) 0; border: 0; text-align: right; }
    & tr :is(th, td)[data-title]::before { content: attr(data-title); color: var(--color-muted); font-weight: var(--weight-normal); text-align: left; }
  }
}

/* ---------------------------------------------------------------- basket */

/* The basket's items on the left and its totals on the right from large screens, with notices across the top.
   .cart-collaterals holds the totals and any cross-sells; its children are placed in this grid directly. */
.woocommerce-cart .shop-page__content > .woocommerce {
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-xl);
  & > * { grid-column: 1 / -1; }
  @media (min-width: 64rem) {
    &:has(.cart_totals) { grid-template-columns: minmax(0, 1fr) minmax(0, var(--shop-aside)); align-items: start; }
    & > .woocommerce-notices-wrapper { grid-row: 1; }
    & > .woocommerce-cart-form { grid-column: 1; grid-row: 2; }
    & .cart_totals { grid-column: 2; grid-row: 2 / span 2; }
    & .cross-sells { grid-column: 1; grid-row: 3; }
  }
}
.woocommerce .cart-collaterals { display: contents; &::before, &::after { content: none; } }
.woocommerce .woocommerce-cart-form { container-type: inline-size; } /* the items lay out by the form's width */

/* Each item is a row: the photo, the name over its options and price, the quantity, the subtotal and the remove
   button. Not table columns, so the row can re-flow where the form is narrow (below). The column headings stay
   for screen readers only. */
.woocommerce table.cart {
  display: block; margin: 0;
  & thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  & tbody, & tr { display: block; }
  & td { display: block; padding: 0; border: 0; }
  & tr.cart_item {
    display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto minmax(5.5rem, auto) 2rem; align-items: center; gap: var(--space-3xs) var(--space-m);
    grid-template-areas: "thumbnail name quantity subtotal remove" "thumbnail price quantity subtotal remove";
    padding-block: var(--space-m); border-bottom: 1px solid var(--color-line);
  }
  & td.product-thumbnail { grid-area: thumbnail; align-self: start; }
  & td.product-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--color-line); border-radius: var(--radius); object-fit: cover; }
  & td.product-name { grid-area: name; align-self: end; line-height: var(--leading-snug); }
  & td.product-price { grid-area: price; align-self: start; color: var(--color-muted); font-size: var(--text-small); }
  & td.product-quantity { grid-area: quantity; }
  & td.product-subtotal { grid-area: subtotal; font-weight: var(--weight-bold); text-align: right; }
  & td.product-remove { grid-area: remove; }
  /* The remove link: a cross (assets/icons/xmark.svg) in a 32px circle; ::before grows what can be tapped to --target-size */
  & td.product-remove a.remove {
    position: relative; display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 50%;
    color: var(--color-muted) !important; font-size: 0; text-decoration: none;
    &::before { content: ""; position: absolute; inset: calc((2rem - var(--target-size)) / 2); }
    &::after { content: ""; width: 0.75rem; height: 0.75rem; background: currentColor; mask: url("../../icons/xmark.svg") center / contain no-repeat; }
    &:hover { background: var(--color-ink); color: var(--color-white) !important; }
  }
  /* The coupon field and "Update cart", under the items */
  & td.actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-s); padding-block: var(--space-m); }
  & td.actions .coupon { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
  & td.actions .coupon .button { white-space: nowrap; }
  & td.actions .coupon .input-text.has-error { border-color: var(--color-error); }
  /* WooCommerce gives the coupon field its own border, padding and no focus ring */
  & td.actions .coupon .input-text {
    width: 12rem; margin: 0; padding: var(--field-padding); border-color: var(--color-field-border);
    &:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); box-shadow: 0 0 0 var(--focus-offset) var(--color-focus-halo); }
  }
}
/* A narrow form (phones, and beside the totals on a small laptop): the name and price beside a smaller photo,
   with the quantity and subtotal on a line under them */
@container (width < 36rem) {
  .woocommerce table.cart {
    & tr.cart_item {
      grid-template-columns: 4.5rem auto minmax(0, 1fr) 2rem; column-gap: var(--space-s);
      grid-template-areas: "thumbnail name name remove" "thumbnail price price remove" "thumbnail quantity subtotal subtotal";
      padding-block: var(--space-s);
    }
    & td.product-remove { align-self: start; }
    & td.product-quantity { margin-top: var(--space-2xs); }
    & td.product-subtotal { margin-top: var(--space-2xs); }
    & td.actions { display: grid; justify-content: stretch; }
    & td.actions .coupon .input-text { flex: 1 1 8rem; width: auto; min-width: 0; }
    & td.actions > .button { width: 100%; }
  }
}

/* The totals: a light bordered panel, like the product page's add to basket form. It stays in view beside a long
   basket on large screens. */
.woocommerce .cart-collaterals .cart_totals {
  float: none; width: auto; margin-top: var(--space-m); padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--shop-panel-light);
  @media (width < 40rem) { padding: var(--space-s); }
  @media (min-width: 48rem) { width: 100%; max-width: var(--shop-aside); margin-left: auto; }
  @media (min-width: 64rem) { position: sticky; top: calc(var(--header-height) + var(--space-m)); margin-top: 0; }
  & h2 { margin-bottom: var(--space-2xs); }
  & .wc-proceed-to-checkout { padding: 0; }
  /* WooCommerce makes it bigger, and a block, which puts the text at the top of the button */
  & .checkout-button { display: flex; width: 100%; min-height: var(--target-size); margin: 0; padding: var(--button-padding); font-size: var(--text-button); line-height: var(--leading-tight); }
}
/* Each total is a line: its label on the left and the amount on the right. Shipping puts its options under the
   label, full width. The order total is larger. The checkout's order summary matches (below). */
.woocommerce :is(.cart_totals table.shop_table, table.woocommerce-checkout-review-order-table) {
  display: block; margin: 0 0 var(--space-m); border: 0;
  & :is(thead, tbody, tfoot) { display: block; }
  & tr { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-s); padding-block: var(--space-xs); border-bottom: 1px solid var(--color-line); }
  & tr :is(th, td) { display: block; padding: 0; border: 0; text-align: left; &::before { content: none; } }
  & tr th { width: auto; color: var(--color-text); font-weight: var(--weight-normal); } /* WooCommerce sets 35% */
  & tr td { flex: none; max-width: 100%; }
  & tr td { color: var(--color-ink); text-align: right; }
  & tr.woocommerce-shipping-totals { flex-direction: column; align-items: stretch; gap: 0; }
  & tr.woocommerce-shipping-totals td { text-align: left; }
  & tr.order-total { padding-top: var(--space-s); border-bottom: 0; }
  & tr.order-total th { color: var(--color-ink); font-weight: var(--weight-bold); }
  & tr.order-total td .amount { font-size: var(--text-h3); }
  & tr.order-total td small { display: block; }
  & tr.order-total td small .amount { font-size: inherit; }
  /* "[Remove]" after a coupon's discount */
  & .woocommerce-remove-coupon { margin-left: var(--space-3xs); color: var(--color-ink); font-size: var(--text-small); text-decoration: underline; text-decoration-thickness: 1px; &:hover { text-decoration-thickness: 2px; } }
}
/* "(includes £x VAT)" and similar notes: extra small, not the browser's "smaller". WooCommerce's #767676 is only
   4.2:1 on the panel. */
.woocommerce :is(.cart_totals, #order_review) :is(table, p) small { color: var(--color-text-on-paper); font-size: var(--text-xsmall); }
.woocommerce ul#shipping_method {
  margin: 0; padding: 0;
  & .amount { font-weight: var(--weight-normal); }
  /* Left-aligned, so the radios line up in a column even when an option's name wraps */
  & li { display: flex; align-items: flex-start; gap: var(--space-2xs); margin: 0; text-align: left; }
  & li input { margin-top: calc((var(--target-size) - 1.125rem) / 2); }
  & li input[type="hidden"] + label { padding-block: var(--space-3xs) 0; } /* one option only: text, with nothing to tap */
  /* At least 44px tall to tap; block, so the name and price still wrap as one line of text */
  & li label { display: block; padding-block: calc((var(--target-size) - 1lh) / 2); color: var(--color-ink); font-size: var(--text-small); font-weight: var(--weight-normal); line-height: var(--leading-snug); }
}
.woocommerce :is(.woocommerce-shipping-destination, .woocommerce-shipping-contents) { margin: var(--space-3xs) 0 0; font-size: var(--text-small); line-height: var(--leading-snug); }
/* The shipping calculator: a link that opens a short form */
.woocommerce .woocommerce-shipping-calculator {
  margin-top: var(--space-2xs);
  & .shipping-calculator-button { display: inline-block; margin: 0; color: var(--color-ink); font-size: var(--text-small); text-decoration: underline; text-decoration-thickness: 1px; &:hover { text-decoration-thickness: 2px; } }
  & .shipping-calculator-button::after { content: none; }
  & .shipping-calculator-form { margin-top: var(--space-xs); }
  & .shipping-calculator-form .form-row { margin-bottom: var(--space-2xs); }
  & .shipping-calculator-form .button { width: 100%; }
}

/* An empty basket: a centred message over the "Return to shop" button, in place of a notice */
.woocommerce .wc-empty-cart-message .cart-empty {
  --notice-icon: url("../../icons/cart.svg");
  display: block; margin: 0; padding: var(--space-xl) 0 var(--space-m); border: 0; background: none; font-size: var(--text-lead); text-align: center;
  &::before { position: static; display: block; width: 3rem; height: 3rem; margin: 0 auto var(--space-s); background: var(--color-muted); }
}
.woocommerce .return-to-shop { margin: 0; padding-bottom: var(--space-xl); text-align: center; }

/* Cross-sells ("You may be interested in…"), under the items */
.woocommerce .cross-sells { margin-top: var(--space-xl); & > h2 { margin-bottom: var(--space-m); font-size: var(--text-h3); line-height: var(--leading-heading); letter-spacing: normal; } }

/* ---------------------------------------------------------------- checkout */

/* The customer's details on the left and the order summary on the right from large screens. Notices and
   validation errors go across the top. */
.woocommerce form.checkout {
  display: grid; grid-template-columns: minmax(0, 1fr); column-gap: var(--space-xl);
  &::before, &::after { content: none; }
  & > * { grid-column: 1 / -1; }
  @media (min-width: 64rem) {
    grid-template-columns: minmax(0, 1fr) minmax(0, var(--shop-aside)); grid-template-rows: auto auto 1fr; align-items: start;
    & > .woocommerce-NoticeGroup { grid-row: 1; }
    & > .col2-set { grid-column: 1; grid-row: 2 / span 2; }
    & > #order_review_heading { grid-column: 2; grid-row: 2; }
    & > #order_review { grid-column: 2; grid-row: 3; }
  }
}
.woocommerce form.checkout > #order_review_heading { margin: var(--space-xl) 0 var(--space-s); @media (min-width: 64rem) { margin-top: 0; } }
.woocommerce form.checkout > #order_review {
  padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--shop-panel-light);
  @media (width < 40rem) { padding: var(--space-s); }
}
.woocommerce .col2-set {
  display: grid; gap: var(--space-m); width: auto;
  &::before, &::after { content: none; }
  & .col-1, & .col-2 { float: none; width: auto; }
}
.woocommerce .col2-set h3, .woocommerce-billing-fields h3, .woocommerce-additional-fields h3 { margin-bottom: var(--space-s); }
.woocommerce-checkout #ship-to-different-address {
  float: none; margin: 0 0 var(--space-2xs);
  & label { display: flex; align-items: center; gap: var(--space-2xs); min-height: var(--target-size); color: var(--color-ink); font-size: var(--text-base); font-weight: var(--weight-normal); letter-spacing: normal; cursor: pointer; }
}
.woocommerce-checkout .woocommerce-additional-fields { clear: both; margin-top: var(--space-m); }
.woocommerce-checkout .woocommerce-account-fields .create-account { margin-bottom: 0; }

/* Form rows: two side by side where WooCommerce marks them first and last */
.woocommerce :is(.woocommerce-billing-fields__field-wrapper, .woocommerce-shipping-fields__field-wrapper, .woocommerce-address-fields__field-wrapper, form.edit-account, form.register, form.woocommerce-form-login, form.lost_reset_password, form.checkout_coupon) {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-s);
  & > *, & > .form-row-wide, & > fieldset, & > .clear { grid-column: 1 / -1; }
  & > .form-row-first { grid-column: 1; }
  & > .form-row-last { grid-column: 2; }
  & > .clear { display: none; }
  @media (width < 40rem) { & > :is(.form-row-first, .form-row-last) { grid-column: 1 / -1; } }
}
.woocommerce form .form-row {
  float: none; width: auto; margin: 0 0 var(--form-gap); padding: 0;
  & label { display: block; margin-bottom: var(--field-gap); color: var(--color-ink); font-size: var(--text-small); font-weight: var(--weight-normal); line-height: var(--leading-snug); }
  /* A checkbox label: the box sits in the gap on the left, and the text (with its required "*") wraps beside it as
     one run of text. At least 44px tall to tap. */
  & label.checkbox, & label.woocommerce-form__label-for-checkbox {
    position: relative; display: block; min-height: var(--target-size); margin: 0;
    padding-block: calc((var(--target-size) - 1lh) / 2); padding-left: calc(1.125rem + var(--space-2xs)); cursor: pointer;
    & input { position: absolute; top: calc((var(--target-size) - 1.125rem) / 2); left: 0; margin: 0; }
  }
  & .input-text, & select { width: 100%; }
  & textarea.input-text { min-height: 6rem; resize: vertical; }
  & .required { visibility: visible; color: var(--color-error); font-weight: var(--weight-normal); text-decoration: none; }
  & .optional { color: var(--color-muted); }
  /* A hint under a field ("This will be how your name will be displayed…") */
  & > span > em, & > em { display: block; margin-top: var(--field-gap); color: var(--color-muted); font-size: var(--text-small); font-style: normal; }
  /* The checkout's country, when the shop sells to one country: WooCommerce shows it as text that can't be changed */
  & select.country_to_state--single { min-height: 0; padding: 0; border: 0; background: none; color: var(--color-ink); }
  & strong { font-weight: var(--weight-normal); color: var(--color-ink); }
}
/* A field that passes keeps its usual border. One that fails gets a red border and a red message under it, as in
   Forminator, and its label stays ink. */
.woocommerce form .form-row.woocommerce-validated :is(.input-text, select) { border-color: var(--color-field-border); }
.woocommerce form .form-row.woocommerce-invalid label { color: var(--color-ink); }
.woocommerce form .form-row.woocommerce-invalid :is(.input-text, select, .select2-selection) { border-color: var(--color-error); }
.woocommerce form .form-row .checkout-inline-error-message { margin: var(--field-gap) 0 0; color: var(--color-error); font-size: var(--text-small); line-height: var(--leading-snug); }
/* The "show password" button inside a password field: an eye, 44px to tap. WooCommerce draws it in its layout
   stylesheet, which the theme doesn't load. */
.woocommerce form .password-input { display: block; position: relative; }
.woocommerce form .show-password-input {
  position: absolute; top: 0; right: 0; display: grid; place-items: center; width: var(--target-size); height: var(--target-size); padding: 0; border: 0; background: none; transform: none; cursor: pointer;
  &::before { content: ""; width: var(--icon-s); height: var(--icon-s); margin: 0; background: var(--color-ink); mask: url("../../icons/eye.svg") center / contain no-repeat; }
  &.display-password::before { mask-image: url("../../icons/eye-slash.svg"); }
  &:focus-visible { outline: var(--focus-width) solid var(--color-focus); outline-offset: calc(var(--focus-width) * -1); }
}
.woocommerce form .password-input input { padding-right: var(--target-size); }
.woocommerce .woocommerce-password-strength { margin-top: var(--field-gap); padding: var(--space-3xs) var(--space-xs); font-size: var(--text-small); font-weight: var(--weight-normal); }
.woocommerce .woocommerce-password-hint { display: block; margin-top: var(--field-gap); font-size: var(--text-small); line-height: var(--leading-snug); }

/* Searchable selects (country and county, where the shop sells to several): the same box as a field, with the
   theme's chevron. The list opens outside .woocommerce, at the end of the page. */
.woocommerce .select2-container .select2-selection--single {
  height: var(--target-size); border: 1px solid var(--color-field-border); border-radius: 0;
  & .select2-selection__rendered { padding: 0 var(--space-xl) 0 var(--space-xs); color: var(--color-ink); line-height: calc(var(--target-size) - 2px); }
  & .select2-selection__arrow { top: 0; right: 0; width: var(--space-xl); height: calc(var(--target-size) - 2px); background: var(--field-chevron) no-repeat center / 0.75rem; & b { display: none; } }
}
.woocommerce .select2-container--focus .select2-selection--single, .woocommerce .select2-container--open .select2-selection--single { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
.select2-container .select2-dropdown { border: 1px solid var(--color-ink); border-radius: 0; box-shadow: var(--shadow-panel); font-size: var(--text-small); }
.select2-container .select2-search--dropdown { padding: var(--space-2xs); }
.select2-container .select2-search--dropdown .select2-search__field { min-height: 2.25rem; padding: var(--space-3xs) var(--space-2xs); border: 1px solid var(--color-field-border); border-radius: 0; }
.select2-container .select2-results__option { margin: 0; padding: var(--space-2xs) var(--space-xs); color: var(--color-ink); }
.select2-container--default .select2-results__option--highlighted[aria-selected],
.select2-container--default .select2-results__option--highlighted[data-selected] { background: var(--color-paper-light); color: var(--color-ink); }
.select2-container--default .select2-results__option[aria-selected="true"],
.select2-container--default .select2-results__option[data-selected="true"] { background: var(--color-paper); color: var(--color-ink); }

/* The order summary: each item is a line with its photo, name, quantity and options on the left and its total on
   the right (the photo is added in includes/woocommerce/woocommerce.php). The totals under them match the basket's. */
.woocommerce table.woocommerce-checkout-review-order-table {
  & thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  & tbody tr { align-items: flex-start; }
  & tbody tr:first-child { padding-top: 0; }
  & tbody td.product-name { position: relative; flex: 1; min-width: 0; min-height: 3.5rem; padding-left: calc(3.5rem + var(--space-s)); font-size: var(--text-small); line-height: var(--leading-snug); text-align: left; }
  & td.product-name .product-thumbnail { position: absolute; top: 0; left: 0; width: 3.5rem; }
  & td.product-name .product-thumbnail img { display: block; width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--color-line); border-radius: var(--radius); object-fit: cover; }
  & td.product-name .product-quantity { color: var(--color-text); font-weight: var(--weight-normal); white-space: nowrap; }
  & tbody td.product-total { font-size: var(--text-small); white-space: nowrap; }
}

/* Payment: each method is a white bordered row with its radio; the chosen one has a dark border and shows its
   details under the name */
.woocommerce-checkout #order_review .woocommerce-checkout-payment__title { margin-bottom: var(--space-xs); font-size: var(--text-h3); line-height: var(--leading-heading); letter-spacing: normal; }
.woocommerce-checkout #payment {
  border-radius: 0; background: transparent;
  & ul.payment_methods { display: grid; gap: var(--space-2xs); margin: 0 0 var(--space-s); padding: 0; border: 0; &::before, &::after { content: none; } }
  & ul.payment_methods li {
    display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0 var(--space-s); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-white); line-height: var(--leading-snug); /* WooCommerce sets 2 */
    &:has(> input:checked) { border-color: var(--color-ink); }
    &:has(> input:focus-visible) { outline: var(--focus-width) solid var(--color-focus); outline-offset: var(--focus-offset); }
  }
  /* "No payment methods available": the notice alone, not a row round it */
  & ul.payment_methods li:not(:has(> input)) { display: block; padding: 0; border: 0; background: none; & > * { margin: 0; } }
  & ul.payment_methods li > input { margin: 0; &:focus-visible { outline: none; box-shadow: none; } } /* the row shows focus */
  & ul.payment_methods li > label { flex: 1; min-width: 0; padding: calc((var(--target-size) - 1lh) / 2) 0 calc((var(--target-size) - 1lh) / 2) var(--space-2xs); color: var(--color-ink); cursor: pointer; }
  & ul.payment_methods li > label img { float: right; max-height: 1.5rem; margin: 0 0 0 var(--space-3xs); }
  & div.payment_box {
    flex: 0 0 100%; margin: 0; padding: var(--space-xs) 0 var(--space-s); border-top: 1px solid var(--color-line); border-radius: 0; background: none; color: var(--color-text); font-size: var(--text-small); line-height: var(--leading-snug);
    &::before { content: none; }
    & p:last-child { margin-bottom: 0; }
  }
  & div.place-order { margin: 0; padding: 0; }
  & #place_order { display: flex; width: 100%; min-height: var(--target-size); margin-top: var(--space-s); padding: var(--button-padding); font-size: var(--text-button); line-height: var(--leading-tight); float: none; } /* WooCommerce makes it bigger */
}
.woocommerce .woocommerce-terms-and-conditions-wrapper {
  font-size: var(--text-small); line-height: var(--leading-snug);
  & .woocommerce-privacy-policy-text p { margin: 0 0 var(--space-2xs); }
  & .form-row { margin: 0; }
}
/* Links in WooCommerce's text look like links in .prose (type.css) */
.woocommerce :is(.woocommerce-privacy-policy-link, .woocommerce-terms-and-conditions-link, .lost_password a, .showcoupon, .showlogin) {
  color: var(--color-ink); text-decoration: underline; text-decoration-thickness: 1px;
  &:hover { text-decoration-thickness: 2px; }
}
/* The forms that open under "Have a coupon?" and "Returning customer?", and the account's login and register forms:
   a bordered panel */
.woocommerce form.checkout_coupon, .woocommerce form.login, .woocommerce form.register {
  margin: 0 0 var(--space-m); padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); text-align: left;
  @media (width < 40rem) { padding: var(--space-s); }
  & > p:not(.form-row, .lost_password) { margin: 0 0 var(--space-s); font-size: var(--text-small); line-height: var(--leading-snug); }
  & > :last-child, & > p:last-of-type { margin-bottom: 0; }
}
.woocommerce-checkout :is(form.checkout_coupon, form.woocommerce-form-login) { max-width: var(--measure); }
/* The coupon field beside its button */
.woocommerce form.checkout_coupon {
  grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2xs);
  & .form-row { margin: 0; }
  & .button { width: 100%; }
}
/* A refused coupon's message, under the field (basket and checkout) */
.woocommerce .coupon-error-notice { flex: 0 0 100%; grid-column: 1 / -1; margin: 0; color: var(--color-error); font-size: var(--text-small); line-height: var(--leading-snug); }

/* ---------------------------------------------------------------- order received and order details */

/* "Thank you. Your order has been received." then the order's number, date, total and payment method as a row of boxes */
.woocommerce .woocommerce-thankyou-order-received { margin-bottom: var(--space-m); color: var(--color-ink); font-size: var(--text-lead); line-height: var(--leading-snug); }
.woocommerce ul.order_details {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: var(--space-2xs); margin: 0 0 var(--space-l); padding: 0; list-style: none;
  &::before, &::after { content: none; }
  & li {
    float: none; margin: 0; padding: var(--space-s); border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--shop-panel-light);
    color: var(--color-text-on-paper); font-size: var(--text-xsmall); line-height: var(--leading-snug); letter-spacing: var(--tracking-label); text-transform: uppercase;
  }
  & li strong { display: block; margin-top: var(--space-3xs); color: var(--color-ink); font-size: var(--text-base); font-weight: var(--weight-normal); letter-spacing: 0; text-transform: none; overflow-wrap: anywhere; }
}
/* The order number, date and status in "Order #123 was placed on…": dark text, not a yellow highlight */
.woocommerce mark { background: none; color: var(--color-ink); font-weight: var(--weight-bold); }
.woocommerce :is(.woocommerce-order-details, .woocommerce-customer-details, .woocommerce-order-downloads) { margin: var(--space-l) 0 0; }
.woocommerce :is(.woocommerce-order-details__title, .woocommerce-column__title, .woocommerce-order-downloads__title, .woocommerce-bacs-bank-details h2, .wc-bacs-bank-details-heading),
.woocommerce-account .woocommerce-MyAccount-content :is(h2, h3) { margin-bottom: var(--space-s); font-size: var(--text-h3); line-height: var(--leading-heading); letter-spacing: normal; }
.woocommerce table.order_details :is(td.product-total, tfoot td) { text-align: right; }
.woocommerce table.order_details .product-quantity { color: var(--color-text); font-weight: var(--weight-normal); }
.woocommerce .woocommerce-customer-details address,
.woocommerce .woocommerce-customer-details :is(.woocommerce-customer-details--phone, .woocommerce-customer-details--email) { padding-left: 0; &::before { content: none; } }
.woocommerce .woocommerce-customer-details address { padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); }
.woocommerce .woocommerce-customer-details address p { margin: var(--space-2xs) 0 0; }
.woocommerce .woocommerce-columns--addresses { gap: var(--space-m); }
/* An order's notes ("Order updates") */
.woocommerce ol.woocommerce-OrderUpdates { margin: 0 0 var(--space-l); padding: 0; list-style: none; & li { padding-block: var(--space-xs); border-bottom: 1px solid var(--color-line); } & .meta { font-size: var(--text-small); } }

/* ---------------------------------------------------------------- my account */

.woocommerce-account .woocommerce {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-l) var(--space-xl);
  &::before, &::after { content: none; }
  @media (min-width: 48rem) { grid-template-columns: 14rem minmax(0, 1fr); align-items: start; }
  & > .woocommerce-notices-wrapper { grid-column: 1 / -1; margin-bottom: calc(var(--space-l) * -1 + var(--space-2xs)); }
  & > .woocommerce-notices-wrapper > :last-child { margin-bottom: 0; }
}
/* Signed out: one column of fields wide (--form-width) for the login, lost password and reset password forms;
   wider when the register form sits beside the login */
.woocommerce-account:not(.logged-in) .woocommerce {
  grid-template-columns: minmax(0, 1fr); row-gap: 0; max-width: var(--form-width);
  &:has(> .u-columns) { max-width: calc(var(--form-width) * 2 + var(--space-xl)); }
  & > .woocommerce-notices-wrapper { margin-bottom: 0; }
  & > .woocommerce-notices-wrapper > :last-child { margin-bottom: var(--space-m); }
  & > :is(p, .woocommerce-message, .woocommerce-info) { margin-bottom: var(--space-m); }
}
.woocommerce .u-columns.col2-set { gap: var(--space-l) var(--space-xl); @media (min-width: 48rem) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* WooCommerce's h2s under the page title ("Cart totals", "Login", "Register"): the h3 style */
.woocommerce :is(.cart_totals > h2, .u-columns h2), .woocommerce-account .woocommerce > h2 { font-size: var(--text-h3); line-height: var(--leading-heading); letter-spacing: normal; }
.woocommerce .u-columns h2, .woocommerce-account .woocommerce > h2 { margin-bottom: var(--space-s); }
.woocommerce form.login .form-row, .woocommerce form.register .form-row { margin-bottom: var(--form-gap); }
/* The login form's last rows: "Remember me", then the button with "Lost your password?" beside it */
.woocommerce form.login .form-row:has(.woocommerce-form-login__rememberme) { display: grid; justify-items: start; gap: var(--space-2xs); margin-bottom: 0; }
.woocommerce form.login .woocommerce-form-login__rememberme { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: var(--target-size); margin: 0; color: var(--color-ink); font-size: var(--text-small); cursor: pointer; }
.woocommerce form.login .woocommerce-form-login__submit { float: none; margin: 0; min-width: var(--button-min-width); }
.woocommerce form.login .lost_password { margin: var(--space-s) 0 0; font-size: var(--text-small); }
@media (pointer: coarse) { .woocommerce form.login .lost_password a { display: inline-block; padding-block: max(0px, (var(--target-size) - 1lh) / 2); } } /* 44px tall to tap */
.woocommerce form.register .woocommerce-privacy-policy-text { font-size: var(--text-small); line-height: var(--leading-snug); & p { margin: 0 0 var(--space-s); } }
.woocommerce form.register .woocommerce-form-register__submit { min-width: var(--button-min-width); }
/* Lost password and reset password: the field under its intro, one column */
.woocommerce form.lost_reset_password {
  & > p:not(.form-row) { margin: 0 0 var(--space-m); }
  & > .form-row { grid-column: 1 / -1; }
  & > .form-row:last-of-type { margin-bottom: 0; }
  & .button { min-width: var(--button-min-width); }
}

/* The account menu: a list with a line under each link and the current page in bold with a dark edge. On phones
   it is one row that scrolls sideways, so the page's content starts near the top. */
.woocommerce-account .woocommerce-MyAccount-navigation {
  float: none; width: auto; min-width: 0;
  & ul { margin: 0; padding: 0; border-top: 1px solid var(--color-line); list-style: none; }
  & li { border-bottom: 1px solid var(--color-line); }
  & a { display: block; padding: var(--space-xs) var(--space-s); border-left: 2px solid transparent; color: var(--color-text); text-decoration: none; &:hover { background: var(--color-paper-light); color: var(--color-ink); } }
  & li.is-active a { border-left-color: var(--color-ink); background: var(--color-paper-light); color: var(--color-ink); font-weight: var(--weight-bold); }
  @media (width < 48rem) {
    & ul { display: flex; gap: var(--space-2xs); margin-inline: calc(var(--wrap-gutter) * -1); padding: var(--focus-width) var(--wrap-gutter); border: 0; overflow-x: auto; scrollbar-width: none; }
    & li { flex: none; border: 0; }
    & a { display: flex; align-items: center; min-height: var(--target-size); padding: 0 var(--space-s); border: 1px solid var(--color-line); border-radius: var(--radius); font-size: var(--text-small); white-space: nowrap; }
    & li.is-active a { border-color: var(--color-ink); }
  }
}
.woocommerce-account .woocommerce-MyAccount-content {
  float: none; width: auto; min-width: 0;
  & > p { margin: 0 0 var(--space-s); }
  & > p a, & .woocommerce-Address-title a { color: var(--color-ink); text-decoration: underline; text-decoration-thickness: 1px; &:hover { text-decoration-thickness: 2px; } }
  & > form { max-width: var(--measure); }
  & > .woocommerce-notices-wrapper > :last-child { margin-bottom: var(--space-m); }
  /* "Password change" in the account details form: a heading over its fields, not a boxed fieldset */
  & fieldset { min-width: 0; margin: var(--space-s) 0 0; padding: 0; border: 0; }
  & fieldset legend { margin-bottom: var(--space-s); padding: 0; color: var(--color-ink); font-size: var(--text-h3); line-height: var(--leading-heading); }
  & form .button { min-width: var(--button-min-width); }
}
/* The dashboard's links to the account's pages (includes/woocommerce/woocommerce.php): bordered cards, like product cards */
.woocommerce .account-links { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: var(--space-s); margin: var(--space-m) 0 0; padding: 0; list-style: none; }
.woocommerce .account-links__link {
  display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: start; gap: var(--space-3xs) var(--space-s); height: 100%; padding: var(--space-m);
  border: 1px solid var(--color-line); border-radius: var(--radius); background: var(--color-white); color: var(--color-text); text-decoration: none;
  transition: border-color var(--transition), background-color var(--transition);
  & .icon { grid-row: 1 / span 2; margin-top: 0.125rem; color: var(--color-ink); }
  &:hover { border-color: var(--color-ink); background: var(--color-paper-light); }
}
.woocommerce .account-links__title { color: var(--color-ink); line-height: var(--leading-snug); }
.woocommerce .account-links__text { font-size: var(--text-small); line-height: var(--leading-snug); }

/* Orders: the "View" buttons sit in a row, and "Previous" and "Next" under the table */
.woocommerce .woocommerce-orders-table__cell-order-actions { text-align: right; & .button { margin: var(--space-3xs) 0 var(--space-3xs) var(--space-3xs); } }
.woocommerce .woocommerce-orders-table__cell-order-number a { text-decoration: underline; text-decoration-thickness: 1px; }
.woocommerce-account .woocommerce-pagination { display: flex; justify-content: space-between; gap: var(--space-s); }

/* Addresses: a bordered card each, with "Edit" beside the title */
.woocommerce .u-columns.woocommerce-Addresses { gap: var(--space-s); margin-top: var(--space-m); @media (min-width: 64rem) { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.woocommerce .woocommerce-Address { padding: var(--space-m); border: 1px solid var(--color-line); border-radius: var(--radius); }
.woocommerce-account .addresses .woocommerce-Address-title {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: var(--space-3xs) var(--space-s); margin-bottom: var(--space-2xs);
  &::before, &::after { content: none; }
  & :is(h2, h3) { float: none; margin: 0; }
  & .edit { float: none; font-size: var(--text-small); }
}
.woocommerce address { font-style: normal; line-height: var(--leading); }
