/* =============================================
   UMA DOCS — layout, sidebar, content
   Inherits base variables from styles-sage.css
   ============================================= */

/* ── Shell layout ── */
.docs-shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 57px);
  align-items: start;
}

/* ── Top nav ── */
.shai-docs-nav {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(250,250,249,.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.shai-docs-nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 24px;
  gap: 16px;
}

.shai-docs-nav__logo {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--text);
  text-decoration: none;
}

.shai-docs-nav__logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.shai-docs-nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.shai-docs-nav__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  transition: color .14s, background .14s;
}

.shai-docs-nav__link:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.shai-docs-nav__back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--muted);
  border: 1px solid var(--border);
  background: var(--bg-white);
  text-decoration: none;
  transition: color .14s, background .14s;
}

.shai-docs-nav__back:hover {
  color: var(--text-2);
  background: var(--bg-alt);
}

/* ── Hamburger ── */
.docs-hamburger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-white);
  cursor: pointer;
  flex-shrink: 0;
}

.docs-hamburger__bar {
  display: block;
  height: 2px;
  background: var(--text-2);
  border-radius: 2px;
  transform-origin: center;
  transition: transform .22s ease, opacity .18s ease;
}

.docs-hamburger.is-open .docs-hamburger__bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.docs-hamburger.is-open .docs-hamburger__bar:nth-child(2) { opacity: 0; transform: scaleX(0); }
.docs-hamburger.is-open .docs-hamburger__bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ── Backdrop ── */
.docs-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 49;
  background: rgba(28,25,23,.38);
  backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 220ms;
}

.docs-backdrop.is-visible {
  opacity: 1;
}

/* ── Sidebar ── */
.docs-sidebar {
  position: sticky;
  top: 57px;
  height: calc(100vh - 57px);
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: var(--bg-white);
  padding: 24px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.docs-sidebar::-webkit-scrollbar { width: 4px; }
.docs-sidebar::-webkit-scrollbar-track { background: transparent; }
.docs-sidebar::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.docs-sidebar__logo {
  padding: 0 20px 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}

.docs-sidebar__logo a {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.docs-sidebar__logo-badge {
  font-family: var(--font);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--accent-border);
  padding: 2px 7px;
  border-radius: 999px;
}

/* ── Sidebar nav ── */
.docs-nav {
  padding: 0 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.docs-nav__group {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-bottom: 12px;
}

.docs-nav__group-label {
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 6px;
  display: block;
}

.docs-nav__link {
  display: block;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--muted);
  border-radius: 7px;
  text-decoration: none;
  transition: color .13s, background .13s;
  line-height: 1.4;
}

.docs-nav__link:hover {
  color: var(--text);
  background: var(--bg-alt);
}

.docs-nav__link.is-active {
  color: var(--accent);
  background: var(--accent-light);
  font-weight: 600;
}

/* ── Main content area ── */
.docs-main {
  width: 100%;
  padding: 48px 56px 80px;
  min-width: 0;
  max-width: 860px;
  box-sizing: border-box;
}

/* ── Page title ── */
.docs-page-title {
  width: 100%;
  max-width: 100%;
  padding-bottom: 36px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.docs-page-title .eyebrow {
  display: block;
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.docs-page-title h1 {
  font-family: var(--font-display);
  font-size: 35px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin: 0 0 12px;
  color: var(--text);
}

.docs-page-title p {
  font-size: 1.05rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
  max-width: 540px;
}

/* ── Sections ── */
.docs-section {
  width: 100%;
  max-width: 100%;
  padding: 48px 0 0;
  scroll-margin-top: 80px;
}

.docs-section + .docs-section {
  border-top: 1px solid var(--border);
}

.docs-section__eyebrow {
  display: inline-block;
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 6px;
}

.docs-section h2 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--text);
  margin: 0 0 16px;
}

.docs-section h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 28px 0 10px;
}

.docs-section p {
  font-size: 0.95rem;
  color: var(--text-2);
  line-height: 1.75;
  margin: 0 0 14px;
}

.docs-section ul,
.docs-section ol {
  padding-left: 20px;
  margin: 0 0 16px;
  color: var(--text-2);
  font-size: 0.93rem;
  line-height: 1.75;
}

.docs-section li + li { margin-top: 5px; }

.docs-section code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--accent);
  padding: 1px 6px;
  border-radius: 5px;
}

/* ── Code blocks ── */
.docs-codeblock {
  background: #1c1917;
  border: 1px solid #292524;
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0 20px;
}

.docs-codeblock__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 18px;
  border-bottom: 1px solid #292524;
  background: #111110;
}

.docs-codeblock__header span {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: rgba(168,162,158,.5);
}

.docs-codeblock pre {
  margin: 0;
  padding: 20px 22px;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  line-height: 1.75;
  color: #d6d3d1;
  overflow-x: auto;
}

