/*
 * Content templates — 404 page and search results (informational pages join
 * later; see tasks/phase-4-content.md). Loaded only where its markup renders
 * (inc/content.php). The search form itself reuses the `.j2e-search` styles
 * from header.css, which loads site-wide.
 */

/* The article spans full width (the upsell grid needs it); the message,
   search, and links stay a centered narrow column. */
.error404 .inside-article {
	padding-block: clamp(2rem, 6vw, 4rem);
	text-align: center;
}

.error404 .entry-header,
.error404 .entry-content,
.error404 .j2e-content-links {
	max-width: 40rem;
	margin-inline: auto;
}

.error404 .entry-title {
	color: var(--j2e-heading-1);
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	margin-bottom: 0.75em;
}

.error404 .entry-content > p {
	color: var(--j2e-gray-text);
	font-size: 1.05rem;
}

/* Shared: the reused header-search pill, centered with room to breathe.
   Rendered on the 404 and both empty search states. Wider than the plain
   header pill: it carries the category segment. */
.j2e-content-search {
	margin: 1.5rem auto 0;
	max-width: 34rem;
}

.j2e-content-search .j2e-search {
	border: 1px solid var(--j2e-purple-border-soft);
}

/* Category filter — a select rendered as the pill's right segment (divider
   left, chevron right). The open dropdown stays OS-native by design: no JS
   to own, accessible out of the box. GP's element styles are outranked by
   the `.j2e-search` prefix, same trick as the field. */
.j2e-search .j2e-search__cat {
	flex: 0 1 auto;
	max-width: 40%;
	margin: 0;
	padding: 0.35rem 1.7rem 0.35rem 0.8rem;
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--j2e-gray-text);
	background-color: transparent;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='none' stroke='%23666' stroke-width='1.5' stroke-linecap='round' d='m1 1 4 4 4-4'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.7rem center;
	border: 0;
	border-left: 1px solid var(--j2e-border);
	border-radius: 0 999px 999px 0;
	appearance: none;
	-webkit-appearance: none;
	cursor: pointer;
	text-overflow: ellipsis;
	white-space: nowrap;
	overflow: hidden;
}

.j2e-search .j2e-search__cat:hover,
.j2e-search .j2e-search__cat:focus {
	color: var(--j2e-purple);
}

.j2e-search .j2e-search__cat:focus-visible {
	outline: 2px solid var(--j2e-purple);
	outline-offset: -2px;
}

/* Shared: the Front page / Shop / Contact pill links. */
.j2e-content-links {
	margin-top: 2rem;
}

