/* ====================================================================
 * The header actions — book, cart, account
 * --------------------------------------------------------------------
 * These sit in the navigation block's own <ul>, so they are the tail of
 * the desktop row and the tail of the mobile overlay. See
 * inc/nav-actions.php for why they live there and why the cart only
 * appears when it holds something.
 *
 * The whole point of this file is that PLACES AND ACTIONS ARE DIFFERENT
 * KINDS OF THING. Eight of the items in that list are destinations; these
 * are things you do. Someone looking for "book" should not have to read
 * eight place names to find it, so the cluster is divided from the links
 * and weighted internally: book is solid, the cart is a state, signing in
 * is quiet.
 * ==================================================================== */

.alrasly-navact {
	display: flex;
	align-items: center;
	gap: 0.35rem;
}

/* The rule that separates actions from places. It is a border rather than a
   gap because a gap alone reads as "the menu wrapped", not as a division —
   and inline-start, so it lands on the correct side in RTL. */
.alrasly-navact--first {
	margin-inline-start: 0.5rem;
	padding-inline-start: 0.9rem;
	border-inline-start: 1px solid rgba(255, 255, 255, 0.12);
}

.alrasly-navact .alrasly-navact__book,
.alrasly-navact .alrasly-navact__cart,
.alrasly-navact .alrasly-navact__in,
.alrasly-navact .alrasly-navact__account,
.alrasly-navact .alrasly-navact__out {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	/* 44px on every one: these are the smallest targets in the header and two
	   of them are icon-only. */
	min-block-size: 44px;
	border-radius: 999px;
	text-decoration: none;
	font-size: 0.9375rem;
	line-height: 1;
	white-space: nowrap;
	transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.alrasly-navact :is(a) svg { inline-size: 1.05rem; block-size: 1.05rem; flex: 0 0 auto; }

/* ── Book: the primary action ────────────────────────────────────────
 * The only thing on this site anyone pays for outside the course, and it was
 * not in the navigation at all. Solid accent on the dark ground measures
 * 10.94:1 with --ground as the label; white on accent would be 1.76:1, which
 * is why the label is dark.
 *
 * Every anchor below is written as `.alrasly-navact .alrasly-navact__x`
 * (0,2,0) on purpose. Core's navigation block prints
 * `.wp-block-navigation__responsive-container :where(.wp-block-navigation-item a)
 * { color: inherit }` at (0,1,0), and on Tutor views that inline sheet lands
 * AFTER this file, so a bare class lost the cascade and the label went white on
 * peach — 1.76:1, measured on staging 12 Sep on every dashboard page. */
.alrasly-navact .alrasly-navact__book {
	padding-inline: 1.05rem;
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--ground);
	font-weight: 600;
}
.alrasly-navact .alrasly-navact__book:hover,
.alrasly-navact .alrasly-navact__book:focus-visible {
	background-color: #ffc79b;
	color: var(--wp--preset--color--ground);
}

/* ── Cart: a state, not a link ───────────────────────────────────────
 * It is only in the DOM when the cart is not empty, so it never has to say
 * "0". It is outlined rather than solid so it cannot outrank the booking
 * button while still being obvious the moment it appears. */
.alrasly-navact .alrasly-navact__cart {
	padding-inline: 0.7rem;
	border: 1px solid rgba(255, 255, 255, 0.16);
	color: var(--wp--preset--color--text);
}
.alrasly-navact .alrasly-navact__cart:hover,
.alrasly-navact .alrasly-navact__cart:focus-visible {
	border-color: rgba(255, 178, 122, 0.5);
	color: var(--wp--preset--color--accent);
}
.alrasly-navact__count {
	display: grid;
	place-items: center;
	min-inline-size: 1.25rem;
	block-size: 1.25rem;
	padding-inline: 0.25rem;
	border-radius: 999px;
	background-color: var(--wp--preset--color--accent);
	color: var(--wp--preset--color--ground);
	font-size: 0.75rem;
	font-weight: 700;
	/* Arabic-Indic digits in a Latin-neutral run: isolate so the count cannot
	   be reordered into the text around it. */
	unicode-bidi: isolate;
}

/* ── Signing in: deliberately quiet ──────────────────────────────────
 * This was an outlined peach pill until booking arrived. Two accent controls
 * in one bar compete and neither wins, and of the two, booking is the one
 * someone is more likely to be here for. */
