/* History Page Styles - Elegant Timeline Design */

/* Hero Section */
.history-hero {
    position: relative;
    min-height: 70vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background: linear-gradient(180deg, 
        rgba(12, 17, 28, 1) 0%,
        rgba(27, 36, 51, 1) 100%
    );
}

.hero-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('https://images.unsplash.com/photo-1507838153414-b4b713384a76?q=80&w=1920') center/cover;
    opacity: 0.15;
    z-index: 0;
}

.history-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
}

.history-hero-content h1 {
    font-size: 4.5rem;
    font-weight: 800;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, var(--color-gold) 0%, #f4e4c1 50%, var(--color-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 2px;
}

.history-hero-content p {
    font-size: 1.4rem;
    color: rgba(255, 255, 255, 0.8);
    max-width: 700px;
    margin: 0 auto;
    font-weight: 300;
}

/* Timeline Section */
.timeline-section {
    padding: 8rem 2rem;
    background: linear-gradient(180deg, 
        rgba(12, 17, 28, 1) 0%,
        rgba(20, 25, 38, 1) 50%,
        rgba(12, 17, 28, 1) 100%
    );
    position: relative;
    min-height: 100vh;
}

.timeline-container {
    max-width: 1400px;
    margin: 0 auto;
    position: relative;
}

/* Vertical Timeline Line - Centered */
.timeline-bar {
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 3px;
    background: linear-gradient(180deg, 
        transparent 0%,
        rgba(197, 161, 90, 0.3) 5%,
        rgba(197, 161, 90, 0.6) 50%,
        rgba(197, 161, 90, 0.3) 95%,
        transparent 100%
    );
    transform: translateX(-50%);
}

.timeline-bar::before,
.timeline-bar::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 16px;
    height: 16px;
    background: var(--color-gold);
    border-radius: 50%;
    box-shadow: 0 0 20px rgba(197, 161, 90, 0.6);
}

.timeline-bar::before { top: 0; }
.timeline-bar::after { bottom: 0; }

/* Timeline Content */
.timeline-content {
    padding: 2rem 0;
}

/* Timeline Period */
.timeline-period {
    position: relative;
    margin-bottom: 8rem;
    opacity: 0;
    animation: fadeIn 1s ease forwards;
}

.timeline-period:nth-child(1) { animation-delay: 0.2s; }
.timeline-period:nth-child(2) { animation-delay: 0.3s; }
.timeline-period:nth-child(3) { animation-delay: 0.4s; }
.timeline-period:nth-child(4) { animation-delay: 0.5s; }
.timeline-period:nth-child(5) { animation-delay: 0.6s; }
.timeline-period:nth-child(6) { animation-delay: 0.7s; }
.timeline-period:nth-child(7) { animation-delay: 0.8s; }

@keyframes fadeIn {
    to { opacity: 1; }
}

/* Period Card - Alternating Layout */
.period-card {
    position: relative;
    background: rgba(27, 36, 51, 0.98);
    backdrop-filter: blur(10px);
    padding: 3rem;
    border-radius: 30px;
    border: 1px solid rgba(197, 161, 90, 0.2);
    cursor: pointer;
    width: 42%;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    overflow: hidden;
}

.period-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(197, 161, 90, 0.05) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.period-card:hover::after {
    opacity: 1;
}

/* Left side cards */
.timeline-period[data-position="above"] .period-card {
    margin-left: 0;
    margin-right: auto;
    transform-origin: right center;
}

/* Right side cards */
.timeline-period[data-position="below"] .period-card {
    margin-left: auto;
    margin-right: 0;
    transform-origin: left center;
}

.period-card:hover {
    transform: scale(1.02);
    border-color: rgba(197, 161, 90, 0.5);
    box-shadow: 0 25px 70px rgba(0, 0, 0, 0.5),
                0 0 40px rgba(197, 161, 90, 0.2);
}

/* Connector Line to Timeline */
.period-card::before {
    content: '';
    position: absolute;
    top: 3rem;
    width: 80px;
    height: 1px;
    background: linear-gradient(90deg, var(--color-gold), transparent);
}

.timeline-period[data-position="above"] .period-card::before {
    right: -80px;
    background: linear-gradient(90deg, transparent, var(--color-gold));
}

.timeline-period[data-position="below"] .period-card::before {
    left: -80px;
}

/* Period Dot */
.period-dot {
    position: absolute;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--color-gold), #d4a460);
    border: 4px solid rgba(12, 17, 28, 1);
    border-radius: 50%;
    left: 50%;
    top: 2.5rem;
    transform: translateX(-50%);
    z-index: 5;
    box-shadow: 0 0 0 0 rgba(197, 161, 90, 0.4);
    animation: pulse 3s infinite;
    transition: all 0.3s ease;
}

@keyframes pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(197, 161, 90, 0.4);
    }
    50% {
        box-shadow: 0 0 0 20px rgba(197, 161, 90, 0);
    }
}

.period-card:hover + .period-dot {
    transform: translateX(-50%) scale(1.4);
    box-shadow: 0 0 30px rgba(197, 161, 90, 0.8);
}

/* Period Year */
.period-year {
    font-size: 2.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--color-gold), #f4e4c1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1rem;
    letter-spacing: 1px;
}

