/* Vizbl Gitflow — minimalist, Linear/Vercel-leaning. Light + dark via media query. */

:root {
  --bg: #fbfbfa;
  --surface: #ffffff;
  --surface-2: #f6f7f9;
  --text: #14151a;
  --muted: #6b7280;
  --faint: #9aa1ab;
  --border: #ececec;
  --border-strong: #e2e2e2;
  --accent: #2563eb;
  --shadow: 0 1px 2px rgba(17, 18, 22, 0.04), 0 8px 24px rgba(17, 18, 22, 0.05);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  --synced: #16a34a;
  --drift: #d97706;
  --failing: #dc2626;
  --unknown: #cbd0d6;

  --synced-soft: #e9f6ee;
  --drift-soft: #fdf2e3;
  --failing-soft: #fcebec;
  --unknown-soft: #eef0f2;

  --radius: 14px;
  --radius-sm: 9px;
  --maxw: 920px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0c0e;
    --surface: #131417;
    --surface-2: #1a1c20;
    --text: #f1f2f4;
    --muted: #9aa1ab;
    --faint: #6b7280;
    --border: #232529;
    --border-strong: #2c2f34;
    --accent: #6ea0ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);

    --synced: #2ea043;
    --drift: #d29922;
    --failing: #f25555;
    --unknown: #2f333a;

    --synced-soft: #112116;
    --drift-soft: #241c0d;
    --failing-soft: #2a1416;
    --unknown-soft: #1a1c20;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.page { max-width: var(--maxw); margin: 0 auto; padding: 48px 20px 64px; }

/* ---- masthead ---- */
.masthead {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand__mark {
  width: 12px; height: 12px; border-radius: 4px;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  align-self: center;
}
.brand__name { font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand__sub { color: var(--muted); font-weight: 500; }
.updated { color: var(--faint); font-size: 13px; }

/* ---- banner ---- */
.banner {
  display: flex; align-items: center; gap: 16px;
  padding: 20px 22px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface);
  box-shadow: var(--shadow); margin-bottom: 32px;
}
.banner__icon { width: 14px; height: 14px; border-radius: 50%; flex: none; }
.banner__title { margin: 0; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
.banner__sub { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.banner--synced  { background: var(--synced-soft); border-color: transparent; }
.banner--synced  .banner__icon { background: var(--synced); }
.banner--drift   { background: var(--drift-soft); border-color: transparent; }
.banner--drift   .banner__icon { background: var(--drift); }
.banner--failing { background: var(--failing-soft); border-color: transparent; }
.banner--failing .banner__icon { background: var(--failing); }
.banner--unknown .banner__icon { background: var(--unknown); }

/* ---- groups ---- */
.group { margin-bottom: 30px; }
.group__head { display: flex; align-items: center; margin: 0 4px 10px; }
.group__name {
  font-size: 12px; font-weight: 650; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--muted);
}
.group__card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}

/* ---- project ---- */
.project { padding: 18px 20px; border-top: 1px solid var(--border); }
.project:first-child { border-top: none; }
.project__head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.project__id { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.project__name { font-weight: 600; font-size: 15.5px; color: var(--text); }
.project__name:hover { color: var(--accent); }
.project__desc { color: var(--faint); font-size: 12.5px; font-family: var(--mono); }
.project__tags { display: flex; align-items: center; gap: 8px; flex: none; }

/* health pill */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  background: var(--surface-2); color: var(--muted);
}
.pill__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--unknown); }
.pill[data-state="synced"]  { background: var(--synced-soft); color: var(--synced); }
.pill[data-state="synced"]  .pill__dot { background: var(--synced); }
.pill[data-state="drift"]   { background: var(--drift-soft); color: var(--drift); }
.pill[data-state="drift"]   .pill__dot { background: var(--drift); }
.pill[data-state="failing"] { background: var(--failing-soft); color: var(--failing); }
.pill[data-state="failing"] .pill__dot { background: var(--failing); }

