/* EDRI documentation — branding tweaks on top of the Furo theme.
   Brand palette sampled from logo.png: turquoise circuitry (#0f8b94)
   on a dark navy (#1b2a3a). */

:root {
    --edri-brand: #0f8b94;
    --edri-brand-dark: #1b2a3a;

    /* Semantic accents used by the changelog. */
    --edri-success: #2e7d32;
    --edri-danger: #c62828;
    --edri-warning: #a06a18;
    --edri-info: #2f6fa7;
    --edri-purple: #7758a6;
    --edri-muted: #68717d;
}

/* Keep semantic accents readable when Furo is explicitly switched to dark. */
body[data-theme="dark"] {
    --edri-success: #67c587;
    --edri-danger: #ef7d86;
    --edri-warning: #d8aa54;
    --edri-info: #7db5e8;
    --edri-purple: #b59be1;
    --edri-muted: #aab3be;
}

/* Also follow the operating-system preference while Furo is in auto mode. */
@media (prefers-color-scheme: dark) {
    body:not([data-theme="light"]) {
        --edri-success: #67c587;
        --edri-danger: #ef7d86;
        --edri-warning: #d8aa54;
        --edri-info: #7db5e8;
        --edri-purple: #b59be1;
        --edri-muted: #aab3be;
    }
}

/* --- Sidebar logo ------------------------------------------------------- */
.sidebar-logo {
    max-width: 8rem;
    border-radius: 50%;          /* the logo is a circular badge */
    box-shadow: 0 2px 10px rgba(15, 139, 148, 0.25);
}
.sidebar-logo-container {
    padding: 0.75rem 0 0.25rem;
}

/* A subtle brand accent under the logo / above the search box. */
.sidebar-brand {
    border-bottom: 2px solid var(--edri-brand);
    padding-bottom: 0.75rem;
    margin-bottom: 0.5rem;
}

/* --- Headings ----------------------------------------------------------- */
h1, h2 {
    border-bottom: 1px solid var(--color-background-border);
    padding-bottom: 0.2em;
}

/* --- Inline code & code blocks ----------------------------------------- */
.highlight {
    border-radius: 6px;
    border-left: 3px solid var(--edri-brand);
}
code.literal {
    border-radius: 4px;
}

/* --- Mermaid diagrams --------------------------------------------------- */
/* Center diagrams and give them room to breathe.
   sphinxcontrib-mermaid injects ``pre.mermaid > svg { width: 100%;
   height: 500px; }`` at runtime. That can compress wide diagrams and make node
   labels unreadable. Keep each SVG at its natural size and let the page scroll
   horizontally instead. */
pre.mermaid,
div.mermaid,
.mermaid {
    text-align: center;
    margin: 1.5em 0;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 0.75rem;
}
pre.mermaid > svg,
.mermaid svg {
    width: auto !important;
    max-width: none !important;
    min-width: 640px;
    height: auto !important;
    overflow: visible;
}
.mermaid svg text,
.mermaid svg .nodeLabel,
.mermaid svg .edgeLabel,
.mermaid svg .messageText,
.mermaid svg .noteText {
    font-family: inherit !important;
}
@media (max-width: 700px) {
    pre.mermaid > svg,
    .mermaid svg {
        min-width: 760px;
    }
}

/* --- Changelog ---------------------------------------------------------- */
/* The changelog generator emits only edri-* classes. Avoid theme-specific
   ancestors such as .rst-content so these rules remain valid with Furo. */

.edri-changelog-release-summary,
.edri-changelog-category-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.edri-changelog-release-summary {
    margin: 0.55rem 0 0.7rem;
}

.edri-changelog-category-summary {
    margin: -0.15rem 0 1.35rem;
}

.edri-changelog-release-state,
.edri-changelog-release-total,
.edri-changelog-release-breaking,
.edri-changelog-category-pill {
    display: inline-flex;
    align-items: center;
    /* Flexbox strips the whitespace between the count <strong> and its label
       text ("50 changes" -> "50changes"); restore the gap here. */
    gap: 0.3rem;
    min-height: 1.7rem;
    padding: 0.16rem 0.58rem;
    border: 1px solid var(--color-background-border);
    border-radius: 999px;
    background: var(--color-background-secondary);
    font-size: 0.78rem;
    line-height: 1.25;
    white-space: nowrap;
}

.edri-changelog-release-state {
    font-weight: 700;
}

.edri-changelog-release-state-unreleased {
    color: var(--edri-info);
    border-color: color-mix(in srgb, var(--edri-info) 38%, var(--color-background-border));
    background: color-mix(in srgb, var(--edri-info) 10%, var(--color-background-primary));
}

.edri-changelog-release-state-prerelease {
    color: var(--edri-warning);
    border-color: color-mix(in srgb, var(--edri-warning) 38%, var(--color-background-border));
    background: color-mix(in srgb, var(--edri-warning) 10%, var(--color-background-primary));
}

