/* =============================================================================
   MEGH Timeline — Fase 1: Entrada
   ============================================================================= */

/* Importa Inter do Google Fonts como fallback padrão */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700&display=swap');

/* ── Container principal ─────────────────────────────────────────────────── */

.megh-timeline-intro {
    display: flex;
    align-items: center;
    width: 100%;
    /* Permite que a linha SVG extenda além dos limites durante a Fase 2 */
    overflow: visible;
}

/* Elementor wrappers — garantem que o SVG não seja clipado */
.elementor-widget-megh_timeline_intro,
.elementor-widget-megh_timeline_intro > .elementor-widget-container {
    overflow: visible !important;
}

/* ── Inner: linha flexível (texto + seta) ───────────────────────────────── */

.megh-timeline-intro__inner {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 20px;
    text-decoration: none;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    /* Permite overflow do SVG durante a Fase 2 */
    overflow: visible;
}

/* Remove sublinhado e herda cor para o link */
.megh-timeline-intro__inner:hover,
.megh-timeline-intro__inner:focus {
    text-decoration: none;
    outline: none;
}

/* ── Texto ──────────────────────────────────────────────────────────────── */

.megh-timeline-intro__text {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 300;
    line-height: 1.2;
    color: #1a1a1a;
    letter-spacing: -0.01em;

    /* Opacidade inicial: será animada via GSAP */
    opacity: 0;
    transform: translateY(12px);
}

/* ── Seta ───────────────────────────────────────────────────────────────── */

.megh-timeline-intro__arrow {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    /* Necessário para a linha SVG extender além do elemento durante a Fase 2 */
    overflow: visible;

    /* Opacidade inicial: será animada via GSAP */
    opacity: 0;
}

.megh-timeline-intro__arrow-svg {
    display: block;
    overflow: visible;
    /* A largura é controlada pelo controle do Elementor via CSS */
}

/* Elementos SVG da seta */
.megh-timeline-intro__arrow-svg line,
.megh-timeline-intro__arrow-svg polyline {
    stroke: #1a1a1a;
    stroke-width: 1.5;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: miter;
}

/* ── Estado: animação em execução ───────────────────────────────────────── */

/* Evita interação durante a animação de entrada */
.megh-timeline-intro.is-animating {
    pointer-events: none;
}

/* ── Estado: pronto para interação ─────────────────────────────────────── */

.megh-timeline-intro.is-ready .megh-timeline-intro__inner {
    cursor: pointer;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .megh-timeline-intro__text {
        font-size: 22px;
    }
}

@media (max-width: 480px) {
    .megh-timeline-intro__text {
        font-size: 18px;
    }

    .megh-timeline-intro__inner {
        gap: 12px;
    }
}

/* =============================================================================
   Fase 2 — Revelação do Logo
   ============================================================================= */

/* ── Fonte do logo SVG (escondida) ────────────────────────────────────────── */

.megh-timeline-logo-source {
    display: none;
    position: absolute;
    pointer-events: none;
    visibility: hidden;
}

/* ── Linha extensora (elemento fixo criado pelo JS) ──────────────────────── */

.megh-line-extender {
    position: fixed;
    pointer-events: none;
    transform-origin: left center;
    z-index: 99998;
}

/* ── Overlay de revelação ────────────────────────────────────────────────── */

.megh-timeline-overlay {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: all;
}

/* ── Container do logo no overlay ───────────────────────────────────────── */

.megh-timeline-overlay__logo {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 90%;
}

.megh-timeline-overlay__logo svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

