/**
 * Contests
 *
 * The contest page and its gallery, the upload page, and the single entry -
 * single-contest.php and single-contest_entry.php. Built on base.css tokens,
 * so it follows the light/dark toggle; nothing here is a hard-coded color,
 * except what sits on a photo (the prev/next arrows) and has to read against
 * the photo, not the page.
 *
 * Loaded with prose.css, which styles the intro, the contest details and the
 * entry's description.
 *
 * @copyright   2026, ON1
 */

/* !- Nav bar
   A full-width band, black like the photo backdrop, in both themes. It's
   pinned data-theme="dark" in the templates so its text stays light. */
#contest-nav {
	background: var(--black);
}

#contest-nav h3 {
	font-size: var(--text-lg);
}

#contest-nav h3 a {
	color: var(--text-100);
	font-weight: 700;
	text-decoration: none;
}

#contest-nav .nav {
	align-items: center;
}

/* base.css gives list items a bottom margin, which lifts the links off
   the title's center line */
#contest-nav .nav-item {
	margin-bottom: 0;
}

#contest-nav .nav-link {
	color: var(--text-300);
	font-size: var(--text-sm);
	text-decoration: none;
}

#contest-nav .nav-link:hover {
	color: var(--text-100);
}

#contest-nav .back-link {
	color: var(--text-100);
	font-size: var(--text-sm);
	text-decoration: none;
}

#contest-nav .back-link:hover {
	color: var(--text-300);
}

/* !- Contest index
   One tile per contest - a random entry, the title and where entries stand. */
#contest-index h1 {
	font-size: var(--text-4xl);
	font-weight: 900;
	margin-bottom: 2rem;
}

.contest-tile {
	color: var(--text-100);
	display: block;
	text-decoration: none;
}

.contest-tile-image {
	aspect-ratio: 3 / 2;
	background: var(--bg-850);
	border-radius: var(--border-radius);
	max-width: 100%;
	overflow: hidden;
}

.contest-tile-image img {
	display: block;
	height: 100%;
	object-fit: cover;
	transition: transform 0.2s ease;
	width: 100%;
}

.contest-tile:hover .contest-tile-image img {
	transform: scale(1.02);
}

.contest-tile h2 {
	font-size: var(--text-lg);
	font-weight: 700;
	margin: 1rem 0 0.25rem;
}

.contest-tile:hover h2 {
	color: var(--link);
}

.contest-tile p {
	color: var(--text-300);
	font-size: var(--text-sm);
	margin: 0;
}

/* !- Page spacing */
#contest-index,
#contest-intro,
#contest-gallery,
#contest-upload,
#contest-entry {
	padding: 5rem 0;
}

/* The gallery follows the intro, which already ends in its own padding */
#contest-gallery {
	padding-top: 0;
}

/* The photo's black backdrop meets the nav bar, as one band */
#contest-entry {
	padding-top: 0;
}

/* !- Intro */
#contest-intro h1 {
	font-size: var(--text-4xl);
	font-weight: 900;
	margin-bottom: 1rem;
}

#contest-intro .contest-subtitle {
	color: var(--text-200);
	font-size: var(--text-2xl);
	font-weight: 400;
	margin-bottom: 1.5rem;
}

.contest-dates {
	color: var(--text-300);
	font-size: var(--text-sm);
	font-weight: 600;
	margin-top: 1.5rem;
}

.contest-cta {
	margin: 2rem 0;
}

#contest-intro .btn {
	font-size: var(--text-sm);
	padding: 0.75rem 1.25rem;
}

.contest-details-toggle a {
	font-weight: 600;
}

/* The details read as a document, left-aligned under the centered intro */
#contest-details .post-prose {
	padding-top: 1.5rem;
}

/* !- Gallery
   CSS multi-column masonry: each photo keeps its real aspect ratio instead of
   every tile being cropped to the same shape. Uses the 'on1pg-masonry' image
   size (600px wide, unlimited height), which every upload gets. */
#contest-gallery h2 {
	font-size: var(--text-2xl);
	font-weight: 700;
	margin-bottom: 1.5rem;
}

.contest-masonry {
	column-count: 4;
	column-gap: 1rem;
}

.contest-masonry-item {
	-webkit-column-break-inside: avoid;
	border-radius: var(--border-radius);
	break-inside: avoid;
	display: block;
	margin-bottom: 1rem;
	overflow: hidden;
}

.contest-masonry-item img {
	display: block;
	height: auto;
	transition: transform 0.2s ease;
	width: 100%;
}

.contest-masonry-item:hover img {
	transform: scale(1.02);
}

@media (max-width: 991px) {
	.contest-masonry {
		column-count: 3;
	}
}

@media (max-width: 767px) {
	.contest-masonry {
		column-count: 2;
		column-gap: 0.5rem;
	}

	.contest-masonry-item {
		margin-bottom: 0.5rem;
	}
}

@media (max-width: 479px) {
	.contest-masonry {
		column-count: 1;
	}
}

