/*
Theme Name: Egara Juga!
Description: El web de la fira Egara Juga! de Terrassa. Programa, jocs i inscripcions en directe des de Ludoya.
Version: 1.0.0
Requires at least: 6.5
Requires PHP: 7.4
Text Domain: egarajuga
License: GPL-2.0-or-later
*/

:root {
	--ej-night: var(--wp--preset--color--night);
	--ej-crimson: var(--wp--preset--color--crimson);
	--ej-orange: var(--wp--preset--color--orange);
	--ej-gold: var(--wp--preset--color--gold);
	--ej-bone: var(--wp--preset--color--bone);
	--ej-paper: var(--wp--preset--color--paper);
	--ej-ink: var(--wp--preset--color--ink);
	--ej-muted: var(--wp--preset--color--muted);
	--ej-radius: 14px;
	--ej-shadow: 0 1px 2px rgba(29, 20, 24, 0.06), 0 4px 14px rgba(29, 20, 24, 0.06);
	--ej-shadow-lift: 0 2px 4px rgba(29, 20, 24, 0.08), 0 10px 28px rgba(29, 20, 24, 0.12);
}

/* Padding inside the width, everywhere: a padded box at 100% otherwise spills over its neighbours. */
*,
*::before,
*::after {
	box-sizing: border-box;
}

html {
	scroll-behavior: smooth;
	scroll-padding-top: 5rem;
}

body {
	-webkit-font-smoothing: antialiased;
	text-rendering: optimizeLegibility;
}

:where(a):focus-visible,
:where(button):focus-visible {
	outline: 3px solid var(--ej-orange);
	outline-offset: 3px;
	border-radius: 6px;
}

.skip-link:focus {
	z-index: 1000;
}

/* Header --------------------------------------------------------------------------------------- */

.ej-header {
	position: sticky;
	top: 0;
	z-index: 50;
	background: var(--ej-night);
	color: var(--ej-bone);
	border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.admin-bar .ej-header {
	top: var(--wp-admin--admin-bar--height, 32px);
}

.ej-header__bar {
	min-height: 64px;
}

.ej-header .ej-logo img {
	display: block;
	width: auto;
	height: 44px;
}

.ej-header .wp-block-navigation {
	font-size: 0.95rem;
	font-weight: 600;
	gap: 0.25rem 1.4rem;
}

.ej-header .wp-block-navigation a {
	color: var(--ej-bone);
	text-decoration: none;
	padding: 0.35rem 0;
	border-bottom: 2px solid transparent;
}

.ej-header .wp-block-navigation a:hover,
.ej-header .wp-block-navigation .current-menu-item > a,
.ej-header .wp-block-navigation a[aria-current="page"] {
	color: #fff;
	border-bottom-color: var(--ej-orange);
}

.ej-header .wp-block-navigation__responsive-container.is-menu-open {
	background: var(--ej-night) !important;
	color: var(--ej-bone) !important;
	padding: 1.5rem;
}

.ej-header .wp-block-navigation__responsive-container.is-menu-open .wp-block-navigation__container {
	gap: 1.1rem;
	font-size: 1.35rem;
}

.ej-header .wp-block-navigation__responsive-container-open,
.ej-header .wp-block-navigation__responsive-container-close {
	color: var(--ej-bone);
}

/* Hero ----------------------------------------------------------------------------------------- */

.ej-hero {
	position: relative;
	overflow: hidden;
	background-color: var(--ej-night);
	background-image:
		linear-gradient(180deg, rgba(14, 28, 32, 0.55) 0%, rgba(14, 28, 32, 0.78) 55%, var(--ej-night) 100%),
		var(--ej-hero-image);
	background-size: cover;
	background-position: center 30%;
	color: var(--ej-bone);
	text-align: center;
}

.ej-hero__logo img {
	width: min(340px, 72vw);
	height: auto;
	filter: drop-shadow(0 6px 24px rgba(0, 0, 0, 0.45));
}

.ej-kicker {
	margin: 0;
	font-size: 0.85rem;
	font-weight: 800;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--ej-orange);
}

.ej-hero__date {
	margin: 0.4rem 0 0;
	text-wrap: balance;
	font-size: clamp(1.5rem, 4.2vw, 2.4rem);
	font-weight: 900;
	line-height: 1.1;
	color: #fff;
}

.ej-hero__place {
	margin: 0;
	font-size: 1.1rem;
	font-weight: 600;
	opacity: 0.9;
}

