/* Report layout layer: the R1 source rail. Author: Imad A. Adel.
   Shared by every research report in the family. Each report ships this file
   byte-identical to the family copy (hash in LAYER-READY.json) and links it after
   its own <style> blocks; a page's own fixes go in its report.surface.css, never here.
   The rail's content is supplied by the page (house-rail-data); this file holds only
   layout and the palette corrections the whole family needs.

   Scope: every layout rule is under :root[data-variant="R1"], which the page's head
   script sets. The dark-scheme text rules at the end are not: they correct the shared
   palette rather than the layout, and keep the exact specificity they were accepted
   with, so their cascade against each page's own rules does not change. */

/* ============================================================ column hygiene */
/* the page must never force a horizontal scroll at any width */
:root[data-variant="R1"] .shell,
:root[data-variant="R1"] .main{min-width:0}
:root[data-variant="R1"] .plot-box{min-width:0}
/* a grid item keeps min-width:auto, so a pane whose min-content is wider than the
   track pushes the track past the viewport. Every item placed in a grid has to give
   that up explicitly, and the tracked crumb has to be allowed to break. */
:root[data-variant="R1"] .pane,
:root[data-variant="R1"] .kpistrip,
:root[data-variant="R1"] #housecol,
:root[data-variant="R1"] #houserail{min-width:0}
:root[data-variant="R1"] #housecol{max-width:100%}
:root[data-variant="R1"] .crumb,
:root[data-variant="R1"] .pane-head h1{overflow-wrap:anywhere}
/* min-width:0 alone is not enough here: the pane still takes its automatic minimum
   size from a <select> whose longest option is wider than the track, and grows the
   grid item past the viewport. An explicit max-width:100% is what holds it. */
:root[data-variant="R1"] .pane,
:root[data-variant="R1"] .kpistrip{max-width:100%}
/* printed equations run past a 320 px viewport; the formula is the part that cannot
   break, so it gets the scroll. (F-WP12-01) */
:root[data-variant="R1"] .eq-row{min-width:0;max-width:100%}
:root[data-variant="R1"] .eq-f{overflow-x:auto;max-width:100%}
/* the equation grid's 300 px track floor is wider than a 320 px viewport once the
   panel padding is taken out; minmax(min(100%,N),1fr) collapses instead of overflowing. */
:root[data-variant="R1"] .eq-grid{grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr))}
/* bold emphasis inside the guide note rendered near-black on a warm dark panel,
   about 1.2:1. (F-WP12-02) */
:root[data-variant="R1"] .guide-note b,
:root[data-variant="R1"] .guide-note strong{color:var(--ink)}
/* the readout header holds a status flag whose tracked capitals do not wrap */
:root[data-variant="R1"] .kpistrip > *{min-width:0;max-width:100%}
:root[data-variant="R1"] .kpistrip .kc-head{flex-wrap:wrap;min-width:0;max-width:100%}
:root[data-variant="R1"] .kpistrip .flag{white-space:normal;overflow-wrap:anywhere}

/* ============================================================== source rail */
/* Reading column with a persistent source rail. The provenance of a claim sits
   beside the claim rather than at the end of the page. */
:root[data-variant="R1"] .main{
  display:grid;
  grid-template-columns:minmax(0,1fr) minmax(min(100%,268px),300px);
  gap:26px;align-items:start}
:root[data-variant="R1"] #housecol{grid-column:1;display:flow-root}
:root[data-variant="R1"] .pane{max-width:min(72ch,100%)}
:root[data-variant="R1"] .kpistrip{max-width:min(72ch,100%)}
:root[data-variant="R1"] #houserail{
  grid-column:2;position:sticky;top:18px;align-self:start;
  border:1px solid var(--line);border-radius:10px;background:var(--panel);
  padding:16px 17px;font-size:.82rem;line-height:1.7}
:root[data-variant="R1"] #houserail h2{
  font-size:.62rem;font-weight:800;letter-spacing:.12em;text-transform:uppercase;
  color:var(--muted);margin:0 0 10px}
:root[data-variant="R1"] #houserail h2 + *{margin-top:0}
:root[data-variant="R1"] #houserail dl{display:grid;grid-template-columns:1fr;gap:9px;margin:0}
:root[data-variant="R1"] #houserail dt{font-size:.68rem;color:var(--muted)}
:root[data-variant="R1"] #houserail dd{margin:0 0 2px;overflow-wrap:anywhere}
:root[data-variant="R1"] #houserail a{color:var(--blue)}
:root[data-variant="R1"] #houserail .railsep{
  border:0;border-top:1px solid var(--line);margin:15px 0}
:root[data-variant="R1"] #houserail .railkv{
  display:flex;justify-content:space-between;gap:10px;padding:3px 0}
:root[data-variant="R1"] #houserail .railkv b{font-variant-numeric:tabular-nums}
@media(max-width:1060px){
  :root[data-variant="R1"] .main{grid-template-columns:minmax(0,1fr)}
  :root[data-variant="R1"] .pane,
  :root[data-variant="R1"] .kpistrip{max-width:100%}
  :root[data-variant="R1"] #housecol{grid-column:1}
  :root[data-variant="R1"] #houserail{grid-column:1;position:static;order:-1}
}

/* ================================================= dark-scheme text (unscoped) */
/* F-WP12-04: text coloured from --navy/--navy2, which the dark palette maps to
   background shades. Text takes the panel ink; backgrounds keep their tokens. */
:root:not([data-theme="light"]) .gcard h3,
:root:not([data-theme="light"]) .fignum,
:root:not([data-theme="light"]) .eq-name,
:root:not([data-theme="light"]) .eq-row .eq-f,
:root:not([data-theme="light"]) .note b,
:root:not([data-theme="light"]) .note .co-k,
:root:not([data-theme="light"]) .note .wk{color:var(--ink)}
/* negative values in the dark scheme measured 4.32:1 on the shared palette */
:root:not([data-theme="light"]) .neg{color:#F08378}
