/** This is the rudimentary style collection for the 
    GRSI revival project. **/

:root {
    --dropshadow-1: 3pt 2pt 1pt 0px rgba(155, 155, 155, 1);
    --dropshadow-2: 0pt 2pt rgba(155, 155, 155, 1);
    --headerBackground: #352208;
    --pageBackground: #f5f0ea;
    --surfaceBackground: #ffffff;
    --textColor: #1f1b17;
    --mutedTextColor: #6a625a;
    --borderColor: #cdb8a7;
    --tableStripe: #efe6dc;
    --fontSans: "Helvetica Neue", Helvetica, Arial, sans-serif;
    --fontSerif: Georgia, "Times New Roman", Times, serif;
    --contentWidth: 64rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
}

* {
    box-sizing: border-box;
}

/* Main site layout: Use flex for this. */
body {
    display: flex;
    flex-direction: column;
    /*margin-left: clamp(0.5em, 20vw, 40vw);*/
    /*margin-right: clamp(0.5em, 20vw, 40vw);*/
    align-items: center;
    font-family: var(--fontSans);
    background-color: var(--pageBackground);
    color: var(--textColor);
    line-height: 1.6;
    padding: 0;
    margin: 0;
    min-height: 100vh;
}

h1,
h2 {
    font-family: var(--fontSerif);
    font-weight: 600;
}

h3,
h4 {
    font-family: var(--fontSerif);
    font-weight: 500;
}

a {
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

header {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: var(--headerBackground);
    color: #e1bb80;
    box-shadow: var(--dropshadow-2);
}

.pager {
    background-color: var(--headerBackground);
}

div.site-banner {
    text-align: center;
    padding: 0.55rem;
    margin: 0;

    h1 {
        text-align: center;
        font-size: 1.35rem;
        font-weight: 400;
        margin: 0 3rem 0 3rem;
        padding: 0;
    }
}

nav>ul {
    font-family: var(--fontSerif);
    font-size: 1.2rem;
    list-style-type: none;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.25em;
    margin-top: 0.25rem;
    margin-bottom: 0;
    padding: 0;

    li {
        color: #e1bb80;
        list-style-type: none;
        display: inline-block;
        text-align: center;

        &.currentPage,
        &:hover {
            background-color: #884201;
        }

        a {
            display: inline-block;
            text-decoration: none;
            color: #e1bb80;
            padding: 0.5rem;
        }
    }
}

input#chk-mobile-menu {
    display: none;
}

label#lbl-mobile-menu {
    display: none;
}

/* Responsive menu. */
@media only screen and (max-width: 768px) {
    header {
        display: grid;
        grid-template-columns: 5fr auto;
        gap: 0px 0px;
        grid-template-areas:
            "title hamburger"
            "menu menu";
    }

    div.site-banner {
        grid-area: title;
        align-self: center;

        h1 {
            text-align: left;
            margin: 0;
            font-size: clamp(1rem, 5vw, 1.25rem);
        }
    }

    label#lbl-mobile-menu {
        font-family: "Times New Roman";
        display: block;
        margin: 0.2rem 0.4rem;
        text-align: right;
        font-size: 2rem;
        cursor: pointer;
        grid-area: hamburger;
        border: solid 1pt #333;
        border-radius: 0.1em;
        width: min-content;
        line-height: 0.7;
        padding: 0.1em 0.1em 0.1em 0.1em;

        &:hover {
            background-color: #884201;
        }
    }

    nav {
        grid-area: menu;
        display: none;
    }

    nav>ul {
        display: flex;
        flex-direction: column;
        gap: 0;

        li {
            border-width: 1pt 0 0 0;
            border-color: white;
            border-style: solid;
            padding: 0.5rem;

            a {
                width: 96vw;
                padding: 0;
            }
        }
    }

    input#chk-mobile-menu:checked~header>nav {
        display: block;
    }
}

main {
    max-width: var(--contentWidth);
    width: min(var(--contentWidth), calc(100% - 2rem));
    margin: 1em auto;
    flex: 1;
}

h3.name {
    margin-top: 0.3em;
}

h3,
h4 {
    margin-bottom: 0;
}

h4+p,
h4+ul,
h3+p,
h3+ul {
    margin-top: 0;
}

span.bbtiId {
    font-weight: bold;
    color: grey;
    display: inline-block;
    margin-left: 1em;
}

table td span.bbtiId {
    display: none;
}

span.mjTitle {
    font-style: italic;
}