/* !- Pagination */
.contest-pagination {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 3rem;
}

.contest-pagination .page-numbers {
	align-items: center;
	background: var(--bg-900);
	border: 1px solid var(--bg-700);
	border-radius: var(--border-radius);
	color: var(--text-300);
	display: flex;
	font-size: var(--text-sm);
	font-weight: 600;
	justify-content: center;
	min-width: 2.5rem;
	padding: 0.5rem 0.75rem;
	text-decoration: none;
}

.contest-pagination a.page-numbers:hover {
	border-color: var(--blue-500);
	color: var(--text-50);
}

.contest-pagination .page-numbers.current {
	background: var(--blue-500);
	border-color: var(--blue-500);
	color: var(--white);
}

.contest-pagination .page-numbers.dots {
	background: none;
	border-color: transparent;
}

/* The solid fill takes the deeper step in light theme so white text on it
   clears AA */
[data-theme="light"] .contest-pagination .page-numbers.current {
	background: var(--blue-600);
	border-color: var(--blue-600);
}

/* !- Single entry: the photo
   The frame breaks out of the .container to the full viewport width, so a
   short, wide photo's backdrop spans the page. */
.contest-image-frame {
	align-items: center;
	/* Black in both themes on purpose - a viewing backdrop for the photo */
	background: var(--black);
	display: flex;
	justify-content: center;
	left: 50%;
	margin-left: -50vw;
	margin-right: -50vw;
	max-height: calc(68vh + 6rem);
	max-width: 100vw;
	overflow: hidden;
	padding: 3rem 0;
	position: relative;
	right: 50%;
	width: 100vw;
}

.contest-image-frame img {
	height: auto;
	max-height: 68vh;
	max-width: 100%;
	object-fit: contain;
	width: auto;
}

.photo-copyright {
	color: var(--text-500);
	font-size: var(--text-tiny);
	font-weight: 700;
	margin-top: 0.75rem;
	text-transform: uppercase;
}

/* On the photo, so white on translucent black in both themes */
.contest-nav-arrow {
	align-items: center;
	background: color-mix(in srgb, var(--black) 35%, transparent);
	border-radius: 50%;
	color: var(--white);
	display: flex;
	font-size: var(--text-lg);
	height: 3rem;
	justify-content: center;
	line-height: 1;
	opacity: 0.75;
	position: absolute;
	text-decoration: none;
	top: 50%;
	transform: translateY(-50%);
	transition: opacity 0.15s ease, background 0.15s ease;
	width: 3rem;
	z-index: 5;
}

.contest-nav-arrow:hover,
.contest-nav-arrow:focus {
	background: color-mix(in srgb, var(--black) 60%, transparent);
	color: var(--white);
	opacity: 1;
}

.contest-nav-prev {
	left: 1rem;
}

.contest-nav-next {
	right: 1rem;
}

@media (max-width: 767px) {
	.contest-nav-arrow {
		font-size: var(--text-base);
		height: 2.5rem;
		width: 2.5rem;
	}

	.contest-nav-prev {
		left: 0.5rem;
	}

	.contest-nav-next {
		right: 0.5rem;
	}
}

/* !- Single entry: details */
#contest-entry h1 {
	font-size: var(--text-2xl);
	font-weight: 700;
	margin-bottom: 1rem;
}

.contest-meta-card {
	background: var(--bg-850);
	border: 1px solid var(--bg-700);
	border-radius: var(--border-radius);
	margin-top: 1.25rem;
	padding: 1rem 1.25rem;
}

.contest-meta-notes {
	line-height: 1.5;
	margin: 0 0 0.85rem;
}

.contest-meta-notes:last-child {
	margin-bottom: 0;
}

.contest-meta-label {
	color: var(--text-500);
	display: block;
	font-size: 0.7rem;
	letter-spacing: 0.06em;
	margin-bottom: 0.25rem;
	text-transform: uppercase;
}

.contest-exif-strip {
	align-items: center;
	color: var(--text-300);
	display: flex;
	flex-wrap: wrap;
	font-size: 0.85rem;
	gap: 0 1rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.contest-meta-notes + .contest-exif-strip {
	border-top: 1px solid var(--bg-700);
	padding-top: 0.85rem;
}

.contest-exif-strip li {
	align-items: center;
	display: flex;
	gap: 0.4rem;
	margin-bottom: 0;
	white-space: nowrap;
}

.contest-exif-strip i {
	color: var(--text-500);
}

/* !- Upload page
   The contest's WPForms form. WPForms' own styling is off on this site, so
   everything the form shows is styled here, by field type - each contest has
   its own form, so nothing hangs on per-field classes from the builder. */
.upload-card {
	background: var(--bg-850);
	border-radius: var(--border-radius);
	padding: 2.75rem;
}

@media (max-width: 575.98px) {
	.upload-card {
		padding: 1.75rem 1.375rem;
	}
}

.upload-card h1 {
	font-size: var(--text-2xl);
	font-weight: 700;
	margin-bottom: 1.75rem;
}

.upload-card #contest-details {
	margin-bottom: 2rem;
}

