/*
 * Site-wide structural layout: container, header, primary navigation,
 * search panel and footer. Mobile-first — base rules target small screens,
 * larger layouts are added inside min-width media queries.
 */

.container {
	max-width: var(--container-width);
	margin-inline: auto;
	padding-inline: var(--gutter);
}

/* ---------------------------------------------------------------------
 * Breadcrumbs (media_news_render_breadcrumbs(), inc/breadcrumbs.php) —
 * used by single.php, page.php, archive.php, category.php, tag.php and
 * author.php, so it lives here rather than in one template-specific file.
 * ------------------------------------------------------------------ */

.breadcrumbs ol {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 1.25rem 0 0;
	padding: 0;
	font-size: 0.8125rem;
	color: var(--color-text-muted);
}

.breadcrumbs li:not(:last-child)::after {
	content: "/";
	margin-inline-start: 0.4rem;
}

.breadcrumbs a {
	color: var(--color-text-muted);
	text-decoration: none;
}

.breadcrumbs a:hover {
	color: var(--color-primary);
}

/* ---------------------------------------------------------------------
 * Top bar
 * ------------------------------------------------------------------ */

.site-topbar {
	background: var(--color-secondary);
	color: #fff;
	font-size: 0.8125rem;
}

.site-topbar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--gutter);
	padding-block: 0.4rem;
}

.site-topbar a {
	color: #fff;
}

.topbar-navigation ul {
	list-style: none;
	display: flex;
	gap: 1rem;
	margin: 0;
	padding: 0;
}

/* ---------------------------------------------------------------------
 * Header
 * ------------------------------------------------------------------ */

.site-header {
	background: var(--color-background);
	border-bottom: 3px solid var(--color-text);
}

.has-sticky-header .site-header {
	position: sticky;
	top: 0;
	z-index: 100;
	box-shadow: var(--shadow-sm);
}

.site-header__inner {
	display: flex;
	align-items: center;
	gap: var(--gutter);
	padding-block: 0.75rem;
}

/*
 * add_theme_support('custom-logo') is registered with flex-height/
 * flex-width (see inc/theme-setup.php), which lets site owners upload a
 * logo of any aspect ratio — but WordPress then renders it at that file's
 * native pixel size with no cap of its own, so an uploaded logo can blow up
 * the whole masthead. These max-heights are the theme's actual size
 * constraint; width stays auto so the aspect ratio is never distorted.
 */
.site-branding__logo img {
	max-height: 36px;
	width: auto;
}

.site-branding__logo--mobile {
	display: block;
}

.site-branding__logo--desktop {
	display: none;
}

.site-branding__title {
	margin: 0;
	font-family: var(--font-heading);
	font-size: 1.75rem;
	font-weight: 900;
	letter-spacing: -0.01em;
}

.site-branding__title a {
	color: var(--color-text);
	text-decoration: none;
}

/* Primary navigation: collapsed off-canvas-style panel on mobile. */
/* Pushes the nav (and, right after it, header-actions) to the right edge
   as one tight group instead of the old justify-content:space-between on
   the header row, which spread the hamburger and search buttons apart
   with a large, awkward gap on mobile since they were spaced as two
   independent flex items rather than a cluster. Reset back to 0 at the
   782px breakpoint (below), where flex:1 does the centering job instead. */
.main-navigation {
	position: static;
	margin-inline-start: auto;
}

.menu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: 0;
	border-radius: var(--radius-pill);
	cursor: pointer;
	color: var(--color-text);
	transition: background-color var(--transition-base);
}

.menu-toggle:hover {
	background: var(--color-surface);
}

.menu-toggle__icon,
.menu-toggle__icon::before,
.menu-toggle__icon::after {
	display: block;
	width: 20px;
	height: 2px;
	background: currentColor;
	position: relative;
}

.menu-toggle__icon::before {
	content: "";
	position: absolute;
	top: -6px;
}

.menu-toggle__icon::after {
	content: "";
	position: absolute;
	top: 6px;
}

#primary-menu {
	list-style: none;
	margin: 0;
	padding: 1rem 0;
	display: none;
}

#primary-menu.is-open {
	display: block;
	position: absolute;
	inset-inline: 0;
	top: 100%;
	background: var(--color-background);
	border-bottom: 1px solid var(--color-border);
}

#primary-menu li {
	border-top: 1px solid var(--color-border);
}

#primary-menu a {
	display: block;
	padding: 0.75rem var(--gutter);
	color: var(--color-text);
	text-decoration: none;
}

#primary-menu .menu-item-has-children {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

#primary-menu .menu-item-has-children > a {
	flex: 1;
}

/* Injected by navigation.js — only needed on mobile, where the desktop
   :hover/:focus-within dropdown below doesn't apply. */
.submenu-toggle {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	background: none;
	border: 0;
	color: inherit;
	cursor: pointer;
}

.submenu-toggle::after {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
}

.submenu-toggle[aria-expanded="true"]::after {
	transform: rotate(-135deg);
}

#primary-menu .sub-menu {
	list-style: none;
	margin: 0;
	padding: 0 0 0 var(--gutter);
	display: none;
}

#primary-menu .menu-item-has-children.is-open > .sub-menu {
	display: block;
}

.header-actions {
	display: flex;
	align-items: center;
}

