/*
Theme Name: Općina Markušica
Theme URI: https://markusica.hr/
Template: opcinaTema
Author: Sven Hartl PlaviLink
Author URI: https://plavilink.hr/
Description: Site-specific child theme for Općina Markušica. Owns the municipality's brand palette on top of the reusable "Opcina Tema" parent; structure, sections and logic come from the parent.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: markusica
*/

/*
 * Site-specific CSS overrides go here (loaded after the parent styles).
 * The brand palette lives in functions.php (base colors) + assets/css/brand.css
 * (shade variants). Keep this file for genuine Markušica-only tweaks.
 *
 * The blocks below were ported from the Ernestinovo child theme (2026-11-09,
 * see docs/FEATURES-2026-11-09.md); where that theme hardcoded its green and
 * gold, this one uses the parent's colour tokens so the brand palette above
 * carries through. The "client request" dates record that site's history.
 */

/* Homepage "Brze veze": seven tiles (see markusica_home_utility_links) in
   ONE row on wide screens, where the parent grid is 6 columns. Between 900 and
   1280px the parent's 4 columns give 4 + 3. */
@media (min-width: 1281px) {
	.mt-section--utility-links {
		--mt-section-utility-links-grid: repeat(7, minmax(0, 1fr));
	}
}

/* Homepage "Lokalne vijesti": the latest three cards in one row instead of the
   parent's paged slider (see markusica_home_news_grid / _count). The slider wrapper
   markup stays; only the track becomes a grid, so the cards keep their
   equal-height flex behaviour from the parent. */
.mt-local-news .mt-cards-slider--grid .mt-cards-slider__viewport {
	overflow: visible;
	cursor: default;
	touch-action: auto;
	-webkit-user-select: auto;
	user-select: auto;
}

.mt-local-news .mt-cards-slider--grid .mt-cards-slider__track {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1.25rem 1rem;
	transition: none;
}

.mt-local-news .mt-cards-slider--grid .mt-cards-slider__slide {
	flex: none;
	min-width: 0;
}

/* The parent's dot row is reused by the phone slider below (filled by
   mt-home-news-slider.js); while the cards sit in the grid it stays hidden. */
.mt-local-news .mt-cards-slider--grid .mt-cards-slider__dots {
	display: none;
}

/* Phones and tablets (client request 2026-09-28): the three cards as a swipe
   slider instead of a stack — the track scrolls horizontally with scroll-snap,
   one card per screen on phones, two on tablets; no buttons, a row of
   non-interactive dots (the parent's dot styling) mirrors the position. */
@media (max-width: 899px) {
	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__track {
		display: flex;
		gap: 1rem;
		overflow-x: auto;
		overscroll-behavior-x: contain;
		scroll-snap-type: x mandatory;
		scrollbar-width: none;
		-webkit-overflow-scrolling: touch;
		/* Room for the card shadow/lift, which overflow:auto would otherwise clip. */
		padding-block: 0.25rem 0.75rem;
		margin-block: -0.25rem -0.75rem;
	}

	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__track::-webkit-scrollbar {
		display: none;
	}

	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__slide {
		flex: 0 0 calc((100% - 1rem) / 2);
		scroll-snap-align: start;
		scroll-snap-stop: always;
	}

	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__dots {
		display: flex;
	}

	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__dot {
		cursor: default;
	}
}

@media (max-width: 599px) {
	.mt-local-news .mt-cards-slider--grid .mt-cards-slider__slide {
		flex-basis: 100%;
	}
}

/* Header: no hamburger "Meni" trigger on desktop (client request, 2026-09-21).
   Above the parent's 1280px collapse point the five nav tabs sit fully visible
   in the header bar, so the Izbornik trigger beside them is redundant. It stays
   at ≤1280px, where the parent folds the tabs away and the hamburger (plus the
   bottom tab-bar "Meni" on phones) is the way into the navigation. The button
   keeps rendering, so mt-izbornik.js still finds its toggles; the search icon
   stays right-aligned via the parent's margin-left:auto on the actions cluster.
   Specificity (0,2,0) beats the parent's (0,1,0) display:inline-flex regardless
   of where the parent bundle lands in the cascade. */
