/*
Copyright: (c) 2026 Jörn Menne
Licensed under the Apache License, Version 2.0
See NOTICE file for details.
*/

/* Search bar */
#search-container {
    margin: 0.5rem;
    padding: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
}

#search-container form {
    width: 100%;
}

/* Groups the filter controls, the legend is only read out by screen readers */
#search-container fieldset {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    width: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    min-width: 0;
}

/* Mobile: every control takes the full width of the search bar */
#search-container input[type="text"],
#search-container select,
#search-container button[type="submit"] {
    flex: 1 1 100%;
}

/* The filter fields are rendered by the Django form, so they cannot take the .field class yet */
#search-container input[type="text"],
#search-container select {
    min-height: 2.75rem;
    padding: 0.6rem 0.75rem;

    font: inherit;
    font-size: 1rem;
    color: black;
    background-color: #fff;
    border: 2px solid var(--field-border);
    border-radius: var(--border-radius);
}

/* From tablet width on, the fields share one line and grow to fill it */
@media (min-width: 600px) {
    #search-container input[type="text"],
    #search-container select {
        flex: 1 1 10rem;
    }

    #search-container button[type="submit"] {
        flex: 0 0 auto;
    }
}

/* Entry cards */
.container {
    display: grid;
    grid-template-columns: 1fr;
    /* Every row as tall as the tallest card, so all cards have the same height */
    grid-auto-rows: 1fr;
    gap: 1rem;
    padding: 0 0.75rem;

    @media (min-width: 600px) {
        grid-template-columns: repeat(2, 1fr);
    }

    @media (min-width: 950px) {
        grid-template-columns: repeat(3, 1fr);
    }
}

.no-js .container{
    padding: 1rem;
}

/* Hover and focus of the card (the card layout and status colours are in status-style.css) */
.entry {
    transition: filter var(--dur), translate var(--dur), box-shadow var(--dur);

    /* Only on devices with a real pointer, so taps don't leave a stuck hover */
    @media (hover: hover) {
        &:hover {
            filter: brightness(0.96);
            translate: 0 -2px;
            box-shadow: 1px 3px 6px var(--color-shadow);
        }
    }

    /* Focus ring on the card, since the title link itself has no visible box */
    &:has(.entry-title:focus-visible) {
        outline: 3px solid black;
        outline-offset: 2px;
    }
}

/* The title link covers the whole card, so a click anywhere opens the entry */
.entry-title {
    color: var(--color-txt);
    text-decoration: none;

    &::after {
        content: "";
        position: absolute;
        inset: 0;
        border-radius: var(--border-radius);
    }

    &:focus-visible {
        outline: none;
    }
}

.entry-body {
    h2 {
        margin: 0 0 0.5rem;
        font-size: 1.1rem;
    }

    p {
        margin: 0.5rem 0 0;
    }
}

/* Message when no entry matches the filter, spans all columns */
.no-results {
    grid-column: 1 / -1;
    text-align: center;
    font-weight: bold;
}

/* Pagination */
.pagination {
    padding: 1.5rem 0.75rem;
}

.step-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    justify-content: center;
    align-items: center;
}
