/**
 * Visitor-facing fallback body — the listing, search results and 404 that
 * `index.php` renders when no Theme Builder template applies.
 *
 * Enqueued for EVERYONE by `index.php`. There is no editor variant: an editor
 * and a logged-out visitor get the same page, and the only difference between
 * them is the small badge from `editor-badge.css`. See `inc/fallback.php`.
 *
 * Deliberately NOT a design system. It is a readable column of results with the
 * plugin's brand tokens applied where they exist — anything more elaborate
 * starts competing with the Theme Builder, which is the thing this page exists
 * to tell you to go and use.
 *
 * Brand tokens come from the plugin's Colors tab on `:root`; the literals are
 * the plugin-absent fallback. Dark mode is honoured because the plugin sets
 * `html[data-tewido-theme="dark"]` site-wide, not just on canvas pages.
 */

/**
 * An Elementor-built singular view. No column, no padding — the built page owns
 * its own layout and every section in it is designed to reach the viewport
 * edge. Constraining it here letterboxes the whole design.
 *
 * It still gets `flex: 1 1 auto` so the sticky footer in `fallback-chrome.css`
 * keeps working on a short page.
 */
.tewido-elementra-theme-main--bare {
	position: relative;
	flex: 1 1 auto;
	width: 100%;
	min-width: 0;
}