/* Remove fill original; stroke é aplicado via JS */
.megh-timeline-overlay__logo svg path,
.megh-timeline-overlay__logo svg rect,
.megh-timeline-overlay__logo svg circle,
.megh-timeline-overlay__logo svg ellipse,
.megh-timeline-overlay__logo svg polyline,
.megh-timeline-overlay__logo svg polygon {
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ── Botão de fechar ─────────────────────────────────────────────────────── */

.megh-timeline-overlay__close {
    position: absolute;
    top: 28px;
    right: 32px;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    background: transparent;
    border: none;
    padding: 0;
    color: inherit;
    transition: opacity 0.2s ease, transform 0.25s ease;
    z-index: 1;
}

.megh-timeline-overlay__close:hover {
    opacity: 0.6;
    transform: rotate(90deg) scale(1.1);
}

/* Linhas do X via pseudo-elementos */
.megh-timeline-overlay__close::before,
.megh-timeline-overlay__close::after {
    content: '';
    position: absolute;
    width: 22px;
    height: 1.5px;
    background: currentColor;
    border-radius: 1px;
}

.megh-timeline-overlay__close::before {
    transform: rotate(45deg);
}

.megh-timeline-overlay__close::after {
    transform: rotate(-45deg);
}

/* =============================================================================
   Fase 3 — Linha do Tempo
   ============================================================================= */

.megh-phase3 {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;  /* centraliza verticalmente */
    padding: 0 7vw 0vh;
    box-sizing: border-box;
    gap: 16px;
}

/* ── Grid principal: M esquerda | conteúdo + timeline direita ──────────── */

.megh-phase3__main {
    display: grid;
    grid-template-columns: clamp(100px, 15vw, 200px) 1fr;
    gap: 0 36px;
    align-items: end; /* base do M alinhada com a linha */
}

.megh-phase3__logo-m {
    /* coluna esquerda — ocupa apenas o espaço do SVG */
}

.megh-phase3__m-svg {
    width: 100%;
    height: auto;
    display: block;
    overflow: visible;
}

/* Coluna direita: texto em cima, timeline embaixo */
.megh-phase3__right {
    display: flex;
    flex-direction: column;
    min-width: 0; /* evita overflow em flex */
    height: 100%; /* necessário para justify-content funcionar */
    align-self: stretch;
}

.megh-phase3__content {
    padding-bottom: 24px;
}

.megh-phase3__title {
    font-family: 'Inter', sans-serif;
    font-size: 40px;
    font-weight: 300;
    line-height: 1.1;
    color: #1a1a1a;
    margin: 0 0 12px;
    padding: 0;
}

.megh-phase3__subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    line-height: 1.55;
    color: #666666;
    margin: 0;
    max-width: 38vw; /* flexível em vez de fixo */
}

/* ── Área da timeline ────────────────────────────────────────────────────── */

.megh-phase3__timeline {
    position: relative;
    width: 100%;
}

/* Linha horizontal (animada via scaleX) */
.megh-phase3__tl-line {
    width: 100%;
    height: 1px;
    background: #1a1a1a;
    position: absolute;
    top: 75px;
    left: 0;
    transform-origin: left center;
}

/* Faixa dos marcadores */
.megh-phase3__markers {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-end; /* ancora tudo na linha (bottom) */
    width: 100%;
    position: relative;
    /* altura mínima = espaço para o ano + dot acima + espaço para popup abaixo */
    min-height: 80px;
    padding-bottom: 0;
}

/* Cada marcador: flex-column, dot na base (alinhado à linha) */
.megh-phase3__marker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    cursor: default;
    position: relative; /* âncora para o popup */
    /* Puxa o marcador para que o dot fique exatamente sobre a linha */
    transform: translateY( 50% );
}

/* Ano — acima da bolinha */
.megh-phase3__marker-year {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    font-weight: 300;
    color: #1a1a1a;
    white-space: nowrap;
    line-height: 1;
    /* transition definido inline pelo JS */
}

/* Bolinha — alinhada à linha horizontal */
.megh-phase3__marker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid #1a1a1a;
    background: transparent;
    flex-shrink: 0;
    position: relative;
    z-index: 1;
    transition: transform 0.25s ease, background-color 0.2s ease;
}

.megh-phase3__marker-dot.is-active {
    background: currentColor;
}

/* ── Popup (hover) — conector + título ────────────────────────────────────── */

