/* Docs page, ported from Choreon Docs.html. Colors/radii/mono via tokens;
   bespoke layout metrics raw (matches app.css). */
/* Width comes from .wrap so the rails line up with the header and footer.
   T/B padding lives in app.css under .page--docs so all chrome stays in one place. */
.docs { display: grid; grid-template-columns: 220px minmax(0, 1fr) 200px; gap: var(--space-40); align-items: start; }

/* left sidebar */
/* dvh tracks the visible viewport (URL-bar collapse on mobile Chrome doesn't
   re-layout the sidebar mid-scroll); vh kept as a fallback for old browsers. */
.docs .sidebar { position: sticky; top: 94px; display: flex; flex-direction: column; gap: 26px; max-height: calc(100vh - 120px); max-height: calc(100dvh - 120px); overflow-y: auto; padding-right: 6px; }
.docs .nav-group .nav-title { font-size: var(--fs-12); font-weight: var(--fw-semibold); letter-spacing: .08em; text-transform: uppercase; color: var(--placeholder); margin-bottom: 10px; }
.docs .nav-group a { display: block; font-size: var(--fs-14); color: var(--sub); padding: 7px 12px; border-radius: 7px; border-left: 2px solid transparent; transition: .15s; line-height: 1.3; }
.docs .nav-group a:hover { color: var(--light); background: rgba(var(--light-rgb),.03); }
.docs .nav-group a.active { color: var(--light); background: linear-gradient(90deg, rgba(var(--primary-rgb),.16), rgba(var(--primary-rgb),.02)); border-left-color: var(--primary); }

/* center content */
.docs .content { min-width: 0; }
.docs .content .crumb { font-size: var(--fs-14); color: var(--placeholder); margin-bottom: 18px; }
.docs .content .crumb .crumb-sep { color: var(--placeholder); margin: 0 4px; opacity: .7; }
.docs .content .crumb .grad { font-weight: var(--fw-semibold); }
.docs .content h1 { font-size: 40px; font-weight: var(--fw-semibold); letter-spacing: -.025em; margin-bottom: 14px; }
.docs .content .lead { font-size: var(--fs-18); color: var(--sub); line-height: 1.55; margin-bottom: 14px; max-width: 680px; }
.docs .doc-sec { padding-top: 40px; margin-top: 8px; scroll-margin-top: 90px; }
.docs .doc-sec > h2 { font-size: 27px; font-weight: var(--fw-semibold); letter-spacing: -.015em; margin-bottom: 6px; display: flex; align-items: center; gap: 12px; }
.docs .doc-sec h3 { font-size: var(--fs-18); font-weight: var(--fw-semibold); margin: 30px 0 10px; scroll-margin-top: 90px; }
.docs .doc-sec h4 { font-size: var(--fs-16); font-weight: var(--fw-semibold); margin: 22px 0 8px; color: var(--light); }
.docs .content p { font-size: var(--fs-16); color: var(--sub); line-height: 1.7; margin: 12px 0; max-width: 720px; }
.docs .content ul, .docs .content ol { margin: 12px 0 12px 4px; padding-left: 22px; max-width: 720px; }
.docs .content li { font-size: var(--fs-16); color: var(--sub); line-height: 1.7; margin: 6px 0; }
.docs .content li::marker { color: var(--primary); }
.docs .content strong { color: var(--light); font-weight: var(--fw-semibold); }
.docs .content a.link { color: var(--accent-violet); border-bottom: 1px solid rgba(var(--violet-rgb),.35); }
.docs .content a.link:hover { border-bottom-color: var(--accent-violet); }

/* code */
.docs code { font-family: var(--font-mono); font-size: .88em; background: rgba(var(--primary-rgb),.12); color: var(--primary); padding: 2px 7px; border-radius: 5px; white-space: nowrap; }
.docs pre { background: #0c0d0f; border: 1px solid var(--divider); border-radius: var(--radius-lg); padding: 16px 18px; overflow-x: auto; margin: 14px 0; position: relative; }
.docs pre code { display: block; font-size: 13px; line-height: 1.75; color: var(--sub); background: none; padding: 0; white-space: pre; border-radius: 0; }
.docs pre .tok { color: var(--primary); }
.docs pre .cmt { color: var(--placeholder); }
.docs .copy { position: absolute; top: 10px; right: 10px; background: var(--surface); border: 1px solid var(--divider-strong); color: var(--sub); font-size: 11px; font-family: var(--font-sans); padding: 4px 9px; border-radius: 6px; cursor: pointer; opacity: 0; transition: .15s; }
.docs pre:hover .copy { opacity: 1; }
.docs .copy:hover { color: var(--light); border-color: var(--primary); }

/* callouts */
.docs .note { display: flex; gap: 13px; align-items: flex-start; border: 1px solid var(--divider); background: rgba(var(--primary-rgb),.06); border-radius: var(--radius-lg); padding: 15px 18px; margin: 16px 0; max-width: 720px; }
.docs .note.warn { background: rgba(255,183,77,.06); }
.docs .note .ico { flex: none; margin-top: 1px; color: var(--primary); }
.docs .note.warn .ico { color: var(--warning); }
.docs .note p { margin: 0; font-size: var(--fs-14); color: var(--sub); line-height: 1.6; }
.docs .note p strong { color: var(--light); }

/* steps */
.docs .steps { counter-reset: step; list-style: none; padding-left: 0; margin: 16px 0; }
.docs .steps > li { position: relative; padding-left: 42px; margin: 16px 0; min-height: 28px; }
.docs .steps > li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: -2px; width: 28px; height: 28px; border-radius: 50%; background: rgba(var(--primary-rgb),.14); border: 1px solid rgba(var(--primary-rgb),.4); color: var(--primary); font-size: 13px; font-weight: var(--fw-semibold); display: flex; align-items: center; justify-content: center; }

