/* ========================================================================== 
   Long-form project documentation
   Scoped to pages explicitly assigned the project-documentation template.
   ========================================================================== */

.project-documentation {
    --doc-text: var(--site-text, #263238);
    --doc-muted: var(--site-muted, #586d8b);
    --doc-primary: var(--site-primary, #2563eb);
    --doc-border: var(--site-border, #e5e7eb);
    --doc-surface: var(--site-surface, #f8fafc);

    max-width: 1100px;
    margin-right: auto;
    margin-left: auto;
    color: var(--doc-text);
}

.project-documentation-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    margin: 1.5rem 0 1.75rem;
}

.project-documentation-back {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--doc-primary);
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    text-underline-offset: 4px;
}

.project-documentation-back:hover {
    text-decoration: underline;
}

.project-documentation-type {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--doc-border);
    border-radius: 999px;
    background: var(--doc-surface);
    color: var(--doc-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.project-documentation-header {
    margin-bottom: 2.5rem;
    padding: 0 0 2rem;
    border-bottom: 1px solid var(--doc-border);
    text-align: center;
}

.project-documentation-logo {
    display: block;
    width: auto;
    max-width: 150px;
    max-height: 110px;
    object-fit: contain;
    margin: 0 auto 1.25rem;
}

.project-documentation-title {
    max-width: 1100px;
    margin: 0 auto;
    color: #111827;
    font-size: clamp(2rem, 4.5vw, 3.1rem);
    font-weight: 750;
    letter-spacing: -0.045em;
    line-height: 1.15;
    text-wrap: balance;
}

.project-documentation-subtitle {
    max-width: 860px;
    margin: 1rem auto 0;
    color: var(--doc-muted);
    font-size: clamp(1.05rem, 2vw, 1.25rem);
    line-height: 1.7;
    text-align: center;
}

.project-documentation-period {
    margin: 0.8rem 0 0;
    color: var(--doc-muted);
    font-size: 0.9rem;
    text-align: center;
}

.project-documentation-content {
    max-width: 1100px;
    margin: 0 auto;
    overflow-wrap: anywhere;
}

.project-documentation-content p {
    color: #374151;
    font-size: 1rem;
    line-height: 1.85;
    text-align: justify;
}

.project-documentation-content h2 {
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: #111827;
    font-size: clamp(1.55rem, 3vw, 2rem);
    font-weight: 730;
    letter-spacing: -0.03em;
    line-height: 1.3;
    scroll-margin-top: 1.5rem;
}

.project-documentation-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.8rem;
    color: #172033;
    font-size: clamp(1.2rem, 2.5vw, 1.5rem);
    font-weight: 700;
    line-height: 1.4;
    scroll-margin-top: 1.5rem;
}

.project-documentation-content h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.65rem;
    color: #172033;
    font-size: 1.1rem;
    font-weight: 700;
    scroll-margin-top: 1.5rem;
}

.project-documentation-content ul,
.project-documentation-content ol {
    margin-top: 0.75rem;
    margin-bottom: 1.5rem;
    padding-left: 1.5rem;
}

.project-documentation-content li {
    margin-bottom: 0.55rem;
    color: #374151;
    font-size: 1rem;
    line-height: 1.75;
}

.project-documentation-content li::marker {
    color: var(--doc-primary);
}

.project-documentation-content a {
    color: var(--doc-primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.project-documentation-content a:hover {
    color: #1d4ed8;
}

.project-documentation-content .list-unstyled {
    padding-left: 0;
}

.project-documentation-content .list-unstyled li {
    margin-bottom: 0.45rem;
}

.project-documentation-content pre {
    max-width: 100%;
    margin: 1.25rem 0 1.5rem;
    padding: 1rem 1.15rem;
    overflow-x: auto;
    border: 1px solid var(--doc-border);
    border-radius: 0.65rem;
    background: #f8fafc;
    color: #1f2937;
    font-family: 'Fira Code', 'SFMono-Regular', Consolas, monospace;
    font-size: 0.875rem;
    line-height: 1.6;
    white-space: pre;
    -webkit-overflow-scrolling: touch;
}

.project-documentation-content .diagram-container {
    max-width: 100%;
    margin: 1.25rem 0 1.5rem;
    overflow-x: auto;
    border: 1px solid var(--doc-border);
    border-radius: 0.65rem;
    background: #f8fafc;
    -webkit-overflow-scrolling: touch;
}

.project-documentation-content .diagram-container pre {
    width: max-content;
    min-width: 100%;
    margin: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
}

.project-documentation-content table {
    width: 100%;
    margin: 1.25rem 0 1.75rem;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.project-documentation-content th,
.project-documentation-content td {
    padding: 0.75rem;
    border: 1px solid var(--doc-border);
    text-align: left;
    vertical-align: top;
}

.project-documentation-content th {
    background: var(--doc-surface);
    color: #172033;
    font-weight: 700;
}

.project-documentation-content img {
    max-width: 100%;
    height: auto;
}

.project-documentation-content .gallery img {
    border-color: var(--doc-border);
    border-radius: 0.5rem;
}

.project-documentation-content blockquote {
    margin: 1.25rem 0;
    padding: 0.85rem 1.1rem;
    border-left: 3px solid var(--doc-primary);
    background: var(--doc-surface);
}

.project-documentation-content blockquote p:last-child {
    margin-bottom: 0;
}

.project-documentation-footer {
    margin-top: 3rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--doc-border);
}

.project-documentation a:focus-visible {
    border-radius: 3px;
    outline: 3px solid rgb(37 99 235 / 35%);
    outline-offset: 3px;
}

@media (max-width: 575.98px) {
    .project-documentation-nav {
        margin-top: 1rem;
        margin-bottom: 1.25rem;
    }

    .project-documentation-header {
        margin-bottom: 1.75rem;
        padding-bottom: 1.5rem;
    }

    .project-documentation-title {
        font-size: clamp(1.8rem, 8vw, 2.4rem);
    }

    .project-documentation-content p,
    .project-documentation-content li {
        font-size: 0.96rem;
    }

    .project-documentation-content pre {
        padding: 0.85rem;
        font-size: 0.8rem;
    }

    .project-documentation-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-documentation * {
        scroll-behavior: auto !important;
    }
}
