/* OpenTrucker News — site layer over the McGowan framework.
   Adds only what a newspaper needs and the framework does not carry:
   display typography, editorial furniture (kickers, deks, bylines, rules) and
   the chart/figure block. No ms-card margins, no ms-card__footer overrides —
   the grid owns spacing, the CDN owns components. See tests_layout.py.

   Page #262626, white cards, #333 card text — matched to the rest of the suite.
   The serif is a system stack, so it costs zero font requests: newsprint feel
   without a Google Fonts round trip. */

:root {
  --paper: #262626; --ink: #FFFFFF; --panel: #FFFFFF; --panel-ink: #333333;
  --moss: var(--ms-color-primary, #0E86FF);
  --fern: rgba(14, 134, 255, 0.12);
  --ember: #C98A3B; --line: #3A3A3A; --muted: #B5B5B5;
  --rule: #D7D5CE;
  --good: #2E7D4F; --bad: #B0413E;
  --sans: 'Roboto', system-ui, -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  --serif: 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
}
a { color: var(--moss); text-decoration: none; }
a:hover, a:focus-visible { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--moss); outline-offset: 2px; }

/* ---------------------------------------------------------------- masthead */

.ms-masthead {
  border-bottom: 3px double var(--line);
  padding: 28px 0 16px;
  margin-bottom: 18px;
  text-align: center;
}
.ms-masthead__title {
  font-family: var(--serif);
  font-size: clamp(2rem, 6vw, 3.4rem);
  font-weight: 700; letter-spacing: -0.02em; line-height: 1.05;
  margin: 0;
}
.ms-masthead__standfirst {
  color: var(--muted); font-size: 0.95rem; margin: 8px auto 0; max-width: 60ch;
}
.ms-masthead__dateline {
  color: var(--muted); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.12em; margin-top: 12px;
}

/* ------------------------------------------------------------- editorial */

.ms-kicker {
  display: inline-block; font-size: 0.72rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--moss); margin-bottom: 6px;
}
.ms-headline {
  font-family: var(--serif); font-weight: 700; letter-spacing: -0.015em;
  line-height: 1.15; margin: 0 0 8px;
}
.ms-headline--lead { font-size: clamp(1.7rem, 4.2vw, 2.6rem); }
.ms-headline--story { font-size: 1.25rem; }
.ms-headline--sm { font-size: 1.05rem; }
.ms-headline a { color: inherit; }
.ms-headline a:hover { color: var(--moss); text-decoration: none; }

.ms-dek {
  font-family: var(--serif); font-size: 1.02rem; line-height: 1.5;
  color: var(--panel-ink); opacity: 0.86; margin: 0 0 10px;
}
.ms-byline {
  font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted);
}
.ms-byline__origin {
  border: 1px solid var(--rule); border-radius: 2px;
  padding: 1px 6px; margin-left: 8px; text-transform: none; letter-spacing: 0;
}

/* Story body. Measure is capped because a 1400px line is unreadable however
   nice the grid looks. */
.ms-prose {
  font-family: var(--serif); font-size: 1.09rem; line-height: 1.68;
  color: var(--panel-ink); max-width: 68ch;
}
.ms-prose p { margin: 0 0 1.05em; }
.ms-prose > p:first-of-type::first-letter {
  float: left; font-size: 3.1em; line-height: 0.86; font-weight: 700;
  padding: 0.04em 0.09em 0 0; color: var(--panel-ink);
}
.ms-prose h2 {
  font-size: 1.3rem; margin: 1.6em 0 0.5em;
  padding-top: 0.6em; border-top: 1px solid var(--rule);
}
.ms-prose a { text-decoration: underline; }

.ms-rule { border: 0; border-top: 1px solid var(--rule); margin: 18px 0; }
.ms-rule--double { border-top: 3px double var(--rule); }

/* --------------------------------------------------------------- figures */

