/* ============================================================
   REDBOARD — HoosAI ✕ BNSF Railway
   safety incident intake + FRA reportability console
   ink + glass, Barlow Condensed / Inter / Fraunces italic / JetBrains Mono
   ============================================================ */

:root {
  --ink: #06070A;
  --ink-2: #0B0D12;
  --text: #E9ECF2;
  --muted: rgba(233, 236, 242, 0.56);
  --faint: rgba(233, 236, 242, 0.32);
  --line: rgba(233, 236, 242, 0.10);
  --glass: rgba(255, 255, 255, 0.035);
  --glass-2: rgba(255, 255, 255, 0.06);
  --accent: #F35D0A;
  --accent-soft: rgba(243, 93, 10, 0.16);
  --ok: #3DDC84;
  --ok-soft: rgba(61, 220, 132, 0.14);
  --warn: #F2C94C;
  --warn-soft: rgba(242, 201, 76, 0.14);
  --blue: #4D8DEE;
  --blue-soft: rgba(77, 141, 238, 0.14);
  --disp: "Barlow Condensed", sans-serif;
  --body: "Inter", sans-serif;
  --serif: "Fraunces", serif;
  --mono: "JetBrains Mono", monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
/* the hidden attribute must always win, even over classes that set their own display */
[hidden]{ display:none !important; }


html { scroll-behavior: smooth; }
html, body { overflow-x: hidden; }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
}

.wrap { width: min(1280px, calc(100% - 48px)); margin: 0 auto; }

em { font-family: var(--serif); font-style: italic; font-weight: 400; }

h1, h2, h3 { font-family: var(--disp); text-transform: uppercase; letter-spacing: 0.01em; line-height: 1.02; font-weight: 700; }

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

::selection { background: var(--accent); color: #fff; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--disp);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 12px 26px;
  border: 1px solid var(--line);
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: var(--text);
  transition: transform 0.25s ease, background 0.25s ease, border-color 0.25s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: #ff6f1f; }
.btn-ghost { background: var(--glass); backdrop-filter: blur(8px); }
.btn-ghost:hover { background: var(--glass-2); border-color: rgba(233,236,242,0.25); }

/* ---------- pulse dot ---------- */
.pulse {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243,93,10,0.5); }
  50% { box-shadow: 0 0 0 6px rgba(243,93,10,0); }
}

/* ---------- badges (shared) ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--disp);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 11px;
  padding: 5px 11px;
  border-radius: 100px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.status-reportable, .verdict-reportable { background: var(--accent); color: #fff; }
.status-not-reportable, .verdict-not-reportable { background: var(--ok-soft); color: var(--ok); border-color: rgba(61,220,132,0.3); }
.status-review, .verdict-review { background: var(--warn-soft); color: var(--warn); border-color: rgba(242,201,76,0.32); }
.status-capa { background: var(--blue-soft); color: var(--blue); border-color: rgba(77,141,238,0.32); }
.type-badge { background: var(--glass-2); color: var(--text); border-color: var(--line); font-size: 10.5px; }
.risk-flag { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(243,93,10,0.4); }
.trend-flag { background: var(--accent-soft); color: var(--accent); border: 1px solid rgba(243,93,10,0.4); font-size: 10px; }

/* ---------- logo badge ---------- */
.brand-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; }
.brand-badge img { display: block; height: 20px; width: auto; }

/* ============================================================
   HEADER
   ============================================================ */
.site-head {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(6, 7, 10, 0.82);
  backdrop-filter: blur(14px) saturate(150%);
  border-bottom: 1px solid var(--line);
}
.head-row {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  flex-wrap: wrap;
}
.lockup {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: 0.12em;
  display: flex;
  align-items: center;
  gap: 9px;
}
.lockup-x { color: var(--accent); font-size: 13px; }
.head-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}
.head-tag {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  color: var(--muted);
}
.head-clock {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  color: var(--faint);
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

/* ============================================================
   CONSOLE HERO
   ============================================================ */
.console-hero { padding: 118px 0 44px; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.26em;
  color: var(--accent);
}
.hero-h1 {
  margin-top: 14px;
  font-size: clamp(48px, 8vw, 88px);
}
.hero-sub {
  margin-top: 16px;
  max-width: 700px;
  font-size: 16.5px;
  color: var(--muted);
}
.hero-sub em { color: var(--text); }

.stat-row {
  margin-top: 44px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--line);
}
.stat { padding: 22px 20px 4px 0; border-right: 1px solid var(--line); }
.stat:first-child { padding-left: 0; }
.stat:not(:first-child) { padding-left: 20px; }
.stat:last-child { border-right: none; }
.stat b {
  display: block;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  color: var(--text);
}
.stat span { display: block; margin-top: 8px; font-size: 12.5px; color: var(--muted); }

