/* ═══════════════════════════════════════════════════════════
   MailFlow Docs — docs.css
   Extends style.css (must be loaded after it)
   ═══════════════════════════════════════════════════════════ */

/* ── Sticky sidebar fix ───────────────────────────────────── */
/* style.css sets overflow-x: hidden on html/body, which creates a scroll
   container and silently breaks position: sticky on any descendant.
   overflow-x: clip clips identically but does NOT create a scroll container,
   so sticky works correctly. This override is safe — docs.html has no orbs
   or other elements that need horizontal clipping via a scroll container. */
html, body { overflow-x: clip; }

/* ── Reading progress bar ─────────────────────────────────── */
.read-progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent-light) 60%, #c4b8ff 100%);
  z-index: 200;
  transition: width 0.1s linear;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Docs hero ────────────────────────────────────────────── */
.docs-hero {
  position: relative;
  padding: 140px 0 80px;
  text-align: center;
  overflow: hidden;
  border-bottom: 1px solid var(--border);
}

.docs-hero::before {
  content: '';
  position: absolute;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 900px; height: 600px;
  background: radial-gradient(ellipse, rgba(124,106,247,0.14) 0%, transparent 70%);
  pointer-events: none;
}

.docs-hero .section-tag {
  opacity: 0;
  animation: docsFadeUp 0.55s ease 0.05s forwards;
}
.docs-hero h1 {
  margin: 16px 0 18px;
  opacity: 0;
  animation: docsFadeUp 0.55s ease 0.15s forwards;
}
.docs-hero > .container > .docs-hero-sub {
  font-size: 1.1rem;
  color: var(--text-3);
  max-width: 520px;
  margin: 0 auto 52px;
  opacity: 0;
  animation: docsFadeUp 0.55s ease 0.25s forwards;
}

.docs-hero-cards {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

.docs-hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  text-align: left;
  cursor: pointer;
  transition: all 0.22s ease;
  opacity: 0;
  min-width: 230px;
}
.docs-hero-card:nth-child(1) { animation: docsFadeUp 0.55s ease 0.32s forwards; }
.docs-hero-card:nth-child(2) { animation: docsFadeUp 0.55s ease 0.42s forwards; }
.docs-hero-card:nth-child(3) { animation: docsFadeUp 0.55s ease 0.52s forwards; }

.docs-hero-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-card), 0 0 0 1px var(--border-accent);
}

.docs-hero-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: rgba(124,106,247,0.12);
  border: 1px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}

.docs-hero-card-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 3px;
}
.docs-hero-card-desc {
  font-size: 12.5px;
  color: var(--text-3);
}

@keyframes docsFadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Docs layout wrapper ──────────────────────────────────── */
.docs-wrap {
  display: flex;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 48px);
  align-items: flex-start;
  gap: 0;
}

/* ── Sidebar ──────────────────────────────────────────────── */
.docs-sidebar {
  width: 248px;
  flex-shrink: 0;
  position: sticky;
  top: var(--nav-height);
  height: calc(100vh - var(--nav-height));
  overflow-y: auto;
  padding: 40px 0 40px;
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: rgba(124,106,247,0.2) transparent;
}
.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-thumb { background: rgba(124,106,247,0.25); border-radius: 4px; }

.sidebar-nav { padding-right: 24px; }

.sidebar-group {
  margin-bottom: 32px;
}

.sidebar-group-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 8px;
  padding: 0 2px;
}
.sidebar-group-icon {
  display: flex;
  color: var(--accent-light);
}

.sidebar-group ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.sidebar-link {
  display: block;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-3);
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
  border-left: 2px solid transparent;
  line-height: 1.4;
}
.sidebar-link:hover {
  color: var(--text-2);
  background: rgba(255,255,255,0.04);
}
.sidebar-link.active {
  color: var(--accent-light);
  background: rgba(124,106,247,0.08);
  border-left-color: var(--accent);
}

.sidebar-sub .sidebar-link {
  padding-left: 22px;
  font-size: 12.5px;
}

