/*
Theme Name: CIBIO
Author: Rúben Luz
Author URI: mailto:ruben.fs.luz@uac.pt
Description: Block theme for CIBIO-Açores. Design tokens live in theme.json; light/dark colour values live below.
Version: 0.21.1
Requires at least: 6.5
Requires PHP: 8.0
Text Domain: cibio
*/

/* ---------------------------------------------------------------
   Colour modes. theme.json palette entries point at these variables.
   Light is the default. Dark follows the visitor's system setting
   unless they chose a mode with the toggle (html[data-theme]).
   --------------------------------------------------------------- */
:root {
	color-scheme: light;
	--cibio-base: #ffffff;
	--cibio-surface: #f2f5f2;
	--cibio-contrast: #14211a;
	--cibio-muted: #55645b;
	--cibio-primary: #2f5d46;
	--cibio-accent: #3d7a5a;
	--cibio-border: #d8e0da;
	/* Official logo colours (light); white in dark mode. */
	--cibio-logo-leaf1: #02311B;
	--cibio-logo-leaf2: #08A25B;
	--cibio-logo-leaf3: #44E098;
	--cibio-logo-word: #000000;
}
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		color-scheme: dark;
		--cibio-base: #0f1613;
		--cibio-surface: #17211c;
		--cibio-contrast: #e8eee9;
		--cibio-muted: #a3b3a9;
		--cibio-primary: #8fc7a4;
		--cibio-accent: #6fbf92;
		--cibio-border: #2a3a31;
		--cibio-logo-leaf1: rgba(255, 255, 255, .5);
		--cibio-logo-leaf2: rgba(255, 255, 255, .78);
		--cibio-logo-leaf3: #ffffff;
		--cibio-logo-word: #ffffff;
	}
}
:root[data-theme="dark"] {
	color-scheme: dark;
	--cibio-base: #0f1613;
	--cibio-surface: #17211c;
	--cibio-contrast: #e8eee9;
	--cibio-muted: #a3b3a9;
	--cibio-primary: #8fc7a4;
	--cibio-accent: #6fbf92;
	--cibio-border: #2a3a31;
	--cibio-logo-leaf1: rgba(255, 255, 255, .5);
	--cibio-logo-leaf2: rgba(255, 255, 255, .78);
	--cibio-logo-leaf3: #ffffff;
	--cibio-logo-word: #ffffff;
}

/* Keep custom CSS minimal; prefer theme.json and block settings. */
a { text-underline-offset: 0.2em; }
:focus-visible { outline: 3px solid var(--wp--preset--color--accent); outline-offset: 2px; }
img { height: auto; }

/* Cards and grids ------------------------------------------------ */
.cibio-link-all { font-weight: 600; text-decoration: none; }

