/* Budget Hub design tokens. The single source of colour, type, space, radius and motion.
   Light theme first (read in the sun), dark theme complete. Never hard-code a colour in a
   screen stylesheet: use these names. See web/DESIGN.md for the rules. */

@font-face {
  font-family: "Archivo";
  src: url("../fonts/archivo-var-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: block;
}

:root {
  color-scheme: light;

  /* ---- Surfaces: chalk and ink ---- */
  --chalk: #E9ECE6;          /* the page */
  --surface: #F5F7F3;        /* sheets, raised panels */
  --sunk: #DEE3DB;           /* wells, tracks, pressed rows */
  --ink: #14201A;            /* text, glass outline */
  --ink-2: #4A5650;          /* secondary text, 6.4:1 on chalk */
  --ink-3: #737D77;          /* tertiary marks only, never body text */
  --hair: rgba(20, 32, 26, .12);
  --hair-2: rgba(20, 32, 26, .22);
  --on-ink: #F5F7F3;         /* text on an ink fill */
  --on-acc: #FFFFFF;         /* a glyph on a solid category accent */
  --island: #0A0D0B;         /* the arrival capsule (the Dynamic Island's black) */
  --on-island: #F2F5F2;
  --on-island-2: rgba(242, 245, 242, .72);
  --scrim: 10, 18, 13;       /* rgb of the dimming layer under sheets */

  /* ---- The one vivid colour: the pace (liquid, rule, ruler, score) ---- */
  --green: #1F9D63;   --green-deep: #117045;   /* deep = as text, 5.1:1 on chalk */
  --yellow: #F2B200;  --yellow-deep: #7E5C00;  /* yellow is never text: use -deep */
  --red: #D9472B;     --red-deep: #A3321C;
  /* thin marks (the hero rule, the ruler zone, bars): darker than the liquid so a 4 to 6 px
     line keeps 3:1 against its track in the sun; the yellow mark also gets a deep inset edge */
  --green-mark: #178A55;  --yellow-mark: #D49A00;  --red-mark: #C93F24;
  --dry: #A3AAA4;            /* an almost empty liquid drains toward this */
  --pace: var(--green);      /* set by [data-zone] on <html> */
  --pace-deep: var(--green-deep);
  --pace-mark: var(--green-mark);
  --mark-edge: transparent;  /* inset edge of a thin pace mark (yellow only) */

  /* ---- Glass (read by the canvas) ---- */
  --glass-hi: 255, 255, 255;
  --glass-tint: 96, 128, 140;
  --glass-tint-a: .045;
  --glass-shade: 20, 32, 26;

  /* ---- Category accents: muted earth tones, never the pace hues, never purple ----
     The API keeps its names (ink, sun, leaf, coral, sea, plum, sand, sky); they render as
     ink, ochre-brown, sage-grey, terracotta, petrol, aubergine-brown, taupe, slate. */
  --cat-ink: #3D4842;
  --cat-sun: #8E6630;
  --cat-leaf: #5F7262;
  --cat-coral: #A0563F;
  --cat-sea: #2C6370;
  --cat-plum: #6A4651;
  --cat-sand: #7D6F62;
  --cat-sky: #536578;

  /* ---- Type: Archivo variable, one family ---- */
  --font: "Archivo", ui-sans-serif, -apple-system, system-ui, sans-serif;
  --t-hero: 92px;        /* the figure; 820, wdth 116, -0.04em */
  --t-figure: 44px;      /* the big figure of a screen or a sheet (Mois, Catégories, Charges, simulator); 800, wdth 114 */
  --t-display: 34px;     /* tank figures; 780, wdth 112 */
  --t-title: 26px;       /* section titles; 760, wdth 104 */
  --t-headline: 19px;    /* sheet titles, merchant in a sheet; 700 */
  --t-body: 16px;        /* rows, sentences; 440-560 */
  --t-sub: 15px;         /* secondary lines */
  --t-foot: 13px;        /* captions, meta */
  --t-micro: 12px;       /* chips, scale labels */
  --w-display: 116%;     /* font-stretch of big numerals */

  /* ---- Space: 4 / 8 / 12 / 16 / 24 / 40 ---- */
  --s0: 4px; --s1: 8px; --s2: 12px; --s3: 16px; --s4: 24px; --s5: 40px;
  --gutter: 20px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --tabbar-h: 64px;
  --content-bottom: calc(var(--tabbar-h) + 44px + var(--safe-b));

  /* ---- Radius: one scale ---- */
  --r-xs: 10px;   /* chips, small wells */
  --r-s: 14px;    /* fields, rows when pressed */
  --r-m: 18px;    /* grouped panels */
  --r-l: 26px;    /* cards, the simulator */
  --r-tank: 28px; /* the glass */
  --r-sheet: 30px;
  --r-pill: 999px;

  /* ---- Layers ---- */
  --z-compact: 10; --z-edge: 15; --z-tab: 20; --z-flight: 30; --z-island: 35; --z-scrim: 40; --z-sheet: 50; --z-toast: 60;

  /* ---- Icons: one set (Tabler outline), one stroke ---- */
  --icon-stroke: 1.65;

  /* ---- Motion: the JS springs (js/core/motion.js) sampled into CSS linear() ----
     Use the pair together: transition: transform var(--d-snappy) var(--e-snappy). */
  --e-smooth: linear(0, 0.029, 0.083, 0.158, 0.242, 0.319, 0.401, 0.478, 0.543, 0.607, 0.664, 0.71, 0.754, 0.792, 0.822, 0.851, 0.875, 0.894, 0.911, 0.926, 0.938, 0.948, 0.957, 0.964, 0.97, 0.975, 0.979, 0.983, 0.986, 0.988, 0.99, 0.992, 0.993, 0.994, 0.995, 0.996, 0.997, 0.997, 0.998, 0.998, 1);
  --d-smooth: 712ms;
  --e-snappy: linear(0, 0.034, 0.088, 0.168, 0.259, 0.352, 0.43, 0.516, 0.595, 0.666, 0.719, 0.773, 0.82, 0.858, 0.886, 0.913, 0.935, 0.953, 0.965, 0.976, 0.984, 0.99, 0.995, 0.998, 1, 1.002, 1.003, 1.003, 1.004, 1.004, 1.004, 1.003, 1.003, 1.003, 1.002, 1.002, 1.002, 1.001, 1.001, 1.001, 1);
  --d-snappy: 450ms;
  --e-sheet: linear(0, 0.027, 0.076, 0.149, 0.232, 0.309, 0.396, 0.479, 0.547, 0.618, 0.675, 0.732, 0.782, 0.82, 0.856, 0.887, 0.91, 0.931, 0.949, 0.961, 0.973, 0.981, 0.988, 0.993, 0.997, 0.999, 1.001, 1.003, 1.003, 1.004, 1.004, 1.004, 1.004, 1.004, 1.003, 1.003, 1.003, 1.002, 1.002, 1.002, 1);
  --d-sheet: 577ms;
  --e-bouncy: linear(0, 0.026, 0.081, 0.165, 0.254, 0.348, 0.442, 0.533, 0.617, 0.701, 0.768, 0.827, 0.877, 0.918, 0.952, 0.98, 1, 1.015, 1.025, 1.032, 1.035, 1.037, 1.036, 1.034, 1.032, 1.029, 1.025, 1.021, 1.018, 1.015, 1.012, 1.009, 1.007, 1.005, 1.003, 1.002, 1.001, 1, 1, 0.999, 1);
  --d-bouncy: 745ms;
  --e-liquid: linear(0, 0.019, 0.064, 0.124, 0.197, 0.271, 0.351, 0.424, 0.497, 0.562, 0.626, 0.679, 0.728, 0.773, 0.81, 0.844, 0.872, 0.897, 0.917, 0.934, 0.948, 0.96, 0.97, 0.977, 0.984, 0.989, 0.993, 0.996, 0.998, 1, 1.001, 1.002, 1.002, 1.002, 1.003, 1.003, 1.003, 1.002, 1.002, 1.002, 1);
  --d-liquid: 1163ms;
  --e-digits: linear(0, 0.021, 0.063, 0.128, 0.194, 0.265, 0.335, 0.405, 0.471, 0.541, 0.598, 0.65, 0.696, 0.738, 0.776, 0.812, 0.841, 0.866, 0.887, 0.905, 0.921, 0.936, 0.947, 0.957, 0.965, 0.971, 0.978, 0.982, 0.986, 0.989, 0.991, 0.993, 0.995, 0.996, 0.997, 0.998, 0.999, 0.999, 1, 1, 1);
  --d-digits: 545ms;
  /* A press goes down fast (the finger is the clock) and comes back on the snappy spring. */
  --d-press: 90ms;
  --e-press: cubic-bezier(.3, 0, .2, 1);
}

/* The pace zone travels with the score: every carrier reads --pace. */
:root[data-zone="yellow"] { --pace: var(--yellow); --pace-deep: var(--yellow-deep); --pace-mark: var(--yellow-mark); --mark-edge: color-mix(in srgb, var(--yellow-deep) 55%, transparent); }
:root[data-zone="red"] { --pace: var(--red); --pace-deep: var(--red-deep); --pace-mark: var(--red-mark); }

/* ---- Dark: the evening. Same hierarchy, liquids a touch brighter. ---- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --chalk: #0E1411; --surface: #171F1A; --sunk: #1F2823;
    --ink: #E4EAE3; --ink-2: #A3AEA6; --ink-3: #7B867F;
    --hair: rgba(228, 234, 227, .12); --hair-2: rgba(228, 234, 227, .22);
    --on-ink: #101612; --scrim: 0, 0, 0;
    --green: #2BAE6D; --green-deep: #5CCB8F;
    --yellow: #E9AE14; --yellow-deep: #F0C24B;
    --red: #E0583B; --red-deep: #F08D72;
    --dry: #59625C;
    --green-mark: #2BAE6D; --yellow-mark: #E9AE14; --red-mark: #E0583B;
    --on-acc: var(--on-ink);
    --glass-hi: 210, 230, 215; --glass-tint: 160, 190, 200; --glass-tint-a: .06; --glass-shade: 0, 0, 0;
    --cat-ink: #AAB5AD; --cat-sun: #C99A5B; --cat-leaf: #97AB99; --cat-coral: #CE8B73;
    --cat-sea: #70A6B1; --cat-plum: #B48B98; --cat-sand: #B5A595; --cat-sky: #93A6BA;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --chalk: #0E1411; --surface: #171F1A; --sunk: #1F2823;
  --ink: #E4EAE3; --ink-2: #A3AEA6; --ink-3: #7B867F;
  --hair: rgba(228, 234, 227, .12); --hair-2: rgba(228, 234, 227, .22);
  --on-ink: #101612; --scrim: 0, 0, 0;
  --green: #2BAE6D; --green-deep: #5CCB8F;
  --yellow: #E9AE14; --yellow-deep: #F0C24B;
  --red: #E0583B; --red-deep: #F08D72;
  --dry: #59625C;
  --green-mark: #2BAE6D; --yellow-mark: #E9AE14; --red-mark: #E0583B;
  --on-acc: var(--on-ink);
  --glass-hi: 210, 230, 215; --glass-tint: 160, 190, 200; --glass-tint-a: .06; --glass-shade: 0, 0, 0;
  --cat-ink: #AAB5AD; --cat-sun: #C99A5B; --cat-leaf: #97AB99; --cat-coral: #CE8B73;
  --cat-sea: #70A6B1; --cat-plum: #B48B98; --cat-sand: #B5A595; --cat-sky: #93A6BA;
}
