/*
 * Native WooCommerce Mini-Cart, Cart and My Account presentation.
 *
 * WooCommerce owns every interaction and state transition. This stylesheet is
 * loaded only when one of the decorated native surfaces is present.
 */

.resacommerce-shell-surfaces,
.resacommerce-shell-surfaces * {
  box-sizing: border-box;
}

.resacommerce-shell-surfaces :is(h1, h2, h3, legend) {
  text-wrap: balance;
}

.resacommerce-shell-surfaces :is(p, address, .wc-block-components-product-metadata) {
  text-wrap: pretty;
}

.resacommerce-shell-surfaces :is(
  .amount,
  .wc-block-components-formatted-money-amount,
  .wc-block-mini-cart__badge,
  .woocommerce-orders-table__cell-order-number
) {
  font-variant-numeric: tabular-nums;
}

.resacommerce-shell-surfaces :is(button, input, select, textarea, a):focus-visible {
  outline: 3px solid var(--resacommerce-shell-focus);
  outline-offset: 3px;
}

.resacommerce-shell-surfaces :is(
  .wc-block-components-button,
  .wp-element-button,
  .button,
  button[type="submit"],
  input[type="submit"]
) {
  align-items: center;
  border: 1px solid var(--resacommerce-shell-accent);
  border-radius: var(--resacommerce-shell-radius);
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 650;
  justify-content: center;
  min-height: var(--resacommerce-shell-control-height);
  padding: 0.75rem 1.25rem;
  text-align: center;
  text-decoration: none;
}

.resacommerce-shell-surfaces :is(
  .wc-block-components-button,
  .wp-element-button,
  .button,
  button[type="submit"],
  input[type="submit"]
):not(:disabled) {
  background: var(--resacommerce-shell-accent);
  color: var(--resacommerce-shell-accent-contrast);
}

.resacommerce-shell-surfaces :is(button, input, select, textarea):disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

/* Native notification layers: inline, item context, blocking and portal. */
.resacommerce-shell-surfaces .wc-block-components-validation-error,
.resacommerce-shell-surfaces .woocommerce-invalid :is(.woocommerce-error, .required) {
  color: var(--resacommerce-shell-error);
}

.resacommerce-shell-surfaces .wc-block-cart-items__row .wc-block-components-notice-banner,
.resacommerce-shell-surfaces .wc-block-mini-cart__products-table .wc-block-components-notice-banner {
  border-radius: var(--resacommerce-shell-radius-sm);
  font-size: 0.8125rem;
  margin-block: 0.5rem 0;
  padding: 0.625rem 0.75rem;
}

body.resacommerce-shell :is(
  .wc-block-components-notice-snackbar-list,
  .wc-block-components-snackbar-list
) {
  inset-block-end: max(1rem, env(safe-area-inset-bottom));
  inset-inline: auto max(1rem, env(safe-area-inset-right));
  max-width: min(25rem, calc(100vw - 2rem));
  z-index: 100;
}

body.resacommerce-shell :is(
  .wc-block-components-notice-snackbar,
  .wc-block-components-snackbar
) {
  background: #171717;
  border-radius: var(--resacommerce-shell-radius);
  box-shadow: var(--resacommerce-shell-shadow);
  color: #fff;
}

/* Mini-Cart Block: WooCommerce's native drawer and focus management. */
.resacommerce-shell--mini-cart .wc-block-mini-cart__button {
  border: 0;
  border-radius: var(--resacommerce-shell-radius);
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.625rem;
}

.resacommerce-shell--mini-cart .wc-block-mini-cart__button:hover {
  background: var(--resacommerce-shell-surface-subtle);
}

