/* Pico CSS provides most base styles, these are custom overrides 
    https://github.com/picocss/pico/discussions/482
*/

:root {

    --pico-primary: #524c84;
    --pico-primary-hover: #7b78b8;
    --separator-color: #999;

    --pico-font-family-sans-serif: Inter, system-ui, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, Helvetica, Arial, "Helvetica Neue", sans-serif, var(--pico-font-family-emoji);
    --pico-font-size: 87.5%;
    /* Original: 100% */
    --pico-line-height: 1.25;
    /* Original: 1.5 */
    --pico-form-element-spacing-vertical: 0.5rem;
    /* Original: 1rem */
    --pico-form-element-spacing-horizontal: 1.0rem;
    /* Original: 1.25rem */
    --pico-border-radius: 0.375rem;
    /* Original: 0.25rem */
}

@media (min-width: 576px) {
    :root {
        --pico-font-size: 87.5%;
        /* Original: 106.25% */
    }
}

@media (min-width: 768px) {
    :root {
        --pico-font-size: 87.5%;
        /* Original: 112.5% */
    }
}

@media (min-width: 1024px) {
    :root {
        --pico-font-size: 87.5%;
        /* Original: 118.75% */
    }
}

@media (min-width: 1280px) {
    :root {
        --pico-font-size: 87.5%;
        /* Original: 125% */
    }
}

@media (min-width: 1536px) {
    :root {
        --pico-font-size: 87.5%;
        /* Original: 131.25% */
    }
}

h1,
h2,
h3,
h4,
h5,
h6 {
    --pico-font-weight: 600;
    /* Original: 700 */
}

article {
    border: 1px solid var(--pico-muted-border-color);
    /* Original doesn't have a border */
    border-radius: calc(var(--pico-border-radius) * 2);
    /* Original: var(--pico-border-radius) */
}

article>footer {
    border-radius: calc(var(--pico-border-radius) * 2);
    /* Original: var(--pico-border-radius) */
}



[data-theme="dark"] {
    --separator-color: #666666;
    --pico-background-color: #000000;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main.container {
    flex: 1 0 auto;
}

span.data {
    font-family: Verdana, Geneva, Tahoma, sans-serif;
}

/* Top bar - Pico nav styling with customizations */

nav.top-bar {
    background-color: black;
    color: white;
    padding: 0rem 1rem 0rem 1rem;
    position: relative;
    min-height: auto;
}

nav.top-bar ul {
    margin: 0;
}

nav.top-bar li {
    list-style: none;
}

nav.top-bar .logo img {
    max-height: 60px;
    height: auto;
    max-width: 100%;
}

nav.top-bar .title {
    font-size: 1.6em;
    color: white;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: 50%;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

nav.top-bar .icons img {
    max-height: 60px;
    height: auto;
    max-width: 100%;
}

nav.top-bar a {
    color: white;
    text-decoration: none;
}

nav.top-bar a:hover {
    color: #ccc;
}

/* Dark mode toggle - Pico switch styling */

.theme-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
}

.theme-toggle label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: white;
}

.theme-toggle input[type="checkbox"][role="switch"] {
    margin: 0;
}

/* Breadcrumbs */

.breadcrumbs {
    margin-bottom: 1rem;
    font-size: 1.0em;
    opacity: 0.8;
}

.breadcrumbs .separator {
    margin: 0 0.5rem;
    color: var(--separator-color);
}

.breadcrumbs .current {
    font-weight: 500;
}

/* Search form */

.search-row {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
}

.search-row input[type="text"] {
    flex: 1;
    max-width: 500px;
}

.search-row button {
    width: auto;
    flex-shrink: 0;
}

