/*
 * sc-archive-variations.css
 *
 * PURPOSE
 * -------
 * Functional base styles for the archive variation UI. Layout for the
 * actions row (qty / price+sku / button) is defined here. Everything else —
 * colours, typography, card spacing — is left to your theme.
 *
 * CLASS REFERENCE
 * ───────────────
 * .sc-av-card                 Outer container: flex row (media | body).
 * .sc-av-card--single         Modifier: single product page variant.
 * .sc-av-card-media           Left column — product image wrapped in a link.
 * .sc-av-card-body            Right column — title, short desc, variation selector.
 * .sc-av-card-title           Product title heading.
 * .sc-av-card-desc            Short product description.
 *
 * .sc-av-wrap                 Outer wrapper. Add flex/grid layout here.
 * .sc-av-wrap--variable       Modifier: variable product (has dropdowns).
 * .sc-av-wrap--simple         Modifier: simple product (no dropdowns).
 *
 * .sc-av-selects              Container for attribute rows (variable only).
 * .sc-av-attribute            Single attribute row.
 * .sc-av-label                Attribute <label>.
 * .sc-av-select               Attribute <select>.
 *
 * .sc-av-actions              Flex row: qty | meta | button.
 * .sc-av-qty                  Qty wrapper: minus / input / plus.
 * .sc-av-qty-btn              Shared class on − and + buttons.
 * .sc-av-qty-minus            Decrease qty button.
 * .sc-av-qty-plus             Increase qty button.
 * .sc-av-qty-input            Qty number input.
 *
 * .sc-av-meta                 Stacked column inside actions row.
 * .sc-av-sku-wrap             SKU label + value (sits above the price).
 * .sc-av-sku-label            Static "SKU:" text.
 * .sc-av-sku                  Live SKU value (aria-live).
 * .sc-av-price                Price HTML span (below SKU).
 *
 * .sc-av-btn                  Add-to-cart / status button.
 * .sc-av-message              Status message area (aria-live).
 * .sc-av-message--success     Modifier: confirmation.
 * .sc-av-message--error       Modifier: error.
 * .sc-av-message--warning     Modifier: out-of-stock notice.
 */



/*
 * .sc-av-card                 Outer container: two-column layout (media | body).
 * .sc-av-card--single         Modifier: single product page variant.
 * .sc-av-card-media           Left column: product image wrapped in a link.
 * .sc-av-card-body            Right column: title, short desc, variation selector.
 * .sc-av-card-title           Product title (h2 on archive, h1 on single).
 * .sc-av-card-desc            Short product description.
 */

.sc-av-card {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 10rem 1fr;
  container-type: inline-size;
  background: var(--wp--preset--color--gold-10);
  border: solid 1px var(--wp--preset--color--gold-30);
  border-radius: var(--container-border-radius);
  padding: 1.5rem;
  height: 100%;
}

@container (max-width: 460px) {
   .sc-av-card > div {
     grid-column: 1/-1;
   }
   .sc-av-card-media img {
     width: 10rem !important;
     aspect-ratio: 1/.75;
   }
}

.sc-av-card-media img {
  width: auto;
  height: 100%;
  object-fit: cover;
  border-radius: calc(var(--container-border-radius) * .5);
  border: solid 1px var(--wp--preset--color--black-40) !important;
  margin: 0 !important;
}



.sc-av-card-media a {
  display: block;
}

.sc-av-card-media img {
  display: block;
  width: 100%;
  height: auto;
}

.sc-av-card-body {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
}

.sc-av-card-title {
  margin: 0;
  font-size: var(--wp--preset--font-size--medium) !important;
  color: var(--wp--preset--color--red) !important;
  margin: 0 !important;
  padding: 0 !important;
  line-height: 1.3;
}

.sc-av-card-title a {
  text-decoration: none;
  color: inherit;
}

.sc-av-card-title a:hover {
  text-decoration: underline;
}

.sc-av-card-desc {
  font-size: 0.875em;
  line-height: 1.5;
  margin: 0;
}

/* ── Single product variant ──────────────────────────────────────────────── */

.sc-av-card--single {
  gap: var(--inline-spacer);
  padding: var(--inline-spacer);
}

@media (min-width: 800px) {
   .sc-av-card--single {
     grid-template-columns: .7fr 1fr;
   }
}

.sc-av-card--single .sc-av-card-title {
  font-size: var(--wp--preset--font-size--large) !important;
}

 .sc-av-wrap {
   margin-top: auto;
   --component-box-shadow: 0 .125rem .25rem rgba(0, 0, 0, .2);
 }
 
.sc-av-card--single .sc-av-card-body {
    justify-content: center;
 }
 
.sc-av-card--single .sc-av-wrap {
   margin-top: unset;
 }

