/**
 * Header Login block — front-end styles.
 *
 * Logged out: the "Login" pill (an <a>). Logged in: the same pill as a
 * <button> that opens the account menu (core 2.114.0). Both carry
 * `.wwh-header-login__link` and `__label` on purpose: the theme's home-page
 * glow and its ≤430px 32×32 rule (header.css) target those classes.
 *
 * Mirrors wwh/header-search:
 *   - default (over dark hero) → white ink
 *   - body.home2-nav-on-light  → dark ink (#1a1613)
 * Pill-shaped to read against busy hero imagery without leaning on the
 * --header-ink token (which can resolve to warm-cream and disappear on a
 * sunset / sky background).
 */

.wwh-header-login {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.wwh-header-login__link {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	color: #ffffff; /* default over dark hero */
	text-decoration: none;
	font-family: var(--wp--preset--font-family--body);
	font-size: var(--wp--preset--font-size--caption);
	letter-spacing: 0.02em;
	padding: 0.35rem 0.75rem;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.55);
	background: rgba(0, 0, 0, 0.18);
	backdrop-filter: blur(6px);
	-webkit-backdrop-filter: blur(6px);
	transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

.wwh-header-login__link:hover,
.wwh-header-login__link:focus-visible {
	background: rgba(0, 0, 0, 0.32);
	border-color: #ffffff;
	color: #ffffff;
}

.wwh-header-login__link:focus-visible {
	box-shadow: 0 0 0 2px currentColor;
}

/* Light-section inversion (home2-scroll.js toggles body.home2-nav-on-light) */
body.home2-nav-on-light .site-header .wwh-header-login__link {
	color: #1a1613;
	border-color: rgba(26, 22, 19, 0.45);
	background: rgba(255, 255, 255, 0.55);
}

body.home2-nav-on-light .site-header .wwh-header-login__link:hover,
body.home2-nav-on-light .site-header .wwh-header-login__link:focus-visible {
	background: rgba(255, 255, 255, 0.85);
	border-color: #1a1613;
	color: #1a1613;
}

.wwh-header-login__icon {
	flex-shrink: 0;
}

.wwh-header-login__label {
	white-space: nowrap;
}

/* ---- Logged in: account menu --------------------------------------------- */

.wwh-header-login__toggle {
	appearance: none;
	-webkit-appearance: none;
	margin: 0;
	cursor: pointer;
	line-height: inherit;
	padding: 0.25rem 0.7rem 0.25rem 0.25rem;
}

.wwh-header-login__toggle .wwh-header-login__label {
	max-width: 12ch;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* GitLab #238: from 1251px the full menu shows, and with the basket icon the
   row needs ~1283px, so between 1251 and ~1300 the account button ran off the
   right edge (and a longer first name pushed that further). Initials only up
   to 1399px; the name stays in the button's accessible name. The band was
   1365px until #471: from 1366 the name came back and the row overflowed
   until about 1395px. */
@media (min-width: 1251px) and (max-width: 1399px) {
	.wwh-header-login__toggle .wwh-header-login__label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}
}

.wwh-header-login__chevron {
	flex-shrink: 0;
	transition: transform 0.2s ease;
}

.wwh-header-login__toggle[aria-expanded="true"] .wwh-header-login__chevron {
	transform: rotate(180deg);
}

.wwh-header-login__avatar {
	flex-shrink: 0;
	width: 26px;
	height: 26px;
	border-radius: 50%;
	object-fit: cover;
}

.wwh-header-login__avatar--initials {
	display: inline-grid;
	place-items: center;
	background: #8f632f; /* brand-text */
	color: #ffffff;
	font-family: var(--wp--preset--font-family--ui);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.04em;
	line-height: 1;
}

.wwh-header-login .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The panel is a white card in both ink modes. */
.wwh-header-login__menu {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	z-index: 210; /* above the mega-nav panels (200), same as header-search */
	width: 270px;
	padding: 8px;
	background: #ffffff;
	color: #1a1613;
	border-radius: 12px;
	box-shadow: 0 12px 36px rgba(0, 0, 0, 0.22);
	text-align: left;
}

.wwh-header-login__menu[hidden] {
	display: none;
}

.wwh-header-login__who {
	display: flex;
	align-items: center;
	gap: 0.7rem;
	padding: 10px 10px 12px;
	margin-bottom: 6px;
	border-bottom: 1px solid #e9e4db;
}

.wwh-header-login__who .wwh-header-login__avatar {
	width: 40px;
	height: 40px;
	font-size: 14px;
}

.wwh-header-login__who-text {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.wwh-header-login__name {
	font-family: var(--wp--preset--font-family--body);
	font-size: 17px;
	font-weight: 600;
	line-height: 1.25;
}

.wwh-header-login__email {
	font-family: var(--wp--preset--font-family--ui);
	font-size: 12px;
	color: #5a544d;
	overflow-wrap: anywhere;
}

.wwh-header-login__tier {
	margin-top: 4px;
	font-family: var(--wp--preset--font-family--ui);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: #8f632f;
}

.wwh-header-login__links {
	list-style: none;
	margin: 0;
	padding: 0 0 6px;
	border-bottom: 1px solid #e9e4db;
}

.wwh-header-login__links a,
.wwh-header-login__logout {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 9px 10px;
	border-radius: 8px;
	color: #1a1613;
	text-decoration: none;
	font-family: var(--wp--preset--font-family--body);
	font-size: 17px;
	line-height: 1.3;
}

.wwh-header-login__logout {
	margin-top: 6px;
	color: #9a4a30; /* terracotta, 6.4:1 on white */
}

.wwh-header-login__links a:hover,
.wwh-header-login__links a:focus-visible,
.wwh-header-login__logout:hover,
.wwh-header-login__logout:focus-visible {
	background: #f2efea;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.wwh-header-login__links a:focus-visible,
.wwh-header-login__logout:focus-visible {
	outline: 2px solid #1a1613;
	outline-offset: -2px;
}

/* Below 640px, hide the label and keep just the icon to save header space */
@media (max-width: 640px) {
	.wwh-header-login__chevron {
		display: none;
	}

	.wwh-header-login__toggle.wwh-header-login__link {
		padding: 0.2rem;
	}

	.wwh-header-login__menu {
		width: min(270px, calc(100vw - 24px));
	}

	.wwh-header-login__label {
		position: absolute;
		width: 1px;
		height: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip: rect(0, 0, 0, 0);
		white-space: nowrap;
		border: 0;
	}

	.wwh-header-login__link {
		padding: 0.4rem;
	}
}
