/* THE COLOUR WHEEL'S CARD (ui/sheets/colour.js colourPanel; #337, piece 22 of #313; the design: design-313 30-sheets.html `sheet-small`, "a small card that stands where the work is"). The spray can's wheel is a page of the HUD's one
   sheet (ui/sheets/panels.js), put out of the frame by ui/sheet.js `frame(false)`, so that no rule of the frame (ui/style/sheet.css `the frame`, all under .sheet[data-frame]) reaches it. The world runs on behind it. The card is
   the dark at the sheet's strength with the one thin edge of the notice's and the plates' make (--plate-rule, in ink: nothing here asks for an answer, so not the lamp's); its name is a label (it has no tag); the page is the wheel and the
   bar; at its foot stands the frame's own way out, its key drawn, which is the one way to shut it that is shown (the colour key, the use key and Esc shut it too, ui/hud.js onKey). Nothing here is a length, a colour or a time of its
   own: the HUD's tokens (data/hud.js), the rows of data/sheet.js `look` that makeSheet sets on every sheet (the foot's), and the rows of HUD.text.colour.look, which colour.js sets on the card as --colour-<name> (tests/wheel.test.mjs
   holds it so). Every colour the wheel draws is the paint's own, which colour.js computes (data/spray.js paintAt) and hands on as --ring-colours, --tone-from, --tone-to, --pure and --paint. Every rule is under html[data-panel='colour']
   or .colour, so that none of these short names is styled bare for anything else. */
/* No veil is laid over the world behind the card: the wall the paint is for is what the player is looking at while a colour is chosen. */
html[data-panel='colour'] .panel-screen { place-items: center; padding: var(--gutter); }
html[data-panel='colour'] .panel-screen .sheet {
  box-sizing: border-box; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; gap: var(--colour-gap);
  width: calc(var(--colour-wheel) + 2 * var(--colour-pad-x)); max-width: 100%; max-height: 100%;
  padding: var(--colour-pad-top) var(--colour-pad-x) var(--colour-pad-bottom);
  background: var(--dark-sheet); border: 0; border-left: var(--plate-rule) solid var(--ink); border-radius: 0; outline: none;
  color: var(--ink);
}

/* its name: a label (the label's size, weight and tracking, in the dim ink), not a sheet's title */
html[data-panel='colour'] .panel-screen .sheet-head .titles { min-width: 0; }
html[data-panel='colour'] .panel-screen .sheet-head h2 {
  margin: 0; font: var(--weight-label) var(--size-label) / var(--sheet-label-lead) var(--font-text);
  letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-dim);
}
html[data-panel='colour'] .panel-screen .sheet-body {
  min-height: 0; overflow-y: auto; padding: 0;
  scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent;
}

/* the foot: the way out, as the frame draws it (ui/style/sheet.css the foot): the key, then its word, in the label's own type */
html[data-panel='colour'] .panel-screen .sheet-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sheet-foot-gap-y) var(--sheet-foot-gap-x);
  font: var(--weight-label) var(--size-label) / var(--sheet-label-lead) var(--font-text); letter-spacing: var(--track-label); text-transform: uppercase; color: var(--ink-dim);
}
html[data-panel='colour'] .panel-screen .sheet-foot .close {
  display: inline-flex; align-items: center; gap: var(--sheet-entry-gap); margin: 0; padding: 0; border: 0; background: none;
  font: inherit; letter-spacing: inherit; text-transform: inherit; color: inherit; transition: color var(--warm);
}
html[data-panel='colour'] .panel-screen .sheet-foot .close:hover:not(:disabled), html[data-panel='colour'] .panel-screen .sheet-foot .close:focus-visible:not(:disabled) { background: none; color: var(--ink); }
html[data-panel='colour'] .panel-screen .sheet-foot .close:focus-visible { outline: var(--plate-rule) solid var(--ink-dim); outline-offset: var(--sheet-entry-gap); }
html[data-panel='colour'] .panel-screen .sheet-foot .status:empty { display: none; }

/* the colour wheel: a wheel of hue (a ring of every colour round the colour chosen) and a bar of light under it, from black through the hue to white, both in the paint's own saturation. The pointer picks on either; the knob
   and the tick stand where the hue and the light are. */
.colour { --ring: 11%; display: grid; justify-items: center; gap: var(--colour-parts); }
.colour .wheel { position: relative; width: min(var(--colour-wheel), 100%); aspect-ratio: 1; touch-action: none; cursor: crosshair; }
.colour .ring {
  position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ring-colours));
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring) * 2), var(--black) calc(100% - var(--ring) * 2 + var(--colour-line)));
          mask: radial-gradient(farthest-side, transparent calc(100% - var(--ring) * 2), var(--black) calc(100% - var(--ring) * 2 + var(--colour-line)));
}
.colour .swatch { position: absolute; inset: calc(var(--ring) + 7%); border-radius: 50%; background: var(--paint); box-shadow: 0 0 0 var(--colour-line) var(--rule); }
.colour .arm { position: absolute; inset: 0; transform: rotate(var(--turn)); pointer-events: none; }
.colour .knob {
  position: absolute; left: 50%; top: calc(var(--ring) / 2); width: var(--colour-knob); height: var(--colour-knob); margin: calc(var(--colour-knob) / -2) 0 0 calc(var(--colour-knob) / -2);
  border: var(--plate-rule) solid var(--ink); border-radius: 50%; box-shadow: 0 0 0 var(--colour-line) var(--black), inset 0 0 0 var(--colour-line) var(--black);
}
.colour .tone {
  position: relative; width: min(var(--colour-wheel), 100%); height: var(--colour-bar); border: var(--colour-line) solid var(--rule); touch-action: none; cursor: pointer;
  background: linear-gradient(to right, var(--tone-from), var(--pure), var(--tone-to));
}
.colour .tick {
  position: absolute; top: calc(-1 * var(--colour-tick-over)); bottom: calc(-1 * var(--colour-tick-over)); left: var(--at); width: var(--colour-tick-width); margin-left: calc(var(--colour-tick-width) / -2);
  border: var(--plate-rule) solid var(--ink); box-shadow: 0 0 0 var(--colour-line) var(--black); pointer-events: none;
}
