/* ---------- portfolio: per-year reference index over full-bleed media ---------- */

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body.portfolio {
    background: var(--cat-bg);
    color: var(--cat-ink);
    font-family: var(--body-font, var(--sans));
    font-size: 16px;
    line-height: 1.4;
    overflow: hidden;                 /* the listing scrolls, not the body */
    --gutter: clamp(1.2rem, 6vw, 5rem);  /* left/right margin; text + search align to it */
}
a { color: inherit; text-decoration: none; }

/* ---- full-bleed background preview ---- */
.backgroundPreview { position: fixed; inset: 0; z-index: 0; background: var(--cat-bg); }
.backgroundPreview img,
.backgroundPreview video {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; opacity: 0; transition: opacity 0.4s ease;
}
.backgroundPreview img.show, .backgroundPreview video.show { opacity: 1; }

/* ---- analog effect layers (compositor-only; over the image, under the scrim) ---- */
.fx { position: absolute; inset: 0; pointer-events: none; }

/* lens vignette — gives the full-bleed image a "through a lens" falloff */
.fx-vignette { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 52%, rgba(0,0,0,0.5) 100%); }

/* VHS scanlines: faint + static. A wide tracking band sweeps ONCE when JS adds
   .sweep (rare). The brightness flicker/focus pulls are driven in JS on the image. */
.fx-bands {
    background: repeating-linear-gradient(0deg,
        rgba(0,0,0,0.05) 0px, rgba(0,0,0,0.05) 1px,
        rgba(255,255,255,0.012) 2px, rgba(255,255,255,0.012) 3px);
    background-size: 100% 3px;
    mix-blend-mode: multiply; opacity: 0.4;
}
.fx-bands::after {
    content: ""; position: absolute; left: 0; right: 0; height: 16%;
    background: linear-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0.07) 50%, rgba(255,255,255,0) 100%);
    transform: translateY(-30%); opacity: 0;
}
.fx-bands.sweep::after { animation: vhsTrack 0.9s linear; }
@keyframes vhsTrack { 0% { transform: translateY(-30%); opacity: 1; } 100% { transform: translateY(640%); opacity: 1; } }

/* film grain — faint, static fractal-noise texture */
.fx-grain {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
    background-size: 180px 180px; opacity: 0.04; mix-blend-mode: overlay;
}
.fx-flicker { display: none; }   /* flicker now handled in JS (rare, on the image) */
.fx-grain.surge { animation: grainSurge 1.1s ease; }
@keyframes grainSurge { 0%,100% { opacity: 0.04; } 50% { opacity: 0.13; } }

/* lens vignette + an iris pulse (darken for a beat) */
.fx-vignette.pulse { animation: irisPulse 1.1s ease; }
@keyframes irisPulse {
    0%,100% { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 52%, rgba(0,0,0,0.5) 100%); }
    50%     { background: radial-gradient(ellipse at center, rgba(0,0,0,0) 36%, rgba(0,0,0,0.66) 100%); }
}

/* film light leak — warm wash blooms from an edge then fades */
.fx-leak { opacity: 0; background: radial-gradient(120% 80% at 100% 0%, rgba(255,150,40,0.5), rgba(255,90,30,0.18) 35%, transparent 60%); mix-blend-mode: screen; }
.fx-leak.on { animation: leak 1.4s ease; }
@keyframes leak { 0% { opacity: 0; } 35% { opacity: 0.7; } 100% { opacity: 0; } }

/* projector cue dot (cigarette burn) — small ring top-right, a couple of frames */
.fx-cue { opacity: 0; }
.fx-cue::after { content: ""; position: absolute; top: 7%; right: 8%; width: 46px; height: 46px; border-radius: 50%;
    background: radial-gradient(circle, rgba(0,0,0,0.55) 0 38%, rgba(255,255,255,0.85) 42% 52%, transparent 56%); }
.fx-cue.on { animation: cue 0.9s steps(1); }
@keyframes cue { 0%,18% { opacity: 0; } 19%,30% { opacity: 1; } 31%,72% { opacity: 0; } 73%,84% { opacity: 1; } 85%,100% { opacity: 0; } }

/* VHS head-switch — torn, jittered noise strip at the very bottom */
.fx-headswitch { opacity: 0; }
.fx-headswitch::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4%;
    background: repeating-linear-gradient(90deg, rgba(255,255,255,0.5) 0 2px, rgba(0,0,0,0.4) 2px 5px, rgba(255,255,255,0.2) 5px 7px);
    filter: blur(0.4px); }
