/* ============================================================
   Be Civic — BMD Dashboard — style.css
   Brand: Manrope + tricolour palette, light/dark modes.
   ============================================================ */

/* ---- Tokens ---- */
:root {
  --brand-gold: #fae042;
  --brand-red:  #ed2939;

  --bg:          #ffffff;
  --bg-soft:     #f7f5ee;
  --bg-card:     #ffffff;
  --ink:         #1a1a18;
  --body:        #2a2a26;
  --mute:        #6a6a65;
  --line:        #ebe9e3;

  /* Status colors */
  --status-active:       #16a34a;
  --status-active-bg:    #f0fdf4;
  --status-refined:      #2563eb;
  --status-refined-bg:   #eff6ff;
  --status-invalidated:  #dc2626;
  --status-invalidated-bg: #fef2f2;
  --status-superseded:   #9ca3af;
  --status-superseded-bg: #f9fafb;
  --status-unknown:      #6b7280;
  --status-unknown-bg:   #f3f4f6;

  --sans-display: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --sans-body:    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono:         ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --shell-max: none;
  --shell-pad: 32px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:       #0a0a0a;
    --bg-soft:  #141412;
    --bg-card:  #1c1c1a;
    --ink:      #f5f4ee;
    --body:     #d4d2cc;
    --mute:     #888884;
    --line:     #232321;

    --status-active-bg:       #052e16;
    --status-refined-bg:      #1e3a5f;
    --status-invalidated-bg:  #450a0a;
    --status-superseded-bg:   #1f2937;
    --status-unknown-bg:      #1f2937;
  }
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; }
body {
  font-family: var(--sans-body);
  background: var(--bg);
  color: var(--body);
  line-height: 1.5;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }

/* ---- Shell ---- */
.shell {
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: 0 var(--shell-pad);
}

/* ---- Wordmark ---- */
.wm {
  font-family: var(--sans-display);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--ink);
  font-size: 18px;
}
.wm .gb { color: var(--brand-gold); }
.wm .rd { color: var(--brand-red); }

/* ---- Nav ---- */
nav.top {
  border-bottom: 1px solid var(--line);
  padding: 16px 0;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}
nav.top .inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
.nav-title {
  font-family: var(--sans-display);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.nav-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-home {
  font-size: 12px;
  color: var(--mute);
  font-family: var(--mono);
}
.nav-home:hover { color: var(--ink); }
.nav-updated {
  font-size: 11px;
  color: var(--mute);
  font-family: var(--mono);
}

/* ---- Page header ---- */
.page-header {
  padding: 40px 0 32px;
  border-bottom: 1px solid var(--line);
}
.page-header h1 {
  font-family: var(--sans-display);
  font-weight: 800;
  font-size: clamp(28px, 4vw, 42px);
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1.1;
}

/* ---- Summary stats bar ---- */
.stats-bar {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  margin-top: 24px;
}
.stat {
  padding: 16px 28px 16px 0;
  margin-right: 28px;
  border-right: 1px solid var(--line);
}
.stat:last-child { border-right: none; margin-right: 0; }
.stat-value {
  font-family: var(--sans-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  display: block;
  line-height: 1;
}
.stat-label {
  font-size: 12px;
  color: var(--mute);
  margin-top: 4px;
  display: block;
}
.stat.gold .stat-value { color: var(--brand-gold); -webkit-text-stroke: 1px #b8960a; }
@media (prefers-color-scheme: dark) {
  .stat.gold .stat-value { -webkit-text-stroke: 0; color: var(--brand-gold); }
}

/* ---- Section ---- */
.section {
  padding: 40px 0 48px;
}
.section + .section {
  border-top: 1px solid var(--line);
}
.section-heading {
  font-family: var(--sans-display);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--mute);
  margin-bottom: 20px;
}

/* ---- BMC blocks grid ---- */
.blocks-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.block-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px 14px;
  position: relative;
  overflow: hidden;
}

/* Top colour bar by dominant status */
.block-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
}
.block-card.status-active::before    { background: var(--status-active); }
.block-card.status-refined::before   { background: var(--status-refined); }
.block-card.status-invalidated::before { background: var(--status-invalidated); }
.block-card.status-superseded::before { background: var(--status-superseded); }
.block-card.status-mixed::before     { background: var(--brand-gold); }

.block-name {
  font-family: var(--sans-display);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.005em;
  line-height: 1.3;
  margin-bottom: 10px;
}

.block-count {
  font-family: var(--sans-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 6px;
}

.status-dots {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}
.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
}
.status-dot.active      { background: var(--status-active-bg);      color: var(--status-active); }
.status-dot.refined     { background: var(--status-refined-bg);     color: var(--status-refined); }
.status-dot.invalidated { background: var(--status-invalidated-bg); color: var(--status-invalidated); }
.status-dot.superseded  { background: var(--status-superseded-bg);  color: var(--status-superseded); }

/* ---- Findings list ---- */
.findings-list {
  display: grid;
  gap: 10px;
}
.finding-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.finding-code {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  flex-shrink: 0;
  padding-top: 2px;
  width: 70px;
}
.finding-strength {
  flex-shrink: 0;
  padding-top: 1px;
}
.strength-badge {
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
}
.strength-badge.direct       { background: #ecfdf5; color: #065f46; }
.strength-badge.observed     { background: #eff6ff; color: #1e40af; }
.strength-badge.interpreted  { background: #fefce8; color: #854d0e; }
.strength-badge.weak         { background: var(--bg-soft); color: var(--mute); }
.strength-badge.speculative  { background: var(--bg-soft); color: var(--mute); }
@media (prefers-color-scheme: dark) {
  .strength-badge.direct       { background: #022c22; color: #6ee7b7; }
  .strength-badge.observed     { background: #1e3a5f; color: #93c5fd; }
  .strength-badge.interpreted  { background: #422006; color: #fde68a; }
}

.finding-statement {
  font-size: 13.5px;
  color: var(--body);
  line-height: 1.5;
}

/* ---- Sessions list ---- */
.sessions-list {
  display: grid;
  gap: 10px;
}
.session-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.session-code {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  color: var(--brand-gold);
  -webkit-text-stroke: 0.5px #b8960a;
  flex-shrink: 0;
  width: 60px;
}
@media (prefers-color-scheme: dark) {
  .session-code { -webkit-text-stroke: 0; }
}
.session-info { flex: 1; min-width: 0; }
.session-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.session-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  margin-top: 4px;
}

/* ---- Error / loading ---- */
.load-error {
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--mute);
  font-size: 13px;
  font-family: var(--mono);
}

/* ---- Footer ---- */
footer.foot {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  color: var(--mute);
  font-size: 12.5px;
}
.foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.foot-nav { font-family: var(--mono); font-size: 11.5px; }
.foot-nav a { color: var(--mute); margin-right: 16px; }
.foot-nav a:hover { color: var(--ink); }

/* ---- Responsive ---- */
@media (max-width: 960px) {
  .blocks-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 700px) {
  :root { --shell-pad: 20px; }
  .blocks-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-bar { gap: 8px; }
  .stat { padding: 10px 16px 10px 0; margin-right: 16px; }
}
@media (max-width: 480px) {
  .blocks-grid { grid-template-columns: 1fr 1fr; }
}
