/* Paleopaedia - Prehistoric Creature Encyclopedia */
/* Photorealistic styling with Wikipedia-inspired layouts */

:root {
    --rock-dark: #2c2416;
    --rock-medium: #5c4a3d;
    --rock-light: #8b7355;
    --sand: #d4c4a8;
    --parchment: #f5f0e6;
    --text-dark: #1a1a1a;
    --text-muted: #555;
    --link-blue: #0645ad;
    --link-visited: #0b0080;
    --border-gray: #a2a9b1;
    --infobox-bg: #f8f9fa;
    --shadow-dark: rgba(0,0,0,0.4);
    --shadow-light: rgba(0,0,0,0.2);

    /* Era colors */
    --precambrian: #f74370;
    --cambrian: #7fa056;
    --ordovician: #009270;
    --silurian: #b3e1b6;
    --devonian: #cb8c37;
    --carboniferous: #67a599;
    --permian: #f04028;
    --triassic: #812b92;
    --jurassic: #34b2c9;
    --cretaceous: #7fc64e;
    --paleogene: #fd9a52;
    --neogene: #ffe619;
    --quaternary: #f9f97f;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Liberation Sans', sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background-color: var(--parchment);
}

/* ==================== MAIN PAGE (Canyon Background) ==================== */

.main-page {
    min-height: 100vh;
    background:
        linear-gradient(to bottom, rgba(0,0,0,0.3) 0%, rgba(0,0,0,0.1) 50%, rgba(0,0,0,0.4) 100%),
        url('https://images.unsplash.com/photo-1474044159687-1ee9f3a51722?w=1920&q=80') center center / cover no-repeat fixed;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.main-header {
    text-align: center;
    margin-bottom: 40px;
}

.main-title {
    font-family: 'Georgia', serif;
    font-size: 4rem;
    color: #fff;
    text-shadow:
        3px 3px 6px rgba(0,0,0,0.8),
        0 0 30px rgba(0,0,0,0.5);
    letter-spacing: 4px;
    margin-bottom: 10px;
}

.main-subtitle {
    font-size: 1.3rem;
    color: var(--sand);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    font-style: italic;
}

/* ==================== GEOLOGICAL TIMESCALE ==================== */

.timescale-container {
    width: 100%;
    max-width: 900px;
    background: linear-gradient(135deg, rgba(44,36,22,0.95), rgba(92,74,61,0.95));
    border-radius: 12px;
    padding: 30px;
    box-shadow:
        0 20px 60px rgba(0,0,0,0.5),
        inset 0 1px 0 rgba(255,255,255,0.1),
        inset 0 -1px 0 rgba(0,0,0,0.3);
    border: 1px solid rgba(255,255,255,0.1);
}

.timescale-title {
    text-align: center;
    color: var(--sand);
    font-size: 1.5rem;
    margin-bottom: 25px;
    font-family: 'Georgia', serif;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.era-section {
    margin-bottom: 25px;
}

.era-label {
    color: var(--sand);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 10px;
    padding-left: 5px;
    opacity: 0.8;
}

.periods-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.period-card {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.period-card::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    background: inherit;
    filter: brightness(0.7);
}

.period-card:hover {
    transform: translateX(10px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

.period-card:hover .period-arrow {
    opacity: 1;
    transform: translateX(5px);
}

.period-color {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
    box-shadow: inset 0 2px 4px rgba(255,255,255,0.3), 0 2px 4px rgba(0,0,0,0.2);
    flex-shrink: 0;
}

.period-info {
    flex: 1;
}

.period-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: #fff;
    margin-bottom: 2px;
}

.period-years {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.7);
}

.period-arrow {
    color: #fff;
    font-size: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
}

/* Period colors */
.period-cambrian { background: linear-gradient(135deg, var(--cambrian), #5a8040); }
.period-ordovician { background: linear-gradient(135deg, var(--ordovician), #007050); }
.period-silurian { background: linear-gradient(135deg, var(--silurian), #90c090); }
.period-devonian { background: linear-gradient(135deg, var(--devonian), #a06020); }
.period-carboniferous { background: linear-gradient(135deg, var(--carboniferous), #508070); }
.period-permian { background: linear-gradient(135deg, var(--permian), #c02020); }
.period-triassic { background: linear-gradient(135deg, var(--triassic), #601070); }
.period-jurassic { background: linear-gradient(135deg, var(--jurassic), #2090a0); }
.period-cretaceous { background: linear-gradient(135deg, var(--cretaceous), #509030); }
.period-paleogene { background: linear-gradient(135deg, var(--paleogene), #d07030); }
.period-neogene { background: linear-gradient(135deg, var(--neogene), #c0b010); }
.period-quaternary { background: linear-gradient(135deg, var(--quaternary), #d0d060); }

.color-cambrian { background: var(--cambrian); }
.color-ordovician { background: var(--ordovician); }
.color-silurian { background: var(--silurian); }
.color-devonian { background: var(--devonian); }
.color-carboniferous { background: var(--carboniferous); }
.color-permian { background: var(--permian); }
.color-triassic { background: var(--triassic); }
.color-jurassic { background: var(--jurassic); }
.color-cretaceous { background: var(--cretaceous); }
.color-paleogene { background: var(--paleogene); }
.color-neogene { background: var(--neogene); }
.color-quaternary { background: var(--quaternary); }

/* ==================== PERIOD PAGE ==================== */

.period-page {
    min-height: 100vh;
    background: var(--parchment);
}

.period-header {
    padding: 40px 20px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.period-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.15;
    background: url('https://images.unsplash.com/photo-1474044159687-1ee9f3a51722?w=1920&q=80') center center / cover;
}

.period-header-content {
    position: relative;
    z-index: 1;
}

.period-page-title {
    font-family: 'Georgia', serif;
    font-size: 3rem;
    color: var(--rock-dark);
    margin-bottom: 10px;
}

.period-page-years {
    font-size: 1.2rem;
    color: var(--rock-medium);
    margin-bottom: 15px;
}

.period-page-description {
    max-width: 700px;
    margin: 0 auto;
    color: var(--text-muted);
    font-size: 1.1rem;
}

.breadcrumb {
    padding: 15px 20px;
    background: #fff;
    border-bottom: 1px solid var(--border-gray);
}

.breadcrumb a {
    color: var(--link-blue);
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

.breadcrumb span {
    color: var(--text-muted);
    margin: 0 8px;
}

/* ==================== CREATURE GRID ==================== */

.creatures-section {
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.creatures-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 25px;
}

.creature-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px var(--shadow-light);
    transition: all 0.3s ease;
    text-decoration: none;
    color: inherit;
    border: 1px solid var(--border-gray);
}

.creature-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 30px var(--shadow-dark);
}

.creature-card-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: linear-gradient(135deg, var(--sand), var(--rock-light));
}

.creature-card-content {
    padding: 20px;
}

.creature-card-name {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--link-blue);
    margin-bottom: 5px;
}

.creature-card-scientific {
    font-style: italic;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 10px;
}

.creature-card-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

/* ==================== CREATURE DETAIL PAGE (Wikipedia Style) ==================== */

.creature-page {
    min-height: 100vh;
    background: #fff;
}

.creature-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
}

.creature-main {
    order: 1;
}

.creature-title {
    font-family: 'Georgia', serif;
    font-size: 2.5rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.creature-intro {
    font-size: 1.05rem;
    margin-bottom: 25px;
    text-align: justify;
}

.creature-intro strong {
    font-weight: 600;
}

.creature-section {
    margin-bottom: 25px;
}

.creature-section h2 {
    font-size: 1.4rem;
    color: var(--text-dark);
    border-bottom: 1px solid var(--border-gray);
    padding-bottom: 5px;
    margin-bottom: 15px;
}

.creature-section p {
    text-align: justify;
    margin-bottom: 15px;
}

/* ==================== INFOBOX (Wikipedia Style) ==================== */

.infobox {
    order: 2;
    background: var(--infobox-bg);
    border: 1px solid var(--border-gray);
    border-radius: 4px;
    padding: 15px;
    font-size: 0.9rem;
    height: fit-content;
    position: sticky;
    top: 20px;
}

.infobox-title {
    text-align: center;
    font-size: 1.2rem;
    font-weight: 600;
    background: var(--rock-medium);
    color: #fff;
    padding: 10px;
    margin: -15px -15px 15px -15px;
    border-radius: 3px 3px 0 0;
}

.infobox-image {
    width: 100%;
    border-radius: 4px;
    margin-bottom: 15px;
}

.infobox-image-caption {
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
    margin-bottom: 15px;
}

.infobox table {
    width: 100%;
    border-collapse: collapse;
}

.infobox th {
    text-align: left;
    padding: 6px 8px;
    background: rgba(0,0,0,0.05);
    border: 1px solid var(--border-gray);
    font-weight: 600;
    width: 40%;
}

.infobox td {
    padding: 6px 8px;
    border: 1px solid var(--border-gray);
}

.infobox-section-header {
    text-align: center;
    background: var(--rock-light);
    color: #fff;
    padding: 8px;
    font-weight: 600;
}

/* ==================== CLASSIFICATION TABLE ==================== */

.classification-table {
    margin-top: 15px;
}

.classification-table th {
    background: rgba(0,0,0,0.03);
}

/* ==================== FOOTER ==================== */

.footer {
    background: var(--rock-dark);
    color: var(--sand);
    text-align: center;
    padding: 30px 20px;
    margin-top: 50px;
}

.footer a {
    color: var(--sand);
}

/* ==================== SEARCH BAR ==================== */

.search-container {
    max-width: 500px;
    margin: 30px auto;
    position: relative;
}

.search-input {
    width: 100%;
    padding: 15px 20px;
    font-size: 1rem;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 30px;
    background: rgba(255,255,255,0.1);
    color: #fff;
    outline: none;
    transition: all 0.3s ease;
}

.search-input::placeholder {
    color: rgba(255,255,255,0.6);
}

.search-input:focus {
    background: rgba(255,255,255,0.2);
    border-color: rgba(255,255,255,0.5);
}

/* ==================== RESPONSIVE DESIGN ==================== */

@media (max-width: 900px) {
    .creature-content {
        grid-template-columns: 1fr;
    }

    .infobox {
        order: -1;
        position: static;
        max-width: 350px;
        margin: 0 auto 20px auto;
    }

    .main-title {
        font-size: 2.5rem;
    }

    .period-page-title {
        font-size: 2rem;
    }
}

@media (max-width: 600px) {
    .main-title {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    .main-subtitle {
        font-size: 1rem;
    }

    .timescale-container {
        padding: 20px 15px;
    }

    .period-card {
        padding: 12px 15px;
    }

    .creatures-grid {
        grid-template-columns: 1fr;
    }

    .creature-title {
        font-size: 1.8rem;
    }
}

/* ==================== LOADING STATE ==================== */

.loading {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
}

.loading::after {
    content: '';
    display: inline-block;
    width: 30px;
    height: 30px;
    border: 3px solid var(--border-gray);
    border-top-color: var(--rock-medium);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 15px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== NO RESULTS ==================== */

.no-results {
    text-align: center;
    padding: 50px;
    color: var(--text-muted);
    font-size: 1.2rem;
}

/* ==================== CREATURE COUNT BADGE ==================== */

.creature-count {
    display: inline-block;
    background: rgba(255,255,255,0.2);
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.8rem;
    margin-left: 10px;
    color: rgba(255,255,255,0.9);
}
