/* ============================================================
   THE FORECOURT GAZETTE — design tokens
   Newspaper aesthetic per the brief. Palette: paper + ink + one
   accent (masthead red). Chart series use the dataviz skill's
   validated 8-hue categorical set, unchanged.
   ============================================================ */
:root {
  color-scheme: light;

  --paper: #f6f5ef;
  --surface: #fcfcfb;
  --ink: #1a1a1a;
  --ink-secondary: #54524c;
  --ink-muted: #8a8781;
  --hairline: #dedad0;
  --hairline-strong: #c3c2b7;
  --accent: #a5182e;
  --accent-ink: #fffdfb;

  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --series-4: #eda100;
  --series-5: #e87ba4;
  --series-6: #008300;
  --series-7: #4a3aa7;
  --series-8: #e34948;

  --good: #0ca30c;
  --warning: #fab219;
  --serious: #ec835a;
  --critical: #d03b3b;

  --font-serif: "Iowan Old Style", "Palatino Linotype", "URW Palladio L", "P052", Georgia, "Times New Roman", serif;
  --font-sans: -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;

  --nav-width: 6.5rem;
  --content-max: 74rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
}

h1:focus { outline: none; }

a { color: inherit; text-decoration: none; }

/* ---------- app shell ---------- */

.app-shell {
  display: flex;
  min-height: 100vh;
}

.paper-main {
  flex: 1;
  min-width: 0;
  max-width: calc(100% - var(--nav-width));
}

.paper-inner {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.75rem 1.75rem 4rem;
}

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

.masthead {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 1.5rem 1.75rem 0;
}

.masthead-wordmark {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2.6rem;
  letter-spacing: 0.01em;
  margin: 0;
  line-height: 1;
}

.masthead-strap {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--ink-secondary);
  font-size: 0.95rem;
  margin: 0.15rem 0 0;
}

.masthead-rule {
  border: 0;
  border-top: 3px solid var(--ink);
  margin: 0.9rem 0 0;
}

.masthead-rule-thin {
  border: 0;
  border-top: 1px solid var(--ink);
  margin: 3px 0 0;
}

.masthead-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0 1rem;
  font-size: 0.82rem;
  color: var(--ink-secondary);
  flex-wrap: wrap;
}

.masthead-meta .dateline {
  font-variant-numeric: tabular-nums;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  animation: pulse 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- wire ticker ---------- */

.wire {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 1.75rem 0.75rem;
}

.wire-strip {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-top: 1px solid var(--hairline-strong);
  border-bottom: 1px solid var(--hairline-strong);
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  font-size: 0.85rem;
}

.wire-label {
  font-family: var(--font-serif);
  font-variant: small-caps;
  font-weight: 700;
  color: var(--accent);
  flex-shrink: 0;
  letter-spacing: 0.02em;
}

.wire-headline {
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.wire-empty { color: var(--ink-muted); font-style: italic; }

/* ---------- nav rail ---------- */

.nav-rail {
  width: var(--nav-width);
  flex-shrink: 0;
  background: var(--ink);
  color: var(--paper);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 1.1rem 0 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
}

.nav-rail-mark {
  font-family: var(--font-serif);
  font-weight: 700;
  text-align: center;
  font-size: 1.6rem;
  color: var(--paper);
  margin-bottom: 1rem;
  line-height: 1;
}

.nav-rail-mark span {
  display: block;
  font-size: 0.6rem;
  font-variant: small-caps;
  color: #b8b6ac;
  margin-top: 0.2rem;
  letter-spacing: 0.03em;
}

.nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.nav-list a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 0.65rem 0.25rem;
  color: #cfcdc3;
  font-size: 0.68rem;
  text-align: center;
  border-left: 3px solid transparent;
  line-height: 1.15;
}

.nav-list a svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-list a:hover {
  color: var(--paper);
  background: rgba(255, 255, 255, 0.06);
}

.nav-list a.active {
  color: var(--paper);
  border-left-color: var(--accent);
  background: rgba(165, 24, 46, 0.18);
  font-weight: 600;
}

/* ---------- section header ---------- */

.section-kicker {
  font-family: var(--font-serif);
  font-variant: small-caps;
  color: var(--accent);
  font-size: 1rem;
  letter-spacing: 0.02em;
  margin: 0 0 0.15rem;
}

.section-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 2rem;
  margin: 0 0 0.3rem;
}

