:root {
    --color-bg: #ffffff;
    --color-bg-alt: #f6f7f9;
    --color-text: #1c2128;
    --color-text-muted: #57606a;
    --color-border: #d8dee4;
    --color-accent: #e8792a;
    --color-accent-dark: #c25f16;
    --color-blue: #4f74b5;
    --color-blue-dark: #33518a;
    --color-code-bg: #1c2128;
    --color-code-text: #e6edf3;
    --sidebar-width: 260px;
}

@media (prefers-color-scheme: dark) {
    :root {
        --color-bg: #14171c;
        --color-bg-alt: #1b1f26;
        --color-text: #e6edf3;
        --color-text-muted: #9aa5b1;
        --color-border: #2d333b;
        --color-code-bg: #0d1117;
        --color-code-text: #e6edf3;
    }
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 1.5rem;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-bg);
    line-height: 1.6;
}

a {
    color: var(--color-blue);
}

@media (prefers-color-scheme: dark) {
    a {
        color: #7ea6e0;
    }
}

code, pre {
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.88em;
}

p code, li code, td code {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 4px;
    padding: 0.1em 0.4em;
}

pre {
    background: var(--color-code-bg);
    color: var(--color-code-text);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    overflow-x: auto;
    line-height: 1.55;
}

pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

/* ---- Header (mirrors the main site's .site-nav) ---- */

.site-nav {
    position: sticky;
    top: 0;
    z-index: 10;
    background: color-mix(in srgb, var(--color-bg) 88%, transparent);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--color-border);
}

.site-nav .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 64px;
}

.brand {
    display: flex;
    align-items: center;
    margin-top: 10px;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 700;
    font-size: 1.1rem;
}

.brand img {
    width: 80px;
    height: 80px;
    object-fit: contain;
}

.back-home {
    margin-left: auto;
    margin-right: 1.25rem;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.85rem;
}

.back-home:hover {
    color: var(--color-text);
}

.nav-toggle {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.nav-toggle-label {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 6px;
    font-size: 1.3rem;
    line-height: 1;
    color: var(--color-text);
    cursor: pointer;
}

.nav-toggle:focus-visible ~ .site-nav .nav-toggle-label {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* ---- Layout ---- */

.layout {
    display: flex;
    min-height: 100vh;
    max-width: 1280px;
    margin: 0 auto;
}

.sidebar {
    width: var(--sidebar-width);
    flex-shrink: 0;
    padding: 1.75rem 1.25rem;
    border-right: 1px solid var(--color-border);
    position: sticky;
    top: 64px;
    align-self: flex-start;
    height: calc(100vh - 64px);
    overflow-y: auto;
}

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

.sidebar nav li + li {
    margin-top: 0.15rem;
}

.sidebar nav li a {
    display: block;
    padding: 0.35rem 0.6rem;
    line-height: 1.3;
    border-radius: 6px;
    text-decoration: none;
    color: var(--color-text-muted);
    font-size: 0.92rem;
}

.sidebar nav li a:hover {
    background: var(--color-bg-alt);
    color: var(--color-text);
}

.sidebar nav .nav-number {
    display: inline-block;
    width: 1.4rem;
    color: var(--color-accent);
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.78rem;
    color: var(--color-text-muted);
}

main {
    flex: 1;
    min-width: 0;
    padding: 0 3rem 6rem;
}

.hero {
    position: relative;
    overflow: hidden;
    padding: 3.5rem 1rem 3rem;
    border-bottom: 1px solid var(--color-border);
    margin-bottom: 3rem;
}

.hero::before,
.hero::after {
    content: "";
    position: absolute;
    z-index: 0;
    border-radius: 50%;
    filter: blur(70px);
    pointer-events: none;
}

.hero::before {
    width: 360px;
    height: 360px;
    top: -140px;
    left: -100px;
    background: var(--color-accent);
    opacity: 0.16;
}

.hero::after {
    width: 320px;
    height: 320px;
    bottom: -160px;
    right: -80px;
    background: var(--color-blue);
    opacity: 0.14;
}

@media (prefers-color-scheme: dark) {
    .hero::before {
        opacity: 0.28;
    }

    .hero::after {
        opacity: 0.24;
    }
}

.hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2.5rem;
}

.hero-content {
    flex: 1 1 auto;
    min-width: 0;
}

.hero-image {
    flex: 0 0 auto;
}

.hero-image img {
    width: 140px;
    height: auto;
}

.hero h1 {
    font-size: 2.4rem;
    margin: 0.5rem 0 0.5rem;
}

.hero p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    max-width: 560px;
    margin: 0;
}

