/* ==========================================================================
   Documentation shell: left navigation, article, right "On this page"
   ========================================================================== */

.docs-shell {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding-left: 0;
    padding-right: 0;
}

@media (min-width: 992px) {
    .docs-shell {
        grid-template-columns: 16rem minmax(0, 1fr);
    }
}

@media (min-width: 1200px) {
    .docs-shell {
        grid-template-columns: 16.5rem minmax(0, 1fr) 14rem;
    }

    .docs-shell.docs-shell-no-toc {
        grid-template-columns: 16.5rem minmax(0, 1fr);
    }
}

/* Left navigation */

.docs-sidebar {
    background: var(--tep-surface-muted);
    border-right: 1px solid var(--tep-border);
}

@media (min-width: 992px) {
    .docs-sidebar-offcanvas {
        position: sticky;
        top: calc(var(--tep-header-height) + var(--tep-section-bar-height));
        max-height: calc(100vh - var(--tep-header-height) - var(--tep-section-bar-height));
        overflow-y: auto;
        padding: 1.5rem 1rem 2rem;
    }
}

.docs-sidebar .offcanvas-body {
    flex-direction: column;
    gap: 1.5rem;
}

@media (max-width: 991.98px) {
    .docs-sidebar {
        background: transparent;
        border-right: 0;
    }

    .docs-sidebar .offcanvas-lg {
        background: var(--tep-surface-muted);
    }
}

.docs-nav-section-title {
    display: block;
    margin-bottom: 0.5rem;
    padding: 0.25rem 0.75rem;
    color: var(--tep-navy);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-decoration: none;
    text-transform: uppercase;
}

.docs-nav-section-title:hover {
    color: var(--tep-blue);
}

.docs-nav-section-title.active {
    color: var(--tep-blue);
}

.docs-nav-empty {
    padding: 0 0.75rem;
    color: var(--tep-text-muted);
    font-size: 0.875rem;
}

.nav-tree {
    margin: 0;
    padding: 0;
    list-style: none;
}

.nav-tree .nav-tree {
    margin-left: 0.75rem;
    padding-left: 0.5rem;
    border-left: 1px solid var(--tep-border-strong);
}

.nav-tree-link {
    display: block;
    margin: 0.1rem 0;
    padding: 0.45rem 0.75rem;
    border-radius: var(--tep-radius-sm);
    color: var(--tep-text);
    font-size: 0.9rem;
    line-height: 1.35;
    text-decoration: none;
}

.nav-tree-link:hover {
    background: rgba(36, 91, 152, 0.07);
    color: var(--tep-navy);
}

.nav-tree-link.active {
    background: var(--tep-active-bg);
    color: var(--tep-navy);
    font-weight: 600;
}

.nav-tree-group-header {
    display: flex;
    align-items: center;
}

.nav-tree-group-header .nav-tree-link {
    flex: 1;
}

.nav-tree-category {
    font-weight: 500;
}

.nav-tree-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: var(--tep-radius-sm);
    background: transparent;
    color: var(--tep-text-muted);
}

.nav-tree-toggle:hover {
    background: rgba(36, 91, 152, 0.08);
    color: var(--tep-navy);
}

.nav-tree-toggle .bi {
    transition: transform 0.15s ease;
}

.nav-tree-toggle.collapsed .bi {
    transform: rotate(-90deg);
}

.docs-nav-other {
    padding-top: 1rem;
    border-top: 1px solid var(--tep-border-strong);
}

