/* Tony & Johnny — WooCommerce Overrides */
/* Brand colors applied to WooCommerce UI elements globally. */
/* Cart, checkout, account, shop, product pages. */

/* ── Archive / Shop page spacing — reduce Astra/WooCommerce defaults ── */
.woocommerce-page #primary {
  margin-top: 1.5em !important;
  padding-top: 0 !important;
}

.woocommerce-js .woocommerce-breadcrumb {
  margin-bottom: 0.5em;
}

.woocommerce-products-header__title {
  margin-top: 0;
}

.woocommerce .woocommerce-result-count,
.woocommerce .woocommerce-ordering {
  margin-bottom: 0.5em;
}

/* ── Archive / Shop product grid — overrides Astra's ast-full-width list layout ── */
.woocommerce.archive ul.products,
.woocommerce-page.archive ul.products {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
}

.woocommerce.archive ul.products li.product,
.woocommerce-page.archive ul.products li.product {
  float: none !important;
  width: auto !important;
  margin: 0 !important;
}

@media (max-width: 921px) {
  .woocommerce.archive ul.products,
  .woocommerce-page.archive ul.products {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .woocommerce.archive ul.products,
  .woocommerce-page.archive ul.products {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ── Product Grid Cards ── */
.woocommerce ul.products li.product .woocommerce-loop-product__title {
  font-family: var(--tj-font-body);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--tj-dark);
}

.woocommerce ul.products li.product .price {
  color: var(--tj-coral);
  font-weight: 700;
}

/* ── Archive product card — normalized image area ── */
/*
 * Problem: real product images arrive at wildly different aspect ratios,
 * so card heights blow out. Fix: fixed-height image box + object-fit:contain
 * keeps every image visible without cropping, on a neutral warm background.
 * Scoped to .archive so single-product gallery is untouched.
 */

/* Flex-column card so the add-to-cart button always pins to the bottom */
.woocommerce.archive ul.products li.product,
.woocommerce-page.archive ul.products li.product {
  display: flex;
  flex-direction: column;
}

/* Link wrapper stretches to fill card height */
.woocommerce.archive ul.products li.product a.woocommerce-loop-product__link,
.woocommerce-page.archive ul.products li.product a.woocommerce-loop-product__link {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Fixed-height image box — contain + centered on warm cream background */
.woocommerce.archive ul.products li.product a.woocommerce-loop-product__link img,
.woocommerce-page.archive ul.products li.product a.woocommerce-loop-product__link img {
  display: block;
  width: 100%;
  height: 220px;
  object-fit: contain;
  background-color: #faf7f5;
  border-radius: var(--tj-border-r);
  padding: 12px;
  box-sizing: border-box;
  flex-shrink: 0;
  margin-bottom: 10px;
}

/* Add-to-cart button pins to bottom of card */
.woocommerce.archive ul.products li.product > a.button,
.woocommerce-page.archive ul.products li.product > a.button {
  margin-top: auto;
}

/* On mobile (2 columns) reduce image height slightly */
@media (max-width: 600px) {
  .woocommerce.archive ul.products li.product a.woocommerce-loop-product__link img,
  .woocommerce-page.archive ul.products li.product a.woocommerce-loop-product__link img {
    height: 160px;
    padding: 8px;
  }
}

/* ── Buttons (global) ── */
.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce #respond input#submit {
  background-color: var(--tj-coral);
  color: #fff;
  font-family: var(--tj-font-body);
  font-weight: 700;
  border-radius: var(--tj-border-r);
  border: none;
  transition: background-color var(--tj-transition);
}
.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce #respond input#submit:hover {
  background-color: var(--tj-coral-dark);
  color: #fff;
}

/* Alt (outlined) buttons */
.woocommerce a.button.alt,
.woocommerce button.button.alt {
  background-color: var(--tj-coral);
  color: #fff;
}
.woocommerce a.button.alt:hover,
.woocommerce button.button.alt:hover {
  background-color: var(--tj-coral-dark);
}

/* ── Price / Amount ── */
.woocommerce .price ins,
.woocommerce .amount {
  color: var(--tj-coral);
}

/* ── Sale Badge ── */
.woocommerce span.onsale {
  background-color: var(--tj-coral);
  border-radius: 4px;
  min-height: auto;
  min-width: auto;
  padding: 4px 8px;
  line-height: 1.4;
}

/* ── Cart ── */
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button {
  background-color: var(--tj-coral);
  border-radius: var(--tj-border-r);
  font-family: var(--tj-font-body);
  font-weight: 700;
  font-size: 1rem;
}
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover {
  background-color: var(--tj-coral-dark);
}

/* ── Checkout ── */
.woocommerce-checkout #place_order {
  background-color: var(--tj-coral);
  border-radius: var(--tj-border-r);
  font-family: var(--tj-font-body);
  font-weight: 700;
}
.woocommerce-checkout #place_order:hover {
  background-color: var(--tj-coral-dark);
}

/* ── Form Fields ── */
.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea {
  border-radius: var(--tj-border-r);
  border-color: var(--tj-border);
  font-family: var(--tj-font-body);
}
.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus {
  border-color: var(--tj-coral);
  outline: none;
  box-shadow: 0 0 0 2px rgba(224, 120, 98, 0.15);
}

/* ── Notices ── */
.woocommerce-message,
.woocommerce-info {
  border-top-color: var(--tj-coral);
}
.woocommerce-message::before,
.woocommerce-info::before {
  color: var(--tj-coral);
}

/* ── Single Product Page ── */

/* Constrain the two-column product block to a centered max-width.
   Without this, 48% float columns on a 1200px container = 576px each — too wide. */
