/* Ask Physics Docs at /docs/: a top bar with search, section tabs, a sidebar, the page,
   and "On this page". Builds on styles.css (colors, fonts, .brand). */
.docs-body { --side: 248px; --toc: 220px; --top: 116px; }

/* top bar and tabs */
.docs-top {
  position: sticky; top: 0; z-index: 20;
  background: rgba(7, 8, 15, 0.88); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.docs-bar, .docs-tabs { max-width: 1400px; margin: 0 auto; padding: 0 24px; }
.docs-bar { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand-sub { font-size: 19px; }
.docs-search { position: relative; flex: 1; max-width: 460px; margin-left: auto; }
.docs-search input {
  width: 100%; height: 40px; padding: 0 40px 0 38px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg2) no-repeat 12px center / 16px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b93a7' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  color: var(--text); font: 15px var(--body);
}
.docs-search input::placeholder { color: var(--muted); }
.docs-search input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(139, 233, 253, 0.12); }
.docs-search input::-webkit-search-cancel-button { display: none; }
.docs-search kbd {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  padding: 1px 7px; border: 1px solid var(--line); border-radius: 6px;
  color: var(--muted); font: 12px var(--mono); pointer-events: none;
}
#docs-results {
  position: absolute; left: 0; right: 0; top: 46px; margin: 0; padding: 6px; list-style: none;
  max-height: 60vh; overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
#docs-results a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); }
#docs-results a:hover, #docs-results .active a { background: rgba(139, 233, 253, 0.08); text-decoration: none; }
#docs-results .r-title { display: block; font-weight: 600; }
#docs-results .r-meta { display: block; color: var(--muted); font-size: 13px; }
#docs-results .empty { padding: 10px; color: var(--muted); font-size: 14px; }
.docs-links { display: flex; align-items: center; gap: 20px; font-size: 14px; white-space: nowrap; }
.docs-links a { color: var(--label); }
.docs-links a:hover { color: var(--text); text-decoration: none; }
.docs-tabs { display: flex; gap: 28px; overflow-x: auto; scrollbar-width: none; }
.docs-tabs::-webkit-scrollbar { display: none; }
.docs-tabs a {
  padding: 12px 0 11px; border-bottom: 2px solid transparent; white-space: nowrap;
  color: var(--muted); font-size: 15px; font-weight: 500;
}
.docs-tabs a:hover { color: var(--text); text-decoration: none; }
.docs-tabs a.here { color: var(--text); border-bottom-color: var(--cyan); }

/* the three columns */
.docs {
  display: grid; grid-template-columns: var(--side) minmax(0, 1fr) var(--toc); gap: 48px;
  max-width: 1400px; margin: 0 auto; padding: 0 24px;
}
.docs-menu { display: none; }
.docs-side, .docs-toc {
  position: sticky; top: var(--top); align-self: start;
  max-height: calc(100vh - var(--top)); overflow-y: auto; padding: 28px 4px 40px 0;
  scrollbar-width: thin; scrollbar-color: var(--line) transparent;
}
.docs-side p { margin: 22px 0 6px 12px; color: var(--text); font-weight: 600; font-size: 14px; }
.docs-side p:first-child { margin-top: 0; }
.docs-side ul { list-style: none; margin: 0; padding: 0; }
.docs-side a {
  display: block; padding: 7px 12px; border-radius: 8px;
  color: var(--muted); font-size: 14.5px; line-height: 1.35;
}
.docs-side a:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); text-decoration: none; }
.docs-side a.here { color: var(--cyan); background: rgba(139, 233, 253, 0.08); font-weight: 500; }
.docs-toc p { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; color: var(--text); font-weight: 600; font-size: 14px; }
.docs-toc p::before { content: ""; width: 14px; height: 10px; border-top: 2px solid var(--label); border-bottom: 2px solid var(--label); box-sizing: border-box; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--line); }
.docs-toc a { display: block; margin-left: -1px; padding: 5px 0 5px 14px; border-left: 1px solid transparent; color: var(--muted); font-size: 14px; line-height: 1.4; }
.docs-toc .l4 a { padding-left: 26px; font-size: 13px; }
.docs-toc a:hover { color: var(--text); text-decoration: none; }
.docs-toc a.here { color: var(--cyan); border-left-color: var(--cyan); }

/* the page. styles.css centers every main and footer with auto margins; the grid places
   these instead, so the docs reset them. */