@media (min-width: 1281px) {
	.mt-site-header .mt-site-header__menu--izbornik {
		display: none;
	}
}

/* -- Term-archive pages (inc/term-archive-pages.php) ------------------------ */

/* The page body sits in the hero and spans the archive's full 1260px frame
   (the hero copy is otherwise capped at 54rem) — lists, prose and galleries
   alike, so the intro reads as wide as the filter panel and cards below. */
.mt-term-archive-page .mt-page-hero__copy {
	--mt-page-hero-copy-max-width: none;
	justify-self: stretch;
	width: 100%;
	max-width: none;
}

.mt-term-archive-page__content {
	width: 100%;
	max-width: none;
}

/* The body opens with a contact list or a heading, not an intro paragraph —
   keep the global lede rule (first p reads larger) off a mid-text paragraph. */
.mt-term-archive-page__content > p:first-of-type {
	color: inherit;
	font-size: inherit !important;
	line-height: inherit;
}

.mt-term-archive-page__content h2 {
	margin: var(--mt-space-lg) 0 var(--mt-space-sm);
	font-size: 1.35rem;
	line-height: var(--mt-line-height-tight);
}

/* -- YouTube embeds in editor content --------------------------------------- */

.mt-editor-content .wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper {
	position: relative;
}

.mt-editor-content .wp-block-embed.wp-embed-aspect-16-9 .wp-block-embed__wrapper::before {
	content: "";
	display: block;
	padding-top: 56.25%;
}

.mt-editor-content .wp-block-embed.wp-has-aspect-ratio .wp-block-embed__wrapper iframe {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	border: 0;
}

/* -- Istaknuti projekti showcase ---------------------------------------------
   The parent draws the tabbed showcase (section-featured-projects.css) on the
   primary colour with the warning colour as the accent — here the petrol blue
   and the gold of the brand palette, so no override is needed. (The
   Ernestinovo child forced its header green here instead.) ------------------ */

/* -- Projekti hub: featured projects as photo banners, then the all-projects
   button, then the project-news archive (inc/projekti-hub.php). The hero copy
   spans the archive's frame so the banner grid can use the full width. ------- */

.mt-projekti-hub .mt-page-hero__copy.mt-projekti-hub__copy {
	--mt-page-hero-copy-max-width: none;
	justify-self: stretch;
	width: 100%;
	max-width: none;
}

.mt-projekti-hub__lead {
	max-width: 54rem;
}

/* One banner per row, full width (client feedback 2026-09-24). */
.mt-project-banners {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: clamp(1rem, 2vw, 1.5rem);
	margin-top: clamp(1.5rem, 3vw, 2.25rem);
}

/* Full-width banners: a wide, fixed band rather than 16:9 (which would be
   ~700px tall at 1260px). The deep primary shows while the photo loads. */
.mt-project-banner {
	position: relative;
	display: block;
	height: clamp(17rem, 34vw, 26rem);
	overflow: hidden;
	background: var(--mt-color-primary-deep);
	border-radius: var(--mt-radius-lg);
	box-shadow: var(--mt-shadow-elevated);
	color: #ffffff;
	text-decoration: none;
}

.mt-project-banner__media,
.mt-project-banner__media img {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.mt-project-banner__media img {
	transition: transform var(--mt-motion-base);
}

.mt-project-banner:hover .mt-project-banner__media img,
.mt-project-banner:focus-visible .mt-project-banner__media img {
	transform: scale(1.04);
}

/* Readability scrim: photo on top, text on a dark petrol gradient at the foot. */
.mt-project-banner::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(4, 30, 40, 0) 28%, rgba(4, 30, 40, 0.55) 60%, rgba(4, 30, 40, 0.88) 100%);
}

