/* The one loader (om-wmnnk): the ordermetrics mark, its ring still, its two bars rising and settling in turn.
   One motion language for the three sizes. It waits 300 ms before it shows so a quick load never flashes it, and it
   holds its space from the start (no layout shift). Under reduced motion: the still mark and its words (style.css
   stops every animation then, so nothing here may depend on an animation to become visible). */
:root {
  --om-loader-mark: var(--mark);      /* the logo's own colour (dist/mark.svg), ruling DS1 */
  --om-loader-ring: color-mix(in srgb, var(--mark) 58%, transparent);
  --om-loader-delay: 300ms;
  --om-loader-cycle: 2.4s;            /* one calm breath, not a spinner */
}
:root[data-theme="light"] {
  --om-loader-ring: color-mix(in srgb, var(--mark) 50%, transparent);
}

.om-loader {
  display: inline-flex; align-items: center; gap: var(--space-2, 8px);
  color: var(--paper-3); font: var(--weight-medium, 500) var(--text-small, 13px)/1.35 var(--font-ui);
  vertical-align: middle; min-inline-size: 0; max-inline-size: 100%;
}
.om-loader-mark { flex: none; inline-size: 1.25em; block-size: 1.25em; overflow: visible; }
.om-loader-ring { fill: var(--om-loader-ring); }
.om-loader-bar { fill: var(--om-loader-mark); }
.om-loader-halo { display: none; fill: none; stroke: var(--om-loader-mark); stroke-width: 1; vector-effect: non-scaling-stroke; }
.om-loader-words { min-inline-size: 0; overflow-wrap: anywhere; text-wrap: balance; }

/* inline: a line of text or a button; the mark is the line's height. */
.om-loader[data-loader="inline"] { gap: .45em; font: inherit; color: inherit; }
.om-loader[data-loader="inline"] .om-loader-mark { inline-size: 1.1em; block-size: 1.1em; }

/* block: a card, a panel, a table body. It takes the height of the figure it stands for. */
.om-loader[data-loader="block"] { display: flex; min-block-size: var(--figure-medium, 28px); }
.om-loader[data-loader="block"] .om-loader-mark { inline-size: 22px; block-size: 22px; }

/* ambient: a whole surface. The mark, larger, with its words under it, centred in what holds it. */
.om-loader[data-loader="ambient"] {
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-3, 12px);
  font: var(--weight-medium, 500) var(--text-note, 15px)/1.4 var(--font-ui); color: var(--paper-2); text-align: center;
}
.om-loader[data-loader="ambient"] .om-loader-mark { inline-size: 72px; block-size: 72px; margin-block-end: var(--space-3, 12px); }
.om-loader[data-loader="ambient"] .om-loader-words { max-inline-size: 36ch; }

/* A card's or a page's face while its reading loads: the mark large in the middle of the body, its words under it,
   so a waiting card reads as waiting from across the canvas. The empty axis line is not drawn under it. */
.om-component:is([data-size="card"], [data-size="page"])[data-state="loading"] > .om-loader[data-loader="block"] {
  flex: 1 1 auto; flex-direction: column; justify-content: center; align-items: center; gap: 18px;
  min-block-size: 132px; padding-block: var(--space-3, 12px); text-align: center;
  font: var(--weight-medium, 500) var(--text-small, 13px)/1.4 var(--font-ui);
}
.om-component:is([data-size="card"], [data-size="page"])[data-state="loading"] > .om-loader[data-loader="block"] .om-loader-mark { inline-size: 52px; block-size: 52px; }
.om-component:is([data-size="card"], [data-size="page"])[data-state="loading"] > .om-loader[data-loader="block"] .om-loader-words { max-inline-size: 30ch; color: var(--paper-2); }
.om-component:is([data-size="card"], [data-size="page"])[data-state="loading"] > .om-baseline { display: none; }
.ss-first-sync .om-loader[data-loader="block"] .om-loader-mark { inline-size: 32px; block-size: 32px; }
/* Ruling LD1: a panel's figures on their way (the full-size card, the inspector, a chart or table body): the card's own
   face, the large mark in the middle of where the figures will stand with its one line under it. */