.single-product .woocommerce div.product {
  max-width: 900px;
  margin-left: auto;
  margin-right: auto;
  overflow: hidden; /* clearfix for the two floated columns */
}

/* Image column — fixed width, float to physical right (= RTL start side) */
.single-product .woocommerce div.product div.images {
  float: right !important;
  width: 340px !important;
  max-width: 340px;
  clear: none;
}

/* Summary column — fills remaining space, float to physical left (= RTL end side).
   max-width caps it so it never becomes the full residual when image is absent. */
.single-product .woocommerce div.product div.summary {
  float: left !important;
  width: calc(100% - 380px) !important;
  max-width: 480px;
  overflow: hidden;
}

/* Image card — white background, radius, shadow sit cleanly on the 340px column */
.single-product .woocommerce-product-gallery {
  background: #fff;
  border-radius: var(--tj-border-r);
  padding: 12px;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.07);
}

/* Image inner radius */
.single-product .woocommerce-product-gallery__wrapper img {
  border-radius: calc(var(--tj-border-r) - 2px);
}

/* Tabs + related break out below the two floated columns */
.single-product .woocommerce .woocommerce-tabs,
.single-product .woocommerce section.related,
.single-product .woocommerce .up-sells {
  clear: both;
}

/* Product title */
.woocommerce div.product .product_title {
  font-family: var(--tj-font-head);
  font-size: 1.7rem;
  color: var(--tj-dark);
  margin-bottom: 0.4em;
}

/* Price */
.woocommerce div.product p.price,
.woocommerce div.product span.price {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--tj-coral);
  margin-bottom: 0.75em;
}

/* Short description — muted text, separator line below */
.woocommerce div.product .woocommerce-product-details__short-description {
  color: var(--tj-text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
  margin-bottom: 1.25em;
  border-bottom: 1px solid var(--tj-border);
  padding-bottom: 1.25em;
}

/* Add-to-cart row — flex, compact, not full-width */
.woocommerce div.product form.cart {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 1em;
}

/* Quantity input — small fixed-width box */
.woocommerce div.product form.cart .quantity input.qty {
  flex: 0 0 72px;
  width: 72px;
  border: 1.5px solid var(--tj-border);
  border-radius: var(--tj-border-r);
  padding: 10px 8px;
  font-family: var(--tj-font-body);
  font-size: 1rem;
  text-align: center;
  height: auto;
}
.woocommerce div.product form.cart .quantity input.qty:focus {
  border-color: var(--tj-coral);
  outline: none;
  box-shadow: 0 0 0 2px rgba(224, 120, 98, 0.15);
}

/* Add-to-cart button — sized to its label, not stretched across the row */
.woocommerce div.product form.cart .single_add_to_cart_button {
  flex: 0 0 auto;
  min-width: 150px;
  max-width: 260px;
  font-size: 1rem;
  padding: 11px 24px;
}

/* Product meta (SKU, categories) */
.woocommerce div.product .product_meta {
  margin-top: 1em;
  font-size: 0.85rem;
  color: var(--tj-text-muted);
  border-top: 1px solid var(--tj-border);
  padding-top: 0.75em;
}
.woocommerce div.product .product_meta a {
  color: var(--tj-coral);
}

/* Mobile — single column, image above summary */
@media (max-width: 768px) {
  .single-product .woocommerce div.product div.images,
  .single-product .woocommerce div.product div.summary {
    float: none !important;
    width: 100% !important;
    max-width: 100%;
  }
  .single-product .woocommerce div.product div.images {
    margin-bottom: 1.5em;
  }
  /* Button full-width on mobile only */
  .woocommerce div.product form.cart .single_add_to_cart_button {
    flex: 1;
    max-width: none;
  }
}

/* ── Block Checkout — radio inputs styled as checkboxes ──
 *
 * Approach: background-image SVG checkmark (most reliable cross-browser).
 * No ::after on <input> (unreliable). No CSS variables (SpeedyCache safe).
 * No directional properties (RTL safe).
 * Applies to both shipping and payment radio inputs.
 */

/* Unselected: square, white, grey border — no checkmark */
body .wc-block-components-radio-control__input[type="radio"],
body .wc-block-components-radio-control input[type="radio"].wc-block-components-radio-control__input {
  -webkit-appearance: none !important;
  appearance: none !important;
  width: 20px !important;
  height: 20px !important;
  min-width: 20px !important;
  min-height: 20px !important;
  border-radius: 4px !important;
  border: 2px solid #9e9e9e !important;
  background-color: #ffffff !important;
  background-image: none !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

/* Suppress WC's ::before inner dot in all states */
body .wc-block-components-radio-control__input[type="radio"]::before,
body .wc-block-components-radio-control input[type="radio"].wc-block-components-radio-control__input::before {
  display: none !important;
}

/* Selected: coral fill + white checkmark via inline SVG background-image */
body .wc-block-components-radio-control__input[type="radio"]:checked,
body .wc-block-components-radio-control input[type="radio"].wc-block-components-radio-control__input:checked {
  border: 2px solid #E07862 !important;
  background-color: #E07862 !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpolyline points='3,11 8,15 17,5' stroke='%23ffffff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' fill='none'/%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: center !important;
  background-size: 14px 14px !important;
  box-shadow: none !important;
}

/* Focus: coral outline for keyboard accessibility */
body .wc-block-components-radio-control__input[type="radio"]:focus,
body .wc-block-components-radio-control input[type="radio"].wc-block-components-radio-control__input:focus {
  outline: 3px solid rgba(224, 120, 98, 0.35) !important;
  outline-offset: 3px !important;
}
