garage44.eu/jeroen/cartopolis

logclone: git clone https://garage44.eu/jeroen/cartopolis.git

.. /crates/atlas/web/src/css/depth.css

raw

/*
 * Glass and depth: the page as a lit scene rather than flat paint.
 *
 * One light, from above. Every surface is a pane of glass over a faintly
 * coloured page: a translucent fill, a blur of what is behind it, a rim of
 * light along its top edge and a soft shadow under it. Every button is a thing
 * standing on that pane: lit on top, shaded underneath, lifting under the
 * pointer and sinking when pressed. Fields are the reverse — wells pressed into
 * the glass — so "type here" and "press this" are told apart by shape before
 * colour.
 *
 * The client draws the same thing in egui (`theme.rs`: GLASS over a blur for
 * what floats over the map, a light rim and a drop shadow on its buttons).
 * Every colour here is a token from `theme.css`, generated from that file.
 */

/* ── The page behind the glass ───────────────────────────────────────────────
   A glass panel over a flat colour is just a slightly different flat colour,
   and soft glows are too even to change that. What a blur needs is structure,
   so the page is a street map: Groningen's centre, the canal ring in the
   middle, drawn in one faint ink (`img/groningen.svg`, real OpenStreetMap
   geometry). The file is a mask and the colour is a token, so it follows the
   theme. It sits on a fixed layer behind everything, which is why the page
   colour moves from `body` to `html`. */

html,
html[data-theme] {
    background: var(--m-bg);
}

body {
    background: transparent;
}

/* Sized to the *large* viewport, not to `inset: 0`, so the map stays put.
   `cover` rescales the drawing whenever its box changes, and `inset: 0` is a
   box that changes all the time: a phone's address bar sliding in and out
   (the dynamic viewport), and a desktop scrollbar appearing or going between
   one page and the next (the box loses its width). Both moved the streets
   under the glass. `100vw` includes the scrollbar and `100lvh` is the height
   with the browser's bars retracted, so neither of those changes it — only a
   real resize of the window does. */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    height: 100lvh;
    z-index: -1;
    pointer-events: none;
    background: var(--c-map);
    -webkit-mask: url('/img/groningen.svg') center / cover no-repeat;
    mask: url('/img/groningen.svg') center / cover no-repeat;
}

.m-shell,
.m-shell__main,
.m-shell__content {
    background: transparent;
}

/* ── Glass ───────────────────────────────────────────────────────────────── */

.m-shell__nav,
.m-shell__context,
.m-shell__header,
.page-header {
    background: var(--c-glass-soft);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border-color: var(--c-rim);
}

.m-shell__nav {
    box-shadow: inset -1px 0 0 var(--c-highlight);
}

/* Once the nav and the context are drawers over the page (the shell's own
   breakpoint), they take the denser glass: through the soft one the list
   beneath read as a blur of buttons behind the form. */
@container m-shell (width < 1100px) {
    .m-shell__context {
        background: var(--c-glass);
    }
}

@container m-shell (width < 720px) {
    .m-shell__nav {
        background: var(--c-glass);
    }
}

/* Inside the nav pane already: no second sheet of glass. */
.m-shell__nav-head,
.m-shell__nav-foot {
    background: transparent;
    border-color: var(--c-rim);
}

.m-card,
.record,
.m-dialog,
.m-toast,
.m-alert,
.empty {
    background: var(--c-glass-soft);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border: 1px solid var(--c-rim);
    box-shadow:
        inset 0 1px 0 var(--c-highlight),
        0 2px 6px var(--c-shade),
        0 8px 24px -8px var(--m-shadow-color);
}

.m-card,
.record {
    border-radius: var(--m-radius-lg);
}

.m-card__foot {
    background: transparent;
    border-top-color: var(--c-rim);
}

.m-dialog {
    box-shadow:
        inset 0 1px 0 var(--c-highlight),
        0 24px 64px -16px var(--m-shadow-color),
        0 2px 6px var(--c-shade);
}

