/* =============================================================================
   NOMAD STUDIO — Documentation section
   Extends nomad.css tokens. Loaded only on /docs/** pages, after nomad.css.
   ========================================================================== */

/* ---------- Shell: sticky sidebar + content -------------------------------- */
.docs-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  padding-block: 18px clamp(72px, 9vw, 132px);
}
@media (max-width: 940px) {
  .docs-shell { grid-template-columns: 1fr; gap: 22px; }
}

/* Sidebar gets its own fixed-height scroll region (not just "sticky until it
   runs out of room") so its scrollbar is fully independent of the content
   column's — scrolling either one never moves the other. */
.docs-side {
  position: sticky;
  top: calc(var(--nav-h) + 14px);
  height: calc(100vh - var(--nav-h) - 28px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 10px;
  font-size: .92rem;
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}
.docs-side::-webkit-scrollbar { width: 7px; }
.docs-side::-webkit-scrollbar-track { background: transparent; }
.docs-side::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 10px; }
@media (max-width: 940px) { .docs-side { position: static; height: auto; overflow-y: visible; } }

.docs-side-title {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
  margin: 0 0 14px;
}

.docs-group { margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.docs-group summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 2px;
  font-weight: 700;
  color: var(--txt);
  font-size: .88rem;
}
.docs-group summary::-webkit-details-marker { display: none; }
.docs-group summary::after {
  content: '';
  width: 8px; height: 8px;
  border-right: 1.6px solid var(--txt-3);
  border-bottom: 1.6px solid var(--txt-3);
  transform: rotate(-45deg);
  transition: transform .2s var(--ease);
  flex: none;
}
.docs-group[open] summary::after { transform: rotate(45deg); }
.docs-group ul { list-style: none; margin: 0; padding: 0 0 12px; display: grid; gap: 1px; }
.docs-group li a,
.docs-group li span {
  display: block;
  padding: 7px 10px 7px 16px;
  border-radius: var(--r-sm);
  color: var(--txt-2);
  text-decoration: none;
  font-size: .87rem;
}
.docs-group li a:hover { color: var(--txt); background: var(--ink-800); }
.docs-group li a.is-current {
  color: var(--txt);
  font-weight: 700;
  background: color-mix(in srgb, var(--accent, var(--c-create)) 22%, var(--ink-800));
}
.docs-group li span.is-soon {
  color: var(--txt-3);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.docs-soon-tag {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 2px 7px;
  flex: none;
}

/* ---------- Content: breadcrumb, meta, prose -------------------------------- */
.docs-crumbs {
  font-size: .82rem;
  color: var(--txt-3);
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.docs-crumbs a { color: var(--txt-3); text-decoration: none; }
.docs-crumbs a:hover { color: var(--txt-2); }
.docs-crumbs span.sep { opacity: .5; }
.docs-crumbs span.here { color: var(--txt-2); }

.docs-h1 { margin: 0 0 10px; }

.docs-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 30px;
}
.docs-pill {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: normal;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid var(--line-2);
  color: var(--txt-2);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.docs-pill b { color: var(--txt); font-weight: 700; }
.docs-pill.is-accent { border-color: color-mix(in srgb, var(--accent) 55%, var(--line-2)); color: var(--accent); }

.docs-lead {
  font-size: 1.08rem;
  line-height: 1.62;
  color: var(--txt-2);
  max-width: 68ch;
}

.docs-section-title {
  font-size: .78rem;
  font-family: var(--mono);
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
  margin: 46px 0 18px;
  padding-top: 30px;
  border-top: 1px solid var(--line);
}
.docs-section-title:first-of-type { border-top: 0; padding-top: 0; margin-top: 34px; }

/* ---------- Guided walkthrough: numbered step cards ------------------------- */
.docs-steps { list-style: none; margin: 0; padding: 0; counter-reset: docstep; }
.docs-step {
  counter-increment: docstep;
  position: relative;
  padding: 22px 22px 22px 62px;
  margin-bottom: 14px;
  background: var(--ink-850);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.docs-step::before {
  content: counter(docstep);
  position: absolute;
  left: 20px; top: 20px;
  width: 28px; height: 28px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 18%, var(--ink-800));
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: .85rem;
  display: flex; align-items: center; justify-content: center;
}
.docs-step h4 { margin: 0 0 4px; font-size: 1.02rem; }
.docs-step .docs-step-type {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
  display: block;
  margin-bottom: 8px;
}
.docs-step p { margin: 0; color: var(--txt-2); font-size: .95rem; line-height: 1.6; }
.docs-step p + p { margin-top: 8px; }
.docs-step ul.docs-step-list { margin: 10px 0 0; padding-left: 18px; color: var(--txt-2); font-size: .92rem; line-height: 1.6; }

.docs-step details {
  margin-top: 12px;
  border-top: 1px dashed var(--line-2);
  padding-top: 12px;
}
.docs-step summary {
  cursor: pointer;
  font-size: .82rem;
  color: var(--accent);
  font-weight: 600;
}
.docs-step details pre {
  margin: 10px 0 0;
  padding: 14px 16px;
  background: var(--ink-900);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.55;
  color: var(--txt-2);
  white-space: pre-wrap;
  max-height: 340px;
  overflow-y: auto;
}

/* ---------- Real examples: result + full-page capture ----------------------- */
.docs-examples { display: grid; gap: 28px; margin-top: 10px; }
.docs-example {
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--ink-850);
}
.docs-example-head {
  padding: 14px 20px;
  border-bottom: 1px solid var(--line);
  font-size: .88rem;
  color: var(--txt-2);
}
.docs-example-head b { color: var(--txt); }
.docs-example-grid { display: grid; grid-template-columns: 260px 1fr; gap: 0; }
@media (max-width: 780px) { .docs-example-grid { grid-template-columns: 1fr; } }
.docs-example-result { padding: 18px; border-right: 1px solid var(--line); display: flex; align-items: center; }
@media (max-width: 780px) { .docs-example-result { border-right: 0; border-bottom: 1px solid var(--line); } }
.docs-example-result img,
.docs-example-shot img { width: 100%; display: block; cursor: zoom-in; }
.docs-example-result img { border-radius: var(--r-sm); }
.docs-example-shot { background: var(--ink-900); }

/* ---------- Lightbox: click an example image to view it full-size ---------- */
.docs-lightbox {
  position: fixed; inset: 0; z-index: 999;
  background: rgba(4, 6, 12, .92);
  display: flex; align-items: center; justify-content: center;
  padding: 40px;
  opacity: 0; pointer-events: none;
  transition: opacity .18s var(--ease);
}
.docs-lightbox.is-open { opacity: 1; pointer-events: auto; }
.docs-lightbox img {
  max-width: 100%; max-height: 100%;
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  cursor: zoom-out;
}
.docs-lightbox-close {
  position: absolute; top: 22px; right: 28px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--line-2);
  background: var(--ink-850);
  color: var(--txt);
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}
.docs-lightbox-close:hover { background: var(--ink-800); }
.docs-example-caption {
  padding: 8px 20px 16px;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
}

/* ---------- Doc index cards -------------------------------------------------- */
.docs-idx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.docs-idx-card {
  display: block;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--ink-850);
  text-decoration: none;
  transition: border-color .2s, transform .2s;
}
.docs-idx-card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.docs-idx-card h4 { margin: 0 0 6px; color: var(--txt); font-size: .98rem; }
.docs-idx-card p { margin: 0; color: var(--txt-3); font-size: .82rem; line-height: 1.5; }
.docs-idx-card.is-soon { opacity: .5; pointer-events: none; }

/* ---------- Prev / next footer ------------------------------------------------ */
.docs-pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 50px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
}
.docs-pager a {
  flex: 1;
  max-width: 48%;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  text-decoration: none;
  color: var(--txt-2);
}
.docs-pager a:hover { border-color: var(--line-2); color: var(--txt); }
.docs-pager a.is-next { text-align: right; margin-left: auto; }
.docs-pager span.docs-pager-label {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: normal;
  text-transform: uppercase;
  color: var(--txt-3);
  margin-bottom: 4px;
}
