/* ═══════════════════════════════════════════════════
   A5labs Docs — Braun-inspired Design
   Clean. Functional. Honest.
   ═══════════════════════════════════════════════════ */

:root {
  --bg: #FAFAF8;
  --surface: #FFFFFF;
  --surface-hover: #F5F5F0;
  --border: #E8E6E1;
  --border-light: #F0EDE8;
  --text: #1A1A1A;
  --text-secondary: #6B6B6B;
  --text-muted: #999999;
  --accent: #2D2D2D;
  --accent-light: #4A4A4A;
  --blue: #3B82F6;
  --blue-light: #EFF6FF;
  --green: #22C55E;
  --red: #EF4444;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 4px 12px rgba(0,0,0,0.08);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

/* ── Login ─────────────────────────────────────── */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow-lg);
}

.login-card h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-card p {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-card input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: var(--font);
  outline: none;
  transition: border var(--transition);
  margin-bottom: 16px;
}

.login-card input:focus {
  border-color: var(--accent);
}

.login-card button {
  width: 100%;
  padding: 12px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition);
}

.login-card button:hover {
  background: var(--accent-light);
}

.login-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}

/* ── Layout ────────────────────────────────────── */
.shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.header h1 {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header a, .btn-sm {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
  background: none;
  cursor: pointer;
  font-family: var(--font);
}

.header a:hover, .btn-sm:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* ── Index / Doc List ──────────────────────────── */
.category {
  margin-bottom: 32px;
}

.category h2 {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.doc-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text);
  transition: all var(--transition);
  display: block;
}

.doc-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
  transform: translateY(-1px);
}

.doc-card h3 {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 4px;
}

.doc-card .meta {
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Document View ─────────────────────────────── */
.doc-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 32px;
  align-items: start;
}

.doc-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 44px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.doc-content h1 { font-size: 26px; font-weight: 600; margin: 28px 0 14px; letter-spacing: -0.02em; }
.doc-content h2 { font-size: 20px; font-weight: 600; margin: 24px 0 12px; letter-spacing: -0.01em; padding-bottom: 8px; border-bottom: 1px solid var(--border-light); }
.doc-content h3 { font-size: 16px; font-weight: 600; margin: 20px 0 8px; }
.doc-content h1:first-child { margin-top: 0; }

.doc-content p { margin-bottom: 12px; }
.doc-content ul, .doc-content ol { margin: 8px 0 12px 24px; }
.doc-content li { margin-bottom: 4px; }

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 14px;
}

.doc-content th, .doc-content td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.doc-content th {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--bg);
}

.doc-content code {
  background: var(--bg);
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.doc-content pre {
  background: #1E1E1E;
  color: #D4D4D4;
  padding: 16px 20px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  margin: 12px 0;
  font-size: 13px;
  line-height: 1.5;
}

.doc-content pre code {
  background: none;
  padding: 0;
  color: inherit;
}

.doc-content strong { font-weight: 600; }

.doc-content blockquote {
  border-left: 3px solid var(--border);
  padding: 8px 16px;
  margin: 12px 0;
  color: var(--text-secondary);
  background: var(--bg);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.doc-content hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Sidebar ───────────────────────────────────── */
.sidebar {
  position: sticky;
  top: 24px;
}

.sidebar-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.sidebar-section h3 {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.toc a {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 4px 0;
  transition: color var(--transition);
}

.toc a:hover { color: var(--text); }

/* ── Comments ──────────────────────────────────── */
.comment-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  resize: vertical;
  min-height: 80px;
  outline: none;
  transition: border var(--transition);
  margin-bottom: 8px;
}

.comment-form textarea:focus {
  border-color: var(--accent);
}

.comment-form button {
  padding: 8px 16px;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font);
  transition: background var(--transition);
}

.comment-form button:hover {
  background: var(--accent-light);
}

.comment {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-light);
}

.comment:last-child { border-bottom: none; }

.comment .meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.comment .body {
  font-size: 14px;
  line-height: 1.5;
}

.comment .resolution {
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--blue-light);
  border-radius: var(--radius-sm);
  font-size: 13px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-open { background: #FEF3C7; color: #92400E; }
.badge-resolved { background: #D1FAE5; color: #065F46; }

.comment-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--blue);
  color: white;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 600;
  margin-left: 6px;
}

/* ── Responsive ────────────────────────────────── */
@media (max-width: 768px) {
  .doc-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    order: -1;
  }

  .doc-content {
    padding: 24px 20px;
  }

  .doc-grid {
    grid-template-columns: 1fr;
  }

  .header {
    flex-direction: column;
    gap: 12px;
    align-items: flex-start;
  }

  .login-card {
    padding: 32px 24px;
  }
}

@media (max-width: 480px) {
  body { font-size: 14px; }
  .doc-content h1 { font-size: 22px; }
  .doc-content h2 { font-size: 18px; }
  .shell { padding: 16px 12px; }
}
