/* The 🔵 circle view (circle-view.js, docs/circle-view.md). */
/* The experimental circle view: a white page with, to start, a "new
   center" ring with a plus, that darkens a little on hover. Clicking it
   turns it into a blank center to fill in. More centers (peers) go round
   it, each placed by layoutCenters, and the lot is kept in the middle. */
#circle-view { flex: 1; overflow: hidden; background: #fff; position: relative; }
#circle-view[hidden] { display: none; }
#circle-view .centers { position: absolute; inset: 0; transform-origin: 0 0; }
/* A center: a 140px double ring (a thin outer line a little outside the
   first) with an icon at 25%, a label (a word or two, caps) in the
   middle, and a description sitting across the ring's bottom edge on
   white so it breaks the ring. */
#circle-view .center { color: #000; font-family: var(--font); --F: 140px; --R: calc(var(--inner, var(--size, var(--F))) / 2); --ink: #000; }
/* Drawn for sharpness (copied from a since-removed 🟣 experiment):
   every box is placed in whole pixels (no translate(-50%, -50%)), lines
   are 2px, and the rings, grey band and pluses are SVG circles. */
/* A center's size (--size) fits its inner ring (layoutKids). Hovered,
   it grows a fifth of the way to fitting one element more (--grow), a
   hint of the size to come, overlapping its neighbours rather than
   pushing them. Its box stays the same size; only its rings and band
   grow (a transition on the SVG circles' r, through --R), so nothing is
   laid out again while they move (growing the box made the view jitter). */
/* Its left and top are its middle (layoutCenters), so it grows from the
   middle and slides when it moves. Hovered (.hot, set by the pointer
   being inside its ring; see fill), it grows. */
#circle-view .center { position: absolute; width: var(--size, var(--F)); height: var(--size, var(--F)); margin: calc(var(--size, var(--F)) / -2) 0 0 calc(var(--size, var(--F)) / -2); transition: left .25s, top .25s; }
#circle-view .center.hot { --R: calc(var(--grow) / 2); }
#circle-view .center:not(.kid):is(.hot, .peering) { z-index: 1; }
#circle-view .center.kid:is(.hot, .orbiting) { z-index: 5; }
/* The selected center (the last clicked; zoom keeps it in the middle) has a faint blue glow. */
#circle-view .center.selected > .rim { filter: drop-shadow(0 0 5px rgb(0 120 212 / .45)); }
#circle-view svg.rings { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
#circle-view svg.rings circle { cx: 50%; cy: 50%; transition: r .25s, stroke .15s, stroke-width .25s, opacity .25s; }
/* The double ring: 2px, a 3px white gap, 2px, white inside. */
#circle-view .rim .outer { r: calc(var(--R) + 4px); fill: #fff; stroke: var(--ink); stroke-width: 2px; }
#circle-view .rim .inner { r: calc(var(--R) - 1px); fill: none; stroke: var(--ink); stroke-width: 2px; }
#circle-view .center .rim { position: absolute; inset: 0; }
/* The center's own face (icon, label, description) is its core, in the
   middle. Once it has an inner ring (.open), the double border goes
   round the lot and the core keeps a single ring. */
#circle-view .center .core { position: absolute; left: 50%; top: 50%; width: var(--F); height: var(--F); margin: calc(var(--F) / -2) 0 0 calc(var(--F) / -2); border-radius: 50%; z-index: 2; }
/* Its own ring, once open, is a thinner double one: 1px, a 2px gap, 1px. */
#circle-view .core .face { r: calc(var(--F) / 2 - .5px); fill: #fff; stroke: #000; stroke-width: 1px; opacity: 0; }
#circle-view .core .face-out { r: calc(var(--F) / 2 + 2.5px); fill: none; stroke: #000; stroke-width: 1px; opacity: 0; }
#circle-view .center.open > .core :is(.face, .face-out) { opacity: 1; }
/* Dashed lines from the core out to each element, as thick as the
   double ring's lines (drawn by layoutKids). */
#circle-view .center svg.links { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; z-index: 2; }
#circle-view .links line { stroke: #000; stroke-width: 2px; stroke-dasharray: 4 4; }
/* Hovered, the inner ring shows in grey, from just outside the core to
   8px inside the double ring. A click anywhere inside the center adds an
   element (the band covers it all; the core takes its own clicks). */
