/* history.css */

/* Hero Section */
.history-hero {
    padding: var(--spacing-24) 0; /* Increased padding for better visual */
    background-image: url('../images/history_header.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
    text-align: center;
    color: var(--color-white); /* Change text color to white */
    overflow: hidden; /* Ensure pseudo-element doesn't overflow */
}

.history-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4); /* Semi-transparent black overlay */
    z-index: 1;
}

.history-hero .container {
    position: relative;
    z-index: 2; /* Ensure text is above overlay */
}

.history-title-main {
    font-size: var(--font-size-6xl);
    font-weight: 700;
    color: var(--color-white); /* Ensure title is white */
    margin-bottom: var(--spacing-2);
}

.history-title-sub {
    font-size: var(--font-size-lg);
    color: var(--color-white); /* Ensure subtitle is white */
    font-weight: 500;
}

/* Contents Section */
.history-contents {
    padding: var(--spacing-16) 0;
}

.history-tabs {
    display: flex;
    justify-content: center;
    gap: var(--spacing-4);
    margin-bottom: var(--spacing-12);
    padding: var(--spacing-4) 0;
    background-color: var(--color-gray-100);
    border-bottom: 1px solid var(--color-gray-200);
    position: sticky;
    top: 90px; /* Position below the header (header height is 90px) */
    z-index: 100; /* Much lower to avoid mobile menu conflict */
}

.history-tab {
    padding: var(--spacing-2) var(--spacing-6);
    border-radius: var(--border-radius-md);
    color: var(--color-gray-700);
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    white-space: nowrap; /* Prevent wrapping */
}

.history-tab:hover {
    background-color: var(--color-gray-200);
    color: var(--color-primary);
}

.history-tab.active {
    background-color: var(--color-primary);
    color: var(--color-white);
}

@media (max-width: 768px) {
    .history-tabs {
        flex-wrap: wrap;
        gap: var(--spacing-2);
        padding: var(--spacing-3) var(--spacing-1);
    }

    .history-tab {
        padding: var(--spacing-1) var(--spacing-2);
        font-size: var(--font-size-sm);
    }
}

.history-timeline {
    position: relative;
    padding-left: 0px;
    margin-left: 80px;
    border-left: 4px solid #e0e0e0;
    --timeline-progress: 0%;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: -4px;
    top: 0;
    width: 4px;
    height: var(--timeline-progress);
    background-color: var(--color-primary);
    z-index: 1;
}

.history-era {
    margin-bottom: var(--spacing-20);
    position: relative;
}

.history-era-title {
    position: absolute;
    left: -120px;
    top: 0;
    font-size: var(--font-size-5xl);
    font-weight: 700;
    color: #d0d0d0;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    line-height: 1;
}

.history-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--spacing-12);
    opacity: 0;
    transform: translateY(30px);
    transition: opacity 0.8s ease-out, transform 0.8s ease-out;
    gap: var(--spacing-6);
}

.history-item.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.history-year-wrapper {
    flex: 0 0 120px;
    position: relative;
}

.history-year-wrapper::before {
    content: '';
    position: absolute;
    top: 5px;
    left: -13px;
    width: 15px;
    height: 15px;
    background-color: var(--color-primary);
    border-radius: 50%;
    border: 3px solid white;
}

.history-year {
    font-size: var(--font-size-2xl);
    font-weight: 700;
    color: var(--color-primary);
    line-height: 1.2;
    text-align: right;
}

.history-month {
    font-size: var(--font-size-base);
    font-weight: 500;
}

.history-details {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
    background-color: var(--color-white);
    padding: var(--spacing-6); /* Reduce padding to save space */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.history-details-content {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
 .history-details-content {
    flex-direction: column;
    gap: 15px;
}   
}

.history-japan {
    flex: 0 0 280px; /* Slightly reduce width */
    background-color: var(--color-gray-50);
    padding: var(--spacing-5); /* Reduce padding */
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-sm);
}

.history-japan-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--color-primary);
    margin-bottom: var(--spacing-3);
    border-bottom: 2px solid var(--color-primary);
    padding-bottom: var(--spacing-1);
}

.history-japan-content {
    font-size: var(--font-size-sm);
    line-height: 1.6;
    color: var(--color-gray-700);
}

.history-japan-content ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.history-japan-content li {
    margin-bottom: var(--spacing-2);
    position: relative;
    padding-left: var(--spacing-4);
}

.history-japan-content li::before {
    content: "●";
    position: absolute;
    left: 0;
    color: var(--color-accent);
    font-weight: 600;
}

.history-image {
    width: 100%;
    max-height: 290px; /* Reduce max height to save vertical space */
    object-fit: cover;
    border-radius: var(--border-radius-md);
    margin-bottom: var(--spacing-0); /* Reduce margin */

}

.history-copy {
    font-size: var(--font-size-lg);
    font-weight: 500;
    color: var(--color-gray-800);
    margin-bottom: var(--spacing-2);
    font-style: italic;
}

.history-title {
    font-size: var(--font-size-xl);
    font-weight: 700;
    margin-bottom: var(--spacing-4);
}

.history-description {
    line-height: 1.8;
    color: var(--color-gray-700);
    margin-bottom: var(--spacing-4);
}

.history-link {
    position: relative;
    display: block;
    width: 160px;
    margin-left: auto;
    margin-right: 0;
    padding: 15px 30px 15px 15px; /* Adjusted padding for arrow */
    background-color: var(--color-primary);
    font-size: 14px;
    font-weight: 700;
    color: var(--color-white);
    line-height: 1.6;
    text-decoration: none;
    text-align: center;
    transition: .2s; /* Shortened transition */
    box-sizing: border-box;
    border-radius: var(--border-radius-md); /* Keep border-radius */
    overflow: hidden; /* For shine effect */
    z-index: 1;
}
@media (max-width: 768px) {
    .history-link {
       width: 100%; 
    }
}

.history-link::after {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    right: 15px; /* Position of the arrow */
    width: 9px;
    height: 9px;
    margin: auto;
    border-top: 2px solid var(--color-white);
    border-right: 2px solid var(--color-white);
    transform: rotate(45deg);
    transition: .2s;
    box-sizing: border-box;
}

.history-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background-image: linear-gradient(130deg, rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.5) 50%, rgba(255, 255, 255, 0) 80%);
    transition: .5s;
    z-index: -1; /* Behind the text */
}

.history-link:hover::before {
    left: 100%;
}

.history-link .material-symbols-outlined {
    font-size: var(--font-size-base);
    margin-left: var(--spacing-1); /* Space between text and icon */
    vertical-align: middle; /* Align icon vertically */
}

/* Responsive */
@media (max-width: 768px) {
    .history-timeline {
        padding-left: 20px;
        border-left: 2px solid #e0e0e0;
        margin-left: 0;
    }

    .history-timeline::before {
        left: -2px;
        width: 2px;
    }

    .history-era-title {
        display: none; /* Hide vertical era title on mobile */
    }

    .history-item {
        flex-direction: column;
        gap: var(--spacing-4);
    }

    .history-year-wrapper {
        flex: 0 0 30px;
        margin-bottom: 0;
    }

    .history-japan {
        flex: none;
        order: 0;
        margin-bottom: var(--spacing-4);
    }

    .history-year-wrapper::before {
        left: -28px;
    }
}