/* Minha Jornada — trilha vertical com coluna de coral */

/* A trilha tem três colunas (texto | coral | links): precisa de mais largura
   que o padrão para o texto não ficar espremido. */
.page-jornada .site-shell {
  max-width: min(1120px, 96vw);
}

.page-jornada .panel-journey {
  position: relative;
  overflow: hidden;
  padding: clamp(1rem, 3vw, 2rem) clamp(0.75rem, 2vw, 1.5rem) clamp(1.5rem, 4vw, 2.75rem);
  border: 3px solid rgba(77, 150, 255, 0.24);
  background:
    radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, 0.95), transparent 70%),
    linear-gradient(180deg, #fffdf6 0%, #f0f9fb 38%, #e2f2f8 72%, #d8eef7 100%);
}

/* Feixes de luz que atravessam a água */
.page-jornada .panel-journey::before {
  content: "";
  position: absolute;
  inset: -20% -10% auto -10%;
  height: 70%;
  pointer-events: none;
  background:
    linear-gradient(104deg, transparent 44%, rgba(255, 255, 255, 0.75) 47%, transparent 50%),
    linear-gradient(96deg, transparent 62%, rgba(255, 255, 255, 0.55) 65%, transparent 68%),
    linear-gradient(112deg, transparent 24%, rgba(255, 255, 255, 0.45) 27%, transparent 30%);
  animation: journeyRays 12s ease-in-out infinite alternate;
}

.journey-trail {
  --spine-w: clamp(150px, 20vw, 224px);
  --medal-size: clamp(84px, 11vw, 118px);
  --trail-gap: clamp(1rem, 2.4vw, 2.25rem);
  position: relative;
  z-index: 1;
  max-width: 1060px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: clamp(2.75rem, 6vw, 5rem);
  padding: 0.75rem 0 1.5rem;
}

/* ---------- Coluna de coral ---------- */

.journey-reef {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(50% - var(--spine-w) / 2);
  width: var(--spine-w);
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 5%, #000 90%, transparent 100%);
  mask-image: linear-gradient(180deg, transparent 0, #000 5%, #000 90%, transparent 100%);
}

.reef-tile {
  display: block;
  flex: none;
  width: 100%;
  aspect-ratio: 418 / 650;
  background-image: url("../assets/jornada/coral-coluna.png");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

/* Blocos alternados espelhados: a emenda entre eles fica invisível. */
.reef-tile:nth-child(even) {
  transform: scaleY(-1);
}

/* ---------- Bolhas ---------- */

.journey-bubbles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
}

.journey-bubbles span {
  position: absolute;
  /* Cada bolha nasce numa altura diferente e sobe uma tela: cobre a coluna inteira. */
  bottom: var(--bubble-start, 0%);
  width: var(--bubble-size, 14px);
  height: var(--bubble-size, 14px);
  border-radius: 50%;
  opacity: 0;
  border: 1px solid rgba(255, 255, 255, 0.85);
  background: radial-gradient(circle at 32% 28%, rgba(255, 255, 255, 0.95), rgba(173, 232, 244, 0.4) 58%, rgba(77, 150, 255, 0.18));
  animation: bubbleRise var(--bubble-dur, 16s) linear infinite;
  animation-delay: var(--bubble-delay, 0s);
}

.journey-bubbles span:nth-child(1)  { left: 4%;  --bubble-start: 0%;  --bubble-size: 12px; --bubble-dur: 15s; --bubble-delay: 0s; }
.journey-bubbles span:nth-child(2)  { left: 12%; --bubble-start: 16%; --bubble-size: 20px; --bubble-dur: 21s; --bubble-delay: 3s; }
.journey-bubbles span:nth-child(3)  { left: 21%; --bubble-start: 33%; --bubble-size: 9px;  --bubble-dur: 13s; --bubble-delay: 6s; }
.journey-bubbles span:nth-child(4)  { left: 29%; --bubble-start: 49%; --bubble-size: 16px; --bubble-dur: 19s; --bubble-delay: 1.5s; }
.journey-bubbles span:nth-child(5)  { left: 37%; --bubble-start: 65%; --bubble-size: 11px; --bubble-dur: 17s; --bubble-delay: 8s; }
.journey-bubbles span:nth-child(6)  { left: 46%; --bubble-start: 82%; --bubble-size: 22px; --bubble-dur: 24s; --bubble-delay: 4.5s; }
.journey-bubbles span:nth-child(7)  { left: 55%; --bubble-start: 8%;  --bubble-size: 10px; --bubble-dur: 14s; --bubble-delay: 10s; }
.journey-bubbles span:nth-child(8)  { left: 63%; --bubble-start: 25%; --bubble-size: 18px; --bubble-dur: 20s; --bubble-delay: 2s; }
.journey-bubbles span:nth-child(9)  { left: 71%; --bubble-start: 41%; --bubble-size: 13px; --bubble-dur: 16s; --bubble-delay: 7s; }
.journey-bubbles span:nth-child(10) { left: 80%; --bubble-start: 58%; --bubble-size: 24px; --bubble-dur: 26s; --bubble-delay: 5s; }
.journey-bubbles span:nth-child(11) { left: 88%; --bubble-start: 74%; --bubble-size: 10px; --bubble-dur: 15s; --bubble-delay: 11s; }
.journey-bubbles span:nth-child(12) { left: 95%; --bubble-start: 90%; --bubble-size: 15px; --bubble-dur: 18s; --bubble-delay: 9s; }

/* ---------- Marcador de início ---------- */

.trail-start {
  position: relative;
  z-index: 2;
  margin: 0;
  text-align: center;
  font-family: "Fredoka One", cursive;
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  color: #0e7490;
}

/* ---------- Paradas ---------- */

.trail-stop {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr var(--spine-w) 1fr;
  column-gap: var(--trail-gap);
  align-items: center;
  opacity: 0;
  transition:
    opacity 0.6s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

/* Faixa colorida da parada: separa visualmente cada trecho e dá a cor do tema. */
.trail-stop::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -1.5rem -1.1rem;
  border-radius: 42px;
  background: linear-gradient(
    180deg,
    color-mix(in srgb, var(--stop-color, var(--blue)) 26%, transparent),
    color-mix(in srgb, var(--stop-color, var(--blue)) 12%, transparent)
  );
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--stop-color, var(--blue)) 38%, transparent);
}

