/* ===========================================================================
   lg.header — the buttons in the header (includes/header.php), beta look
   ---------------------------------------------------------------------------

     .versionselector                      top right of the header
       a.lg-header-btn--status             Basic / Premium + second line
       .versionleft                        desktop only (a.css hides it < 650px)
         .lg-header-btn                    guests: Login   members: Account, Admin
         .lg-header-btn--primary           guests: Sign up, or Login if returning
         .lg-header-btn--quiet             members: Log out
       .versionright--editions             guests: edition picker (lg.footer.css)
       .navbox                             phones only: the account circle
     .change-version__chevron              chevron of the language pill
     .sub-header                           language list under the header
       .button_flag_small                  one language (flag, name, count)

   Pills of the edition picker's height and border (lg.footer.css): 41px on
   desktop, 40px in the phone bar. Colours from tokens.css, so dark mode
   follows. The elements keep their old .button / .button--premium-status
   classes for main2025.js and the modals; the selectors here are one class
   more specific than a.css's (.header .button, .header .button.button--
   premium-status, a-dark.css) and this file loads after it, so it wins at
   every width without !important.
   =========================================================================== */

/* --- Low windows: the header scrolls away ---------------------------------
   On a short desktop window (a laptop with the browser's own bars, a
   landscape tablet) the sticky header took a large share of the height the
   exercise needs. From 640px of height down it scrolls with the page.
   --lg-header-offset is what the sticky exercise and text heads sit under
   (lg.exercise.css, lg.text-head.css) and what anchors stop below
   (lg.core.css); header.php writes it as an inline style on <html>, so 0 has
   to come with !important - the same as the trainer and the word sheet do
   on phones. The language list opens under the header wherever it is
   (main2025.js measures it, and 0 once it has scrolled out). */
@media (min-width: 650px) and (max-height: 640px) {

	.header {
		position: relative;
	}

	html {
		--lg-header-offset: 0px !important;
	}

	/* "html": one step above the hidden default below, which comes later. */
	html .lg-to-top {
		display: inline-flex;
	}
}

/* Back to top (footer.php): bottom right, in that low-window case only (the
   media query above shows it), faded in once the header has scrolled out
   (.is-visible from the script beside it). A round button in the header
   buttons' look. */
.lg-to-top {
	display: none;
	position: fixed;
	right: 1.25rem;
	bottom: 1.25rem;
	z-index: 20;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 1px solid var(--lg-border);
	border-radius: 50%;
	background: var(--lg-surface);
	box-shadow: 0 6px 18px rgba(var(--lg-shadow-rgb, 120, 98, 72), 0.16);
	color: var(--lg-text);
	cursor: pointer;
	opacity: 0;
	pointer-events: none;
	transform: translateY(8px);
	transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.15s ease;
}

.lg-to-top.is-visible {
	opacity: 1;
	pointer-events: auto;
	transform: none;
}

.lg-to-top:hover {
	background: var(--lg-surface-alt);
}

.lg-to-top:focus-visible {
	outline: 2px solid var(--lg-red);
	outline-offset: 2px;
}

.lg-to-top svg {
	width: 20px;
	height: 20px;
}

/* --- Chevron of the language pill (.change-version) ---------------------- */
/* The edition picker's line chevron (lg-editions.php), a size up and in the
   CTA red: the pill is the way into the other languages. Turned up while the
   list is open (main2025.js sets data-versions-displayed). Replaces the old
   down.gif / drawn-border arrow. */
.change-version__chevron {
	display: inline-flex;
	flex: 0 0 auto;
	width: 1.15rem;
	height: 1.15rem;
	margin-left: 0.15rem;
	color: var(--lg-red);
	vertical-align: middle;
	transition: transform 0.15s ease;
}

.change-version__chevron svg {
	display: block;
	width: 100%;
	height: 100%;
}

.change-version[data-versions-displayed="1"] .change-version__chevron {
	transform: rotate(180deg);
}

/* The old arrow was a 36px-high box and gave the pill its height; the
   chevron is smaller, so the padding now does. The phone pill sets its own
   height and padding (a.css .navigation--inline .change-version). */