.om-reading-wait { display: flex; flex: 1 1 auto; justify-content: center; align-items: center; min-block-size: 220px; inline-size: 100%; }
.om-reading-wait > .om-loader[data-loader="block"] {
  flex-direction: column; justify-content: center; align-items: center; gap: 18px; text-align: center;
  font: var(--weight-medium, 500) var(--text-small, 13px)/1.4 var(--font-ui);
}
.om-reading-wait > .om-loader[data-loader="block"] .om-loader-mark { inline-size: 52px; block-size: 52px; }
.om-reading-wait > .om-loader[data-loader="block"] .om-loader-words { max-inline-size: 30ch; color: var(--paper-2); }
.cs-reading-updating { color: var(--paper-3); font: var(--weight-medium, 500) var(--text-small, 13px)/1.35 var(--font-ui); white-space: nowrap; }
/* A reading that could not be worked out: its line where the loading line stood, the same size, Try again beside it. */
.om-reading-failed {
  display: flex; flex: 1 1 auto; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 14px;
  min-block-size: 220px; inline-size: 100%; text-align: center; color: var(--paper-2);
  font: var(--weight-medium, 500) var(--text-small, 13px)/1.4 var(--font-ui);
}
.om-reading-failed > p { margin: 0; max-inline-size: 36ch; text-wrap: balance; }

@media (prefers-reduced-motion: no-preference) {
  .om-loader[data-loader="ambient"] .om-loader-halo,
  .om-reading-wait > .om-loader[data-loader="block"] .om-loader-halo,
  .om-component[data-state="loading"] > .om-loader[data-loader="block"] .om-loader-halo {
    display: block; transform-box: fill-box; transform-origin: 50% 50%;
    animation: om-loader-halo var(--om-loader-cycle) cubic-bezier(.2, .6, .3, 1) infinite both;
  }
  .om-loader { opacity: 0; animation: om-loader-in 420ms cubic-bezier(.2, .8, .2, 1) var(--om-loader-delay) forwards; }
  .om-loader-bar {
    transform-box: fill-box; transform-origin: 50% 100%;
    animation: om-loader-rise var(--om-loader-cycle) cubic-bezier(.45, 0, .55, 1) infinite both;
  }
  .om-loader-bar[data-bar="2"] { animation-delay: calc(var(--om-loader-cycle) * .18); }
  .om-loader[data-loader="ambient"] .om-loader-ring { animation: om-loader-glow calc(var(--om-loader-cycle) * 2) ease-in-out infinite; }
}
@keyframes om-loader-in { to { opacity: 1; } }
/* A bar rises from just below its place to its place, holds, and sinks back a little: never a jump, never a flash. */
@keyframes om-loader-rise {
  0%, 100% { opacity: .2; transform: translateY(26%) scaleY(.62); }
  42%, 62% { opacity: 1; transform: none; }
}
/* The halo leaves the ring's edge, widens and is gone before the next breath: seen at the edge of the eye, never loud. */
@keyframes om-loader-halo {
  0% { opacity: .5; transform: scale(.96); }
  70%, 100% { opacity: 0; transform: scale(1.5); }
}
@keyframes om-loader-glow { 0%, 100% { opacity: .75; } 50% { opacity: 1; } }

/* The band's tile and a card's face: the loader in place of the figure, its words beside it. */
#slots .band-tile .band-loader { margin: 4px 0; }
#slots .band-lead .band-loader { margin: 8px 0; }
#slots .band-tile .band-loader .om-loader-mark { inline-size: 1.35em; block-size: 1.35em; }
.band-loader .om-loader-words, .om-component .om-loader .om-loader-words { color: var(--paper-3); }

/* A syncing store's chip (sync-chip.js): the running pill's family (dist/ask/ask.css .ask-running), right-aligned
   above the Ask anything bar and stacked above that pill. One chip per store; pressing it opens its detail. */
