/* Semanticus docs — layout + content typography for the /docs section.
   REUSES the brand tokens from site.css (load site.css FIRST, then this file).
   No new colours are introduced: every value below resolves to a --token defined
   in site.css, so light ("Paper") / dark ("Terminal") behaviour is inherited for free. */

/* ---- two-column shell (sidebar + content) ---- */
.docs-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 40px 24px 72px;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
}

/* ---- left sidebar nav (a <details open> so it can fold to a disclosure on mobile) ---- */
.docs-sidebar {
  position: sticky;
  top: 80px;                       /* clear the 60px sticky site header */
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  border: 0;
}
.docs-sidebar[open],
.docs-sidebar:not([open]) { border: 0; }             /* strip any UA framing */
.docs-sidebar > summary {
  display: none;                   /* hidden on desktop; shown as a toggle < 880px */
  list-style: none;
  cursor: pointer;
  align-items: center;
  gap: 10px;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 15px;
  color: var(--fg);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.docs-sidebar > summary::-webkit-details-marker { display: none; }
.docs-sidebar > summary::after {
  content: "";
  margin-left: auto;
  width: 8px; height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s ease;
}
.docs-sidebar[open] > summary::after { transform: rotate(-135deg); }

.docs-nav { display: flex; flex-direction: column; gap: 20px; padding-top: 4px; }
.docs-nav .group-label {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px 12px;
}
.docs-nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.docs-nav a {
  display: block;
  padding: 6px 12px;
  font-size: 14.5px;
  color: var(--muted);
  border-left: 2px solid transparent;
  border-radius: 0 6px 6px 0;
}
.docs-nav a:hover { color: var(--fg); background: var(--surface); text-decoration: none; }
.docs-nav a.current {
  color: var(--accent);
  border-left-color: var(--signal);
  background: var(--accent-soft);
  font-weight: 600;
}

/* ---- content column ---- */
.docs-content { min-width: 0; }    /* let long code/tables scroll, not blow out the grid */
.docs-content img { max-width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--border); }

.docs-breadcrumb {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--muted);
  margin-bottom: 14px;
}
.docs-breadcrumb a { color: var(--muted); }
.docs-breadcrumb a:hover { color: var(--fg); }
.docs-breadcrumb .sep { opacity: .5; padding: 0 6px; }

.docs-content h1 {
  font-family: var(--disp);
  font-size: clamp(28px, 4vw, 38px);
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--fg);
  margin-bottom: 6px;
}
.docs-content .lede {
  color: var(--strong);
  font-size: 18px;
  line-height: 1.6;
  margin: 8px 0 8px;
  text-wrap: pretty;
}

.docs-content h2 {
  font-family: var(--disp);
  font-size: 23px;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 40px 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  position: relative;
}
.docs-content h3 {
  font-family: var(--disp);
  font-size: 18px;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin: 28px 0 8px;
  position: relative;
}
/* hover-reveal heading anchors */
.docs-content h2 > .anchor,
.docs-content h3 > .anchor {
  position: absolute;
  left: -0.9em;
  color: var(--muted);
  opacity: 0;
  font-weight: 400;
  text-decoration: none;
  transition: opacity .12s ease;
}
.docs-content h2:hover > .anchor,
.docs-content h3:hover > .anchor { opacity: 1; }

.docs-content p,
.docs-content li { color: var(--strong); font-size: 15.5px; line-height: 1.7; }
.docs-content p { margin: 0 0 14px; }
.docs-content ul,
.docs-content ol { margin: 0 0 16px 22px; display: flex; flex-direction: column; gap: 6px; }
.docs-content a { color: var(--accent); }
.docs-content strong { color: var(--fg); }
.docs-content hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }

/* ---- inline code chips + code blocks ---- */
.docs-content code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--strong);
  word-break: break-word;
}
.docs-content pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 0 0 18px;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--strong);
}
.docs-content pre code {
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

/* ---- tables (wrap wide ones in <div class="table-wrap">) ---- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; }
.docs-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin: 0 0 18px;
}
.docs-content th,
.docs-content td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.docs-content th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.docs-content tbody tr:hover { background: var(--surface); }

/* ---- callout boxes ---- */
.callout {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 0 0 18px;
}
.callout > .callout-title {
  display: block;
  font-family: var(--disp);
  font-weight: 600;
  font-size: 14.5px;
  color: var(--fg);
  margin-bottom: 4px;
}
.callout p:last-child { margin-bottom: 0; }
.callout p { color: var(--muted); font-size: 14.5px; }
.callout.note { border-left-color: var(--accent); }
.callout.tip  { border-left-color: var(--good); }
.callout.warn { border-left-color: var(--warn); }
.callout.danger { border-left-color: var(--bad); }

/* ---- section-map card grid (used by the docs landing page) ---- */
.docs-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(238px, 1fr));
  gap: 16px;
  margin: 22px 0 8px;
}
.doc-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  color: inherit;
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
.doc-card:hover {
  text-decoration: none;
  border-color: color-mix(in srgb, var(--signal) 50%, var(--border));
  box-shadow: var(--shadow);
  transform: translateY(-2px);
}
.doc-card .card-kicker {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.doc-card h3 {
  font-family: var(--disp);
  font-size: 16.5px;
  letter-spacing: -0.01em;
  color: var(--fg);
  margin-bottom: 6px;
}
.doc-card p { color: var(--muted); font-size: 14px; line-height: 1.55; margin: 0; }

/* a lighter card used for the dense Studio-tab grid */
.doc-card.compact { padding: 16px 18px; }
.doc-card.compact h3 { font-size: 15px; margin-bottom: 4px; }

/* the docs landing intro block */
.docs-hero { margin-bottom: 8px; }
.docs-hero h1 { font-family: var(--disp); font-size: clamp(30px, 5vw, 42px); letter-spacing: -0.025em; color: var(--fg); }
.docs-hero p { color: var(--strong); font-size: 18px; line-height: 1.6; max-width: 720px; margin-top: 10px; text-wrap: pretty; }
.docs-section-title {
  font-family: var(--disp);
  font-size: 22px;
  letter-spacing: -0.015em;
  color: var(--fg);
  margin: 40px 0 4px;
}
.docs-section-sub { color: var(--muted); font-size: 14.5px; margin-bottom: 4px; }

/* ---- responsive: fold the sidebar into a top disclosure under ~880px ---- */
@media (max-width: 880px) {
  .docs-shell { grid-template-columns: 1fr; gap: 20px; padding-top: 24px; }
  .docs-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
    margin-bottom: 4px;
  }
  .docs-sidebar > summary { display: flex; }         /* the disclosure toggle appears */
  .docs-nav { padding: 14px 4px 4px; }
}
@media (min-width: 881px) {
  /* desktop: no toggle; the <details open> content is simply always shown */
  .docs-sidebar > summary { display: none; }
}
