/* Jewish Festivals Timeline CSS */

/* ============================================
   CSS Custom Properties
   ============================================ */
:root {
    --timeline-primary: #a1b0d8;
    --timeline-primary-dark: #8a9ac4;
    --timeline-accent: #e67e22;
    --timeline-accent-light: rgba(230, 126, 34, 0.15);
    --timeline-text: #333;
    --timeline-text-muted: #666;
    --timeline-bg: #f9f9f9;
    --timeline-card-bg: #ffffff;
    --timeline-border: #e0e0e0;
    --timeline-line: #0e4d92;
    --timeline-transition: 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --timeline-transition-fast: 0.2s ease;
    --timeline-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --timeline-shadow-hover: 0 8px 30px rgba(0, 0, 0, 0.15);
    --timeline-shadow-active: 0 12px 40px rgba(0, 0, 0, 0.2);
}

/* Break out of WordPress constrained layouts */
#jewish-festivals-timeline-container {
    width: 100vw !important;
    max-width: 100vw !important;
    margin-left: calc(-50vw + 50%) !important;
    margin-right: calc(-50vw + 50%) !important;
    padding: 0 1rem;
    box-sizing: border-box;
}

.jewish-timeline {
    font-family: 'Heebo', sans-serif;
    width: 100%;
    margin: 3rem auto;
    padding: 0;
    color: var(--timeline-text);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.timeline-header {
    text-align: center;
    margin-bottom: 2rem;
    width: 100%;
    max-width: 700px;
}

.timeline-header h2 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: var(--timeline-primary);
    font-weight: 600;
}

.timeline-header p {
    font-size: 1.2rem;
    color: var(--timeline-text-muted);
}

/* ============================================
   Progress Indicator
   ============================================ */
.timeline-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--timeline-text-muted);
}

.timeline-progress-counter {
    font-weight: 600;
    color: var(--timeline-primary);
    min-width: 50px;
    text-align: center;
}

.timeline-progress-bar {
    width: 150px;
    height: 4px;
    background: var(--timeline-border);
    border-radius: 2px;
    overflow: hidden;
}

.timeline-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--timeline-primary), var(--timeline-accent));
    border-radius: 2px;
    transition: width var(--timeline-transition);
}

.timeline-navigation {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 3rem;
    gap: 1rem;
    position: relative;
    z-index: 10;
}

.timeline-navigation button {
    background: var(--timeline-primary);
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
}

.timeline-navigation button:hover:not(:disabled) {
    background: #1a6bc2;
    transform: scale(1.05);
}