/* test badge */
.test-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  font-family: var(--mono); background: var(--surface-2); color: var(--muted);
}
.test-badge[data-state="success"] { background: var(--synced-soft); color: var(--synced); }
.test-badge[data-state="failed"]  { background: var(--failing-soft); color: var(--failing); }
.test-badge[data-state="running"] { background: var(--drift-soft); color: var(--drift); }
.test-badge__link { font-size: 11.5px; font-weight: 600; opacity: 0.85; }

/* ---- flow (env chain) ---- */
.flow {
  display: flex; align-items: stretch; flex-wrap: wrap; gap: 10px;
}
.env {
  flex: 1 1 150px; min-width: 140px;
  display: flex; flex-direction: column; gap: 3px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border);
}
.env__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.env__name { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; color: var(--text); }
.env__branch { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.env__sha { font-family: var(--mono); font-size: 14px; font-weight: 600; color: var(--accent); }
.env__sha--none { color: var(--faint); font-weight: 500; font-size: 12px; }
.env__since { font-size: 11.5px; color: var(--faint); }
.env[data-health="unknown"] { border-style: dashed; opacity: 0.85; }

/* ---- gap connector ---- */
.gap {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  flex: 0 0 auto; align-self: stretch;
}
.gap__badge {
  display: inline-flex; align-items: center; gap: 6px; height: 100%;
  padding: 6px 12px; border: none; border-radius: var(--radius-sm);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer;
  background: transparent; color: var(--muted); white-space: nowrap;
}
.gap__arrow { font-size: 15px; opacity: 0.6; }
.gap[data-state="synced"] .gap__badge { color: var(--synced); cursor: default; }
.gap[data-state="drift"]  .gap__badge {
  background: var(--drift-soft); color: var(--drift);
}
.gap[data-state="drift"]  .gap__badge:hover { filter: brightness(0.97); text-decoration: none; }
.gap[data-state="unknown"] .gap__badge { color: var(--faint); cursor: default; }
.gap__badge:disabled { cursor: default; }
/* When expanded the row grows; keep the badge compact instead of stretching. */
.gap[data-open="true"] .gap__badge { height: auto; align-self: center; }

/* expandable commit list — breaks the row onto a full-width panel */
.gap__commits {
  flex-basis: 100%; width: 100%; margin-top: 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); padding: 6px;
  max-height: 320px; overflow-y: auto;
}
.gap[data-open="true"] { flex-basis: 100%; width: 100%; }

.commit {
  display: flex; align-items: baseline; gap: 10px;
  padding: 5px 8px; border-radius: 6px; font-size: 13px;
}
.commit:hover { background: var(--surface-2); }
.commit--merge { opacity: 0.75; }
.commit__sha { font-family: var(--mono); font-size: 12px; color: var(--accent); flex: none; }
.commit__title {
  color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1;
}
.commit__mr { font-family: var(--mono); font-size: 12px; color: var(--muted); flex: none; }
.commit--more { color: var(--faint); font-style: italic; padding: 6px 8px; }

/* ---- footer / legend ---- */
.error {
  text-align: center; color: var(--failing); font-size: 14px;
  background: var(--failing-soft); padding: 10px; border-radius: var(--radius-sm);
}
.footer { margin-top: 36px; text-align: center; }
.legend {
  display: flex; flex-wrap: wrap; gap: 14px; justify-content: center;
  margin-bottom: 14px;
}
.legend__item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.legend__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--unknown); }
.legend__swatch[data-state="synced"]  { background: var(--synced); }
.legend__swatch[data-state="drift"]   { background: var(--drift); }
.legend__swatch[data-state="failing"] { background: var(--failing); }
.footer__line { margin: 4px 0; font-size: 13px; color: var(--muted); }
.footer__muted { color: var(--faint); }

@media (max-width: 560px) {
  .flow { flex-direction: column; align-items: stretch; }
  .gap { flex-direction: row; align-self: auto; }
  .gap__badge { height: auto; width: 100%; justify-content: center; }
  .env { min-width: 0; }
}
