/*
 * NOIR & GOLD | CLEAN CHECKOUT V4
 * Scope: WooCommerce Cart, Checkout, Order Received.
 * Intention: accessible light checkout for an editorial charcoal/champagne storefront.
 * No element removal, form replacement, or custom payment logic.
 */
body.woocommerce-cart,
body.woocommerce-checkout {
  --ng-page: #f6f3ee;
  --ng-surface: #fffdfa;
  --ng-surface-soft: #f8f5ef;
  --ng-ink: #262925;
  --ng-muted: #6c6f69;
  --ng-border: #e3ded4;
  --ng-gold: #a88a61;
  --ng-deep: #292d2a;
  color-scheme: light;
  background: var(--ng-page) !important;
  color: var(--ng-ink) !important;
  font-family: -apple-system, BlinkMacSystemFont, "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Remove previous dark-section inheritance without touching website-wide themes */
body.woocommerce-checkout :is(.wp-site-blocks, .site-content, .entry-content, main, .wc-block-checkout),
body.woocommerce-cart :is(.wp-site-blocks, .site-content, .entry-content, main, .wc-block-cart) {
  color: var(--ng-ink);
}
body.woocommerce-checkout :is(.wc-block-checkout, .woocommerce, .entry-content),
body.woocommerce-cart :is(.wc-block-cart, .woocommerce, .entry-content) {
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
body.woocommerce-checkout :is(h1,h2,h3,h4,.wc-block-components-title),
body.woocommerce-cart :is(h1,h2,h3,h4,.wc-block-components-title) {
  color: var(--ng-ink) !important;
  line-height: 1.35;
  letter-spacing: 0;
  font-weight: 650;
}
body.woocommerce-checkout :is(.wc-block-checkout__main,.wc-block-checkout__sidebar,.woocommerce-order,.woocommerce-order-details,.woocommerce-customer-details),
body.woocommerce-cart :is(.wc-block-cart__main,.wc-block-cart__sidebar,.cart_totals) {
  box-sizing: border-box;
  background: var(--ng-surface) !important;
  color: var(--ng-ink) !important;
  border: 1px solid var(--ng-border) !important;
  border-radius: 16px !important;
  box-shadow: 0 12px 34px rgba(41,45,42,.045) !important;
}
body.woocommerce-checkout :is(.wc-block-checkout__main,.wc-block-checkout__sidebar),
body.woocommerce-cart :is(.wc-block-cart__main,.wc-block-cart__sidebar) {
  padding: clamp(18px, 2.5vw, 34px) !important;
  min-width: 0;
}

/* Woo Blocks: make order summary and its children uniformly legible. */
body.woocommerce-checkout :is(.wc-block-components-sidebar,.wc-block-components-order-summary,.wc-block-components-order-summary__content,.wc-block-components-totals-wrapper,.wc-block-components-totals-item,.wc-block-components-order-summary-item),
body.woocommerce-cart :is(.wc-block-components-sidebar,.wc-block-components-totals-wrapper,.wc-block-components-totals-item) {
  background: transparent !important;
  color: var(--ng-ink) !important;
  border-color: var(--ng-border) !important;
  box-shadow: none !important;
}
body.woocommerce-checkout :is(.wc-block-components-order-summary-item__description,.wc-block-components-order-summary-item__total-price,.wc-block-components-product-name,.wc-block-components-product-price,.wc-block-components-formatted-money-amount,.wc-block-components-totals-item__label,.wc-block-components-totals-item__value,.wc-block-components-order-summary-item__quantity,.wc-block-components-product-metadata,.wc-block-components-product-details),
body.woocommerce-cart :is(.wc-block-components-product-name,.wc-block-components-formatted-money-amount,.wc-block-components-totals-item__label,.wc-block-components-totals-item__value) {
  color: var(--ng-ink) !important;
  overflow-wrap: anywhere;
  text-shadow: none !important;
}
body.woocommerce-checkout :is(.wc-block-components-order-summary-item__description,.wc-block-components-product-metadata) {
  min-width: 0;
}
body.woocommerce-checkout :is(.wc-block-components-product-metadata,.wc-block-components-product-details,.wc-block-components-order-summary-item__description .wc-block-components-product-price),
body.woocommerce-cart :is(.wc-block-components-product-metadata,.wc-block-components-product-details) {
  color: var(--ng-muted) !important;
  font-size: .9em;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__quantity {
  background: var(--ng-surface-soft) !important;
  border: 1px solid var(--ng-border) !important;
  box-shadow: 0 0 0 2px var(--ng-surface) !important;
  color: var(--ng-ink) !important;
}
body.woocommerce-checkout :is(.wc-block-components-order-summary-item__image,.wc-block-components-product-image) img,
body.woocommerce-cart .wc-block-components-product-image img {
  border-radius: 8px;
  background: var(--ng-surface-soft);
}
body.woocommerce-checkout .wc-block-components-totals-footer-item,
body.woocommerce-cart .wc-block-components-totals-footer-item {
  color: var(--ng-ink) !important;
  font-weight: 750;
  font-size: 1.12em;
}

/* Section descriptions, links and form labels */
body.woocommerce-checkout :is(.wc-block-checkout__main,.wc-block-checkout__sidebar,.woocommerce-checkout-review-order) :is(p,small,label,strong),
body.woocommerce-cart :is(.wc-block-cart__main,.wc-block-cart__sidebar) :is(p,small,label,strong) {
  color: var(--ng-ink) !important;
}
body.woocommerce-checkout :is(.wc-block-components-text-input label,.wc-block-components-combobox label,.wc-block-components-checkbox__label,.wc-block-components-radio-control__label,.wc-block-components-radio-control__option-layout),
body.woocommerce-cart :is(.wc-block-components-checkbox__label,.wc-block-components-radio-control__label) {
  color: var(--ng-ink) !important;
  opacity: 1 !important;
}
body.woocommerce-checkout :is(a:not(.button),.wc-block-components-totals-coupon-link),
body.woocommerce-cart a:not(.button) {
  color: #785c35;
  text-underline-offset: 3px;
}
body.woocommerce-checkout :is(.wc-block-components-form,.woocommerce) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea),
body.woocommerce-cart :is(.wc-block-components-form,.woocommerce) :is(input:not([type=checkbox]):not([type=radio]):not([type=hidden]),select,textarea),
body.woocommerce-checkout .select2-container .select2-selection {
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  min-height: 48px;
  color: var(--ng-ink) !important;
  -webkit-text-fill-color: var(--ng-ink);
  background: #fff !important;
  border: 1px solid #cfc9bf !important;
  border-radius: 9px !important;
  box-shadow: none !important;
  font-size: 16px;
}
body.woocommerce-checkout :is(input,textarea)::placeholder,
body.woocommerce-cart :is(input,textarea)::placeholder {
  color: #787b75 !important;
  opacity: 1;
}
body.woocommerce-checkout :is(input[type=checkbox],input[type=radio]),
body.woocommerce-cart :is(input[type=checkbox],input[type=radio]) {
  accent-color: var(--ng-gold);
}

/* Payment methods: undo dark panels and invisible text from older design. */
body.woocommerce-checkout :is(.wc-block-checkout__payment-method,.wc-block-components-radio-control,.wc-block-components-radio-control-accordion-option,.wc-block-components-radio-control__option,.wc-block-components-radio-control-accordion-content,#payment,.woocommerce-checkout-payment) {
  background: var(--ng-surface) !important;
  color: var(--ng-ink) !important;
  border-color: var(--ng-border) !important;
  box-shadow: none !important;
}
body.woocommerce-checkout :is(.wc-block-components-radio-control__option,.wc-block-components-radio-control-accordion-option) {
  padding: 14px !important;
  border-radius: 9px;
}
body.woocommerce-checkout :is(.wc-block-components-radio-control-accordion-content,.wc-block-components-payment-methods__save-card-info,.payment_box) {
  color: var(--ng-ink) !important;
  background: var(--ng-surface-soft) !important;
  border-radius: 9px !important;
  padding: 14px !important;
}
body.woocommerce-checkout :is(.wc-block-components-radio-control,.wc-block-checkout__payment-method,#payment) :is(label,p,span,small,strong,div),
body.woocommerce-checkout :is(.payment_methods,.payment_box) :is(label,p,span,small,strong,div) {
  color: var(--ng-ink) !important;
  opacity: 1 !important;
  text-shadow: none !important;
}
/* Keep radio/checkbox indicators and gateway-specific controls functional. */
body.woocommerce-checkout #payment div.payment_box:before {
  border-bottom-color: var(--ng-surface-soft) !important;
}

/* Classic checkout/cart support */
body.woocommerce-checkout :is(#customer_details,.woocommerce-checkout-review-order,table.shop_table,.woocommerce-order-overview,.woocommerce-order-details,.woocommerce-customer-details),
body.woocommerce-cart :is(table.shop_table,.cart_totals) {
  color: var(--ng-ink) !important;
  background: var(--ng-surface) !important;
  border-color: var(--ng-border) !important;
}
body.woocommerce-checkout :is(table.shop_table th,table.shop_table td,.woocommerce-checkout-review-order th,.woocommerce-checkout-review-order td),
body.woocommerce-cart :is(table.shop_table th,table.shop_table td) {
  color: var(--ng-ink) !important;
  background: transparent !important;
  border-color: var(--ng-border) !important;
}
body.woocommerce-checkout .woocommerce-thankyou-order-received {
  background: #edf3ec;
  color: #285039;
  border-left: 4px solid #7c9a7a;
  padding: 18px;
  border-radius: 8px;
}

/* Primary actions: high contrast and generous tap targets. */
body.woocommerce-checkout :is(.wc-block-components-button,#place_order,button.button,input.button),
body.woocommerce-cart :is(.wc-block-components-button,button.button,input.button,a.button) {
  box-sizing: border-box;
  min-height: 48px;
  background: var(--ng-deep) !important;
  color: #fffefa !important;
  border: 1px solid var(--ng-deep) !important;
  border-radius: 10px !important;
  font-weight: 650;
  box-shadow: none !important;
}
body.woocommerce-checkout :is(.wc-block-components-button,#place_order,button.button) :is(span,div,strong),
body.woocommerce-cart :is(.wc-block-components-button,button.button,a.button) :is(span,div,strong) {
  color: #fffefa !important;
}
body.woocommerce-checkout :is(.wc-block-components-button,#place_order,button.button):hover,
body.woocommerce-cart :is(.wc-block-components-button,button.button,a.button):hover {
  background: #9e7a4c !important;
  border-color: #9e7a4c !important;
  color: #fffefa !important;
}
body.woocommerce-checkout :is(.woocommerce-info,.woocommerce-message,.wc-block-components-notice-banner),
body.woocommerce-cart :is(.woocommerce-info,.woocommerce-message,.wc-block-components-notice-banner) {
  background: #f4f0e6 !important;
  color: var(--ng-ink) !important;
  border-color: #d6c5a9 !important;
  border-radius: 9px;
}
body.woocommerce-checkout :is(.woocommerce-error,.wc-block-components-notice-banner.is-error),
body.woocommerce-cart :is(.woocommerce-error,.wc-block-components-notice-banner.is-error) {
  background: #fff0ee !important;
  color: #7a2929 !important;
  border-color: #dbb0a8 !important;
}
body.woocommerce-checkout :is(button,input,select,textarea,a):focus-visible,
body.woocommerce-cart :is(button,input,select,textarea,a):focus-visible {
  outline: 3px solid var(--ng-gold) !important;
  outline-offset: 2px;
}

/* Mobile: preserve WooCommerce own responsive layout; avoid forced columns. */
@media(max-width: 780px) {
  body.woocommerce-checkout :is(.wp-block-woocommerce-checkout,.wc-block-checkout,.entry-content),
  body.woocommerce-cart :is(.wp-block-woocommerce-cart,.wc-block-cart,.entry-content) {
    max-width: 100%;
  }
  body.woocommerce-checkout :is(.wc-block-checkout__main,.wc-block-checkout__sidebar),
  body.woocommerce-cart :is(.wc-block-cart__main,.wc-block-cart__sidebar) {
    padding: 16px !important;
    border-radius: 12px !important;
  }
  body.woocommerce-checkout :is(h1,.wp-block-post-title),
  body.woocommerce-cart :is(h1,.wp-block-post-title) {
    font-size: clamp(27px, 7vw, 36px);
    line-height: 1.25;
  }
  body.woocommerce-checkout .wc-block-components-order-summary-item__description {
    overflow-wrap: anywhere;
  }
  body.woocommerce-checkout :is(.wc-block-checkout__sidebar,.wc-block-components-sidebar),
  body.woocommerce-cart :is(.wc-block-cart__sidebar,.wc-block-components-sidebar) {
    position: static !important;
    width: 100%;
    max-width: 100%;
  }
  body.woocommerce-cart .wc-block-cart__submit-container {
    background: var(--ng-surface);
  }
  body.woocommerce-checkout :is(.wc-block-components-button,#place_order) {
    width: 100%;
  }
}

/* ======================== V5 refinement ========================
   Specific, visual-only overrides for WooCommerce Blocks.
   The Block component DOM is controlled by WooCommerce; selectors may need
   revisiting after major WooCommerce updates. No checkout logic is altered.
*/
body.woocommerce-checkout,
body.woocommerce-cart {
  --ng-page: #f7f5f1;
  --ng-surface: #fffefa;
  --ng-surface-soft: #f6f3ec;
  --ng-ink: #282b28;
  --ng-muted: #656961;
  --ng-border: #e6e0d7;
  --ng-gold: #ae8d60;
  --ng-deep: #31332e;
  background: var(--ng-page) !important;
  font-size: 16px;
  line-height: 1.6;
}

/* More restrained surfaces, clearly separated editable form / totals. */
body.woocommerce-checkout :is(.wc-block-checkout__main, .wc-block-checkout__sidebar),
body.woocommerce-cart :is(.wc-block-cart__main, .wc-block-cart__sidebar) {
  background: var(--ng-surface) !important;
  border: 1px solid var(--ng-border) !important;
  border-radius: 14px !important;
  box-shadow: 0 7px 28px rgba(35, 36, 30, .035) !important;
}
body.woocommerce-checkout .wc-block-components-checkout-step__heading,
body.woocommerce-checkout .wc-block-components-title {
  margin-bottom: 16px;
}
body.woocommerce-checkout .wc-block-components-checkout-step__title {
  font-size: clamp(18px, 1.8vw, 21px);
  font-weight: 680;
  line-height: 1.45;
}

/* Product row: product name and totals have their own lines instead of
   competing for a very narrow third column. No merchandise details hidden. */
body.woocommerce-checkout .wc-block-components-order-summary-item {
  display: grid !important;
  grid-template-columns: 56px minmax(0, 1fr) !important;
  grid-template-rows: auto auto !important;
  column-gap: 13px !important;
  row-gap: 7px !important;
  align-items: start !important;
  padding: 17px 0 !important;
  min-width: 0 !important;
  border-bottom: 1px solid var(--ng-border) !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__image {
  grid-column: 1 !important;
  grid-row: 1 / span 2 !important;
  align-self: start !important;
  width: 56px !important;
  min-width: 0 !important;
  margin: 0 !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__image img {
  width: 56px !important;
  height: 56px !important;
  object-fit: cover;
  border: 1px solid var(--ng-border);
  border-radius: 9px !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__description {
  grid-column: 2 !important;
  grid-row: 1 !important;
  min-width: 0 !important;
  margin: 0 !important;
  overflow-wrap: break-word !important;
  word-break: normal !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__description .wc-block-components-product-name {
  display: block !important;
  width: 100%;
  font-weight: 700 !important;
  font-size: 15px !important;
  line-height: 1.55 !important;
  color: var(--ng-ink) !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__total-price {
  grid-column: 2 !important;
  grid-row: 2 !important;
  margin: 0 !important;
  min-width: 0 !important;
  text-align: left !important;
  justify-self: start !important;
  font-weight: 680 !important;
  font-size: 15px !important;
  line-height: 1.5 !important;
  white-space: normal !important;
}
body.woocommerce-checkout .wc-block-components-order-summary-item__quantity {
  right: -5px !important;
  top: -7px !important;
  min-width: 23px;
  height: 23px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  font-weight: 650;
  border-radius: 99px;
  background: #f0eadf !important;
}
/* Discounts are real financial data. Keep them visible but not visually loud. */
body.woocommerce-checkout :is(.wc-block-components-sale-badge, .wc-block-components-product-badge, .wc-block-components-product-price__value--regular) {
  max-width: 100% !important;
  overflow-wrap: break-word !important;
  white-space: normal !important;
}
body.woocommerce-checkout :is(.wc-block-components-sale-badge,.wc-block-components-product-badge) {
  display: inline-block !important;
  vertical-align: middle;
  width: fit-content;
  padding: 3px 7px !important;
  margin: 4px 0 !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  line-height: 1.45 !important;
  letter-spacing: 0 !important;
  color: #755c36 !important;
  background: #f1ebe0 !important;
  border: none !important;
  border-radius: 5px !important;
}
body.woocommerce-checkout .wc-block-components-product-metadata,
body.woocommerce-checkout .wc-block-components-product-details {
  margin-top: 5px !important;
  font-size: 12px !important;
  color: var(--ng-muted) !important;
  line-height: 1.6 !important;
}
body.woocommerce-checkout .wc-block-components-order-summary .wc-block-components-order-summary__content {
  padding-block: 0 !important;
}
/* Summary price rows: calm labels with one strong grand total. */
body.woocommerce-checkout .wc-block-components-totals-item {
  padding-block: 14px !important;
  align-items: baseline !important;
}
body.woocommerce-checkout .wc-block-components-totals-item__label {
  font-size: 14px !important;
  color: var(--ng-muted) !important;
}
body.woocommerce-checkout .wc-block-components-totals-item__value,
body.woocommerce-checkout .wc-block-components-formatted-money-amount {
  font-variant-numeric: tabular-nums;
}
body.woocommerce-checkout .wc-block-components-totals-footer-item__value,
body.woocommerce-checkout .wc-block-components-totals-footer-item .wc-block-components-formatted-money-amount {
  color: var(--ng-ink) !important;
  font-weight: 760 !important;
  font-size: clamp(18px,1.5vw,22px) !important;
}

/* Compact but comfortable card-like payment method selection.
   Avoid altering actual payment input elements/gateway generated forms. */
body.woocommerce-checkout .wc-block-components-radio-control-accordion-option {
  border: 1px solid var(--ng-border) !important;
  border-radius: 10px !important;
  margin-block: 9px !important;
  background: #fffefa !important;
  overflow: visible !important;
}
body.woocommerce-checkout .wc-block-components-radio-control-accordion-option:has(input:checked) {
  border-color: #c2aa83 !important;
  background: #fdfaf4 !important;
}
body.woocommerce-checkout .wc-block-components-radio-control__option {
  min-height: 52px !important;
  padding: 14px 16px !important;
  border-radius: 10px !important;
}
body.woocommerce-checkout .wc-block-components-radio-control__label {
  font-size: 15px !important;
  font-weight: 620 !important;
  line-height: 1.5 !important;
  color: var(--ng-ink) !important;
}
body.woocommerce-checkout .wc-block-components-radio-control-accordion-content {
  margin: 0 14px 12px !important;
  padding: 12px 14px !important;
  background: var(--ng-surface-soft) !important;
  border-radius: 8px !important;
  font-size: 14px !important;
  line-height: 1.75 !important;
}
body.woocommerce-checkout .wc-block-components-radio-control-accordion-content p {
  margin: 0 !important;
  line-height: 1.75 !important;
}
body.woocommerce-checkout .wc-block-components-checkbox__label {
  font-size: 14px !important;
  line-height: 1.6 !important;
}

/* Regular checkout form inputs: consistent spacing and very legible labels. */
body.woocommerce-checkout .wc-block-components-text-input input,
body.woocommerce-checkout .wc-block-components-combobox input,
body.woocommerce-checkout .wc-block-components-text-input select {
  min-height: 50px !important;
  border-radius: 8px !important;
}
body.woocommerce-checkout .wc-block-components-checkout-place-order-button,
body.woocommerce-checkout #place_order {
  min-height: 54px !important;
  border-radius: 9px !important;
  font-size: 15px !important;
  letter-spacing: .02em;
}

@media (max-width: 780px) {
  body.woocommerce-checkout,
  body.woocommerce-cart {
    font-size: 15px;
  }
  body.woocommerce-checkout :is(.wc-block-checkout__main,.wc-block-checkout__sidebar),
  body.woocommerce-cart :is(.wc-block-cart__main,.wc-block-cart__sidebar) {
    padding: 17px 14px !important;
    border-radius: 12px !important;
  }
  body.woocommerce-checkout .wc-block-components-order-summary-item {
    grid-template-columns: 52px minmax(0,1fr) !important;
    column-gap: 12px !important;
  }
  body.woocommerce-checkout .wc-block-components-order-summary-item__image,
  body.woocommerce-checkout .wc-block-components-order-summary-item__image img {
    width: 52px !important;
    height: 52px !important;
  }
  body.woocommerce-checkout .wc-block-components-radio-control-accordion-content {
    margin-inline: 10px !important;
    padding: 11px 12px !important;
  }
}
