/* How a person chooses (`window.Picker`, picker.js; docs/design-system.md, Pickers): one root,
   `.picker`, and a surface named on it, `data-surface="popover"`. The items are drawn by what draws
   them everywhere else; this sheet draws the picker around them. */
.picker {
    position: relative;
    display: block;
    min-width: 0;
    font-weight: 600;
}

/* The select a popover stands in for keeps the value and the form's checks, out of sight. */
.picker > .picker-native {
    position: absolute;
    inset: auto auto 0 0;
    width: 1px;
    min-width: 0;
    height: 1px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* The popover surface: a field that shows the choice, a panel with the search over the list. */
.picker .picker-field {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
    min-height: 46px;
    padding: 7px 12px;
    border: 2px solid var(--ink-border);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 3px 3px 0 var(--ink-shadow);
    color: var(--text-dark);
    font: inherit;
    font-size: .95rem;
    text-align: left;
    transform: none;
}
.picker .picker-field:hover:not(:disabled) { background: var(--bg-subtle); transform: none; }
.picker .picker-field:focus-visible { outline: 3px solid #8e6bd8; outline-offset: 2px; }
.picker .picker-field:disabled { cursor: default; opacity: .6; box-shadow: none; }
.picker-choice { display: flex; min-width: 0; }
.picker-placeholder { opacity: .65; }
.picker-field .picker-caret {
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    margin-top: -4px;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transform: rotate(45deg);
}
.picker-field[aria-expanded="true"] .picker-caret { margin-top: 4px; transform: rotate(-135deg); }

.picker-panel {
    position: absolute;
    z-index: 40;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    min-width: min(280px, calc(100vw - 32px));
    padding: 8px;
    border: 2px solid var(--ink-border);
    border-radius: 12px;
    background: var(--white);
    box-shadow: 4px 4px 0 var(--ink-shadow);
    /* Its own colours: a dark page (a booster being opened) would otherwise lend it light text,
       so it takes the theme's ink, which is drawn for its surface. */
    color: var(--text-dark);
    text-align: left;
}
.picker-panel[hidden] { display: none; }
/* In the top layer it is placed by the script, against the viewport. */
.picker-panel:popover-open { position: fixed; inset: auto; margin: 0; overflow: visible; }
.picker .picker-search {
    box-sizing: border-box;
    width: 100%;
    margin: 0 0 6px;
    padding: 8px 10px;
    border: 2px solid var(--ink-border);
    border-radius: 8px;
    box-shadow: none;
    font: inherit;
    font-size: .9rem;
    transform: none;
}
.picker-options {
    display: grid;
    gap: 2px;
    max-height: 240px;
    margin: 0;
    padding: 0;
    overflow-y: auto;
    list-style: none;
}
.picker-option {
    display: flex;
    align-items: center;
    min-height: 40px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
}
.picker-option.is-active { background: var(--pastel-purple-light); }
.picker-option[aria-selected="true"] { box-shadow: inset 3px 0 0 #8e6bd8; }
.picker-option.is-typed { font-weight: 800; overflow-wrap: anywhere; }
.picker-none { padding: 10px 8px; font-size: .85rem; opacity: .7; }
/* A small heading over each group, when there are two. */
.picker-section { padding: 8px 8px 2px; font-size: .72rem; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; opacity: .7; }

/* A choice made in place of a typed name (`create`), or what was typed used as it is (`other`). */
.picker-option.is-new { font-weight: 800; }
/* The list under a button (`Picker.anchored`): the panel is all there is. */
.picker-panel.is-anchored { z-index: 50; }
/* Without the Popover API the panel sits in the body: against the viewport all the same. */
.picker-panel.is-anchored:not(:popover-open) { position: fixed; }
.picker-panel.is-anchored .picker-option { gap: 8px; }
.picker-panel.is-anchored .picker-option img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

/* The field of chips (`Picker.tokens`): the chips and the input share one box, the list opens under it. */
.picker-tokens {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 6px;
    border: 2px solid var(--ink-border);
    border-radius: 10px;
    background: var(--white);
    cursor: text;
}
.picker-tokens:focus-within { outline: 3px solid #8050ca; outline-offset: 2px; }
.picker-chips { display: contents; }
.picker-token {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 2px 3px 2px 10px;
    border: 2px solid var(--ink-border);
    border-radius: 20px;
    background: var(--pastel-purple);
    font-size: .74rem;
    font-weight: 900;
}
.picker[data-kind="tag"] .picker-token { background: var(--pastel-blue); }
.picker .picker-token button {
    display: grid;
    place-items: center;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    box-shadow: none;
    font: inherit;
    font-size: .95rem;
    line-height: 1;
    cursor: pointer;
}
.picker .picker-token button:hover { background: rgb(37 37 45 / .12); }
.picker .picker-token-input {
    flex: 1 1 140px;
    min-width: 120px;
    padding: 5px 6px;
    border: 0;
    box-shadow: none;
    outline: none;
    font: inherit;
}

/* The inline surface: items pressed in place under a toolbar, by groups that fold or in one row. */
.picker[data-surface="inline"] { display: grid; gap: 12px; color: var(--text-dark); }
.picker [hidden] { display: none !important; }
.picker-toolbar { position: sticky; top: calc(var(--shell-pad-top) + 16px); z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border: 3px solid var(--ink-border); border-radius: 12px; background: var(--white); box-shadow: 3px 3px 0 var(--ink-shadow); }
.picker-summary { margin-right: auto; font-size: .86rem; }
.picker-toolbar input[type="search"], .picker-toolbar select { min-width: 0; padding: 7px 9px; border: 2px solid var(--ink-border); border-radius: 8px; background: var(--white); font: 650 .8rem 'Sora', sans-serif; }
.picker-toolbar input[type="search"] { flex: 0 1 200px; }
.picker-controls { display: contents; }
.picker-odds { display: inline-flex; align-items: center; gap: 6px; font-size: .78rem; font-weight: 900; cursor: pointer; }
.picker[data-surface="inline"] button.secondary { padding: 7px 11px; font-size: .76rem; }
.picker .picker-empty { margin: 0; padding: 18px; border: 3px dashed #bdb7c6; border-radius: 12px; text-align: center; font-weight: 650; }

/* Groups: one row per group, its items underneath, folded or not. */
.picker-groups { display: grid; gap: 8px; }
.picker-group { border: 2px solid var(--ink-border); border-radius: 12px; background: var(--white); }
.picker-group.has-choices { background: var(--bg-subtle); }
.picker-group header { display: flex; align-items: center; gap: 10px; padding: 6px 10px; }
.picker-group header input[type="checkbox"] { width: 18px; height: 18px; margin: 0; accent-color: #8050ca; }
.picker .picker-group-toggle, .picker-group-name { display: flex; flex: 1; align-items: center; justify-content: flex-start; gap: 10px; padding: 6px 4px; border: 0; background: transparent; box-shadow: none; color: inherit; font: inherit; text-align: left; }
.picker .picker-group-toggle { cursor: pointer; }
.picker-group-toggle strong, .picker-group-name strong { font-size: .92rem; }
.picker-group-toggle small, .picker-group-name small { padding: 2px 8px; border-radius: 12px; background: var(--muted-gray); font-size: .7rem; font-weight: 900; }
.picker-group-toggle .picker-caret { width: auto; height: auto; margin: 0 0 0 auto; border: 0; transform: none; transition: transform .15s; }
.picker-group-toggle[aria-expanded="false"] .picker-caret { transform: rotate(-90deg); }
html.motion-reduced .picker-group-toggle .picker-caret { transition: none; }
.picker-items { display: flex; flex-wrap: wrap; gap: 6px; }
.picker-group .picker-items { padding: 4px 12px 12px; }
.picker-chip-wrap { display: inline-flex; align-items: center; gap: 4px; }
.picker-after:empty { display: none; }
.picker .picker-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 2px solid #aaa3b0; border-radius: 20px; background: var(--white); box-shadow: none; color: var(--text-dark); font: 800 .74rem 'Sora', sans-serif; cursor: pointer; transform: none; }
.picker .picker-chip small { padding: 0 5px; border-radius: 8px; background: var(--muted-gray); font-size: .64rem; }
.picker .picker-chip[aria-pressed="true"] { border-color: var(--ink-border); background: var(--pastel-purple); box-shadow: 2px 2px 0 var(--ink-shadow); }
.picker .picker-chip[aria-pressed="true"] small { background: var(--white); }
.picker .picker-chip.is-off { opacity: .55; }
.picker .picker-chip:disabled { cursor: default; }
.picker .picker-chip:focus-visible { outline: 3px solid #8050ca; outline-offset: 2px; }
.picker-weight { width: 62px; padding: 3px 5px; border: 2px solid var(--ink-border); border-radius: 6px; font: 700 .72rem 'Sora', sans-serif; }

@media (max-width: 760px) {
    .picker-toolbar input[type="search"] { flex: 1 1 100%; }
}

/* A style's sample picture on its chip (#1089). */
.picker .picker-chip .style-sample { flex: 0 0 auto; width: 30px; height: 37px; margin: -2px 0 -2px -4px; border: 1.5px solid var(--ink-border); border-radius: 6px; object-fit: cover; animation: style-sample-in 320ms ease-out both; }
.picker .picker-chip:has(.style-sample) { border-radius: 12px; }
@keyframes style-sample-in { from { opacity: 0; transform: scale(0.85); } to { opacity: 1; transform: none; } }
/* The sample shown large over the page while its chip is hovered or focused (set-form.js). */
.style-sample-preview { position: fixed; z-index: 1000; width: 360px; aspect-ratio: 832 / 1023; border: 3px solid var(--ink-border); border-radius: 12px; background: var(--white); box-shadow: 5px 5px 0 var(--ink-shadow); object-fit: cover; pointer-events: none; opacity: 0; visibility: hidden; }
.style-sample-preview.is-shown { opacity: 1; visibility: visible; animation: style-sample-preview-in 180ms ease-out; }
@keyframes style-sample-preview-in { from { opacity: 0; transform: translateY(6px) scale(.94); } to { opacity: 1; transform: none; } }