/* ── Mobile sidebar toggle ────────────────────────────────── */
.docs-mobile-nav-toggle {
  display: none;
  width: 100%;
  padding: 12px 16px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin: 20px 0 0;
  align-items: center;
  gap: 8px;
  transition: all 0.15s;
}
.docs-mobile-nav-toggle:hover {
  background: var(--bg-3);
  border-color: var(--border-accent);
  color: var(--text-1);
}
.docs-mobile-nav-toggle svg { transition: transform 0.25s; }
.docs-mobile-nav-toggle.open svg { transform: rotate(180deg); }

.docs-mobile-sidebar {
  display: none;
  background: var(--bg-1);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 24px;
}
.docs-mobile-sidebar.open { display: block; }

/* ── Main content area ────────────────────────────────────── */
.docs-content {
  flex: 1;
  min-width: 0;
  padding: 48px 0 100px 56px;
}

/* Section anchors account for fixed nav */
.docs-content h2[id],
.docs-content h3[id] {
  scroll-margin-top: calc(var(--nav-height) + 28px);
}

/* ── Docs section headers ─────────────────────────────────── */
.docs-section-marker {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
  padding: 20px 24px;
  background: linear-gradient(135deg, rgba(124,106,247,0.08) 0%, transparent 60%);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
}
.docs-section-marker-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  background: rgba(124,106,247,0.15);
  border: 1px solid var(--border-accent);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent-light);
  flex-shrink: 0;
}
.docs-section-marker-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-light);
  margin-bottom: 2px;
}
.docs-section-marker-title {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-1);
}

.docs-h2 {
  font-family: 'Syne', sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--text-1);
  margin: 48px 0 12px;
  padding-top: 4px;
}
.docs-h2:first-of-type { margin-top: 0; }

.docs-h3 {
  font-family: 'Syne', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-1);
  margin: 32px 0 10px;
}

.docs-p {
  color: var(--text-2);
  line-height: 1.75;
  margin-bottom: 16px;
}
.docs-p:last-child { margin-bottom: 0; }

.docs-divider {
  height: 1px;
  background: linear-gradient(90deg, var(--border-accent), transparent 60%);
  margin: 52px 0;
  border: none;
}