/* badges */
.docs .badge { font-size: 11px; padding: 2px 9px; border-radius: 6px; font-weight: var(--fw-semibold); }
.docs .badge.beta { background: rgba(var(--violet-rgb),.16); color: var(--accent-violet); }

/* right TOC */
.docs .toc { position: sticky; top: 94px; font-size: var(--fs-14); }
.docs .toc .toc-title { font-size: var(--fs-12); font-weight: var(--fw-semibold); letter-spacing: .08em; text-transform: uppercase; color: var(--placeholder); margin-bottom: 12px; }
.docs .toc a { display: block; color: var(--placeholder); padding: 5px 0 5px 12px; border-left: 2px solid var(--divider); transition: .15s; line-height: 1.4; }
.docs .toc a:hover { color: var(--sub); }
.docs .toc a.active { color: var(--light); border-left-color: var(--primary); }
.docs .toc a.sub { padding-left: 24px; font-size: var(--fs-12); }

/* page-nav */
.docs .page-nav { display: flex; gap: 16px; margin-top: 56px; border-top: 1px solid var(--divider); padding-top: 28px; }
.docs .page-nav a { flex: 1; border: 1px solid var(--divider); border-radius: var(--radius-lg); padding: 16px 20px; transition: .15s; background: rgba(26,26,26,.5); }
.docs .page-nav a:hover { border-color: var(--primary); }
.docs .page-nav .dir { font-size: var(--fs-12); color: var(--placeholder); }
.docs .page-nav .ttl { font-size: var(--fs-16); font-weight: var(--fw-semibold); color: var(--light); margin-top: 4px; }
.docs .page-nav a.next { text-align: right; }

@media (max-width: 1180px) {
  .docs { grid-template-columns: 220px minmax(0, 1fr); gap: var(--space-40); }
  .docs .toc { display: none; }
}

@media (max-width: 860px) {
  /* Keep generous side padding on mobile. Use longhand L/R so we don't
     overwrite .page--docs's padding-top/bottom via shorthand (.wrap.docs has
     higher specificity than .page--docs and would zero T/B otherwise). */
  .wrap.docs { padding-left: 32px; padding-right: 32px; }
  .docs { grid-template-columns: 1fr; gap: 0; }
  .docs .sidebar { display: none; }
  .docs .content .crumb { margin-bottom: 14px; }
  .docs .content h1 { font-size: clamp(26px, 7vw, 34px); margin-bottom: 12px; }
  .docs .content .lead { font-size: var(--fs-16); }
  .docs .doc-sec { padding-top: 32px; }
  .docs .doc-sec > h2 { font-size: clamp(20px, 5.4vw, 24px); gap: 10px; }
  .docs .doc-sec h3 { font-size: var(--fs-16); margin: 24px 0 8px; }
  .docs .doc-sec h4 { margin: 18px 0 6px; }
  /* inline code can wrap on phones so long flag names don't blow out the column */
  .docs code { white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
  .docs pre { padding: 12px 14px; border-radius: var(--radius); margin: 12px 0; }
  .docs pre code { font-size: 12.5px; line-height: 1.7; }
  /* hover doesn't exist on touch — always show the copy chip */
  .docs .copy { opacity: 1; top: 8px; right: 8px; }
  .docs .note { padding: 13px 14px; gap: 11px; margin: 14px 0; }
  .docs .steps > li { padding-left: 36px; margin: 14px 0; }
  .docs .steps > li::before { width: 24px; height: 24px; font-size: 12px; top: -1px; }
}

@media (max-width: 520px) {
  .wrap.docs { padding-left: 24px; padding-right: 24px; }
  .docs .content h1 { letter-spacing: -.02em; }
  /* stack prev/next so they don't squeeze into illegible widths */
  .docs .page-nav { flex-direction: column; gap: 12px; margin-top: 36px; padding-top: 22px; }
  .docs .page-nav a { padding: 14px 16px; }
  .docs .page-nav a.next { text-align: left; }
}