.change-version {
	padding-top: 0.45rem;
	padding-bottom: 0.45rem;
}

/* --- Section links on desktop (.navigation .navi) ------------------------ */
/* The boxed tabs of the old header, in the new look: a 1px hairline instead
   of the 4px grey frame, rounded top corners, a little air between the tabs
   instead of overlapping frames, the beta font. The current one (header.php
   marks it aria-current="page") takes the page's ground and covers the
   header's bottom line (margin-bottom -1px, as before), so it opens into the
   page below like a real tab. Phones: the sections are in the bottom
   navigation (a.css). */
@media (min-width: 650px) {

	/* A flex row, bottoms aligned: the tabs end exactly on the header's
	   bottom line. As inline-blocks in a text line they hung off the line
	   box, whose height comes from the font and rounded differently with the
	   header's height - from 768px (the logo's padding changes there) they
	   sat 1px low, their border in the page below. !important: a.css forces
	   display:block !important on .navigation from 650px. */
	.header .navigation {
		display: flex !important;
		flex-wrap: wrap;
		align-items: flex-end;
	}

	.header .navigation .change-version {
		align-self: center;
	}

	.header .navigation .navi {
		margin: 0 0.3rem -1px 0;
		padding: 0.55rem 0.95rem 0.6rem;
		/* All round, the bottom too: an unselected tab is a closed card
		   standing on the header's line. */
		border: 1px solid var(--lg-border);
		border-radius: 10px 10px 0 0;
		background: var(--lg-surface);
		color: var(--lg-text-soft);
		font-family: var(--lg-font);
		font-size: 0.95rem;
		font-weight: 400;
		text-decoration: none;
		transition: background-color 0.15s ease, color 0.15s ease;
	}

	.header .navigation .navi:hover {
		background: var(--lg-surface-alt);
		color: var(--lg-text);
		text-decoration: none;
	}

	/* The current tab: open to the page, like a register tab - its bottom
	   border in the page's ground covers the header's line, so the tab and
	   the page below are one surface. */
	.header .navigation .navi[aria-current="page"] {
		border-bottom-color: var(--lg-bg);
		background: var(--lg-bg);
		color: var(--lg-text);
		font-weight: 700;
	}

	.header .navigation .navi:focus-visible {
		outline: 2px solid var(--lg-red);
		outline-offset: -2px;
	}

	/* English pages: the Business English link after the sections - a tab
	   too, but quieter. */
	.header .navigation .navi.extra-navi {
		font-weight: 400;
	}

	/* Room between the language pill and the first tab. */
	.header .navigation .change-version {
		margin-right: 0.6rem;
	}
}

/* --- Language list under the header (.sub-header) ----------------------- */
/* Opened by the language pill (main2025.js, .change-version). The look of
   the home page's picker (/home/?language=all, lg.home.css .lg-home__picker):
   page ground, white round tiles with a hairline and a soft shadow, red ring
   on hover. Markup, widths and links stay header.php's - only the look.
   "body" in front: one step above a.css / a-dark.css, whatever the order
   they load in. */
body .sub-header {
	/* Top border: the header's line, which the list opens onto (main2025.js
	   places it 1px up so the two coincide). */
	border-top: 1px solid var(--lg-border);
	border-bottom: 1px solid var(--lg-border);
	background-color: var(--lg-bg);
	box-shadow: 0 14px 28px rgba(var(--lg-shadow-rgb, 120, 98, 72), 0.12);
}

body .sub-header .content {
	padding-top: 0.4rem;
	padding-bottom: 1rem;
	background-color: transparent;
}

body .sub-header .sub-header-headline {
	padding: 0.7rem 0 0.8rem;
	margin: 0;
	color: var(--lg-text);
	font-family: var(--lg-font-heading);
	font-size: 1.1rem;
	font-weight: 700;
}

