/* ============================================================================
   CANON SHELL — the chrome every app wears, as one linked file.

   canon-tokens.css settled the palette. Nothing settled the layer above it, and
   it showed: across 425 app files the same objects had picked up four and five
   names apiece —

     the mono micro-label   .kicker (81) · .eyebrow (57) · .panel-kicker (5),
                            across SEVEN different letter-spacings
     the small state pill   .pill (144) · .badge (111) · .tag (97) · .chip (85)
     the brand square       .mark (344) · .brand-mark (296)
     the bar                .topbar (318) · .bar (146), at 52/56/58/60/62/64px
     .btn                   28 / 29 / 30 / 31 / 32 / 33 / 34 / 36px

   None of that is visible one file at a time, which is why it happened.

   DIVERGENCE vs SHELL — the two rules pull in opposite directions on purpose.
   An app's own screen must not resemble the product it was drawn from
   (_ROADOS_SPEC.md §Divergence). The chrome around that screen should be the same
   everywhere. Divergence below the bar; uniformity at it and above.

   The distinction that removes the four-way pill confusion:
     BADGE states a value.   CHIP is something you press.
   If you are tempted to add a third, you want one of those two.

   TWO CORRECTIONS, both learned by measuring rather than by reasoning:

   1. Canon only owns names whose meaning is universal. `.bar` was dropped for the
      same reason and after the same count: 5 apps use it as their app bar, 43 use it
      for a progress bar, a scale bar or a chart bar. Worse, the CHECKER was asserting
      canon's 56px against `.topbar,.bar`, so it read a 5px progress bar as a broken
      app bar — and an agent dutifully inflated one to 56px. Use `.topbar`. An earlier version also
      claimed .field, .card, .panel, .av, .gutter, .hash and .part — then the corpus
      was counted: 21 of the 24 apps using .field already had their own rule for it,
      67 of 67 for .pill, 71 of 81 for .card, 46 of 49 for .av. A shared library that
      claims a common word does not unify anything; it repaints somebody else's
      widget. Those names are gone from here. Apps own them.

   2. Everything canon keeps is wrapped in :where(), so it carries ZERO specificity
      and any rule an app writes beats it automatically. Canon is the default an app
      gets for free, never a rule it has to fight. (The ::-webkit-scrollbar rules are
      left unwrapped — a pseudo-element cannot sit inside :where().)

   Neither correction protects an app that uses a canon name and never sets the
   property canon sets: a `.lcd .field` with no background of its own still took
   canon's #fff, invisible under near-white text. Specificity cannot catch that —
   only rendering can, which is why _audit.mjs measures contrast.

   Link order, always:
     canon-tokens.css → canon-reset.css → canon-shell.css → the app's own <style>
   ========================================================================== */

/* ── the micro-label ──────────────────────────────────────────────────────────
   .kicker is canonical. .eyebrow and .panel-kicker are aliases so the files
   already using them stay correct; new work uses .kicker. Letter-spacing is .1em,
   the corpus plurality, not a new invention. */
:where(.kicker, .eyebrow, .panel-kicker){
  color:var(--faint);font:600 10px/1 var(--mono);
  letter-spacing:.1em;text-transform:uppercase;
}
:where(.kicker.loud){font-size:10.5px;letter-spacing:.13em}

/* ── the bar. Exactly one <h1> per app and it is the app's name; a heading for a
      view inside the app is an <h2>. ─────────────────────────────────────────── */
:where(.topbar){
  display:flex;align-items:center;gap:11px;height:var(--topbar);padding:0 15px;
  border-bottom:1px solid var(--line);background:rgba(255,255,255,.92);
  backdrop-filter:blur(22px) saturate(140%);
  -webkit-backdrop-filter:blur(22px) saturate(140%);
}
:where(.topbar h1){margin:0;font-size:14.5px;font-weight:680;letter-spacing:-.03em;white-space:nowrap}
:where(.topbar .sep){width:1px;height:22px;margin:0 2px;background:var(--line)}
:where(.top-right, .bar-right){margin-left:auto;display:flex;align-items:center;gap:6px}

/* Promoting an app's brand text to <h1> gives the document the heading it needs
   without changing a pixel — but only if the UA's 2em size and 0.67em margins are
   cancelled. This class does exactly that and nothing else; it rides alongside
   whatever class already styled the element.
      <span class="brand-name">Code</span>
   becomes
      <h1 class="brand-h1 brand-name">Code</h1>
   A blanket h1 reset was tried first and rejected: measured, it moved layout in 10
   apps whose h1 margins were load-bearing. */
/* For an app whose chrome deliberately shows no name — a full-bleed call, a
   reader, a phone-shaped surface — the document still needs its one heading. This
   gives it one without inventing a visible title the design never had. Making it
   visible later is a one-line change; putting a name somewhere a designer chose
   not to is not mine to decide. */
:where(.sr-only){position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}

:where(.brand-h1){margin:0;font:inherit;letter-spacing:inherit;color:inherit;display:inline}

/* the brand square — .mark and .brand-mark are one object under two names */
:where(.mark, .brand-mark){
  display:grid;place-items:center;width:30px;height:30px;border-radius:9px;flex:none;
  background:#050505;color:#fff;font-size:15px;font-weight:760;letter-spacing:-.04em;
  box-shadow:0 3px 12px rgba(0,0,0,.12);
}
:where(.mark.sm, .brand-mark.sm){width:22px;height:22px;border-radius:7px;font-size:11px;box-shadow:none}