.fx-headswitch.on { animation: headsw 0.5s steps(4); }
@keyframes headsw { 0% { opacity: 0; transform: translateX(0); } 10%,90% { opacity: 0.85; } 100% { opacity: 0; transform: translateX(-6px); } }

/* CRT hum bar — soft bright band rolls slowly up the frame once */
.fx-hum { opacity: 0; }
.fx-hum::after { content: ""; position: absolute; left: 0; right: 0; height: 30%;
    background: linear-gradient(rgba(255,255,255,0) 0%, rgba(255,255,255,0.06) 50%, rgba(255,255,255,0) 100%); }
.fx-hum.on { opacity: 1; animation: hum 1.4s linear; }
.fx-hum.on::after { animation: humRoll 1.4s linear; }
@keyframes hum { 0%,100% { opacity: 1; } }
@keyframes humRoll { from { transform: translateY(130%); } to { transform: translateY(-130%); } }

/* film scratches — thin vertical lines flicker briefly */
.fx-scratch { opacity: 0; background: repeating-linear-gradient(90deg, transparent 0 7%, rgba(255,255,255,0.12) 7.1%, transparent 7.3% 14%); }
.fx-scratch.on { animation: scratch 0.7s steps(3); }
@keyframes scratch { 0%,100% { opacity: 0; } 20% { opacity: 0.5; } 55% { opacity: 0.2; } 80% { opacity: 0.4; } }

