/* ===========================================================================
   soup.css — the bowl.

   The front page is a bowl of soup with the site floating in it. Every page is
   a thing you can see from the doorway and click; nothing is behind a lid, a
   stair, or a corridor.

   This replaces the box. The box was a lovely object and the wrong front door:
   it asked you to open it before it would tell you what was inside, and what
   was inside was the labyrinth, which asked for more patience again. A bowl
   asks for nothing. You look down into it and the whole site is already there.

   The gallery is still here — it is one of the things floating in the soup,
   and it says plainly that it is the strange way round. It is no longer the
   toll gate on the way to a drum machine.
   =========================================================================== */

:root {
    --soup-rim:    #2b1b52;
    --soup-rim-lit:#6a4fd8;
    --soup-deep:   #150a2e;
}

/* ===== the stage ===== */
#soup {
    position: relative;
    /* The third term is the fit: the bowl never grows taller than the room the
       hero has left after the wordmark and the tagline, so nothing is pushed
       off the bottom of a short window. aspect-ratio turns width into height,
       so the cap is written as a width. */
    --soup-squash: .68;
    --soup-reserve: 384px;
    width: min(92vw, 880px, calc((100vh - var(--soup-reserve)) / var(--soup-squash)));
    margin: 0 auto;
    /* The pieces are sized in cqw against this box, so a narrower bowl holds
       smaller pieces and the composition stays the composition instead of
       collapsing into a pile. */
    container-type: inline-size;
    /* The bowl is an ellipse seen from above and in front, so its box is wide
       and short; the rim and the body hang below it. */
    aspect-ratio: 1 / var(--soup-squash);
    z-index: 3;
}

/* Without JS the bowl never builds, so the links are in the page already and
   this is what is left: a plain list of everywhere, which is no worse than
   most front pages and a great deal better than an empty box. */
