/* console: flame + sidebar handle (Nov 4)
   "The flame that unfolds": the gl14 mark bare (no pill) at the far left of the token strip is the one control.
   Rest = static ice mark. Hover / keyboard focus = the red living flame, the mark nudges 4px right and a soft frosted-glass
   sidebar edge slides in from the screen's left edge (a hint that a sidebar can be pulled out). Click / ⌘B toggles the
   sidebar (js/console.js setSb); while it's open the edge stays lit on the seam between sidebar and console.
   The Dashboard lives in the sidebar (brand mark at its top + "Dashboard" in Features). */

/* no pill: the bare ice flame at rest. A 36x44 hit area; the halo (on .cx-flm-in::before, so it travels with the
   4px nudge) is a soft round frosted-glass disc that fades in on hover / focus, and stays very faint while the sidebar is open. */
.cx-strip .cx-flm.mini-mark {
  --flm-ice: 127, 184, 255; --flm-hot: 255, 74, 30;
  position: relative; display: grid; place-items: center; flex: none; width: 36px; height: 44px; margin: 0 -5px 0 -3px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer; color: inherit; font: inherit; outline: none;
  background: none !important; box-shadow: none !important; }
.cx-flm .cx-flm-in::before {
  content: ""; position: absolute; z-index: -1; left: 50%; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  pointer-events: none;
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.10), rgba(255,255,255,.035) 62%, rgba(var(--flm-ice), .05));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), inset 0 0 0 1px rgba(255,255,255,.07), 0 0 14px -3px rgba(var(--flm-ice), .32);
  -webkit-backdrop-filter: blur(8px) saturate(1.2); backdrop-filter: blur(8px) saturate(1.2);
  opacity: 0; scale: .86; transition: opacity .2s ease, scale .2s cubic-bezier(.2, .8, .2, 1), box-shadow .2s ease; }
.cx-flm:is(:hover, :focus-visible) .cx-flm-in::before { opacity: 1; scale: 1; }
.cx-flm[aria-pressed="true"] .cx-flm-in::before { opacity: .38; scale: 1; }
.cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-in::before { opacity: 1; }
/* the global focus ring (console.css / hover.css / light.css, !important) would draw an oval on the 36x44 button: the ring lives on the halo instead */
html:root:root:is([data-look], :not([data-look])) .cx-strip .cx-flm.mini-mark.mini-mark:is(:focus, :focus-visible, :hover, :active) { outline: none !important; box-shadow: none !important; background: none !important; }
/* keyboard focus: a round ice ring on the halo */
.cx-flm:focus-visible .cx-flm-in::before {
  box-shadow: inset 0 1px 0 rgba(255,255,255,.16), 0 0 0 2px rgba(var(--flm-ice), .85), 0 0 12px -2px rgba(var(--flm-ice), .6); }

/* the mark: ice at rest (never red), the living flame on hover / keyboard focus only */
.cx-flm .cx-flm-in { position: relative; display: grid; place-items: center; width: 26px; height: 26px; translate: 0 0; transition: translate .28s cubic-bezier(.2, .8, .2, 1); }
.cx-flm.mini-mark .mm, .cx-flm.mini-mark .mm-live { translate: none !important; }
.cx-flm.mini-mark .mm { width: 24px; height: 24px; opacity: 1; filter: drop-shadow(0 0 5px rgba(90, 150, 230, .32)) !important; transition: opacity .22s ease; }
.cx-flm.mini-mark .mm-live { width: 32px; height: 32px; margin: -16px 0 0 -16px; opacity: 0; }
.cx-flm.mini-mark:is(:hover, :focus-visible) .mm-live { opacity: 1; }
.cx-flm.mini-mark:is(:hover, :focus-visible) .mm { opacity: 0; }
/* closed: nudge right (pull it out); open: nudge left (fold it back) */
.cx-flm:is(:hover, :focus-visible) .cx-flm-in { translate: 4px 0; }
.cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-in { translate: -3px 0; }

/* the sidebar edge: a soft frosted-glass seam (no colour, no hard line). One 40px box centred on the edge
   (6px in from the screen's left when closed, the sidebar seam when open), painted in three soft layers:
   a 2-3px white/ice inner highlight, a ~12px translucent glass strip and a low-opacity ice haze; a light
   backdrop blur frosts what's behind. Masked to fade out at the top, bottom and both sides, so no edge is hard. */
