/* =================================================================
   TERRAPERENE — WooCommerce bridge
   Maps WooCommerce's native markup (loop, single, cart, checkout,
   account, notices) onto the theme's design tokens. The static page
   templates (shop/product/cart…) remain the visual reference; this
   file makes the *dynamic* Woo output match them.
   ================================================================= */

/* ---------- Header / footer logo guard ----------
   WooCommerce core (woocommerce-layout.css) ships a blanket
   `.woocommerce-page img { height: auto; max-width: 100% }`. Its specificity
   (0,1,1) outranks the theme's `.brand__logo` (0,1,0), so on every shop / cart /
   checkout / account page that rule strips the logo's fixed HEIGHT — and the
   logo is a 1000×195 SVG, so it balloons to ~5:1 and blows out the masthead.
   Restore only the height with a selector that outranks Woo's. Header and footer
   share `.brand__logo`.
   IMPORTANT: keep `max-width: 100%` (do NOT use `none`). The narrow mobile header
   (≤360px) relies on the logo being able to shrink to fit alongside the burger +
   action icons; pinning it to its full width pushed the cart icon off the edge. */
.woocommerce-page .brand__logo { height: 42px; width: auto; max-width: 100%; }
.woocommerce-page .header.is-scrolled .brand__logo { height: 35px; }
@media (max-width: 600px) { .woocommerce-page .brand__logo { height: 30px; } }

/* WooCommerce reuses the bare `cart` class on its add-to-cart form
   (form.cart) and the cart-page table (table.cart). The theme's slide-in
   cart drawer (style.css "Cart drawer") is also an unscoped
   .cart { position: fixed; visibility: hidden }, which would otherwise hide
   those Woo elements. Keep anything carrying `.cart` inside .woocommerce in
   normal, visible flow. (The drawer itself sits in the footer, outside
   .woocommerce, so it is unaffected.) */
.woocommerce form.cart,
.woocommerce table.cart { position: static; inset: auto; z-index: auto; visibility: visible; }

/* ---------- Product loop grid ---------- */
.woocommerce ul.products,
ul.products {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(1rem, 2.4vw, 1.8rem);
  margin: 0;
  padding: 0;
  list-style: none;
}
@media (min-width: 720px) { .woocommerce ul.products, ul.products { grid-template-columns: repeat(3, 1fr); } }
.woocommerce ul.products li.product,
ul.products li.product {
  margin: 0 !important;
  width: auto !important;
  float: none !important;
  list-style: none;
}
.woocommerce ul.products li.product::before { display: none; }
/* WooCommerce's clearfix ::before/::after on ul.products turn into stray grid
   cells (an empty first cell + a trailing one), pushing products into column 2.
   Remove them so the product grid fills from the top-left. */
.woocommerce ul.products::before,
.woocommerce ul.products::after,
ul.products::before,
ul.products::after { content: none; }

/* ---------- Prices (loop + single + cart) ---------- */
.woocommerce .price,
.product-card__foot .price,
.woocommerce-Price-amount { font-family: var(--font-display); }
.product-card__foot .price { color: var(--forest); font-size: 1.35rem; font-weight: 600; }
.woocommerce .price del,
.product-card__foot del { color: var(--ink-3); opacity: .8; font-weight: 400; margin-right: .35rem; }
.woocommerce .price ins,
.product-card__foot ins { text-decoration: none; color: var(--wheat-2); }
.woocommerce .price del .woocommerce-Price-amount { font-size: .85em; }

/* ---------- Star ratings ---------- */
.product-card__rating svg,
.psum__rating svg { width: 15px; height: 15px; color: var(--wheat); }

