/* @nax/ui frame kit: the rules of base.css and kit.css that the frame itself draws with, for a
   product that loads frame.css without them (Naxirion Manage, whose own class names kit.css would
   restyle, and whose own element styles base.css would replace): the side sheet a phone's menu
   opens in, its scrim and its hidden title, the tips that name the folded rail's icons, the
   menu the account switcher opens, the dialog its "Choose customers…" opens (0.9.2), and the
   light or dark choice a settings page draws (1.0.0). base.css's rules for that dialog are
   written under :where(.dialog), so they reach nothing outside it and weigh what they weigh in
   base.css.

   Made from base.css and kit.css by scripts/frame_kit_css.py: change a rule there and run the
   script, never here. Load it before frame.css. The tip draws with the product's night tokens
   (--night, --night-rule, --night-strong). */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

:where(.dialog) {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: var(--text-md)/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
}

:where(.dialog) h2 {
  line-height: 1.25;
  margin: 0 0 0.75rem;
  text-wrap: balance;
}

:where(.dialog) h2 {
  font-size: var(--text-lg);
  font-weight: 600;
}

:where(.dialog) p {
  margin: 0 0 0.75rem;
}

:where(.dialog) .muted {
  color: var(--muted);
}

:where(.dialog) label {
  display: grid;
  gap: 6px;
  font-weight: 600;
  font-size: var(--text-sm);
}

:where(.dialog) input {
  font: inherit;
  font-size: var(--text-md);
  padding: 7px 10px;
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-control);
  background: var(--surface);
  color: var(--ink);
}

:where(.dialog) input::placeholder {
  color: var(--faint);
}

:where(.dialog) input:focus-visible,
:where(.dialog) button:focus-visible,
:where(.dialog) [role="option"]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

:where(.dialog) input:focus-visible {
  outline-offset: 0;
  border-color: var(--accent);
}

:where(.dialog) button {
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.3;
  padding: 7px 14px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-control);
  background: var(--accent);
  color: var(--on-accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

:where(.dialog) button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 88%, var(--ink));
}

:where(.dialog) button:disabled {
  opacity: 0.55;
  cursor: default;
}

:where(.dialog) button.secondary {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--rule-strong);
  box-shadow: var(--shadow-sm);
}

:where(.dialog) button.secondary:hover:not(:disabled) {
  background: var(--sunk);
}

:where(.dialog) button svg {
  width: 15px;
  height: 15px;
  flex: none;
}

:where(.dialog) .grid-form {
  display: grid;
  gap: 14px;
  max-width: 560px;
}

.scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: 50;
  animation: fade-in 120ms ease-out;
}

.dialog {
  position: fixed;
  top: 14vh;
  left: 50%;
  transform: translateX(-50%);
  width: min(500px, calc(100vw - 32px));
  max-height: 76vh;
  overflow: auto;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-box);
  box-shadow: var(--shadow-lg);
  z-index: 51;
  padding: 20px 22px;
  display: grid;
  gap: 14px;
  animation: rise-in 140ms ease-out;
}

.dialog h2 {
  margin: 0;
  font-size: var(--text-xl);
}

.dialog .lede {
  margin: -6px 0 0;
  color: var(--muted);
  font-size: var(--text-md);
}

.dialog .buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* A mark's word on hover (D163), night in both themes as HostedScan's is, with a rule so it still
   stands off a dark page. */
.tip {
  z-index: 70;
  padding: 4px 10px;
  border: 1px solid var(--night-rule);
  border-radius: var(--radius-control);
  background: var(--night);
  color: var(--night-strong);
  font-size: var(--text-sm);
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.sheet {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  width: min(280px, 86vw);
  z-index: 51;
  box-shadow: var(--shadow-lg);
  animation: slide-in 160ms ease-out;
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
}

@keyframes slide-in {
  from {
    transform: translateX(-24px);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scrim,
  .dialog,
  .sheet {
    animation: none;
  }
}

.menu {
  min-width: 230px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: var(--radius-box);
  box-shadow: var(--shadow-lg);
  padding: 6px;
  z-index: 60;
  font-size: var(--text-sm);
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  outline: none;
  color: var(--ink);
  text-decoration: none;
  user-select: none;
}

.menu-item[data-highlighted] {
  background: var(--sunk);
}

.menu-item[data-disabled] {
  color: var(--faint);
  cursor: default;
}

.menu-item svg {
  width: 15px;
  height: 15px;
  color: var(--muted);
  flex: none;
}

.menu-item .check {
  margin-left: auto;
  color: var(--ink);
}

.menu-item[data-state="open"] {
  background: var(--sunk);
}

/* A menu's own parts: who it is about at its head (a section's pages, beside the folded rail), a
   group's heading, and a line between groups. Last, as they came after every rule above in the
   products. */
.menu-label {
  padding: 8px 10px 6px;
  font-size: var(--text-xs);
  color: var(--muted);
  display: grid;
  gap: 1px;
}

.menu-label b {
  color: var(--ink);
  font-weight: 600;
  font-size: var(--text-sm);
}

.menu-group-label {
  padding: 8px 10px 4px;
  font: 600 var(--text-xs)/1 var(--font-body);
  color: var(--faint);
}

.menu-sep {
  height: 1px;
  background: var(--rule);
  margin: 5px 4px;
}

/* Light, dark or the device's, on a settings page (`AppearanceSetting`, 1.0.0): three choices side
   by side in a sunk band, the chosen one raised onto the page's paper, as the menu's choices were
   ticked. Each is a radio whose dot is hidden: the band says which, and the arrow keys move along
   it. In frame-kit.css too, since Manage and Watch draw it without this file. */
.appearance {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-box);
  background: var(--sunk);
}

.appearance-choice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 6px;
  color: var(--muted);
  font-size: var(--text-sm);
  line-height: 1.4;
  cursor: pointer;
  user-select: none;
}

.appearance-choice:hover {
  color: var(--ink);
}

.appearance-choice[data-checked] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

.appearance-choice:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.appearance-choice svg {
  width: 16px;
  height: 16px;
  flex: none;
}
