*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:     #0c0d0c;
  --panel:  #141614;
  --panel2: #191b18;
  --fg:     #e8e6df;
  --muted:  #8a8a82;
  --dim:    #56564f;
  --line:   #2a2c28;
  --green:  #7bb37a;
  --red:    #c87065;
  --accent: #d6a14a;
}

html, body {
  background: var(--bg);
  color: var(--fg);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  min-height: 100vh;
}

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

@keyframes kadi-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0; }
}

@keyframes kadi-pulse {
  0%, 100% { transform: scale(1);    opacity: 1;   }
  50%      { transform: scale(1.35); opacity: 0.7; }
}

@keyframes kadi-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ── App shell ─────────────────────────────────────────────────────────────── */

#app {
  min-height: 100vh;
  width: 100%;
  padding: 32px clamp(20px, 4vw, 56px);
  display: flex;
  flex-direction: column;
  gap: 22px;
}

/* ── Utility ───────────────────────────────────────────────────────────────── */

.dim    { color: var(--dim); }
.accent { color: var(--accent); }

/* ── Top bar ───────────────────────────────────────────────────────────────── */

.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  font-size: 11px;
  letter-spacing: 0.05em;
  color: var(--muted);
  flex-wrap: wrap;
  row-gap: 8px;
}

.top-bar-left {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}

.kadi-badge {
  color: var(--bg);
  background: var(--accent);
  padding: 2px 8px;
  font-size: 10px;
  letter-spacing: 0.08em;
  font-weight: 700;
}

.clock {
  font-variant-numeric: tabular-nums;
}

/* ── Hero ──────────────────────────────────────────────────────────────────── */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(24px, 5vw, 80px);
  padding: 12px 0 8px;
  align-items: center;
}

.hero-wordmark h1 {
  font-size: clamp(72px, 13vw, 168px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.06em;
  white-space: nowrap;
}

.cursor {
  display: inline-block;
  width: 0.14em;
  height: 0.78em;
  background: var(--accent);
  margin-left: 0.18em;
  vertical-align: -0.04em;
  animation: kadi-blink 1.1s steps(2) infinite;
}

.hero-tagline {
  margin-top: 18px;
  font-size: 13px;
  color: var(--muted);
  letter-spacing: 0.04em;
}

.hero-desc {
  font-size: clamp(15px, 1.3vw, 17px);
  line-height: 1.65;
  color: var(--fg);
  font-weight: 400;
  border-left: 2px solid var(--accent);
  padding-left: 20px;
}

.hero-desc-muted {
  display: block;
  margin-top: 14px;
  color: var(--muted);
}

/* ── Section label ─────────────────────────────────────────────────────────── */

.section-label {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  padding-top: 4px;
}

.section-divider {
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ── Status board ──────────────────────────────────────────────────────────── */

.status-board {
  border: 1px solid var(--line);
  background: var(--panel);
}

.status-header,
.status-row {
  display: grid;
  grid-template-columns: 64px minmax(0, 1.6fr) 130px 130px 120px;
  padding: 11px 22px;
}

.status-header {
  border-bottom: 1px solid var(--line);
  font-size: 10px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
}

.status-row {
  padding: 14px 22px;
  align-items: start;
  font-size: 13px;
  cursor: pointer;
  transition: background 120ms;
  /* always-present border avoids layout shift on selection */
  border-left: 2px solid transparent;
  margin-left: -2px;
  border-bottom: 1px solid var(--line);
}

.status-row:last-child { border-bottom: none; }

.status-row:hover,
.status-row.selected {
  background: rgba(214, 161, 74, 0.06);
}

.status-row.selected {
  border-left-color: var(--accent);
}

.thread-id {
  color: var(--muted);
  padding-top: 1px;
}

.status-row.selected .thread-id {
  color: var(--accent);
}

.thread-note {
  font-size: 11px;
  margin-top: 4px;
  margin-left: 18px;
  color: var(--muted);
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  transition: opacity 160ms, max-height 200ms;
}

.status-row.selected .thread-note {
  opacity: 1;
  max-height: 40px;
}

.thread-phase { color: var(--muted); }

.status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.pulse-dot.live {
  animation: kadi-pulse 2.2s ease-in-out infinite;
}

.thread-updated {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ── Process strip ─────────────────────────────────────────────────────────── */

.process-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border: 1px solid var(--line);
  margin-top: 4px;
}

.process-step {
  padding: 20px 22px;
  background: var(--panel2);
  border-right: 1px solid var(--line);
}

.process-step:last-child { border-right: none; }

.process-num {
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.process-title {
  font-size: 15px;
  margin-bottom: 6px;
  font-weight: 500;
}

.process-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

/* ── Footer ────────────────────────────────────────────────────────────────── */

.site-footer {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  font-size: 12px;
  color: var(--muted);
  flex-wrap: wrap;
  row-gap: 12px;
}

.site-footer a {
  color: var(--fg);
  text-decoration: none;
  border-bottom: 1px solid var(--accent);
  padding-bottom: 2px;
}

.site-footer a:hover { color: var(--accent); }

.footer-hints {
  color: var(--dim);
  font-size: 11px;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  align-items: center;
}

.footer-hints span { white-space: nowrap; }

kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--muted);
  font-size: 10px;
  margin: 0 2px;
  font-family: inherit;
}

.members-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 11px;
  padding: 0 0 2px;
  border-bottom: 1px dashed var(--dim);
}

/* ── Partners overlay ──────────────────────────────────────────────────────── */

.partners-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 9, 8, 0.86);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  /* hidden by default via JS; animation plays on open */
}

.partners-overlay.open {
  animation: kadi-fade 180ms ease-out;
}

.partners-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  width: min(640px, 100%);
  font-family: 'JetBrains Mono', monospace;
}

.partners-header {
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.partners-close {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--muted);
  padding: 2px 8px;
  font-size: 10px;
  cursor: pointer;
  font-family: inherit;
  letter-spacing: 0.12em;
}

.partners-close:hover {
  border-color: var(--muted);
  color: var(--fg);
}

.partners-body { padding: 8px 0; }

.member-row {
  padding: 18px 22px;
  display: grid;
  grid-template-columns: 32px 1fr 120px;
  gap: 16px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.member-row:last-child { border-bottom: none; }

.member-index { font-size: 11px; }

.member-info {
  display: flex;
  align-items: center;
  gap: 14px;
}

.member-avatar {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--panel2);
  flex-shrink: 0;
}

.member-role   { color: var(--fg); font-size: 14px; }
.member-handle { color: var(--dim); font-size: 11px; margin-top: 2px; }

.member-joined { color: var(--muted); font-size: 11px; }

.member-label {
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

/* ── Responsive ────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .status-header,
  .status-row {
    grid-template-columns: 48px minmax(0, 1fr) 90px 90px;
  }

  /* Hide updated column on small screens */
  .status-header > *:last-child,
  .status-row > *:last-child {
    display: none;
  }

  .process-strip {
    grid-template-columns: 1fr;
  }

  .process-step {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .process-step:last-child { border-bottom: none; }

  .member-row {
    grid-template-columns: 24px 1fr;
    row-gap: 8px;
  }

  .member-joined { display: none; }
}