.timeline-navigation button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.timeline-navigation select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--timeline-primary);
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    background-color: white;
    min-width: 220px;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.timeline-wrapper {
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    padding: 0;
    height: 520px; /* Fixed height for consistency */
    width: calc(100% - 2rem);
    max-width: 100%;
    border: 2px solid var(--timeline-primary);
    border-radius: 12px;
    background: linear-gradient(180deg, var(--timeline-bg) 0%, #fff 50%, var(--timeline-bg) 100%);
    box-shadow: var(--timeline-shadow);
    box-sizing: border-box;
}

/* Main horizontal line */
.timeline-wrapper::before {
    content: '';
    position: absolute;
    left: 0%;
    right: 0%;
    top: 50%;
    height: 4px;
    background: linear-gradient(to right, rgba(14, 77, 146, 0.1), #0e4d92 50%, rgba(14, 77, 146, 0.1));
    transform: translateY(-50%);
    z-index: 1;
    border-radius: 2px;
}

.timeline-track {
    display: flex;
    position: relative;
    min-width: 100%;
    z-index: 1;
    transition: transform 0.5s ease;
    align-items: center;
    height: 100%;
    padding: 0 80px;
}

.timeline-event {
    min-width: 280px;
    width: 280px;
    height: 100%;
    margin: 0 1.5rem;
    position: relative;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.timeline-event.even {
    align-items: center;
}

.timeline-event.odd {
    align-items: center;
}

.timeline-event.even .timeline-content {
    position: absolute;
    bottom: calc(50% + 25px);
}

.timeline-event.odd .timeline-content {
    position: absolute;
    top: calc(50% + 25px);
}

.timeline-event:hover .timeline-content {
    transform: scale(1.02);
    box-shadow: var(--timeline-shadow-hover);
}

/* Timeline date marker dot */
.timeline-marker {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--timeline-line);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100; /* Increased z-index to ensure visibility */
    box-shadow: 0 0 0 4px white, 0 0 0 6px rgba(14, 77, 146, 0.3);
    transition: all 0.3s ease;
}

.timeline-event.active .timeline-marker {
    background: var(--timeline-accent);
    width: 30px;
    height: 30px;
    box-shadow: 0 0 0 6px white, 0 0 0 8px rgba(230, 126, 34, 0.4);
}

.timeline-content {
    padding: 1rem;
    background: var(--timeline-card-bg);
    border-radius: 8px;
    box-shadow: var(--timeline-shadow);
    text-align: left;
    width: 260px;
    height: 200px; /* Fixed height for consistency */
    transition: all var(--timeline-transition);
    position: relative;
    z-index: 3;
    border: 1px solid var(--timeline-border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Scrollable description area */
.timeline-description {
    font-size: 1rem;
    line-height: 1.6;
    color: var(--timeline-text-muted);
    overflow-y: auto; /* Make description scrollable */
    flex-grow: 1; /* Let description take remaining space */
    padding-right: 8px; /* Space for scrollbar */
    margin-bottom: 10px; /* Space at bottom */
    max-height: 150px; /* Maximum height of scrollable area */
}

/* Customize scrollbar for webkit browsers */
.timeline-description::-webkit-scrollbar {
    width: 6px;
}

.timeline-description::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.timeline-description::-webkit-scrollbar-thumb {
    background: var(--timeline-primary);
    border-radius: 10px;
}

.timeline-description::-webkit-scrollbar-thumb:hover {
    background: var(--timeline-line);
}

/* Add connecting line from content to timeline for even events */
.timeline-event.even .timeline-content::after {
    content: '';
    position: absolute;
    width: 2px;
    background: linear-gradient(to bottom, var(--timeline-primary), var(--timeline-line));
    left: 50%;
    bottom: -25px;
    height: 25px;
    transform: translateX(-50%);
    z-index: 2;
}

/* Add connecting line from content to timeline for odd events */
.timeline-event.odd .timeline-content::before {
    content: '';
    position: absolute;
    width: 2px;
    background: linear-gradient(to top, var(--timeline-primary), var(--timeline-line));
    left: 50%;
    top: -25px;
    height: 25px;
    transform: translateX(-50%);
    z-index: 2;
}

.timeline-event.active .timeline-content {
    transform: translateY(-8px);
    box-shadow: var(--timeline-shadow-active);
    border-left: 4px solid var(--timeline-accent);
    background: linear-gradient(135deg, #fff 0%, var(--timeline-accent-light) 100%);
}

/* Festival name display */
.timeline-title {
    font-size: 1rem;
    margin-bottom: 0.5rem;
    color: var(--timeline-line);
    line-height: 1.3;
    font-weight: 600;
    flex-shrink: 0;
}

.timeline-event.active .timeline-title {
    color: var(--timeline-accent);
}

.timeline-image {
    margin: 0 -1rem 0.5rem;
    overflow: hidden;
    border-radius: 4px;
    height: 70px;
    width: calc(100% + 2rem);
    flex-shrink: 0;
}

.timeline-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.timeline-event.active .timeline-image img {
    transform: scale(1.02);
}

/* Scroll indicator */
.scroll-indicator {
    position: absolute;
    bottom: 8px;
    right: 8px;
    color: var(--timeline-line);
    font-size: 12px;
    opacity: 0.7;
    display: flex;
    align-items: center;
}

.scroll-indicator::before {
    content: '↓';
    font-size: 14px;
    margin-right: 4px;
}

/* Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Star of David decorative element */
.timeline-event.active .timeline-marker::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 16px solid rgba(230, 126, 34, 0.4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    animation: rotateStar 4s infinite linear;
}

.timeline-event.active .timeline-marker::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 16px solid rgba(230, 126, 34, 0.4);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(0deg);
    animation: rotateStar 4s infinite linear reverse;
}

@keyframes rotateStar {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ============================================
   Modal for Festival Details
   ============================================ */
.festivals-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.festivals-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.festivals-modal {
    background: white;
    width: 90%;
    max-width: 600px;
    max-height: 85vh;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    padding: 0;
    position: relative;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: all 0.3s ease;
}

.festivals-modal-overlay.active .festivals-modal {
    transform: scale(1) translateY(0);
}

.festivals-modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: var(--timeline-text-muted);
    cursor: pointer;
    transition: all var(--timeline-transition-fast);
    border: none;
    z-index: 10;
}

.festivals-modal-close:hover {
    background: var(--timeline-accent);
    color: white;
    transform: rotate(90deg);
}

.festivals-modal-image {
    width: 100%;
    height: 200px;
    overflow: hidden;
}

.festivals-modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.festivals-modal-content {
    padding: 1.5rem 2rem 2rem;
    overflow-y: auto;
    max-height: calc(85vh - 200px);
}

.festivals-modal-title {
    font-size: 1.8rem;
    color: var(--timeline-accent);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.festivals-modal-description {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--timeline-text);
}

/* Compact card styles for festivals (name + image only) */
#jewish-festivals-timeline-container .timeline-content {
    height: 160px;
    padding: 1rem;
}

#jewish-festivals-timeline-container .timeline-description {
    display: none; /* Hide descriptions on cards */
}

#jewish-festivals-timeline-container .scroll-indicator {
    display: none;
}

#jewish-festivals-timeline-container .timeline-title {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    text-align: center;
}

