/**
 * Community directory: the tab strip and the vendor cards on /community/.
 *
 * Every rule is scoped under .hec-comm so it outranks the Elementor kit's
 * (0,1,1) element rules, as in club-months.css. Colours are the page's own:
 * deep green ink, mauve accent (darkened to #7A4A79 for small text so it
 * meets WCAG AA on white). Logical properties throughout: the page is RTL.
 *
 * Columns follow the width of the panels (a container query), not the
 * screen, so the grid adapts if the Elementor section is made full-width.
 */

.hec-comm {
	--hec-comm-ink: #3C4F45;
	--hec-comm-muted: #617067;
	--hec-comm-accent: #7A4A79;
	--hec-comm-heading: #A676A5;
	--hec-comm-pill-bg: #F3E9F3;
	--hec-comm-line: #DDE2DC;
	--hec-comm-ground: #F8F8F6;
	--hec-comm-surface: #FFFFFF;
	--hec-comm-radius: 16px;
	--hec-comm-gap: 20px;
	--hec-comm-shadow: 0 1px 2px rgba(60, 79, 69, 0.06), 0 6px 20px rgba(60, 79, 69, 0.08);
	--hec-comm-shadow-lift: 0 2px 4px rgba(60, 79, 69, 0.08), 0 14px 30px rgba(60, 79, 69, 0.14);

	/* The page body uses the theme's system stack; Elementor applies the site
	   font per widget, so the component sets it itself. Headings keep Amatic SC. */
	font-family: "Noto Sans Hebrew", sans-serif;
	color: var(--hec-comm-ink);
}

.hec-comm *,
.hec-comm *::before,
.hec-comm *::after {
	box-sizing: border-box;
}

/* ---------- Tab strip ---------- */

.hec-comm .hec-comm__tabs {
	position: sticky;
	top: var(--hec-comm-sticky-top, 0px);
	z-index: 20;
	margin-block-end: 28px;
	padding-block: 10px;
	background: rgba(255, 255, 255, 0.94);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
	border-block-end: 1px solid var(--hec-comm-line);
}

/* Logged-in visitors have the fixed admin bar on top (32px; 46px on tablets;
   not fixed at 600px and below). */
body.admin-bar .hec-comm .hec-comm__tabs {
	top: calc(var(--hec-comm-sticky-top, 0px) + 32px);
}

@media (max-width: 782px) {
	body.admin-bar .hec-comm .hec-comm__tabs {
		top: calc(var(--hec-comm-sticky-top, 0px) + 46px);
	}
}

@media (max-width: 600px) {
	body.admin-bar .hec-comm .hec-comm__tabs {
		top: var(--hec-comm-sticky-top, 0px);
	}
}

.hec-comm .hec-comm__track {
	display: flex;
	gap: 8px;
	overflow-x: auto;
	padding: 2px;
	scroll-snap-type: x proximity;
	scrollbar-width: none;
	-webkit-overflow-scrolling: touch;
}

.hec-comm .hec-comm__track::-webkit-scrollbar {
	display: none;
}

