/*
Theme Name: Existo
Theme URI: https://existo.org
Author: Wim Bommerez
Description: Block theme voor existo.org, vervangt Hemma. Gebruikt existo-blocks plugin voor split-blocks.
Version: 0.7.3
Requires at least: 6.5
Tested up to: 6.7
Requires PHP: 7.4
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: existo
*/

/* --- Hemma-compatible block CSS (overgenomen uit hemma/style.css, ingekort) --- */

.block {
	position: relative;
	overflow: hidden;
}

.block.is-halfheight { min-height: 50vh; }
.block.is-fullheight { min-height: 100vh; }

/* Featured image als hero — strekt zich uit over de volledige viewport
   (align:full in templates/*.html). Width:100% is nodig omdat een <figure>
   zonder expliciete breedte naar zijn natuurlijke content-breedte krimpt
   en dan blijft de afbeelding gewoon op z'n oorspronkelijke pixelbreedte
   staan. Hoogte vast op 50vh, object-fit: cover op de img. */
.existo-hero-image {
	width: 100%;
	height: 50vh;
}
.existo-hero-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* Split block entry-animatie: fade-in-up. Initiële state via .is-animated-init
   (door JS toegevoegd zodra IntersectionObserver beschikbaar is — zonder JS
   blijven de blocks gewoon zichtbaar, dus we hoeven geen :not()-fallback te
   tekenen). De .is-visible-class wordt door dezelfde JS toegevoegd zodra het
   block ≥10% in viewport komt. prefers-reduced-motion: animatie volledig uit. */
.block-split-composer.is-animated-init {
	opacity: 0;
	transform: translateY(24px);
	transition: opacity 0.7s ease-out, transform 0.7s ease-out;
	will-change: opacity, transform;
}
.block-split-composer.is-animated-init.is-visible {
	opacity: 1;
	transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
	.block-split-composer.is-animated-init {
		opacity: 1;
		transform: none;
		transition: none;
	}
}

/* Split block layout — spiegelt .block-split-composer uit Hemma */
/* Block werkt met align:wide (wideSize uit theme.json). De wide-cap
   en centrering komen uit core; we voegen alleen overflow + visuele
   styling (schaduw, ronde hoeken) toe. */
.block-split-composer {
	display: block;
	position: relative;
	width: 100%;
	overflow: hidden;
	border-radius: 6px;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06), 0 12px 32px rgba(0, 0, 0, 0.08);
	margin-block: 1.5rem;
}

/* Safety-net: als de layout-context niet correct doorvalt (bv. wp:post-content
   zonder constrained layout) zorg dat alignwide alsnog tot wideSize uitstrekt. */
.block-split-composer.alignwide {
	max-width: var(--wp--style--global--wide-size, 1600px);
	margin-left: auto;
	margin-right: auto;
}
.block-split-composer.alignfull {
	max-width: none;
}
.block-split-composer .block-content {
	position: relative;
	min-height: 320px;
}
/* Wanneer een hoogte (halfheight/fullheight) is ingesteld op het block, moet
   de inhoud de volledige wrapper-hoogte vullen. Anders blijft block-content
   op zijn natuurlijke (tekst-)hoogte en is de figuur ook maar zo hoog. */
.block-split-composer.is-halfheight,
.block-split-composer.is-fullheight {
	display: flex;
}
.block-split-composer.is-halfheight .block-content,
.block-split-composer.is-fullheight .block-content {
	flex: 1 0 auto;
	width: 100%;
	min-height: inherit;
	display: flex;
	align-items: stretch;
}
.block-split-composer .block-figure {
	position: absolute;
	top: 0;
	right: 0;
	width: 50%;
	height: 100%;
	background-size: cover;
	background-position: center;
	min-height: 320px;
}
.block-split-composer.block-split-img-left .block-figure {
	right: auto;
	left: 0;
}
.block-split-composer .container {
	position: relative;
	z-index: 1;
}
.block-split-composer .block-text {
	padding: 4rem 3rem;
	box-sizing: border-box;
	max-width: 100%;
	overflow-wrap: break-word;
}
.block-split-composer .column.is-6-desktop {
	box-sizing: border-box;
}

/* InnerBlocks-body binnen het split-block: WordPress past anders de globale
   contentSize (695px) toe op de paragraphs, terwijl onze tekstkolom maar de
   helft van wideSize breed is. Forceer alle directe block-children naar 100%
   van de kolom en breek lange woorden zodat tekst niet uit de container valt. */
