/* =============================================================================
   CESL Fixed Nav — cesl-nav.css  v1.2.0
   Futuregram Studio Limited
   ============================================================================= */

/* =============================================================================
   CSS CUSTOM PROPERTIES (overridden by inline style from PHP)
   ============================================================================= */
:root {
	--cesl-primary:    #39327F;
	--cesl-accent:     #D81F26;
	--cesl-comp1:      #3C3280;
	--cesl-comp2:      #bebede;
	--cesl-sidebar-w:  140px;
	--cesl-panel-w:    48vw;
	--cesl-sub-w:      30vw;
	--cesl-transition: 0.35s ease;
	--cesl-size-nav:   26px;
	--cesl-size-aux:   18px;
	--cesl-size-sub:   22px;
}

/* =============================================================================
   BODY OFFSET — push page right so sidebar never covers content
   ============================================================================= */
body {
	margin-left: var(--cesl-sidebar-w) !important;
	box-sizing: border-box;
}

/* =============================================================================
   SCRIM — above page, below sidebar
   ============================================================================= */
#cesl-scrim {
	display: none;
	position: fixed;
	top: 0;
	left: var(--cesl-sidebar-w);
	right: 0;
	bottom: 0;
	background: rgba(0,0,0,0.45);
	z-index: 9000;
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* =============================================================================
   SIDEBAR — always on top of everything including search overlay
   ============================================================================= */
#cesl-sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: var(--cesl-sidebar-w);
	height: 100vh;
	background: var(--cesl-primary);
	z-index: 10000;
	display: flex;
	flex-direction: column;
	align-items: stretch;
	box-sizing: border-box;
}

/* ── Logo — fixed height at top ── */
#cesl-logo {
	padding: 16px 14px;
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

#cesl-logo a {
	display: block;
	width: 100%;
	line-height: 0;
}

#cesl-logo img {
	width: 100%;
	height: auto;
	display: block;
}

#cesl-logo-text {
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	line-height: 1.3;
	text-align: center;
}

/* ── Menu toggle — fills remaining space, centres content within it ── */
#cesl-btn-nav {
	flex: 1;
	display: flex;
	flex-direction: column-reverse;
	align-items: center;
	justify-content: center;
	gap: 6px;
	width: 100%;
	padding: 0;
	background: rgba(255,255,255,0);
	border: none;
	cursor: pointer;
	color: #ffffff;
	box-sizing: border-box;
	transition: background 0.2s ease;
}

#cesl-btn-nav:hover {
	background: rgba(255,255,255,0);
}

#cesl-btn-nav.is-active,
#cesl-btn-nav.is-active:hover {
	background: rgba(255,255,255,0) !important;
}

/* Icon wrapper — handles default/close swap */
.cesl-icon-wrap {
	position: relative;
	width: 22px;
	height: 22px;
	flex-shrink: 0;
}

.cesl-icon {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: opacity 0.2s ease;
}

.cesl-icon svg {
	width: 22px;
	height: 22px;
	display: block;
}

.cesl-icon-default { opacity: 1; }
.cesl-icon-close   { opacity: 0; }

#cesl-btn-nav.is-active .cesl-icon-default { opacity: 0; }
#cesl-btn-nav.is-active .cesl-icon-close   { opacity: 1; }

/* Menu label */
.cesl-btn-label {
	font-size: 15px;
	font-weight: normal;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: #ffffff;
	font-family: inherit;
	line-height: 1;
}

/* ── Bottom group: CTA icons + search ── */
#cesl-sidebar-bottom {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding-bottom: 10px;
}

#cesl-cta1-icon,
#cesl-cta2-icon,
#cesl-btn-search {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 12px 0;
	background: none;
	border: none;
	cursor: pointer;
	color: rgba(255,255,255,0.75);
	text-decoration: none;
	transition: color 0.2s ease, background 0.2s ease;
	box-sizing: border-box;
}

#cesl-cta1-icon:hover,
#cesl-cta2-icon:hover,
#cesl-btn-search:hover {
	color: #ffffff;
	background: rgba(255,255,255,0.08);
}

#cesl-cta1-icon svg,
#cesl-cta2-icon svg {
	width: 32px;
	height: 32px;
	display: block;
}

#cesl-btn-search {
	color: rgba(255,255,255,0.85);
}

#cesl-btn-search svg {
	width: 32px;
	height: 32px;
	display: block;
}

/* =============================================================================
   NAV PANEL — slides in from left, sits to the right of sidebar
   ============================================================================= */
#cesl-nav-panel {
	display: none;
	position: fixed;
	top: 0;
	left: var(--cesl-sidebar-w);
	width: 33vw;
	height: 100vh;
	background: var(--cesl-nav-panel-bg);
	z-index: 9500;
	overflow-y: auto;
	transform: translateX(-110%);
	transition: transform var(--cesl-transition);
}