.om-sync-chips { position: fixed; z-index: 8989; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-inline-size: min(560px, calc(100vw - 32px)); pointer-events: none; }
.om-sync-chips[hidden], :root[data-ask-open] .om-sync-chips { display: none; }
.om-sync-chip-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; max-inline-size: 100%; pointer-events: auto; }
.om-sync-chip {
  display: flex; align-items: center; gap: 8px; block-size: 30px; min-inline-size: 0; max-inline-size: 100%; padding: 0 12px 0 10px;
  box-sizing: border-box; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--table); box-shadow: var(--raise-2);
  font: var(--text-tick)/1 var(--font-ui); color: var(--paper-2); cursor: pointer; white-space: nowrap;
}
.om-sync-chip:hover { color: var(--paper); }
.om-sync-chip:focus-visible { outline: 2px solid var(--lamp-ink); outline-offset: 2px; }
.om-sync-chip .om-loader { flex: none; }
.om-sync-chip .om-loader-mark { inline-size: 14px; block-size: 14px; }
.om-sync-chip-words { min-inline-size: 0; overflow: hidden; text-overflow: ellipsis; color: var(--paper); }
.om-sync-chip-time { flex: none; font-variant-numeric: tabular-nums; color: var(--paper-3); }
.om-sync-chip-time:empty { display: none; }
.om-sync-chip-wrap[data-state="ready"] .om-loader-bar { animation: none; opacity: 1; transform: none; }
.om-sync-chip-wrap[data-state="attention"] .om-sync-chip-words { color: var(--ember); }
.om-sync-detail {
  inline-size: min(360px, calc(100vw - 32px)); box-sizing: border-box; padding: 12px 14px; border: 1px solid var(--rule-strong);
  border-radius: var(--radius-sheet, 14px); background: var(--table); box-shadow: var(--raise-2); display: grid; gap: 4px;
}
.om-sync-detail[hidden] { display: none; }
.om-sync-detail p { margin: 0; font: var(--text-small, 13px)/1.4 var(--font-ui); }
.om-sync-detail-title { color: var(--paper); font-weight: var(--weight-strong) !important; }
.om-sync-detail-now { color: var(--paper-2); }
.om-sync-detail-next { color: var(--paper-3); }

/* The canvas before its first card: the ambient loader, centred, under the strip; it lets the canvas be used. */
.om-first-sync-ambient { position: absolute; inset-block-start: 50%; inset-inline-start: 50%; translate: -50% -50%; z-index: 3; pointer-events: none; }

/* A card keeping its last finished reading while the next is worked out (state "refreshing"): a small badge on its
   top edge says so, clear of the card's own controls; the figure stays, never blank. */
.om-component[data-state="refreshing"]::after {
  content: "Updating"; position: absolute; inset-block-start: 0; inset-inline-end: 18px; translate: 0 -50%; z-index: 1;
  padding: 2px 8px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--table);
  font: var(--text-tick)/1.2 var(--font-ui); color: var(--paper-2); pointer-events: none;
}
/* om-wigsj (never a blank card): a last answer (another day's range, or from before a cost change). The same badge, as
   a real element so its hover names the days shown (anatomy.js om-last-shown); the figures one step quieter (quiet ink)
   until today's arrive. Nothing moves: the badge sits where the Updating badge sits, the figures keep their places. */
.om-component[data-state="refreshing"][data-last-shown]::after { content: none; }
.om-last-shown {
  position: absolute; inset-block-start: 0; inset-inline-end: 18px; translate: 0 -50%; z-index: 1; margin: 0;
  padding: 2px 8px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--table);
  font: var(--text-tick)/1.2 var(--font-ui); color: var(--paper-2); white-space: nowrap;
}
.om-component[data-last-shown="failed"] .om-last-shown { color: var(--ember); }
.om-component[data-last-shown] :is(.om-reading-amount, .om-total-value, .om-figure-totals, .om-component-chart) { color: var(--paper-2); }
/* om-ds3lv (the owner, 23 Nov: "an opaque overlay over the prior version of the canvas card with the loading icon"): a card
   whose QUESTION changed (a new period) while its answer is out keeps its place and size; a veil of its own surface covers
   its old content, leaving a faint shape and no readable figure, and the app's one loader (the mark of a card's first
   load, at the same size) sits in its middle. The title stays readable above it; no Updating badge; no held dimming.
   On at once (no fade in, no delay: within the frame of the change); lifted when the answer lands, the new content
   already in place underneath. Reduced motion: the still mark (style.css stops the bars). */
:root { --om-veil-alpha: 92%; --om-veil-band-alpha: 95%; --om-veil-blur: 3px; }   /* Night: a card's small figures at 92% are a faint shape; the band's
                                                               large ones need 95% (measured in both engines, 1440 wide) */
