/* ==========================================================================
   Brain & Breathing Science — Refresh layer (2026)
   Motion, parallax and polish on top of the original design. Loaded last.
   Every hidden-until-revealed state is scoped to html.bb-js, so the site is
   fully visible if JavaScript is off or slow. Reduced-motion is respected.
   ========================================================================== */

:root {
	--bb-blue: #2A3FB2;
	--bb-indigo: #3F51B5;
	--bb-yellow: #F8CB30;
	--bb-ink: #292F36;
	--bb-line: #DEE0ED;
	--bb-mist: #F0F1F7;
	--bb-ease: cubic-bezier(.16, 1, .3, 1);      /* expo-out: fast start, soft landing */
	--bb-ease-io: cubic-bezier(.77, 0, .18, 1);  /* for panels that slide in and out */
}

html {
	scrollbar-gutter: stable;
	scroll-padding-top: 120px;
	-webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) {
	html { scroll-behavior: smooth; }
}
body {
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
img { max-width: 100%; }

/* Smooth cross-fade between pages in browsers that support it (no JS). */
@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .35s; }
body > header.bb-header { view-transition-name: bb-header; }

/* Inline SVG icons + spans must inherit colour (custom.css colours "*"). */
.bb-icon, .bb-icon *, .bb-burger, .bb-close, .bb-w, .bb-w > span { color: inherit; }
.bb-icon { display: inline-block; vertical-align: -0.125em; }

/* --------------------------------------------------------------------------
   Scroll progress
   -------------------------------------------------------------------------- */
.bb-progress {
	position: fixed;
	top: 0; left: 0; right: 0;
	height: 3px;
	z-index: 1001;
	pointer-events: none;
}
.bb-progress span {
	display: block;
	height: 100%;
	background: var(--bb-yellow);
	transform: scaleX(0);
	transform-origin: 0 50%;
	will-change: transform;
}
/* Modern browsers drive the bar from CSS alone (no JS per scroll frame). */
@supports (animation-timeline: scroll()) {
	.bb-progress span {
		animation: bbProgress linear both;
		animation-timeline: scroll(root block);
	}
	@keyframes bbProgress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
}

/* --------------------------------------------------------------------------
   Header: sticks, tucks away on scroll down, returns on scroll up
   -------------------------------------------------------------------------- */
@media (min-width: 768px) {
	body > header.bb-header {
		position: -webkit-sticky;
		position: sticky;
		top: 0;
		z-index: 900;
		background: #fff;
		transition: transform .55s var(--bb-ease), box-shadow .4s ease;
	}
	body > header.bb-header.is-scrolled { box-shadow: 0 10px 40px -18px rgba(42, 63, 178, .28); }
	body > header.bb-header.is-hidden { transform: translate3d(0, -100%, 0); }
	body > header.bb-header:focus-within { transform: none; }
}
.header_logo img { transition: opacity .3s ease; }
.header_logo a:hover img { opacity: .82; }

/* Main menu: underline grows from the centre */
.header_mid ul li a { position: relative; display: inline-block; padding: 6px 0; }
.header_mid ul li a::after {
	content: '';
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 2px;
	background: var(--bb-yellow);
	transform: scaleX(0);
	transition: transform .55s var(--bb-ease);
}
.header_mid ul li a:hover::after,
.header_mid ul li.current-menu-item > a::after,
.header_mid ul li.current-menu-ancestor > a::after,
.header_mid ul li.current-page-ancestor > a::after { transform: scaleX(1); }

/* Hamburger (replaces the Font Awesome icon, same yellow square) */
.header_nav a { transition: background-color .4s ease, color .4s ease, opacity .35s ease; }
.bb-burger {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-end;
	gap: .2em;
	width: .8em;
}
.bb-burger i {
	display: block;
	width: 100%;
	height: 3px;
	border-radius: 2px;
	background: currentColor;
	transition: width .5s var(--bb-ease);
}
.bb-burger i:nth-child(2) { width: 70%; }
.bb-burger i:nth-child(3) { width: 85%; }
.header_nav a:hover .bb-burger i { width: 100%; }
.header_nav a:hover .bb-burger i:nth-child(2) { transition-delay: .05s; }
.header_nav a:hover .bb-burger i:nth-child(3) { transition-delay: .1s; }

