/* texas.css — the Texas crude pipelines page (/flows/texas/).
 *
 * site/redesign-texas step 1 (2026-11-11, Thomas via HQ, decisions A to G:
 * "flow better, work pretty identical to grid status ... lots of white space
 * but things are too spread out"). tokens.css declares the palette, app.css
 * builds .panel, .seg and .data-table, shell.css the key card and sub-bar;
 * this sheet lays the page out: one row of controls, then a grid of the list,
 * a small map, the selected item's stats and its volume chart, and under
 * them one band for a line with its own filing. Under 700px it is one
 * column and the selection opens under its own row. No colour literal and no
 * custom property: tests/test_web_tokens.py holds both.
 */

/* THE PAGE GROUND. The body carries no `.app` class, so this sheet owns the
 * font, ink and background. font-size on body, never html. */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); margin: 0; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--t-body);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font-family: var(--font-ui); }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px;
    text-decoration-color: var(--line-strong); }
a:hover { text-decoration-color: var(--ink); }
.muted { color: var(--ink-faint); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }

.tx { max-width: 1280px; margin: 0 auto; padding: var(--sp-2) var(--sp-4) var(--sp-4); }
.state { padding: var(--sp-2) var(--sp-3); margin: 0; color: var(--ink-body); font-size: var(--t-data); }
.show-sm { display: none; }

/* ------------------------------------------------------------ controls */
/* ONE ROW, ALWAYS IN THIS ORDER: view, search, range, unit. From 1240px the
 * script docks the row into the crude sub-bar (its right end); under that it
 * is the page's first row and wraps. The sub-bar's own rules (shell.css) are
 * not touched: these size what this page puts in it. */
.tx-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2);
          margin: 0 0 var(--sp-2); }
.tx-bar .seg { flex: none; }
.tx-bar .seg-btn { padding: var(--sp-1) var(--sp-3); white-space: nowrap; line-height: 1.3; }
.tx-tab-n { font-family: var(--font-data); font-size: var(--t-label); color: var(--ink-faint); }
.tx-tab-map { display: none; }
.tx-search {
  min-width: 0; width: 180px; max-width: 100%;
  padding: var(--sp-1) var(--sp-2); line-height: 1.3;
  font-size: var(--t-data); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
}
.tx-unit { font-family: var(--font-data); font-size: var(--t-label); color: var(--ink-faint); }
.flows-tabs > .tx-bar { flex-wrap: nowrap; align-self: center; margin: 0 0 0 auto;
                        padding-left: var(--sp-4); }
/* The sub-bar stays in view while the list scrolls under it. */
@media (min-width: 701px) {
  body > .flows-tabs { position: sticky; top: 0; z-index: 1100; }
}
.tx-month {
  padding: var(--sp-1) var(--sp-2);
  font-size: var(--t-data); color: var(--ink);
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: var(--r-ctl);
}
/* Counts and dates, one line; it wraps. */
.tx-count { margin: 0 0 var(--sp-2); font-size: var(--t-label); color: var(--ink-body); }

/* ------------------------------------------------------------ the grid */
/* The list on the left; beside it the map (its box is the Texas frame at
 * zoom 5: 355 x 310 measured on the live page, 2026-11-11) with the chosen
 * item's head and stats; under those its volume box; under everything the
 * filing band. #tx-detail is not a box of its own here: its parts are laid
 * straight into this grid, so a card never sits inside another card. */
.tx-work {
  display: grid; gap: var(--sp-3); align-items: start;
  grid-template-columns: minmax(0, 700fr) 362px minmax(0, 164fr);
  grid-template-rows: auto 1fr auto;
  grid-template-areas: "list map sel" "list vol vol" "band band band";
}
.tx-list { grid-area: list; }
.tx-map-panel { grid-area: map; }
.tx-detail { display: contents; }
.tx-detail[hidden] { display: none; }
.tx-sel { grid-area: sel; min-width: 0; }
.tx-vol { grid-area: vol; }
.tx-boxes { grid-area: band; }
/* Three columns need the list's table (about 670px) beside the 362px map and
 * the selection: from 1240px, where the controls dock into the sub-bar too. */
