/**
 * WooCommerce pages — Cart (/basket/) and Checkout (/purchase/).
 *
 * Loaded conditionally via inc/enqueue.php on is_cart() || is_checkout() ||
 * is_account_page(). Live measurements captured 2026-05-29 with
 * chrome-devtools-mcp on https://sterretroquay.com/purchase/.
 *
 * Live design summary (the live site uses Bricks elements to compose the
 * checkout into 2 columns and the cart page is essentially blank — users
 * are funneled through the slide-out mini-cart panel instead):
 *   - Cart page (/basket/): just an <h1>Basket</h1>, no cart contents
 *   - Checkout page (/purchase/): standard WC form, minimal custom styling,
 *     light-grey "Complete Purchase" button (matches the mini-cart button)
 *
 * Local renders the same pages through index.php fallback (no dedicated
 * page-purchase.php / page-basket.php template) so the markup we get is
 * <main><article><h2>{title}</h2>{the_content}</article></main> with WC
 * shortcodes expanded inside the_content().
 *
 * Scope: this stylesheet only fixes the visible problems that block the
 * page from being presentable — header clearance, notice styling, button
 * theming, basic form input typography. Pixel-perfect parity with live's
 * Bricks-composed layout is deferred until the checkout page is finalized
 * on live (currently incomplete per Tom).
 */

/* === Header clearance for WC pages ===
   index.php renders <main> with no padding, so content collides with the
   fixed header. Push the main down by the same offset other page templates
   use (--header-offset-desktop / --header-offset-mobile from tokens.css). */
body.woocommerce-page main {
  padding-top: var(--header-offset-desktop);
  padding-left: var(--Space-m);
  padding-right: var(--Space-m);
  padding-bottom: var(--Space-2xl);
  max-width: 144rem;                                      /* 1440px — site container width */
  margin: 0 auto;
  min-height: calc(100vh - 30rem);                        /* keeps footer off-content */
}

@media (max-width: 767px) {
  body.woocommerce-page main {
    padding-top: var(--header-offset-mobile);
    padding-left: var(--Space-s);
    padding-right: var(--Space-s);
  }
}

/* === Page title (rendered as <h2> in index.php fallback) ===
   Cart page (/basket/) keeps its "Basket" title — clean sans-serif
   (--font-body); Quast is reserved for the logo. Matches live. */
body.woocommerce-cart main > article > h2 {
  font-family: var(--font-body);
  font-size: var(--heading-l);                            /* big presence — matches live size */
  font-weight: 400;
  line-height: 1.1;
  color: var(--text-primary);
  text-transform: capitalize;
  margin: 0 0 var(--Space-l);
}

/* Checkout page (/purchase/) hides the title — live shows no title above the
   checkout form. Compensate for its removed vertical footprint with a top
   margin on the form so "Delivery Details" stays roughly where it was. */
body.woocommerce-checkout main > article > h2 {
  display: none;
}

body.woocommerce-checkout form.checkout {
  margin-top: var(--Space-xl);                            /* ~64px — replaces hidden title's footprint */
}

/* === WC notices ===
   Default WC ships a green ribbon for success, red for errors, blue for
   info — all with a "Purchase Overview" button floated right. We keep the
   button but rein in the colors/padding to match the theme. */
body.woocommerce-page .woocommerce-notices-wrapper {
  margin: 0 0 var(--Space-m);
}

body.woocommerce-page .woocommerce-message,
body.woocommerce-page .woocommerce-error,
body.woocommerce-page .woocommerce-info {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--Space-s);
  margin: 0 0 var(--Space-xs);
  padding: var(--Space-s) var(--Space-m);
  font-family: var(--font-body);
  font-size: var(--body-s);                               /* 13px — readable but reserved */
  line-height: 1.5;
  border: 1px solid var(--color-surface-d-1);
  border-left-width: 3px;
  border-radius: var(--Radius-2xs);
  list-style: none;
}

body.woocommerce-page .woocommerce-message {
  background: var(--color-surface-l-9);
  color: var(--text-primary);
  border-left-color: var(--color-success);
}

body.woocommerce-page .woocommerce-error {
  background: var(--color-surface-l-9);
  color: var(--text-primary);
  border-left-color: var(--color-primary);                /* theme red */
}

body.woocommerce-page .woocommerce-info {
  background: var(--color-surface-l-9);
  color: var(--text-primary);
  border-left-color: var(--text-primary-l-3);
}

body.woocommerce-page .woocommerce-error li,
body.woocommerce-page .woocommerce-message li,
body.woocommerce-page .woocommerce-info li {
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--Space-s);
  width: 100%;
}

/* The "Purchase Overview" button inside notices — float-right via margin-left:auto */
body.woocommerce-page .woocommerce-message .button,
body.woocommerce-page .woocommerce-error .button,
body.woocommerce-page .woocommerce-info .button {
  margin-left: auto;
}