/* --------------------------------------------------------------------------
   Sidebar menu
   -------------------------------------------------------------------------- */
.sidebar_main,
.sidebar_main.open {
	width: min(400px, 88vw);
	max-width: none;
	height: 100vh;
	height: 100dvh;
	overflow-y: auto;
	overscroll-behavior: contain;
	visibility: hidden;
	transition: transform .75s var(--bb-ease-io), visibility 0s linear .75s, box-shadow .75s ease;
}
.sidebar_main.open {
	visibility: visible;
	box-shadow: -40px 0 90px rgba(16, 24, 80, .28);
	transition: transform .75s var(--bb-ease-io), visibility 0s, box-shadow .75s ease;
}
html.bb-menu-open { overflow: hidden; }

.bb-menu-backdrop {
	position: fixed;
	inset: 0;
	z-index: 999;
	background: rgba(41, 47, 54, .42);
	-webkit-backdrop-filter: blur(3px);
	backdrop-filter: blur(3px);
	opacity: 0;
	pointer-events: none;
	transition: opacity .6s ease;
}
html.bb-menu-open .bb-menu-backdrop { opacity: 1; pointer-events: auto; }

.bb-close {
	position: relative;
	display: inline-block;
	width: 1em;
	height: 1em;
	transition: transform .6s var(--bb-ease);
}
.bb-close::before,
.bb-close::after {
	content: '';
	position: absolute;
	top: 50%; left: 0;
	width: 100%;
	height: 2px;
	margin-top: -1px;
	background: currentColor;
	transform: rotate(45deg);
}
.bb-close::after { transform: rotate(-45deg); }
.sidebar_main a.menu_close { color: #fff; }
.sidebar_main a.menu_close:hover,
.sidebar_main a.menu_close:focus-visible { color: var(--bb-yellow); }
a.menu_close:hover .bb-close { transform: rotate(90deg); }
html.bb-menu-open .bb-progress { opacity: 0; }

.sidebar_main li a { transition: color .3s ease, transform .5s var(--bb-ease); }
.sidebar_main li a[href]:hover { color: var(--bb-yellow) !important; transform: translateX(6px); }

html.bb-js .sidebar_main h3,
html.bb-js .sidebar_main .menu_close,
html.bb-js .sidebar_main .menu > li {
	opacity: 0;
	transform: translate3d(28px, 0, 0);
	transition: opacity .5s ease, transform .8s var(--bb-ease);
}
html.bb-js .sidebar_main.open h3,
html.bb-js .sidebar_main.open .menu_close,
html.bb-js .sidebar_main.open .menu > li {
	opacity: 1;
	transform: none;
	transition-delay: .18s;
}
html.bb-js .sidebar_main.open .menu > li { transition-delay: calc(.22s + var(--i, 0) * .05s); }

/* --------------------------------------------------------------------------
   Banners: parallax background + slow settle on load
   -------------------------------------------------------------------------- */
.bb-parallax {
	position: relative;
	overflow: hidden;
	background-color: var(--bb-blue);
	isolation: isolate;
}
.bb-parallax__layer {
	position: absolute;
	top: -2px; left: 0; right: 0; bottom: -2px;
	z-index: 0;
	background-size: cover;
	background-position: center center;
	background-repeat: no-repeat;
	will-change: transform;
	pointer-events: none;
}
.bb-parallax__img {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	object-position: center center;
}
.bb-parallax > *:not(.bb-parallax__layer) { position: relative; z-index: 1; }
.top_home_content, .top_banner_default h1 { will-change: transform, opacity; }

@media (prefers-reduced-motion: no-preference) {
	html.bb-js .bb-parallax__layer { animation: bbSettle 2.2s var(--bb-ease) both; }
}
@keyframes bbSettle {
	from { scale: 1.1; opacity: .35; }
	to   { scale: 1;   opacity: 1; }
}

/* Headline word-by-word rise (hero + inner page titles) */
html.bb-js .bb-hero-copy:not(.is-split),
html.bb-js .top_banner_default h1:not(.is-split) { visibility: hidden; }
.bb-split .bb-w {
	display: inline-block;
	overflow: hidden;
	vertical-align: top;
	padding-bottom: .1em;
	margin-bottom: -.1em;
}
.bb-split .bb-w > span {
	display: inline-block;
	transform: translate3d(0, 110%, 0);
	transition: transform 1.1s var(--bb-ease);
	transition-delay: calc(var(--d, 0) * 1ms);
}
.bb-split.is-in .bb-w > span { transform: none; }

/* --------------------------------------------------------------------------
   Scroll reveals
   -------------------------------------------------------------------------- */
html.bb-js [data-bb-reveal] {
	opacity: 0;
	transition: opacity .9s ease, transform 1.15s var(--bb-ease);
	transition-delay: calc(var(--bb-d, 0) * 1ms);
}
html.bb-js [data-bb-reveal="up"]    { transform: translate3d(0, 44px, 0); }
html.bb-js [data-bb-reveal="left"]  { transform: translate3d(-60px, 0, 0); }
html.bb-js [data-bb-reveal="right"] { transform: translate3d(60px, 0, 0); }
html.bb-js [data-bb-reveal="wipe"]  { opacity: 1; }
html.bb-js [data-bb-reveal].is-in   { opacity: 1; transform: none; }
@media (max-width: 767.98px) {
	html.bb-js [data-bb-reveal="up"]    { transform: translate3d(0, 26px, 0); }
	html.bb-js [data-bb-reveal="left"],
	html.bb-js [data-bb-reveal="right"] { transform: translate3d(0, 26px, 0); }
	html.bb-js [data-bb-reveal].is-in   { transform: none; }
}

/* Image wipe: the photo uncovers left-to-right while easing out of a zoom */
.bb-wipe img { transition: clip-path 1.5s var(--bb-ease), scale 2s var(--bb-ease); }
html.bb-js .bb-wipe:not(.is-in) img { clip-path: inset(0 100% 0 0); scale: 1.18; }

/* What We Do: the yellow block slides out from behind the photo, then
   drifts at its own depth while scrolling */
.second_home_img::before {
	translate: 0 var(--bb-shift, 0px);
	transition: transform 1.3s var(--bb-ease) .35s;
}
html.bb-js .second_home_img:not(.is-in)::before { transform: translate3d(-30px, -30px, 0); }

/* Section title rule draws itself across */
.home_section_title_line h2::after {
	transform-origin: 0 50%;
	transition: transform 1.8s var(--bb-ease) .3s;
}
html.bb-js .home_section_title_line:not(.is-in) h2::after { transform: scaleX(0); }

/* Research team: masked photo with inner parallax */
.bb-img-mask {
	margin: 0;
	overflow: hidden;
	position: relative;
}
.bb-img-mask img {
	display: block;
	width: 100%;
	height: auto;
	scale: 1.12;
	will-change: transform;
}
html.bb-js .bb-img-mask.bb-wipe:not(.is-in) img { scale: 1.25; }
.home_research_img > div { will-change: transform; }

/* --------------------------------------------------------------------------
   Research platform cards
   -------------------------------------------------------------------------- */
.third_home .bb-card {
	display: block;
	position: relative;
	height: 100%;
	padding: 26px 0 10px;
}
.third_home .bb-card::before {
	content: '';
	position: absolute;
	top: 0; left: 0;
	width: 48px;
	height: 3px;
	background: var(--bb-yellow);
	transition: width .8s var(--bb-ease);
}
.third_home .bb-card h3 { transition: color .35s ease, transform .7s var(--bb-ease); }
.third_home .bb-card p  { transition: transform .7s var(--bb-ease) .04s; }
.third_home .bb-card:hover::before { width: 100%; }
.third_home .bb-card:hover h3 { color: var(--bb-blue); transform: translateX(6px); }
.third_home .bb-card:hover p  { transform: translateX(6px); }
@media (max-width: 767.98px) {
	.third_home .col-md-4 { margin-bottom: 28px; }
}

/* --------------------------------------------------------------------------
   Text links with the yellow rule: the line sweeps out and back on hover
   -------------------------------------------------------------------------- */
.learn_more_third_home a::after,
.home_blog_row a::after,
.blog_link_home a::after,
.home_research_img div a::after,
.single_blog_con a::after,
.single_blog_row a::after,
.single_publication_row a::after,
.news_con a::after,
.back_to_blog a::after { transform-origin: 100% 50%; }

.learn_more_third_home a:hover::after,
.home_blog_link a:hover::after,
.blog_link_home a:hover::after,
.home_research_img div a:hover::after,
.single_blog_con a:hover::after,
.single_blog_row a:hover::after,
.single_publication_row a:hover::after,
.news_con a:hover::after,
.back_to_blog a:hover::after { animation: bbLine .8s var(--bb-ease); }

@keyframes bbLine {
	0%   { transform: scaleX(1); transform-origin: 100% 50%; }
	45%  { transform: scaleX(0); transform-origin: 100% 50%; }
	46%  { transform: scaleX(0); transform-origin: 0 50%; }
	100% { transform: scaleX(1); transform-origin: 0 50%; }
}

/* --------------------------------------------------------------------------
   Blog rows: a soft wash sweeps in behind the row on hover
   -------------------------------------------------------------------------- */
.home_blog_row,
.single_blog_row {
	position: relative;
	isolation: isolate;
}
.home_blog_row::before,
.single_blog_row::before {
	content: '';
	position: absolute;
	top: 0; bottom: 0; left: -15px; right: -15px;
	z-index: -1;
	background: var(--bb-mist);
	transform: scaleX(0);
	transform-origin: 0 50%;
	transition: transform .8s var(--bb-ease);
}
.home_blog_row:hover::before,
.single_blog_row:hover::before { transform: scaleX(1); }
.home_blog_row h3,
.single_blog_row h3 { transition: color .35s ease, transform .7s var(--bb-ease); }
.home_blog_row:hover h3,
.single_blog_row:hover h3 { transform: translateX(8px); color: var(--bb-blue); }

/* --------------------------------------------------------------------------
   Inner pages
   -------------------------------------------------------------------------- */
.top_banner_sub ul li a { position: relative; display: inline-block; padding: 4px 0; }
.top_banner_sub ul li a::after {
	content: '';
	position: absolute;
	left: 0; right: 0; bottom: 0;
	height: 2px;
	background: var(--bb-yellow);
	transform: scaleX(0);
	transition: transform .55s var(--bb-ease);
}
.top_banner_sub ul li a:hover::after,
.top_banner_sub ul li.current_page_item > a::after { transform: scaleX(1); }
@media (max-width: 767.98px) {
	.top_banner_sub ul li a::after { display: none; }
}

/* Image zoom inside its frame on hover */
.second_research_row .col-md-6 > a:has(img),
.faculty_panels .col-md-4 { overflow: hidden; }
.second_research_row .col-md-6 > a:has(img) { display: block; }
.second_research_row img,
.faculty_panels .col-md-4 img { transition: scale 1.2s var(--bb-ease); }
.second_research_row a:hover img,
.faculty_panels:hover .col-md-4 img { scale: 1.05; }
.second_research_row h3 { transition: color .35s ease; }
.second_research_row a:hover h3 { color: var(--bb-blue); }

.collaborator_panels img { transition: transform .6s var(--bb-ease); }
.collaborator_panels a:hover img { transform: scale(1.08); }

.footer_top_r a { display: inline-block; transition: color .35s ease, transform .5s var(--bb-ease); }
.footer_top_r a:hover { transform: translateY(-2px); }

/* --------------------------------------------------------------------------
   Reduced motion: everything visible, nothing moves
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: .001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: .001ms !important;
		transition-delay: 0s !important;
		scroll-behavior: auto !important;
	}
	html.bb-js [data-bb-reveal],
	.bb-split .bb-w > span { opacity: 1 !important; transform: none !important; }
	.bb-wipe img { clip-path: none !important; }
	.bb-parallax__layer, .bb-img-mask img, .home_research_img > div { translate: none !important; }
}
