/* ── Inter ───────────────────────────────────────────────────────────────
 * Self-hosted, because the CSP is `font-src 'self'`: a webfont host would need
 * that opened up AND `style-src` for its stylesheet, which is exactly what the
 * two apps this replaces did and what let them block first paint on a third
 * party.
 *
 * One variable file per subset, carrying both axes (`opsz` and `wght` 100-900),
 * so every weight the app uses is one download. Browsers default
 * `font-optical-sizing: auto`, so the hero amount gets Inter's display cut and
 * body text its text cut without a line of CSS — which is the nearest honest
 * replacement for the width-axis gesture the original system had, since Inter
 * has no width axis at all.
 *
 * latin-ext is declared but only fetched if someone actually types a character
 * in its range; that is what `unicode-range` is for.
 *
 * Inter is SIL Open Font License 1.1 — see web/fonts/LICENSE.txt.
 */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-opsz-normal.woff2") format("woff2-variations");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Design tokens.
 *
 * Grounding: a household ledger for a few people in Kigali, on a phone, several
 * times a day. RWF amounts are five to seven digits with no decimals
 * (RWF 1,248,000) — long zero-decimal numerals are the real content, and the
 * whole system is sized around them.
 *
 * One accent for the entire app. Modules are NOT colour-coded: a module hue
 * would encode nothing the nav doesn't already say, and spending colour on it
 * would leave none for meaning. Here colour means exactly one thing — the sign
 * and state of a number.
 */

:root {
  /* Warm near-neutrals, carried over from the app this replaces: white page,
     the same paper-grey for header rows and quiet fills, hairlines as alpha on
     black so they sit correctly on either. Light and dark stay in one hue
     family — a cool light under a warm dark reads as a bug, not a choice. */
  --canvas:     #FFFFFF;
  --surface:    #FFFFFF;
  --surface-2:  #F5F5F3;
  --rule:       rgba(0, 0, 0, 0.10);
  --rule-firm:  rgba(0, 0, 0, 0.18);

  --ink:        #1A1A18;
  --ink-2:      #6B6B67;
  --ink-3:      #9B9B97;

  /* The deep teal of the 5,000-franc note — the money this app counts. It also
     keeps the one piece of visual DNA from envelopes (#4FD1C5, now the dark
     variant), which is the app that gets used most. */
  --accent:     #0B6E72;
  --accent-dim: rgba(11, 110, 114, 0.12);
  --on-accent:  #FFFFFF;
  /* The same value, but never rebound by a state. Use it where a rebound
     --accent would be wrong — a selected card whose status already set
     --accent to grey needs a selection colour that still reads as one. */
  --accent-app: #0B6E72;

  /* Semantic — the only other colour in the app. Fixed meaning everywhere. */
  --in:         #3B6D11;  --in-dim:   #EAF3DE;
  --out:        #A32D2D;  --out-dim:  #FCEBEB;
  --due:        #854F0B;  --due-dim:  #FAEEDA;

  --overlay:    rgba(0, 0, 0, 0.50);
  --focus:      #185FA5;

  /* One family for everything. The fallbacks matter for the first paint before
     the woff2 lands (font-display: swap) and for emoji, which always come from
     the platform. */
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --t-micro: 11px;
  --t-label: 12px;
  --t-small: 13px;
  --t-body:  15px;
  --t-input: 16px;   /* never smaller — anything less makes iOS Safari zoom */
  --t-lead:  17px;
  --t-h2:    20px;
  --t-h1:    26px;
  --t-hero:  34px;

  /* Radius by hierarchy, not one value on everything. */
  --r-1: 6px;    /* inputs, chips, small controls */
  --r-2: 10px;   /* buttons, menus */
  --r-3: 16px;   /* sheets, dialogs */
  --r-full: 999px;

  --s-1: 4px;  --s-2: 8px;  --s-3: 12px; --s-4: 16px;
  --s-5: 24px; --s-6: 32px; --s-7: 48px;

  /* Elevation is reserved for things that genuinely float. Rows and tiles get
     none — uniform soft shadows on identical rounded cards is the tell. */
  --shadow-sheet: 0 -10px 44px rgba(0, 0, 0, 0.22);
  --shadow-menu:  0 8px 28px rgba(0, 0, 0, 0.18);

  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left:   env(safe-area-inset-left, 0px);
  --safe-right:  env(safe-area-inset-right, 0px);

  --ease: cubic-bezier(0.22, 1, 0.36, 1);

  --rail-w: 76px;
  --bar-h: 58px;
}

@media (min-width: 900px) {
  :root { --t-hero: 44px; }
}

/* Dark values, declared once and applied by either trigger: the system setting
 * (unless the viewer has explicitly chosen light), or an explicit choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --canvas:     #1A1A18;
    --surface:    #1C1C1A;
    --surface-2:  #252523;
    --rule:       rgba(255, 255, 255, 0.10);
    --rule-firm:  rgba(255, 255, 255, 0.18);

    --ink:        #E8E8E4;
    --ink-2:      #9B9B97;
    --ink-3:      #6B6B67;

    --accent:     #43C8CE;
    --accent-dim: rgba(67, 200, 206, 0.14);
    --on-accent:  #06231F;
    --accent-app: #43C8CE;

    --in:  #C0DD97;  --in-dim:  #1B3A0A;
    --out: #F7C1C1;  --out-dim: #4A1515;
    --due: #FAC775;  --due-dim: #412404;

    --overlay: rgba(0, 0, 0, 0.62);
    --focus:   #B5D4F4;

    --shadow-sheet: 0 -10px 44px rgba(0, 0, 0, 0.55);
    --shadow-menu:  0 8px 28px rgba(0, 0, 0, 0.45);
  }
}

:root[data-theme="dark"] {
  --canvas:     #1A1A18;
  --surface:    #1C1C1A;
  --surface-2:  #252523;
  --rule:       rgba(255, 255, 255, 0.10);
  --rule-firm:  rgba(255, 255, 255, 0.18);

  --ink:        #E8E8E4;
  --ink-2:      #9B9B97;
  --ink-3:      #6B6B67;

  --accent:     #43C8CE;
  --accent-dim: rgba(67, 200, 206, 0.14);
  --on-accent:  #06231F;
  --accent-app: #43C8CE;

  --in:  #C0DD97;  --in-dim:  #1B3A0A;
  --out: #F7C1C1;  --out-dim: #4A1515;
  --due: #FAC775;  --due-dim: #412404;

  --overlay: rgba(0, 0, 0, 0.62);
  --focus:   #B5D4F4;

  --shadow-sheet: 0 -10px 44px rgba(0, 0, 0, 0.55);
  --shadow-menu:  0 8px 28px rgba(0, 0, 0, 0.45);
}