.mt-project-banner__body {
	position: absolute;
	inset: auto 0 0 0;
	z-index: 1;
	display: grid;
	gap: 0.45rem;
	justify-items: start;
	padding: clamp(1rem, 2.2vw, 1.6rem);
	font-size: 1rem;
	line-height: 1.4;
}

.mt-project-banner__meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.45rem;
}

.mt-project-banner__year {
	display: inline-flex;
	align-items: center;
	padding: 0.2rem 0.55rem;
	border: 1px solid rgba(255, 255, 255, 0.45);
	border-radius: var(--mt-radius-pill);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.05em;
}

.mt-project-banner__title {
	display: -webkit-box;
	overflow: hidden;
	color: #ffffff;
	font-size: clamp(1.15rem, 1.8vw, 1.5rem);
	font-weight: 800;
	line-height: 1.2;
	letter-spacing: var(--mt-heading-letter-spacing);
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

.mt-project-banner__excerpt {
	display: -webkit-box;
	overflow: hidden;
	max-width: 46rem;
	color: rgba(255, 255, 255, 0.86);
	font-size: 0.95rem;
	line-height: 1.5;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
}

/* "Pogledaj projekt" in the brand gold (the warning token, #dec45b). */
.mt-project-banner__more {
	display: inline-flex;
	align-items: center;
	gap: 0.4rem;
	margin-top: 0.15rem;
	color: var(--mt-color-warning);
	font-size: 0.9rem;
	font-weight: 700;
}

.mt-project-banner__more > span,
.mt-projekti-hub__all-arrow {
	width: 0.85rem;
	height: 0.85rem;
	background: currentColor;
	-webkit-mask: url("../opcinaTema/assets/svg/arrow-right.svg") center / contain no-repeat;
	mask: url("../opcinaTema/assets/svg/arrow-right.svg") center / contain no-repeat;
	transition: transform var(--mt-motion-fast);
}

.mt-project-banner:hover .mt-project-banner__more > span,
.mt-projekti-hub__all .mt-button:hover .mt-projekti-hub__all-arrow {
	transform: translateX(0.2rem);
}

.mt-project-banner:focus-visible {
	outline: var(--mt-focus-ring-width) solid var(--mt-focus-ring-color);
	outline-offset: 3px;
}

/* The hero zeroes every paragraph margin (.mt-page-hero__copy p), so the
   button row needs the stronger selector to keep its distance from the
   last banner. */
.mt-projekti-hub .mt-page-hero__copy .mt-projekti-hub__all {
	margin: clamp(1.5rem, 3vw, 2.25rem) 0 0;
	font-size: 1rem;
}

.mt-projekti-hub__all .mt-button {
	gap: 0.6rem;
}

.mt-projekti-hub__anchor {
	display: block;
	height: 0;
	margin-top: var(--mt-space-lg);
	scroll-margin-top: 6rem;
}

@media (max-width: 767px) {
	.mt-project-banners {
		grid-template-columns: minmax(0, 1fr);
	}

	.mt-project-banner {
		height: auto;
		min-height: 14rem;
		aspect-ratio: 16 / 9;
	}

	.mt-project-banner__excerpt {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mt-project-banner__media img,
	.mt-project-banner__more > span,
	.mt-projekti-hub__all-arrow {
		transition: none;
	}
}

/* -- Hub pages (Općina, Mještani, Poduzetnici, Projekti, Posjetitelji): the
   links inside the service-panel cards no longer slide right on hover/focus
   (client request, 2026-09-28) — only the colour change remains. The parent
   (pages.css) shifts the link 0.18rem and its arrow 0.12rem; the :is() list
   matches its (0,3,1) specificity, so this later rule wins the cascade. --- */

:is(.mt-opcina-page, .mt-mjestani-page, .mt-poduzetnici-page, .mt-projekti-page, .mt-posjetitelji-page) .mt-service-panel a:hover,
:is(.mt-opcina-page, .mt-mjestani-page, .mt-poduzetnici-page, .mt-projekti-page, .mt-posjetitelji-page) .mt-service-panel a:focus-visible,
:is(.mt-opcina-page, .mt-mjestani-page, .mt-poduzetnici-page, .mt-projekti-page, .mt-posjetitelji-page) .mt-service-panel a:hover::before,
:is(.mt-opcina-page, .mt-mjestani-page, .mt-poduzetnici-page, .mt-projekti-page, .mt-posjetitelji-page) .mt-service-panel a:focus-visible::before {
	transform: none;
}

/* -- Event cards (archive grids: vijesti, projektne vijesti, termini, term
   archives; also the --pill variant): no movement on hover/focus (client
   request, 2026-09-28). The parent (organisms/card-event.css) lifts the card
   2px and slides the "Pročitaj više" link 0.15rem; the shadow and colour
   changes and the photo zoom stay. Same selectors as the parent, so equal
   specificity and the later cascade position win. ------------------------- */

.mt-event-card:hover,
.mt-event-card:focus-within,
.mt-event-card--pill:hover,
.mt-event-card--pill:focus-within,
.mt-event-card__more:hover,
.mt-event-card__more:focus-visible,
.mt-event-card:not(.mt-event-card--pill):hover .mt-event-card__more,
.mt-event-card:not(.mt-event-card--pill):focus-within .mt-event-card__more,
.mt-event-card--pill:hover .mt-event-card__more,
.mt-event-card--pill:focus-within .mt-event-card__more {
	transform: none;
}

/* -- Homepage "Lokalne vijesti" media cards: no movement on hover/focus either
   (client request, 2026-09-28). The parent (sections/section-local-news.css)
   lifts the card 2px and nudges the "Pročitaj više" arrow 0.14rem; the
   elevated shadow and the photo zoom stay. Same selectors as the parent. -- */

.mt-media-card:hover,
.mt-media-card:focus-visible,
.mt-media-card:hover .mt-media-card__more-arrow,
.mt-media-card:focus-visible .mt-media-card__more-arrow {
	transform: none;
}

/* -- Načelnik: his profile card alone in the row (the site has no osoba with
   the zamjenik-nacelnika term, so the parent renders only his card). The
   parent sizes the card for two side by side, so on its own it looked empty —
   a bigger portrait, more air and larger type fill the full width; the
   parent's phone stack (≤768px, photo above the text) is left as it is.
   Selectors carry the .mt-nacelnik-archive__people ancestor to outweigh the
   parent's. ---------------------------------------------------------------- */

@media (min-width: 769px) {
	.mt-nacelnik-archive__people .mt-nacelnik-archive__about {
		gap: clamp(2rem, 4vw, 3.5rem);
		padding: clamp(1.5rem, 3vw, 2.5rem);
	}

	.mt-nacelnik-archive__people .mt-nacelnik-archive__about > .wp-block-image,
	.mt-nacelnik-archive__people .mt-nacelnik-archive__about-avatar {
		width: min(24rem, 40%);
	}

	.mt-nacelnik-archive__people .mt-nacelnik-archive__about img {
		border-radius: var(--mt-radius-lg);
	}

	.mt-nacelnik-archive__people .mt-nacelnik-archive__about-text {
		gap: 0.35rem;
		padding-block: var(--mt-space-sm);
	}

	.mt-nacelnik-archive__people .mt-nacelnik-archive__about-text > * {
		margin-block: 0;
		font-size: 1.1rem;
		line-height: 1.6;
	}

	/* Name, then the office line as a lead. */
	.mt-nacelnik-archive__people .mt-nacelnik-archive__about-text > :first-child {
		margin-bottom: 0.35rem;
		font-size: clamp(1.7rem, 2.4vw, 2.2rem);
		font-weight: 800;
		letter-spacing: var(--mt-heading-letter-spacing);
	}

	.mt-nacelnik-archive__people .mt-nacelnik-archive__about-text > :nth-child(2) {
		margin-bottom: 1rem;
		color: var(--mt-color-primary);
		font-size: 1.2rem;
		font-weight: 600;
	}
}

/* -- Općinsko vijeće: the saziv president's card in the hero (inc/opcinsko-
   vijece.php), between the saziv switcher and the member list. Same profile
   card as the načelnik's (.mt-nacelnik-archive__about, standalone parent
   styles), but in its own row so the full-width načelnik tweaks above do not
   apply; the photo slot stays modest — a president without a photo gets the
   neutral avatar. --------------------------------------------------------- */

.mt-council-president {
	margin-top: var(--mt-space-sm);
	margin-bottom: var(--mt-space-md);
}

@media (min-width: 769px) {
	.mt-council-president .mt-nacelnik-archive__about > .wp-block-image,
	.mt-council-president .mt-nacelnik-archive__about-avatar {
		width: min(12rem, 34%);
	}
}

/* -- Footer: EU programme logos at the bottom of the brand column -----------
 * Rendered by this child's footer-brand-block override (template-parts/
 * molecules/footer-brand-block.php): Zaželi (ESF+) and the "Sufinancira
 * Europska unija" emblem — Markušica runs the Zaželi programme. The parent
 * lays the block out as a flex row (crest | text); this switches it to a
 * 2-row grid so the logos span a second row that soaks up the column's
 * remaining height and sit at the bottom of the footer's first column. Both
 * logos are dark artwork, so each sits on a small white chip. */

.mt-footer-brand-block {
	display: grid;
	grid-template-columns: auto minmax(0, 1fr);
	grid-template-rows: auto 1fr;
	align-items: center;
	align-self: stretch;
	column-gap: var(--mt-footer-brand-block-gap);
	row-gap: var(--mt-space-md);
}

.mt-footer-brand-block__partners {
	grid-column: 1 / -1;
	align-self: end;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--mt-space-sm);
	margin: 0;
	padding: 0;
	list-style: none;
}

.mt-footer-brand-block__partner {
	display: inline-flex;
	align-items: center;
	padding: var(--mt-space-xs);
	background: #ffffff;
	border-radius: var(--mt-radius-sm);
}

.mt-footer-brand-block__partner img {
	display: block;
	height: 2.5rem;
	width: auto;
	max-width: 100%;
}

/* Footer stacks to a single column under 900px: the chips sit right below
   the crest + text, centered. */
@media (max-width: 900px) {
	.mt-footer-brand-block__partners {
		justify-content: center;
	}
}

/* --------------------------------------------------------------------------
   Projekti: funder/programme logos at the top of a project description.
   A project page that opens with the EU / ministry logos can wrap them in one
   wp:html block, a <ul class="mt-project-logos">, so they render as a compact
   row of white chips instead of full-width images (the <ul> also keeps the
   parent's content-gallery filter from grouping them as photos, and the
   child's card-image fallback skips them — inc/projekti-hub.php).
   -------------------------------------------------------------------------- */
.mt-project-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--mt-space-sm);
	margin: 0 0 var(--mt-space-lg);
	padding: 0;
	list-style: none;
}

.mt-project-logos li {
	display: inline-flex;
	align-items: center;
	margin: 0;
	padding: var(--mt-space-xs) var(--mt-space-sm);
	background: var(--mt-color-surface);
	border: 1px solid var(--mt-color-border);
	border-radius: var(--mt-radius-sm);
}

.mt-project-logos li::before,
.mt-project-logos li::marker {
	content: none;
}

.mt-project-logos img {
	display: block;
	width: auto;
	height: 3.5rem;
	max-width: 100%;
}