.j2e-content-links ul {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 0.75rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.j2e-content-links a {
	display: inline-block;
	padding: 0.55em 1.4em;
	border-radius: 999px;
	background: var(--j2e-purple);
	color: var(--j2e-nav-text);
	text-decoration: none;
}

.j2e-content-links a:hover,
.j2e-content-links a:focus {
	background: var(--j2e-purple-hover);
	color: var(--j2e-nav-text);
}

.j2e-content-links a:focus-visible {
	outline: 2px solid var(--j2e-purple-dark);
	outline-offset: 2px;
}

/*
 * Generic search results (`?s=` without post_type — old links, hand-typed
 * URLs; every site search form is product-scoped and renders through the Woo
 * archive instead). GP outputs title + medium featured image + excerpt per
 * entry; lay each out as a compact media-object row.
 */

/* Product searches also carry `search-results` (plus `woocommerce`) on body —
   their heading is styled by the Woo archive sheet, so scope these to the
   generic list only. */
.search-results:not(.woocommerce) .page-header {
	margin-bottom: 1.5rem;
}

.search-results:not(.woocommerce) .page-title {
	color: var(--j2e-heading-1);
	font-size: clamp(1.4rem, 3.5vw, 1.9rem);
}

.search-results article .inside-article {
	display: grid;
	grid-template-columns: minmax(90px, 150px) 1fr;
	grid-template-areas:
		"image header"
		"image summary";
	column-gap: 1.25rem;
	align-items: start;
	padding-block: 1.25rem;
	border-bottom: 1px solid var(--j2e-border);
}

.search-results article .entry-header {
	grid-area: header;
}

.search-results article .post-image {
	grid-area: image;
	margin: 0;
}

.search-results article .post-image img {
	display: block;
	width: 100%;
	height: auto;
	border: 1px solid var(--j2e-border);
	border-radius: 4px;
	background: var(--j2e-bg);
}

.search-results article .entry-summary {
	grid-area: summary;
	color: var(--j2e-gray-text);
	margin-top: 0.4rem;
}

/* No image → single column, text spans the row. */
.search-results article .inside-article:not(:has(.post-image)) {
	grid-template-columns: 1fr;
	grid-template-areas:
		"header"
		"summary";
}

.search-results article .entry-title {
	font-size: 1.15rem;
	margin: 0;
}

.search-results article .entry-title a {
	color: var(--j2e-link);
	text-decoration: none;
}

.search-results article .entry-title a:hover,
.search-results article .entry-title a:focus {
	color: var(--j2e-link-hover);
	text-decoration: underline;
}

/* Empty state (GP's no-results box) — center the message with the search
   pill and links beneath. Woo's no-products state needs no extra rule: the
   pill and links blocks center themselves. */
.search-results .no-results .inside-article {
	text-align: center;
}

@media (max-width: 600px) {
	.search-results article .inside-article {
		grid-template-columns: minmax(70px, 90px) 1fr;
	}
}

/* Latest-products upsell grid (404 + empty search states). The cards
   themselves are styled by the Woo product-grid sheet; this just frames the
   section. Card text alignment is reset because the 404/no-results contexts
   center their text. */
.j2e-latest-products {
	margin-top: clamp(2.5rem, 6vw, 4rem);
	text-align: initial;
}

.j2e-latest-products__title {
	color: var(--j2e-heading-2);
	font-size: clamp(1.25rem, 3vw, 1.6rem);
	margin-bottom: 1rem;
	padding-top: 1.25rem;
	border-top: 1px solid var(--j2e-border);
	text-align: center;
}

/* Contact form ([just2euro_contact_form], inc/content/contact-form.php).
   Labels always visible above the fields, full-width inputs at a readable
   measure, brand-gray button matching the Woo buttons, cyan focus ring. */
.j2e-contact-form {
	max-width: 40rem;
}

.j2e-contact-form__field {
	margin: 0 0 1.25rem;
}

.j2e-contact-form__field label {
	display: block;
	margin-bottom: 0.35rem;
	font-weight: 600;
	color: var(--j2e-heading-3);
}

.j2e-contact-form__field input,
.j2e-contact-form__field textarea {
	display: block;
	width: 100%;
	padding: 0.6rem 0.75rem;
	font-size: 1rem;
	color: var(--j2e-text);
	background-color: var(--j2e-bg);
	border: 1px solid var(--j2e-field-border);
	border-radius: 5px;
}

.j2e-contact-form__field textarea {
	min-height: 10rem;
	resize: vertical;
}

.j2e-contact-form__field input:focus-visible,
.j2e-contact-form__field textarea:focus-visible,
.j2e-contact-form__submit:focus-visible {
	outline: 2px solid var(--j2e-cyan);
	outline-offset: 2px;
}

.j2e-contact-form__field--error input,
.j2e-contact-form__field--error textarea {
	border-color: var(--j2e-error);
}

.j2e-contact-form__error {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.9rem;
	color: var(--j2e-error);
}

.j2e-contact-form__notice {
	margin-bottom: 1.25rem;
	padding: 0.75rem 1rem;
	color: var(--j2e-error-text);
	background-color: var(--j2e-error-bg);
	border-left: 4px solid var(--j2e-error);
}

.j2e-contact-form__notice p,
.j2e-contact-form--sent p {
	margin: 0;
}

.j2e-contact-form--sent {
	padding: 1rem 1.25rem;
	color: var(--j2e-success);
	background-color: var(--j2e-success-bg);
	border-left: 4px solid var(--j2e-success);
}

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.j2e-contact-form__hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.j2e-contact-form__actions {
	margin: 0;
}

.j2e-contact-form__submit {
	padding: 0.7rem 1.6rem;
	font-size: 1rem;
	font-weight: 600;
	color: var(--j2e-gray-text);
	background-color: var(--j2e-gray-light);
	border: 0;
	border-radius: 5px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.j2e-contact-form__submit:hover,
.j2e-contact-form__submit:focus {
	color: var(--j2e-gray-text);
	background-color: var(--j2e-gray-hover);
}
