/* =========================================================
   1. RESET, CONFIGURAÇÕES GERAIS E BASE DO DOCUMENTO
   ========================================================= */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 18px;
  scroll-behavior: smooth;
}

body {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  /* background-color: #1a1a1a; */

  background: linear-gradient(
    135deg,
    #0b0b0b 0%,
    #141414 30%,
    #1a1a1a 50%,
    #24142d 70%,
    #3a0f2e 100%
  );

  /* A animação dura 15 segundos e repete para sempre */
  /* animation: atmosferaPinkFloyd 15s ease infinite; */

  color: #e0e0e0;
  overflow-x: hidden;
}

@keyframes atmosferaPinkFloyd {
  0% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

/* =========================================================
   2. ELEMENTOS FIXOS E DE INTERFACE
   ========================================================= */

/* Sentinel usado pelo Intersection Observer para detectar o topo da página */
#marcador-topo {
  position: absolute;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
}

/* Barra de progresso de leitura */
.barra-de-progresso {
  position: fixed;
  top: 0;
  left: 0;
  height: 8px;
  width: 0%; /* Começa vazia e cresce conforme o scroll */
  background-color: #ff79c6;
  z-index: 1000;
  transition: width 0.1s linear;
}

/* Botão "Voltar ao topo" */
#btn-topo {
  position: fixed;
  bottom: 20px;
  right: 20px;

  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #ff79c6;
  color: #1a1a1a;
  text-decoration: none;
  font-size: 2.2rem;
  cursor: pointer;

  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);

  /* Estado inicial: invisível e fora da área clicável */
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(20px);

  /*
    Embora 'visibility' não seja animável, incluí-la na transição
    ajuda o navegador a sincronizar corretamente os estados visuais
    ao exibir o botão.
  */
  transition:
    opacity 0.3s ease,
    transform 0.3s ease,
    visibility 0.3s;

  z-index: 999;

  /* Centralização do ícone */
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* Estado visível do botão */
#btn-topo.visivel {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

/* Feedback visual no hover */
#btn-topo:hover {
  background-color: #fff;
  transform: scale(1.1);
}

/* =========================================================
   3. ESTRUTURA PRINCIPAL E TIPOGRAFIA
   ========================================================= */

main {
  width: 100%;
}

h1 {
  padding: 80px 20px;
  text-align: center;
  font-size: 3rem;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 2px;
}

/* Destaque de palavras e elementos decorativos */
span {
  color: #ff79c6;
}

/* Destaque para a tag <time> nos títulos */
h2 time {
  color: #ff79c6;
  font-weight: 700;
}

/* =========================================================
   4. TIMELINE – BASE (MOBILE FIRST)
   ========================================================= */

.timeline {
  position: relative;
  max-width: 1000px;
  margin: 0 auto 100px;
  padding: 0 20px;
}

/* Linha vertical da timeline */
.timeline::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 51px;
  width: 4px;
  margin-left: -2px;
  background-color: #666;
  z-index: 0;
}

/* Container de cada evento */
.evento {
  position: relative;
  width: 100%;
  padding-left: 80px;
  margin-bottom: 80px;
  z-index: 1;
}

/* Estado inicial dos elementos animados */
[data-anime="timeline"] {
  opacity: 0;
  transform: translateY(50px);
  transition:
    opacity 0.8s ease,
    transform 0.8s ease;
  will-change: opacity, transform;
}

/* Estado visível após a animação */
[data-anime="timeline"].aparecer {
  opacity: 1;
  transform: translateY(0);
}

/* Card de conteúdo */
.conteudo {
  position: relative;
  min-height: 180px;
  padding: 30px;

  background-color: #2b2b2b;
  color: #ddd;
  border-radius: 6px;
  border-top: 3px solid #ff79c6;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);

  display: flex;
  flex-direction: column;
  justify-content: center;
}

.conteudo h2 {
  margin-bottom: 15px;
  font-size: 1.6rem;
  color: #fff;
}

.conteudo p {
  font-size: 1rem;
  line-height: 1.6;
}

/* Seta que conecta o card à linha */
.conteudo::before {
  content: "";
  position: absolute;
  top: 30px;
  left: -10px;

  width: 0;
  height: 0;
  border-style: solid;
  border-width: 10px 10px 10px 0;
  border-color: transparent #2b2b2b transparent transparent;
}

/* Marcador circular da timeline */
.evento::after {
  content: "";
  position: absolute;
  top: 40px;
  left: 21px;

  width: 20px;
  height: 20px;
  border-radius: 50%;

  background-color: #ff79c6;
  border: 4px solid #1a1a1a;

  box-shadow: 0 0 15px rgba(255, 121, 198, 1);
  z-index: 1;
}

/* =========================================================
   5. ACESSIBILIDADE – REDUÇÃO DE MOVIMENTO
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  [data-anime] {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* =========================================================
   6. LAYOUT DESKTOP (MIN-WIDTH: 900px)
   ========================================================= */

@media (min-width: 900px) {
  .timeline::after {
    left: 50%;
    margin-left: -2px;
  }

  .evento {
    width: 50%;
    padding: 0 50px;
    margin-bottom: 150px;
  }

  /* Eventos ímpares – lado esquerdo */
  .evento:nth-child(odd) {
    left: 0;
    transform: translateX(-100px);
  }

  .evento:nth-child(odd) .conteudo {
    text-align: right;
  }

  .evento:nth-child(odd) .conteudo::before {
    left: auto;
    right: -10px;
    border-width: 10px 0 10px 10px;
    border-color: transparent transparent transparent #2b2b2b;
  }

  .evento:nth-child(odd)::after {
    left: auto;
    right: -10px;
  }

  /* Eventos pares – lado direito */
  .evento:nth-child(even) {
    left: 50%;
    transform: translateX(100px);
  }

  .evento:nth-child(even)::after {
    left: -10px;
  }

  /* Estado final após animação no desktop */
  .evento.aparecer {
    transform: translateX(0);
  }
}
