/**
 * v-styles.css — custom UWEA styles (CSS only).
 * Customizations for the publications-family pages (projects, publications,
 * concept-2030, book-on-offshore, secrets-of-wind) + their shared slider /
 * category switcher. Kept out of the theme's core style.css.
 * Enqueued after uwea-style so it wins on specificity ties.
 *
 * Scoping:
 *  - shared component rules (slider, switcher dropdown) are scoped to the
 *    component classes (.js-pub-widgets-slider / .uw-switcher*) so they apply
 *    on every page that uses them;
 *  - layout specific to the Projects page stays under .page-template-page-projects.
 */

/* ============================================================
   SHARED — publications slider (.events-slider.js-pub-widgets-slider)
   ============================================================ */

/* nav arrows: hidden until Swiper initializes (avoids the flash on page load
   where the buttons show before JS runs), then shown only when navigation is
   usable — Swiper adds .swiper-button-lock when <=1 slide / all fit.
   (buttons live in .container, NOT inside .swiper, so key off .swiper-initialized via :has) */
.js-pub-widgets-slider .swiper-button-prev,
.js-pub-widgets-slider .swiper-button-next { display: none; }
.js-pub-widgets-slider:has(.swiper-initialized) .swiper-button-prev,
.js-pub-widgets-slider:has(.swiper-initialized) .swiper-button-next { display: flex; }
.js-pub-widgets-slider .swiper-button-lock { display: none !important; }

/* banner: drop the global 5.5rem pagination reserve under the slide
   (this slider shows no pagination -> it was just empty space) */
.js-pub-widgets-slider .swiper-wrapper { padding-bottom: 0; }

/* slide hover marker: arrow-in-circle + "Детальніше" pill (Variant A, like 100re).
   .event-item is the slide's <a href>. */
