/* ==========================================================================
   Header: exact clone of the reference header (freya/header.php).

   Values are hers. Invisible upgrades only: the brand is a <p> (one <h1>
   per page), the toggle has aria-expanded, focus is visible, the viewport
   allows pinch-zoom, and her global !important overflow hacks are gone.
   The grouped sitemap menu (The Book, Community) opens in her nav style.
   ========================================================================== */

.site-viewport-wrapper {
	width: 100%;
	position: relative;
	overflow-x: clip; /* her overflow lock, without breaking sticky elements */
}

/* --- Announcement bar -------------------------------------------------- */
.site-announcement-bar {
	background-color: var(--ek-earth-dark);
	color: var(--ek-sand);
	text-align: center;
	padding: 0 20px;
	font-family: var(--ek-font-sans);
	font-size: 15px;
	line-height: 1.5;
	letter-spacing: 0.3px;
	font-weight: 500;
	width: 100%;
}
/* The whole bar is the link (to the shop): a big, clear target. */
.site-announcement-bar a {
	display: block;
	padding: 11px 0;
	color: inherit;
	text-decoration: none;
}
.site-announcement-bar a::after { content: ' \2192'; color: var(--ek-veld-gold); transition: margin 0.2s ease; }
.site-announcement-bar a:hover,
.site-announcement-bar a:focus-visible { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--ek-veld-gold); }

/* Top bar (26 Nov; site-wide, was Home only): the bar holds three sibling links: the
   numbered edition's order link, then "Standard softcover" with its two shops.
   One line from 760px, two lines on phones (order link, then the shops).
   Sand on earth-dark 13:1; the gold rule and arrows are decoration
   (veld-gold 5.7:1 on earth-dark). Every link is at least 44px tall on phones. */
.site-announcement-bar--split { padding: 0 var(--ek-edge, 20px); }
.site-announcement-bar__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 0 28px;
	max-width: 1200px;
	margin: 0 auto;
}
.site-announcement-bar--split a { display: inline-flex; align-items: center; min-height: 44px; padding: 0; }
html body .site-announcement-bar--split a:focus-visible { outline: 2px solid var(--ek-veld-gold); outline-offset: 2px; } /* the site ring (gold-ink) is 2.97:1 on this dark bar; veld-gold 5.73:1 */
.site-announcement-bar--split .site-announcement-bar__shop::after { content: ' \2197'; white-space: pre; color: var(--ek-veld-gold); }
.site-announcement-bar__retail { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0 14px; }
.site-announcement-bar__label { color: var(--ek-on-dark-muted); font-weight: 500; }
.site-announcement-bar__shops { display: flex; gap: 0 16px; margin: 0; padding: 0; list-style: none; }
.site-announcement-bar__shops > li { margin: 0; padding: 0; }
@media (min-width: 760px) {
	.site-announcement-bar__retail { padding-left: 28px; border-left: 1px solid var(--ek-veld-gold); }
}
/* Long words on desktop, short on phones; display:none takes the other one out
   of the accessibility tree too, so each link's name is the words it shows. */
.site-announcement-bar--split .bar-short { display: none; }
/* Phones (26 Nov, compact): two rows: the order link, then
   "Softcover: Takealot · Amazon SA" with the label inline. Same 14px text and
   44px links as before; at 320px the second row may wrap on its own. */
@media (max-width: 759px) {
	.site-announcement-bar--split { font-size: 14px; letter-spacing: 0; }
	.site-announcement-bar--split .bar-long { display: none; }
	.site-announcement-bar--split .bar-short { display: inline; }
	.site-announcement-bar__inner { flex-direction: column; }
	/* Block, not flex: a two-line Afrikaans label keeps its arrow on the text. */
	html body .site-announcement-bar--split .site-announcement-bar__cta { display: block; width: 100%; min-height: 0; padding: 12px 0; line-height: 20px; text-align: center; }
	.site-announcement-bar__retail { width: 100%; flex-wrap: wrap; gap: 0 8px; border-top: 1px solid var(--ek-earth-mid); }
	.site-announcement-bar__shops { gap: 0 4px; }
	.site-announcement-bar__shops > li + li::before { content: '\00B7' / ''; padding: 0 6px 0 2px; color: var(--ek-on-dark-muted); } /* 4px gap + 2px = 6px each side */
	.site-announcement-bar__shops > li { display: inline-flex; align-items: center; }
}

/* --- Header ------------------------------------------------------------ */
.site-header {
	background-color: var(--ek-sand);
	border-bottom: 1px solid var(--ek-border);
	position: relative;
	z-index: 1000;
	width: 100%;
}

