/* ---------------------------------------------------------------
   Poster Contest Grid & Voting
   Loaded automatically by the Poster Contest Voting plugin.
--------------------------------------------------------------- */


/* ---------------------------------------------------------------
   Grid
--------------------------------------------------------------- */

.contest-grid {
	display: grid;
	/* Default: fluid auto-fill (shortcode with no columns set, archive) */
	grid-template-columns: repeat( auto-fill, minmax( 280px, 1fr ) );
	gap: 2rem;
	padding: 2rem 0;
}

/* Fixed columns set by the block or shortcode via --contest-columns */
.contest-grid[style*="--contest-columns"] {
	grid-template-columns: repeat( var( --contest-columns ), minmax( 0, 1fr ) );
}

@media ( max-width: 768px ) {
	.contest-grid[style*="--contest-columns"] {
		grid-template-columns: repeat( min( var( --contest-columns ), 2 ), minmax( 0, 1fr ) );
	}
}

@media ( max-width: 480px ) {
	.contest-grid,
	.contest-grid[style*="--contest-columns"] {
		grid-template-columns: 1fr;
	}
}


/* ---------------------------------------------------------------
   Entry card
--------------------------------------------------------------- */

.contest-entry {
	display: flex;
	flex-direction: column;
	border: 1px solid #e0e0e0;
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 2px 6px rgba( 0, 0, 0, 0.06 );
	transition: box-shadow 0.2s;
}

.contest-entry:hover {
	box-shadow: 0 4px 14px rgba( 0, 0, 0, 0.12 );
}

/* Clickable card (lightbox enabled) */
.contest-entry.has-lightbox {
	cursor: pointer;
}

.contest-entry.has-lightbox .contest-footer {
	cursor: default;
}


/* ---------------------------------------------------------------
   Featured image
--------------------------------------------------------------- */

.contest-photo {
	overflow: hidden;
	line-height: 0;
}

/* Default: image at its natural proportions */
.contest-photo img {
	width: 100%;
	height: auto;
	display: block;
	object-fit: cover;
}

/* Fixed aspect ratio (set via inline style on the container) */
.contest-photo--ratio img {
	height: 100%;
}


/* ---------------------------------------------------------------
   Card body
--------------------------------------------------------------- */

.contest-content {
	padding: 1rem 1.25rem;
	flex: 1;
}

.contestant-number {
	font-size: 1.6rem;
	font-weight: 700;
	margin-bottom: 0.5rem;
	line-height: 1.2;
}

.contestant-text {
	font-size: 0.95rem;
	color: #444;
	line-height: 1.6;
}


/* ---------------------------------------------------------------
   Card footer (vote count + button)
--------------------------------------------------------------- */

.contest-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.85rem 1.25rem;
	border-top: 1px solid #e8e8e8;
	background: #f7f7f7;
}

.vote-count-wrap {
	font-size: 0.9rem;
	color: #555;
}

.vote-count {
	font-weight: 700;
	font-size: 1.1rem;
}


/* ---------------------------------------------------------------
   Vote button states
--------------------------------------------------------------- */

.contest-vote-btn {
	padding: 0.5rem 1.4rem;
	background: var( --global-palette1, #0073aa );
	color: #fff;
	border: none;
	border-radius: 4px;
	cursor: pointer;
	font-size: 0.9rem;
	font-weight: 600;
	letter-spacing: 0.02em;
	transition: background 0.2s, opacity 0.2s;
	white-space: nowrap;
}

.contest-vote-btn:hover:not( :disabled ) {
	background: var( --global-palette2, #005a87 );
}

/* Voted / disabled */
.contest-vote-btn.voted,
.contest-vote-btn:disabled {
	background: #d4d4d4;
	color: #888;
	cursor: not-allowed;
}

/* Loading */
.contest-vote-btn.loading {
	opacity: 0.6;
}

/* Not open yet */
.contest-vote-btn.status-before {
	background: #fbbf24;
	color: #78350f;
	cursor: not-allowed;
	font-size: 0.8rem;
	padding: 0.5rem 0.9rem;
}

/* Closed */
.contest-vote-btn.status-closed {
	background: #d4d4d4;
	color: #888;
	cursor: not-allowed;
}


/* ---------------------------------------------------------------
   Status banners
--------------------------------------------------------------- */

.contest-status {
	padding: 0.85rem 1.25rem;
	border-radius: 6px;
	margin-bottom: 1.5rem;
	font-weight: 600;
	font-size: 0.95rem;
}

.contest-status--before {
	background: #fef9c3;
	color: #854d0e;
	border: 1px solid #fde68a;
}

.contest-status--closed {
	background: #f3f4f6;
	color: #374151;
	border: 1px solid #d1d5db;
}


/* ---------------------------------------------------------------
   Empty state
--------------------------------------------------------------- */

.contest-empty {
	text-align: center;
	padding: 3rem 1rem;
	color: #888;
}


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

body.contest-lightbox-open {
	overflow: hidden;
}

.contest-lightbox {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.contest-lightbox[hidden] {
	display: none;
}

.contest-lightbox-backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.75 );
	cursor: pointer;
}

.contest-lightbox-dialog {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 8px;
	width: min( 800px, 92vw );
	max-height: 90vh;
	overflow-y: auto;
	display: flex;
	flex-direction: column;
	outline: none;
}

.contest-lightbox-close {
	position: sticky;
	top: 0.75rem;
	float: right;
	margin: 0.75rem 0.75rem 0 auto;
	width: 2rem;
	height: 2rem;
	flex-shrink: 0;
	background: rgba( 0, 0, 0, 0.55 );
	color: #fff;
	border: none;
	border-radius: 50%;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 2;
	transition: background 0.15s;
}

.contest-lightbox-close:hover {
	background: rgba( 0, 0, 0, 0.85 );
}

.contest-lightbox-image {
	line-height: 0;
}

.contest-lightbox-image img {
	width: 100%;
	height: auto;
	display: block;
	border-radius: 8px 8px 0 0;
}

.contest-lightbox-content {
	padding: 1.5rem 1.75rem;
}

.contest-lightbox-title {
	margin: 0 0 1rem;
	font-size: 1.6rem;
	line-height: 1.2;
}

.contest-lightbox-text {
	font-size: 0.95rem;
	line-height: 1.75;
	color: #333;
}

.contest-lightbox-body .contest-footer {
	border-radius: 0 0 8px 8px;
	position: sticky;
	bottom: 0;
}


/* ---------------------------------------------------------------
   Block editor preview states
--------------------------------------------------------------- */

.contest-preview-loading {
	display: flex;
	align-items: center;
	gap: 0.75rem;
	padding: 2rem 1.5rem;
	color: #757575;
	font-size: 0.9rem;
}

.contest-preview-error {
	padding: 1.5rem;
	background: #fff8f8;
	border: 1px solid #f5c6c6;
	border-radius: 4px;
	color: #c0392b;
	font-size: 0.875rem;
}
