/**
 * Slot mark: the brand's status mark. An empty slot (four corners) means
 * "waiting", a slot with a piece in it means "in place". Replaces check
 * marks, green dots and progress bars. Always next to a word: the mark alone
 * does not carry the meaning. Project block (PPL Logistiikka).
 *
 * Class: slot-mark on an empty inline element (a span in a headline or in the
 * form confirmation message), or drawn by another block on a pseudo-element
 * with the same variables (step-cards does this for its steps, the form's
 * size-choice for its choices: css/forms-brand.css).
 *
 * States and variants:
 *   is-filled            the piece is in the slot
 *   slot-mark--parcel    the piece is a small parcel square, not a pallet
 *   slot-mark--large     84 x 56 px
 *
 * Everything is one background stack: eight corner gradients and the piece
 * as a ninth layer, so a pseudo-element can be a slot mark. The piece drops
 * in from above (registered properties; without @property it just appears).
 *
 * Variables:
 *   --slot-mark-clr      corner color when filled (accent)
 *   --slot-piece-clr     piece color (heading color; parcel: --pak-clr)
 */

@property --slot-piece {
    syntax: "<color>";
    inherits: true;
    initial-value: transparent;
}

@property --slot-drop {
    syntax: "<length>";
    inherits: true;
    initial-value: 0px;
}

.slot-mark,
.step-card::before,
.size-choice ul li label::after {
    --c: var(--border-clr);
    --t: 2px;
    --a: 8px;
    --slot-inset: 5px;
    --slot-piece: transparent;
    --slot-drop: -8px;
    --slot-piece-w: calc(100% - var(--slot-inset) * 2);
    --slot-piece-h: calc(100% - var(--slot-inset) * 2);
    --slot-piece-x: var(--slot-inset);
    display: inline-block;
    flex: none;
    width: 36px;
    height: 24px;
    vertical-align: middle;
    background:
        linear-gradient(var(--c) 0 0) left top / var(--a) var(--t), linear-gradient(var(--c) 0 0) left top / var(--t) var(--a),
        linear-gradient(var(--c) 0 0) right top / var(--a) var(--t), linear-gradient(var(--c) 0 0) right top / var(--t) var(--a),
        linear-gradient(var(--c) 0 0) left bottom / var(--a) var(--t), linear-gradient(var(--c) 0 0) left bottom / var(--t) var(--a),
        linear-gradient(var(--c) 0 0) right bottom / var(--a) var(--t), linear-gradient(var(--c) 0 0) right bottom / var(--t) var(--a),
        linear-gradient(var(--slot-piece) 0 0) left var(--slot-piece-x) bottom calc(var(--slot-inset) - var(--slot-drop)) / var(--slot-piece-w) var(--slot-piece-h);
    background-repeat: no-repeat;
    transition: --slot-piece 0.2s, --slot-drop 0.4s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.slot-mark.is-filled,
.size-choice ul li input:checked + label::after,
.step-card.is-done::before,
html:not(.js) .step-card::before {
    --c: var(--slot-mark-clr, var(--accent-clr));
    --slot-piece: var(--slot-piece-clr, var(--heading-clr));
    --slot-drop: 0px;
}

.slot-mark--parcel,
.size-choice ul li.choice-2 label::after,
.step-cards--parcels .step-card::before {
    --slot-piece-clr: var(--pak-clr);
    --slot-piece-w: 9px;
    --slot-piece-h: 9px;
}

.slot-mark--large {
    --t: 4px;
    --a: 16px;
    --slot-inset: 11px;
    --slot-drop: -18px;
    width: 84px;
    height: 56px;
}

.slot-mark--large.slot-mark--parcel {
    --slot-piece-w: 20px;
    --slot-piece-h: 20px;
}

@media (prefers-reduced-motion: reduce) {
    .slot-mark,
    .step-card::before {
        transition: none;
    }
}