body .sub-header .button_flag_small {
	display: inline-flex;
	flex-direction: column;
	justify-content: center;
	min-height: 3rem;
	padding: 0.5rem 0.9rem 0.5rem 3.1rem;
	border-radius: 999px;
	background-color: var(--lg-surface);
	background-size: 1.7rem auto;
	background-position: 0.85rem center;
	box-shadow: inset 0 0 0 1px var(--lg-border), 0 4px 12px rgba(var(--lg-shadow-rgb, 120, 98, 72), 0.10);
	color: var(--lg-text);
	font-family: var(--lg-font);
	font-weight: 400;
	line-height: 1.25;
	text-overflow: ellipsis;
	transition: box-shadow 0.15s ease;
}

body .sub-header .button_flag_small:hover {
	background-color: var(--lg-surface);
	box-shadow: inset 0 0 0 1px var(--lg-red), 0 4px 12px rgba(var(--lg-shadow-rgb, 120, 98, 72), 0.14);
	color: var(--lg-text);
}

body .sub-header .button_flag_small:focus-visible {
	outline: 2px solid var(--lg-red);
	outline-offset: 2px;
}

/* The count under the name ("67 exercises"): muted, as on the home page. */
body .sub-header .button_flag_small__stats div {
	margin-top: 0 !important;
	color: var(--lg-text-muted);
}

/* --- The pill ------------------------------------------------------------- */
.header .button.lg-header-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	height: 41px;
	margin: 0;
	padding: 0 1rem;
	border: 1px solid var(--lg-border);
	border-radius: 999px;
	background: var(--lg-bg);
	color: var(--lg-text);
	font-family: var(--lg-font);
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1.15;
	text-decoration: none;
	text-shadow: none;
	box-shadow: none;
	white-space: nowrap;
	vertical-align: middle;
	cursor: pointer;
	box-sizing: border-box;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.header .button.lg-header-btn:hover {
	background: var(--lg-surface-alt);
	border-color: var(--lg-border-strong);
	color: var(--lg-text);
	text-decoration: none;
}

.header .button.lg-header-btn:focus-visible {
	outline: 2px solid var(--lg-red);
	outline-offset: 2px;
}

/* The one red button in the header: sign up, or login for a browser that
   has logged in before (header.php, $lg_header_returning). */
