/* ─── Iris Documentation — Stylesheet ─────────────────────────────────── */

:root {
  --bg: #f5f7fa;
  --bg-sidebar: #eef2f6;
  --bg-code: #edf3f9;
  --border: #d9e1ea;
  --text: #131b22;
  --text-muted: #58697a;
  --text-nav: #1d2a36;
  --accent: #0f172a;
  --accent-soft: #edf4ff;
  --accent-dark: #0f172a;
  --heading: #101827;
  --link: #12324a;
  --link-hover: #1d4668;
  --warn-bg: #fff7d6;
  --warn-border: #d4a017;
  --info-bg: #e6f2ff;
  --info-border: #3b82f6;
  --sidebar-w: 320px;
  --topbar-h: 64px;
  --radius: 12px;
  --shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
}

[data-theme="dark"] {
  --bg: #0b1118;
  --bg-sidebar: #101a23;
  --bg-code: #101d2a;
  --border: #243545;
  --text: #edf5ff;
  --text-muted: #9db0c2;
  --text-nav: #edf5ff;
  --accent: #b8d8ff;
  --accent-soft: #12263b;
  --accent-dark: #edf5ff;
  --heading: #f2f7ff;
  --link: #dfeeff;
  --link-hover: #ffffff;
  --warn-bg: #2f260f;
  --warn-border: #f0bf62;
  --info-bg: #122e4d;
  --info-border: #8ec5ff;
  --shadow: 0 18px 32px rgba(2, 6, 23, 0.6);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: "Roboto", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  min-height: 100vh;
}

h1, h2, h3, h4, .docs-topbar-brand, .docs-nav-section-label, .docs-topbar-label, .docs-content .step-grid strong {
  font-family: "Poppins", "Product Sans", "Roboto", sans-serif;
}

/* ─── Layout ────────────────────────────────────────────────────────────── */

.docs-topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 18px 0 20px;
  gap: 14px;
  z-index: 100;
}

[data-theme="dark"] .docs-topbar {
  background: rgba(11, 17, 24, 0.96);
}

.docs-topbar-brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.docs-topbar-brand {
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.03em;
  line-height: 1;
}

.docs-topbar-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}

.docs-topbar-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}

.docs-topbar-spacer { flex: 1; }

.docs-theme-toggle {
  width: 38px;
  height: 38px;
  min-width: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.04);
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 20px;
  transition: background .15s ease, border-color .15s ease, transform .15s ease, color .15s ease;
}

[data-theme="dark"] .docs-theme-toggle {
  background: rgba(255, 255, 255, 0.06);
  color: #fbbf24;
}

.docs-theme-toggle:hover {
  background: rgba(15, 23, 42, 0.08);
  border-color: var(--text-muted);
  transform: translateY(-1px) scale(1.05);
}

[data-theme="dark"] .docs-theme-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fde047;
}

.sidebar-toggle:hover {
  transform: translateY(-1px);
}

.docs-theme-toggle .material-symbols-outlined,
.docs-theme-toggle .material-icons {
  font-size: 20px;
  width: 20px;
  height: 20px;
  line-height: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  user-select: none;
}

.docs-wrapper {
  display: flex;
  margin-top: var(--topbar-h);
  min-height: calc(100vh - var(--topbar-h));
}

/* ─── Sidebar ───────────────────────────────────────────────────────────── */

.docs-sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  position: fixed;
  top: var(--topbar-h);
  bottom: 0;
  overflow-y: auto;
  padding: 16px 0 30px;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.docs-nav-section {
  margin: 0 12px 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  overflow: hidden;
}

.docs-nav-section[open] {
  border-color: var(--border);
  background: rgba(255, 255, 255, 0.18);
}

.docs-nav-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 16px;
}

.docs-nav-section-label::-webkit-details-marker { display: none; }

.docs-nav-section-label::after {
  content: "+";
  font-size: 18px;
  line-height: 1;
  color: var(--text-muted);
  transform: translateY(-1px);
}

.docs-nav-section[open] > .docs-nav-section-label::after {
  content: "−";
}