.tewido-elementra-theme-main--content {
	--tewido-elementra-fb-text: var(--tewido-elementra-color-body, #474747);
	--tewido-elementra-fb-heading: var(--tewido-elementra-color-heading, #292929);
	--tewido-elementra-fb-accent: var(--tewido-elementra-color-primary, #93003f);
	--tewido-elementra-fb-muted: var(--tewido-elementra-color-gray-500, #6b7280);
	--tewido-elementra-fb-hairline: var(--tewido-elementra-color-gray-200, #e5e7eb);
	--tewido-elementra-fb-field: var(--tewido-elementra-color-surface, #ffffff);

	/* Containing block for the editor's corner ribbon. Harmless when no ribbon
	   renders, and cheaper than a `:has()` the visitor pays for. */
	position: relative;
	flex: 1 1 auto;
	width: 100%;

	/* The page gutter, and nothing else. The width cap lives on the inner
	   container below so it can track Elementor's Content Width; keeping both
	   on one element would mean the gutter shrank the content column instead
	   of sitting outside it. */
	padding: 48px 20px 64px;
	box-sizing: border-box;
	color: var(--tewido-elementra-fb-text);
	font-family: var(--tewido-elementra-font-body, inherit);
	font-size: 16px;
	line-height: 1.65;
}

/**
 * The content container.
 *
 * `--tewido-elementra-fb-content-width` is printed inline by
 * `inc/fallback.php`, read from the active Elementor kit's Content Width. It
 * has to be a variable rather than a literal: the moment an editor changes
 * Site Settings → Layout → Content Width, a hard-coded 1140px would put this
 * column on a different left edge from every Elementor section on the page.
 * The literal here is only the plugin-absent fallback, and it is Elementor's
 * own default rather than a preference of ours.
 */
.tewido-elementra-fb-container {
	width: 100%;
	max-width: var(--tewido-elementra-fb-content-width, 1140px);
	margin-inline: auto;
}

/* An Elementor-built page owns its own layout — no cap, no gutter. The
   container stays in the markup so the editor ribbon has a consistent home. */
.tewido-elementra-theme-main--bare > .tewido-elementra-fb-container {
	max-width: none;
}

/* -------------------------------------------------------------------
 *   Page head
 * ----------------------------------------------------------------- */

.tewido-elementra-fb-head {
	margin: 0 0 40px;
	padding: 0 0 20px;
	border-bottom: 1px solid var(--tewido-elementra-fb-hairline);
}

.tewido-elementra-fb-head__title {
	margin: 0;
	color: var(--tewido-elementra-fb-heading);
	font-family: var(--tewido-elementra-font-heading, inherit);
	font-size: clamp(26px, 3vw, 34px);
	font-weight: 700;
	line-height: 1.2;
	text-transform: capitalize;
	letter-spacing: -0.015em;
}

.tewido-elementra-fb-head__desc {
	margin: 12px 0 0;
	color: var(--tewido-elementra-fb-muted);
	font-size: 15px;
}

.tewido-elementra-fb-head__desc p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------
 *   Single entry — prose only
 *
 *   An Elementor-built entry never reaches these rules: it renders under
 *   `--bare`, outside this block's `--content` scope.
 * ----------------------------------------------------------------- */

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body > *:first-child {
	margin-top: 0;
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body > *:last-child {
	margin-bottom: 0;
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body p,
.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body ul,
.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body ol {
	margin: 0 0 1.25em;
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body h2,
.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body h3,
.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body h4 {
	margin: 1.8em 0 0.6em;
	color: var(--tewido-elementra-fb-heading);
	font-family: var(--tewido-elementra-font-heading, inherit);
	line-height: 1.3;
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body a {
	color: var(--tewido-elementra-fb-accent);
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body img {
	max-width: 100%;
	height: auto;
	border-radius: 8px;
}

.tewido-elementra-theme-main--content .tewido-elementra-fb-entry__body blockquote {
	margin: 1.5em 0;
	padding: 4px 0 4px 20px;
	border-left: 3px solid var(--tewido-elementra-fb-accent);
	color: var(--tewido-elementra-fb-muted);
}

/* -------------------------------------------------------------------
 *   Results
 * ----------------------------------------------------------------- */

.tewido-elementra-fb-list {
	display: grid;
	gap: 32px;
}

.tewido-elementra-fb-card {
	display: grid;
	grid-template-columns: 200px 1fr;
	gap: 24px;
	align-items: start;
	padding: 0 0 32px;
	border-bottom: 1px solid var(--tewido-elementra-fb-hairline);
}

.tewido-elementra-fb-card:last-child {
	padding-bottom: 0;
	border-bottom: 0;
}

/* No thumbnail — the body takes the full width rather than leaving a hole
   where the image would have been. */
.tewido-elementra-fb-card:not(:has(> .tewido-elementra-fb-card__media)) {
	grid-template-columns: 1fr;
}

.tewido-elementra-fb-card__media {
	display: block;
	overflow: hidden;
	border-radius: 10px;
	line-height: 0;
}

.tewido-elementra-fb-card__media img {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 4 / 3;
	object-fit: cover;
}

.tewido-elementra-fb-card__body {
	min-width: 0;
}

.tewido-elementra-fb-card__title {
	margin: 0 0 8px;
	font-family: var(--tewido-elementra-font-heading, inherit);
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.tewido-elementra-fb-card__title a {
	color: var(--tewido-elementra-fb-heading);
	text-decoration: none;
}

.tewido-elementra-fb-card__title a:hover,
.tewido-elementra-fb-card__title a:focus {
	color: var(--tewido-elementra-fb-accent);
}

.tewido-elementra-fb-card__title a:focus-visible {
	outline: 2px solid var(--tewido-elementra-fb-accent);
	outline-offset: 3px;
}

.tewido-elementra-fb-card__meta {
	margin: 0 0 10px;
	color: var(--tewido-elementra-fb-muted);
	font-size: 13px;
}

.tewido-elementra-fb-card__excerpt {
	margin: 0;
	font-size: 15px;
}

/* -------------------------------------------------------------------
 *   Empty state + 404
 * ----------------------------------------------------------------- */

.tewido-elementra-fb-empty {
	max-width: 520px;
	padding: 8px 0 0;
}

.tewido-elementra-fb-empty--404 {
	margin: 0 auto;
	text-align: center;
	padding-top: 32px;
}

.tewido-elementra-fb-empty--404 .tewido-elementra-fb-head__title {
	margin: 0 0 14px;
}

.tewido-elementra-fb-empty__text {
	margin: 0 0 24px;
	color: var(--tewido-elementra-fb-muted);
}

.tewido-elementra-fb-empty__home {
	margin: 20px 0 0;
}

.tewido-elementra-fb-empty__home a {
	color: var(--tewido-elementra-fb-accent);
	font-weight: 600;
	text-decoration: none;
	border-bottom: 1px solid currentColor;
}

/* -------------------------------------------------------------------
 *   Search form
 *
 *   Core's html5 search form, styled by element rather than by class — the
 *   markup comes from `get_search_form()` and carries only `.search-form`.
 * ----------------------------------------------------------------- */

.tewido-elementra-fb-empty .search-form {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.tewido-elementra-fb-empty .search-form label {
	flex: 1 1 200px;
	margin: 0;
}

.tewido-elementra-fb-empty .search-field {
	width: 100%;
	box-sizing: border-box;
	padding: 10px 14px;
	background: var(--tewido-elementra-fb-field);
	border: 1px solid var(--tewido-elementra-fb-hairline);
	border-radius: 8px;
	color: inherit;
	font: inherit;
	font-size: 15px;
}

.tewido-elementra-fb-empty .search-field:focus {
	border-color: var(--tewido-elementra-fb-accent);
	outline: 2px solid color-mix(in srgb, var(--tewido-elementra-fb-accent) 30%, transparent);
	outline-offset: 1px;
}

.tewido-elementra-fb-empty .search-submit {
	padding: 10px 20px;
	background: var(--tewido-elementra-fb-accent);
	border: 0;
	border-radius: 8px;
	color: #ffffff;
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	cursor: pointer;
}

.tewido-elementra-fb-empty .search-submit:hover,
.tewido-elementra-fb-empty .search-submit:focus {
	background: color-mix(in srgb, var(--tewido-elementra-fb-accent) 85%, black);
}

/* -------------------------------------------------------------------
 *   Pagination
 *
 *   `the_posts_pagination()` emits `.navigation.pagination` wrapping
 *   `.nav-links` with `.page-numbers` children.
 * ----------------------------------------------------------------- */

.tewido-elementra-fb-pagination {
	margin: 48px 0 0;
}

.tewido-elementra-fb-pagination .nav-links {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	align-items: center;
}

.tewido-elementra-fb-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	box-sizing: border-box;
	border: 1px solid var(--tewido-elementra-fb-hairline);
	border-radius: 8px;
	color: var(--tewido-elementra-fb-text);
	font-size: 15px;
	text-decoration: none;
}

.tewido-elementra-fb-pagination .page-numbers:hover,
.tewido-elementra-fb-pagination .page-numbers:focus {
	border-color: var(--tewido-elementra-fb-accent);
	color: var(--tewido-elementra-fb-accent);
}

.tewido-elementra-fb-pagination .page-numbers.current {
	background: var(--tewido-elementra-fb-accent);
	border-color: var(--tewido-elementra-fb-accent);
	color: #ffffff;
	font-weight: 600;
}

.tewido-elementra-fb-pagination .page-numbers.dots {
	border-color: transparent;
}

@media (max-width: 640px) {
	.tewido-elementra-theme-main--content {
		padding: 32px 20px 48px;
	}

	.tewido-elementra-fb-card {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.tewido-elementra-fb-card__media img {
		aspect-ratio: 16 / 9;
	}
}