#jewish-festivals-timeline-container .timeline-image {
    height: 90px;
    margin: 0 -1rem 0.5rem;
    width: calc(100% + 2rem);
}

/* Click hint - separate element so it doesn't affect connector pseudo-elements */
#jewish-festivals-timeline-container .timeline-content .click-hint {
    display: block;
    text-align: center;
    font-size: 0.75rem;
    color: var(--timeline-primary);
    margin-top: auto;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .timeline-header h2 {
        font-size: 1.8rem;
    }

    .timeline-navigation select {
        min-width: 180px;
    }

    .timeline-wrapper {
        width: calc(100% - 1rem);
        margin: 0 auto;
        height: 480px;
    }

    .timeline-event {
        min-width: 280px;
        width: 280px;
        margin: 0 1.5rem;
    }

    .timeline-content {
        padding: 1.2rem;
        width: 260px;
    }

    .timeline-title {
        font-size: 1.1rem;
        margin-bottom: 0.7rem;
    }

    .timeline-image {
        height: 90px;
        margin-bottom: 0.7rem;
    }
}

@media (max-width: 576px) {
    .timeline-header h2 {
        font-size: 1.5rem;
    }

    .timeline-header p {
        font-size: 1rem;
    }

    .timeline-navigation {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.5rem;
        margin-bottom: 1rem;
    }

    .timeline-navigation button {
        width: 36px;
        height: 36px;
    }

    .timeline-navigation select {
        min-width: 140px;
        font-size: 0.9rem;
    }

    .timeline-wrapper {
        height: 440px;
        padding: 0;
    }

    .timeline-event {
        min-width: 240px;
        width: 240px;
        margin: 0 1rem;
    }

    .timeline-content {
        padding: 1rem 1rem 0.8rem;
        width: 220px;
    }

    .timeline-title {
        font-size: 1rem;
        margin-bottom: 0.5rem;
    }

    .timeline-image {
        height: 100px;
        margin: 0 -1rem 0.7rem;
        width: calc(100% + 2rem);
    }

    .timeline-marker {
        width: 20px;
        height: 20px;
    }

    .timeline-event.active .timeline-marker {
        width: 26px;
        height: 26px;
    }
}