/* Shared styles for every A1Firewall doc page.
   Used together with nav.js (header + footer) and a per-page sidebar TOC. */

:root {
  --p1: #0E5EFF;
  --p2: #00D4AA;
  --fg: #0f172a;
  --fg2: #334155;
  --muted: #64748B;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --card: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: 'Inter', 'IBM Plex Sans Arabic', system-ui, sans-serif;
  background: var(--bg);
  color: var(--fg2);
  line-height: 1.65;
}
[dir="rtl"] body { font-family: 'IBM Plex Sans Arabic', 'Inter', sans-serif; }
a { color: var(--p1); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Hero ─────────────────────────────────────────── */
.doc-hero {
  background: linear-gradient(135deg, var(--p1) 0%, var(--p2) 100%);
  color: #fff;
  padding: 56px 24px 72px;
  text-align: center;
}
.doc-hero .crumb { font-size: 13px; opacity: .85; letter-spacing: .04em; margin-bottom: 8px; }
.doc-hero .crumb a { color: #fff; opacity: .85; }
.doc-hero .crumb a:hover { opacity: 1; }
.doc-hero h1 { font-size: 40px; font-weight: 800; margin: 0 0 10px; line-height: 1.15; }
.doc-hero p { opacity: .94; font-size: 17px; max-width: 720px; margin: 0 auto; }
.doc-hero .meta {
  margin-top: 18px;
  font-size: 13px;
  display: inline-flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  background: rgba(255,255,255,.14); padding: 8px 18px; border-radius: 999px;
}

/* ─── Layout shell ────────────────────────────────── */
.docs-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 36px;
  max-width: 1320px;
  margin: 0 auto;
  padding: 36px 24px 80px;
}
@media (max-width: 980px) {
  .docs-shell { grid-template-columns: 1fr; }
  .docs-toc { position: static !important; max-height: none !important; }
}

.docs-toc {
  position: sticky;
  top: 88px;
  align-self: start;
  padding: 18px 16px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  font-size: 14px;
}
.docs-toc h3 {
  font-size: 11px;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); font-weight: 700;
  margin: 0 0 12px; padding: 0 8px;
}
.docs-toc a {
  display: block;
  padding: 6px 10px;
  color: var(--fg2);
  border-radius: 6px;
  transition: background .15s, color .15s;
  line-height: 1.45;
}
.docs-toc a:hover { background: #f1f5f9; color: var(--p1); text-decoration: none; }
.docs-toc a.active { background: #eff6ff; color: var(--p1); font-weight: 600; }
.docs-toc a.lvl-2 { padding-left: 22px; font-size: 13px; opacity: .9; }
[dir="rtl"] .docs-toc a.lvl-2 { padding-left: 10px; padding-right: 22px; }

.docs-main {
  background: var(--card);
  border-radius: 16px;
  padding: 48px 56px;
  border: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  min-width: 0;
}
@media (max-width: 720px) { .docs-main { padding: 32px 24px; } }

.docs-main > section { padding-top: 16px; margin-bottom: 48px; scroll-margin-top: 80px; }
.docs-main > section:first-child { padding-top: 0; }
.docs-main > section + section { border-top: 1px solid var(--line); padding-top: 48px; }

/* ─── Typography ───────────────────────────────────── */
.docs-main h1 { font-size: 30px; font-weight: 800; color: var(--fg); margin: 0 0 8px; line-height: 1.2; }
.docs-main h2 { font-size: 22px; font-weight: 700; color: var(--fg); margin: 32px 0 14px; line-height: 1.3; }
.docs-main h3 { font-size: 17px; font-weight: 700; color: var(--fg); margin: 24px 0 10px; }
.docs-main h4 { font-size: 15px; font-weight: 700; color: var(--fg); margin: 18px 0 8px; }
.docs-main p { margin: 0 0 14px; color: var(--fg2); font-size: 15px; line-height: 1.75; }
.docs-main .lede { color: var(--muted); font-size: 17px; line-height: 1.65; margin: 0 0 24px; }
.docs-main ul, .docs-main ol { margin: 0 0 16px; padding-left: 24px; line-height: 1.85; font-size: 15px; }
[dir="rtl"] .docs-main ul, [dir="rtl"] .docs-main ol { padding-left: 0; padding-right: 24px; }
.docs-main li { margin-bottom: 4px; color: var(--fg2); }
.docs-main strong { color: var(--fg); font-weight: 700; }

/* anchor links beside headings */
.docs-main h2, .docs-main h3 { position: relative; }
.docs-main h2 .anchor, .docs-main h3 .anchor {
  position: absolute; right: 100%; padding-right: 10px;
  color: var(--muted); opacity: 0; font-weight: 400; font-size: .85em;
}
.docs-main h2:hover .anchor, .docs-main h3:hover .anchor { opacity: 1; }

/* ─── Code ────────────────────────────────────────── */
.docs-main code {
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  background: #f1f5f9;
  color: var(--fg);
  padding: 2px 6px;
  border-radius: 4px;
  word-break: break-word;
}
.docs-main pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 18px 22px;
  border-radius: 10px;
  overflow-x: auto;
  margin: 14px 0;
  font-size: 13px;
  line-height: 1.65;
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
}
.docs-main pre code { background: transparent; color: inherit; padding: 0; font-size: inherit; border-radius: 0; }
.docs-main pre.has-lang { padding-top: 38px; position: relative; }
.docs-main pre .lang-tag {
  position: absolute; top: 10px; right: 16px;
  font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
}

/* terminal chrome */
.terminal {
  background: #0f172a; border-radius: 10px; overflow: hidden; margin: 14px 0;
  border: 1px solid #1e293b;
}
.terminal .bar {
  display: flex; align-items: center; gap: 6px;
  background: #1e293b; padding: 8px 14px; font-size: 11px; color: #94a3b8;
}
.terminal .bar .dot { width: 11px; height: 11px; border-radius: 50%; background: #475569; }
.terminal .bar .dot.r { background: #ef4444; } .terminal .bar .dot.y { background: #f59e0b; } .terminal .bar .dot.g { background: #22c55e; }
.terminal .bar .ttl { margin-inline-start: 10px; }
.terminal pre { margin: 0; border-radius: 0; }

/* ─── Tables ──────────────────────────────────────── */
.docs-main table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 14px; }
.docs-main th, .docs-main td { text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
[dir="rtl"] .docs-main th, [dir="rtl"] .docs-main td { text-align: right; }
.docs-main th { background: #f8fafc; color: var(--muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.docs-main tbody tr:hover { background: #f8fafc; }
.docs-main td code { font-size: 12.5px; }

/* ─── Callouts ────────────────────────────────────── */
.callout {
  padding: 14px 18px;
  border-radius: 10px;
  margin: 16px 0;
  font-size: 14px;
  border-inline-start: 4px solid;
  line-height: 1.6;
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { display: block; margin-bottom: 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; }
.callout.info  { background: #eff6ff; border-color: #3b82f6; color: #1e3a8a; }
.callout.warn  { background: #fef3c7; border-color: #f59e0b; color: #78350f; }
.callout.tip   { background: #f0fdf4; border-color: #22c55e; color: #14532d; }
.callout.danger{ background: #fef2f2; border-color: #ef4444; color: #7f1d1d; }
.callout.note  { background: #f5f3ff; border-color: #8b5cf6; color: #4c1d95; }

/* ─── Badges ──────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 12px;
}
.badge.guide { background: #eff6ff; color: #1d4ed8; }
.badge.arch  { background: #f0fdf4; color: #166534; }
.badge.ref   { background: #fef3c7; color: #92400e; }
.badge.cli   { background: #f3e8ff; color: #6b21a8; }
.badge.hw    { background: #fce7f3; color: #9d174d; }
.badge.comp  { background: #ecfeff; color: #155e75; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.tag.get  { background: #ecfdf5; color: #047857; }
.tag.post { background: #eff6ff; color: #1d4ed8; }
.tag.put  { background: #fef3c7; color: #92400e; }
.tag.del  { background: #fef2f2; color: #b91c1c; }
.tag.ws   { background: #f3e8ff; color: #6b21a8; }

/* ─── Step list ───────────────────────────────────── */
.step-list { counter-reset: step; list-style: none; padding: 0; margin: 16px 0 24px; }
.step-list > li {
  counter-increment: step;
  position: relative;
  padding: 18px 0 18px 56px;
  border-bottom: 1px solid var(--line);
}
.step-list > li:last-child { border-bottom: none; }
.step-list > li::before {
  content: counter(step);
  position: absolute; left: 0; top: 16px;
  width: 36px; height: 36px;
  background: linear-gradient(135deg, var(--p1), var(--p2));
  color: #fff; border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700; font-size: 15px;
}
[dir="rtl"] .step-list > li { padding: 18px 56px 18px 0; }
[dir="rtl"] .step-list > li::before { left: auto; right: 0; }
.step-list h3 { margin: 0 0 8px; font-size: 17px; }

/* ─── ASCII diagram blocks ────────────────────────── */
.diagram {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px 22px;
  margin: 18px 0;
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg);
  white-space: pre;
  overflow-x: auto;
}

/* ─── Method/endpoint signature ───────────────────── */
.endpoint {
  background: #0f172a; color: #e2e8f0;
  padding: 14px 18px; border-radius: 10px;
  margin: 14px 0;
  font-family: 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 14px;
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap;
}
.endpoint .method {
  padding: 3px 10px; border-radius: 5px; font-weight: 700;
  font-size: 12px; letter-spacing: .04em;
}
.endpoint .method.get  { background: #047857; color: #fff; }
.endpoint .method.post { background: #1d4ed8; color: #fff; }
.endpoint .method.put  { background: #92400e; color: #fff; }
.endpoint .method.del  { background: #b91c1c; color: #fff; }
.endpoint .method.ws   { background: #6b21a8; color: #fff; }
.endpoint .path { color: #fbbf24; }

/* ─── Property table for JSON schemas ─────────────── */
.props { font-size: 13.5px; }
.props th:nth-child(1), .props td:nth-child(1) { width: 22%; font-family: 'JetBrains Mono', monospace; }
.props th:nth-child(2), .props td:nth-child(2) { width: 14%; color: var(--muted); }
.props th:nth-child(3), .props td:nth-child(3) { width: 12%; }

.req-yes { color: #b91c1c; font-weight: 700; font-size: 12px; }
.req-no  { color: var(--muted); font-size: 12px; }

/* ─── KBD keys ────────────────────────────────────── */
kbd {
  background: #f1f5f9; border: 1px solid #cbd5e1; border-bottom-width: 2px;
  border-radius: 4px; padding: 1px 6px; font-family: 'JetBrains Mono', monospace;
  font-size: 12px; color: var(--fg);
}

/* ─── Card grid (used on docs.html index) ─────────── */
.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 22px; margin: 30px 0; }
.doc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 28px 26px;
  transition: transform .2s, box-shadow .2s, border-color .2s;
  display: flex; flex-direction: column;
}
.doc-card:hover { transform: translateY(-3px); border-color: var(--p1); box-shadow: 0 16px 36px rgba(14,94,255,0.08); }
.doc-card h3 { margin: 8px 0 6px; font-size: 19px; color: var(--fg); }
.doc-card p { color: var(--muted); font-size: 14px; flex: 1; line-height: 1.6; }
.doc-card a.cta { color: var(--p1); font-weight: 700; font-size: 14px; text-decoration: none; margin-top: 14px; display: inline-flex; align-items: center; gap: 6px; }
.doc-card a.cta::after { content: "→"; }

/* ─── Misc ─────────────────────────────────────────── */
.docs-main hr { border: 0; border-top: 1px solid var(--line); margin: 32px 0; }
.docs-main blockquote {
  border-inline-start: 4px solid var(--p1);
  background: #eff6ff;
  padding: 14px 18px;
  border-radius: 0 10px 10px 0;
  margin: 18px 0;
  color: #1e3a8a;
  font-style: italic;
}
[dir="rtl"] .docs-main blockquote { border-radius: 10px 0 0 10px; }
.docs-main .small { font-size: 12.5px; color: var(--muted); }