/* A statement, not a button: no fill, so nobody tries to tap it. */
.ej-badge {
	display: inline-flex;
	align-items: center;
	gap: 0.45rem;
	padding: 0.2rem 0;
	border-bottom: 2px solid var(--ej-gold);
	color: var(--ej-gold);
	font-weight: 800;
	font-size: 1.05rem;
	letter-spacing: 0.02em;
}

.ej-hero .ludoya-countdown {
	display: inline-block;
	padding: 1rem clamp(1rem, 4vw, 2rem);
	border-radius: var(--ej-radius);
	background: rgba(255, 255, 255, 0.06);
	box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
	color: #fff;
}

.ej-hero .ludoya-countdown__value {
	color: #fff;
}

.ej-hero .ludoya-countdown__label {
	color: var(--ej-orange);
	opacity: 1;
	font-weight: 700;
}

.ej-hero .ludoya-countdown__now strong {
	color: var(--ej-gold);
}

.ej-hero .wp-block-buttons {
	gap: 0.75rem;
}

.wp-block-button.is-style-ej-light .wp-block-button__link {
	background: transparent;
	color: var(--ej-bone);
	box-shadow: inset 0 0 0 2px rgba(246, 240, 230, 0.55);
}

.wp-block-button.is-style-ej-light .wp-block-button__link:hover {
	background: rgba(246, 240, 230, 0.1);
	color: #fff;
}

.wp-block-button.is-style-ej-orange .wp-block-button__link {
	background: var(--ej-orange);
	color: var(--ej-ink);
}

.wp-block-button.is-style-ej-orange .wp-block-button__link:hover {
	background: #f6b468;
	color: var(--ej-ink);
}

/* Sections ------------------------------------------------------------------------------------- */

.ej-section-title {
	margin-bottom: 0.25rem;
}

.ej-lead {
	font-size: 1.15rem;
	line-height: 1.65;
}

.ej-muted {
	color: var(--ej-muted);
}

.ej-dark {
	background: var(--ej-night);
	color: var(--ej-bone);
}

.ej-dark a:not(.wp-block-button__link) {
	color: var(--ej-orange);
}

.ej-page-head {
	background:
		radial-gradient(1200px 300px at 85% -40%, rgba(161, 11, 66, 0.55), transparent 70%),
		var(--ej-night);
	color: var(--ej-bone);
}

.ej-page-head h1 {
	color: #fff;
	margin: 0;
}

.ej-page-head p {
	margin: 0.5rem 0 0;
	max-width: 46rem;
	opacity: 0.9;
}

/* Area tiles on the front page: one per area of the fair. */
.ej-areas {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
	gap: 1rem;
}

.ej-area {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 0.35rem;
	min-height: 11rem;
	padding: 1.25rem;
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
	color: var(--ej-ink);
	text-decoration: none;
	transition: transform 140ms ease, box-shadow 140ms ease;
	overflow: hidden;
}

.ej-area:hover,
.ej-area:focus-visible {
	transform: translateY(-2px);
	box-shadow: var(--ej-shadow-lift);
	color: var(--ej-ink);
}

.ej-area::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 5px;
	background: var(--ej-area-colour, var(--ej-crimson));
}

.ej-area__icon {
	font-size: 1.8rem;
	line-height: 1;
}

.ej-area__name {
	font-size: 1.2rem;
	font-weight: 800;
}

.ej-area__text {
	font-size: 0.92rem;
	color: var(--ej-muted);
	line-height: 1.5;
}

.ej-area__more {
	margin-top: auto;
	font-size: 0.9rem;
	font-weight: 700;
	color: var(--ej-crimson);
}

/* Facts strip. */
.ej-facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1rem;
	text-align: center;
}

.ej-fact strong {
	display: block;
	font-size: clamp(1.8rem, 4vw, 2.6rem);
	font-weight: 900;
	line-height: 1;
	color: var(--ej-orange);
}

.ej-fact span {
	font-size: 0.9rem;
	opacity: 0.85;
}

/* Poster */
.ej-poster img {
	border-radius: var(--ej-radius);
	box-shadow: var(--ej-shadow-lift);
}

/* Organisers and sponsors */
.ej-org-card {
	padding: 1.25rem;
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
	height: 100%;
}

.ej-org-card h3 {
	margin-top: 0;
}

.ej-logos li {
	display: flex;
}

.ej-logos li > a {
	flex: 1 1 auto;
}

