/*
 * Shell components: Helix-style mega menu, off-canvas treeview, cookie banner, ESPA box.
 * Markup keeps the Joomla class names (inc/menus.php, template-parts/global/*). Written from scratch (Q25).
 */

/* ---- Mega menu (header) ------------------------------------------------------------------------- */

.sp-megamenu-parent {
	display: block;
	float: right;
	z-index: 9;
	margin: 0;
	padding: 0;
	list-style: none;
}

.sp-megamenu-parent > li {
	display: inline-block;
	position: relative;
	padding: 0;
}

.sp-megamenu-parent > li > a {
	display: inline-block;
	padding: 43px 8px !important;
	font-size: 14px;
	line-height: 1;
	text-transform: uppercase;
	color: var(--icf-color-black);
}

/* Below 980px the off-canvas replaces the mega menu (the menu is also .hidden-xs below 768px). */
@media (max-width: 979px) {
	.sp-megamenu-parent {
		display: none;
	}
}

/* Top-level items stay black on hover and when active (as on the reference). */
.sp-megamenu-parent > li:hover > a,
.sp-megamenu-parent > li.active > a {
	color: var(--icf-color-black) !important;
}

.sp-megamenu-parent > li.sp-has-child > a::after {
	content: " \f107";
	font-family: FontAwesome;
	line-height: 13px;
}

.sp-megamenu-parent .sp-dropdown {
	display: none;
	position: absolute;
	z-index: 10;
	margin: 0;
}

.sp-megamenu-parent .sp-dropdown.sp-dropdown-main {
	top: 100%;
}

.sp-megamenu-parent .sp-dropdown.sp-dropdown-main.sp-menu-right {
	left: 0;
}

.sp-megamenu-parent .sp-dropdown.sp-dropdown-main.sp-menu-left {
	right: 0;
}

.sp-megamenu-parent .sp-dropdown.sp-menu-center {
	margin-left: 45px;
}

.sp-megamenu-parent .sp-dropdown.sp-dropdown-sub {
	top: 0;
	left: 100%;
}

.sp-megamenu-parent .sp-has-child:hover > .sp-dropdown {
	display: block;
	animation: icf-fade-in var(--icf-motion-dropdown);
}

@keyframes icf-fade-in {
	from {
		opacity: 0;
	}

	to {
		opacity: 1;
	}
}

.sp-megamenu-parent .sp-dropdown .sp-dropdown-inner {
	padding: 10px 35px 30px;
	background: var(--icf-color-secondary);
	box-shadow: 0 3px 5px 0 rgba(0, 0, 0, 0.2);
}

.sp-megamenu-parent .sp-dropdown.sp-dropdown-sub .sp-dropdown-inner {
	box-shadow: 0 0 5px rgba(0, 0, 0, 0.2);
}

.sp-megamenu-parent .sp-dropdown .sp-dropdown-items,
.sp-megamenu-parent .sp-mega-group,
.sp-megamenu-parent .sp-mega-group .sp-mega-group-child {
	margin: 0;
	padding: 0;
	list-style: none;
}

.sp-megamenu-parent .sp-dropdown li.sp-menu-item {
	display: block;
	position: relative;
	padding: 0;
}

.sp-megamenu-parent .sp-dropdown li.sp-menu-item > a {
	display: block;
	position: relative;
	width: 100%;
	padding: 12px 0;
	font-size: 15px;
	font-weight: 300;
	letter-spacing: 0.05em;
	text-transform: none;
	color: var(--icf-color-white) !important;
	text-decoration: none !important;
	border-bottom: 0 solid #233e5f;
	cursor: pointer;
	transition: color 0.2s ease;
}

/* Underline that grows from the centre on hover. */
.sp-megamenu-parent .sp-dropdown li.sp-menu-item > a::before {
	content: "";
	position: absolute;
	bottom: 0;
	left: 0;
	width: 100%;
	height: 2px;
	visibility: hidden;
	background-color: var(--icf-color-white);
	transform: scaleX(0);
	transition: all var(--icf-motion-underline) ease-in-out 0s;
}

.sp-megamenu-parent .sp-dropdown li.sp-menu-item > a:hover::before {
	visibility: visible;
	transform: scaleX(1);
}

.sp-megamenu-parent .sp-dropdown .sp-dropdown-items .sp-has-child > a::after {
	content: " \f105";
	float: right;
	font-family: FontAwesome;
}

