/* ==========================================================================
   Sukkot Hadar — beautiful-sukkah competition (Project 2)
   Loaded only on /competition/. All selectors are namespaced (.emc*)
   so nothing here can affect the rest of the site.
   ========================================================================== */

.emc,
.emc-dialog,
.emc-lb {
	--emc-green: #59a907;
	--emc-green-dark: #3b7200;
	--emc-green-deep: #24470a;
	--emc-ink: #1f1f1f;
	--emc-text: #33382f;
	--emc-muted: #6a7064;
	--emc-tint: #f3f8ec;
	--emc-tint-2: #eaf4de;
	--emc-line: #dfe9d3;
	--emc-heart: #e0245e;
	--emc-radius: 18px;
	--emc-shadow: 0 18px 40px -22px rgba(24, 48, 0, 0.45);
	--emc-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
	--emc-head: Karantina, "nextexit-variable", sans-serif;
}

.emc *,
.emc-dialog *,
.emc-lb * {
	box-sizing: border-box;
}

/* Open dialogs keep their own scroll; the page behind stays where it was. */
.emc-dialog,
.emc-lb {
	overscroll-behavior: contain;
}

/* --------------------------------------------------------------------------
   Intro + status
   -------------------------------------------------------------------------- */

.emc-intro {
	font-size: 18px;
	line-height: 1.7;
	color: var(--emc-text);
	margin-bottom: 20px;
}

.emc-intro p:last-child {
	margin-bottom: 0;
}

.emc-status {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px 20px;
	margin-bottom: 24px;
}

.emc-status:empty {
	display: none;
}

.emc-status__line {
	margin: 0;
	font-size: 17px;
	color: var(--emc-text);
	flex: 1 1 320px;
}

.emc-status__line--open {
	background: var(--emc-tint);
	border: 1px solid var(--emc-line);
	border-radius: 14px;
	padding: 12px 16px;
}

.emc-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--emc-green);
	margin-inline-end: 6px;
	vertical-align: middle;
	box-shadow: 0 0 0 0 rgba(89, 169, 7, 0.6);
	animation: emc-pulse 2s infinite;
}

@keyframes emc-pulse {
	0% { box-shadow: 0 0 0 0 rgba(89, 169, 7, 0.55); }
	70% { box-shadow: 0 0 0 10px rgba(89, 169, 7, 0); }
	100% { box-shadow: 0 0 0 0 rgba(89, 169, 7, 0); }
}

/* --------------------------------------------------------------------------
   Buttons (own classes — independent from the theme's .btn overrides)
   -------------------------------------------------------------------------- */

.emc-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	min-height: 50px;
	padding: 12px 30px;
	border-radius: 999px;
	border: 2px solid var(--emc-green);
	background: var(--emc-green);
	color: #fff;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.15;
	text-decoration: none;
	cursor: pointer;
	box-shadow: 0 10px 22px -10px rgba(59, 114, 0, 0.6);
	transition: transform 0.25s var(--emc-ease), background-color 0.25s, color 0.25s, border-color 0.25s;
}

.emc-btn:hover,
.emc-btn:focus-visible {
	background: var(--emc-green-dark);
	border-color: var(--emc-green-dark);
	color: #fff;
	transform: translateY(-2px);
	text-decoration: none;
}

.emc-btn--ghost {
	background: #fff;
	color: var(--emc-green-dark);
	box-shadow: none;
	min-height: 44px;
	padding: 8px 22px;
	font-size: 16px;
}

.emc-btn--block {
	width: 100%;
	margin-top: 14px;
}

.emc-btn[disabled],
.emc-btn.is-loading {
	opacity: 0.7;
	cursor: progress;
	transform: none;
}

