/*
 * Site Header — theblogrelay/assets/css/header.css
 * Source of truth: theblogrelay-homepage.html (Fiona)
 * Rebuilt: 2026-06-07 per Fiona's HTML
 *
 * CO-OWNED FILE
 * Changes to this file require review of: tbr-design-system.css
 * Contract: NORMALIZER-CONTRACT.md
 */

/* ── Announcement bar ──────────────────────────────────────────── */

.announcement {
	position: fixed;
	top: 0; /* sits above the fixed header */
	left: 0;
	right: 0;
	z-index: 1001; /* above header (z-index: 1000) */
	background: var(--primary-50);
	border-bottom: 1px solid var(--primary-100);
	padding: 0.625rem 1.5rem;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	font-family: var(--font-body);
	font-size: 0.875rem;
	color: var(--warm-700);
}

.announcement.hidden {
	display: none;
}

.announcement__inner {
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.announcement__link {
	color: var(--primary-700);
	font-weight: 500;
	text-decoration: none;
}

.announcement__link:hover {
	text-decoration: underline;
}

.announcement__close {
	position: absolute;
	right: 1rem;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	color: var(--warm-500);
	font-size: 1.125rem;
	line-height: 1;
	padding: 0.25rem;
	border-radius: 4px;
	transition: color 0.15s ease, background 0.15s ease;
}

.announcement__close:hover {
	color: var(--warm-900);
	background: var(--warm-100);
}

/* ── Header shell ──────────────────────────────────────────────── */

.header {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1000;
	background: rgba(255, 255, 255, 0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
	            border-color 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.header.scrolled {
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
	border-bottom: 1px solid var(--warm-200);
}

/* ── Inner container ───────────────────────────────────────────── */

.header__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: 68px; /* per Fiona's HTML — not 72px */
	max-width: 1400px;
	margin: 0 auto;
	padding: 0 2.5rem;
}

/* ── Logo ──────────────────────────────────────────────────────── */

.header__logo {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	text-decoration: none;
	flex-shrink: 0;
}

.header__logo-icon {
	width: 32px;
	height: 32px;
	background: linear-gradient(135deg, var(--primary-600), var(--primary-800));
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #fff;
	font-size: 0.875rem;
	font-weight: 600;
	flex-shrink: 0;
	line-height: 1;
}

.header__logo:hover .header__logo-icon {
	opacity: 0.9;
}

.header__logo-icon {
	/* Force colour — overrides any cascade from design system or normalizer */
	color: #fff !important;
	font-size: 0.875rem !important;
	font-weight: 600 !important;
}

.header__logo-text {
	font-family: var(--font-display);
	font-size: 1.125rem;
	font-weight: 400;
	letter-spacing: -0.01em;
	color: var(--primary-700);
	transition: color 0.15s ease;
}

.header__logo:hover .header__logo-text {
	color: var(--primary-800);
}

/* Image logo — rendered when a logo is uploaded via Customizer → Site Identity. */
.header__logo-img {
	height: 40px;
	width: auto;
	display: block;
	flex-shrink: 0;
}

/* ── Logo wrap (logo + tagline) ────────────────────────────────── */

.header__logo-wrap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	flex-shrink: 0;
}

.header__tagline {
	margin: 0;
	font-family: var(--font-body);
	font-size: 9px;
	font-weight: 400;
	color: var(--warm-800);
	line-height: 1;
	letter-spacing: 0.01em;
	text-align: center;
}

/* ── Primary nav ───────────────────────────────────────────────── */

.header__nav {
	display: none;
	align-items: center;
	gap: 0.125rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 901px) {
	.header__nav {
		display: flex;
	}
}

/* Top-level links and buttons */
.header__nav-link {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	padding: 0.5rem 0.875rem;
	font-family: var(--font-body);
	font-size: 0.9375rem;
	font-weight: 700;
	color: var(--warm-600);
	text-decoration: none;
	border-radius: 8px;
	border: none;
	background: none;
	cursor: pointer;
	white-space: nowrap;
	transition: color 0.15s ease, background 0.15s ease;
}

.header__nav-link:hover,
.header__nav-link:focus-visible {
	color: var(--warm-900);
	background: var(--warm-50);
}

.header__nav-link.active {
	color: var(--primary-700);
	background: var(--primary-50);
}

/* Dropdown chevron */
.header__nav-link svg {
	color: var(--warm-400);
	flex-shrink: 0;
	transition: transform 0.2s ease, color 0.15s ease;
}

.header__nav-item:hover .header__nav-link svg,
.header__nav-item:focus-within .header__nav-link svg {
	transform: rotate(180deg);
	color: var(--warm-600);
}

/* ── Dropdown container ────────────────────────────────────────── */

.header__nav-item {
	position: relative;
}

.header__dropdown {
	display: none;
	position: absolute;
	top: calc(100% + 0.5rem);
	left: 50%;
	transform: translateX(-50%);
	min-width: 220px;
	background: #fff;
	border: 1px solid var(--warm-200);
	border-radius: 12px;
	padding: 0.375rem;
	box-shadow: 0 8px 24px rgba(15, 14, 13, 0.08);
	z-index: 200;
}

/*
 * Hover bridge — invisible pseudo-element fills the 0.5rem gap between the
 * nav button and the dropdown so :hover on .header__nav-item stays active
 * while the cursor traverses the gap. Without this, leaving the button edge
 * triggers a mouseout before the cursor reaches the dropdown.
 */
.header__nav-item::after {
	content: '';
	position: absolute;
	bottom: -0.5rem; /* matches the gap in .header__dropdown top offset */
	left: 0;
	right: 0;
	height: 0.5rem;
}

.header__nav-item:hover .header__dropdown,
.header__nav-item:focus-within .header__dropdown {
	display: block;
}

.header__dropdown-link {
	display: block;
	padding: 0.625rem 1rem;
	font-family: var(--font-body);
	font-size: 0.875rem;
	font-weight: 400;
	color: var(--warm-700);
	text-decoration: none;
	border-radius: 8px;
	transition: color 0.15s ease, background 0.15s ease;
}

.header__dropdown-link:hover,
.header__dropdown-link.active {
	color: var(--primary-700);
	background: var(--primary-50);
}

.header__dropdown-link.active {
	font-weight: 500;
}

.header__dropdown-footer {
	border-top: 1px solid var(--warm-100);
	margin-top: 0.25rem;
	padding-top: 0.25rem;
}

.header__dropdown-footer .header__dropdown-link {
	font-weight: 500;
	color: var(--primary-700);
}

.header__dropdown-footer .header__dropdown-link:hover {
	background: var(--primary-50);
}

/* ── Header actions ────────────────────────────────────────────── */

.header__actions {
	display: flex;
	align-items: center;
	gap: 0.5rem;
}

.header__search {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--warm-600);
	border-radius: 8px;
	transition: color 0.15s ease, background 0.15s ease;
}