.m-dialog::backdrop {
    backdrop-filter: blur(6px);
}

.empty {
    border-style: dashed;
    box-shadow: none;
}

/* A list row is a pane you can pick up. */
.record {
    transition:
        transform var(--m-duration) var(--m-ease),
        box-shadow var(--m-duration) var(--m-ease),
        border-color var(--m-duration) var(--m-ease);

    &:hover:not(.is-disabled) {
        border-color: var(--c-rim-strong);
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 var(--c-highlight),
            0 2px 4px var(--c-shade),
            0 18px 36px -16px var(--m-shadow-color);
    }

    &.is-selected {
        border-color: var(--m-accent);
        box-shadow:
            inset 3px 0 0 var(--m-accent),
            inset 0 1px 0 var(--c-highlight),
            0 0 0 1px var(--m-accent),
            0 12px 32px -12px var(--c-glow);
    }
}

/* ── Buttons: things standing on the glass ───────────────────────────────── */

.m-button {
    background:
        linear-gradient(180deg, var(--c-highlight), transparent 70%),
        var(--bg);
    border-color: var(--border);
    box-shadow:
        inset 0 1px 0 var(--c-rim-strong),
        inset 0 -1px 0 var(--c-shade),
        0 1px 2px var(--c-shade),
        0 4px 12px -6px var(--m-shadow-color);

    &:hover:not(:disabled, [aria-disabled='true']) {
        background:
            linear-gradient(180deg, var(--c-highlight), transparent 70%),
            var(--bg-hover);
        transform: translateY(-1px);
        box-shadow:
            inset 0 1px 0 var(--c-rim-strong),
            inset 0 -1px 0 var(--c-shade),
            0 2px 4px var(--c-shade),
            0 10px 20px -8px var(--m-shadow-color);
    }

    &:active:not(:disabled, [aria-disabled='true']) {
        transform: translateY(1px);
        box-shadow:
            inset 0 2px 5px var(--c-shade),
            0 0 0 var(--c-shade);
    }

    &:focus-visible {
        box-shadow:
            inset 0 1px 0 var(--c-rim-strong),
            0 0 0 3px var(--m-focus);
    }

    /* The call to action: a lit teal key, glowing on the glass under it. */
    &[data-variant='primary'] {
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--c-accent-top) 45%, var(--m-accent)) 0%,
            var(--m-accent) 55%,
            var(--c-accent-bottom) 100%
        );
        border-color: var(--c-accent-bottom);
        box-shadow:
            inset 0 1px 0 var(--c-accent-top),
            inset 0 -1px 0 var(--c-accent-bottom),
            0 1px 2px var(--c-shade),
            0 8px 22px -8px var(--c-glow);

        &:hover:not(:disabled, [aria-disabled='true']) {
            background: linear-gradient(
                180deg,
                color-mix(in srgb, var(--c-accent-top) 65%, var(--m-accent)) 0%,
                var(--m-accent) 60%,
                var(--c-accent-bottom) 100%
            );
            box-shadow:
                inset 0 1px 0 var(--c-accent-top),
                inset 0 -1px 0 var(--c-accent-bottom),
                0 2px 4px var(--c-shade),
                0 14px 30px -10px var(--c-glow);
        }

        &:active:not(:disabled, [aria-disabled='true']) {
            background: linear-gradient(180deg, var(--c-accent-bottom), var(--m-accent));
            box-shadow:
                inset 0 2px 6px var(--c-shade),
                0 4px 12px -8px var(--c-glow);
        }

        &:disabled,
        &[aria-disabled='true'] {
            box-shadow: none;
        }
    }

    /* A quiet key: an etched outline of glass at rest, so it still reads as
       something to press, and the full lift under the pointer. */
    &[data-variant='ghost'] {
        background: transparent;
        /* The border, not the rim: a white rim on a light page is no edge. */
        border-color: var(--m-border);
        box-shadow: inset 0 1px 0 var(--c-highlight);

        &:hover:not(:disabled, [aria-disabled='true']) {
            background:
                linear-gradient(180deg, var(--c-highlight), transparent 70%),
                var(--c-glass-soft);
            border-color: var(--c-rim-strong);
            box-shadow:
                inset 0 1px 0 var(--c-rim-strong),
                0 1px 2px var(--c-shade),
                0 8px 18px -8px var(--m-shadow-color);
        }
    }

    &:disabled,
    &[aria-disabled='true'] {
        box-shadow: none;
    }
}

