/*
Theme Name: WOW-BE
Theme URI: https://wow.meteo.be/
Author: KMI – Koninklijk Meteorologisch Instituut van België
Author URI: https://www.meteo.be/
Description: Minimal block theme for WOW-BE, the weather observation platform of the Royal Meteorological Institute of Belgium. Polylang-ready (per-language menu, logo, login link and language switcher).
Version: 1.0.11
Requires at least: 6.6
Tested up to: 7.1
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wowbe
Domain Path: /languages
*/

/* Colours, font and heading sizes live in theme.json; this file holds what
   theme.json cannot express. */

:root {
	--wowbe-header-h: 79px;
}

/* No gap between header and main (margins are set per template below). */
body .wp-site-blocks > * + * {
	margin-block-start: 0;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
}

/* ── Header bar: logo | menu | languages + institute ───────── */

.wowbe-site-header {
	position: relative;
	z-index: 100;
	background: var(--wp--preset--color--primary);
}

.wowbe-site-header .wowbe-header {
	display: flex;
	flex-wrap: nowrap;
	align-items: stretch;
	gap: 0;
	height: var(--wowbe-header-h);
}

.wowbe-logo {
	flex: 0 0 auto;
}

.wowbe-logo a,
.wowbe-logo img {
	display: block;
}

.wowbe-logo img {
	height: var(--wowbe-header-h);
	width: auto;
}

/* Menu */

.wowbe-site-header .wowbe-menu {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
}

.wowbe-menu__list {
	display: flex;
	margin: 0;
	padding: 0 0 0 10px;
	list-style: none;
}

.wowbe-menu__list li {
	position: relative;
	display: flex;
}

.wowbe-menu__list a {
	display: flex;
	align-items: center;
	padding: 0 20px;
	color: #ffffff;
	font-size: 16px;
	text-decoration: none;
	white-space: nowrap;
	transition: background 0.15s;
}

.wowbe-menu__list a:hover,
.wowbe-menu__list a:focus-visible,
.wowbe-menu__list .current-menu-item > a,
.wowbe-menu__list .current_page_item > a,
.wowbe-menu__list .current-menu-ancestor > a,
.wowbe-menu__list .current-page-ancestor > a {
	background: var(--wp--preset--color--primary-dark);
	color: #ffffff;
}

.wowbe-menu__list .current-menu-item > a,
.wowbe-menu__list .current_page_item > a,
.wowbe-menu__list .current-menu-ancestor > a,
.wowbe-menu__list .current-page-ancestor > a {
	font-weight: 700;
}

.wowbe-menu__list a:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: -4px;
}

.wowbe-login-icon {
	width: 1em;
	height: 1em;
	margin-right: 6px;
	fill: currentColor;
}

/* Dropdown */

.wowbe-menu__list ul {
	display: none;
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1000;
	min-width: 180px;
	margin: 0;
	padding: 0;
	list-style: none;
	background: var(--wp--preset--color--primary-dark);
	box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.wowbe-menu__list li:hover > ul,
.wowbe-menu__list li:focus-within > ul {
	display: block;
}

.wowbe-menu__list ul li {
	display: block;
}

.wowbe-menu__list ul a {
	display: block;
	padding: 10px 16px;
	font-size: 14px;
	border-top: 1px solid rgba(255, 255, 255, 0.15);
}

.wowbe-menu__list ul a:hover {
	background: #0a5f90;
}

/* Hamburger and submenu carets (mobile only) */

.wowbe-menu__toggle,
.wowbe-submenu-toggle {
	display: none;
	align-items: center;
	justify-content: center;
	padding: 0;
	background: transparent;
	border: 0;
	cursor: pointer;
}

.wowbe-menu__toggle {
	flex-direction: column;
	gap: 4px;
	width: 48px;
	height: var(--wowbe-header-h);
}

.wowbe-menu__bar {
	display: block;
	width: 22px;
	height: 2px;
	background: #ffffff;
}

.wowbe-submenu-toggle {
	position: absolute;
	top: 0;
	right: 0;
	width: 48px;
	height: 48px;
}

.wowbe-submenu-toggle::before {
	content: "";
	width: 8px;
	height: 8px;
	border-right: 2px solid #ffffff;
	border-bottom: 2px solid #ffffff;
	transform: rotate(45deg);
	transition: transform 0.15s;
}

.wowbe-submenu-open > .wowbe-submenu-toggle::before {
	transform: rotate(-135deg);
}

/* Languages + institute logo */

.wowbe-site-header .wowbe-header__end {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 20px;
	margin: 0 0 0 auto;
	padding: 0 12px 0 16px;
}

/* Boxed NL / FR / EN buttons, as on the current WOW-BE; the active language
   is a filled white box so it stands out clearly. */
.wowbe-lang__list {
	display: flex;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.wowbe-lang__item {
	display: block;
	min-width: 2.6em;
	padding: 6px 8px;
	color: #ffffff;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	text-align: center;
	text-decoration: none;
	border: 2px solid #ffffff;
	transition: background-color 0.2s ease-out, color 0.2s ease-out;
}

a.wowbe-lang__item:hover,
a.wowbe-lang__item:focus-visible {
	color: #ffffff;
	background-color: rgba(255, 255, 255, 0.2);
}

a.wowbe-lang__item:focus-visible {
	outline: 2px solid #ffffff;
	outline-offset: 2px;
}

.wowbe-lang__item.is-current {
	color: var(--wp--preset--color--primary);
	background-color: #ffffff;
}

.wowbe-lang__item.is-disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.wowbe-institute a,
.wowbe-institute img {
	display: block;
}

.wowbe-institute img {
	height: 73px;
	width: auto;
}

/* ── Content pages: white card ─────────────────────────────── */

.wowbe-card {
	max-width: 900px;
	margin: 40px auto;
	padding: 30px 40px;
	background: var(--wp--preset--color--surface);
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 3px;
}

.wowbe-card .wp-block-post-title {
	margin: 0 0 20px;
}

.wowbe-card .wp-block-post-content h2 {
	margin-top: 25px;
}

.wowbe-card .wp-block-post-content h3,
.wowbe-card .wp-block-post-content h4 {
	margin-top: 20px;
}

/* Short bar above section headings (WOW-NL layout, WOW-BE navbar colour). */
.wowbe-card .wp-block-post-content h2::before {
	content: "";
	display: block;
	width: 60px;
	height: 3px;
	margin-bottom: 20px;
	background: var(--wp--preset--color--primary);
}

.wowbe-card .wp-block-post-content > h2:first-child {
	margin-top: 0;
}

.wowbe-card .wp-block-post-content > h2:first-child::before {
	display: none;
}

.wowbe-card .wp-block-post-content :is(ul, ol) {
	padding-left: 1.5em;
}

.wowbe-card .wp-block-group.has-background {
	display: flow-root;
}

/* ── Accordion: core Details block (no plugin, no JS) ───────── */

.wp-block-details {
	border: 1px solid var(--wp--preset--color--border);
	border-radius: 3px;
}

.wp-block-details + .wp-block-details {
	margin-block-start: 8px;
}

.wp-block-details summary {
	position: relative;
	padding: 12px 44px 12px 16px;
	color: var(--wp--preset--color--primary);
	font-weight: 700;
	line-height: 1.4;
	list-style: none;
	cursor: pointer;
}

.wp-block-details summary::-webkit-details-marker {
	display: none;
}

.wp-block-details summary::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 18px;
	width: 8px;
	height: 8px;
	margin-top: -6px;
	border-right: 2px solid currentColor;
	border-bottom: 2px solid currentColor;
	transform: rotate(45deg);
	transition: transform 0.15s ease;
}

.wp-block-details[open] summary::after {
	margin-top: -2px;
	transform: rotate(-135deg);
}

.wp-block-details summary:hover {
	background: var(--wp--preset--color--accent-light);
}

.wp-block-details summary:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: -2px;
}