/* ---------- Buttons ---------- */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit,
.woocommerce .button {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--forest); color: var(--cream);
  font-family: var(--font-body, inherit); font-size: .9rem; font-weight: 500; letter-spacing: .02em;
  padding: .85rem 1.5rem; border: 0; border-radius: var(--r-pill);
  cursor: pointer; transition: background .25s var(--ease), transform .25s var(--ease);
  line-height: 1.1;
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce .button:hover { background: var(--forest-2, #21301f); transform: translateY(-2px); color: var(--cream); }
.woocommerce .button.alt,
.woocommerce #payment #place_order { background: var(--wheat-2); }
.woocommerce .button.alt:hover { background: var(--wheat); }
/* Single-product "Add to cart" matches the shop card (forest green); the gold
   primary style stays on checkout's "place order" and other .button.alt. */
.woocommerce .single_add_to_cart_button { background: var(--forest); color: var(--cream); border-color: var(--forest); }
.woocommerce .single_add_to_cart_button:hover,
.woocommerce .single_add_to_cart_button.alt:hover { background: var(--forest-2); color: var(--cream); }
.woocommerce a.button.wc-backward,
.woocommerce .button.wc-forward { background: transparent; color: var(--forest); border: 1px solid var(--line); }

/* ---------- Notices ---------- */
.woocommerce-message,
.woocommerce-info,
.woocommerce-error {
  border: 1px solid var(--line); border-left-width: 3px;
  background: var(--white); color: var(--ink);
  border-radius: var(--r-sm); padding: 1rem 1.2rem; margin: 0 0 1.5rem;
  list-style: none; box-shadow: var(--shadow-sm, 0 1px 2px rgba(0,0,0,.04));
}
.woocommerce-message { border-left-color: var(--moss); }
.woocommerce-info { border-left-color: var(--wheat); }
.woocommerce-error { border-left-color: #b04a3a; }
/* Drop WooCommerce's default icon-font glyph (the stray blue "ℹ" that overlaps
   the text on e.g. an empty category) — the theme uses the left accent instead. */
.woocommerce-message::before,
.woocommerce-info::before,
.woocommerce-error::before { content: none; display: none; }
.woocommerce-message .button,
.woocommerce-info .button,
.woocommerce-error .button { padding: .5rem 1rem; font-size: .82rem; }

/* ---------- Toolbar (result count + filters + ordering) ---------- */
.shop-toolbar .woocommerce-result-count { margin: 0; color: var(--ink-2); font-size: .9rem; }
.shop-toolbar .woocommerce-ordering { margin: 0; }
.shop-toolbar select,
.woocommerce form .form-row select,
.woocommerce .quantity input.qty {
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: .6rem 1rem; background: var(--white); color: var(--ink); font: inherit;
}

/* ---------- Quantity ---------- */
.woocommerce .quantity { display: inline-flex; }
.woocommerce .quantity input.qty { width: 4.5rem; text-align: center; border-radius: var(--r-pill); }

/* ---------- Pagination ---------- */
.woocommerce nav.woocommerce-pagination ul { border: 0; display: flex; gap: .4rem; justify-content: center; }
.woocommerce nav.woocommerce-pagination ul li { border: 0; }
.woocommerce nav.woocommerce-pagination ul li a,
.woocommerce nav.woocommerce-pagination ul li span {
  border: 1px solid var(--line); border-radius: var(--r-pill);
  min-width: 42px; height: 42px; display: grid; place-items: center; padding: 0; color: var(--ink);
}
.woocommerce nav.woocommerce-pagination ul li span.current,
.woocommerce nav.woocommerce-pagination ul li a:hover { background: var(--forest); color: var(--cream); border-color: var(--forest); }

/* Infinite scroll (theme-built, no plugin): loader shown while the next page of
   products is fetched and appended; the numbered pager above is hidden by JS. */
.shop-infinite { display: flex; justify-content: center; align-items: center; padding: 2.8rem 0 .5rem; min-height: 2rem; }
.shop-infinite__spinner { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--forest); opacity: 0; animation: tp-spin .7s linear infinite; transition: opacity .2s; }
.shop-infinite.is-loading .shop-infinite__spinner { opacity: 1; }
.shop-infinite__end { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
@keyframes tp-spin { to { transform: rotate(360deg); } }

/* ---------- Single product ---------- */
.woocommerce div.product { display: grid; gap: clamp(2rem, 5vw, 4rem); }
@media (min-width: 860px) { .woocommerce div.product { grid-template-columns: minmax(0,1.05fr) minmax(0,1fr); align-items: start; } }
.woocommerce div.product .woocommerce-product-gallery { margin: 0; }
.woocommerce div.product .woocommerce-product-gallery img { border-radius: var(--r-lg); }
.woocommerce div.product .product_title { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.8rem); color: var(--forest); margin: .3rem 0 .8rem; }
.woocommerce div.product p.price,
.woocommerce div.product span.price { color: var(--forest); font-size: 1.8rem; }
.woocommerce div.product .woocommerce-product-rating { margin-bottom: 1rem; }
.woocommerce div.product form.cart { margin: 1.6rem 0; display: flex; flex-wrap: wrap; gap: .8rem; align-items: center; }
.woocommerce div.product form.cart .variations { width: 100%; }
.woocommerce div.product form.cart .variations select { width: 100%; margin-top: .3rem; }
.woocommerce div.product .product_meta { margin-top: 1.4rem; font-size: .85rem; color: var(--ink-2); display: flex; flex-direction: column; gap: .35rem; }

/* Tabs: span the full width under the two-column hero */
.woocommerce div.product .woocommerce-tabs { grid-column: 1 / -1; }
.woocommerce div.product .woocommerce-tabs ul.tabs { padding: 0; margin: 0 0 1.5rem; border-bottom: 1px solid var(--line); display: flex; gap: .5rem; flex-wrap: wrap; }
.woocommerce div.product .woocommerce-tabs ul.tabs::before { display: none; }
.woocommerce div.product .woocommerce-tabs ul.tabs li { background: none; border: 0; border-radius: 0; margin: 0; padding: 0; }
.woocommerce div.product .woocommerce-tabs ul.tabs li::before,
.woocommerce div.product .woocommerce-tabs ul.tabs li::after { display: none; }
.woocommerce div.product .woocommerce-tabs ul.tabs li a { padding: .8rem 1.2rem; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; }
.woocommerce div.product .woocommerce-tabs ul.tabs li.active a { color: var(--forest); border-bottom-color: var(--wheat); }
.woocommerce div.product .related,
.woocommerce div.product .upsells { grid-column: 1 / -1; }
.woocommerce div.product .related > h2,
.woocommerce div.product .upsells > h2 { font-family: var(--font-display); color: var(--forest); font-size: clamp(1.5rem, 3vw, 2rem); margin-bottom: 1.5rem; }

/* ---------- Tables (cart, order, account) ---------- */
.woocommerce table.shop_table {
  border: 1px solid var(--line); border-radius: var(--r-lg);
  border-collapse: separate; border-spacing: 0; overflow: hidden; background: var(--white);
}
.woocommerce table.shop_table th { background: var(--cream-2); color: var(--forest); font-weight: 600; font-size: .82rem; letter-spacing: .04em; text-transform: uppercase; padding: 1rem; }
.woocommerce table.shop_table td { padding: 1rem; border-top: 1px solid var(--line); }
.woocommerce table.shop_table img { width: 60px; border-radius: var(--r-sm); }
.woocommerce .cart_totals,
.woocommerce-checkout #order_review,
.woocommerce .woocommerce-order-details { border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.4rem, 3vw, 2rem); background: var(--white); }
.woocommerce .cart_totals h2,
.woocommerce-checkout h3 { font-family: var(--font-display); color: var(--forest); }
.wc-proceed-to-checkout .checkout-button { width: 100%; }

/* Cart line-items on phones. WooCommerce stacks .shop_table_responsive at
   <=768px on its own; this restyles that stack into the on-brand cards used
   by the static cart (assets/css/pages.css -> .cart-row): product as the
   header, price/quantity/subtotal as labelled lines, remove pinned top-right.
   Scoped to table.cart so checkout / order / account tables keep Woo's
   default responsive behaviour. Matches Woo's 768px breakpoint (not the
   static 600px) so the stacked range is never the generic Woo layout. */
@media (max-width: 768px) {
  .woocommerce table.cart.shop_table_responsive,
  .woocommerce table.cart.shop_table_responsive tbody { display: block; width: 100%; border: 0; background: transparent; overflow: visible; }
  .woocommerce table.cart.shop_table_responsive thead { display: none; }
  .woocommerce table.cart.shop_table_responsive tbody tr { display: block; }
  .woocommerce table.cart.shop_table_responsive tr.cart_item {
    position: relative; padding: 1.4rem 2.4rem 1.4rem 0; border-bottom: 1px solid var(--line);
  }
  .woocommerce table.cart.shop_table_responsive tr.cart_item td { width: auto; padding: 0; border: 0; text-align: left; }
  /* Header: thumbnail beside the product name (mirrors .cart-prod). */
  .woocommerce table.cart.shop_table_responsive td.product-thumbnail { float: left; width: 78px; margin: 0 1rem .2rem 0; }
  .woocommerce table.cart.shop_table_responsive td.product-thumbnail img {
    width: 78px; height: 78px; padding: 6px; object-fit: contain;
    background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm);
  }
  .woocommerce table.cart.shop_table_responsive td.product-name {
    display: flex; align-items: center; min-height: 78px; margin-bottom: .7rem; font-size: .95rem; font-weight: 500;
  }
  .woocommerce table.cart.shop_table_responsive td.product-thumbnail::before,
  .woocommerce table.cart.shop_table_responsive td.product-name::before { display: none; }
  /* Price / quantity / subtotal -> labelled lines (label from data-title). */
  .woocommerce table.cart.shop_table_responsive td.product-price,
  .woocommerce table.cart.shop_table_responsive td.product-quantity,
  .woocommerce table.cart.shop_table_responsive td.product-subtotal {
    clear: both; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .5rem 0;
  }
  .woocommerce table.cart.shop_table_responsive td.product-price::before,
  .woocommerce table.cart.shop_table_responsive td.product-quantity::before,
  .woocommerce table.cart.shop_table_responsive td.product-subtotal::before {
    content: attr(data-title); float: none;
    font-size: .72rem; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3);
  }
  /* Remove (x) pinned to the top-right of the card. */
  .woocommerce table.cart.shop_table_responsive td.product-remove { position: absolute; top: 1.4rem; right: 0; width: auto; margin: 0; }
  .woocommerce table.cart.shop_table_responsive td.product-remove::before { display: none; }
  /* Coupon + update-cart row stays a normal full-width block. */
  .woocommerce table.cart.shop_table_responsive td.actions { clear: both; padding-top: 1.2rem; text-align: left; }
  .woocommerce table.cart.shop_table_responsive td.actions::before { display: none; }
}

