/*
 * apidocs.juicefin.com shell styles. Tokens, fonts and shell look are copied from
 * juicefinancial/juice-juicefin4 (lib/theme.ts, app/globals.css, components/shell/*).
 * No CSS reset beyond box-sizing, so tables and lists inside .doc-content keep their semantics.
 */

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("/assets/fonts/JetBrainsMono-latin-wght.woff2") format("woff2");
  font-weight: 100 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --juice-ink: #05060f;
  --juice-stage: #0a0e27;
  --juice-deep: #150c3a;
  --juice-cyan: #00adee;
  --juice-violet: #4827d0;
  --juice-on-dark: #f7f9ff;
  --juice-mute: #8b93a7;
  --juice-line-dark: rgba(255, 255, 255, .09);
  --juice-font-display: Montserrat, system-ui, -apple-system, sans-serif;
  --juice-font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --juice-container: 1180px;
  --juice-gutter: 40px;
  --juice-radius-tile: 14px;
  --juice-radius-pill: 999px;
  --header-height: 64px;
  color-scheme: dark;
}

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

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--juice-ink);
  color: var(--juice-on-dark);
  font-family: var(--juice-font-display);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
a { color: var(--juice-cyan); transition: opacity .2s ease, color .2s ease; }
a:focus-visible, summary:focus-visible { outline: 2px solid var(--juice-cyan); outline-offset: 3px; border-radius: 8px; }

.site-wrap { width: 100%; max-width: var(--juice-container); margin: 0 auto; padding: 0 var(--juice-gutter); }

.skip-link {
  position: absolute; left: 16px; top: -60px; z-index: 100;
  padding: 10px 16px; border-radius: var(--juice-radius-pill);
  background: var(--juice-violet); color: #fff; text-decoration: none; font-weight: 600;
}
.skip-link:focus { top: 16px; }

