/* Bag, checkout, order confirmation and account pages only. */

.ej-checkout-header {
	display: grid;
	grid-template-columns: 1fr auto;
	align-items: center;
	height: var(--ej-header);
	padding-inline: var(--ej-gutter);
	border-bottom: 1px solid var(--ej-rule);
	background: var(--ej-white);
	font-size: var(--ej-small);
}
.ej-checkout-header__bag a { display: inline-flex; align-items: center; justify-content: flex-end; min-width: 44px; min-height: 44px; text-decoration: none; }
.ej-checkout-header__bag a:hover { text-decoration: underline; text-underline-offset: 0.35em; }

@media (min-width: 1024px) {
	.ej-checkout-header { grid-template-columns: 1fr auto 1fr; }
	.ej-checkout-header .ej-logo { grid-column: 2; }
	.ej-checkout-header__bag { grid-column: 3; justify-self: end; }
}

/* WooCommerce caps these titles at 1000px, which pushes them out of line. */
.woocommerce-cart .ej-page > .wp-block-post-title,
.woocommerce-checkout .ej-page > .wp-block-post-title { max-width: 1200px !important; }

/* ---------- Shared WooCommerce pieces ---------- */

.woocommerce-cart .ej-page,
.woocommerce-checkout .ej-page,
.woocommerce-order-received main { padding: clamp(32px, 4vw, 64px) var(--ej-gutter) var(--ej-section); }

.ej-page .wc-block-components-button:not(.is-link),
.woocommerce-account .woocommerce .button {
	min-height: 52px;
	border: 0;
	border-radius: 0;
	background: var(--ej-petrol);
	color: var(--ej-bone);
	font-family: var(--wp--preset--font-family--inter);
	font-size: var(--wp--preset--font-size--body);
	font-weight: 400;
}
.ej-page .wc-block-components-button:not(.is-link):hover,
.woocommerce-account .woocommerce .button:hover { background: var(--ej-ink); color: var(--ej-bone); }
.ej-page .wc-block-components-button:not(.is-link):disabled { opacity: 0.5; }

.ej-page .wc-block-components-text-input input,
.ej-page .wc-block-components-textarea,
.ej-page .wc-blocks-components-select .wc-blocks-components-select__container,
.ej-page .wc-blocks-components-select .wc-blocks-components-select__select,
.ej-page .wc-block-components-quantity-selector,
.ej-page .wc-block-components-quantity-selector::after,
.ej-page .wc-block-components-radio-control--highlight-checked,
.ej-page .wc-block-components-radio-control--highlight-checked::after,
.ej-page .wc-block-components-notice-banner,
.ej-page .wp-block-woocommerce-checkout-order-summary-block { border-radius: 0 !important; }

.ej-page .wc-block-components-checkout-order-summary__title-text { font-family: var(--ej-caslon); font-size: 1.5rem; font-weight: 400; }
.ej-page .wc-block-components-order-summary-item__image > img { height: auto; aspect-ratio: 3 / 4; object-fit: cover; }

.ej-page .wc-block-components-title.wc-block-components-title,
.woocommerce-account .woocommerce h2,
.woocommerce-order-received main h2 {
	font-family: var(--ej-caslon);
	font-size: 1.5rem;
	font-weight: 400;
	line-height: 1.2;
}

/* ---------- Bag ---------- */

.ej-page .wc-block-cart__totals-title.wc-block-cart__totals-title {
	padding-block: 0 16px;
	font-family: var(--ej-caslon);
	font-size: 1.5rem;
	font-weight: 400;
	text-align: left;
	text-transform: none;
}
.ej-page .wc-block-cart-items .wc-block-cart-items__header { font-size: var(--ej-small); font-weight: 400; text-transform: none; }
.ej-page .wc-block-cart-items .wc-block-cart-item__image img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.ej-page .wc-block-components-product-name { font-size: var(--wp--preset--font-size--body); text-decoration: none; }
.ej-page .wc-block-components-product-name:hover { text-decoration: underline; text-underline-offset: 0.3em; }
.ej-page .wc-block-cart-item__remove-link { min-height: 44px; }

.ej-bag-empty { padding-block: 24px 48px; }
.ej-page .wp-block-woocommerce-empty-cart-block > * { margin-block: 0; text-align: left; }

.woocommerce-cart .ej-page > .wp-block-post-title,
.woocommerce-checkout .ej-page > .wp-block-post-title { margin-block-start: 0; }
.ej-page .wc-block-components-product-name { font-family: var(--wp--preset--font-family--inter); }
.ej-page .wc-block-components-address-card,
.ej-page .checkout-order-summary-block-fill,
.ej-page .checkout-order-summary-block-fill-wrapper > * { border-radius: 0 !important; }