#circle-view .center .band { position: absolute; inset: calc(var(--size, 140px) / 2 - var(--grow, 140px) / 2); border-radius: 50%; opacity: 0; pointer-events: none; cursor: pointer; z-index: 1; transition: opacity .15s; }
#circle-view .band circle { r: calc((var(--R) + var(--F) / 2 - 1px) / 2); stroke-width: max(0px, calc(var(--R) - var(--F) / 2 - 15px)); fill: none; stroke: #ececec; }
#circle-view .band:hover circle { stroke: #e2e2e2; }
#circle-view .center.new .band { display: none; }
#circle-view .center.hot:not(.peering) > .band { opacity: 1; pointer-events: auto; }
/* A small plus ring, like the new-center one, blinks where the next
   element will go (placed by layoutKids). */
#circle-view .center .ghost { position: absolute; left: calc(50% + var(--gx, 0px) - 13px); top: calc(50% + var(--gy, 0px) - 13px); width: 26px; height: 26px; color: #6c6c6c; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .15s; }
#circle-view .ghost svg { position: absolute; inset: 0; overflow: visible; }
#circle-view .ghost .outer { cx: 13px; cy: 13px; r: 15.5px; fill: #fff; stroke: currentColor; stroke-width: 1px; }
#circle-view .ghost .inner { cx: 13px; cy: 13px; r: 12.5px; fill: none; stroke: currentColor; stroke-width: 1px; }
#circle-view .ghost path { stroke: currentColor; stroke-width: 2px; fill: none; }
#circle-view .center.hot:not(.peering, .deep) > .ghost:not(.oghost) { opacity: 1; animation: ghost-blink 1.1s ease-in-out infinite alternate; }
@keyframes ghost-blink { from { opacity: 1; } to { opacity: .2; } }
/* Peers. Round each center, where a new one would go, is the peer ring
   (pointerAt); hovered, a new-center ring blinks there, in whichever of
   the 8 directions is nearest the pointer and free, sliding round as
   the pointer does. Clicking makes the new center there. The center
   itself doesn't grow for it. */
#circle-view:has(> .centers > :is(.peering, .orbiting)) { cursor: pointer; }
#circle-view .center .peer-new { position: absolute; left: calc(50% + var(--px, 0px) - 70px); top: calc(50% + var(--py, 0px) - 70px); width: 140px; height: 140px; --R: 70px; --ink: #6c6c6c; color: #484848; cursor: pointer; opacity: 0; pointer-events: none; transition: left .25s, top .25s, opacity .15s; }
#circle-view .center.peering > .peer-new { opacity: 1; pointer-events: auto; animation: ghost-blink 1.1s ease-in-out infinite alternate; }
#circle-view .center.new > .peer-new { display: none; }
/* While the peer ring's hovered, it shows as its 8 wedges, one per
   direction, faintly; the one the new center goes in is filled. Taken
   ones aren't drawn (showPeer). */
#circle-view .center svg.wedges { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; opacity: 0; transition: opacity .15s; }
#circle-view .center.peering > svg.wedges { opacity: 1; }
#circle-view .wedges path { fill: none; stroke: #e2e2e2; stroke-width: 1px; transition: fill .15s; }
#circle-view .wedges path.on { fill: #f4f4f4; }
/* Clicking a face wraps it in a new center (Wrapping, in circle-view.js). */
#circle-view .center.filling > .core { cursor: pointer; }
#circle-view .center.filling > .core > .slot { cursor: text; }
/* An element: a center 60% the size (--F, its face), placed round its
   ring by layoutKids. It's a center too, with rings of its own, and its
   box grows to hold them. */
#circle-view .center.kid { --F: 84px; z-index: 3; }
/* Dragged round its ring (Reordering), an element lifts; the others
   move round the ring frame by frame, so their slide is off. */
#circle-view .center.kid.filling > .core { cursor: grab; }
#circle-view .center.kid { transition: left .25s, top .25s, transform .15s; }
#circle-view .center.reordering > .kid { transition: transform .15s; }
#circle-view .center.kid.dragging { z-index: 6; transform: scale(1.08); }
#circle-view .center.kid.dragging > .core { cursor: grabbing; }
#circle-view .center.kid.dragging > .rim { filter: drop-shadow(0 4px 8px rgb(0 0 0 / .18)); }
/* Outer rings (layoutKids): round the double border, each a band as
   wide as an element with space either side, edged on the outside by a
   single 2px ring. Hovered (.orbiting), a band shows in grey with the
   blinking plus where its next element goes; a full ring shows
   nothing. Just outside the outermost ring, the next ring shows the same
   way, snapping in from outside rather than looking like the center
   growing. */
