/* A magoo's state on its card: web.includes.magoo-state. Three slots that
   keep their place; data-slot picks the icon pair and data-on which half of
   it, so a state change is one attribute and no markup. */

/* Sized by the card rather than the screen: the same card is a column on
   a phone and one of several on a desktop. */
.magoo-state-row {
    container-type: inline-size;
    display: flex;
    gap: 6px;
    width: 100%;
}

.magoo-state {
    display: inline-flex;
    flex: 1 1 auto;
    min-width: 0;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 34px;
    padding: 0 10px;
    border: 0;
    border-radius: 17px;
    background-color: var(--state-bg);
    color: var(--state-fg);
    font-family: 'roboto-medium';
    font-size: 13px;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .15s ease, color .15s ease, opacity .15s ease;
}

.magoo-state:disabled {
    cursor: default;
}

.magoo-state:focus-visible {
    outline: 2px solid var(--state-fg);
    outline-offset: 2px;
}

.magoo-state-row[aria-busy="true"] .magoo-state {
    opacity: .55;
    pointer-events: none;
}

.magoo-state__label {
    font-family: inherit;
    overflow: hidden;
    text-overflow: ellipsis;
}

.magoo-state__icon {
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    background-color: currentColor;
    -webkit-mask: var(--state-icon) center / contain no-repeat;
    mask: var(--state-icon) center / contain no-repeat;
}

.magoo-state[data-slot="published"][data-on="false"] {
    --state-bg: #F1F1F1;
    --state-fg: #6B6B6B;
    --state-icon: url('../img/magoo-state/draft.svg');
}

.magoo-state[data-slot="published"][data-on="true"] {
    --state-bg: #E8F3FF;
    --state-fg: #1976D2;
    --state-icon: url('../img/magoo-state/published.svg');
}

.magoo-state[data-slot="discoverable"][data-on="true"] {
    --state-bg: #E8F5EC;
    --state-fg: #278A4B;
    --state-icon: url('../img/magoo-state/discoverable.svg');
}

.magoo-state[data-slot="discoverable"][data-on="false"] {
    --state-bg: #FDECEC;
    --state-fg: #D32F2F;
    --state-icon: url('../img/magoo-state/not-discoverable.svg');
}

.magoo-state[data-slot="audience"][data-on="false"] {
    --state-bg: #F3F3F3;
    --state-fg: #555555;
    --state-icon: url('../img/magoo-state/private.svg');
}

.magoo-state[data-slot="audience"][data-on="true"] {
    --state-bg: #F0EAFF;
    --state-fg: #6546C7;
    --state-icon: url('../img/magoo-state/public.svg');
}

/* Only admins can make a magoo transferable, so this sits apart from the
   three states every owner has. */
.magoo-transferable-badge {
    --state-bg: #FDECEC;
    --state-fg: #D32F2F;
    --state-icon: url('../img/magoo-state/transferable.svg');
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 24px;
    padding: 0 10px;
    border-radius: 12px;
    background-color: var(--state-bg);
    color: var(--state-fg);
    font-family: 'roboto-medium';
    font-size: 12px;
    line-height: 1;
    white-space: nowrap;
}

.magoo-transferable-badge .magoo-state__icon {
    width: 14px;
    height: 14px;
}

@container (max-width: 380px) {
    .magoo-state {
        gap: 4px;
        padding: 0 7px;
        font-size: 12px;
    }

    .magoo-state__icon {
        width: 14px;
        height: 14px;
    }
}

@container (max-width: 320px) {
    .magoo-state {
        gap: 3px;
        padding: 0 6px;
        font-size: 11px;
    }

    .magoo-state__icon {
        width: 12px;
        height: 12px;
    }
}
