/* mercat.css — Mercat public page styles */


/* Tokens */
:root {
	--mercat-header-bg: var(--color-forest, #1b5e20);
	--mercat-dark-bg: var(--color-evergreen, #163f31);

	--mercat-max-width: 1440px;
	--mercat-gutter: 16px;
	--mercat-inner-pad: 12px;
	--mercat-section-pb: 16px;
	--pill-gap: 2px;
	--mercat-header-pt: 6px;
	--mercat-header-pb: 10px;
}

/* ------------------ Header / cover ------------------ */
.mercat-header {
	background-color: var(--mercat-header-bg);
	padding-top: var(--mercat-header-pt);
	padding-bottom: var(--mercat-header-pb);
}

/* Ensure spacing above breaking-news bar */
.breaking-news { margin-top: 8px; }

/* ── Breaking news / activity bar ───────────────────── */
.breaking-news {
	height: 40px;
	display: flex;
	align-items: center;
	padding: 0 16px;
	/* subtle variant of the site's forest color (very slightly lighter) */
	background: color-mix(in srgb, var(--color-forest, #04202C) 82%, white 18%);
	font-size: 14px;
	font-weight: 500;
	overflow: hidden;
	white-space: nowrap;
	text-overflow: ellipsis;
	box-shadow: 0 1px 0 rgba(0,0,0,0.05);
}

/* spacing below breaking-news before the carousel */
.breaking-news .bn-icon {
	margin-right: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	transition: transform 320ms ease-in-out;
	transform-origin: center;
	/* very light forest color for icon */
	color: color-mix(in srgb, var(--color-forest, #04202C) 18%, white 82%);
}
.breaking-news .bn-text {
	overflow: hidden;
	text-overflow: ellipsis;
	/* very light forest color for text */
	color: color-mix(in srgb, var(--color-forest, #04202C) 18%, white 82%);
}

/* Full-bleed: make the bar span the full viewport width regardless of container */
.breaking-news {
	position: relative;
	left: 50%;
	right: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	width: 100vw;
	box-sizing: border-box;
}

/* Animation classes toggled by JS */
.bn-exit { opacity: 0; transform: translateY(-10px); transition: opacity 360ms ease-in-out, transform 360ms ease-in-out; }
.bn-enter { opacity: 1; transform: translateY(0); transition: opacity 360ms ease-in-out, transform 360ms ease-in-out; }
	/* ------------------ Breaking news / activity bar ------------------ */
	/* Keep a small spacing above the bar and present it full-bleed */
	.breaking-news { margin-top: 8px; }
	.breaking-news {
	  height: 40px;
	  display: flex;
	  align-items: center;
	  padding: 0 16px;
	  /* subtle variant of the site's forest color (very slightly lighter) */
	  background: color-mix(in srgb, var(--color-forest, #04202C) 82%, white 18%);
	  font-size: 14px;
	  font-weight: 500;
	  overflow: hidden;
	  white-space: nowrap;
	  text-overflow: ellipsis;
	  box-shadow: 0 1px 0 rgba(0,0,0,0.05);
	  position: relative;
	  left: 50%;
	  right: 50%;
	  margin-left: -50vw;
	  margin-right: -50vw;
	  width: 100vw;
	  box-sizing: border-box;
	}
	.breaking-news .bn-icon {
	  margin-right: 8px;
	  display: inline-flex;
	  align-items: center;
	  justify-content: center;
	  transition: transform 320ms ease-in-out;
	  transform-origin: center;
	  color: color-mix(in srgb, var(--color-forest, #04202C) 18%, white 82%);
	}
	.breaking-news .bn-text {
	  overflow: hidden;
	  text-overflow: ellipsis;
	  color: color-mix(in srgb, var(--color-forest, #04202C) 18%, white 82%);
	}

	/* Animation classes toggled by JS */
	.bn-exit { opacity: 0; transform: translateY(-10px); transition: opacity 360ms ease-in-out, transform 360ms ease-in-out; }
	.bn-enter { opacity: 1; transform: translateY(0); transition: opacity 360ms ease-in-out, transform 360ms ease-in-out; }
	.bn-invisible { opacity: 0; transform: translateY(10px); }
	.breaking-news:focus { outline: 3px solid rgba(0,0,0,0.08); outline-offset: 2px; }

	/* ------------------ Sections / layout ------------------ */
	body .mercat-dark-section {
	  background-color: var(--mercat-dark-bg);
	  margin-top: 2rem;
	  margin-bottom: 0;
	  padding-bottom: var(--mercat-section-pb);
	}
	.is-mercat-root main { padding-bottom: 0; }
	.mercat-dark-section .mercat-pill-section { padding-bottom: 0; }
	.mercat-pill-section {
	  max-width: var(--mercat-max-width);
	  margin-inline: auto;
	  padding-inline: var(--mercat-gutter);
	  box-sizing: border-box;
	}
	.mercat-cards-section { --_h: var(--pill-card-img-h); }
	.mercat-cards-section .cards-row {
	  display: flex;
	  gap: var(--pill-gap);
	  overflow-x: auto;
	  padding: 6px var(--mercat-inner-pad) 0;
	  scrollbar-width: none;
	}
	.mercat-cards-section .cards-row::-webkit-scrollbar { display: none; }
	@media (max-width:480px) { .mercat-cards-section { --_h: 140px; } }

	/* ------------------ Utilities / Buttons ------------------ */
	.btn-pine {
	  background-color: var(--color-pine);
	  color: #fff;
	  border: none;
	  padding: 0.6rem 1.1rem;
	  border-radius: 9999px;
	  display: inline-block;
	  font-weight: 400;
	  text-decoration: none;
	}
	.btn-pine:hover { filter: brightness(0.95); }
	.btn-pine:focus { outline: 3px solid color-mix(in srgb, var(--color-pine) 20%, #000); outline-offset: 2px; }
	.stalls-desc { font-size: 0.95rem; padding-inline: 12px; }

	/* ------------------ Breaking-news modal (single, client-populated) ------------------ */
	/* Rounded modal with hero image and a pine titlebar */
	#breakingNewsModal { z-index: 2302 !important; }
	body.is-mercat-root #breakingNewsModal.modal.show { z-index: 10006 !important; }
	#breakingNewsModal + .modal-backdrop { z-index: 2300 !important; }
	#breakingNewsModal .modal-content { border-radius: 16px 16px 0 0; overflow: hidden; }

	/* Header stacks title above image */
	#breakingNewsModal .modal-header {
	  display: flex !important;
	  flex-direction: column !important;
	  align-items: stretch !important;
	  padding: 0 !important;
	  border-bottom: none;
	}

	/* Hero image (below title) */
	#breakingNewsModal .bn-modal-img {
	  width: 100%;
	  height: 220px;
	  object-fit: cover;
	  display: block;
	  border-top-left-radius: 0;
	  border-top-right-radius: 0;
	}

	#breakingNewsModal .modal-body { padding-top: 1rem; }

	#breakingNewsModal .btn-close {
	  position: absolute !important;
	  top: 12px !important;
	  right: 12px !important;
	  width: 40px;
	  height: 40px;
	  padding: 0;
	  border-radius: 50%;
	  background-color: rgba(255,255,255,0.92);
	  -webkit-backdrop-filter: blur(6px);
	  backdrop-filter: blur(6px);
	  border: 1px solid rgba(0,0,0,0.06);
	  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
	  background-repeat: no-repeat;
	  background-position: center;
	  background-size: 56%;
	  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><line x1='4' y1='4' x2='20' y2='20' stroke='%2304202C' stroke-width='2.6' stroke-linecap='round'/><line x1='20' y1='4' x2='4' y2='20' stroke='%2304202C' stroke-width='2.6' stroke-linecap='round'/></svg>");
	  color: transparent;
	  z-index: 10;
	}

	/* Close chip (aligned with publication date) */
	#breakingNewsModal .bn-close-chip {
	  display: inline-flex; align-items: center; gap: 8px;
	  padding: 6px 10px; border-radius: 9999px; border: 1px solid rgba(0,0,0,0.08);
	  background: rgba(91,112,101,0.06); color: var(--color-pine, #5B7065);
	  font-weight: 600; cursor: pointer; text-decoration: none;
	}
	#breakingNewsModal .bn-close-chip svg { display: block; }
	#breakingNewsModal .bn-close-chip:focus { outline: 3px solid rgba(91,112,101,0.18); outline-offset: 2px; }
	#breakingNewsModal .bn-close-chip:hover { background: rgba(91,112,101,0.10); }

	/* ───────────────────────────────────────────
	   "Com funciona el mercat digital" section
	─────────────────────────────────────────── */
	.cf-wrapper {
		padding: 0 12px 28px;
	}
	.cf-section {
		background: #eef2ee;
		border-radius: 16px;
		border: 0.5px solid #b2bab1;
		padding: 18px 14px 16px;
		text-align: center;
		box-shadow: 0 4px 12px rgba(0,0,0,0.12);
	}
	.cf-header {
		margin-bottom: 14px;
	}
	.cf-title {
		font-size: 1rem;
		font-weight: 700;
		color: var(--color-evergreen, #304040);
		margin-bottom: 2px;
		line-height: 1.2;
	}
	.cf-subtitle {
		font-size: 0.78rem;
		color: rgba(33,37,41,0.55);
		line-height: 1.3;
	}
	.cf-steps {
		display: flex;
		flex-direction: row;
		align-items: stretch;
		justify-content: center;
		gap: 8px;
		margin-bottom: 14px;
	}
	.cf-step {
		background: #fff;
		border-radius: 12px;
		border: 0.5px solid #b2bab1;
		padding: 12px 6px 10px;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 5px;
		flex: 1;
		min-width: 0;
	}
	.cf-step-num {
		font-size: 0.75rem;
		font-weight: 700;
		color: var(--color-pine, #5B7065);
		margin-right: 2px;
	}
	.cf-icon {
		font-size: 1.65rem;
		color: var(--color-evergreen, #304040);
		line-height: 1;
	}
	.cf-step-title {
		font-size: 0.85rem;
		font-weight: 700;
		color: var(--color-evergreen, #304040);
		line-height: 1.1;
	}
	.cf-step-desc {
		font-size: 0.7rem;
		color: rgba(33,37,41,0.55);
		line-height: 1.2;
		white-space: nowrap;
	}
	.cf-benefits {
		display: flex;
		flex-wrap: wrap;
		justify-content: center;
		gap: 6px;
	}
	.cf-benefit {
		font-size: 0.75rem;
		font-weight: 600;
		color: var(--color-pine, #5B7065);
		background: rgba(91,112,101,0.1);
		border-radius: 999px;
		padding: 4px 10px;
		display: inline-flex;
		align-items: center;
		gap: 4px;
		white-space: nowrap;
	}
	.cf-benefit::before {
		content: '✓';
		font-weight: 700;
		font-size: 0.75rem;
	}
	@media (min-width: 768px) {
		.cf-wrapper { padding: 0 24px 32px; }
		.cf-section { padding: 22px 20px 20px; }
		.cf-title { font-size: 1.1rem; }
		.cf-subtitle { font-size: 0.85rem; }
		.cf-steps { gap: 12px; }
		.cf-step { padding: 14px 10px 12px; }
		.cf-icon { font-size: 1.9rem; }
		.cf-step-title { font-size: 0.95rem; }
		.cf-step-desc { font-size: 0.8rem; }
		.cf-benefit { font-size: 0.82rem; }
	}

	/* Search history styles */
	.search-history { background: #fff; border-radius: 8px; padding: 8px; max-width: 720px; }
	.search-history .sh-header { padding-bottom: 4px; }
	.search-history #sh-list { border-top: 1px solid #e6e6e6; }
	.search-history .sh-item { height: 36px; display: flex; align-items: center; }
	.search-history .sh-item + .sh-item { border-top: 1px solid #e6e6e6; }
	.search-history .sh-query { text-decoration: none; color: inherit; }
	.search-history .sh-remove { width: 28px; height: 28px; padding: 0; line-height: 1; }
	.search-history .sh-ts { font-size: 0.75rem; color: #888; }

