/* ============================================================================
   shared/rail-section.css — a SECTION in a workspace's left rail.

   A rail is a column of sections: a heading, a body, repeat. Every workspace in the suite
   builds one and — until this file — every workspace declared its own rule for it. The
   survey found FOURTEEN independent declarations of the same heading, ELEVEN of them
   byte-identical:

       margin:0; padding:8px 12px 6px; font-size:10.5px; letter-spacing:.09em;
       text-transform:uppercase; color:var(--muted); border-bottom:1px solid var(--line)

   Eleven copies is not a coincidence, it is a component nobody wrote down — and the three
   that differ are the cost of that: sound at `9px 12px 7px`, `field-components`' `.h6row`
   at a 10px inset instead of 12, retopo's `.ph` in sentence case at a fixed 34px with no
   border. The component library documents no section or rail component at all, so there
   was nothing to reach for and everyone reached for the clipboard.

   THE INSETS ARE THE POINT, because a rail is read down its left edge. Three values, and
   which one applies is decided by what the content IS, not by which section it is in:

       12px   a section HEADING, and any form row in a section body
        6px   a LIST ROW (the outliner's tree, and anything that is a list of the same
               thing) — rows carry their own hover/selection fill, which needs to sit
               inboard of the heading rather than align with its text
        0px   nothing. No surface in the suite puts rail content flush to the edge.

   A rail whose sections disagree about these reads as ragged even when every section is
   individually fine, which is exactly how it went wrong: four different insets down one
   column (12 · 8 · 6 · 0) with each one defensible on its own.
   ========================================================================== */

/* ---- the heading ------------------------------------------------------------------- */
/* ONE HEIGHT for every heading in a rail, declared rather than left to the content. Without
   it a heading that carries an action is as tall as that action (36.8px) and one that does
   not is as tall as its text (28.4px), so a rail's headings step in and out down the column
   for no reason a reader can name. 32px is the text height plus the padding this rule
   already had, and it is tall enough for the action chip below to sit inside it. */
.rail-h {
  margin: 0; padding: 8px 12px 6px; min-height: 32px; box-sizing: border-box;
  font-size: 10.5px; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 8px; flex: 0 0 auto;
}
/* `hidden` IS A UA-STYLESHEET RULE, and any author `display` outranks it — so `display:flex` above
   would render a heading its host had hidden, permanently and invisibly to the host. Every consumer
   that toggles a section would hit this and patch it locally, which is how a component grows a ring
   of local fixes for one missing line. It belongs here, once. */
.rail-h[hidden] { display: none; }

/* the count slot — provenance, so it recedes to faint and never competes with the title
   (`ui-and-authoring-docs.md` §2: emphasis follows importance). Tabular so a changing
   number does not shift the controls beside it. */
.rail-h .ct {
  margin-left: auto; font-size: 10px; color: var(--faint);
  font-variant-numeric: tabular-nums; text-transform: none; letter-spacing: 0;
}
/* AN ACTION IN A HEADING is the minority placement (2 surfaces of 9 that have one; the
   other 6 use the asset bar above the rail) but it is a real one, and those two agree on
   its treatment: accent-soft fill, accent text, NO border, radius 6. Reproduced here so a
   third surface gets the established chip rather than the nearest one to hand — the rig
   reached for `.sl-add`, which is stack-list's BODY-group chip: a different fill, a real
   border, a different radius and 1px smaller, sitting in a heading it was never scoped to.
   `.ct` takes the slack, so with a count present the actions sit right and without one
   they sit left; `margin-left:auto` on the first action keeps both cases flush right. */
.rail-h .rail-act {
  margin-left: auto; font-size: 11px; line-height: 16px; padding: 1px 8px;
  border-radius: 6px; background: var(--accent-soft); color: var(--accent-text);
  cursor: pointer; white-space: nowrap;
}
.rail-h .ct ~ .rail-act { margin-left: 0; }
.rail-h .rail-act ~ .rail-act { margin-left: 0; }
.rail-h .rail-act:hover { background: var(--accent); color: var(--on-accent); }
/* THE DISABLED STATE BELONGS TO THE COMPONENT, like every other atom's does (`components.css`
   carries one for `.btn`, `.chip`, `.selin`, `.inp`…). A heading action whose precondition is not
   met — capture with nothing posed — must READ as unavailable and keep its hover off, or the only
   evidence that it will refuse is the toast you get after pressing it (`ui-and-authoring-docs.md`
   §9: prevent the invalid action, do not merely handle it). It stays visible and keeps its title,
   which is where the reason is. */
.rail-h .rail-act.is-disabled { background: var(--well); color: var(--faint); cursor: not-allowed; }
.rail-h .rail-act.is-disabled:hover { background: var(--well); color: var(--faint); }

/* ---- the body ---------------------------------------------------------------------- */
/* No padding of its own: what a body contains decides its inset, so a list module and a
   form block can both sit in one without fighting a container's opinion. */
.rail-b { min-height: 0; overflow: auto; }
/* a form block — label/control rows — at the heading's own inset, so the two line up */
.rail-b.form { padding: 8px 12px; }

/* a chip row directly under a heading (role filters, view toggles). It had NO rule at all
   on the one surface that used it, so its chips sat at x=0 and butted edge to edge. */
.rail-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px; }

/* A LIST IN A RAIL shares the outliner's geometry, because they are the same thing read the
   same way: rows inboard at 6px, 26px pitch, and the destructive control right-aligned like
   the tree's eye and trash. The rig's chain list used `.mrow` — the MENU molecule's row —
   flush at x=0 and 29.6px tall, so one rail carried two list pitches 3.6px apart, two left
   edges, and a trash floating 164px short of the right edge because `.mrow` has no
   `margin-left:auto` on it and bare `.rm` has no rule at all. */
.rail-list { padding: 4px 6px 12px; }
.rail-list .mrow { height: 26px; border-radius: 6px; }
.rail-list .mrow .rm { margin-left: auto; color: var(--faint); cursor: pointer; display: inline-flex; }
.rail-list .mrow .rm:hover { color: var(--danger); }

/* the empty state, at the catalogue's own values (`.sl-empty`, `.emptyTree`): 11.5px and
   faint, not body text. The rig's `.rst-empty` had no rule and rendered 13px in `--ink` —
   louder than the content it was standing in for. */
.rail-empty { padding: 10px 12px; font-size: 11.5px; color: var(--faint); line-height: 1.5; }
.rail-empty b { color: var(--text2); font-weight: 600; }
