/* =============================================================
   Termpolis — Documentation styles
   Layered on top of styles.css to keep the marketing site slim.
   ============================================================= */

:root {
  --docs-sidebar-width: 18rem;
  --docs-content-max: 56rem;
  --docs-code-bg: rgba(15, 26, 36, 0.72);
  --docs-border: rgba(157, 188, 214, 0.14);
  --docs-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.docs-body {
  min-height: 100vh;
}

.docs-shell {
  width: min(calc(100% - 2rem), 82rem);
  margin: 0 auto;
  padding: 1.2rem 0 3rem;
}

/* ---- Header --------------------------------------------------- */

.docs-header {
  position: sticky;
  top: 1rem;
  z-index: 12;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.6rem;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(10, 18, 26, 0.88);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}

.docs-header .site-nav {
  justify-self: center;
}

.docs-header .site-nav a.active {
  color: var(--coral);
}

.docs-search input {
  min-width: 16rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 13, 19, 0.72);
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease;
}

.docs-search input::placeholder {
  color: var(--muted);
}

.docs-search input:focus {
  border-color: var(--coral);
}

/* ---- Layout --------------------------------------------------- */

.docs-layout {
  display: grid;
  grid-template-columns: var(--docs-sidebar-width) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.docs-sidebar {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 7.5rem);
  overflow-y: auto;
  padding-right: 0.5rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.docs-sidebar::-webkit-scrollbar {
  width: 6px;
}

.docs-sidebar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.docs-sidebar-inner {
  padding: 1.4rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-strong);
  box-shadow: var(--docs-shadow);
}

.docs-sidebar-eyebrow {
  margin: 1.2rem 0 0.5rem;
  color: var(--coral);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.docs-sidebar-eyebrow:first-of-type {
  margin-top: 0;
}

.docs-toc {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.1rem;
}

.docs-toc a {
  display: block;
  padding: 0.42rem 0.7rem;
  border-radius: 0.55rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.25;
  transition: background 0.15s ease, color 0.15s ease;
}

.docs-toc a:hover,
.docs-toc a:focus-visible {
  background: rgba(102, 167, 255, 0.08);
  color: var(--text);
}

.docs-toc a.is-active {
  background: rgba(255, 122, 69, 0.12);
  color: var(--text);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px rgba(255, 122, 69, 0.22);
}

.docs-toc a.is-hidden {
  display: none;
}

/* ---- Content column ------------------------------------------ */

.docs-content {
  min-width: 0;
  max-width: var(--docs-content-max);
}

.docs-hero {
  padding: 1rem 0 1.2rem;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2rem;
}

.docs-hero h1 {
  font-size: clamp(2.6rem, 6vw, 4.2rem);
  margin-top: 0.3rem;
}

.docs-lead {
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 1.15rem;
  line-height: 1.65;
  max-width: 40rem;
}

.docs-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin: 1.3rem 0 0.2rem;
}