.header-inner {
	max-width: calc(var(--ek-grid) + 2 * var(--ek-edge)); /* the shared edge (tokens.css) */
	margin: 0 auto;
	padding: 30px 25px 20px;
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
}

.brand-container {
	text-align: center;
	margin-bottom: 25px;
	text-decoration: none;
	color: var(--ek-earth-dark);
	display: block;
}
.brand-container:hover { color: var(--ek-earth-dark); }

.brand-title {
	font-family: var(--ek-font-serif);
	font-size: 38px;
	font-weight: 700;
	letter-spacing: 3px;
	text-transform: uppercase;
	margin: 0;
	line-height: 1;
}

.brand-tagline {
	font-family: var(--ek-font-serif);
	font-style: italic;
	font-size: 14px;
	color: var(--ek-sage);
	margin-top: 6px;
	letter-spacing: 1px;
}

/* --- Navigation row ---------------------------------------------------- */
.navigation-row {
	width: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	border-top: 1px solid var(--ek-border);
	padding-top: 15px;
	position: relative;
}

.main-nav {
	display: flex;
	justify-content: center;
	gap: 28px;
	list-style: none;
	margin: 0;
	padding: 0;
}
.main-nav > li { position: relative; }

.main-nav a,
.main-nav .ek-subnav-toggle {
	color: var(--ek-earth-dark);
	text-decoration: none;
	font-family: var(--ek-font-sans);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	padding: 10px 0;
	min-height: 44px;
	position: relative;
	transition: color 0.3s ease;
	background: none;
	border: 0;
	cursor: pointer;
	line-height: inherit;
	display: inline-flex;
	align-items: center;
	gap: 6px;
}
/* Gold text at AA (5.3:1 on sand); the bright gold stays on the underline. */
.main-nav a:hover,
.main-nav .ek-subnav-toggle:hover { color: var(--ek-gold-link); }

.main-nav a::after,
.main-nav .ek-subnav-toggle::after {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 0%;
	height: 1px;
	background-color: var(--ek-veld-gold);
	transition: width 0.3s ease;
}
.main-nav a:hover::after,
.main-nav .ek-subnav-toggle:hover::after { width: 100%; }

.ek-subnav-toggle__icon { transition: transform 0.3s ease; }
.ek-subnav-toggle[aria-expanded="true"] .ek-subnav-toggle__icon { transform: rotate(180deg); }

/* Groups: a dropdown in her style (sand panel, hairline border, same type). */
.main-nav .sub-menu {
	list-style: none;
	margin: 0;
	padding: 10px 0;
	background-color: var(--ek-sand);
	border: 1px solid var(--ek-border);
	box-shadow: 0 10px 20px var(--ek-black-a08);
}
.main-nav .sub-menu a {
	display: block;
	padding: 12px 24px;
	white-space: nowrap;
	font-size: 15px;
	letter-spacing: 0.5px;
	text-transform: none;
	font-weight: 500;
}
.main-nav .sub-menu a:hover,
.main-nav .sub-menu a:focus-visible { background-color: var(--ek-linen-deep); color: var(--ek-earth-dark); }
.main-nav .sub-menu a::after { content: none; }

[data-ek-header][data-nav] .sub-menu { display: none; }
[data-ek-header][data-nav] .ek-subnav-toggle[aria-expanded="true"] + .sub-menu { display: block; }

/* --- Language switch: "English | Afrikaans" (2 Nov), top left ----------
   Plain words, each in its own language; the current one is dark and
   underlined in gold (aria-current), the other a quiet link. 44px targets.
   Desktop: top left, mirroring the cart top right around the wordmark.
   Phones: in the sticky bar next to Menu, the cart alone on the right. */
.header-lang {
	position: absolute;
	left: calc(var(--ek-edge) - 6px); /* its first link's 6px padding: the text sits on the shared edge */
	top: 25px;
	display: flex;
	align-items: center;
}
.ek-lang {
	display: inline-flex;
	align-items: center;
	font-family: var(--ek-font-sans);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0.3px;
	white-space: nowrap;
}
.ek-lang__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	padding: 0 6px;
	color: var(--ek-muted-strong);
	text-decoration: none;
	border-radius: 2px;
}
.ek-lang__link:hover { color: var(--ek-earth-dark); text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--ek-veld-gold); }
.ek-lang__link:focus-visible { outline: 3px solid var(--ek-veld-gold); outline-offset: 1px; }
.ek-lang__link.is-current {
	color: var(--ek-earth-dark);
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 6px;
	text-decoration-color: var(--ek-veld-gold);
}
.ek-lang__sep { color: var(--ek-line-dark); padding: 0 2px; }

