<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">

body {
    background-color: #fff0ec;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    padding: 0;
}

header {
    position: -webkit-sticky;
    position: sticky;
    top: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    border-bottom: 0.125rem solid #000;
    padding: 0.625rem 1.25rem;
    z-index: 1000;
    width: 100%;
    -webkit-box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    box-shadow: 0 0.25rem 0.5rem rgba(0, 0, 0, 0.1);
    font-family: 'Comfortaa', sans-serif;
}

.page_title h1 {
    font-size: 1.7rem;
    margin: 0;
}

.page_title a {
    color: black;
    text-decoration: none;
    transition: color 0.3s ease;
    font-weight: lighter;
}

.page_title a .latin-name {
    font-size: 1.5rem;
    color: rgba(0, 0, 0, 0.3);
}

.page_title a:hover {
    color: #ae031f;
}

/* Navigation styling */
nav {
    display: flex;
}

nav ul {
    list-style: none;
    margin: 0 1rem;
    padding: 0;
}

nav ul li {
    display: inline-block;
}

nav ul li a {
    color: black;
    text-decoration: none;
    padding: 0.625rem 0.7rem;
    cursor: pointer;
    display: inline-block;
    position: relative;
}

nav ul li a::after {
    content: '';
    position: absolute;
    top: 2.3rem;
    left: 0;
    width: 0;
    height: 0.063rem; /* Thickness of the underline */
    background-color: black; /* Color of the underline */
    transition: width 0.3s ease-in-out; /* Smooth transition for width */
}

nav ul li a:hover::after {
    width: 100%;
}

#language_filter {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

main {
    margin-top: 4rem;
    margin-bottom: 10rem;
    padding: 1.25rem;
    font-family: 'Comfortaa', sans-serif;
}

#content_collection {
    max-width: 39.75rem;
    margin: 2.5rem auto; /* Center content with top and bottom margin */
    padding: 1.875rem; /* Padding inside the container */
    background-color: rgba(255, 255, 255, 0.95); /* Soft translucent background */
    text-align: center;
}

/* Grid Layout */
#content_collection .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); /* Flexible grid, min 10rem */
    gap: 1.875rem; /* Space between grid items */
    justify-content: center; /* Center items horizontally */
}

/* Grid Items */
#content_collection .grid-item {
    background-color: white;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.2);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 15rem; /* Set width for a square */
    height: 15rem; /* Set height for a square */
    text-decoration: none; /* Remove underline */
    color: #333; /* Text color */
    font-size: 1.125rem;
    border-radius: 0.3125rem; /* Rounded corners */
}

/* Hover Effects */
#content_collection .grid-item:hover {
    transform: translateY(-0.3125rem);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.4);
}


/* Responsive typography adjustments */
@media (max-width: 1200px) {
    header {
        padding: 1.625rem 1.25rem;
    }
}

@media (max-width: 992px) {
    header {
        display: block;
        text-align: center;
    }

    .page_title {
        margin-bottom: 1rem;
    }

    .page_title a .latin-name {
        color: rgba(0, 0, 0, 0.5);
    }

    nav {
        justify-content: center;
    }

    #content_collection .grid {
        grid-template-columns: repeat(3, 1fr);
    }

    #content_collection .grid-item {
        transform: scale(0.9);
    }
}

@media (max-width: 768px) {
    header {
        padding: 1.625rem 1.25rem;
        flex-direction: column;
    }

    .page_title {
        display: flex;
        flex-direction: column;
        align-items: center;
    }

    nav ul {
        display: flex;
        justify-content: center;
    }

    nav ul li a {
        font-size: 1rem;
        padding: 0.5rem 1rem;
    }

    main {
        margin-top: 2rem;
    }

    #content_collection {
        margin: 1.5rem 8rem;
        max-width: 30.75rem;
    }

    #content_collection .grid {
        grid-template-columns: repeat(2, 1fr);
    }

    #content_collection .grid-item {
        transform: scale(0.9);
        width: 10rem;
        height: 10rem;
    }
}

@media (max-width: 576px) {
    header {
        justify-content: center;
    }

    .page_title h1 {
        font-size: 1.3rem;
    }

    .page_title a .latin-name {
        font-size: 1.1rem;
    }

    nav {
        display: block;
    }

    nav ul li {
        margin-left: 0.4375rem;
    }

    nav ul li a {
        font-size: 0.875rem;
        padding: 0.4375rem 0.9375rem;
    }

    nav ul li a::after {
        top: 2rem;
    }

    #language_filter {
        justify-content: center;
    }

    main {
        margin-top: 1.25rem;
    }

    #content_collection {
        margin: 1.5rem 8rem;
        max-width: 28.75rem;
    }

    #content_collection .grid {
        grid-template-columns: 1fr;
    }

    #content_collection .grid-item {
        width: 10rem;
        height: 10rem;
    }
}