/* tape dropout — a few bright speckles flash */
.fx-dropout { opacity: 0;
    background-image: radial-gradient(2px 2px at 20% 30%, #fff, transparent), radial-gradient(2px 2px at 70% 60%, #fff, transparent),
        radial-gradient(1px 1px at 45% 80%, #fff, transparent), radial-gradient(2px 2px at 85% 25%, #fff, transparent),
        radial-gradient(1px 1px at 30% 65%, #fff, transparent); }
.fx-dropout.on { animation: dropout 0.5s steps(2); }
@keyframes dropout { 0%,100% { opacity: 0; } 25% { opacity: 0.8; } 60% { opacity: 0.3; } }

@media (prefers-reduced-motion: reduce) {
    .fx-bands::after, .fx-headswitch.on, .fx-scratch.on, .fx-dropout.on, .fx-hum.on, .fx-hum.on::after { animation: none; }
}

/* readability scrim between image and text */
body.portfolio::after {
    content: ""; position: fixed; inset: 0; z-index: 1; pointer-events: none;
}
body.align-left::after   { background: var(--cat-scrim-left); }
body.align-center::after { background: var(--cat-scrim-center); }

/* ---- scrolling listing ---- */
.ref-listing {
    position: relative; z-index: 2; height: 100%;
    overflow-y: auto; scroll-behavior: smooth;
    padding: 14vh var(--gutter) 42vh;
}
body.align-center .ref-listing { text-align: center; }

.ref-masthead {
    font-weight: 200; letter-spacing: 0.04em;
    font-size: clamp(1.3rem, 2.6vw, 1.9rem);
    color: var(--cat-ink); margin-bottom: 2.4rem;
    text-shadow: 0 1px 6px rgba(0,0,0,0.6);
}
.ref-masthead span { color: var(--cat-ink-dim); }

.year-group { margin: 0 0 1.8rem; }
body.align-center .year-group { max-width: 70ch; margin-left: auto; margin-right: auto; }
.year-marker { margin: 1.4rem 0 0.55rem; }
.year-marker span {
    font-size: 1.15rem; color: var(--cat-ink); letter-spacing: 0.12em;
    text-shadow: 0 1px 5px rgba(0,0,0,0.6);
}

.year-entries { list-style: none; }
.ref-entry { margin: 0.1rem 0; }
.ref-row { display: flex; align-items: flex-end; gap: 0.6rem; cursor: pointer; padding: 0.28em 0; }
body.align-center .ref-row { text-align: left; }

.ref-title {
    font-family: var(--sans); font-weight: 200; letter-spacing: 0.04em;
    font-size: clamp(0.95rem, 1.6vw, 1.25rem); line-height: 1.2;
    flex: 0 1 auto;                       /* take needed width, wrap long titles instead of clipping */
    color: var(--cat-ink-dim); text-shadow: 0 1px 6px rgba(0,0,0,0.6);
    transition: color 0.25s;
    text-transform: lowercase;            /* net.art voice — titles are lowercase, not Title Case */
}
.ref-leader {
    flex: 1 1 2rem; margin-bottom: 0.3em; min-width: 1.5rem;
    border-bottom: 1px dotted rgba(243,239,230,0.32);
}
.ref-endlabel {
    display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; justify-content: flex-end;
    flex: 0 0 auto; text-align: right; margin-bottom: 0.18em; max-width: 45%;
}
.class-tag, .endlabel-collab {
    font-family: var(--sans); font-weight: 200; letter-spacing: 0.04em;
    font-size: clamp(0.72rem, 1.2vw, 0.92rem);
    color: var(--cat-ink-dim); text-shadow: 0 1px 6px rgba(0,0,0,0.6);
    transition: color 0.25s;
    /* keep each material/collaborator label to a single line — a long descriptive
       "material" sentence truncates with an ellipsis instead of wrapping and
       knocking the title/leader out of alignment. Full text shows on the work page. */
    min-width: 0; max-width: 100%; white-space: nowrap;
    overflow: hidden; text-overflow: ellipsis;
}
.endlabel-collab { font-style: italic; }

/* active (drives background) + hover/open brighten */
.ref-entry.active .ref-title,
.ref-entry.active .class-tag,
.ref-entry.active .endlabel-collab { color: var(--cat-ink); }
.ref-entry.active .ref-row:hover .ref-title,
.ref-entry.open  .ref-title { color: #fff; }
.ref-entry.open  .ref-title::after { content: " ›"; color: var(--accent); }
@media (hover: hover) {
    .ref-row:hover .ref-title { color: var(--cat-ink); }
}

/* ---- expand: image beside text, full width when the viewport allows ---- */
.ref-detail {
    padding: 0.6rem 0 1.6rem; max-width: none; width: 100%;
    display: grid; grid-template-columns: 1fr; gap: 1.4rem 2rem;
    animation: refUnfold 0.28s ease;
}
@media (min-width: 820px) {
    /* text stays aligned with the listing text on the left; the image aligns to
       the RIGHT EDGE of the screen (cancels the listing's right gutter). */
    .ref-detail.has-media { display: flex; gap: 2rem; align-items: flex-start; justify-content: space-between; }
    .ref-detail.has-media .ref-detail-text { flex: 0 1 44ch; }
    .ref-detail.has-media .ref-detail-media {
        flex: 0 0 auto; max-width: 52vw; text-align: right;
        margin-right: calc(-1 * var(--gutter));   /* reach the viewport's right edge */
    }
    .ref-detail.has-media .ref-detail-media .slideshow { display: inline-block; max-width: 100%; }
}
@keyframes refUnfold { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.ref-detail-text { min-width: 0; }
.ref-detail-media { min-width: 0; }
.ref-blurb { max-width: 70ch; }
.ref-openhint { font-size: 0.8rem; color: var(--cat-ink-dim); margin-bottom: 0.6rem; letter-spacing: 0.03em; }
.show-works { list-style: none; margin: 0; }
.show-works li { margin: 0.15rem 0; }
.show-works a { color: var(--cat-ink); text-shadow: 0 1px 6px rgba(0,0,0,0.6); }
.show-works a:hover { color: #fff; text-decoration: underline; }
.ref-credit {
    font-size: 0.9rem; font-style: italic; color: rgba(243,239,230,0.78);
    text-shadow: 0 1px 5px rgba(0,0,0,0.6); margin-bottom: 0.7rem;
}
.ref-blurb {
    font-size: 0.95rem; line-height: 1.55; color: rgba(243,239,230,0.82);
    text-shadow: 0 1px 5px rgba(0,0,0,0.6); margin-bottom: 0.9rem;
}
.ref-blurb em { color: #fff; font-style: italic; }
.slideshow { max-width: 100%; }
.slide-frame { position: relative; display: inline-block; line-height: 0; max-width: 100%; background: transparent; }
.slide-frame img { display: block; max-width: 100%; max-height: 70vh; width: auto; height: auto; }
.slide-nav {
    position: absolute; top: 0; bottom: 0; width: 2.6rem; border: none;
    background: rgba(0,0,0,0.25); color: #fff; font-size: 1.8rem; cursor: pointer;
    opacity: 0.7; transition: opacity 0.2s;
}
.slide-nav:hover { opacity: 1; background: rgba(0,0,0,0.45); }
.slide-nav.prev { left: 0; } .slide-nav.next { right: 0; }
.slide-dots { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.slide-dots .dot {
    width: 0.55rem; height: 0.55rem; border-radius: 50%; padding: 0; cursor: pointer;
    border: 1px solid rgba(243,239,230,0.6); background: transparent;
}
.slide-dots .dot.on { background: rgba(243,239,230,0.9); }
.ref-open {
    margin-top: 1rem; background: none; font: inherit; font-size: 1rem;
    color: var(--cat-ink); cursor: pointer; text-shadow: 0 1px 5px rgba(0,0,0,0.6);
    border: 1px solid var(--cat-ink-dim); padding: 0.4rem 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}
.ref-open:hover { border-color: var(--cat-ink); background: rgba(243,239,230,0.08); }
.ref-open .arr { color: var(--accent); }

/* ---- mobile slot-machine centre line ---- */
.slot-line { display: none; }
@media (hover: none) {
    .ref-listing { padding-top: 50vh; padding-bottom: 55vh; scroll-snap-type: y proximity; }
    .ref-entry { scroll-snap-align: center; }
    /* selection marker: not a full line across, just a minimal arrow/tick on each side edge */
    .slot-line {
        display: block; position: fixed; left: 0; right: 0; top: 50%; z-index: 3;
        pointer-events: none;
    }
    .slot-line::before, .slot-line::after {
        position: absolute; top: 0; transform: translateY(-50%);
        color: var(--cat-ink); opacity: 0.55; font-size: 0.85rem; line-height: 1;
        text-shadow: 0 1px 3px #000;
    }
    .slot-line::before { content: '▸'; left: 0.4rem; }
    .slot-line::after  { content: '◂'; right: 0.4rem; }
    body.has-open .slot-line { display: none; }
}

/* ---- nav ---- */
.toggleNav {
    position: fixed; top: 0.7rem; left: calc(var(--gutter) / 2); transform: translateX(-50%);
    z-index: 12; background: none; border: none; color: var(--cat-ink);
    font-size: 1.6rem; cursor: pointer; text-shadow: 0 1px 4px #000; line-height: 1;
}
/* transparent search bubble, left edge aligned with the listing text */
.siteSearch {
    position: fixed; top: 0.7rem; left: var(--gutter); z-index: 12;
    width: 9rem; padding: 0.18rem 0.8rem;
    background: rgba(243,239,230,0.07);
    border: 1px solid rgba(243,239,230,0.25); border-radius: 999px;
    color: var(--cat-ink); font: inherit; font-size: 1rem;
    text-shadow: 0 1px 4px #000;
    transition: width 0.25s, background 0.25s, border-color 0.25s;
}
.siteSearch::placeholder { color: var(--cat-ink-dim); }
.siteSearch:focus { outline: none; width: 16rem; background: rgba(243,239,230,0.14); border-color: rgba(243,239,230,0.5); }
.agentDot { position: fixed; top: 0.55rem; left: calc(var(--gutter) + 9.6rem); z-index: 12; color: var(--accent); font-size: 1.4rem; text-shadow: 0 1px 4px #000; }
@media (max-width: 560px) { .siteSearch { width: 6.5rem; } .siteSearch:focus { width: 10rem; } }
.sideMenu {
    position: fixed; inset: 0; z-index: 20; background: #0a0806;
    overflow-y: auto; padding: 4rem 2rem; transition: opacity 0.25s, visibility 0s 0s;
}
.sideMenu.hidden { opacity: 0; visibility: hidden; transition: opacity 0.25s, visibility 0s 0.25s; }
.sideMenu a { display: block; text-align: center; padding: 0.45rem 0; font-size: 1.25rem; color: var(--cat-ink); }
.sideMenu a:hover { color: #fff; }
.menu-note { font-size: 0.55em; letter-spacing: 0.06em; opacity: 0.45; margin-left: 0.4em; vertical-align: baseline; }
.closeNav { position: absolute; top: 0.6rem; right: 1rem; background: none; border: none; color: var(--cat-ink); font-size: 1.8rem; cursor: pointer; }

/* ---- filter banner ---- */
.filter-banner {
    position: fixed; top: 0; left: 0; right: 0; z-index: 12; text-align: center;
    padding: 0.5rem; background: rgba(0,0,0,0.5); font-size: 0.9rem;
}
.filter-banner a { color: var(--accent); }