.block-split-composer .existo-split__body {
	max-width: 100%;
	overflow-wrap: break-word;
	word-wrap: break-word;
}
.block-split-composer .existo-split__body > * {
	max-width: 100%;
	margin-left: 0;
	margin-right: 0;
}
/* Defensief: als gemigreerde inner-blocks ergens een alignwide/alignfull-class
   meekrijgen via WP-core layout-CSS, niet uit de tekstkolom laten breken. */
.block-split-composer .existo-split__body .alignwide,
.block-split-composer .existo-split__body .alignfull,
.block-split-composer .existo-split__body [class*="wp-container-"] {
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}
.block-split-composer .existo-split__body p {
	margin-block: 0.75em;
}
.block-split-composer .columns {
	display: flex;
	flex-wrap: wrap;
}
.block-split-composer .column.is-6-desktop {
	flex: 0 0 50%;
	max-width: 50%;
}
.block-split-composer.block-split-img-left .column.is-6-desktop {
	margin-left: 50%;
}

/* Tablet portrait en kleiner: split-block stacked — afbeelding bovenaan, tekst
   eronder. Breakpoint op 1024px zodat zowel iPad portrait (768px) als iPad Pro
   portrait (1024px) stacked tonen; pas vanaf landscape (>1024px) komt de
   side-by-side layout terug. .block-figure verlaat absolute positionering →
   in gewone block-flow staat ze automatisch bovenaan want in de DOM is ze de
   eerste sibling binnen .block-content. .columns krijgt flex-direction:column
   en de tekstkolom verliest haar 50%-breedte. Halfheight/fullheight zetten we
   uit zodat de pagina niet onnodig hoog wordt op tablet/mobiel. */
@media (max-width: 1024px) {
	.block-split-composer .block-figure {
		position: relative;
		width: 100%;
		height: 320px;
		min-height: 0;
	}
	.block-split-composer .columns {
		display: block;
	}
	.block-split-composer .column.is-6-desktop,
	.block-split-composer.block-split-img-left .column.is-6-desktop {
		flex: none;
		max-width: 100%;
		width: 100%;
		margin-left: 0;
	}
	.block-split-composer.is-halfheight,
	.block-split-composer.is-fullheight {
		display: block;
		min-height: 0;
	}
	.block-split-composer.is-halfheight .block-content,
	.block-split-composer.is-fullheight .block-content {
		display: block;
		min-height: 0;
	}
	.block-split-composer .block-text {
		padding: 2.5rem 1.5rem;
	}
}

/* Bulma-achtige utility-classes uit Hemma */
.container.is-fluid {
	width: 100%;
	padding-right: 2rem;
	padding-left: 2rem;
}

.block-title {
	font-size: 2rem;
	margin: 0 0 0.5rem;
}
.block-subtitle {
	font-style: italic;
	color: #555;
	margin: 0 0 1rem;
}

/* Paginatop-ondertitel (gemigreerd uit opendept_subtitle_subtitle) */
.existo-subtitle {
	font-style: italic;
	font-size: 1.6rem;
	color: #555;
	margin: 0 0 1.5rem;
	line-height: 1.4;
	text-align: center;
}

/* Pagetitel — alleen h1-niveau krijgt 3em. .wp-block-post-title zonder
   element-prefix raakt OOK de h2-titels op de blog-cards en zou die ook
   op 3em zetten, dus we scopen strikt op h1. */
h1.wp-block-post-title {
	font-size: 3em;
	line-height: 1.15;
}

/* Card-titel op blog-overzicht: nette h2-grootte, niet de page-title-grootte. */
.existo-blog-card .existo-blog-card__title {
	font-size: 1.35rem;
	line-height: 1.3;
}

/* oEmbeds (YouTube, Vimeo, etc.) gecentreerd */
.wp-block-embed,
.wp-embedded-content {
	margin-left: auto;
	margin-right: auto;
	display: block;
}
.wp-block-embed {
	text-align: center;
}

/* Knoppen — kleuren overgenomen uit Hemma-palet */
.button {
	display: inline-block;
	padding: 0.75rem 1.5rem;
	border-radius: 3px;
	background: #111;
	color: #fff;
	text-decoration: none;
	font-weight: 600;
	transition: opacity .2s;
}
.button:hover { opacity: 0.85; }

