/* ═══════════════════════════════════════════════════════════════════════════
   31-freight.css — the US RAIL FREIGHT research surface (#freight-root).
   Built by static/js/freight.js. Namespace: .fr-  (checked free against every
   predecessor: .st- .pos- .stx- .sx- .cx- .ea- .tr- .rg- .ec- .sc- .es- .rfy-
   and research-feed's .rf-).
   ---------------------------------------------------------------------------
   Load order in static/css/app/ IS the cascade and this file is APPENDED at
   the highest number, so nothing here fights for specificity and nothing here
   may be renumbered or reordered.

   THE DIALECT IS OURS, taken from 27-refinery.css and 07-command-center.css
   rather than invented: opaque --bg-tertiary cards, ONE hairline inset ring
   (never a 1px border — those render as bowtie artifacts in headless
   screenshots), --radius-lg, an in-card eyebrow, and every colour resolving
   through tokens.css so both themes follow for free.

   COLOUR IS BLUE/ORANGE, NEVER GREEN/RED.
   Green/red loses 81% of its perceptual separation under deuteranopia;
   blue/orange loses none. Up is --info-blue, down is --amber, and neither is
   load-bearing anyway:

     * the verdict is a SENTENCE beginning with a bolded verdict WORD;
     * every direction is ALSO a glyph (▲ ▼ –) rendered in the text flow;
     * every percentage prints its sign;
     * the diverging bars sit on a centred baseline, so the SIDE a bar falls on
       carries the direction independently of its hue.

   Desaturate a screenshot of this board and the verdict, every carrier's
   direction and every commodity's direction are all still readable.

   TYPOGRAPHIC PRIORITY (spec R1): the verdict sentence is the largest text on
   the surface and has no number beside it. The evidence strip is deliberately
   small and tabular-numeric — it supports the verdict, it does not compete.
   ═══════════════════════════════════════════════════════════════════════════ */

#freight-root{
  position:absolute;inset:0;display:none;
  flex-direction:column;min-width:0;min-height:0;
  background:var(--bg-primary);
}
/* MPFreight.show()/hide() owns this class, so the host needs no per-mode
   display rule of its own in 05-chart-panels.css. */
#freight-root.fr-on{display:flex;}

/* The stage's OTHER layers, hidden while this surface owns it. Declared here
   so wiring the view is a class toggle in research.js and nothing else.
   !important matches the existing .research-panel rules it has to beat. */
#research-view.rsx-mode-freight #research-iframe,
#research-view.rsx-mode-freight #rsx-index,
#research-view.rsx-mode-freight .rf-surface,
#research-view.rsx-mode-freight .research-panel{display:none!important;}

/* ── Scroller ──────────────────────────────────────────────────────────── */

.fr-scroll{
  flex:1 1 auto;min-height:0;overflow-y:auto;overflow-x:hidden;
  scrollbar-width:thin;
  scrollbar-color:color-mix(in srgb, var(--accent) 22%, transparent) transparent;
}
.fr-scroll::-webkit-scrollbar{width:0.375rem;height:0.375rem;}
.fr-scroll::-webkit-scrollbar-track{background:transparent;}
.fr-scroll::-webkit-scrollbar-thumb{
  background:var(--border-default);border-radius:0.25rem;
}
.fr-scroll:hover::-webkit-scrollbar-thumb{
  background:color-mix(in srgb, var(--accent) 28%, transparent);
}

.fr-inner{
  display:flex;flex-direction:column;gap:0.75rem;
  padding:0.875rem 1rem 2rem;
  max-width:64rem;margin:0 auto;
}

.fr-loading{
  padding:2.5rem 0;text-align:center;
  color:var(--text-muted);font-size:0.8125rem;
}

/* ── Synthetic-data banner ─────────────────────────────────────────────── */
/* Unmissable by construction: full-bleed, warm surface, uppercase lead. A
   screenshot of seeded data must never be mistakable for a federal filing. */