.ej-logos {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
	grid-auto-rows: 1fr;
	gap: 1rem;
	margin: 0 0 var(--wp--preset--spacing--50);
	padding: 0;
	list-style: none;
}

/* A white logo needs a dark tile. */
.ej-logos .is-dark a {
	background: var(--ej-night);
	color: var(--ej-bone);
}

.ej-support {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1rem 1.5rem;
	margin-bottom: var(--wp--preset--spacing--40);
	padding: 1.25rem 1.5rem;
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
}

.ej-support p {
	margin: 0;
}

.ej-support strong {
	font-size: 1.15rem;
}

/* Instagram band */
.ej-insta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: clamp(1.25rem, 3vw, 2rem);
	border-radius: var(--ej-radius);
	background: linear-gradient(120deg, var(--ej-crimson), #5a0a3a);
	color: #fff;
}

.ej-insta p {
	margin: 0;
}

.ej-insta strong {
	display: block;
	font-size: 1.35rem;
}

.ej-insta a.wp-element-button {
	background: #fff;
	color: var(--ej-crimson);
	text-decoration: none;
	border-radius: 999px;
	padding: 0.75rem 1.4rem;
	font-weight: 700;
}

/* Previous editions */
.ej-gallery {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 0.6rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.ej-gallery img {
	display: block;
	width: 100%;
	aspect-ratio: 4 / 3;
	object-fit: cover;
	border-radius: 10px;
}

/* Contact form (Contact Form 7), in the same language as the sign-up form. */
.wpcf7 form {
	display: grid;
	gap: 0.25rem;
	max-width: 36rem;
	padding: clamp(1rem, 3vw, 1.6rem);
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
}

.wpcf7 label {
	display: block;
	font-weight: 600;
	font-size: 0.95rem;
}

.wpcf7 input[type="text"],
.wpcf7 input[type="email"],
.wpcf7 textarea {
	box-sizing: border-box;
	width: 100%;
	margin-top: 0.35rem;
	padding: 0.75rem 0.9rem;
	border: 1px solid rgba(29, 20, 24, 0.18);
	border-radius: 10px;
	background: #fff;
	color: var(--ej-ink);
	font: inherit;
}

.wpcf7 textarea {
	min-height: 9rem;
}

.wpcf7 input:focus-visible,
.wpcf7 textarea:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--ej-crimson) 45%, transparent);
	outline-offset: 1px;
}

.wpcf7 .wpcf7-acceptance .wpcf7-list-item {
	margin: 0;
}

.wpcf7 .wpcf7-acceptance label {
	display: flex;
	gap: 0.5rem;
	align-items: flex-start;
	font-weight: 400;
}

.wpcf7 input[type="submit"] {
	justify-self: start;
	padding: 0.8rem 1.6rem;
	border: 0;
	border-radius: 999px;
	background: var(--ej-crimson);
	color: #fff;
	font: inherit;
	font-weight: 700;
	cursor: pointer;
}

.wpcf7 input[type="submit"]:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.wpcf7 .wpcf7-spinner {
	display: none;
}

.ej-logos a {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	height: 100%;
	min-height: 120px;
	padding: 0.9rem;
	border-radius: 12px;
	background: #fff;
	box-shadow: var(--ej-shadow);
	color: var(--ej-ink);
	font-size: 0.8rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	transition: transform 140ms ease, box-shadow 140ms ease;
}

.ej-logos a:hover {
	transform: translateY(-2px);
	box-shadow: var(--ej-shadow-lift);
	color: var(--ej-ink);
}

.ej-logos img {
	max-width: 100%;
	max-height: 64px;
	object-fit: contain;
}

/* Directions */
.ej-how {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
	gap: 1rem;
}

.ej-how > div {
	padding: 1.1rem 1.2rem;
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
}

.ej-how h3 {
	margin: 0 0 0.35rem;
	font-size: 1.05rem;
}

.ej-how p {
	margin: 0;
	font-size: 0.95rem;
}

.ej-map iframe {
	display: block;
	width: 100%;
	height: 380px;
	border: 0;
	border-radius: var(--ej-radius);
	box-shadow: var(--ej-shadow);
}

.ej-map-consent {
	display: grid;
	place-items: center;
	gap: 0.75rem;
	height: 380px;
	padding: 1rem;
	border-radius: var(--ej-radius);
	background:
		repeating-linear-gradient(45deg, rgba(14, 28, 32, 0.04) 0 12px, transparent 12px 24px),
		var(--ej-paper);
	box-shadow: var(--ej-shadow);
	text-align: center;
}