.js-pub-widgets-slider .event-item { position: relative; }
.js-pub-widgets-slider .event-item::after {
	content: "";
	position: absolute;
	right: 2rem;
	bottom: 2rem;
	width: 4.6rem;
	height: 4.6rem;
	border-radius: 50%;
	background-color: #0070B9;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath d='M5 12h13M12 5l7 7-7 7' fill='none' stroke='%23ffffff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: center;
	background-size: 2rem;
	box-shadow: 0 .4rem 1.4rem rgba(0, 0, 0, .20);
	transition: background-color .2s ease, transform .2s ease;
	pointer-events: none;
	z-index: 3;
}
.js-pub-widgets-slider .event-item::before {
	content: "Детальніше";
	position: absolute;
	right: 7.4rem;
	bottom: 2rem;
	height: 4.6rem;
	display: flex;
	align-items: center;
	padding: 0 2rem;
	border-radius: 5rem;
	background: #474747;
	color: #fff;
	font-family: PFHandbookPro, sans-serif;
	font-size: 1.5rem;
	font-weight: 700;
	text-transform: uppercase;
	white-space: nowrap;
	opacity: 0;
	transform: translateX(1rem);
	transition: opacity .25s ease, transform .25s ease;
	pointer-events: none;
	z-index: 3;
}
.js-pub-widgets-slider .event-item:hover::before { opacity: 1; transform: translateX(0); }
.js-pub-widgets-slider .event-item:hover::after { background-color: #019AD9; transform: scale(1.06); }
/* EN pages: localise the marker label (CSS content can't go through WPML) */
html[lang^="en"] .js-pub-widgets-slider .event-item::before { content: "Learn more"; }
@media (prefers-reduced-motion: reduce) {
	.js-pub-widgets-slider .event-item::before,
	.js-pub-widgets-slider .event-item::after { transition: none; }
}

/* ============================================================
   SHARED — category switcher: tab strip (desktop) vs dropdown (mobile)
   (publications-switcher renders .uw-switcher-mobile + .uw-switcher together)
   ============================================================ */

/* desktop: hide the mobile dropdown wrapper (was leaving empty space) */
.uw-switcher-mobile { display: none; }

/* dropdown styled like our tags (.uw-switcher__item active): dark pill, white text */
.uw-switcher-select {
	display: block;
	width: 100%;
	max-width: 34rem;
	margin: 0 auto;
	min-height: 4.6rem;
	box-sizing: border-box;
	border: 0;
	border-radius: 5rem;
	background-color: #474747;
	color: #fff;
	font-family: PFHandbookPro, sans-serif;
	font-size: 1.8rem;
	font-weight: 700;
	text-transform: uppercase;
	padding: .9rem 4.6rem .9rem 2rem;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23ffffff' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 1.8rem center;
	outline: none;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.uw-switcher-select:focus-visible { box-shadow: 0 0 0 3px rgba(1, 154, 217, .45); }

/* ============================================================
   PROJECTS page only — card grid + vertical rhythm (desktop)
   ============================================================ */
@media (min-width: 769px) {
	.page-template-page-projects .projects-grid {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 1.5rem;
	}
	.page-template-page-projects .item-book { flex: 0 1 43rem; }
	/* spacing: use the family's native rhythm (like /konczepcziya-rozvytku-do-2030/) —
	   switcher m-t-3/m-b-3 (3rem) and .sc--m-sm partners gap are left untouched */
}

/* ============================================================
   BOOK-WHITE pages (book-on-offshore, secrets-of-wind)
   Borrow the concept page's generous reading size (theme default here is 16px)
   and trim the empty desktop top gap (no slider to fill the 260px).
   ============================================================ */
/* font-size needs !important to beat WP preset classes (.has-medium-font-size) used
   on some pages' paragraphs (e.g. secrets-of-wind) so the family reads consistently */
.page-template-page-book-white .book-content p,
.page-template-page-book-white .book-content li,
.page-template-page-book-white blockquote { font-size: 2.4rem !important; line-height: 1.5; }
.page-template-page-book-white .authors-list p { font-size: 1.8rem; line-height: 1.6; }
/* left-align body text (theme defaults to justify -> ragged "rivers", worse on mobile) */
.page-template-page-book-white .book-content p,
.page-template-page-book-white .book-content li { text-align: left; }
/* gap under the switcher before the text — match the concept page (~80px) */
.page-template-page-book-white .book-content { margin-top: 5rem; }

@media (min-width: 769px) {
	.page-template-page-book-white .page-body { padding-top: 14rem; }
}
@media (max-width: 768px) {
	/* match concept's smaller mobile reading size */
	.page-template-page-book-white .book-content p,
	.page-template-page-book-white .book-content li,
	.page-template-page-book-white blockquote { font-size: 2rem !important; }
	/* tighten the upper-hero gaps on phones — the cover+title hero is already tall,
	   so the family's h1 padding + the 5rem switcher gap stack into too much space */
	.page-template-page-book-white .book-header h1.uw-h1 { padding-bottom: 0 !important; }
	.page-template-page-book-white .book-content { margin-top: 2rem; }
}

/* ============================================================
   MOBILE (<=768)
   ============================================================ */
@media (max-width: 768px) {
	/* category nav -> dropdown: hide the tab strip ONLY when a dropdown replaces it
	   (publications family renders .uw-switcher-mobile right before .uw-switcher).
	   Switchers without a dropdown (e.g. the events archive tabs/filter) stay visible. */
	.uw-switcher-mobile + .uw-switcher { display: none !important; }
	.uw-switcher-mobile { display: block; }
	/* any still-visible switcher (events archive) -> contained horizontal scroll, never overflow */
	.uw-switcher {
		overflow-x: auto;
		justify-content: flex-start;
		flex-wrap: nowrap;
		max-width: 100%;
		-webkit-overflow-scrolling: touch;
		scrollbar-width: none;
	}
	.uw-switcher::-webkit-scrollbar { display: none; }
	.uw-switcher__item { flex: 0 0 auto; white-space: nowrap; }

	/* slider marker: smaller circle, no hover tooltip on touch */
	.js-pub-widgets-slider .event-item::before { content: none; }
	.js-pub-widgets-slider .event-item::after {
		width: 3.4rem; height: 3.4rem; right: 1.2rem; bottom: 1.2rem; background-size: 1.5rem;
	}

	/* shared spacing for the whole publications family (any page with the category switcher):
	   tighten the big top padding + stop the slider overlapping the H1 on mobile */
	.page-body:has(.uw-switcher-mobile) { padding-top: 14rem; }
	.page-body:has(.uw-switcher-mobile) .uw-h1 { padding-bottom: 4rem !important; }
	.page-body:has(.uw-switcher-mobile) .events-slider { margin-top: 2rem; }
	/* tighten the partners section margins on mobile (theme .sc--m-sm = 80px top/bottom -> too much) */
	.page-body:has(.uw-switcher-mobile) .sc--m-sm { margin-top: 4rem; margin-bottom: 4rem; }

	/* projects page cards: single column */
	.page-template-page-projects .projects-grid { grid-template-columns: 1fr; gap: 4rem; margin-top: 5rem; }
	.page-template-page-projects .item-book { min-width: 0; }

	/* book-white pages (book-on-offshore, secrets-of-wind): the hero .book-header is
	   flex-row (cover + long title) and overflows on phones — stack it: cover on top,
	   title below at a smaller size (kills the horizontal scroll) */
	.page-template-page-book-white .book-header {
		flex-direction: column;
		align-items: center;
		text-align: center;
		gap: 3rem;
	}
	.page-template-page-book-white .book-header .book-image,
	.page-template-page-book-white .book-image { flex: 0 0 auto; width: auto; max-width: 60%; }
	.page-template-page-book-white .book-header .uw-h1 { font-size: 2.8rem; }
}

/* ============================================================
   FORMS — Contact Form 7 controls (membership + contact)
   Theme default rendered inputs at 14px / ~27px tall: 14px font triggers
   iOS Safari auto-zoom on focus, and 27px is below the 44px touch target.
   Lift to 16px font + ~48px height across the .uw-form wrapper.
   ============================================================ */
.uw-form .wpcf7 input[type="text"],
.uw-form .wpcf7 input[type="email"],
.uw-form .wpcf7 input[type="tel"],
.uw-form .wpcf7 input[type="url"],
.uw-form .wpcf7 input[type="number"],
.uw-form .wpcf7 input[type="date"],
.uw-form .wpcf7 select,
.uw-form .wpcf7 textarea {
	font-size: 1.6rem;
	min-height: 4.8rem;
	padding: 1rem 1.4rem;
	line-height: 1.4;
	box-sizing: border-box;
}
.uw-form .wpcf7 textarea { min-height: 12rem; }
.uw-form .wpcf7 input[type="submit"],
.uw-form .wpcf7 .wpcf7-submit {
	font-size: 1.6rem;
	min-height: 4.8rem;
}

/* ============================================================
   404 page (error404 / .page-body--404)
   Rebuilt template: one centered hero — big "404", H1 message,
   helpful search + section links. Vertically balanced between
   the fixed header and the footer.
   ============================================================ */
.page-body--404 {
	padding-top: 19rem;          /* clear the fixed header (no .page-header wrapper here) */
	padding-bottom: 9rem;
	display: flex;
	align-items: center;
	min-height: 70vh;
}
.page-body--404 > .container { width: 100%; }
.error-404 { text-align: center; max-width: 60rem; margin: 0 auto; }
.error-404__code {
	font-family: PFHandbookPro, sans-serif;
	font-weight: 700;
	font-size: 11rem;
	line-height: 1;
	letter-spacing: .5rem;
	color: #019AD9;
	margin: 0;
}
.error-404__title {
	font-family: PFHandbookPro, sans-serif;
	font-weight: 700;
	font-size: 3.6rem;
	line-height: 1.15;
	color: #474747;
	margin: 1rem 0 1.8rem;
}
.error-404__text { margin: 0 auto 3.2rem; max-width: 52rem; }
.error-404__search {
	display: flex;
	gap: 1rem;
	justify-content: center;
	max-width: 48rem;
	margin: 0 auto 2.5rem;
}
.error-404__search input[type="search"] {
	flex: 1 1 auto;
	min-width: 0;
	min-height: 4.8rem;
	font-size: 1.6rem;
	padding: 1rem 1.6rem;
	border: 1px solid #c9c9c9;
	border-radius: 5rem;
	box-sizing: border-box;
	background: #fff;
}
.error-404__search input[type="search"]:focus-visible {
	outline: none;
	border-color: #019AD9;
	box-shadow: 0 0 0 3px rgba(1, 154, 217, .35);
}
.error-404__search .btn { flex: 0 0 auto; }
.error-404__home { margin: 0 auto 3.5rem; }
.error-404__nav ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 1rem 1.2rem;
}
.error-404__nav a {
	display: inline-flex;
	align-items: center;
	min-height: 4.4rem;
	padding: .6rem 2rem;
	border-radius: 5rem;
	background: #F6F6F6;
	color: #474747;
	font-family: PFHandbookPro, sans-serif;
	font-size: 1.6rem;
	font-weight: 700;
	text-transform: uppercase;
	transition: background-color .2s ease, color .2s ease;
}
.error-404__nav a:hover { background: #474747; color: #fff; }

@media (max-width: 768px) {
	.page-body--404 { padding-top: 14rem; padding-bottom: 5rem; min-height: 0; display: block; }
	.error-404__code { font-size: 7rem; letter-spacing: .2rem; }
	.error-404__title { font-size: 2.6rem; }
	.error-404__search { flex-direction: column; align-items: stretch; }
	.error-404__search .btn { width: 100%; justify-content: center; }
}
