/**
 * Front-end styles.
 *
 * Deliberately quiet: colours come from the theme through currentColor and a couple of tokens a
 * theme can override, so the blocks sit inside somebody else's design instead of fighting it.
 */

.ludoya {
	--ludoya-gap: 1.25rem;
	--ludoya-radius: 10px;
	--ludoya-border: color-mix(in srgb, currentColor 15%, transparent);
	--ludoya-muted: color-mix(in srgb, currentColor 65%, transparent);

	/* Card surface. Kept as a tint of the theme's own text colour rather than a fixed white, so
	   these sit on a dark theme without a light rectangle punched out of it. */
	--ludoya-surface: color-mix(in srgb, currentColor 4%, transparent);
	--ludoya-tile-empty: color-mix(in srgb, currentColor 8%, transparent);
	--ludoya-tag-bg: color-mix(in srgb, currentColor 8%, transparent);
	--ludoya-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
	--ludoya-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);

	/* The app's --time-*-color and --status-*-color hues. Each is mixed toward the theme's own
	   text colour so it lands right on a light or a dark page: keying these off
	   prefers-color-scheme would read the browser rather than the theme, and a dark-mode browser
	   on a light theme would get the washed-out set. */
	--ludoya-time-past: var(--ludoya-muted);
	--ludoya-time-soon: color-mix(in srgb, #4A80C8 78%, currentColor);
	--ludoya-time-today: color-mix(in srgb, #3D96A4 78%, currentColor);
	--ludoya-time-now: color-mix(in srgb, #2E9E42 78%, currentColor);
	--ludoya-status-positive: color-mix(in srgb, #2E8B3A 74%, currentColor);
	--ludoya-status-negative: color-mix(in srgb, #CE3B3B 74%, currentColor);
}


.ludoya .ludoya-heading,
.ludoya .ludoya-subheading {
	margin: 0 0 var(--ludoya-gap);
}

.ludoya-empty {
	color: var(--ludoya-muted);
}

/* Events ------------------------------------------------------------------ */

.ludoya-events__grid {
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	align-items: start;
}

.ludoya-events--list .ludoya-events__grid {
	grid-template-columns: 1fr;
}

/* One card, one link. The app lays these out as a row: art, then when, then what. */
.ludoya-card {
	display: flex;
	gap: 0.75rem;
	align-items: flex-start;
	padding: 0.6rem;
	border-radius: var(--ludoya-radius);
	background: var(--ludoya-surface);
	box-shadow: var(--ludoya-shadow);
	color: inherit;
	text-decoration: none;
	transition: box-shadow 120ms ease, transform 120ms ease;
}

.ludoya-card:hover,
.ludoya-card:focus-visible {
	box-shadow: var(--ludoya-shadow-hover);
	color: inherit;
	text-decoration: none;
	transform: translateY(-1px);
}

.ludoya-card--past {
	opacity: 0.72;
}

.ludoya-card--canceled .ludoya-card__title {
	text-decoration: line-through;
}

/* Square art at a fixed size, so a ragged mix of portrait box shots still lines up. */
.ludoya-card__media {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--ludoya-tile-empty);
}

.ludoya-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

/* No art: a tinted initial. Deterministic per event, so the page reads as designed. */
.ludoya-card__tile {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	font-size: 1.5rem;
	font-weight: 700;
	line-height: 1;
	/* Mixed with currentColor rather than pinned to a light or dark value: the surrounding theme
	   decides which way this leans, and a browser in dark mode on a light theme must not get a
	   dark tile. */
	color: color-mix(in srgb, hsl(var(--ludoya-tint) 55% 45%) 65%, currentColor);
	background: color-mix(in srgb, hsl(var(--ludoya-tint) 60% 50%) 16%, transparent);
}

.ludoya-card__body {
	display: flex;
	flex-direction: column;
	gap: 0.1rem;
	min-width: 0;
	flex: 1 1 auto;
}

.ludoya-card__when {
	font-size: 0.8rem;
	color: var(--ludoya-muted);
}

.ludoya-card__when--today {
	color: var(--ludoya-time-today);
	font-weight: 600;
}

.ludoya-card__when--soon {
	color: var(--ludoya-time-soon);
	font-weight: 600;
}

.ludoya-card__when--now {
	color: var(--ludoya-time-now);
	font-weight: 600;
}

.ludoya-card__when--past {
	color: var(--ludoya-time-past);
}

.ludoya-card__title {
	font-size: 0.95rem;
	font-weight: 700;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ludoya-card__where,
.ludoya-card__game {
	font-size: 0.8rem;
	color: var(--ludoya-muted);
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ludoya-card__tags {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-top: 0.3rem;
}

.ludoya-tag {
	display: inline-block;
	padding: 0.05rem 0.45rem;
	border-radius: 999px;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.01em;
	color: var(--ludoya-muted);
	background: var(--ludoya-tag-bg);
}

.ludoya-tag--positive {
	color: var(--ludoya-status-positive);
}

.ludoya-tag--negative {
	color: var(--ludoya-status-negative);
}

.ludoya-tag--quiet {
	color: var(--ludoya-muted);
}

/* The one call to action: the sign-up submit, and the link out to the app. */
.ludoya-button {
	display: inline-block;
	padding: 0.5rem 1.1rem;
	border: 0;
	border-radius: 999px;
	font-size: 0.9rem;
	font-weight: 600;
	line-height: 1.4;
	cursor: pointer;
	text-decoration: none;
	/* Tonal, not a solid fill. A solid one needs its own foreground colour, and setting `color` on
	   the same rule that reads `currentColor` for the background collapses both to one value —
	   white on white. Tinting the theme's own colour keeps it legible whatever the theme is. */
	color: inherit;
	background: color-mix(in srgb, currentColor 12%, transparent);
	box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 22%, transparent);
	transition: background-color 120ms ease;
}

.ludoya-button:hover,
.ludoya-button:focus-visible {
	color: inherit;
	text-decoration: none;
	background: color-mix(in srgb, currentColor 20%, transparent);
}

/* Single event ------------------------------------------------------------ */

.ludoya-event__head {
	display: flex;
	gap: 1rem;
	align-items: flex-start;
	margin-bottom: 1rem;
}

.ludoya-event__art {
	flex: 0 0 auto;
	width: 104px;
	height: 104px;
	border-radius: 10px;
	overflow: hidden;
	background: var(--ludoya-tile-empty);
}

.ludoya-event__art img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ludoya-event__art .ludoya-card__tile {
	font-size: 2.6rem;
}

.ludoya-event__headings {
	min-width: 0;
	flex: 1 1 auto;
}

.ludoya-event__headings > * {
	margin: 0 0 0.15rem;
}

.ludoya-event__title {
	margin: 0 0 0.25rem;
	line-height: 1.2;
}

.ludoya-event--canceled .ludoya-event__title {
	text-decoration: line-through;
}

.ludoya-event__where,
.ludoya-event__game {
	color: var(--ludoya-muted);
	font-size: 0.9rem;
}

.ludoya-event__address {
	display: block;
}

a.ludoya-event__address,
a.ludoya-location__address {
	color: inherit;
	text-decoration: underline;
	text-decoration-color: var(--ludoya-border);
	text-underline-offset: 0.15em;
}

a.ludoya-event__address:hover,
a.ludoya-location__address:hover {
	text-decoration-color: currentColor;
}

/* The games an event puts on the table, as the collection shows them, one size down. */
.ludoya-event__games {
	margin: 0 0 var(--ludoya-gap);
}

.ludoya-event__games .ludoya-games {
	grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
}

/* The venue on a map, folded away until asked for. */
.ludoya-map {
	margin: 0 0 var(--ludoya-gap);
}

.ludoya-map summary {
	cursor: pointer;
	font-size: 0.9rem;
	color: var(--ludoya-muted);
}

.ludoya-map[open] summary {
	margin-bottom: 0.5rem;
}

.ludoya-map__frame {
	overflow: hidden;
	border-radius: var(--ludoya-radius);
	border: 1px solid var(--ludoya-border);
	aspect-ratio: 16 / 9;
	max-height: 360px;
}

.ludoya-map__frame iframe {
	display: block;
	width: 100%;
	height: 100%;
	border: 0;
}

/* Text the way it was typed in the app: paragraphs, lists and headings, no theme surprises. */
.ludoya-event__description :is(h4, h5, h6) {
	margin: 1em 0 0.35em;
	font-size: 1rem;
}

.ludoya-event__description :is(ul, ol) {
	margin: 0 0 1em;
	padding-left: 1.4em;
}

.ludoya-event__people {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	font-size: 0.9rem;
	color: var(--ludoya-muted);
}

/* The programme of a bigger event: its sub-events as a single column of cards, in the order they
   happen, between the description and the sign-up. Dividers carry the day and the start hour, so a
   forty-card programme is read by its headings rather than card by card. */
.ludoya-event__programme {
	margin: 1.25rem 0;
}

.ludoya-programme__day {
	margin: 1.25rem 0 0.5rem;
	padding-bottom: 0.35rem;
	border-bottom: 1px solid var(--ludoya-border, rgba(0, 0, 0, 0.12));
	font-size: 1rem;
}

/* Catalan and Spanish write weekdays and months in lower case, which is right in a sentence and
   wrong as a heading — so the first letter only, rather than capitalizing every word. */
.ludoya-programme__day::first-letter {
	text-transform: uppercase;
}

.ludoya-programme__day:first-of-type {
	margin-top: 0.25rem;
}

.ludoya-programme__time {
	margin: 0.75rem 0 0.4rem;
	color: var(--ludoya-muted);
	font-size: 0.8125rem;
	font-variant-numeric: tabular-nums;
	letter-spacing: 0.04em;
}

@media (max-width: 480px) {
	.ludoya-event__art {
		width: 72px;
		height: 72px;
	}
}


/* Sign-up form ------------------------------------------------------------ */

.ludoya-form {
	display: grid;
	gap: 0.9rem;
	max-width: 34rem;
	padding: 1.1rem;
	border-radius: var(--ludoya-radius);
	background: var(--ludoya-surface);
	box-shadow: var(--ludoya-shadow);
}

.ludoya-field label {
	font-size: 0.85rem;
	font-weight: 600;
}

.ludoya-field {
	display: grid;
	gap: 0.3rem;
	margin: 0;
}

.ludoya-field--consent label {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
	font-size: 0.9rem;
}

.ludoya-field input[type="text"],
.ludoya-field input[type="email"],
.ludoya-field input[type="date"],
.ludoya-field select,
.ludoya-field textarea {
	width: 100%;
	padding: 0.5rem 0.65rem;
	border: 1px solid var(--ludoya-border);
	border-radius: 8px;
	background: transparent;
	color: inherit;
	font: inherit;
}

.ludoya-field input:focus-visible,
.ludoya-field select:focus-visible,
.ludoya-field textarea:focus-visible {
	outline: 2px solid color-mix(in srgb, currentColor 45%, transparent);
	outline-offset: 1px;
}

.ludoya-choices,
.ludoya-scale {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	align-items: center;
}

.ludoya-choice {
	display: inline-flex;
	gap: 0.35rem;
	align-items: center;
}

.ludoya-grid {
	border-collapse: collapse;
	width: 100%;
}

.ludoya-grid th,
.ludoya-grid td {
	border-bottom: 1px solid var(--ludoya-border);
	padding: 0.4rem;
	text-align: center;
}

.ludoya-grid th[scope="row"] {
	text-align: left;
}

/* The honeypot must be reachable by nothing a person uses, and invisible to everyone. */
.ludoya-hp {
	position: absolute !important;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

.ludoya-notice {
	padding: 0.65rem 0.9rem;
	border-radius: 8px;
	background: var(--ludoya-surface);
	border-left: 3px solid var(--ludoya-muted);
}

.ludoya-notice--ok {
	border-left-color: var(--ludoya-status-positive);
	color: var(--ludoya-status-positive);
}

.ludoya-notice--error {
	border-left-color: var(--ludoya-status-negative);
	color: var(--ludoya-status-negative);
}

.ludoya-error {
	padding: 0.75rem 1rem;
	border: 1px dashed currentColor;
	border-radius: 6px;
	font-size: 0.9rem;
}

/* Collection, stats, locations -------------------------------------------- */

.ludoya-collection__count {
	color: var(--ludoya-muted);
	font-size: 0.9rem;
	margin-top: 0;
}

.ludoya-games {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.ludoya-collection--list .ludoya-games {
	grid-template-columns: 1fr;
}

.ludoya-game a {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
	height: 100%;
	padding: 0.6rem;
	border-radius: var(--ludoya-radius);
	background: var(--ludoya-surface);
	box-shadow: var(--ludoya-shadow);
	color: inherit;
	text-decoration: none;
	transition: box-shadow 120ms ease, transform 120ms ease;
}

.ludoya-game a:hover,
.ludoya-game a:focus-visible {
	box-shadow: var(--ludoya-shadow-hover);
	color: inherit;
	text-decoration: none;
	transform: translateY(-1px);
}

.ludoya-game__cover {
	display: block;
	aspect-ratio: 1 / 1;
	border-radius: 8px;
	overflow: hidden;
	background: var(--ludoya-tile-empty);
	margin-bottom: 0.4rem;
}

.ludoya-game__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ludoya-game__cover .ludoya-card__tile {
	font-size: 2.2rem;
}

.ludoya-game__name {
	font-weight: 700;
	font-size: 0.9rem;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

.ludoya-game__meta {
	font-size: 0.8rem;
	color: var(--ludoya-muted);
}

/* List layout: the tile becomes a row, cover on the left, like an event card. */
.ludoya-collection--list .ludoya-game a {
	flex-direction: row;
	align-items: center;
	gap: 0.75rem;
}

.ludoya-collection--list .ludoya-game__cover {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	margin-bottom: 0;
}

.ludoya-collection--list .ludoya-game__name {
	flex: 1 1 auto;
}

.ludoya-tiles {
	list-style: none;
	margin: 0 0 var(--ludoya-gap);
	padding: 0;
	display: grid;
	gap: 0.75rem;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.ludoya-tile {
	border-radius: var(--ludoya-radius);
	background: var(--ludoya-surface);
	box-shadow: var(--ludoya-shadow);
	padding: 1rem;
	display: grid;
	gap: 0.2rem;
	text-align: center;
}

.ludoya-tile__value {
	font-size: 1.6rem;
	font-weight: 700;
	line-height: 1.1;
}

.ludoya-tile__label {
	font-size: 0.8rem;
	color: var(--ludoya-muted);
}

.ludoya-top-games {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.4rem;
	counter-reset: none;
}

.ludoya-top-games li {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.45rem 0.6rem;
	border-radius: 8px;
	background: var(--ludoya-surface);
}

.ludoya-top-games__rank {
	flex: 0 0 1.4rem;
	text-align: center;
	font-weight: 700;
	color: var(--ludoya-muted);
}

.ludoya-top-games__cover {
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 6px;
	overflow: hidden;
	background: var(--ludoya-tile-empty);
}

.ludoya-top-games__cover img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ludoya-top-games__cover .ludoya-card__tile {
	font-size: 1rem;
}

.ludoya-top-games a {
	flex: 1 1 auto;
	color: inherit;
	text-decoration: none;
	font-weight: 600;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.ludoya-top-games a:hover {
	text-decoration: underline;
}

.ludoya-top-games__count {
	flex: 0 0 auto;
	font-size: 0.8rem;
	color: var(--ludoya-muted);
}

.ludoya-location-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 0.75rem;
}

.ludoya-location {
	display: flex;
	gap: 0.75rem;
	align-items: center;
	padding: 0.6rem;
	border-radius: var(--ludoya-radius);
	background: var(--ludoya-surface);
	box-shadow: var(--ludoya-shadow);
}

.ludoya-location__media {
	flex: 0 0 auto;
	width: 56px;
	height: 56px;
	border-radius: 8px;
	overflow: hidden;
	background: var(--ludoya-tile-empty);
}

.ludoya-location__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.ludoya-location__body {
	min-width: 0;
}

.ludoya-location__body strong {
	display: block;
	font-size: 0.95rem;
}

.ludoya-location__address {
	display: block;
	font-size: 0.8rem;
	color: var(--ludoya-muted);
}

.ludoya-location__description {
	display: block;
	margin-top: 0.35rem;
	font-size: 0.85rem;
}

.ludoya-location__description p {
	margin: 0 0 0.5em;
}
