/* ============================================
   Vision X API Documentation
   Editorial Swiss — warm, authoritative, crafted
   ============================================ */

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

:root {
  --bg: #faf8f4;
  --bg-sidebar: #f1efe9;
  --bg-card: #f4f2ed;
  --bg-code: #1c1c26;
  --bg-code-inline: rgba(0, 0, 0, 0.055);
  --border: #ddd9d0;
  --border-code: rgba(255, 255, 255, 0.06);
  --text: #3a3a3a;
  --text-dim: #84807a;
  --text-bright: #1a1917;
  --accent: #b84a1c;
  --accent-light: rgba(184, 74, 28, 0.07);
  --accent-hover: #9a3d16;
  --method-post-bg: rgba(184, 74, 28, 0.1);
  --method-post-text: #b84a1c;
  --method-get-bg: rgba(39, 119, 73, 0.1);
  --method-get-text: #277749;
  --green: #277749;
  --red: #b83220;
  --yellow: #a06b10;
  --blue: #2a5fa0;
  --sidebar-w: 260px;
  --content-max: 760px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.72;
  border-top: 3px solid var(--accent);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Subtle paper grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.7' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

::selection {
  background: rgba(184, 74, 28, 0.15);
  color: var(--text-bright);
}

/* Selection inside dark code blocks */
.example pre code::selection,
.example pre code *::selection,
.example pre::selection,
code.block::selection {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* ---- SIDEBAR ---- */
.sidebar {
  position: fixed;
  top: 3px;
  left: 0;
  bottom: 0;
  width: var(--sidebar-w);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  padding: 2.25rem 0 2rem;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

.sidebar-logo {
  display: block;
  padding: 0 1.75rem 1.5rem;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-bright);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.sidebar-logo::after {
  content: '';
  display: block;
  margin-top: 1.25rem;
  height: 1px;
  background: var(--border);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 0.75rem 1rem 0;
  gap: 1px;
}

.nav-link {
  display: block;
  padding: 0.475rem 0.875rem;
  border-radius: 6px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.15s, background 0.15s;
  letter-spacing: 0.005em;
}

.nav-link:hover {
  color: var(--text-bright);
  background: rgba(0, 0, 0, 0.035);
}

.nav-link.active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

/* Mobile toggle (injected by nav.js) */
.menu-toggle {
  display: none;
  position: fixed;
  top: calc(3px + 0.875rem);
  left: 0.875rem;
  z-index: 200;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.06);
  transition: background 0.15s;
}

.menu-toggle:hover { background: var(--bg-card); }

.menu-toggle span {
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  position: relative;
  transition: background 0.2s;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: '';
  display: block;
  width: 16px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  position: absolute;
  left: 0;
  transition: transform 0.2s;
}
.menu-toggle span::before { top: -5px; }
.menu-toggle span::after { top: 5px; }

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26, 25, 23, 0.25);
  z-index: 50;
  backdrop-filter: blur(2px);
}

/* ---- CONTENT ---- */
.content {
  margin-left: var(--sidebar-w);
  max-width: var(--content-max);
  padding: 3.5rem 3rem 6rem;
  animation: fadeUp 0.45s ease both;
}

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

/* ---- TYPOGRAPHY ---- */
h1 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.025em;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h2 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-bright);
  letter-spacing: -0.015em;
  line-height: 1.3;
  margin-top: 3rem;
  margin-bottom: 0.875rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

h3 {
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--text-bright);
  margin-top: 1.75rem;
  margin-bottom: 0.5rem;
  letter-spacing: 0.01em;
}

.subtitle {
  font-size: 1.0625rem;
  color: var(--text-dim);
  margin-bottom: 2.5rem;
  line-height: 1.6;
}

p { margin-bottom: 0.875rem; }

ul, ol {
  margin: 0.5rem 0 1.25rem 1.25rem;
}
li { margin-bottom: 0.4rem; }

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.15s;
}
a:hover { color: var(--accent-hover); }

strong {
  font-weight: 600;
  color: var(--text-bright);
}

