/*
  ----------------------------------------
  Docs
  ----------------------------------------
*/

@layer styles {
    .docs-page {
        width: 100%;
        padding-top: var(--space-lg);
        padding-bottom: var(--space-xl);
        color: var(--darker);
    }

    .docs-index {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
        gap: var(--space-sm);
        max-width: var(--container-max);
        padding: 0;
        margin: 0;
    }

    .docs-index-link {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        min-height: 4rem;
        padding: var(--space-sm);
        color: var(--darker);
        text-decoration: none;
        background: var(--white);
        border: var(--border) solid var(--light);
        border-radius: var(--rounded);
        box-shadow: var(--shadow-sm);
        transition:
            border-color 150ms ease,
            transform 150ms ease,
            box-shadow 150ms ease;
    }

    .docs-index-link:hover {
        border-color: var(--brand-2);
        box-shadow: var(--shadow);
        transform: translateY(-1px);
    }

    .docs-index-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 2.5rem;
        width: 2.5rem;
        height: 2.5rem;
        color: var(--white);
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        background: var(--brand-2);
        border-radius: var(--rounded-sm);
        font-variant-numeric: tabular-nums;
    }

    .knowledge-area-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
        gap: var(--space-sm);
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .knowledge-area-grid > li {
        min-width: 0;
    }

    .knowledge-document-grid {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(min(100%, 24rem), 1fr));
        gap: var(--space-sm);
        width: 100%;
        max-width: none;
        padding: 0;
        margin: 0;
    }

    .knowledge-document-grid > li {
        min-width: 0;
    }

    .knowledge-section-overview {
        display: grid;
        grid-template-columns: minmax(0, 1fr) auto;
        align-items: center;
        gap: var(--space-md);
        padding: var(--space-md);
        color: var(--white);
        background: var(--darker);
        border-radius: var(--rounded);
        box-shadow: var(--shadow-sm);
    }

    .knowledge-section-overview-content {
        display: flex;
        flex-direction: column;
        gap: var(--space-2xs);
        max-width: var(--max-w-text);
    }

    .knowledge-section-overview-label {
        color: var(--brand-1);
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .knowledge-section-overview-title,
    .knowledge-section-overview-description {
        margin: 0;
    }

    .knowledge-section-overview-description {
        color: var(--lighter);
        line-height: 1.6;
    }

    .knowledge-area-card {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
        height: 100%;
        padding: var(--space-md);
        color: var(--darker);
        text-decoration: none;
        background: var(--white);
        border: var(--border) solid var(--light);
        border-radius: var(--rounded);
        box-shadow: var(--shadow-sm);
        transition:
            border-color 150ms ease,
            transform 150ms ease,
            box-shadow 150ms ease;
    }

    .knowledge-area-card:hover {
        border-color: var(--brand-2);
        box-shadow: var(--shadow);
        transform: translateY(-1px);
    }

    .knowledge-area-card-heading {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
    }

    .knowledge-area-card-title {
        display: block;
        font-size: var(--text-lg);
        font-weight: var(--font-semibold);
    }

    .knowledge-area-card-description {
        color: var(--dark);
        line-height: 1.5;
    }

    ol.knowledge-area-card-points {
        display: flex;
        flex-direction: column;
        justify-content: flex-start;
        gap: var(--space-xs);
        max-width: none;
        padding: 0;
        margin: 0;
        color: var(--midtone);
        line-height: 1.5;
        counter-reset: step-counter;
    }

    ol.knowledge-area-card-points li {
        position: relative;
        max-width: none;
        min-height: 1.7rem;
        padding-top: 0.15rem;
        padding-left: calc(1.7rem + var(--space-xs));
        font-size: var(--text-base);
        line-height: 1.4;
        counter-increment: step-counter;
    }

    ol.knowledge-area-card-points li::before {
        position: absolute;
        top: 0;
        left: 0;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 1.7rem;
        height: 1.7rem;
        color: var(--white);
        font-size: 90%;
        font-weight: var(--font-bold);
        line-height: 0;
        content: counter(step-counter);
        background: var(--black);
        border-radius: var(--rounded-full);
    }

    .knowledge-area-card-action {
        display: inline-flex;
        align-items: center;
        gap: var(--space-2xs);
        padding-top: var(--space-xs);
        margin-top: auto;
        color: var(--link);
        font-weight: var(--font-semibold);
    }

    .knowledge-project-composition {
        width: 100%;
        padding: var(--space-md);
        margin-bottom: var(--space-md);
        background: var(--white);
        border: var(--border) solid var(--light);
        border-radius: var(--rounded);
        box-shadow: var(--shadow-sm);
    }

    .knowledge-project-composition-root {
        position: relative;
        display: flex;
        flex-direction: column;
        gap: var(--space-2xs);
        width: min(100%, 22rem);
        padding: var(--space-sm) var(--space-md);
        margin: 0 auto var(--space-lg);
        color: var(--white);
        background: var(--darker);
        border-radius: var(--rounded);
        box-shadow: var(--shadow);
        text-align: center;
    }

    .knowledge-project-composition-root::after {
        position: absolute;
        top: 100%;
        left: 50%;
        height: var(--space-lg);
        border-left: var(--border) solid var(--midtone);
        content: "";
    }

    .knowledge-project-composition-root-label {
        color: var(--brand-1);
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        letter-spacing: 0.04em;
        text-transform: uppercase;
    }

    .knowledge-project-composition-root-title {
        font-size: var(--text-xl);
        line-height: 1.2;
    }

    .knowledge-project-composition-root-description {
        color: var(--lighter);
        font-size: var(--text-sm);
    }

    .knowledge-project-composition-grid {
        position: relative;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr) repeat(3, minmax(0, 1fr));
        gap: var(--space-sm);
        padding-top: var(--space-md);
    }

    .knowledge-project-composition-grid::before {
        position: absolute;
        top: 0;
        right: 9%;
        left: 9%;
        border-top: var(--border) solid var(--midtone);
        content: "";
    }

    .knowledge-project-composition-card {
        position: relative;
        display: block;
        min-width: 0;
        overflow: visible;
        background: var(--white);
        border: var(--border) solid var(--light);
        border-radius: var(--rounded);
        box-shadow: var(--shadow-sm);
        transition:
            border-color 150ms ease,
            transform 150ms ease,
            box-shadow 150ms ease;
    }

    .docs-prose a.knowledge-project-composition-card {
        color: var(--darker);
        font-weight: inherit;
        text-decoration: none;
    }

    .knowledge-project-composition-card:hover {
        border-color: var(--brand-2);
        box-shadow: var(--shadow);
        transform: translateY(-2px);
    }

    .knowledge-project-composition-card:focus-visible {
        outline: var(--border-lg) solid var(--brand-2);
        outline-offset: var(--border);
    }

    .knowledge-project-composition-card::before {
        position: absolute;
        top: calc(var(--space-md) * -1);
        left: 50%;
        height: var(--space-md);
        border-left: var(--border) solid var(--midtone);
        content: "";
    }

    .knowledge-project-composition-card-header {
        display: flex;
        align-items: center;
        gap: var(--space-xs);
        padding: var(--space-xs);
        color: var(--white);
        background: var(--darker);
        border-bottom: var(--border) solid var(--dark);
        border-top-left-radius: var(--rounded);
        border-top-right-radius: var(--rounded);
    }

    .knowledge-project-composition-card-header h3 {
        margin: 0;
        color: inherit;
        font-size: var(--text-lg);
        line-height: 1.2;
    }

    .knowledge-project-composition-card-number {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        flex: 0 0 2rem;
        width: 2rem;
        height: 2rem;
        color: var(--darker);
        font-size: var(--text-sm);
        font-weight: var(--font-semibold);
        background: var(--brand-1);
        border-radius: var(--rounded-sm);
        font-variant-numeric: tabular-nums;
    }

    .knowledge-project-composition-card-body {
        display: flex;
        flex-direction: column;
        gap: var(--space-sm);
        padding: var(--space-sm);
        color: var(--dark);
    }

    .knowledge-project-composition-card-body p,
    .knowledge-project-composition-card-body h4,
    .knowledge-project-composition-card-body ul,
    .knowledge-project-composition-card-body ol {
        max-width: none;
        margin: 0;
    }

    .knowledge-project-composition-card-body ul,
    .knowledge-project-composition-card-body ol {
        padding-left: var(--space-sm);
    }

    .knowledge-project-composition-card-group {
        display: flex;
        flex-direction: column;
        gap: var(--space-2xs);
        padding: var(--space-xs);
        background: var(--lighter);
        border-radius: var(--rounded-sm);
    }

    .knowledge-project-composition-card-group h4 {
        color: var(--darker);
        font-size: var(--text-base);
        line-height: 1.2;
    }

    @media (max-width: 900px) {
        .knowledge-project-composition-root {
            margin-bottom: var(--space-md);
        }

        .knowledge-project-composition-root::after,
        .knowledge-project-composition-grid::before,
        .knowledge-project-composition-card::before {
            display: none;
        }

        .knowledge-project-composition-grid {
            grid-template-columns: repeat(2, minmax(0, 1fr));
            padding-top: 0;
        }

        .knowledge-project-composition-card-journal {
            grid-column: span 2;
        }
    }

    @media (max-width: 639px) {
        .knowledge-section-overview {
            grid-template-columns: 1fr;
        }

        .knowledge-section-overview .ui-button {
            width: 100%;
        }

        .knowledge-project-composition {
            padding: var(--space-sm);
        }

        .knowledge-project-composition-grid {
            grid-template-columns: 1fr;
        }

        .knowledge-project-composition-card-journal {
            grid-column: span 1;
        }
    }

    .docs-breadcrumb {
        display: flex;
        align-items: center;
        flex-wrap: wrap;
        gap: var(--space-2xs);
        color: var(--midtone);
        font-size: var(--text-sm);
    }

    .docs-breadcrumb a {
        color: var(--link);
        font-weight: var(--font-semibold);
    }

    .docs-prose {
        max-width: var(--max-w-text);
    }

    .docs-prose-wide {
        max-width: none;
    }

    .docs-prose-wide > h1,
    .docs-prose-wide > h2,
    .docs-prose-wide > h3,
    .docs-prose-wide > h4,
    .docs-prose-wide > p,
    .docs-prose-wide > ul,
    .docs-prose-wide > ol {
        max-width: var(--max-w-text);
    }

    .docs-prose > *:first-child {
        margin-top: 0;
    }

    .docs-prose h1,
    .docs-prose h2,
    .docs-prose h3,
    .docs-prose h4 {
        line-height: 1;
    }

    .docs-prose p,
    .docs-prose li {
        line-height: 1.6;
    }

    .docs-prose a {
        color: var(--link);
        font-weight: var(--font-semibold);
    }

    .docs-prose ul,
    .docs-prose ol {
        list-style: revert;
        padding-left: var(--space-md);
    }

    .docs-prose table {
        display: block;
        width: 100%;
        overflow-x: auto;
        border-collapse: collapse;
        white-space: normal;
    }

    .docs-prose th,
    .docs-prose td {
        padding: var(--space-2xs) var(--space-xs);
        border: var(--border) solid var(--light);
        text-align: left;
        vertical-align: top;
    }

    .docs-prose th {
        background: var(--lighter);
        font-weight: var(--font-semibold);
    }

    .docs-prose pre {
        padding: var(--space-sm);
        overflow-x: auto;
        margin-bottom: var(--space-sm);
        background: var(--black);
        border: var(--border) solid var(--dark);
        border-radius: var(--rounded);
    }

    .docs-prose pre code {
        display: block;
        padding: 0;
        background: transparent;
        color: var(--lighter);
        font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
        font-size: 0.875em;
        line-height: 1.5;
        white-space: pre;
    }

    .docs-prose :not(pre) > code {
        padding: 0.2em 0.4em;
        color: var(--white);
        background: var(--darker);
        border-radius: var(--rounded-sm);
        font-size: 0.875em;
        white-space: normal;
    }

    .docs-mermaid {
        padding: var(--space-sm);
        margin-bottom: var(--space-sm);
        overflow-x: auto;
        background: var(--white);
        border: var(--border) solid var(--light);
        border-radius: var(--rounded);
    }

    .docs-mermaid svg {
        display: block;
        max-width: 100%;
        height: auto;
        margin-inline: auto;
    }

    .docs-mermaid-link {
        text-decoration: none;
    }

    .docs-mermaid-link .node {
        cursor: pointer;
        filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.24));
        text-decoration: none;
        transition: filter 200ms ease;
    }

    .docs-mermaid-link:hover .node,
    .docs-mermaid-link:focus-visible .node {
        filter: brightness(1.12) drop-shadow(0 2px 3px rgb(0 0 0 / 0.3));
    }

    .docs-mermaid-link:active .node {
        filter: brightness(0.96) drop-shadow(0 1px 1px rgb(0 0 0 / 0.2));
    }

    .docs-mermaid-link:focus-visible {
        outline: none;
        text-decoration: none;
    }

    .docs-mermaid-link:focus-visible .label-container {
        stroke: var(--black) !important;
        stroke-width: var(--border-lg) !important;
    }

    .docs-mermaid pre {
        margin-bottom: 0;
    }

    .highlight {
        background: var(--black);
    }

    .highlight .c,
    .highlight .cm,
    .highlight .cp,
    .highlight .c1,
    .highlight .cs,
    .highlight .go,
    .highlight .gp,
    .highlight .gs {
        color: var(--midtone);
    }

    .highlight .k,
    .highlight .kd,
    .highlight .kn,
    .highlight .kp,
    .highlight .kr,
    .highlight .kt,
    .highlight .o,
    .highlight .ow {
        color: var(--error-light);
    }

    .highlight .kc,
    .highlight .m,
    .highlight .mb,
    .highlight .mf,
    .highlight .mh,
    .highlight .mi,
    .highlight .mo,
    .highlight .il,
    .highlight .se,
    .highlight .na,
    .highlight .no,
    .highlight .nl,
    .highlight .nv,
    .highlight .vc,
    .highlight .vg,
    .highlight .vi,
    .highlight .vm,
    .highlight .gh,
    .highlight .gu {
        color: var(--info-light);
    }

    .highlight .s,
    .highlight .sa,
    .highlight .sb,
    .highlight .sc,
    .highlight .dl,
    .highlight .sd,
    .highlight .s2,
    .highlight .sh,
    .highlight .si,
    .highlight .sx,
    .highlight .s1,
    .highlight .ss,
    .highlight .sr,
    .highlight .nt {
        color: var(--success-light);
    }

    .highlight .nb,
    .highlight .nd,
    .highlight .bp,
    .highlight .fm,
    .highlight .nf {
        color: var(--brand-4-light);
    }

    .highlight .nc,
    .highlight .ne,
    .highlight .nn,
    .highlight .ni {
        color: var(--warning-light);
    }

    .highlight .gd,
    .highlight .gr,
    .highlight .gt {
        color: var(--error-light);
    }

    .highlight .gi {
        color: var(--success-light);
    }

    .highlight .ge {
        font-style: italic;
    }

    .highlight .gh,
    .highlight .gu {
        font-weight: var(--font-bold);
    }

    .highlight .w {
        color: var(--lighter);
    }

    @media (max-width: 900px) {
        .knowledge-area-grid {
            grid-template-columns: 1fr;
        }
    }
}