.docs-nav-other-title {
    margin: 0 0 0.4rem;
    padding: 0 0.75rem;
    color: var(--tep-text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.docs-nav-other ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.docs-nav-other a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.75rem;
    border-radius: var(--tep-radius-sm);
    color: var(--tep-text-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.docs-nav-other a:hover {
    color: var(--tep-navy);
    background: rgba(36, 91, 152, 0.07);
}

.docs-nav-other a.active {
    color: var(--tep-navy);
    font-weight: 600;
}

/* Main column */

.docs-main {
    min-width: 0;
    padding: 1.5rem 1rem 3rem;
    background: var(--tep-surface);
}

@media (min-width: 768px) {
    .docs-main {
        padding: 2rem 2.5rem 3.5rem;
    }
}

.docs-nav-toggle {
    margin-bottom: 1rem;
}

.doc-breadcrumbs .breadcrumb {
    --bs-breadcrumb-divider: "/";
    --bs-breadcrumb-item-active-color: var(--tep-text-muted);
    margin-bottom: 1rem;
    font-size: 0.825rem;
}

.doc-breadcrumbs .breadcrumb a {
    color: var(--tep-text-muted);
    text-decoration: none;
}

.doc-breadcrumbs .breadcrumb a:hover {
    color: var(--tep-blue);
    text-decoration: underline;
}

.doc-article,
.category-section,
.category-header,
.empty-state {
    max-width: var(--tep-content-width);
}

.doc-header {
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--tep-border);
}

.doc-title {
    margin-bottom: 0.5rem;
    font-size: clamp(1.5rem, 1.5vw + 1rem, 1.9rem);
}

.doc-lead {
    margin-bottom: 0.75rem;
    color: var(--tep-text-muted);
    font-size: 1.05rem;
}

.doc-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.4rem 1rem;
    color: var(--tep-text-muted);
    font-size: 0.825rem;
}

.doc-meta-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.doc-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.doc-badge-org {
    background: var(--tep-accent-soft);
    color: var(--tep-blue);
}

.doc-badge-restricted {
    background: var(--tep-important-bg);
    color: var(--tep-important);
}

.doc-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

/* Mobile "On this page" */

.toc-mobile {
    margin-bottom: 1.5rem;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: var(--tep-surface-muted);
}

.toc-mobile summary {
    padding: 0.7rem 1rem;
    color: var(--tep-navy);
    font-weight: 600;
    cursor: pointer;
}

.toc-mobile .toc-list {
    padding: 0 1rem 0.75rem;
}

/* ==========================================================================
   Article content typography
   ========================================================================== */

.doc-content {
    font-size: 1rem;
    line-height: 1.7;
}

.doc-content > * + * {
    margin-top: 1rem;
}

.doc-content h2 {
    margin-top: 2.25rem;
    margin-bottom: 0.75rem;
    font-size: 1.35rem;
}

.doc-content h3 {
    margin-top: 1.75rem;
    margin-bottom: 0.5rem;
    font-size: 1.1rem;
}

.doc-content h4 {
    margin-top: 1.5rem;
    font-size: 1rem;
}

.doc-content > h2:first-child,
.doc-content > h3:first-child {
    margin-top: 0;
}

.doc-content p,
.doc-content ul,
.doc-content ol,
.doc-content dl {
    margin-bottom: 0;
}

.doc-content ul,
.doc-content ol {
    padding-left: 1.5rem;
}

.doc-content li + li {
    margin-top: 0.35rem;
}

/* Top-level numbered lists are styled as procedures */
.doc-content > ol {
    counter-reset: step;
    padding: 1rem 1.25rem;
    border-radius: var(--tep-radius);
    background: var(--tep-surface-muted);
    list-style: none;
}

.doc-content > ol > li {
    position: relative;
    padding-left: 2.25rem;
    counter-increment: step;
}

.doc-content > ol > li::before {
    content: counter(step);
    position: absolute;
    left: 0;
    top: 0.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.6rem;
    height: 1.6rem;
    border-radius: 50%;
    background: var(--tep-blue);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    line-height: 1;
}

.doc-content > ol > li + li {
    margin-top: 0.6rem;
}

.doc-content code {
    padding: 0.1em 0.35em;
    border-radius: 4px;
    background: var(--tep-surface-muted);
    color: var(--tep-navy);
    font-family: var(--tep-font-mono);
    font-size: 0.875em;
}

.doc-content pre {
    padding: 1rem 1.25rem;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: #F8FAFD;
    overflow-x: auto;
}

.doc-content pre code {
    padding: 0;
    background: transparent;
}

.doc-content blockquote {
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--tep-border-strong);
    color: var(--tep-text-muted);
}