@media (max-width: 1023.98px) {
	.ej-page .wc-block-components-quantity-selector { width: 136px; min-height: 44px; }
	.ej-page .wc-block-components-quantity-selector .wc-block-components-quantity-selector__button { min-width: 44px; min-height: 44px; }
	.ej-page .wc-block-cart-item__remove-link { min-width: 44px; }
	.ej-page .wc-block-cart-items a.wc-block-components-product-name { display: inline-flex; align-items: center; min-height: 44px; }
}
/* ---------- Account ---------- */

.woocommerce-account .woocommerce form.login,
.woocommerce-account .woocommerce form.lost_reset_password { max-width: 440px; margin: 0; padding: 0; border: 0; border-radius: 0; }
.woocommerce-account .woocommerce form .form-row { padding: 0; }
.woocommerce-account .woocommerce form .form-row label { font-size: var(--ej-small); }
.woocommerce-account .woocommerce form .form-row input.input-text {
	min-height: 48px;
	padding: 0;
	border: 0;
	border-bottom: 1px solid var(--ej-ink);
	border-radius: 0;
	background: none;
	color: var(--ej-ink);
	font: inherit;
	font-size: 1rem;
}
.woocommerce-account .woocommerce form.login .woocommerce-form-login__rememberme { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 8px 0; }
.woocommerce-account .woocommerce form.login .woocommerce-form-login__rememberme input { width: 20px; height: 20px; margin: 0; accent-color: var(--ej-petrol); }
.woocommerce-account .woocommerce form.login .woocommerce-form-login__submit { float: none; width: 100%; margin: 0; }
.woocommerce-account .woocommerce .lost_password a { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--ej-small); }

.woocommerce-account .woocommerce-MyAccount-navigation ul { margin: 0 0 32px; padding: 0; list-style: none; }
.woocommerce-account .woocommerce-MyAccount-navigation a { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--ej-rule); font-size: var(--ej-small); text-decoration: none; }
.woocommerce-account .woocommerce-MyAccount-navigation a:hover,
.woocommerce-account .woocommerce-MyAccount-navigation .is-active a { text-decoration: underline; text-underline-offset: 0.35em; }

/* Menu */
.woocommerce-account .woocommerce .woocommerce-MyAccount-navigation li { margin: 0; padding: 0; }

