/*
Theme Name: ACT4Consumers
Theme URI: https://potrosacica.hr/
Author: Društvo Potrošačica
Author URI: https://potrosacica.hr/
Description: Block theme for the ACT4Consumers – Capacity & Tools for Collective Actions EU project (SMP-CONS-2025-ADR-RAD, Project 101266409). Bilingual-ready (English/Croatian, Polylang compatible), with an Events custom post type, partner logo placeholders and EU funding visibility elements built in.
Requires at least: 6.7
Tested up to: 6.9
Requires PHP: 7.4
Version: 1.3.2
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: act4consumers
Tags: block-theme, full-site-editing, two-columns, custom-colors, custom-logo, translation-ready
*/

/* =========================================================
   ACT4Consumers – global styles that go beyond theme.json
   ========================================================= */

/* Smooth rendering */
body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

/* ---------- Header ---------- */
.act4c-header {
	border-bottom: 1px solid var(--wp--preset--color--border, #e3e8f0);
}

.act4c-topbar {
	font-size: 0.8125rem;
	letter-spacing: 0.02em;
}

.act4c-topbar a {
	text-decoration: none;
}

/* ---------- Brand (site logo + title) ---------- */
/* The logo is kept at a fixed, tidy height regardless of the uploaded
   image's dimensions, so the header and menu stay aligned.
   Scoped to .act4c-header so it also applies if the header template part
   was customised in the Site Editor before this version. */
.act4c-header .wp-block-site-logo img {
	max-height: 56px;
	height: auto;
	width: auto !important;
	max-width: 240px;
	object-fit: contain;
	display: block;
}

.act4c-header .wp-block-site-logo a {
	display: block;
	line-height: 0;
}

/* When a logo is set, hide the title/tagline text next to it (the Site
   Title setting still provides the browser-tab / SEO title). */
.act4c-header .wp-block-group:has(> .wp-block-site-logo) .wp-block-site-title,
.act4c-header .wp-block-group:has(> .wp-block-site-logo) .wp-block-site-tagline {
	display: none;
}

@media (max-width: 1023px) {
	.act4c-header .wp-block-site-logo img {
		max-height: 44px;
		max-width: 190px;
	}
}

/* ---------- Navigation (classic menu rendered by act4c/nav-menu) ---------- */
.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(1px, 1px, 1px, 1px);
	clip-path: inset(50%);
	word-wrap: normal !important;
}

.act4c-nav ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
	align-items: center;
}

.act4c-nav li {
	position: relative;
}

