/* NO @import ANY MORE (2026-09-15, on request: "make the unique heading font to be
   Archivo when selecting this in Settings"). This file pulled Barlow for six weeks —
   deliberately not through tokens.css, whose @import block feeds the typography
   picker, since a header face is not a body face to choose between. The heading face
   is Archivo now, which tokens.css already loads for that picker, so there is nothing
   left for this file to fetch. If a face that ISN'T in tokens.css is ever wanted back
   here, the @import returns and must be the first rule in the stylesheet. */

/* App header type — TYPE ONLY.
   ==========================================================================
   Started inside orders.html as a page-local exception for one screen
   (2026-08-20, Figma 2089:44574: "set specific header styles just in this page,
   as I used a different typography here"), then asked for on Orders, Products
   and Product detail too — which makes it the app's header typeface rather than
   one page's private choice. Hence one file the pages link, not the same four
   values copy-pasted into three <style> blocks where they would drift.

   SCOPE — this file changes the FONT and nothing else. No stickiness, no band,
   no padding, no layout. Those exist only on the order-detail header, where they
   were asked for specifically, and they stay in orders.html's own <style>. Adding
   them here would silently restructure three pages that only wanted the type.

   It is NOT in ce-ui: this is the prototype's decision, not the design system's,
   and nothing in ce-ui/ should have to know about it.

   WHAT IT BREAKS — read before extending it:
   - THE SIXTH-TYPEFACE PROBLEM IS GONE (2026-09-15). This file used to load Barlow,
     a face the system did not have and the typography picker did not offer. The
     heading face is Archivo now, which tokens.css already loads and the picker
     already lists as a body face, so the prototype no longer introduces a typeface
     of its own. Keep it that way: a heading face the system lacks is a tokens.css
     question, not a literal here.
   - NO type sizes of its own any more, as of 2026-09-03. This list was three deep
     on 2026-08-30 and is now empty, which was always the goal. The entity page
     title (34/40, then 32/40) came off it on 2026-08-31 when --app-header-text was
     pointed at --text-heading-2xl; --app-header-section-text (20/24) went the same
     day once its last consumer, orders.html's timeline event titles, moved to a
     token; and --app-header-text-lg (40/48) went on 2026-09-03 once the heading
     scale was rescaled and --text-heading-2xl became that exact pair.
     Keep it empty. A size this file needs and tokens.css does not have is a
     question for tokens.css, not a local pair here.
   - The custom properties below sit on :root, which is what tokens.css does.
     They carry an --app- prefix rather than the system's --text- or --font- one,
     precisely so they never read as system tokens that escaped.
     (Do not write those two prefixes as a slash-separated pair in a comment here:
     the star-slash inside it closes the comment early and silently swallows the
     :root block below. That exact typo cost a debugging round on 2026-08-20.)

   Weight is NOT on that list: 500 is --weight-medium's value. Built at Figma's
   own font/weight/SemiBold 600 and dropped to 500 on 2026-08-20, because 600
   read as bold against a page whose heaviest weight is otherwise 500.

   Logged in ce-ui/docs/proposals.md, "A page-local type scale on the order-detail
   header", as an open question: whether a page — or now an app — may carry its
   own type scale, and if so through what mechanism. This file is that question in
   working code; it is not a decision. */

:root {
  /* ARCHIVO, AND IT IS THE SYSTEM'S OWN TOKEN (2026-09-15, on request: "make the
     unique heading font to be Archivo when selecting this in Settings"). It was
     'Barlow' as a literal here, a sixth typeface this file loaded itself.
     ce-ui now carries --font-heading (tokens.css) as the face the Headings: Unique
     setting puts on, so this reads that rather than restating a family: one place
     decides what a unique heading looks like, and the prototype's extra heading
     classes below simply follow it. The variable stays — the rules in this file are
     written against --app-header-font and --app-header-font-follow, and collapsing
     them into the token would lose the Match-body half of the setting. */
  --app-header-font: var(--font-heading);
  /* Entity page titles — one order, one product. Was this file's own off-scale
     32/40 (Figma font/size/3xl over font/line-height/2xl, briefly 34) until
     2026-08-31, when it was pointed at --text-heading-2xl instead on request:
     "use the largest value available in tokens". So the pair is now 28/32 — the
     biggest heading the system actually has — and this variable stops being a
     size of its own, becoming an alias that says WHICH token a page title takes.
     Titles get SMALLER by 4px and their line box by 8; that is the cost of being
     on the scale, and it is the same trade .filter-drawer__title took on
     2026-08-27 (see the note above .page-header__title below).
     The order detail steps DOWN from this to --text-heading-xl once its page is
     scrolled — that rule is page-local, in orders.html. */
  --app-header-text: var(--text-heading-2xl); /* 28/32 */
  /* --app-header-text-lg (40/48) stood here for the main pages' titles — Orders and
     Products — which carried a bigger title than an entity page does (2026-08-20;
     tried at 48/56, settled at 40/48 the same day). Deleted 2026-09-03, when
     --text-heading-2xl was rescaled to 40/48 and this stopped being a size the system
     lacked and became a second name for one it has. The rule below went with it: with
     both the list and the entity title resolving to --text-heading-2xl, the
     [data-view="list"] override was declaring the value it was already inheriting.
     The list/entity size difference is gone as a consequence, not as a decision —
     --text-heading-2xl is the top of the scale, so keeping the two apart would mean
     putting an off-scale pair back in this block, which is the one thing it exists
     not to do. If a bigger page title is wanted, it is a sixth token in tokens.css,
     not a local one here. */
  /* --app-header-section-text (20/24, Figma font/size/lg over font/line-height/md)
     stood here for orders.html's section headings and timeline event titles.
     Deleted 2026-08-31: the section headings became plain .card__title and the
     timeline titles were pointed at --text-heading, so it had no consumers left.
     Not kept "in case" — an unused off-scale pair in this block is exactly what
     the header comment above warns against, and re-deriving it is one line. */
  --app-header-weight: 500;
  /* The face every heading rule in this file actually uses — never
     --app-header-font directly. It resolves against the shell's Headings setting
     (js/shell.js): Unique gives the heading face, Match body — the default since 2026-08-20 —
     gives whichever body face the typography picker chose. It defaults to the body
     face for the same reason the rule below is keyed on ["unique"]: a page whose
     script has not run carries no attribute, and what it paints in that gap has to
     be the default.

     This is the whole setting in two declarations. Before it (2026-08-20) the rules
     below pinned Barlow through the `font` shorthand, which beat ce-ui's
     font-family-only rule — and since ce-ui's rule is what "Unique" is built from,
     the two ended up exactly inverted: Barlow appeared ONLY under Match body, and
     Unique — the default — showed Plus Jakarta on every heading. The variable, plus
     the unique-mode rule below, is what turns the pair the right way up. */
  --app-header-font-follow: var(--font-sans);
}