/* === Two-column checkout layout ===
   form-checkout.php (theme override) renders two direct children of
   form.checkout:
     #customer_details      — .col2-set (delivery fields + order notes)
     .checkout-order-summary — wraps "Your order" heading + #order_review
   CSS Grid puts customer details on the LEFT and the order summary on the
   RIGHT. align-items:start so the summary tops out level with the form.
   Because the left column is taller, its grid row is tall — which gives the
   sticky summary room to travel (see below). */
body.woocommerce-checkout form.checkout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-column-gap: var(--Space-l);                        /* ~50px gutter between columns */
  align-items: start;
}

/* Left column: customer details + order notes. flex-column on .col2-set
   stacks .col-1 (delivery details) above .col-2 (order notes).
   NOTE: no flex `gap` here — col-1 leads with a 0-height
   <wc-order-attribution-inputs> node, and a flex gap pushed the whole
   column down by one gap-step (misaligning "Delivery Details" against
   "Your order"). We separate col-1 / col-2 with an explicit margin-top on
   col-2 instead, so col-1 tops out flush with the grid row. */
body.woocommerce-checkout #customer_details.col2-set {
  grid-column: 1;
  display: flex;
  flex-direction: column;
}

body.woocommerce-checkout .col2-set .col-1,
body.woocommerce-checkout .col2-set .col-2 {
  width: 100%;
  max-width: none;
  float: none;                                            /* WC default floats these — undo */
}

body.woocommerce-checkout .col2-set .col-2 {
  margin-top: var(--Space-m);                             /* gap between delivery fields + order notes */
}

/* The empty .woocommerce-shipping-fields div (shipping is disabled) leaves
   no visible gap, but the .woocommerce-additional-fields with order notes
   stays in col-2 and naturally renders below col-1. */
body.woocommerce-checkout .woocommerce-shipping-fields:empty {
  display: none;
}

/* Right column: the order summary wrapper. The grid's align-items:start tops
   it out level with the delivery-details column. */
body.woocommerce-checkout .checkout-order-summary {
  grid-column: 2;
}

body.woocommerce-checkout #order_review_heading {
  margin: 0 0 var(--Space-s);
}

/* On mobile the grid collapses to a single column; the summary sits below
   the form with a little breathing room. */
@media (max-width: 767px) {
  body.woocommerce-checkout form.checkout {
    grid-template-columns: 1fr;
    grid-column-gap: 0;
  }
  body.woocommerce-checkout #customer_details.col2-set,
  body.woocommerce-checkout .checkout-order-summary {
    grid-column: 1;
  }
  body.woocommerce-checkout .checkout-order-summary {
    margin-top: var(--Space-l);
  }
}

/* === Review order table — thumbnails (template override) ===
   /woocommerce/checkout/review-order.php adds a .product-thumbnail cell
   before the product-name cell. Size it to 60×60 to match mini-cart. */
body.woocommerce-checkout .woocommerce-checkout-review-order-table .product-thumbnail {
  width: 6rem;                                            /* 60px column */
  padding: var(--Space-2xs);
  vertical-align: middle;
}

body.woocommerce-checkout .review-order-thumbnail {
  width: 6rem;
  height: 6rem;
  object-fit: cover;
  display: block;
  border-radius: var(--Radius-2xs);
}

/* Header cell over the thumbnail column stays empty/narrow */
body.woocommerce-checkout .woocommerce-checkout-review-order-table thead .product-thumbnail {
  background: transparent;
}

/* === Form layout ===
   WC checkout uses <p class="form-row">… we just normalize spacing + typography. */
body.woocommerce-checkout .form-row {
  margin: 0 0 var(--Space-s);
}

body.woocommerce-checkout label {
  display: block;
  margin-bottom: var(--Space-3xs);
  font-family: var(--font-body);
  font-size: var(--body-xs);                              /* 9px — matches mini-cart label scale */
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-primary);
}

body.woocommerce-checkout .required {
  color: var(--color-primary);
  text-decoration: none;
}

body.woocommerce-checkout input[type="text"],
body.woocommerce-checkout input[type="email"],
body.woocommerce-checkout input[type="tel"],
body.woocommerce-checkout input[type="password"],
body.woocommerce-checkout input[type="number"],
body.woocommerce-checkout select,
body.woocommerce-checkout textarea {
  width: 100%;
  padding: var(--Space-2xs) var(--Space-xs);
  font-family: var(--font-body);
  font-size: var(--body-s);                               /* 13px */
  line-height: 1.4;
  color: var(--text-primary);
  background: var(--color-surface-l-9);
  border: 1px solid var(--color-surface-d-1);
  border-radius: var(--Radius-2xs);
  transition: border-color var(--transition-fast);
}

body.woocommerce-checkout input[type="text"]:focus,
body.woocommerce-checkout input[type="email"]:focus,
body.woocommerce-checkout input[type="tel"]:focus,
body.woocommerce-checkout input[type="password"]:focus,
body.woocommerce-checkout input[type="number"]:focus,
body.woocommerce-checkout select:focus,
body.woocommerce-checkout textarea:focus {
  outline: none;
  border-color: var(--text-primary-l-3);
}

