/* ---- Fonts ---- */
@font-face {
    font-family: 'Bricolage Grotesque';
    src: url('../assets/fonts/Bricolage_Grotesque/BricolageGrotesque-VariableFont_opsz,wdth,wght.ttf') format('truetype-variations');
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
}

/* ---- Reset ---- */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    /* Kept in sync with the fixed nav's real rendered height by js/nav.js;
       this is just a sane fallback before that first measurement lands. */
    --nav-h: 5rem;
}

html, body {
    width: 100%;
}

body {
    min-height: 100vh;
    font-family: system-ui, sans-serif;
    background: #000;
    color: #fff;
}

/* ---- Home view ---- */
.home-view {
    display: flex;
    min-height: 100vh;
    align-items: flex-start;
    justify-content: center;
    overflow: hidden;
    padding-top: calc(var(--nav-h) + -5.0rem);
}

/* ---- Object grid ---- */
.object-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    row-gap: 0.5em;
    column-gap: 2em;
    padding: 3em;
    background-color: #000;
    background-image: radial-gradient(oklch(1 0 0 / 0.1) 1px, transparent 1px);
    background-size: 5em 5em;
    background-position: center;
    border-radius: 1.8em;
    width: clamp(34rem, 78vw, 96rem);
    font-size: clamp(0.34rem, 0.95vw, 1.05rem);
}

/* ---- Objects ---- */
.object-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    gap: 0.5em;
    border-radius: 0.9em;
    text-decoration: none;
    color: inherit;
    user-select: none;
    transition: scale 100ms ease-in-out;
}

.object-item:active { scale: 0.97; }

.object-item:focus-visible {
    outline: max(1px, 0.2em) solid oklch(var(--item-color));
    outline-offset: max(1px, 0.2em);
}

.object-art-wrap {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    height: 19em;
    width: 100%;
}

.object-art {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    filter: invert(1);
    transition: transform 150ms ease-in-out, filter 150ms ease-in-out;
}

/* Per-object scale tweaks — the shared bounding box doesn't read as equal size across every silhouette */
.object-item[data-id="works"] .object-art {
    max-width: 70%;
    max-height: 70%;
    margin-bottom: 1.6em;
}

.object-item[data-id="about"] .object-art {
    max-width: 60%;
    max-height: 60%;
    margin-bottom: 1.6em;
}

.object-item[data-id="teaching"] .object-art {
    max-width: 65%;
    max-height: 65%;
    margin-bottom: 1.6em;
}

.object-item[data-id="moonmist"] .object-art {
    max-width: 62%;
    max-height: 62%;
    margin-bottom: 1.6em;
}

.object-item[data-id="experiments"] .object-art {
    max-width: 70%;
    max-height: 70%;
    margin-bottom: 1.6em;
}

.object-item[data-id="archive"] .object-art {
    max-width: 70%;
    max-height: 70%;
    margin-bottom: 1.6em;
}

.object-tape {
    height: 2.6em;
    width: auto;
    flex-shrink: 0;
    filter: invert(1);
}

/* Reached state: set by JS on hover, tap, and idle-arm-reach alike, so all three read the same */
.object-item.is-reaching .object-art {
    transform: scale(1.05) rotate(-1deg);
    filter: invert(1) drop-shadow(0 0 0.4em oklch(var(--item-color) / 0.55));
}

/* ---- Arm ---- */
.arm {
    position: absolute;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translate(-50%, -100%) translate(var(--arm-tx, 0px), var(--arm-ty, -5%));
    z-index: 3;
    pointer-events: none;
    user-select: none;
    transition: transform 300ms ease-in-out;
    transition-delay: 300ms;
}

/* ---- Mobile: 2×3 layout, sized to fit one screen without scrolling ---- */
@media (max-width: 640px) {
    .home-view {
        min-height: 100dvh;
        padding-top: calc(var(--nav-h) + -2.0rem);
    }

    .object-grid {
        grid-template-columns: repeat(2, 1fr);
        width: clamp(18rem, 94vw, 30rem);
        font-size: clamp(0.5rem, 2.8vw, 0.78rem);
        row-gap: 0.6em;
        column-gap: 1.5em;
        padding: 1em;
    }

    .object-art-wrap {
        height: 14.0em;
    }

    .object-tape {
        height: 2.4em;
    }

    /* Same specificity as the per-item overrides above, wins on source order — scales the desktop art-to-tape gap down for mobile */
    .object-item[data-id] .object-art {
        margin-bottom: 0.8em;
    }
}

/* ---- Content views (gallery / item / prose) ---- */
.content-view {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: calc(var(--nav-h) + 2rem) 2rem 4rem;
}

.content {
    max-width: 60rem;
    margin: 0 auto;
    width: 100%;
}

.content h1 {
    font-size: 2rem;
    font-weight: 400;
    letter-spacing: 0.02em;
}

.content a {
    color: oklch(0.85 0 0);
    font-weight: 700;
    text-decoration: underline;
    transition: color 150ms ease;
}

.content a:hover {
    color: #fff;
}

/* ---- Site nav (persistent across all pages) ---- */
.site-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
    padding: 1.2rem 1.5rem 1rem;
}

/* Solid backdrop: only on pages that scroll content underneath the nav (category.html) */
.site-nav--solid {
    background: #000;
    border-bottom: 1px solid oklch(0.15 0 0);
}

.site-name {
    color: oklch(0.85 0 0);
    text-decoration: none;
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 3rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    transition: color 150ms ease;
}

.site-name:hover {
    color: #fff;
}

.category-label {
    color: oklch(0.45 0 0);
    text-decoration: none;
    font-family: 'Bricolage Grotesque', system-ui, sans-serif;
    font-size: 2rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    transition: color 150ms ease;
}

.category-label:hover {
    color: oklch(0.8 0 0);
}

.category-label--static {
    cursor: default;
}

.category-label--static:hover {
    color: oklch(0.45 0 0);
}

.category-label[hidden] {
    display: none;
}
