/**
 * Front-end styles for the ROXOLNOK Elementor widgets: "Tartalom rács"
 * (ArchiveGridWidget), "Szűrő mező" (FilterFieldWidget), "Kereső mező"
 * (SearchFieldWidget) and "Kapcsolódó taxonómia-kártyák"
 * (RelatedTermsWidget). Deliberately minimal — a grid, a card shell, a
 * plain filter/search field — so the site's own Elementor layout/theme
 * styling carries the actual visual design. The "webshop" two-column
 * look (filters left, grid right) comes entirely from Elementor's own
 * Section/Container layout — placing "Szűrő mező"/"Kereső mező" widgets
 * in one column and a "Tartalom rács" in the other — not from a layout
 * option baked into these widgets.
 */

/*
 * CSS Grid, deliberately not flexbox: `repeat(N, 1fr)` always creates N
 * equal-width tracks spanning the row — regardless of how many items
 * actually exist — and `fr` tracks are defined to divide the space that
 * remains *after* `gap` is subtracted, with zero `calc()` needed. A lone
 * card auto-places into track 1 and stays at exactly 1/N width; tracks
 * 2..N simply render empty, the card never stretches to fill them. (An
 * earlier flexbox + `calc(... / var(...))` version of this rule depended
 * on calc() dividing by a value substituted through nested `var()`,
 * which is valid per spec but has a history of inconsistent support —
 * grid's own `fr` unit needs none of that arithmetic.)
 */
.rxcm-related-terms__title,
.rxcm-featured-items__title,
.rxcm-related-posts__title {
	margin: 0 0 0.8rem;
	font-weight: 700;
	font-size: 1.1rem;
}

/*
 * Shown only inside the Elementor editor/preview (RelatedTermsWidget::/
 * FeaturedItemsWidget::/RelatedPostsWidget::/RepeaterFieldWidget::
 * renderEditNotice()) when there is nothing to render because of a
 * config problem — e.g. no real post context (editing a Theme Builder
 * template directly), an invalid post type/taxonomy, or
 * (RelatedTermsWidget/RelatedPostsWidget/RepeaterFieldWidget) the
 * current post has no term/linked post/repeater row assigned. Never
 * reaches real site visitors.
 */
.rxcm-editor-notice {
	margin: 0;
	padding: 1rem 1.2rem;
	background: rgba(196, 30, 30, 0.06);
	border: 1px dashed rgba(196, 30, 30, 0.4);
	color: inherit;
	font-size: 0.9rem;
}

.rxcm-archive-grid__items,
.rxcm-related-terms,
.rxcm-featured-items,
.rxcm-related-posts,
.rxcm-taxonomy-archive__grid {
	display: grid;
	grid-template-columns: repeat(var(--rxcm-archive-columns, 3), 1fr);
	gap: var(--rxcm-archive-gap, 24px);
}

@media (max-width: 782px) {
	.rxcm-archive-grid__items,
	.rxcm-related-terms,
	.rxcm-featured-items,
	.rxcm-related-posts,
	.rxcm-taxonomy-archive__grid {
		grid-template-columns: repeat(2, 1fr);
	}
}

@media (max-width: 480px) {
	.rxcm-archive-grid__items,
	.rxcm-related-terms,
	.rxcm-featured-items,
	.rxcm-related-posts,
	.rxcm-taxonomy-archive__grid {
		grid-template-columns: 1fr;
	}
}

.rxcm-featured-items__empty {
	opacity: 0.75;
	padding: 1.5rem 0;
	text-align: center;
}

.rxcm-archive-grid.is-loading .rxcm-archive-grid__items {
	opacity: 0.5;
	pointer-events: none;
}