/* "Deliver to a different address?" + Order notes section headings */
body.woocommerce-checkout h3 {
  font-family: var(--font-body);
  font-size: var(--body-m);                               /* 16px */
  font-weight: 700;
  margin: var(--Space-m) 0 var(--Space-s);
  color: var(--text-primary);
}

body.woocommerce-checkout .woocommerce-billing-fields h3 {
  margin-top: 0;
}

/* === Order summary table === */
body.woocommerce-checkout .shop_table {
  width: 100%;
  margin: 0 0 var(--Space-m);
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: var(--body-s);                               /* 13px */
}

body.woocommerce-checkout .shop_table th,
body.woocommerce-checkout .shop_table td {
  padding: var(--Space-s) var(--Space-xs);
  text-align: left;
  border-bottom: 1px solid var(--color-surface-d-1);
}

body.woocommerce-checkout .shop_table th {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: var(--body-xs);                              /* 9px header */
  color: var(--text-primary);
}

body.woocommerce-checkout .shop_table td {
  color: var(--text-primary);
}

body.woocommerce-checkout .shop_table .order-total td,
body.woocommerce-checkout .shop_table .order-total th {
  font-weight: 700;
  border-bottom: 0;
}

body.woocommerce-checkout .shop_table .product-name {
  color: var(--text-primary);
}

body.woocommerce-checkout .shop_table .amount {
  color: var(--text-primary);
}

/* === Payment area wrapper ===
   WC ships .woocommerce-checkout-payment with a default lavender/grey
   background that clashes with the theme. Strip it to inherit the page bg
   and add subtle padding. */
body.woocommerce-checkout #payment,
body.woocommerce-checkout .woocommerce-checkout-payment {
  background: transparent;
  padding: var(--Space-m) 0 0;
  margin: 0;
  border: 0;
  border-radius: 0;
}

/* === Payment methods === */
body.woocommerce-checkout .wc_payment_methods {
  list-style: none;
  padding: 0;
  margin: 0 0 var(--Space-m);
}

body.woocommerce-checkout .wc_payment_method {
  padding: var(--Space-s) 0;
  border-bottom: 1px solid var(--color-surface-d-1);
}

body.woocommerce-checkout .wc_payment_method:last-child {
  border-bottom: 0;
}

body.woocommerce-checkout .wc_payment_method label {
  display: inline-flex;
  align-items: center;
  gap: var(--Space-2xs);
  margin: 0;
  font-size: var(--body-s);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
  cursor: pointer;
}

/* === Buttons ===
   The "Complete Purchase" button (#place_order, .button.alt) needs to match
   the mini-cart's "Proceed to Payment" button — light-grey bg, dark text,
   uppercase. Default WC ships this in violet rgb(127,84,179) — override
   site-wide for any WC button with .alt class. */
body.woocommerce-page .button,
body.woocommerce-page button[type="submit"],
body.woocommerce-page #place_order {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20rem;                                       /* 200px — matches mini-cart Proceed to Payment */
  height: 4rem;                                           /* 40px */
  padding: 0 1.5rem;                                      /* 15px — matches mini-cart */
  background: var(--color-surface-d-1);                   /* rgb(225,225,225) — light grey */
  color: var(--text-primary);                             /* rgb(62,62,59) */
  font-family: var(--font-body);
  font-size: var(--body-xs);                              /* 9px */
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  border: 0;
  border-radius: var(--Radius-2xs);                       /* 8.5px */
  cursor: pointer;
  transition: background var(--transition-fast), color var(--transition-fast);
}

body.woocommerce-page .button:hover,
body.woocommerce-page button[type="submit"]:hover,
body.woocommerce-page #place_order:hover {
  background: var(--text-primary);
  color: var(--color-surface-l-9);
}

/* "Place order" / "Complete Purchase" deserves a touch more weight — center
   it within its containing block (live shows it centered under the order
   summary). */
body.woocommerce-checkout .place-order {
  margin-top: var(--Space-m);
  text-align: center;
}

body.woocommerce-checkout #place_order {
  margin: 0 auto;
}

/* === Privacy policy text === */
body.woocommerce-checkout .woocommerce-privacy-policy-text {
  margin: var(--Space-s) 0;
  font-family: var(--font-body);
  font-size: var(--body-xs);
  line-height: 1.6;
  color: var(--text-primary-l-2);
}

body.woocommerce-checkout .woocommerce-privacy-policy-text a {
  color: var(--text-primary);
  text-decoration: underline;
}

/* === Cart page (essentially blank on live) ===
   /basket/ has just the <h1>/<h2> title and no further content on live.
   Local mirrors that — give the title some breathing room and call it done.
   The page-basket class is set by WP's body_class() filter from the page
   slug. */
body.woocommerce-cart main > article {
  min-height: 40rem;                                      /* keeps the page from feeling collapsed */
}