.section-dek {
  color: var(--ink-secondary);
  max-width: 46rem;
  margin: 0 0 1.5rem;
  font-size: 1rem;
}

.section-rule {
  border: 0;
  border-top: 1px solid var(--hairline-strong);
  margin: 0 0 1.5rem;
}

/* ---------- KPI stat tiles ---------- */

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr));
  gap: 1px;
  background: var(--hairline);
  border: 1px solid var(--hairline);
  margin-bottom: 2rem;
}

.stat-tile {
  background: var(--surface);
  padding: 1rem 1.1rem;
}

.stat-tile .stat-value {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.9rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.stat-tile .stat-label {
  color: var(--ink-secondary);
  font-size: 0.78rem;
  margin-top: 0.2rem;
}

.stat-tile.accent .stat-value { color: var(--accent); }

/* ---------- chart panels ---------- */

.panel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.5rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--hairline-strong);
  padding: 1.1rem 1.25rem 1.3rem;
}

.panel-title {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  margin: 0 0 0.15rem;
}

.panel-caption {
  color: var(--ink-muted);
  font-size: 0.78rem;
  margin: 0 0 0.9rem;
}

/* ---------- bar chart ---------- */

.bar-chart { display: flex; flex-direction: column; gap: 0.55rem; }

.bar-row {
  display: grid;
  grid-template-columns: 7.5rem 1fr 3.6rem;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.82rem;
}

.bar-row .bar-name {
  color: var(--ink-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  background: var(--paper);
  border: 1px solid var(--hairline);
  height: 0.85rem;
  position: relative;
}

.bar-fill {
  height: 100%;
  border-radius: 0 3px 3px 0;
  min-width: 3px;
}

.bar-row .bar-value {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

/* ---------- trend chart (SVG) ---------- */

.trend-chart { width: 100%; height: auto; }
.trend-chart .trend-line { fill: none; stroke: var(--series-1); stroke-width: 2; }
.trend-chart .trend-area { fill: var(--series-1); opacity: 0.08; }
.trend-chart .trend-dot { fill: var(--series-1); }
.trend-chart .trend-axis { stroke: var(--hairline-strong); stroke-width: 1; }
.trend-chart .trend-grid { stroke: var(--hairline); stroke-width: 1; }
.trend-chart text { fill: var(--ink-muted); font-family: var(--font-sans); font-size: 10px; }
.trend-chart .trend-label { fill: var(--ink); font-weight: 600; font-size: 11px; }

.trend-axis-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--ink-muted);
  padding: 0.15rem 0.2rem 0;
}

/* ---------- status badge ---------- */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.15rem 0.55rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  font-size: 0.75rem;
  white-space: nowrap;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

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

.gazette-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.gazette-table caption {
  text-align: left;
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.6rem;
}

.gazette-table th {
  text-align: left;
  font-size: 0.72rem;
  color: var(--ink-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 2px solid var(--ink);
  padding: 0.5rem 0.7rem;
}

.gazette-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

.gazette-table tbody tr:hover { background: rgba(165, 24, 46, 0.04); }

.num { font-variant-numeric: tabular-nums; text-align: right; }

/* ---------- empty state ---------- */

.empty-state {
  border: 1px dashed var(--hairline-strong);
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-muted);
  font-style: italic;
}

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  .nav-rail { --nav-width: 4.4rem; }
  .nav-list a { font-size: 0; padding: 0.6rem 0; }
  .nav-list a svg { width: 20px; height: 20px; }
  .nav-rail-mark { font-size: 1.1rem; }
  .nav-rail-mark span { display: none; }
  .masthead-wordmark { font-size: 1.8rem; }
  .bar-row { grid-template-columns: 5rem 1fr 3rem; }
}

/* ---------- focus visibility ---------- */

a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- blazor scaffolding (kept) ---------- */

.valid.modified:not([type=checkbox]) { outline: 1px solid #26b050; }
.invalid { outline: 1px solid #e50000; }
.validation-message { color: #e50000; }

#blazor-error-ui {
  display: none;
  background: #f6d7a9;
  color: #1a1a1a;
  bottom: 0;
  box-shadow: 0 -1px 2px rgba(0,0,0,.2);
  left: 0;
  padding: 0.8rem 1.25rem;
  position: fixed;
  width: 100%;
  z-index: 1000;
  font-family: var(--font-sans);
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

.blazor-error-boundary {
  background: #b32121;
  padding: 1rem 1.25rem;
  color: white;
}
.blazor-error-boundary::after { content: "An error has occurred."; }
