/**
 * Block Checkout — GOBI brand (light)
 *
 * Scoped styles for the WooCommerce Cart & Checkout blocks.
 * Loaded only on the block cart/checkout pages via
 * functions.php :: gobi_enqueue_block_checkout_styles().
 *
 * Feature: .claude/features/feature-block-checkout/
 * Scope: stock block UI + LIGHT GOBI brand only (see OUTPUT-implementation-plan.md).
 *
 * Accessibility (accessibility-lead pre-build guidance, 2026-07-13):
 *   - Primary CTA = green #265734 + white text (8.4:1). Bright orange #FF602D is an
 *     accent only — white-on-#FF602D fails AA (3.0:1), never use it for button text.
 *   - Inline link/text = #C2410C (5.18:1 on white); bright orange fails 4.5:1 as text.
 *   - Never remove a focus ring without a >=2px, >=3:1 replacement (slate #3A3E47).
 *   - Do NOT hide the blocks' native labels, required markers, or aria-live errors.
 *   - Do NOT restyle the express (Apple/Google/PayPal) wallet buttons — leave the
 *     third-party branding + focus intact.
 *
 * All selectors are scoped to the block wrappers so nothing leaks to header/footer.
 */

/* -------------------------------------------------------------------------
 * Brand tokens (reference only)
 *   CTA green            #265734   white text 8.4:1
 *   CTA green (hover)    #1E4429
 *   Accent orange        #FF602D   accents / large display only
 *   Link orange (text)   #C2410C   5.18:1 on white
 *   Body text            #434549
 *   Heading              #222
 *   Slate (focus ring)   #3A3E47
 * ---------------------------------------------------------------------- */

/* Headings — Anton display face, brand dark. */
.wc-block-checkout .wc-block-components-title,
.wc-block-checkout .wc-block-components-checkout-step__title,
.wp-block-woocommerce-cart .wc-block-components-title {
	font-family: "Anton", sans-serif;
	font-weight: 400;
	letter-spacing: 0.01em;
	color: #222;
}

/* Body copy in the blocks — brand body color. */
.wc-block-checkout,
.wp-block-woocommerce-cart {
	color: #434549;
}

/* -------------------------------------------------------------------------
 * Primary CTA buttons — Place order / Proceed to checkout.
 * Blue #1d2796 at rest, green #265734 on hover — matches the live classic button.
 * White text = 11.8:1 (blue) / 8.4:1 (green), both AA. No underline (button-styled).
 * Doubled class + !important to beat the block's own .contained specificity,
 * matching this theme's existing !important-heavy CSS convention.
 * ---------------------------------------------------------------------- */