/* ── Selects ─────────────────────────────────────────────────────────────── */

.sc-av-select {
  margin-bottom: 1rem;
  -moz-appearance: none;
  -webkit-appearance: none;
  color: black;
  border: 1px solid var(--wp--preset--color--black-40);
  display: block;
  overflow: hidden;
  border-radius: .25rem;
  padding: .5rem 2rem .5rem .75rem;
  text-overflow: ellipsis;
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.5rem;
  height: 2.5rem;
  box-shadow: var(--component-box-shadow);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 13.41 8.12'%3E%3Cpolyline points='.71 .71 6.71 6.71 12.71 .71' style='fill:none;stroke:%23e40034;stroke-miterlimit:10;stroke-width:2px;'/%3E%3C/svg%3E");
  background-position: calc(100% - .5rem) center;
  background-repeat: no-repeat;
  background-size: .85rem;
  cursor: pointer;
  z-index: 2;
  position: relative;
}

.sc-av-select option:disabled {
  opacity: 0.4;
}


/* ── Actions row ─────────────────────────────────────────────────────────── */
/*
 * The actions row is a flex row with three sections:
 *   [qty controls]  [meta: sku above / price below]  [add-to-cart button]
 *
 * The meta column grows to fill available space between qty and the button.
 * Override gap and alignment in your theme as needed.
 */

.sc-av-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

/* ── Qty controls ────────────────────────────────────────────────────────── */
/* Layout and appearance are provided by WooCommerce Blocks via the
 * wc-block-components-quantity-selector classes applied to the wrapper,
 * buttons, and input. Override here only if needed. */

.sc-av-qty-btn {
  cursor: pointer;
  user-select: none;
}

.sc-av-wrap .wc-block-components-quantity-selector {
  height: 2.5rem;
  width: 92px;
  background: #ffffff;
  box-shadow: var(--component-box-shadow);
  border-color: var(--wp--preset--color--black-40);
}

.sc-av-qty-input.wc-block-components-quantity-selector__input {
  min-width: 30px !important;
}

.sc-av-qty-btn.wc-block-components-quantity-selector__button {
  min-width: 30px !important;
}

/* ── Meta column (SKU above, price below) ────────────────────────────────── */

.sc-av-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: end;
  flex: 1;           /* grows to fill space between qty and button */
  min-width: 0;      /* allows text to truncate if needed */
}

.sc-av-sku-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.25rem;
  font-size: 0.65em;
  opacity: 0.7;
  line-height: 1;
  color: #666666;
}

/* Hide SKU row when SKU value is empty. */
.sc-av-sku-wrap:has(.sc-av-sku:empty) {
  display: none;
}

.sc-av-price {
  display: block;
  line-height: 1;
  font-size: 1.3rem;
  font-weight: 600;
}

/* ── Add-to-cart button ──────────────────────────────────────────────────── */

.sc-av-btn {
  cursor: pointer;
  flex-shrink: 0;
  height: 2.5rem;
  padding: .5rem 1rem;
  line-height: 1.5rem;
  background: var(--wp--preset--color--red);
  border-radius: 2rem;
  box-shadow: var(--component-box-shadow);
  border: none;
  color: #fff;
  font-size: .75rem;
}


.sc-guest-login-btn {
  cursor: pointer;
  flex-shrink: 0;
  height: 2.5rem !important;
  padding: .5rem 1rem !important;
  line-height: 1.5rem !important;
  background: var(--wp--preset--color--red) !important;
  border-radius: 2rem !important;
  box-shadow: var(--component-box-shadow) !important;
  border: none !important;
  color: #fff !important;
  margin: 0 !important;
  font-weight: 400 !important;
  font-size: .75rem !important;
}

.sc-av-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

/* ── Message area ────────────────────────────────────────────────────────── */


.sc-av-message {
  opacity: 0;
  line-height: 1rem;
  height: 2rem;
  border-top-right-radius: .25rem;
  border-top-left-radius: .25rem;
  padding: .25rem .5rem .5rem .5rem;
  margin-bottom: -.5rem;
  transition: all .5s linear;
  font-size: 0.75em;
  background-color: transparent;
  color: #fff;
  position: relative;
  z-index: 1;
}

.sc-av-wrap--simple .sc-av-message {
  padding: .25rem .5rem;
  border-radius: .25rem;
  margin-bottom: .5rem;
  height: 1.5rem;
}

/* Override these colours in your theme for brand palette. */
.sc-av-message--success { background-color: var(--wp--preset--color--blue); opacity: 1; }
.sc-av-message--error   { background-color: var(--wp--preset--color--red); opacity: 1; }
.sc-av-message--warning { background-color: #d6b099; opacity: 1; }
