/* =============================================================================
   Lunch at TJ -- the application's tokens
   =============================================================================

   :root ONLY. No rule, no at-rule, nothing but the one :root block below --
   the containment harness fails anything else here, and fails a :root block
   anywhere in app.css.

   Split out of app.css at step 9b (2026-10-16), byte-identical, so that a
   page can have the app's tokens without app.css's rules: shared/login.html
   links the shared file and this one (step 9d) and must not get app.css's
   body, link and flash rules. Every page that links app.css links, in this
   order: tj-shared-tokens.css, this file, app.css. A page that linked app.css
   without this file would resolve no var() at all, which is why the
   containment harness's link check requires both, in that order.

   Before 9b this block was app.css's TOKENS layer, and its comments below
   still speak of "this file" and "app.css" in that sense.
   ============================================================================= */


/* ============================== TOKENS ============================== */

:root {

  /* --- The purple ramp: gone (step 10) ------------------------------------

     The app's own ramp was removed in step 10, -800, -700 and -500 at C1 and
     the rest at C2 (2026-10-19). The brand is #46166B, and the role aliases
     below point into the shared file's scales. Later layers still consume
     role aliases only, never the shared file's scale names directly.       */


  /* --- Role aliases: what later layers actually consume ------------------- */

  --text-primary:       var(--text);          /* body copy, form labels, item names */
  --table-header-bg:    var(--purple-900);    /* th fills on data/calendar/count tables */
  --brand-primary-dark: var(--purple-800);    /* headings, th text, hover on a primary fill */
  --brand-primary:      var(--purple-700);    /* links, accents, fills, accent-color */
  --border-subtle:      var(--border);        /* hairlines; fills are --app-fill-subtle */
  --surface-page:       var(--surface-alt);   /* the page ground */


  /* --- Neutrals ------------------------------------------------------------

     Role-named with no ramp. The brand flip does not move these, so there is
     no derivation relationship to keep legible and a role name is simply
     better: a value can change without the name starting to lie.            */

  --text-secondary: var(--text-muted);   /* secondary and meta text.
                               CAVEAT, measured at e776b84: 156 occurrences,
                               of which 128 are inside inline style="..."
                               attributes. A token cannot reach an inline
                               attribute, so this token governs 27 of them.
                               Any estimate of the brand flip's size that
                               counts only stylesheet rules is wrong. */
  --text-tertiary:     var(--text-placeholder);   /* de-emphasised text, disclosure arrows, empty states */
  --border-default: var(--border-strong);   /* form controls and table borders */
  --border-light:   var(--border-soft);   /* footer separators */

  --surface-raised: var(--surface);  /* .card and other lifted surfaces.
                                 The app writes the `white` KEYWORD today --
                                 31 `background: white`, 28 `color: white`,
                                 and #ffffff appears as a hex literal nowhere.
                                 The conversion is exactly equivalent
                                 (white === #ffffff), so it cannot change a
                                 pixel, but it is deferred to steps 3-4 along
                                 with the rules that would consume it. */


  /* --- Status --------------------------------------------------------------

     shared/base.html defines the success and error triads in full, which is
     why both carry a border token even though each border has a single use:
     step 3 relocates that block byte-identical and will want the complete
     set. The warning pair has no border token because its border (#ffe69c,
     one use) is page-scoped, not global -- asymmetric on purpose.            */

  --status-success-bg:     var(--success-50);
  --status-success-text:   var(--success);
  --status-success-border: var(--success-100);

  --status-danger-bg:      var(--danger-50);
  --status-danger-text:    var(--danger);
  --status-danger-border:  var(--danger-100);

  --status-warning-bg:     #fff3cd;
  --status-warning-text:   var(--warning);

  --action-danger: var(--danger);   /* destructive ACTION colour -- buttons and links that
                          delete or cancel. Distinct from --status-danger-text,
                          which is copy inside an error message. */


  /* --- Accent ------------------------------------------------------------- */

  --accent-gold: var(--tj-gold);  /* Nav link and dropdown hover (not the title).
                              2.29:1 on white -- FAILS WCAG AA for text at any
                              size. Borders, rules, fills and badge
                              backgrounds only.
                              5.79:1 on --brand-primary (#46166B),
                              6.78:1 on --brand-primary-dark (#38104F).
                              Ratios recomputed 2026-10-19 at step 10 C2,
                              not carried forward from a document.

                              No authoritative source for a school gold
                              exists; the 2011 guide names only Pantone 269
                              and black. This is the value the app already
                              uses. ONE token on purpose -- it expands only
                              when a concrete use demands a tint and a
                              dark-on-tint variant.

                              Also the announcement banner's top and bottom
                              rules (Item A), on --app-announcement-bg:
                              2.11:1 there, decoration only -- the banner's
                              text carries the meaning. That fill is its own
                              token, not a tint of this one. */


  /* --- Roles for steps 7 to 9 ----------------------------------------------

     ONE VOCABULARY, minted once in step 7, for every hard-coded colour in the
     app: app.css's rule bodies (step 7), the templates' inline styles and
     scripts (step 8), and shared/login.html and the email constants (step 9).
     One token per value and role. Each holds today's literal, so minting them
     changes nothing, and nothing consumes them in this commit.

     Names are roles under --app-, which no name in the shared TJ block uses;
     the containment harness's redefinition check is what guarantees it.
     Where a role's value is a ramp step, the token points at the ramp, as the
     role aliases above do. The elevation shadows and the login panel's are
     WHOLE box-shadow values, so a shared whole shadow can replace one with no
     second edit; the scrim and the focus ring are colours, and the ring's RGB
     must equal --brand-primary's (checked).

     Ten have no consumer until steps 8 and 9. They are listed in
     tests/test_containment_harness.py UNCONSUMED_TOKENS, which fails the run
     the day one is consumed and must be empty after step 9.               */

  /* Focus */
  --app-focus-border: var(--purple-700);          /* :focus borders on inputs */
  --app-focus-ring:   rgba(70, 22, 107, 0.15);    /* :focus ring; RGB = --brand-primary */

  /* Text on filled backgrounds */
  --app-text-on-brand:         #ffffff;   /* on --brand-primary fills */
  --app-text-on-table-header:  #ffffff;   /* on --table-header-bg */
  --app-text-on-fill:          #ffffff;   /* on grey, red, blue and warning fills */
  --app-nav-link-text:         var(--on-purple-text);
  --app-nav-toggle-text:       var(--on-purple-muted);
  --app-nav-toggle-hover-text: var(--on-purple-text);
  --app-modal-header-subtext:  var(--on-purple-muted);
  --app-nav-separator:         rgba(255, 255, 255, 0.2);

  /* Text */
  --app-text-strong:   var(--text);      /* strong neutral copy: messages, names */
  --app-text-emphasis: var(--text);      /* maximum-contrast notes */
  --app-text-detail:   var(--text-muted);      /* explanations, detail lists */
  --app-text-tertiary-on-tint: var(--text-muted);   /* de-emphasised text that can sit on the weekend cell or a
                                          row-hover tint; the darker grey at the flip (step 8) */
  --app-text-danger:   var(--danger);   /* danger STATUS copy -- not an action */
  --app-text-added:    #1a7a38;   /* an added line in a change summary */
  --app-code-text:     #cdd6f4;   /* the JSON viewer */

  /* Surfaces */
  --app-surface-muted:      var(--surface-alt);    /* bands, header rows, totals, tiles */
  --app-option-hover-bg:    var(--surface-alt);    /* an option row on hover */
  --app-surface-sunken:     var(--surface-hover);    /* expanded bodies, member cards */
  --app-header-hover-bg:    var(--surface-hover);    /* a clickable header on hover */
  --app-calendar-weekend-bg: var(--purple-100);
  --app-fill-subtle:        var(--purple-100);       /* badges, progress tracks */
  --app-surface-stripe:     var(--purple-50);   /* zebra rows, empty calendar cells */
  --app-row-hover-bg:       var(--purple-100);
  --app-option-selected-bg: var(--purple-100);
  --app-nav-dropdown-bg:    var(--purple-800);
  --app-surface-inactive:   #f5f5f5;
  --app-code-bg:            #1e1e2e;

  /* Borders */
  --app-border-divider:       var(--border-soft);   /* row and section dividers */
  --app-border-divider-faint: var(--border-soft);
  --app-option-border:        var(--border-strong);
  --app-border-inactive:      #ddd;
  --app-border-danger:        var(--danger);   /* danger alert cards and failed states */

  /* Status beyond the three triads */
  --app-status-neutral-text:        #495057;
  --app-status-neutral-bg:          #e2e3e5;
  --app-status-neutral-accent:      #999;      /* neutral severity stripe */
  --app-status-info-text:           #0c5460;
  --app-status-info-bg:             #d1ecf1;
  --app-status-success-accent:      var(--success);
  --app-status-success-tint:        var(--success-50);
  --app-status-danger-tint:         var(--danger-50);
  --app-status-danger-wash:         var(--danger-50);
  --app-status-warning-border:      #ffe69c;
  --app-status-warning-strong-text: #664500;
  --app-status-warning-accent:      #ffc107;
  --app-status-pending-border:      #f0ad4e;
  --app-status-attention-text:      #8a5a00;
  --app-status-attention-border:    #8a5a00;
  --app-status-attention-fill:      #8a5a00;

  /* Announcement banner (Item A). A soft yellow fill, edged in --accent-gold.
     Its text is --text-primary, 15.64:1 here, and its link --brand-primary,
     12.22:1. A literal, not var(--gold-50): the harness reads a new token's
     declared value resolving var() within this block only. */
  --app-announcement-bg:            #FFF6D6;

  /* Fills and actions */
  --app-brand-hover:          var(--purple-600);       /* purple button fills on hover (H2) */
  --app-fill-neutral:         #6c757d;
  --app-fill-warning:         #856404;
  --app-action-danger-hover:  #B03636;
  --app-role-badge-staff-bg:  #0d6efd;

  /* Elevation: whole box-shadow values, and the scrim */
  --app-shadow-card:         var(--card-shadow);
  --app-shadow-modal:        var(--dialog-shadow);
  --app-shadow-sticky:       0 -2px 8px rgba(0, 0, 0, 0.08);
  --app-shadow-dropdown:     var(--raised-shadow);
  --app-shadow-nav-dropdown: var(--raised-shadow);
  --app-shadow-panel:        0 2px 8px rgba(0, 0, 0, 0.1);
  --app-scrim:               var(--scrim);


  /* --- Radii ---------------------------------------------------------------

     Three discrete values, measured across the 24 style blocks: 4px (28
     declarations), 3px (20), 6px (18). They cover 66 of 85 border-radius
     declarations; the rest are `0` (9), 8px (4), one 50%, and ten compound
     corner values that name individual corners and cannot be a scalar token.

     No type scale and no spacing scale, deliberately. font-size measures 15
     distinct values across 169 declarations at 0.05rem granularity -- that is
     drift, not a scale, and naming it would launder drift as intent. Spacing
     is coherent on a 0.25rem grid but only covers 73%, and it has no pending
     consumer the way colour has the brand flip; it is deferred to step 3,
     where the components layer can say what the steps mean.                  */

  --radius-sm: 3px;   /* badges, small controls */
  --radius-md: 4px;   /* inputs, cards, flash messages */
  --radius-lg: 6px;   /* banners and other large surfaces */

}
