/**
 * WooCommerce: cart, checkout and the student's account.
 *
 * These pages were stock WooCommerce — a different typeface, different
 * buttons, different spacing from the rest of the site. They are also
 * the pages people are on while handing over money, which is exactly
 * where an unfamiliar look costs sales.
 *
 * Two different systems are styled here, because WooCommerce uses two:
 *
 *   1. Cart and Checkout are blocks (.wc-block-*). Their markup is
 *      rendered by JavaScript, so this file targets the stable
 *      component classes rather than structure.
 *   2. My Account is the older shortcode (.woocommerce-MyAccount-*).
 *
 * Colour, type and spacing only. No layout is moved and no element is
 * hidden, so a WooCommerce update cannot leave the page broken — at
 * worst a new element arrives unstyled.
 */

/* =========================================================================
   Shared page frame
   ====================================================================== */

.woocommerce-page .site-main,
.woocommerce .site-main {
	padding-block: clamp(2rem, 5vw, 4rem);
}

.woocommerce-page .wrap > h1,
.woocommerce-page .entry-title {
	margin-bottom: 1.5rem;
}

/* ---- Notices ------------------------------------------------------------
   Stock notices are grey boxes with a coloured left edge. Ours carry the
   brand and, more importantly, read as deliberate rather than as an
   error the site did not expect.
   ------------------------------------------------------------------- */

.woocommerce-message,
.woocommerce-info,
.woocommerce-error,
.wc-block-components-notice-banner {
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	padding: 1rem 1.15rem;
	background: #fff;
	box-shadow: var(--shadow-sm);
	font-size: .93rem;
	line-height: 1.6;
}

.woocommerce-message,
.wc-block-components-notice-banner.is-success {
	border-color: rgb(27 127 140 / 35%);
	background: rgb(27 127 140 / 7%);
}

.woocommerce-error,
.wc-block-components-notice-banner.is-error {
	border-color: rgb(179 45 46 / 35%);
	background: rgb(179 45 46 / 6%);
}

.woocommerce-info,
.wc-block-components-notice-banner.is-info {
	border-color: rgb(15 42 86 / 22%);
	background: rgb(15 42 86 / 5%);
}

/* =========================================================================
   Buttons — one button style across the whole site
   ====================================================================== */

.woocommerce a.button,
.woocommerce button.button,
.woocommerce input.button,
.woocommerce-page a.button,
.woocommerce-page button.button,
.wc-block-components-button:not(.is-link) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: .5rem;
	padding: .8rem 1.5rem;
	border: 1px solid transparent;
	border-radius: 999px;
	font-family: var(--font-sans);
	font-size: .95rem;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	cursor: pointer;
	color: var(--navy-deep);
	background: linear-gradient(180deg, var(--gold-light) -40%, var(--gold) 55%, var(--gold-deep) 160%);
	box-shadow: var(--shadow-gold), inset 0 1px 0 rgb(255 255 255 / 45%);
	transition: transform var(--fast) var(--ease), box-shadow var(--base) var(--ease), background-color var(--fast) var(--ease);
}