/* ============================================================
   DASHBOARD SHELL
   ============================================================ */
.board-wrap { padding: 20px 0 90px; }
.grid-shell {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 24px;
  align-items: start;
}
.col-main, .col-side { min-width: 0; }

/* ---------- panels ---------- */
.panel {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: clamp(20px, 3vw, 30px);
  margin-bottom: 24px;
  backdrop-filter: blur(14px) saturate(150%);
}
.panel:last-child { margin-bottom: 0; }
.panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 22px;
}
.panel-head h2 { font-size: 21px; letter-spacing: 0.02em; }
.panel-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
  white-space: nowrap;
}
.panel-footnote {
  margin-top: 18px;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.6;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

/* ============================================================
   INTAKE FORM
   ============================================================ */
.form-row { display: grid; gap: 16px; margin-bottom: 16px; }
.form-row-3 { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field > span {
  font-family: var(--disp);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  font-size: 11.5px;
  color: var(--muted);
}
.field > span em { font-family: var(--body); font-style: normal; text-transform: none; letter-spacing: 0; color: var(--faint); font-size: 11px; }
.field select, .field input, .field textarea {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 13px;
  color: var(--text);
  font-family: var(--body);
  font-size: 14.5px;
  width: 100%;
}
.field textarea { resize: vertical; min-height: 44px; font-family: var(--body); }
.field select:focus, .field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field select:invalid { color: var(--faint); }
.field input::placeholder, .field textarea::placeholder { color: var(--faint); }

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

/* ============================================================
   DETERMINATION PANEL
   ============================================================ */
.determination-placeholder { color: var(--faint); font-size: 14.5px; line-height: 1.7; }
.determination-card { animation: fadeUp 0.4s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
.determination-top {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.determination-id {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--muted);
  letter-spacing: 0.03em;
}
.determination-text {
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
  min-height: 1.75em;
}
.determination-text .cursor { display: inline-block; width: 2px; height: 1em; background: var(--accent); vertical-align: -2px; animation: blink 0.9s step-end infinite; margin-left: 1px; }
@keyframes blink { 50% { opacity: 0; } }
.determination-citation {
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(243,93,10,0.3);
  border-radius: 6px;
  padding: 10px 14px;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.determination-citation.on { opacity: 1; }
.determination-disclaimer {
  margin-top: 16px;
  font-size: 12px;
  color: var(--faint);
  line-height: 1.6;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.determination-disclaimer.on { opacity: 1; }

/* ============================================================
   BOARD FILTERS
   ============================================================ */
.board-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.filter-field { display: flex; flex-direction: column; gap: 6px; flex: 1 1 160px; min-width: 140px; }
.filter-field span {
  font-family: var(--disp);
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 10.5px;
  color: var(--faint);
}
.filter-field select {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 11px;
  color: var(--text);
  font-family: var(--body);
  font-size: 13.5px;
  width: 100%;
}
.filter-field select:focus { outline: none; border-color: var(--accent); }

/* ============================================================
   INCIDENT LIST
   ============================================================ */
.incident-list { display: flex; flex-direction: column; }
.incident-empty { padding: 30px 0; color: var(--faint); font-size: 14px; text-align: center; }

.incident-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}
.incident-row:last-child { border-bottom: none; }

.incident-core {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  flex: 1 1 300px;
}
.incident-id { font-family: var(--mono); font-size: 12px; color: var(--faint); }
.incident-sub { font-size: 13.5px; color: var(--text); }
.incident-time { font-family: var(--mono); font-size: 11.5px; color: var(--faint); }

.incident-detail {
  flex: 1 1 240px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 12.5px;
  color: var(--muted);
}
.incident-detail .sev-none, .incident-detail .sev-minor { color: var(--muted); }
.incident-detail .sev-moderate { color: var(--warn); }
.incident-detail .sev-severe, .incident-detail .sev-catastrophic { color: var(--accent); font-weight: 600; }

.incident-status { flex: 0 0 auto; }

.incident-actions { display: flex; gap: 8px; flex-wrap: wrap; flex: 0 0 auto; margin-left: auto; }
.btn-mini {
  font-family: var(--disp);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 13px;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--glass-2);
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
  white-space: nowrap;
}
.btn-mini:hover { background: rgba(255,255,255,0.1); border-color: rgba(233,236,242,0.3); }
.btn-mini.capa-btn { border-color: var(--accent-soft); color: var(--accent); }
.btn-mini.capa-btn:hover { background: rgba(243,93,10,0.14); }
.btn-mini:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-mini:disabled:hover { background: var(--glass-2); border-color: var(--line); }

.capa-note { font-family: var(--mono); font-size: 11px; color: var(--blue); }

/* ============================================================
   TREND PANEL
   ============================================================ */
.trend-item { padding: 14px 0; border-bottom: 1px solid var(--line); }
.trend-item:last-child { border-bottom: none; padding-bottom: 0; }
.trend-item:first-child { padding-top: 0; }
.trend-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.trend-label { font-size: 13px; color: var(--text); line-height: 1.4; }
.trend-row { display: flex; align-items: flex-end; gap: 14px; }
.sparkline { display: flex; align-items: flex-end; gap: 3px; height: 32px; flex: none; }
.sparkline span { width: 8px; background: var(--glass-2); border-radius: 2px 2px 0 0; }
.sparkline span.up { background: var(--accent); }
.trend-count { font-family: var(--mono); font-size: 13px; color: var(--muted); white-space: nowrap; }
.trend-count small { display: block; font-size: 10px; color: var(--faint); margin-top: 2px; letter-spacing: 0.06em; text-transform: uppercase; }

/* ============================================================
   CROSSING RISK PANEL
   ============================================================ */
.crossing-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}
.crossing-item:last-child { border-bottom: none; padding-bottom: 0; }
.crossing-item:first-child { padding-top: 0; }
.crossing-rank {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--faint);
  flex: none;
  width: 20px;
}
.crossing-item.high-risk .crossing-rank { color: var(--accent); }
.crossing-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.crossing-name { font-size: 13px; color: var(--text); }
.crossing-sub { font-size: 11.5px; color: var(--faint); }
.crossing-score { display: flex; align-items: center; gap: 8px; flex: 0 0 90px; }
.score-bar { flex: 1; height: 5px; background: var(--glass-2); border-radius: 100px; overflow: hidden; }
.score-bar i { display: block; height: 100%; background: var(--faint); border-radius: 100px; }
.crossing-item.high-risk .score-bar i { background: var(--accent); }
.score-num { font-family: var(--mono); font-size: 12px; color: var(--muted); min-width: 26px; text-align: right; }
.crossing-item.high-risk .score-num { color: var(--accent); }

/* ============================================================
   TOASTS
   ============================================================ */
.toast-stack {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  width: min(360px, calc(100% - 40px));
}
.toast {
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 18px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  box-shadow: 0 16px 40px rgba(0,0,0,0.45);
  backdrop-filter: blur(14px) saturate(150%);
  animation: toastIn 0.35s ease;
}
.toast.out { animation: toastOut 0.3s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   FOOTER
   ============================================================ */
.site-foot { border-top: 1px solid var(--line); padding: 40px 0 56px; }
.foot-lockup {
  font-family: var(--disp);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.foot-lockup span { color: var(--accent); }
.site-foot p { margin-top: 14px; max-width: 780px; font-size: 12px; color: var(--faint); line-height: 1.7; }

/* ============================================================
   MOBILE — no horizontal scroll anywhere; everything stacks
   ============================================================ */
@media (max-width: 960px) {
  .grid-shell { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .head-row { gap: 10px; }
  .lockup { font-size: 15px; gap: 6px; }
  .head-meta { gap: 10px; margin-left: auto; }
  .head-tag span, .head-tag { font-size: 9.5px; letter-spacing: 0.14em; }
  .head-clock { font-size: 10.5px; padding-left: 10px; }
  .console-hero { padding: 108px 0 32px; }
  .stat-row { grid-template-columns: 1fr 1fr; }
  .stat { border-right: none; border-bottom: 1px solid var(--line); padding: 18px 0 14px; }
  .stat:nth-child(odd) { border-right: 1px solid var(--line); padding-right: 16px; }
  .stat:nth-child(even) { padding-left: 16px; }
  .stat:nth-child(3), .stat:nth-child(4) { border-bottom: none; }
  .form-row-3 { grid-template-columns: 1fr; }
  .form-actions { flex-direction: column-reverse; }
  .form-actions .btn { width: 100%; }
  .board-filters { flex-direction: column; }
  .filter-field { flex: 1 1 auto; }
  .incident-row { flex-direction: column; align-items: flex-start; }
  .incident-actions { margin-left: 0; width: 100%; }
  .incident-actions .btn-mini { flex: 1 1 auto; }
  .incident-status { order: -1; }
  .trend-row { flex-wrap: wrap; }
  .crossing-score { flex-basis: 70px; }
  .toast-stack { right: 12px; bottom: 12px; left: 12px; width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pulse { animation: none; }
  .determination-text .cursor { animation: none; }
}
