/* =========================================================
   Zeal Portal — the finance scope (arc P)
   /css/system/finance.css

   The arc P boards' values as ROLE tokens, in a layer finance opts into.
   Nothing outside `.fin` changes. A finance page sets
   <body class="fin"> (or a finance tab puts `.fin` on its root) and loads
   this file after colors_and_type.css, then components/finance.css.

   Where the system already holds a board value, the role points at the
   system token; the board's own values fill the rest. The Portal 2.0 UI
   pass can promote this layer to the default, and dark mode becomes one
   more set of values for it. Names are roles, never colours (arc P,
   docs/designs/arc-p-mockups/README.md).

   This file and colors_and_type.css are the only places a finance value
   is written down. scripts/check-finance-tokens.py fails any finance
   page or finance component that writes a raw colour or loads the
   legacy stack.
   ========================================================= */

.fin {
  /* ink and paper */
  --fin-ink:          var(--ink);                 /* #000 */
  --fin-paper:        var(--paper);               /* #FFF */
  --fin-muted:        rgba(0, 0, 0, 0.62);        /* labels, secondary text */
  --fin-muted-2:      var(--ink-2);               /* 72%: sub-lines, meta */
  --fin-faint:        rgba(0, 0, 0, 0.45);        /* the plain dot, disabled text */

  /* rules */
  --fin-rule-1:       var(--rule);                /* 8%: row hairline */
  --fin-rule-2:       var(--rule-2);              /* 14%: section hairline */
  --fin-rule-3:       var(--rule-3);              /* 22%: control border */
  --fin-rule-dash:    rgba(0, 0, 0, 0.35);        /* the drop zone */
  --fin-rule-strong:  var(--ink);                 /* 1px structural */

  /* accent and links */
  --fin-accent:       var(--accent);              /* active tab, primary action */
  --fin-accent-ink:   var(--ink);                 /* text on the accent */
  --fin-accent-soft:  var(--zeal-orange-25);      /* the current step, the selected tile */
  --fin-link:         var(--link);                /* digital orange */
  --fin-link-hover:   var(--accent-hover);

  /* states: a tint and a dot */
  --fin-ok:           var(--green);
  --fin-ok-soft:      var(--green-soft);
  --fin-warn:         var(--amber);
  --fin-warn-soft:    var(--amber-soft);
  --fin-bad:          var(--red-status);
  --fin-bad-soft:     var(--red-soft);
  --fin-plain:        var(--warm);
  --fin-plain-dot:    var(--fin-faint);

  /* surfaces */
  --fin-well:         var(--warm);                /* the band under a selection */
  --fin-quiet:        #F4F4F4;                    /* a disabled control */
  --fin-canvas:       #EDEAE4;                    /* behind a document preview */
  --fin-tag:          var(--ink);                 /* the @you tag */
  --fin-tag-ink:      var(--paper);

  /* type: the boards' scale (11 to 46px) */
  --fin-t-micro:      11px;
  --fin-t-label:      12px;
  --fin-t-body:       13px;
  --fin-t-lead:       14px;
  --fin-t-row:        15px;
  --fin-t-step:       16px;                       /* a step's name on the track */
  --fin-t-h3:         20px;
  --fin-t-h2:         28px;
  --fin-t-detail:     27px;                       /* one bill: its supplier and total */
  --fin-t-figure:     35px;
  --fin-t-figure-2:   30px;                       /* the project tab's tiles */
  --fin-t-title:      46px;                       /* a list or hub */
  --fin-t-title-detail: 42px;                     /* one order, one project */
  --fin-track-label:  0.08em;
  --fin-track-head:   -0.035em;
  --fin-track-section: -0.02em;
  --fin-track-figure: -0.03em;

  /* shape and space */
  --fin-r-1:          var(--r-1);                 /* 2px: controls, chips */
  --fin-r-2:          var(--r-2);                 /* 4px: tiles, panels */
  --fin-control-h:    38px;
  --fin-pad-page:     36px 40px 40px;
  --fin-page-max:     1440px;

  /* the boards set no line height, so text sits at the face's own; a
     paragraph that wraps sets its own (1.4 or 1.45, as the boards do) */
  line-height: normal;
}

/* A finance page carries no legacy stack, so it brings its own small base. */
body.fin {
  margin: 0;
  background: var(--fin-paper);
  color: var(--fin-ink);
  font-family: var(--font-std);
  font-size: var(--fin-t-body);
  -webkit-font-smoothing: antialiased;
}
body.fin *, body.fin *::before, body.fin *::after { box-sizing: border-box; }

/* ── Portal 2.0: the roles on design system v2's tokens ──────────────────
   The close-out (2 Oct 2026): finance joins the shell. For a portal.v2
   holder (:root[data-v2], which nobody else's page carries) each COLOUR
   role reads v2's semantic layer, so finance follows the theme, dark
   included. Type, shape and space keep the boards' values: the move onto
   v2's components is Arc P's restyle pass, later. Without the key nothing
   here applies, and finance renders exactly as the boards drew it.

   The nearest semantic token for each role. The two greys the boards wrote
   as values (the quiet control, the preview canvas) take a ground. The
   @you tag stays ink on paper in light, and becomes paper on ink in dark,
   as v2's dark is designed rather than inverted. */
:root[data-v2] .fin {
  --fin-ink:          var(--z-text);
  --fin-paper:        var(--z-bg-raised);
  --fin-muted:        var(--z-text-3);
  --fin-muted-2:      var(--z-text-2);
  --fin-faint:        var(--z-text-3);

  --fin-rule-1:       var(--z-line);
  --fin-rule-2:       var(--z-line-2);
  --fin-rule-3:       var(--z-line-2);
  --fin-rule-dash:    var(--z-text-3);
  --fin-rule-strong:  var(--z-text);

  --fin-accent:       var(--z-accent);
  --fin-accent-ink:   var(--z-on-accent);
  --fin-accent-soft:  var(--z-bg-select);
  --fin-link:         var(--z-accent-text);
  --fin-link-hover:   var(--z-accent-text);

  --fin-ok:           var(--z-ok);
  --fin-ok-soft:      var(--z-ok-soft);
  --fin-warn:         var(--z-warn);
  --fin-warn-soft:    var(--z-warn-soft);
  --fin-bad:          var(--z-bad);
  --fin-bad-soft:     var(--z-bad-soft);
  --fin-plain:        var(--z-bg-hover);
  --fin-plain-dot:    var(--z-text-3);

  --fin-well:         var(--z-bg-hover);
  --fin-quiet:        var(--z-bg-sunk);
  --fin-canvas:       var(--z-bg-rail);
  --fin-tag:          var(--z-text);
  --fin-tag-ink:      var(--z-bg);
}

/* The canvas past a short page takes the page ground from frame.css, which
   finance links, as every page on the frame does. */
