﻿/** * Copyright (c) 2026 DNA Genics, S.L. All rights reserved.
 * 
 * Haplogroup Timeline Component - Elegant Vertical Design
 * A clean, vertical timeline showing when a haplogroup emerged in human history.
 */

/* ========================================
   CSS VARIABLES
   ======================================== */
.haplo-timeline-wrapper {
    --htl-gold: var(--ydr-gold, #C9A430);
    --htl-bronze: var(--ydr-bronze, #6B5D4D);
    --htl-bronze-light: var(--ydr-bronze-light, #8B7A6A);
    --htl-ivory: var(--ydr-ivory, #FAF8F5);
    --htl-ivory-dim: var(--ydr-ivory-dim, rgba(250, 248, 245, 0.7));
    --htl-bg-dark: rgba(45, 40, 36, 0.5);
    --htl-bg-card: rgba(45, 40, 36, 0.6);
    --htl-border: rgba(107, 93, 77, 0.2);
    --htl-font-display: var(--ydr-font-display, 'Cormorant Garamond', serif);
    --htl-font-body: var(--ydr-font-body, 'Inter', sans-serif);
}

/* ========================================
   TIMELINE WRAPPER
   ======================================== */
.haplo-timeline-wrapper {
    margin: 3rem 0;
    padding: 0;
}

/* ========================================
   CHAPTER HEADER
   ======================================== */
.haplo-timeline-chapter-header {
    text-align: center;
    margin-bottom: 3rem;
}

.haplo-timeline-chapter-label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--htl-gold);
    margin-bottom: 1rem;
    font-family: var(--htl-font-body);
}

.haplo-timeline-title {
    font-family: var(--htl-font-display);
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 600;
    color: var(--htl-ivory);
    margin: 0 0 0.5rem;
    line-height: 1.2;
}

.haplo-timeline-subtitle {
    font-size: 1rem;
    color: var(--htl-ivory-dim);
    margin: 0;
    font-weight: 400;
}

/* ========================================
   VERTICAL TIMELINE CONTAINER
   ======================================== */
.haplo-timeline-vertical {
    position: relative;
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem 0;
}

/* ========================================
   TIMELINE SPINE (Central Line)
   ======================================== */
.haplo-timeline-spine {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(
        180deg,
        transparent 0%,
        var(--htl-bronze) 5%,
        var(--htl-gold) 50%,
        var(--htl-bronze) 95%,
        transparent 100%
    );
    transform: translateX(-50%);
    z-index: 1;
}

/* ========================================
   MILESTONES CONTAINER
   ======================================== */
.haplo-timeline-milestones {
    position: relative;
    z-index: 2;
}

/* ========================================
   TIMELINE ITEM (Each Milestone)
   ======================================== */
.haplo-timeline-item {
    position: relative;
    display: flex;
    align-items: flex-start;
    margin-bottom: 2.5rem;
    opacity: 0;
    animation: htl-fade-in 0.6s ease forwards;
    animation-delay: var(--animation-delay, 0ms);
}

.haplo-timeline-item:last-child {
    margin-bottom: 0;
}

/* Left-aligned items */
.haplo-timeline-left {
    flex-direction: row;
    padding-right: calc(50% + 40px);
}

.haplo-timeline-left .haplo-timeline-card {
    text-align: right;
    margin-right: auto;
}

.haplo-timeline-left .haplo-timeline-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.haplo-timeline-left .haplo-timeline-connector {
    position: absolute;
    right: calc(50% + 16px);
    width: 24px;
    top: 16px;
}

/* Right-aligned items */
.haplo-timeline-right {
    flex-direction: row-reverse;
    padding-left: calc(50% + 40px);
}

.haplo-timeline-right .haplo-timeline-card {
    text-align: left;
    margin-left: auto;
}

.haplo-timeline-right .haplo-timeline-node {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.haplo-timeline-right .haplo-timeline-connector {
    position: absolute;
    left: calc(50% + 16px);
    width: 24px;
    top: 16px;
}

/* ========================================
   TIMELINE NODE (Dot on Spine)
   ======================================== */
.haplo-timeline-node {
    position: relative;
    z-index: 3;
}

.haplo-timeline-node-dot {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--htl-bg-dark);
    border: 2px solid var(--htl-bronze);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.haplo-timeline-node-dot .dna-icon {
    width: 14px;
    height: 14px;
    color: var(--htl-bronze-light);
    transition: color 0.3s ease;
}

.haplo-timeline-item:hover .haplo-timeline-node-dot {
    border-color: var(--htl-gold);
    transform: scale(1.1);
}

.haplo-timeline-item:hover .haplo-timeline-node-dot .dna-icon {
    color: var(--htl-gold);
}

/* ========================================
   HAPLOGROUP MARKER (Highlighted)
   ======================================== */
.haplo-timeline-haplogroup .haplo-timeline-node-dot {
    width: 44px;
    height: 44px;
    background: linear-gradient(135deg, var(--htl-gold), #D4AF37);
    border: 3px solid var(--htl-ivory);
    box-shadow: 0 0 20px rgba(201, 164, 48, 0.4);
}

.haplo-timeline-haplogroup .haplo-timeline-node-dot .dna-icon {
    width: 20px;
    height: 20px;
    color: #1a1816;
}

.haplo-timeline-haplogroup:hover .haplo-timeline-node-dot .dna-icon {
    color: #1a1816;
}

/* Glow effect */
.haplo-timeline-node-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(201, 164, 48, 0.3) 0%, transparent 70%);
    animation: htl-pulse 2s ease-in-out infinite;
    pointer-events: none;
}

/* Adjust node position for haplogroup */
.haplo-timeline-haplogroup.haplo-timeline-left .haplo-timeline-connector {
    top: 22px;
}

.haplo-timeline-haplogroup.haplo-timeline-right .haplo-timeline-connector {
    top: 22px;
}

/* ========================================
   CONNECTOR LINE
   ======================================== */
.haplo-timeline-connector {
    height: 2px;
    background: linear-gradient(
        90deg,
        var(--htl-bronze) 0%,
        var(--htl-border) 100%
    );
}

.haplo-timeline-right .haplo-timeline-connector {
    background: linear-gradient(
        90deg,
        var(--htl-border) 0%,
        var(--htl-bronze) 100%
    );
}

.haplo-timeline-haplogroup .haplo-timeline-connector {
    background: linear-gradient(
        90deg,
        var(--htl-gold) 0%,
        rgba(201, 164, 48, 0.3) 100%
    );
    height: 3px;
}

.haplo-timeline-haplogroup.haplo-timeline-right .haplo-timeline-connector {
    background: linear-gradient(
        90deg,
        rgba(201, 164, 48, 0.3) 0%,
        var(--htl-gold) 100%
    );
}

/* ========================================
   CONTENT CARD
   ======================================== */
.haplo-timeline-card {
    background: var(--htl-bg-card);
    border: 1px solid var(--htl-border);
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    max-width: 320px;
    transition: all 0.3s ease;
}

.haplo-timeline-item:hover .haplo-timeline-card {
    border-color: var(--htl-bronze);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.haplo-timeline-card-date {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--htl-bronze-light);
    margin-bottom: 0.5rem;
    font-family: var(--htl-font-body);
}

.haplo-timeline-card-title {
    font-family: var(--htl-font-display);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--htl-ivory);
    margin: 0 0 0.5rem;
    line-height: 1.3;
}

.haplo-timeline-card-description {
    font-size: 0.875rem;
    color: var(--htl-ivory-dim);
    margin: 0;
    line-height: 1.6;
}

.haplo-timeline-card-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--htl-border);
    font-size: 0.8rem;
    color: var(--htl-bronze-light);
}