.fr-synth{
  display:flex;flex-wrap:wrap;gap:0.5rem;align-items:baseline;
  padding:0.5rem 0.75rem;border-radius:var(--radius-lg, 0.5rem);
  background:color-mix(in srgb, var(--amber) 18%, var(--bg-tertiary));
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--amber) 55%, transparent);
  color:var(--text-primary);font-size:0.75rem;line-height:1.45;
}
.fr-synth-word{
  font-weight:800;letter-spacing:0.08em;font-size:0.6875rem;
  color:var(--amber);text-transform:uppercase;
}

/* ── The verdict (spec R1) ─────────────────────────────────────────────── */

.fr-verdict{
  margin:0.25rem 0 0.125rem;
  font-size:1.0625rem;line-height:1.5;font-weight:400;
  color:var(--text-secondary);
  letter-spacing:-0.005em;
  max-width:56rem;
}
.fr-verdict-word{
  font-weight:750;color:var(--text-primary);
  /* The word is the encoding. No colour class is applied to it on purpose:
     the reader must not learn to read the hue instead of the sentence. */
}

/* ── Evidence strip ────────────────────────────────────────────────────── */

.fr-ev{
  display:grid;gap:1px;
  grid-template-columns:repeat(auto-fit, minmax(8.75rem, 1fr));
  background:var(--border-subtle);
  border-radius:var(--radius-lg, 0.5rem);overflow:hidden;
  box-shadow:inset 0 0 0 1px var(--border-subtle);
}
.fr-ev-cell{
  display:flex;flex-direction:column;gap:0.1875rem;
  padding:0.4375rem 0.625rem;background:var(--bg-tertiary);
  /* The label can run to two lines; the value must still sit at the bottom so
     the numbers line up across cells whatever their labels do. */
  justify-content:space-between;min-height:2.75rem;
}
/* WRAPS, never ellipsises. Measured at 1440 with `nowrap`: three of the nine
   labels truncated to "VS SAME WEEK LAS…", "4-WEEK VS LAST YE…" and "INSIDE
   ITS OWN SP…" — and a clipped label on a statistic is the same failure as a
   caveat in a tooltip, because the reader cannot tell what the number counts. */
.fr-ev-k{
  font-size:0.625rem;letter-spacing:0.05em;text-transform:uppercase;
  color:var(--text-muted);line-height:1.25;
  overflow-wrap:anywhere;
}
.fr-ev-v{
  font-size:0.8125rem;font-weight:600;color:var(--text-primary);
  font-variant-numeric:tabular-nums;
}
/* n is PHYSICALLY ATTACHED to the statistic it qualifies — never a tooltip,
   never a footnote, never croppable out of a screenshot. */
.fr-n{
  font-size:0.625rem;font-weight:500;color:var(--text-muted);
  letter-spacing:0.01em;
}

/* ── Provenance / method tags (spec R3: inline, always) ────────────────── */

.fr-tag{
  display:inline-block;margin-left:0.375rem;
  padding:0.0625rem 0.25rem;border-radius:0.1875rem;
  font-size:0.5625rem;font-weight:700;letter-spacing:0.075em;
  text-transform:uppercase;vertical-align:0.08em;
}
.fr-tag-derived{
  color:var(--text-muted);
  box-shadow:inset 0 0 0 1px var(--border-default);
}
.fr-tag-scope{
  color:var(--amber);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--amber) 45%, transparent);
}
.fr-tag-im{
  color:var(--info-blue);
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--info-blue) 45%, transparent);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.fr-card{
  display:flex;flex-direction:column;gap:0.5rem;
  padding:0.75rem 0.875rem 0.875rem;
  background:var(--bg-tertiary);
  border-radius:var(--radius-lg, 0.5rem);
  box-shadow:inset 0 0 0 1px var(--border-subtle);
}
.fr-card-err{
  box-shadow:inset 0 0 0 1px color-mix(in srgb, var(--amber) 45%, transparent);
}
.fr-eyebrow{
  font-size:0.625rem;letter-spacing:0.07em;text-transform:uppercase;
  color:var(--text-muted);font-weight:600;
}