/* --- Cart: icon + label, count badge on the icon ------------------------ */
.header-inner { position: relative; }
/* Desktop: top right of the header, level with the wordmark. */
.header-utilities {
	position: absolute;
	right: calc(var(--ek-edge) - 10px); /* the cart link's 10px padding */
	top: 25px;
	display: flex;
	align-items: center;
}
@media (min-width: 851px) {
	.navigation-row { position: static; }
}
.cart-link {
	display: inline-flex;
	align-items: center;
	gap: 18px;
	min-height: 48px;
	padding: 6px 10px;
	color: var(--ek-earth-dark);
	text-decoration: none;
	font-family: var(--ek-font-sans);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.5px;
	border-radius: 2px;
	transition: color 0.2s ease, background-color 0.2s ease;
}
.cart-link:hover { background-color: var(--ek-linen-deep); }
.cart-link:hover .cart-label { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--ek-veld-gold); }
.cart-icon { position: relative; display: inline-flex; width: 26px; height: 26px; }
.cart-count {
	position: absolute;
	top: -9px;
	right: -12px;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 11px;
	background-color: var(--ek-gold-text); /* deep veld gold: white text 5.3:1 */
	color: var(--ek-white);
	font-size: 13px;
	font-weight: 700;
	line-height: 22px;
	text-align: center;
	letter-spacing: 0;
	box-shadow: 0 0 0 2px var(--ek-sand);
}
.cart-count.is-empty { display: none; }

/* --- Mobile toggle ----------------------------------------------------- */
.mobile-menu-toggle {
	display: none;
	background: none;
	border: none;
	color: var(--ek-earth-dark);
	cursor: pointer;
	padding: 6px 10px;
	line-height: 1;
	font-family: var(--ek-font-sans);
	font-size: 15px;
	font-weight: 600;
	letter-spacing: 0.5px;
}
.mobile-menu-toggle__icon { display: block; }
.mobile-menu-toggle__label { display: block; }

/* Other sticky bars (her hub sub-nav) sit below the visible header bar. */
@media (max-width: 850px) {
	html { scroll-padding-top: var(--ek-header-visible, 0px); }
}
@media (max-width: 850px) and (prefers-reduced-motion: reduce) {
	.site-header[data-sticky] { transition: none; }
}

/* --- Desktop flyouts --------------------------------------------------- */
@media (min-width: 851px) {
	/* Opens below the item with no dead gap: the ::before bridge keeps the
	   pointer "inside" while crossing. Open/close is nav.js (hover with a
	   short close delay, click, keyboard), shown via aria-expanded. */
	.main-nav .sub-menu {
		position: absolute;
		top: calc(100% + 10px);
		left: 50%;
		transform: translateX(-50%);
		min-width: 250px;
		z-index: 1001;
	}
	.main-nav .sub-menu::before {
		content: "";
		position: absolute;
		left: 0;
		right: 0;
		top: -12px;
		height: 12px;
	}
}

