/* sheepi.sh — one stylesheet for every page.
 *
 * Tokens, type and page chrome come from the landing page; the collage and
 * the lightbox are only used by photos.html but live here so there is a
 * single place to change anything.
 *
 * Images are never colour-dimmed. Photographs show their own colour.
 */

@import url('https://fonts.googleapis.com/css2?family=Bangers&family=Caveat:wght@400;700&family=Cinzel+Decorative:wght@400;700&family=Cormorant+Garamond:wght@400;500;600;700&family=Old+Standard+TT:wght@400;700&family=Orbitron:wght@400;500;700&family=Patrick+Hand&family=Rock+Salt&family=Source+Serif+4:ital,opsz,wght@0,8..60,400;0,8..60,600;1,8..60,400&family=Special+Elite&family=Uncial+Antiqua&family=VT323&display=swap');


/* ---------- tokens ---------- */

:root {
    --page-bg: #111;
    --panel-bg: rgba(255, 255, 255, 0.04);
    --ink: #f9f0d1;
    --gold: #d4af37;

}


/* ---------- page chrome ---------- */

body {
    font-family: 'Source Serif 4', 'Georgia', serif;
    font-size: 18px;
    line-height: 1.5;
    background: var(--page-bg);
    color: var(--ink);
    margin: 20px;
}

.topbar {
    display: flex;
    align-items: center;
    margin-bottom: 20px;
}

.brand {
    font-family: 'Caveat', cursive;
    font-size: clamp(2.6rem, 5vw, 5rem);
    line-height: 1;
    letter-spacing: 0.06em;
    margin: 0;
    font-weight: 700;
    color: var(--ink);
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.2);
}

.topbar .nav {
    margin-left: 22px;
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--gold);
    text-decoration: none;
    opacity: 0.8;
}

.topbar .nav:hover {
    opacity: 1;
}

/* the intro paragraph on each page: keep the lines a readable length */
body > p {
    max-width: 100ch;
    margin: 0 0 30px;
}


/* ---------- the art gallery (index.html) ---------- */

.artbox {
    position: relative;
    display: inline-block;
    width: var(--w, 600px);
    max-width: 100%;
    box-sizing: border-box;
    float: left;
    margin: 0 14px 14px 0;
    padding: 14px;
    background: linear-gradient(135deg, rgba(212,175,55,0.22), rgba(255,240,180,0.08));
    border: 2px solid #d8b04e;
    box-shadow:
        0 0 0 2px rgba(130, 96, 20, 0.75),
        0 0 0 6px rgba(212, 175, 55, 0.18),
        inset 0 0 0 2px rgba(255, 228, 128, 0.38),
        inset 0 0 18px rgba(0, 0, 0, 0.45);
    line-height: 0;
}

.artbox::before {
    content: "";
    position: absolute;
    inset: 6px;
    border: 1px solid rgba(255, 219, 114, 0.8);
    pointer-events: none;
}

.artbox img {
    display: block;
    width: 100%;
    height: auto;
    image-rendering: pixelated;

    /* inline placeholder sits exactly behind the image, never the frame */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

div.artbox {
    margin-right: 50px !important;
    margin-bottom: 50px !important;
}

.artbox .caption {
    display: block;
    margin-top: 8px;
    line-height: 1.2;
    font-size: 12px;
    letter-spacing: 0.08em;
    color: #f3d992;
    text-align: left;
}

.artbox .caption a {
    color: inherit;
    text-decoration: none;
    font-style: italic;
    font-weight: inherit;
}

/* once the real image has decoded, stop nearest-neighbour scaling. This is
   the only thing is-ready does now -- the artwork is never desaturated. */
.artbox.is-ready img {
    image-rendering: auto;
}


/* ---------- the photo collage (photos.html) ---------- */

/* Justified rows: every thumb starts --row tall and as wide as its aspect
   ratio (--r, set by the page) makes it; flex then scales each row to
   the edge. The spacer soaks up the slack on
   the last row so a lone photo isn't blown up to fill it. */
.grid {
    --row: 220px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 40px;
}

.thumb {
    /* grow and shrink are both proportional to --r, so every thumb in a
       row scales by the same factor and the row stays level. The height
       follows from the aspect ratio, so nothing is ever cropped. */
    flex: calc(var(--r, 1.5) * 100) 1 calc(var(--r, 1.5) * var(--row));
    aspect-ratio: var(--r, 1.5);
    min-width: 0;
    padding: 0;
    border: 0;
    background: #000;
    cursor: pointer;
    line-height: 0;
    overflow: hidden;
}

.thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* inline placeholder shows until the thumbnail lands */
    background-size: cover;
    background-position: center;
}

.thumb:hover img,
.thumb:focus-visible img {
    filter: brightness(1.08);
}

.thumb:focus-visible {
    outline: 2px solid var(--gold);
    outline-offset: 2px;
}

.grid .spacer {
    flex: 1000 1 0;
    height: 0;
}



/* ---------- lightbox ---------- */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(8, 8, 8, 0.96);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 20px;
}

.lightbox[hidden] {
    display: none;
}

.lightbox img {
    max-width: 100%;
    max-height: calc(100vh - 130px);
    object-fit: contain;
    background-size: cover;
    background-position: center;
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.9);
}

.lb-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 14px;
    font-family: 'VT323', monospace;
    font-size: 18px;
    letter-spacing: 0.06em;
    color: var(--ink);
    opacity: 0.85;
}

.lb-bar a {
    color: var(--gold);
    text-decoration: none;
}

.lb-bar a:hover {
    text-decoration: underline;
}

.lb-caption {
    font-family: inherit;
    font-style: italic;
    font-size: 15px;
    letter-spacing: 0;
}

.lb-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: 0;
    color: var(--ink);
    font-size: 40px;
    opacity: 0.4;
    cursor: pointer;
    padding: 20px;
    line-height: 1;
}

.lb-nav:hover {
    opacity: 1;
}

.lb-prev { left: 4px; }
.lb-next { right: 4px; }

.lb-close {
    position: absolute;
    top: 10px;
    right: 16px;
    background: none;
    border: 0;
    color: var(--ink);
    font-size: 30px;
    opacity: 0.5;
    cursor: pointer;
    line-height: 1;
}

.lb-close:hover {
    opacity: 1;
}


/* ---------- narrow screens ---------- */

@media (max-width: 700px) {
    body { margin: 12px; }
    .grid { --row: 110px; gap: 4px; }
    div.artbox { float: none; margin: 0 0 24px !important; }
}