.search-toggle {
	width: 44px;
	height: 44px;
	border: 0;
	border-radius: var(--radius-pill);
	background: none;
	cursor: pointer;
	position: relative;
	color: var(--color-text);
	transition: background-color var(--transition-base);
}

.search-toggle:hover {
	background: var(--color-surface);
}

.search-toggle__icon {
	display: block;
	width: 16px;
	height: 16px;
	margin: auto;
	border: 2px solid currentColor;
	border-radius: 50%;
	position: relative;
}

.search-toggle__icon::after {
	content: "";
	position: absolute;
	width: 8px;
	height: 2px;
	background: currentColor;
	bottom: -6px;
	right: -6px;
	transform: rotate(45deg);
}

.header-search {
	border-top: 1px solid var(--color-border);
	padding-block: 1rem;
	background: var(--color-surface);
}

.header-search .search-form {
	display: flex;
	gap: 0.5rem;
}

.header-search .search-field {
	flex: 1;
	padding: 0.6rem 0.75rem;
	border: 1px solid var(--color-border-strong);
	border-radius: var(--radius);
}

.header-search .search-submit {
	padding: 0.6rem 1.25rem;
	border: 0;
	border-radius: var(--radius);
	background: var(--color-primary);
	color: #fff;
	cursor: pointer;
}

@media (min-width: 782px) {
	.site-branding__logo--mobile {
		display: none;
	}

	.site-branding__logo--desktop {
		display: block;
	}

	/* Desktop-sized logos: the responsive-swap desktop slot, and the single
	   "used at every breakpoint" slot when only one logo is configured
	   (see header.php) — but never the mobile-swap slot, which should stay
	   compact even if the viewport happens to be wide. */
	.site-branding__logo:not(.site-branding__logo--mobile) img {
		max-height: 44px;
	}

	.menu-toggle {
		display: none;
	}

	/* Desktop dropdowns already open via :hover/:focus-within below — the
	   mobile tap-to-expand button (navigation.js) would be redundant here. */
	.submenu-toggle {
		display: none;
	}

	.main-navigation {
		display: flex;
		align-items: center;
		flex: 1;
		justify-content: center;
		margin-inline-start: 0;
	}

	#primary-menu {
		display: flex;
		position: static;
		padding: 0;
		border: 0;
		gap: 1.75rem;
	}

	#primary-menu li {
		border-top: 0;
		position: relative;
	}

	#primary-menu > li > a {
		padding: 0.5rem 0;
		font-size: 0.8125rem;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: 0.04em;
		background-image: linear-gradient(var(--color-primary), var(--color-primary));
		background-position: 0 100%;
		background-repeat: no-repeat;
		background-size: 0% 2px;
		transition: background-size var(--transition-base);
	}

	#primary-menu > li > a:hover,
	#primary-menu > li > a:focus-visible {
		background-size: 100% 2px;
	}

	#primary-menu .sub-menu {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 200px;
		background: var(--color-background);
		border: 1px solid var(--color-border);
		box-shadow: 0 4px 10px rgb(0 0 0 / 8%);
		padding: 0.5rem 0;
		z-index: 50;
	}

	#primary-menu .menu-item-has-children:hover > .sub-menu,
	#primary-menu .menu-item-has-children:focus-within > .sub-menu,
	#primary-menu .menu-item-has-children.is-open > .sub-menu {
		display: block;
	}

	#primary-menu .sub-menu a {
		padding: 0.5rem 1rem;
	}
}

/* ---------------------------------------------------------------------
 * Footer
 * ------------------------------------------------------------------ */

.site-footer {
	background: var(--color-secondary);
	color: #e6e6e6;
	padding-block: 3.5rem 1.5rem;
	margin-top: 2rem;
}

/* Higher specificity than wp-block-library's own link-color rules on core
   widget blocks (e.g. Latest Posts), so footer links stay visually
   consistent no matter which widget/block is dropped into a footer column. */
.site-footer a,
.site-footer .widget a {
	color: #e6e6e6;
	text-decoration-color: rgb(255 255 255 / 35%);
}

.site-footer a:hover,
.site-footer .widget a:hover {
	color: #fff;
}

.site-footer__top {
	display: grid;
	gap: 2.5rem;
	margin-bottom: 2rem;
}

.site-footer__description {
	color: #c7c7c7;
	max-width: 40ch;
	line-height: 1.6;
}

.site-footer .widget-title,
.site-footer .widget .wp-block-heading {
	font-size: 1.0625rem;
	color: #fff;
	margin-bottom: 1rem;
}

.site-footer__widgets {
	display: grid;
	gap: 2rem;
	grid-template-columns: 1fr;
}

.site-footer__widgets .widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 0.6rem;
	font-size: 0.9375rem;
}

.footer-navigation ul {
	list-style: none;
	display: flex;
	flex-wrap: wrap;
	gap: 1.5rem;
	margin: 0 0 1.25rem;
	padding: 0;
}

.site-footer__bottom {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-between;
	gap: 0.5rem;
	border-top: 1px solid rgb(255 255 255 / 15%);
	padding-top: 1rem;
	font-size: 0.875rem;
	color: #b8b8b8;
}

@media (min-width: 782px) {
	.site-footer__top {
		grid-template-columns: minmax(220px, 1fr) 3fr;
	}

	.site-footer__widgets {
		grid-template-columns: repeat(4, 1fr);
	}
}