.woocommerce a.button:hover,
.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce-page a.button:hover,
.woocommerce-page button.button:hover,
.wc-block-components-button:not(.is-link):hover {
	transform: translateY(-1px);
	background: linear-gradient(180deg, #f7dca6 -40%, var(--gold-light) 55%, var(--gold) 160%);
	box-shadow: 0 2px 4px rgb(184 134 43 / 22%), 0 10px 24px rgb(184 134 43 / 28%), inset 0 1px 0 rgb(255 255 255 / 55%);
}

.woocommerce a.button:active,
.woocommerce button.button:active,
.wc-block-components-button:not(.is-link):active { transform: translateY(0); }

.woocommerce a.button:focus-visible,
.woocommerce button.button:focus-visible,
.wc-block-components-button:focus-visible {
	outline: 2px solid var(--navy);
	outline-offset: 3px;
}

/* Secondary actions should not compete with the one that completes the
   purchase. */
.woocommerce a.button.wc-backward,
.woocommerce button.button[name="update_cart"],
.wc-block-components-button.is-link {
	background: transparent;
	color: var(--navy);
	border-color: var(--line);
	box-shadow: none;
}

.woocommerce a.button.wc-backward:hover,
.woocommerce button.button[name="update_cart"]:hover {
	background: rgb(15 42 86 / 6%);
	border-color: rgb(15 42 86 / 25%);
	box-shadow: none;
}

/* The one button that takes the money. */
.wc-block-components-checkout-place-order-button {
	width: 100%;
	padding-block: 1.05rem;
	font-size: 1.02rem;
}

/* =========================================================================
   Form fields
   ====================================================================== */

.woocommerce form .form-row input.input-text,
.woocommerce form .form-row textarea,
.woocommerce form .form-row select,
.wc-block-components-text-input input,
.wc-block-components-textarea,
.wc-block-components-select__select {
	width: 100%;
	padding: .85rem 1rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	background: #fff;
	font-family: var(--font-sans);
	font-size: 1rem;              /* 16px minimum, or iOS zooms on focus */
	line-height: 1.4;
	color: var(--ink);
	transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}

.woocommerce form .form-row input.input-text:focus,
.woocommerce form .form-row textarea:focus,
.woocommerce form .form-row select:focus,
.wc-block-components-text-input input:focus,
.wc-block-components-select__select:focus {
	outline: none;
	border-color: var(--gold);
	box-shadow: 0 0 0 3px rgb(217 164 65 / 22%);
}

.woocommerce form .form-row label,
.wc-block-components-checkout-step__heading,
.wc-block-components-title {
	font-family: var(--font-sans);
	font-weight: 700;
	color: var(--navy);
}

.woocommerce form .form-row label { margin-bottom: .35rem; display: block; }

/* The floating label the block checkout uses. */
.wc-block-components-text-input label {
	color: var(--muted);
	font-weight: 600;
}

.wc-block-components-text-input.is-active label {
	color: var(--navy);
}

/* ---- Validation ---------------------------------------------------------
   Red text alone fails anyone who cannot distinguish it. Each error also
   carries a thicker border and a tinted field, so the signal survives
   without colour.
   ------------------------------------------------------------------- */

.woocommerce form .form-row.woocommerce-invalid input.input-text,
.wc-block-components-text-input.has-error input {
	border-color: #b32d2e;
	border-width: 2px;
	background: rgb(179 45 46 / 4%);
}

.wc-block-components-validation-error,
.woocommerce-error li {
	color: #a32627;
	font-size: .85rem;
	font-weight: 600;
}

.woocommerce form .form-row .required {
	color: #b32d2e;
	text-decoration: none;
	border: 0;
}

/* =========================================================================
   Checkout layout
   ====================================================================== */

.wc-block-checkout__form,
.wc-block-components-sidebar {
	font-family: var(--font-sans);
}

.wc-block-components-checkout-step {
	padding-bottom: 1.6rem;
	margin-bottom: 1.6rem;
	border-bottom: 1px solid var(--line);
}

.wc-block-components-checkout-step:last-child { border-bottom: 0; }

.wc-block-components-checkout-step__title {
	font-family: var(--font-sans);
	font-size: 1.12rem;
	font-weight: 800;
	color: var(--navy);
}

/* ---- Order summary ------------------------------------------------------
   Lifted onto a panel: it is the part people re-read before paying, so
   it should look like a document rather than loose text.
   ------------------------------------------------------------------- */

.wc-block-components-sidebar .wc-block-components-totals-wrapper,
.wc-block-components-order-summary {
	background: #fff;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	box-shadow: var(--shadow-sm);
}

.wc-block-components-sidebar .wc-block-components-totals-wrapper {
	padding: 1rem 1.15rem;
	margin-bottom: .85rem;
}

.wc-block-components-totals-item__label { color: var(--muted); font-weight: 600; }
.wc-block-components-totals-item__value { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.wc-block-components-totals-footer-item {
	font-size: 1.08rem;
	border-top: 1px solid var(--line);
	padding-top: .85rem;
}

.wc-block-components-totals-footer-item .wc-block-components-totals-item__value {
	color: var(--navy);
	font-weight: 800;
	font-size: 1.2rem;
}

/* A discounted line should read the same here as on the course page. */
.wc-block-components-product-price del,
.woocommerce del {
	opacity: .6;
	font-weight: 600;
}

.wc-block-components-product-price ins,
.woocommerce ins {
	text-decoration: none;
	background: none;
	font-weight: 800;
	color: var(--navy);
}

/* ---- Payment methods ---------------------------------------------------- */

.wc-block-components-radio-control__option {
	padding: .9rem 1rem .9rem 2.6rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-sm);
	margin-bottom: .55rem;
	background: #fff;
	transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), background-color var(--fast) var(--ease);
}

.wc-block-components-radio-control__option:hover {
	border-color: rgb(217 164 65 / 55%);
}

.wc-block-components-radio-control__option-checked {
	border-color: var(--gold);
	background: rgb(217 164 65 / 7%);
	box-shadow: 0 0 0 3px rgb(217 164 65 / 16%);
}

/* =========================================================================
   My Account
   ====================================================================== */

.woocommerce-account .woocommerce {
	display: grid;
	grid-template-columns: minmax(200px, 250px) 1fr;
	gap: clamp(1.25rem, 3vw, 2.5rem);
	align-items: start;
}

