:root {
  --text: #1a1a1a;
  --text-muted: #666;
  --bg: #fafafa;
  --surface: #fff;
  --border: #e0e0e0;
  --accent: #1565c0;
  --annotation-bg: #f0f4f8;
  --annotation-border: #b0bec5;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: "SF Mono", "Fira Code", "Fira Mono", Menlo, monospace;
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem;
}
.site-header nav {
  max-width: 900px;
  margin: 0 auto;
}
.site-title {
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  margin-top: 4rem;
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
}

/* Index page */
h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin-top: 2rem;
  margin-bottom: 1.5rem;
}

.case-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}
.case-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s;
}
.case-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}
.case-card h3 {
  font-size: 1rem;
  margin-bottom: 0.25rem;
}
.case-outlet {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Case detail page */
.case-header {
  padding-top: 2rem;
  margin-bottom: 1.5rem;
}
.case-header h1 {
  margin-top: 0;
  margin-bottom: 0.25rem;
}
.case-meta {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}
.case-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.external-link {
  color: var(--accent);
  font-size: 0.9rem;
}

/* Section nav */
.section-nav {
  display: flex;
  gap: 0.25rem;
  border-bottom: 2px solid var(--border);
  margin-bottom: 2rem;
}
.section-nav a {
  padding: 0.6rem 1rem;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.section-nav a:hover {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* Sections */
.case-section {
  margin-bottom: 3rem;
}
.case-section h2 {
  font-size: 1.4rem;
  margin-bottom: 1rem;
}

/* Rubric */
.rubric-content {
  font-size: 0.95rem;
}
.rubric-content h2 {
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
}
.rubric-content h3 {
  font-size: 1.05rem;
  margin-top: 1.25rem;
  margin-bottom: 0.4rem;
}
.rubric-content p {
  margin-bottom: 0.6rem;
}
.rubric-content ul {
  margin-left: 1.5rem;
  margin-bottom: 0.6rem;
}
.rubric-content li {
  margin-bottom: 0.3rem;
}

/* Lead cards */
.lead-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 1.25rem;
}
.lead-header {
  margin-bottom: 0.75rem;
}
.lead-header h3 {
  font-size: 1.05rem;
  margin: 0;
}

/* Lead body */
.lead-body {
  font-size: 0.95rem;
}
.lead-body p {
  margin-bottom: 0.6rem;
}
.lead-body strong {
  font-weight: 600;
}
.lead-body ul, .lead-body ol {
  margin-left: 1.5rem;
  margin-bottom: 0.6rem;
}
.lead-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  margin: 0.75rem 0;
}
.lead-body th, .lead-body td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.6rem;
  text-align: left;
}
.lead-body th {
  background: var(--bg);
}
.lead-body hr {
  display: none;
}

/* Annotation */
.lead-annotation {
  margin-top: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--annotation-bg);
  border-left: 3px solid var(--annotation-border);
  border-radius: 0 4px 4px 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Tipsheet preamble */
.tipsheet-preamble {
  margin-bottom: 2rem;
  font-size: 0.95rem;
}
.tipsheet-preamble p { margin-bottom: 0.6rem; }
.tipsheet-preamble h1 { font-size: 1.3rem; margin-top: 0; margin-bottom: 0.75rem; }
.tipsheet-preamble h2 { font-size: 1.1rem; margin-top: 1.5rem; margin-bottom: 0.5rem; }
.tipsheet-preamble ul { margin-left: 1.5rem; margin-bottom: 0.6rem; }
.tipsheet-preamble li { margin-bottom: 0.25rem; }

/* Transcript */
.transcript-intro {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}
.transcript {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.msg {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  font-size: 0.9rem;
}
.msg-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.35rem;
}
.msg-content {
  word-break: break-word;
}
.msg-content p { margin-bottom: 0.4rem; }
.msg-content p:last-child { margin-bottom: 0; }

.msg-user {
  background: #f0f0f0;
  border: 1px solid #e0e0e0;
}
.msg-assistant {
  background: #e8f0fe;
  border: 1px solid #c5d9f2;
}
.msg-assistant .msg-content code {
  background: rgba(0,0,0,0.06);
  padding: 0.1em 0.3em;
  border-radius: 3px;
  font-size: 0.85em;
}
.msg-tool_use {
  background: #f5f5f5;
  border: 1px solid #e0e0e0;
  font-family: var(--mono);
}
.tool-label {
  color: #6a1b9a;
}
.msg-tool_use pre {
  margin-top: 0.25rem;
  white-space: pre-wrap;
  font-size: 0.82rem;
}
.msg-tool_use code {
  font-size: 0.85rem;
}

.msg-tool_result {
  padding: 0;
}
.tool-result-block {
  font-size: 0.85rem;
}
.tool-result-block summary {
  cursor: pointer;
  padding: 0.5rem 1rem;
  color: var(--text-muted);
  background: #f8f8f8;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}
.tool-result-block summary:hover {
  background: #f0f0f0;
}
.tool-result-block pre {
  margin: 0;
  padding: 0.75rem 1rem;
  background: #fafafa;
  border: 1px solid #e8e8e8;
  border-top: none;
  border-radius: 0 0 4px 4px;
  white-space: pre-wrap;
  font-size: 0.8rem;
  max-height: 400px;
  overflow-y: auto;
}
.tool-error summary {
  color: #c62828;
  background: #ffebee;
}

.msg-thinking { padding: 0; }
.thinking-block summary {
  cursor: pointer;
  padding: 0.5rem 1rem;
  font-style: italic;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.thinking-content {
  padding: 0.75rem 1rem;
  background: #f9f9f9;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-style: italic;
  white-space: pre-wrap;
  max-height: 300px;
  overflow-y: auto;
}

/* Back link */
.back-link {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.back-link a {
  color: var(--accent);
  font-size: 0.9rem;
}

/* Responsive */
@media (max-width: 768px) {
  .case-grid {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 1.4rem;
  }
}