.button.is-red        { background-color: #FB6658; color: #fff; }
.button.is-orange     { background-color: #FC8251; color: #fff; }
.button.is-yellow     { background-color: #F9C356; color: #333; }
.button.is-green      { background-color: #6BB470; color: #fff; }
.button.is-light-blue { background-color: #60C2E4; color: #fff; }
.button.is-blue       { background-color: #4A89DC; color: #fff; }
.button.is-purple     { background-color: #A188E0; color: #fff; }
.button.is-pink       { background-color: #EA7CBA; color: #fff; }
.button.is-brown      { background-color: #B39164; color: #fff; }
.button.is-dark       { background-color: #565656; color: #fff; }
.button.is-white      { background-color: #fff; color: #333; border: 1px solid #ddd; }

/* Bottom notes (gemigreerd uit Hemma's bottom_notes theme_mod) — kleine
   centered tekst onderaan de footer. */
.existo-bottom-notes {
	font-size: 87.5%;
	text-align: center;
	padding: 1rem 1.5rem;
	color: #666;
}
.existo-bottom-notes a {
	color: inherit;
}

/* Blog overzicht — 2-koloms cards (home.html, category.html) */
.existo-category-filter {
	list-style: none;
	padding: 0;
	margin: 0 0 2rem;
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	justify-content: center;
}
.existo-category-filter li a {
	display: inline-block;
	padding: 0.35rem 0.9rem;
	border: 1px solid #ddd;
	border-radius: 999px;
	text-decoration: none;
	color: #333;
	background: #fff;
	transition: background-color .15s, color .15s, border-color .15s;
}
.existo-category-filter li a:hover {
	background: #4A89DC;
	border-color: #4A89DC;
	color: #fff;
}
.existo-category-filter li.current-cat a,
.existo-category-filter li.current-cat-parent a {
	background: #4A89DC;
	border-color: #4A89DC;
	color: #fff;
}

.existo-blog-card {
	background: #fff;
	border-radius: 8px;
	overflow: hidden;
	box-shadow: 0 1px 3px rgba(0,0,0,0.04), 0 6px 18px rgba(0,0,0,0.05);
	transition: box-shadow .2s, transform .2s;
}
.existo-blog-card:hover {
	box-shadow: 0 2px 6px rgba(0,0,0,0.08), 0 12px 32px rgba(0,0,0,0.10);
	transform: translateY(-2px);
}
.existo-blog-card .existo-blog-card__image,
.existo-blog-card .existo-blog-card__image img {
	display: block;
	width: 100%;
	border-radius: 0;
}
.existo-blog-card .existo-blog-card__terms,
.existo-blog-card .existo-blog-card__title,
.existo-blog-card .existo-blog-card__date,
.existo-blog-card .existo-blog-card__excerpt {
	padding-left: 1.25rem;
	padding-right: 1.25rem;
}
.existo-blog-card .existo-blog-card__terms {
	margin-top: 1rem;
	color: #4A89DC;
	font-weight: 600;
}
.existo-blog-card .existo-blog-card__terms a {
	color: inherit;
	text-decoration: none;
}
.existo-blog-card .existo-blog-card__title a {
	color: inherit;
	text-decoration: none;
}
.existo-blog-card .existo-blog-card__title a:hover {
	color: #4A89DC;
}

/* Header-navigatie. We renderen het primaire menu via wp_nav_menu (zie
   [existo_menu]-shortcode in functions.php) zodat Polylang automatisch het
   juiste menu per taal kiest op basis van menu-locatie 'primary'. De CSS
   spiegelt de horizontale flex-layout die het FSE-navigatieblock zou geven. */
.existo-nav {
	display: flex;
}
.existo-nav .existo-nav__list,
.existo-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
	align-items: center;
}
.existo-nav li {
	margin: 0;
}
.existo-nav a {
	color: inherit;
	text-decoration: none;
	padding: 0.4rem 0.2rem;
	display: inline-block;
	transition: color .15s;
}
.existo-nav a:hover,
.existo-nav .current-menu-item > a,
.existo-nav .current-menu-ancestor > a {
	color: #4A89DC;
}
.existo-nav .sub-menu {
	display: none; /* eenvoudige fallback: dropdowns later eventueel toevoegen */
}

/* Verticale variant voor footer-menu — gebruikt via
   [existo_menu location="footer" class="existo-nav__list--vertical"]. */
.existo-nav .existo-nav__list--vertical {
	flex-direction: column;
	gap: 0.4rem 0;
	font-size: 0.95rem;
	/* De lijst is een flex-item van .existo-nav en is zo smal als het langste
	   item. align-items:center centreert de links alleen onderling; met
	   margin-inline:auto komt de lijst zelf ook in het midden van de kolom. */
	margin-inline: auto;
	text-align: center;
}

@media (max-width: 768px) {
	.existo-nav .existo-nav__list,
	.existo-nav ul {
		gap: 0.25rem 1rem;
		font-size: 0.95rem;
	}
}

/* Header rechterkant: menu + Polylang language-switcher op één rij.
   Compact zodat de switcher direct naast het laatste menu-item plakt. */
.existo-header-end {
	gap: 1.5rem;
	align-items: center;
}
.existo-header-end .wp-block-polylang-language-switcher,
.existo-header-end .lang-item {
	margin: 0;
}
/* Polylang zet .pll-switcher op width:100%. In deze flex-rij claimt de
   switcher daardoor even veel ruimte als het menu, waardoor het menu over
   meerdere regels wrapt terwijl de switcher maar één vlaggetje toont. */
.existo-header-end .wp-block-polylang-language-switcher {
	width: auto;
	flex: 0 0 auto;
}
.existo-header-end .wp-block-polylang-language-switcher ul {
	display: flex;
	gap: 0.5rem;
	list-style: none;
	margin: 0;
	padding: 0;
	align-items: center;
}
.existo-header-end .wp-block-polylang-language-switcher a {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	color: inherit;
}
.existo-header-end .wp-block-polylang-language-switcher img {
	display: block;
	width: 18px;
	height: auto;
}

/* Footer-widgets gemigreerd uit Hemma's footer-1..4 sidebars */
.widget {
	margin-bottom: 1.5rem;
}
.widget .widget-title {
	font-size: 1.1rem;
	margin: 0 0 0.75rem;
	font-weight: 600;
}
.widget ul {
	list-style: none;
	padding: 0;
	margin: 0;
}
.widget ul li {
	margin-bottom: 0.4rem;
}

/* Full background block (existo/full-bg) — spiegelt Hemma's Composer full-bg:
   .block.is-bg-image.is-text-light.is-centered. Hemma had geen overlay; de
   donkere laag (.existo-fullbg__overlay, opacity per block instelbaar) is
   nieuw zodat witte tekst ook op lichte foto's leesbaar blijft. */
.existo-fullbg-block {
	position: relative;
	display: flex;
	flex-direction: column;
	justify-content: center;
	overflow: hidden;
	background-color: #565656;
	background-position: center center;
	background-size: cover;
	background-repeat: no-repeat;
	color: #fff;
	text-align: center;
	margin-block: 1.5rem;
}
.existo-fullbg-block.alignwide {
	max-width: var(--wp--style--global--wide-size, 1600px);
	margin-left: auto;
	margin-right: auto;
	border-radius: 6px;
}
.existo-fullbg-block.alignfull {
	max-width: none;
}
.existo-fullbg-block.is-halfheight { min-height: 50vh; }
.existo-fullbg-block.is-fullheight { min-height: 100vh; }
.existo-fullbg-block .existo-fullbg__overlay {
	position: absolute;
	inset: 0;
	background: #000;
	pointer-events: none;
}
.existo-fullbg-block .block-content {
	position: relative;
	z-index: 1;
	width: 100%;
}
.existo-fullbg-block .block-text {
	max-width: 820px;
	margin: 0 auto;
	padding: 4rem 1.5rem;
	box-sizing: border-box;
	overflow-wrap: break-word;
}
.existo-fullbg-block .block-title,
.existo-fullbg-block .block-subtitle,
.existo-fullbg-block a:not(.button) {
	color: #fff;
}
.existo-fullbg-block .block-subtitle {
	color: rgba(255, 255, 255, 0.85);
}
.existo-fullbg-block .existo-fullbg__body > * {
	max-width: 100%;
	margin-left: auto;
	margin-right: auto;
}
.existo-fullbg-block .button {
	margin-top: 1rem;
}
@media (max-width: 768px) {
	.existo-fullbg-block .block-text {
		padding: 3rem 1rem;
	}
}
