/* ========================================================================== */
/* Main hero block */
/* ========================================================================== */

.tl-hero-main {
	position: relative;
	min-height: clamp(320px, 45vw, 600px);

	.bg {
		position: absolute;
		inset: 0;
		overflow: hidden;
	}

	.bg-image {
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		animation: main-hero-flight 40s ease-in-out infinite alternate;
		will-change: transform;
	}

	.overlay {
		background: var(--tblr-body-bg);
		position: absolute;
		bottom: -1px;
		padding: clamp(1.5rem, 4vw, 3.5rem);

		header {
			display: grid;
			gap: 0.7rem;

      .title {
        width: 87%;
      }
		}

		@supports (clip-path: polygon(0 100%, 0 0, 100% 0, 100% 100%)) {
			clip-path: polygon(0 100%, 0 0, 76% 0, 100% 100%, 100% 100%);
		}
	}

	.title {
		font-family: Boogaloo;
		font-weight: normal;
		margin: 0;
		max-width: 16ch;
		font-size: clamp(2rem, 7.2vw, 5rem);
		line-height: 0.95;
		letter-spacing: 0.01em;
	}

	.kicker {
		text-transform: uppercase;
		letter-spacing: 0.12em;
		font-size: 0.82rem;
		margin: 0;
	}

	.long {
		margin: 0;
		max-width: 40ch;
		font-size: clamp(16px, 2vw, 24px);
		line-height: 1.5;
    padding-right: clamp(0rem, 4vw, 3rem);
	}

	@media (max-width: 575px) {
		min-height: 390px;

		.title {
			max-width: 100%;
		}
	}
}

/* ========================================================================== */
/* Background graphic */
/* ========================================================================== */

.background-graphic {
	position: relative;

	&::before {
		content: "";
		position: absolute;
		top: 50%;
		left: 50%;
		width: clamp(58rem, 92vw, 110rem);
		aspect-ratio: 1;
		transform: translate(-50%, -50%);
		background: url("/assets/logo/torch_lift_logo_sign_white-106bf79e.svg") center / contain no-repeat;
		opacity: 0.02;
		filter: saturate(0) contrast(1.15);
		pointer-events: none;
		z-index: 0;
	}

  @media (max-width: 991px) {
    &::before {
      display: none;
    }
  }
}

/* ========================================================================== */
/* Secondary hero blocks (default / flip) */
/* ========================================================================== */

.tl-hero {
	position: relative;
	z-index: 1;

	.layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: clamp(1.4rem, 4vw, 3rem);
		align-items: center;
	}

	.actions {
		margin-top: clamp(1.5rem, 4vw, 2.5rem);
		display: flex;
		flex-wrap: wrap;
		gap: 0.9rem;
	}

	.visual {
		margin: 0;
		max-width: 100%;
		overflow: hidden;
		box-shadow: 0 18px 48px rgba(0, 0, 0, 0.2);
		border: 1px solid color-mix(in srgb, var(--tblr-border-color) 75%, transparent);
		padding: 20px;
		border-radius: 12px;
	}

	.image {
		display: block;
		width: 100%;
	}

	.visual-rotating {
		display: grid;

		.image {
			grid-area: 1 / 1;

			&:not(:first-child) {
				opacity: 0;
				animation: visual-rotate-fade 16s ease-in-out infinite;
				will-change: opacity;
			}

			&:not(:first-child):nth-child(3) {
				animation-delay: 4s;
			}

			&:not(:first-child):nth-child(4) {
				animation-delay: 8s;
			}

			&:not(:first-child):nth-child(5) {
				animation-delay: 12s;
			}
		}
	}

	.kicker {
		text-transform: uppercase;
    font-weight: 800;
		letter-spacing: 0.12em;
		font-size: 0.82rem;
		color: var(--tblr-secondary);
		margin-bottom: 0.9rem;
	}

	.title {
		font-size: clamp(1.6rem, 3.6vw, 2.8rem);
		line-height: 1.1;
		margin: 0 0 0.8rem;
		max-width: 18ch;
		text-wrap: balance;
	}

	.long {
		margin: 0;
		max-width: 70ch;
		font-size: clamp(1.08rem, 1.9vw, 1.28rem);
		line-height: 1.5;
		color: var(--tblr-secondary);
		text-wrap: pretty;
	}

	@media (min-width: 992px) {
		.layout {
			grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
			gap: clamp(1.8rem, 4vw, 3.4rem);
		}

		&.tl-hero-flip {
			.visual {
				order: 2;
			}

			.content {
				order: 1;
			}
		}
	}

	@media (max-width: 575px) {
		text-align: center;

		.actions {
			justify-content: center;
		}

		.title,
		.long {
			margin-inline: auto;
		}

		.actions .tl-btn {
			width: 100%;
		}
	}
}