.edri-changelog-release-state-stable {
    color: var(--edri-success);
    border-color: color-mix(in srgb, var(--edri-success) 38%, var(--color-background-border));
    background: color-mix(in srgb, var(--edri-success) 10%, var(--color-background-primary));
}

.edri-changelog-release-breaking {
    color: var(--edri-danger);
    border-color: color-mix(in srgb, var(--edri-danger) 40%, var(--color-background-border));
    background: color-mix(in srgb, var(--edri-danger) 10%, var(--color-background-primary));
}

.edri-changelog-category-pill {
    --edri-changelog-pill-accent: var(--edri-muted);
    color: var(--color-foreground-primary);
    border-color: color-mix(
        in srgb,
        var(--edri-changelog-pill-accent) 28%,
        var(--color-background-border)
    );
    background: color-mix(
        in srgb,
        var(--edri-changelog-pill-accent) 7%,
        var(--color-background-primary)
    );
}

.edri-changelog-category-pill strong {
    color: var(--edri-changelog-pill-accent);
}

.edri-changelog-category-added,
.edri-changelog-category-fixed {
    --edri-changelog-pill-accent: var(--edri-success);
}

.edri-changelog-category-changed,
.edri-changelog-category-infrastructure {
    --edri-changelog-pill-accent: var(--edri-info);
}

.edri-changelog-category-deprecated,
.edri-changelog-category-dependencies {
    --edri-changelog-pill-accent: var(--edri-warning);
}

.edri-changelog-category-removed,
.edri-changelog-category-security {
    --edri-changelog-pill-accent: var(--edri-danger);
}

.edri-changelog-category-performance,
.edri-changelog-category-documentation,
.edri-changelog-category-testing {
    --edri-changelog-pill-accent: var(--edri-purple);
}

/* Individual release-note entries. The category is communicated with a
   narrow accent rather than filling the whole card with a strong color. */
.edri-changelog-entry.admonition {
    --edri-changelog-accent: var(--edri-brand);
    overflow: hidden;
    margin: 0.75rem 0 1.15rem;
    padding: 0;
    border: 1px solid var(--color-background-border);
    border-left: 4px solid var(--edri-changelog-accent);
    border-radius: 8px;
    background: var(--color-background-primary);
    box-shadow: 0 1px 3px rgba(27, 42, 58, 0.08);
}

.edri-changelog-entry.admonition > .admonition-title {
    margin: 0 !important;
    padding: 0.72rem 0.9rem !important;
    border: 0;
    background: var(--color-background-secondary);
    background: color-mix(
        in srgb,
        var(--edri-changelog-accent) 7%,
        var(--color-background-secondary)
    );
    color: var(--color-foreground-primary);
    font-size: 1rem;
    font-weight: 650;
    line-height: 1.35;
}

/* Furo adds an icon to generic admonition titles. Changelog cards use the
   colored edge instead, so the icon would only add noise. */
.edri-changelog-entry.admonition > .admonition-title::before {
    display: none;
}

.edri-changelog-entry.admonition > :not(.admonition-title) {
    margin-left: 0.95rem;
    margin-right: 0.95rem;
}

.edri-changelog-entry.admonition > .admonition-title + * {
    margin-top: 0.85rem;
}

.edri-changelog-entry.admonition > :last-child {
    margin-bottom: 0.95rem;
}

.edri-changelog-entry-added,
.edri-changelog-entry-fixed {
    --edri-changelog-accent: var(--edri-success);
}

.edri-changelog-entry-changed,
.edri-changelog-entry-infrastructure {
    --edri-changelog-accent: var(--edri-info);
}

.edri-changelog-entry-deprecated,
.edri-changelog-entry-dependencies {
    --edri-changelog-accent: var(--edri-warning);
}

.edri-changelog-entry-removed,
.edri-changelog-entry-security {
    --edri-changelog-accent: var(--edri-danger);
}

.edri-changelog-entry-performance,
.edri-changelog-entry-documentation,
.edri-changelog-entry-testing {
    --edri-changelog-accent: var(--edri-purple);
}

/* Breaking/migration metadata is generated as blockquotes. Keep it visible,
   but subordinate to the change title. */
.edri-changelog-entry blockquote {
    margin: 0.8rem 0;
    padding: 0.58rem 0.75rem;
    border-left: 3px solid var(--edri-warning);
    border-radius: 0 5px 5px 0;
    background: color-mix(
        in srgb,
        var(--edri-warning) 8%,
        var(--color-background-secondary)
    );
}

.edri-changelog-entry blockquote p:last-child {
    margin-bottom: 0;
}

/* --- Changelog disclosures --------------------------------------------- */
details.edri-changelog-files,
details.edri-changelog-about,
details.edri-changelog-older-releases {
    margin: 0.75rem 0 0;
    max-width: 46rem;
    border: 1px solid var(--color-background-border);
    border-radius: 7px;
    background: var(--color-background-secondary);
    font-size: 0.875rem;
}

