/* Glass orb wheel. Theme comes from [data-theme] on <html>, style from [data-style] on .orb.
   Rule for this file and orb.js: no CSS filters on the overlay (they fringe on transparent
   windows) and no inline style attributes (the overlay page's CSP blocks them). */
:root {
  --ink: #ffffff;
  --dim: rgba(255, 255, 255, 0.5);
  --tint: rgba(30, 30, 38, 0.62);
  --tint-native: rgba(12, 12, 18, 0.08);
  --edge: rgba(255, 255, 255, 0.3);
  --spec: rgba(255, 255, 255, 0.26);
  --depth: rgba(0, 0, 0, 0.2);
  --sep: rgba(255, 255, 255, 0.16);
  --glow: #ffffff;
  --lens-fill: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.07) 70%);
  --lens-edge: rgba(255, 255, 255, 0.26);
  --badge-bg: rgba(255, 255, 255, 0.13);
  --badge-edge: rgba(255, 255, 255, 0.16);
  --orb-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;
}
[data-theme="light"] {
  --ink: #141416;
  --dim: rgba(20, 20, 24, 0.42);
  --tint: rgba(252, 252, 254, 0.6);
  --tint-native: rgba(255, 255, 255, 0.14);
  --edge: rgba(255, 255, 255, 0.95);
  --spec: rgba(255, 255, 255, 0.75);
  --depth: rgba(0, 0, 0, 0.06);
  --sep: rgba(0, 0, 0, 0.12);
  --glow: #ffffff;
  --lens-fill: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.6) 75%);
  --lens-edge: rgba(255, 255, 255, 0.95);
  --badge-bg: rgba(255, 255, 255, 0.8);
  --badge-edge: rgba(0, 0, 0, 0.06);
}

.orb {
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  user-select: none;
  -webkit-user-select: none;
  cursor: default;
  font-family: var(--orb-font);
  --halo-rim: var(--ink);
  --halo-glow: var(--glow);
  --span: 40deg;
  --seg: 45deg;
}
.orb > div, .orb-halo i { position: absolute; inset: 0; border-radius: 50%; }