.megh-phase3__marker-popup {
    position: absolute;
    top: calc( 100% + 4px ); /* logo abaixo do dot */
    left: 50%;
    transform: translateX( -50% ) translateY( -6px );
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 10;
    white-space: nowrap;
}

.megh-phase3__marker-popup.is-visible {
    opacity: 1;
    transform: translateX( -50% ) translateY( 0 );
    pointer-events: auto;
}

/* Linha vertical de conexão */
.megh-phase3__marker-connector {
    display: block;
    width: 1px;
    height: 28px;
    background: #1a1a1a;
    flex-shrink: 0;
}

/* Título do evento */
.megh-phase3__marker-title {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #1a1a1a;
    line-height: 1.4;
    text-align: center;
    white-space: normal;
    max-width: 140px;
}

/* Dica de interação */
.megh-phase3__hint {
    text-align: center;
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 300;
    color: #999;
    margin: 16px 0 0;
    letter-spacing: 0.02em;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .megh-phase3 {
        padding: 40px 24px;
    }

    .megh-phase3__top {
        gap: 20px;
    }

    .megh-phase3__title {
        font-size: 28px;
    }

    .megh-phase3__marker-year {
        font-size: 10px;
    }
}

@media (max-width: 480px) {
    .megh-phase3__top {
        flex-direction: column;
        align-items: flex-start;
    }

    .megh-phase3__logo-m {
        width: 80px;
    }
}


/* =============================================================================
   Fase 4 — Cards de Evento
   ============================================================================= */

.megh-phase4 {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: 120px 1fr;
    grid-template-rows: 1fr;
    /* Logo e fechar ficam sobre o grid via position absolute */
    overflow: hidden;
}

/* Logo SVG — canto superior esquerdo */
.megh-phase4__logo {
    position: absolute;
    top: 20px;
    left: 28px;
    z-index: 10;
    pointer-events: none;
    /* tamanho máximo do SVG na Fase 4 */
    max-width: 90px;
}
.megh-phase4__logo svg {
    display: block;
    width: 100%;
    height: auto;
    max-width: 90px;
}
/* Garante que os paths do SVG clonado sejam visíveis */
.megh-phase4__logo svg path,
.megh-phase4__logo svg circle,
.megh-phase4__logo svg rect,
.megh-phase4__logo svg polyline,
.megh-phase4__logo svg polygon {
    stroke-dasharray: none !important;
    stroke-dashoffset: 0 !important;
    opacity: 1 !important;
}
/* Fallback: texto MEGH caso SVG não seja inserido */
.megh-phase4__logo:not(:has(svg)) {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: #1a1a1a;
    line-height: 1;
}

/* Botão fechar — canto superior direito */
.megh-phase4__close {
    position: absolute;
    top: 20px;
    right: 28px;
    background: none;
    border: none;
    font-size: 24px;
    line-height: 1;
    color: #1a1a1a;
    cursor: pointer;
    z-index: 10;
    padding: 4px 8px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}
.megh-phase4__close:hover { opacity: 1; }

/* ── Sidebar (coluna esquerda) ──────────────────────────────────────────── */

.megh-phase4__sidebar {
    grid-column: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    /* Distribui os markers ao longo de toda a altura */
    justify-content: space-between;
    padding: 100px 0 60px 39px;
    position: relative;
    gap: 0;
}

/* Linha vertical contínua */
.megh-phase4__sb-line {
    position: absolute;
    left: 44px; /* alinha com o centro dos dots */
    top: 100px;
    bottom: 60px;
    width: 1px;
    background: #cccccc;
    z-index: 0;
}

/* Item da sidebar */
.megh-phase4__sb-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    position: relative;
    z-index: 1;
    transition: opacity 0.2s ease;
    /* padding removido pois o space-between já distribui */
}
.megh-phase4__sb-item:hover { opacity: 0.8; }

/* Ponto do marker */
.megh-phase4__sb-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    border: 1px solid currentColor;
    flex-shrink: 0;
    background: transparent;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.megh-phase4__sb-item.is-active .megh-phase4__sb-dot {
    transform: scale(1.4);
}