#circle-view .center svg.orbits { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
#circle-view .orbits circle { cx: 50%; cy: 50%; fill: none; }
#circle-view .orbits .line { stroke: #000; stroke-width: 2px; transition: r .25s; }
#circle-view .orbits .hover { stroke: #ececec; display: none; }
#circle-view .center.orbiting > .orbits .hover { display: inline; }
#circle-view .orbits .hint { display: none; transform-box: fill-box; transform-origin: center; }
#circle-view .orbits .hint .line { stroke: #6c6c6c; transition: none; }
#circle-view .center.orbiting.adding > .orbits .hint { display: inline; animation: orbit-in .18s ease-out; }
@keyframes orbit-in { from { transform: scale(1.06); opacity: 0; } }
#circle-view .center .oghost { left: calc(50% + var(--ox, 0px) - 13px); top: calc(50% + var(--oy, 0px) - 13px); }
#circle-view .center.orbiting:not(.deep) > .oghost { opacity: 1; animation: ghost-blink 1.1s ease-in-out infinite alternate; }
#circle-view .center.orbiting { cursor: pointer; }
#circle-view .center.ringed > .delete { left: calc(50% + round((var(--size) / 2 + 21px) * .7071, 1px) - 10px); top: calc(50% - round((var(--size) / 2 + 21px) * .7071, 1px) - 10px); }
#circle-view .center.orbiting:not(.deep) > .delete { opacity: 1; }
/* Its number, to its left, on white so it breaks a ring it lands on. */
#circle-view .center.kid > .core > .num { position: absolute; right: calc(100% + 8px); top: calc(var(--F) / 2 - var(--num, 13px) * 8 / 13); padding: 0 4px; background: #fff; font-size: var(--num, 13px); line-height: calc(var(--num, 13px) * 16 / 13); color: #484848; pointer-events: none; }
/* Text boxes: placed in whole pixels by slotFit (left and top). */
/* A face is drawn as an icon: the emoji alone in the circle, and the label
   under it, in capitals, black with a white edge so it reads over the
   lines it crosses. The sizes are slotFit's. */
#circle-view .center .icon, #circle-view .center .label { position: absolute; white-space: nowrap; }
#circle-view .center .icon { line-height: 1; font-family: "Segoe UI Emoji Monospace", var(--font); }
/* A ring's title (layoutTitles): right-aligned, ending just left of the
   number of the ring's first element. Blank, it only shows while its ring's hovered. */
#circle-view .center .ring-title { position: absolute; right: calc(50% + 76px); overflow-wrap: anywhere; z-index: 4; font-size: 11px; line-height: 14px; letter-spacing: .06em; text-transform: uppercase; font-weight: 600; color: #6c6c6c; text-align: right; cursor: text; transition: top .25s, opacity .15s; }
#circle-view .center .ring-title.blank { width: 64px; min-height: 12px; opacity: 0; pointer-events: none; background: #fff; box-shadow: inset 0 0 0 1px #c8c8c8; }
#circle-view .center .ring-title.blank:focus { background: #fff; }
#circle-view .center:is(.hot.open:not(.peering)) > .ring-title.blank[data-ring="0"],
#circle-view .center.orbiting:not(.adding) > .ring-title.blank.on,
#circle-view .center .ring-title.blank:focus { opacity: 1; pointer-events: auto; }
#circle-view .center:not(.open) > .ring-title[data-ring="0"] { display: none; }
#circle-view .center .label { line-height: 1; text-transform: uppercase; font-weight: 600; z-index: 3; -webkit-text-stroke: 4px #fff; paint-order: stroke fill; }
#circle-view .center .label.slot.monaco { overflow: visible; }
#circle-view .center .label.slot.monaco .view-line span { -webkit-text-stroke: 4px #fff; paint-order: stroke fill; }
/* Wrapped (Wrapping): the new center's rings and face grow in round the
   one that slides out onto its inner ring. */
