/* Documentation pages (doc/). Builds on ../site.css (variables, nav, cards, tables, theme). */

.docs { background: var(--bg); }

/* site.css gives every <section> big landing-page padding; docs use plain flow. */
.docs main section { padding: 0; }

.nav .docs-title { color: rgba(255, 255, 255, 0.55); font-weight: 500; }
.nav .docs-title::before { content: "/"; margin-right: .6rem; color: rgba(255, 255, 255, 0.3); }

.docs-menu-button {
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  padding: .3rem .7rem;
  font-size: .85rem;
  cursor: pointer;
}

.docs-layout {
  max-width: 1360px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 210px;
  gap: 3rem;
}

@media (max-width: 1200px) {
  .docs-layout { grid-template-columns: 240px minmax(0, 1fr); }
  .docs-toc { display: none; }
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 56px;
  align-self: start;
  max-height: calc(100vh - 56px);
  overflow-y: auto;
  padding: 2rem 0 3rem;
  font-size: .9rem;
}

.docs-sidebar .group { margin-bottom: 1.4rem; }

.docs-sidebar .group-title {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--subtext);
  margin: 0 0 .4rem .7rem;
}

.docs-sidebar ul { list-style: none; margin: 0; padding: 0; }

.docs-sidebar a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .32rem .7rem;
  border-radius: 8px;
  color: var(--subtext);
}

.docs-sidebar a:hover { color: var(--text); background: rgba(127, 127, 127, 0.1); text-decoration: none; }
.docs-sidebar a.active { color: var(--text); font-weight: 600; background: rgba(37, 99, 235, 0.12); }
.is-dark .docs-sidebar a.active { background: rgba(110, 168, 255, 0.14); }
.docs-sidebar ul ul { margin: .1rem 0 .3rem .7rem; padding-left: .5rem; border-left: 1px solid var(--border); }

.badge-soon {
  font-size: .65rem;
  font-weight: 600;
  padding: .05rem .4rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--subtext);
  white-space: nowrap;
}

.badge-prerelease {
  font-size: .65rem;
  font-weight: 700;
  padding: .05rem .45rem;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.12);
  color: var(--accent);
  white-space: nowrap;
  vertical-align: middle;
}

h1 .badge-prerelease, h2 .badge-prerelease { font-size: .8rem; margin-left: .4rem; }

/* "Requires StudioTools x.y.z or later." under a feature page's lead paragraph. */
.prose .requires { font-size: .9rem; color: var(--subtext); margin-top: -.4rem; }

@media (max-width: 860px) {
  .docs-menu-button { display: inline-block; }
  .docs-layout { grid-template-columns: minmax(0, 1fr); }

  .docs-sidebar {
    display: none;
    position: fixed;
    inset: 56px 0 0 0;
    max-height: none;
    z-index: 40;
    background: var(--bg);
    padding: 1.5rem;
  }

  .docs-sidebar.open { display: block; }
}

/* On this page */
.docs-toc {
  position: sticky;
  top: 56px;
  align-self: start;
  padding: 2.6rem 0 2rem;
  font-size: .85rem;
}

.docs-toc .group-title { font-size: .72rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--subtext); margin-bottom: .5rem; }
.docs-toc ul { list-style: none; margin: 0; padding: 0; border-left: 1px solid var(--border); }
.docs-toc a { display: block; padding: .25rem 0 .25rem .8rem; color: var(--subtext); }
.docs-toc a:hover { color: var(--text); text-decoration: none; }

/* Article */
.prose { padding: 2.5rem 0 4rem; max-width: 48rem; min-width: 0; }

.prose .breadcrumbs { font-size: .85rem; color: var(--subtext); margin-bottom: .4rem; }
.prose .breadcrumbs a { color: var(--subtext); }

.prose h1 { font-size: clamp(2rem, 4vw, 2.75rem); line-height: 1.1; letter-spacing: -0.025em; margin: 0 0 1rem; }
.prose .lead { font-size: 1.18rem; color: var(--subtext); margin: 0 0 2rem; }

.prose h2 {
  font-size: 1.55rem;
  letter-spacing: -0.015em;
  margin: 3rem 0 .8rem;
  padding-top: 1.6rem;
  border-top: 1px solid var(--border);
  scroll-margin-top: 72px;
}

.prose h3 { font-size: 1.15rem; margin: 2rem 0 .5rem; scroll-margin-top: 72px; }
.prose h4 { font-size: 1rem; margin: 1.5rem 0 .4rem; }
.prose p, .prose li { font-size: 1rem; }
.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li { margin-bottom: .4rem; }
.prose li > ul, .prose li > ol { margin-top: .4rem; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 2.5rem 0; }

.prose code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: rgba(127, 127, 127, 0.14);
  padding: .1em .35em;
  border-radius: 5px;
}

.prose pre {
  background: rgba(127, 127, 127, 0.1);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: .88rem;
  line-height: 1.5;
}

