/* Doc pages — shared layout (includes/*.html) */
:root {
  --doc-sidebar-width: 15rem;
  --doc-content-max: 48rem;
}

.doc-page {
  min-height: 100vh;
  background: var(--sf-bg);
  color: var(--sf-color-text);
  overflow-x: clip;
}

@supports not (overflow: clip) {
  .doc-page {
    overflow-x: hidden;
  }
}

/* .navbar is position:fixed in suhu-framework.css (same as index.html) */

.doc-shell {
  display: block;
  max-width: 90rem;
  margin: 0 auto;
  padding: 0 1rem 2.5rem;
}

@media (min-width: 992px) {
  .doc-shell {
    display: grid;
    grid-template-columns: var(--doc-sidebar-width) minmax(0, 1fr);
    gap: 0;
    padding: 0 1.5rem 3rem;
  }
}

/* Sidebar: desktop only — mobile/tablet use navbar offcanvas */
.doc-sidebar {
  display: none !important;
  visibility: hidden;
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
  clip: rect(0, 0, 0, 0);
}

@media (min-width: 992px) {
  .doc-sidebar {
    display: block !important;
    visibility: visible;
    position: sticky;
    width: auto;
    height: auto;
    overflow-y: auto;
    pointer-events: auto;
    clip: auto;
    top: var(--navbar-height);
    align-self: start;
    max-height: calc(100vh - var(--navbar-height));
    padding: 1.5rem 1.25rem 1.5rem 0;
  }
}

.doc-sidebar__label {
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sf-color-text-subtle);
  margin: 0 0 0.5rem;
}

.doc-sidebar__nav {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
  margin-bottom: 1.25rem;
}

.doc-sidebar__link {
  display: block;
  padding: 0.4375rem 0.625rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sf-color-text-muted);
  text-decoration: none;
  border-radius: var(--radius);
  transition: background var(--transition-fast), color var(--transition-fast);
}

.doc-sidebar__link:hover {
  color: var(--sf-color-text);
  background: var(--sf-hover-bg);
  text-decoration: none;
}

.doc-sidebar__link.active {
  color: var(--sf-blue-600);
  background: rgb(14 165 233 / 0.1);
}

.doc-main {
  min-width: 0;
  width: 100%;
  padding: 1rem 0 0;
}

@media (min-width: 992px) {
  .doc-main {
    padding: 1.75rem 0 0 2rem;
  }
}

.doc-article {
  max-width: 100%;
  min-width: 0;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

@media (min-width: 992px) {
  .doc-article {
    max-width: var(--doc-content-max);
  }
}

.doc-article h1 {
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.75rem;
}

.doc-lead {
  font-size: 1.0625rem;
  line-height: 1.65;
  color: var(--sf-color-text-muted);
  margin: 0 0 2rem;
}

.doc-note {
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--sf-color-text-muted);
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: var(--sf-surface-2);
  border: 1px solid var(--sf-border);
  border-radius: var(--radius);
}

.doc-article h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 2.25rem 0 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--sf-border);
}

.doc-article h2:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

.doc-article h3 {
  font-size: 1rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
}

.doc-article p,
.doc-article li {
  font-size: 0.9375rem;
  line-height: 1.7;
  color: var(--sf-color-text-muted);
}

.doc-article p { margin: 0 0 1rem; }

.doc-article ul,
.doc-article ol {
  margin: 0 0 1rem;
  padding-left: 1.35rem;
}

.doc-article li { margin-bottom: 0.35rem; }

/* .doc-main: all links use link-primary (installation, configuration, full-guide) */
.doc-main a:not(.btn) {
  color: var(--sf-blue-500) !important;
  text-decoration: none;
  text-decoration-color: var(--sf-blue-500) !important;
}

.doc-main a:not(.btn):hover {
  color: var(--sf-blue-600) !important;
  text-decoration: none !important;
}

.doc-article code {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85em;
  padding: 0.15em 0.4em;
  background: var(--sf-surface-2);
  border: 1px solid var(--sf-border);
  border-radius: var(--radius-lg);
  color: var(--sf-color-text);
}

/* Tip alert — override framework flex so text wraps on narrow screens */
.doc-article .doc-tip {
  display: block;
  max-width: 100%;
  box-sizing: border-box;
  margin-bottom: 1.5rem;
}

.doc-tip__text {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: inherit;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.doc-tip__label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

@media (min-width: 480px) {
  .doc-tip__label {
    display: inline;
    margin: 0 0.35rem 0 0;
    text-transform: none;
    letter-spacing: normal;
    font-size: inherit;
  }

  .doc-tip__label::after {
    content: ':';
  }
}

.doc-view-code-label {
  display: inline-block;
  max-width: 100%;
  padding: 0.1em 0.45em;
  font-style: normal;
  font-weight: 600;
  font-size: 0.875em;
  white-space: normal;
  overflow-wrap: anywhere;
  background: rgb(6 182 212 / 0.12);
  border: 1px solid rgb(6 182 212 / 0.25);
  border-radius: var(--radius-lg);
  vertical-align: baseline;
}

.doc-pre {
  margin: 0 0 1.25rem;
  padding: 1rem 1.125rem;
  background: var(--sf-surface-2);
  border: 1px solid var(--sf-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
  max-width: 100%;
  box-sizing: border-box;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--sf-color-text);
}

.doc-pre code {
  display: block;
  min-width: 0;
  white-space: pre;
  padding: 0;
  background: none;
  border: none;
  font-size: inherit;
}

.doc-card {
  margin-bottom: 1rem;
}

.doc-card .card-body {
  padding: 1.25rem;
}

.doc-table-wrap {
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.doc-table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.doc-table th,
.doc-table td {
  padding: 0.625rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--sf-border);
}

.doc-table th {
  font-weight: 600;
  color: var(--sf-color-text);
  background: var(--sf-surface-2);
}

.doc-breadcrumb {
  margin-bottom: 1.25rem;
}

.doc-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--sf-border);
}

.doc-toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr));
  gap: 0.5rem;
  margin: 0 0 1.5rem;
}

.doc-toc-grid a:not(.btn) {
  display: block;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--sf-color-text-muted);
  background: var(--sf-surface);
  border: 1px solid var(--sf-border);
  border-radius: var(--radius);
  text-decoration: none;
  transition: border-color var(--transition-fast), color var(--transition-fast);
}

.doc-toc-grid a:not(.btn):hover {
  color: var(--sf-blue-600);
  border-color: var(--sf-blue-500);
}

.doc-toc-grid .btn {
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
}

/* Offcanvas in-page links (no icon column) */
.doc-offcanvas-anchor .link-text {
  margin-left: 0;
}

@media (max-width: 991.98px) {
  .doc-shell,
  .doc-main,
  .doc-article {
    max-width: 100%;
    min-width: 0;
  }

  .doc-pre,
  .doc-table-wrap {
    -webkit-overflow-scrolling: touch;
  }

  .doc-pre {
    padding: 0.875rem;
    font-size: 0.75rem;
  }

  .doc-toc-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .doc-toc-grid a,
  .doc-toc-grid .btn {
    min-width: 0;
    overflow-wrap: anywhere;
    word-break: break-word;
    hyphens: auto;
  }

  .doc-article code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .doc-breadcrumb {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex-wrap: nowrap;
    max-width: 100%;
  }

  .doc-actions .btn {
    flex: 1 1 100%;
    width: 100%;
    max-width: 100%;
  }
}

@media (max-width: 479.98px) {
  .doc-toc-grid {
    grid-template-columns: 1fr;
  }
}
