@import url('astroplasm_inner.css');
body {
    margin: 0;
    background: var(--pagebg);
    background-image: linear-gradient(var(--topbar) 30px, var(--pagebg) 30px);
    color: var(--color);
    font: 1rem var(--bodyfont);
}

img {
    border: none;
}

form {
    display: inline;
}

.nav-link {
    padding: 0 8px;
    font-size: 1rem;
    text-decoration: underline;
    font-family: var(--headerfont);
}

#head > form {
    float: right;
    margin: 3px;
}

.title {
    font-size: 1.1875rem;
    font-weight: normal;
    text-align: center;
    min-width: 220px;
}

.title-full {
    display: none;
}

.title-short {
    display: inline;
}

.title-sub {
    display: block;
    font-size: 1.15em;
    font-weight: normal;
    opacity: 0.9;
    margin-top: 4px;
}

@media (min-width: 1100px) {
    .title-full {
        display: inline;
    }

    .title-short {
        display: none;
    }
}

.gallery {
    clear: left;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 400px));
    gap: 34px 28px;
    margin: 36px 20px 0 20px;
    padding: 0;
}

.thumbs > li {
    list-style: none;
    display: block;
    width: auto;
    margin: 0;
    vertical-align: top;
    font-size: 0.6875rem;
    color: #404040;
    min-width: 0;
    overflow: hidden;
}

.gallery > li > a {
    display: inline;
}

.gallery > li > a > img {
    float: left;
    margin: 0 10px 3px 0;
    box-shadow: 0 0 5px #bbb;
    --thumb-size: 11.25rem;
    max-width: var(--thumb-size);
    max-height: var(--thumb-size);
    height: auto;
}

.description {
    margin: 0 0 5px;
}

.description h3 {
    font-size: 0.8125rem;
    font-weight: normal;
    margin: 0 0 7px;
    color: #404040;
    overflow-wrap: anywhere;
}

.description p {
    font-size: 0.9375rem;
}

.info, .info > a {
    color: #aaa;
    text-align: right;
    font-style: italic;
    margin: 3px;
    overflow-wrap: anywhere;
}

.info > a {
    text-decoration: underline;
}

.footer {
    font-size: 0.6875rem;
    margin: 5px;
    text-align: center;
}

#sort {
    color: #555;
    text-align: right;
    font-size: 0.75rem;
    font-style: italic;
    margin: -13px 20px 0 0;
}

#sort > a {
    color: #7C7996;
}

#about {
    margin: 30px 20px;
    color: #555;
    font-size: 0.75rem;
}

@media (max-width: 1200px) {
    .gallery {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 30px 24px;
    }

    .gallery > li > a > img {
        --thumb-size: 10.375rem;
    }
}

@media (prefers-color-scheme: light) {
    body {
        background-color: var(--pagebg);
        background-image: url("../artwork/Tilebg.png");
        background-repeat: repeat;
    }
}

.title, .title > a, .nav-link {
    color: var(--link);
}

.title, .title > a {
    font-family: var(--titlefont);
}

.nav-link:hover, .title > a:hover {
    color: var(--linkhover);
}

.nav-current {
    color: var(--linkhover);
    font-weight: bold;
}

.thumbs > li, .description h3 {
    color: var(--color);
}

.info, .info > a, #sort, #about {
    color: var(--muted);
}

#sort > a {
    color: var(--link);
    text-decoration: underline;
}

.gallery > li > a > img {
    box-shadow: 0 0 5px var(--shadow);
}

#q {
    background: var(--searchbg);
    color: var(--color);
    border: 1px solid var(--overlay-border);
}

@media (prefers-color-scheme: light) {
    #q {
        background: #ffffff;
    }
}

#q:focus {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

#head {
    position: relative;
    min-height: 30px;
    background: var(--topbar);
}

#head::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -7px;
    height: 7px;
    background: linear-gradient(var(--topbar), transparent);
    pointer-events: none;
}

@media (prefers-color-scheme: light) {
    #head {
        background: #E5E9EC; /* pale, cool silver-white */
    }

    #head::after {
        background: linear-gradient(#E5E9EC, transparent); /* pale, cool silver-white */
    }
}

.nav-link, #head > form {
    position: relative;
    z-index: 2;
}