/* ---- INLINE CODE ---- */
code {
  font-family: 'IBM Plex Mono', 'Fira Code', monospace;
  font-size: 0.8rem;
  background: var(--bg-code-inline);
  padding: 0.15em 0.45em;
  border-radius: 4px;
  color: var(--text-bright);
  font-weight: 500;
}

code.block {
  display: block;
  margin-top: 0.5rem;
  padding: 0.8rem 1rem;
  background: var(--bg-code);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: #c8c8d4;
  overflow-x: auto;
}

/* ---- CODE EXAMPLES ---- */
.example {
  background: var(--bg-code);
  border-radius: 10px;
  margin: 1.25rem 0;
  overflow: hidden;
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.07),
    0 0 0 1px rgba(0, 0, 0, 0.04);
}

.example-header {
  padding: 0.6rem 1.125rem;
  background: rgba(255, 255, 255, 0.035);
  border-bottom: 1px solid var(--border-code);
  font-size: 0.6875rem;
  font-weight: 600;
  color: #8a8a98;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.example pre {
  padding: 1.125rem 1.25rem;
  margin: 0;
  overflow-x: auto;
}

.example pre::-webkit-scrollbar { height: 5px; }
.example pre::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 5px;
}

.example pre code {
  background: none;
  padding: 0;
  font-size: 0.8125rem;
  line-height: 1.65;
  color: #c8c8d4;
  font-weight: 400;
}

/* Response variant */
.example.response {
  box-shadow:
    0 2px 12px rgba(0, 0, 0, 0.07),
    0 0 0 1px rgba(39, 119, 73, 0.18);
}

.example.response .example-header {
  background: rgba(39, 119, 73, 0.06);
  color: #6daa82;
}

/* ---- ENDPOINT BADGE ---- */
.endpoint {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  padding: 0.6rem 1.125rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.endpoint code {
  background: none;
  font-size: 0.9375rem;
  color: var(--text-bright);
  font-weight: 500;
}

.method {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 5px;
  font-size: 0.6875rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
}

.method.post {
  background: var(--method-post-bg);
  color: var(--method-post-text);
}
.method.get {
  background: var(--method-get-bg);
  color: var(--method-get-text);
}

/* ---- TABLES ---- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.875rem;
}

thead { border-bottom: 2px solid var(--border); }

th {
  text-align: left;
  padding: 0.6rem 0.875rem;
  color: var(--text-dim);
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  padding: 0.675rem 0.875rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }

tbody tr {
  transition: background 0.1s;
}
tbody tr:hover {
  background: rgba(0, 0, 0, 0.018);
}

/* ---- INFO & NOTE BOXES ---- */
.info-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  margin: 1.25rem 0;
}

.info-box strong {
  display: block;
  font-size: 0.6875rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.35rem;
}

.note {
  background: var(--accent-light);
  border-left: 3px solid var(--accent);
  padding: 0.9rem 1.125rem;
  border-radius: 0 8px 8px 0;
  margin: 1.25rem 0;
  font-size: 0.875rem;
  line-height: 1.65;
}

/* ---- STATUS COLORS ---- */
.status-pending  { color: var(--blue);   font-weight: 600; }
.status-success  { color: var(--green);  font-weight: 600; }
.status-failed   { color: var(--red);    font-weight: 600; }
.status-expired  { color: var(--yellow); font-weight: 600; }
.status-refunded { color: var(--yellow); font-weight: 600; }

/* ---- PAGE NAV ---- */
.page-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.page-nav a {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--accent);
}
.page-nav a:hover { color: var(--accent-hover); }

.page-nav .prev::before { content: "\2190\00a0"; }
.page-nav .next::after  { content: "\00a0\2192"; }

/* ---- RESPONSIVE ---- */
@media (max-width: 800px) {
  .menu-toggle { display: flex; }

  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.1);
  }

  .sidebar-overlay.visible { display: block; }

  .content {
    margin-left: 0;
    padding: 4.5rem 1.75rem 4rem;
  }
}

@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  h2 { font-size: 1.3rem; }

  .content { padding: 4rem 1.125rem 3rem; }

  .example pre { padding: 0.875rem 1rem; }
  .example pre code { font-size: 0.75rem; }

  table { font-size: 0.8125rem; }
  th, td { padding: 0.5rem 0.625rem; }

  .endpoint {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
}
