/*
  Caelion workspace · v5 · a Moon's picture

  The flat drawing that stands for one particular Moon wherever it is named: its own colour,
  shaded like the round one; its eyes, black on a light body and white on a dark one; its face
  as it is now (operations/moon_pic.py holds the five); and round it a ring in the colour of
  its aura. Between ring and face a hair of whatever lies behind shows through, cut by a mask,
  so the picture sits on any surface without knowing its colour.

  Sized by --size; made on the server by the moon_pic tag and in scripts by v5/moon-pic.js.
*/

:root[data-layout="v5"] {
  .moon-pic {
    --size: 40px;
    --rim: max(2px, calc(var(--size) * .05));
    --gap: max(1.5px, calc(var(--size) * .034));
    --ring: var(--b-2);
    position: relative;
    display: inline-block;
    flex: none;
    width: var(--size);
    height: var(--size);
    border-radius: 50%;
    background: var(--ring);
    color: #121116;
    -webkit-mask: radial-gradient(closest-side, #000 calc(100% - var(--rim) - var(--gap) - .6px), transparent calc(100% - var(--rim) - var(--gap)), transparent calc(100% - var(--rim) - .6px), #000 calc(100% - var(--rim)));
    mask: radial-gradient(closest-side, #000 calc(100% - var(--rim) - var(--gap) - .6px), transparent calc(100% - var(--rim) - var(--gap)), transparent calc(100% - var(--rim) - .6px), #000 calc(100% - var(--rim)));
    vertical-align: middle;
  }

  /* its aura is its ring: one colour, the rainbow, or the three chromatic primaries */
  .moon-pic[data-aura="solid"] {
    --ring: var(--aura, #f7c18f);
  }

  .moon-pic[data-aura="rainbow"] {
    --ring: conic-gradient(from 200deg, #ff8f7a, #f7c96b, #8de6c3, #7fb4ff, #c3a6ff, #ff8fc0, #ff8f7a);
  }

  .moon-pic[data-aura="chromatic"] {
    --ring: conic-gradient(from 30deg, #ff5d73 0 33.34%, #7dfcc0 0 66.67%, #6fa8ff 0);
  }

  .moon-pic[data-eyes="light"] {
    color: #f8f9fc;
  }

  /* the body: its colour, lit from the upper left and falling away to the lower right */
  .moon-pic::before {
    content: "";
    position: absolute;
    inset: calc(var(--rim) + var(--gap));
    border-radius: 50%;
    background:
      radial-gradient(circle at 33% 24%, rgb(255 255 255 / .62), transparent 46%),
      radial-gradient(circle at 70% 86%, rgb(0 0 0 / .24), transparent 62%),
      var(--body, #ebe8e2);
  }

  .moon-pic[data-eyes="light"]::before {
    background:
      radial-gradient(circle at 33% 24%, rgb(255 255 255 / .26), transparent 46%),
      radial-gradient(circle at 70% 86%, rgb(0 0 0 / .34), transparent 62%),
      var(--body, #26252f);
  }

  .moon-pic > svg {
    position: absolute;
    top: calc(var(--rim) + var(--gap));
    left: calc(var(--rim) + var(--gap));
    display: block;
    width: calc(100% - 2 * (var(--rim) + var(--gap)));
    height: calc(100% - 2 * (var(--rim) + var(--gap)));
    fill: currentColor;
  }

  .moon-pic .l {
    fill: none;
    stroke: currentColor;
    stroke-width: 5.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .moon-pic .g {
    fill: #fff;
  }

  .moon-pic[data-eyes="light"] .g {
    display: none;
  }

  .moon-pic .b {
    fill: #ff6f8f;
    opacity: .34;
  }

  .moon-pic[data-eyes="light"] .b {
    fill: #ff9db0;
    opacity: .3;
  }

  /* a paused Moon is the same Moon, asleep: a little of its colour goes */
  .moon-pic[data-face="offline"] {
    filter: saturate(.55);
  }

  /* the smallest pictures keep to the face: the blush would only smudge */
  .moon-pic.is-tiny .b,
  .moon-pic.is-tiny .g {
    display: none;
  }
}