.alrasly-navact .alrasly-navact__in {
	padding-inline: 0.85rem;
	color: var(--wp--preset--color--text-2);
	border: 1px solid transparent;
}
.alrasly-navact .alrasly-navact__in:hover,
.alrasly-navact .alrasly-navact__in:focus-visible {
	color: var(--wp--preset--color--text);
	border-color: rgba(255, 255, 255, 0.16);
}

/* ── Signed in ───────────────────────────────────────────────────── */
.alrasly-navact .alrasly-navact__account {
	padding-inline-start: 0.35rem;
	padding-inline-end: 0.85rem;
	border: 1px solid rgba(255, 255, 255, 0.12);
	color: var(--wp--preset--color--text);
	background-color: rgba(255, 255, 255, 0.04);
}
.alrasly-navact .alrasly-navact__account:hover,
.alrasly-navact .alrasly-navact__account:focus-visible {
	border-color: rgba(255, 178, 122, 0.42);
	color: var(--wp--preset--color--text);
}
.alrasly-navact__avatar {
	display: grid;
	place-items: center;
	inline-size: 1.75rem;
	block-size: 1.75rem;
	border-radius: 50%;
	background-color: var(--wp--preset--color--brand);
	color: #fff;
	font-size: 0.8125rem;
	font-weight: 600;
	unicode-bidi: isolate;
}
/* Clipped, not truncated in PHP: cutting Arabic at a fixed character count
   breaks the word and can strip a letter's shaping. */
.alrasly-navact__name {
	max-inline-size: 8rem;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.alrasly-navact .alrasly-navact__out {
	inline-size: 44px;
	justify-content: center;
	color: var(--wp--preset--color--text-3);
}
.alrasly-navact .alrasly-navact__out:hover,
.alrasly-navact .alrasly-navact__out:focus-visible { color: var(--wp--preset--color--accent); }
/* The arrow points OUT of the door. It is drawn pointing right, which is
   forward in LTR and backward in RTL, so it is mirrored. */
html[dir="rtl"] .alrasly-navact__out svg { transform: scaleX(-1); }

.alrasly-navact :is(a):focus-visible {
	outline: 2px solid var(--wp--preset--color--accent);
	outline-offset: 2px;
}


/* ── When the row stops fitting ──────────────────────────────────────
 * Measured at 1440: eight links come to 701px, the three actions to 371px,
 * and the logo plus its gap to 84 — 1212px inside a header whose constrained
 * layout caps it at 1180. It does not fit at ANY viewport, because the cap is
 * fixed: the header wrapped onto two rows and grew from 65px to 123px tall.
 *
 * Shortening the sign-in label recovered 64px, which makes it fit on a wide
 * screen. Below that the container shrinks with the viewport and it wraps
 * again, so the overlay — which already holds all eleven items and works —
 * takes over earlier instead. Core sets that changeover at 600px; with eleven
 * items a horizontal menu is a large-desktop affordance, so it moves to 1200.
 *
 * These three selectors are core's own, re-stated inside the band between the
 * two breakpoints. Nothing here runs below 600px, where core already agrees.
 * ────────────────────────────────────────────────────────────────── */
@media (min-width: 600px) and (max-width: 1199.98px) {
	.wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) {
		display: none;
	}
	.wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: flex;
	}
	.wp-block-navigation__responsive-container-close { display: block; }
}

/* The overlay stacks its items, so the divider that separates actions from
   places has to become a horizontal rule. This was scoped to 599.98px, which
   is now the wrong number — the overlay starts at 1200. */
@media (max-width: 1199.98px) {
	.alrasly-navact--first {
		margin-inline-start: 0;
		padding-inline-start: 0;
		border-inline-start: 0;
		margin-block-start: 0.85rem;
		padding-block-start: 0.85rem;
		border-block-start: 1px solid rgba(255, 255, 255, 0.12);
	}
	.alrasly-navact .alrasly-navact__book { padding-inline: 1.4rem; }
}

/* ── The signed-in name does not fit the desktop row ─────────────────
 * Measured with a full cart at 1440: signed out the header needs 1169px of its
 * 1180px cap, and the signed-in variant needs 1253 — it overflowed and wrapped
 * the header onto two rows. The name is the difference: the account pill with
 * a name is 175px against 91 for the signed-out control, and the name is
 * clipped at 8rem so a longer one is worse still.
 *
 * The avatar identifies the account on its own, so above the breakpoint only
 * the avatar shows. It is hidden by CLIPPING rather than display:none, because
 * display:none would take the name away from screen readers too — the link
 * would then announce as a bare initial.
 *
 * Below 1200 this does not apply: the overlay stacks, and there the full name
 * is both useful and free.
 * ────────────────────────────────────────────────────────────────── */