.act4c-nav a {
	display: block;
	padding: 0.55rem 0.85rem;
	text-decoration: none;
	font-weight: 600;
	font-size: 0.9375rem;
	color: var(--wp--preset--color--contrast);
	border-radius: 6px;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.act4c-nav a:hover,
.act4c-nav li.current-menu-item > a,
.act4c-nav li.current-menu-ancestor > a {
	color: var(--wp--preset--color--primary);
	background: var(--wp--preset--color--tint);
}

/* Hamburger button – hidden on desktop */
.act4c-nav-toggle {
	display: none;
	background: transparent;
	border: 1px solid var(--wp--preset--color--border, #e3e8f0);
	border-radius: 8px;
	padding: 0.55rem 0.7rem;
	cursor: pointer;
	line-height: 0;
}

.act4c-nav-toggle__bars {
	display: inline-flex;
	flex-direction: column;
	gap: 4px;
}

.act4c-nav-toggle__bars span {
	display: block;
	width: 20px;
	height: 2px;
	border-radius: 2px;
	background: var(--wp--preset--color--contrast);
	transition: transform 0.2s ease, opacity 0.2s ease;
}

.act4c-nav.is-open .act4c-nav-toggle__bars span:nth-child(1) {
	transform: translateY(6px) rotate(45deg);
}

.act4c-nav.is-open .act4c-nav-toggle__bars span:nth-child(2) {
	opacity: 0;
}

.act4c-nav.is-open .act4c-nav-toggle__bars span:nth-child(3) {
	transform: translateY(-6px) rotate(-45deg);
}

/* Desktop dropdowns */
@media (min-width: 1024px) {
	.act4c-nav ul ul {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		min-width: 260px;
		background: var(--wp--preset--color--base);
		border: 1px solid var(--wp--preset--color--border, #e3e8f0);
		border-radius: 10px;
		box-shadow: 0 12px 30px rgba(10, 31, 68, 0.12);
		padding: 0.4rem;
		z-index: 99;
		flex-direction: column;
		align-items: stretch;
	}

	.act4c-nav li:hover > ul,
	.act4c-nav li:focus-within > ul {
		display: flex;
	}

	/* Full-width highlight on dropdown items */
	.act4c-nav ul ul li {
		width: 100%;
	}

	.act4c-nav ul ul a {
		display: block;
		width: 100%;
		box-sizing: border-box;
		font-weight: 500;
		font-size: 0.9rem;
		padding: 0.55rem 0.75rem;
		white-space: normal;
	}

	.act4c-nav ul ul ul {
		top: 0;
		left: 100%;
	}
}

/* Mobile & tablet: collapsed hamburger menu */
@media (max-width: 1023px) {
	.act4c-header {
		position: relative;
	}

	.act4c-nav--collapsible .act4c-nav-toggle {
		display: inline-flex;
	}

	.act4c-nav--collapsible .act4c-nav-inner {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		background: var(--wp--preset--color--base);
		border-top: 1px solid var(--wp--preset--color--border, #e3e8f0);
		border-bottom: 3px solid var(--wp--preset--color--primary);
		box-shadow: 0 18px 34px rgba(10, 31, 68, 0.16);
		padding: 0.75rem var(--wp--preset--spacing--30, 1rem) 1.25rem;
		max-height: calc(100vh - 130px);
		overflow-y: auto;
		z-index: 999;
	}

	.act4c-nav--collapsible.is-open .act4c-nav-inner {
		display: block;
	}

	.act4c-nav ul {
		flex-direction: column;
		align-items: stretch;
		gap: 0;
	}

	.act4c-nav a {
		padding: 0.7rem 0.5rem;
		border-radius: 6px;
		border-bottom: 1px solid var(--wp--preset--color--surface, #f5f7fb);
	}

	/* Sub-menus: always visible inside the open panel, indented */
	.act4c-nav ul ul {
		display: flex;
		position: static;
		box-shadow: none;
		border: none;
		padding: 0 0 0 1rem;
		background: transparent;
		flex-direction: column;
		align-items: stretch;
	}

	.act4c-nav ul ul a {
		font-weight: 500;
		font-size: 0.9rem;
	}

	/* Footer menu (non-collapsible): compact horizontal wrap */
	.act4c-nav:not(.act4c-nav--collapsible) ul {
		flex-direction: row;
		flex-wrap: wrap;
		gap: 0.25rem;
	}

	.act4c-nav:not(.act4c-nav--collapsible) a {
		border-bottom: none;
	}
}

/* ---------- Language switcher ---------- */
.act4c-lang ul {
	display: flex;
	gap: 0.35rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.act4c-lang a {
	display: inline-block;
	padding: 0.25rem 0.6rem;
	border: 1px solid var(--wp--preset--color--border, #e3e8f0);
	border-radius: 999px;
	font-size: 0.8125rem;
	font-weight: 600;
	text-decoration: none;
	color: var(--wp--preset--color--muted);
	text-transform: uppercase;
	letter-spacing: 0.04em;
}

.act4c-lang li.current-lang a {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
	color: #fff;
}

.act4c-lang a:hover {
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
}

.act4c-lang li.current-lang a:hover {
	color: #fff;
}

/* ---------- Partner logo strip ---------- */
/* Logos stay in full colour — EU visibility rules require the unmodified
   emblem, and partner logos must be clearly visible. */
.act4c-logo-strip img {
	max-height: 72px;
	width: auto;
	transition: transform 0.2s ease;
}

.act4c-logo-strip img:hover {
	transform: scale(1.04);
}

/* ---------- EU funding notice ---------- */
.act4c-funding-notice {
	display: flex;
	gap: 1.25rem;
	align-items: center;
	flex-wrap: wrap;
}

.act4c-funding-notice__emblem img {
	width: 180px;
	height: auto;
	display: block;
}

.act4c-funding-notice__text {
	flex: 1;
	min-width: 260px;
	font-size: 0.85rem;
	line-height: 1.55;
}

.act4c-funding-notice__statement {
	font-weight: 700;
	margin: 0 0 0.35rem;
}

.act4c-funding-notice__disclaimer {
	margin: 0;
	opacity: 0.85;
}

/* ---------- Cards ---------- */
.act4c-card {
	border: 1px solid var(--wp--preset--color--border, #e3e8f0);
	border-radius: 14px;
	overflow: hidden;
	background: var(--wp--preset--color--base);
	transition: box-shadow 0.2s ease, transform 0.2s ease;
	height: 100%;
}

.act4c-card:hover {
	box-shadow: 0 14px 34px rgba(10, 31, 68, 0.1);
	transform: translateY(-2px);
}

/* Card title links (e.g. Knowledge Hub sections) — clearly clickable.
   Post titles (news/event cards) are excluded. */
.act4c-card h3:not(.wp-block-post-title) a {
	text-decoration: none;
	color: var(--wp--preset--color--primary);
}

.act4c-card h3:not(.wp-block-post-title) a::after {
	content: " →";
}

.act4c-card h3:not(.wp-block-post-title) a:hover {
	text-decoration: underline;
	color: var(--wp--preset--color--primary-dark);
}

/* ---------- Event meta chips ---------- */
.act4c-event-meta {
	display: flex;
	gap: 0.5rem;
	flex-wrap: wrap;
	align-items: center;
}

.act4c-event-meta .act4c-chip,
.act4c-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.35rem;
	background: var(--wp--preset--color--tint);
	color: var(--wp--preset--color--primary);
	border-radius: 999px;
	padding: 0.2rem 0.7rem;
	font-size: 0.8125rem;
	font-weight: 600;
}

/* Bound meta paragraphs that are empty should not leave gaps */
.act4c-event-meta p:empty {
	display: none;
}

/* ---------- Buttons refinement ---------- */
.wp-block-button__link {
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.wp-block-button__link:hover {
	opacity: 0.9;
	transform: translateY(-1px);
}

/* ---------- Editor placeholders for dynamic blocks ---------- */
.act4c-editor-placeholder {
	border: 1px dashed #94a3b8;
	border-radius: 8px;
	padding: 0.75rem 1rem;
	background: #f8fafc;
	color: #475569;
	font-size: 13px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ---------- Skip link (accessibility) ---------- */
.act4c-skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 100000;
	background: var(--wp--preset--color--primary);
	color: #fff;
	padding: 0.6rem 1.2rem;
	border-radius: 0 0 8px 0;
	font-weight: 600;
	text-decoration: none;
}

.act4c-skip-link:focus {
	left: 0;
	color: #fff;
}

/* ---------- Cookie notice ---------- */
.act4c-cookie-notice {
	position: fixed;
	bottom: 1rem;
	left: 1rem;
	right: 1rem;
	max-width: 560px;
	margin: 0 auto;
	z-index: 9999;
	background: var(--wp--preset--color--primary-dark, #00205b);
	color: #fff;
	border-radius: 12px;
	padding: 1rem 1.25rem;
	display: flex;
	gap: 1rem;
	align-items: center;
	flex-wrap: wrap;
	box-shadow: 0 16px 40px rgba(10, 31, 68, 0.35);
	font-size: 0.875rem;
	line-height: 1.5;
}

.act4c-cookie-notice[hidden] {
	display: none;
}

.act4c-cookie-notice p {
	margin: 0;
	flex: 1;
	min-width: 220px;
}

.act4c-cookie-notice a {
	color: var(--wp--preset--color--accent, #ffcc00);
}

.act4c-cookie-notice button {
	background: var(--wp--preset--color--accent, #ffcc00);
	color: var(--wp--preset--color--primary-dark, #00205b);
	border: none;
	border-radius: 8px;
	padding: 0.55rem 1.2rem;
	font-weight: 700;
	font-size: 0.875rem;
	cursor: pointer;
}

.act4c-cookie-notice button:hover {
	opacity: 0.9;
}

/* ---------- Footer social icons ---------- */
.act4c-footer-social .wp-block-social-links {
	gap: 0.5rem;
}

/* ---------- Project timeline ---------- */
.act4c-timeline__track {
	gap: 0.75rem;
}

.act4c-timeline__item {
	background: var(--wp--preset--color--base);
	border: 1px solid var(--wp--preset--color--border, #e3e8f0);
	border-radius: 12px;
	padding: 0.7rem 1rem;
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.45;
	position: relative;
	text-align: center;
	flex: 1 1 150px;
	max-width: 220px;
}

.act4c-timeline__item span {
	color: var(--wp--preset--color--muted);
	font-size: 0.8125rem;
}

.act4c-timeline__item:not(:last-child)::after {
	content: "→";
	position: absolute;
	right: -0.85rem;
	top: 50%;
	transform: translateY(-50%);
	color: var(--wp--preset--color--primary);
	font-weight: 700;
}

@media (max-width: 781px) {
	.act4c-timeline__item {
		flex: 1 1 100%;
		max-width: none;
	}
	.act4c-timeline__item:not(:last-child)::after {
		content: "↓";
		right: auto;
		left: 50%;
		top: auto;
		bottom: -1.15rem;
		transform: translateX(-50%);
	}
	.act4c-timeline__track {
		gap: 1.1rem;
	}
}

/* ---------- Misc ---------- */
.act4c-divider {
	border: none;
	border-top: 3px solid var(--wp--preset--color--accent);
	width: 64px;
	margin-left: 0;
}

.act4c-hero-kicker {
	letter-spacing: 0.12em;
	text-transform: uppercase;
	font-weight: 700;
}