@media (max-width: 1239px) {
  .tx-work {
    grid-template-columns: 362px minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "list list" "map sel" "vol vol" "band band";
  }
}

/* ------------------------------------------------------------ cards */
.tx .panel { box-shadow: none; margin: 0; min-width: 0; }
.tx .panel-header { flex-wrap: wrap; background: var(--surface); padding: var(--sp-2) var(--sp-3); }
.tx .panel-header h4 { font-size: var(--t-label); font-weight: 600; text-transform: uppercase;
                       letter-spacing: var(--label-tracking); color: var(--ink-body); margin: 0; }
.tx .panel-header .unit { font-family: var(--font-data); font-size: var(--t-label); color: var(--ink-faint); }
.tx .panel-header .tx-month { margin-left: auto; }
.tx .panel-body { padding: var(--sp-2) var(--sp-3); }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------ map */
/* The Texas frame fits at zoom 5 in 355 x 310 (measured); the box is a
 * little over that. Its own stacking context, so the map's controls stay
 * under the sticky sub-bar. */
.tx-map-panel { overflow: hidden; position: relative; z-index: 0; }
.mapbox { height: 320px; background: var(--surface); }
.mapbox .map-key { width: 232px; }
/* Folded, the key is its button and no wider: at 232px it lay across the top
 * of the small map, over Cushing. */
.mapbox .map-key.collapsed { width: auto; }
.mapbox .map-key-body { max-height: 210px; }
.leaflet-container { font-family: var(--font-ui); }
.leaflet-tooltip { background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
                   box-shadow: none; font-size: var(--t-data); }

/* ------------------------------------------------------------ the list */
/* Seven columns and the longest name ("Gray Oak (Eagle Ford receipts)") on
 * one 28px row in the list's 700px: short heads (js/texas.js COLS), names in
 * the UI face, 5px each side of a column. NOTHING IS CUT TO FIT: where the
 * box is narrower than the table, a name wraps to a second line (every other
 * cell keeps one line), so the Source column always shows whole. A refinery's
 * operator may wrap. */
.tx-list-table th, .tx-list-table td { padding: var(--sp-1) 5px; }
.tx-list-table thead th { text-align: right; }
.tx-list-table thead th:first-child { text-align: left; }
.tx-list-table td { vertical-align: middle; height: 28px; }
.tx-list-table td:first-child { white-space: normal; font-family: var(--font-ui); }
/* The line under a refinery's name when one filing covers two sites. */
.tx-sub { color: var(--ink-body); font-size: var(--t-label); }
/* A row with that line is two lines and no more. On the wide layout the table
 * sizes its own columns and gave the name less than its width, so the name
 * wrapped above its line, the line wrapped too, and West's row stood four
 * lines tall (HQ 2026-11-19). There the name and the line each keep to one
 * line and the column takes their width; nothing is cut. Under 700px the
 * columns are fixed and both may wrap. */
@media (min-width: 701px) {
  .tx-plant-table td:first-child:has(.tx-sub) b, .tx-plant-table .tx-sub { white-space: nowrap; }
}
.tx-plant-table td:nth-child(2) { white-space: normal; font-family: var(--font-ui); color: var(--ink-body); }
.tx-list-table .tx-period, .tx-list-table .tx-src, .tx-list-table .tx-util-col,
.tx-list-table th:nth-child(3), .tx-list-table th:nth-child(5), .tx-list-table th:nth-child(7),
.tx-plant-table td:nth-child(2), .tx-plant-table th:nth-child(2) { text-align: left; }
.tx-plant-table th:nth-child(3), .tx-plant-table th:nth-child(7) { text-align: right; }
.tx-plant-table th:nth-child(5) { text-align: left; }
.tx-period, .tx-src { color: var(--ink-body); font-family: var(--font-ui); }
.tx-src { font-size: var(--t-label); }
.tx-row { cursor: pointer; }
.tx-row.is-hover td, .tx-row:focus-visible td { background: var(--surface-2); }
.tx-row.is-open td { background: var(--surface-2); }
/* The selected row carries a left rule. */
.tx-row.is-open td:first-child { box-shadow: inset 3px 0 0 var(--ink); }
.th-sort { background: none; border: 0; padding: 0; cursor: pointer; font: inherit;
           color: inherit; letter-spacing: inherit; text-transform: inherit; }
