/* =========================================================================
   The color well, palette, More Colors, and Find a Color (color-picker.js).
   Built on the Marker tokens in marker.css, so light and dark come with
   them. The swatches themselves are the work's colors and never change
   with the theme.

   Every swatch has an inset edge in --field-border, which keeps 3:1
   against the panel in both themes, even for a swatch the panel's own
   color. The chosen color and focus are rings outside the swatch with a
   gap of the panel's color between, so they show on white and on black.

   The saturation and brightness area and the hue slider are drawn with
   gradients because they are the colors being picked.
   ========================================================================= */

/* The well */
.pal-group { display: flex; gap: 8px; align-items: center; flex-wrap: nowrap; }
.pal-well {
  display: flex; align-items: center; gap: 10px;
  flex: 1 1 auto;
  width: 100%; min-width: 0; min-height: 44px;
  margin: 0;
  padding: 0 12px 0 8px;
  border: 1px solid var(--field-border);
  border-radius: var(--r-control);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/20px var(--font-body);
  text-align: left;
  cursor: pointer;
}
.pal-well:hover { border-color: var(--ink); }
.pal-well:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.pal-well[aria-expanded="true"] { border-color: var(--ink); }
.pal-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-well .icon { flex: none; color: var(--muted); }
/* The video editor's tool row is one line under the canvas. */
.vd-toolbar .pal-group { flex: 0 1 220px; min-width: 150px; }

.pal-chip {
  flex: none;
  width: 26px; height: 26px;
  border-radius: var(--r-chip);
  box-shadow: inset 0 0 0 1px var(--field-border);
}
.pal-chip-lg { width: 44px; height: 30px; }
.pal-chip-xl { width: 64px; height: 64px; border-radius: var(--r-control); }
/* No color: a diagonal line through the chip. */
.pal-chip.is-none {
  background: linear-gradient(to top right, transparent calc(50% - 1px), var(--danger) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)), var(--surface);
}