/* Hero ------------------------------------------------------------ */
.cibio-hero { background-image: linear-gradient(135deg, #0f2419 0%, #25513b 55%, #4f8a6b 100%); }
.cibio-hero, .cibio-hero h1, .cibio-hero p { color: #fff; }

/* Sliding words: one word visible at a time, pure CSS (6 items; the first is repeated for a seamless loop). */
.cibio-rotator { display: inline-block; height: 1.25em; overflow: hidden; vertical-align: bottom; }
.cibio-rotator__list { display: flex; flex-direction: column; animation: cibio-slide 21s infinite; }
.cibio-rotator__list span { display: block; height: 1.25em; line-height: 1.25; white-space: nowrap; color: #b4dcc2; }
@keyframes cibio-slide {
	0%, 12%   { transform: translateY(0); }
	14.5%, 26.5% { transform: translateY(-1.25em); }
	29%, 41%  { transform: translateY(-2.5em); }
	43.5%, 55.5% { transform: translateY(-3.75em); }
	58%, 70%  { transform: translateY(-5em); }
	72.5%, 84.5% { transform: translateY(-6.25em); }
	87%, 100% { transform: translateY(-7.5em); }
}
/* A long word keeps the line height of the others; on phones its text is a little smaller to fit on one line. */
.cibio-rotator__list span.is-long b { font-weight: inherit; }
@media (max-width: 600px) { .cibio-rotator__list span.is-long b { font-size: .62em; } }

@media (prefers-reduced-motion: reduce) {
	.cibio-rotator__list { animation: none; }
}
.screen-reader-text-static { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Header tools: search + theme toggle ------------------------------ */
.cibio-theme-toggle { background: none; border: 1px solid var(--wp--preset--color--border); color: var(--wp--preset--color--contrast); border-radius: 999px; width: 2.5rem; height: 2.5rem; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.cibio-theme-toggle:hover { border-color: var(--wp--preset--color--accent); }
.cibio-theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .cibio-theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .cibio-theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .cibio-theme-toggle .icon-sun { display: none; }
	:root:not([data-theme="light"]) .cibio-theme-toggle .icon-moon { display: block; }
}

/* Header search: icon button that matches the theme toggle */
.cibio-header .wp-block-search__button { background: transparent; color: var(--wp--preset--color--contrast); border: 1px solid var(--wp--preset--color--border); border-radius: 999px; width: 2.5rem; height: 2.5rem; min-width: 2.5rem; padding: 0; margin: 0; display: inline-flex; align-items: center; justify-content: center; }
.cibio-header .wp-block-search__button:hover { border-color: var(--wp--preset--color--accent); background: transparent; color: var(--wp--preset--color--contrast); }
.cibio-header .wp-block-search__button svg { fill: currentColor; }
.cibio-header .wp-block-search__inside-wrapper { border: 0; padding: 0; }

/* Hero text lines up with the site content width */
.cibio-hero.cibio-hero > .wp-block-cover__inner-container { width: 1200px !important; max-width: 100% !important; margin-left: auto !important; margin-right: auto !important; padding-inline: 0; box-sizing: border-box; }
.cibio-link-all { display: inline-block; margin-top: .5rem; }
.wp-block-post-featured-image img { border-radius: 10px; }
.cibio-header { border-bottom-color: var(--wp--preset--color--border); }

/* Schematic map */
.cibio-map { margin: 1.5rem 0 0; }
.cibio-map__svg { width: 100%; height: auto; display: block; }
.cibio-map .ocean { fill: var(--wp--preset--color--surface); }
.cibio-map .grid { stroke: var(--wp--preset--color--border); stroke-width: 1; stroke-dasharray: 2 7; }
.cibio-map .land { fill: var(--wp--preset--color--border); stroke: var(--wp--preset--color--muted); stroke-width: 1; stroke-opacity: .35; stroke-linejoin: round; }
.cibio-map path.site { stroke: var(--wp--preset--color--accent); stroke-width: 1; stroke-linejoin: round; }
.cibio-map .site { fill: var(--wp--preset--color--accent); }
.cibio-map .link { display: none; fill: none; stroke: var(--wp--preset--color--accent); stroke-width: 2; stroke-dasharray: 6 9; opacity: .55; }
.cibio-map .ring { fill: none; stroke: var(--wp--preset--color--accent); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: cibio-pulse 3.2s ease-out infinite; }
.cibio-map .label { fill: var(--wp--preset--color--contrast); font: 700 23px var(--wp--preset--font-family--heading); }
.cibio-map .sub { fill: var(--wp--preset--color--muted); font: 500 15px var(--wp--preset--font-family--body); }
.cibio-map .isle { fill: var(--wp--preset--color--muted); font: 500 14px var(--wp--preset--font-family--body); }
.cibio-map .region { fill: var(--wp--preset--color--muted); font: 600 13px var(--wp--preset--font-family--body); letter-spacing: .28em; text-transform: uppercase; opacity: .6; }
.cibio-map .compass { fill: var(--wp--preset--color--muted); opacity: .7; }
@keyframes cibio-pulse { 0% { transform: scale(.55); opacity: .9; } 100% { transform: scale(1.7); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cibio-map .ring { animation: none; opacity: .35; } }

/* Hub pages (Research, Training): heading and its text sit together */
.wp-block-post-content > h3 { margin-block-end: 0; }
.wp-block-post-content > h3 + p { margin-block-start: .3rem; }
.wp-block-post-content > h3 a { text-decoration: none; }
.wp-block-post-content > h3 a:hover { text-decoration: underline; }

/* Phone: bigger map labels so they stay readable when the map shrinks */
@media (max-width: 640px) {
	.cibio-map .label { font-size: 30px; }
	.cibio-map .isle { font-size: 19px; }
	.cibio-map .sub { font-size: 19px; }
	.cibio-map .region { font-size: 15px; letter-spacing: .1em; }
}

/* Header logo (on a light pill in dark mode, since the wordmark is black) */
.cibio-logo { display: inline-flex; align-items: center; text-decoration: none; }
.cibio-logo img { display: block; height: 46px; width: auto; }
.cibio-logo--text { font-weight: 700; color: var(--wp--preset--color--primary); }
/* Inline SVG logo: sharp at any size; colours follow the mode (no white pill needed in dark mode). */
.cibio-logo--svg svg { display: block; height: 46px; width: auto; }
.cibio-logo__leaf1 { fill: var(--cibio-logo-leaf1); }
.cibio-logo__leaf2 { fill: var(--cibio-logo-leaf2); }
.cibio-logo__leaf3 { fill: var(--cibio-logo-leaf3); }
.cibio-logo__word { fill: var(--cibio-logo-word); }
:root[data-theme="dark"] .cibio-logo img { background: #fff; padding: 4px 12px; border-radius: 10px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cibio-logo img { background: #fff; padding: 4px 12px; border-radius: 10px; } }

/* Footer */
.cibio-footer-top { gap: 1rem 2rem; }
.cibio-footer-top > p { margin: 0; flex: 1 1 320px; max-width: 760px; }
.cibio-social { display: flex; gap: .6rem; align-items: center; }
.cibio-social__link { display: inline-flex; width: 30px; height: 30px; color: var(--wp--preset--color--muted); transition: color .15s; }
.cibio-social__link svg { width: 100%; height: 100%; }
.cibio-social__link:hover, .cibio-social__link:focus-visible { color: var(--wp--preset--color--accent); }
/* Footer: logo and name; then logo groups side by side (host institution, member of, co-financed by, follow us).
   Logos are monochrome with no white box: in light mode white melts into the background (multiply) and the
   colours come back on hover; in dark mode they are inverted to white (the white background turns black and
   disappears with "screen"). */
.cibio-footer-top { gap: .75rem 1.25rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--wp--preset--color--border); }
.cibio-footer-top .cibio-logo--svg svg, .cibio-footer-top .cibio-logo img { height: 40px; }
.cibio-footer-name { margin: 0; max-width: 34rem; color: var(--wp--preset--color--muted); line-height: 1.4; }
.cibio-footer-row { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1.75rem 3rem; margin-top: 1.75rem !important; }
.cibio-logos { display: flex; flex-wrap: wrap; gap: 1.75rem 3rem; margin: 0; }
.cibio-logos__group { margin: 0 !important; }
.cibio-logos__caption { margin: 0 0 .8rem !important; font-size: .78rem; font-weight: 600; letter-spacing: .02em; color: var(--wp--preset--color--contrast); }
.cibio-logos__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; gap: .9rem 1.6rem; }
.cibio-logos__list li { margin: 0; }
.cibio-logos__list a { display: block; }
.cibio-logos__list img { display: block; height: 38px; width: auto; max-width: 150px; object-fit: contain; filter: grayscale(1) contrast(1.15); mix-blend-mode: multiply; opacity: .85; transition: filter .25s ease, opacity .25s ease; }
.cibio-logos__list img.is-tall { height: 52px; }
.cibio-logos__list a:hover img, .cibio-logos__list a:focus-visible img { filter: none; opacity: 1; }
:root[data-theme="dark"] .cibio-logos__list img, :root[data-theme="dark"] .cibio-logos__list a:hover img { filter: grayscale(1) invert(1) contrast(1.1); mix-blend-mode: screen; opacity: .9; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cibio-logos__list img, :root:not([data-theme="light"]) .cibio-logos__list a:hover img { filter: grayscale(1) invert(1) contrast(1.1); mix-blend-mode: screen; opacity: .9; } }
.cibio-follow .cibio-social { gap: .7rem; }
.cibio-footer-bottom { margin-top: 1.75rem !important; padding-top: 1rem; border-top: 1px solid var(--wp--preset--color--border); }
.cibio-footer-bottom p { margin: 0; }
.cibio-footer-links a { color: var(--wp--preset--color--muted); text-decoration: none; }
.cibio-footer-links a:hover { color: var(--wp--preset--color--accent); text-decoration: underline; }
@media (max-width: 640px) { .cibio-footer-row, .cibio-logos { gap: 1.5rem 2rem; } .cibio-logos__list { gap: .8rem 1.2rem; } .cibio-logos__list img { height: 32px; max-width: 120px; } .cibio-logos__list img.is-tall { height: 44px; } }
/* Cookie notice: small card bottom-left, never covers the page */
.cibio-cookie { position: fixed; z-index: 50; left: 1rem; bottom: 1rem; max-width: 26rem; display: flex; align-items: center; gap: 1rem; padding: .8rem 1rem; background: var(--wp--preset--color--base); color: var(--wp--preset--color--contrast); border: 1px solid var(--wp--preset--color--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0, 0, 0, .14); font-size: .82rem; line-height: 1.45; }
.cibio-cookie[hidden] { display: none; }
.cibio-cookie p { margin: 0; }
.cibio-cookie a { color: var(--wp--preset--color--accent); }
.cibio-cookie__ok { flex: none; border: 0; border-radius: 999px; padding: .45rem 1rem; background: var(--wp--preset--color--accent); color: var(--wp--preset--color--base); font: inherit; font-weight: 600; cursor: pointer; }
.cibio-cookie__ok:focus-visible { outline: 3px solid var(--wp--preset--color--contrast); outline-offset: 2px; }
@media (max-width: 520px) { .cibio-cookie { left: .75rem; right: .75rem; bottom: .75rem; max-width: none; } }
/* Intro paragraph on listing pages (research facilities, documentaries) */
.cibio-lead { font-size: clamp(1.05rem, 1rem + .3vw, 1.2rem); color: var(--wp--preset--color--muted); line-height: 1.6; margin: .25rem 0 2rem; }
.cibio-lead:has(+ .cibio-lead-note) { margin-bottom: .75rem; }
.cibio-lead-note { margin: 0 0 2rem; font-size: var(--wp--preset--font-size--small); font-weight: 600; color: var(--wp--preset--color--accent); }

/* Home news carousel: one slide at a time, photo beside the text */
.cibio-home-split { align-items: flex-start; }
.cibio-carousel { position: relative; }
.cibio-carousel > .wp-block-post-template { display: flex !important; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 0; margin: 0; padding: 0; list-style: none; }
.cibio-carousel > .wp-block-post-template::-webkit-scrollbar { display: none; }
.cibio-carousel > .wp-block-post-template > li { flex: 0 0 100%; scroll-snap-align: start; margin: 0; }
.cibio-slide { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1.75rem; align-items: center; margin: 0; }
.cibio-slide__img { position: relative; margin: 0; aspect-ratio: 4 / 3; overflow: hidden; border-radius: 12px; background: var(--wp--preset--color--surface); }
.cibio-slide__img a { display: block; height: 100%; }
.cibio-slide__img img { position: relative; z-index: 1; display: block; width: 100% !important; height: 100% !important; aspect-ratio: auto !important; object-fit: cover; border-radius: 0 !important; transition: transform .6s ease; }
/* Posters and small photos: shown whole over a blurred copy of themselves (set by assets/theme.js) */
.cibio-slide__img.is-fit img { object-fit: contain !important; }
.cibio-slide__img.is-fit::before { content: ""; position: absolute; inset: -30px; background: var(--cibio-bg) center / cover no-repeat; filter: blur(24px); opacity: .5; }
.cibio-slide:hover .cibio-slide__img:not(.is-fit) img { transform: scale(1.03); }
.cibio-slide__text { display: flex; flex-direction: column; gap: .6rem; }
.cibio-slide__text > * { margin: 0 !important; }
.cibio-kicker { color: var(--wp--preset--color--accent); font-size: var(--wp--preset--font-size--small); font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.cibio-slide .wp-block-post-title { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.75rem) !important; line-height: 1.25; }
.cibio-slide .wp-block-post-title a, .cibio-pub-list .wp-block-post-title a { color: var(--wp--preset--color--contrast); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cibio-slide .wp-block-post-title a:hover, .cibio-pub-list .wp-block-post-title a:hover { color: var(--wp--preset--color--accent); }
.cibio-slide .wp-block-post-excerpt__excerpt { margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.cibio-carousel-nav { display: flex; align-items: center; justify-content: flex-start; gap: .5rem; margin-top: 1rem; }
.cibio-carousel-nav button { border: 0; padding: 0; width: .55rem; height: .55rem; border-radius: 999px; background: var(--wp--preset--color--border); cursor: pointer; transition: width .3s ease, background .3s ease; }
.cibio-carousel-nav button[aria-current="true"] { width: 1.6rem; background: var(--wp--preset--color--accent); }
.cibio-carousel-nav .cibio-arrow { width: 2rem; height: 2rem; background: none; border: 1px solid var(--wp--preset--color--border); color: var(--wp--preset--color--contrast); border-radius: 999px; font-size: 1rem; line-height: 1; }
.cibio-carousel-nav .cibio-arrow:hover { border-color: var(--wp--preset--color--accent); }
@media (max-width: 781px) { .cibio-slide { grid-template-columns: 1fr; gap: 1rem; } .cibio-slide__img { aspect-ratio: 16 / 9; } }
@media (prefers-reduced-motion: reduce) { .cibio-slide__img img, .cibio-carousel-nav button { transition: none; } .cibio-slide:hover .cibio-slide__img img { transform: none; } }
/* Publications: three newest; title, then journal · date; a thin line on the left turns green on hover */
.cibio-pub-list > .wp-block-post-template { display: flex; flex-direction: column; gap: 1.25rem; margin: 0; padding: 0; list-style: none; }
.cibio-pub-list .wp-block-post-template > li { margin: 0; padding: .15rem 0 .15rem 1rem; border-left: 2px solid var(--wp--preset--color--border); transition: border-color .2s ease; }
.cibio-pub-list .wp-block-post-template > li:hover, .cibio-pub-list .wp-block-post-template > li:focus-within { border-left-color: var(--wp--preset--color--accent); }
.cibio-pub-list .wp-block-post-title { margin: 0; font-weight: 600; line-height: 1.35; }
.cibio-pub-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; margin-top: .4rem; font-size: var(--wp--preset--font-size--small); line-height: 1.4; }
.cibio-pub-meta > p { margin: 0; }
.cibio-pub-meta > p:empty { display: none; }
.cibio-pub-journal { font-style: italic; color: var(--wp--preset--color--contrast); }
.cibio-pub-date { color: var(--wp--preset--color--muted); white-space: nowrap; }
.cibio-pub-journal:not(:empty) + .cibio-pub-date::before { content: "·"; margin-right: .5rem; }
/* Header tools aligned on one line */
.cibio-header .wp-block-search { margin: 0; display: flex; align-items: center; }
.cibio-header .wp-block-search__inside-wrapper { align-items: center; }
.cibio-header .wp-block-search__button { margin: 0; padding: 0; display: inline-flex; align-items: center; justify-content: center; height: 2.5rem; width: 2.5rem; }
.cibio-header .cibio-theme-toggle { margin: 0; }

/* Home: the hero starts right under the header (no blank strip) */
body.home .wp-site-blocks > main { margin-block-start: 0; }

/* Phone header: logo left; search, language, light/dark and the menu button on the right ---- */
@media (max-width: 599px) {
	.cibio-header .wp-block-navigation__responsive-container-open {
		display: inline-flex; align-items: center; justify-content: center;
		border: 1px solid var(--wp--preset--color--border); border-radius: 999px; color: var(--wp--preset--color--contrast);
	}
	.cibio-header .wp-block-navigation { order: 9; }
	.cibio-header .alignwide > .wp-block-group { gap: .4rem; flex-wrap: nowrap; }
	.cibio-header .cibio-theme-toggle,
	.cibio-header .wp-block-search__button,
	.cibio-header .cibio-lang-switch,
	.cibio-header .wp-block-navigation__responsive-container-open { width: 2.25rem; height: 2.25rem; }
	.cibio-header .cibio-logo img, .cibio-header .cibio-logo--svg svg { max-height: 34px; width: auto; }
}

/* Phone menu (opened with the menu button): full screen, left aligned, sections with their pages ---- */
.cibio-header .wp-block-navigation__responsive-container.is-menu-open {
	background-color: var(--wp--preset--color--base) !important;
	color: var(--wp--preset--color--contrast) !important;
	padding: 1rem 1.5rem 2rem !important;
}
.cibio-header .is-menu-open .wp-block-navigation__responsive-container-close {
	top: 1rem; right: 1rem; width: 2.5rem; height: 2.5rem; display: inline-flex; align-items: center; justify-content: center;
	border: 1px solid var(--wp--preset--color--border); border-radius: 999px; color: var(--wp--preset--color--contrast);
}
.cibio-header .is-menu-open .wp-block-navigation__responsive-container-content {
	padding-top: 4rem !important; align-items: stretch !important;
}
.cibio-header .is-menu-open .wp-block-navigation__container {
	width: 100%; align-items: stretch !important; justify-content: flex-start !important; gap: 0 !important;
}
.cibio-header .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item {
	width: 100%; align-items: flex-start !important; text-align: left;
	padding: .8rem 0; border-bottom: 1px solid var(--wp--preset--color--border);
}
.cibio-header .is-menu-open .wp-block-navigation__container > .wp-block-navigation-item > .wp-block-navigation-item__content {
	font-size: 1.25rem; font-weight: 600; padding: 0 !important;
}
.cibio-header .is-menu-open .wp-block-navigation__submenu-container {
	width: 100%; align-items: flex-start !important; gap: 0 !important;
	margin-top: .35rem !important; padding: 0 0 0 1rem !important;
	border-left: 2px solid var(--wp--preset--color--accent) !important;
}
.cibio-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item__content {
	font-size: 1.05rem; font-weight: 400; padding: .4rem 0 !important; color: var(--wp--preset--color--contrast);
}
/* A page with its own sub-pages inside a section (Training > Advanced training > AZSS): left aligned, lighter line. */
.cibio-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation-item {
	width: 100%; align-items: flex-start !important; text-align: left;
}
.cibio-header .is-menu-open .wp-block-navigation__submenu-container .wp-block-navigation__submenu-container {
	margin-top: 0 !important; border-left: 1px solid var(--wp--preset--color--border) !important;
}
.cibio-header .is-menu-open .wp-block-navigation-item__content:hover { color: var(--wp--preset--color--accent); }
/* "Research" only groups its pages: not a link. */
.cibio-header .wp-block-navigation a.wp-block-navigation-item__content[href="#"] { cursor: default; }
.cibio-header .is-menu-open a.wp-block-navigation-item__content[href="#"] { pointer-events: none; }

/* Sticky header: stays at the top while scrolling (below the WordPress admin bar when logged in).
   When the page is scrolled (html.cibio-scrolled, set by theme.js) it gets a soft shadow; its size never changes. */
.wp-site-blocks > header.wp-block-template-part { position: sticky; top: var(--wp-admin--admin-bar--height, 0px); z-index: 100; }
.cibio-header { transition: padding .25s ease, box-shadow .25s ease; }
.cibio-scrolled .cibio-header { box-shadow: 0 4px 18px rgba(0, 0, 0, .12); } /* Same size while scrolling (no shrinking). */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]).cibio-scrolled .cibio-header { box-shadow: 0 4px 18px rgba(0, 0, 0, .45); } }
:root[data-theme="dark"].cibio-scrolled .cibio-header { box-shadow: 0 4px 18px rgba(0, 0, 0, .45); }
/* On phones the admin bar scrolls away, so the header sticks to the very top. */
@media (max-width: 600px) { .wp-site-blocks > header.wp-block-template-part { top: 0; } }
/* Jumping to #anchors leaves room for the header. */
html { scroll-padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + 90px); }

/* Hero parallax: the photo moves slower than the page and the text drifts up and fades (theme.js).
   The photo is a bit taller than the hero so no gap shows while it moves. Off for reduced motion. */
.cibio-hero { overflow: hidden; }
.cibio-parallax .cibio-hero > .wp-block-cover__image-background { top: -12%; height: 124%; will-change: transform; }
.cibio-parallax .cibio-hero > .wp-block-cover__inner-container { will-change: transform, opacity; }
@media (prefers-reduced-motion: reduce) {
	.cibio-header { transition: none; }
	.cibio-parallax .cibio-hero > .wp-block-cover__image-background { top: 0; height: 100%; transform: none !important; }
	.cibio-parallax .cibio-hero > .wp-block-cover__inner-container { transform: none !important; opacity: 1 !important; }
}

/* Map v3: one scale for every frame; Spain faint for context, Madeira inset, CIBIO main campus (Vairão) house sign */
.cibio-map .land--other { opacity: .3; stroke: none; }
.cibio-map .inset { fill: var(--wp--preset--color--surface); stroke: var(--wp--preset--color--border); stroke-width: 1.5; stroke-dasharray: 5 5; fill: none; }
.cibio-map .hq path { fill: var(--wp--preset--color--contrast); stroke: var(--wp--preset--color--surface); stroke-width: 2; stroke-linejoin: round; paint-order: stroke; }
.cibio-map .label--hq { font-size: 17px; }
.cibio-map .hq .pin-dot { fill: var(--wp--preset--color--surface); }
.cibio-map rect.inset--fill { fill: var(--wp--preset--color--surface); }
.cibio-map .land--focus { fill: var(--wp--preset--color--accent); fill-opacity: .55; }
.cibio-map .twin path { fill: var(--wp--preset--color--accent); stroke: var(--wp--preset--color--surface); stroke-width: 2; stroke-linejoin: round; paint-order: stroke; }
.cibio-map .twin .pin-dot { fill: var(--wp--preset--color--surface); }
.cibio-map .leader { fill: none; stroke: var(--wp--preset--color--muted); stroke-width: 1; opacity: .6; }
.cibio-map .halo { paint-order: stroke; stroke: var(--wp--preset--color--surface); stroke-width: 4px; stroke-linejoin: round; }
@media (max-width: 640px) { .cibio-map text.label--hq { font-size: 24px; } .cibio-map .halo { stroke-width: 6px; } }
.cibio-map .scale { fill: none; stroke: var(--wp--preset--color--muted); stroke-width: 2; }

/* Top bar (inspired by ciimar.up.pt): dark bar in both modes, white logo and menu, a visible search box,
   "EN PT" and the light/dark toggle. The phone menu (full screen) keeps the page colours. */
/* Bar colour: a dark shade of the map's island green (#3d7a5a), fixed in both modes; white text on it is 9:1. */
:root { --cibio-bar-bg: #24493a; --cibio-bar-text: #ffffff; --cibio-bar-muted: rgba(255, 255, 255, .8); --cibio-bar-line: rgba(255, 255, 255, .35); --cibio-bar-field: #eef3f0; }
.cibio-header.cibio-header { background-color: var(--cibio-bar-bg) !important; border-bottom-color: transparent !important; color: var(--cibio-bar-text);
	--cibio-logo-leaf1: rgba(255, 255, 255, .5); --cibio-logo-leaf2: rgba(255, 255, 255, .78); --cibio-logo-leaf3: #ffffff; --cibio-logo-word: #ffffff; }
.cibio-header .wp-block-navigation { color: var(--cibio-bar-text); font-size: .95rem; font-weight: 600; gap: 1.6rem; }
.cibio-header .wp-block-navigation .wp-block-navigation-item__content:hover { color: #ffffff; text-decoration: underline; text-underline-offset: .35em; }
/* Desktop dropdowns: dark too */
.cibio-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container {
	background-color: var(--cibio-bar-bg) !important; color: var(--cibio-bar-text) !important; border: 1px solid var(--cibio-bar-line) !important;
	border-radius: 0 0 8px 8px; padding: .35rem 0; font-weight: 500;
}
.cibio-header .wp-block-navigation__responsive-container:not(.is-menu-open) .wp-block-navigation__submenu-container .wp-block-navigation-item__content { padding: .5rem 1.1rem; }
/* Phone menu panel keeps the normal page colours */
.cibio-header .wp-block-navigation__responsive-container.is-menu-open { color: var(--wp--preset--color--contrast) !important; }
/* Round buttons (light/dark, phone menu) become light outlines */
.cibio-header .cibio-theme-toggle,
.cibio-header .wp-block-navigation__responsive-container-open { color: var(--cibio-bar-text); border-color: var(--cibio-bar-line); }
.cibio-header .cibio-theme-toggle:hover { border-color: #ffffff; }
/* Search box: a light pill with the icon inside */
.cibio-header .cibio-bar-search .wp-block-search__inside-wrapper { background: var(--cibio-bar-field); border: 0; border-radius: 999px; padding: 0 .25rem 0 .9rem; width: 12rem; height: 2.3rem; box-sizing: border-box; }
.cibio-header .cibio-bar-search .wp-block-search__input { background: transparent; border: 0; padding: 0; color: #18231e; font-size: .9rem; min-width: 0; height: 100%; }
.cibio-header .cibio-bar-search .wp-block-search__input::placeholder { color: #66736c; opacity: 1; }
.cibio-header .cibio-bar-search .wp-block-search__input:focus { outline: none; }
.cibio-header .cibio-bar-search .wp-block-search__inside-wrapper:focus-within { outline: 3px solid #ffffff; outline-offset: 2px; }
.cibio-header .cibio-bar-search .wp-block-search__button { border: 0; width: 1.9rem; min-width: 1.9rem; height: 1.9rem; color: #18231e; background: transparent; }
.cibio-header .cibio-bar-search .wp-block-search__button:hover { color: var(--wp--preset--color--primary); border: 0; }
/* EN PT */
.cibio-header .cibio-lang-switch { color: var(--cibio-bar-text); }
.cibio-header .cibio-lang-switch__item { opacity: .75; }
.cibio-header .cibio-lang-switch__item[aria-current], .cibio-header .cibio-lang-switch__item:hover { opacity: 1; }
.cibio-header .cibio-lang-switch__item[aria-current] { text-decoration: underline; text-underline-offset: .35em; }
/* Desktop (1180px and up): one line in both languages (Portuguese labels are longer). */
.cibio-header .alignwide, .cibio-header .alignwide > .wp-block-group { flex-wrap: nowrap; }
.cibio-header .alignwide > .wp-block-group { gap: 1rem; }
.cibio-header .wp-block-navigation { gap: 1.1rem; font-size: .9rem; }
.cibio-header .wp-block-navigation__container { flex-wrap: nowrap; white-space: nowrap; }
.cibio-header .cibio-bar-search .wp-block-search__inside-wrapper { width: 10rem; }
@media (max-width: 1320px) { .cibio-header .wp-block-navigation { gap: .85rem; font-size: .86rem; } .cibio-header .alignwide > .wp-block-group { gap: .75rem; } .cibio-header .cibio-bar-search .wp-block-search__inside-wrapper { width: 8.5rem; } }
/* EN PT and light/dark inside the collapsed menu (copied there by theme.js); hidden everywhere else. */
.cibio-menu-extras { display: none; }
.cibio-header .is-menu-open .cibio-menu-extras { display: flex; order: -1; align-items: center; gap: 1rem; margin: 0 0 .5rem; padding-bottom: 1rem; border-bottom: 1px solid var(--wp--preset--color--border); width: 100%; }
.cibio-header .is-menu-open .cibio-menu-extras .cibio-lang-switch { color: var(--wp--preset--color--contrast); width: auto; height: auto; margin: 0; }
.cibio-header .is-menu-open .cibio-menu-extras .cibio-lang-switch__item { font-size: 1rem; padding: .35rem .5rem; }
.cibio-header .is-menu-open .cibio-menu-extras .cibio-theme-toggle { color: var(--wp--preset--color--contrast); border-color: var(--wp--preset--color--border); }
/* Below 1180px the menu collapses into the menu button (the full-screen menu), and the bar keeps the logo,
   a real search box (it takes the free space) and the menu button. */
@media (max-width: 1179px) {
	.cibio-header .wp-block-navigation__responsive-container-open:not(.always-shown) {
		display: inline-flex; align-items: center; justify-content: center; width: 2.25rem; height: 2.25rem;
		border: 1px solid var(--cibio-bar-line); border-radius: 999px; color: var(--cibio-bar-text);
	}
	.cibio-header .wp-block-navigation__responsive-container:not(.hidden-by-default):not(.is-menu-open) { display: none; }
	.cibio-header .wp-block-navigation { order: 9; }
	.cibio-header .alignwide > .wp-block-group { flex: 1; min-width: 0; justify-content: flex-end; gap: .5rem; }
	.cibio-header .alignwide > .wp-block-group > .cibio-lang-switch,
	.cibio-header .alignwide > .wp-block-group > .cibio-theme-toggle { display: none; }
	.cibio-header .cibio-bar-search { flex: 1; min-width: 0; max-width: 18rem; }
	.cibio-header .cibio-bar-search .wp-block-search__inside-wrapper { width: 100%; height: 2.25rem; }
	.cibio-header .cibio-bar-search .wp-block-search__button { width: 1.8rem; min-width: 1.8rem; height: 1.8rem; }
}
.cibio-back { margin: 0 0 .5rem; font-size: var(--wp--preset--font-size--small); }
.cibio-back a { color: var(--wp--preset--color--muted); text-decoration: none; }
.cibio-back a:hover { color: var(--wp--preset--color--accent); }

/* Home banner: the photos cross-fade one after another, 7 s each. Timing and keyframes come from functions.php
   (they depend on the number of photos). Each photo's credit shows in the corner while it is visible; the dots
   at the bottom show how many photos there are and which one is showing. */
.cibio-hero > .cibio-hero__slide, .cibio-hero > .cibio-hero__credit, .cibio-hero__dot > i {
	animation-timing-function: ease-in-out; animation-iteration-count: infinite; animation-fill-mode: backwards;
}
.cibio-hero > .cibio-hero__slide { opacity: 0; }
.cibio-hero > .cibio-hero__credit {
	position: absolute; right: 1rem; bottom: .7rem; z-index: 2; max-width: calc(100% - 2rem);
	font-size: .72rem; line-height: 1.3; color: rgba(255, 255, 255, .82) !important; text-decoration: none; text-align: right; opacity: 0;
}
.cibio-hero > .cibio-hero__credit.is-base { opacity: 1; }
a.cibio-hero__credit:hover, a.cibio-hero__credit:focus { text-decoration: underline !important; }
.cibio-hero__dots { position: absolute; left: 50%; bottom: .85rem; z-index: 3; transform: translateX(-50%); display: flex; gap: .15rem; }
.cibio-hero__dot { position: relative; width: 24px; height: 24px; padding: 0; border: 0; background: none; cursor: pointer; }
.cibio-hero__dot::before { content: ""; position: absolute; left: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: rgba(255, 255, 255, .38); transition: background .2s; }
.cibio-hero__dot:hover::before, .cibio-hero__dot:focus-visible::before { background: rgba(255, 255, 255, .75); }
.cibio-hero__dot:focus-visible { outline: 2px solid #fff; outline-offset: -2px; border-radius: 50%; }
.cibio-hero__dot > i { position: absolute; left: 8px; top: 8px; width: 8px; height: 8px; border-radius: 50%; background: #fff; opacity: 0; pointer-events: none; }
.cibio-hero__dot:first-child > i { opacity: 1; }
@media (prefers-reduced-motion: reduce) {
	.cibio-hero > .cibio-hero__slide, .cibio-hero > a.cibio-hero__credit, .cibio-hero__dot > i { animation: none !important; opacity: 0; }
	.cibio-hero > .cibio-hero__credit.is-base, .cibio-hero__dot:first-child > i { animation: none !important; opacity: 1; }
}
@media (max-width: 600px) {
	.cibio-hero > .cibio-hero__credit { font-size: .65rem; right: .75rem; bottom: .5rem; }
	.cibio-hero__dots { bottom: 3.3rem; }
}