.hec-comm .hec-comm__tab {
	flex: 0 0 auto;
	padding: 9px 18px;
	border: 1px solid var(--hec-comm-line);
	border-radius: 999px;
	background: var(--hec-comm-surface);
	color: var(--hec-comm-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	scroll-snap-align: start;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.hec-comm .hec-comm__tab:hover {
	border-color: var(--hec-comm-ink);
	color: var(--hec-comm-ink);
}

.hec-comm .hec-comm__tab[aria-current="page"] {
	border-color: var(--hec-comm-ink);
	background: var(--hec-comm-ink);
	color: #FFFFFF;
}

.hec-comm .hec-comm__tab:focus-visible {
	outline: 2px solid var(--hec-comm-accent);
	outline-offset: 2px;
}

/* Arrows for a mouse, added by community.js: a mouse has no sideways scroll
   and the strip's scrollbar is hidden. Each shows only while tabs are hidden
   on its side (data-more-start / data-more-end on the strip), over a fade.
   The page is RTL, so the start side is the right: the fades run from
   there inwards. Touch screens keep the plain swipe. */
.hec-comm .hec-comm__arrow {
	display: none;
	position: absolute;
	inset-block: 0;
	z-index: 1;
	align-items: center;
	width: 72px;
	margin: 0;
	padding: 0 6px;
	border: 0;
	border-radius: 0;
	cursor: pointer;
}

.hec-comm .hec-comm__arrow--start {
	inset-inline-start: 0;
	justify-content: flex-start;
}

.hec-comm .hec-comm__arrow--end {
	inset-inline-end: 0;
	justify-content: flex-end;
}

/* The theme reset paints every button:hover and :focus #c36 (pink-red);
   the states are listed so the fade holds. */
.hec-comm .hec-comm__arrow--start,
.hec-comm .hec-comm__arrow--start:hover,
.hec-comm .hec-comm__arrow--start:focus {
	background: linear-gradient(to left, #FFFFFF 45%, rgba(255, 255, 255, 0));
	color: var(--hec-comm-ink);
	outline: none;
}

.hec-comm .hec-comm__arrow--end,
.hec-comm .hec-comm__arrow--end:hover,
.hec-comm .hec-comm__arrow--end:focus {
	background: linear-gradient(to right, #FFFFFF 45%, rgba(255, 255, 255, 0));
	color: var(--hec-comm-ink);
	outline: none;
}

.hec-comm .hec-comm__arrow span {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: 1px solid var(--hec-comm-line);
	border-radius: 50%;
	background: var(--hec-comm-surface);
	box-shadow: var(--hec-comm-shadow);
	color: var(--hec-comm-ink);
	transition: border-color 0.15s ease;
}

.hec-comm .hec-comm__arrow:hover span {
	border-color: var(--hec-comm-ink);
}

.hec-comm .hec-comm__arrow svg {
	width: 18px;
	height: 18px;
}

@media (hover: hover) and (pointer: fine) {
	/* Snapping would pull a tab the script reveals back under an arrow. */
	.hec-comm .hec-comm__track {
		scroll-snap-type: none;
	}

	.hec-comm .hec-comm__tabs[data-more-start] .hec-comm__arrow--start,
	.hec-comm .hec-comm__tabs[data-more-end] .hec-comm__arrow--end {
		display: flex;
	}
}

/* ---------- Panels and grids ---------- */

.hec-comm .hec-comm__panels {
	container-type: inline-size;
	container-name: hec-comm;
}

.hec-comm .hec-comm__section {
	margin-block-end: 56px;
}

.hec-comm .hec-comm__section[hidden] {
	display: none;
}

.hec-comm .hec-comm__heading {
	margin: 0 0 22px;
	color: var(--hec-comm-heading);
	font-family: "Amatic SC", cursive;
	font-size: clamp(38px, 6vw, 54px);
	font-weight: 700;
	line-height: 1.05;
	text-align: center;
}

.hec-comm .hec-comm__section--cards .hec-comm__heading {
	margin-block-end: 26px;
}

.hec-comm .hec-comm__section--tiles .hec-comm__grid {
	max-inline-size: 1100px;
	margin-inline: auto;
}

.hec-comm .hec-comm__grid {
	display: grid;
	gap: var(--hec-comm-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.hec-comm .hec-comm__grid--cards {
	grid-template-columns: minmax(0, 1fr);
}

.hec-comm .hec-comm__grid--tiles {
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 28px 20px;
}

.hec-comm .hec-comm__item {
	display: flex;
	margin: 0;
	padding: 0;
}

@container hec-comm (min-width: 520px) {
	.hec-comm .hec-comm__grid--cards {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.hec-comm .hec-comm__grid--tiles {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

@container hec-comm (min-width: 800px) {
	.hec-comm .hec-comm__grid--cards {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}

	.hec-comm .hec-comm__grid--tiles {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@container hec-comm (min-width: 1100px) {
	.hec-comm .hec-comm__grid--cards {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}

	.hec-comm .hec-comm__grid--tiles {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}
}

@container hec-comm (min-width: 1400px) {
	.hec-comm .hec-comm__grid--cards {
		grid-template-columns: repeat(5, minmax(0, 1fr));
	}

	.hec-comm .hec-comm__grid--tiles {
		grid-template-columns: repeat(6, minmax(0, 1fr));
	}
}

/* Browsers without container queries size by the viewport instead. */
@supports not (container-type: inline-size) {
	@media (min-width: 520px) {
		.hec-comm .hec-comm__grid--cards {
			grid-template-columns: repeat(2, minmax(0, 1fr));
		}

		.hec-comm .hec-comm__grid--tiles {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}
	}

	@media (min-width: 800px) {
		.hec-comm .hec-comm__grid--cards {
			grid-template-columns: repeat(3, minmax(0, 1fr));
		}

		.hec-comm .hec-comm__grid--tiles {
			grid-template-columns: repeat(4, minmax(0, 1fr));
		}
	}

	@media (min-width: 1100px) {
		.hec-comm .hec-comm__grid--cards {
			grid-template-columns: repeat(4, minmax(0, 1fr));
		}

		.hec-comm .hec-comm__grid--tiles {
			grid-template-columns: repeat(5, minmax(0, 1fr));
		}
	}
}

/* ---------- Cards ---------- */

.hec-comm .hec-comm-card {
	position: relative;
	display: flex;
	flex-direction: column;
	inline-size: 100%;
	border-radius: var(--hec-comm-radius);
	background: var(--hec-comm-surface);
	box-shadow: var(--hec-comm-shadow);
	color: inherit;
	text-decoration: none;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hec-comm a.hec-comm-card:hover {
	transform: translateY(-3px);
	box-shadow: var(--hec-comm-shadow-lift);
	color: inherit;
}

.hec-comm a.hec-comm-card:focus-visible {
	transform: translateY(-3px);
	box-shadow: var(--hec-comm-shadow-lift);
	outline: 3px solid var(--hec-comm-accent);
	outline-offset: 3px;
}

.hec-comm .hec-comm-card--static {
	cursor: default;
}

.hec-comm .hec-comm-card__badge {
	position: absolute;
	top: -10px;
	inset-inline-end: -8px;
	z-index: 2;
	inline-size: 72px;
	block-size: auto;
	margin: 0;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
	pointer-events: none;
}

.hec-comm .hec-comm-card__media {
	display: block;
	aspect-ratio: 3 / 2;
	overflow: hidden;
	border-radius: var(--hec-comm-radius) var(--hec-comm-radius) 0 0;
	background: var(--hec-comm-ground);
}

.hec-comm .hec-comm-card__media img {
	display: block;
	inline-size: 100%;
	max-inline-size: none;
	block-size: 100%;
	margin: 0;
	border-radius: 0;
	object-fit: cover;
}

.hec-comm .hec-comm-card__placeholder {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	background: linear-gradient(135deg, var(--hec-comm-ground), #F4E7DE);
}

.hec-comm .hec-comm-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	gap: 8px;
	padding: 14px 16px 16px;
}

.hec-comm .hec-comm-card__title {
	margin: 0;
	color: var(--hec-comm-ink);
	font-family: inherit;
	font-size: 18px;
	font-weight: 800;
	line-height: 1.3;
}

.hec-comm .hec-comm-card__text {
	display: -webkit-box;
	overflow: hidden;
	color: var(--hec-comm-muted);
	font-size: 14px;
	line-height: 1.55;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
}

.hec-comm .hec-comm-card__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin-block-start: auto;
	padding-block-start: 4px;
}

.hec-comm .hec-comm-card__pill {
	padding: 4px 12px;
	border-radius: 999px;
	background: var(--hec-comm-pill-bg);
	color: var(--hec-comm-accent);
	font-size: 13px;
	font-weight: 700;
	line-height: 1.4;
}

.hec-comm .hec-comm-card__go {
	margin-inline-start: auto;
	color: var(--hec-comm-accent);
	font-size: 13px;
	font-weight: 700;
}

/* ---------- Logo tiles ---------- */

.hec-comm .hec-comm-tile {
	position: relative;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 10px;
	inline-size: 100%;
	color: inherit;
	text-align: center;
	text-decoration: none;
}

.hec-comm .hec-comm-tile--static {
	cursor: default;
}

.hec-comm .hec-comm-tile__badge {
	position: absolute;
	top: -10px;
	inset-inline-end: -6px;
	z-index: 2;
	inline-size: 56px;
	block-size: auto;
	margin: 0;
	filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.15));
	pointer-events: none;
}

.hec-comm .hec-comm-tile__media {
	display: flex;
	align-items: center;
	justify-content: center;
	inline-size: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	border-radius: 12px;
	background: var(--hec-comm-surface);
	box-shadow: 0 2px 10px rgba(60, 79, 69, 0.12);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hec-comm .hec-comm-tile__media img {
	display: block;
	inline-size: 100%;
	max-inline-size: none;
	block-size: 100%;
	margin: 0;
	border-radius: 0;
	object-fit: contain;
}

.hec-comm a.hec-comm-tile:hover .hec-comm-tile__media {
	transform: translateY(-3px);
	box-shadow: var(--hec-comm-shadow-lift);
}

.hec-comm a.hec-comm-tile:focus-visible .hec-comm-tile__media {
	transform: translateY(-3px);
	box-shadow: var(--hec-comm-shadow-lift);
}

.hec-comm a.hec-comm-tile:focus-visible {
	outline: 3px solid var(--hec-comm-accent);
	outline-offset: 4px;
	border-radius: 12px;
}

.hec-comm .hec-comm-tile__placeholder {
	display: block;
	inline-size: 100%;
	block-size: 100%;
	background: linear-gradient(135deg, var(--hec-comm-ground), #F4E7DE);
}

.hec-comm .hec-comm-tile__title {
	margin: 0;
	color: var(--hec-comm-accent);
	font-family: inherit;
	font-size: 15px;
	font-weight: 800;
	line-height: 1.3;
}

.hec-comm .hec-comm-tile__sub {
	margin-block-start: -6px;
	color: var(--hec-comm-accent);
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

/* ---------- Phone order ---------- */

/* The owner can give phones their own category order (editor → סדר במובייל).
   The HTML keeps the desktop order; each tab and section carries its phone
   position in --hec-comm-m, and "הכל", which has none, stays first. Same
   breakpoint as Elementor's mobile view. */
@media (max-width: 767px) {
	.hec-comm .hec-comm__tab {
		order: var(--hec-comm-m, 0);
	}

	.hec-comm .hec-comm__panels {
		display: flex;
		flex-direction: column;
	}

	.hec-comm .hec-comm__section {
		order: var(--hec-comm-m, 0);
	}
}

/* ---------- Small screens ---------- */

@media (max-width: 519px) {
	.hec-comm .hec-comm__tab {
		padding: 8px 14px;
		font-size: 14px;
	}

	.hec-comm .hec-comm__section {
		margin-block-end: 40px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.hec-comm .hec-comm-card,
	.hec-comm .hec-comm-tile__media,
	.hec-comm .hec-comm__tab,
	.hec-comm .hec-comm__arrow span {
		transition: none;
	}

	.hec-comm a.hec-comm-card:hover,
	.hec-comm a.hec-comm-card:focus-visible,
	.hec-comm a.hec-comm-tile:hover .hec-comm-tile__media,
	.hec-comm a.hec-comm-tile:focus-visible .hec-comm-tile__media {
		transform: none;
	}
}