.doc-content hr {
    margin: 2rem 0;
    border-color: var(--tep-border);
    opacity: 1;
}

.doc-content dt {
    font-weight: 600;
    color: var(--tep-navy);
}

.doc-content dd {
    margin-left: 0;
    margin-bottom: 0.75rem;
    color: var(--tep-text);
}

.doc-content a.external-link::after {
    content: "\F1C5";
    display: inline-block;
    margin-left: 0.2em;
    font-family: "bootstrap-icons";
    font-size: 0.7em;
    vertical-align: 0.1em;
}

/* Tables */

.doc-table-wrapper {
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
}

.doc-table {
    --bs-table-bg: var(--tep-surface);
    margin: 0;
    font-size: 0.925rem;
}

.doc-table thead th {
    background: var(--tep-surface-muted);
    color: var(--tep-navy);
    font-weight: 600;
    white-space: nowrap;
}

.doc-table th,
.doc-table td {
    padding: 0.65rem 0.85rem;
    vertical-align: top;
}

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

/* Callouts: :::note, :::tip, :::important, :::warning, :::caution, :::troubleshooting, :::placeholder */

.callout {
    margin: 1.25rem 0;
    padding: 0.9rem 1.1rem;
    border: 1px solid var(--tep-border);
    border-left-width: 4px;
    border-radius: var(--tep-radius);
    background: var(--tep-note-bg);
}

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

.callout > * + * {
    margin-top: 0.5rem;
}

.callout-title {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 0.25rem;
    font-weight: 700;
}

.callout-note {
    border-left-color: var(--tep-note);
    background: var(--tep-note-bg);
}

.callout-note .callout-title {
    color: var(--tep-note);
}

.callout-tip {
    border-left-color: var(--tep-tip);
    background: var(--tep-tip-bg);
}

.callout-tip .callout-title {
    color: var(--tep-tip);
}

.callout-important {
    border-left-color: var(--tep-important);
    background: var(--tep-important-bg);
}

.callout-important .callout-title {
    color: var(--tep-important);
}

.callout-warning,
.callout-caution {
    border-left-color: var(--tep-warning-border);
    background: var(--tep-warning-bg);
}

.callout-warning .callout-title,
.callout-caution .callout-title {
    color: var(--tep-warning);
}

.callout-caution {
    border-left-color: var(--tep-danger);
    background: var(--tep-danger-bg);
}

.callout-caution .callout-title {
    color: var(--tep-danger);
}

.callout-troubleshooting {
    border-left-color: var(--tep-navy);
    background: var(--tep-surface-muted);
}

.callout-troubleshooting .callout-title {
    color: var(--tep-navy);
}

.callout-placeholder {
    border-style: dashed;
    border-left-style: solid;
    border-left-color: var(--tep-placeholder);
    background: var(--tep-placeholder-bg);
}

.callout-placeholder .callout-title {
    color: var(--tep-placeholder);
}

.doc-article > .callout-placeholder {
    margin-top: 0;
    margin-bottom: 1.5rem;
}

/* Figures and screenshots */

.doc-figure {
    margin: 1.5rem 0;
}

.doc-figure-link {
    display: block;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: #F8FAFD;
    overflow: hidden;
    cursor: zoom-in;
}

.doc-figure-link:hover {
    border-color: var(--tep-accent);
}

.doc-figure img {
    display: block;
    max-width: 100%;
    height: auto;
    margin: 0 auto;
}

.doc-figure figcaption {
    margin-top: 0.5rem;
    color: var(--tep-text-muted);
    font-size: 0.85rem;
    text-align: center;
}

.doc-placeholder-frame {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 1rem 1.25rem;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: var(--tep-surface);
    color: var(--tep-text-muted);
    font-size: 0.925rem;
}

.doc-placeholder-frame .bi {
    font-size: 1.1rem;
}

