/* ==============================================
   UMBC Timeline - Fresh Start
   ============================================== */

/* Variables — scoped to the block wrapper, NOT :root. These generic names
   (--gold, --black, --gray…) previously leaked to the whole page and could
   collide with other components. Brand values alias the global tokens. */
.umbc-timeline-block {
    --gold: var(--umbc-btn-gold, #fdb515);
    --gold-dark: #ab7e01;
    --gold-light: #FFD34E;
    --black: var(--umbc-ink-black, #000000);
    --gray-dark: #333333;
    --gray-med: #595959;
    --gray: #595959;
    --gray-light: #999999;
    --gray-pale: #CCCCCC;
    --white: #FFFFFF;
    --bg-page: var(--umbc-surface-page, #ffffff);

    --card-width: 300px;
    --gap: 100px;
}

.timeline-header {
    max-width: 1200px;
    text-align: left;
    margin: 0 auto 3rem;
    position: relative;
}

.header-accent {
    width: 60px;
    height: 4px;
    background: var(--gold);
    margin: 0 auto 1.5rem;
    border-radius: 2px;
}

.timeline-header .subtitle {
    font-size: 1.125rem;
    color: var(--gray-med);
    font-weight: 300;
}

/* ==============================================
   Phase Tabs
   ============================================== */
.phases {
    display: flex;
    gap: 0;
    margin-top: 2rem;
    border-bottom: 3px solid var(--gray-pale);
}

.phase-tab {
    background: transparent;
    border: none;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--gray-med);
    cursor: pointer;
    position: relative;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
    margin-bottom: -3px;
}

.phase-tab.active {
    color: var(--gold-dark);
    border-top: 1px solid #cccccc;
    border-right: 1px solid #cccccc;
    border-left: 1px solid #cccccc;
    border-bottom: 3px solid var(--gold);
}

.phase-tab.active:hover {
    color: var(--black);
}

.phase-tab.disabled {
    color: var(--gray);
    cursor: not-allowed;
    opacity: 1;
}

/* Phase Content */
.phase-content {
    margin-top: 1.5rem;
    margin-bottom: 2rem;
}

.phase-info {
    display: none;
}

.phase-info.active {
    display: block;
}

.phase-date {
    font-size: 1rem;
    color: var(--gray-dark);
    margin-bottom: 0.75rem;
}

.phase-description {
    font-size: 1rem;
    color: var(--gray-med);
    line-height: 1.6;
}

/* ==============================================
   Navigation Controls
   ============================================== */
.timeline-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.control-btn {
    width: 48px;
    height: 48px;
    border: 1px solid #007176 !important;
    background: var(--white);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 1.125rem;
    padding: 0;
}

.control-btn:hover:not(:disabled) {
    background: #f9f9f9;
    border-color: var(--gray-light);
    color: var(--black);
    transform: scale(1.05);
}

.control-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.control-btn:hover:disabled {
    background: var(--white);
}

.progress-track {
    flex: 1;
    max-width: 400px;
    height: 6px;
    background: #E0E0E0;
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--gold-dark), var(--gold));
    width: 0%;
    transition: width 0.3s;
}

/* ==============================================
   Timeline Wrapper - Horizontal Scroll Container
   ============================================== */
.timeline-wrapper {
    position: relative;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 4rem 2rem;
    margin: 0 -1rem;

    /* Custom scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--gold) #E0E0E0;
}

.timeline-wrapper::-webkit-scrollbar {
    height: 8px;
}

.timeline-wrapper::-webkit-scrollbar-track {
    background: #E0E0E0;
}

.timeline-wrapper::-webkit-scrollbar-thumb {
    background: var(--gold);
    border-radius: var(--umbc-radius-sm, 4px);
}

/* ==============================================
   Timeline Track - The Main Horizontal Line
   ============================================== */
.timeline-track {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 600px;
    padding: 0 2rem;
    width: max-content;
    min-width: 100%;
}

/* The horizontal spine line - drawn with background */
.timeline-track::before {
    content: '';
    position: absolute;
    left: 2rem;
    right: 2rem;
    top: 50%;
    height: 4px;
    background: linear-gradient(to right,
            var(--gray-light) 0%,
            var(--gray-light) 35%,
            var(--gold) 50%,
            var(--black) 65%,
            var(--black) 100%);
    transform: translateY(-50%);
    z-index: 0;
    pointer-events: none;
}

/* ==============================================
   Year Markers
   ============================================== */
.timeline-year-marker {
    display: flex;
    align-items: center;
    margin: 0 2rem;
    z-index: 10;
}

.year-badge {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--white);
    background: var(--gray-med);
    padding: 0.75rem 1.5rem;
    border-radius: var(--umbc-radius-md, 8px);
    border: 3px solid var(--gray-dark);
    box-shadow: var(--umbc-shadow-card);
    white-space: nowrap;
}