/* INLINE caveats — anything that changes what a number MEANS. Never behind a
   toggle, per spec R3. */
.fr-inline{
  margin:0;font-size:0.6875rem;line-height:1.55;color:var(--text-secondary);
  max-width:52rem;
}
.fr-inline strong{color:var(--text-primary);font-weight:650;}

.fr-context{
  padding:0.5rem 0.75rem;border-radius:var(--radius-lg, 0.5rem);
  background:var(--bg-secondary);
  box-shadow:inset 0 0 0 1px var(--border-subtle);
  font-size:0.6875rem;line-height:1.55;color:var(--text-secondary);
}
.fr-context-word{font-weight:700;color:var(--text-primary);}

/* ── Info expander (spec R3: ONE per panel, real button, not a title=) ─── */

.fr-info{margin-top:0.125rem;}
.fr-info-btn,
.fr-collapse{
  appearance:none;background:transparent;border:0;cursor:pointer;
  padding:0.25rem 0.5rem;border-radius:0.25rem;
  font:inherit;font-size:0.6875rem;font-weight:600;
  color:var(--text-muted);text-align:left;
  box-shadow:inset 0 0 0 1px var(--border-subtle);
  /* 44px is the touch target the floors pass asks for; the visible chip is
     smaller, so the target is grown with padding rather than the ink. */
  min-height:1.75rem;
}
.fr-info-btn:hover,
.fr-collapse:hover{color:var(--text-primary);background:var(--bg-hover);}
.fr-info-btn:focus-visible,
.fr-collapse:focus-visible{
  outline:1px solid var(--accent);outline-offset:-1px;color:var(--text-primary);
}
.fr-info-body{
  margin-top:0.375rem;padding:0.5rem 0.625rem;
  background:var(--bg-secondary);border-radius:0.375rem;
  font-size:0.6875rem;line-height:1.6;color:var(--text-secondary);
  max-width:52rem;
}
.fr-info-body em{color:var(--text-primary);font-style:italic;}

.fr-collapse{align-self:flex-start;margin-top:0.25rem;}

/* ── Chart ─────────────────────────────────────────────────────────────── */

.fr-chart{
  width:100%;
  /* max() so the pane never collapses on a short viewport; never sized in rem
     alone (see the pane-ratio gotcha). */
  height:max(11rem, 22vh);
  background:var(--chart-bg);
  border-radius:0.375rem;
  box-shadow:inset 0 0 0 1px var(--border-subtle);
  overflow:hidden;
}
.fr-svg{width:100%;height:100%;display:block;}
.fr-ln{fill:none;stroke-linejoin:round;stroke-linecap:round;}
/* vector-effect keeps the stroke 1.6px after the non-uniform viewBox stretch,
   which is what stops the line thinning to invisibility on a wide pane. */
.fr-ln-now{
  stroke:var(--info-blue);stroke-width:1.6;vector-effect:non-scaling-stroke;
}
.fr-ln-prior{
  stroke:var(--amber);stroke-width:1.4;stroke-dasharray:4 3;
  opacity:0.85;vector-effect:non-scaling-stroke;
}
.fr-ax{
  fill:var(--text-muted);font-size:9px;text-anchor:middle;
  font-variant-numeric:tabular-nums;
}
.fr-key{font-weight:700;}
.fr-key-now{color:var(--info-blue);}
.fr-key-prior{color:var(--amber);}

/* ── Tables ────────────────────────────────────────────────────────────── */