/* ========================================================================== */
/* Hero CTA */
/* ========================================================================== */

.tl-hero-cta {
  text-align: center;

	.kicker {
		text-transform: uppercase;
		letter-spacing: 0.12em;
		font-size: 0.82rem;
		color: var(--tblr-secondary);
		margin: 0 0 0.9rem;
	}

	.title {
		font-size: clamp(1.6rem, 3.6vw, 2.8rem);
		line-height: 1;
		margin: 0 auto;
		max-width: 18ch;
	}

	.actions {
		margin-top: clamp(1.5rem, 4vw, 2.5rem);
		display: flex;
		justify-content: center;
		gap: 0.9rem;
	}

	@media (max-width: 575px) {
		.actions .tl-btn {
			width: 100%;
		}
	}
}

/* ========================================================================== */
/* Hero intro */
/* ========================================================================== */

.tl-hero-intro {
	max-width: 950px;
  padding-block: clamp(2rem, 4vw, 4rem);


	.kicker {
		color: var(--tblr-body-color);
		font-size: var(--sl-font-size-medium);
		font-weight: 700;
		letter-spacing: 0;
		margin: 0 0.4rem 0.75rem;
		text-transform: uppercase;
	}

	.title {
		font-family: Boogaloo;
		font-size: clamp(3.5rem, 8vw, 7.5rem);
		font-weight: normal;
		line-height: 0.84;
		margin: 0;
		max-width: 850px;
		text-transform: uppercase;

		em {
			color: var(--tblr-primary);
			font-style: normal;
		}
	}

	.intro {
		color: var(--tblr-body-color);
		font-size: clamp(1rem, 1.7vw, 1.3rem);
		line-height: 1.55;
		margin: 1.5rem 0 0;
		max-width: 600px;
	}

	@media (max-width: 767px) {
		padding-inline: 1rem;

		.title {
			font-size: clamp(3.25rem, 16vw, 5.5rem);
		}
	}
}

/* ========================================================================== */
/* Challenge topic card */
/* ========================================================================== */

