/*
 * ACAD1 Review Center — WooCommerce override layer (classic)
 * child-theme-guide.md §8 "40-woocommerce.css — the override layer",
 * verbatim except for the two departures below.
 *
 *   1. Pre-flight token substitution noted in 00-tokens.css: guide's
 *      invalid-bg literal -> var(--a1-invalid-bg) (.woocommerce-error;
 *      .woocommerce form .form-row.woocommerce-invalid input.input-text).
 *   2. Task 7 addition, not in §8 at all: the "Grid reset for the overridden
 *      loop wrapper" block near the bottom of this file, which the
 *      woocommerce/loop/loop-start.php override does not work without. It
 *      carries its own comment; read it before changing the loop markup.
 *
 * Scope note (docs/research/woocommerce-brief.md §5): this file targets
 * WooCommerce's CLASSIC cart/checkout/product markup (shortcode-rendered,
 * server-side PHP templates: `.woocommerce table.shop_table`, `#order_review`,
 * `#payment ul.payment_methods`, etc). On a store using the block Cart/
 * Checkout, none of these selectors match anything — that markup is styled
 * separately in 45-woocommerce-blocks.css. The two files are mutually
 * exclusive by rendering path and do not conflict.
 *
 * `!important` is permitted here only where Woo ships inline or
 * higher-specificity rules (guide §0.6 / Global Constraint 7).
 */

/* ── buttons ─────────────────────────────────────────────── */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce a.button.alt,
.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce #respond input#submit.alt,
.woocommerce .widget_shopping_cart a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--a1-font); font-weight: 700; font-size: var(--a1-body-sm);
  line-height: 1.2; text-transform: none; letter-spacing: 0;
  min-height: var(--a1-target-min); padding: 13px 22px;
  background: var(--a1-accent); color: var(--a1-contrast);
  border: 1px solid transparent; border-radius: var(--a1-r-btn);
  text-shadow: none; box-shadow: none;
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover,
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover {
  background: var(--a1-accent-lt); color: var(--a1-contrast);
}
.woocommerce a.button.disabled,
.woocommerce button.button:disabled,
.woocommerce button.button:disabled[disabled] {
  background: var(--a1-disabled-bg); color: var(--a1-disabled-fg); opacity: 1;
}
/* secondary actions: continue shopping, update cart, back to cart */
.woocommerce .cart .button[name="update_cart"],
.woocommerce .return-to-shop .button,
.woocommerce-cart .wc-backward .button {
  background: transparent; color: var(--a1-primary); border-color: var(--a1-primary);
}

/* ── price ───────────────────────────────────────────────── */
.woocommerce div.product p.price,
.woocommerce div.product span.price,
.woocommerce ul.products li.product .price {
  color: var(--a1-text); font-weight: 800; font-size: 28px;
  letter-spacing: -0.03em; font-variant-numeric: tabular-nums;
}
.woocommerce div.product p.price del,
.woocommerce ul.products li.product .price del { color: var(--a1-secondary); font-weight: 400; font-size: 0.6em; }
.woocommerce div.product p.price ins { text-decoration: none; }
.woocommerce .amount { font-variant-numeric: tabular-nums; }

/* ── notices ─────────────────────────────────────────────── */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.woocommerce-noreviews,
p.no-comments {
  background: var(--a1-surface); color: var(--a1-text);
  border: 1px solid var(--a1-border); border-top: 3px solid var(--a1-primary);
  border-radius: var(--a1-r-card);
  padding: var(--a1-s-4) var(--a1-s-5) var(--a1-s-4) var(--a1-s-5);
  font-size: var(--a1-body-sm);
}
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before { display: none; }
.woocommerce-message { border-top-color: var(--a1-accent); }
.woocommerce-error   { border-top-color: var(--a1-accent); background: var(--a1-invalid-bg); }
.woocommerce-error li { list-style: none; }

