/**
 * EditorialCore Layout Grid, Masthead Header, Sticky Bar, Mobile Drawer, Sidebar & Footer
 */

.ec-site {
	display: flex;
	flex-direction: column;
	min-height: 100vh;
}

.ec-main {
	flex: 1 0 auto;
}

.ec-container {
	width: 100%;
	max-width: var(--ec-container-max);
	margin-inline: auto;
	padding-inline: var(--ec-space-4);
}

@media (min-width: 768px) {
	.ec-container {
		padding-inline: var(--ec-space-5);
	}
}

@media (min-width: 1280px) {
	.ec-container {
		padding-inline: var(--ec-space-6);
	}
}

.ec-section {
	padding-block: var(--ec-space-5);
}

.ec-section + .ec-section {
	border-top: 1px solid var(--ec-color-border);
}

/* Utility Bar */
.ec-utility-bar {
	background-color: var(--ec-color-secondary);
	color: var(--ec-color-on-secondary);
	font-size: var(--ec-text-xs);
}

.ec-utility-bar__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ec-space-4);
	min-height: 32px;
	padding-block: 0;
}

.ec-utility-bar__date {
	display: inline-flex;
	align-items: center;
	font-weight: 500;
	letter-spacing: 0.01em;
	opacity: 0.88;
	white-space: nowrap;
}

.ec-secondary-nav {
	display: none;
}

@media (min-width: 768px) {
	.ec-secondary-nav {
		display: block;
	}
}

.ec-secondary-nav__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ec-space-4);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-secondary-nav__list a {
	display: inline-flex;
	align-items: center;
	min-height: 32px;
	color: var(--ec-color-on-secondary);
	text-decoration: none;
	opacity: 0.9;
}

.ec-secondary-nav__list a:hover {
	opacity: 1;
	text-decoration: underline;
}

/* Masthead */
.ec-header {
	background-color: var(--ec-color-bg);
	border-bottom: 1px solid var(--ec-color-border);
	position: relative;
	z-index: 40;
}

.ec-has-sticky-header .ec-header {
	position: sticky;
	top: 0;
}

.ec-header.is-scrolled {
	box-shadow: var(--ec-shadow-sm);
}

.ec-masthead__inner {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ec-space-4);
	padding-block: 0.7rem;
}

@media (min-width: 1024px) {
	.ec-masthead__inner {
		padding-block: 0.85rem;
	}
}

.ec-masthead__left {
	display: flex;
	align-items: center;
	gap: var(--ec-space-2);
	min-width: 0;
}

.ec-masthead__actions {
	position: relative;
	display: flex;
	align-items: center;
	flex: 0 0 auto;
}

.ec-header--centered .ec-masthead__inner {
	display: grid;
	grid-template-columns: 44px 1fr 44px;
	align-items: center;
}

.ec-header--centered .ec-masthead__left {
	display: contents;
}

.ec-header--centered .ec-branding {
	text-align: center;
	justify-self: center;
}

.ec-header--centered .ec-masthead__actions {
	justify-self: end;
}

.ec-branding {
	min-width: 0;
}

.ec-branding__logo img {
	max-height: 52px;
	width: auto;
}

.ec-branding__title {
	margin: 0;
	font-family: var(--ec-font-heading);
	font-size: clamp(1.35rem, 1.1rem + 1vw, 2rem);
	font-weight: 700;
	line-height: 1.15;
	letter-spacing: -0.02em;
}

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

.ec-branding__tagline {
	margin: 2px 0 0;
	font-size: var(--ec-text-xs);
	color: var(--ec-color-text-muted);
	display: none;
}

@media (min-width: 640px) {
	.ec-branding__tagline {
		display: block;
	}
}

/* Desktop Navigation Bar */
.ec-navbar {
	display: none;
	border-top: 1px solid var(--ec-color-border);
	background-color: var(--ec-color-bg);
}

.ec-primary-nav--inline {
	display: none;
}

@media (min-width: 1024px) {
	.ec-mobile-toggle {
		display: none;
	}

	.ec-navbar {
		display: block;
	}

	.ec-primary-nav--inline {
		display: block;
	}

	.ec-header--centered .ec-masthead__inner {
		grid-template-columns: 1fr auto 1fr;
	}

	.ec-header--centered .ec-branding {
		grid-column: 2;
	}

	.ec-header--centered .ec-masthead__actions {
		grid-column: 3;
	}
}