.badges {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-start;
    flex-wrap: wrap;
    margin-top: 1.25rem;
}

@media (max-width: 900px) {
    .hero-inner {
        text-align: center;
        gap: 1.5rem;
    }

    .hero p {
        margin: 0 auto;
    }

    .badges {
        justify-content: center;
    }

    .hero-image {
        display: none;
    }
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
}

section.doc-section {
    padding-top: 2.5rem;
    margin-top: -2.5rem;
    margin-bottom: 3rem;
}

section.doc-section:first-of-type {
    margin-top: 0;
}

.doc-section h2 {
    font-size: 1.6rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border-bottom: 1px solid var(--color-border);
    padding-bottom: 0.6rem;
}

.doc-section h2 .section-number {
    color: var(--color-accent);
    font-variant-numeric: tabular-nums;
}

.doc-section h3 {
    font-size: 1.15rem;
    margin-top: 2rem;
}

.tree {
    background: var(--color-bg-alt);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem 1.25rem;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
    font-size: 0.85rem;
    overflow-x: auto;
    white-space: pre;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
    font-size: 0.92rem;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--color-border);
}

th {
    color: var(--color-text-muted);
    font-weight: 600;
}

.callout {
    border-left: 3px solid var(--color-accent);
    background: var(--color-bg-alt);
    padding: 0.85rem 1.1rem;
    border-radius: 0 8px 8px 0;
    margin: 1.25rem 0;
    font-size: 0.92rem;
}

.callout strong {
    color: var(--color-accent-dark);
}

@media (prefers-color-scheme: dark) {
    .callout strong {
        color: var(--color-accent);
    }
}

footer.site-footer {
    padding: 2rem 1rem 0;
}

.footer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
    justify-self: center;
}

.share-bar {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}

.share-label {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-right: 0.25rem;
}

.share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    border: 1px solid var(--color-border);
    color: var(--color-text-muted);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.share-link svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: currentColor;
}

.share-link:hover {
    color: var(--color-accent);
    border-color: var(--color-accent);
    background: var(--color-bg-alt);
}

.footer-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 1rem;
}

.footer-logo {
    display: inline-flex;
    align-items: center;
    line-height: 0;
}

.footer-logo:first-child {
    justify-self: start;
}

.footer-organifox {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    justify-self: end;
}

.footer-email {
    font-size: 0.78rem;
    color: var(--color-text-muted);
    text-decoration: none;
}

.footer-email:hover {
    color: var(--color-text);
}

.footer-logo img {
    height: 32px;
    width: auto;
    object-fit: contain;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.footer-logo-fennec img {
    height: 80px;
}

.footer-logo:hover img {
    opacity: 1;
}

.footer-copyright {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.85rem;
    text-align: center;
}

@media (max-width: 560px) {
    .footer-inner {
        grid-template-columns: 1fr;
        justify-items: center;
        gap: 1.25rem;
    }

    .footer-logo:first-child,
    .footer-organifox {
        justify-self: center;
    }
}

@media (max-width: 900px) {
    .back-home {
        display: none;
    }

    .nav-toggle-label {
        display: inline-flex;
    }

    .layout {
        flex-direction: column;
    }

    .sidebar {
        position: relative;
        top: 0;
        height: auto;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        display: none;
    }

    .nav-toggle:checked ~ .layout .sidebar {
        display: block;
    }

    main {
        padding: 0 1.25rem 4rem;
    }
}