body.resacommerce-shell--mini-cart .wc-block-components-drawer__screen-overlay {
  background: rgb(0 0 0 / 0.42);
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__drawer {
  background: var(--resacommerce-shell-surface);
  color: var(--resacommerce-shell-text);
  inline-size: min(28rem, 100vw);
  max-inline-size: 100vw;
  min-block-size: 100dvh;
}

body.resacommerce-shell--mini-cart .wp-block-woocommerce-mini-cart-contents {
  min-block-size: 100dvh;
  padding-block: env(safe-area-inset-top) env(safe-area-inset-bottom);
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__title {
  border-block-end: 1px solid var(--resacommerce-shell-border);
  font-size: clamp(1.25rem, 4vw, 1.625rem);
  line-height: 1.2;
  margin: 0;
  padding: 1.25rem 4rem 1.25rem 1.25rem;
}

body.resacommerce-shell--mini-cart .wc-block-components-drawer__close {
  align-items: center;
  border-radius: 999px;
  display: inline-flex;
  inset-block-start: calc(0.875rem + env(safe-area-inset-top));
  inset-inline-end: calc(0.875rem + env(safe-area-inset-right));
  justify-content: center;
  min-block-size: 2.75rem;
  min-inline-size: 2.75rem;
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__items {
  padding: 0.5rem 1.25rem 1.25rem;
  scrollbar-gutter: stable;
}

body.resacommerce-shell--mini-cart .wc-block-cart-items__row {
  border-block-end: 1px solid var(--resacommerce-shell-border);
  gap: 0.875rem;
  padding-block: 1rem;
}

body.resacommerce-shell--mini-cart .wc-block-cart-item__image img {
  aspect-ratio: 1;
  border-radius: var(--resacommerce-shell-radius);
  object-fit: cover;
}

/*
 * Woo's interactive template contains a non-linked fallback image and a
 * linked catalogue image. Keep the fallback only when the linked image is
 * actually hidden; otherwise both can flash or remain visible after hydration.
 */
body.resacommerce-shell--mini-cart
  .wc-block-cart-item__image:has(> a:not([hidden]))
  > img {
  block-size: 1px;
  clip-path: inset(50%);
  inline-size: 1px;
  overflow: hidden;
  position: absolute;
}

body.resacommerce-shell--mini-cart .wc-block-components-product-name {
  color: inherit;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

body.resacommerce-shell--mini-cart
  .wc-block-components-product-metadata__description {
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  display: -webkit-box;
  font-size: 0.8125rem;
  line-height: 1.45;
  overflow: hidden;
}

body.resacommerce-shell--mini-cart .wc-block-cart-item__remove-link {
  color: var(--resacommerce-shell-muted);
  min-block-size: 2.75rem;
  text-underline-offset: 0.2em;
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__footer {
  background: var(--resacommerce-shell-surface);
  border-block-start: 1px solid var(--resacommerce-shell-border);
  box-shadow: 0 -0.5rem 1.25rem rgb(0 0 0 / 0.04);
  padding: 1.25rem;
  padding-block-end: max(1.25rem, env(safe-area-inset-bottom));
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__footer-actions {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: 1fr 1fr;
}

body.resacommerce-shell--mini-cart .wc-block-mini-cart__footer-actions > * {
  min-inline-size: 0;
}

/* Cart Block: responsive item list plus an anchored native summary. */
.resacommerce-shell--cart .wp-block-woocommerce-cart {
  margin-inline: auto;
  max-inline-size: var(--resacommerce-shell-width);
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.resacommerce-shell--cart .wc-block-components-sidebar-layout.wc-block-cart {
  align-items: start;
  display: grid;
  gap: clamp(1.5rem, 4vw, 3rem);
  grid-template-columns: minmax(0, 1fr) minmax(18rem, 24rem);
  margin-block: 1.5rem 3rem;
}

.resacommerce-shell--cart .wc-block-cart__main,
.resacommerce-shell--cart .wc-block-cart__sidebar {
  inline-size: 100%;
  margin: 0;
  min-inline-size: 0;
  padding: 0;
}

.resacommerce-shell--cart .wc-block-cart__sidebar {
  background: var(--resacommerce-shell-surface-subtle);
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 1.5rem;
}

.resacommerce-shell--cart .wc-block-cart-items {
  border: 0;
  border-collapse: collapse;
  inline-size: 100%;
}

.resacommerce-shell--cart .wc-block-cart-items__header {
  color: var(--resacommerce-shell-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
}

.resacommerce-shell--cart .wc-block-cart-items__row {
  border-block-end: 1px solid var(--resacommerce-shell-border);
}

.resacommerce-shell--cart .wc-block-cart-items__row > td {
  padding-block: 1.25rem;
}

.resacommerce-shell--cart .wc-block-cart-item__image img {
  aspect-ratio: 1;
  border-radius: var(--resacommerce-shell-radius);
  object-fit: cover;
}

.resacommerce-shell--cart .wc-block-components-product-name {
  color: inherit;
  font-weight: 650;
  line-height: 1.35;
  text-decoration: none;
}

.resacommerce-shell--cart .wc-block-components-product-metadata {
  color: var(--resacommerce-shell-muted);
  font-size: 0.8125rem;
}

.resacommerce-shell--cart .wc-block-components-quantity-selector {
  border-color: var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius-sm);
  min-block-size: 2.75rem;
}

.resacommerce-shell--cart .wc-block-cart-item__remove-link {
  color: var(--resacommerce-shell-muted);
  min-block-size: 2.75rem;
  text-underline-offset: 0.2em;
}

.resacommerce-shell--cart .wc-block-components-totals-wrapper {
  border-color: var(--resacommerce-shell-border);
}

.resacommerce-shell--cart .wc-block-cart__submit-button {
  inline-size: 100%;
}

/* My Account: native endpoints, navigation, tables, cards and forms. */
.resacommerce-shell--account .woocommerce[data-resacommerce-shell-context="account"] {
  align-items: start;
  display: grid;
  gap: clamp(1.25rem, 4vw, 2.5rem);
  grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr);
  margin: 2rem auto 4rem;
  max-inline-size: var(--resacommerce-shell-width);
  padding-inline: clamp(1rem, 3vw, 2rem);
}

.resacommerce-shell--account .woocommerce > :is(
  .woocommerce-notices-wrapper,
  .woocommerce-error,
  .woocommerce-message,
  .woocommerce-info,
  .u-columns,
  form.woocommerce-form,
  form.lost_reset_password
) {
  grid-column: 1 / -1;
  inline-size: 100%;
}

.resacommerce-shell--account .woocommerce-MyAccount-navigation {
  background: var(--resacommerce-shell-surface-subtle);
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius-lg);
  inline-size: 100%;
  padding: 0.5rem;
}

.resacommerce-shell--account .woocommerce-MyAccount-navigation ul {
  display: grid;
  gap: 0.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.resacommerce-shell--account .woocommerce-MyAccount-navigation a {
  border-radius: var(--resacommerce-shell-radius);
  color: inherit;
  display: block;
  font-weight: 600;
  padding: 0.75rem 0.875rem;
  text-decoration: none;
}

.resacommerce-shell--account .woocommerce-MyAccount-navigation a:hover {
  background: var(--resacommerce-shell-surface);
}

.resacommerce-shell--account .woocommerce-MyAccount-navigation .is-active a,
.resacommerce-shell--account .woocommerce-MyAccount-navigation [aria-current="page"] {
  background: var(--resacommerce-shell-selected);
  color: var(--resacommerce-shell-accent);
}

.resacommerce-shell--account .woocommerce-MyAccount-content {
  background: var(--resacommerce-shell-surface);
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius-lg);
  inline-size: 100%;
  min-inline-size: 0;
  overflow-wrap: anywhere;
  padding: clamp(1.25rem, 3vw, 2rem);
}

.resacommerce-shell--account .woocommerce-MyAccount-content > :first-child {
  margin-block-start: 0;
}

.resacommerce-shell--account .woocommerce-MyAccount-content > :last-child {
  margin-block-end: 0;
}

.resacommerce-shell--account .woocommerce-Addresses {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
}

.resacommerce-shell--account .woocommerce-Address {
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius);
  inline-size: 100%;
  padding: 1rem;
}

.resacommerce-shell--account :is(.woocommerce-orders-table, .woocommerce-table) {
  border-collapse: collapse;
  inline-size: 100%;
}

.resacommerce-shell--account :is(.woocommerce-orders-table, .woocommerce-table) :is(th, td) {
  border-block-end: 1px solid var(--resacommerce-shell-border);
  padding: 0.875rem 0.75rem;
  text-align: start;
  vertical-align: middle;
}

.resacommerce-shell--account :is(.form-row, .woocommerce-address-fields__field-wrapper) {
  min-inline-size: 0;
}

.resacommerce-shell--account :is(input.input-text, select, textarea) {
  background: var(--resacommerce-shell-surface);
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius);
  color: inherit;
  font: inherit;
  inline-size: 100%;
  min-block-size: var(--resacommerce-shell-control-height);
  padding: 0.875rem 1rem;
}

.resacommerce-shell--account textarea {
  min-block-size: 8rem;
  resize: vertical;
}

.resacommerce-shell--account fieldset {
  border: 1px solid var(--resacommerce-shell-border);
  border-radius: var(--resacommerce-shell-radius);
  margin-block: 1.5rem;
  padding: 1rem;
}

@media (max-width: 52rem) {
  .resacommerce-shell--cart .wc-block-components-sidebar-layout.wc-block-cart {
    grid-template-columns: minmax(0, 1fr);
  }

  .resacommerce-shell--cart .wc-block-cart__sidebar {
    position: static;
  }

  .resacommerce-shell--account .woocommerce[data-resacommerce-shell-context="account"] {
    grid-template-columns: minmax(0, 1fr);
  }

  .resacommerce-shell--account .woocommerce-MyAccount-navigation ul {
    display: flex;
    flex-wrap: wrap;
  }
}

@media (max-width: 36rem) {
  body.resacommerce-shell :is(
    .wc-block-components-notice-snackbar-list,
    .wc-block-components-snackbar-list
  ) {
    inset-inline: max(0.75rem, env(safe-area-inset-left)) max(0.75rem, env(safe-area-inset-right));
    max-width: none;
  }

  body.resacommerce-shell--mini-cart .wc-block-mini-cart__drawer {
    inline-size: 100vw;
  }

  body.resacommerce-shell--mini-cart .wc-block-mini-cart__footer-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .resacommerce-shell--cart .wp-block-woocommerce-cart {
    padding-inline: 0.75rem;
  }

  .resacommerce-shell--cart .wc-block-cart__sidebar,
  .resacommerce-shell--account .woocommerce-MyAccount-content {
    border-radius: var(--resacommerce-shell-radius);
    padding: 1rem;
  }

  .resacommerce-shell--account .woocommerce[data-resacommerce-shell-context="account"] {
    margin-block: 1rem 2.5rem;
    padding-inline: 0.75rem;
  }

  .resacommerce-shell--account .woocommerce-MyAccount-navigation ul {
    display: grid;
  }

  .resacommerce-shell--account :is(.woocommerce-orders-table, .woocommerce-table) {
    display: block;
    max-inline-size: 100%;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.resacommerce-shell--mini-cart :is(
    .wc-block-components-drawer__screen-overlay,
    .wc-block-mini-cart__drawer,
    .wc-block-components-notice-snackbar,
    .wc-block-components-snackbar
  ) {
    animation: none !important;
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
