/**
 * NusantaRun Runner Widget styles.
 * Colors are exposed as CSS custom properties on .nr-runner-widget so they can be
 * overridden per-theme (e.g. in the child theme's stylesheet) without editing this file.
 *
 * Breakpoints (768px / 480px) and the card entrance animation intentionally match
 * live.nusanta.run's own runner grid for visual consistency across NusantaRun's web
 * properties.
 */

.nr-runner-widget {
	--nr-red: #b10000;
	--nr-gold: #ce920b;
	--nr-gold-alpha: rgba(206, 146, 11,.5);
	--nr-gold-soft: #f7ecd8;
	--nr-gold-text: #8a6a1f;
	--nr-text: #1a1a1a;
	--nr-muted: #6b6b6b;
	--nr-avatar-bg: #ce920b;

	/* No max-width / auto margin: the theme's own container controls width. */
	margin: 0;
	box-sizing: border-box;
}

.nr-runner-widget *,
.nr-runner-widget *::before,
.nr-runner-widget *::after {
	box-sizing: inherit;
}

.nr-runner-widget__bar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 24px;
	flex-wrap: wrap;
	margin-bottom: 32px;
}

body .nr-runner-widget__search {
	flex: 1 1 320px;
	border: none;
	border-bottom: 1px solid var(--nr-gold);
	border-radius: 0;
	background: transparent;
	padding: 10px 4px;
	font-size: 14px;
	color: var(--nr-gold);
	outline: none;
}

.nr-runner-widget__search::placeholder {
	color: var(--nr-gold);
	opacity: 0.8;
}

.nr-runner-widget__tabs {
	display: flex;
	border: 1px solid var(--nr-gold);
	overflow: hidden;
	flex: 0 0 auto;
}

.nr-runner-widget__tab {
	border: none;
	border-left: 1px solid var(--nr-gold);
	background-color: #fff;
	background-image: linear-gradient(var(--nr-gold-soft), #fff);
	color: var(--nr-gold);
	padding: 14px 22px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	white-space: nowrap;
}

.nr-runner-widget__tab:first-child {
	border-left: none;
}

.nr-runner-widget__tab.is-active {
	background-image: none;
	color: var(--nr-gold);
}

.nr-runner-widget__status {
	text-align: center;
	color: var(--nr-muted);
	margin: 24px 0;
}

.nr-runner-widget__status:empty {
	display: none;
}

/* Desktop (default): 5 columns. */
.nr-runner-widget__grid {
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	gap: 20px;
}

/* Tablet: */
@media (max-width: 768px) {
	.nr-runner-widget__grid {
		grid-template-columns: repeat(3, 1fr);
		gap: 15px;
	}
	.nr-runner-card__bib{
		font-size: 12px;
	}
	.nr-runner-card__name{
		font-size: 14px
	}
	.nr-runner-card__country{
		font-size: 8px;
	}
	.nr-runner-widget__tab{
		flex: 1
	}
}

/* Mobile: */
@media (max-width: 480px) {
	.nr-runner-widget__bar {
		flex-direction: column;
		align-items: stretch;
		gap: 10px;
	}
	body .nr-runner-widget__search{
		flex: 1;
	}
}

.nr-runner-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	background: none;
	border: none;
	font: inherit;
	gap: 2.5px;
	transition: opacity .5s ease;
}

/* Entrance/exit: JS adds .is-entering to a newly-inserted card and .is-leaving to one
   about to be removed; it never toggles both, and never needs to force a reflow first,
   since @keyframes (unlike CSS transitions) run as soon as the class lands. */
@keyframes nrRunnerCardEnter {
	from {
		opacity: 0;
		filter: blur(5px);
		transform: translateY(30px);
	}
	to {
		opacity: 1;
		filter: blur(0);
		transform: translateY(0);
	}
}

@keyframes nrRunnerCardExit {
	from {
		opacity: 1;
		filter: blur(0);
		transform: translateY(0);
	}
	to {
		opacity: 0;
		filter: blur(5px);
		transform: translateY(-20px);
	}
}

.nr-runner-card.is-entering {
	animation: nrRunnerCardEnter 0.5s ease-out forwards;
}

.nr-runner-card.is-leaving {
	animation: nrRunnerCardExit 0.3s ease-in forwards;
	pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
	.nr-runner-card.is-entering,
	.nr-runner-card.is-leaving {
		animation: none;
	}
}

.nr-runner-card__avatar {
	/* Scales with the column instead of a fixed 180px so 5-up desktop columns still
	   render a circle instead of an oval; aspect-ratio keeps width and height locked. */
	width: 100%;
	max-width: 180px;
	aspect-ratio: 1 / 1;
	border-radius: 50%;
	background: var(--nr-avatar-bg);
	color: white;
	box-shadow: 0px 0px 0px var(--nr-gold-alpha);
    margin: 0 auto 10px;
}

.nr-runner-card__avatar img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	border-radius: 50%;
}

.nr-runner-card__bib {
	color: var(--nr-gold);
	font-weight: 700;
	font-size: 16px;
	line-height: 1;
	mask: linear-gradient(black, rgba(0, 0, 0, .25));
	-webkit-mask: linear-gradient(black, rgba(0, 0, 0, .25));
}

.nr-runner-card__name {
	color: var(--nr-text);
	font-weight: 700;
	font-size: 16px;
	line-height: 1.1;
}

.nr-runner-card__country {
	color: var(--nr-muted);
	font-size: 10px;
	letter-spacing: 1px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
}

.nr-runner-card__flag {
	font-size: 10px;
	line-height: 1;
}

.nr-runner-widget__load-more {
	display: flex;
	justify-content: center;
	margin-top: 20px;
}

.nr-runner-widget__load-more-btn {
	color: var(--nr-muted);
	background: transparent;
	font-size: 10px;
    padding: 12px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
	cursor: pointer;
	width: 100%;
	border: 1px solid var(--nr-muted);
    border-left: none;
    border-right: none;
    border-radius: 0;
    mask: linear-gradient(90deg, transparent, black, transparent);
	-webkit-mask: linear-gradient(90deg, transparent, black, transparent);
	transition: all .35s ease;
	opacity: .55
}

.nr-runner-widget__load-more-btn:hover,
.nr-runner-widget__load-more-btn:focus-visible {
	letter-spacing: 1px;
	opacity: 1;
}

.nr-runner-widget__grid:hover .nr-runner-card{
	opacity: .75
}

.nr-runner-widget__grid .nr-runner-card:hover{
	opacity: 1
}

.nr-runner-card:hover .nr-runner-card__avatar {
	box-shadow: 0px 0px 20px var(--nr-gold-alpha);
}

.nr-runner-widget-error {
	color: #b3261e;
}