/*
 * EncodeLabel kit: the monthly allowance (goes with assets/js/kit-usage.js).
 *
 * Two things live here:
 *   .usage-meter    the quiet line "62 of 100 free labels left this month"
 *   .usage-limit    what is inside the "not enough left" pop-up: the numbers
 *                   and the choices (print the first 60, buy credits, order)
 *
 * Everything else (the pop-up itself, buttons, the status line) is the
 * shell's, from site.css. Colours come from the design tokens only, so the
 * light and the dark theme both work.
 */

/* ---- The meter ------------------------------------------------------------ */
/* It is a .status-line; these rules only make a long line wrap tidily. */
.usage-meter { align-items: flex-start; margin: 8px 0 0; }
.usage-meter::before { align-self: flex-start; margin-top: .5em; }
.usage-meter > span { min-width: 0; }
.usage-meter a { font-weight: 600; white-space: nowrap; }
/* Amber, never red: running low is worth knowing, not worth a fright. */
.usage-meter.is-warn a { color: var(--link); }

/* ---- Inside the pop-up ------------------------------------------------------ */
.usage-numbers { margin: 0 0 16px; font-size: 1.05rem; line-height: 1.5; }
.usage-numbers strong { font-weight: 700; white-space: nowrap; }

.usage-choices { display: grid; gap: 8px; margin: 0 0 16px; padding: 0; list-style: none; }
.usage-choices > li { margin: 0; }

/* One choice: a picture, two lines of words, an arrow. A <button> or an <a>. */
.usage-choice {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  width: 100%; min-height: 64px; padding: 10px 10px 10px 12px;
  border: 1px solid var(--field-line); border-radius: var(--radius-small);
  background: var(--card); color: var(--ink);
  font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.usage-choice:hover { border-color: var(--ink); background: color-mix(in srgb, var(--ink) 5%, var(--card)); }
.usage-choice-icon {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--radius-small); background: var(--soft); color: var(--link);
}
.usage-choice-words { display: block; min-width: 0; }
.usage-choice-title { display: block; font-weight: 650; line-height: 1.3; }
.usage-choice-note { display: block; margin-top: 2px; color: var(--muted); font-size: .9rem; line-height: 1.4; }
.usage-choice-go { display: grid; place-items: center; color: var(--muted); }
.usage-choice:hover .usage-choice-go { color: var(--ink); }

/* While one choice is being checked with the server the others wait. */
.usage-choices[aria-busy="true"] .usage-choice { cursor: progress; }
.usage-choices[aria-busy="true"] .usage-choice:not([aria-busy="true"]),
.usage-choices[aria-busy="true"] ~ .usage-login { opacity: .5; }
.usage-choice[aria-busy="true"] { display: flex; justify-content: center; gap: 10px; opacity: 1; font-weight: 600; }

.usage-login { margin: 0 0 16px; font-size: .95rem; }
.usage-fine { margin: 0; }
/* News about the pop-up itself ("your numbers have just changed"), under the numbers. */
.usage-limit > .status-line { align-items: flex-start; min-height: 0; margin: -6px 0 14px; }
.usage-limit > .status-line::before { align-self: flex-start; margin-top: .5em; }
.usage-limit > .status-line:empty { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .usage-choice { transition: background-color .15s, border-color .15s; }
}