.th-sort:hover { color: var(--ink); }
svg.tx-util { display: inline-block; vertical-align: middle; margin-right: var(--sp-2); }
.tx-util-bg { fill: var(--line); }
.tx-util-fill { fill: var(--series-1); }
svg.tx-util.is-over .tx-util-fill { fill: var(--warn); }
/* The bar's key, under the pipelines table: what the amber bar is. */
.tx-list-key { margin: 0; padding: var(--sp-1) 5px var(--sp-2); }
.tx-list-unit { color: var(--ink-body); }
.sw-util, .sw-util-over { width: 14px; height: 6px; }
.sw-util { background: var(--series-1); }
.sw-util-over { background: var(--warn); }
.tx-util-n { display: inline-block; min-width: 4ch; text-align: right;
             font-family: var(--font-data); font-variant-numeric: tabular-nums; }

svg.spark { display: block; overflow: visible; }
.spark-line { fill: none; stroke: var(--series-1); stroke-width: 1.5;
              stroke-linejoin: round; stroke-linecap: round; }
.spark-dot { fill: var(--series-1); }
svg.spark.s-del .spark-line { stroke: var(--series-3); }
svg.spark.s-del .spark-dot { fill: var(--series-3); }

/* ------------------------------------------------------------ the selection */
/* The head: the name, one identity line, then at most four stats, stacked in
 * the narrow column beside the map (two by two on a phone). Hairlines between
 * the stats, no boxes. */
.tx-detail-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start;
                  gap: 0 var(--sp-2); margin: 0 0 var(--sp-2); }
.tx-detail-head h3 { font-family: var(--font-display); font-weight: 400; font-size: var(--t-title);
                     line-height: 1.15; margin: 0; overflow-wrap: anywhere; }
.tx-meta { grid-column: 1 / -1; color: var(--ink-body); font-size: var(--t-label);
           margin-top: var(--sp-1); overflow-wrap: anywhere; }
.tx-stats { display: grid; grid-template-columns: 1fr; margin: 0; }
.tx-stat { display: flex; flex-direction: column; min-width: 0;
           padding: var(--sp-1) 0; border-top: 1px solid var(--line); }
.tx-stat-label {
  font-size: var(--t-label);
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.tx-stat-value { color: var(--ink); font-family: var(--font-data); font-size: 1.125rem; line-height: 1.25;
                 font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.tx-stat-sub { font-size: var(--t-label); color: var(--ink-body); }
@media (max-width: 1239px) {
  .tx-stats { grid-template-columns: 1fr 1fr; column-gap: var(--sp-4); }
}
/* The source line wraps. Never clip a sentence that explains a figure (HQ 2026-11-11): at 375 a refinery's
   "Source: EIA Form EIA-820 (Jan 2026); Texas RRC Form T-1 (03-1072)" was
   cut at 327 of 360 px. tests/e2e/ui01_panel_standard.cjs reads it at 375. */
.tx-source {
  margin: var(--sp-2) 0 0;
  font-size: var(--t-label);
  color: var(--ink-faint);
  white-space: normal;
  overflow-wrap: break-word;
}
/* The nameplate's credit, on a line of its own under the source; it wraps. */
.tx-credit {
  margin: var(--sp-1) 0 0;
  font-size: var(--t-label);
  color: var(--ink-faint);
  white-space: normal;
  overflow-wrap: break-word;
}
.tx-credit:empty { display: none; }

/* THE FILING BAND, for a line with its own T-1 filing: receipts against
 * deliveries, the month's sources, and the missing months, three abreast;
 * two and one under 1240px; stacked under 700px. One box if the filing
 * cannot be read. */
.tx-boxes { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 5fr) minmax(0, 3fr);
            gap: var(--sp-3); align-items: start; }
.tx-boxes.single { grid-template-columns: 1fr; }
.tx-boxes > .panel { min-width: 0; }
@media (max-width: 1239px) {
  .tx-boxes { grid-template-columns: 1fr 1fr; }
  .tx-boxes > .tx-gaps-block { grid-column: 1 / -1; }
}

/* "Missing data": one plain line per kind. */
.tx-gaps { list-style: none; margin: 0; padding: 0; font-size: var(--t-data); color: var(--ink-body); }
.tx-gaps li { padding: var(--sp-1) 0; border-top: 1px solid var(--line); overflow-wrap: break-word; }
.tx-gaps li:first-child { border-top: 0; padding-top: 0; }
.tx-gap-k { color: var(--ink); font-weight: 500; margin-right: var(--sp-1); }
.tx-gaps-block .state, .tx-who .state { padding-left: 0; }

.tx-legend { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); margin: var(--sp-1) 0 0;
             color: var(--ink-body); font-size: var(--t-label); }