.wc-block-checkout .wc-block-components-checkout-place-order-button.wc-block-components-button,
.wp-block-woocommerce-cart .wc-block-cart__submit-button.wc-block-components-button,
.wp-block-woocommerce-cart .wc-block-cart__submit-container .wc-block-components-button.contained {
	background-color: #1d2796 !important;
	border-color: #1d2796 !important;
	color: #fff !important;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.wc-block-checkout .wc-block-components-checkout-place-order-button.wc-block-components-button:hover,
.wp-block-woocommerce-cart .wc-block-cart__submit-button.wc-block-components-button:hover,
.wp-block-woocommerce-cart .wc-block-cart__submit-container .wc-block-components-button.contained:hover {
	background-color: #265734 !important;
	border-color: #265734 !important;
	color: #fff !important;
	text-decoration: none; /* button-styled: never underline on hover (house rule) */
}

/* -------------------------------------------------------------------------
 * Inline text links — darkened orange, underlined at rest.
 * Rest-state underline (not hover-only): these links sit inside runs of body
 * text (terms consent, login prompt), where WCAG 1.4.1 requires the link be
 * distinguishable by more than color. #C2410C vs body #434549 is only 1.85:1,
 * so color alone is not enough — the underline carries it. (accessibility-lead
 * review, 2026-07-13.) Scoped to non-button links so we never underline a button.
 * ---------------------------------------------------------------------- */
.wc-block-checkout a:not(.wc-block-components-button),
.wp-block-woocommerce-cart a:not(.wc-block-components-button) {
	color: #C2410C;
	text-decoration: underline;
	transition: color 0.2s ease;
}

.wc-block-checkout a:not(.wc-block-components-button):hover,
.wc-block-checkout a:not(.wc-block-components-button):focus,
.wp-block-woocommerce-cart a:not(.wc-block-components-button):hover,
.wp-block-woocommerce-cart a:not(.wc-block-components-button):focus {
	color: #C2410C;
	text-decoration: underline;
}

/* -------------------------------------------------------------------------
 * Focus indicator — visible slate ring. ADDITIVE: we never remove the block's
 * native focus styles, we add a strong, high-contrast ring on top.
 * Slate on white = strong 3:1+; 2px thick, offset for clarity.
 * ---------------------------------------------------------------------- */
.wc-block-checkout a:focus-visible,
.wc-block-checkout button:focus-visible,
.wc-block-checkout input:focus-visible,
.wc-block-checkout select:focus-visible,
.wc-block-checkout textarea:focus-visible,
.wc-block-checkout .wc-block-components-button:focus-visible,
.wp-block-woocommerce-cart a:focus-visible,
.wp-block-woocommerce-cart button:focus-visible,
.wp-block-woocommerce-cart input:focus-visible,
.wp-block-woocommerce-cart select:focus-visible,
.wp-block-woocommerce-cart textarea:focus-visible,
.wp-block-woocommerce-cart .wc-block-components-button:focus-visible {
	outline: 2px solid #3A3E47;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Form inputs — light brand accent on the focused field border.
 * Additive only: we do not touch labels, required markers, or placeholders
 * (keeping the block's native accessible names + AA placeholder contrast).
 * ---------------------------------------------------------------------- */
.wc-block-checkout .wc-block-components-text-input input:focus,
.wc-block-checkout .wc-block-components-text-input.is-active input {
	border-color: #265734;
}

/* -------------------------------------------------------------------------
 * Reduced motion — drop the transitions we added to an instant state change.
 * ---------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	.wc-block-checkout .wc-block-components-checkout-place-order-button.wc-block-components-button,
	.wp-block-woocommerce-cart .wc-block-cart__submit-button.wc-block-components-button,
	.wp-block-woocommerce-cart .wc-block-cart__submit-container .wc-block-components-button.contained,
	.wc-block-checkout a:not(.wc-block-components-button),
	.wp-block-woocommerce-cart a:not(.wc-block-components-button) {
		transition: none;
	}
}

/* -------------------------------------------------------------------------
 * Inline Terms & Conditions disclosure (js/block-checkout-terms.js).
 * The native terms link is enhanced to role="button"; clicking expands the
 * full terms inline below the checkbox instead of navigating away.
 * Collapsed state = the panel carries [hidden] (out of the a11y tree).
 * ---------------------------------------------------------------------- */
.gobi-terms-inline {
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.25s ease;
}

.gobi-terms-inline[hidden] {
	display: none;
}

.gobi-terms-inline__inner {
	margin: 0.6em 0 0;
	padding: 0.9em 1.1em;
	border: 1px solid #d8d8d8;
	border-radius: 4px;
	background: #fff;
	font-size: 0.9em;
	line-height: 1.5;
}

/* Caret affordance on the trigger — rotates when expanded (shape + state,
   not color alone). Pseudo-element is decorative / ignored by AT. */
.wc-block-checkout__terms a[aria-expanded]::after {
	content: "";
	display: inline-block;
	width: 0.5em;
	height: 0.5em;
	margin-left: 0.4em;
	vertical-align: middle;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.2s ease;
}

.wc-block-checkout__terms a[aria-expanded="true"]::after {
	transform: rotate(-135deg);
}

@media (prefers-reduced-motion: reduce) {
	.gobi-terms-inline {
		transition: none;
	}
	.wc-block-checkout__terms a[aria-expanded]::after {
		transition: none;
	}
}

/* -------------------------------------------------------------------------
 * Express Checkout box — complete border.
 * WooCommerce leaves the content box's TOP border to pseudo-elements on the
 * title (a fieldset-legend effect); those render inconsistently here (top edge
 * open). Give the box its own full border + radius and float the title above
 * it, so it no longer depends on the pseudo-element mechanism. !important to
 * beat WooCommerce's equal-specificity rules regardless of stylesheet order.
 * ---------------------------------------------------------------------- */
.wc-block-components-express-payment--checkout .wc-block-components-express-payment__content {
	border-top: 1px solid color-mix( in srgb, currentColor 20%, transparent ) !important;
	border-radius: 4px !important;
	margin-top: 0 !important;
}

.wc-block-components-express-payment--checkout .wc-block-components-express-payment__title-container {
	position: static !important;
	margin-bottom: 0.5rem;
}

.wc-block-components-express-payment--checkout .wc-block-components-express-payment__title {
	transform: none !important;
}

.wc-block-components-express-payment--checkout .wc-block-components-express-payment__title-container::before,
.wc-block-components-express-payment--checkout .wc-block-components-express-payment__title-container::after {
	display: none !important;
}

/* -------------------------------------------------------------------------
 * Clean "panel" treatment (Shopify-style) — 2026-07-14.
 * The block leaves these bordered regions transparent, showing the gray page
 * background. Filling them white makes each read as a distinct card/panel.
 * First pass — refine on dev.
 * ---------------------------------------------------------------------- */

/* Order summary sidebar */
.wp-block-woocommerce-checkout-order-summary-block {
	background: #fff;
}

/* Express Checkout box (already bordered by the fix above) */
.wc-block-components-express-payment--checkout .wc-block-components-express-payment__content {
	background: #fff;
}

/* Shipping option rows */
.wc-block-components-shipping-rates-control__package--multiple {
	background: #fff;
}

/* Payment methods panel (Credit card / Affirm / PayPal) */
.wc-block-checkout__payment-method {
	background: #fff;
}

/* -------------------------------------------------------------------------
 * Authorize.net inline card row (.wc-inline-card-element) — the gateway's
 * block integration renders card number / MM/YY / CVC as plain <input>s
 * inside its own compact bordered row (styled-components; only the
 * wc-inline-card-element / wc-block-authnet-gateway-container classes are
 * stable). Flatsome's global input styles (fixed ~2.507em height, white
 * background) inflate those inputs so they paint over the row's border,
 * leaving it visible only at the edges. Reset the inner inputs so the row
 * renders as the gateway designed it, and stretch the shrink-wrapping
 * inline-flex wrapper so the row spans the panel like every other field.
 * (Replaces earlier .wc-authnet-cc-form rules — that's an element ID on the
 * classic checkout, not a class; the selector matched nothing anywhere.)
 * ---------------------------------------------------------------------- */
.wc-block-checkout .wc-inline-card-element input {
	height: auto;
	min-height: 0;
	margin: 0;
	border: 0;
	box-shadow: none;
	background-color: transparent;
	border-radius: 0;
}

.wc-block-checkout .wc-inline-card-element > div {
	display: flex;
	width: 100%;
}

/* Row border: the gateway ships #BDBDBD (1.88:1 on white) — fails the 3:1
   non-text-contrast floor, and it's the sole field boundary once the
   placeholders are replaced by typed digits. #767676 = 4.5:1.
   accessibility-lead review 2026-07-14 (round 2). */
.wc-block-checkout .wc-inline-card-element > div > div {
	flex: 1;
	border-color: #767676;
}

.wc-block-checkout .wc-inline-card-element input:first-of-type {
	flex: 1 1 auto;
	width: auto;
}

/* Group-level focus ring: input:focus-visible covers keyboard focus today,
   but this survives a gateway switch to Accept.js iframes (focus-within
   fires on the wrapper even when focus is inside a cross-origin iframe)
   and gives mouse focus a guaranteed >=3:1 indicator. */
.wc-block-checkout .wc-inline-card-element:focus-within {
	outline: 2px solid #3A3E47;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Trust badges — "Guaranteed Safe Checkout" banner appended below the checkout
 * block (functions.php :: gobi_append_checkout_trust_badges). Constrained from
 * the source 1200px to a tasteful width and centered.
 * ---------------------------------------------------------------------- */
.gobi-trust-badges {
	margin: 24px auto 0;
	max-width: 560px;
	padding: 0 16px;
	text-align: center;
}

.gobi-trust-badges img {
	display: block;
	width: 100%;
	max-width: 100%;
	height: auto;
	margin: 0 auto;
}