.docs-bug-btn,
.docs-feature-btn {
  display: inline-block;
  padding: 0.7rem 1.2rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  line-height: 1;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.docs-bug-btn {
  background: #e53935;
  color: #fff;
  box-shadow: 0 2px 8px rgba(229, 57, 53, 0.25);
}

.docs-bug-btn:hover,
.docs-bug-btn:focus-visible {
  background: #c62828;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 57, 53, 0.35);
}

.docs-feature-btn {
  background: #1976d2;
  color: #fff;
  box-shadow: 0 2px 8px rgba(25, 118, 210, 0.25);
}

.docs-feature-btn:hover,
.docs-feature-btn:focus-visible {
  background: #125ea5;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(25, 118, 210, 0.35);
}

.docs-toc-external a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.docs-sidebar-bug {
  color: #e53935 !important;
  font-weight: 600;
}

/* Section blocks */

.docs-section {
  padding: 2.4rem 0;
  border-bottom: 1px solid var(--line);
}

.docs-section:last-of-type {
  border-bottom: 0;
}

.docs-section h2 {
  font-family: "Aptos", "Segoe UI Variable Display", "Trebuchet MS", sans-serif;
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
  letter-spacing: -0.02em;
  color: var(--text);
  margin: 0 0 0.9rem;
}

.docs-section h3 {
  font-size: 1.12rem;
  letter-spacing: 0;
  margin: 1.4rem 0 0.6rem;
  color: var(--text);
}

.docs-section p {
  color: var(--muted);
  line-height: 1.72;
  margin: 0.75rem 0;
}

.docs-section strong {
  color: var(--text);
}

.docs-section em {
  color: #cddbe8;
  font-style: italic;
}

.docs-section code {
  padding: 0.1rem 0.4rem;
  border-radius: 0.35rem;
  background: var(--docs-code-bg);
  color: #cdeaff;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 0.88em;
}

.docs-section a {
  color: var(--sky);
  text-decoration: underline;
  text-decoration-color: rgba(102, 167, 255, 0.35);
}

.docs-section a:hover {
  text-decoration-color: var(--sky);
}

/* Lists */

.docs-list {
  margin: 0.7rem 0;
  padding: 0 0 0 1.1rem;
  display: grid;
  gap: 0.55rem;
  color: var(--muted);
  line-height: 1.6;
}

.docs-list-ordered {
  list-style: decimal;
}

.docs-list li::marker {
  color: var(--coral);
}

/* Tables */

.docs-table-wrap {
  overflow-x: auto;
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

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

.docs-table thead th {
  background: rgba(102, 167, 255, 0.08);
  color: var(--text);
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--line);
}

.docs-table tbody td {
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  vertical-align: top;
}

.docs-table tbody tr:last-child td {
  border-bottom: 0;
}

.docs-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.docs-table code {
  white-space: nowrap;
}

/* Figures */

.docs-shot {
  margin: 1.4rem 0 0.4rem;
  padding: 0;
  background: transparent;
}

.docs-shot img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #050a10;
  box-shadow: var(--docs-shadow);
}

.docs-shot figcaption {
  margin-top: 0.55rem;
  padding: 0 0.1rem;
  color: var(--muted);
  font-size: 0.85rem;
  font-style: italic;
  line-height: 1.5;
}

/* Pre / code blocks */

.docs-pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--docs-code-bg);
  color: #cdeaff;
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 0.82rem;
  line-height: 1.55;
  white-space: pre;
}

/* Keys */

kbd {
  display: inline-block;
  padding: 0.1rem 0.45rem;
  min-width: 1.6rem;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 0.35rem;
  background: rgba(13, 23, 33, 0.92);
  color: var(--text);
  font-family: "JetBrains Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 0.78rem;
  line-height: 1;
  text-align: center;
  vertical-align: baseline;
}

.docs-footer {
  margin-top: 2.5rem;
  padding: 1.4rem 0 0;
  border-top: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* Callouts */

.docs-callout {
  margin: 1.2rem 0;
  padding: 1rem 1.2rem;
  border: 1px solid rgba(255, 122, 69, 0.28);
  border-left: 3px solid var(--coral);
  border-radius: var(--radius-sm);
  background: rgba(255, 122, 69, 0.06);
}

.docs-callout p {
  margin: 0.4rem 0;
  color: var(--text);
  line-height: 1.6;
}

.docs-callout p:first-child {
  margin-top: 0;
}

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

.docs-callout strong {
  color: var(--coral);
}

/* ---- Search result state ------------------------------------- */

.docs-section.is-hidden,
.docs-sidebar-eyebrow.is-hidden {
  display: none;
}

.docs-search-empty {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

/* ---- Responsive ---------------------------------------------- */

@media (max-width: 960px) {
  .docs-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .docs-sidebar {
    position: static;
    max-height: none;
    padding-right: 0;
  }

  .docs-sidebar-inner {
    padding: 1rem;
  }

  .docs-header {
    grid-template-columns: auto auto;
    grid-template-areas:
      "brand nav"
      "search search";
    border-radius: var(--radius-md);
  }

  .docs-header .brand { grid-area: brand; }
  .docs-header .site-nav { grid-area: nav; justify-self: end; flex-wrap: wrap; justify-content: flex-end; }
  .docs-search { grid-area: search; }
  .docs-search input { width: 100%; min-width: 0; }
}

@media (max-width: 600px) {
  .docs-hero h1 {
    font-size: 2.2rem;
  }

  .docs-section {
    padding: 1.8rem 0;
  }

  .docs-table thead th,
  .docs-table tbody td {
    padding: 0.5rem 0.55rem;
    font-size: 0.82rem;
  }
}
