/* ===================================
   CONTENTS SECTION - VISUAL TRAIL
   Transformação da grade em trilha/caminho
   =================================== */

@keyframes elementGlow {
    0%, 100% {
        box-shadow: 0 8px 24px rgba(255, 107, 0, 0.2);
    }
    50% {
        box-shadow: 0 12px 32px rgba(255, 107, 0, 0.4);
    }
}

/* Sobrescrever o layout de grade padrão */
.contents-section .contents-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    padding: 60px 0;
}

/* Linha central da trilha (caminho) */
.contents-section .contents-grid::before {
    content: '';
    position: absolute;
    left: 50%;
    top: 80px;
    bottom: 80px;
    width: 4px;
    background: linear-gradient(
        to bottom,
        transparent 0%,
        var(--primary-color) 5%,
        var(--primary-color) 95%,
        transparent 100%
    );
    transform: translateX(-50%);
    z-index: 0;
}

/* Remover estilos antigos dos cards */
.contents-section .chapter-card {
    background: white;
    padding: 32px 40px;
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    border: 2px solid #f0f0f0;
    position: relative;
    margin-bottom: 48px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1;
    overflow: visible;
}

/* Alternar posição: esquerda e direita */
.contents-section .chapter-card:nth-child(odd) {
    margin-left: 0;
    margin-right: 50%;
    padding-right: 60px;
}

.contents-section .chapter-card:nth-child(even) {
    margin-left: 50%;
    margin-right: 0;
    padding-left: 60px;
}

/* Remover o before anterior */
.contents-section .chapter-card::before {
    display: none;
}

/* Ponto de conexão na trilha (bola) */
.contents-section .chapter-card::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 24px;
    background: white;
    border: 4px solid var(--primary-color);
    border-radius: 50%;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    transition: all 0.3s ease;
    box-shadow: 0 0 0 8px rgba(255, 107, 0, 0.1);
}

/* Posição da bola: à direita para cards da esquerda */
.contents-section .chapter-card:nth-child(odd)::after {
    right: -12px;
}

/* Posição da bola: à esquerda para cards da direita */
.contents-section .chapter-card:nth-child(even)::after {
    left: -12px;
}

/* Hover: expandir a bola e card */
.contents-section .chapter-card:hover {
    border-color: var(--primary-color);
    box-shadow: 0 12px 36px rgba(255, 107, 0, 0.15);
    animation: none;
    transform: scale(1.02);
}

.contents-section .chapter-card:hover::after {
    width: 32px;
    height: 32px;
    background: var(--gradient-primary);
    border-color: var(--primary-color);
    box-shadow: 0 0 0 12px rgba(255, 107, 0, 0.15);
}

/* Ajustar número do capítulo - RECRIADO DO ZERO */
.contents-section .chapter-number {
    /* Dimensões */
    width: 64px;
    height: 64px;
    min-width: 64px;
    min-height: 64px;
    
    /* Visual */
    background: var(--gradient-primary);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(255, 107, 0, 0.3);
    animation: elementGlow 1s ease-in-out infinite;
    
    /* Centralização perfeita com Flexbox */
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* Tipografia */
    font-family: var(--font-headings);
    font-size: 1.75rem;
    font-weight: 800;
    color: white;
    line-height: 1;
    text-align: center;
    
    /* Espaçamento */
    margin: 0 0 20px 0;
    padding: 0;
    
    /* Transição */
    transition: all 0.3s ease;
}

.contents-section .chapter-card:hover .chapter-number {
    transform: rotate(-5deg) scale(1.1);
}

.contents-section .chapter-number i {
    font-size: 1.75rem;
}

/* Ajustar títulos e textos */
.contents-section .chapter-card h3 {
    font-family: var(--font-headings);
    font-size: 1.35rem;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--text-primary);
    line-height: 1.3;
}

.contents-section .chapter-card p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-size: 1rem;
}

/* Animação de entrada escalonada */
.contents-section .chapter-card {
    opacity: 0;
    animation: slideInTrail 0.6s ease forwards;
}

.contents-section .chapter-card:nth-child(1) { animation-delay: 0.1s; }
.contents-section .chapter-card:nth-child(2) { animation-delay: 0.2s; }
.contents-section .chapter-card:nth-child(3) { animation-delay: 0.3s; }
.contents-section .chapter-card:nth-child(4) { animation-delay: 0.4s; }
.contents-section .chapter-card:nth-child(5) { animation-delay: 0.5s; }
.contents-section .chapter-card:nth-child(6) { animation-delay: 0.6s; }
.contents-section .chapter-card:nth-child(7) { animation-delay: 0.7s; }
.contents-section .chapter-card:nth-child(8) { animation-delay: 0.8s; }

@keyframes slideInTrail {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Indicadores visuais de início e fim da trilha */
.contents-section .contents-grid::after {
    content: '🏁';
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    font-size: 2.5rem;
    z-index: 2;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: translateX(-50%) scale(1);
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
}

/* ===================================
   RESPONSIVE - MOBILE
   =================================== */

@media (max-width: 768px) {
    /* Em mobile: trilha vertical centralizada */
    .contents-section .contents-grid::before {
        left: 32px;
        transform: none;
    }
    
    .contents-section .chapter-card {
        margin: 0 0 32px 64px !important;
        padding: 24px 28px 24px 40px !important;
        max-width: 100%;
    }
    
    .contents-section .chapter-card::after {
        left: -44px !important;
        right: auto !important;
        width: 20px;
        height: 20px;
    }
    
    .contents-section .chapter-card:hover::after {
        width: 26px;
        height: 26px;
    }
    
    /* Badge mobile - RECRIADO */
    .contents-section .chapter-number {
        width: 56px;
        height: 56px;
        min-width: 56px;
        min-height: 56px;
        font-size: 1.5rem;
        line-height: 1;
        text-align: center;
        padding: 0;
        margin: 0 0 16px 0;
    }
    
    .contents-section .chapter-card h3 {
        font-size: 1.15rem;
    }
    
    .contents-section .chapter-card p {
        font-size: 0.95rem;
    }
    
    /* Animação mobile: vem da esquerda */
    @keyframes slideInTrail {
        from {
            opacity: 0;
            transform: translateX(-20px);
        }
        to {
            opacity: 1;
            transform: translateX(0);
        }
    }
    
    .contents-section .contents-grid::after {
        left: 32px;
        transform: none;
        font-size: 2rem;
    }
}

@media (max-width: 480px) {
    .contents-section .chapter-card {
        margin-left: 56px !important;
        padding: 20px 20px 20px 32px !important;
    }
    
    .contents-section .contents-grid::before {
        left: 24px;
    }
    
    .contents-section .chapter-card::after {
        left: -36px !important;
    }
    
    .contents-section .contents-grid::after {
        left: 24px;
        font-size: 1.75rem;
    }
}