/* ==============================================
   Timeline Items - Base Structure
   ============================================== */
.timeline-item,
.timeline-item-long {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0 calc(var(--gap) / 2);
    z-index: 5;
}

/* Top items: card above line */
.timeline-item.top {
    justify-content: flex-end;
    padding-bottom: 0;
    margin-bottom: 292px;
}

/* Bottom items: card below line */
.timeline-item.bottom {
    justify-content: flex-start;
    padding-top: 0;
    margin-top: 292px;
}

/* Top items: card above line */
.timeline-item-long.top {
    justify-content: flex-end;
    padding-bottom: 0;
    margin-bottom: 333px;
}

/* Bottom items: card below line */
.timeline-item-long.bottom {
    justify-content: flex-start;
    padding-top: 0;
    margin-top: 333px;
}

/* Item Details - Hidden until shown in modal */
.item-details {
    display: none;
}

/* ==============================================
   Item Dot - Sits on the timeline spine
   ============================================== */
.item-dot {
    width: 14px;
    height: 14px;
    background: var(--white);
    border: 4px solid var(--gray-med);
    border-radius: 50%;
    z-index: 10;
    flex-shrink: 0;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

/* ==============================================
   Item Connector - Vertical line from dot to card
   ============================================== */
.item-connector {
    width: 2px;
    height: 60px;
    background: var(--gray-light);
    flex-shrink: 0;
}

/* ==============================================
   Event Cards
   ============================================== */
.item-card {
    min-width: 320px;
    width: var(--card-width);
    background: var(--white);
    border: 2px solid var(--gray-light);
    border-radius: var(--umbc-radius-lg, 12px);
    padding: 1.25rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.item-card::after {
    content: '\f065';
    font-family: 'Font Awesome 7 Pro';
    font-weight: 900;
    position: absolute;
    bottom: 0.75rem;
    right: 0.75rem;
    font-size: 0.875rem;
    color: var(--gray-light);
    opacity: 0.6;
    transition: all 0.3s;
}

.item-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--umbc-shadow-card-hover);
}

.item-card:hover::after {
    color: var(--gold-dark);
    opacity: 1;
    transform: scale(1.1);
}

.item-card:focus {
    outline: 3px solid var(--gold);
    outline-offset: 2px;
}

.card-icon {
    width: 56px;
    height: 56px;
    background: var(--gray-light);
    color: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--gray-dark);
    margin-bottom: 0.5rem;
}

.card-date {
    font-size: 0.875rem;
    color: var(--gray-med);
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.card-summary {
    font-size: 0.875rem;
    color: var(--gray-med);
    line-height: 1.5;
}

/* ==============================================
   PAST State (Grayscale)
   ============================================== */
.timeline-item.past .item-dot,
.timeline-item-long.past .item-dot {
    border-color: var(--gray-pale);
}

.timeline-item.past .item-connector,
.timeline-item-long.past .item-connector {
    background: var(--gray-pale);
}

.timeline-item.past .item-card,
.timeline-item-long.past .item-card {
    background: #F5F5F5;
    border-color: var(--gray-pale);
}

.timeline-item.past .card-icon,
.timeline-item-long.past .card-icon {
    background: var(--gray-light);
}

.timeline-item.past .card-title,
.timeline-item-long.past .card-title {
    color: var(--gray-med);
}

.timeline-item.past .card-date,
.timeline-item.past .card-summary {
    color: var(--gray-light);
}

/* ==============================================
   CURRENT State (Gold Highlight)
   ============================================== */
.timeline-item.current .item-dot,
.timeline-item-long.current .item-dot {
    background: var(--white);
    border-color: var(--gold);
    box-shadow: 0 0 20px rgba(253, 181, 21, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        box-shadow: 0 0 20px rgba(253, 181, 21, 0.6);
    }

    50% {
        box-shadow: 0 0 30px rgba(253, 181, 21, 0.9);
    }
}

.timeline-item.current .item-connector,
.timeline-item-long.current .item-connector {
    background: var(--gold);
}

.timeline-item.current .item-card,
.timeline-item-long.current .item-card {
    background: linear-gradient(135deg, #FFF9E6 0%, var(--white) 100%);
    border-color: var(--gold);
    box-shadow: 0 4px 20px rgba(253, 181, 21, 0.3);
}

.timeline-item.current .card-icon,
.timeline-item-long.current .card-icon {
    background: linear-gradient(135deg, var(--gold-dark), var(--gold-light));
}

.timeline-item.current .card-title,
.timeline-item-long.current .card-title {
    color: var(--gold-dark);
    font-weight: 700;
}

.timeline-item.current .card-date,
.timeline-item-long.current .card-date {
    color: var(--gold-dark);
    font-weight: 600;
}

.current-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--black);
    border: 1px solid var(--black);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: var(--umbc-radius-lg, 12px);
    letter-spacing: 0.5px;
}