.ms-figure { margin: 0 0 18px; }
.ms-chart {
  width: 100%; height: 320px; min-height: 220px;
  background: transparent;
}
.ms-chart.is-empty {
  display: flex; align-items: center; justify-content: center;
  height: 120px; color: var(--muted); font-size: 0.9rem;
  border: 1px dashed var(--rule);
}
.ms-chart--tall { height: 420px; }
.ms-chart--spark { height: 46px; min-height: 46px; }

.ms-figure__caption {
  display: block; font-size: 0.8rem; line-height: 1.5; color: var(--panel-ink);
  opacity: 0.78; border-top: 1px solid var(--rule); padding-top: 8px; margin-top: 6px;
}
.ms-figure__text { display: block; margin-bottom: 4px; }
.ms-figure__sources { display: block; }
/* The limits of a number, printed with it. Small, but never hidden. */
.ms-figure__caveat {
  display: block; margin-top: 6px; font-size: 0.76rem; font-style: italic;
}

/* ------------------------------------------------------------ stat strip */

.ms-stat { display: flex; flex-direction: column; gap: 2px; }
.ms-stat__label {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--muted);
}
.ms-stat__value {
  font-family: var(--serif); font-size: 1.9rem; font-weight: 700;
  line-height: 1.1; color: var(--panel-ink);
}
.ms-stat__meta { font-size: 0.78rem; color: var(--muted); }
.ms-stat__delta { font-weight: 700; }
.ms-stat__delta--good { color: var(--good); }
.ms-stat__delta--bad { color: var(--bad); }
.ms-stat__delta--up { color: var(--panel-ink); }
.ms-stat__delta--down { color: var(--panel-ink); }
.ms-stat__delta--flat { color: var(--muted); }

.ms-flag {
  display: inline-block; font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ember); border: 1px solid var(--ember);
  border-radius: 2px; padding: 0 5px; margin-left: 6px;
}

/* ----------------------------------------------------------- data tables */

.ms-datatable { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.ms-datatable th {
  text-align: left; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); font-weight: 700;
  border-bottom: 2px solid var(--rule); padding: 6px 8px;
}
.ms-datatable td {
  padding: 7px 8px; border-bottom: 1px solid var(--rule); color: var(--panel-ink);
}
.ms-datatable tr:last-child td { border-bottom: 0; }
.ms-datatable__num { text-align: right; font-variant-numeric: tabular-nums; }
.ms-datatable__strong { font-weight: 700; }
/* A wide table on a phone scrolls itself rather than the page. */
.ms-tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* ------------------------------------------------------------ story list */

.ms-storylist { list-style: none; margin: 0; padding: 0; }
.ms-storylist > li { padding: 12px 0; border-bottom: 1px solid var(--rule); }
.ms-storylist > li:last-child { border-bottom: 0; padding-bottom: 0; }

.ms-linkout { list-style: none; margin: 10px 0 0; padding: 0; }
.ms-linkout > li { padding: 5px 0; font-size: 0.9rem; }
.ms-linkout__publisher { color: var(--muted); font-size: 0.8rem; }

.ms-empty {
  text-align: center; color: var(--muted); padding: 28px 12px;
  border: 1px dashed var(--rule); border-radius: 3px;
}

/* ------------------------------------------------------------- form widths */

/* A native <select> sizes itself to its longest option, and a USDA origin
   district runs to sixty characters ("IMPERIAL, COACHELLA VALLEYS CA, CENTRAL
   AND WESTERN AZ, MEXICO CROSSINGS..."). Left alone that drags the whole page
   sideways on a phone -- 124px of horizontal scroll on a 375px viewport. The
   grid cell is the constraint, not the content. */
.ms-select, .ms-input { width: 100%; max-width: 100%; }
.ms-form { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.ms-form .ms-field { min-width: 0; flex: 1 1 220px; }

@media (max-width: 700px) {
  .ms-form .ms-field { flex-basis: 100%; }
}

@media (max-width: 700px) {
  .ms-chart { height: 260px; }
  .ms-chart--tall { height: 300px; }
  .ms-prose > p:first-of-type::first-letter { font-size: 2.6em; }
}