.doc-figure-placeholder figcaption {
    text-align: left;
}

.image-lightbox .modal-body {
    padding: 0.5rem;
    text-align: center;
    background: #F8FAFD;
}

/* Downloads and related */

.doc-downloads,
.doc-related {
    margin-top: 2.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tep-border);
}

.doc-downloads h2,
.doc-related h2 {
    font-size: 1.15rem;
}

.download-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.download-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: var(--tep-surface);
}

.download-item + .download-item {
    margin-top: 0.6rem;
}

.download-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: var(--tep-radius-sm);
    background: var(--tep-accent-soft);
    color: var(--tep-blue);
    font-size: 1.25rem;
}

.download-text {
    display: flex;
    flex: 1;
    flex-direction: column;
    min-width: 0;
}

.download-title {
    font-weight: 600;
}

.download-meta {
    color: var(--tep-text-muted);
    font-size: 0.8rem;
}

/* Pager */

.doc-pager {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    max-width: var(--tep-content-width);
    margin-top: 2.5rem;
}

.doc-pager-link {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 0.9rem 1rem;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    text-decoration: none;
}

.doc-pager-link:hover {
    border-color: var(--tep-accent);
    background: var(--tep-accent-soft);
}

.doc-pager-next {
    grid-column: 2;
    text-align: right;
}

.doc-pager-label {
    color: var(--tep-text-muted);
    font-size: 0.8rem;
}

.doc-pager-title {
    color: var(--tep-blue);
    font-weight: 600;
}

/* Right column: On this page */

.docs-toc {
    background: var(--tep-surface-muted);
    border-left: 1px solid var(--tep-border);
}

.docs-toc-inner {
    position: sticky;
    top: calc(var(--tep-header-height) + var(--tep-section-bar-height));
    max-height: calc(100vh - var(--tep-header-height) - var(--tep-section-bar-height));
    overflow-y: auto;
    padding: 2rem 1rem;
}

.toc-title {
    margin-bottom: 0.6rem;
    color: var(--tep-navy);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.toc-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.toc-link {
    display: block;
    padding: 0.3rem 0.6rem;
    border-left: 2px solid transparent;
    color: var(--tep-text-muted);
    font-size: 0.825rem;
    line-height: 1.4;
    text-decoration: none;
}

.toc-link:hover {
    color: var(--tep-navy);
}

.toc-link.active {
    border-left-color: var(--tep-blue);
    color: var(--tep-blue);
    font-weight: 600;
}

.toc-level-3 .toc-link {
    padding-left: 1.25rem;
}

/* ==========================================================================
   Category and guides pages
   ========================================================================== */

.category-header {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--tep-border);
}

.category-header-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 3rem;
    height: 3rem;
    border-radius: var(--tep-radius);
    background: var(--tep-accent-soft);
    color: var(--tep-blue);
    font-size: 1.4rem;
}

.category-section {
    margin-bottom: 2rem;
}

.category-section h2 {
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.planned-list {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 1px solid var(--tep-border);
    border-radius: var(--tep-radius);
    background: var(--tep-surface);
}

.planned-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.7rem 1rem;
    color: var(--tep-text-muted);
}

.planned-list li + li {
    border-top: 1px solid var(--tep-border);
}

.guides-page {
    padding-top: 2rem;
    padding-bottom: 3rem;
}

.guides-header {
    margin-bottom: 1.5rem;
}

.guides-grid {
    display: grid;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .guides-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

.guide-tree {
    margin: 0.5rem 0 0;
    padding: 0;
    list-style: none;
}

.guide-tree .guide-tree {
    margin-left: 1.25rem;
}

.guide-tree li {
    padding: 0.2rem 0;
}

.guide-tree a {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
}

.guide-tree a:hover {
    text-decoration: underline;
}

.guide-tree-category > a {
    font-weight: 600;
    color: var(--tep-navy);
}

.guide-tree .badge-soon {
    margin-left: 0.5rem;
}
