/* <toe-tag-picker>: see toe-tag-picker.js. Uses the site's colours and fonts from app.css. */

toe-tag-picker {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-family: var(--sans);
}

toe-tag-picker[hidden],
.ttp-panel[hidden] {
    display: none;
}

/* Matches the list component's filter buttons. */
.ttp-add {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 8px;
    color: var(--primary);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--button-radius, 4px);
    cursor: pointer;
    transition: color 0.15s, background-color 0.15s, border-color 0.15s;
}

.ttp-add svg {
    display: block;
    width: 18px;
    height: 18px;
    transition: transform 0.15s;
}

/* The button's text, before the "+" (the text attribute). */
.ttp-text {
    margin: 0 2px 0 4px;
    font-family: var(--sans);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
}

.ttp-add:hover {
    border-color: var(--ocean);
}

/* While open, the "+" turns to an "×" that closes the search. */
.ttp-open .ttp-add {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.ttp-open .ttp-add svg {
    transform: rotate(45deg);
}

.ttp-panel {
    position: relative;
}

.ttp-input {
    width: 11rem;
    margin: 0;
    padding: 4px 10px;
    font-size: 0.8125rem;
    line-height: 1.4;
    border-radius: var(--button-radius, 4px);
}

.ttp-input:focus-visible {
    border-color: var(--ocean);
    outline: none;
}

/* Every tag until something is typed, so one can be chosen straight away. */
.ttp-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: min(20rem, calc(100vw - 32px));
    max-height: 16rem;
    margin: 0;
    padding: 4px;
    overflow-y: auto;
    overscroll-behavior: contain;
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--button-radius, 4px);
    box-shadow: 0 10px 28px rgba(22, 32, 43, 0.18);
    z-index: 25;
}

.ttp-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    font-size: 0.875rem;
    line-height: 1.3;
    color: var(--ink);
    border-radius: var(--button-radius, 4px);
    cursor: pointer;
}

.ttp-option:hover,
.ttp-option.ttp-active {
    background: var(--foam);
}

.ttp-swatch {
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 2px;
}

.ttp-name {
    flex: 1;
    font-weight: 500;
}

.ttp-category {
    flex: none;
    font-size: 0.6875rem;
    color: var(--muted);
}

.ttp-none {
    padding: 6px 8px;
    font-size: 0.8125rem;
    color: var(--muted);
}
