/* FONT IMPORT */
@import url('https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&family=Montserrat:wght@400;500;600&display=swap');

/* THEME & VARIABLES (dark theme for this page) */
:root {
    --primary-green: #556b2f;
    --dark-green: #2e4034;
    --background-dark: #1a2a26;
    --text-light: #f2f2f2;
    --text-muted: #a0a0a0;
    --border-color: rgba(255, 255, 255, 0.15);
    --module-bg: rgba(255, 255, 255, 0.05);
    /* NEW: Onyx color for subtitle */
    --onyx: #353839;
}

body {
    font-family: 'Montserrat', sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    margin: 0;
    padding-top: 120px; /* Space for global fixed header (100px) + breathing room */
    line-height: 1.6;
}

/* BACKGROUND CYCLER */
#background-cycler {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    background-size: cover;
    background-position: center;
    transition: background-image 1.5s ease-in-out;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(26, 42, 38, 0.9), rgba(26, 42, 38, 0.7));
    z-index: -1;
}

/* MAIN PAGE LAYOUT */
.page-container {
    max-width: 90%;
    margin: 2rem auto 4rem auto;
    padding: 0 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 3rem;
}

/* UPDATED: Heading color forced to pure black */
.page-header h1 {
    font-family: 'Merriweather', serif;
    font-size: 3rem;
    font-weight: 700;
    margin: 0;
    color: #000000; /* Requested change */
    letter-spacing: 1px;
}

/* UPDATED: Subtitle color set to Onyx */
.page-header p {
    font-size: 1.1rem;
    color: var(--onyx); /* Requested change */
    max-width: 700px;
    margin: 0.75rem auto 0;
    line-height: 1.5;
}

/* EXTINCT SPECIES GRID */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.75rem;
    align-items: stretch;
}

.species-card {
    background-color: var(--module-bg);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    transition: transform 0.35s ease, box-shadow 0.35s ease, background-color 0.35s ease;
    backdrop-filter: blur(2px);
    position: relative;
}

.species-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    background-color: rgba(255,255,255,0.08);
}

.card-image-wrapper {
    height: 200px;
    background-color: #222;
    position: relative;
    overflow: hidden;
}

.card-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(100%) contrast(1.05);
    transition: filter 0.4s ease, transform 12s linear;
    transform: scale(1.02);
}

.species-card:hover .card-image-wrapper img {
    filter: grayscale(0%) contrast(1.1);
    transform: scale(1.1);
}

.card-info {
    padding: 1rem 1rem 1.25rem 1rem;
    text-align: center;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.card-info h4 {
    margin: 0 0 0.4rem 0;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: 0.5px;
}

.card-info p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    letter-spacing: 0.5px;
}

.extinction-year {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(145deg, rgba(0,0,0,0.75), rgba(0,0,0,0.55));
    color: #fff;
    padding: 4px 9px;
    border-radius: 5px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* LOADING & EMPTY STATES */
.loading-indicator, .empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    opacity: 0.9;
}

.loading-indicator i {
    font-size: 2.3rem;
    margin-bottom: 1rem;
    color: var(--primary-green);
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
}

/* RESPONSIVE TUNING */
@media (max-width: 1100px) {
    .page-header h1 {
        font-size: 2.5rem;
    }
    .grid-container {
        gap: 1.4rem;
    }
}

@media (max-width: 800px) {
    .page-header h1 {
        font-size: 2.15rem;
    }
    .page-container {
        max-width: 94%;
    }
    .card-image-wrapper {
        height: 180px;
    }
}

@media (max-width: 560px) {
    body {
        padding-top: 130px;
    }
    .page-header h1 {
        font-size: 1.9rem;
    }
    .grid-container {
        gap: 1.2rem;
    }
    .card-image-wrapper {
        height: 165px;
    }
}