/* ==========================================================================
   GarudaShield — Documentation
   ========================================================================== */

:root {
  --bg: #0a0e14;
  --bg-soft: #0d131c;
  --bg-elev: #111826;
  --surface: rgba(255, 255, 255, 0.03);
  --surface-hover: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);

  --text: #e9edf4;
  --muted: #97a1b3;
  --muted-2: #6b7587;

  --accent: #f5a524;
  --accent-soft: rgba(245, 165, 36, 0.12);
  --accent-glow: rgba(245, 165, 36, 0.35);

  --green: #3ecf8e;
  --wa: #25d366;

  --font-head: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  --radius: 12px;
  --radius-lg: 18px;
  --maxw: 1240px;
  --nav-h: 68px;
}

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

html { scroll-behavior: smooth; }

[id] { scroll-margin-top: calc(var(--nav-h) + 18px); }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: var(--accent-soft); color: var(--accent); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

a { color: inherit; text-decoration: none; }
img, svg { display: block; }
code { font-family: var(--font-mono); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: 24px;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.88rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
  white-space: nowrap;
  font-family: var(--font-body);
}
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 8px 15px; font-size: 0.84rem; }
.btn-wa {
  background: var(--wa);
  color: #05201a;
  box-shadow: 0 0 0 1px rgba(37, 211, 102, 0.4), 0 8px 24px -8px rgba(37, 211, 102, 0.35);
}
.btn-wa:hover { background: #2ee06f; transform: translateY(-1px); }
.wa-ico { width: 16px; height: 16px; flex-shrink: 0; }

/* ===== Scroll progress ===== */
.scroll-progress {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0;
  z-index: 300;
  background: linear-gradient(90deg, var(--accent), #ffb73d);
  box-shadow: 0 0 10px var(--accent-glow);
}

/* ===== Navbar ===== */
.nav {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background 0.25s ease, border-color 0.25s ease, backdrop-filter 0.25s ease;
  border-bottom: 1px solid transparent;
}
.nav.scrolled {
  background: rgba(10, 14, 20, 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-color: var(--border);
}
.nav-inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
.brand-mark { width: 32px; height: 32px; color: var(--accent); }
.brand-accent { color: var(--accent); }
.brand-badge {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(245, 165, 36, 0.3);
  padding: 3px 8px;
  border-radius: 6px;
  margin-left: 4px;
}
.nav-links { display: flex; align-items: center; gap: 26px; }
.nav-links a { font-size: 0.9rem; color: var(--muted); transition: color 0.15s ease; }
.nav-links a:hover { color: var(--text); }

/* ===== Layout ===== */
.docs-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 56px;
  padding-top: calc(var(--nav-h) + 48px);
  padding-bottom: 96px;
}

/* ===== Sidebar ===== */
.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 48px);
  overflow-y: auto;
  padding-right: 8px;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 3px; }

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 18px;
}
.sidebar-search svg { width: 16px; height: 16px; color: var(--muted-2); flex-shrink: 0; }
.sidebar-search input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.86rem;
}
.sidebar-search input::placeholder { color: var(--muted-2); }
.sidebar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.sidebar-nav a:hover { color: var(--text); background: var(--surface); }
.sidebar-nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.sidebar-nav a.filtered-out { display: none; }
.nav-no {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted-2);
  width: 22px;
  flex-shrink: 0;
}
.sidebar-nav a.active .nav-no { color: var(--accent); }
.sidebar-empty {
  display: none;
  padding: 14px 8px;
  font-size: 0.85rem;
  color: var(--muted-2);
}
.sidebar-empty.show { display: block; }

/* ===== Content ===== */
.docs-content {
  min-width: 0;
  max-width: 780px;
}
.doc-section { padding-bottom: 72px; border-bottom: 1px solid var(--border); margin-bottom: 64px; }
.doc-section:last-child { border-bottom: 0; margin-bottom: 0; }

.section-tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(245, 165, 36, 0.25);
  padding: 5px 11px;
  border-radius: 6px;
  margin-bottom: 18px;
}

.docs-content h1 {
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 14px;
}
.lead { font-size: 1.05rem; color: var(--muted); max-width: 65ch; }