/*
 * "ROXOLNOK: Taxonómia archívum" — one titled section per post type the
 * current taxonomy term is attached to (e.g. "Rocktörténetek",
 * "Hanganyagok"), each its own `.rxcm-taxonomy-archive__grid` reusing
 * the shared grid rule above. `:last-child` zeroes the trailing
 * `margin-bottom` the widget's own "Szekciók közötti térköz" Style
 * control sets, so the widget never leaves dangling empty space below
 * its last section regardless of what that spacing value is.
 */
.rxcm-taxonomy-archive__section:last-child {
	margin-bottom: 0 !important;
}

.rxcm-taxonomy-archive__section-title {
	margin: 0 0 1rem;
	font-size: 1.4rem;
	font-weight: 700;
}

.rxcm-archive-card {
	display: block;
	color: inherit;
	text-decoration: none;
	border: 1px solid rgba(0, 0, 0, 0.12);
	border-radius: 8px;
	overflow: hidden;
	transition: box-shadow 0.15s ease;
}

.rxcm-archive-card:hover,
.rxcm-archive-card:focus-visible {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.rxcm-archive-card__media {
	position: relative;
}

.rxcm-archive-card__media img {
	width: 100%;
	height: auto;
	display: block;
	aspect-ratio: var(--rxcm-card-image-ratio, 4 / 3);
	object-fit: cover;
}

/*
 * Positioning only — background/text color, border-radius, padding and
 * typography all come from ArchiveGridWidget's "Kiemelt tulajdonság"
 * Style controls (Elementor generates that per-instance CSS with
 * sensible defaults already matching this), so none of that is
 * hardcoded here. One card can carry *several* badges at once now (every
 * term assigned in the highlighted taxonomy, not just the first) — the
 * per-position placement rules below live on a `__highlight-group`
 * (`overlay-*`) or `__highlight-row` (`above-*`/`below-*`) wrapper, not
 * on the individual `__highlight` spans, so however many badges exist
 * they stack/wrap together as one group instead of landing on top of
 * each other at the exact same absolute position.
 */
.rxcm-archive-card__highlight {
	display: inline-block;
	white-space: nowrap;
	line-height: 1.2;
}

.rxcm-archive-card__highlight-group {
	position: absolute;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rxcm-archive-card__highlight-group--overlay-top-left,
.rxcm-archive-card__highlight-group--overlay-top-center,
.rxcm-archive-card__highlight-group--overlay-top-right {
	top: 10px;
}

.rxcm-archive-card__highlight-group--overlay-bottom-left,
.rxcm-archive-card__highlight-group--overlay-bottom-center,
.rxcm-archive-card__highlight-group--overlay-bottom-right {
	bottom: 10px;
}

.rxcm-archive-card__highlight-group--overlay-top-left,
.rxcm-archive-card__highlight-group--overlay-bottom-left {
	left: 10px;
	align-items: flex-start;
}

.rxcm-archive-card__highlight-group--overlay-top-right,
.rxcm-archive-card__highlight-group--overlay-bottom-right {
	right: 10px;
	align-items: flex-end;
}

.rxcm-archive-card__highlight-group--overlay-top-center,
.rxcm-archive-card__highlight-group--overlay-bottom-center {
	left: 50%;
	transform: translateX(-50%);
	align-items: center;
}

.rxcm-archive-card__highlight-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	padding: 0.6rem 1rem 0;
}

.rxcm-archive-card__highlight-row--above-left,
.rxcm-archive-card__highlight-row--below-left {
	justify-content: flex-start;
}

.rxcm-archive-card__highlight-row--above-center,
.rxcm-archive-card__highlight-row--below-center {
	justify-content: center;
}

.rxcm-archive-card__highlight-row--above-right,
.rxcm-archive-card__highlight-row--below-right {
	justify-content: flex-end;
}

/*
 * `--full`: a single badge spans the whole row, as before; several
 * split it into equal-width segments (`flex: 1 1 0` on each) rather
 * than each one claiming the full width and overlapping the others.
 */
.rxcm-archive-card__highlight-row--above-full .rxcm-archive-card__highlight,
.rxcm-archive-card__highlight-row--below-full .rxcm-archive-card__highlight {
	flex: 1 1 0;
	text-align: center;
}

.rxcm-archive-card__body {
	padding: 1rem;
}

.rxcm-archive-card__title {
	margin: 0 0 0.4em;
	font-size: 1.05rem;
	line-height: 1.3;
}

.rxcm-archive-card__excerpt {
	margin: 0;
	font-size: 0.9rem;
	opacity: 0.8;
}

/*
 * `card_layout` option (FeaturedItemsWidget): `top` (default) needs no
 * class — the plain `display: block` flow above already stacks
 * media → body(title, excerpt) vertically. `row`/`side` only apply once
 * a modifier class is present, so every other widget sharing this
 * markup (ArchiveGridWidget, RelatedTermsWidget, ArchiveFilterController)
 * is completely unaffected. `.rxcm-archive-card__body` becomes
 * `display: contents` in both variants so `__title`/`__excerpt` (its
 * children) can be positioned as independent grid items — `:last-child`
 * below still matches against the real DOM, not the generated boxes, so
 * it correctly targets the title when there is no excerpt to render.
 *
 * `--rxcm-card-image-size`/`--rxcm-card-image-ratio` (FeaturedItemsWidget
 * Style tab "Kép" section, `{{WRAPPER}} .rxcm-featured-items` selectors)
 * are plain CSS custom properties, inherited down to whichever rule
 * below reads them — unset anywhere else, so every `var(..., fallback)`
 * below simply keeps its fallback for every other widget.
 */
.rxcm-archive-card--layout-row,
.rxcm-archive-card--layout-side {
	display: grid;
}

.rxcm-archive-card--layout-row .rxcm-archive-card__body,
.rxcm-archive-card--layout-side .rxcm-archive-card__body {
	display: contents;
}

.rxcm-archive-card--layout-row {
	grid-template-columns: auto 1fr;
	grid-template-areas: "media title" "excerpt excerpt";
	align-items: center;
}

.rxcm-archive-card--layout-row .rxcm-archive-card__media {
	grid-area: media;
	width: var(--rxcm-card-image-size, 96px);
	margin: 1rem 0 1rem 1rem;
}

.rxcm-archive-card--layout-row .rxcm-archive-card__media img {
	aspect-ratio: var(--rxcm-card-image-ratio, 1 / 1);
	border-radius: 6px;
}

.rxcm-archive-card--layout-row .rxcm-archive-card__title {
	grid-area: title;
	margin: 1rem 1rem 1rem 0.8rem;
}

.rxcm-archive-card--layout-row .rxcm-archive-card__excerpt {
	grid-area: excerpt;
	margin: 0 1rem 1rem;
}

.rxcm-archive-card--layout-side {
	grid-template-columns: var(--rxcm-card-image-size, minmax(110px, 35%)) 1fr;
	grid-template-areas: "media title" "media excerpt";
}

.rxcm-archive-card--layout-side .rxcm-archive-card__media {
	grid-area: media;
	height: 100%;
}

.rxcm-archive-card--layout-side .rxcm-archive-card__media img {
	height: 100%;
	aspect-ratio: auto;
}

.rxcm-archive-card--layout-side .rxcm-archive-card__title {
	grid-area: title;
	align-self: end;
	margin: 1rem 1rem 0.4em;
}

.rxcm-archive-card--layout-side .rxcm-archive-card__title:last-child {
	align-self: center;
}

.rxcm-archive-card--layout-side .rxcm-archive-card__excerpt {
	grid-area: excerpt;
	align-self: start;
	margin: 0 1rem 1rem;
}

.rxcm-archive-grid__pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin: 2rem 0 0;
}

