/* ═══════════════════════════════════════════════════════════════════════════
   accid-styles.css — THE STUB. One <link> in the head, forever.

   IMPORTS ONLY, plus the layer statement. Hand-written, static, and NOT on any
   regenerator's list — the bridge never touches this file.

   WHY IT EXISTS (Phase 5.2, 2026-08-19). Precedence used to be emergent from
   the order of eight <link> tags, which meant the only way to win a fight was
   `!important`. accid-layers.css says so in its own comments: its !important is
   there to beat accid_grid.css. Declare the order once and that fight is over —
   not overridden, ABSENT, because there is nothing left to override.

   THE ORDER IS THE POINT. Later layers win for normal declarations. It is
   chosen by what currently fights what, and grid comes before layers because
   that is the fight the comments document.

   ⚠ UNLAYERED BEATS EVERY LAYER. A sheet left outside is not "not yet
   converted", it is promoted above all of this. Partial layering is the one
   state worse than none. Anything that cannot be imported here — the injected
   <style> blocks, and project_styles.css whose path is per-project and so
   cannot be a static @import — gets its layer at the source instead. Grep for
   `@layer` in the injectors before assuming a sheet is covered.

   ⚠ @import MUST COME FIRST. Only @charset and @layer statements may precede
   it. One stray rule at the top of this file and every import below it is
   discarded silently. Keep this file imports-only.

   ⚠ !important REVERSES LAYER ORDER — earlier layers win for important
   declarations. So an !important down in `reset` or `grid` outranks everything
   generated. That is why the bulk deletion had to happen with this, not after:
   layering an !important entrenches it rather than settling it.
   ═══════════════════════════════════════════════════════════════════════════ */

@layer reset, grid, site, modules, layers, decoration, palette, project,
       global, look, category, tag, pov, grouped, container, page, page-id,
       editor;

/* `editor` IS LAST, ADDED 2026-08-21, and the reason is a bug it fixes.
   Editor-chrome VISIBILITY rules lived in accid-layers.css (layer `layers`) and
   could not hide .container-child-toolbar, because that toolbar is drawn by
   accid-chrome.css in layer `decoration` — which sorts AFTER `layers`, and
   later layers win. Observed directly: on one page a templates-sourced HTML
   module had its chrome correctly hidden (its toolbar comes from accid_grid.css
   in `grid`, an EARLIER layer) while a templates-sourced CONTAINER showed 4 of
   its 5 chrome elements. Same rule, same page, opposite results, decided
   entirely by which sheet drew the toolbar.

   Rules about whether chrome is SHOWN therefore have to outrank every sheet
   that draws it. This is the last layer, so they do. */

/* WHY `site` SITS BEFORE `modules`, learned the hard way 2026-08-19.
   accid-site-style (applySiteStyleVars) emits two different heights of rule in
   one block: element-level DEFAULTS — h1..h6, body, a — and the per-surface
   backgrounds. Putting the whole block in `global`, after `modules`, made the
   generic `h1` rule beat `.mddoc [data-role="h1"]`, because LAYER ORDER
   OVERRIDES SPECIFICITY. That is precisely the containment failure
   markdown-module.js documents and restates family and colour to prevent — and
   before layering it could not happen, since 0,2,0 beat 0,0,1 on specificity.
   md-rolecss caught it in one run.

   Early is correct for both jobs: module rules then beat site typography, and
   the surfaces still sit far below look / category / page, which is what lets a
   content template repaint them. */

/* ── the shipped sheets ─────────────────────────────────────────────────────
   grid before layers: accid-layers.css's overrides exist to beat accid_grid.css
   and can now be plain declarations. modules after grid so a module rule beats
   the grid's generic box. decoration is editor chrome. palette is last of the
   shipped set because it declares tokens the others consume. */
/* THE RESET GOES FIRST, and it must be in `reset` rather than wherever it
   happens to be written. It lived at the top of modules-styles.css until
   2026-08-20 and therefore entered layer(modules) — outranking every margin and
   padding in grid and site, because layer order overrides specificity and `*`
   being the weakest selector no longer protects anything. The slot below was
   declared from the start and left empty; that is what made the order look
   right here and be wrong in the browser. */
@import url("accid-reset.css")       layer(reset);
@import url("accid_grid.css")        layer(grid);
@import url("modules-styles.css")    layer(modules);
@import url("accid-layers.css")      layer(layers);
@import url("accid-edit-layer.css")  layer(decoration);
@import url("data-streams.css")      layer(decoration);
@import url("zoom-modal.css")        layer(decoration);
@import url("../../../accid-shared/accid-palette.css") layer(palette);

/* project_styles.css is NOT imported here — its path is {dev_project}-accid/
   and @import cannot take a dynamic URL. index.html injects it into
   layer(project) with a one-line <style> instead. Its layer sits AFTER the
   shipped sheets, so a project can override ACCID's defaults, and BEFORE the
   generated files, so a page or category rule still wins. */

/* The generated files (Phase 5.1) are declared in the layer statement above but
   NOT imported until they exist: @import fails SILENTLY on 404, so importing a
   file that is not there yet buys nothing and hides a real break behind an
   identical non-event. They are added here as each is first written. */