.trail-stop--west { transform: translate3d(-42px, 26px, 0); }
.trail-stop--east { transform: translate3d(42px, 26px, 0); }

.trail-stop.is-visible {
  opacity: 1;
  transform: none;
}

.trail-medal-wrap {
  grid-column: 2;
  grid-row: 1;
  justify-self: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  z-index: 2;
}

.trail-story,
.trail-actions {
  grid-row: 1;
}

.trail-stop--west .trail-story { grid-column: 1; }
.trail-stop--west .trail-actions { grid-column: 3; justify-self: start; align-items: flex-start; }
.trail-stop--east .trail-story { grid-column: 3; }
.trail-stop--east .trail-actions { grid-column: 1; justify-self: end; align-items: flex-end; }

.trail-num {
  font-family: "Fredoka One", cursive;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
  color: #fff;
  /* A cor "shadow" é a versão escura de cada parada: garante contraste com o texto branco. */
  background: var(--stop-shadow, #2563eb);
  padding: 0.26rem 0.9rem;
  border-radius: 999px;
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(13, 51, 73, 0.25);
  white-space: nowrap;
}

/* ---------- Medalhão do personagem ---------- */

.trail-medal {
  position: relative;
  width: var(--medal-size);
  min-width: 44px;
  min-height: 44px;
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  border-radius: 50%;
  /* Bolha de vidro: deixa o coral aparecer atrás do personagem recortado. */
  background: radial-gradient(circle at 38% 26%, rgba(255, 255, 255, 0.72), rgba(214, 240, 250, 0.34) 58%, rgba(125, 196, 228, 0.28));
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.9),
    0 0 0 8px var(--stop-color, var(--blue)),
    0 14px 26px rgba(13, 51, 73, 0.22),
    inset 0 8px 16px rgba(255, 255, 255, 0.7);
  cursor: pointer;
  touch-action: manipulation;
  animation: medalBob 5s ease-in-out infinite;
  transition: box-shadow 0.25s ease;
}

.trail-stop:nth-child(even) .trail-medal { animation-delay: -1.6s; }
.trail-stop:nth-child(3n) .trail-medal { animation-delay: -3.1s; }

.trail-medal-photo {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 50%;
}

.trail-medal-img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  padding: 8%;
  filter: drop-shadow(0 3px 5px rgba(13, 51, 73, 0.35));
}