#cesl-nav-panel.is-open {
	transform: translateX(0);
}

#cesl-nav-panel-inner {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	min-height: 100vh;
	padding: 80px 52px 60px 80px;
	box-sizing: border-box;
}

/* ── Primary nav list — no borders ── */
#cesl-nav-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

#cesl-nav-list li {
	margin: 0;
	padding: 0;
}

#cesl-nav-list a,
#cesl-nav-list button.cesl-nav-trigger {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 12px 0;
	font-size: var(--cesl-size-nav);
	font-weight: 600;
	color: rgba(255,255,255,0.92);
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	text-align: left;
	font-family: inherit;
	line-height: 1.25;
	transition: color 0.2s ease;
}

#cesl-nav-list a:hover,
#cesl-nav-list button.cesl-nav-trigger:hover {
	color: #ffffff;
}

#cesl-nav-list button.cesl-nav-trigger.is-active {
	color: #ffffff;
}

/* ── Plus icon — rotates to × when active ── */
.cesl-nav-plus {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
	color: rgba(255,255,255,0.55);
	transition: transform 0.25s ease, color 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cesl-nav-plus svg {
	width: 100%;
	height: 100%;
	display: block;
}

button.cesl-nav-trigger.is-active .cesl-nav-plus {
	transform: rotate(45deg);
	color: var(--cesl-accent);
}

/* ── Aux nav ── */
.cesl-aux-nav {
	list-style: none;
	margin: 24px 0 0;
	padding: 0;
}

.cesl-aux-nav li {
	margin: 0;
	padding: 0;
}

.cesl-aux-nav a,
a.cesl-aux-link {
	display: block;
	padding: 6px 0;
	font-size: var(--cesl-size-aux);
	font-weight: 400;
	color: rgba(255,255,255,0.6);
	text-decoration: none;
	transition: color 0.2s ease;
}

.cesl-aux-nav a:hover,
a.cesl-aux-link:hover {
	color: #ffffff;
}

/* =============================================================================
   SUBMENU FLYOUT PANEL
   Flush right of nav panel, top-aligned with matching padding-top
   ============================================================================= */
#cesl-sub-panel {
	display: none;
	position: fixed;
	top: 0;
	left: calc(var(--cesl-sidebar-w) + 33vw);
	width: calc(100vw - var(--cesl-sidebar-w) - 60vw);
	height: 100vh;
	background: #ffffff;
	z-index: 9500;
	overflow-y: auto;
	transform: translateX(-20px);
	opacity: 0;
	transition: transform var(--cesl-transition), opacity var(--cesl-transition);
}

#cesl-sub-panel.is-open {
	transform: translateX(0);
	opacity: 1;
}

#cesl-sub-panel-inner {
	display: flex;
	flex-direction: column;
	justify-content: flex-start;
	min-height: 100vh;
	padding: 80px 44px 60px 44px;
	box-sizing: border-box;
}

/* Section title — same padding-top as nav panel so baselines align */
#cesl-sub-title {
	font-size: var(--cesl-size-nav);
	font-weight: 700;
	color: var(--cesl-sub-title-col);
	margin: 0;
	line-height: 1.25;
	padding: 12px 0;
}

/* Child links list */
#cesl-sub-links {
	list-style: none;
	margin: 0;
	padding: 0;
}

#cesl-sub-links li {
	margin: 0;
	padding: 0;
}

#cesl-sub-links a {
	display: block;
	padding: 10px 0;
	font-size: var(--cesl-size-sub);
	color: var(--cesl-sub-links-col);
	text-decoration: none;
	font-weight: 500;
	transition: color 0.2s ease, padding-left 0.2s ease;
}

#cesl-sub-links a:hover {
	color: var(--cesl-primary);
	padding-left: 6px;
}

/* =============================================================================
   SEARCH OVERLAY
   Full-screen near-black. Sidebar sits on top (z-index 10000 vs 9500 here).
   Dark grey is the INPUT's own background. Placeholder = "Search CESL".
   ============================================================================= */
#cesl-search-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(10,10,10,0.93);
	z-index: 9500;
	align-items: center;
	justify-content: center;
}

#cesl-search-overlay.is-open {
	display: flex;
}

#cesl-search-inner {
	margin-left: var(--cesl-sidebar-w);
	width: calc(100vw - var(--cesl-sidebar-w));
	padding: 0 60px;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	align-items: stretch;
}

/* Transparent wrapper — only provides relative context for the icon */
#cesl-search-bar {
	position: relative;
	width: 100%;
	background: transparent;
	display: flex;
	align-items: stretch;
}