/* ---------- Forms (checkout, account, etc.) ---------- */
.woocommerce form .form-row { margin: 0 0 1.1rem; }
.woocommerce form .form-row label { display: block; font-size: .82rem; color: var(--ink-2); margin-bottom: .4rem; }
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce-account form input,
.woocommerce .select2-selection,
.woocommerce #customer_details input.input-text {
  width: 100%; padding: .85rem 1rem; border: 1px solid var(--line);
  border-radius: var(--r-sm); background: var(--white); color: var(--ink); font: inherit;
}
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus { outline: 0; border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-tint); }
.woocommerce .col2-set { display: grid; gap: clamp(1.5rem, 4vw, 3rem); }
@media (min-width: 800px) { .woocommerce-checkout .col2-set { grid-template-columns: 1fr 1fr; } }

/* Order-received / thank-you: lay the billing + shipping address columns out as a
   clean grid. WooCommerce makes .col2-set a clearfixed float container — its
   ::before/::after pseudo-elements become grid items and push the real columns
   into a 2x2 diagonal, so remove them; and reset Woo's float + 48% width.
   Two-up on tablet/desktop, stacked on mobile. */
.woocommerce-page .woocommerce-customer-details .col2-set { display: grid; gap: clamp(1.4rem, 4vw, 2.5rem); }
.woocommerce-page .woocommerce-customer-details .col2-set::before,
.woocommerce-page .woocommerce-customer-details .col2-set::after { content: none; }
.woocommerce-page .woocommerce-customer-details .col2-set .col-1,
.woocommerce-page .woocommerce-customer-details .col2-set .col-2 { float: none; width: auto; max-width: none; margin: 0; }
@media (min-width: 600px) { .woocommerce-page .woocommerce-customer-details .col2-set { grid-template-columns: 1fr 1fr; } }