/* Grupo texto do item: ano + título empilhados */
.megh-phase4__sb-text {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

/* Texto do ano na sidebar */
.megh-phase4__sb-year {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 300;
    white-space: nowrap;
    transition: color 0.2s ease, font-weight 0.2s ease;
    line-height: 1.2;
}
.megh-phase4__sb-item.is-active .megh-phase4__sb-year {
    font-weight: 600;
}

/* Título do marker na sidebar (abaixo do ano) */
.megh-phase4__sb-title {
    font-family: 'Inter', sans-serif;
    font-size: 9px;
    font-weight: 300;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 80px;
    transition: color 0.2s ease;
    line-height: 1.2;
    opacity: 0.8;
}
.megh-phase4__sb-item.is-active .megh-phase4__sb-title {
    font-weight: 500;
    opacity: 1;
}

/* ── Área do card (coluna direita) ──────────────────────────────────────────── */

.megh-phase4__content {
    grid-column: 2;
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    overflow: hidden;
}

/* ── Card individual ──────────────────────────────────────────────────────────────── */

/* Todos os elementos do scroll-stage (card ativo + ghosts) compartilham
   a mesma área (position:absolute inset:0). A posição visual é definida
   exclusivamente pelo transform injetado pelo JS. */
.megh-phase4-card,
.megh-phase4__ghost {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 8vw 60px 4vw;
    text-align: center;
    /* Estado inicial: JS define opacity/transform antes de adicionar ao DOM */
    transition: opacity 0.4s ease, transform 0.4s ease;
}

/* Card ativo — estilos específicos */
.megh-phase4-card {
    pointer-events: none; /* JS alterna conforme estado */
    gap: 0;
}

/* Ghost cards — sempre inativos para interacção */
.megh-phase4__ghost {
    opacity: 0.4;
    pointer-events: none;
}

/* Ghost acima: deslocado 52% para cima */
.megh-phase4__ghost--above {
    transform: translateY(-52%) scale(0.78);
}

/* Ghost abaixo: deslocado 52% para baixo */
.megh-phase4__ghost--below {
    transform: translateY(52%) scale(0.78);
}

/* Ghost ano */
.megh-phase4__ghost-year {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 300;
    margin: 0 0 6px;
    line-height: 1;
}

/* Ghost label (título compact) */
.megh-phase4__ghost-label {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 300;
    opacity: 0.7;
    margin: 0;
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Ano em destaque (parte superior) */
.megh-phase4__card-year {
    font-family: 'Inter', sans-serif;
    font-size: 48px;
    font-weight: 300;
    color: #1a1a1a;
    margin: 0 0 32px;
    line-height: 1;
    letter-spacing: -0.01em;
}

/* Título do card */
.megh-phase4__card-title {
    font-family: 'Inter', sans-serif;
    font-size: 28px;
    font-weight: 300;
    color: #1a1a1a;
    line-height: 1.25;
    margin: 0 0 16px;
    max-width: 560px;
}

/* Período */
.megh-phase4__card-period {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #888888;
    margin: 0 0 24px;
    letter-spacing: 0.04em;
}

/* Descrição */
.megh-phase4__card-desc {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #444444;
    line-height: 1.75;
    max-width: 520px;
    white-space: pre-line;
    margin: 0 0 16px;
    text-align: center;
}

/* Texto extra */
.megh-phase4__card-extra {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 300;
    color: #666666;
    line-height: 1.6;
    max-width: 520px;
    white-space: pre-line;
    margin: 0;
    text-align: center;
}

/* ── Responsivo ─────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .megh-phase4 {
        grid-template-columns: 80px 1fr;
    }
    .megh-phase4__sidebar {
        padding-left: 18px;
    }
    .megh-phase4__sb-line {
        left: 26px;
    }
    .megh-phase4__card-year  { font-size: 32px; }
    .megh-phase4__card-title { font-size: 20px; }
}