.cx-flm .cx-flm-edge {
  --flm-x: max(6px, var(--flm-sbw, 0px));
  --edge-hi: rgba(240, 247, 255, .34); --edge-glass: rgba(214, 230, 250, .085); --edge-haze: rgba(var(--flm-ice), .07); --edge-shade: rgba(0, 0, 0, 0);
  position: fixed; z-index: 60; top: 0; bottom: 0; left: calc(var(--flm-x) - 20px); width: 40px; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 18.5px, var(--edge-hi) 20px, transparent 21.5px),
    linear-gradient(90deg, transparent 12px, var(--edge-glass) 15.5px, var(--edge-glass) 24.5px, transparent 28px),
    linear-gradient(90deg, var(--edge-shade) 4px, var(--edge-haze) 20px, var(--edge-shade) 36px);
  -webkit-backdrop-filter: blur(3px) saturate(1.15); backdrop-filter: blur(3px) saturate(1.15);
  -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(90deg, transparent 6px, #000 16px, #000 24px, transparent 34px);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent), linear-gradient(90deg, transparent 6px, #000 16px, #000 24px, transparent 34px);
  mask-composite: intersect;
  opacity: 0; translate: -10px 0;
  transition: opacity .22s ease, translate .22s cubic-bezier(.2, .8, .2, 1); }
.cx-flm:is(:hover, :focus-visible) .cx-flm-edge { opacity: 1; translate: 0 0; }
/* open: settles to a very faint glass seam; hover brings it back up */
.cx-flm[aria-pressed="true"] .cx-flm-edge { opacity: .42; translate: 0 0; }
.cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-edge { opacity: 1; }