@media (min-width: 1200px) {
	.alrasly-navact__name {
		position: absolute;
		inline-size: 1px;
		block-size: 1px;
		padding: 0;
		margin: -1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
	.alrasly-navact .alrasly-navact__account { padding-inline-end: 0.35rem; }
}

/* ── The language toggle ─────────────────────────────────────────────
 * inc/lang-toggle.php. A ninth <li> after the eighth place and before the
 * actions divider, printed ONLY when the page has a published translation.
 * It is a utility, not a destination: smaller, dimmer, no pill, and it does
 * not take the display weight the places carry. Written as
 * `.alrasly-langtoggle .alrasly-langtoggle__link` (0,2,0) for the same
 * reason as the cluster's anchors — core's `:where(.wp-block-navigation-item a)`
 * rules otherwise win on colour.
 *
 * 44px min-block-size everywhere, not only on mobile: it is the smallest
 * text in the header and a finger has to land on it in the overlay.
 * ────────────────────────────────────────────────────────────────── */
.alrasly-langtoggle {
	display: flex;
	align-items: center;
	margin-inline-start: 0.25rem;
}
.alrasly-langtoggle .alrasly-langtoggle__link {
	display: inline-flex;
	align-items: center;
	min-block-size: 44px;
	padding-inline: 0.5rem;
	font-size: 0.8125rem;
	font-weight: 400;
	line-height: 1;
	letter-spacing: 0.01em;
	color: rgba(255, 255, 255, 0.62);
	text-decoration: none;
	white-space: nowrap;
	border-radius: 999px;
	transition: color 160ms ease, background-color 160ms ease;
}
.alrasly-langtoggle .alrasly-langtoggle__link:hover,
.alrasly-langtoggle .alrasly-langtoggle__link:focus-visible {
	color: var(--wp--preset--color--text);
	background-color: rgba(255, 255, 255, 0.06);
}
/* The Arabic word on an English page takes the Arabic face and reads at the
   Arabic body size: the display face is Latin-first and sets Arabic small. */
.alrasly-langtoggle .alrasly-langtoggle__link[lang="ar"] {
	font-family: var(--wp--preset--font-family--body);
	font-size: 0.9375rem;
}

/* In the overlay the items stack; the toggle keeps its 44px row and a little
   air above it so it reads as the utility tail of the places, not a ninth
   place. The divider before the actions cluster follows it. */
@media (max-width: 1199.98px) {
	.alrasly-langtoggle {
		margin-inline-start: 0;
		margin-block-start: 0.35rem;
	}
	.alrasly-langtoggle .alrasly-langtoggle__link {
		padding-inline: 0;
		font-size: 0.9375rem;
	}
	.alrasly-langtoggle .alrasly-langtoggle__link[lang="ar"] { font-size: 1.0625rem; }
}

/* On the minimal header there is no list: the toggle is a lone element at the
   end of the branding row. No extra margin — the row's own gap places it. */
.alrasly-langtoggle--solo { margin-inline-start: 0; }

/* ── The navigation's typography on Tutor's late-rendered templates ──
 * theme.json gives core/navigation the display face at 500 and the medium
 * size, and WordPress prints that as `:root :where(.wp-block-navigation){…}`
 * inside global-styles-inline-css — but ONLY when it has seen a navigation
 * block before wp_head printed the styles. Tutor's single course, lesson and
 * quiz templates render the header part after wp_head, so on those pages the
 * rule is never printed and the menu falls back to the body face at 400:
 * lighter, narrower (910px against 993 at 1440), and visibly not the same
 * header. Found on production 12 Sep 2026; same mechanism as the import map
 * in inc/tutor-late-render.php.
 *
 * Mirrored here, keyed on the body class that file sets and wrapped in
 * :where so it weighs nothing: where WordPress prints the real rule
 * (0,1,0 — the :root) theme.json still wins, and an edit there is not
 * silently outlived by this copy on any normal page. Keep the values equal
 * to theme.json's styles.blocks.core/navigation.
 * ────────────────────────────────────────────────────────────────── */
:where(.alrasly-tutor-single .wp-block-navigation) {
	font-family: var(--wp--preset--font-family--display);
	font-size: var(--wp--preset--font-size--medium);
	font-weight: 500;
}