/* ==============================================
   FUTURE State (Full Color)
   ============================================== */
.timeline-item.future .item-dot {
    border-color: var(--black);
}

.timeline-item.future .item-connector {
    background: var(--black);
}

.timeline-item.future .item-card {
    border-color: var(--black);
}

.timeline-item.future .card-icon {
    background: linear-gradient(135deg, var(--black), var(--gray-dark));
}

.timeline-item.future .card-title {
    color: var(--black);
}

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

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

.modal-box {
    background: var(--white);
    border-radius: var(--umbc-radius-lg, 12px);
    max-width: 700px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    position: relative;
    transform: translateY(30px);
    transition: transform 0.3s;
}

.modal-backdrop.active .modal-box {
    transform: translateY(0);
}

.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--gray-light);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    transition: all 0.2s;
    padding: 0;
}

.modal-close-btn:hover {
    background: var(--gold);
    transform: rotate(90deg);
}

.modal-body h2 {
    font-size: 2rem;
    color: var(--black);
    margin-bottom: 1rem;
    padding-right: 2rem;
}

.modal-body .detail-date {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--gold-dark);
    font-weight: 600;
    margin-bottom: 1rem;
}

.modal-body p {
    margin-bottom: 1rem;
    line-height: 1.8;
}

.modal-body ul {
    list-style: none;
    margin: 1rem 0;
}

.modal-body ul li {
    padding: 0.5rem 0 0.5rem 2rem;
    position: relative;
}

.modal-body ul li::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    background: var(--gold);
    border-radius: 50%;
}