/* Mega groups have no visible title (Joomla "showmenutitle" off). */
.sp-megamenu-parent .sp-dropdown li.sp-menu-item > a.sp-group-title {
	display: none !important;
	font-weight: 700;
	text-transform: uppercase;
}

/* ---- Off-canvas treeview ------------------------------------------------------------------------- */

.offcanvas-menu .vina-treeview-menus {
	display: block;
}

.offcanvas-menu .treeview,
.offcanvas-menu .treeview ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.offcanvas-menu .treeview ul {
	margin-top: 4px;
	background-color: transparent;
}

.offcanvas-menu .treeview li {
	position: relative;
	margin: 0;
	padding: 0;
	background: none;
	border: none;
}

.offcanvas-menu .treeview .sub-menu li {
	padding-left: 10px;
}

.offcanvas-menu .treeview li a {
	display: inline-block;
	width: 100%;
	padding: 8px 10px 8px 0;
	color: var(--icf-color-white) !important;
	border-bottom: 1px solid var(--icf-color-offcanvas-rule);
	transition: 300ms;
}

/* A20: the hover takes the site's orange, not the pink #e52b50 of the template demo. */
.offcanvas-menu .treeview li a:hover {
	color: var(--icf-color-accent) !important;
}

.offcanvas-menu .treeview .active > a {
	text-decoration: underline;
}

.offcanvas-menu .treeview .hitarea {
	position: absolute;
	top: 0;
	right: 0;
	width: 25px;
	height: 37px;
	margin-left: 0;
	cursor: pointer;
	background: url("../img/treeview-open.svg") center center no-repeat transparent;
}

.offcanvas-menu .treeview .hitarea.expandable-hitarea {
	background-image: url("../img/treeview-closed.svg");
}

/* K34: on the catalogue pages that show a book the reference's treeview() fails (inc/catalogue.php), so only the
   template's module rules apply: every sub-menu open, no indent, no hit areas. */
.offcanvas-menu ul.level0:not(.treeview),
.offcanvas-menu ul.level0:not(.treeview) ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.offcanvas-menu ul.level0:not(.treeview) li {
	padding: 0;
	border: none;
}

.offcanvas-menu ul.level0:not(.treeview) li a {
	display: inline-block;
	width: 100%;
	padding: 8px 10px 8px 0;
	color: var(--icf-color-white) !important;
	border-bottom: 1px solid var(--icf-color-offcanvas-rule);
	transition: 300ms;
}

.offcanvas-menu ul.level0:not(.treeview) li a:hover {
	color: var(--icf-color-accent) !important;
}

.offcanvas-menu ul.level0:not(.treeview) .active > a {
	text-decoration: underline;
}

/* ---- Cookie banner (cookieconsent 3.1.1, options as the Joomla GDPR plugin) ---------------------- */

div.cc-revoke,
div.cc-window {
	font-size: 16px;
	line-height: 1em;
}

div.cc-window {
	z-index: var(--icf-z-cookie);
}

div.cc-window.cc-banner {
	padding: 1em 1.8em;
}

div.cc-window.cc-floating {
	padding: 2em 1.8em;
}

/* Buttons take their content width (the plugin's CSS), not equal halves, and never wrap. */
.cc-window .cc-compliance > .cc-btn {
	flex: 1 1 auto;
	white-space: nowrap;
}

.cc-window .cc-highlight .cc-btn:first-child:hover {
	text-decoration: underline;
}

/* ---- ESPA publicity box (EngageBox #5 on the reference) ------------------------------------------ */

.rstbox {
	display: block;
	position: fixed;
	z-index: var(--icf-z-espa);
	box-sizing: border-box;
	max-width: var(--icf-size-espa-max);
	max-height: 100%;
	height: auto;
	padding: 0;
	overflow: auto;
	font-size: 14px;
	line-height: 1.4;
	color: var(--icf-color-espa-text);
	background-color: var(--icf-color-white);
	border: none;
	border-radius: 0;
}

.rstbox_bottom-left {
	bottom: 0;
	left: 0;
}

.rstbox_shd_1 {
	box-shadow: var(--icf-shadow-espa);
}

.rstbox .rstbox-content {
	overflow: hidden;
}

.rstbox img {
	width: 100%;
}

/* Slides up on page load (EngageBox "slideUpIn", 400ms). */
.rstbox.icf-in {
	animation: icf-slide-up 400ms ease-out;
}

.rstbox.icf-out {
	display: none;
}

@keyframes icf-slide-up {
	from {
		opacity: 0;
		transform: translateY(100%);
	}

	to {
		opacity: 1;
		transform: none;
	}
}