.docs-content h2 {
  font-family: var(--font-head);
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 40px 0 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.docs-content h3 { font-family: var(--font-head); font-size: 1.08rem; margin: 26px 0 10px; }
.docs-content p { color: var(--muted); margin: 0 0 16px; max-width: 70ch; }
.docs-content strong { color: var(--text); }
.docs-content code {
  font-size: 0.86em;
  background: rgba(245, 165, 36, 0.1);
  color: #ffd28a;
  border: 1px solid rgba(245, 165, 36, 0.2);
  padding: 2px 6px;
  border-radius: 5px;
  white-space: nowrap;
}

.docs-content ul, .docs-content ol {
  margin: 0 0 18px;
  padding-left: 22px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 70ch;
}
.docs-content li strong { color: var(--text); }
.docs-content li::marker { color: var(--accent); }

/* ===== Callout ===== */
.callout {
  display: flex;
  gap: 14px;
  padding: 18px 22px;
  border-radius: var(--radius);
  border: 1px solid rgba(245, 165, 36, 0.28);
  background: linear-gradient(180deg, rgba(245, 165, 36, 0.07), transparent);
  margin: 22px 0;
}
.callout p { margin: 0; font-size: 0.95rem; }

/* ===== Code ===== */
.code {
  position: relative;
  margin: 18px 0 22px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: #0d1117;
  overflow: hidden;
}
.code code {
  display: block;
  padding: 18px 20px;
  font-size: 0.83rem;
  line-height: 1.7;
  color: #c9d1d9;
  background: transparent;
  border: 0;
  white-space: pre;
  overflow-x: auto;
}
.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.copy-btn:hover { color: var(--accent); border-color: var(--accent); }
.copy-btn.copied { color: var(--green); border-color: rgba(62, 207, 142, 0.5); }

/* ===== Table ===== */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 18px 0 24px;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
th, td {
  text-align: left;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--font-head);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
}
tr:last-child td { border-bottom: 0; }
td { color: var(--muted); }
td:first-child { color: var(--text); white-space: nowrap; }
tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* ===== Steps ===== */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 24px 0 28px;
}
.step {
  position: relative;
  padding: 26px 22px 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.step:hover { transform: translateY(-3px); border-color: rgba(245, 165, 36, 0.35); }
.step-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 12px;
}
.step h3 { font-family: var(--font-head); font-size: 1.02rem; margin-bottom: 8px; }
.step p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.step code { font-size: 0.85em; }

/* ===== API cards ===== */
.api-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin: 18px 0 26px;
}
.api-card {
  padding: 20px 22px;
  border: 1px solid rgba(37, 211, 102, 0.25);
  border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(37, 211, 102, 0.06), var(--surface) 60%);
}
.api-card h3 { font-family: var(--font-head); font-size: 1rem; margin: 0 0 8px; color: var(--wa); }
.api-card p { color: var(--muted); font-size: 0.9rem; margin: 0; }

/* ===== FAQ ===== */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  margin-bottom: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 0fr);
  transition: border-color 0.18s ease, grid-template-rows 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.faq-item:hover { border-color: var(--border-strong); }
.faq-item[open] { border-color: rgba(245, 165, 36, 0.35); grid-template-rows: auto minmax(0, 1fr); }
.faq-body { min-height: 0; overflow: hidden; }
.faq-item summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  font-weight: 600;
  font-size: 0.98rem;
  user-select: none;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: "+";
  flex-shrink: 0;
  width: 26px; height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 1.1rem;
  font-weight: 400;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(245, 165, 36, 0.3);
}
.faq-item[open] summary { color: var(--accent); }
.faq-body p { padding: 0 22px 20px; color: var(--muted); font-size: 0.93rem; max-width: 70ch; }

/* ===== Support ===== */
.support-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 22px;
}
.support-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.support-card:hover {
  transform: translateY(-3px);
  border-color: rgba(245, 165, 36, 0.4);
  box-shadow: 0 18px 40px -26px var(--accent-glow);
}
.support-card h3 { font-family: var(--font-head); font-size: 1.02rem; }
.support-card p { color: var(--muted); font-size: 0.9rem; margin: 0; }
.support-card > span { color: var(--accent); font-size: 0.82rem; font-weight: 600; margin-top: 6px; }

/* ===== Footer ===== */
.footer {
  padding: 40px 0;
  border-top: 1px solid var(--border);
  background: var(--bg);
}
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-inner p { color: var(--muted-2); font-size: 0.84rem; }
.footer-links { display: flex; gap: 22px; flex-wrap: wrap; }
.footer-links a { color: var(--muted-2); font-size: 0.84rem; transition: color 0.15s ease; }
.footer-links a:hover { color: var(--accent); }