:root[data-theme="light"] { --om-veil-alpha: 90%; --om-veil-band-alpha: 95%; }
.om-component[data-veiled] > .om-veil {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center;
  border-radius: inherit; pointer-events: none;
  background: color-mix(in srgb, var(--table) var(--om-veil-alpha), transparent);
  -webkit-backdrop-filter: blur(var(--om-veil-blur)); backdrop-filter: blur(var(--om-veil-blur));
}
.om-component[data-veiled] > .om-component-heading { z-index: 3; }
.om-component[data-veiled][data-state="refreshing"]::after { content: none; }
.om-component[data-veiled][data-held="true"] { opacity: 1; }
.om-veil > .om-loader[data-loader="block"] { --om-loader-delay: 0ms; min-block-size: 0; }
.om-veil > .om-loader[data-loader="block"] .om-loader-mark { inline-size: 52px; block-size: 52px; }
.om-component:is([data-size="tile"], [data-size="folded"]) > .om-veil > .om-loader[data-loader="block"] .om-loader-mark { inline-size: 26px; block-size: 26px; }
/* The band's tile (band/tile.js), the same veil over its figure, line and note; its title above it. */
#slots .band-tile > .band-veil {
  position: absolute; inset: 0; z-index: 2; display: flex; align-items: center; justify-content: center; pointer-events: none;
  border-radius: inherit; background: color-mix(in srgb, var(--table) var(--om-veil-band-alpha), transparent);
  -webkit-backdrop-filter: blur(var(--om-veil-blur)); backdrop-filter: blur(var(--om-veil-blur));
}
#slots .band-tile[data-veiled] > .band-head { position: relative; z-index: 3; }
#slots .band-tile > .band-veil > .om-loader { --om-loader-delay: 0ms; }
#slots .band-tile > .band-veil .om-loader-mark { inline-size: 26px; block-size: 26px; }
/* A card opened full size (component-studio.js): its figures under the same veil while its new question is out. */
.cs-veiled-host { position: relative; }
.cs-veil {
  position: absolute; inset: 0; z-index: 4; display: flex; align-items: center; justify-content: center; pointer-events: none;
  border-radius: inherit; background: color-mix(in srgb, var(--table) var(--om-veil-alpha), transparent);
  -webkit-backdrop-filter: blur(var(--om-veil-blur)); backdrop-filter: blur(var(--om-veil-blur));
}
.cs-veil[hidden] { display: none; }
.cs-veil > .om-loader { --om-loader-delay: 0ms; }
.cs-veil > .om-loader[data-loader="block"] .om-loader-mark { inline-size: 52px; block-size: 52px; }
/* The veil's mark is there with the veil, at once: not the 300 ms wait and fade of a first load (that wait keeps a quick
   load from flashing; here the veil itself already says the card waits). */
.om-veil > .om-loader, #slots .band-tile > .band-veil > .om-loader, .cs-veil > .om-loader { opacity: 1; animation: none; }
/* The Director's (c), 23 Nov: at 9 to 25 s a bare mark reads as a stuck app: the veil names what it waits for, the period
   as the date control words it (app.js veilWords: --om-veil-words, 'Last 30 days'), under the mark. */
/* The mark stays in the very middle; the words stand just under it (half the mark's size, then a gap). */
.om-veil, .cs-veil { --om-veil-mark-half: 26px; }
#slots .band-tile > .band-veil, .om-component:is([data-size="tile"], [data-size="folded"]) > .om-veil { --om-veil-mark-half: 13px; }
.om-veil::after, #slots .band-tile > .band-veil::after, .cs-veil::after {
  content: var(--om-veil-words, ""); position: absolute; inset-inline: 5%; inset-block-start: calc(50% + var(--om-veil-mark-half) + 8px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center;
  font: var(--weight-medium, 500) var(--text-small, 13px)/1.3 var(--font-ui); color: var(--paper-2);
}
#slots .band-tile > .band-veil::after, .om-component:is([data-size="tile"], [data-size="folded"]) > .om-veil::after {
  inset-block-start: calc(50% + var(--om-veil-mark-half) + 3px); font-size: var(--text-tick, 11px);
}
@media (prefers-reduced-motion: no-preference) {
  .om-veil > .om-loader[data-loader="block"] .om-loader-halo, .cs-veil > .om-loader .om-loader-halo {
    display: block; transform-box: fill-box; transform-origin: 50% 50%;
    animation: om-loader-halo var(--om-loader-cycle) cubic-bezier(.2, .6, .3, 1) infinite both;
  }
}

