/**
 * WC Pedagógica Eventos — front-end styles.
 *
 * Mobile-first, no dependencies. The brand colours come from Settings and are
 * injected as --pedev-brand / --pedev-brand-dark by wp_add_inline_style().
 */

/*
 * Tokens live on :root so the inline <style> printed after this file — which
 * also targets :root — can override --pedev-brand / --pedev-brand-dark with the
 * colours from Settings. Declaring them on .pedev instead would win by
 * proximity and silently discard the configured brand colour.
 */
:root {
	--pedev-brand: #0b5fff;
	--pedev-brand-dark: #06327f;
	--pedev-ink: #101828;
	--pedev-muted: #4b5565;
	--pedev-faint: #667085;
	--pedev-line: #e4e7ec;
	--pedev-border: #8a94a6;
	--pedev-surface: #fff;
	--pedev-soft: #f7f8fa;
	--pedev-radius: 12px;

	/*
	 * Derived brand colours. The brand comes from Settings and may be light
	 * (this client's is orange), so white-on-brand text and brand-on-white
	 * text are not safe to assume.
	 *
	 * --pedev-on-brand   text drawn on a brand-filled surface
	 * --pedev-brand-ink  brand used as text/icon on a white surface
	 *
	 * These static values are the fallback; the @supports block below computes
	 * them from --pedev-brand wherever relative colour syntax is available.
	 */
	--pedev-on-brand: #fff;
	--pedev-on-brand-dark: #fff;
	--pedev-brand-ink: var(--pedev-brand-dark);
}

@supports (color: oklch(from white l c h)) {
	:root {
		/*
		 * Lightness below ~0.68 in OKLch -> white text; above -> near-black.
		 * clamp() turns the comparison into a step function.
		 */
		--pedev-on-brand: oklch(from var(--pedev-brand) clamp(0.15, (0.68 - l) * 100, 1) 0 h);
		--pedev-on-brand-dark: oklch(from var(--pedev-brand-dark) clamp(0.15, (0.68 - l) * 100, 1) 0 h);
		/* Capped lightness keeps brand-coloured text at ~5:1 on white. */
		--pedev-brand-ink: oklch(from var(--pedev-brand) min(l, 0.45) c h);
	}
}

.pedev {
	box-sizing: border-box;
	color: var(--pedev-ink);
	font-size: 16px;
	line-height: 1.5;
	margin: 2rem 0;
}

.pedev *,
.pedev *::before,
.pedev *::after {
	box-sizing: inherit;
}

/* ---------------------------------------------------------------- Cards */

.pedev-card {
	background: var(--pedev-surface);
	border: 1px solid var(--pedev-line);
	border-radius: var(--pedev-radius);
	padding: 1.25rem;
}

.pedev-card + .pedev-card,
.pedev-card + .pedev-tickets,
.pedev-tickets + .pedev-card {
	margin-top: 1.25rem;
}

.pedev-empty {
	color: var(--pedev-muted);
	font-style: italic;
	margin: 0;
}

/* ------------------------------------------------------- Event meta card */

.pedev-event__meta {
	display: grid;
	gap: 0.75rem;
}

.pedev-meta {
	display: flex;
	flex-direction: column;
	gap: 0.15rem;
}