/* ── form fields (checkout, account, coupon) ─────────────── */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.woocommerce .select2-container .select2-selection--single,
.woocommerce-account input.input-text,
.woocommerce #coupon_code {
  width: 100%; font-family: var(--a1-font); font-size: var(--a1-body-sm);
  min-height: var(--a1-target-min); padding: 12px 13px;
  color: var(--a1-text); background: var(--a1-contrast);
  border: 1px solid var(--a1-border-strong); border-radius: var(--a1-r-input);
  box-shadow: none;
}
.woocommerce form .form-row input.input-text:focus-visible,
.woocommerce form .form-row select:focus-visible {
  border-color: var(--a1-accent); outline: 2px solid var(--a1-accent); outline-offset: 1px;
}
.woocommerce form .form-row label { font-size: var(--a1-kicker); font-weight: 700; letter-spacing: var(--a1-ls-kicker); text-transform: uppercase; color: var(--a1-secondary); }
.woocommerce form .form-row.woocommerce-invalid input.input-text { border-color: var(--a1-accent); background: var(--a1-invalid-bg); }
.woocommerce form .form-row .required { color: var(--a1-accent); text-decoration: none; }
.woocommerce .select2-container--default .select2-selection--single .select2-selection__arrow { height: 46px; }
.woocommerce .select2-dropdown { border-color: var(--a1-border-strong); border-radius: var(--a1-r-input); }
.woocommerce .select2-results__option--highlighted { background: var(--a1-accent) !important; }

/* ── quantity ────────────────────────────────────────────── */
.woocommerce .quantity .qty {
  min-height: var(--a1-target-min); width: 84px; padding: 12px 10px; text-align: center;
  font-family: var(--a1-font); font-variant-numeric: tabular-nums;
  border: 1px solid var(--a1-border-strong); border-radius: var(--a1-r-input);
  background: var(--a1-contrast); color: var(--a1-text);
}

/* ── variation form (tier / branch / session selectors) ──── */
.woocommerce div.product form.cart .variations { border: 0; margin-bottom: var(--a1-s-4); }
.woocommerce div.product form.cart .variations tr { display: flex; flex-direction: column; gap: 7px; margin-bottom: var(--a1-s-4); }
.woocommerce div.product form.cart .variations th,
.woocommerce div.product form.cart .variations td { display: block; padding: 0; border: 0; }
.woocommerce div.product form.cart .variations label {
  font-size: var(--a1-kicker); font-weight: 700; letter-spacing: var(--a1-ls-kicker);
  text-transform: uppercase; color: var(--a1-secondary);
}
.woocommerce div.product form.cart .variations select {
  width: 100%; min-height: var(--a1-target-min); padding: 12px 13px;
  border: 1px solid var(--a1-border-strong); border-radius: var(--a1-r-input);
  background: var(--a1-contrast); font-family: var(--a1-font); font-size: var(--a1-body-sm);
}
.woocommerce div.product form.cart .reset_variations { font-size: var(--a1-caption); color: var(--a1-accent); }
.woocommerce div.product .woocommerce-variation-price { margin-bottom: var(--a1-s-3); }

/* ── tabs → flush-left rules, no Woo bubbles ─────────────── */
.woocommerce div.product .woocommerce-tabs ul.tabs { padding: 0; margin: 0 0 var(--a1-s-6); display: flex; gap: var(--a1-s-5); flex-wrap: wrap; border-bottom: 1px solid var(--a1-border); }
.woocommerce div.product .woocommerce-tabs ul.tabs::before { display: none; }
.woocommerce div.product .woocommerce-tabs ul.tabs li {
  background: transparent; border: 0; border-radius: 0; margin: 0; padding: 0 0 12px;
}
.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none; }
/* The <li> carries the 12px bottom padding that offsets the active
   underline, so the anchor — the only thing that is actually clickable —
   was about 19px tall. Give the anchor the hit target itself (§7, §12);
   the underline offset on the <li> is unchanged. */
.woocommerce div.product .woocommerce-tabs ul.tabs li a {
  display: inline-flex; align-items: center;
  min-height: var(--a1-target-min); padding: 0;
  font-weight: 600; font-size: var(--a1-body-sm); color: var(--a1-secondary);
}
.woocommerce div.product .woocommerce-tabs ul.tabs li.active { border-bottom: 2px solid var(--a1-accent); }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active a { color: var(--a1-text); }

/* ── cart / checkout / order tables ──────────────────────── */
.woocommerce table.shop_table,
.woocommerce table.shop_attributes {
  width: 100%; border-collapse: collapse; table-layout: fixed;
  border: 1px solid var(--a1-border); border-radius: var(--a1-r-card);
  overflow: hidden; font-size: 14px;
}
.woocommerce table.shop_table thead tr { background: var(--a1-primary); }
.woocommerce table.shop_table th {
  text-align: left; padding: 13px 16px;
  font-size: var(--a1-kicker); font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--a1-contrast);
}
.woocommerce table.shop_table td {
  padding: 14px 16px; border-top: 0; border-bottom: 1px solid var(--a1-rule);
  font-variant-numeric: tabular-nums;
}
.woocommerce table.shop_table tbody tr:nth-child(even) { background: var(--a1-surface); }
.woocommerce table.shop_table tfoot td,
.woocommerce table.shop_table tfoot th { border-top: 2px solid var(--a1-border); font-weight: 700; }
/* Woo's own `.remove` is a 1em x 1em glyph — nowhere near §7's 48px floor.
   min-height/min-width beat Woo's width/height regardless of specificity
   (a min-* constraint is applied after the used width), so no !important is
   needed for the sizing; the colour pair keeps it, because Woo ships
   `color: red !important` on this element. */