.docs-codeblock pre .kw  { color: #c084fc; }
.docs-codeblock pre .fn  { color: #818cf8; }
.docs-codeblock pre .str { color: #86efac; }
.docs-codeblock pre .cm  { color: #57534e; font-style: italic; }
.docs-codeblock pre .op  { color: #57534e; }
.docs-codeblock pre .kv  { color: #67e8f9; }

/* ── Callouts ── */
.docs-callout {
  display: flex;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  border: 1px solid;
  margin: 16px 0 20px;
}

.docs-callout p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.65;
}

.docs-callout__icon {
  font-size: 0.9rem;
  flex-shrink: 0;
  margin-top: 1px;
}

.docs-callout--info {
  background: var(--secondary-light);
  border-color: var(--secondary-border);
  color: var(--secondary);
}

.docs-callout--info p { color: #1e3a8a; }

.docs-callout--warn {
  background: #fff8ed;
  border-color: #fed7aa;
  color: var(--accent);
}

.docs-callout--warn p { color: #92400e; }

/* ── Tables ── */
.docs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  margin: 14px 0 22px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

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

.docs-table th {
  padding: 10px 14px;
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}

.docs-table td {
  padding: 10px 14px;
  color: var(--text-2);
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
  vertical-align: top;
}

.docs-table tbody tr:last-child td { border-bottom: none; }
.docs-table tbody tr:hover td { background: var(--bg-alt); }

/* ── Tags ── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 2px 8px;
  border-radius: 999px;
}

.tag--required {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.tag--optional {
  background: var(--bg-alt);
  color: var(--muted);
  border: 1px solid var(--border);
}

/* ── Gradient text utility (reused from sage) ── */
.text-gradient {
  background: var(--gradient-text);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: var(--accent);
}

/* ── Ordered steps ── */
.docs-steps {
  padding-left: 0;
  list-style: none;
  counter-reset: step-counter;
  display: flex;
  flex-direction: column;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin: 14px 0 20px;
  background: var(--bg-white);
}

.docs-steps li {
  counter-increment: step-counter;
  display: flex;
  gap: 10px;
  padding: 20px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-white);
  position: relative;
  transition: background .15s;
}

.docs-steps li:last-child { border-bottom: none; }
.docs-steps li:hover { background: var(--bg-alt); }

.docs-steps li::before {
  content: counter(step-counter, decimal-leading-zero);
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--accent);
  background: var(--accent-light);
  border: 1px solid var(--accent-border);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
  height: max-content;
  flex-shrink: 0;
  margin-top: 2px;
}

.docs-steps li > div { flex: 1; min-width: 0; }
.docs-steps li p { margin: 0 0 8px; }
.docs-steps li p:last-child { margin-bottom: 0; }

/* ── Quick start grid ── */
.docs-steps-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
  margin: 14px 0 20px;
}

.docs-steps-items {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 20px 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-white);
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.docs-steps-items__num {
  padding-top: 2px;
}

.docs-steps-items__body {
  min-width: 0;
}

.docs-steps-items__body p {
  margin: 0 0 10px;
}

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

.docs-steps-items .docs-codeblock {
  margin: 14px 0;
}

/* ── Footer CTA surfaces ── */
.btn-dark-primary,
.btn-dark-secondary,
.btn-animus {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 20px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.btn-dark-primary {
  color: #111110;
  background: #ffffff;
  border: 1px solid #ffffff;
}

.btn-dark-primary:hover {
  background: #f5f5f4;
  border-color: #f5f5f4;
  transform: translateY(-1px);
}

.btn-dark-secondary,
.btn-animus {
  color: rgba(255, 255, 255, 0.9);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-dark-secondary:hover,
.btn-animus:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.animus-promo__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 28px;
  align-items: center;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 28px;
  background:
    radial-gradient(circle at top left, rgba(63, 102, 221, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 28px 80px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(18px);
}

.animus-promo__content {
  min-width: 0;
}

.animus-promo__eyebrow {
  display: inline-block;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.animus-promo__content h1 {
  margin: 0 0 14px;
  color: #ffffff;
  font-size: 38px;
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.04;
}

.animus-promo__content p {
  margin: 0;
  max-width: 760px;
  color: rgba(255, 255, 255, 0.74);
  font-size: 1rem;
  line-height: 1.7;
}

.animus-promo__actions {
  justify-self: end;
}

/* ── Responsive ── */
@media (max-width: 860px) {
  .docs-shell {
    grid-template-columns: 1fr;
  }

  .shai-final-hero__inner,
  .animus-promo__inner {
    grid-template-columns: 1fr;
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100dvh;
    transform: translateX(-100%);
    transition: transform 260ms cubic-bezier(.4,0,.2,1);
    z-index: 50;
  }

  .docs-sidebar.is-open {
    transform: translateX(0);
  }

  .docs-backdrop {
    display: block;
  }

  .docs-hamburger {
    display: flex;
  }

  .docs-main {
    width: 100%;
    max-width: none;
    padding: 32px 20px 64px;
  }

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

@media (max-width: 540px) {
  .shai-docs-nav__link span { display: none; }
  .shai-docs-nav__link { padding: 6px 8px; }
  .docs-main {
    width: 100%;
    max-width: none;
    padding: 24px 16px 56px;
  }

  .shai-final-hero {
    padding: 64px 0;
  }

  .shai-final-hero__panel,
  .animus-promo__inner {
    border-radius: 22px;
    padding: 24px;
  }

  .shai-final-hero__actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-dark-primary,
  .btn-dark-secondary,
  .btn-animus {
    width: 100%;
  }

  .sg-footer__inner {
    grid-template-columns: 1fr;
    align-items: flex-start;
  }

  .sg-footer__brand:nth-of-type(1),
  .sg-footer__links,
  .sg-footer__copy {
    grid-column: 1;
    justify-self: start;
  }

  .sg-footer__links {
    grid-row: 3;
  }

  .sg-footer__copy {
    grid-row: 4;
  }

  .sg-footer__brand-image {
    width: min(160px, 100%);
  }

  .docs-steps-items {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 18px 16px;
  }
}