.emc-btn:focus-visible,
.emc-year:focus-visible,
.emc-vote:focus-visible,
.emc-share:focus-visible,
.emc-card__media:focus-visible,
.emc-link:focus-visible,
.emc-lb__btn:focus-visible,
.emc-dialog__close:focus-visible,
.emc-file:focus-within {
	outline: 3px solid var(--emc-green-dark);
	outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Year filter
   -------------------------------------------------------------------------- */

.emc-years {
	display: flex;
	gap: 8px;
	margin-bottom: 22px;
	overflow-x: auto;
	padding: 4px 2px 8px;
	scrollbar-width: thin;
}

.emc-year {
	flex: 0 0 auto;
	min-height: 40px;
	padding: 6px 18px;
	border-radius: 999px;
	border: 1.5px solid var(--emc-line);
	background: #fff;
	color: var(--emc-ink);
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.emc-year:hover {
	border-color: var(--emc-green);
	color: var(--emc-green-dark);
}

.emc-year.is-active {
	background: var(--emc-green-dark);
	border-color: var(--emc-green-dark);
	color: #fff;
}

/* --------------------------------------------------------------------------
   Grid + cards
   -------------------------------------------------------------------------- */

.emc-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
}

@media (max-width: 1199px) {
	.emc-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 575px) {
	.emc-grid {
		grid-template-columns: minmax(0, 1fr);
		gap: 18px;
	}
}

.emc-empty {
	grid-column: 1 / -1;
	text-align: center;
	color: var(--emc-muted);
	font-size: 18px;
	padding: 24px 0;
}

.emc-card {
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 1px solid var(--emc-line);
	border-radius: var(--emc-radius);
	overflow: hidden;
	box-shadow: var(--emc-shadow);
	transition: transform 0.3s var(--emc-ease), box-shadow 0.3s;
}

.emc-card[hidden] {
	display: none;
}

.emc-card:hover {
	transform: translateY(-3px);
}

.emc-card.is-highlight {
	box-shadow: 0 0 0 4px var(--emc-green), var(--emc-shadow);
}

.emc-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	padding: 0;
	border: 0;
	background: var(--emc-tint);
	cursor: zoom-in;
	overflow: hidden;
}

.emc-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s var(--emc-ease);
}

.emc-card__media:hover .emc-card__img {
	transform: scale(1.04);
}

.emc-card__zoom {
	position: absolute;
	inset-inline-start: 12px;
	top: 12px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--emc-green-dark);
	opacity: 0;
	transition: opacity 0.25s;
}

.emc-card__media:hover .emc-card__zoom,
.emc-card__media:focus-visible .emc-card__zoom {
	opacity: 1;
}

@media (hover: none) {
	.emc-card__zoom {
		opacity: 0.9;
		width: 34px;
		height: 34px;
	}
}

.emc-card__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 16px 18px 18px;
	flex: 1 1 auto;
}

.emc .emc-card__title {
	font-family: var(--emc-head);
	font-weight: 700;
	font-size: 30px;
	line-height: 1;
	color: var(--emc-green-dark);
	margin: 0;
	overflow-wrap: anywhere;
}

.emc-card__meta {
	margin: 0;
	font-size: 15px;
	color: var(--emc-muted);
}

