:root {
  color-scheme: light;
  --ink: #141c24;
  --muted: #54595f;
  --accent: #6ec1e4;
  --accent-2: #f6a727;
  --surface: #ffffff;
  --paper: #ffffff;
  --line: rgba(15, 23, 42, 0.08);
  --code: #0b1220;
  --code-text: #e2e8f0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Roboto", "Segoe UI", sans-serif;
  background: radial-gradient(circle at 10% 20%, rgba(110, 193, 228, 0.25) 0%, transparent 35%),
              radial-gradient(circle at 90% 10%, rgba(246, 167, 39, 0.15) 0%, transparent 40%),
              var(--paper);
  color: var(--ink);
}

header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(12px);
  background: rgba(248, 250, 252, 0.9);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

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

.badge {
  width: 60px;
  height: 60px;
  border-radius: 14px;
  background: linear-gradient(135deg, #6ec1e4, #61ce70);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-family: "Josefin Sans", sans-serif;
}

.badge-logo {
  background: linear-gradient(135deg, #6ec1e4, #61ce70);
  box-shadow: 0 10px 20px rgba(110, 193, 228, 0.25);
}

.badge-logo img {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 4px 10px rgba(20, 28, 36, 0.15));
}

.header-text h1 {
  margin: 0;
  font-family: "Josefin Sans", sans-serif;
  font-size: 20px;
}

.header-text p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  margin-left: auto;
  display: flex;
  gap: 12px;
}

.header-actions a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px 64px;
}

.doc-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.08);
}

.doc-shell h1 {
  font-family: "Josefin Sans", sans-serif;
  margin-top: 0;
}

.doc-shell h2,
.doc-shell h3,
.doc-shell h4 {
  font-family: "Josefin Sans", sans-serif;
  margin-top: 28px;
}

.doc-shell p {
  line-height: 1.7;
  color: var(--ink);
}

.doc-shell a {
  color: var(--accent);
}

.doc-shell ul,
.doc-shell ol {
  padding-left: 20px;
  line-height: 1.7;
}

.doc-shell blockquote {
  border-left: 4px solid var(--accent);
  margin: 20px 0;
  padding: 12px 18px;
  background: #f0fdfa;
  color: #0f172a;
}

.doc-shell code {
  background: rgba(15, 118, 110, 0.12);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.9em;
}

.doc-shell pre {
  background: var(--code);
  color: var(--code-text);
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
}

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

.doc-shell th,
.doc-shell td {
  border: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
}

.doc-shell th {
  background: #f1f5f9;
  font-weight: 600;
}

.index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 8px;
}

.tab {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab:hover {
  border-color: rgba(15, 118, 110, 0.4);
  color: var(--accent);
}

.tab.active {
  background: linear-gradient(135deg, #6ec1e4, #61ce70);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 10px 20px rgba(110, 193, 228, 0.25);
}

.group-meta {
  margin-top: 14px;
}

.group-desc {
  color: var(--muted);
  margin: 6px 0 18px;
}

.index-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: var(--surface);
}

.index-card h3 {
  margin: 0 0 6px;
  font-family: "Josefin Sans", sans-serif;
}

.index-card p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 14px;
}

.index-card a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  font-size: 14px;
}

/* ── Two-column layout: ToC sidebar + doc content ── */

#doc-body {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

#toc-sidebar {
  width: 200px;
  min-width: 200px;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  border-left: 2px solid var(--line);
  padding-left: 16px;
  order: 1;
  flex-shrink: 0;
}

#doc-content {
  flex: 1;
  min-width: 0;
}

.toc-title {
  font-family: "Josefin Sans", sans-serif;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 10px;
}

.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.toc-list li {
  margin: 0;
}

.toc-h3 {
  padding-left: 14px;
}

.toc-link {
  display: block;
  font-size: 13px;
  line-height: 1.4;
  padding: 3px 0;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.toc-link:hover,
.toc-link.active {
  color: var(--accent);
}

/* ── Copy button on <pre> blocks ── */

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255, 255, 255, 0.12);
  color: var(--code-text);
  border: none;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s, background 0.2s;
}

.copy-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.22);
}

/* ── Code tabs ── */

.code-tabs {
  margin: 16px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.code-tabs-bar {
  display: flex;
  gap: 0;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
}

.code-tab-btn {
  background: transparent;
  border: none;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.code-tab-btn:hover {
  color: var(--ink);
}

.code-tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.code-tab-panel {
  display: none;
}

.code-tab-panel.active {
  display: block;
}

.code-tab-panel pre {
  margin: 0;
  border-radius: 0;
}

/* ── Breadcrumb ── */

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.breadcrumb-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.breadcrumb-link:hover {
  text-decoration: underline;
}

.breadcrumb-sep {
  color: var(--muted);
  font-size: 15px;
}

.breadcrumb-current {
  color: var(--muted);
  font-weight: 500;
}

/* ── Version badge & meta bar ── */

.meta-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.version-badge {
  display: inline-block;
  background: #10b981;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}

.meta-updated {
  font-size: 13px;
  color: var(--muted);
}

/* ── Prism theme overrides to match site variables ── */

.doc-shell pre[class*="language-"],
.doc-shell code[class*="language-"] {
  background: var(--code);
  color: var(--code-text);
}

.doc-shell pre[class*="language-"] {
  border-radius: 12px;
  padding: 16px;
}

/* Inline code should not use Prism dark bg */
.doc-shell :not(pre) > code[class*="language-"] {
  background: rgba(15, 118, 110, 0.12);
  color: var(--ink);
  padding: 2px 6px;
  border-radius: 6px;
}

/* ── Responsive ── */

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .header-actions {
    margin-left: 0;
  }

  .doc-shell {
    padding: 22px;
  }

  #toc-sidebar {
    display: none;
  }

  #doc-body {
    flex-direction: column;
  }
}