/* Period Title */
.period-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 1.5rem;
}

/* Period Image */
.period-image {
    width: 100%;
    height: 220px;
    border-radius: 20px;
    overflow: hidden;
    margin: 1.5rem 0;
    border: 2px solid rgba(197, 161, 90, 0.2);
    transition: all 0.5s ease;
}

.period-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.7s ease, filter 0.5s ease;
    filter: grayscale(40%) brightness(0.8);
}

.period-card:hover .period-image img {
    transform: scale(1.1);
    filter: grayscale(0%) brightness(1) saturate(1.1);
}

/* Period Text */
.period-preview {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1rem;
    line-height: 1.8;
    display: block;
}

.period-full {
    display: none;
}

/* Expanded Card State */
.period-card.expanded {
    position: fixed !important;
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%) scale(1) !important;
    width: 85vw !important;
    max-width: 1100px !important;
    max-height: 85vh;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    z-index: 10001 !important;
    padding: 4rem;
    margin: 0 !important;
    background: #1b2433 !important;
    background-color: #1b2433 !important;
    backdrop-filter: none !important;
    opacity: 1 !important;
    border: 2px solid var(--color-gold);
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.9),
                0 0 80px rgba(197, 161, 90, 0.4);
    pointer-events: auto !important;
}

.period-card.expanded::before {
    display: none !important;
}

.period-card.expanded::after {
    display: none !important;
}

.period-card.expanded .period-image {
    height: 450px;
    border-color: var(--color-gold);
}

.period-card.expanded .period-preview {
    display: none;
}

.period-card.expanded .period-full {
    display: block;
    color: rgba(255, 255, 255, 0.85);
    font-size: 1.1rem;
    line-height: 1.9;
    margin-top: 1.5rem;
}

/* Dim other cards when one is expanded */
body.card-expanded .period-card:not(.expanded) {
    opacity: 0.3;
    filter: blur(3px);
    pointer-events: none;
}

/* Ensure expanded card's parent doesn't block z-index */
body.card-expanded .timeline-period:has(.period-card.expanded) {
    z-index: 10001 !important;
    position: relative;
}

body.card-expanded .timeline-bar,
body.card-expanded .period-dot {
    opacity: 0.3;
}

/* Dark overlay backdrop when card is expanded */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: auto;
}

.modal-overlay.active {
    display: block;
    opacity: 1;
}

/* Prevent body scroll when modal is open */
body.card-expanded {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

html.card-expanded {
    overflow: hidden !important;
}

/* Hide video background and parallax layers when card is expanded */
body.card-expanded .video-background,
body.card-expanded .parallax-layer,
body.card-expanded body::before {
    opacity: 0 !important;
    visibility: hidden !important;
}

/* Close Button */
.close-button {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    width: 50px;
    height: 50px;
    background: rgba(197, 161, 90, 0.15);
    border: 2px solid var(--color-gold);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    line-height: 1;
    color: var(--color-gold);
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 100;
}

.period-card.expanded .close-button {
    display: flex;
}

.close-button:hover {
    background: var(--color-gold);
    color: rgba(12, 17, 28, 1);
    transform: rotate(90deg) scale(1.1);
}

/* Scrollbar for Expanded Card */
.period-card.expanded::-webkit-scrollbar {
    width: 10px;
}

.period-card.expanded::-webkit-scrollbar-track {
    background: rgba(12, 17, 28, 0.5);
    border-radius: 10px;
}

.period-card.expanded::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, var(--color-gold), #d4a460);
    border-radius: 10px;
}

.period-card.expanded::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #f4e4c1, var(--color-gold));
}

/* Mobile Responsive */
@media (max-width: 1024px) {
    .timeline-bar {
        left: 50px;
    }
    
    .period-card {
        width: calc(100% - 120px);
        margin-left: 120px !important;
        margin-right: 0 !important;
    }
    
    .period-card::before {
        left: -80px !important;
        right: auto !important;
    }
    
    .period-dot {
        left: 50px;
    }
    
    .period-card.expanded {
        width: 92vw !important;
        padding: 2.5rem !important;
    }
    
    .history-hero-content h1 {
        font-size: 3rem;
    }
    
    .period-year {
        font-size: 2.2rem;
    }
    
    .period-card.expanded .period-image {
        height: 300px;
    }
}

@media (max-width: 768px) {
    .timeline-section {
        padding: 3rem 1rem;
    }
    
    .period-card {
        width: calc(100% - 80px);
        margin-left: 80px !important;
        padding: 1.5rem;
    }
    
    .history-hero-content h1 {
        font-size: 2rem;
    }
    
    .period-card.expanded {
        padding: 1.5rem !important;
    }
    
    .period-title {
        font-size: 1.25rem;
    }
    
    .period-description {
        font-size: 0.9rem;
        line-height: 1.6;
    }
}

@media (max-width: 480px) {
    .timeline-section {
        padding: 2rem 0.75rem;
    }
    
    .period-card {
        width: calc(100% - 60px);
        margin-left: 60px !important;
        padding: 1.25rem;
    }
    
    .history-hero-content h1 {
        font-size: 1.75rem;
    }
    
    .period-year {
        font-size: 0.9rem;
    }
    
    .period-title {
        font-size: 1.1rem;
    }
}