/* ── Fields: wells pressed into the glass ────────────────────────────────── */

.m-input,
.m-select {
    box-shadow:
        inset 0 1px 3px var(--c-shade),
        0 1px 0 var(--c-highlight);

    &:focus-within {
        box-shadow:
            inset 0 1px 3px var(--c-shade),
            0 0 0 3px var(--m-focus),
            0 0 18px -4px var(--c-glow);
    }
}

.m-checkbox,
.m-radio {
    box-shadow: inset 0 1px 2px var(--c-shade);

    &:checked,
    &:indeterminate {
        background: linear-gradient(180deg, var(--c-accent-top), var(--m-accent) 60%);
        box-shadow:
            inset 0 1px 0 var(--c-accent-top),
            0 0 10px -2px var(--c-glow);
    }
}

/* ── Choosers: a recessed track, a raised thumb ─────────────────────────── */

.m-segmented,
.m-theme-switch {
    background: var(--m-surface-sunken);
    border-color: var(--c-rim);
    box-shadow:
        inset 0 1px 3px var(--c-shade),
        0 1px 0 var(--c-highlight);
}

.m-segmented__label {
    :checked + & {
        background: linear-gradient(
            180deg,
            color-mix(in srgb, var(--c-accent-top) 45%, var(--m-accent)),
            var(--m-accent) 60%
        );
        color: var(--m-on-accent);
        box-shadow:
            inset 0 1px 0 var(--c-accent-top),
            0 1px 2px var(--c-shade),
            0 4px 12px -4px var(--c-glow);
    }
}

.m-theme-switch__option[aria-checked='true'] {
    background:
        linear-gradient(180deg, var(--c-highlight), transparent 70%),
        var(--m-surface-raised);
    color: var(--m-accent-text);
    box-shadow:
        inset 0 1px 0 var(--c-rim-strong),
        0 1px 2px var(--c-shade),
        0 3px 8px -2px var(--m-shadow-color);
}

/* ── Navigation ──────────────────────────────────────────────────────────── */

.m-nav-item {
    transition:
        background var(--m-duration) var(--m-ease),
        color var(--m-duration) var(--m-ease),
        box-shadow var(--m-duration) var(--m-ease);

    &:hover {
        background: var(--c-glass-soft);
        box-shadow: inset 0 1px 0 var(--c-highlight);
    }

    /* The live page: a lit pane with a glowing teal edge. */
    &[aria-current='page'] {
        background: linear-gradient(90deg, var(--m-accent-soft), var(--c-glass-soft));
        box-shadow:
            inset 3px 0 0 var(--m-accent),
            inset 0 1px 0 var(--c-highlight),
            0 1px 2px var(--c-shade),
            -2px 0 14px -4px var(--c-glow);
    }
}

/* ── Small things ────────────────────────────────────────────────────────── */

.m-badge {
    border: 1px solid color-mix(in srgb, var(--tone) 22%, transparent);
}

/* A toned tag is flat: its soft fill and nothing else, as the midas hub and
   the client's facts (`contacts::fact`) draw it. The rim and highlight it had
   made every label read as a button. A plain one keeps its rim, which is all
   that marks it out on a card. */