.modal-body .detail-note,
.modal-body .detail-highlight {
    padding: 1rem;
    border-radius: var(--umbc-radius-md, 8px);
    margin: 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.modal-body .detail-note {
    background: #E8F4FD;
    border-left: 4px solid #1E90FF;
}

.modal-body .detail-highlight {
    background: #FFF9E6;
    border-left: 4px solid var(--gold);
    color: var(--gold-dark);
    font-weight: 600;
}

/* ==============================================
   Mobile Responsive
   ============================================== */
@media (max-width: 768px) {
    .prototype-label {
        top: 0.5rem;
        right: 0.5rem;
        font-size: 0.75rem;
        padding: 0.375rem 0.75rem;
    }

    .section-placeholder {
        padding: 1.5rem 1rem;
        font-size: 0.875rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .section-placeholder.top,
    .section-placeholder.bottom {
        margin-top: 1rem;
        margin-bottom: 1rem;
    }

    .phases {
        flex-direction: column;
        gap: 0.5rem;
        border-bottom: none;
    }

    .phase-tab {
        text-align: left;
        padding: 0.75rem 1rem;
        border-left: 3px solid transparent;
        border-bottom: none;
        margin-bottom: 0;
    }

    .phase-tab.active {
        border-left-color: var(--gold);
        border-bottom: none;
        background: #FFF9E6;
    }

    .timeline-controls {
        display: none;
    }

    .timeline-wrapper {
        overflow: visible;
        padding: 2rem 1rem;
    }

    .timeline-track {
        flex-direction: column;
        align-items: stretch;
        gap: 2rem;
        padding: 0 0 0 40px;
        min-height: auto;
        width: 100%;
    }

    .timeline-track::before {
        left: 20px;
        right: auto;
        top: 0;
        bottom: 0;
        width: 4px;
        height: 100%;
        background: linear-gradient(to bottom,
                var(--gray-light) 0%,
                var(--gray-light) 35%,
                var(--gold) 50%,
                var(--black) 65%,
                var(--black) 100%);
        transform: none;
    }

    .timeline-year-marker {
        margin: 2px;
        position: relative;
    }

    .timeline-year-marker::before {
        content: '';
        position: absolute;
        left: -30px;
        top: 50%;
        transform: translateY(-50%);
        width: 12px;
        height: 12px;
        background: var(--gold);
        border: 3px solid var(--white);
        border-radius: 50%;
        z-index: 10;
    }

    .year-badge {
        font-size: 1.5rem;
    }

    .timeline-item,
    .timeline-item-long {
        flex-direction: row;
        align-items: flex-start;
        padding: 0 !important;
        margin: 8px;
        margin-bottom: 0 !important;
        margin-top: 0 !important;
        gap: 1rem;
    }

    .timeline-item.top,
    .timeline-item-long.top,
    .timeline-item.bottom,
    .timeline-item-long.bottom {
        flex-direction: row;
        justify-content: flex-start;
    }

    .timeline-item .item-dot,
    .timeline-item-long .item-dot {
        position: absolute;
        left: -26px;
        top: 1.5rem;
    }

    .timeline-item .item-connector,
    .timeline-item-long .item-connector {
        display: none;
        visibility: hidden;
    }

    .timeline-item .item-card,
    .timeline-item-long .item-card {
        width: 100%;
        max-width: 100%;
        margin-top: 0;
    }

    /* YOUTUBE EMBED RESPONSIVE FIX */
    .modal-body .video-container {
        position: relative;
        padding-bottom: 56.25%;
        /* 16:9 Aspect Ratio */
        padding-top: 25px;
        height: 0;
    }

    iframe {
        top: 0;
        left: 0;
        max-width: 100%;
        width: fit-content !important;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

/* =============================================================
   Dark Mode — Timeline Block
   ============================================================= */

/* Remap root variables for dark context */
[data-theme="dark"] .timeline-header .subtitle {
    color: #aaa;
}

/* Phase tabs */
[data-theme="dark"] .phases {
    border-bottom-color: var(--umbc-border, #3d3d3d);
}

[data-theme="dark"] .phase-tab {
    color: #aaa;
}

[data-theme="dark"] .phase-tab.active {
    color: var(--gold-dark);
    border-top-color: var(--umbc-border, #3d3d3d);
    border-right-color: var(--umbc-border, #3d3d3d);
    border-left-color: var(--umbc-border, #3d3d3d);
    /* Gold bottom border stays — gold on dark bg is valid */
}

[data-theme="dark"] .phase-tab.active:hover {
    color: #e0e0e0;
}

[data-theme="dark"] .phase-date {
    color: #c0c0c0;
}

[data-theme="dark"] .phase-description {
    color: #aaa;
}

/* Mobile active tab highlight */
[data-theme="dark"] .phase-tab.active {
    background: #1e1a00;
}

/* Nav control buttons */
[data-theme="dark"] .control-btn {
    background: var(--umbc-surface-card, #2d2d2d);
    border-color: #007176 !important;
    color: #c0c0c0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .control-btn:hover:not(:disabled) {
    background: #333;
    color: #e0e0e0;
}

[data-theme="dark"] .control-btn:hover:disabled {
    background: var(--umbc-surface-card, #2d2d2d);
}

/* Progress track */
[data-theme="dark"] .progress-track {
    background: #333;
}

/* Scrollbar */
[data-theme="dark"] .timeline-wrapper {
    scrollbar-color: var(--gold) #333;
}

[data-theme="dark"] .timeline-wrapper::-webkit-scrollbar-track {
    background: #333;
}

/* Item dot: white center */
[data-theme="dark"] .item-dot {
    background: var(--umbc-surface-card-alt, #232323);
    border-color: #666;
}

/* Connector */
[data-theme="dark"] .item-connector {
    background: #555;
}

/* Default / future cards */
[data-theme="dark"] .item-card {
    background: var(--umbc-surface-card-alt, #232323);
    border-color: var(--umbc-border, #3d3d3d);
}

[data-theme="dark"] .item-card:hover {
    box-shadow: var(--umbc-shadow-card-hover);
}

[data-theme="dark"] .card-icon {
    background: #444;
}

[data-theme="dark"] .card-title {
    color: #e0e0e0;
}

[data-theme="dark"] .card-date,
[data-theme="dark"] .card-summary {
    color: #aaa;
}

/* Year badge */
[data-theme="dark"] .year-badge {
    background: #333;
    border-color: #555;
    color: #e0e0e0;
}

/* Past state */
[data-theme="dark"] .timeline-item.past .item-dot,
[data-theme="dark"] .timeline-item-long.past .item-dot {
    border-color: var(--umbc-border, #3d3d3d);
    background: var(--umbc-surface-card-alt, #232323);
}

[data-theme="dark"] .timeline-item.past .item-connector,
[data-theme="dark"] .timeline-item-long.past .item-connector {
    background: #333;
}

[data-theme="dark"] .timeline-item.past .item-card,
[data-theme="dark"] .timeline-item-long.past .item-card {
    background: #181818;
    border-color: var(--umbc-border, #3d3d3d);
}

[data-theme="dark"] .timeline-item.past .card-icon,
[data-theme="dark"] .timeline-item-long.past .card-icon {
    background: #333;
}

[data-theme="dark"] .timeline-item.past .card-title,
[data-theme="dark"] .timeline-item-long.past .card-title {
    color: #666;
}

[data-theme="dark"] .timeline-item.past .card-date,
[data-theme="dark"] .timeline-item.past .card-summary {
    color: #555;
}

/* Current state: gold dot glow + card — gold on dark is valid */
[data-theme="dark"] .timeline-item.current .item-dot,
[data-theme="dark"] .timeline-item-long.current .item-dot {
    background: var(--umbc-surface-card-alt, #232323);
    /* Gold border + glow stays */
}

[data-theme="dark"] .timeline-item.current .item-card,
[data-theme="dark"] .timeline-item-long.current .item-card {
    background: linear-gradient(135deg, #2a2200 0%, #1e1e1e 100%);
    /* Gold border stays */
}

/* Future state */
[data-theme="dark"] .timeline-item.future .item-dot {
    border-color: #e0e0e0;
    background: var(--umbc-surface-card-alt, #232323);
}

[data-theme="dark"] .timeline-item.future .item-connector {
    background: #aaa;
}

[data-theme="dark"] .timeline-item.future .item-card {
    border-color: #aaa;
}

[data-theme="dark"] .timeline-item.future .card-icon {
    background: linear-gradient(135deg, #444, #555);
}

[data-theme="dark"] .timeline-item.future .card-title {
    color: #e0e0e0;
}

/* Current badge */
[data-theme="dark"] .current-badge {
    color: #e0e0e0;
    border-color: #e0e0e0;
}

/* Modal */
[data-theme="dark"] .modal-box {
    background: var(--umbc-surface-card-alt, #232323);
    color: #e0e0e0;
}

[data-theme="dark"] .modal-body h2 {
    color: #e0e0e0;
}

[data-theme="dark"] .modal-body p {
    color: #c0c0c0;
}

[data-theme="dark"] .modal-body ul li {
    color: #c0c0c0;
}

/* Gold bullet dots in modal list stay — gold on dark bg is valid */

[data-theme="dark"] .modal-close-btn {
    background: #444;
}

[data-theme="dark"] .modal-close-btn:hover {
    background: var(--gold);
    /* Gold bg + white icon — already has color:#fff */
}

/* Note box (blue-tinted) */
[data-theme="dark"] .modal-body .detail-note {
    background: #0d2033;
    border-left-color: #1e90ff;
    color: #b0d4f1;
}

/* Highlight box: gold accent — gold on dark surface is valid */
[data-theme="dark"] .modal-body .detail-highlight {
    background: #2a2000;
    border-left-color: var(--gold);
    color: var(--gold-dark);
}

/* Mobile vertical spine */
@media (max-width: 768px) {
    [data-theme="dark"] .timeline-year-marker::before {
        border-color: #1e1e1e;
    }

    [data-theme="dark"] .phase-tab.active {
        background: #1e1a00;
    }
}