.woocommerce table.shop_table .product-remove a.remove {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--a1-target-min); min-width: var(--a1-target-min);
  color: var(--a1-secondary) !important; font-weight: 400;
}
.woocommerce table.shop_table .product-remove a.remove:hover {
  background: var(--a1-accent) !important; color: var(--a1-contrast) !important;
}
.woocommerce-cart .cart-collaterals .cart_totals,
.woocommerce-checkout #order_review {
  background: var(--a1-surface); border: 1px solid var(--a1-border);
  border-radius: var(--a1-r-card); padding: var(--a1-s-6);
}
.woocommerce-checkout #payment { background: transparent; border-radius: 0; }
.woocommerce-checkout #payment ul.payment_methods {
  border-bottom: 1px solid var(--a1-border); padding: 0 0 var(--a1-s-4);
}
.woocommerce-checkout #payment ul.payment_methods li {
  background: var(--a1-contrast); border: 1px solid var(--a1-border);
  border-radius: var(--a1-r-btn); padding: 15px; margin-bottom: var(--a1-s-2); list-style: none;
}
.woocommerce-checkout #payment div.payment_box { background: var(--a1-surface); border-radius: var(--a1-r-btn); font-size: var(--a1-meta); }
.woocommerce-checkout #payment div.payment_box::before { display: none; }

/* ── My Account ──────────────────────────────────────────── */
.woocommerce-account .woocommerce-MyAccount-navigation ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.woocommerce-account .woocommerce-MyAccount-navigation li a {
  display: block; padding: 13px 16px; font-weight: 600; font-size: var(--a1-body-sm);
  color: var(--a1-secondary); text-decoration: none; border-radius: var(--a1-r-btn);
}
.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a { background: var(--a1-primary); color: var(--a1-contrast); }
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover { background: var(--a1-surface); color: var(--a1-text); }

/* ── loop cards (if the shop loop is ever used) ──────────── */
.woocommerce ul.products li.product {
  background: var(--a1-bg); border: 1px solid var(--a1-border);
  border-radius: var(--a1-r-card); padding: var(--a1-s-6); text-align: left;
}
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-size: var(--a1-h4); font-weight: 800; letter-spacing: -0.02em; padding: 0 0 var(--a1-s-2);
}
.woocommerce ul.products li.product a img { border-radius: var(--a1-r-img); margin-bottom: var(--a1-s-3); }