.ec-nav-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ec-space-1);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-header--centered .ec-nav-list {
	justify-content: center;
}

.ec-nav-list > li {
	position: relative;
	display: flex;
	align-items: center;
}

.ec-nav-list > li > a {
	display: inline-flex;
	align-items: center;
	min-height: 42px;
	padding: 0 var(--ec-space-3);
	font-size: var(--ec-text-sm);
	font-weight: 600;
	color: var(--ec-color-text);
	text-decoration: none;
}

.ec-header:not(.ec-header--centered) .ec-navbar .ec-nav-list > li:first-child > a {
	padding-left: 0;
}

.ec-nav-list > li > a:hover,
.ec-nav-list > li.current-menu-item > a,
.ec-nav-list > li.current_page_item > a {
	color: var(--ec-color-primary);
}

.ec-submenu-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 32px;
	min-height: 36px;
	padding: 0 4px;
	border: 0;
	background: transparent;
	color: var(--ec-color-text-muted);
	cursor: pointer;
}

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

.ec-nav-list .sub-menu {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	min-width: 220px;
	padding: var(--ec-space-2) 0;
	margin: 0;
	list-style: none;
	background-color: var(--ec-color-bg);
	border: 1px solid var(--ec-color-border);
	border-radius: var(--ec-radius-sm);
	box-shadow: var(--ec-shadow-md);
	z-index: 60;
}

.ec-nav-list li.is-open > .sub-menu,
.ec-nav-list li:hover > .sub-menu,
.ec-nav-list li:focus-within > .sub-menu {
	display: block;
}

.ec-nav-list .sub-menu a {
	display: block;
	padding: var(--ec-space-2) var(--ec-space-4);
	font-size: var(--ec-text-sm);
	color: var(--ec-color-text);
	text-decoration: none;
}

.ec-nav-list .sub-menu a:hover {
	background-color: var(--ec-color-surface);
	color: var(--ec-color-primary);
}

/* Header Search Popover (Anchored to Search Icon) */
.ec-search-panel {
	position: absolute;
	top: calc(100% + 10px);
	right: 0;
	width: min(410px, calc(100vw - 2rem));
	padding: 0.625rem;
	background-color: var(--ec-color-bg);
	border: 1px solid var(--ec-color-border);
	border-radius: var(--ec-radius-md);
	box-shadow: 0 12px 30px rgba(15, 23, 42, 0.12), 0 2px 6px rgba(15, 23, 42, 0.05);
	z-index: 90;
}

.ec-search-panel[hidden] {
	display: none;
}

.ec-search-panel__inner {
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

.ec-search-panel__inner .ec-search-form {
	flex: 1 1 auto;
	min-width: 0;
	max-width: none;
}

.ec-search-panel .ec-search-close {
	min-width: 36px;
	min-height: 36px;
	padding: 6px;
	color: var(--ec-color-text-muted);
	flex: 0 0 auto;
}

/* Mobile Navigation Drawer */
.ec-drawer {
	position: fixed;
	inset: 0;
	z-index: 2147483640;
}

.ec-drawer[hidden] {
	display: none;
}

.ec-drawer__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(15, 23, 42, 0.52);
	backdrop-filter: blur(2px);
}

.ec-drawer__panel {
	position: relative;
	width: min(336px, 88vw);
	max-width: 100%;
	height: 100vh;
	height: 100dvh;
	background-color: var(--ec-color-bg);
	overflow-y: auto;
	overflow-x: hidden;
	overscroll-behavior: contain;
	padding: 0;
	box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
	display: flex;
	flex-direction: column;
	gap: 0;
}

.ec-drawer__head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: var(--ec-space-3);
	padding: 0.85rem 1.15rem;
	background-color: var(--ec-color-bg);
	border-bottom: 1px solid var(--ec-color-border);
}

.ec-drawer__brand {
	font-family: var(--ec-font-heading);
	font-weight: 700;
	font-size: var(--ec-text-lg);
	line-height: 1.2;
	min-width: 0;
	overflow-wrap: break-word;
}

.ec-drawer__close {
	margin-right: -6px;
	flex: 0 0 auto;
}

.ec-drawer__search {
	padding: 0.85rem 1.15rem;
	border-bottom: 1px solid var(--ec-color-border);
	background-color: var(--ec-color-surface);
}

.ec-drawer__nav {
	padding: 0.5rem 0.75rem;
	flex: 1 0 auto;
}