.sw { display: inline-block; vertical-align: middle; margin-right: var(--sp-1); }
.sw-flow { width: 14px; height: 0; border-top: 2px solid var(--series-1); }
.sw-cap { width: 14px; height: 0; border-top: 2px dashed var(--ink-faint); }
.sw-lease, .sw-rec, .sw-del, .sw-del-ref, .sw-del-exp, .sw-del-pipe, .sw-del-out, .sw-del-other { width: 10px; height: 10px; }
.sw-lease { background: var(--series-5); }
.sw-rec { background: var(--series-1); }
.sw-del, .sw-del-ref { background: var(--series-3); }
.sw-del-exp { background: var(--series-4); }
.sw-del-pipe { background: var(--series-6); }
.sw-del-out { background: var(--series-2); }
.sw-del-other { background: var(--series-other); }

.tx-parties { width: 100%; }
.tx-parties td { vertical-align: middle; }
.tx-parties td:first-child { white-space: normal; overflow-wrap: anywhere; }
.tx-parties .muted { font-size: var(--t-label); }
.tx-parties tr[data-point] { cursor: default; }
/* What the filing totals but does not name: last, and quieter. */
.tx-parties tr.tx-other td { color: var(--ink-body); }
.tx-parties tr[data-point]:hover td { background: var(--surface-2); }

/* ------------------------------------------------------------ chart */
.tx-chart { min-height: 170px; }
svg.chart { display: block; width: 100%; height: auto; outline: none; touch-action: pan-y; }
svg.chart:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
svg.chart .grid { stroke: var(--line); stroke-width: 1; }
svg.chart .axis { stroke: var(--line-strong); stroke-width: 1; }
svg.chart .tick { fill: var(--ink-faint); font-family: var(--font-data); font-size: var(--t-label); }
svg.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .c-flow { stroke: var(--series-1); }
svg.chart .dot.c-flow { fill: var(--series-1); stroke: none; }
svg.chart .c-cap { stroke: var(--ink-faint); stroke-width: 1.5; stroke-dasharray: 5 4; }
svg.chart .dot.c-cap { fill: var(--ink-faint); stroke: none; }
svg.chart .bar.c-lease { fill: var(--series-5); }
svg.chart .bar.c-rec { fill: var(--series-1); }
svg.chart .bar.c-del, svg.chart .bar.c-del-ref { fill: var(--series-3); }
svg.chart .bar.c-del-exp { fill: var(--series-4); }
svg.chart .bar.c-del-pipe { fill: var(--series-6); }
svg.chart .bar.c-del-out { fill: var(--series-2); }
svg.chart .bar.c-del-other { fill: var(--series-other); }
svg.chart .cross { stroke: var(--line-strong); stroke-width: 1; }
svg.chart .mark { stroke: var(--ink-faint); stroke-width: 1; stroke-dasharray: 2 3; }
.tx-readout { margin: var(--sp-1) 0 0; font-family: var(--font-data); font-size: var(--t-label);
              color: var(--ink-body); overflow-wrap: break-word; }

