/* Waggy Photo Contest — public gallery */

.wpc-contest {
	--wpc-button: #7d7268;
	--wpc-button-hover: #625950;
	--wpc-voted: #118a2e;
	--wpc-text: #222;
	--wpc-gap: 28px;

	margin: 1.5em 0;
}

/* Scoped to .wpc-contest so theme paragraph styles cannot shrink it back. */
.wpc-contest .wpc-message {
	font-size: 18px;
	line-height: 1.5;
	margin: 1em 0 1.5em;
}

.wpc-grid {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--wpc-gap);
}

@media (max-width: 1024px) {
	.wpc-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

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

@media (max-width: 460px) {
	.wpc-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.wpc-card {
	margin: 0;
	padding: 0;
	text-align: center;
	display: flex;
	flex-direction: column;
	align-items: center;
}

/* Fixed-ratio box keeps the grid tidy no matter what shape people upload. */
.wpc-photo-wrap {
	width: 100%;
	aspect-ratio: 4 / 3;
	overflow: hidden;
	background: #f1efec;
}

.wpc-photo {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.wpc-photo--missing {
	display: block;
	width: 100%;
	height: 100%;
}

.wpc-name {
	font-size: 1.25rem;
	font-weight: 700;
	color: var(--wpc-text);
	margin: 0.6em 0 0.5em;
	line-height: 1.2;
}

.wpc-vote {
	display: inline-block;
	background: var(--wpc-button);
	color: #fff;
	border: 0;
	border-radius: 2px;
	padding: 0.7em 2.2em;
	font-size: 0.95rem;
	font-weight: 700;
	letter-spacing: 0.05em;
	cursor: pointer;
	transition: background 0.15s ease;
}

.wpc-vote:hover:not([disabled]),
.wpc-vote:focus-visible:not([disabled]) {
	background: var(--wpc-button-hover);
}

.wpc-vote[disabled] {
	cursor: default;
	opacity: 0.75;
}

.wpc-vote.is-voted {
	background: var(--wpc-voted);
}

.wpc-vote.is-busy {
	opacity: 0.6;
	cursor: progress;
}

.wpc-contest .wpc-message.is-error {
	color: #a3231f;
}

/* Public running tally, between the pet's name and its vote button. */
.wpc-contest .wpc-count {
	margin: 0 0 0.6em;
	font-size: 15px;
	font-weight: 700;
	color: var(--wpc-text);
}

/* The day's vote is spent: buttons stay visible but inert. */
.wpc-grid.is-spent .wpc-vote:not(.is-voted) {
	background: #b6afa8;
}

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

.wpc-modal {
	position: fixed;
	inset: 0;
	z-index: 99999;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

/* An author-level display rule beats the UA's [hidden] rule, so restate it. */
.wpc-modal[hidden] {
	display: none;
}

.wpc-modal-box {
	background: #fff;
	border-radius: 4px;
	padding: 28px;
	width: 100%;
	max-width: 420px;
	box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
	text-align: left;
}

.wpc-modal-title {
	margin: 0 0 1em;
	font-size: 20px;
	line-height: 1.3;
}

.wpc-field {
	display: block;
	margin-bottom: 1em;
}

.wpc-field-label {
	display: block;
	font-size: 15px;
	font-weight: 700;
	margin-bottom: 0.35em;
}

.wpc-modal-box .wpc-email {
	width: 100%;
	box-sizing: border-box;
	padding: 0.6em 0.7em;
	font-size: 16px; /* 16px stops iOS Safari zooming the page on focus. */
	border: 1px solid #b9b2ab;
	border-radius: 3px;
}

.wpc-consent-row {
	display: flex;
	gap: 0.6em;
	align-items: flex-start;
	font-size: 15px;
	line-height: 1.4;
	margin-bottom: 1em;
}

.wpc-consent-row input {
	margin-top: 0.2em;
	flex: 0 0 auto;
}

.wpc-modal-error {
	margin: 0 0 1em;
	font-size: 15px;
	color: #a3231f;
}

.wpc-modal-error:empty {
	margin: 0;
}

.wpc-modal-actions {
	display: flex;
	gap: 0.6em;
	align-items: center;
}

.wpc-modal-submit {
	background: var(--wpc-button);
	color: #fff;
	border: 0;
	border-radius: 2px;
	padding: 0.7em 1.6em;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.05em;
	cursor: pointer;
}

.wpc-modal-submit:hover {
	background: var(--wpc-button-hover);
}

.wpc-modal-cancel {
	background: none;
	border: 0;
	padding: 0.7em 0.4em;
	font-size: 15px;
	color: #5c5550;
	text-decoration: underline;
	cursor: pointer;
}