/* ---------- My account ---------- */
.woocommerce-account .woocommerce-MyAccount-navigation ul { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.woocommerce-account .woocommerce-MyAccount-navigation li { border-bottom: 1px solid var(--line); }
.woocommerce-account .woocommerce-MyAccount-navigation li:last-child { border-bottom: 0; }
.woocommerce-account .woocommerce-MyAccount-navigation li a { display: block; padding: .9rem 1.2rem; color: var(--ink); }
.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a,
.woocommerce-account .woocommerce-MyAccount-navigation li a:hover { background: var(--cream-2); color: var(--forest); }
@media (min-width: 800px) { .woocommerce-account .woocommerce-MyAccount-navigation { float: left; width: 28%; } .woocommerce-account .woocommerce-MyAccount-content { float: right; width: 68%; } }

/* ---------- Misc ---------- */
.woocommerce .onsale,
span.onsale { background: var(--wheat-2); color: var(--cream); border-radius: var(--r-pill); min-height: auto; min-width: auto; padding: .25rem .7rem; font-size: .75rem; font-weight: 500; line-height: 1.4; }
.woocommerce .star-rating span::before,
.woocommerce p.stars a::before { color: var(--wheat); }

/* ---------- Single product (content-single-product.php) ----------
   The page uses the static .psum/.gallery/.tabs markup (styled by pages.css);
   these cover only the bits sourced from WooCommerce. */
.psum__poa { font-size: 1.2rem; font-weight: 500; color: var(--ink-2); }
.psum__cart.cart .single_add_to_cart_button.disabled { opacity: .55; cursor: not-allowed; }
.spec-table.woocommerce-product-attributes th { width: 32%; white-space: nowrap; }
.spec-table.woocommerce-product-attributes p { margin: 0; }
/* WooCommerce reviews rendered inside the Avaliações tab panel */
#tab-rev ol.commentlist { list-style: none; margin: 0 0 2rem; padding: 0; display: flex; flex-direction: column; gap: 1.4rem; }
#tab-rev ol.commentlist li { padding: 0; }
#tab-rev .comment-text { padding-left: 0; }
#tab-rev .star-rating { float: none; margin: .2rem 0; }
#tab-rev .comment-form-rating p.stars { margin: .3rem 0 1rem; }
#tab-rev .comment-form { display: flex; flex-direction: column; gap: .8rem; max-width: 40rem; }
#tab-rev .comment-form label { font-size: .85rem; color: var(--ink-2); }
#tab-rev .comment-form input[type="text"], #tab-rev .comment-form input[type="email"], #tab-rev .comment-form textarea {
  width: 100%; padding: .8rem 1rem; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--white); font: inherit;
}