.filters-row {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.filters-row label {
    width: auto;
    min-width: 200px;
}

.collection-header {
    margin-bottom: 1.5rem;
    text-align: center;
}

.result-details {
    margin: 1rem 0;
    text-align: center;
}

/* Pagination */

.pager {
    margin: 1rem 0;
    text-align: center;
}

.pager__item {
    display: inline-block;
    vertical-align: top;
    font-size: 1rem;
    margin: 0 2px;
}

.pager__item.active .pager__link {
    background-color: var(--pico-primary);
    color: #fff;
    text-decoration: none;
}

.pager__item--prev svg, .pager__item--next svg {
    width: 8px;
    height: 12px;
}

.pager__item--next .pager__link svg {
    transform: rotate(180deg);
    transform-origin: center center;
}

.pager__text {
    position: relative;
    border-radius: var(--pico-border-radius);
    display: block;
    text-align: center;
    width: 2.625rem;
    height: 2.625rem;
    line-height: 2.625rem;
    margin-left: -1px;
    text-decoration: none;
}

.pager__link {
    position: relative;
    border-radius: var(--pico-border-radius);
    display: block;
    text-align: center;
    width: 2.625rem;
    height: 2.625rem;
    line-height: 2.625rem;
    margin-left: -1px;
    text-decoration: none;
    transition: 0.3s;
}

.pager__link:hover, .pager__link:focus, .pager__link:active {
    background-color: var(--pico-primary-hover);
    color: #fff;
    text-decoration: none;
}

.pager__link:hover svg path, .pager__link:focus svg path, .pager__link:active svg path {
    fill: #fff;
}

@media screen and (max-width: 576px) {
    .pager__item {
        position: absolute;
        top: -9999px;
        left: -9999px;
    }
    .pager__item.active, .pager__item:first-of-type, .pager__item:last-of-type,
    .pager__item:nth-of-type(2), .pager__item:nth-last-of-type(2) {
        position: initial;
        top: initial;
        left: initial;
    }
    .pager__item.active + li {
        position: initial;
        top: initial;
        left: initial;
    }
}

/* Gallery */

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
    padding: 2rem 2rem;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    box-sizing: border-box;
}

.gallery .container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-bottom: 10px;
    width: 100%;
}

.gallery .container img.thumbnail {
    opacity: 1;
    display: block;
    max-width: 100%;
    max-height: 300px;
    width: auto;
    height: auto;
    backface-visibility: hidden;
    border-radius: var(--pico-border-radius);
}

.gallery .container .image-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    width: 100%;
}

.gallery .container .label {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    width: 100%;
    text-align: center;
    margin-top: auto;
    padding: 10px 5px 0px 5px;
}

.gallery .container .overlay {
    position: absolute;
    top: 0px;
    width: 100%;
    height: 100%;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    overflow: visible;
}

.gallery .buttons {
    margin: 10px auto 0 auto;
    opacity: 1;
    background-color: var(--pico-card-background-color);
    border: 1px solid var(--pico-muted-border-color);
    border-radius: var(--pico-border-radius);
    pointer-events: auto;
    padding: 8px 12px;
    display: inline-block;
    overflow: visible;
}

.gallery .buttons a {
    display: inline-block;
    opacity: 1;
    position: relative;
}

.gallery .buttons a img {
    padding: 0px;
    background-color: transparent;
    border-radius: 4px;
}

.gallery .container .overlay .title {
    margin: 5px auto 0 auto;
    padding: 0px 10px;
    white-space: wrap;
    overflow-wrap: anywhere;
    font-size: 1.2em;
}

.gallery .container:hover img.thumbnail {
    opacity: 0.8;
}

.gallery .container:hover .overlay {
    opacity: 1;
}

/* Removed - using Pico button styles */

/* Detail view */

.content {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 2rem;
}

.image {
    max-width: min(100%, 500px);
    flex: 0 0 auto;
    height: auto;
    border-radius: var(--pico-border-radius);
}

table.striped {
    flex: 1 1 300px;
    max-width: 100%;
    table-layout: fixed;
    width: 100%;
}

table.striped td:first-child {
    font-weight: bold;
}

@media (max-width: 1400px) {
    .content {
        flex-direction: column;
    }
}

/* External tool buttons */

a.icon {
    display: inline;
    margin: 0 0.25rem;
    text-decoration: none;
}

a.icon img {
    width: 36px;
    height: 36px;
}

a.icon img:active {
    transform: scale(0.9);
}

/* Tooltip positioning */

a.icon[data-tooltip] {
    position: relative;
}

a.icon[data-tooltip]::before,
a.icon[data-tooltip]::after {
    bottom: 100%;
    margin-bottom: 0.25rem;
}

/* Footer */

.footer {
    background-color: black;
    color: white;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: center;
    padding: 1rem 0 2rem 0;
    margin-top: auto;
    width: 100vw;
    margin-left: calc(-50vw + 50%);
    flex-shrink: 0;
}

.footer-section {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.footer-section a {
    color: white;
    text-decoration: none;
}

.footer-section a:hover {
    text-decoration: underline;
}

.footer-section a i {
    font-size: 28px;
}

.footer-section a i:hover {
    color: #ccc;
}