.prose pre code { background: none; padding: 0; }

kbd {
  font-family: -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: .8em;
  padding: .1em .45em;
  border-radius: 5px;
  border: 1px solid var(--border);
  border-bottom-width: 2px;
  background: var(--surface);
}

.prose .ui { font-weight: 600; }
.prose .table-wrap { margin: 1.2rem 0 1.6rem; }
.prose table { font-size: .92rem; }
.prose th, .prose td { padding: .65rem .9rem; }
.prose dl { margin: 1rem 0 1.5rem; }
.prose dt { font-weight: 600; margin-top: 1rem; }
.prose dd { margin: .2rem 0 0 0; color: var(--subtext); }

/* Callouts */
.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  padding: .9rem 1.1rem;
  margin: 1.4rem 0;
  background: rgba(37, 99, 235, 0.06);
}

.callout > :first-child { margin-top: 0; }
.callout > :last-child { margin-bottom: 0; }
.callout .callout-title { font-weight: 700; display: block; margin-bottom: .25rem; }
.callout.tip { border-left-color: #22a06b; background: rgba(34, 160, 107, 0.07); }
.callout.warning { border-left-color: #e8a317; background: rgba(232, 163, 23, 0.08); }
.callout.danger { border-left-color: var(--rec); background: rgba(239, 59, 54, 0.07); }

/* Screenshots. The <img> points at the final file; docs.js swaps in a placeholder while it is missing. */
.doc-shot { margin: 1.8rem 0; }
.doc-shot img { border-radius: 12px; border: 1px solid var(--border); box-shadow: var(--shadow); width: 100%; height: auto; }
.doc-shot.small img { max-width: 520px; }
.doc-shot figcaption { margin-top: .6rem; font-size: .88rem; color: var(--subtext); }
.is-dark .doc-shot img:not([data-dark-src]) { filter: brightness(.88) contrast(1.04); }

.shot-placeholder {
  aspect-ratio: 16 / 10;
  border: 2px dashed var(--border);
  border-radius: 12px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 1.5rem;
  color: var(--subtext);
  background: repeating-linear-gradient(135deg, rgba(127, 127, 127, 0.05) 0 12px, transparent 12px 24px);
}

.doc-shot.small .shot-placeholder { max-width: 520px; aspect-ratio: 4 / 3; }
.shot-placeholder .big { font-size: 2rem; line-height: 1; margin-bottom: .5rem; }
.shot-placeholder strong { display: block; color: var(--text); margin-bottom: .3rem; }
.shot-placeholder code { font-size: .8rem; }

/* Diagrams */
.chunk-diagram {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 1.4rem 0;
  font-size: .82rem;
}

.chunk-diagram .chunk {
  flex: 1 1 90px;
  padding: .7rem .6rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface);
  text-align: center;
}

.chunk-diagram .chunk strong { display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .9rem; }
.chunk-diagram .chunk span { color: var(--subtext); }
.chunk-diagram .chunk.header { flex-basis: 100%; background: rgba(127, 127, 127, 0.1); }
.chunk-diagram .chunk.meta { border-color: rgba(124, 58, 237, 0.5); background: rgba(124, 58, 237, 0.08); }
.chunk-diagram .chunk.audio { flex-grow: 4; border-color: rgba(37, 99, 235, 0.5); background: rgba(37, 99, 235, 0.08); }

.scale { margin: 1.4rem 0; }
.scale .row { display: grid; grid-template-columns: 7rem minmax(0, 1fr); gap: 1rem; align-items: center; margin-bottom: .45rem; font-size: .9rem; }
.scale .bar { height: 1.6rem; border-radius: 6px; background: var(--gradient); display: flex; align-items: center; padding: 0 .6rem; color: #fff; font-size: .8rem; white-space: nowrap; overflow: hidden; }
.scale .value { font-weight: 600; font-variant-numeric: tabular-nums; }

/* Doc home cards */
.docs .card h3 a { color: var(--text); }
.docs .card ul { margin: .6rem 0 0; padding-left: 1.1rem; color: var(--subtext); font-size: .92rem; }
.docs .card li { margin-bottom: .2rem; font-size: .92rem; }

/* Prev / next */
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 4rem; }
.pager a { display: block; border: 1px solid var(--border); border-radius: 12px; padding: .9rem 1.1rem; color: var(--text); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a small { display: block; color: var(--subtext); font-size: .78rem; }
.pager .next { text-align: right; grid-column: 2; }

.soon-banner {
  display: inline-flex;
  gap: .5rem;
  align-items: center;
  font-size: .82rem;
  font-weight: 600;
  padding: .3rem .75rem;
  border-radius: 999px;
  border: 1px dashed var(--border);
  color: var(--subtext);
  margin-bottom: 1rem;
}

.docs footer { border-top: 1px solid var(--border); margin-top: 2rem; padding: 2rem 0; }