/* Grid reset for the overridden loop wrapper (Task 7).
   woocommerce/loop/loop-start.php adds the §4 `.a1-grid` classes to Woo's own
   `<ul class="products columns-N">` rather than replacing the element, so the
   loop items become grid items while still being `<li>` children of a real list
   (content-product.php emits them; a <div> wrapper would orphan them).
   woocommerce-layout.css, which is still enqueued, floats those items and pins a
   percentage width plus a right margin per `columns-N`. Grid ignores the float
   but honours both, so without this reset every cell is starved to ~22% of its
   track and offset by a gutter. The clearfix pseudo-elements have to go too —
   as children of a grid container they would occupy two real grid cells.
   `margin: 0` is only half a reset, and the more interesting half is a DESIGN
   CHANGE rather than a fix. Clearing the horizontal margin does belong with the
   width work — a grid item still honours it, so Woo's float gutter would offset
   every cell inside its own track, on top of the `gap`. But clearing the BOTTOM
   margin fixes nothing: it removes spacing that would simply stack on the row
   gap and make the rows airier than the columns. That is a deliberate choice —
   `gap` as the single source of spacing — and it is the reason to think twice
   before "restoring" this shorthand to something narrower.
   Scoped to `.a1-grid` so a loop rendered without the override is untouched.

   CASCADE — the honest version, because half of it is unverifiable from here.
   Against WooCommerce itself these rules win, but on TIE-BREAK, not on weight:
   Woo's per-column rule `.woocommerce ul.products.columns-4 li.product` and the
   override `.woocommerce ul.products.a1-grid li.product` are both (0,4,2) —
   EQUAL specificity — and equal specificity is decided by print order.
   `woocommerce-layout` is a declared dependency of `a1-woo` in inc/enqueue.php,
   so WP_Dependencies guarantees it prints first and these rules print last.
   That is why no `!important` is used against Woo.

   GENERATEPRESS IS A DIFFERENT MATTER AND IS NOT SETTLED HERE. GP ships its own
   WooCommerce stylesheet, and `a1-woo` does NOT declare it as a dependency:
   docs/research/wp-generatepress-brief.md §2 confirms only `generate-style` and
   `generate-child` as documented handles and explicitly says not to invent one
   for GP's additional sheets. So GP's Woo sheet may print before or after this
   file — unknown from source. If GP sets `display` or `grid-template-columns`
   on `.woocommerce ul.products` (0,2,1), it beats `.a1-grid` (0,1,0) on
   specificity regardless of order, and TWO things fail silently at once: the
   grid never activates, and the `.a1-grid--N` collapses in 50-responsive.css
   never apply either — while `float: none; width: auto` below still lands, so
   every product stacks full-width instead of falling back to Woo's float grid.
   Neither an invented handle nor blanket `!important` is an acceptable fix for
   a conflict nobody has observed yet. THE SHOP LOOP MUST BE INSPECTED IN A
   BROWSER on a real GP + Woo install before this is considered done; see
   acad1-child/woocommerce/README.md. If GP does win, the fix is a targeted
   `!important` on the two properties it actually sets — this file is one of the
   four where §0.6 permits that — or a dependency added once the real handle has
   been read out of `wp_styles()`. */
.woocommerce ul.products.a1-grid { margin: 0; padding: 0; list-style: none; }
.woocommerce ul.products.a1-grid::before,
.woocommerce ul.products.a1-grid::after { display: none; }
.woocommerce ul.products.a1-grid li.product {
  width: auto; margin: 0; float: none; clear: none;
}

/* ── shop-loop pagination ───────────────────────── */
/* Not in §8 — added by the final review pass. The product archive is a
   first-class page in this build (task 7 ships a woocommerce/loop/loop-start.php
   override), and §12 requires "no Woo default styling anywhere". Left
   unstyled, Woo's own pagination renders as its default pill list with its
   own greys and ~1em targets, which is exactly that failure. Tokens only,
   --a1-target-min on both axes so every page link clears §7's floor.

   Specificity note, same as the loop-grid block above: these selectors tie
   with WooCommerce's own (`.woocommerce nav.woocommerce-pagination ul li a`
   is (0,2,4) either way) and win on print order, because a1-woo declares
   woocommerce-general as a dependency. `span.current` adds a class and so
   beats the shared rule outright. No !important needed. */
.woocommerce nav.woocommerce-pagination { margin-top: var(--a1-s-8); text-align: center; }
.woocommerce nav.woocommerce-pagination ul {
  display: flex; flex-wrap: wrap; justify-content: center; gap: var(--a1-s-2);
  margin: 0; padding: 0; border: 0; list-style: none;
}
.woocommerce nav.woocommerce-pagination ul li { border: 0; margin: 0; padding: 0; overflow: visible; }
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--a1-target-min); min-width: var(--a1-target-min);
  padding: 0 var(--a1-s-3);
  font-family: var(--a1-font); font-size: var(--a1-body-sm); font-weight: 700;
  font-variant-numeric: tabular-nums; line-height: 1.2;
  color: var(--a1-secondary); background: transparent; text-decoration: none;
  border: 1px solid var(--a1-border); border-radius: var(--a1-r-btn);
}
.woocommerce nav.woocommerce-pagination ul li a:hover,
.woocommerce nav.woocommerce-pagination ul li a:focus {
  background: var(--a1-surface); color: var(--a1-text);
}
.woocommerce nav.woocommerce-pagination ul li span.current {
  background: var(--a1-primary); color: var(--a1-contrast); border-color: var(--a1-primary);
}

/* ── kill Woo's leftover decoration ──────────────────────── */
.woocommerce .woocommerce-breadcrumb { display: none; }
.woocommerce span.onsale { display: none; }
.woocommerce div.product .stock { color: var(--a1-accent); font-weight: 700; font-size: var(--a1-meta); }
.woocommerce .star-rating span::before { color: var(--a1-accent); }
.woocommerce-store-notice { background: var(--a1-primary); color: var(--a1-on-dark); }