/* ---------- Checkout (two-column via terraperene_checkout_grid_* wrappers) ---------- */
@media (min-width: 900px) {
  .woocommerce-checkout .checkout-grid { display: grid; grid-template-columns: minmax(0, 1fr) 370px; gap: clamp(2rem, 4vw, 3.5rem); align-items: start; }
  .woocommerce-checkout .checkout-col-side { position: sticky; top: 100px; }
}
/* #customer_details carries WooCommerce's .col2-set class, and Woo floats its
   .col-1/.col-2 children at 48% each — but this theme lays the checkout out with
   .checkout-grid (billing left, order right). So make the billing area one
   full-width column; the field wrappers below do the first/last two-up.
   (Without this the billing inputs collapse to ~36px.) */
.woocommerce-checkout #customer_details { display: block; }
.woocommerce-checkout #customer_details .col-1,
.woocommerce-checkout #customer_details .col-2 { float: none; width: 100%; max-width: none; }
/* Billing/shipping fields: first/last name two-up, everything else full width.
   A grid (at every width) so it doesn't depend on WooCommerce's float CSS. */
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper,
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.2rem; }
/* Reset Woo's float/47% on the rows so each fills its grid cell. */
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper > .form-row,
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper > .form-row { width: auto; float: none; }
.woocommerce-checkout .woocommerce-billing-fields__field-wrapper .form-row-wide,
.woocommerce-checkout .woocommerce-shipping-fields__field-wrapper .form-row-wide { grid-column: 1 / -1; }
.woocommerce-checkout h3, .woocommerce-checkout #order_review_heading { font-family: var(--font-display); color: var(--forest); font-size: clamp(1.3rem, 2.5vw, 1.55rem); margin: 0 0 1.1rem; }
.woocommerce-checkout .woocommerce-additional-fields { margin-top: 1.6rem; }
.woocommerce-checkout #order_review { background: var(--cream-2, var(--bone)); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(1.4rem, 3vw, 1.9rem); }
.woocommerce-checkout #order_review table.shop_table { border: 0; background: transparent; border-radius: 0; margin: 0; }
.woocommerce-checkout #order_review table.shop_table th,
.woocommerce-checkout #order_review table.shop_table td { padding: .55rem 0; border: 0; border-bottom: 1px solid var(--line); font-size: .9rem; }
.woocommerce-checkout #order_review .cart-subtotal th, .woocommerce-checkout #order_review .cart-subtotal td { color: var(--ink-2); }
.woocommerce-checkout #order_review .order-total th,
.woocommerce-checkout #order_review .order-total td { font-size: 1.1rem; color: var(--forest); border-bottom: 0; padding-top: .9rem; }
.woocommerce-checkout #payment { background: transparent; padding: 0; margin-top: 1rem; }
.woocommerce-checkout #payment ul.payment_methods { border: 0; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .5rem; }
.woocommerce-checkout #payment ul.payment_methods li { background: var(--white); border: 1px solid var(--line); border-radius: var(--r-sm); padding: .75rem 1rem; list-style: none; }
.woocommerce-checkout #payment ul.payment_methods li::before, .woocommerce-checkout #payment ul.payment_methods li::after { display: none; }
.woocommerce-checkout #payment ul.payment_methods li img { float: right; max-height: 22px; margin: 0; }
.woocommerce-checkout #payment div.payment_box { background: var(--cream); border-radius: var(--r-sm); font-size: .84rem; color: var(--ink-2); }
.woocommerce-checkout #payment div.payment_box::before { display: none; }
.woocommerce-checkout #place_order { width: 100%; margin-top: .5rem; }