.emc-card__desc {
	margin: 2px 0 0;
	font-size: 15px;
	line-height: 1.55;
	color: var(--emc-text);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.emc-card__actions {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: auto;
	padding-top: 12px;
}

.emc-vote {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 8px 18px;
	border-radius: 999px;
	border: 2px solid var(--emc-green);
	background: var(--emc-green);
	color: #fff;
	font-size: 17px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.2s, color 0.2s, border-color 0.2s, transform 0.2s;
}

.emc-vote:hover {
	background: var(--emc-green-dark);
	border-color: var(--emc-green-dark);
}

.emc-vote:active {
	transform: scale(0.96);
}

.emc-vote__icon {
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
}

.emc-vote.is-voted {
	background: #fff;
	color: var(--emc-heart);
	border-color: #f3c4d3;
}

.emc-vote.is-voted .emc-vote__icon {
	fill: var(--emc-heart);
	stroke: var(--emc-heart);
	animation: emc-heart 0.45s var(--emc-ease);
}

@keyframes emc-heart {
	0% { transform: scale(0.6); }
	60% { transform: scale(1.25); }
	100% { transform: scale(1); }
}

.emc-vote[disabled] {
	opacity: 0.7;
	cursor: progress;
}

.emc-count {
	font-size: 15px;
	font-weight: 700;
	color: var(--emc-ink);
	white-space: nowrap;
	/* Own line above the buttons, so vote + share always fit side by side. */
	order: -1;
	flex-basis: 100%;
}

.emc-count.is-bump {
	animation: emc-bump 0.5s var(--emc-ease);
}

@keyframes emc-bump {
	50% { color: var(--emc-green); transform: scale(1.08); }
}

.emc-share {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	min-height: 40px;
	padding: 6px 14px;
	margin-inline-start: auto;
	border: 1.5px solid var(--emc-line);
	border-radius: 999px;
	background: #fff;
	color: var(--emc-green-dark);
	font-size: 15px;
	font-weight: 700;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	flex: 0 0 auto;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

.emc-share:hover {
	background: var(--emc-tint);
	border-color: var(--emc-green);
	color: var(--emc-green-dark);
	text-decoration: none;
}

.emc-share__icon {
	flex: 0 0 auto;
}

.emc-tip {
	position: absolute;
	inset-inline-start: 0;
	bottom: calc(100% - 4px);
	background: var(--emc-ink);
	color: #fff;
	font-size: 14px;
	line-height: 1.3;
	padding: 6px 12px;
	border-radius: 10px;
	opacity: 0;
	transform: translateY(6px);
	pointer-events: none;
	transition: opacity 0.2s, transform 0.2s;
	max-width: 100%;
}

.emc-tip.is-on {
	opacity: 1;
	transform: none;
}

/* --------------------------------------------------------------------------
   Submission form
   -------------------------------------------------------------------------- */

.emc-join {
	scroll-margin-top: 110px;
}

.emc-join__lead {
	color: var(--emc-text);
	font-size: 17px;
	margin-bottom: 18px;
}

.emc-closed {
	font-size: 18px;
	color: var(--emc-text);
	margin: 8px 0 4px;
}

.emc-form .form-label {
	font-weight: 700;
	color: var(--emc-ink);
}

.emc-req {
	color: #c62828;
}

.emc-form textarea.form-control {
	min-height: 120px;
}

.emc-form .form-control.is-invalid,
.emc-form input[type="checkbox"].is-invalid {
	border-color: #c62828;
	box-shadow: 0 0 0 2px rgba(198, 40, 40, 0.15);
}

.emc-file {
	position: relative;
	display: flex;
	align-items: center;
	gap: 14px;
	min-height: 64px;
	padding: 10px 14px;
	border: 2px dashed var(--emc-line);
	border-radius: 14px;
	background: #fff;
	cursor: pointer;
	transition: border-color 0.2s, background-color 0.2s;
}

.emc-file:hover {
	border-color: var(--emc-green);
	background: var(--emc-tint);
}

.emc-file input[type="file"] {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	opacity: 0;
	cursor: pointer;
}

.emc-file input[type="file"].is-invalid + .emc-file__ui {
	color: #c62828;
}

.emc-file__ui {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	color: var(--emc-green-dark);
	font-weight: 700;
	min-width: 0;
	overflow-wrap: anywhere;
}

.emc-file__preview {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 10px;
	margin-inline-start: auto;
	flex: 0 0 auto;
}

.emc-file__preview[hidden] {
	display: none;
}

.emc-help {
	display: block;
	margin-top: 6px;
	color: var(--emc-muted);
	font-size: 14px;
}

.emc-check {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-size: 15px;
	color: var(--emc-text);
	cursor: pointer;
}

.emc-check input {
	width: 20px;
	height: 20px;
	margin-top: 2px;
	flex: 0 0 auto;
	accent-color: var(--emc-green-dark);
}

.emc-check a {
	color: var(--emc-green-dark);
	text-decoration: underline;
}

/* Honeypot: off-screen, not display:none (some bots skip hidden fields). */
.emc-hp {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	inset-inline-start: -9999px;
}

/* --------------------------------------------------------------------------
   Messages
   -------------------------------------------------------------------------- */

.emc-msg {
	margin-top: 14px;
	padding: 10px 14px;
	border-radius: 12px;
	font-size: 16px;
	line-height: 1.45;
	text-align: center;
}

.emc-msg[hidden] {
	display: none;
}

.emc-msg--ok {
	background: var(--emc-tint-2);
	color: var(--emc-green-deep);
	border: 1px solid #cfe5b6;
}

.emc-msg--err {
	background: #fdecee;
	color: #a1162a;
	border: 1px solid #f6c9cf;
}

/* --------------------------------------------------------------------------
   Vote dialog
   -------------------------------------------------------------------------- */

.emc-dialog {
	width: min(440px, calc(100vw - 32px));
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	padding: 28px 24px 20px;
	border: 0;
	border-radius: 22px;
	background: #fff;
	color: var(--emc-text);
	box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.45);
	direction: rtl;
}

.emc-dialog::backdrop {
	background: rgba(20, 30, 10, 0.55);
}

.emc-dialog[open] {
	animation: emc-in 0.25s var(--emc-ease);
}

@keyframes emc-in {
	from { opacity: 0; transform: translateY(14px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

.emc-dialog__close-form {
	margin: 0;
}

.emc-dialog__close {
	position: absolute;
	top: 12px;
	inset-inline-end: 12px;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border: 0;
	border-radius: 50%;
	background: var(--emc-tint);
	color: var(--emc-ink);
	cursor: pointer;
}

.emc-dialog .emc-dialog__title {
	font-family: var(--emc-head);
	font-size: 40px;
	line-height: 1;
	color: var(--emc-green-dark);
	margin: 0 0 6px;
	padding-inline-end: 44px;
}

.emc-dialog__for {
	margin: 0 0 12px;
	font-size: 16px;
}

.emc-dialog__text {
	font-size: 15px;
	line-height: 1.55;
	margin: 0 0 12px;
}

.emc-dialog .form-label {
	font-weight: 700;
	color: var(--emc-ink);
}

.emc-ltr {
	direction: ltr;
	text-align: center;
	font-size: 20px;
	letter-spacing: 0.04em;
}

.emc-code {
	font-size: 26px;
	letter-spacing: 0.35em;
	font-variant-numeric: tabular-nums;
}

.emc-step[hidden] {
	display: none;
}

.emc-dialog__links {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	margin-top: 12px;
}

.emc-link {
	border: 0;
	background: none;
	padding: 4px 0;
	color: var(--emc-green-dark);
	font-size: 14px;
	font-weight: 700;
	text-decoration: underline;
	cursor: pointer;
}

.emc-link[disabled] {
	color: var(--emc-muted);
	text-decoration: none;
	cursor: default;
}

.emc-dialog__fine {
	margin: 16px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: var(--emc-muted);
}

.emc-dialog__fine a {
	color: var(--emc-green-dark);
}

/* --------------------------------------------------------------------------
   Lightbox
   -------------------------------------------------------------------------- */

.emc-lb {
	width: 100vw;
	height: 100vh;
	height: 100dvh;
	max-width: none;
	max-height: none;
	margin: 0;
	padding: 0;
	border: 0;
	background: rgba(12, 16, 8, 0.94);
	color: #fff;
	direction: rtl;
}

.emc-lb::backdrop {
	background: rgba(12, 16, 8, 0.94);
}

.emc-lb[open] {
	display: flex;
	align-items: center;
	justify-content: center;
}

.emc-lb__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
	max-width: min(1100px, calc(100vw - 140px));
	max-height: 100vh;
	max-height: 100dvh;
	padding: 56px 0 20px;
}

.emc-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 190px);
	max-height: calc(100dvh - 190px);
	object-fit: contain;
	border-radius: 12px;
}

.emc-lb__cap {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	text-align: center;
	max-width: 760px;
	font-size: 15px;
	line-height: 1.5;
	color: rgba(255, 255, 255, 0.85);
}

.emc-lb__cap strong {
	font-family: var(--emc-head);
	font-size: 32px;
	line-height: 1;
	color: #fff;
}

.emc-lb__desc {
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.emc-lb__btn {
	position: absolute;
	display: grid;
	place-items: center;
	width: 48px;
	height: 48px;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	color: #fff;
	cursor: pointer;
	transition: background-color 0.2s;
}

.emc-lb__btn:hover {
	background: rgba(255, 255, 255, 0.28);
}

.emc-lb__btn[hidden] {
	display: none;
}

.emc-lb__close {
	top: 14px;
	inset-inline-end: 14px;
}

.emc-lb__prev,
.emc-lb__next {
	top: 50%;
	transform: translateY(-50%);
}

/* RTL: previous on the right, next on the left. */
.emc-lb__prev {
	right: 16px;
}

.emc-lb__next {
	left: 16px;
}

@media (max-width: 767px) {
	.emc-lb__figure {
		max-width: calc(100vw - 24px);
		padding-top: 64px;
	}

	.emc-lb__prev,
	.emc-lb__next {
		top: auto;
		bottom: 18px;
		transform: none;
	}

	.emc-lb__img {
		max-height: calc(100vh - 230px);
		max-height: calc(100dvh - 230px);
	}

	.emc-lb__figure {
		padding-bottom: 80px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.emc *,
	.emc-dialog,
	.emc-dialog *,
	.emc-lb,
	.emc-lb * {
		animation: none !important;
		transition: none !important;
	}
}