.wp-block-details[open] summary {
	border-bottom: 1px solid var(--wp--preset--color--border);
}

.wp-block-details > :not(summary) {
	margin-right: 16px;
	margin-left: 16px;
}

.wp-block-details > summary + * {
	margin-block-start: 15px;
}

.wp-block-details > :last-child:not(summary) {
	margin-bottom: 15px;
}

/* ── Map (Kaart): full height below the header ─────────────── */

.wowbe-map-main,
.wowbe-map-main .wp-block-post-content {
	margin: 0;
	padding: 0;
}

.wowbe-map {
	height: calc(100dvh - var(--wowbe-header-h));
}

.admin-bar .wowbe-map {
	height: calc(100dvh - var(--wowbe-header-h) - 32px);
}

.wowbe-map iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* ── Contact Form 7 ────────────────────────────────────────── */

.wpcf7-list-item {
	display: block;
	margin: 0;
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 input[type="tel"],
.wpcf7 input[type="url"],
.wpcf7 select,
.wpcf7 textarea {
	width: 100%;
	padding: 8px 10px;
	font: inherit;
	border: 1px solid #cccccc;
	border-radius: 3px;
}

.wpcf7-submit {
	padding: 10px 20px;
	color: #ffffff;
	font: inherit;
	background: var(--wp--preset--color--primary);
	border: 0;
	border-radius: 3px;
	cursor: pointer;
}

.wpcf7-submit:hover {
	background: var(--wp--preset--color--primary-dark);
}

/* ── Responsive ────────────────────────────────────────────── */

@media (max-width: 1024px) {
	.wowbe-site-header .wowbe-menu {
		flex: 0 0 auto;
		order: 3;
	}

	.wowbe-menu__toggle {
		display: flex;
	}

	.wowbe-menu__list {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		z-index: 1000;
		flex-direction: column;
		width: 100%;
		padding: 0;
		background: var(--wp--preset--color--primary);
		box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
	}

	.wowbe-menu__list.is-open {
		display: flex;
	}

	.wowbe-menu__list li {
		display: block;
	}

	.wowbe-menu__list a {
		padding: 14px 20px;
	}

	.wowbe-menu__list .menu-item-has-children > a {
		padding-right: 56px;
	}

	.wowbe-submenu-toggle {
		display: flex;
	}

	/* Submenus open by tapping the caret instead of hovering. */
	.wowbe-menu__list ul,
	.wowbe-menu__list li:hover > ul,
	.wowbe-menu__list li:focus-within > ul {
		display: none;
		position: static;
		min-width: 0;
		box-shadow: none;
	}

	.wowbe-menu__list li.wowbe-submenu-open > ul {
		display: block;
	}

	.wowbe-menu__list ul a {
		padding-left: 36px;
	}

	.wowbe-site-header .wowbe-header__end {
		padding-right: 0;
	}
}

@media (max-width: 782px) {
	.admin-bar .wowbe-map {
		height: calc(100dvh - var(--wowbe-header-h) - 46px);
	}

	.wowbe-card {
		margin: 20px 10px;
		padding: 20px;
	}
}

@media (max-width: 600px) {
	:root {
		--wowbe-header-h: 60px;
	}

	.wowbe-site-header .wowbe-header__end {
		gap: 10px;
		padding-left: 8px;
	}

	.wowbe-lang__list {
		gap: 4px;
	}

	.wowbe-lang__item {
		min-width: 2.2em;
		padding: 5px 5px;
		font-size: 13px;
	}

	.wowbe-institute img {
		height: 54px;
	}
}