.challenge-topic-card {
	--back-hover-transform: translate(3%, -4%) scale(0.98) rotate(2deg);
	--back-transform: translate(5%, -2%) scale(0.94) rotate(5deg);
	--shape-hover-transform: translate(1%, -1%) scale(1.02) rotate(-1deg);
	--shape-transform: rotate(-3deg);

	align-items: center;
	display: flex;
	min-height: 520px;
	position: relative;
  padding: clamp(2rem, 4vw, 4rem);

	&::before {
		background: color-mix(in srgb, var(--topic-color) 30%, var(--tblr-body-bg));
		clip-path: polygon(2% 24%, 20% 3%, 83% 8%, 98% 39%, 88% 94%, 31% 100%, 5% 76%);
		content: "";
		inset: 12% 5% 12% -3%;
		pointer-events: none;
		position: absolute;
		transform: var(--back-transform);
		transition: transform 650ms cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	&:nth-child(even) {
		--back-hover-transform: translate(-3%, 4%) scale(0.98) rotate(-2deg);
		--back-transform: translate(-5%, 2%) scale(0.94) rotate(-5deg);
		--shape-hover-transform: translate(-1%, 1%) scale(1.02) rotate(1deg);
		--shape-transform: rotate(3deg);

		justify-content: flex-end;

		&::before {
			clip-path: polygon(8% 9%, 72% 2%, 98% 30%, 93% 83%, 65% 98%, 4% 89%, 0 38%);
			inset: 12% -3% 12% 5%;
		}

		.body {
			margin-right: clamp(1rem, 8vw, 8rem);
		}
	}

	&:nth-child(3n) {
		--back-hover-transform: translate(4%, 1%) scale(0.96) rotate(-3deg);
		--back-transform: translate(2%, 4%) scale(0.91) rotate(-7deg);
		--shape-hover-transform: translate(-1%, -2%) scale(1.03) rotate(2deg);
		--shape-transform: rotate(-1deg);

		&::before {
			clip-path: polygon(15% 0, 92% 12%, 100% 55%, 78% 96%, 18% 100%, 0 68%, 4% 21%);
			inset: 9% 3% 14% -5%;
		}

		.shape {
			clip-path: polygon(4% 11%, 77% 0, 98% 19%, 93% 78%, 61% 100%, 8% 89%, 0 41%);
			inset: 10% 4% 6% -7%;
		}
	}

	&:nth-child(4n) {
		--back-hover-transform: translate(-2%, -3%) scale(0.99) rotate(4deg);
		--back-transform: translate(-4%, -1%) scale(0.92) rotate(7deg);
		--shape-hover-transform: translate(2%, 1%) scale(1.025) rotate(-2deg);
		--shape-transform: rotate(2deg);

		&::before {
			clip-path: polygon(3% 17%, 38% 0, 95% 16%, 100% 66%, 82% 94%, 24% 100%, 0 72%);
			inset: 13% -4% 9% 4%;
		}

		.shape {
			clip-path: polygon(0 29%, 18% 4%, 86% 0, 100% 35%, 89% 88%, 46% 100%, 5% 82%);
			inset: 6% -7% 11% 7%;
		}
	}

	&:hover {
		&::before {
			transform: var(--back-hover-transform);
		}

		.shape {
			transform: var(--shape-hover-transform);
		}
	}

	.shape {
		background: linear-gradient(145deg, color-mix(in srgb, var(--topic-color) 42%, var(--tblr-body-bg)), color-mix(in srgb, var(--topic-color) 72%, var(--tblr-body-bg)));
		clip-path: polygon(9% 4%, 89% 0, 100% 28%, 91% 92%, 26% 100%, 0 72%, 4% 23%);
		inset: 8% 8% 8% -6%;
		pointer-events: none;
		position: absolute;
		transform: var(--shape-transform);
		transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1);

		&::after {
			border: 1px solid color-mix(in srgb, var(--topic-color) 45%, transparent);
			clip-path: polygon(13% 8%, 87% 4%, 95% 30%, 87% 86%, 29% 94%, 6% 69%, 10% 27%);
			content: "";
			inset: 9%;
			position: absolute;
		}
	}

	&:nth-child(even) .shape {
		clip-path: polygon(3% 20%, 29% 1%, 93% 9%, 100% 73%, 70% 100%, 9% 91%, 0 52%);
		inset: 8% -6% 8% 8%;
	}

	.body {
		margin-left: clamp(1rem, 8vw, 8rem);
		max-width: 640px;
		padding: clamp(2rem, 4vw, 4rem);
		position: relative;
		z-index: 1;
	}

	.activity {
		align-items: center;
		border-left: 3px solid var(--topic-color);
		color: var(--tblr-body-color);
		display: flex;
		flex-wrap: wrap;
		font-size: var(--sl-font-size-small);
		font-weight: 700;
		gap: 0.5rem;
		letter-spacing: 0;
		margin-bottom: 1rem;
		padding-left: 0.75rem;
		text-transform: uppercase;

		.rank {
			border-left: 1px solid color-mix(in srgb, var(--tblr-body-color) 35%, transparent);
			color: var(--tblr-emphasis-color);
			margin-left: 0.25rem;
			padding-left: 0.75rem;
		}
	}

	.title {
		font-family: Boogaloo;
		font-size: clamp(3.5rem, 7vw, 6rem);
		font-weight: normal;
		line-height: 0.9;
		margin: 0;
		text-transform: uppercase;

		a {
			color: var(--tblr-emphasis-color);
			text-decoration: none;

			&:hover {
				color: var(--topic-color);
			}
		}
	}

	.description {
		color: var(--tblr-emphasis-color);
		font-size: var(--sl-font-size-medium);
		line-height: 1.65;
		margin: 1.25rem 0 2rem;
		max-width: 560px;
	}

	.actions {
		align-items: center;
		display: flex;
		flex-wrap: wrap;
		gap: 1rem 2rem;
	}

	@media (max-width: 767px) {
		display: flex;
		min-height: auto;
		padding-inline: 1rem;

		.body,
		&:nth-child(even) .body {
			margin: 0;
			padding: clamp(2rem, 8vw, 3.5rem) 1.5rem;
		}

		.shape,
		&:nth-child(even) .shape {
			inset: 4% -25%;
		}

		.title {
			font-size: clamp(3.25rem, 16vw, 5.5rem);
		}
	}

	@media (prefers-reduced-motion: reduce) {
		&::before,
		.shape {
			transition: none;
		}

		&:hover::before {
			transform: var(--back-transform);
		}

		&:hover .shape {
			transform: var(--shape-transform);
		}
	}
}

