/*
  EBI Documentation Styles
  Clean technical documentation with proper table handling
*/

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --max-width: 920px;
  --radius-xl: 16px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --radius-sm: 6px;

  --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --bg: #f4f5f7;
  --panel: #ffffff;
  --panel-2: #f9fafb;

  --text: #111827;
  --muted: #4b5563;
  --faint: #6b7280;

  --border: #e5e7eb;
  --border-strong: #d1d5db;

  --link: #2563eb;
  --link-hover: #1d4ed8;

  --accent: #3b82f6;
  --accent-subtle: #eff6ff;

  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 8px 30px rgba(0,0,0,0.06);

  --code-bg: #1e293b;
  --code-text: #e2e8f0;

  --inline-code-bg: #f1f5f9;
  --inline-code-border: #e2e8f0;

  --leading: 1.65;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f172a;
    --panel: #1e293b;
    --panel-2: #334155;

    --text: #f1f5f9;
    --muted: #94a3b8;
    --faint: #64748b;

    --border: #334155;
    --border-strong: #475569;

    --link: #60a5fa;
    --link-hover: #93c5fd;

    --accent: #3b82f6;
    --accent-subtle: rgba(59, 130, 246, 0.1);

    --shadow: 0 1px 3px rgba(0,0,0,0.3), 0 8px 30px rgba(0,0,0,0.25);

    --code-bg: #0f172a;
    --code-text: #e2e8f0;

    --inline-code-bg: #334155;
    --inline-code-border: #475569;
  }
}

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

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

.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2.5rem 1.5rem 4rem;
}

.doc {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 2.5rem 3rem;
  box-shadow: var(--shadow);
}

@media (max-width: 760px) {
  .content { padding: 1.5rem 1rem 3rem; }
  .doc { padding: 1.5rem 1.25rem; border-radius: var(--radius-lg); }
}

/* Typography */

h1, h2, h3, h4, h5, h6 {
  margin: 2rem 0 0.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

h1 {
  margin-top: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

h2 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
  margin-top: 2.5rem;
}

h3 { font-size: 1.2rem; }
h4 { font-size: 1.05rem; }
h5, h6 { font-size: 0.95rem; color: var(--muted); }

p { margin: 0.875rem 0; }

strong { font-weight: 600; }

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

a {
  color: var(--link);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

::selection { background: rgba(59, 130, 246, 0.2); }

/* Document header - Status/Date styling */
h1 + p > strong:first-child,
h1 + p + p > strong:first-child {
  color: var(--muted);
  font-weight: 500;
}

/* Lists */

ul, ol {
  margin: 0.875rem 0;
  padding-left: 1.5rem;
}
li { margin: 0.25rem 0; }
li > ul, li > ol { margin: 0.25rem 0; }

/* Blockquotes */

blockquote {
  margin: 1.25rem 0;
  padding: 0.875rem 1rem;
  border-left: 3px solid var(--accent);
  background: var(--accent-subtle);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--muted);
}
blockquote p { margin: 0.5rem 0; }
blockquote p:first-child { margin-top: 0; }
blockquote p:last-child { margin-bottom: 0; }

/* Code */

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--inline-code-bg);
  border: 1px solid var(--inline-code-border);
  padding: 0.125em 0.375em;
  border-radius: var(--radius-sm);
}

pre {
  margin: 1.25rem 0;
  padding: 1rem 1.125rem;
  overflow-x: auto;
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: var(--radius-md);
  line-height: 1.5;
  font-size: 0.875rem;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* Tables */

table {
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

th, td {
  padding: 0.5rem 1rem 0.5rem 0;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--faint);
  padding-bottom: 0.625rem;
}

tr:last-child td { border-bottom: none; }

td:first-child {
  font-weight: 600;
}

/* TOC */

#TOC {
  margin: 0 0 2rem;
  padding: 1.25rem 1.5rem;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

#TOC .toc-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--faint);
  margin-bottom: 0.75rem;
}

#TOC ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

#TOC li {
  margin: 0.125rem 0;
  line-height: 1.4;
}

#TOC > ul > li {
  margin: 0.375rem 0;
}

#TOC a {
  color: var(--text);
  font-size: 0.9rem;
}

#TOC a:hover {
  color: var(--link);
}

#TOC ul ul {
  padding-left: 1rem;
  margin-top: 0.25rem;
}

#TOC ul ul a {
  color: var(--muted);
  font-size: 0.85rem;
}

#TOC ul ul ul {
  display: none; /* Hide 3rd level - too deep */
}

/* Images */

img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}

figure { margin: 1.25rem 0; }
figcaption {
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.875rem;
}

/* Definition lists (pandoc sometimes generates these) */

dl {
  margin: 1rem 0;
}

dt {
  font-weight: 600;
  margin-top: 0.75rem;
}

dd {
  margin-left: 1.5rem;
  color: var(--muted);
}

/* Footnotes */

.footnotes {
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

/* Print */

@media print {
  body { background: white; color: black; }
  .doc { box-shadow: none; border: 1px solid #ccc; }
  #TOC { break-inside: avoid; }
  pre { white-space: pre-wrap; word-wrap: break-word; }
}