/* ── Code blocks ──────────────────────────────────────────── */
.docs-code {
  background: rgba(6, 6, 15, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin: 20px 0;
  box-shadow: var(--shadow-card);
}
.docs-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
}
.docs-code-dots {
  display: flex;
  gap: 6px;
}
.docs-code-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
}
.docs-code-dot:nth-child(1) { background: #ff5f57; }
.docs-code-dot:nth-child(2) { background: #ffbd2e; }
.docs-code-dot:nth-child(3) { background: #28ca41; }
.docs-code-lang {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.docs-copy-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: rgba(124,106,247,0.1);
  border: 1px solid var(--border-accent);
  border-radius: 6px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  color: var(--accent-light);
  cursor: pointer;
  transition: all 0.15s;
}
.docs-copy-btn:hover {
  background: rgba(124,106,247,0.2);
  color: #fff;
}
.docs-copy-btn.copied {
  background: rgba(34, 197, 94, 0.15);
  border-color: rgba(34, 197, 94, 0.3);
  color: var(--green);
}
.docs-code pre {
  padding: 20px 20px;
  overflow-x: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--text-2);
  margin: 0;
}
.docs-code pre .cm { color: var(--text-3); font-style: italic; }     /* comments */
.docs-code pre .kw { color: var(--accent-light); }                    /* keywords */
.docs-code pre .st { color: #86efac; }                                /* strings */
.docs-code pre .nm { color: #93c5fd; }                                /* names/vars */
.docs-code pre .op { color: var(--text-3); }                          /* operators */

/* ── Inline code ──────────────────────────────────────────── */
.docs-inline-code {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.85em;
  background: rgba(124,106,247,0.1);
  color: var(--accent-light);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(124,106,247,0.2);
}

/* ── Callout boxes ────────────────────────────────────────── */
.docs-callout {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  border-radius: var(--radius);
  margin: 20px 0;
  border: 1px solid;
  transition: box-shadow 0.2s ease;
}
.docs-callout:hover {
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}
.docs-callout-icon {
  flex-shrink: 0;
  width: 20px; height: 20px;
  margin-top: 1px;
}
.docs-callout-body { flex: 1; }
.docs-callout-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}
.docs-callout p {
  font-size: 13.5px;
  line-height: 1.65;
  margin: 0;
}

.docs-callout-info {
  background: rgba(124,106,247,0.07);
  border-color: rgba(124,106,247,0.25);
}
.docs-callout-info .docs-callout-icon { color: var(--accent-light); }
.docs-callout-info .docs-callout-title { color: var(--accent-light); }
.docs-callout-info p { color: var(--text-2); }

.docs-callout-tip {
  background: rgba(34,197,94,0.07);
  border-color: rgba(34,197,94,0.25);
}
.docs-callout-tip .docs-callout-icon { color: var(--green); }
.docs-callout-tip .docs-callout-title { color: var(--green); }
.docs-callout-tip p { color: var(--text-2); }

.docs-callout-warn {
  background: rgba(245,158,11,0.07);
  border-color: rgba(245,158,11,0.25);
}
.docs-callout-warn .docs-callout-icon { color: var(--yellow); }
.docs-callout-warn .docs-callout-title { color: var(--yellow); }
.docs-callout-warn p { color: var(--text-2); }

/* ── Step list ────────────────────────────────────────────── */
.docs-steps {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 24px 0;
}
.docs-step {
  display: flex;
  gap: 18px;
  align-items: flex-start;
}
.docs-step-num {
  flex-shrink: 0;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-light) 100%);
  color: #fff;
  font-family: 'Syne', sans-serif;
  font-size: 13px;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 12px var(--accent-glow);
  margin-top: 1px;
}
.docs-step-body { flex: 1; }
.docs-step-body h4 {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}
.docs-step-body p {
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.65;
  margin: 0;
}

/* ── Deployment scenario tabs ─────────────────────────────── */
.scenario-tabs {
  display: flex;
  gap: 4px;
  margin: 24px 0 0;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}
.scenario-tab {
  padding: 9px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.18s ease;
  margin-bottom: -1px;
  border-radius: 0;
  white-space: nowrap;
}
.scenario-tab:hover { color: var(--text-2); }
.scenario-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}

.scenario-panels { margin-top: 0; }
.scenario-panel {
  display: none;
  padding: 28px 0 0;
  animation: tabFadeIn 0.25s ease;
}
.scenario-panel.active { display: block; }

@keyframes tabFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Architecture diagram ─────────────────────────────────── */
.arch-diagram {
  background: rgba(6,6,15,0.7);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin: 16px 0;
  overflow-x: auto;
}
.arch-diagram pre {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  line-height: 1.8;
  color: var(--text-2);
  margin: 0;
  white-space: pre;
}
.arch-diagram pre .arch-accent { color: var(--accent-light); }
.arch-diagram pre .arch-dim { color: var(--text-3); }

/* ── Proxy config examples ────────────────────────────────── */
.proxy-examples { margin: 16px 0; }
.proxy-example-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.proxy-example-tab {
  padding: 7px 14px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-bottom: -1px;
}
.proxy-example-tab:hover { color: var(--text-2); }
.proxy-example-tab.active {
  color: var(--accent-light);
  border-bottom-color: var(--accent);
}
.proxy-example-panels .proxy-example-panel {
  display: none;
}
.proxy-example-panels .proxy-example-panel.active {
  display: block;
  animation: tabFadeIn 0.2s ease;
}

