/**
 * Brand icons: the eight icons of the brand as inline SVG that builds itself
 * when it scrolls into view. The ink parts (the structure) wipe in one after
 * another, then the accent part (the thing that is moved or looked at) lands
 * in its place, the same motion as the slot mark. Project block (PPL
 * Logistiikka).
 *
 * Class: brand-icon--<name> on a block; includes/blocks/brand-icons.php
 * prints the SVG as the block's first child on the front end (the editor
 * shows the block without the icon).
 *   names: slot, pallet, parcel, shelf, container, label, door, picking
 *
 * Uses:
 *   .brand-icon.brand-icon--pallet     an empty GB container: a standalone
 *                                      icon, e.g. the first child of a .card
 *   ul.icon-list > li.brand-icon--…    core list with an icon per row (the
 *                                      class goes on each list item)
 *
 * js/blocks/brand-icons.js adds .is-drawn to the SVG when it is on screen
 * and sets --n, the icon's order among its siblings, so a row of icons
 * builds from the first to the last. Without the script or with reduced
 * motion the icons are simply there.
 *
 * Variables:
 *   --brand-icon-size   48px (list rows: 32px)
 */

.brand-icon-svg {
    display: block;
    flex: none;
    width: var(--brand-icon-size, 48px);
    height: var(--brand-icon-size, 48px);
}

.brand-icon-ink {
    fill: var(--heading-clr);
}

.brand-icon-accent {
    fill: var(--accent-clr);
}

.gb-container.brand-icon {
    margin-bottom: 14px;
}

/* ---- List with an icon per row ---- */
ul.icon-list {
    --brand-icon-size: 32px;
    display: grid;
    grid-template-columns: 1fr;
    gap: 0 48px;
    margin: 0;
    padding: 0;
    list-style: none;
}

ul.icon-list > li {
    position: relative;
    min-height: calc(var(--brand-icon-size) + 28px);
    padding: 14px 0 14px calc(var(--brand-icon-size) + 16px);
    border-top: 1px solid var(--border-clr);
    font-size: 0.95em;
}

ul.icon-list > li > .brand-icon-svg {
    position: absolute;
    left: 0;
    top: 14px;
}

ul.icon-list small {
    display: block;
    margin-top: 2px;
    font-size: 0.9em;
}

/* ---- Build ---- */
@media (prefers-reduced-motion: no-preference) {
    .js .brand-icon-svg .brand-icon-wipes {
        clip-path: inset(0 100% 0 0);
    }

    .js .brand-icon-svg .brand-icon-wipes--up {
        clip-path: inset(100% 0 0 0);
    }

    .js .brand-icon-svg .brand-icon-lands {
        opacity: 0;
        transform: translateY(-8px);
    }

    .js .brand-icon-svg.is-drawn .brand-icon-wipes {
        clip-path: inset(0);
        transition: clip-path 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) calc(var(--n, 0) * 0.14s + var(--i) * 0.08s);
    }

    .js .brand-icon-svg.is-drawn .brand-icon-lands {
        opacity: 1;
        transform: none;
        transition:
            transform 0.45s cubic-bezier(0.2, 0.7, 0.2, 1) calc(var(--n, 0) * 0.14s + var(--i) * 0.08s + 0.2s),
            opacity 0.2s calc(var(--n, 0) * 0.14s + var(--i) * 0.08s + 0.2s);
    }
}

@media (min-width: 768px) {
    ul.icon-list--2 {
        grid-template-columns: 1fr 1fr;
    }
}