details.edri-changelog-about,
details.edri-changelog-older-releases {
    margin-bottom: 1rem;
}

details.edri-changelog-files > summary,
details.edri-changelog-about > summary,
details.edri-changelog-older-releases > summary {
    cursor: pointer;
    list-style: none;
    padding: 0.46rem 0.85rem;
    color: var(--color-foreground-secondary);
    font-weight: 600;
    user-select: none;
}

details.edri-changelog-files > summary::-webkit-details-marker,
details.edri-changelog-about > summary::-webkit-details-marker,
details.edri-changelog-older-releases > summary::-webkit-details-marker {
    display: none;
}

details.edri-changelog-files > summary::before,
details.edri-changelog-about > summary::before,
details.edri-changelog-older-releases > summary::before {
    content: "\25B8";  /* ▸ */
    display: inline-block;
    width: 1em;
    margin-right: 0.3rem;
    color: var(--edri-brand);
    transition: transform 120ms ease;
}

details.edri-changelog-files[open] > summary::before,
details.edri-changelog-about[open] > summary::before,
details.edri-changelog-older-releases[open] > summary::before {
    transform: rotate(90deg);
}

details.edri-changelog-files[open] > summary,
details.edri-changelog-about[open] > summary,
details.edri-changelog-older-releases[open] > summary {
    border-bottom: 1px solid var(--color-background-border);
}

details.edri-changelog-files > summary:hover,
details.edri-changelog-about > summary:hover,
details.edri-changelog-older-releases > summary:hover {
    color: var(--color-foreground-primary);
}

/* --- Changelog changed files ------------------------------------------- */
ul.edri-changelog-file-list {
    margin: 0;
    padding: 0.65rem 0.85rem 0.8rem;
    list-style: none;
}

ul.edri-changelog-file-list li {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0.3rem 0;
    font-size: 0.875rem;
}

ul.edri-changelog-file-list a {
    word-break: break-word;
}

.edri-changelog-file-path {
    min-width: 0;
    overflow-wrap: anywhere;
    font-family: var(
        --font-stack--monospace,
        SFMono-Regular,
        Consolas,
        "Liberation Mono",
        monospace
    );
    font-size: 0.82rem;
}

.edri-changelog-rename-arrow {
    color: var(--color-foreground-muted);
}

ul.edri-changelog-file-list .status {
    display: inline-flex;
    flex: 0 0 1.5rem;
    align-items: center;
    justify-content: center;
    min-width: 1.5rem;
    height: 1.35rem;
    margin-top: 0.05rem;
    padding: 0 0.28rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1;
    color: #fff;
}

ul.edri-changelog-file-list .status-M,
ul.edri-changelog-file-list .status-T {
    background: var(--edri-brand);
}

ul.edri-changelog-file-list .status-A {
    background: #2e7d32;
}

ul.edri-changelog-file-list .status-D {
    background: #c62828;
}

ul.edri-changelog-file-list .status-R,
ul.edri-changelog-file-list .status-C {
    background: #8a641f;
}

ul.edri-changelog-file-list .status-U,
ul.edri-changelog-file-list .status-X,
ul.edri-changelog-file-list .status-B {
    background: #6b7280;
}

/* --- Empty and older-release states ------------------------------------ */
.edri-changelog-empty {
    margin: 0.6rem 0 1.2rem;
    padding: 0.8rem 0.9rem;
    border: 1px dashed var(--color-background-border);
    border-radius: 7px;
    background: color-mix(
        in srgb,
        var(--edri-brand) 3%,
        var(--color-background-primary)
    );
    color: var(--color-foreground-secondary);
}

.edri-changelog-older-release-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
    gap: 0.35rem 1rem;
    margin: 0;
    padding: 0.7rem 1rem 0.85rem 2.15rem;
}

.edri-changelog-older-release-list li {
    padding-right: 0.4rem;
}

.edri-changelog-older-release-list time {
    margin-left: 0.55rem;
    color: var(--color-foreground-muted);
    font-size: 0.8rem;
}

@media (max-width: 600px) {
    .edri-changelog-release-summary,
    .edri-changelog-category-summary {
        gap: 0.35rem;
    }

    .edri-changelog-release-state,
    .edri-changelog-release-total,
    .edri-changelog-release-breaking,
    .edri-changelog-category-pill {
        font-size: 0.74rem;
    }

    .edri-changelog-entry.admonition > .admonition-title {
        padding: 0.65rem 0.75rem !important;
    }

    .edri-changelog-entry.admonition > :not(.admonition-title) {
        margin-left: 0.78rem;
        margin-right: 0.78rem;
    }

    details.edri-changelog-files,
    details.edri-changelog-about,
    details.edri-changelog-older-releases {
        max-width: 100%;
    }
}