.docs .docs-page, .docs .docs-foot { min-width: 0; max-width: 780px; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }
.docs-page { padding: 32px 0 64px; }
.eyebrow { margin: 0 0 8px; color: var(--violet); font: 600 13px var(--mono); letter-spacing: 0.08em; text-transform: uppercase; }
.docs-head { display: flex; align-items: flex-start; gap: 16px; }
.docs-page h1 {
  flex: 1; margin: 0 0 14px; font: 700 clamp(30px, 4.5vw, 44px)/1.1 var(--display);
  letter-spacing: -0.025em; overflow-wrap: anywhere; hyphens: auto;
}
.copy-page {
  flex: none; margin-top: 6px; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--label); font: 13px var(--body);
}
.copy-page:hover { border-color: var(--cyan); color: var(--text); }
.copy-page.done { border-color: var(--ok); color: var(--ok); }
.docs-page .lead { color: #c8cbe0; font-size: 18.5px; line-height: 1.6; margin: 0 0 28px; }
.docs-page p, .docs-page li { color: #d6d9e8; line-height: 1.75; overflow-wrap: anywhere; }
.docs-page li { margin: 4px 0; }
.docs-page h2, .docs-page h3, .docs-page h4 {
  font-family: var(--display); letter-spacing: -0.015em; scroll-margin-top: calc(var(--top) + 16px);
}
.docs-page h3 { font-size: 26px; margin: 44px 0 10px; }
.docs-page h4 { font-size: 19px; margin: 30px 0 8px; }
.docs-page a { text-decoration: underline; text-decoration-color: rgba(139, 233, 253, 0.4); text-underline-offset: 3px; }
.docs-page a:hover { text-decoration-color: var(--cyan); }
.docs-page code { background: var(--bg2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 0.86em; }
.docs-page pre { background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; overflow-x: auto; line-height: 1.55; }
.docs-page pre code { background: none; border: 0; padding: 0; }
.docs-page table { display: block; overflow-x: auto; border-collapse: collapse; margin: 20px 0; font-size: 14px; }
.docs-page th, .docs-page td { border-bottom: 1px solid var(--line); padding: 9px 14px 9px 0; text-align: left; vertical-align: top; }
.docs-page th { color: var(--label); font-weight: 600; border-bottom-color: #343852; }
.docs-page .math {
  margin: 24px 0; padding: 20px; overflow-x: auto; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  color: var(--eq); font-family: var(--mono);
}
.callout {
  display: flex; gap: 12px; margin: 24px 0; padding: 14px 18px;
  background: rgba(47, 116, 208, 0.12); border: 1px solid rgba(139, 233, 253, 0.28); border-radius: 12px;
}
.callout::before { content: "i"; flex: none; display: grid; place-items: center; width: 22px; height: 22px; margin-top: 3px; border: 1.5px solid var(--cyan); border-radius: 50%; color: var(--cyan); font: 700 13px var(--mono); }
.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 56px; }
.docs-pager a {
  display: block; padding: 14px 18px; border: 1px solid var(--line); border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.docs-pager a:hover { border-color: var(--cyan); }
.docs-pager small { display: block; color: var(--muted); font-weight: 400; font-size: 13px; }
.docs-pager .next { grid-column: 2; text-align: right; }
.docs-foot { margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.docs-foot a { color: var(--label); }

/* narrower screens: the outline goes first, then the sidebar becomes a menu */
@media (max-width: 1180px) {
  .docs { grid-template-columns: var(--side) minmax(0, 1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 860px) {
  .docs-body { --top: 0px; }
  .docs-top { position: static; } /* a tall bar would eat a phone screen */
  .docs-bar { gap: 14px; padding: 0 16px; height: auto; flex-wrap: wrap; padding-top: 10px; }
  .docs-bar .brand { flex-basis: 100%; }
  .docs-search { order: 3; flex: 1 1 0; min-width: 0; max-width: none; margin: 0 0 10px; }
  .docs-search kbd { display: none; }
  .docs-links { order: 4; gap: 12px; font-size: 13px; margin-bottom: 10px; }
  .docs-tabs { padding: 0 16px; gap: 22px; }
  .docs { display: block; padding: 0 16px; }
  .docs-links > a:first-child { display: none; } /* room for the search box */
  .docs-links .install-btn { height: 40px; padding: 0 14px; }
  .docs-links .gh { width: 40px; height: 40px; }
  .docs-menu {
    display: block; width: 100%; margin: 16px 0 0; padding: 11px 14px; text-align: left; cursor: pointer;
    border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--text); font: 600 14px var(--body);
  }
  .docs-menu::after { content: "+"; float: right; color: var(--muted); }
  .docs-menu[aria-expanded="true"]::after { content: "\2212"; }
  .docs-side { position: static; display: none; max-height: none; padding: 10px 0 0; }
  .docs-side.open { display: block; }
  .docs-side a { padding: 9px 12px; } /* finger-sized */
  .docs-page { padding-top: 22px; }
  .docs-head { flex-direction: column; gap: 0; }
  .copy-page { margin: 0 0 14px; }
  .docs-page .lead { font-size: 17px; }
  .docs-page h3 { font-size: 22px; }
  .docs-page table { font-size: 13px; }
}
@media (max-width: 420px) {
  .brand-sub { font-size: 17px; }
}
