/* Docs layer — extends site/style.css (loaded first).
   Reuses the shared scanner-console tokens; adds only the docs layout,
   sidebar table of contents, prose typography, figures, and callouts. */

/* ---- docs shell: sidebar + content ---- */

.docs-layout {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: 3rem;
  max-width: 68rem;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 5rem;
  align-items: start;
}

/* ---- sidebar table of contents ---- */

.docs-sidebar {
  position: sticky;
  top: 2rem;
  min-width: 0;
}

.docs-sidebar-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding-left: 0.875rem;
}

.docs-nav {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.125rem;
}

.docs-nav a {
  display: block;
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9375rem;
  padding: 0.4rem 0.875rem;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
}

.docs-nav a:hover {
  color: var(--text);
  background: var(--bg-semi);
}

/* Active item borrows the app's active-tab treatment: amber text + accent. */
.docs-nav a[aria-current="page"] {
  color: var(--brand);
  border-left-color: var(--brand);
  background: var(--bg-semi);
}

/* Device sub-pages nest under the Device Tab index: indent + smaller text. */
.docs-nav-child a {
  padding-left: 1.875rem;
  font-size: 0.9063rem;
}

/* ---- content column ---- */

.docs-content {
  min-width: 0;
  max-width: 44rem;
}

.docs-content h1 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

/* The lede paragraph directly after the h1 reads larger, muted. */
.docs-content h1 + p {
  color: var(--text-muted);
  font-size: 1.1875rem;
  line-height: 1.55;
  margin-bottom: 1.5rem;
}

.docs-content h2 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.75rem;
  letter-spacing: -0.01em;
  margin: 2.75rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-scanner);
}

.docs-content h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3125rem;
  margin: 2rem 0 0.75rem;
}

/* Glossary terms are h2 for a correct heading outline (each term is a direct
   child of the page h1), but they read at h3 weight/size without the section
   divider — the term list shouldn't look like a stack of top-level sections. */
.docs-glossary h2 {
  font-weight: 700;
  font-size: 1.3125rem;
  margin: 2rem 0 0.75rem;
  padding-top: 0;
  border-top: none;
}

.docs-content p,
.docs-content li {
  font-size: 1.0625rem;
  line-height: 1.65;
}

.docs-content p {
  margin-bottom: 1rem;
}

.docs-content ul,
.docs-content ol {
  margin: 0 0 1.25rem;
  padding-left: 1.5rem;
  display: grid;
  gap: 0.4rem;
}

.docs-content li {
  padding-left: 0.25rem;
}

.docs-content strong {
  color: var(--text);
  font-weight: 600;
}

.docs-content a {
  color: var(--brand-light);
  text-underline-offset: 2px;
}

.docs-content hr {
  border: none;
  margin: 0;
}

/* Frequencies, filenames, keys, and commands read in mono. */
.docs-content code,
kbd {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-panel);
  border: 1px solid var(--border-scanner);
  border-radius: 3px;
  padding: 0.1em 0.4em;
}

kbd {
  color: var(--text);
  white-space: nowrap;
}

.docs-content pre {
  background: var(--bg-panel);
  border: 1px solid var(--border-scanner);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.docs-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.9375rem;
  line-height: 1.55;
}

/* ---- tables ---- */

.docs-content .table-wrap {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9688rem;
}

.docs-content th,
.docs-content td {
  text-align: left;
  padding: 0.55rem 0.875rem;
  border-bottom: 1px solid var(--border-scanner);
  vertical-align: top;
}

.docs-content th {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.8125rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
}

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

/* ---- callouts (ported from Markdown blockquotes) ---- */

.docs-content .callout {
  background: var(--bg-semi);
  border: 1px solid var(--border-scanner);
  border-left: 3px solid var(--brand);
  border-radius: 0 6px 6px 0;
  padding: 0.875rem 1.125rem;
  margin: 0 0 1.25rem;
}

.docs-content .callout p:last-child {
  margin-bottom: 0;
}

/* ---- figures (screenshots) ---- */

.docs-figure {
  margin: 1.75rem 0 2rem;
}

.docs-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.docs-figure figcaption {
  margin-top: 0.625rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-align: center;
}

/* ---- status dots (replace 🟡🟢🔴 emoji in prose) ---- */

.status-dot {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  border-radius: 50%;
  margin-right: 0.15em;
  vertical-align: baseline;
  flex-shrink: 0;
}

.dot-green {
  background: var(--led-green);
  box-shadow: 0 0 4px var(--led-green);
}

.dot-yellow {
  background: var(--brand);
  box-shadow: 0 0 4px var(--brand-glow);
}

.dot-red {
  background: #e5484d;
  box-shadow: 0 0 4px rgba(229, 72, 77, 0.6);
}

/* ---- prev / next pagination ---- */

.docs-pagination {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3.5rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border-scanner);
}

.docs-pagination a {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  text-decoration: none;
  padding: 0.875rem 1.125rem;
  background: var(--bg-semi);
  border: 1px solid var(--border-scanner);
  border-radius: 8px;
  color: var(--text);
}

.docs-pagination a:hover {
  border-color: var(--steel-border);
}

.docs-pagination .page-prev {
  grid-column: 1;
}

.docs-pagination .page-next {
  grid-column: 2;
  text-align: right;
}

.docs-pagination .page-dir {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.docs-pagination .page-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.0625rem;
  color: var(--brand-light);
}

/* ---- docs landing cards ---- */

.docs-index-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin-top: 2rem;
}

.docs-card {
  display: block;
  text-decoration: none;
  background: var(--bg-semi);
  border: 1px solid var(--border-scanner);
  border-radius: 8px;
  padding: 1.25rem 1.375rem;
  color: var(--text);
}

.docs-card:hover {
  border-color: var(--steel-border);
}

.docs-card h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0 0 0.375rem;
  border: none;
  padding: 0;
  color: var(--brand-light);
}

.docs-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9688rem;
  line-height: 1.5;
}

/* ---- responsive ---- */

@media (max-width: 55rem) {
  .docs-layout {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-top: 1.5rem;
  }

  .docs-sidebar {
    position: static;
  }

  /* Sidebar becomes a horizontal, scrollable strip above the content. */
  .docs-nav {
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    gap: 0.25rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
  }

  .docs-nav a {
    border-left: none;
    border-bottom: 2px solid transparent;
    border-radius: 4px 4px 0 0;
    white-space: nowrap;
  }

  .docs-nav a[aria-current="page"] {
    border-left: none;
    border-bottom-color: var(--brand);
  }

  /* No indent in the horizontal strip — children sit inline with the rest. */
  .docs-nav-child a {
    padding-left: 0.875rem;
  }

  .docs-index-grid {
    grid-template-columns: 1fr;
  }

  .docs-pagination {
    grid-template-columns: 1fr;
  }

  .docs-pagination .page-prev,
  .docs-pagination .page-next {
    grid-column: 1;
    text-align: left;
  }
}