.rxcm-archive-grid__pager button {
	padding: 0.5em 1.1em;
	cursor: pointer;
}

.rxcm-archive-grid__pager button:disabled {
	opacity: 0.4;
	cursor: default;
}

.rxcm-archive-grid__page-status {
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.rxcm-archive-grid__pager[hidden],
.rxcm-archive-grid__empty[hidden] {
	display: none;
}

.rxcm-archive-grid__empty {
	opacity: 0.75;
	padding: 2rem 0;
	text-align: center;
}

/* Filter field widget — one instance per taxonomy. */
.rxcm-filter-field {
	margin: 0 0 1.75rem;
}

.rxcm-filter-field__label {
	display: block;
	font-weight: 700;
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 0 0 0.6rem;
	padding: 0;
}

.rxcm-filter-field__group {
	margin: 0;
	padding: 0;
	border: none;
}

.rxcm-filter-field__select {
	width: 100%;
	padding: 0.5em 0.75em;
}

.rxcm-filter-field__option {
	display: flex;
	align-items: center;
	gap: 0.5em;
	padding: 0.3em 0;
	cursor: pointer;
	font-size: 0.94rem;
}

.rxcm-filter-field__checkbox {
	margin: 0;
}

.rxcm-filter-field__option-label {
	flex: 1 1 auto;
}

/*
 * "Sor végén" count style: `margin-left: auto` on a flex child pushes it
 * to the far end of the row — the checkbox + label stay bunched left,
 * the count sits flush right, matching the approved mockup's "Népszerű
 * témák" list. Background/radius/typography come from the widget's own
 * Style controls (`{{WRAPPER}} .rxcm-filter-field__option-count`).
 */
.rxcm-filter-field__option-count {
	margin-left: auto;
	padding: 0.05em 0.5em;
	font-size: 0.85em;
	font-variant-numeric: tabular-nums;
	opacity: 0.7;
}

/*
 * Search field widget. `.rxcm-search-field` is explicitly a column flex
 * container — not relying on the <form>'s default block flow — so the
 * title always stacks above the input+button row regardless of any
 * flex/grid context a theme or Elementor container might otherwise leak
 * onto it.
 */
.rxcm-search-field {
	display: flex;
	flex-direction: column;
	margin: 0 0 1.75rem;
}

.rxcm-search-field__title {
	display: block;
	width: 100%;
	font-weight: 700;
	font-size: 0.9rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	margin: 0 0 0.6rem;
	padding: 0;
}

.rxcm-search-field__row {
	display: flex;
	flex-direction: row;
	gap: 0.5rem;
}

.rxcm-search-field__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 0.5em 0.75em;
}

