/* ==========================================================================
   FOAMS — dynamic layer
   Everything that moves lives here; css/foams.css keeps the base look.
   ========================================================================== */

/* the site is always black on white (also when the phone is in dark mode).
   The colour goes on <body>, so project pages (.projectpage = black) can
   paint the whole window, margins included. */
:root {
    color-scheme: light;
}

body {
    background: white;
}

:root {
    --reveal-time: 900ms;
    --reveal-distance: 28px;
    --ease-out: cubic-bezier(.2, .7, .2, 1);
}


/* --- Intro loader: "foams" decodes letter by letter ---------------------- */

.loader {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    pointer-events: none;
    transition: opacity 600ms ease;
}

.loader.is-done {
    opacity: 0;
}

.decode-text {
    font-size: 30px;
    text-align: center;
}

.text-animation {
    display: inline-block;
    position: relative;
    color: transparent;
}

.text-animation::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 1.2em;
    background: #0e182d;
    transform: translate(-50%, -55%);
}

.text-animation.state-1::before { width: 1px; }
.text-animation.state-2::before { width: 0.9em; }
.text-animation.state-3 { color: black; }
.text-animation.state-3::before { width: 0; }


/* --- Pixel confetti canvas ----------------------------------------------- */

.confetti {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    mix-blend-mode: multiply;
}


/* --- Feed: reveal on scroll, filtering ------------------------------------ */

.js-reveal .feed-thumb {
    opacity: 0;
    transform: translateY(var(--reveal-distance));
    transition: opacity var(--reveal-time) ease, transform var(--reveal-time) var(--ease-out);
}

.js-reveal .feed-thumb.is-in {
    opacity: 1;
    transform: none;
}

.js-reveal .feed-thumb.no-transition {
    transition: none;
}

.feed-thumb.is-hidden {
    display: none;
}

/* the feed and its looping copy are at least one screen tall, so the jump
   from the copy back to the original is invisible even with few items */
#feed,
.feed-clone {
    min-height: 100vh;
    box-sizing: border-box;
}

.feed-thumb img {
    transition: filter 400ms ease;
}

/* empty spacer cells keep their width but have no content */
.feed-thumb.spacer {
    pointer-events: none;
}


/* --- Fixed controls: filter / reset / shuffle ---------------------------- */

.feed-controls {
    position: fixed;
    left: 20px;
    bottom: 40px;
    z-index: 5;
}

.feed-controls-text {
    display: flex;
    gap: 0.6em;
}

.ctl,
.filter-option,
.filter-close,
.filter-show {
    font: inherit;
    color: black;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.ctl,
.filter-option {
    border-bottom: 2px solid transparent;
    transition: border 250ms ease;
}

.ctl:hover,
.ctl:focus-visible,
.ctl.is-active {
    border-color: black;
}


/* --- Filter panel -------------------------------------------------------- */

.filter-panel {
    position: fixed;
    inset: 0;
    z-index: 6;
    overflow: auto;
    padding: 6vw;
    background: rgba(255, 255, 255, 0.94);
    display: flex;
    flex-direction: column;
    justify-content: center;
    opacity: 0;
    transition: opacity 300ms ease;
}

.filter-panel[hidden] {
    display: none;
}

.filter-panel.is-open {
    opacity: 1;
}

.filter-groups {
    font-size: 1.5em;
    line-height: 1.25;
    max-width: 66em;
}

@media screen and (min-width: 48em) {
    .filter-groups {
        font-size: 2.5em;
    }
}

.filter-group {
    margin-bottom: 0.9em;
}

.filter-label {
    margin: 0 0 0.2em;
    font-family: "univers-light", "Helvetica", "Arial", sans-serif;
    font-size: 0.35em;
    letter-spacing: 0.05em;
}

.filter-option {
    margin-right: 0.25em;
}

.filter-option:hover,
.filter-option:focus-visible,
.filter-option.is-active {
    border-color: black;
}

.filter-option sup {
    font-size: 0.35em;
    margin-left: 0.1em;
}

.filter-close {
    position: absolute;
    top: 0.5em;
    right: 0.75em;
    font-size: 3em;
    line-height: 1;
}

.filter-show {
    align-self: flex-start;
    font-size: 1.5em;
    margin-top: 0.5em;
    border-bottom: 2px solid black;
}


/* --- Project pages ------------------------------------------------------- */

.projectpage {
    cursor: url(../icons/cursor.png) 25 25, auto;
}

.projectpage .line {
    background-color: white;
}

.projectpage a,
.projectpage a:hover,
.projectpage a:focus,
.projectpage a:active {
    color: white;
}

.projectpage a:hover,
.projectpage a:focus {
    border-color: white;
}


/* --- Project list -------------------------------------------------------- */

.project-list-page {
    margin-top: 0;
}

.project-list-page .foams-header.fixed-logo {
    top: 50vh;
}

.project-list-wrap:hover .project-thumbnail {
    display: block;
}

.project-list-nolink .project-list-wrap {
    cursor: default;
}


/* --- Accessibility: people who ask for less motion get a still page ------ */

@media (prefers-reduced-motion: reduce) {
    .js-reveal .feed-thumb {
        opacity: 1;
        transform: none;
        transition: none;
    }
}