.tx-foot { max-width: 1280px; margin: 0 auto; padding: var(--sp-3) var(--sp-4) var(--sp-5);
           border-top: 1px solid var(--line); color: var(--ink-faint); font-size: var(--t-data); }
.tx-foot p { margin: 0 0 var(--sp-1); }

/* ------------------------------------------------------------ narrow */
/* Under 700px (js/texas.js PHONE_LAYOUT): one column. The list keeps four
 * columns at fixed widths, so nothing in an opened row can widen it; the map
 * is the view switch's third position; the selection sits under its row,
 * its parts stacked. */
@media (max-width: 700px) {
  .tx { padding: var(--sp-2) var(--sp-4) var(--sp-4); }
  .hide-sm { display: none; }
  .show-sm { display: revert; }
  .tx-tab-map { display: inline-block; }
  .tx-search { flex: 1 1 120px; width: auto; }
  .tx-work { display: block; }
  .tx-map-panel { display: none; margin: 0 0 var(--sp-3); }
  .tx.is-map .tx-map-panel { display: block; margin-bottom: var(--sp-3); }
  .tx.is-map .tx-list { display: none; }
  .tx-detail { display: block; }
  .tx-list-table { table-layout: fixed; }
  .tx-list-table td { height: 34px; }
  .tx-list-table th:nth-child(2) { width: 58px; }
  .tx-list-table th:nth-child(3) { width: 98px; }
  .tx-list-table th.tx-util-col { width: 52px; }
  .tx-plant-table th:nth-child(3) { width: 60px; }
  .tx-plant-table th:nth-child(4) { width: 50px; }
  .tx-plant-table th:nth-child(5) { width: 78px; }
  .tx-list-table td:first-child, .tx-list-table .tx-period { white-space: normal; }
  svg.tx-util { display: none; }
  .tx-util-n { min-width: 0; }
  /* The opened row: the block, in the table's own width. */
  .tx-list-table tr.tx-open-row > td { height: auto; padding: var(--sp-3) var(--sp-2);
    white-space: normal; text-align: left; background: var(--bg);
    font-family: var(--font-ui); }
  .tx-list-table tr.tx-open-row:hover > td { background: var(--bg); }
  .tx-detail > * + * { margin-top: var(--sp-3); }
  .tx-stats { grid-template-columns: 1fr 1fr; column-gap: var(--sp-4); }
  .tx-boxes { grid-template-columns: 1fr; }
  .tx-boxes > .tx-gaps-block { grid-column: auto; }
  .mapbox .map-key-body { max-height: 200px; }
}
@media (forced-colors: active) {
  svg.chart .line, .spark-line { stroke: CanvasText; }
}

/* Screen-reader-only text: the page's h1 (launch audit S2, 2026-11). Same
   rule as style.css's .sr-only, which this page does not load. */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* The plant's T-1 deliveries by delivering line (HQ 2026-11-06), in the US
   map's refinery-panel order of series colours. */
svg.chart .bar.c-car1 { fill: var(--series-1); }
svg.chart .bar.c-car2 { fill: var(--series-2); }
svg.chart .bar.c-car3 { fill: var(--series-3); }
svg.chart .bar.c-car4 { fill: var(--series-4); }
svg.chart .bar.c-car5 { fill: var(--series-6); }
.sw-c-car1 { background: var(--series-1); }
.sw-c-car2 { background: var(--series-2); }
.sw-c-car3 { background: var(--series-3); }
.sw-c-car4 { background: var(--series-4); }
.sw-c-car5 { background: var(--series-6); }

/* A note under a refinery's table or chart (main, refinery-pages audit
 * 2026-11-12): the owner's ruled sentence on what the page shows, and the
 * months a feeder went unread. A block that wraps, quieter than the figures. */
.tx-note { margin: var(--sp-2) 0 0; font-family: var(--font-ui); font-size: var(--t-label);
           color: var(--ink-body); overflow-wrap: break-word; }