/* Messages, such as "Confirm your email address" */
.woocommerce-account .wc-block-components-notice-banner { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 32px; padding: 16px; border: 1px solid var(--ej-rule); border-radius: 0; background: none; color: var(--ej-ink); font-size: var(--ej-small); }
.woocommerce-account .wc-block-components-notice-banner > svg { flex: none; }
.woocommerce-account .wc-block-components-notice-banner__content { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.woocommerce-account .wc-block-components-notice-banner .button.wc-forward { order: 1; margin: 0; opacity: 1; }

/* Buttons */
.woocommerce-account .woocommerce .button { display: inline-flex; align-items: center; justify-content: center; padding: 0 28px; line-height: 1.2; text-decoration: none; }
.woocommerce-account .woocommerce .wc-block-components-notice-banner .button { min-height: 44px; padding-inline: 20px; font-size: var(--ej-small); }
.woocommerce-account .woocommerce table .button,
.woocommerce-account .woocommerce table .button:hover { min-height: 44px; padding: 0; background: none; color: var(--ej-ink); font-size: var(--ej-small); text-decoration: underline; text-underline-offset: 0.35em; }
.woocommerce-account .woocommerce table.shop_table .button { display: inline-flex; margin: 0 16px 0 0; }

/* Orders */
.woocommerce-account .woocommerce table.shop_table tr :is(th, td) { background: none !important; }
.woocommerce-account .woocommerce table.shop_table { margin: 0 0 40px; border: 0; border-radius: 0; border-collapse: collapse; font-size: var(--ej-small); }
.woocommerce-account .woocommerce table.shop_table :is(th, td) { padding: 14px 12px 14px 0; border: 0; border-bottom: 1px solid var(--ej-rule); font-weight: 400; text-align: left; vertical-align: top; }
.woocommerce-account .woocommerce table.woocommerce-orders-table :is(th, td) { vertical-align: middle; }
.woocommerce-account .woocommerce table.shop_table thead th { color: var(--ej-muted); }
.woocommerce-account .woocommerce table.order_details :is(th, td):last-child { padding-right: 0; text-align: right; }
.woocommerce-account .woocommerce table.shop_table :is(strong, .woocommerce-Price-amount) { font-weight: 400; }
.woocommerce-account .woocommerce table .wc-item-meta { margin: 8px 0 0; padding: 0; list-style: none; }
.woocommerce-account .woocommerce table .wc-item-meta li { margin: 0; padding: 0; color: var(--ej-muted); }
.woocommerce-account .woocommerce table .wc-item-meta :is(p, strong) { display: inline; float: none; margin: 0; }

/* Addresses */
.woocommerce-account .woocommerce address { padding: 0; border: 0; border-radius: 0; font-size: var(--wp--preset--font-size--body); font-style: normal; line-height: 1.6; }
.woocommerce-account .woocommerce :is(.woocommerce-Addresses, .woocommerce-columns--addresses) { display: grid; gap: 32px; }
.woocommerce-account .woocommerce :is(.woocommerce-Addresses, .woocommerce-columns--addresses)::before,
.woocommerce-account .woocommerce :is(.woocommerce-Addresses, .woocommerce-columns--addresses)::after { display: none; }
.woocommerce-account .woocommerce :is(.woocommerce-Addresses, .woocommerce-columns--addresses) > * { float: none; width: auto; max-width: none; margin: 0; }
.woocommerce-account .woocommerce .woocommerce-Address-title { display: block; }
.woocommerce-account .woocommerce .woocommerce-Address-title :is(h2, .edit) { float: none; margin: 0; }
.woocommerce-account .woocommerce .woocommerce-Address-title .edit { display: inline-flex; align-items: center; min-height: 44px; font-size: var(--ej-small); }

/* Forms */
.woocommerce-account .woocommerce-MyAccount-content form .form-row { margin: 0 0 20px; }
.woocommerce-account .woocommerce form :is(select, .select2-selection--single) { height: 48px; padding: 0; border: 0; border-bottom: 1px solid var(--ej-ink); border-radius: 0; background-color: transparent; color: var(--ej-ink); font-size: 1rem; }
.woocommerce-account .woocommerce form .select2-container .select2-selection--single .select2-selection__rendered { height: 47px; padding: 0 24px 0 0 !important; color: var(--ej-ink); line-height: 47px; }
.woocommerce-account .woocommerce form .select2-selection--single .select2-selection__arrow { top: 0; right: 0; height: 47px; }
.woocommerce-account .woocommerce form .select2-container--focus .select2-selection--single { outline: 2px solid var(--ej-ink); outline-offset: 3px; }
.woocommerce-account .woocommerce form .required { color: inherit; }
.woocommerce-account .woocommerce form fieldset { margin: 32px 0 0; padding: 0; border: 0; }
.woocommerce-account .woocommerce form legend { margin-bottom: 20px; padding: 0; font-family: var(--ej-caslon); font-size: 1.5rem; line-height: 1.2; }
.woocommerce-account .woocommerce form em { color: var(--ej-muted); font-size: var(--ej-small); font-style: normal; }
.woocommerce-account .woocommerce form .show-password-input { width: 44px; height: 44px; }
.woocommerce-account .woocommerce form.lost_reset_password .button { width: 100%; margin-top: 20px; }
.woocommerce-account .woocommerce form.login > .form-row { margin: 0 0 20px; }

/* 768px matches the width where WooCommerce switches to its phone layout. */
@media (max-width: 768px) {
	.woocommerce-account .woocommerce table.woocommerce-orders-table thead { display: none; }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody tr { display: block; padding-block: 12px; border-bottom: 1px solid var(--ej-rule); }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody :is(th, td) { display: flex; align-items: center; justify-content: flex-end; gap: 4px; min-height: 36px; padding: 0; border: 0; text-align: right !important; }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody :is(th, td)::before { float: none; margin-right: auto; color: var(--ej-muted); font-weight: 400; }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody :is(th, .woocommerce-orders-table__cell-order-actions) { justify-content: flex-start; }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody .woocommerce-orders-table__cell-order-actions::before { display: none; }
	.woocommerce-account .woocommerce table.woocommerce-orders-table tbody th a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (min-width: 768px) {
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation) { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: clamp(32px, 6vw, 96px); align-items: start; }
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation)::before,
	.woocommerce-account .woocommerce:has(> .woocommerce-MyAccount-navigation)::after { display: none; }
	.woocommerce-account .woocommerce > :is(.woocommerce-MyAccount-navigation, .woocommerce-MyAccount-content) { float: none; width: auto; }
	.woocommerce-account .woocommerce :is(.woocommerce-Addresses, .woocommerce-columns--addresses) { grid-template-columns: 1fr 1fr; }
}

/* Checkout: tap areas at least 44px tall for the checkboxes. The smaller top margin keeps them where they were. */
.wc-block-checkout .wc-block-components-checkbox { margin-top: 4px; }
.wc-block-checkout .wc-block-components-checkbox label { padding-block: 12px; }
