/* ============================================
   TIMELINE — Jornada Interativa
   ============================================ */

/* ============ TIMELINE SECTION ============ */
#timeline {
  padding: var(--space-2xl) 0;
  border-top: 1px solid var(--c-border);
  overflow: hidden;
}

.timeline-header {
  padding: 0 var(--space-lg);
  margin-bottom: var(--space-2xl);
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-xl);
}

/* ============ ERA NAVIGATION ============ */
.era-nav {
  display: flex;
  gap: 0;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0 var(--space-lg);
  position: relative;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: var(--space-xl);
}

.era-nav::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: var(--space-lg);
  right: var(--space-lg);
  height: 1px;
  background: var(--c-border);
}

.era-nav::-webkit-scrollbar { display: none; }

.era-tab {
  flex: 0 0 auto;          /* não cresce nem estica — tamanho natural */
  min-width: 80px;
  max-width: 160px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: var(--space-md) var(--space-sm) calc(var(--space-md) - 2px);
  cursor: none;
  text-align: left;
  transition: border-color 0.3s, background 0.3s;
  position: relative;
  z-index: 1;
  overflow: hidden;        /* garante que nada vaza para fora do botão */
}

.era-tab:hover .era-tab-label { color: var(--c-text); }

.era-tab.active {
  border-bottom-color: var(--c-terra);
}

.era-tab.active .era-tab-label { color: var(--c-text); }
.era-tab.active .era-tab-period { color: var(--c-terra); }

.era-tab-icon {
  display: block;
  font-size: 1.2rem;
  margin-bottom: 4px;
}

.era-tab-label {
  display: block;
  font-family: var(--f-mono);
  font-size: 0.65rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--c-text-dim);
  transition: color 0.2s;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.era-tab-period {
  display: block;
  font-size: 0.68rem;
  color: var(--c-text-dim);
  transition: color 0.2s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============ ERA CONTENT ============ */
.era-stage {
  position: relative;
  /* altura dinâmica — sem min-height fixo que causa sobreposição */
}

.era-panel {
  display: none;           /* oculto por padrão — sem ocupar espaço */
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out);
  padding: 0 var(--space-lg);
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

/* Era panel entrance animation */
@keyframes panelIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.era-panel.active {
  display: block;
  animation: panelIn 0.45s var(--ease-out) forwards;
  pointer-events: all;
}

.era-panel-inner {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: var(--space-2xl);
  align-items: start;
}

/* Era Info Column */
.era-info {
  position: sticky;
  top: 100px;
}

.era-number {
  font-family: var(--f-display);
  font-size: 8rem;
  font-weight: 900;
  line-height: 1;
  color: var(--c-border);
  letter-spacing: -0.05em;
  margin-bottom: -20px;
  position: relative;
  z-index: 0;
}

.era-title {
  position: relative;
  z-index: 1;
  font-family: var(--f-display);
  font-style: italic;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 700;
  color: var(--c-text);
  margin-bottom: var(--space-md);
}

.era-color-bar {
  width: 40px;
  height: 3px;
  border-radius: 2px;
  margin-bottom: var(--space-md);
}

.era-description {
  font-size: 0.95rem;
  color: var(--c-text-muted);
  line-height: 1.8;
  margin-bottom: var(--space-lg);
}

/* Era progress indicators */
.era-progress {
  display: flex;
  gap: 6px;
}

.era-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-border);
  cursor: none;
  transition: background 0.2s, transform 0.2s;
}

.era-dot.active { background: var(--c-terra); transform: scale(1.3); }
.era-dot:hover { background: var(--c-text-muted); }