.rxcm-search-field__submit {
	flex: 0 0 auto;
	padding: 0.5em 1.1em;
	cursor: pointer;
}

.rxcm-search-field__submit--icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.5em;
}

.rxcm-search-field__submit--icon i,
.rxcm-search-field__submit--icon svg {
	font-size: 16px;
	width: 16px;
	height: 16px;
}

/* Visually hidden but still available to assistive tech — used for the
 * search field's <label>, since the visible cue is the submit button. */
.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/*
 * "ROXOLNOK: Ismétlődő mező lista" widget (RepeaterFieldWidget) — a
 * generic label/value list for any repeater field's rows, deliberately
 * plain (no card/grid chrome) since it has to look reasonable for any
 * field shape, from a two-column "Típus + Szöveg" list to a longer
 * multi-field row.
 */
.rxcm-repeater-list__title {
	margin: 0 0 0.8rem;
	font-weight: 700;
	font-size: 1.1rem;
}

.rxcm-repeater-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: var(--rxcm-repeater-row-gap, 0px);
}

.rxcm-repeater-list__row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem 1.5rem;
	padding: 0.9rem 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.rxcm-repeater-list__row:last-child {
	border-bottom: 0;
}

.rxcm-repeater-list__field {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.rxcm-repeater-list__field-label {
	font-size: 0.8rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	opacity: 0.65;
}

.rxcm-repeater-list__field-value img {
	display: block;
	border-radius: 4px;
}
