/* The right-click menu (static/cell_menu.js): the calculation widget's glass
   (cell_summary.css .csum), 246px wide, on <body> so nothing clips it and
   its blur has the page behind it. Motion is transform and opacity only:
   it grows from the corner at the pointer (transform-origin set by the
   script) over 140ms, leaves over 90ms; one highlight (.cm-hl) slides
   between the rows over 120ms. */
.cm {
  position: fixed; z-index: 300; width: 246px; box-sizing: border-box; padding: 5px;
  border-radius: 10px; outline: none;
  background: linear-gradient(180deg, rgba(30, 34, 48, .46), rgba(22, 25, 36, .54));
  -webkit-backdrop-filter: blur(22px) saturate(1.7) brightness(1.18);
  backdrop-filter: blur(22px) saturate(1.7) brightness(1.18);
  border: 1px solid rgba(255, 255, 255, .17);
  box-shadow: 0 20px 54px rgba(0, 0, 0, .55), 0 2px 8px rgba(0, 0, 0, .30), inset 0 1px 0 rgba(255, 255, 255, .16);
  color: rgb(227, 230, 239);
  font-size: 12.5px; line-height: 1.2; text-align: left; user-select: none; -webkit-user-select: none;
  --cm-muted: rgb(179, 185, 199); --cm-hl: rgba(255, 255, 255, .09); --cm-press: rgba(255, 255, 255, .16);
  --cm-div: rgba(255, 255, 255, .12); --cm-on: #fff;
  opacity: 0; transform: scale(.96);
  will-change: transform, opacity;
  contain: layout paint style;
}
.cm.is-open {
  opacity: 1; transform: none;
  transition: opacity 140ms cubic-bezier(0.16, 1, 0.3, 1), transform 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
.cm.is-closing {
  opacity: 0; transform: scale(.98); pointer-events: none;
  transition: opacity 90ms ease-in, transform 90ms ease-in;
}
html[data-theme="light"] .cm {
  background: linear-gradient(180deg, rgba(255, 255, 255, .62), rgba(250, 250, 252, .70));
  -webkit-backdrop-filter: blur(22px) saturate(1.35); backdrop-filter: blur(22px) saturate(1.35);
  border: 1px solid rgba(255, 255, 255, .9);
  box-shadow: 0 22px 50px rgba(40, 34, 24, .30), 0 2px 6px rgba(40, 34, 24, .10), inset 0 1px 0 rgba(255, 255, 255, .95);
  color: #1f1e1b;
  --cm-muted: #55524b; --cm-hl: rgba(40, 34, 24, .08); --cm-press: rgba(40, 34, 24, .14);
  --cm-div: rgba(40, 34, 24, .12); --cm-on: #000;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .cm { background: rgba(24, 27, 39, .96); }
  html[data-theme="light"] .cm { background: rgba(252, 252, 253, .97); }
}
@media (prefers-reduced-transparency: reduce) {
  .cm { background: rgba(24, 27, 39, .96); }
  html[data-theme="light"] .cm { background: rgba(252, 252, 253, .97); }
}

/* The top: the cell's name, its value and default. Quiet on purpose. */
.cm-head { padding: 4px 9px 6px; font-size: 10.5px; color: var(--cm-muted); }
.cm-name, .cm-val { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-val { margin-top: 2px; font-variant-numeric: tabular-nums; }
.cm-val b { font-weight: 500; color: rgb(214, 218, 229); }
html[data-theme="light"] .cm-val b { color: #2b2a26; }

/* Rows: 28px, the icon, the label, the key on the right. */
.cm-row {
  position: relative; z-index: 1; display: flex; align-items: center; height: 28px; padding: 0 9px;
  border-radius: 6px; cursor: default; box-sizing: border-box;
}
.cm-row svg {
  flex: none; width: 14px; height: 14px; margin-right: 9px; fill: none; stroke: var(--cm-muted);
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: stroke 120ms ease-out;
}
.cm-label { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 120ms ease-out; }
.cm-key { flex: none; margin-left: 10px; font: inherit; font-size: 11px; color: var(--cm-muted); }
.cm-row.is-on .cm-label { color: var(--cm-on); }
.cm-row.is-on svg { stroke: var(--cm-on); }
.cm-row[aria-disabled="true"] { opacity: .36; }
.cm-div { height: 1px; margin: 4px 6px; background: var(--cm-div); }

/* The highlight: one rounded shape behind the rows, moved by transform
   (translateY to the row, scaleY to its height over the 28px row). */
.cm-hl {
  position: absolute; left: 5px; right: 5px; top: 0; height: 28px; border-radius: 6px;
  background: var(--cm-hl); pointer-events: none; opacity: 0; transform-origin: 0 0;
  transition: transform 120ms ease-out, opacity 100ms ease-out;
}
.cm-hl.is-on { opacity: 1; transition: transform 120ms ease-out, opacity 80ms ease-out; }
.cm-hl.is-jump { transition: none; }
.cm-hl::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: var(--cm-press); opacity: 0; }
.cm-hl.is-press::after { opacity: 1; }

/* Last edited by: a 20px avatar, a small label over the name and time. */
.cm-edited { height: auto; min-height: 36px; padding-top: 4px; padding-bottom: 4px; }
.cm-edited[aria-disabled="true"] { opacity: 1; }
.cm-edited[aria-disabled="true"] .cm-edited-name { color: var(--cm-muted); }
.cm-avatar {
  flex: none; width: 20px; height: 20px; margin-right: 9px; border-radius: 50%;
  display: grid; place-items: center; font-size: 10px; font-weight: 600; color: #fff;
  background: hsl(var(--eh-hue, 210) 45% 42%);
}
.cm-edited-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.cm-edited-label { font-size: 10px; color: var(--cm-muted); }
.cm-edited-name { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cm-arrow { flex: none; display: flex; }
.cm-arrow svg { margin: 0 0 0 6px; }

/* Reduced motion: no scale and no slide, a short fade. */
@media (prefers-reduced-motion: reduce) {
  .cm, .cm.is-closing { transform: none; }
  .cm.is-open { transition: opacity 80ms linear; }
  .cm.is-closing { transition: opacity 60ms linear; }
  .cm-hl, .cm-hl.is-on { transition: opacity 60ms linear; }
}

/* "Press ⌘V to paste": the same glass, bottom centre. */
.cm-toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300; padding: 8px 14px; border-radius: 10px;
  background: rgba(24, 27, 39, .92); color: rgb(227, 230, 239); font-size: 12.5px;
  border: 1px solid rgba(255, 255, 255, .17); box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  opacity: 0; transform: translate(-50%, 6px); pointer-events: none;
  transition: opacity 140ms ease-out, transform 140ms ease-out;
}
.cm-toast.is-on { opacity: 1; transform: translate(-50%, 0); }

/* Pinned hints (Cell details): kept open, shown whatever the hover
   settings say, with a close button in the corner. */
html[data-inspect="off"] .inspect-card.is-pinned { display: block !important; }
html[data-hints="off"] #tooltip.is-pinned { display: block !important; }
#tooltip.is-pinned { pointer-events: auto; padding-right: 26px; }
.inspect-card.is-pinned { padding-right: 30px; }
.inspect-close, .tip-close {
  position: absolute; top: 6px; right: 6px; width: 20px; height: 20px; padding: 0; border: 0;
  border-radius: 50%; background: rgba(255, 255, 255, .08); color: #e9e5de; font-size: 14px;
  line-height: 20px; text-align: center; cursor: pointer;
}
.inspect-close:hover, .tip-close:hover { background: rgba(255, 255, 255, .18); }