/* ============ MILESTONES ============ */
.milestones-column {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.milestone-card {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  overflow: hidden;
  transition: border-color 0.3s, transform 0.3s var(--ease-out), box-shadow 0.3s;
  opacity: 0;
  transform: translateY(20px);
}

.milestone-card.visible {
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.5s var(--ease-out), transform 0.5s var(--ease-out), border-color 0.3s, box-shadow 0.3s;
}

.milestone-card:hover {
  border-color: var(--c-verde);
  transform: translateY(-4px);
  box-shadow: 0 20px 60px rgba(44, 120, 115, 0.1);
}

.milestone-header {
  padding: var(--space-md) var(--space-lg);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  border-bottom: 1px solid var(--c-border);
}

.milestone-meta {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.milestone-type-badge {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.25em 0.7em;
  border-radius: 100px;
}

.badge-video  { background: rgba(196, 98, 45, 0.15); color: var(--c-terra); border: 1px solid rgba(196, 98, 45, 0.3); }
.badge-music  { background: rgba(44, 120, 115, 0.15); color: var(--c-verde); border: 1px solid rgba(44, 120, 115, 0.3); }
.badge-photo  { background: rgba(212, 160, 66, 0.15); color: var(--c-ouro); border: 1px solid rgba(212, 160, 66, 0.3); }
.badge-text   { background: rgba(107, 63, 160, 0.15); color: #9B6BD4; border: 1px solid rgba(107, 63, 160, 0.3); }
.badge-milestone { background: rgba(237, 232, 220, 0.08); color: var(--c-text-muted); border: 1px solid var(--c-border); }

.milestone-date {
  font-family: var(--f-mono);
  font-size: 0.65rem;
  color: var(--c-text-dim);
}

.milestone-title {
  font-family: var(--f-display);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--c-text);
  line-height: 1.3;
}

/* Media embeds */
.milestone-media {
  position: relative;
  width: 100%;
  background: var(--c-surface2);
}

.milestone-media iframe {
  width: 100%;
  border: none;
  display: block;
}

.youtube-embed {
  aspect-ratio: 16 / 9;
}

.youtube-embed iframe {
  height: 100%;
}

.spotify-embed {
  height: 152px;
}

.spotify-embed iframe {
  height: 152px;
}

.soundcloud-embed {
  height: 166px;
}

.soundcloud-embed iframe {
  width: 100%;
  height: 166px;
  border: none;
}

/* Photo grid */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 2px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
  transition: transform 0.4s var(--ease-out), filter 0.4s;
  filter: saturate(0.8);
}

.photo-grid img:hover { transform: scale(1.03); filter: saturate(1.1); }

.milestone-body {
  padding: var(--space-md) var(--space-lg);
}

.milestone-desc {
  font-size: 0.9rem;
  color: var(--c-text-muted);
  line-height: 1.7;
}

/* ============ EMPTY STATE ============ */
.milestone-empty {
  background: var(--c-surface);
  border: 1px dashed var(--c-border);
  border-radius: 12px;
  padding: var(--space-xl);
  text-align: center;
}

.milestone-empty p {
  font-family: var(--f-mono);
  font-size: 0.75rem;
  color: var(--c-text-dim);
  letter-spacing: 0.05em;
}

.milestone-empty p strong {
  display: block;
  color: var(--c-terra);
  font-size: 0.8rem;
  margin-bottom: var(--space-sm);
}

/* ============ PRÓXIMO MARCO BUTTON ============ */
.era-next-wrap {
  display: flex;
  justify-content: center;
  padding: var(--space-xl) var(--space-lg) var(--space-lg);
}

.era-next-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: var(--space-md) var(--space-xl);
  cursor: none;
  transition: border-color 0.25s, background 0.25s, transform 0.25s var(--ease-out);
  min-width: 200px;
}

.era-next-btn:hover {
  border-color: var(--c-terra);
  background: rgba(196, 98, 45, 0.06);
  transform: translateX(3px); /* desloca para a direita — reforça que é um avanço no tempo */
}

.era-next-btn--end:hover {
  border-color: var(--c-verde);
  background: rgba(44, 120, 115, 0.06);
  transform: translateX(-3px); /* desloca para a esquerda — reforça que vai voltar ao topo */
}

.era-next-label {
  font-family: var(--f-mono);
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--c-text-dim);
}

.era-next-name {
  font-family: var(--f-display);
  font-style: italic;
  font-size: 1rem;
  font-weight: 700;
  color: var(--c-text-muted);
  transition: color 0.2s;
}

.era-next-btn:hover .era-next-name { color: var(--c-terra); }
.era-next-btn--end:hover .era-next-name { color: var(--c-verde); }

.era-next-arrow {
  width: 18px;
  height: 18px;
  stroke: var(--c-text-dim);
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.2s, transform 0.3s var(--ease-out);
  animation: arrowBounce 2s ease-in-out infinite;
}

.era-next-btn:hover .era-next-arrow {
  stroke: var(--c-terra);
  animation: none;
  transform: translateX(5px);
}

@keyframes arrowBounce {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(4px); }
}

/* ============ FUTURE HORIZON ============ */
.horizon-card {
  background: linear-gradient(135deg, var(--c-surface) 0%, rgba(107, 63, 160, 0.05) 100%);
  border: 1px solid rgba(107, 63, 160, 0.2);
  border-radius: 12px;
  padding: var(--space-lg);
  position: relative;
  overflow: hidden;
}

.horizon-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -10%;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(107, 63, 160, 0.1), transparent 70%);
  pointer-events: none;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .era-panel-inner {
    grid-template-columns: 1fr;
  }
  .era-info { position: static; }
  .era-number { font-size: 5rem; }
}

@media (max-width: 600px) {
  .era-tab-period { display: none; }
  .era-tab { min-width: 70px; }

  /* Impede que o cabeçalho do card esmague os textos e tags no celular */
  .milestone-header {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  /* Coloca a Tag de um lado e a Data do outro ocupando todo o topo do card */
  .milestone-meta {
    width: 100%;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
  }

  /* Ajusta o botão de avançar para a próxima era */
  .era-next-btn {
    min-width: 100%;
  }
}