﻿/* Base typography, surfaces and direction handling. One job: the app's visual foundation. */

/* Design-token channels (R G B) consumed by tailwind-config.js as `rgb(var(--c-x) / a)`.
   These are the light-theme values — identical to the original literals, so light renders
   byte-for-byte as before. The dark theme only overrides these variables (see dark.css). */
:root {
  --c-ink:      56 56 87;    /* #383857 */
  --c-inksoft:  61 61 77;    /* #3d3d4d */
  --c-muted:    113 118 128; /* #717680 */
  --c-track:    236 236 241; /* #ECECF1 */
  --c-bar:      201 201 217; /* #C9C9D9 */
  --c-line:     234 234 236; /* #EAEAEC */
  --c-canvas:   250 250 251; /* #FAFAFB */

  /* Surface = the elevated panel colour that views spell as `bg-white`. Kept as a token so
     dark.css can retint every card/menu/input at once. Light: plain white. */
  --c-surface:  255 255 255;
}

/* The `hidden` attribute means "not relevant", and nothing about layout should be able to argue.
 *
 * The browser's own rule is `[hidden] { display: none }` — specificity 0,1,0, the same as a class. So
 * ANY class that sets a display beats it whenever it is declared later, and `<div class="modal" hidden>`
 * renders. That is not theoretical: the "Ask for more allowance" dialog on the billing page has
 * `.reason-backdrop { display: flex }`, and it opened by itself on every page load the moment stylesheet
 * order shifted (the Tailwind CDN used to inject its reset last, at runtime; a compiled stylesheet is
 * linked first, like any other file).
 *
 * `!important` is the documented idiom for exactly this attribute, and is the only form that does not
 * depend on which file happens to load last — a dependency that would break again the next time a
 * stylesheet moves. */
[hidden] {
  display: none !important;
}

body {
  font-family: 'IBM Plex Sans', 'Inter', system-ui, sans-serif;
}

html[dir="rtl"] body {
  font-family: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;
}

.card {
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

/* Directional glyphs (back arrows, chevrons) must mirror in RTL. */
html[dir="rtl"] .dir-arrow {
  display: inline-block;
  transform: scaleX(-1);
}

/* There used to be a `max-width: 640px` block here that hid the nav labels and the language label to
   "compact" the desktop header on a phone. It is gone, and deliberately: it never fixed anything. The
   header still needed 724px, so every page in the application scrolled sideways by 334px, and all the
   rule bought was five unlabelled icons — a nav you had to guess at. Below `lg` the desktop header is
   now not rendered at all; _MobileNav draws a top bar, a bottom tab bar and a drawer instead. */

/* ── Waiting ─────────────────────────────────────────────────────────────────
   Two pieces, both global, because the JS that uses them is global.

   .btn-spinner was defined only in billing.css and two-factor.css, so form-busy.js — which runs on
   every page — inserted an element with no styling anywhere else. Every busy control outside those
   two pages showed a bare unstyled box. It belongs here, once. */

@keyframes mdw-spin { to { transform: rotate(360deg); } }

.btn-spinner {
  display: inline-block;
  width: .85em;
  height: .85em;
  margin-inline-end: .45em;
  vertical-align: -.1em;
  border: 2px solid currentColor;      /* works on a dark button and a bordered one alike */
  border-top-color: transparent;
  border-radius: 50%;
  animation: mdw-spin .6s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  /* Fade rather than spin. */
  .btn-spinner { animation: mdw-spin-fade 1.2s ease-in-out infinite; }
  @keyframes mdw-spin-fade { 50% { opacity: .35; } }
}