/* ===== Back to top ===== */
.to-top {
  position: fixed;
  right: 22px;
  bottom: calc(22px + env(safe-area-inset-bottom));
  z-index: 200;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: rgba(17, 24, 38, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, color 0.2s ease, border-color 0.2s ease;
}
.to-top svg { width: 18px; height: 18px; }
.to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }
.to-top:hover { color: var(--accent); border-color: var(--accent); }

/* ===== Reveal ===== */
.js .doc-section { opacity: 0; transform: translateY(18px); transition: opacity 0.6s cubic-bezier(0.16, 1, 0.3, 1), transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.js .doc-section.in { opacity: 1; transform: translateY(0); }

/* ===== Responsive ===== */
@media (max-width: 1024px) {
  .docs-layout { grid-template-columns: 220px minmax(0, 1fr); gap: 36px; }
}

@media (max-width: 880px) {
  .docs-layout { grid-template-columns: 1fr; gap: 28px; padding-top: calc(var(--nav-h) + 28px); }
  .sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
  }
  .sidebar-search { margin-bottom: 0; }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
  .sidebar-nav a {
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 6px 13px;
    font-size: 0.82rem;
  }
  .sidebar-nav a .nav-no { display: none; }
  .sidebar-nav a.active { border-color: var(--accent); }
  .steps { grid-template-columns: 1fr; }
  .api-cards, .support-grid { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  .nav-links { gap: 16px; }
}

@media (max-width: 600px) {
  .nav-links { display: none; }
  .nav-actions .btn-wa {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 0;
    border-radius: 10px;
  }
  .container { padding-inline: 18px; }
  .docs-content h1 { font-size: 1.7rem; }
  .doc-section { padding-bottom: 52px; margin-bottom: 48px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .doc-section { opacity: 1; transform: none; transition: none; }
  .js .doc-section.in { opacity: 1; transform: none; }
}

/* ===== v2 professional docs ===== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3346; border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a4f6f; }
::-webkit-scrollbar-corner { background: var(--bg); }
html { scrollbar-width: thin; scrollbar-color: #2a3346 var(--bg); }

/* Heading anchor links */
.head-link {
  font-size: 0.8em;
  color: var(--muted-2);
  opacity: 0;
  margin-left: 8px;
  text-decoration: none;
  transition: opacity 0.15s ease, color 0.15s ease;
}
h2:hover .head-link, h3:hover .head-link, .head-link:focus-visible { opacity: 1; }
.head-link:hover { color: var(--accent); }

/* On-this-page TOC */
.page-toc {
  margin: 26px 0 32px;
  padding: 18px 22px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: var(--surface);
}
.page-toc-title {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.page-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.page-toc a {
  display: block;
  font-size: 0.9rem;
  color: var(--muted);
  padding: 5px 10px;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.page-toc a:hover { color: var(--text); background: var(--surface-hover); }
.page-toc a.active { color: var(--accent); border-left-color: var(--accent); background: var(--accent-soft); }

/* Search result count */
.search-count {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted-2);
  margin: -6px 2px 16px;
}
.search-count.show { display: block; }

/* Prev / Next section navigation */
.section-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-top: 36px;
  padding-top: 26px;
  border-top: 1px solid var(--border);
}
.section-nav-link {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 0 1 auto;
  max-width: 48%;
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.18s ease, transform 0.18s ease, background 0.18s ease;
}
.section-nav-link:hover { border-color: rgba(245, 165, 36, 0.4); transform: translateY(-2px); background: var(--surface-hover); }
.section-nav-link .nav-kicker {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted-2);
}
.section-nav-link .nav-title { font-weight: 600; color: var(--text); font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.section-nav-link.next { margin-left: auto; text-align: right; }
.section-nav-link.only { margin-inline: auto; }
.section-nav-link .nav-kicker.next-kick { display: inline-block; }

/* Print-friendly */
@media print {
  .nav, .sidebar, .to-top, .scroll-progress, .section-nav, .page-toc, .copy-btn { display: none !important; }
  .docs-layout { display: block; padding-top: 0; }
  .doc-section { padding-bottom: 24px; border-bottom: 0; }
  body { background: #fff; color: #000; }
  a { color: inherit; }
}