.header__search:hover {
	color: var(--warm-900);
	background: var(--warm-100);
}

/* Mobile hamburger — 3 spans */
.header__toggle {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 5px;
	width: 40px;
	height: 40px;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	border-radius: 8px;
	transition: background 0.15s ease;
}

.header__toggle span {
	display: block;
	width: 100%;
	height: 2px;
	background: var(--warm-700);
	border-radius: 2px;
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.header__toggle:hover {
	background: var(--warm-100);
}

/* Hamburger → X when mobile menu is open */
.header__toggle[aria-expanded="true"] span:nth-child(1) {
	transform: translateY(7px) rotate(45deg);
}

.header__toggle[aria-expanded="true"] span:nth-child(2) {
	opacity: 0;
	transform: scaleX(0);
}

.header__toggle[aria-expanded="true"] span:nth-child(3) {
	transform: translateY(-7px) rotate(-45deg);
}

@media (min-width: 901px) {
	.header__toggle {
		display: none;
	}
}

/* ── Mobile nav overlay ────────────────────────────────────────── */

.mobile-nav {
	display: none; /* hidden by default — JS adds .active to open */
	position: fixed;
	inset: 0;
	background: #fff;
	z-index: 300;
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-nav.active {
	display: block;
	transform: translateX(0);
}

.mobile-nav__inner {
	padding: 1.5rem;
	height: 100%;
	overflow-y: auto;
}

.mobile-nav__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--warm-700);
	border-radius: 8px;
	margin-left: auto;
	margin-bottom: 1.5rem;
	transition: background 0.15s ease;
}

.mobile-nav__close:hover {
	background: var(--warm-100);
}

/* WP default nav list inside mobile overlay */
.mobile-nav__list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.mobile-nav__list a {
	display: block;
	padding: 0.875rem 0;
	font-family: var(--font-body);
	font-size: 1.125rem;
	font-weight: 500;
	color: var(--warm-800);
	text-decoration: none;
	border-bottom: 1px solid var(--warm-100);
	transition: color 0.15s ease;
}

.mobile-nav__list a:hover {
	color: var(--primary-700);
}

.mobile-nav__list .sub-menu {
	display: none; /* collapsed by default — JS toggles is-expanded */
	list-style: none;
	padding: 0 0 0 1rem;
	margin: 0;
}

.mobile-nav__list li.is-expanded > .sub-menu {
	display: block;
}

.mobile-nav__list .sub-menu a {
	font-size: 1rem;
	font-weight: 400;
	color: var(--warm-600);
}

/* Parent items need relative positioning for the expand button */
.mobile-nav__list li.menu-item-has-children {
	position: relative;
}

/* Expand/collapse +/- button — sits at the right of the parent link row */
.mobile-nav__expand {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	width: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	cursor: pointer;
	color: var(--warm-500);
	font-size: 1.25rem;
	line-height: 1;
	border-radius: 8px;
	transition: color 0.15s ease, background 0.15s ease;
}

.mobile-nav__expand:hover {
	color: var(--warm-900);
	background: var(--warm-100);
}

/* ── Search overlay ────────────────────────────────────────────── */

