/* WJ Case Study #1 — UI */

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

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --surface-2: #fafaf8;
  --ink: #0a0a0a;
  --ink-2: #1a1a1a;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --line: #e5e5e0;
  --line-2: #d4d4cf;
  --accent: #1a1a1a;
  --accent-ink: #ffffff;
  --ai: #6d28d9;
  --ai-bg: #f5f3ff;
  --ai-line: #ddd6fe;
  --stub: #f59e0b;
  --stub-bg: #fffbeb;
  --ok: #047857;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fef3c7;
  --running: #2563eb;
  --running-bg: #eff6ff;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

html, body { height: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); }
a:hover { text-decoration-color: var(--accent); }

/* Top bar */
.topbar {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 16px 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 36px; height: 36px;
  background: #fff;
  color: var(--accent);
  border-radius: 8px;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
}
.brand-title { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.brand-sub { font-size: 12px; color: rgba(255,255,255,0.7); }
.status-row { display: flex; gap: 10px; align-items: center; }

.pill {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 999px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.pill-muted { background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.85); }
.pill-ok { background: rgba(4,120,87,0.2); color: #6ee7b7; }
.pill-warn { background: rgba(180,83,9,0.2); color: #fcd34d; }
.pill-link { background: rgba(255,255,255,0.12); color: #fff; text-decoration: none; }
.pill-link:hover { background: rgba(255,255,255,0.18); }

/* Layout */
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 36px 80px;
}

.rail {
  position: sticky;
  top: 80px;
  align-self: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.rail-title {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
}
.pipeline {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.step {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  transition: background 120ms ease;
  align-items: center;
}
.step.is-bonus { opacity: 0.7; }
.step .step-num {
  width: 22px; height: 22px;
  display: grid; place-items: center;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.step .step-name { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.step .step-meta { font-size: 11px; color: var(--muted); }
.step .step-state { font-size: 11px; color: var(--muted-2); font-weight: 600; }

.bonus-tag {
  display: inline-block;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--ai-bg);
  color: var(--ai);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 6px;
  font-weight: 700;
  vertical-align: middle;
}

.step.is-running { background: var(--running-bg); }
.step.is-running .step-num { background: var(--running); color: #fff; border-color: var(--running); }
.step.is-running .step-state { color: var(--running); }

.step.is-done { background: var(--ok-bg); }
.step.is-done .step-num { background: var(--ok); color: #fff; border-color: var(--ok); }
.step.is-done .step-state { color: var(--ok); }
.step.is-done .step-num::before { content: "✓"; }
.step.is-done .step-num { font-size: 12px; }

.step.is-waiting { background: var(--warn-bg); }
.step.is-waiting .step-num { background: var(--warn); color: #fff; border-color: var(--warn); }
.step.is-waiting .step-state { color: var(--warn); }

.rail-foot {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.metric { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; }
.metric-num { font-size: 18px; font-weight: 700; color: var(--ink); display: block; }
.metric-label { font-size: 11px; color: var(--muted); display: block; margin-top: 2px; }

/* Stage */
.stage { display: flex; flex-direction: column; gap: 18px; }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 32px;
  box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.card h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.015em; margin-bottom: 4px; }
.card h3 { font-size: 18px; font-weight: 700; letter-spacing: -0.005em; margin-bottom: 2px; }

.eyebrow {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}

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

.badge {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
  white-space: nowrap;
}
.badge-ai {
  background: var(--ai-bg);
  color: var(--ai);
  border-color: var(--ai-line);
}
.badge-stub {
  background: var(--stub-bg);
  color: var(--stub);
  border-color: #fde68a;
}
.badge-ok { background: var(--ok-bg); color: var(--ok); border-color: #86efac; }

/* Hero */
.hero h1 {
  font-size: 38px;
  font-weight: 700;
  letter-spacing: -0.025em;
  margin: 6px 0 14px;
  line-height: 1.1;
}
.hero .lede { color: var(--ink-2); font-size: 16px; max-width: 700px; }
.hero-actions { display: flex; gap: 10px; margin: 22px 0 26px; }

.btn {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  padding: 12px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  transition: all 120ms ease;
  font-family: inherit;
  text-decoration: none;
}
.btn:hover { border-color: var(--line-2); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-primary:hover { background: #2a2a2a; }
.btn-secondary {
  background: var(--ai);
  color: #fff;
  border-color: var(--ai);
}
.btn-secondary:hover { background: #5b21b6; }
.btn-ghost {
  background: transparent;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
}
.btn-sub { font-size: 11px; font-weight: 400; opacity: 0.7; letter-spacing: 0; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.hero-bullets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}
.bullet {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.bullet-num { font-size: 28px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; }
.bullet-title { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.bullet-sub { font-size: 12px; color: var(--muted); }

/* Creator profile */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.field-block { margin-bottom: 12px; }
.field-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}
.field-value { font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.field-list { font-size: 13px; color: var(--ink-2); }
.field-list li { margin-bottom: 3px; }

.tag-row { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  color: var(--ink-2);
}

/* Brief content */
.brief-section { margin-bottom: 18px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.brief-section:last-child { border-bottom: 0; padding-bottom: 0; }
.brief-section h4 {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
}
.brief-section .brief-value { font-size: 15px; color: var(--ink); margin-bottom: 4px; }
.brief-section .brief-rationale { font-size: 13px; color: var(--muted); font-style: italic; }

.comp-list { display: grid; gap: 8px; margin-top: 6px; }
.comp-item {
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex; justify-content: space-between; gap: 10px;
}
.comp-item .comp-name { font-weight: 600; font-size: 13px; }
.comp-item .comp-score {
  font-size: 12px;
  color: var(--ai);
  background: var(--ai-bg);
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 700;
}
.comp-item .comp-rationale { font-size: 12px; color: var(--muted); margin-top: 3px; }

/* Approval gate */
.card-approval {
  background: linear-gradient(135deg, #fffbeb 0%, var(--surface) 60%);
  border-color: #fde68a;
}
.approval-actions { display: flex; gap: 10px; margin-top: 10px; }

/* Cascade grid */
.cascade-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.card-output { padding: 22px 26px; }
.card-output h3 { font-size: 16px; }

/* Email preview */
.email-preview {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px 18px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
  max-height: 320px;
  overflow-y: auto;
}
.email-headers {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px dashed var(--line);
}
.email-headers strong { color: var(--ink-2); margin-right: 4px; }

/* Doc preview */
.doc-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.doc-section:last-child { border-bottom: 0; }
.doc-section .doc-key {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 2px;
}
.doc-section .doc-val { color: var(--ink-2); }

.doc-scroll {
  max-height: 360px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 16px;
  background: var(--surface-2);
}

/* Pod recommendation */
.pod-ranked {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pod-item {
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 14px;
  align-items: center;
}
.pod-item.is-rec {
  border-color: var(--ai);
  background: var(--ai-bg);
  border-width: 2px;
}
.pod-score {
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}
.pod-item.is-rec .pod-score { color: var(--ai); }
.pod-members { font-weight: 600; font-size: 13px; }
.pod-rationale { font-size: 12px; color: var(--muted); margin-top: 3px; }
.pod-rec-tag {
  background: var(--ai);
  color: #fff;
  font-size: 10px;
  letter-spacing: 0.08em;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Asana project */
.asana-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.asana-meta .field-value { font-size: 13px; }

.asana-section {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}
.asana-section-head {
  padding: 8px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.asana-task {
  padding: 6px 14px;
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.asana-task:last-child { border-bottom: 0; }
.asana-task .task-due { color: var(--muted); font-size: 11px; }

/* Fathom */
.fathom-actions { margin-bottom: 14px; }
.fathom-decisions, .fathom-actions-list {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.fathom-decisions h4, .fathom-actions-list h4 {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-weight: 600;
}
.fathom-item { padding: 6px 0; font-size: 13px; }
.fathom-item .owner-tag {
  background: var(--ai-bg);
  color: var(--ai);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* Summary */
.card-summary {
  background: linear-gradient(135deg, var(--ok-bg) 0%, var(--surface) 70%);
  border-color: #86efac;
}
.summary-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.summary-stat {
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.summary-stat .num { font-size: 20px; font-weight: 700; }
.summary-stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* How it works */
.card-howto { background: var(--surface-2); }
.howto-list {
  margin: 10px 0 0 22px;
  font-size: 14px;
  color: var(--ink-2);
}
.howto-list li { margin-bottom: 8px; line-height: 1.55; }
.howto-list code {
  background: #1a1a1a;
  color: #fcd34d;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-family: 'SF Mono', Monaco, Menlo, monospace;
}

/* Expandable metric (the "show math" pattern) */
.bullet-expandable { cursor: pointer; transition: border-color 120ms ease; }
.bullet-expandable:hover { border-color: var(--ink-2); }
.info-tag {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--muted);
  border: 1px solid var(--line);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 6px;
  font-weight: 600;
  vertical-align: middle;
}

.expand-panel {
  margin-top: 16px;
  padding: 18px 20px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.expand-title {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  font-weight: 700;
  margin-bottom: 10px;
}
.expand-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 10px;
  line-height: 1.5;
}

/* Tables (math, why, integration) */
.math-table, .why-table, .integration-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.math-table th, .why-table th, .integration-table th {
  text-align: left;
  padding: 8px 10px;
  background: var(--surface);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--line);
}
.math-table td, .why-table td, .integration-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-2);
  vertical-align: top;
}
.math-table .total-row td {
  border-top: 2px solid var(--ink);
  border-bottom: 0;
  padding-top: 12px;
  background: var(--surface);
}
.integration-table code {
  background: #1a1a1a;
  color: #fcd34d;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 11px;
  font-family: 'SF Mono', Monaco, Menlo, monospace;
}

/* Why-this-4 expandable */
.why-section {
  margin-top: 14px;
  padding: 14px 18px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.why-section summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  user-select: none;
  outline: none;
}
.why-section summary:hover { color: var(--ink-2); }
.why-section[open] summary { margin-bottom: 12px; }

/* Strategic discussion card */
.card-strategic {
  background: linear-gradient(135deg, var(--ai-bg) 0%, var(--surface) 60%);
  border-color: var(--ai-line);
  border-left: 4px solid var(--ai);
}
.card-strategic h2 { color: var(--ink); }
.card-strategic .eyebrow { color: var(--ai); }

.hub-list {
  margin-left: 18px;
  font-size: 13px;
  color: var(--ink-2);
  line-height: 1.55;
}
.hub-list li { margin-bottom: 6px; }

@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .rail { position: static; }
  .cascade-grid { grid-template-columns: 1fr; }
}