/* ── Provider cards ───────────────────────────────────────── */
.provider-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.provider-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px;
  transition: all 0.2s ease;
}
.provider-card:hover {
  border-color: var(--border-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.provider-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.provider-icon {
  width: 36px; height: 36px;
  border-radius: 9px;
  background: rgba(124,106,247,0.1);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
.provider-name {
  font-family: 'Syne', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-1);
}

/* ── Settings table (provider details) ───────────────────── */
.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.settings-table tr {
  border-bottom: 1px solid var(--border);
}
.settings-table tr:last-child { border-bottom: none; }
.settings-table td {
  padding: 6px 0;
  vertical-align: top;
}
.settings-table td:first-child {
  color: var(--text-3);
  width: 90px;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding-right: 12px;
  padding-top: 8px;
}
.settings-table td:last-child {
  font-family: 'JetBrains Mono', monospace;
  color: var(--text-2);
  font-size: 12px;
}

/* ── Env vars reference table ─────────────────────────────── */
.docs-table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.docs-table th {
  padding: 12px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  background: rgba(255,255,255,0.03);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.docs-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.5;
  color: var(--text-2);
}
.docs-table tr:last-child td { border-bottom: none; }
.docs-table tr:hover td { background: rgba(255,255,255,0.015); }
.docs-table td:first-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-light);
  white-space: nowrap;
}
.docs-table .badge-req {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(239,68,68,0.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,0.25);
}
.docs-table .badge-opt {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(90,90,128,0.25);
  color: var(--text-3);
  border: 1px solid rgba(90,90,128,0.3);
}

/* ── Command reference table ──────────────────────────────── */
.cmd-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}
.cmd-table tr {
  border-bottom: 1px solid var(--border);
}
.cmd-table tr:last-child { border-bottom: none; }
.cmd-table td {
  padding: 12px 16px;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.5;
}
.cmd-table td:first-child {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--accent-light);
  white-space: nowrap;
  width: 50%;
}
.cmd-table td:last-child { color: var(--text-3); }

/* ── Feature checklist ────────────────────────────────────── */
.docs-checklist {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 16px 0;
}
.docs-checklist li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-2);
  line-height: 1.5;
}
.docs-checklist-icon {
  flex-shrink: 0;
  color: var(--green);
  margin-top: 2px;
}
.docs-checklist strong { color: var(--text-1); }

/* ── Keyboard shortcut pill ───────────────────────────────── */
.kbd {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  background: var(--bg-3);
  border: 1px solid rgba(255,255,255,0.15);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 7px;
  color: var(--text-2);
  line-height: 1.6;
}

/* ── Quick-ref card row ───────────────────────────────────── */
.docs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin: 20px 0;
}
.docs-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: all 0.18s ease;
}
.docs-card:hover {
  border-color: var(--border-accent);
  background: var(--bg-3);
}
.docs-card-icon {
  color: var(--accent-light);
  margin-bottom: 10px;
}
.docs-card h4 {
  font-family: 'Syne', sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 6px;
}
.docs-card p {
  font-size: 12.5px;
  color: var(--text-3);
  line-height: 1.55;
  margin: 0;
}

/* ── Section separator ────────────────────────────────────── */
.docs-section-sep {
  margin: 80px 0 56px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.docs-section-sep-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-accent), transparent);
}
.docs-section-sep-line:last-child {
  background: linear-gradient(270deg, var(--border-accent), transparent);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1024px) {
  .docs-wrap {
    flex-direction: column;
  }
  .docs-sidebar {
    display: none; /* hidden; mobile nav shows instead */
  }
  .docs-mobile-nav-toggle { display: flex; }
  .docs-content {
    padding: 24px 0 80px;
  }
  .docs-hero-card { min-width: 0; flex: 1 1 200px; }
}

@media (max-width: 768px) {
  .docs-hero { padding: 110px 0 60px; }
  .docs-hero h1 { font-size: clamp(1.8rem, 6vw, 2.6rem); }
  .docs-hero-cards { flex-direction: column; }
  .docs-hero-card { flex-direction: row; }
  .scenario-tabs { overflow-x: auto; }
  .provider-grid { grid-template-columns: 1fr; }
  .docs-card-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .docs-h2 { font-size: 1.3rem; }
  .docs-code pre { font-size: 11.5px; }
  .docs-table td, .docs-table th { padding: 10px 12px; }
}
