/**
 * The member area.
 *
 * Consumes the branding custom properties rather than declaring colours, so a
 * creator who sets their accent gets it here too - and so nothing has to
 * !important its way past a theme. Every value falls back, because this
 * stylesheet can legitimately render on a page where branding_style() has
 * already been emitted by another shortcode.
 *
 * THIS FILE NOW OWNS THE SURFACE'S LAYOUT, AND THAT IS A FIX RATHER THAN A
 * PREFERENCE. The wrapper used to wear `straelos-storefront` - the layout class
 * - purely to reach the palette, while registering no dependency on the file
 * that carries it. Measured on the real /my-account/ page: exactly one
 * stylesheet loaded (this one), and the computed padding was `0px`. So the
 * padding, box-sizing and centring all lived somewhere that never arrived, and
 * the member area ran flush to the edge of the theme's column on every install
 * - unless a product or checkout shortcode happened to share the page, in which
 * case storefront.css loaded and the cap silently dropped from 896px to 640px.
 */

.straelos-member {
	box-sizing: border-box;
	color: var( --straelos-text, #111827 );

	/*
	 * ONE MEASURE, DECLARED HERE, BECAUSE NOTHING ELSE DECLARES ONE ANY MORE.
	 * 55rem rather than the old 56rem for no reason beyond matching the rest of
	 * the scale; the old value was the only cap on this surface and deleting it
	 * outright - which the handoff asked for - would have left the page
	 * uncapped, because the class that used to supply the other cap is gone.
	 *
	 * `var(--straelos-measure,55rem)`: an explicit `width=` attribute (which
	 * only ever sets --straelos-measure, never writes max-width directly - see
	 * Straelos_Storefront_Layout::width_class()) overrides this default; with
	 * no attribute the custom property is unset and 55rem applies exactly as
	 * before this existed. 55rem already equals 880px at the root font size,
	 * so this surface needed no NEW default to join the rest of this pass.
	 */
	margin-inline: auto;
	max-width: var( --straelos-measure, 55rem );
	padding: 24px 16px 48px;
	width: 100%;
}

.straelos-member__section {
	margin: 0 0 2rem;
}

/*
 * THE SAME SECTION TITLE THE STOREFRONT ALREADY SHIPS, value for value, so the
 * two surfaces converge today rather than both moving toward a third figure.
 * It used to be `1.15rem` with no weight and no colour, so an <h2> took the
 * theme's - measured at 18.4px/500/rgb(51,51,51) - which competed with the item
 * titles beneath it at 14px/600.
 */
.straelos-member__heading {
	color: var( --straelos-muted, #6b7280 );
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	margin: 0 0 10px;
	text-transform: uppercase;
}

.straelos-member__list {
	display: grid;
	gap: 0.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.straelos-member__item {
	background: var( --straelos-surface, #fff );
	border: 1px solid var( --straelos-border, rgba( 0, 0, 0, 0.08 ) );
	border-radius: var( --straelos-radius, 14px );
	padding: 1rem 1.15rem;
}

.straelos-member__title {
	color: inherit;
	display: block;
	font-weight: 600;
	text-decoration: none;
}

/*
 * 44px ON THE ANCHOR, NOT ON THE CLASS. `.straelos-member__title` is a <span>
 * on a receipt row and on a booking, and an <a> on a course, a product and a
 * community post - so a bare-class rule would give a non-interactive label a
 * hit target, which is the mistake WCAG 2.5.5 is not about.
 */
a.straelos-member__title {
	align-items: center;
	display: flex;
	min-height: 44px;
}

a.straelos-member__title:hover,
a.straelos-member__title:focus {
	text-decoration: underline;
}

.straelos-member__meta {
	color: var( --straelos-muted, #6b7280 );
	font-size: 0.9rem;
	margin: 0.35rem 0 0;
}

/*
 * A REFUNDED PURCHASE IS DISTINGUISHABLE AT A GLANCE, AND BOTH FIGURES STAY.
 * The row has always SAID "$49.00 refunded" - the design brief's claim that a
 * refund "looks like a purchase" is false - but it said it in the same weight
 * and colour as everything else, so finding it meant reading every line.
 *
 * THE DESIGN ASKED FOR A SINGLE NEGATIVE FIGURE AND THAT IS REFUSED: a partial
 * refund is the case this project treats as normal (Phase 3 declines to revoke
 * access on one), so `amount_cents` and `amount_refunded_cents` are separate
 * columns and a row showing only "-$10.00" would state the wrong amount to
 * somebody checking what they actually paid.
 */
.straelos-member__item--refunded .straelos-member__title {
	color: var( --straelos-muted, #6b7280 );
}

.straelos-member__refund {
	color: var( --straelos-danger, #a32a1a );
	font-size: 0.8125rem;
	font-weight: 600;
}

/*
 * THE LEDGER IS A FLAT LIST WITH ROW SEPARATORS, NOT A STACK OF CARDS -
 * --receipt is its own modifier alongside the shared .straelos-member__item
 * (see the PHP), so courses/bookings/progress rows using the bare class are
 * untouched. :has() degrades safely: without it, receipt rows simply keep
 * the ordinary card gap alongside their own border-bottom - more breathing
 * room, never a broken layout.
 *
 * THE OUTER BORDER + RADIUS + `overflow: hidden` IS `.straelos-affiliate__totals`'s
 * OWN "hairline-divided single container" TECHNIQUE, reused rather than a
 * second invention of it - that rule draws its dividers with `gap: 1px` over
 * a coloured background; this one keeps each row's own `border-bottom`
 * instead (a vertical list of receipts, not a grid of side-by-side panels),
 * so only the OUTER wrap is new. Before this, each row only had its own
 * bottom rule, so the ledger read as a loose stack rather than one card.
 */
.straelos-member__list:has( .straelos-member__item--receipt ) {
	border: 1px solid var( --straelos-border, rgba( 0, 0, 0, 0.08 ) );
	border-radius: var( --straelos-radius, 10px );
	gap: 0;
	overflow: hidden;
}

.straelos-member__item--receipt {
	align-items: baseline;
	background: none;
	border: 0;
	border-bottom: 1px solid var( --straelos-border, rgba( 0, 0, 0, 0.08 ) );
	border-radius: 0;
	column-gap: 20px;
	display: grid;
	grid-template-columns: 1fr auto auto;
	padding: 14px 18px;
}

.straelos-member__item--receipt:last-child {
	border-bottom: 0;
}

.straelos-member__item--receipt .straelos-member__date {
	color: var( --straelos-muted, #6b7280 );
	font-size: 0.875rem;
	white-space: nowrap;
}

.straelos-member__item--receipt .straelos-member__amount {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	white-space: nowrap;
}

.straelos-member__item--receipt .straelos-member__refund {
	grid-column: 1 / -1;
}

/*
 * The bar is decoration; the percentage is also written out as text beside it.
 * A progress bar with no accessible text is a shape, and a screen reader user
 * would be told nothing about how far through a course they are.
 *
 * INLINE WITH ITS NUMBER, because stacked it reads as two facts about different
 * things. The bar is the flexible half so the label never wraps.
 */
.straelos-member__progress {
	align-items: center;
	display: flex;
	gap: 0.6rem;
	margin-top: 0.6rem;
}

.straelos-member__bar {
	background: var( --straelos-border, rgba( 0, 0, 0, 0.08 ) );
	border-radius: 999px;
	flex: 1 1 auto;
	height: 6px;
	overflow: hidden;
}

.straelos-member__bar span {
	background: var( --straelos-accent, #2563eb );
	display: block;
	height: 100%;
}

.straelos-member__progress .straelos-member__meta {
	flex: 0 0 auto;
	font-size: 0.8125rem;
	font-weight: 600;
	margin: 0;
}

/*
 * MEASURED AT 40px BEFORE THIS RULE EXISTED, which is under WCAG 2.5.5's 44px
 * on the one control a member presses. The radius reads the token rather than
 * `999px`, so the surface stops being the only one with pill buttons.
 */
.straelos-member__action,
.straelos-member__signin {
	align-items: center;
	background: var( --straelos-accent, #2563eb );
	border: 0;
	border-radius: var( --straelos-radius, 14px );
	color: var( --straelos-on-accent, #fff );
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-weight: 600;
	min-height: 44px;
	padding: 0 18px;
	text-decoration: none;
}

.straelos-member__action:hover,
.straelos-member__action:focus,
.straelos-member__signin:hover,
.straelos-member__signin:focus {
	background: var( --straelos-accent-hover, var( --straelos-accent, #2563eb ) );
}

/*
 * 44px ON THE LINK ITSELF. This one is an `<a>` already, so the target and the
 * control are the same element - but it had no height of any kind: two
 * declarations, neither affecting the box, giving roughly 20px on a surface
 * people open on a phone.
 */
.straelos-member__link {
	align-items: center;
	color: inherit;
	display: inline-flex;
	font-size: 0.9rem;
	min-height: 44px;
}

/*
 * A PLAIN BORDERED CARD, NOT A STRIPED ONE - the accent-coloured left rule
 * (itself already a fix, from a 4px stripe on a bare card) is dropped
 * outright per the design handoff, which draws this as an ordinary bordered
 * note with no accent edge. `10px` IS AN EXPLICIT LITERAL, NOT
 * `var(--straelos-radius)`'s OWN 14px FALLBACK - the handoff specifies this
 * card's corner radius independently of the general token's default.
 */
.straelos-member__notice {
	background: var( --straelos-surface, #fff );
	border: 1px solid var( --straelos-border, rgba( 0, 0, 0, 0.08 ) );
	border-radius: 10px;
	margin: 0 0 1.5rem;
	padding: 0.75rem 1rem;
}

.straelos-member__pref {
	margin: 0 0 0.75rem;
}

.straelos-member__pref label {
	align-items: flex-start;
	display: flex;
	gap: 0.6rem;
	line-height: 1.45;
}

/*
 * A visible focus ring on every interactive element. The Phase 3.5
 * accessibility pass established that a keyboard user has to be able to see
 * where they are, and :focus-visible keeps it out of the way of mouse users.
 */
.straelos-member a:focus-visible,
.straelos-member button:focus-visible,
.straelos-member input:focus-visible {
	outline: 3px solid var( --straelos-accent, #2563eb );
	outline-offset: 2px;
}