/* By default, tables should have borders and alternate colours. */
table {
    border: solid 1pt var(--borderColor);
    margin: 1rem;
    background-color: var(--surfaceBackground);
    border-collapse: collapse;

    th,
    td {
        padding: 0.5rem;
        border: solid 1pt var(--borderColor);
    }

    tr:nth-child(even) {
        background-color: var(--tableStripe);
    }

    /* Tables should be displayed as lists at a certain 
   form factor and below. */
    @media only screen and (max-width: 768px) {

        border: none;

        thead tr {
            /*display: flex;
        list-style-type: none;
        border: none;*/
            display: none;
        }

        tbody tr {
            display: list-item;
            list-style-type: none;
            border-width: 1pt 0 0 0;
            border-style: solid;
        }

        td {
            display: list-item;
            border: none !important;
            list-style-type: none;
            padding: 0.2em;

            &:last-of-type {
                padding-bottom: 1em;
            }
        }

        thead td {
            text-align: left;
        }

        tbody td[title]::before {
            content: attr(title) ": ";
            font-weight: bold;
        }
    }
}

ul.letterLinks {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.2rem;
    list-style-type: none;
    padding: 0;
    margin: 0.5em 0;

    a,
    a:visited {
        text-decoration: none;
        display: inline-block;
        padding: 0.25em;
        background-color: var(--headerBackground);
        color: white;
        border: solid 1pt #333;
        border-radius: 0.2em;
        width: 1em;
        text-align: center;
    }
}

span.extraInfo {
    /* Hide for now. */
    /* display: inline-block; */
    display: none;
    margin: auto 0.5em;
    font-size: 0.8rem;
    color: var(--mutedTextColor);
}

code {
    font-size: 1.25rem;
}

footer {
    display: flex;
    flex-direction: column;
    gap: 0.25em;
    margin: 0.5rem 0 0 0;
    background-color: var(--surfaceBackground);
    border-top: 2px solid var(--borderColor);
    padding: var(--space-md);
    align-items: center;
    text-align: center;
    box-sizing: border-box;
    width: 100%;
    font-size: 0.8rem;

    * {
        max-width: min(40rem, 96vw);
    }

    div#buildInfo {
        color: var(--mutedTextColor);
        font-size: 0.7rem;
    }

    a[href],
    a[href]:visited {
        color: var(--textColor);
    }
}

/* Layout for footer logos: show them in a single row */
footer .logos {
    display: flex;
    flex-direction: row;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

footer .logos a {
    display: inline-flex;
    align-items: center;
}

footer .logos img {
    height: 3rem;
    width: auto;
}

/* Subcollection stuff. */
div#recordCollection {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
    flex-wrap: wrap;
}

fieldset.collectionBuilder {
    margin-top: 1rem;
    font-size: 1.3rem;
    max-width: 90vw;

    &>legend {
        background-color: var(--headerBackground);
        color: white;
        padding: 0.25em;
    }

    &>div {
        max-width: 90vw;
        padding: 0.5rem;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
    }

    &>div div {
        display: grid;
        grid-template-columns: 10em auto;
        gap: 0.5rem;

        @media only screen and (max-width: 768px) {
            display: grid;
            grid-template-columns: auto;
        }
    }

    input,
    textarea {
        font-size: 1.3rem;
    }
}

/*Meta grid and other divs for displaying slides*/
main {
    max-width: var(--contentWidth);
}

div#imageMetaGrid {
    display: grid;
    grid-template-columns: 1fr;
    align-items: center;
}

@media only screen and (min-width: 768px) {
    div#imageMetaGrid {
        grid-template-columns: 1.5fr 1fr;
        grid-column-gap: 30px;
    }
}

@media only screen and (min-width: 768px) {
    div#imageMetaGrid>h2 {
        grid-column: 1/3;
    }
}

div.itemImageContainer {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 1rem;
    align-self: start;
}

@media only screen and (min-width: 768px) {
    div.itemImageContainer {
        position: sticky;
        top: 20px;
    }
}

img.itemImage {
    width: 100%;
    height: auto;
    border: 1px solid #222222;
}

/* Gallery page styles. */
div.gallery {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: 0.5rem 0 1.5rem;
    justify-content: center;
    align-items: stretch;
}

div.galleryItem {
    border: solid 1px color-mix(in srgb, var(--borderColor) 88%, white);
    padding: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: min(15.5rem, 100%);
    background-color: var(--surfaceBackground);
    box-shadow: 0 10px 24px rgba(53, 34, 8, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

div.galleryItem:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 30px rgba(53, 34, 8, 0.14);
    border-color: #b98760;
}

div.galleryItem::before {
    content: attr(data-material);
    order: 2;
    margin-top: 0.85rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #8a4b1f;
}

div.galleryItem::after {
    content: attr(data-site);
    order: 4;
    margin-top: auto;
    padding-top: 0.9rem;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--mutedTextColor);
    border-top: 1px solid #e9ddd2;
}

div.galleryItem[data-site='- Not set -']::after,
div.galleryItem[data-site='']::after,
div.galleryItem:not([data-site])::after {
    display: none;
}