.pedev-meta__label {
	color: var(--pedev-muted);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.pedev-meta__value {
	font-size: 1rem;
	font-weight: 500;
	overflow-wrap: anywhere;
}

.pedev-meta__value a {
	color: var(--pedev-brand-ink);
}

@media (min-width: 640px) {
	.pedev-event__meta {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* -------------------------------------------------------------- Lot cards */

.pedev-tickets {
	margin-top: 1.5rem;
}

.pedev-tickets__title,
.pedev-signup__title,
.pedev-success__title,
.pedev-lookup__title,
.pedev-mytickets__title {
	font-size: 1.25rem;
	margin: 0 0 0.75rem;
}

/*
 * One card per lote. The old table split name, price and availability into
 * three columns that only lined up when every row had the same shape — with a
 * single lote it left an empty middle column and floating divider lines. A
 * card is self-contained: body on the left, price + call to action on the
 * right, stacked on narrow screens.
 */
.pedev-lots {
	display: grid;
	gap: 0.75rem;
	margin: 0 0 1.25rem;
}

/* Paid and free lots come in two lists; the seam must not show. */
.pedev-lots + .pedev-lots {
	margin-top: -0.5rem;
}

.pedev-lot {
	align-items: center;
	background: var(--pedev-surface);
	border: 1px solid var(--pedev-line);
	border-radius: var(--pedev-radius);
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1.5rem;
	justify-content: space-between;
	padding: 1rem 1.125rem;
}

.pedev-lot.is-sold-out {
	background: var(--pedev-soft);
}

.pedev-lot__body {
	display: flex;
	flex: 1 1 15rem;
	flex-direction: column;
	gap: 0.2rem;
	min-width: 0;
}

.pedev-lot__name {
	font-size: 1.0625rem;
	font-weight: 700;
	line-height: 1.3;
	margin: 0;
}

.pedev-lot__desc {
	color: var(--pedev-muted);
	font-size: 0.9375rem;
	line-height: 1.45;
	margin: 0;
	overflow-wrap: anywhere;
}

.pedev-lot__until {
	color: var(--pedev-faint);
	font-size: 0.8125rem;
	margin: 0.15rem 0 0;
}

.pedev-lot__aside {
	align-items: center;
	display: flex;
	flex: 0 1 auto;
	flex-wrap: wrap;
	gap: 0.5rem 0.875rem;
	justify-content: flex-end;
}

.pedev-lot__price {
	font-size: 1.0625rem;
	font-weight: 700;
	white-space: nowrap;
}

.pedev-price--free {
	color: #067647;
}

.pedev-lot__qty {
	align-items: center;
	display: inline-flex;
	gap: 0.4rem;
}

.pedev-lot__qty-label,
.pedev-lot__hint {
	color: var(--pedev-muted);
	font-size: 0.8125rem;
	font-weight: 600;
}

.pedev-qty {
	border: 1px solid var(--pedev-border);
	border-radius: 8px;
	font: inherit;
	font-size: 1rem;
	min-height: 44px;
	padding: 0.45rem 0.5rem;
	text-align: center;
	width: 4.5rem;
}

.pedev-lot__cta {
	white-space: nowrap;
}

.pedev-lots__actions {
	margin: 0 0 1.25rem;
}

@media (max-width: 34.99em) {
	.pedev-lot {
		align-items: stretch;
		flex-direction: column;
	}

	.pedev-lot__aside {
		justify-content: space-between;
	}

	.pedev-lot__cta {
		flex: 1 1 auto;
	}

	.pedev-lots__actions .pedev-btn {
		display: block;
		width: 100%;
	}
}

/* ----------------------------------------------------------- Buttons */

.pedev-btn {
	-webkit-appearance: none;
	appearance: none;
	align-items: center;
	background: var(--pedev-brand);
	border: 1px solid var(--pedev-brand);
	border-radius: 10px;
	color: var(--pedev-on-brand);
	cursor: pointer;
	display: inline-flex;
	font: inherit;
	font-size: 0.95rem;
	font-weight: 600;
	justify-content: center;
	line-height: 1.2;
	/* 44px is the smallest comfortable touch target. */
	min-height: 44px;
	padding: 0.7rem 1.15rem;
	text-align: center;
	text-decoration: none;
	transition: background 0.15s ease, border-color 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
	.pedev-btn,
	.pedev-grid__item {
		transition: none;
	}
}

.pedev-btn:hover,
.pedev-btn:focus {
	background: var(--pedev-brand-dark);
	border-color: var(--pedev-brand-dark);
	color: var(--pedev-on-brand-dark);
}

.pedev-btn--ghost {
	background: transparent;
	border-color: var(--pedev-border);
	color: var(--pedev-brand-ink);
	font-size: 0.85rem;
	padding: 0.4rem 0.75rem;
}

.pedev-btn--ghost:hover,
.pedev-btn--ghost:focus {
	background: var(--pedev-soft);
	border-color: var(--pedev-brand);
	color: var(--pedev-brand-ink);
}

/* ------------------------------------------------------------- Forms */

.pedev-form {
	margin: 0;
}

.pedev-field {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	margin: 0 0 0.9rem;
}

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

.pedev-field__opt {
	color: var(--pedev-muted);
	font-weight: 400;
}

.pedev-field input[type="text"],
.pedev-field input[type="email"],
.pedev-field input[type="tel"],
.pedev-field input[type="number"],
.pedev-field select {
	border: 1px solid var(--pedev-border);
	border-radius: 10px;
	font: inherit;
	font-size: 1rem;
	padding: 0.6rem 0.7rem;
	width: 100%;
}

.pedev-field input:focus,
.pedev-field select:focus {
	border-color: var(--pedev-brand);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--pedev-brand) 30%, transparent);
	outline: 2px solid var(--pedev-brand-ink);
	outline-offset: 1px;
}

.pedev-field--check label {
	align-items: flex-start;
	display: flex;
	font-weight: 400;
	gap: 0.5rem;
	font-size: 0.9rem;
}

.pedev-row {
	display: grid;
	gap: 0 1rem;
}

@media (min-width: 640px) {
	.pedev-row {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.pedev-row .pedev-field--narrow {
		max-width: 9rem;
	}
}

/* Honeypot: off-screen but still focusable-free for bots. */
.pedev-hp {
	height: 0;
	left: -9999px;
	overflow: hidden;
	position: absolute;
	width: 0;
}

/* ------------------------------------------------------------ Alerts */

.pedev-alert {
	border-radius: 10px;
	font-size: 0.9rem;
	margin: 0 0 1rem;
	padding: 0.75rem 1rem;
}

ul.pedev-alert {
	list-style: disc;
	padding-left: 2rem;
	padding-right: 1rem;
}

.pedev-alert--error {
	background: #fef3f2;
	border: 1px solid #fda29b;
	color: #b42318;
}

.pedev-alert--warn {
	background: #fffaeb;
	border: 1px solid #fec84b;
	color: #b54708;
}

.pedev-alert--info {
	background: #eff8ff;
	border: 1px solid #b2ddff;
	color: #175cd3;
}

/* ------------------------------------------------------------ Badges */

.pedev-badge {
	background: var(--pedev-soft);
	border: 1px solid var(--pedev-line);
	border-radius: 999px;
	color: var(--pedev-muted);
	display: inline-block;
	font-size: 0.72rem;
	font-weight: 600;
	letter-spacing: 0.03em;
	padding: 0.2rem 0.6rem;
	text-transform: uppercase;
	white-space: nowrap;
}

.pedev-badge--issued {
	background: #ecfdf3;
	border-color: #abefc6;
	color: #067647;
}

.pedev-badge--checked-in {
	background: #eff8ff;
	border-color: #b2ddff;
	color: #175cd3;
}

.pedev-badge--cancelled,
.pedev-badge--refunded {
	background: #fef3f2;
	border-color: #fda29b;
	color: #b42318;
}

.pedev-badge--pending {
	background: #fffaeb;
	border-color: #fec84b;
	color: #b54708;
}

/* -------------------------------------------------------- Event grid */

.pedev-grid {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 600px) {
	.pedev-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (min-width: 960px) {
	.pedev-grid {
		grid-template-columns: repeat(3, minmax(0, 1fr));
	}
}

.pedev-grid__item {
	overflow: hidden;
	padding: 0;
	transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.pedev-grid__item:hover {
	box-shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
	transform: translateY(-2px);
}

.pedev-grid__link {
	color: inherit;
	display: block;
	height: 100%;
	text-decoration: none;
}

.pedev-grid__thumb img {
	aspect-ratio: 16 / 9;
	display: block;
	height: auto;
	object-fit: cover;
	width: 100%;
}

.pedev-grid__body {
	display: flex;
	flex-direction: column;
	gap: 0.3rem;
	padding: 1rem;
}

.pedev-grid__date {
	color: var(--pedev-brand-ink);
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.pedev-grid__title {
	font-size: 1.05rem;
	line-height: 1.3;
	margin: 0;
}

.pedev-grid__venue {
	color: var(--pedev-muted);
	font-size: 0.85rem;
}

/* ------------------------------------------------------ Ticket lists */

.pedev-ticket-list {
	list-style: none;
	margin: 0.75rem 0 0;
	padding: 0;
}

.pedev-ticket-list__item {
	align-items: center;
	border-top: 1px solid var(--pedev-line);
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 0.75rem;
	padding: 0.7rem 0;
}

.pedev-ticket-list__item:first-child {
	border-top: 0;
}

.pedev-ticket-list__holder {
	color: var(--pedev-muted);
	font-size: 0.9rem;
	flex: 1 1 auto;
}

.pedev-code {
	background: var(--pedev-soft);
	border: 1px dashed var(--pedev-line);
	border-radius: 8px;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 0.95rem;
	letter-spacing: 0.08em;
	padding: 0.25rem 0.55rem;
}

.pedev-mytickets__group + .pedev-mytickets__group {
	margin-top: 1rem;
}

.pedev-mytickets__event {
	font-size: 1.05rem;
	margin: 0;
}

.pedev-mytickets__event a {
	color: inherit;
	text-decoration: none;
}

.pedev-mytickets__event a:hover {
	color: var(--pedev-brand-ink);
}

/* ---------------------------------------------------------- Success */

.pedev-success {
	border-color: #abefc6;
	background: #f6fef9;
}

.pedev-success__title {
	color: #067647;
}

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

/* --------------------------------------- WooCommerce order / e-mail */

.pedev-order-tickets {
	margin-bottom: 1.5rem;
	width: 100%;
}

.pedev-admin-tickets ul {
	margin: 0;
	padding-left: 1.1rem;
}

/* --------------------------------------- Plugin single-event template */

/*
 * Only used by templates/single-event.php, which takes over the single view
 * when the classic theme ships no single-pedev_evento.php. Deliberately plain:
 * it has to sit inside whatever header/footer the theme prints.
 */

.pedev-single {
	box-sizing: border-box;
	margin: 0 auto;
	max-width: 46rem;
	padding: 2rem 1rem 3rem;
	width: 100%;
}

.pedev-single__title {
	font-size: clamp(1.5rem, 4vw, 2.25rem);
	line-height: 1.2;
	margin: 0 0 1rem;
}

.pedev-single__thumb {
	margin: 0 0 1.5rem;
}

.pedev-single__thumb img {
	border-radius: 12px;
	display: block;
	height: auto;
	max-width: 100%;
}

.pedev-single__content {
	margin-bottom: 1.5rem;
}

/* =========================================================================
 * Registration states
 *
 * One block per state, each with its own voice: "soon" is an invitation and
 * leads with the brand colour; "closed" and "soldout" are neutral facts.
 * ====================================================================== */
.pedev-state {
	border: 1px solid #e4e7ec;
	border-radius: 12px;
	margin: 1.5rem 0;
	padding: 1.5rem 1.25rem;
	text-align: center;
}

.pedev-state__kicker {
	color: var(--pedev-brand, #0b5fff);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	margin: 0 0 0.375rem;
	text-transform: uppercase;
}

.pedev-state__title {
	color: #101828;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.3;
	margin: 0;
}

.pedev-state__help {
	color: #4b5565;
	font-size: 0.9375rem;
	line-height: 1.5;
	margin: 0.75rem 0 0;
}

.pedev-state__help a {
	color: var(--pedev-brand-dark, #06327f);
}

.pedev-state--soon {
	background: #f7f9ff;
	border-color: color-mix(in srgb, var(--pedev-brand, #0b5fff) 28%, #e4e7ec);
}

.pedev-state--closed,
.pedev-state--past,
.pedev-state--soldout {
	background: #f7f8fa;
}

.pedev-state--admin {
	background: #fffaeb;
	border-color: #f5d590;
	text-align: left;
}

/* ------------------------------------------------------------- countdown */

.pedev-countdown {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	justify-content: center;
	margin-top: 1.125rem;
}

.pedev-countdown:empty {
	display: none;
}

.pedev-countdown__unit {
	background: #fff;
	border: 1px solid #e4e7ec;
	border-radius: 10px;
	min-width: 4.25rem;
	padding: 0.625rem 0.5rem;
}

.pedev-countdown__num {
	color: var(--pedev-brand-dark, #06327f);
	display: block;
	font-size: 1.75rem;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	line-height: 1.1;
}

.pedev-countdown__label {
	color: #667085;
	display: block;
	font-size: 0.6875rem;
	letter-spacing: 0.04em;
	margin-top: 0.125rem;
	text-transform: uppercase;
}

@media (min-width: 40em) {
	.pedev-state {
		padding: 2rem 1.75rem;
	}

	.pedev-state__title {
		font-size: 1.5rem;
	}

	.pedev-countdown__unit {
		min-width: 5rem;
	}

	.pedev-countdown__num {
		font-size: 2.25rem;
	}
}