/* ---------- Glass ---------- */
.orb-glass {
  background: radial-gradient(circle at 32% 20%, var(--spec), transparent 42%), var(--tint);
  backdrop-filter: blur(20px) saturate(1.8);
  -webkit-backdrop-filter: blur(20px) saturate(1.8);
  box-shadow:
    inset 0 0 0 1px var(--edge),
    inset 0 1.5px 2px rgba(255, 255, 255, 0.34),
    inset 0 -22px 30px -22px var(--depth),
    0 8px 24px rgba(0, 0, 0, 0.16);
  transition: opacity 0.09s;
}
/* macOS: the real blur is an NSVisualEffectView behind the page; we only add tint + light. */
.orb--native .orb-glass {
  background: radial-gradient(circle at 32% 20%, var(--spec), transparent 42%), var(--tint-native);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

/* ---------- Dividers between slots ([data-dividers] on .orb; "none" draws nothing) ---------- */
.orb-dividers { pointer-events: none; opacity: 0; transition: opacity 0.2s; }
.orb.is-open .orb-dividers { opacity: 1; }
.orb.is-dial .orb-dividers, .orb.is-single .orb-dividers { opacity: 0; }

/* ticks: hairline marks on the bezel, like indices on a watch. */
.orb[data-dividers="ticks"] .orb-dividers {
  background: repeating-conic-gradient(from calc(var(--seg) * -0.5 - 0.35deg), var(--sep) 0deg 0.7deg, transparent 0.7deg var(--seg));
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 15px), #000 calc(100% - 14px), #000 calc(100% - 7px), transparent calc(100% - 6px));
  mask: radial-gradient(closest-side, transparent calc(100% - 15px), #000 calc(100% - 14px), #000 calc(100% - 7px), transparent calc(100% - 6px));
}

/* dots: one small dot on the rim between slots. */
.orb-dot {
  position: absolute;
  width: 3px;
  height: 3px;
  margin: -1.5px 0 0 -1.5px;
  border-radius: 50%;
  background: var(--sep);
}

/* track: a thin ring inside the rim, one arc per slot; the hovered arc takes the halo color. */
.orb-track { position: absolute; inset: 0; overflow: visible; }
.orb-track path {
  fill: none;
  stroke: var(--sep);
  stroke-width: 2;
  stroke-linecap: round;
  transition: stroke 0.15s;
}
.orb-track path.is-hover { stroke: var(--halo-rim); stroke-opacity: 0.85; }

/* wedge: the hovered slot's slice fills with a soft tint that slides between slots. */
.orb-wedge {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(from calc(var(--seg) * -0.5 + 0.6deg), var(--halo-glow) 0deg calc(var(--seg) - 1.2deg), transparent 0deg);
  -webkit-mask: radial-gradient(closest-side, transparent 27%, rgba(0, 0, 0, 0.35) 60%, #000 99%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 27%, rgba(0, 0, 0, 0.35) 60%, #000 99%, transparent 100%);
  opacity: 0;
  transition: transform 0.22s cubic-bezier(0.22, 1.2, 0.36, 1), opacity 0.15s;
}
.orb.has-hover .orb-wedge { opacity: 0.16; }
/* White on light glass disappears, so the light theme tints with the rim color (ink) instead. */
[data-theme="light"] .orb-wedge {
  background: conic-gradient(from calc(var(--seg) * -0.5 + 0.6deg), var(--halo-rim) 0deg calc(var(--seg) - 1.2deg), transparent 0deg);
}
[data-theme="light"] .orb.has-hover .orb-wedge { opacity: 0.2; }
.orb.is-dial .orb-wedge { opacity: 0; }

/* ---------- Halo: a feathered arc of light on the rim plus a soft wash inward ---------- */
.orb-halo {
  pointer-events: none;
  opacity: 0;
  will-change: transform;
  /* Rotation is animated in orb.js (rotateHalo); only the fade is a CSS transition. */
  transition: opacity 0.2s ease;
}
.has-hover .orb-halo { opacity: 1; }
.orb-halo-rim {
  background: conic-gradient(
    from calc(var(--span) * -0.5),
    transparent 0deg,
    var(--halo-rim) calc(var(--span) * 0.32),
    var(--halo-rim) calc(var(--span) * 0.68),
    transparent var(--span)
  );
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 3.5px), #000 calc(100% - 1.75px), transparent calc(100% - 0.5px));
  mask: radial-gradient(closest-side, transparent calc(100% - 5px), #000 calc(100% - 3.5px), #000 calc(100% - 1.75px), transparent calc(100% - 0.5px));
}
.orb-halo-wash {
  background: conic-gradient(
    from calc(var(--span) * -0.8),
    transparent 0deg,
    var(--halo-glow) calc(var(--span) * 0.8),
    transparent calc(var(--span) * 1.6)
  );
  -webkit-mask: radial-gradient(closest-side, transparent 52%, rgba(0, 0, 0, 0.12) 70%, rgba(0, 0, 0, 0.5) 90%, #000 98%, transparent 100%);
  mask: radial-gradient(closest-side, transparent 52%, rgba(0, 0, 0, 0.12) 70%, rgba(0, 0, 0, 0.5) 90%, #000 98%, transparent 100%);
  opacity: 0.3;
  transition: opacity 0.15s;
}
[data-theme="light"] .orb-halo-wash { opacity: 0.85; }

/* ---------- Slots ---------- */
.orb-items { opacity: 0; transition: opacity 0.1s; }
.orb.is-open .orb-items { opacity: 1; }
.orb-item {
  position: absolute;
  transform: translate(-50%, -50%);
  color: var(--dim);
  display: grid;
  place-items: center;
  transition: transform 0.18s cubic-bezier(0.3, 1.4, 0.5, 1), color 0.12s, opacity 0.14s;
}
/* One-time staggered bloom when the wheel opens. */
.orb.is-opening .orb-item {
  animation: item-in 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.25) backwards;
  animation-delay: calc(var(--i) * 9ms);
}
@keyframes item-in { from { opacity: 0; transform: translate(-50%, -50%) scale(0.5); } }
.orb-item.has-color { color: var(--item); opacity: 0.78; }
.orb-icon { position: relative; display: grid; place-items: center; }
.orb-icon svg, .orb-icon img { display: block; }
.orb-icon img { border-radius: 22%; }
.orb-glyph { font-size: calc(var(--size) * 0.05); font-weight: 600; line-height: 1; }
.orb-num {
  display: grid;
  place-items: center;
  width: calc(var(--size) * 0.072);
  height: calc(var(--size) * 0.072);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px currentColor;
  font-size: calc(var(--size) * 0.036);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
/* Glass lens that blooms behind the hovered icon. */
.orb-item::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--lens);
  height: var(--lens);
  margin: calc(var(--lens) / -2) 0 0 calc(var(--lens) / -2);
  border-radius: 50%;
  background: var(--lens-fill);
  box-shadow: inset 0 0 0 1px var(--lens-edge), inset 0 1px 1px rgba(255, 255, 255, 0.4);
  opacity: 0;
  transform: scale(0.55);
  transition: transform 0.26s cubic-bezier(0.22, 1.3, 0.36, 1), opacity 0.16s ease;
}
.orb-item.is-hover::before { opacity: 1; transform: scale(1); }
.orb-item.is-hover { color: var(--item, var(--ink)); opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
.orb-item.is-selected::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(var(--lens) + 6px);
  height: calc(var(--lens) + 6px);
  margin: calc(var(--lens) / -2 - 3px) 0 0 calc(var(--lens) / -2 - 3px);
  border-radius: 50%;
  border: 1.5px solid var(--item, var(--ink));
  opacity: 0.5;
}
.orb-badge {
  position: absolute;
  top: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  padding: 0 5px;
  border-radius: 999px;
  font-size: calc(var(--size) * 0.025);
  line-height: 1.5;
  font-weight: 600;
  white-space: nowrap;
  color: var(--ink);
  background: var(--badge-bg);
  box-shadow: inset 0 0 0 1px var(--badge-edge);
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

/* Slots that came from the other system: dimmed when they can't work here, an amber dot
   when a shortcut was converted by rule and hasn't been checked yet. */
.orb-item.is-off .orb-icon { opacity: 0.32; }
.orb-check {
  position: absolute;
  top: -3px;
  right: -5px;
  width: calc(var(--size) * 0.02);
  height: calc(var(--size) * 0.02);
  min-width: 6px;
  min-height: 6px;
  border-radius: 50%;
  background: #f5b84b;
  box-shadow: 0 0 0 1.5px rgba(0, 0, 0, 0.28);
}

/* Album art from the now-playing slot stands in for its icon. */
.orb-icon img.orb-art {
  border-radius: 22%;
  object-fit: cover;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

/* A notch on the rim marks slots that continue outward (dials and rings). */
.orb-notches { pointer-events: none; opacity: 0; transition: opacity 0.15s; }
.orb.is-open .orb-notches { opacity: 1; }
.orb.is-ring .orb-notches, .orb.is-dial .orb-notches { opacity: 0; }
.orb-notch {
  position: absolute;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--item, var(--ink));
  opacity: 0.4;
  transition: opacity 0.15s, width 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.orb-notch.is-hover { opacity: 1; width: 22px; }

/* ---------- Pointer dot (the overlay holds the cursor while open; this shows the swipe) ---------- */
/* A canvas that overhangs the wheel (see FX_PAD in orb.js) so glow and trails aren't clipped. */
.orb-fx { position: absolute; pointer-events: none; transition: opacity 0.12s; }
.orb:not(.is-open) .orb-fx { opacity: 0; }

/* ---------- Center ---------- */
.orb > .orb-center {
  inset: auto;
  left: 50%;
  top: 50%;
  width: calc(var(--size) * 0.44);
  border-radius: 0;
  transform: translate(-50%, -50%);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.09s;
}
.orb-label {
  font-size: calc(var(--size) * 0.048);
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.orb:not(.has-hover) .orb-label { color: var(--dim); font-weight: 400; }
.orb-hint {
  margin-top: 3px;
  font-size: calc(var(--size) * 0.033);
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.orb:not(.is-open) .orb-glass,
.orb:not(.is-open) .orb-center { opacity: 0; }

/* ---------- Ring mode (apps / clipboard) ---------- */
.orb.ring-in .orb-items { animation: ring-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.15); }
@keyframes ring-in { from { transform: scale(0.86); opacity: 0.2; } }
.orb.is-ring .orb-label {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  font-size: calc(var(--size) * 0.042);
  line-height: 1.2;
  overflow-wrap: anywhere;
}

/* ---------- Dial mode ---------- */
/* Detent ticks on the bezel, visible only in a window that travels with the pointer. On a dial
   that presses keys they mark where each step lands (--tick0 is where the dial opened). */
.orb-ticks {
  pointer-events: none;
  opacity: 0;
  background: repeating-conic-gradient(from calc(var(--tick0, calc(var(--detent, 18deg) * -0.5)) - 0.6deg), var(--ink) 0deg 1.2deg, transparent 1.2deg var(--detent, 18deg));
  -webkit-mask-image:
    radial-gradient(closest-side, transparent calc(100% - 18px), #000 calc(100% - 17px), #000 calc(100% - 9px), transparent calc(100% - 8px)),
    conic-gradient(from calc(var(--ptr, 0deg) - 80deg), transparent 0deg, #000 80deg, transparent 160deg, transparent 360deg);
  -webkit-mask-composite: source-in;
  mask-image:
    radial-gradient(closest-side, transparent calc(100% - 18px), #000 calc(100% - 17px), #000 calc(100% - 9px), transparent calc(100% - 8px)),
    conic-gradient(from calc(var(--ptr, 0deg) - 80deg), transparent 0deg, #000 80deg, transparent 160deg, transparent 360deg);
  mask-composite: intersect;
  transition: opacity 0.2s;
}
/* Every dial turns around the wheel on its arc, so the ticks show on all of them. */
.orb.is-arc .orb-ticks { opacity: 0.6; }
.orb.is-dial .orb-item:not(.is-hover) { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
.orb.is-dial .orb-item .orb-badge { opacity: 0; }
.orb.is-dial .orb-label {
  font-size: calc(var(--size) * 0.105);
  font-weight: 300;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
/* "3 undone", "2 right": a readout in words is set smaller than a number. */
.orb.is-dial .orb-label.is-wordy { font-size: calc(var(--size) * 0.074); letter-spacing: -0.02em; }
.orb.is-dial .orb-hint { font-size: calc(var(--size) * 0.036); }
.orb-label.tick { animation: tick 0.16s ease-out; }
@keyframes tick { 40% { transform: scale(1.07); } }

/* ---------- Closing ---------- */
.orb.is-commit .orb-item.is-hover { transform: translate(-50%, -50%) scale(1.22); transition-duration: 0.12s; }
.orb.is-commit .orb-item.is-hover::before { transform: scale(1.7); opacity: 0; transition: transform 0.28s ease-out, opacity 0.28s ease-out; }
.orb.is-commit .orb-halo-wash { opacity: 0.6; }
[data-theme="light"] .orb.is-commit .orb-halo-wash { opacity: 1; }
.orb.is-commit { animation: orb-out 0.16s ease-in 0.07s forwards; }
.orb.is-cancel { animation: orb-out 0.1s ease-in forwards; }
@keyframes orb-out { to { opacity: 0; transform: scale(0.97); } }
/* macOS overlay: the window itself fades (glass and content together), so the content must
   not fade out ahead of the glass. */
.orb--native.is-commit, .orb--native.is-cancel { animation: none; }
.orb.no-anim, .orb.no-anim * { transition: none !important; animation: none !important; }

/* ---------- Drag to reorder (settings preview) ---------- */
.orb-item.is-dragging { opacity: 0.25; }
.orb-item.is-drop::before { opacity: 1; transform: scale(1.12); box-shadow: inset 0 0 0 2px var(--ink); }
/* `.orb > .orb-ghost` beats the `.orb > div { inset: 0 }` layer rule: without it the ghost
   stretched to the wheel's size and its centering transform pushed it far from the pointer. */
.orb > .orb-ghost {
  inset: auto;
  border-radius: 0;
  position: absolute;
  z-index: 5;
  transform: translate(-50%, -50%) scale(1.2);
  color: var(--ink);
  pointer-events: none;
}
.orb.is-reordering { cursor: grabbing; }

/* ---------- Styles ---------- */
.orb[data-style="smoked"] {
  --ink: #ffffff;
  --dim: rgba(255, 255, 255, 0.5);
  --tint: rgba(16, 16, 22, 0.66);
  --tint-native: rgba(10, 10, 14, 0.5);
  --edge: rgba(255, 255, 255, 0.16);
  --spec: rgba(255, 255, 255, 0.12);
  --depth: rgba(0, 0, 0, 0.3);
  --sep: rgba(255, 255, 255, 0.14);
  --glow: #ffffff;
  --lens-fill: radial-gradient(circle at 50% 30%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.05) 70%);
  --lens-edge: rgba(255, 255, 255, 0.22);
  --badge-bg: rgba(255, 255, 255, 0.12);
  --badge-edge: rgba(255, 255, 255, 0.16);
}
.orb[data-style="smoked"] .orb-halo-wash { opacity: 0.3; }
.orb[data-style="noir"] {
  --ink: #f2dcaa;
  --dim: rgba(216, 191, 139, 0.55);
  --tint: rgba(17, 16, 14, 0.94);
  --tint-native: rgba(17, 16, 14, 0.9);
  --edge: rgba(201, 164, 92, 0.55);
  --spec: rgba(242, 220, 170, 0.07);
  --depth: rgba(0, 0, 0, 0.4);
  --sep: rgba(201, 164, 92, 0.35);
  --glow: #e9c98a;
  --lens-fill: radial-gradient(circle at 50% 30%, rgba(233, 201, 138, 0.2), rgba(233, 201, 138, 0.05) 70%);
  --lens-edge: rgba(233, 201, 138, 0.45);
  --badge-bg: rgba(233, 201, 138, 0.12);
  --badge-edge: rgba(233, 201, 138, 0.3);
}
.orb[data-style="noir"] .orb-label { font-family: "New York", "Iowan Old Style", Georgia, serif; font-style: italic; font-weight: 400; }
.orb[data-style="noir"].is-dial .orb-label { font-style: normal; }
.orb[data-style="noir"] .orb-halo-wash { opacity: 0.22; }
.orb[data-style="aurora"] .orb-halo-rim {
  background: conic-gradient(from calc(var(--span) * -0.5), transparent 0deg, #ff6ad5 calc(var(--span) * 0.25), #ad8cff calc(var(--span) * 0.5), #5ee7ff calc(var(--span) * 0.75), transparent var(--span));
}
.orb[data-style="aurora"] .orb-halo-wash {
  background: conic-gradient(from calc(var(--span) * -0.8), transparent 0deg, #c084fc calc(var(--span) * 0.8), transparent calc(var(--span) * 1.6));
  opacity: 0.45;
}
.orb[data-style="aurora"] .orb-glass::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(#ff6ad5, #ad8cff, #5ee7ff, #7affc6, #ffd36a, #ff6ad5);
  -webkit-mask: radial-gradient(closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  mask: radial-gradient(closest-side, transparent calc(100% - 2px), #000 calc(100% - 1.5px));
  opacity: 0.55;
  animation: aurora-spin 12s linear infinite;
}
@keyframes aurora-spin { to { transform: rotate(360deg); } }
.orb[data-style="solid"] { --tint: #1c1c22; --tint-native: #1c1c22; --spec: rgba(255, 255, 255, 0.06); --edge: rgba(255, 255, 255, 0.1); }
[data-theme="light"] .orb[data-style="solid"] { --tint: #fbfbfc; --tint-native: #fbfbfc; --spec: rgba(255, 255, 255, 0.5); --edge: rgba(0, 0, 0, 0.08); }
.orb[data-style="solid"] .orb-glass { backdrop-filter: none; -webkit-backdrop-filter: none; }