.upload-card .contest-details-toggle {
	margin-bottom: 2rem;
}

/* The honeypot has to stay out of sight, or people fill it in and WPForms
   drops their submission as spam */
#contest-upload .wpforms-field-hp {
	display: none !important;
}

#contest-upload .wpforms-label-hide {
	clip: rect(0 0 0 0);
	height: 1px;
	overflow: hidden;
	position: absolute;
	white-space: nowrap;
	width: 1px;
}

#contest-upload .wpforms-field {
	margin-bottom: 2rem;
	padding: 0;
}

#contest-upload .wpforms-field-label {
	color: var(--text-100);
	display: block;
	font-size: var(--text-xs);
	font-weight: 700;
	margin-bottom: 0.625rem;
}

#contest-upload .wpforms-required-label {
	color: var(--red-500);
	margin-left: 2px;
}

#contest-upload input[type="email"],
#contest-upload input[type="text"],
#contest-upload select,
#contest-upload textarea {
	background: var(--bg-900);
	border: 1px solid var(--bg-700);
	border-radius: var(--border-radius);
	color: var(--text-100);
	font-family: inherit;
	font-size: var(--text-sm);
	padding: 0.875rem 1rem;
	transition: border-color 0.15s ease;
	width: 100%;
}

#contest-upload textarea {
	line-height: 1.6;
	min-height: 110px;
	resize: vertical;
}

#contest-upload input[type="email"]:focus,
#contest-upload input[type="text"]:focus,
#contest-upload select:focus,
#contest-upload textarea:focus {
	border-color: var(--blue-500);
	outline: none;
}

#contest-upload input::placeholder,
#contest-upload textarea::placeholder {
	color: var(--text-500);
}

#contest-upload .wpforms-field-limit-text {
	color: var(--text-500);
	font-size: var(--text-mini);
	margin-top: 0.5rem;
	text-align: right;
}

#contest-upload .wpforms-field-description {
	color: var(--text-400);
	font-size: var(--text-mini);
	line-height: 1.5;
	margin-top: 0.5rem;
}

#contest-upload label.wpforms-error,
#contest-upload em.wpforms-error {
	color: var(--red-500);
	display: block;
	font-size: var(--text-mini);
	font-style: normal;
	font-weight: 600;
	margin-top: 0.375rem;
}

#contest-upload input.wpforms-error,
#contest-upload textarea.wpforms-error {
	border-color: var(--red-500);
}

/* Checkboxes - the rules agreement, if the form has one */
#contest-upload .wpforms-field-checkbox ul {
	list-style: none;
	margin: 0;
	padding: 0;
}

#contest-upload .wpforms-field-checkbox li {
	align-items: flex-start;
	display: flex;
	gap: 0.625rem;
	margin-bottom: 0.5rem;
}

#contest-upload .wpforms-field-checkbox input[type="checkbox"] {
	margin-top: 0.3rem;
}

#contest-upload .wpforms-field-label-inline {
	color: var(--text-200);
	font-size: var(--text-sm);
}

/* File upload - a compact single-row dropzone */
#contest-upload .wpforms-uploader {
	align-items: center;
	background: var(--bg-900);
	border: 2px dashed var(--bg-700);
	border-radius: var(--border-radius);
	cursor: pointer;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	padding: 1.25rem 1.5rem;
	transition: background 0.15s ease, border-color 0.15s ease;
}

#contest-upload .wpforms-uploader:hover,
#contest-upload .wpforms-uploader.dz-drag-hover {
	background: var(--blue-transparent);
	border-color: var(--blue-500);
}

#contest-upload .dz-message {
	align-items: center;
	color: var(--text-300);
	display: flex;
	flex-direction: row;
	font-size: var(--text-sm);
	gap: 0.75rem;
	margin: 0;
}

#contest-upload .dz-message svg {
	color: var(--blue-500);
	flex: none;
	height: 1.375rem;
	width: 1.375rem;
}

#contest-upload .modern-title span {
	color: var(--link);
	font-weight: 600;
	text-decoration: underline;
}

/* Submit */
#contest-upload .wpforms-submit-container {
	margin-top: 0.5rem;
}

#contest-upload .wpforms-submit {
	font-size: var(--text-sm);
	padding: 0.75rem 1.25rem;
}

/* After submitting - the confirmation is plain copy in the card, no box. The
   heading and the rules are no use once the photo is up. */
.upload-card:has(.wpforms-confirmation-container) > h1,
.upload-card:has(.wpforms-confirmation-container) .contest-details-toggle,
.upload-card:has(.wpforms-confirmation-container) #contest-details {
	display: none;
}

#contest-upload .wpforms-confirmation-container {
	color: var(--text-300);
}

#contest-upload .wpforms-confirmation-container .btn {
	font-size: var(--text-sm);
	padding: 0.75rem 1.25rem;
}