#circle-view .center.wrapped > :is(.rim, .core) { animation: wrap-in .45s cubic-bezier(.3, .7, .3, 1); }
@keyframes wrap-in { from { transform: scale(.5); opacity: 0; } }
/* Hover a center and a small × shows at its top right, clear of its
   double ring; click it and the center's gone. */
#circle-view .center .delete { position: absolute; left: calc(50% + round((var(--R) + 21px) * .7071, 1px) - 10px); top: calc(50% - round((var(--R) + 21px) * .7071, 1px) - 10px); z-index: 4; width: 20px; height: 20px; padding: 0; border-radius: 50%; border: 1px solid #6c6c6c; background: #fff; color: #484848; font: 14px/1 var(--font); cursor: pointer; display: grid; place-items: center; opacity: 0; transition: opacity .15s, border-color .15s, color .15s, left .25s, top .25s; }
#circle-view .center.hot:not(.deep) > .delete, #circle-view .kid.tapped > .delete, #circle-view .center .delete:focus-visible { opacity: 1; }
#circle-view .center .delete:hover { border-color: #000; color: #000; }
/* The new-center ring: grey, with a plus, like a center-to-be; hovered,
   it darkens and grows a little. */
#circle-view .center.new { cursor: pointer; color: #484848; --ink: #6c6c6c; }
#circle-view .center.new:hover, #circle-view .center.new:focus-visible { --ink: #3a3a3a; --R: 72px; }
#circle-view .center.new:focus-visible { outline: none; }
#circle-view .center .plus { position: absolute; left: calc(50% - 18px); top: calc(50% - 18px); width: 36px; height: 36px; stroke: currentColor; stroke-width: 2px; fill: none; transition: transform .25s, opacity .25s; }
/* Filling one in: the plus shrinks away as the ring darkens, and three
   grey boxes grow in where the icon, label and description go. Each is
   a box to type in; as soon as it has text, the box is gone and it's
   the text, centred. */
#circle-view .center.filling { cursor: default; color: #000; }
#circle-view .center.filling .core .plus { transform: scale(0); opacity: 0; }
#circle-view .center .slot { outline: none; min-height: 1em; }
#circle-view .center .slot.blank { background: #dedede; transition: background .15s; }
#circle-view .center .slot.blank:focus, #circle-view .center .slot.monaco.blank:focus-within { background: #c8c8c8; }
/* The icon's box is a plain input, so the emoji picker (emoji.js) can
   work it: typing in it opens the picker, in white here. */
#circle-view .center input.icon { border: 0; padding: 0; margin: 0; background: none; color: #000; text-align: center; font-family: "Segoe UI Emoji Monospace", var(--font); line-height: normal; cursor: pointer; }
.emoji-picker.light { background: #fff; color: #000; border-color: #6c6c6c; box-shadow: 0 8px 24px rgba(0, 0, 0, .15); }
.emoji-picker.light .emoji-title { color: #484848; }
.emoji-picker.light .emoji-groups { border-color: #dedede; }
.emoji-picker.light .emoji.cursor { outline-color: #000; }
/* The boxes are the same editor as a message's, in black on the white
   page. The label's editor shows its text in capitals (the font is
   monospace, so they're the width the editor measured). */
#circle-view .center .slot.monaco { min-height: 0; padding: 0; text-align: left; overflow: hidden; --vscode-editor-background: transparent; --vscode-editorCursor-foreground: #000; --vscode-editor-selectionBackground: #b5d5ff; --vscode-editor-inactiveSelectionBackground: #d6e6fa; }
#circle-view .center .slot.monaco .monaco-editor, #circle-view .center .slot.monaco .monaco-editor-background, #circle-view .center .slot.monaco .margin { background: none !important; }
#circle-view .center .slot.monaco .monaco-editor, #circle-view .center .slot.monaco .monaco-editor :focus { outline: none; }
#circle-view .center .slot.monaco .mtk1 { color: #000 !important; }
#circle-view .center .label.slot.monaco .view-line { text-transform: uppercase; }
#circle-view .center.filling .slot { animation: slot-in .3s .1s backwards; }
@keyframes slot-in { from { opacity: 0; } }
/* On a phone the circle view pans and pinches its own way (see Panning in
   circle-view.js), not with the main area's zoom. */
@media (max-width: 799px) and (pointer: coarse) {
  #circle-view { zoom: calc(1 / var(--zoom, 1)); touch-action: none; }
}