.haplo-timeline-card-meta .dna-icon {
    width: 14px;
    height: 14px;
    color: var(--htl-gold);
}

/* Haplogroup card styling */
.haplo-timeline-haplogroup .haplo-timeline-card {
    background: linear-gradient(135deg, rgba(201, 164, 48, 0.15) 0%, var(--htl-bg-card) 100%);
    border-color: rgba(201, 164, 48, 0.4);
    box-shadow: 0 4px 20px rgba(201, 164, 48, 0.15);
}

.haplo-timeline-haplogroup .haplo-timeline-card-date {
    color: var(--htl-gold);
}

.haplo-timeline-haplogroup .haplo-timeline-card-title {
    color: var(--htl-gold);
    font-size: 1.5rem;
}

.haplo-timeline-haplogroup:hover .haplo-timeline-card {
    border-color: var(--htl-gold);
    box-shadow: 0 12px 32px rgba(201, 164, 48, 0.25);
}

/* Align card text for left/right positions */
.haplo-timeline-left .haplo-timeline-card-meta {
    justify-content: flex-end;
}

/* ========================================
   LEGEND
   ======================================== */
.haplo-timeline-legend {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 2rem;
    margin-top: 2.5rem;
    padding: 1rem;
    background: var(--htl-bg-dark);
    border-radius: 8px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.haplo-timeline-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: var(--htl-ivory-dim);
    font-family: var(--htl-font-body);
}

.haplo-timeline-legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--htl-bronze);
    border: 2px solid var(--htl-border);
}

.haplo-timeline-legend-haplogroup .haplo-timeline-legend-dot {
    background: var(--htl-gold);
    border-color: var(--htl-ivory);
    box-shadow: 0 0 8px rgba(201, 164, 48, 0.4);
}

/* ========================================
   ANIMATIONS
   ======================================== */
@keyframes htl-fade-in {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes htl-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.6;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 0.3;
    }
}

/* Animation class for scroll reveal */
.haplo-timeline-item.htl-visible {
    opacity: 1;
}

/* ========================================
   RESPONSIVE DESIGN - TABLET
   ======================================== */