/* ========================================================================== */
/* Card of the day */
/* ========================================================================== */

.card-of-the-day {
	position: relative;
	z-index: 1;

	.layout {
		display: grid;
		grid-template-columns: minmax(0, 1fr);
		gap: clamp(1.4rem, 4vw, 3rem);
		align-items: center;
	}

	.actions {
		margin-top: clamp(1.5rem, 4vw, 2.5rem);
		display: flex;
		flex-wrap: wrap;
		gap: 0.9rem;
	}

	.visual {
		margin: 0;
		max-width: 100%;
		padding: 0;
		border: 0;
		box-shadow: none;
		overflow: visible;
		background: transparent;
	}

	.flashcard {
		width: 100%;

		> section {
			min-width: 0;
			max-width: 100%;
			width: 100%;
			border-radius: 14px;
			box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
		}
	}

	.content {
		.kicker {
			text-transform: uppercase;
			letter-spacing: 0.12em;
			font-size: 0.82rem;
			color: var(--tblr-secondary);
			margin-bottom: 0.9rem;
		}

		.long {
			margin: 0;
			max-width: 70ch;
			font-size: clamp(1.08rem, 1.9vw, 1.28rem);
			line-height: 1.5;
			color: var(--tblr-secondary);
		}

		.title {
			max-width: none;
		}

		.long {
			margin-top: 0.7rem;
		}
	}

	@media (min-width: 992px) {
		.layout {
			grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
		}
	}

	@media (max-width: 767px) {
		text-align: center;

		.actions {
			justify-content: center;
		}

		.long {
			margin-inline: auto;
		}

		.actions .tl-btn {
			width: 100%;
		}
	}
}

/* ========================================================================== */
/* Challenge banner */
/* ========================================================================== */