.soup-fallback {
    list-style: none; margin: 2rem auto 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: .5rem; justify-content: center;
}
.soup-fallback a {
    display: block; padding: .6rem 1rem; text-decoration: none;
    border: 1px solid rgba(155,123,255,.4); border-radius: 999px;
    color: var(--lucid-accent, #9b7bff);
    font-family: var(--lucid-mono, ui-monospace, Menlo, monospace);
    font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
}
.soup-fallback a:hover { background: rgba(138,224,75,.14); border-color: rgba(138,224,75,.7); color: #d9ffb8; }
#soup.built .soup-fallback { display: none; }

/* ===== the vessel =====
   Rim, body and broth are three ellipses stacked. The body is the rim pushed
   down and darkened; nothing here is an image. */
.bowl {
    position: absolute; left: 0; right: 0; top: 0;
    height: 78%;
    transform-origin: 50% 40%;
    transition: transform .62s cubic-bezier(.6,0,.85,.3), filter .62s ease;
}
.bowl-body {
    position: absolute; left: 3%; right: 3%; top: 16%;
    height: 110%;
    border-radius: 50% 50% 46% 46% / 34% 34% 62% 62%;
    background:
        linear-gradient(180deg, #38246b 0%, #1d1038 46%, #0b0618 100%);
    box-shadow: 0 44px 90px rgba(0,0,0,.6), inset 0 -24px 60px rgba(0,0,0,.55);
}
/* The light down one side, so it is a vessel and not a sticker. */
.bowl-body::after {
    content: ''; position: absolute; left: 8%; top: 18%; width: 26%; height: 44%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(176,150,255,.26), transparent 72%);
    filter: blur(6px);
}
.bowl-rim {
    position: absolute; inset: 0;
    border-radius: 50%;
    background: linear-gradient(170deg, var(--soup-rim-lit), var(--soup-rim) 58%, #1a1033);
    box-shadow: 0 0 60px rgba(123, 86, 230,.28);
}

/* ===== the broth =====
   A canvas clipped to the ellipse. soup.js draws a domain-warped swirl into
   it; the gradient underneath is what shows if WebGL is unavailable, and it is
   deliberately not a flat colour so that case still looks like soup. */
.bowl-broth {
    position: absolute; inset: 3.2%;
    border-radius: 50%;
    overflow: hidden;
    background:
        radial-gradient(60% 70% at 32% 30%, rgba(212,79,176,.55), transparent 70%),
        radial-gradient(70% 80% at 72% 64%, rgba(138,224,75,.34), transparent 72%),
        radial-gradient(90% 90% at 50% 50%, #3a1d6e, var(--soup-deep) 78%);
    box-shadow: inset 0 8px 26px rgba(0,0,0,.42), inset 0 -6px 26px rgba(176,150,255,.14);
}
.bowl-broth canvas {
    position: absolute; inset: -2%;
    width: 104%; height: 104%;
    display: block;
}
/* The meniscus: the broth is brighter where it meets the rim. */
.bowl-sheen {
    position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
    background:
        radial-gradient(closest-side, transparent 72%, rgba(190,165,255,.22) 93%, transparent),
        radial-gradient(44% 38% at 36% 24%, rgba(255,255,255,.14), transparent 70%);
    mix-blend-mode: screen;
}

/* ===== steam ===== */
.steam {
    position: absolute; left: 50%; top: -6%;
    width: 46%; height: 60%;
    transform: translateX(-50%);
    pointer-events: none; opacity: .5;
}
.steam i {
    position: absolute; bottom: 0;
    width: 24%; height: 100%;
    border-radius: 50%;
    background: linear-gradient(0deg, rgba(190,165,255,.32), transparent 76%);
    filter: blur(14px);
    /* Linear in time: steam does not speed up and slow down, it is the curl
       in the path that makes it look alive. */
    animation: steamCurl 8s linear infinite;
}
.steam i:nth-child(1) { left: 4%;  animation-duration: 9.2s; }
.steam i:nth-child(2) { left: 30%; animation-duration: 7.4s; animation-delay: -2.6s; animation-name: steamCurl2; }
.steam i:nth-child(3) { left: 56%; animation-duration: 10.1s; animation-delay: -5.1s; }
.steam i:nth-child(4) { left: 18%; animation-duration: 8.6s; animation-delay: -6.8s; animation-name: steamCurl2; opacity: .7; }
.steam i:nth-child(5) { left: 72%; animation-duration: 7.9s; animation-delay: -1.2s; animation-name: steamCurl2; }
@keyframes steamCurl {
    0%   { transform: translate(0, 14%) scale(.7, .8) rotate(0deg); opacity: 0; }
    20%  { opacity: .8; }
    40%  { transform: translate(-9%, -8%) scale(1, 1) rotate(-6deg); }
    70%  { transform: translate(7%, -28%) scale(1.3, 1.15) rotate(5deg); opacity: .5; }
    100% { transform: translate(-4%, -48%) scale(1.7, 1.3) rotate(-3deg); opacity: 0; }
}
@keyframes steamCurl2 {
    0%   { transform: translate(0, 14%) scale(.7, .8) rotate(0deg); opacity: 0; }
    20%  { opacity: .75; }
    45%  { transform: translate(10%, -10%) scale(1.05, 1) rotate(7deg); }
    75%  { transform: translate(-6%, -31%) scale(1.35, 1.2) rotate(-5deg); opacity: .45; }
    100% { transform: translate(5%, -48%) scale(1.7, 1.3) rotate(2deg); opacity: 0; }
}

/* ===== the things in it ===== */
.bits { position: absolute; inset: 0; }

.bit {
    position: absolute; left: 0; top: 0;
    margin: 0; padding: 0;
    background: none; border: 0;
    font: inherit; color: inherit;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    /* Placement is written here every frame by soup.js as it carries the piece
       round its orbit, so there is deliberately no transform and no transition
       on this element: a transition would fight the frames. The bob and the
       hover lift live on .bit-float, one level in, where they are free to. */
    will-change: transform;
}
.bit:focus { outline: none; }

.bit-float {
    display: flex; flex-direction: column; align-items: center; gap: 5px;
    /* Two independent swells, each a smooth back-and-forth (ease-in-out with
       alternate is as close to a sine wave as CSS gets): heave on `translate`
       and roll on `rotate`, separate properties so neither interrupts the
       other, nor the hover lift on `transform`. */
    animation:
        heave var(--heave, 4s) cubic-bezier(.37, 0, .63, 1) var(--delay, 0s) infinite alternate,
        roll  var(--roll, 6s)  cubic-bezier(.37, 0, .63, 1) var(--delay, 0s) infinite alternate;
    transition: transform .3s cubic-bezier(.2,1.3,.4,1);
}
/* Caught: the piece stops where it is and lifts. Chasing a moving target is
   the single fastest way to make a playful thing annoying. */
.bit:hover .bit-float,
.bit:focus-visible .bit-float { animation-play-state: paused; transform: translateY(-9px) scale(1.14); }

/* Small on purpose: the piece is already travelling round its orbit, and a
   bigger swing carried the outer ring over the rim at the top. */
@keyframes heave {
    from { translate: calc(var(--dx, 4px) * -.5) 2px; }
    to   { translate: calc(var(--dx, 4px) * .5) -5px; }
}
@keyframes roll {
    from { rotate: -3.2deg; }
    to   { rotate: 3.2deg; }
}

.bit-shape {
    position: relative;
    width: var(--d, 76px); height: var(--d, 76px);
    border-radius: 50%;
    display: grid; place-items: center;
    /* Everything sits in liquid, so everything gets the same wet edge. */
    box-shadow: 0 10px 22px rgba(0,0,0,.45), inset 0 2px 7px rgba(255,255,255,.18);
    overflow: hidden;
    background: radial-gradient(70% 70% at 34% 28%, rgba(255,255,255,.3), transparent 62%);
}
/* A thing lying on a surface seen from this angle is foreshortened, so the
   whole disc — piece, meniscus and shadow together — is squashed. This one
   change does more than any amount of shading to put the pieces *on* the broth
   rather than in front of it. */
.bit-disc { position: relative; line-height: 0; transform: scaleY(.86); }

/* What the piece is doing to the soup: a soft dark mass under it where it
   displaces the broth, and the ring of surface tension pulled up around it at
   the waterline. */
.bit-disc::before {
    content: ''; position: absolute; left: 2%; right: 2%; bottom: -16%;
    height: 42%; border-radius: 50%;
    background: radial-gradient(closest-side, rgba(5, 2, 14, .62), transparent 74%);
    filter: blur(5px);
    pointer-events: none;
}
.bit-disc::after {
    content: ''; position: absolute; left: -15%; right: -15%; top: 40%;
    height: 40%; border-radius: 50%;
    border: 1px solid rgba(186, 160, 255, .22);
    border-top-color: rgba(222, 206, 255, .46);
    pointer-events: none;
}

/* And what the soup is doing to the piece: everything below the waterline is
   under it. The layer is taller than the piece so the line can rock without
   dragging a hard edge into view. */
.bit-water {
    position: absolute; left: -12%; right: -12%; top: -14%; height: 128%;
    pointer-events: none;
    background: linear-gradient(180deg,
        transparent 0 57%,
        rgba(214, 196, 255, .52) 57% 58.3%,
        rgba(74, 38, 136, .34) 58.3%,
        rgba(28, 12, 58, .52) 100%);
    /* The surface stays level while the piece tilts (the counter-roll runs
       on the same clock as the roll), and creeps up the piece as it sinks and
       down as it rises (against the heave). */
    animation:
        level  var(--roll, 6s)  cubic-bezier(.37, 0, .63, 1) var(--delay, 0s) infinite alternate,
        lapping var(--heave, 4s) cubic-bezier(.37, 0, .63, 1) var(--delay, 0s) infinite alternate;
}
@keyframes level   { from { rotate: 3.2deg; } to { rotate: -3.2deg; } }
@keyframes lapping { from { translate: 0 -2px; } to { translate: 0 3px; } }

/* Rings spreading out over the surface from where the piece sits, two at a
   time, one per bob. Flattened hard, because the surface is seen edge on. */
.bit-wave {
    position: absolute; inset: 0; pointer-events: none;
    transform: translateY(16%) scaleY(.46);
}
.bit-wave i {
    position: absolute; inset: 0; border-radius: 50%;
    border: 1.5px solid rgba(214, 196, 255, .34);
    opacity: 0;
    animation: wave calc(var(--heave, 4s) * 2) cubic-bezier(.2, .6, .35, 1) var(--delay, 0s) infinite;
}
.bit-wave i + i { animation-delay: calc(var(--delay, 0s) - var(--heave, 4s)); }
@keyframes wave {
    0%   { transform: scale(.92); opacity: 0; }
    12%  { opacity: .6; }
    100% { transform: scale(1.85); opacity: 0; border-width: .5px; }
}
.bit-shape svg { width: 100%; height: 100%; display: block; }

/* An ingredient is its own outline. The circle, the disc gradient and the
   round gloss all belong to the live slots; on a bay leaf they are a plate
   the leaf is served on, which is exactly the thing that made these read as
   app icons rather than as food.

   The shadow goes on the SVG rather than on the box, because drop-shadow()
   follows the alpha channel: the shadow of the leaf is leaf-shaped, and it is
   the cheapest honest way to put something *in* a liquid rather than over it. */
.bit-shape.is-drawn {
    background: none;
    border-radius: 0;
    overflow: visible;
    box-shadow: none;
}
.bit-shape.is-drawn::after { content: none; }
/* The submersion is painted inside the SVG, per ingredient, at that
   ingredient's own depth — a straight band across the box would cut the
   stalks off an enoki bundle at the same height as a pea. */
.bit-shape.is-drawn .bit-water { display: none; }
.bit-shape.is-drawn svg {
    overflow: visible;
    filter: drop-shadow(0 5px 6px rgba(6, 2, 16, .55))
            drop-shadow(0 1px 1px rgba(10, 4, 24, .45));
}
/* The live slots keep the round treatment: a round thing in soup is a slice,
   and a slice is allowed to be a window. */
.bit-shape.is-live { border-radius: 50%; overflow: hidden; }
.bit-shape video, .bit-shape canvas, .bit-shape img {
    position: absolute; inset: 0; width: 100%; height: 100%;
    object-fit: cover; display: block;
}
/* A wet highlight over whatever is inside, live content included. */
.bit-shape::after {
    content: ''; position: absolute; inset: 0; border-radius: 50%;
    background:
        radial-gradient(38% 30% at 32% 22%, rgba(255,255,255,.42), transparent 70%),
        radial-gradient(closest-side, transparent 60%, rgba(0,0,0,.34));
    pointer-events: none;
}

/* The label rides above its piece on a dark pill. Eleven names swirling in one
   ellipse means a name will sometimes sit over something else's face, and the
   pill is what makes that read as a label on a chip rather than a collision. */
.bit-label {
    font-family: var(--lucid-mono, ui-monospace, Menlo, monospace);
    font-size: 10px; letter-spacing: .17em; text-transform: uppercase;
    color: rgba(236,230,255,.9);
    text-shadow: 0 1px 4px rgba(0,0,0,.9);
    white-space: nowrap;
    padding: 3px 9px 4px;
    border-radius: 999px;
    /* The pill is the only thing between this text and a live WebGL scene,
       and the scene is not always dark — against the brightest lilac the
       broth renders, the sub-label below was coming out at 3.1:1. There is
       no way to measure text over a canvas from the DOM, so the pill is made
       opaque enough that the worst case still clears AA: at .86 the name is
       11.7:1 and the sub-label 7.5:1 even over the brightest frame. */
    background: rgba(9, 4, 20, .86);
    -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
    border: 1px solid rgba(155,123,255,.30);
    transition: color .2s ease, background .2s ease, border-color .2s ease, opacity .35s ease;
}
.bit-label small {
    display: block; margin-top: 1px;
    font-size: 8.5px; letter-spacing: .12em;
    color: #b49cff;
    text-transform: none;
}
/* Near the top of its orbit the label would hang over the rim, so it swaps to
   the underside of the piece instead. */
.bit.under .bit-label { order: 2; }
/* Behind something that would print over it even there: step aside. With the
   label above the piece this almost never fires, but almost is not never. */
.bit.behind .bit-label { opacity: 0; }
.bit:hover .bit-label, .bit:focus-visible .bit-label {
    color: #d9ffb8; opacity: 1;
    background: rgba(12, 26, 6, .84); border-color: rgba(138,224,75,.6);
}
.bit:hover .bit-label small, .bit:focus-visible .bit-label small { color: var(--lucid-accent-2, #8ae04b); }

/* The ring the piece makes in the broth when you touch it. Inside .bit-disc,
   so it is centred on the shape wherever the label happens to be. */
.bit-ring {
    position: absolute; inset: 0;
    border: 1px solid rgba(138,224,75,.75); border-radius: 50%;
    opacity: 0; pointer-events: none;
}
.bit:hover .bit-ring, .bit:focus-visible .bit-ring { animation: ripple 1.5s ease-out infinite; }
@keyframes ripple {
    0%   { opacity: .75; transform: scale(.55) scaleY(.4); }
    100% { opacity: 0;   transform: scale(2.1) scaleY(.45); }
}

/* ===== going under ===== */
#soup.diving .bowl {
    transform: scale(var(--dive-scale, 9));
    filter: saturate(1.9) brightness(1.25) blur(2px);
}
#soup.diving .bits, #soup.diving .steam { opacity: 0; transition: opacity .2s linear; }
/* The chosen piece's own flight is written inline by soup.js, because where it
   starts from is wherever its orbit had carried it. */
#soup.diving .bits { opacity: 1; }
#soup.diving .bit:not(.chosen) { opacity: 0 !important; transition: opacity .22s linear; }

/* The broth closing over the top of the screen. */
#soup-veil {
    position: fixed; inset: 0; z-index: 9000; pointer-events: none;
    opacity: 0; transition: opacity .42s ease;
    background:
        radial-gradient(60% 60% at var(--vx, 50%) var(--vy, 50%), rgba(212,79,176,.75), transparent 68%),
        radial-gradient(90% 90% at 50% 50%, #3a1d6e, #0b0618 82%);
}
#soup-veil.on { opacity: 1; }

/* The page's own visualiser is the room the bowl sits in. It is turned down
   while the bowl is on screen, because two psychedelic things competing is one
   psychedelic thing too many. */
body:not(.focused) #visual-canvas { opacity: .36; }

/* ===== where you land =====
   The dive has to arrive somewhere that is still liquid, or it reads as a
   trapdoor. The focused section floats on the broth rather than sitting on a
   flat page: the background keeps moving and the content does not. */
body.focused .hero { display: none; }

/* The broth you landed in.

   It has to be a layer of its own rather than a rule on #visual-canvas: the
   visual engine's sliders write opacity and mix-blend-mode straight onto that
   canvas as inline style, which no stylesheet can outrank, and `screen` makes
   it bright enough to swallow body text whole. So the canvas is left alone and
   this sits over it, under the content. The z-indexes are the whole trick —
   the canvas is z-index 0, so the scrim takes 1 and the page takes 2. */
body.focused::before {
    content: ''; position: fixed; inset: 0; z-index: 1; pointer-events: none;
    background:
        radial-gradient(70% 55% at 22% 12%, rgba(212,79,176,.22), transparent 70%),
        radial-gradient(60% 60% at 82% 78%, rgba(138,224,75,.15), transparent 72%),
        linear-gradient(180deg, rgba(10,5,22,.76), rgba(10,5,22,.91));
}
body.focused #content-wrapper { z-index: 2; }
body.focused section:not([hidden]) { position: relative; z-index: 2; }
/* Surfacing: the page rises through the broth once, then holds still. */
body.focused.soup-arrive section:not([hidden]) { animation: surface .85s cubic-bezier(.2,.9,.25,1) 1; }
@keyframes surface {
    0%   { opacity: 0; transform: translateY(26px) scale(.985); filter: blur(7px); }
    100% { opacity: 1; transform: none; filter: none; }
}

/* ===== phones ===== */
@media (max-width: 640px) {
    /* Nearly square on a phone: you are looking further down into the bowl,
       which is the only way a portrait screen gives eleven things room. */
    #soup { --soup-squash: .98; --soup-reserve: 256px; width: min(96vw, calc((100vh - 256px) / .98)); }
    .bowl { height: 82%; }
    .bit-label { font-size: 8.5px; letter-spacing: .12em; }
    .bit-label small { display: none; }
}

/* Still.

   Driven by a class rather than the media query directly, because the viewer
   is allowed to disagree with their own operating system about this one bowl.
   soup.js puts `lucid-still` on <html> when the OS asks for reduced motion, and
   takes it off again if the viewer stirs the soup themselves. The media query
   is still here underneath so the page is right before the script runs. */
@media (prefers-reduced-motion: reduce) {
    :root:not(.lucid-stirred) .bit-float,
    :root:not(.lucid-stirred) .steam i,
    :root:not(.lucid-stirred) .bit-water,
    :root:not(.lucid-stirred) .bit-ring,
    :root:not(.lucid-stirred) .bit-wave i { animation: none !important; }
    :root:not(.lucid-stirred) .bowl,
    :root:not(.lucid-stirred) .bit-float,
    :root:not(.lucid-stirred) #soup-veil { transition: none !important; }
}
:root.lucid-still .bit-float,
:root.lucid-still .steam i,
:root.lucid-still .bit-water,
:root.lucid-still .bit-ring,
:root.lucid-still .bit-wave i { animation: none !important; }
:root.lucid-still .bowl,
:root.lucid-still .bit-float,
:root.lucid-still #soup-veil { transition: none !important; }
:root.lucid-still body.focused.soup-arrive section:not([hidden]) { animation: none; }
:root.lucid-still .bit:hover .bit-float,
:root.lucid-still .bit:focus-visible .bit-float { transform: scale(1.1); }

/* ===== the spoon =====
   One quiet control under the bowl. It exists because the site stops the soup
   for anyone whose system asks for less motion, which is right as a default and
   wrong as a verdict: someone who wants to watch it turn should be able to say
   so without changing a system-wide accessibility setting, and someone who
   wants it to hold still should be able to say that too. */
#soup-stir {
    /* The bowl fills #soup's box, so this has to be hung off the bottom of it
       rather than laid out after it, or it lands on the broth. */
    position: absolute; left: 50%; bottom: -40px; transform: translateX(-50%);
    white-space: nowrap;
    background: rgba(9, 4, 20, .55);
    border: 1px solid rgba(155,123,255,.22); border-radius: 999px;
    color: rgba(236,230,255,.5);
    font-family: var(--lucid-mono, ui-monospace, Menlo, monospace);
    font-size: 9.5px; letter-spacing: .2em; text-transform: uppercase;
    padding: 7px 15px; cursor: pointer; line-height: 1;
    transition: color .2s, border-color .2s, background .2s, opacity .2s;
    z-index: 4;
}
#soup-stir:hover, #soup-stir:focus-visible {
    color: #d9ffb8; border-color: rgba(138,224,75,.6);
    background: rgba(12, 26, 6, .8); outline: none;
}
@media (max-width: 640px) { #soup-stir { font-size: 9px; padding: 6px 13px; bottom: -34px; } }
