/* static/style.css */
:root {
  --bg: #0d1117;
  --surface: #161b22;
  --border: #21262d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --orange: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --cyan: #39d353;
  --code-bg: #1f2937;
  --success-bg: #1a2e1a;
  --error-bg: #2e1a1a;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.7;
  padding: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}

/* Typography */
h1 {
  font-size: 2rem;
  color: var(--accent);
  margin-bottom: 0.25rem;
  font-weight: 700;
}

h2 {
  font-size: 1.4rem;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
  margin: 2.5rem 0 1rem;
}

h3 {
  font-size: 1.1rem;
  color: var(--orange);
  margin: 1.5rem 0 0.5rem;
}

h4 {
  font-size: 0.95rem;
  color: var(--purple);
  margin: 1rem 0 0.4rem;
}

p { margin-bottom: 0.8rem; color: var(--text); }
.subtitle { color: var(--muted); margin-bottom: 2rem; font-size: 0.95rem; }

/* Code blocks */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  margin: 0.75rem 0 1rem;
  font-size: 0.85rem;
  line-height: 1.6;
}

code {
  font-family: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
  font-size: 0.85em;
}

p code, li code, td code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0.1em 0.4em;
  color: var(--cyan);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0 1rem;
  font-size: 0.875rem;
}

th {
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  text-align: left;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
}

td {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
}

tr:nth-child(even) td { background: var(--surface); }

/* Lists */
ul, ol { padding-left: 1.5rem; margin-bottom: 0.8rem; }
li { margin-bottom: 0.3rem; }

/* Callout boxes */
.rule {
  background: var(--surface);
  border-left: 3px solid var(--accent);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.warn {
  background: #2d1f00;
  border-left: 3px solid var(--orange);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.success {
  background: var(--success-bg);
  border-left: 3px solid var(--green);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

.error {
  background: var(--error-bg);
  border-left: 3px solid var(--red);
  padding: 0.75rem 1rem;
  border-radius: 0 6px 6px 0;
  margin: 0.75rem 0;
  font-size: 0.9rem;
}

/* Labels and tags */
.section-label {
  display: inline-block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1rem 0.5rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tag {
  display: inline-block;
  background: #1f2937;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.1rem 0.6rem;
  font-size: 0.75rem;
  color: var(--muted);
  margin: 0.1rem;
}

.tag.get { color: var(--accent); border-color: var(--accent); }
.tag.post { color: var(--green); border-color: var(--green); }
.tag.number-theory { color: var(--purple); border-color: var(--purple); }
.tag.sequences { color: var(--cyan); border-color: var(--cyan); }
.tag.modular { color: var(--orange); border-color: var(--orange); }
.tag.perfect-powers { color: var(--red); border-color: var(--red); }

/* Flow diagrams */
.flow {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--cyan);
  margin: 0.75rem 0 1rem;
  white-space: pre;
}

/* Endpoint cards */
.endpoint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  margin: 1rem 0;
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.endpoint-path {
  font-family: monospace;
  color: var(--cyan);
  font-size: 0.9rem;
}

.endpoint-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

/* Form elements */
.endpoint-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.5rem 0;
}

.endpoint-form label {
  font-size: 0.85rem;
  color: var(--muted);
}

.endpoint-form input {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.3rem 0.5rem;
  color: var(--text);
  font-family: monospace;
  font-size: 0.85rem;
  min-width: 80px;
}

.endpoint-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.endpoint-form button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.endpoint-form button:hover {
  background: #4493e0;
}

/* Response display */
.response {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
  font-family: monospace;
  font-size: 0.85rem;
  white-space: pre-wrap;
  word-break: break-all;
  display: none;
}

.response.show { display: block; }
.response.success { border-left: 3px solid var(--green); }
.response.error { border-left: 3px solid var(--red); }

/* Navigation */
.nav {
  position: sticky;
  top: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0;
  z-index: 100;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  transition: color 0.2s;
}

.nav a:hover, .nav a.active {
  color: var(--accent);
  background: var(--surface);
}

/* Status indicators */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.6rem;
  border-radius: 12px;
  font-size: 0.85rem;
}

.status.ok {
  background: var(--success-bg);
  color: var(--green);
}

.status.err {
  background: var(--error-bg);
  color: var(--red);
}

.status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Utility */
.mt-2 { margin-top: 2rem; }
.mb-1 { margin-bottom: 1rem; }
.text-muted { color: var(--muted); }
.text-accent { color: var(--accent); }
.hidden { display: none !important; }

/* Responsive */
@media (max-width: 768px) {
  body { padding: 1rem; }
  .endpoint-form { flex-direction: column; align-items: stretch; }
  .endpoint-form input { width: 100%; }
}