/* --- Mobile (<= 850px): her dropdown ----------------------------------- */
@media (max-width: 850px) {
	.header-inner { padding: 20px var(--ek-edge) 15px; width: 100%; } /* Menu and cart icons on the shared edge (their buttons reach 10px out) */
	.brand-title { font-size: 28px; }

	.navigation-row {
		justify-content: space-between;
		padding-top: 12px;
		width: 100%;
	}
	.mobile-menu-toggle { display: inline-flex; align-items: center; gap: 10px; position: static; }
	.header-utilities { position: static; transform: none; }

	.primary-nav { display: contents; }

	.main-nav {
		display: flex;
		flex-direction: column;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		width: 100%;
		margin: 0;
		background-color: var(--ek-sand);
		border-bottom: 1px solid var(--ek-border);
		padding: 10px 0;
		gap: 0;
		z-index: 99999;
		box-shadow: 0 10px 20px var(--ek-black-a08);
	}
	/* Collapsed once nav.js owns it; with JS off the list stays open.
	   Fades and slides instead of popping, so the overlay feels smooth. */
	[data-ek-header][data-nav] .main-nav {
		transition: opacity 0.25s ease, transform 0.25s ease, visibility 0s linear 0s;
	}
	[data-ek-header][data-nav="closed"] .main-nav {
		visibility: hidden;
		opacity: 0;
		transform: translateY(-8px);
		pointer-events: none;
		transition: opacity 0.2s ease, transform 0.2s ease, visibility 0s linear 0.2s;
	}

	.main-nav li {
		display: block;
		width: 100%;
		margin: 0;
		padding: 0;
		text-align: center;
	}
	.main-nav a,
	.main-nav .ek-subnav-toggle {
		display: flex;
		justify-content: center;
		width: 100%;
		min-height: 52px;
		padding: 14px 10px;
		font-size: 16px;
		text-align: center;
	}
	.main-nav a::after,
	.main-nav .ek-subnav-toggle::after { display: none; }

	.main-nav .sub-menu {
		position: static;
		border: 0;
		box-shadow: none;
		padding: 0 0 6px;
	}
	.main-nav .sub-menu { background-color: var(--ek-linen-deep); padding: 4px 0 8px; }
	.main-nav .sub-menu a { min-height: 50px; padding: 13px 10px; font-size: 17px; color: var(--ek-earth-dark); justify-content: center; }

	/* Tap targets: 44px, same glyph and box as hers. */
	.mobile-menu-toggle {
		min-width: 48px;
		min-height: 48px;
		margin-left: -10px;
	}
	.cart-link { min-height: 48px; margin-right: -10px; }

	/* Compact sticky bar (nav.js sets data-sticky): the header stays in the
	   flow, so nothing jumps; its top is pulled up by the brand's height so
	   only her navigation row (menu + cart) sticks. It slides away while
	   scrolling down and back on scrolling up; never under reduced motion. */
	.site-header[data-sticky] {
		position: sticky;
		top: var(--ek-header-top, 0px);
		transition: transform 0.3s ease, box-shadow 0.3s ease;
	}
	.site-header[data-sticky="stuck"] { box-shadow: 0 6px 16px var(--ek-black-a06); }
	.site-header[data-sticky="hidden"] {
		transform: translateY(calc(-100% - var(--ek-header-top, 0px)));
	}
	.brand-tagline { font-size: 15px; }
	.site-announcement-bar { font-size: 14px; letter-spacing: 0; }
	.site-announcement-bar a { padding: 12px 0; }
}
/* Reduced motion: the panel shows and hides at once. The reduced-motion rule
   shortens durations, not delays, so a closed panel stayed visibility: visible
   (transparent, its links still tabbable) for the 0.2s visibility delay. */
@media (max-width: 850px) and (prefers-reduced-motion: reduce) {
	[data-ek-header][data-nav] .main-nav,
	[data-ek-header][data-nav="closed"] .main-nav { transition: none; }
}

/* An open group keeps dark text (gold text is too faint); the chevron and
   underline carry the state. */
.main-nav .ek-subnav-toggle[aria-expanded="true"] { color: var(--ek-earth-dark); }
.main-nav .ek-subnav-toggle[aria-expanded="true"] .ek-subnav-toggle__icon { color: var(--ek-veld-gold); }

/* --- Phones (<= 600px): compact header, about 120px instead of 246px ----
   Same parts, same order, less air: the announcement shows its first part
   on one line (the rest stays for screen readers), the tagline rests (it
   shows from 601px), and the menu row keeps 44px tap targets. nav.js
   measures the header, so the sticky bar follows on its own. */
@media (max-width: 600px) {
	.site-announcement-bar a { padding: 9px 0; }
	.site-announcement-bar__more {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
		border: 0;
	}

	.header-inner { padding: 12px var(--ek-edge) 0; }
	.brand-container { margin-bottom: 8px; }
	.brand-title { font-size: 26px; }
	.brand-tagline { display: none; }

	.navigation-row { padding-top: 0; }
	.mobile-menu-toggle,
	.cart-link { min-height: 44px; }
}

/* QA 15 Oct (phones): the announcement link and the wordmark get 44px hit
   areas. The wordmark's padding is cancelled by a negative margin, so the
   header keeps its height. */
@media (max-width: 600px) {
	.site-announcement-bar a { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0; }
	.brand-container { padding-block: 9px; margin: -9px auto -1px; } /* -1px = her 8px gap minus the 9px */
}

/* Phones: the switch shares the sticky bar with Menu and Cart; at the
   narrowest widths the cart keeps its icon and count, its word goes to
   screen readers only. */
@media (max-width: 850px) {
	.header-lang { position: static; margin-right: auto; margin-left: 6px; }
}
@media (max-width: 600px) {
	.ek-lang { font-size: 14px; }
	.ek-lang__link { padding: 0 5px; }
}
@media (max-width: 400px) {
	.cart-link .cart-label {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		overflow: hidden;
		clip-path: inset(50%);
		white-space: nowrap;
	}
	.cart-link { gap: 0; padding: 6px 12px 6px 6px; }
}
