/*
====================================
legacies.css
Styles specific to the Legacies page
====================================
*/

/* --- FILTER BUTTONS --- */
.legacy-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    padding: 15px 0 40px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.filter-btn {
    background: transparent;
    color: var(--color-primary);
    border: 1px solid var(--border-color);
    padding: 8px 15px;
    font-family: var(--font-family-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    text-transform: uppercase;
}

.filter-btn:hover {
    background-color: var(--color-primary);
    color: var(--color-secondary);
}

.filter-btn.active {
    background-color: var(--color-primary);
    color: var(--color-secondary);
    font-weight: bold;
}

/* --- CARD GRID LAYOUT --- */
.legacy-grid {
    display: grid;
    /* Responsive grid: 1 column on small, 2 on medium, 3 on large */
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 30px;
    padding-top: 20px;
}

/* --- SINGLE LEGACY CARD --- */
.legacy-card {
    background-color: var(--color-secondary); /* Dark background for contrast */
    border: 1px solid var(--border-color);
    color: var(--color-primary);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}

.legacy-card:hover {
    /* Lift effect on hover */
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(255, 255, 255, 0.1);
}

/* Image Styling */
.card-image-wrapper {
    width: 100%;
    /* Maintain aspect ratio for portraits/square images */
    aspect-ratio: 4/3; 
    overflow: hidden;
}

.card-portrait {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
    /* Inherits grayscale from common.css */
}

.legacy-card:hover .card-portrait {
    transform: scale(1.05); /* Slight zoom on hover */
}

/* Card Text Content */
.card-content {
    padding: 20px;
    flex-grow: 1; /* Ensures content area takes up remaining space */
}

.legacy-name {
    font-family: var(--font-family-header);
    font-size: 1.8rem;
    margin: 0 0 5px 0;
    color: var(--color-primary);
}

.legacy-short-name {
    display: none;
    font-family: var(--font-family-header);
    font-size: 1.8rem;
    margin: 0 0 5px 0;
    color: var(--color-primary);
}

.legacy-title {
    display: none;
    font-size: 0.8rem;
    color: var(--color-primary);
    margin: 0 0 10px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.legacy-dates-category {
    font-size: 0.9rem;
    margin: 0 0 15px 0;
    color: var(--color-primary);
    display: block;
}

.category-pill {
    display: inline-block;
    background-color: var(--color-primary);
    color: var(--color-secondary);
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: bold;
    margin-right: 5px;
    text-transform: uppercase;
}

.legacy-summary {
    font-family: var(--font-family-body);
    font-size: 1rem;
    margin-bottom: 20px;
    line-height: 1.5;
}

/* Card Action Buttons */
.card-actions {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto; /* Pushes action buttons to the bottom of the card content */
}

.btn-read-more,
.btn-zine-link {
    display: inline-block;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    font-family: var(--font-family-body);
    font-size: 0.9rem;
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-read-more {
    flex-grow: 1;
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--color-primary);
}

.btn-read-more:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.btn-zine-link {
    background-color: var(--color-primary);
    border: 1px solid var(--color-primary);
    color: var(--color-secondary);
}

.btn-zine-link:hover {
    background-color: var(--color-secondary);
    color: var(--color-primary);
}

/* --- MODAL STYLING (Detail View) --- */
.modal {
    background: rgba(0, 0, 0, 0.9);
    border: none;
    width: 90%;
    max-width: 900px;
    padding: 0;
    color: var(--color-primary);
    font-family: var(--font-family-body);
}

.modal-content {
    padding: 40px;
    width: 100%;
    max-width: 100%;
}

.modal-content h2 {
    font-family: var(--font-family-header);
    font-size: 2rem;
    margin-top: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.modal-actions-area {
    text-align: center; 
}
.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: transparent;
    border: none;
    color: var(--color-primary);
    font-size: 2rem;
    cursor: pointer;
    line-height: 1;
    z-index: 10;
}

/* --- RESPONSIVENESS --- */
@media (max-width: 768px) {
    .legacy-grid {
        /* Switch to 1 column on smaller screens */
        grid-template-columns: 1fr; 
    }

    .legacy-filters {
        /* Allow filter buttons to stack */
        justify-content: flex-start;
        overflow-x: auto; /* Allow horizontal scrolling if too many buttons */
        padding-bottom: 10px;
    }
    
    .filter-btn {
        flex-shrink: 0; /* Prevents buttons from squishing */
    }

    .legacy-card {
        flex-direction: row; /* Horizontal layout for better mobile space use */
        height: 200px; /* Fixed height for consistency */
    }

    .category-pill {
        font-size: 0.7rem;
    }

    .card-actions {
        flex-direction: column;
        flex-shrink: 1;
    }

    .card-image-wrapper {
        width: 25%;
        height: 100%;
        aspect-ratio: auto; /* Reset aspect ratio for horizontal layout */
    }

    .card-content {
        width: 60%;
        padding: 15px;
        overflow: hidden;
    }
    
    .legacy-title {
        display: none;
    }

    .legacy-name {
        font-size: 1rem;
        margin: 0 0 10px 0;
    }

    .legacy-summary {
        font-size: 0.9rem;
        
        /* Corrected: Add standard 'line-clamp' property */
        display: -webkit-box;
        -webkit-line-clamp: 2; /* Truncate summary to 2 lines for Webkit browsers (Chrome, Safari, etc.) */
        -webkit-box-orient: vertical;
        overflow: hidden;

        /* Add the standard property for future and current limited browser support */
        line-clamp: 2; 
        margin-bottom: 10px;
    }

    .modal-content h2 {
        font-size: 1.2rem;
        padding-bottom: 10px;
        margin-bottom: 5px;
    }

    .modal-section-header, h3 {
        margin: 0 0 0 0;
        font-size: 0.9rem;
        opacity: 0.8;
        text-align: center;
    }

    .modal-quote {
        margin: 0 auto 20px auto;
    }

    .modal-description {
        font-size: 0.8rem;
    }

    .modal-biography-section {
        font-size: 0.8rem;
    }

    .modal-impact-analysis {
        font-size: 0.8rem;
    }

    .modal-key-contributions {
        font-size: 0.8rem;
    }

    .modal-resources {
        font-size: 0.8rem;
    }
}

@media (max-width: 500px) {
    .card-content {
        padding: 10px;
        overflow: hidden;
    }

    .legacy-dates-category {
        font-size: 0.7rem;
        margin: 0 0 10px 0;
    }

    .category-pill {
        font-size: 0.5rem;
    }

    .legacy-name {
        display: none;
        font-size: 0.8rem;
    }

    .legacy-short-name {
        display: block;
        font-size: 0.8rem;
        margin: 0 0 10px 0;
    }

    .legacy-summary {
        font-size: 0.75rem;
    }

    .btn-read-more,
    .btn-zine-link {
        padding: 7px 15px;
        font-size: 0.8rem;
    }
}

@media (max-width: 320px) {
    .modal-content {
        padding: 15px;
        text-align: center;
    }

    .legacy-name {
        font-size: 0.8rem;
    }

    .btn-read-more,
    .btn-zine-link {
        font-size: 0.7rem;
        padding: 5px 15px;
    }
}