.about-page {
    max-width: 960px;
    margin: 16px 8px;
    padding: 0;
    line-height: normal;
}

.about-page h3 {
    margin: 1.25em 0 0.6em;
    color: var(--color);
    font-family: var(--headerfont);
    font-size: 1.17em;
    font-weight: bold;
}

.about-page p {
    margin: 1em 0;
}

.about-page ol,
.about-page ul {
    margin: 1em 0;
    padding-left: 1.5em;
}

.about-page li {
    margin: 0.6em 0;
}

.about-page a {
    color: var(--link);
    text-decoration: underline;
}

.about-page a:hover {
    color: var(--linkhover);
}

.about-footer {
    max-width: 960px;
    margin: 24px 8px 8px;
}

@media (min-width: 821px) {
    #head {
        display: flex;
        align-items: center;
        gap: 4px;
        padding-left: 150px;
        padding-right: 20px;
    }

    .nav-link {
        position: static;
    }

    #head > form {
        float: none;
        margin-left: auto;
    }

    #head .title {
        flex: 1 1 auto;
        min-width: 0;
        margin: 0;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        transform: skewX(6deg);
    }

    .gallery {
        margin-left: 150px;
        margin-right: 24px;
    }

    .about-page,
    .about-footer {
        margin-left: 150px;
        margin-right: 24px;
    }

}

/* Spangleborder.png only renders at this width (see astroplasm_inner.css);
   keep the navbar and gallery clear of its 100px strip so nothing clips into it. */
@media (min-width: 1731px) {
    #head {
        padding-right: 130px;
    }

    .gallery,
    .about-page,
    .about-footer {
        margin-right: 130px;
    }
}

.nav-back {
    display: none;
}

@media (max-width: 820px) {
    html, body {
        overflow-x: hidden;
        overflow-y: auto;
    }

    .gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 28px 18px;
        margin: 28px 12px 0;
    }

    .gallery > li > a > img {
        --thumb-size: 9.3125rem;
    }

    #sort {
        margin: 16px 12px 4px;
        font-size: 0.6875rem;
    }

    .back-button {
        display: none;
    }

    #head {
        display: grid;
        grid-template-areas:
            "back archive about"
            "title title title"
            "search search search";
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
        grid-template-rows: minmax(40px, auto) minmax(30px, auto) minmax(28px, auto);
        align-items: center;
        gap: 0;
        min-height: 96px;
    }

    .nav-link {
        position: static;
        padding: 8px;
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        text-align: center;
        font-size: 1.0625rem;
    }

    .nav-back     { grid-area: back; display: inline; }
    .nav-archive  { grid-area: archive; }
    .nav-about    { grid-area: about; }

    #head > form {
        grid-area: search;
        float: none;
        position: static;
        width: auto;
        max-width: none;
        min-width: 0;
        margin: 0 8px;
    }

    #q {
        width: 100%;
        min-height: 44px;
        padding: 8px 12px;
        font-size: 1rem;
        box-sizing: border-box;
    }

    #head .title {
        grid-area: title;
        min-width: 0;
        margin: 0;
        padding: 2px 8px;
        font-size: clamp(0.6875rem, 3vw, 1rem);
        line-height: 1.2;
        text-align: center;
        white-space: normal;
        transform: skewX(6deg);
    }

    #head:not(:has(form)):not(:has(.title)) {
        grid-template-areas: "back archive about";
        grid-template-rows: minmax(40px, auto);
        min-height: 40px;
    }
}

@media (max-width: 560px) {
    .gallery {
        grid-template-columns: 1fr;
        gap: 24px;
        margin: 24px 12px 10px;
    }

    .gallery > li > a > img {
        --thumb-size: 10.75rem;
    }

    .description h3 {
        font-size: 0.8125rem;
    }

    .info {
        font-size: 0.6875rem;
    }

    .nav-link { padding: 6px 5px; font-size: 0.9375rem; }
    #head .title { font-size: 0.875rem; }
}

/* Was previously ordered before the ≤560px block, which made this override
   dead code at ≤360px (later rule of equal specificity always won). */
@media (max-width: 360px) {
    .gallery > li > a > img {
        --thumb-size: 8.5625rem;
        margin-right: 8px;
    }
}