/* ---- Header (components/shell/Nav.tsx, without menus or JS) ---- */
.site-header {
  position: sticky; top: 0; z-index: 80;
  background: rgba(5, 6, 15, .92);
  border-bottom: 1px solid var(--juice-line-dark);
}
.site-header-inner {
  min-height: var(--header-height);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 4px 16px;
}
.site-logo { display: flex; align-items: center; flex-shrink: 0; }
.site-logo img { display: block; width: 76px; height: auto; }
.site-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 1px; }
.site-nav a, .site-utils a:not(.site-cta) {
  display: inline-flex; align-items: center; min-height: 40px;
  padding: 9px 12px; border-radius: 9px;
  font-size: 13.5px; font-weight: 500; white-space: nowrap;
  color: rgba(255, 255, 255, .66); text-decoration: none;
}
.site-nav a:hover, .site-utils a:not(.site-cta):hover { color: #fff; }
.site-utils { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.site-utils a:not(.site-cta) { padding: 9px 8px; color: rgba(255, 255, 255, .6); }
.site-cta {
  margin-left: 8px; padding: 10px 20px; border-radius: var(--juice-radius-pill);
  background: var(--juice-violet); color: #fff;
  font-size: 13.5px; font-weight: 600; white-space: nowrap; text-decoration: none;
  box-shadow: 0 6px 20px -8px rgba(72, 39, 208, .9);
}
.site-cta:hover { filter: brightness(1.08); }

/* ---- Docs layout ---- */
.doc-layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 48px;
  padding-top: 40px; padding-bottom: 80px;
}
.doc-sidebar { grid-column: 1; grid-row: 1; min-width: 0; }
.doc-main { grid-column: 2; grid-row: 1; min-width: 0; }
.doc-contents-link { display: none; }

/* Sidebar nav (nested <ul> from the converter, aria-current="page" on the current page) */
.doc-nav {
  position: sticky; top: calc(var(--header-height) + 24px);
  max-height: calc(100vh - var(--header-height) - 48px);
  overflow-y: auto; overscroll-behavior: contain;
  padding-right: 8px;
  font-size: 13.5px; line-height: 1.4;
}
.doc-nav ul { list-style: none; margin: 0; padding: 0; }
.doc-nav ul ul { margin: 2px 0 8px 10px; padding-left: 10px; border-left: 1px solid var(--juice-line-dark); }
.doc-nav > ul > li { margin-bottom: 2px; }
.doc-nav a {
  display: block; padding: 6px 10px; border-radius: 8px;
  color: rgba(255, 255, 255, .7); text-decoration: none; overflow-wrap: anywhere;
}
.doc-nav a:hover { color: #fff; background: rgba(255, 255, 255, .05); }
.doc-nav a[aria-current="page"] { color: #fff; font-weight: 600; background: rgba(0, 173, 238, .12); box-shadow: inset 2px 0 0 var(--juice-cyan); }

/* ---- Content ---- */
.doc-content { overflow-wrap: break-word; }
.doc-content h1, .doc-content h2, .doc-content h3, .doc-content h4 { line-height: 1.25; letter-spacing: -.02em; scroll-margin-top: calc(var(--header-height) + 16px); }
.doc-content h1 { font-size: 36px; font-weight: 600; margin: 0 0 20px; }
.doc-content h2 { font-size: 24px; font-weight: 600; margin: 40px 0 14px; padding-top: 24px; border-top: 1px solid var(--juice-line-dark); }
.doc-content h3 { font-size: 19px; font-weight: 600; margin: 28px 0 10px; }
.doc-content h4 { font-size: 16px; font-weight: 600; margin: 22px 0 8px; }
.doc-content p, .doc-content ul, .doc-content ol { margin: 0 0 16px; color: rgba(247, 249, 255, .86); }
.doc-content li + li { margin-top: 4px; }

.doc-content code {
  font-family: var(--juice-font-mono); font-size: .88em;
  padding: .12em .4em; border-radius: 6px;
  background: rgba(255, 255, 255, .07); overflow-wrap: anywhere;
}
.doc-content pre {
  margin: 0 0 20px; padding: 16px 18px;
  overflow-x: auto; max-width: 100%;
  background: var(--juice-stage); border: 1px solid var(--juice-line-dark); border-radius: var(--juice-radius-tile);
  font-size: 13px; line-height: 1.6;
}
.doc-content pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; white-space: pre; }

/* Wide parameter tables scroll inside the content column, never the page. */
.doc-content table {
  display: block; max-width: 100%; overflow-x: auto;
  margin: 0 0 24px; border-collapse: collapse;
  font-size: 13.5px; line-height: 1.5;
}
.doc-content th, .doc-content td {
  padding: 9px 12px; text-align: left; vertical-align: top;
  border: 1px solid var(--juice-line-dark);
  min-width: 8rem;
}
.doc-content th { background: var(--juice-stage); font-weight: 600; white-space: nowrap; }
.doc-content tr:nth-child(even) td { background: rgba(255, 255, 255, .02); }

.doc-content blockquote {
  margin: 0 0 16px; padding: 12px 16px;
  border-left: 3px solid var(--juice-cyan); border-radius: 0 10px 10px 0;
  background: rgba(0, 173, 238, .06);
}
.doc-content hr { border: 0; border-top: 1px solid var(--juice-line-dark); margin: 32px 0; }

.doc-updated { margin: 40px 0 0; font-family: var(--juice-font-mono); font-size: 12px; letter-spacing: .1em; color: var(--juice-mute); }

.doc-content pre::-webkit-scrollbar, .doc-content table::-webkit-scrollbar { height: 6px; }
.doc-content pre::-webkit-scrollbar-thumb, .doc-content table::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 999px; }

/* ---- Footer (components/shell/Footer.tsx, no card disclosure, no Cookie Preferences) ---- */
.site-footer { background: var(--juice-ink); border-top: 1px solid rgba(255, 255, 255, .08); }
.site-footer > .site-wrap { padding-top: 70px; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer a { text-decoration: none; }
.site-footer-top {
  display: grid; grid-template-columns: 1fr auto; gap: 40px; align-items: flex-end;
  padding-bottom: 44px; border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.site-footer-logo { display: inline-block; margin-bottom: 20px; }
.site-footer-logo img { display: block; width: 86px; height: auto; }
.site-footer-about { margin: 0; max-width: 440px; font-size: 14.5px; line-height: 1.6; color: rgba(255, 255, 255, .7); }
.site-footer-compliance { display: flex; align-items: center; gap: 18px; padding: 10px 14px; }
.site-footer-compliance img { display: block; width: 80px; height: 80px; object-fit: contain; }
.site-footer-columns { display: grid; grid-template-columns: repeat(4, 1fr); gap: 36px 26px; padding: 46px 0 56px; }
.site-footer-heading {
  margin: 0 0 14px; font-family: var(--juice-font-mono); font-size: 12px;
  letter-spacing: .18em; text-transform: uppercase; color: rgba(255, 255, 255, .5);
}
.site-footer-columns ul { display: grid; gap: 9px; }
.site-footer-columns a { font-size: 13px; font-weight: 500; line-height: 1.4; color: rgba(255, 255, 255, .55); }
.site-footer a:hover { color: var(--juice-cyan); }
.site-footer-legal { border-top: 1px solid rgba(255, 255, 255, .07); background: rgba(0, 0, 0, .35); }
.site-footer-legal > .site-wrap { padding-top: 26px; padding-bottom: 34px; }
.site-footer-disclosure { margin: 0 0 20px; font-size: 12.5px; line-height: 1.72; color: rgba(255, 255, 255, .5); }
.site-footer-bottom { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.site-footer-copy { font-family: var(--juice-font-mono); font-size: 12px; letter-spacing: .1em; color: rgba(255, 255, 255, .5); }
.site-footer-legal-links { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.site-footer-legal-links a { font-size: 12px; font-weight: 500; color: rgba(255, 255, 255, .55); }

/* ---- Narrow screens ---- */
@media (max-width: 1080px) {
  .site-header-inner { padding-top: 8px; padding-bottom: 8px; }
  .site-nav { order: 3; flex-basis: 100%; margin: 0 -12px; }
}
@media (max-width: 940px) {
  :root { --juice-gutter: 24px; }
  .site-header { position: static; }
  .doc-layout { grid-template-columns: minmax(0, 1fr); gap: 32px; padding-top: 24px; }
  .doc-main, .doc-sidebar { grid-column: 1; grid-row: auto; }
  .doc-contents-link { display: inline-block; margin-bottom: 16px; font-size: 13px; font-weight: 600; }
  .doc-sidebar { padding-top: 24px; border-top: 1px solid var(--juice-line-dark); }
  .doc-nav { position: static; max-height: none; overflow: visible; padding-right: 0; }
  .site-footer-top { grid-template-columns: 1fr; }
  .site-footer-columns { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  :root { --juice-gutter: 16px; }
  .doc-content h1 { font-size: 28px; }
  .doc-content h2 { font-size: 21px; }
  .site-utils a:not(.site-cta) { padding: 9px 6px; }
  .site-cta { margin-left: 4px; padding: 10px 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
}