.header .button.lg-header-btn--primary {
	border-color: var(--lg-red);
	background: var(--lg-red);
	color: var(--lg-text-inverse);
	/* The label's shadow, as on every red CTA (.lg-btn--primary,
	   .premium-button). The pill rule above clears the legacy .button
	   shadow, so it is set again here. */
	text-shadow: 1px 1px var(--lg-red-shadow, #94332f);
}

.header .button.lg-header-btn--primary:hover {
	border-color: var(--lg-red-hover);
	background: var(--lg-red-hover);
	color: var(--lg-text-inverse);
}

/* Log out: no frame, it is the least wanted. */
.header .button.lg-header-btn--quiet {
	border-color: transparent;
	background: transparent;
	color: var(--lg-text-soft);
}

.header .button.lg-header-btn--quiet:hover {
	border-color: transparent;
	background: var(--lg-surface-alt);
	color: var(--lg-text);
}

/* --- Premium status: two lines ("Basic" / "Order premium") -------------- */
.header .button.lg-header-btn--status {
	flex-direction: column;
	align-items: flex-start;
	gap: 0;
	padding: 0 0.95rem;
	font-size: 0.8rem;
	font-weight: 400;
}

.header .lg-header-btn--status b {
	font-weight: 700;
}

.header .lg-header-btn--status .button--premium-status__sub {
	display: block;
	color: var(--lg-text-muted);
	font-size: 0.72rem;
	font-weight: 400;
}

/* "Order premium" (basic members and guests): a link in the CTA colour, so
   the second line reads as the invitation it is. Darker on hover of the
   whole pill, which is the link. */
.header .lg-header-btn--status .button--premium-status__sub--cta {
	color: var(--lg-red);
	font-weight: 600;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.header .button.lg-header-btn--status:hover .button--premium-status__sub--cta {
	color: var(--lg-red-hover);
}

/* The Premium teaser (header.php): a crown and "Premium" - "Order Premium"
   from 720px - for whoever has no Premium to report: guests and members who
   never had it, everywhere; members whose Premium expired on phones only
   (--teaser-phone, the status pill says "expired" on desktop). Gold, the
   colour of the premium badges, so it reads as an offer and not as one more
   red CTA. */
.header .button.lg-header-btn--teaser {
	gap: 0.35rem;
	padding: 0 0.85rem 0 0.7rem;
	border-color: var(--lg-score);
	background: var(--lg-score-track);
	/* Fixed, not --lg-text: the gold tokens have no dark values, so the
	   pill stays light in dark mode and light text would vanish on it. */
	color: #4a3b1c;
}

.header .button.lg-header-btn--teaser:hover {
	border-color: var(--lg-score);
	background: var(--lg-score);
	color: #4a3b1c;
}

.header .lg-header-btn__icon {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
}

/* Premium that expires within 30 days (header.php, --gold): the teaser's
   gold and crown, then "Premium" in bold over "expires in 29 days". */
.header .button.lg-header-btn--status.lg-header-btn--gold {
	flex-direction: row;
	align-items: center;
	gap: 0.45rem;
	padding: 0 0.95rem 0 0.75rem;
	border-color: var(--lg-score);
	background: var(--lg-score-track);
	color: #4a3b1c;
}

.header .button.lg-header-btn--status.lg-header-btn--gold:hover {
	border-color: var(--lg-score);
	background: var(--lg-score);
	color: #4a3b1c;
}

.header .lg-header-btn--gold .button--premium-status__text {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
}

.header .lg-header-btn--gold .button--premium-status__text b {
	font-size: 0.85rem;
}

.header .lg-header-btn--gold .button--premium-status__sub {
	color: #6b5a33;
}

/* Sign up: "Sign up free" / "Kostenlos registrieren" from 720px, where the
   row has room (lang.header.php $signup_long_text); the short caption
   below. The default hiding of --long is the rule just below. */
@media (min-width: 720px) {

	.header .lg-header-btn--signup .lg-header-btn__label--short {
		display: none;
	}

	.header .lg-header-btn--signup .lg-header-btn__label--long {
		display: inline;
	}
}

/* "Premium" up to 720px, "Order Premium" from there. */
.header .lg-header-btn__label--long {
	display: none;
}

@media (min-width: 720px) {

	.header .lg-header-btn--teaser .lg-header-btn__label--short {
		display: none;
	}

	.header .lg-header-btn--teaser .lg-header-btn__label--long {
		display: inline;
	}
}

@media (min-width: 650px) {

	.header .button.lg-header-btn--teaser-phone {
		display: none;
	}
}

/* More than 30 days of Premium left: star and word on one line. */
.header .lg-header-btn--status .button--premium-status__line {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
}

.header .lg-header-btn--status .button--premium-status__icon {
	position: static;
	width: 16px;
	height: 16px;
}

.header .lg-header-btn--status .button--premium-status__label {
	font-size: 0.85rem;
	font-weight: 700;
	line-height: 1.15;
}

/* --- Desktop row ---------------------------------------------------------- */
@media (min-width: 650px) {

	/* Right edge = the page's text edge (.content: 2rem, 1.5rem up to
	   750px), as the logo sits on the left one. */
	.header .versionselector {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		right: 2rem;
	}

	/* The separators between the groups (borders) are gone: the gap does it. */
	.header .versionleft {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		margin: 0;
		padding: 0;
		border: 0;
		vertical-align: middle;
	}

	.header .versionright {
		padding: 0;
	}
}

/* The account circle is a phone thing; above it was an empty span behind a
   separator line. 651px, not 650: a.css hides .versionleft up to and
   including 650px, and at exactly 650 the circle is the only way to log in. */
@media (min-width: 651px) {

	.header .navbox {
		display: none;
	}
}

/* Russian edition (<html lang>, header.php): its section names are long
   ("Аудирование", "Диктовка"), so from 800px down
   the tabs take a smaller size before the row runs out of room. */
@media (min-width: 650px) and (max-width: 800px) {

	html[lang="ru"] .header .navigation .navi {
		font-size: 0.85rem;
	}
}

/* Below 720px (the teaser's long-caption breakpoint): the section tabs a
   little narrower, so the row fits more often before it wraps. */
@media (min-width: 650px) and (max-width: 719.98px) {

	.header .navigation .navi {
		padding-left: 0.6rem;
		padding-right: 0.6rem;
	}
}

/* Below 860px: the header's right padding down to 0.2rem (from .content's
   2rem / 1.5rem), so the buttons and the section tabs get the room; the
   left one, where the logo is, stays. The buttons' right edge follows.
   Phones (< 650px) have their own row (a.css "phone header bar") and are
   left alone. */
@media (min-width: 650px) and (max-width: 859.98px) {

	.header .content {
		padding-right: 0.2rem;
	}

	.header .versionselector {
		right: 0.2rem;
	}
}

/* Tablets: a bit tighter, the row is long next to the logo. */
@media (min-width: 650px) and (max-width: 899.98px) {

	.header .button.lg-header-btn {
		padding: 0 0.8rem;
	}

	.header .versionselector,
	.header .versionleft {
		gap: 0.35rem;
	}
}

/* --- Phone bar ------------------------------------------------------------ */
/* Only the status pill is left in the row here (a.css hides .versionleft);
   40px like the language pill next to it. */
@media (max-width: 649.98px) {

	.header .button.lg-header-btn {
		height: 40px;
	}

	/* One row, always. a.css lets the row wrap, so a long language name
	   ("Business Englisch") pushed the whole language pill onto a line of
	   its own instead of shrinking it. Without the wrap the pill shrinks
	   (a.css: min-width 0, the name cut off) and the buttons stay put. */
	.header .container .content {
		flex-wrap: nowrap;
		/* The right edge mirrors the logo's left one (a.css .logo,
		   --logo-pad-left: 1rem / 1.2rem / 1.5rem). a.css had 0.1rem, which
		   suits the bottom navigation, not this bar: the account circle
		   touched the edge when the edition picker is hidden. */
		padding-right: 1.2rem;
	}

	/* A cut-off name fades out instead of ending in "…" - only when it
	   really is cut off: main2025.js sets .is-truncated, so "English"
	   stays crisp. Without the script it keeps a.css's ellipsis. */
	.header .navigation--inline .change-version__text.is-truncated {
		text-overflow: clip;
		-webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 1.75rem), transparent);
		mask-image: linear-gradient(90deg, #000 calc(100% - 1.75rem), transparent);
	}

	/* The status pill is a desktop thing; phones get the teaser instead
	   (and Premium members nothing). */
	.header .button.lg-header-btn--status {
		display: none;
	}

	/* The account circle: 40px like the pills beside it. a.css gives it
	   --lg-tap-target (44px) and, in an older block, 42px. */
	.header .button-circle {
		width: 40px;
		height: 40px;
	}
}

/* Right padding of the phone header row, in the logo's steps (above). */
@media (max-width: 419.98px) {

	.header .container .content {
		padding-right: 1rem;
	}
}

@media (min-width: 576px) and (max-width: 649.98px) {

	.header .container .content {
		padding-right: 1.5rem;
	}
}

/* Narrow phones: the Premium teaser shrinks to its crown, a circle like the
   account button (the link keeps "Premium" as its aria-label). */
@media (max-width: 519.98px) {

	/* The language pill gets at most this much, so the buttons beside it
	   keep their room; a longer name fades out (above). */
	.header .navigation--inline .change-version {
		max-width: 10rem;
	}

	.header .button.lg-header-btn--teaser {
		width: 40px;
		padding: 0;
	}

	.header .lg-header-btn--teaser .lg-header-btn__label {
		display: none;
	}

	.header .lg-header-btn--teaser .lg-header-btn__icon {
		width: 18px;
		height: 18px;
	}
}

/* The second line goes, the language name needs the room more. */
@media (max-width: 419.98px) {

	.header .lg-header-btn--status .button--premium-status__sub {
		display: none;
	}

	.header .button.lg-header-btn--status {
		padding: 0 0.75rem;
	}
}