/* Footer */
.ej-footer {
	background: var(--ej-night);
	color: var(--ej-bone);
	font-size: 0.95rem;
}

.ej-footer a {
	color: var(--ej-bone);
	text-decoration: none;
}

.ej-footer a:hover {
	text-decoration: underline;
}

.ej-footer h2 {
	margin-bottom: 0.75rem;
}

.ej-footer a:hover {
	color: var(--ej-orange);
}

.ej-footer .ej-logo img {
	height: 72px;
	width: auto;
}

.ej-footer__links {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: 0.4rem;
}

.ej-footer__small {
	font-size: 0.8rem;
	opacity: 0.7;
}

/* The Ludoya blocks, in the fair's colours ----------------------------------------------------- */

.ludoya {
	--ludoya-surface: var(--ej-paper);
	--ludoya-radius: 12px;
	--ludoya-shadow: var(--ej-shadow);
	--ludoya-shadow-hover: var(--ej-shadow-lift);
	--ludoya-accent: var(--ej-crimson);
	color: var(--ej-ink);
}

.ludoya .ludoya-card {
	background: var(--ej-paper);
	padding: 0.75rem;
}

.ludoya .ludoya-card__title {
	font-size: 1.02rem;
	font-weight: 700;
	line-height: 1.3;
}

.ludoya .ludoya-card__when {
	font-size: 0.85rem;
	font-weight: 600;
	color: var(--ej-muted);
}

.ludoya .ludoya-programme__item--running .ludoya-card__when {
	color: #1f6b3a;
	font-weight: 700;
}

.ludoya .ludoya-card__game,
.ludoya .ludoya-card__where {
	font-size: 0.875rem;
}

.ludoya .ludoya-tag {
	font-size: 0.75rem;
	padding: 0.15rem 0.6rem;
}

.ludoya .ludoya-tag--positive {
	color: #1f6b2c;
	background: #e1f2e3;
}

.ludoya .ludoya-tag--warning {
	color: #8a4b00;
	background: #fde9c8;
}

/* One colour per area, the same on the home tiles, the filter dots and the card tags. Seats left
   keep green to themselves. */