div.galleryItem>a {
    display: block;
    order: 1;
    overflow: hidden;
    background: #efe6dc;
}

div.galleryItem img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border: 1px solid #d8c4b4;
    margin-bottom: 0;
    transition: transform 0.3s ease;
}

div.galleryItem:hover img {
    transform: scale(1.02);
}

div.galleryItem p {
    order: 3;
    margin: 0.45rem 0 0;
    font-family: var(--fontSerif);
    font-size: 1.3rem;
    line-height: 1.2;
}

@media only screen and (min-width: 1024px) {
    main:has(.galleryPageLayout) {
        max-width: min(84rem, calc(100% - 1.5rem));
        width: min(84rem, calc(100% - 1.5rem));
    }

    div.galleryItem {
        width: calc((100% - 3.75rem) / 4);
    }
}

@media only screen and (max-width: 768px) {
    div.gallery {
        gap: 0.9rem;
    }

    div.galleryItem {
        width: min(100%, 20rem);
    }
}


/* staticSearch page stuff. */
div#staticSearch {
    max-width: min(76rem, 96vw);
    margin: 0 auto;
}

main:has(#staticSearch) {
    max-width: min(80rem, calc(100% - 1.5rem));
}

main:has(#staticSearch)>h2 {
    font-size: clamp(2rem, 4.2vw, 3.2rem);
    text-align: center;
    margin: 0.15em 0 0.2em;
    color: #6c2b13;
}

main:has(#staticSearch)>p {
    max-width: 46rem;
    margin: 0 auto 1.1rem;
    text-align: center;
    color: var(--mutedTextColor);
}

form#ssForm {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
}

form#ssForm>span.ssQueryAndButton,
form#ssForm>span.clearButton {
    margin: 0;
}

form#ssForm>span.ssQueryAndButton {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.6rem;
    align-items: center;
    grid-column: 1 / 2;
    padding: 0.7rem;
    border: 1px solid var(--borderColor);
    background: #f8f4ef;
}

form#ssForm>span.clearButton {
    grid-column: 2 / 3;
    align-self: stretch;
}

form#ssForm>div {
    grid-column: 1 / -1;
}

span.ssQueryAndButton {
    flex-wrap: wrap;
}

#staticSearch fieldset legend {
    background: transparent;
    color: #7f4d24;
    padding: 0.35rem;
    margin-bottom: 0.45rem;
    border-bottom: 1px solid #dbc9ba;
    width: 100%;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
}

ul.ssDescCheckboxList,
ul.ssSearchInCheckboxList {
    margin-top: 0;
    margin-bottom: 0;
    min-width: 100%;
    max-height: 11.5rem;
    padding-left: 0.1rem;
}

ul.ssDescCheckboxList li,
ul.ssSearchInCheckboxList li {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

ul.ssDescCheckboxList li input[type="checkbox"],
ul.ssSearchInCheckboxList li input[type="checkbox"] {
    flex-shrink: 0;
    margin: 0;
}

#staticSearch div.ssSearchInFilters,
#staticSearch div.ssDescFilters,
#staticSearch div.ssDateFilters,
#staticSearch div.ssNumFilters,
#staticSearch div.ssBoolFilters,
#staticSearch div.ssFeatFilters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.75rem;
}

#staticSearch fieldset.ssFieldset {
    margin: 0;
    border: none;
    outline: 1px solid var(--borderColor);
    background: #f8f4ef;
    padding: 0.6rem 0.75rem 0.5rem;
    min-height: 11.8rem;
}

input#ssQuery,
button#ssClear,
button#ssDoSearch,
button#ssDoSearch2 {
    font-size: 1rem;
}

input#ssQuery {
    padding: 0.7rem 0.8rem;
    border: 1px solid #cdb8a7;
    background: #fffdfb;
}

button#ssDoSearch,
button#ssDoSearch2 {
    background: #8a3f09;
    color: #f7eee4;
    border: 1px solid #7c3507;
    padding: 0.65rem 1.35rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.82rem;
}

button#ssClear {
    width: 100%;
    height: 100%;
    min-height: 2.75rem;
    border: 1px solid #ccb6a4;
    background: #f7f2ec;
    color: #5b4f44;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.78rem;
}

div.ssDateFilters fieldset {
    justify-content: center;
}

@media only screen and (max-width: 920px) {
    form#ssForm {
        grid-template-columns: 1fr;
    }

    form#ssForm>span.ssQueryAndButton,
    form#ssForm>span.clearButton {
        grid-column: 1 / -1;
    }

    form#ssForm>span.clearButton button#ssClear {
        min-height: 2.4rem;
    }

    #staticSearch fieldset.ssFieldset {
        min-height: auto;
    }
}