/* The login form is a single centred card, not a two-column dashboard. */
.woocommerce-account:not(.logged-in) .woocommerce { display: block; }

.woocommerce-account .woocommerce-MyAccount-navigation {
	position: sticky;
	top: calc(var(--header-h, 72px) + 1rem);
	padding: .5rem;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: var(--glass-bg, #fff);
	-webkit-backdrop-filter: var(--glass-blur);
	backdrop-filter: var(--glass-blur);
	box-shadow: var(--shadow-sm);
}

.woocommerce-MyAccount-navigation ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce-MyAccount-navigation li a {
	display: block;
	padding: .7rem .85rem;
	border-radius: var(--radius-sm);
	font-weight: 700;
	font-size: .93rem;
	color: var(--navy);
	text-decoration: none;
	transition: background-color var(--fast) var(--ease), color var(--fast) var(--ease), transform var(--fast) var(--ease);
}

.woocommerce-MyAccount-navigation li a:hover {
	background: rgb(15 42 86 / 6%);
	transform: translateX(2px);
}

.woocommerce-MyAccount-navigation li.is-active a {
	color: var(--navy-deep);
	background: rgb(217 164 65 / 22%);
	box-shadow: inset 2px 0 0 var(--gold);
}

.woocommerce-MyAccount-content {
	min-width: 0;                 /* lets wide tables scroll instead of overflow */
	padding: clamp(1.1rem, 3vw, 1.9rem);
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	background: #fff;
	box-shadow: var(--shadow-sm);
}

.woocommerce-MyAccount-content > p:first-child { margin-top: 0; }

/* ---- Tables (orders, downloads) ----------------------------------------- */

.woocommerce table.shop_table {
	width: 100%;
	border: 1px solid var(--line);
	border-radius: var(--radius-md);
	border-collapse: separate;
	border-spacing: 0;
	overflow: hidden;
	font-size: .92rem;
}

.woocommerce table.shop_table th {
	padding: .85rem 1rem;
	text-align: left;
	font-weight: 800;
	color: var(--navy);
	background: rgb(15 42 86 / 5%);
	border-bottom: 1px solid var(--line);
}

.woocommerce table.shop_table td {
	padding: .85rem 1rem;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
}

.woocommerce table.shop_table tr:last-child td { border-bottom: 0; }
.woocommerce table.shop_table tbody tr:hover td { background: rgb(217 164 65 / 6%); }

.woocommerce .woocommerce-Price-amount { font-variant-numeric: tabular-nums; }

/* ---- Login / register --------------------------------------------------- */

.woocommerce-form-login,
.woocommerce-form-register,
.woocommerce-ResetPassword {
	max-width: 440px;
	margin-inline: auto;
	padding: clamp(1.4rem, 4vw, 2.2rem);
	border: 1px solid var(--line);
	border-radius: var(--radius-lg);
	background: #fff;
	box-shadow: var(--shadow-md);
}

.woocommerce-form-login .button,
.woocommerce-form-register .button { width: 100%; }

.woocommerce-form-login__rememberme { font-size: .88rem; color: var(--muted); }

.woocommerce-LostPassword {
	margin-top: .9rem;
	font-size: .88rem;
	text-align: center;
}

/* =========================================================================
   Phones

   The account dashboard stacks, and tables are allowed to scroll
   sideways rather than squeezing a date column to nothing.
   ====================================================================== */

@media (max-width: 782px) {
	.woocommerce-account .woocommerce { grid-template-columns: 1fr; }

	.woocommerce-account .woocommerce-MyAccount-navigation {
		position: static;
		padding: .3rem;
	}

	.woocommerce-MyAccount-navigation ul {
		display: flex;
		gap: .25rem;
		overflow-x: auto;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
	}

	.woocommerce-MyAccount-navigation ul::-webkit-scrollbar { display: none; }

	.woocommerce-MyAccount-navigation li a {
		white-space: nowrap;
		padding: .6rem .8rem;
		font-size: .88rem;
	}

	.woocommerce-MyAccount-navigation li.is-active a {
		box-shadow: inset 0 -2px 0 var(--gold);
	}

	.woocommerce-MyAccount-content { padding: 1rem; }

	.woocommerce table.shop_table { display: block; overflow-x: auto; white-space: nowrap; }

	/* Nothing on a payment page should need a horizontal scroll. */
	.wc-block-checkout__form,
	.wc-block-components-sidebar { padding-inline: 0; }
}

@media (prefers-reduced-motion: reduce) {
	.woocommerce a.button,
	.woocommerce button.button,
	.wc-block-components-button,
	.woocommerce-MyAccount-navigation li a {
		transition: none;
	}
}