/* WP search form fills full width */
#cesl-search-bar .search-form,
#cesl-search-bar form[role="search"] {
	display: flex;
	align-items: stretch;
	width: 100%;
	margin: 0 !important;
	padding: 0 !important;
	background: none !important;
	border: none !important;
	box-shadow: none !important;
}

/* Input IS the dark grey bar — high specificity to beat theme overrides */
#cesl-search-overlay #cesl-search-bar .search-field,
#cesl-search-overlay #cesl-search-bar input[type="search"] {
	display: block !important;
	flex: 1 !important;
	width: 100% !important;
	background: rgba(50,50,55,0.95) !important;
	border: none !important;
	outline: none !important;
	box-shadow: none !important;
	font-size: 2.2rem !important;
	font-weight: 300 !important;
	color: rgba(255,255,255,0.85) !important;
	font-family: inherit !important;
	-webkit-appearance: none !important;
	padding: 36px 80px 36px 36px !important;
	box-sizing: border-box !important;
	margin: 0 !important;
	caret-color: var(--cesl-accent) !important;
	height: auto !important;
	line-height: 1.2 !important;
	border-radius: 0 !important;
}

#cesl-search-overlay #cesl-search-bar .search-field::placeholder,
#cesl-search-overlay #cesl-search-bar input[type="search"]::placeholder {
	color: rgba(255,255,255,0.4) !important;
}

/* Hide the WP default submit button */
#cesl-search-bar .search-submit,
#cesl-search-bar button[type="submit"],
#cesl-search-bar input[type="submit"] {
	display: none !important;
}

/* SVG icon — vertically centred on the right of the input */
#cesl-search-icon-btn {
	position: absolute;
	right: 28px;
	top: 50%;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	color: rgba(255,255,255,0.55);
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: color 0.2s ease;
	z-index: 1;
}

#cesl-search-icon-btn:hover {
	color: #ffffff;
}

#cesl-search-icon-btn svg {
	width: 36px;
	height: 36px;
	display: block;
}

/* Hint text — right-aligned */
#cesl-search-hint {
	font-size: 0.8rem;
	color: rgba(255,255,255,0.3);
	margin: 12px 0 0;
	letter-spacing: 0.02em;
	font-family: inherit;
	text-align: right;
}

/* =============================================================================
   MOBILE — max-width: 768px
   ============================================================================= */
@media (max-width: 768px) {

	:root {
		--cesl-sidebar-w: 56px;
		--cesl-panel-w:   100vw;
		--cesl-sub-w:     100vw;
	}

	/* Sidebar becomes horizontal top bar */
	#cesl-sidebar {
		width: 100vw;
		height: var(--cesl-sidebar-w);
		flex-direction: row;
		align-items: center;
		padding: 0;
	}

	body {
		margin-left: 0 !important;
		margin-top: var(--cesl-sidebar-w) !important;
	}

	#cesl-logo {
		padding: 0 10px;
		flex: 1;
		justify-content: flex-start;
	}

	#cesl-logo img {
		width: auto;
		height: 36px;
	}

	#cesl-btn-nav {
		width: auto;
		padding: 0 14px;
		height: 100%;
		background: none;
	}

	.cesl-btn-label {
		display: none;
	}

	/* Hide CTA icons on mobile — too cramped */
	#cesl-sidebar-bottom {
		flex-direction: row;
		margin-top: 0;
		padding-bottom: 0;
		height: 100%;
		align-items: center;
	}

	#cesl-cta1-icon,
	#cesl-cta2-icon {
		display: none;
	}

	#cesl-btn-search {
		width: auto;
		padding: 0 14px;
		height: 100%;
	}

	/* Nav panel: full-width, slides in from top */
	#cesl-nav-panel {
		top: var(--cesl-sidebar-w);
		left: 0;
		width: 100vw;
		height: calc(100vh - var(--cesl-sidebar-w));
		transform: translateX(-100%);
	}

	#cesl-nav-panel-inner {
		padding: 32px 28px 40px;
		justify-content: flex-start;
	}

	/* Sub-panel: slides up from bottom */
	#cesl-sub-panel {
		top: auto;
		left: 0;
		bottom: 0;
		width: 100vw;
		height: auto;
		min-height: 50vh;
		max-height: 80vh;
		transform: translateY(20px);
		opacity: 0;
	}

	#cesl-sub-panel.is-open {
		transform: translateY(0);
		opacity: 1;
	}

	#cesl-sub-panel-inner {
		padding: 32px 28px 40px;
		min-height: unset;
	}

	/* Search overlay on mobile */
	#cesl-search-inner {
		margin-left: 0;
		width: 100%;
		padding: 0 24px;
	}

	#cesl-search-label {
		font-size: 1.3rem;
	}

	#cesl-search-bar .search-field,
	#cesl-search-bar input[type="search"] {
		font-size: 1.2rem;
	}
}