/* ── BADGE states a value. .pill is an alias; both were used for exactly this.
      .tag is NOT: measured across the corpus it also means a tagged sticky note,
      a DOM tag name in a site builder, and an LCD readout — canon painting those
      as pills was the same mistake as claiming .field and .bar. The 9 installed
      apps that did mean a badge now carry their own .tag rule. ──────────────── */
:where(.badge, .pill){
  display:inline-flex;align-items:center;gap:5px;padding:2px 7px;
  border:1px solid var(--line);border-radius:999px;background:#fff;
  font:600 10px/1.6 var(--mono);letter-spacing:.07em;text-transform:uppercase;color:var(--muted);
}
:where(.badge.strong, .pill.strong){border-color:var(--line-strong);color:var(--ink)}
:where(.badge.open, .pill.open){border-style:dashed;color:var(--faint)}
:where(.badge.on, .pill.on){border-color:#111;background:#111;color:#fff}
:where(.badge i, .pill i){width:6px;height:6px;border-radius:50%;background:#111;box-shadow:0 0 0 3px #ededeb}

/* ── CHIP is pressed ──────────────────────────────────────────────────────── */
:where(.chip){
  display:inline-flex;align-items:center;gap:6px;height:28px;padding:0 10px;
  border:1px solid var(--line);border-radius:999px;background:#fff;
  font-size:11px;font-weight:560;white-space:nowrap;
  transition:background .14s ease,border-color .14s ease,color .14s ease;
}
:where(.chip:hover){border-color:var(--line-strong)}
:where(.chip.on){background:#111;border-color:#111;color:#fff}
:where(.chip svg){width:13px;height:13px;color:var(--muted)}
:where(.chip.on svg){color:#fff}
:where(.chip .n){color:var(--faint);font:600 9px/1 var(--mono)}
:where(.chip.on .n){color:#a9a9a6}

/* ── buttons. 34px was the corpus plurality and sits in the spec's 33–34 range;
      .sm 29px is for bars, where 34 crowds a 56px one. ───────────────────────── */
:where(.btn){
  display:inline-flex;align-items:center;gap:6px;height:34px;padding:0 12px;
  border:1px solid var(--line);border-radius:10px;background:#fff;
  font-size:12.5px;font-weight:560;letter-spacing:-.01em;white-space:nowrap;
  transition:background .14s ease,border-color .14s ease;
}
:where(.btn:hover){background:var(--hover);border-color:var(--line-strong)}
:where(.btn svg){width:14px;height:14px;color:var(--muted)}
:where(.btn:hover svg){color:#111}
:where(.btn.sm){height:29px;padding:0 11px;font-size:11.5px}
:where(.btn.sm svg){width:13px;height:13px}
:where(.btn.dark){background:#111;border-color:#111;color:#fff}
:where(.btn.dark svg){color:#fff}
:where(.btn.dark:hover){background:#000}
:where(.btn .n){color:var(--faint);font:600 9px/1 var(--mono)}
:where(.btn.dark .n){color:#a9a9a6}
:where(.btn:disabled, .btn[disabled], .btn[aria-disabled=true]){opacity:.5;cursor:not-allowed;pointer-events:none}

/* icon-only button */
:where(.ti, .icon-btn){display:grid;place-items:center;width:32px;height:32px;border-radius:9px;color:var(--muted);transition:background .14s ease,color .14s ease}
:where(.ti:hover, .icon-btn:hover){background:var(--hover);color:var(--ink)}
:where(.ti svg, .icon-btn svg){width:16px;height:16px}

/* the engine badge — an engine is a replaceable PART; the name it answers to is
   what persists, so the part is rendered small and secondary */
:where(.part){padding:1px 5px;border:1px solid var(--line);border-radius:999px;background:#fff;font:600 8px/1.5 var(--mono);letter-spacing:.06em;text-transform:uppercase;color:var(--faint)}

/* ── rows. A list is hairlines, never a stack of cards. ──────────────────── */
:where(.row-rule){border-top:1px solid var(--line-soft)}
:where(.row-rule:first-child){border-top:0}

/* ── keycap ───────────────────────────────────────────────────────────────── */
:where(kbd){display:inline-flex;align-items:center;justify-content:center;gap:2px;min-width:24px;height:23px;padding:0 6px;border:1px solid var(--line);border-bottom-color:#cfcfcb;border-radius:7px;background:#fafafa;color:#777;font:600 10px/1 var(--mono);box-shadow:0 1px 0 #efefed}

/* ── scrolling. Content scrolls visibly; a navigation rail does not. ──────── */
:where(.scroll-content){min-height:0;overflow-y:auto;scrollbar-width:thin}
.scroll-content::-webkit-scrollbar{width:9px}
.scroll-content::-webkit-scrollbar-thumb{border:2px solid transparent;border-radius:999px;background:#d8d8d4;background-clip:content-box}
:where(.scroll-rail){min-height:0;overflow-y:auto;scrollbar-width:none}
.scroll-rail::-webkit-scrollbar{display:none}

@media (prefers-reduced-motion:reduce){*{animation-duration:.01ms!important;transition-duration:.01ms!important}}

/* ── MEASURE ───────────────────────────────────────────────────────────────
   A line of 102 characters is the thing that actually made these pages hard to
   read, not the type size. Counted from real line boxes across all 101 apps,
   prose ran to a median of 80 characters and a 90th percentile of 110; the
   comfortable range is 45-75, and 57 of the long runs were plain <p>.

   68ch rather than a pixel width, so the measure holds when the type changes.
   :where() keeps it at zero specificity — an app that genuinely needs a wider
   column (a table cell, a code block) overrides it with one plain selector. */
:where(p){max-width:68ch}