.ec-drawer-list,
.ec-drawer-list ul,
.ec-drawer-secondary-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-drawer-list li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	border-bottom: 1px solid rgba(229, 231, 235, 0.75);
}

.ec-drawer-list > li:last-child {
	border-bottom: 0;
}

.ec-drawer-list a {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	align-items: center;
	min-height: 44px;
	padding: 0.625rem 0.5rem;
	color: var(--ec-color-text);
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	border-radius: var(--ec-radius-sm);
	transition: background-color var(--ec-transition), color var(--ec-transition);
}

.ec-drawer-list a:hover {
	background-color: var(--ec-color-surface);
	color: var(--ec-color-primary);
}

.ec-drawer-list .ec-submenu-toggle {
	flex: 0 0 auto;
	margin-left: 4px;
	min-width: 36px;
	min-height: 36px;
	padding: 0;
	border-radius: var(--ec-radius-sm);
	color: var(--ec-color-text-muted);
}

.ec-drawer-list .ec-submenu-toggle:hover {
	background-color: var(--ec-color-surface);
	color: var(--ec-color-primary);
}

.ec-drawer-list .sub-menu {
	display: none;
	flex-basis: 100%;
	padding: 0.25rem 0 0.5rem 0.85rem;
	border-top: 1px solid rgba(229, 231, 235, 0.65);
}

.ec-drawer-list .sub-menu li {
	border-bottom: 0;
}

.ec-drawer-list .sub-menu a {
	min-height: 38px;
	font-size: var(--ec-text-sm);
	font-weight: 500;
	color: var(--ec-color-text-muted);
}

.ec-drawer-list li.is-open > .sub-menu {
	display: block;
}

.ec-drawer__secondary {
	margin-top: auto;
	padding: 0.85rem 1.15rem 1.15rem;
	border-top: 1px solid var(--ec-color-border);
	background-color: var(--ec-color-surface);
}

.ec-drawer-secondary-list,
.ec-drawer-secondary-list ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-drawer-secondary-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
}

.ec-drawer-secondary-list a {
	display: inline-flex;
	align-items: center;
	min-height: 34px;
	font-size: var(--ec-text-xs);
	font-weight: 500;
	color: var(--ec-color-text-muted);
	text-decoration: none;
}

.ec-drawer-secondary-list a:hover {
	color: var(--ec-color-primary);
	text-decoration: underline;
}

.ec-drawer-secondary-list--nested {
	display: flex;
	flex-direction: column;
	flex-wrap: nowrap;
	gap: 0;
}

.ec-drawer-secondary-list--nested li {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	border-bottom: 1px solid rgba(229, 231, 235, 0.75);
}

.ec-drawer-secondary-list--nested > li:last-child,
.ec-drawer-secondary-list--nested .sub-menu li {
	border-bottom: 0;
}

.ec-drawer-secondary-list--nested a {
	flex: 1 1 0;
	min-width: 0;
	min-height: 38px;
	padding: 0.35rem 0.25rem;
}

.ec-drawer-secondary-list--nested .ec-submenu-toggle {
	flex: 0 0 auto;
	margin-left: 4px;
	min-width: 34px;
	min-height: 34px;
	padding: 0;
	border-radius: var(--ec-radius-sm);
	color: var(--ec-color-text-muted);
}

.ec-drawer-secondary-list--nested .ec-submenu-toggle:hover {
	background-color: var(--ec-color-bg);
	color: var(--ec-color-primary);
}

.ec-drawer-secondary-list--nested .sub-menu {
	display: none;
	flex-basis: 100%;
	padding: 0.15rem 0 0.4rem 0.85rem;
	border-top: 1px solid rgba(229, 231, 235, 0.6);
}

.ec-drawer-secondary-list--nested li.is-open > .sub-menu {
	display: block;
}

.ec-drawer-secondary-list--nested .sub-menu a {
	min-height: 34px;
	padding-block: 0.25rem;
}

/* Primary Content + Sidebar Layouts */
.ec-archive-wrap,
.ec-single-wrap,
.ec-page-wrap,
.ec-404-wrap {
	padding-block: var(--ec-space-5) var(--ec-space-7);
}

.ec-content-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ec-space-6);
}

.ec-content-layout--centered .ec-content-layout__main {
	max-width: var(--ec-article-max);
	width: 100%;
	margin-inline: auto;
}