.challenge-banner {
	.inner {
		align-items: center;
		display: flex;
		flex-wrap: wrap;
		gap: clamp(2rem, 6vw, 6rem);
		justify-content: space-between;
		padding-inline: clamp(1.5rem, 7vw, 7rem);
	}

	.copy {
		flex: 1 1 360px;
	}

	.kicker {
		color: var(--tblr-secondary);
		font-size: 0.82rem;
		font-weight: 800;
		letter-spacing: 0.12em;
		margin-bottom: 0.65rem;
		text-transform: uppercase;
	}

	.title {
		color: var(--tblr-emphasis-color);
		font-family: Boogaloo;
		font-size: clamp(2.3rem, 4vw, 3.8rem);
		font-weight: normal;
		line-height: 1;
		margin: 0;
		max-width: 15ch;
		text-transform: uppercase;
	}

	.description {
		color: var(--tblr-secondary);
		font-size: clamp(1rem, 1.4vw, 1.15rem);
		line-height: 1.5;
		margin: 0.9rem 0 0;
		max-width: 62ch;
	}

	.players {
		--circle-size: 180px;

		aspect-ratio: 1;
		flex: 0 0 auto;
		position: relative;
		width: clamp(300px, 30vw, 430px);
	}

	.player {
		--avatar-size: 70px;
		--avatar-outer-size: var(--avatar-size);
		--player-angle: calc((360deg / var(--player-count)) * var(--player-index) - 90deg);
		--player-radius: calc((var(--circle-size) + var(--avatar-outer-size)) / 2);

		align-items: center;
		color: var(--tblr-body-color);
		display: flex;
		height: var(--avatar-outer-size);
		left: calc(50% + cos(var(--player-angle)) * var(--player-radius));
		position: absolute;
		text-decoration: none;
		top: calc(50% + sin(var(--player-angle)) * var(--player-radius));
		transform: translate(-50%, -50%);
		transition: transform 180ms ease;
		width: var(--avatar-outer-size);
		z-index: 1;

		&:nth-child(1) {
			--avatar-size: 84px;
		}
	}

	.photo {
		--size: var(--avatar-size);

		background: var(--tblr-body-bg);
		border-radius: 50%;
	}

	.place {
    font-family: Boogaloo;
    font-size: var(--sl-font-size-large);
		align-items: center;
		bottom: -44px;
		display: flex;
		flex-direction: column;
		left: 50%;
		line-height: 1.1;
		position: absolute;
		transform: translateX(-50%);
		white-space: nowrap;
    text-transform: uppercase;
	}


	.place .score {
		align-items: center;
		display: inline-flex;
		font-size: 0.8em;
		gap: 0.2rem;
		margin-top: 0.1em;
	}


	@media (max-width: 991px) {
    text-align: center;

		.inner {
			align-items: center;
			flex-direction: column;
			justify-content: center;
      gap: 60px;
		}

		.copy,
		.players {
			align-self: center;
		}

		.title,
		.description {
			margin-inline: auto;
      text-align: center;
		}
	}

	@media (max-width: 767px) {


		.inner {
			align-items: center;
			flex-direction: column;
		}

    .copy {
      flex-basis: 100%;
    }

		.players {
			--circle-size: 220px;

			align-self: center;
			width: min(340px, calc(100vw - 2rem));
		}

		.player {
			--avatar-size: 60px;
		}

		.player:nth-child(1) {
			--avatar-size: 72px;
		}
	}
}

/* ========================================================================== */
/* Motion preferences */
/* ========================================================================== */

@media (prefers-reduced-motion: reduce) {
	.tl-hero-main {
		.bg-image {
			animation: none;
		}
	}

	.tl-hero {
		.visual-rotating {
			.image {
				animation: none;
				opacity: 1;
			}

			.image:not(:first-child) {
				display: none;
			}
		}
	}

	.challenge-banner {
		.player {
			transition: none;
		}
	}
}

/* ========================================================================== */
/* Hero animations */
/* ========================================================================== */

@keyframes visual-rotate-fade {
	0%,
	20% {
		opacity: 0;
	}

	25%,
	45% {
		opacity: 1;
	}

	50%,
	100% {
		opacity: 0;
	}
}

@keyframes main-hero-flight {
	from {
		transform: scale(1) translate3d(0, 0, 0);
	}

	to {
		transform: scale(1.3) translate3d(0, -3%, 0);
	}
}