.fr-tbl{
  width:100%;border-collapse:collapse;font-size:0.75rem;
}
.fr-tbl thead th{
  padding:0.25rem 0.5rem;text-align:left;
  font-size:0.625rem;letter-spacing:0.055em;text-transform:uppercase;
  color:var(--text-muted);font-weight:600;
  border-bottom:1px solid var(--border-subtle);
}
.fr-tbl tbody th,
.fr-tbl tbody td{
  padding:0.375rem 0.5rem;text-align:left;font-weight:400;
  color:var(--text-secondary);
  border-bottom:1px solid var(--border-subtle);
  vertical-align:baseline;
}
.fr-tbl tbody tr:last-child th,
.fr-tbl tbody tr:last-child td{border-bottom:0;}
.fr-numc{text-align:right!important;font-variant-numeric:tabular-nums;}
.fr-rr{
  font-weight:700;color:var(--text-primary);font-size:0.75rem;
  letter-spacing:0.02em;
}
.fr-rr-name{
  display:block;font-size:0.625rem;color:var(--text-muted);
  margin-top:0.0625rem;
}
.fr-sym{font-weight:600;color:var(--text-primary);}
.fr-none{
  font-weight:400;color:var(--text-muted);font-size:0.6875rem;
  font-style:italic;
}
.fr-note{font-size:0.6875rem;color:var(--text-muted);line-height:1.5;}
.fr-tbl-legacy{margin-top:0.25rem;}

/* ── Direction: glyph first, hue second ────────────────────────────────── */

.fr-arrow{
  display:inline-block;width:0.75rem;text-align:center;
  font-size:0.625rem;vertical-align:0.03em;
}
.fr-tone-up{color:var(--info-blue);}
.fr-tone-down{color:var(--amber);}
.fr-tone-flat,
.fr-tone-none{color:var(--text-muted);}

/* ── Diverging bars ────────────────────────────────────────────────────── */

.fr-bars{list-style:none;margin:0;padding:0;display:flex;
  flex-direction:column;gap:1px;}
.fr-bar-row{
  display:grid;align-items:center;gap:0.5rem;
  grid-template-columns:minmax(7rem, 14rem) 1fr 4.25rem 4.5rem;
  padding:0.1875rem 0.25rem;border-radius:0.1875rem;
}
.fr-bar-row:hover{background:var(--bg-row-hover);}
.fr-bar-lab{
  font-size:0.6875rem;color:var(--text-secondary);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.fr-bar-track{
  position:relative;height:0.625rem;border-radius:0.125rem;
  background:color-mix(in srgb, var(--border-subtle) 60%, transparent);
}
/* The centred baseline is the real encoding: which SIDE a bar falls on says
   the direction whatever happens to its hue. */
.fr-bar-track::before{
  content:'';position:absolute;left:50%;top:-1px;bottom:-1px;width:1px;
  background:var(--border-strong);
}
.fr-bar{
  position:absolute;top:1px;bottom:1px;border-radius:0.0625rem;
}
.fr-bar-pos{left:50%;background:var(--info-blue);}
.fr-bar-neg{right:50%;background:var(--amber);}
.fr-bar-val{
  font-size:0.6875rem;font-weight:600;text-align:right;
  font-variant-numeric:tabular-nums;
}
.fr-bar-abs{
  font-size:0.6875rem;color:var(--text-muted);text-align:right;
  font-variant-numeric:tabular-nums;
}

/* ── Provenance foot line ──────────────────────────────────────────────── */

.fr-prov{
  display:flex;flex-direction:column;gap:0.25rem;
  padding:0.625rem 0.125rem 0;
  font-size:0.625rem;line-height:1.6;color:var(--text-muted);
  border-top:1px solid var(--border-subtle);
}
.fr-prov strong{color:var(--text-secondary);font-weight:650;}
.fr-link{color:var(--accent);text-decoration:none;}
.fr-link:hover{text-decoration:underline;}
.fr-link:focus-visible{outline:1px solid var(--accent);outline-offset:-1px;}

/* ── Narrow ────────────────────────────────────────────────────────────── */

@media (max-width: 60rem){
  .fr-inner{padding:0.75rem 0.75rem 2rem;}
  .fr-verdict{font-size:0.9375rem;}
  .fr-bar-row{grid-template-columns:minmax(5.5rem, 9rem) 1fr 3.75rem;}
  .fr-bar-abs{display:none;}
}