.search-overlay {
	position: fixed;
	inset: 0;
	z-index: 10000;
	background: rgba(15, 14, 13, 0.94);
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.2s ease;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 4.5rem 1.5rem 3rem;
	overflow-y: auto;
}

.search-overlay.active {
	opacity: 1;
	pointer-events: all;
}

.search-overlay__close {
	position: absolute;
	top: 1.25rem;
	right: 1.5rem;
	width: 44px;
	height: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: rgba(255, 255, 255, 0.4);
	font-size: 1.75rem;
	border-radius: 8px;
	transition: color 0.2s ease;
	line-height: 1;
}

.search-overlay__close:hover {
	color: #fff;
}

.search-overlay__inner {
	width: 100%;
	max-width: 700px;
}

.search-overlay__bar {
	display: flex;
	align-items: center;
	gap: 0.875rem;
	background: #fff;
	border-radius: 12px;
	padding: 0.875rem 1.25rem;
	margin-bottom: 1.75rem;
}

.search-overlay__bar svg {
	width: 20px;
	height: 20px;
	color: var(--warm-400);
	flex-shrink: 0;
}

.search-overlay__input {
	flex: 1;
	border: none;
	outline: none;
	font-family: var(--font-body);
	font-size: 1.125rem;
	color: var(--warm-900);
	background: transparent;
}

.search-overlay__input::placeholder {
	color: var(--warm-400);
}

.search-overlay__clear {
	width: 28px;
	height: 28px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--warm-400);
	font-size: 1.25rem;
	border-radius: 50%;
	flex-shrink: 0;
	transition: color 0.2s ease;
}

.search-overlay__clear:hover {
	color: var(--warm-700);
}

/* ── Type pills ─────────────────────────────────────────────────── */

.search-types {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin-bottom: 2.5rem;
}

.search-type-pill {
	padding: 0.375rem 1rem;
	border-radius: 9999px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: rgba(255, 255, 255, 0.45);
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: transparent;
	cursor: pointer;
	transition: all 0.2s ease;
	font-family: var(--font-body);
}

.search-type-pill.active,
.search-type-pill:hover {
	background: var(--primary-700);
	color: #fff;
	border-color: var(--primary-700);
}

/* ── Results ────────────────────────────────────────────────────── */

.search-count {
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.35);
	margin-bottom: 1.5rem;
}

.search-results__group {
	display: flex;
	flex-direction: column;
	margin-bottom: 2rem;
}

.search-results__group-title {
	font-size: 0.6875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.08em;
	color: rgba(255, 255, 255, 0.28);
	margin-bottom: 0.625rem;
	padding-bottom: 0.5rem;
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.search-overlay .search-result-item {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 0.8rem 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
	text-decoration: none;
	transition: opacity 0.15s ease;
}

.search-overlay .search-result-item:hover {
	opacity: 0.8;
}

.search-result-item__title {
	font-family: var(--font-display);
	font-size: 1rem;
	font-weight: 400;
	font-style: italic;
	color: rgba(255, 255, 255, 0.88);
	flex: 1;
	line-height: 1.35;
}

.search-result-item__badge {
	font-size: 0.6563rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	padding: 0.2rem 0.6rem;
	border-radius: 9999px;
	flex-shrink: 0;
}

.search-result-item__arrow {
	font-size: 0.875rem;
	font-weight: 700;
	color: rgba(255, 255, 255, 0.25);
	flex-shrink: 0;
}

.badge--article    { background: rgba(26,  168, 207, 0.15); color: var(--primary-300); }
.badge--assessment { background: rgba(212, 168,  75, 0.15); color: #d4a84b; }
.badge--quote      { background: rgba(122, 158, 122, 0.15); color: #7a9e7a; }
.badge--template   { background: rgba(212, 132, 122, 0.15); color: #d4847a; }
.badge--worksheet  { background: rgba(174, 150, 210, 0.12); color: #b89fd8; }
.badge--workbook   { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.45); }

/* ── Empty state ────────────────────────────────────────────────── */

.search-empty {
	text-align: center;
	padding: 3rem 0;
}

.search-empty__title {
	font-family: var(--font-display);
	font-size: 1.125rem;
	font-weight: 400;
	font-style: italic;
	color: rgba(255, 255, 255, 0.5);
	margin-bottom: 0.5rem;
}

.search-empty__sub {
	font-size: 0.875rem;
	color: rgba(255, 255, 255, 0.3);
}

/* Fixed header — offset body so content doesn't hide behind it. */
body {
	padding-top: 68px; /* header only — when no announcement bar */
}

/* When announcement bar is visible:
   - header shifts down by bar height (~40px) so it sits flush below the bar
   - body offset = bar (~40px) + header (68px) = 108px
   JS adds .has-announcement to <body> on page load, removes it on dismiss. */
body.has-announcement .header {
	top: 40px; /* bar height — header sits flush below announcement bar */
}

body.has-announcement {
	padding-top: 108px; /* 40px bar + 68px header */
}