.ludoya [data-area-name="jocs-de-taula"] { --ej-area: #1d6a8a; }
.ludoya [data-area-name="rol"] { --ej-area: #c26a12; }
.ludoya [data-area-name="blood-on-the-clocktower"] { --ej-area: #5b2a6e; }
.ludoya [data-area-name="miniatures"] { --ej-area: #2f6f5e; }

.ludoya .ludoya-tag--area {
	color: var(--ej-area, var(--ej-muted));
	background: transparent;
	box-shadow: inset 0 0 0 1.5px var(--ej-area, currentColor);
}

.ludoya .ludoya-chip--area::before {
	background: var(--ej-area, currentColor);
}

/* No art of its own and no game box: the fair's die, on its area's colour, instead of a letter. */
.ludoya .ludoya-card__tile {
	font-size: 0;
	background:
		url("assets/img/dau.svg") center / 52% no-repeat,
		color-mix(in srgb, var(--ej-tile, var(--ej-orange)) 26%, var(--ej-bone));
}

.ludoya-programme__item[data-area-name="jocs-de-taula"],
.ludoya-card:has([data-area-name="jocs-de-taula"]),
.ludoya-event:has(.ludoya-event__headings [data-area-name="jocs-de-taula"]) { --ej-tile: #1d6a8a; }
.ludoya-programme__item[data-area-name="rol"],
.ludoya-card:has([data-area-name="rol"]),
.ludoya-event:has(.ludoya-event__headings [data-area-name="rol"]) { --ej-tile: #c26a12; }
.ludoya-programme__item[data-area-name="blood-on-the-clocktower"],
.ludoya-card:has([data-area-name="blood-on-the-clocktower"]),
.ludoya-event:has(.ludoya-event__headings [data-area-name="blood-on-the-clocktower"]) { --ej-tile: #5b2a6e; }
.ludoya-programme__item[data-area-name="miniatures"],
.ludoya-card:has([data-area-name="miniatures"]),
.ludoya-event:has(.ludoya-event__headings [data-area-name="miniatures"]) { --ej-tile: #2f6f5e; }

.ludoya .ludoya-programme__slot--continues .ludoya-programme__time {
	font-size: 0.85rem;
	font-weight: 700;
}

.ludoya .ludoya-event-game__name {
	overflow-wrap: break-word;
	hyphens: auto;
}

/* Whole words: Catalan has no hyphenation dictionary in most browsers, so "break-word" split
   "Transgalactica" in two. A slightly smaller name fits the narrow tiles instead. */
.ludoya .ludoya-game__name {
	font-size: 0.8rem;
	line-height: 1.25;
}

.ludoya .ludoya-card__media {
	width: 64px;
	height: 64px;
	border-radius: 10px;
}

.ludoya .ludoya-programme__filters {
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
}

.ludoya .ludoya-chip[aria-pressed="true"] {
	background: var(--ej-crimson);
	color: #fff;
	box-shadow: none;
}

/* A selected area keeps its colour: a white ring around the dot instead of losing it. */
.ludoya .ludoya-chip--area[aria-pressed="true"]::before {
	box-shadow: 0 0 0 2px #fff;
}

.ludoya .ludoya-programme__section--along {
	background: color-mix(in srgb, var(--ej-orange) 14%, var(--ej-bone));
}

.ludoya .ludoya-programme__day {
	font-size: 1.35rem;
	font-weight: 900;
	color: var(--ej-ink);
	border-bottom: 3px solid var(--ej-crimson);
	padding-bottom: 0.4rem;
}

.ludoya .ludoya-programme__section--along .ludoya-programme__day {
	border-bottom: 0;
}

.ludoya .ludoya-programme__slot .ludoya-programme__time {
	color: var(--ej-crimson);
	font-size: 1.1rem;
	font-weight: 900;
}

.ludoya .ludoya-button {
	background: var(--ej-crimson);
	color: #fff;
	box-shadow: none;
	padding: 0.7rem 1.4rem;
}

.ludoya .ludoya-button:hover,
.ludoya .ludoya-button:focus-visible {
	background: var(--wp--preset--color--crimson-dark);
	color: #fff;
}

.ludoya .ludoya-button--quiet {
	background: transparent;
	color: var(--ej-crimson);
	box-shadow: inset 0 0 0 2px var(--ej-crimson);
}

.ludoya .ludoya-button--quiet:hover {
	background: color-mix(in srgb, var(--ej-crimson) 10%, transparent);
	color: var(--ej-crimson);
}

.ludoya .ludoya-event-game {
	background: var(--ej-paper);
}

/* The shared activity page: the plugin's single view, framed. */
.ej-activity .ludoya-event {
	padding: clamp(1rem, 3vw, 2rem);
	border-radius: var(--ej-radius);
	background: var(--ej-paper);
	box-shadow: var(--ej-shadow);
}

.ej-activity .ludoya-event__title {
	font-size: clamp(1.6rem, 4vw, 2.2rem);
	font-weight: 900;
	margin: 0.15rem 0;
}

.ej-activity .ludoya-event__art {
	width: 120px;
	height: 120px;
}

/* The form sits inside the activity's card: no second card around it. */
.ej-activity .ludoya-form {
	padding: 0;
	background: transparent;
	box-shadow: none;
}

.ej-activity .ludoya-field input[type="text"],
.ej-activity .ludoya-field input[type="email"],
.ej-activity .ludoya-field textarea,
.ej-activity .ludoya-field select {
	padding: 0.75rem 0.9rem;
	border-radius: 10px;
	background: #fff;
}

.ej-activity .ludoya-event__back a {
	font-weight: 700;
	text-decoration: none;
}

@media (max-width: 600px) {
	.ej-header .ej-logo img {
		height: 38px;
	}

	/* Four areas as a 2×2 grid of short tiles: four full-width cards were four screens of scrolling
	   before the programme. */
	.ej-areas {
		grid-template-columns: 1fr 1fr;
		gap: 0.6rem;
	}

	.ej-area {
		min-height: 0;
		padding: 0.9rem 0.8rem;
	}

	.ej-area__text {
		display: none;
	}

	.ej-area__name {
		font-size: 1rem;
		line-height: 1.25;
	}

	.ej-area__more {
		font-size: 0.8rem;
	}

	.ej-gallery {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.ej-activity .ludoya-event__art {
		width: 72px;
		height: 72px;
	}
}

@media (prefers-reduced-motion: reduce) {
	html {
		scroll-behavior: auto;
	}

	.ej-area,
	.ej-logos a {
		transition: none;
	}
}