:root:not([data-heading-font="match"]) {
  --app-header-font-follow: var(--app-header-font);
}

/* Unique mode: the heading face across the app's whole heading set (Archivo since
   2026-09-15, Barlow before it), not just the titles this file sizes. The selector deliberately mirrors ce-ui's own heading rule
   (elements.css, `:root:not([data-heading-font="match"]) :is(h1..h4,
   .page-header__title, .card__title)`) — same shape, so the two score the same
   (0,3,0) and this one wins purely by being linked later. Written that way rather
   than at a higher specificity because it is REPLACING that rule's face, not
   fighting it: whatever ce-ui decides is a heading is what turns the heading face here.
   .filter-drawer__title and the order detail's own section/timeline titles are added
   because they are headings this prototype invented and ce-ui does not know about.
   Family only — every heading keeps the size and weight its own rule gives it.
   Under Match body this rule is inactive, ce-ui's is too, and every heading falls
   back to the body face through --app-header-font-follow. Unique is the default, so
   both rules are keyed to :not(["match"]) — the default has to be the state with no
   attribute set, or the page paints Match body until shell.js runs.
   NOTE: channel.html does not link this file (see build-artifact.mjs), so "Unique"
   still means ce-ui's --font-ui there. */
:root:not([data-heading-font="match"]) :is(h1, h2, h3, h4, .page-header__title, .card__title,
    .table__title, .filter-drawer__title, .order-detail__section-title,
    .order-timeline__title) {
  font-family: var(--app-header-font);
  /* Archivo is a two-axis variable face; these are the two lines tokens.css gives it
     on body and elements.css gives the ratified headings. Restated because this
     selector reaches three headings ce-ui does not know about — without them those
     three would render at whatever width axis the browser picks while every other
     heading holds the stated 100. */
  font-optical-sizing: auto;
  font-variation-settings: "wdth" 100;
}

/* Every page title on a page that links this file: Orders (list and order
   detail), Products (list and product detail).

   The title sets its font with the `font` shorthand from tokens, so it has to be
   overridden as a shorthand too — a bare font-family would lose to it. Only the
   font is set: .page-header__title's own max-width, truncation and clamping stay
   exactly as elements.css and each page left them (products.html's product name
   clamps to two lines, for instance, and is untouched). */
/* A [data-view="list"] .page-header__title rule stood here, giving Orders' and
   Products' own titles the bigger --app-header-text-lg. Both were deleted on
   2026-09-03 — see that variable's note in the :root block above. Every page title
   in this prototype now takes --app-header-text, i.e. --text-heading-2xl. */

/* THE EXTRA 8px UNDER THE LIST TITLE ROW IS GONE (2026-09-15, on request: "remove
   the extra padding below the page title. Looks assymetrical, the distance from
   global header to orders, and then from Orders to the table"). It was added on
   2026-08-20 as "more air under the main pages' title row" — before the table on
   Orders, before the tabs on Products — and it is exactly the asymmetry reported:
   .page-header__row centres a 48px title in 80px, so 16px sits above the title and
   16 below, and this margin made the lower one 24. The two distances are equal again
   with nothing here.
   WHAT THE OLD NOTE GOT RIGHT, kept because the next change will need it: the value
   belonged on the ROW and not on the title. The row centres its contents, so a margin
   on the title is absorbed by the slack and only shifts the title up by half of it;
   and the row carries the page actions too, so padding inside it would push the
   buttons down with the title instead of moving the line as one. If air under this
   row is ever wanted back, put it here again. */

/* .filter-drawer__title was in this selector list until 2026-08-27, taking the
   same then-32/40 --app-header-text as a page title. It was removed on request
   ("use the biggest header value available in tokens"), because at the time
   --app-header-text was this file's own off-scale pair rather than a token, and
   the biggest heading the system actually has is --text-heading-2xl (28/32).
   Dropping the selector let proposals.css's own `.filter-drawer__title` rule,
   which already sets exactly that, take effect instead of being overridden here.
   On 2026-08-31 the page title followed it: --app-header-text now resolves to
   --text-heading-2xl too, so the two are back at one size — but by both naming
   the same token, not by one of them re-declaring the other's number. Leave the
   selector out regardless; the drawer should keep taking its size from the
   component's own rule.
   The panel's title still follows the Headings setting — the unique-mode rule
   above still lists .filter-drawer__title, and that rule sets family only. */
.page-header__title {
  font: var(--app-header-weight) var(--app-header-text) var(--app-header-font-follow);
}
