/* ==========================================================================
   Reset
   ========================================================================== */
:root {
    --mobile-spacing: 2vh;
    --main-color: blue;
    --padding: 5vh;
    --small-padding: 1vw;
    --mobile-padding: 5vw;
    --button-padding: 1px;
    --bottom-margin: 10vh;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ==========================================================================
   Base
   ========================================================================== */

html {
    font-size: clamp(14px, 1.5vw, 20px);
    font-family: "ltc-caslon-pro", serif;
    color: black;
    display: flex;
    justify-content: center;
    width: 100vw;
    line-height: 1.4;
}

body {
    width: 100vw;
    overflow-x: hidden;
    display: flex;
    flex-wrap: wrap;
    background-color: white;

}

::selection {
    background-color: var(--main-color);
    color: white;
}

b {
    font-weight: 600;
}

a {
    color: black;
    text-decoration: none;
}

a:hover,
.topbar button:hover,
.bio-topbar button:hover,
.filter-btn:hover {
    color: var(--main-color);
}

button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-size: inherit;
    color: inherit;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
}

.hidden {
    display: none;
}

/* Background drawing layer (background.js) */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 1;
    z-index: -1;
    background-image: var(--bg-image, none);
    background-position: var(--bg-position, center);
    background-size: var(--bg-size, auto);
    background-repeat: no-repeat;
    background-blend-mode: var(--bg-blend, normal);
}

/* ==========================================================================
   Custom cursor
   ========================================================================== */

.custom-cursor {
    position: fixed;
    width: 5px;
    height: 5px;
    background-color: black;
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
}

body.cursor-hidden * {
    cursor: none !important;
}

body.cursor-hidden .biography-container:not(.hidden) {
    cursor: w-resize !important;
}

body.cursor-hidden .item-carousel div {
    cursor: w-resize !important;
}

body.cursor-hidden .item-carousel div:last-child {
    cursor: e-resize !important;
}

body.bio-images-off * {
    cursor: none !important;
}

body.bio-images-off .topbar {
    pointer-events: none;
}

.biography-container.images-off,
.biography-container.images-off * {
    cursor: none !important;
}

/* ==========================================================================
   Topbars
   ========================================================================== */

.topbar,
.bio-topbar {
    width: 100vw;
    position: relative;
    padding-top: var(--small-padding);
    padding-left: var(--small-padding);
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    pointer-events: none;
}

.topbar {
    z-index: 99;
}

.topbar .location {
    padding: var(--button-padding);
}

.biography-container .bio-topbar {
    align-self: flex-start;
    z-index: 1410;
}

.topbar button,
.bio-topbar button {
    pointer-events: auto;
}

.topbar .name-btn,
.bio-topbar .name-btn {
    text-align: left;
    width: 14vw;
    z-index: 250;
    padding: var(--button-padding);
}

.topbar .menu,
.bio-topbar .menu {
    width: 85vw;
    padding: 0;
}

/* The outer topbar is inert while the biography modal is open.
   visibility keeps its space in the flow, so nothing shifts on close. */
body.bio-open .topbar {
    visibility: hidden;
}

/* Both toggles stay in the layout at all times and are only made
   invisible — the topbars have no fixed height, so removing a button
   would change their height and push everything below it. */

/* Drawings toggle: only a filter other than "All" brings it out. */
.drawings-toggle-btn {
    display: block;
    visibility: hidden;
    color: var(--main-color);
}

body:has(.filter-btn.active:not([data-filter="all"])):not(.bio-open) .drawings-toggle-btn {
    visibility: visible;
}

/* Images toggle: button.js sets .visible while the modal is open. */
.img-toggle-btn {
    display: block;
    visibility: hidden;
    color: var(--main-color);
}

.img-toggle-btn.visible {
    visibility: visible;
}

/* ==========================================================================
   Biography modal
   ========================================================================== */

.biography-container,
.biography-container.hidden {
    display: none;
}

.biography-container:not(.hidden) {
    width: 100vw;
    height: 100vh;
    background-color: white;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-y: scroll;
    scrollbar-width: none;
    -ms-overflow-style: none;
    cursor: w-resize;
}

.biography-container::-webkit-scrollbar {
    display: none;
}

.biography {
    position: relative;
    width: 70vw;
    margin: auto 0;          /* centres in the space left by the bio-topbar */
    pointer-events: none;
    z-index: 201;
}

.biography p,
.biography a {
    pointer-events: auto;
}

/* --- carousel ------------------------------------------------------------ */

.biography-carousel {
    display: none;           /* off unless .visible is set by button.js */
}

.biography-carousel.visible {
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: auto;
}

.biography-carousel img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    opacity: 0;
}

.biography-carousel img.active {
    opacity: 1;
}

/* ==========================================================================
   Main — filters and list
   ========================================================================== */

main {
    width: 100vw;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start !important;
    align-content: flex-start !important;
    justify-content: center;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.filters {
    width: 70vw;
    padding-top: var(--padding);
    padding-bottom: var(--padding);
    display: flex;
    justify-content: space-evenly;
    margin-bottom: 0;
    position: relative;
    z-index: 50;
    pointer-events: none;    /* the padding must not swallow clicks */
}

.filter-btn {
    pointer-events: auto;
}

.filter-btn.active span,
.filter-btn.clicked span,
.bio.active {
    border-bottom: 1px solid black;
    padding-bottom: var(--button-padding);
}

main .list-grid {
    width: 70vw;
    display: grid;
    grid-template-columns: 10vw 1fr;
    row-gap: 0.5rem;
}

.col1,
.col2,
.col3 {
    padding-right: 1rem;
}

/* Only items carrying a link, description or image react to the cursor */
.list-grid .col2.clickable {
    cursor: pointer;
}

.list-grid .col2.clickable:hover {
    color: var(--main-color);
}

/* Once the drawer is open the title stops reacting —
   from then on each link highlights on its own (global a:hover) */
.list-grid .col2.clickable.open:hover {
    color: inherit;
}

.col-link {
    padding-bottom: 0.5rem;
}

.col-link p {
    margin-bottom: 0 !important;
}

.col-link a {
    border-bottom: 1px solid currentColor;
    padding-bottom: 1px;
    text-decoration: none;
}

img + p {
    font-size: 0.75rem;
    margin-top: 0.25rem;
    margin-bottom: 10vh;
}

/* ==========================================================================
   Credit
   ========================================================================== */

.credit {
    width: 100vw;
    margin: 0 auto;
    font-size: 0.8rem;
    padding: var(--small-padding);
    text-align: start;
}

/* Hidden whenever a filter other than "All" is active */
body:has(.filter-btn.active:not([data-filter="all"])) .credit {
    display: none;
}

.col-link {
    display: block;
    padding-bottom: 0.5rem;
}

.col2.clickable {
    color: inherit;
}

body.bio-open main,
body.bio-open .credit {
    visibility: hidden;
}
