/* The signature background: napkins of graph paper, each curved its own way, floating in the abyss with a live
   glucose trace (lib/paper.js draws them on the <canvas id="paper"> of index.html). Every colour the canvas uses is
   a token of style.css (--paper, --napkin, --napkin-edge, --napkin-shadow, --napkin-cells, --paper-grid,
   --paper-grid5, --paper-curve-1..3, --paper-glow, --paper-ink-alpha), read again when the theme changes. The
   canvas never takes a tap; cards, bars and sheets sit above it on a solid surface (the z-index list in style.css).
   Text that stands directly on the paper gets .on-paper: a pad of the abyss's own colour, so neither a napkin nor a
   trace passes behind a letter. <html data-paper="off"> hides it and leaves the plain --paper. */
body{background-color:var(--paper)}
.paper{position:fixed;inset:0;width:100%;height:100%;z-index:var(--z-paper);pointer-events:none;contain:strict}
/* Before the script runs, and where it cannot (no 2D context): the still grid, so the sheet is never blank. */
.paper:not([data-live]){background-image:
  repeating-linear-gradient(0deg,var(--paper-grid5) 0 1px,transparent 1px 90px),repeating-linear-gradient(90deg,var(--paper-grid5) 0 1px,transparent 1px 90px),
  repeating-linear-gradient(0deg,var(--paper-grid) 0 1px,transparent 1px 18px),repeating-linear-gradient(90deg,var(--paper-grid) 0 1px,transparent 1px 18px)}
[data-paper=off] .paper{display:none}
/* The page's own blocks stack above the paper; the fixed bar, the sheet and the toast carry their own z-index. */
#app,.demo-banner,.stripe,.timers{position:relative;z-index:var(--z-page)}
/* The top bar above the page, so its language menu opens over the screen. It is one band of the abyss's colour
   across the whole width (::before carries it from the bar's max-width to the viewport's, never wider: a band in
   vmax grows with a full-page picture's height and widens the page; under the bar's own stacking context; it clips
   nothing, so the language menu still opens below): a pad per control would show its soft edge as a dark blob
   wherever a napkin passes under Back or the name in the dark theme, where --napkin is lighter than --paper. */
#top{position:relative;z-index:var(--z-nav)}
#top::before{content:'';position:absolute;inset:0 calc(50% - 50vw);z-index:-1;background:var(--paper);pointer-events:none}
/* Text standing on the paper (P9 of docs/design/ux-redesign-lld.md): a pad of the abyss's colour with a soft edge, so
   neither a napkin nor a trace passes behind a letter. By rule, not by name: every heading, paragraph, label, section
   title and loose link or bold line of a screen (#app, or the list beside it in #pane) that is not inside a card or
   another surface of its own (the :not() list: the classes that draw --card-bg or --surface, and a button's own text) takes it, at
   any depth, so a first-run step, a section of Me or a new screen needs no class. :where() keeps it at no
   specificity: an element's own background or width (a tinted note, a block field) wins over the pad. */
.on-paper,#top .brand,
:where(#app,#pane) :where(h1,h2,h3,h4,h5,h6,p,label,summary,.sec,.note,:is(div,section,form,header)>:is(a,b,strong,small,span:not(:empty))):not(:where(.card,details.fc,dialog,table,button,.btn,.link,.navrow,.legend,.tdy-rows,.body-tile,.fd-tile,.trn-tile,.trn-usual,.trn-quiet,.mac-strip,.chl,.mrow,.readout,.orb) *){width:fit-content;max-width:100%;background:var(--paper);box-shadow:0 0 10px 8px var(--paper);border-radius:10px}
/* An outline or quiet button and a text link on the paper: the same pad, at a class's weight so it wins over the
   transparent background .btn sets, and with the button's own width (a block button stays as wide as the column). A
   filled button (.pri, .acc) is its own surface. */
:where(#app,#pane) :is(.btn:not(.pri,.acc),.link):not(:where(.card,details.fc,dialog,table,.navrow,.legend,.tdy-rows,.body-tile,.fd-tile,.trn-tile,.trn-usual,.trn-quiet,.mac-strip,.chl,.mrow,.readout) *){background:var(--paper);box-shadow:0 0 10px 8px var(--paper)}
/* The first run's and glucose's steps centre their headline and lead: the pad, as wide as the text, stays centred. */
:where(.step,.glu-step) > :where(h1,h2,p){margin-inline:auto}
/* The day's date button carries its text in spans, not loose text: they take the pad. */
.tdy-datef>*:not(input){width:fit-content;max-width:100%;background:var(--paper);box-shadow:0 0 10px 8px var(--paper);border-radius:10px}
/* A disabled outline button fades by its ink, not by opacity: at .45 its pad would show the drawing through its
   letters. A filled one already does so (style.css .btn.pri[disabled]). */
:where(#app,#pane) .btn:not(.pri,.acc)[disabled]{opacity:1;color:var(--mut);border-color:var(--line)}