@media (min-width: 1024px) {
	.ec-content-layout--with-sidebar {
		grid-template-columns: minmax(0, 1fr) var(--ec-sidebar-width);
		align-items: start;
		gap: var(--ec-space-6);
	}
}

/* Editorial Post Grids */
.ec-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ec-space-5);
}

@media (min-width: 640px) {
	.ec-grid--cols-2,
	.ec-grid--cols-3,
	.ec-grid--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.ec-grid--cols-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.ec-grid--cols-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.ec-grid--style-horizontal {
	grid-template-columns: minmax(0, 1fr);
}

@media (min-width: 1024px) {
	.ec-grid--cols-2.ec-grid--style-horizontal {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Hero Grid */
.ec-hero-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ec-space-5);
}

@media (min-width: 1024px) {
	.ec-hero-grid {
		grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
		align-items: start;
	}

	.ec-hero-grid--single {
		grid-template-columns: minmax(0, 1fr);
	}
}

.ec-hero-grid__side {
	display: flex;
	flex-direction: column;
	gap: var(--ec-space-4);
}

/* Trending Strip */
.ec-trending-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ec-space-4);
}

@media (min-width: 640px) {
	.ec-trending-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.ec-trending-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

/* Sidebar */
.ec-sidebar {
	display: flex;
	flex-direction: column;
	gap: var(--ec-space-5);
	min-width: 0;
}

/* Modern Smart Sticky Sidebar (Customizer: Layout -> Sidebar Settings; zero inner scrollbar; desktop only) */
@media (min-width: 1024px) {
	.ec-sidebar--sticky {
		position: sticky;
		top: var(--ec-sidebar-sticky-top, 184px);
		align-self: start;
	}

	body:not(.ec-has-sticky-header) .ec-sidebar--sticky {
		top: var(--ec-space-5);
	}
}

.ec-widget {
	padding: var(--ec-space-4);
	background-color: var(--ec-color-surface);
	border: 1px solid var(--ec-color-border);
	border-radius: var(--ec-radius-md);
}

.ec-widget__title {
	font-size: var(--ec-text-base);
	font-family: var(--ec-font-body);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	padding-bottom: var(--ec-space-2);
	margin-bottom: var(--ec-space-3);
	border-bottom: 2px solid var(--ec-color-border-strong);
}

.ec-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-widget li {
	padding-block: var(--ec-space-2);
	border-bottom: 1px solid var(--ec-color-border);
	font-size: var(--ec-text-sm);
}

.ec-widget li:last-child {
	border-bottom: 0;
}

/* Footer */
.ec-footer {
	background-color: var(--ec-color-secondary);
	color: var(--ec-color-on-secondary);
	margin-top: var(--ec-space-7);
}

.ec-footer a {
	color: var(--ec-color-on-secondary);
	opacity: 0.9;
}

.ec-footer a:hover {
	opacity: 1;
}

.ec-footer__widgets {
	padding-block: var(--ec-space-7) var(--ec-space-6);
	border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.ec-footer__grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: var(--ec-space-6);
}

@media (min-width: 640px) {
	.ec-footer__grid--cols-2,
	.ec-footer__grid--cols-3,
	.ec-footer__grid--cols-4 {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 1024px) {
	.ec-footer__grid--cols-3 {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.ec-footer__grid--cols-4 {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

.ec-footer-widget__title {
	color: var(--ec-color-on-secondary);
	font-family: var(--ec-font-body);
	font-size: var(--ec-text-sm);
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	margin-bottom: var(--ec-space-3);
}

.ec-footer-widget ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-footer-widget li {
	margin-bottom: var(--ec-space-2);
	font-size: var(--ec-text-sm);
}

.ec-footer__bottom {
	padding-block: var(--ec-space-4);
	font-size: var(--ec-text-sm);
}

.ec-footer__bottom-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: var(--ec-space-4);
}

.ec-footer__copyright {
	margin: 0;
	opacity: 0.88;
}

.ec-footer__links {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--ec-space-4);
}

.ec-footer-nav__list,
.ec-social-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--ec-space-3);
	list-style: none;
	margin: 0;
	padding: 0;
}

.ec-footer-nav__list a,
.ec-social-link {
	font-size: var(--ec-text-sm);
	text-decoration: none;
}

.ec-footer-nav__list a:hover,
.ec-social-link:hover {
	text-decoration: underline;
}
