/* Academia Speedio — cartões "Qual é o seu maior desafio?" (onboarding). Par do desafio3d.js. */

.desafios {
  display: grid;
  gap: 12px;
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

.desafio,
.desafio *,
.desafio::before,
.desafio::after { box-sizing: border-box; }

.desafio {
  --c1: #1296FC;
  --c2: #7B61FF;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  --my: 50%;
  --s: 1;
  position: relative;
  isolation: isolate;
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 118px;
  margin: 0;
  padding: 18px 40% 18px 20px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 22px;
  overflow: hidden;
  background: #12161b;
  color: #eceff1;
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transform: perspective(900px) rotateX(var(--rx)) rotateY(var(--ry)) scale(var(--s));
  transition: transform .2s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .3s;
  box-shadow: 0 14px 32px -18px rgba(0, 0, 0, .9), inset 0 1px 0 rgba(255, 255, 255, .06);
  animation: desafio-entrar .75s cubic-bezier(.2, .8, .2, 1) backwards;
  animation-delay: calc(var(--i, 0) * 85ms + 40ms);
}
.desafio:nth-child(2) { --i: 1; }
.desafio:nth-child(3) { --i: 2; }
.desafio:nth-child(4) { --i: 3; }
.desafio:nth-child(5) { --i: 4; }
.desafio:nth-child(6) { --i: 5; }
.desafio:active { --s: .965; transition-duration: .08s; }
.desafio:focus-visible { outline: 2px solid var(--c1); outline-offset: 3px; }

@keyframes desafio-entrar {
  from { opacity: 0; translate: 0 22px; scale: .96; }
  to { opacity: 1; translate: 0 0; scale: 1; }
}

/* capa da lição: escura, levemente desfocada e derivando devagar */
.desafio-bg {
  position: absolute;
  inset: -12%;
  z-index: -2;
  animation: desafio-deriva 22s ease-in-out infinite alternate;
  animation-delay: calc(var(--i, 0) * -4s);
  pointer-events: none;
}
.desafio-bg img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: blur(2px) saturate(1.15) brightness(.62);
  opacity: .9;
}
@keyframes desafio-deriva {
  from { transform: translate3d(-4%, -3%, 0) scale(1.02); }
  to { transform: translate3d(4%, 3%, 0) scale(1.1); }
}

/* véu sobre a capa (texto legível à esquerda) e tinta da área à direita */
.desafio-txt::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(120% 140% at 100% 50%, rgba(13, 15, 18, 0) 0%, rgba(13, 15, 18, .2) 40%, rgba(13, 15, 18, 0) 70%),
    linear-gradient(90deg, rgba(13, 15, 18, .95) 0%, rgba(13, 15, 18, .9) 38%, rgba(13, 15, 18, .62) 64%, rgba(13, 15, 18, .38) 100%);
  pointer-events: none;
}
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .desafio-txt::before {
    background:
      radial-gradient(70% 120% at 92% 50%, color-mix(in srgb, var(--c1) 30%, transparent) 0%, color-mix(in srgb, var(--c2) 12%, transparent) 45%, transparent 75%),
      linear-gradient(90deg, rgba(13, 15, 18, .95) 0%, rgba(13, 15, 18, .9) 38%, rgba(13, 15, 18, .62) 64%, rgba(13, 15, 18, .38) 100%);
  }
}
/* filete da área na base */
.desafio-txt::after {
  content: '';
  position: absolute;
  left: 20px;
  bottom: 0;
  width: 44px;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, var(--c1), var(--c2));
  opacity: .9;
  transition: width .35s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.desafio-txt {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.desafio-txt b,
.desafio-txt small { position: relative; z-index: 3; }
.desafio-txt b {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -.01em;
  color: #eceff1;
}
.desafio-txt small {
  font-size: 13px;
  line-height: 1.4;
  color: #a9b4bc;
}

/* objeto 3D à direita */
.desafio-3d {
  position: absolute;
  top: 0;
  right: 0;
  z-index: 2;
  width: 42%;
  height: 100%;
  opacity: 0;
  transition: opacity .6s ease .1s;
  pointer-events: none;
}
.desafio.com-3d .desafio-3d { opacity: 1; }

/* desenho em CSS enquanto o 3D não chega (ou sem WebGL): esfera com anel nas cores da área */
.desafio::before {
  content: '';
  position: absolute;
  top: 50%;
  right: calc(21% - 29px);
  z-index: 1;
  width: 58px;
  height: 58px;
  margin-top: -29px;
  border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, rgba(255, 255, 255, .55) 0, rgba(255, 255, 255, 0) 32%), linear-gradient(140deg, var(--c1), var(--c2));
  box-shadow: 0 0 0 8px rgba(255, 255, 255, .03), 0 0 0 9px rgba(255, 255, 255, .08), 0 0 36px 2px var(--c1);
  opacity: .9;
  transition: opacity .5s ease;
  pointer-events: none;
}
.desafio.com-3d::before { opacity: 0; }

/* brilho que segue o ponteiro */
.desafio::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx) var(--my), rgba(255, 255, 255, .1), transparent 60%);
  opacity: 0;
  transition: opacity .3s;
  pointer-events: none;
}
.desafio.ativo::after { opacity: 1; }

@media (hover: hover) {
  .desafio:hover { border-color: rgba(255, 255, 255, .18); }
  .desafio:hover .desafio-txt::after { width: 72px; }
}

/* selecionado */
.desafio.sel {
  border-color: var(--c1);
  box-shadow: 0 0 0 1px var(--c1), 0 16px 40px -16px var(--c1), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.desafio.sel .desafio-txt::after { width: calc(100% - 44px); }
.desafio.sel .desafio-txt b::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 12px;
  margin: 0 0 3px 10px;
  border: solid var(--c1);
  border-width: 0 2.5px 2.5px 0;
  transform: rotate(45deg);
  vertical-align: middle;
}
@supports (background: color-mix(in srgb, red 50%, transparent)) {
  .desafio.sel { box-shadow: 0 0 0 1px var(--c1), 0 18px 44px -14px color-mix(in srgb, var(--c1) 70%, transparent), inset 0 1px 0 rgba(255, 255, 255, .08); }
}

/* sem WebGL: o desenho em CSS fica, sem canvas */
.desafios.sem-3d .desafio-3d { display: none; }
.desafios.sem-3d .desafio::before { opacity: .9; }

@media (max-width: 360px) {
  .desafio { padding-right: 36%; min-height: 110px; }
  .desafio-txt b { font-size: 17px; }
  .desafio-txt small { font-size: 12.5px; }
  .desafio-3d { width: 38%; }
}

@media (prefers-reduced-motion: reduce) {
  .desafio,
  .desafio-bg { animation: none; }
  .desafio { transform: none; transition: border-color .2s, box-shadow .2s; }
  .desafio:active { --s: 1; }
  .desafio-txt::after { transition: none; }
}