@media (max-width: 768px) {
    .haplo-timeline-wrapper {
        margin: 2rem 0;
    }

    .haplo-timeline-chapter-header {
        margin-bottom: 2rem;
    }

    .haplo-timeline-vertical {
        padding: 1.5rem 0 1.5rem 20px;
    }

    /* Move spine to left edge on mobile */
    .haplo-timeline-spine {
        left: 20px;
        transform: none;
    }

    /* All items align left */
    .haplo-timeline-left,
    .haplo-timeline-right {
        flex-direction: row;
        padding-left: 60px;
        padding-right: 0;
    }

    .haplo-timeline-left .haplo-timeline-card,
    .haplo-timeline-right .haplo-timeline-card {
        text-align: left;
        margin-left: 0;
        margin-right: 0;
        max-width: none;
    }

    .haplo-timeline-left .haplo-timeline-node,
    .haplo-timeline-right .haplo-timeline-node {
        position: absolute;
        left: 20px;
        transform: translateX(-50%);
    }

    .haplo-timeline-left .haplo-timeline-connector,
    .haplo-timeline-right .haplo-timeline-connector {
        position: absolute;
        left: 36px;
        right: auto;
        width: 20px;
        top: 16px;
        background: linear-gradient(
            90deg,
            var(--htl-bronze) 0%,
            var(--htl-border) 100%
        );
    }

    .haplo-timeline-haplogroup.haplo-timeline-left .haplo-timeline-connector,
    .haplo-timeline-haplogroup.haplo-timeline-right .haplo-timeline-connector {
        left: 42px;
        top: 22px;
        background: linear-gradient(
            90deg,
            var(--htl-gold) 0%,
            rgba(201, 164, 48, 0.3) 100%
        );
    }

    .haplo-timeline-left .haplo-timeline-card-meta {
        justify-content: flex-start;
    }

    .haplo-timeline-card {
        padding: 1rem 1.25rem;
    }

    .haplo-timeline-card-title {
        font-size: 1.1rem;
    }

    .haplo-timeline-haplogroup .haplo-timeline-card-title {
        font-size: 1.25rem;
    }

    .haplo-timeline-legend {
        gap: 1.5rem;
        padding: 0.75rem;
    }
}

/* ========================================
   RESPONSIVE DESIGN - SMALL MOBILE
   ======================================== */
@media (max-width: 480px) {
    .haplo-timeline-vertical {
        padding-left: 16px;
    }

    .haplo-timeline-spine {
        left: 16px;
    }

    .haplo-timeline-left,
    .haplo-timeline-right {
        padding-left: 50px;
    }

    .haplo-timeline-left .haplo-timeline-node,
    .haplo-timeline-right .haplo-timeline-node {
        left: 16px;
    }

    .haplo-timeline-left .haplo-timeline-connector,
    .haplo-timeline-right .haplo-timeline-connector {
        left: 32px;
        width: 14px;
    }

    .haplo-timeline-haplogroup.haplo-timeline-left .haplo-timeline-connector,
    .haplo-timeline-haplogroup.haplo-timeline-right .haplo-timeline-connector {
        left: 38px;
    }

    .haplo-timeline-node-dot {
        width: 28px;
        height: 28px;
    }

    .haplo-timeline-node-dot .dna-icon {
        width: 12px;
        height: 12px;
    }

    .haplo-timeline-haplogroup .haplo-timeline-node-dot {
        width: 36px;
        height: 36px;
    }

    .haplo-timeline-haplogroup .haplo-timeline-node-dot .dna-icon {
        width: 16px;
        height: 16px;
    }

    .haplo-timeline-card {
        padding: 0.875rem 1rem;
    }

    .haplo-timeline-card-title {
        font-size: 1rem;
    }

    .haplo-timeline-haplogroup .haplo-timeline-card-title {
        font-size: 1.15rem;
    }

    .haplo-timeline-card-description {
        font-size: 0.8125rem;
    }

    .haplo-timeline-item {
        margin-bottom: 2rem;
    }
}

/* ========================================
   PRINT STYLES
   ======================================== */
@media print {
    .haplo-timeline-wrapper {
        break-inside: avoid;
    }

    .haplo-timeline-item {
        opacity: 1;
        animation: none;
    }

    .haplo-timeline-node-glow {
        display: none;
    }

    .haplo-timeline-card {
        background: #f5f5f5;
        border: 1px solid #ccc;
        box-shadow: none;
    }

    .haplo-timeline-haplogroup .haplo-timeline-card {
        background: #fff3cd;
        border-color: #c9a430;
    }

    .haplo-timeline-spine {
        background: #6B5D4D;
    }

    .haplo-timeline-chapter-label,
    .haplo-timeline-card-date,
    .haplo-timeline-legend-item {
        color: #333;
    }

    .haplo-timeline-title,
    .haplo-timeline-card-title {
        color: #000;
    }

    .haplo-timeline-subtitle,
    .haplo-timeline-card-description {
        color: #555;
    }

    .haplo-timeline-haplogroup .haplo-timeline-card-title,
    .haplo-timeline-haplogroup .haplo-timeline-card-date {
        color: #8B6914;
    }
}

/* ========================================
   REDUCED MOTION
   ======================================== */
@media (prefers-reduced-motion: reduce) {
    .haplo-timeline-item {
        animation: none;
        opacity: 1;
    }

    .haplo-timeline-node-glow {
        animation: none;
    }

    .haplo-timeline-card,
    .haplo-timeline-node-dot {
        transition: none;
    }
}