/* The popover */
.pal-pop {
  position: fixed;
  z-index: 200;
  box-sizing: border-box;
  max-width: calc(100vw - 16px);
  max-height: calc(100vh - 16px);
  overflow: auto;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  background: var(--surface);
  color: var(--ink);
  font: 400 14px/20px var(--font-body);
  text-align: left;
  box-shadow: var(--shadow-dialog);
}
.pal-pop *, .pal-pop *::before, .pal-pop *::after { box-sizing: border-box; }
.pal-palette { display: flex; flex-direction: column; gap: 12px; }
.pal-none {
  display: flex; align-items: center; gap: 8px;
  min-height: 36px; padding: 0 10px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: 400 13px/18px var(--font-body);
  cursor: pointer;
}
.pal-none .pal-chip { width: 20px; height: 20px; border-radius: 4px; }
.pal-none[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.pal-heading { margin: 0 0 6px; color: var(--muted); font-size: 13px; line-height: 18px; font-weight: 600; }
.pal-note { max-width: 276px; margin: 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.pal-grid { display: flex; flex-direction: column; gap: 4px; }
.pal-row { display: flex; gap: 4px; }
/* The tints and shades sit close together under a gap, as columns. */
.pal-section-theme .pal-grid { gap: 0; }
.pal-section-theme .pal-row:first-child { margin-bottom: 8px; }

.pal-swatch {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  flex: none;
  width: 24px; height: 24px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px var(--field-border);
  cursor: pointer;
}
.pal-swatch .icon { width: 14px; height: 14px; }
.pal-section-theme .pal-row:not(:first-child) .pal-swatch { height: 20px; border-radius: 0; }
.pal-section-theme .pal-row:nth-child(2) .pal-swatch { border-radius: 4px 4px 0 0; }
.pal-section-theme .pal-row:last-child .pal-swatch { border-radius: 0 0 4px 4px; }
.pal-swatch[aria-selected="true"] { z-index: 1; box-shadow: inset 0 0 0 1px var(--field-border), 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.pal-swatch:focus-visible { z-index: 2; outline: none; box-shadow: inset 0 0 0 1px var(--field-border), 0 0 0 2px var(--surface), 0 0 0 4px var(--selection); }
/* Bigger swatches for fingers; ten still fit across a 390 px phone. */
@media (any-pointer: coarse) {
  .pal-swatch { width: 30px; height: 30px; }
  .pal-section-theme .pal-row:not(:first-child) .pal-swatch { height: 26px; }
}

.pal-footer, .pal-tools, .pal-buttons, .pal-found-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.pal-footer, .pal-buttons { justify-content: flex-end; }
.pal-pop .btn .icon { margin-right: 6px; }
.pal-pop .btn-icon .icon { margin-right: 0; }

/* More Colors */
.pal-more { display: flex; flex-direction: column; gap: 12px; width: 276px; max-width: 100%; }
.pal-more-title { font: 700 15px/20px var(--font-body); }
.pal-area {
  position: relative;
  height: 160px;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px var(--field-border);
  touch-action: none;
  cursor: crosshair;
}
.pal-area:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
/* A white ring inside a dark one, so the thumb shows on every color. */
.pal-thumb {
  position: absolute;
  width: 16px; height: 16px;
  margin: -8px 0 0 -8px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #FFFFFF, 0 0 0 3px rgba(0, 0, 0, .6), inset 0 0 0 1px rgba(0, 0, 0, .35);
  pointer-events: none;
}
.pal-pop .pal-hue {
  width: 100%; height: 16px; margin: 0; padding: 0;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(to right, #F00 0%, #FF0 17%, #0F0 33%, #0FF 50%, #00F 67%, #F0F 83%, #F00 100%);
  box-shadow: inset 0 0 0 1px var(--field-border);
  -webkit-appearance: none;
  appearance: none;
}
.pal-hue::-webkit-slider-runnable-track { background: transparent; border: 0; }
.pal-hue::-webkit-slider-thumb {
  width: 10px; height: 22px; margin-top: -3px;
  border: 0;
  border-radius: 3px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .35);
  -webkit-appearance: none;
  appearance: none;
}
.pal-hue::-moz-range-track { background: transparent; border: 0; }
.pal-hue::-moz-range-thumb {
  width: 10px; height: 22px;
  border: 0;
  border-radius: 3px;
  background: #FFFFFF;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .6), 0 1px 2px rgba(0, 0, 0, .35);
}
.pal-hue:focus-visible { outline: 2px solid var(--selection); outline-offset: 2px; }
.pal-fields { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 6px; }
.pal-input { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; color: var(--muted); font-size: 13px; line-height: 18px; }
.pal-pop .pal-input .input { width: 100%; min-width: 0; height: 36px; min-height: 36px; padding: 0 6px; font-size: 14px; font-variant-numeric: tabular-nums; }
.pal-preview { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 13px; }
.pal-pv { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.pal-more-name { flex: 1; min-width: 0; color: var(--ink); font-size: 13px; }

/* Find a Color */
.pal-found { display: flex; flex-direction: column; gap: 12px; width: 292px; max-width: 100%; }
.pal-found-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -6px 0 0; }
.pal-found-color { display: flex; align-items: flex-start; gap: 14px; }
.pal-found-facts { display: flex; flex-direction: column; gap: 4px; min-width: 0; margin: 0; }
.pal-found-facts div { display: flex; gap: 8px; }
.pal-found-facts dt { flex: none; width: 44px; margin: 0; color: var(--muted); font-size: 13px; line-height: 20px; }
.pal-found-facts dd { min-width: 0; margin: 0; color: var(--ink); font-size: 14px; line-height: 20px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.pal-found-said { min-height: 18px; color: var(--muted); font-size: 13px; line-height: 18px; }
.pal-found-said:empty { display: none; }

/* Find a Color buttons show only where the browser can pick. */
[data-pal-find][hidden] { display: none !important; }

/* Chrome Web Store and Steam assets (composer.js): the Solids tab is one
   well in the swatch grid's place. */
.fg-sw-grid.fg-sw-well { display: block; }