.trail-medal-icon {
  position: absolute;
  right: -4px;
  bottom: -4px;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
  border-radius: 50%;
  color: #fff;
  background: var(--stop-shadow, #2563eb);
  box-shadow: 0 0 0 3px #fff, 0 4px 10px rgba(13, 51, 73, 0.3);
}

.trail-medal-icon--solo {
  position: static;
  width: 100%;
  height: 100%;
  font-size: 2.2rem;
  box-shadow: none;
}

.trail-stop.is-selected .trail-medal {
  box-shadow:
    0 0 0 4px rgba(255, 255, 255, 0.9),
    0 0 0 8px var(--stop-color, var(--blue)),
    0 0 0 19px color-mix(in srgb, var(--stop-color, var(--blue)) 22%, transparent),
    0 16px 30px rgba(13, 51, 73, 0.26),
    inset 0 8px 16px rgba(255, 255, 255, 0.7);
}

/* ---------- Cartão da história ---------- */

.trail-story {
  position: relative;
  border-radius: 26px;
  padding: 1.5rem 1.6rem 1.4rem;
  background:
    linear-gradient(var(--stop-color, var(--blue)), var(--stop-color, var(--blue))) top / 100% 8px no-repeat,
    rgba(255, 255, 255, 0.96);
  box-shadow:
    0 0 0 3px color-mix(in srgb, var(--stop-color, var(--blue)) 28%, transparent),
    0 16px 32px rgba(13, 51, 73, 0.14);
}

/* Tracejado ligando o cartão até a borda do medalhão, por cima do coral */
.trail-story::after {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(var(--trail-gap) + (var(--spine-w) - var(--medal-size)) / 2);
  border-top: 4px dotted color-mix(in srgb, var(--stop-shadow, #2563eb) 45%, #fff);
}

.trail-stop--west .trail-story::after { left: 100%; }
.trail-stop--east .trail-story::after { right: 100%; }

.trail-story h3 {
  margin: 0 0 0.7rem;
  font-family: "Fredoka One", cursive;
  font-size: clamp(1.2rem, 3.6vw, 1.55rem);
  line-height: 1.3;
  color: color-mix(in srgb, var(--stop-shadow, #2563eb) 82%, #0f172a);
}

.trail-story p {
  margin: 0;
  font-size: clamp(1.02rem, 2.9vw, 1.18rem);
  line-height: 1.85;
  letter-spacing: 0.01em;
  font-weight: 600;
  color: #29394d;
  text-wrap: pretty;
}

/* ---------- Links da parada (lado oposto ao texto) ---------- */

.trail-actions {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  width: fit-content;
  max-width: 100%;
  padding: 1.1rem 1.2rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.78);
  border: 2px dashed color-mix(in srgb, var(--stop-color, var(--blue)) 55%, #fff);
}

.trail-actions .journey-links {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin: 0;
  align-items: inherit;
}

.trail-actions .journey-link {
  padding: 12px 18px;
  font-size: 0.98rem;
}

/* Tracejado ligando o medalhão ao bloco de links */
.trail-actions::before {
  content: "";
  position: absolute;
  top: 50%;
  width: calc(var(--trail-gap) + (var(--spine-w) - var(--medal-size)) / 2);
  border-top: 4px dotted color-mix(in srgb, var(--stop-shadow, #2563eb) 45%, #fff);
}

.trail-stop--west .trail-actions::before { right: 100%; }
.trail-stop--east .trail-actions::before { left: 100%; }

/* ---------- Animações ---------- */

@keyframes medalBob {
  0%, 100% { transform: translateY(0) rotate(-1.5deg); }
  50% { transform: translateY(-9px) rotate(1.5deg); }
}

@keyframes bubbleRise {
  0% { opacity: 0; transform: translate3d(0, 0, 0) scale(0.6); }
  12% { opacity: 0.8; }
  80% { opacity: 0.6; }
  100% { opacity: 0; transform: translate3d(18px, -70vh, 0) scale(1.1); }
}

@keyframes journeyRays {
  from { transform: translateX(-4%) skewX(-2deg); opacity: 0.55; }
  to { transform: translateX(4%) skewX(2deg); opacity: 0.9; }
}

/* ---------- Até tablet em retrato: coral encosta à esquerda ----------
   Abaixo de 900px as três colunas espremem o texto a poucas palavras por
   linha, então o conteúdo passa a ocupar a largura toda ao lado do coral. */

@media (max-width: 899px) {
  .journey-trail {
    --spine-w: clamp(96px, 26vw, 128px);
    --medal-size: clamp(68px, 19vw, 88px);
    --trail-gap: 0.75rem;
    gap: 2.5rem;
  }

  .trail-stop::before {
    inset: -0.9rem -0.55rem;
    border-radius: 30px;
  }

  .journey-reef {
    left: 0;
  }

  .trail-stop {
    grid-template-columns: var(--spine-w) minmax(0, 1fr);
    row-gap: 0.9rem;
  }

  .trail-story {
    padding: 1.15rem 1.15rem 1.05rem;
  }

  .trail-stop--west,
  .trail-stop--east {
    transform: translate3d(0, 28px, 0);
  }

  /* Sem espaço para dois flancos: o texto vai em cima e os links logo abaixo. */
  .trail-medal-wrap {
    grid-column: 1;
    grid-row: 1 / span 2;
    align-self: center;
  }

  .trail-stop--west .trail-story,
  .trail-stop--east .trail-story {
    grid-column: 2;
  }

  .trail-stop--west .trail-actions,
  .trail-stop--east .trail-actions {
    grid-column: 2;
    grid-row: 2;
    justify-self: stretch;
    align-items: flex-start;
  }

  .trail-stop--west .trail-story::after,
  .trail-stop--east .trail-story::after {
    left: auto;
    right: 100%;
  }

  .trail-actions::before {
    display: none;
  }

  .trail-medal-icon {
    width: 30px;
    height: 30px;
    font-size: 0.9rem;
  }
}

/* Celular: a coluna de coral vira uma fita estreita e o medalhão sobe para o
   topo da parada, liberando a largura toda para o texto. */
@media (max-width: 559px) {
  .journey-trail {
    --spine-w: 46px;
    --medal-size: 72px;
    --trail-gap: 0.5rem;
    gap: 2rem;
  }

  .trail-stop {
    grid-template-columns: minmax(0, 1fr);
    padding-left: calc(var(--spine-w) + var(--trail-gap));
    row-gap: 0.6rem;
  }

  .trail-stop::before {
    inset: -0.75rem -0.4rem;
    border-radius: 24px;
  }

  .trail-medal-wrap {
    grid-column: 1;
    grid-row: auto;
    order: -1;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: flex-end;
    justify-self: start;
    gap: 0.55rem;
    /* Puxa o medalhão de volta para cima da fita de coral. */
    margin-left: calc((var(--spine-w) + var(--trail-gap)) * -1);
  }

  .trail-stop--west .trail-story,
  .trail-stop--east .trail-story,
  .trail-stop--west .trail-actions,
  .trail-stop--east .trail-actions {
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
  }

  .trail-story {
    padding: 1rem 1.05rem 0.95rem;
  }

  .trail-story::after {
    display: none;
  }
}

/* Tablet em retrato: sobra largura para os links ficarem lado a lado. */
@media (min-width: 600px) and (max-width: 899px) {
  .journey-trail {
    --spine-w: clamp(128px, 19vw, 168px);
    --medal-size: clamp(88px, 13vw, 112px);
    --trail-gap: 1.25rem;
  }

  .trail-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.7rem 0.9rem;
  }

  .trail-actions .journey-links {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

@media (hover: hover) {
  .trail-medal:hover {
    box-shadow:
      0 0 0 4px rgba(255, 255, 255, 0.9),
      0 0 0 8px var(--stop-color, var(--blue)),
      0 0 0 17px color-mix(in srgb, var(--stop-color, var(--blue)) 20%, transparent),
      0 18px 32px rgba(13, 51, 73, 0.28),
      inset 0 8px 16px rgba(255, 255, 255, 0.7);
  }

  .trail-story:hover {
    box-shadow:
      0 0 0 3px color-mix(in srgb, var(--stop-color, var(--blue)) 45%, transparent),
      0 20px 38px rgba(13, 51, 73, 0.18);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-jornada .panel-journey::before,
  .journey-bubbles span,
  .trail-medal,
  .trail-stop {
    animation: none !important;
    transition: none !important;
  }

  .trail-stop {
    opacity: 1;
    transform: none;
  }
}
