@import url("styles.css");

body.docs-page {
  padding-top: var(--header-h);
  --section-y: 1rem;
}

/* ── Layout ── */
.docs-layout {
  display: flex;
  max-width: calc(var(--max-w) + 14rem);
  margin: 0 auto;
  padding: 0 1.25rem;
  min-height: calc(100vh - var(--header-h));
}

.docs-sidebar {
  width: 13rem;
  flex-shrink: 0;
  padding: 2.5rem 1.5rem 2.5rem 0;
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
}

.docs-sidebar-label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-light);
  margin: 0 0 0.75rem;
}

.docs-sidebar nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.docs-sidebar nav a {
  display: block;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0 0.4rem 0.75rem;
  margin-left: -2px;
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.docs-sidebar nav a:hover,
.docs-sidebar nav a.active {
  color: var(--accent);
  border-left-color: var(--accent);
}

.docs-content {
  flex: 1;
  min-width: 0;
  padding: 2.5rem 0 4rem 2.5rem;
  border-left: 1px solid var(--border);
}

/* ── Typography ── */
.docs-content section {
  margin-bottom: 1rem;
}

.docs-content h1 {
  font-size: 1.875rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.docs-content h2 {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0 0 1rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

.docs-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
  color: var(--text);
}

.docs-content p {
  font-size: 0.9375rem;
  color: var(--text-muted);
  margin: 0 0 0.875rem;
}

.docs-content p strong {
  color: var(--text);
}

.docs-content .lead {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.docs-content .sub-section {
  margin-bottom: 2.75rem;
}

/* ── Endpoint pill ── */
.endpoint-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.125rem;
  font-family: ui-monospace, "SF Mono", "Fira Code", monospace;
  font-size: 0.875rem;
}

.endpoint-pill .method {
  background: var(--accent);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.125rem 0.5rem;
  border-radius: 4px;
}

/* ── Callouts ── */
.callout {
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1.125rem;
  font-size: 0.875rem;
}

.callout.info {
  background: #eff6ff;
  border-left: 3px solid #2563eb;
}

.callout.warning {
  background: #fefce8;
  border-left: 3px solid #ca8a04;
}

.callout p {
  margin: 0;
  color: var(--text);
}

/* ── Tables ── */
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  margin-bottom: 1.75rem;
}

.docs-content thead th {
  text-align: left;
  padding: 0.5rem 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.docs-content tbody td {
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--border);
  vertical-align: top;
  color: var(--text-muted);
}

.docs-content tbody td:first-child {
  color: var(--text);
}

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

.docs-content code {
  font-family: ui-monospace, "SF Mono", "Fira Code", monospace;
  background: var(--bg-subtle);
  padding: 0.125rem 0.375rem;
  border-radius: 4px;
  font-size: 0.8125rem;
  color: var(--text);
}

.badge {
  display: inline-block;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.0625rem 0.4375rem;
  border-radius: 10px;
}

.badge.req {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.opt {
  background: var(--bg-subtle);
  color: var(--text-light);
}

.sev-info {
  color: #2563eb;
  font-weight: 600;
}

.sev-warning {
  color: #ca8a04;
  font-weight: 600;
}

.sev-error {
  color: #dc2626;
  font-weight: 600;
}

/* ── Code blocks ── */
.code-block {
  position: relative;
  margin-bottom: 1.25rem;
}

.code-block pre {
  background: var(--code-bg);
  color: #e5e7eb;
  border-radius: var(--radius);
  padding: 1.25rem;
  overflow-x: auto;
  font-family: ui-monospace, "SF Mono", "Fira Code", monospace;
  font-size: 0.8125rem;
  line-height: 1.75;
  tab-size: 2;
  margin: 0;
}

.copy-btn {
  position: absolute;
  top: 0.625rem;
  right: 0.625rem;
  background: rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  border: none;
  border-radius: 5px;
  padding: 0.1875rem 0.625rem;
  font-size: 0.75rem;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #e5e7eb;
}

.copy-btn.copied {
  color: #4ade80;
}

/* ── Tabs ── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 0.4375rem 1rem;
  font-size: 0.875rem;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-light);
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

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

.tab-panel {
  display: none;
}

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

/* ── Use-case grid ── */
.use-case-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  list-style: none;
  padding: 0;
}

.use-case-grid li {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 0.5rem 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.use-case-grid li::before {
  content: "→ ";
  color: var(--accent);
  font-weight: 700;
}

@media (min-width: 640px) {
  .use-case-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Status legend ── */
.status-legend {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}

.status-legend li {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.9375rem;
  color: var(--text-muted);
  padding: 0.375rem 0;
}

.status-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.success {
  background: #00c853;
}

.status-dot.warning {
  background: #e67e22;
}

.status-dot.error {
  background: #e74c3c;
}

.status-dot.neutral {
  background: #bdc3c7;
}

.status-dot.missing {
  background: transparent;
  border: 2px solid #e74c3c;
}

/* ── Doc index cards ── */
.docs-index-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.docs-index-list a {
  display: block;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.docs-index-list a:hover {
  border-color: var(--accent);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.docs-index-list a strong {
  display: block;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.docs-index-list a span {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.docs-content ul:not(.use-case-grid):not(.status-legend):not(.docs-index-list) {
  margin: 0 0 1rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.docs-content ul:not(.use-case-grid):not(.status-legend):not(.docs-index-list) li {
  margin-bottom: 0.375rem;
}

/* ── Backup type grid ── */
.backup-type-search {
  width: 100%;
  max-width: 20rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.9375rem;
  font-family: inherit;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}

.backup-type-search:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: var(--accent);
}

.backup-type-count {
  font-size: 0.875rem;
  color: var(--text-light);
  margin: 0 0 1rem;
}

.backup-type-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.backup-type-tag {
  padding: 0.3rem 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 899px) {
  .docs-layout {
    flex-direction: column;
  }

  .docs-sidebar {
    width: 100%;
    height: auto;
    position: static;
    padding: 1.25rem 0 0;
    border-bottom: 1px solid var(--border);
  }

  .docs-sidebar nav ul {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem 1rem;
  }

  .docs-sidebar nav a {
    border-left: none;
    padding-left: 0;
    margin-left: 0;
  }

  .docs-sidebar nav a.active {
    color: var(--accent);
  }

  .docs-content {
    padding: 1.5rem 0 3rem;
    border-left: none;
  }
}
