#taste {
    --taste-up: var(--blue);
    --taste-down: #945324;
    --taste-down: light-dark(#945324, #efb279);
}

.taste-panel { grid-template-columns: minmax(0, 1.7fr) minmax(15rem, 1fr); }
.taste-chart-column { min-width: 0; }
.taste-controls {
    display: flex;
    flex-wrap: wrap;
    gap: .45rem .65rem;
}

.taste-controls label {
    display: grid;
    gap: .14rem;
    min-width: 0;
    max-width: 100%;
    color: var(--muted);
    font-size: .875rem;
}
.taste-controls select { width: 100%; }
.taste-figure { margin-top: 1.1rem; }
.taste-figure figcaption {
    font-weight: 600;
    font-size: clamp(1.1rem, 2vw, 1.45rem);
    letter-spacing: -.035em;
}

.taste-legend { display: flex; flex-wrap: wrap; gap: .3rem .9rem; margin-top: .4rem; }
.taste-legend span::before {
    display: inline-block;
    width: .6rem;
    height: .6rem;
    margin-right: .35rem;
    border-radius: 50%;
    content: "";
    background: var(--tone);
}
.taste-gain { --tone: var(--taste-up); }
.taste-loss { --tone: var(--taste-down); }
.taste-flat { --tone: var(--muted); }

.taste-plot {
    position: relative;
    display: grid;
    gap: .65rem;
    margin: 1rem .9rem .5rem 2.8rem;
    font-variant-numeric: tabular-nums;
}

.taste-plane {
    --bubble-max: 2.5rem;
    position: relative;
    height: clamp(15rem, 30vw, 24rem);
    margin-block: .55rem 1.2rem;
    border-left: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: color-mix(in srgb, var(--tint) 45%, transparent);
}

.taste-y-title, .taste-x-title {
    color: var(--muted);
    font-size: .875rem;
}
.taste-x-title { text-align: center; }
.taste-lines, #taste-ticks, #taste-bubbles { position: absolute; inset: 0; }
.taste-lines { pointer-events: none; overflow: visible; }
.taste-diagonal { stroke: var(--underline); stroke-dasharray: 5 5; }
.taste-edge { stroke: var(--blue); stroke-width: 1.35; opacity: .65; }
.taste-gridline {
    position: absolute;
    color: var(--muted);
    font-size: .75rem;
    white-space: nowrap;
    pointer-events: none;
}
.taste-horizontal { left: 0; right: 0; top: var(--position); border-top: 1px solid var(--line); }
.taste-vertical { bottom: 0; top: 0; left: var(--position); border-left: 1px solid var(--line); }
.taste-horizontal span { position: absolute; right: calc(100% + .36rem); transform: translateY(-50%); }
.taste-vertical span { position: absolute; top: calc(100% + .4rem); transform: translateX(-50%); }
.taste-dot {
    --area: max(3px, calc(var(--weight) * var(--bubble-max)));
    position: absolute;
    display: grid;
    place-items: center;
    z-index: 1;
    top: var(--y);
    left: var(--x);
    width: max(16px, var(--area));
    height: max(16px, var(--area));
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--tone);
    cursor: pointer;
    transform: translate(-50%, -50%);
}
.taste-dot::before {
    width: var(--area);
    height: var(--area);
    border: 1px solid var(--tone);
    border-radius: 50%;
    background: color-mix(in srgb, var(--tone) 30%, var(--paper));
    content: "";
}
.taste-dot:hover, .taste-dot:focus-visible, .taste-dot[aria-pressed="true"] { z-index: 3; }
.taste-dot[aria-pressed="true"]::before {
    background: var(--tone);
    outline: 2px solid var(--paper);
    box-shadow: 0 0 0 4px var(--tone);
}
.taste-dot:focus-visible { outline-offset: 5px; }
.taste-dot-label {
    position: absolute;
    top: 50%;
    left: calc(100% + .4rem);
    max-width: 11rem;
    padding: .15rem .3rem;
    border-radius: 3px;
    background: var(--paper);
    color: var(--ink);
    font-size: .8rem;
    line-height: 1.14;
    text-align: start;
    width: max-content;
    overflow-wrap: anywhere;
    transform: translateY(-50%);
    pointer-events: none;
}
.taste-dot-label:empty { display: none; }
.taste-label-left .taste-dot-label { left: auto; right: calc(100% + .4rem); text-align: end; }
.taste-chart-note { margin-top: .6rem; }

.taste-stats { margin-bottom: .85rem; }
.taste-stats strong { color: var(--ink); }
.taste-stats span { display: block; }
.taste-shifts, .taste-related { margin-top: 1rem; }
.taste-shifts h3, .taste-related h3 {
    font-size: 1.07rem;
    line-height: 1.2;
    letter-spacing: -.025em;
}
.taste-shifts ul, .taste-related ul {
    margin: .45rem 0 0;
    padding: 0;
    list-style: none;
}
.taste-shifts ul { display: flex; flex-wrap: wrap; gap: .3rem .6rem; }
.taste-shifts button, .taste-related button {
    border: 0;
    border-radius: 4px;
    background: var(--tint);
    color: var(--ink);
    font: inherit;
    text-align: start;
    cursor: pointer;
}
.taste-shifts button { padding: .35rem .55rem; font-size: .875rem; }
.taste-shifts button span { color: var(--tone); font-variant-numeric: tabular-nums; }
.taste-related li + li { margin-top: .3rem; }
.taste-related button { display: block; width: 100%; padding: .38rem .55rem; }
.taste-related button strong { display: block; font-size: .92rem; }
.taste-related button span { display: block; color: var(--muted); font-size: .8125rem; overflow-wrap: anywhere; }
.taste-shifts button:hover, .taste-related button:hover { color: var(--blue); }
.taste-method { margin-top: .6rem; }
.taste-method summary { width: fit-content; cursor: pointer; }
.taste-method p { max-width: 80ch; margin-top: .35rem; }

@media (max-width: 780px) {
    .taste-panel { grid-template-columns: minmax(0, 1fr); }
    .taste-detail { border: 0; border-top: 1px solid var(--line); padding: .85rem 0 0; }
}
@media (max-width: 480px) {
    .taste-plot { margin-right: .8rem; }
    .taste-plane { --bubble-max: 1.85rem; }
    .taste-dot-label { max-width: 7rem; }
}
@media (forced-colors: active) {
    .taste-dot::before { background: Canvas; border-color: CanvasText; }
    .taste-dot[aria-pressed="true"]::before { background: Highlight; }
}