/* tooltip: "Open sidebar · ⌘B" / "Hide sidebar · ⌘B" (l9 hides .mini-mark::after, hence the stronger selector) */
.cx-strip .cx-flm.mini-mark::after {
  display: block !important; content: attr(data-tip); position: absolute; z-index: 80; left: 0; top: calc(100% + 8px);
  padding: 5px 9px; border-radius: 8px; white-space: nowrap; pointer-events: none;
  font: 500 11.5px/1.2 var(--fs, Inter, system-ui, sans-serif); letter-spacing: .01em; color: var(--tx, #e8eef6);
  background: rgba(16, 20, 27, .92); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 10px 24px -12px rgba(0,0,0,.8);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  opacity: 0; translate: 0 -3px; transition: opacity .14s ease, translate .14s ease; }
.cx-strip .cx-flm.mini-mark:is(:hover, :focus-visible)::after { opacity: 1; translate: 0 0; transition-delay: .35s; }

/* the sidebar slides in / out with the flame */
@keyframes cxSbIn { from { transform: translateX(-100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes cxSbOut { to { transform: translateX(-100%); opacity: 0; } }
@keyframes cxEdgeIn { from { translate: calc(-1 * var(--flm-sbw, 0px)) 0; } }
/* where the sidebar ends (the framed look sets --fr-sbw; other looks fall back to the sidebar's own widths) */
body.cx-sb .cx-flm { --flm-sbw: var(--fr-sbw, 264px); }
body.cx-sb.sb-mini .cx-flm { --flm-sbw: var(--fr-sbw, 76px); }
@media (min-width: 1101px) {
  body.cx-mode.cx-sb .app.side > .sb { animation: cxSbIn .28s cubic-bezier(.2, .8, .2, 1) both; }
  body.cx-mode.cx-sb.cx-sb-out .app.side > .sb { animation: cxSbOut .2s cubic-bezier(.4, 0, 1, 1) both; }
  body.cx-mode.cx-sb .cx-flm[aria-pressed="true"] .cx-flm-edge { animation: cxEdgeIn .28s cubic-bezier(.2, .8, .2, 1); }
  body.cx-sb-out .cx-flm .cx-flm-edge { opacity: 0 !important; transition: opacity .12s ease; }
}
/* narrow screens: the sidebar is the top bar's menu, so the mark is hidden */
@media (max-width: 1100px) { .cx-strip .cx-flm.mini-mark { display: none; } }

@media (prefers-reduced-motion: reduce) {
  .cx-flm .cx-flm-in, .cx-flm .cx-flm-edge, .cx-strip .cx-flm.mini-mark::after { transition: opacity .01s linear !important; }
  .cx-flm .cx-flm-in::before { scale: 1 !important; transition: opacity .2s linear, box-shadow .2s linear !important; }
  .cx-flm:is(:hover, :focus-visible) .cx-flm-in, .cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-in { translate: 0 0; }
  .cx-flm .cx-flm-edge { translate: 0 0 !important; }
  body.cx-mode.cx-sb .app.side > .sb, body.cx-mode.cx-sb .cx-flm .cx-flm-edge { animation: none !important; }
}

/* ---------- light theme ---------- */
html:root[data-theme="light"] .cx-strip .cx-flm.mini-mark { --flm-ice: 74, 128, 196; }
/* light: a white frosted halo with a faint cool shadow */
html:root[data-theme="light"] .cx-flm .cx-flm-in::before {
  background: radial-gradient(circle at 50% 30%, rgba(255,255,255,.92), rgba(255,255,255,.62) 70%);
  box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(20,40,70,.07), 0 4px 12px -5px rgba(40,70,110,.32), 0 0 10px -4px rgba(74,128,196,.3);
  -webkit-backdrop-filter: blur(8px) saturate(1.1) brightness(1.04); backdrop-filter: blur(8px) saturate(1.1) brightness(1.04); }
html:root[data-theme="light"] .cx-flm[aria-pressed="true"] .cx-flm-in::before { opacity: .4; }
html:root[data-theme="light"] .cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-in::before { opacity: 1; }
html:root[data-theme="light"] .cx-flm:focus-visible .cx-flm-in::before {
  box-shadow: inset 0 1px 0 #fff, 0 0 0 2px rgba(60,120,200,.75), 0 0 12px -2px rgba(60,120,200,.45); }
html:root[data-theme="light"] .cx-flm.mini-mark .mm { filter: drop-shadow(0 1px 2px rgba(20,40,70,.25)) drop-shadow(0 0 4px rgba(74,128,196,.25)) !important; }
/* light: a white frosted edge with a faint cool shadow either side */
html:root[data-theme="light"] .cx-flm .cx-flm-edge {
  --edge-hi: rgba(255, 255, 255, .95); --edge-glass: rgba(255, 255, 255, .5); --edge-haze: rgba(255, 255, 255, .35); --edge-shade: rgba(40, 70, 110, .075);
  -webkit-backdrop-filter: blur(4px) saturate(1.1) brightness(1.04); backdrop-filter: blur(4px) saturate(1.1) brightness(1.04); }
html:root[data-theme="light"] .cx-flm[aria-pressed="true"] .cx-flm-edge { opacity: .6; }
html:root[data-theme="light"] .cx-flm[aria-pressed="true"]:is(:hover, :focus-visible) .cx-flm-edge { opacity: 1; }
html:root[data-theme="light"] .cx-strip .cx-flm.mini-mark::after { color: #16202e; background: rgba(255,255,255,.94); box-shadow: inset 0 0 0 1px rgba(20,40,70,.1), 0 10px 24px -12px rgba(20,40,70,.45); }

/* Nov 5: no round halo behind the flame; on hover the living flame burns ICE BLUE (not red) */
html:root .cx-flm .cx-flm-in::before, html:root .cx-flm:is(:hover, :focus-visible, [aria-pressed="true"]) .cx-flm-in::before { opacity: 0 !important; box-shadow: none !important; background: none !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }
html:root .cx-flm.mini-mark { --ice: 127, 184, 255; --ice-hi: 214, 236, 255; }
html:root .cx-flm.mini-mark .mm-live .fl-svg { filter: drop-shadow(0 0 3px rgba(127, 184, 255, .6)) drop-shadow(0 0 8px rgba(127, 184, 255, .25)) !important; }
html:root .cx-flm.mini-mark .mm-live .fb-halo { fill: #7fb8ff !important; opacity: .5; }
html:root .cx-flm.mini-mark .mm-live .fl-glow { background: radial-gradient(closest-side, rgba(127, 184, 255, .3), rgba(70, 120, 200, .1) 55%, transparent) !important; }
html:root .cx-flm.mini-mark .mm-live .fl-em { background: #d6ecff !important; box-shadow: 0 0 4px 1px rgba(127, 184, 255, .8) !important; }
/* keyboard focus without the halo: a soft ice ring hugging the flame */
html:root .cx-flm:focus-visible .cx-flm-in { border-radius: 10px; box-shadow: 0 0 0 2px rgba(127, 184, 255, .55); }