.docs-nav-section-items {
  display: grid;
  gap: 2px;
  padding: 0 8px 10px;
}

.docs-nav-link {
  display: block;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-nav);
  text-decoration: none;
  border-radius: 8px;
  transition: color .12s, background .12s, border-color .12s;
}

.docs-nav-link:hover {
  color: var(--text);
  background: rgba(15, 23, 42, 0.04);
}

.docs-nav-link.active {
  color: var(--text);
  background: rgba(15, 23, 42, 0.08);
  font-weight: 500;
}

[data-theme="dark"] .docs-nav-link:hover {
  background: rgba(184, 216, 255, 0.08);
}

[data-theme="dark"] .docs-nav-link.active {
  background: rgba(184, 216, 255, 0.12);
}

/* ─── Content ───────────────────────────────────────────────────────────── */

.docs-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
}

.docs-content-area {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.docs-content {
  flex: 1;
  max-width: 1200px;
  width: 100%;
  margin: 0;
  padding: 32px 48px 80px 48px;
}

/* ─── Markdown Typography ───────────────────────────────────────────────── */

.docs-content h1 {
  font-size: clamp(2.5rem, 5vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.065em;
  color: var(--heading);
  line-height: 0.96;
  margin: 0 0 24px;
}

.docs-content h2 {
  font-size: clamp(2.2rem, 3vw, 3.4rem);
  font-weight: 800;
  letter-spacing: -0.06em;
  color: var(--heading);
  margin-top: 52px;
  margin-bottom: 18px;
}

.docs-content h3 {
  font-size: 1.15rem;
  font-weight: 650;
  color: var(--heading);
  margin-top: 28px;
  margin-bottom: 8px;
}

.docs-content h4 {
  font-size: .95rem;
  font-weight: 650;
  color: var(--text-muted);
  margin-top: 20px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.docs-content p {
  margin-bottom: 18px;
  font-size: 18px;
  line-height: 1.6;
  color: var(--text);
}

.docs-content a { color: var(--link); text-decoration: underline; }
.docs-content a:hover { color: var(--link-hover); }

.docs-content ul,
.docs-content ol {
  margin: 0 0 16px 20px;
}

.docs-content li { margin-bottom: 6px; }
.docs-content li > p { margin-bottom: 4px; }

.docs-content strong { font-weight: 650; color: var(--heading); }
.docs-content em { font-style: italic; }

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

.docs-content blockquote {
  border-left: 3px solid var(--accent);
  padding: 10px 16px;
  background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 20px 0;
  color: var(--text);
}

.docs-content blockquote p { margin: 0; }

.docs-content code {
  font-family: "JetBrains Mono", "Fira Code", Consolas, "Courier New", monospace;
  font-size: .85em;
  background: var(--bg-code);
  color: var(--accent-dark);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

[data-theme="dark"] .docs-content code {
  color: var(--accent);
}

.docs-content pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  overflow-x: auto;
  margin: 20px 0;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: .88rem;
  color: var(--text);
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 14px;
  overflow-x: auto;
  display: block;
}

.docs-content th {
  background: var(--bg-sidebar);
  font-weight: 650;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  padding: 8px 12px;
  border: 1px solid var(--border);
  text-align: left;
}

.docs-content td {
  padding: 8px 12px;
  border: 1px solid var(--border);
  vertical-align: top;
}

.docs-content tr:hover td { background: var(--bg-sidebar); }

/* ─── Callouts ──────────────────────────────────────────────────────────── */

.docs-content .callout-info {
  background: var(--info-bg);
  border: 1px solid var(--info-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 20px 0;
  font-size: 14px;
}

.docs-content .callout-warning {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 20px 0;
  font-size: 14px;
}

/* ─── Step badges ───────────────────────────────────────────────────────── */

.docs-content .step-grid {
  display: grid;
  gap: 12px;
  margin: 20px 0;
}

/* ─── Page Pagination (Previous / Next) ────────────────────────────────── */

.docs-pagination {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.docs-pagination-link {
  display: flex;
  flex-direction: column;
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sidebar);
  text-decoration: none;
  color: var(--text);
  flex: 1;
  max-width: 48%;
  transition: border-color .15s ease, background .15s ease, transform .15s ease, box-shadow .15s ease;
}

.docs-pagination-prev {
  text-align: left;
  align-items: flex-start;
}

.docs-pagination-next {
  margin-left: auto;
  text-align: right;
  align-items: flex-end;
}

.docs-pagination-empty {
  flex: 1;
  max-width: 48%;
}

.docs-pagination-sub {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

.docs-pagination-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--heading);
  line-height: 1.35;
  transition: color .15s ease;
}

.docs-pagination-link:hover {
  border-color: var(--border);
  background: var(--accent-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.docs-pagination-link:hover .docs-pagination-title {
  color: var(--accent);
}

[data-theme="dark"] .docs-pagination-link {
  background: rgba(255, 255, 255, 0.03);
}

[data-theme="dark"] .docs-pagination-link:hover {
  background: rgba(184, 216, 255, 0.08);
  border-color: var(--border);
}

[data-theme="dark"] .docs-pagination-link:hover .docs-pagination-title {
  color: var(--accent);
}

@media (max-width: 640px) {
  .docs-pagination {
    flex-direction: column;
    gap: 12px;
  }
  .docs-pagination-link,
  .docs-pagination-empty {
    max-width: 100%;
    width: 100%;
  }
  .docs-pagination-next {
    margin-left: 0;
  }
}

/* ─── Page footer ───────────────────────────────────────────────────────── */

.docs-page-footer {
  margin-top: 36px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.docs-page-footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}
.docs-page-footer a:hover { text-decoration: underline; }

/* ─── Loading / Error states ─────────────────────────────────────────────── */

#content-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 80px 20px;
  color: var(--text-muted);
  font-size: 15px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Mobile ────────────────────────────────────────────────────────────── */

.sidebar-toggle {
  display: none;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 8px;
  cursor: pointer;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}

[data-theme="dark"] .sidebar-toggle {
  background: rgba(255, 255, 255, 0.04);
}

@media (max-width: 768px) {
  .sidebar-toggle { display: flex; align-items: center; }

  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform .2s ease;
    z-index: 90;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-main {
    margin-left: 0;
  }

  .docs-content {
    padding: 24px 20px 60px;
  }

  .docs-topbar-label { display: none; }
  .docs-topbar-divider { display: none; }
}

/* ─── Breadcrumb ────────────────────────────────────────────────────────── */

.docs-breadcrumb {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.docs-breadcrumb span { opacity: .5; }

/* ─── Version badge ─────────────────────────────────────────────────────── */

.version-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .04em;
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 2px 10px;
  margin-bottom: 10px;
}

[data-theme="dark"] .version-badge { color: var(--accent); }

/* ─── On-this-page TOC ───────────────────────────────────────────────────── */

@media (min-width: 1200px) {
  .docs-main {
    flex-direction: row;
    align-items: flex-start;
  }

  .docs-content-area {
    flex: 1;
    min-width: 0;
  }

  .docs-content {
    max-width: 1200px;
    padding: 36px 48px 80px 48px;
    margin: 0;
  }

  .docs-toc {
    width: 230px;
    flex-shrink: 0;
    padding: 36px 24px 40px 16px;
    position: sticky;
    top: var(--topbar-h);
    max-height: calc(100vh - var(--topbar-h));
    overflow-y: auto;
    font-size: 13px;
  }

  .docs-toc-label {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0;
    color: var(--text-muted);
    margin-bottom: 12px;
    text-transform: none;
  }

  .docs-toc a {
    display: block;
    padding: 8px 0 8px 0;
    color: var(--text-muted);
    text-decoration: none;
    border-left: 0;
    transition: color .1s, opacity .1s;
  }

  .docs-toc a:hover,
  .docs-toc a.active {
    color: var(--text);
    opacity: 1;
  }
}

@media (min-width: 1500px) {
  .docs-content {
    max-width: 1380px;
    padding: 40px 56px 80px 56px;
  }
}