.m-badge:not([data-tone='neutral']) {
    border-color: transparent;
}

/* ── The chat ────────────────────────────────────────────────────────────────
   Panes of glass over the page: the rail, the list, the conversation, the
   call and the thread. The conversation used to sit bare on the page, and its
   lines then read straight over the streets — flat, and harder to read than
   anything on glass. It is a lighter pane than the list beside it, so the map
   still shows through where the talking is. */

.chat,
.chat-signin {
    background: transparent;
}

.chat-rail,
.chat-side,
.chat-thread,
.chat-main,
.chat-call {
    background: var(--c-glass-soft);
    backdrop-filter: blur(22px) saturate(1.5);
    -webkit-backdrop-filter: blur(22px) saturate(1.5);
    border-color: var(--c-rim);
}

.chat-main {
    background: color-mix(in srgb, var(--c-glass-soft) 70%, transparent);
    box-shadow: inset 0 1px 0 var(--c-highlight);
}

.chat-call {
    border-left: 1px solid var(--c-rim);
    box-shadow: inset 1px 0 0 var(--c-highlight);
}

.chat.is-call-focus .chat-call {
    border-left: none;
}

.chat.is-call-focus .chat-main {
    border-left: 1px solid var(--c-rim);
}

.chat-rail {
    background: var(--m-surface-sunken);
    box-shadow: inset -1px 0 0 var(--c-highlight);
}

.chat-side-head,
.chat-side-foot,
.chat-head {
    border-color: var(--c-rim);
}

/* A workspace tile is a key on the rail. */
.chat-ws {
    background:
        linear-gradient(180deg, var(--c-highlight), transparent 70%),
        var(--m-surface-raised);
    box-shadow:
        inset 0 1px 0 var(--c-rim-strong),
        inset 0 -1px 0 var(--c-shade),
        0 2px 6px var(--c-shade);
    transition:
        transform var(--m-duration) var(--m-ease),
        box-shadow var(--m-duration) var(--m-ease);

    &:hover {
        transform: translateY(-1px);
    }

    &.is-current {
        box-shadow:
            0 0 0 2px var(--m-surface-sunken),
            0 0 0 4px var(--m-accent),
            0 0 18px -2px var(--c-glow);
    }
}

.chat-item {
    transition:
        background var(--m-duration) var(--m-ease),
        box-shadow var(--m-duration) var(--m-ease);

    &:hover:not(:disabled) {
        background: var(--c-glass-soft);
        box-shadow: inset 0 1px 0 var(--c-highlight);
    }

    &.is-current {
        background: linear-gradient(90deg, var(--m-accent-soft), var(--c-glass-soft));
        box-shadow:
            inset 3px 0 0 var(--m-accent),
            inset 0 1px 0 var(--c-highlight),
            -2px 0 14px -4px var(--c-glow);
    }
}

.chat-status {
    box-shadow: inset 0 -1px 0 var(--c-rim);
}

/* Popovers: the hover actions and the emoji tray. */
.chat-actions,
.chat-more-emoji > div {
    background: var(--c-glass);
    backdrop-filter: blur(18px) saturate(1.5);
    -webkit-backdrop-filter: blur(18px) saturate(1.5);
    border-color: var(--c-rim);
    box-shadow:
        inset 0 1px 0 var(--c-highlight),
        0 10px 28px -10px var(--m-shadow-color);
}

/* The composer is a well, like a field. */
.chat-composer {
    background: var(--m-control-bg);
    border-color: var(--m-border-strong);
    box-shadow:
        inset 0 1px 3px var(--c-shade),
        0 1px 0 var(--c-highlight);
    transition: box-shadow var(--m-duration) var(--m-ease);

    &:focus-within {
        border-color: var(--m-accent);
        box-shadow:
            inset 0 1px 3px var(--c-shade),
            0 0 0 3px var(--m-focus),
            0 0 22px -6px var(--c-glow);
    }
}