/*
Theme Name: Black Lotus
Author: CMD Spaar
Description: Thème pour le squadron The Black Lotus Kabal
Version: 1.0.0
Text Domain: black-lotus
*/

/* Composants et interface frontale Black Lotus. */

@font-face {
    font-display: swap;
    font-family: "Adwaita Sans";
    font-style: normal;
    font-weight: 400;
    src: url("fonts/AdwaitaSans-Regular.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "Adwaita Sans";
    font-style: italic;
    font-weight: 400;
    src: url("fonts/AdwaitaSans-Italic.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "Adwaita Mono";
    font-style: normal;
    font-weight: 400;
    src: url("fonts/AdwaitaMono-Regular.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "Adwaita Mono";
    font-style: normal;
    font-weight: 700;
    src: url("fonts/AdwaitaMono-Bold.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "Adwaita Mono";
    font-style: italic;
    font-weight: 400;
    src: url("fonts/AdwaitaMono-Italic.ttf") format("truetype");
}

@font-face {
    font-display: swap;
    font-family: "Adwaita Mono";
    font-style: italic;
    font-weight: 700;
    src: url("fonts/AdwaitaMono-BoldItalic.ttf") format("truetype");
}


.bl-badge {
    display: block;
    width: fit-content;
    padding: 3px 7px;
    font-weight: 700;
    text-align: center;
    border-radius: 4px;
    background-color: var(--badge-bg);
    border: 1px solid var(--badge-border);
    color: var(--badge-text);

    &.urgent {
        background-color: var(--badge-red-bg);
        border-color: var(--badge-red-border);
        color: var(--badge-red-text);
    }

    &.important {
        background-color: var(--badge-orange-bg);
        border-color: var(--badge-orange-border);
        color: var(--badge-orange-text);
    }

    &.moyen {
        background-color: var(--badge-yellow-bg);
        border-color: var(--badge-yellow-border);
        color: var(--badge-yellow-text);
    }

    &.bas {
        background-color: var(--badge-green-bg);
        border-color: var(--badge-green-border);
        color: var(--badge-green-text);
    }

    &.blue {
        background-color: var(--badge-blue-bg);
        border-color: var(--badge-blue-border);
        color: var(--badge-blue-text);
    }
}

.bl-level {
    --bl-level-color: var(--bl-accent, #2271b1);

    align-items: center;
    display: inline-flex;
    gap: 3px;
    vertical-align: middle;
}

.bl-level-segment {
    background: transparent;
    border: 1px solid var(--badge-border, #c3c4c7) !important;
    border-radius: 2px;
    display: block;
    height: 8px;
    width: 14px;

    &.is-filled {
        background: var(--bl-level-color);
        border-color: var(--bl-level-color) !important;
    }
}

.bl-level-1 {
    --bl-level-color: var(--badge-green-border);
}

.bl-level-2 {
    --bl-level-color: #84cc16;
}

.bl-level-3 {
    --bl-level-color: var(--badge-yellow-border);
}

.bl-level-4 {
    --bl-level-color: var(--badge-orange-border);
}

.bl-level-5 {
    --bl-level-color: var(--badge-red-border);
}
.bl-copy-button {
    align-items: center;
    border-radius: 4px;
    box-shadow: none !important;
    display: inline-flex;
    justify-content: center;
    margin-inline-start: 10px !important;
    outline: none !important;
    transition: transform 80ms ease;
    vertical-align: middle;

    &:is(:hover, :active, :focus) {
        box-shadow: none !important;
        outline: none !important;
    }

    .dashicons {
        font-size: 14px;
        height: 14px;
        line-height: 1;
        width: 14px;

        &::before { content: "\f105"; }
    }

    &:active { transform: translateY(1px); }
}


/* Vues principales et détails */

.bl-card {
    background: var(--bl-surface, #fff);
    border: 1px solid var(--bl-border, #c3c4c7);
    border-radius: 8px;
    box-sizing: border-box;
}

.bl-split {
    align-items: var(--bl-split-align, center);
    display: flex;
    gap: var(--bl-split-gap, 16px);
    justify-content: space-between;

    .button {
        align-items: center;
        box-sizing: border-box;
        display: inline-flex;
        font-size: 12px;
        height: 26px;
        justify-content: center;
        line-height: 1;
        min-height: 26px;
        padding: 0 8px;
    }
}

.bl-inset-header {
    border-bottom: 1px solid var(--bl-border, #c3c4c7);
    margin: -16px -16px 16px;
    padding: 14px 16px;
}

.bl-field,
.bl-stack {
    display: flex;
    flex-direction: column;
}

.bl-field {
    gap: var(--bl-field-gap, 6px);
    margin: 0;
}

.bl-field__label {
    color: var(--bl-muted, #646970);
    font-weight: 600;
}

.bl-stack {
    gap: var(--bl-stack-gap, 8px);
}

:is(.bl-master-detail, .bl-post-list > .container) {
    align-items: stretch;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(0, 1fr) var(--bl-detail-width);
}

:is(.bl-panel, .bl-post-list .list, .bl-post-list .detail) {
    border: 1px solid var(--bl-border, #c3c4c7);
    border-radius: 8px;
    box-sizing: border-box;
    height: var(--bl-panel-height);
    min-height: var(--bl-panel-min-height);
    overflow: auto;
}

:is(.bl-detail-panel, .bl-post-list .list, .bl-post-list .detail) {
    opacity: 1;
    transition: opacity 120ms ease;

    &.is-loading {
        cursor: progress;
        opacity: 0.6;
        pointer-events: none;
    }
}

:is(.bl-detail-panel, .bl-post-list .detail) {
    color: var(--bl-text, #1d2327);
    padding: 16px;
}

:is(.bl-panel-empty, .bl-post-list .detail[data-state="empty"] > .bl-muted) {
    align-items: center;
    display: flex;
    font-size: 14px;
    height: 100%;
    justify-content: center;
    margin: 0;
    text-align: center;
}

.bl-muted {
    color: var(--bl-muted, #646970);
    margin: 0;
}

.bl-detail-panel__header {
    --bl-split-gap: 12px;
    background: var(--bl-surface, #fff);
    flex-wrap: wrap;
    position: sticky;
    top: -16px;
    z-index: 2;

    h2 {
        color: var(--bl-text, #1d2327);
        flex: 1 1 180px;
        font-size: 18px;
        line-height: 30px;
        margin: 0;
        min-width: 0;
        overflow-wrap: anywhere;
    }
}
.bl-system-map-dialog {
    height: calc(100vh - 64px);
    max-height: none;
    max-width: none;
    padding: 0;
    width: calc(100vw - 64px);
}

.bl-system-map-dialog::backdrop {
    background: rgb(0 0 0 / 70%);
}

.bl-system-map-dialog__header {
    border-bottom: 1px solid var(--bl-border, #c3c4c7);
    height: 56px;
    padding: 0 16px;

    h2 { margin: 0; }
}

.bl-system-map-dialog__frame {
    border: 0;
    display: block;
    height: calc(100% - 57px);
    width: 100%;
}

.bl-detail-panel__section + .bl-detail-panel__section {
    border-top: 1px solid var(--bl-border, #c3c4c7);
    margin-top: 16px;
    padding-top: 16px;
}

.bl-detail-panel__section h3 {
    color: var(--bl-text, #1d2327);
    font-size: 14px;
    margin: 0 0 10px;
}

.bl-constructions {
    display: grid;
    gap: 16px;
}

.bl-construction {
    min-width: 0;

    & + & {
        border-top: 1px solid var(--bl-border, #c3c4c7);
        padding-top: 16px;
    }

}

.bl-construction__header {
    align-items: baseline;
    gap: 12px;

    h4 {
        color: var(--bl-text, #1d2327);
        font-size: 13px;
        margin: 0;
        min-width: 0;
        overflow-wrap: anywhere;
    }

    > span {
        color: var(--bl-muted, #646970);
        flex: 0 0 auto;
        font-variant-numeric: tabular-nums;
        font-weight: 600;
    }
}

.bl-construction-resources {
    display: grid;
    gap: 10px;
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.bl-construction-progress {
    min-width: 0;

    .bl-split {
        align-items: baseline;
        gap: 12px;
        margin-bottom: 4px;

        > :first-child {
            min-width: 0;
            overflow-wrap: anywhere;
        }

        > :last-child {
            flex: 0 0 auto;
            font-variant-numeric: tabular-nums;

            &.is-complete {
                color: var(--bl-muted, #646970);
                opacity: 0.55;
            }
        }
    }

    progress {
        appearance: none;
        background: var(--bl-surface-alt, #f0f0f1);
        border: 0;
        border-radius: 999px;
        display: block;
        height: 7px;
        overflow: hidden;
        width: 100%;

        &::-webkit-progress-bar {
            background: var(--bl-surface-alt, #f0f0f1);
            border-radius: 999px;
        }

        &::-webkit-progress-value {
            background: var(--bl-accent, #2271b1);
            border-radius: 999px;
        }

        &::-moz-progress-bar {
            background: var(--bl-accent, #2271b1);
            border-radius: 999px;
        }
    }
}

.bl-detail-fields {
    --bl-stack-gap: var(--bl-detail-fields-gap, 8px);
    margin: 0;

    > div {
        align-items: start;
        display: flex;
        gap: var(--bl-detail-field-gap, 64px);
        justify-content: space-between;
    }

    dt {
        color: var(--bl-muted, #646970);
        flex: 0 0 auto;
        font-weight: 600;
        line-height: 1.4;
    }

    dd {
        flex: 0 1 auto;
        line-height: 1.4;
        margin: 0;
        min-width: 0;
        overflow-wrap: anywhere;
        text-align: right;
    }
}

.bl-engineering-graph-page {
    --bl-graph-card: var(--bl-bg);
    --bl-graph-header: var(--bl-surface);
    --bl-graph-line: var(--bl-muted);
}

.bl-engineering-guide { margin-top: 16px; }

.bl-engineering-graph {
    position: relative;
}

.bl-engineering-graph-canvas {
    min-height: 100%;
    min-width: 100%;
    position: relative;
}

.bl-engineering-graph__empty {
    margin: 24px;
}

.bl-engineering-graph-lines {
    height: 100%;
    left: 0;
    overflow: visible;
    pointer-events: none;
    position: absolute;
    top: 0;
    width: 100%;
    z-index: 0;

    marker path { fill: var(--bl-graph-line, var(--bl-muted, #646970)); }
}

.bl-engineering-graph-line {
    fill: none;
    marker-end: url(#bl-engineering-graph-arrow);
    stroke: var(--bl-graph-line, var(--bl-muted, #646970));
    stroke-linecap: square;
    stroke-linejoin: miter;
    stroke-width: 2px;
}


.bl-engineering-node {
    background: var(--bl-graph-card, var(--bl-surface, #fff));
    border: 1px solid var(--bl-border, #c3c4c7);
    border-radius: 8px;
    box-shadow: none;
    color: var(--bl-text, #1d2327);
    display: flex;
    flex-direction: column;
    min-height: 96px;
    overflow: hidden;
    position: absolute;
    width: 300px;
    z-index: 1;

    &:is(:hover, :focus-visible, .is-selected) {
        border-color: var(--bl-accent, #ed5b00);
    }

    &:is(:hover, :focus-visible) { cursor: pointer; }

    &.is-selected {
        box-shadow: 0 0 0 1px var(--bl-accent, #ed5b00);
    }

    .bl-level {
        --bl-level-color: var(--bl-graph-line, var(--bl-muted, #646970)) !important;
    }
}

.bl-engineering-node__header {
    --bl-split-align: flex-start;
    --bl-split-gap: 10px;
    background: var(--bl-graph-header, var(--bl-surface-alt, #f6f7f7));
    border-bottom: 1px solid var(--bl-border, #c3c4c7);
    padding: 10px 12px;

    h2 {
        color: var(--bl-text, #1d2327);
        font-size: 15px;
        line-height: 1.25;
        margin: 0;
    }
}

.bl-engineering-node__modules {
    --bl-stack-gap: 6px;
    justify-content: flex-start;
    list-style: none;
    margin: 0;
    min-height: 0;
    padding: 10px 12px;

    li {
        align-items: center;
        display: grid;
        gap: 8px;
        grid-template-columns: minmax(0, 1fr) auto;
        margin: 0;
    }
}


.bl-engineering-node__module-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-engineering-node__empty {
    display: block !important;
    font-style: italic;
}

.bl-engineering-modification-costs {
    --bl-stack-gap: 8px;
    margin: 0;
}


.bl-calculation-material-cost {
    align-items: baseline;
    display: flex;
    gap: 12px;
    justify-content: space-between;

    .bl-calculation-material-cost__name {
        min-width: 0;
    }

    .bl-calculation-material-cost__missing {
        color: var(--bl-error-border, #d63638);
        flex: 0 0 auto;
        font-variant-numeric: tabular-nums;
        font-weight: 600;
        min-width: 2ch;
        text-align: right;
    }

    &.is-complete .bl-calculation-material-cost__missing {
        color: var(--bl-success-border, #008a20);
    }
}

.bl-calculation-row select:is(:invalid, :disabled) {
    color: var(--bl-disabled, #a7aaad) !important;
    text-shadow: none !important;
}


.bl-form-bar {
    align-items: end;
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 16px 0;
}

.bl-post-list__header {
    align-items: flex-end;
    display: flex;
    gap: 24px;
    justify-content: space-between;
    margin-bottom: 20px;
}

.bl-post-list__header h1 { margin-bottom: 0; }

.bl-post-list__header .filters {
    justify-content: flex-end;
    margin: 0 0 2px auto;
}

.bl-post-list .filters .bl-field {
    --bl-field-gap: 5px;
}

.bl-post-list .filters select {
    min-width: 210px;
}

.bl-post-list .container {
    --bl-detail-field-gap: 64px;
    --bl-detail-fields-gap: 10px;
    --bl-detail-width: 380px;
    --bl-panel-height: calc(100dvh - 240px);
    --bl-panel-min-height: min(520px, var(--bl-panel-height));
}

.bl-post-list-table {
    border: 0 !important;
    box-shadow: none !important;
    margin: 0;

    :is(th, td) { vertical-align: middle; }

    thead th:first-child,
    tbody th { padding-left: 12px; }

    tbody tr { cursor: pointer; }


    td:last-child { width: 92px; }
}

.bl-post-list .list {
    position: relative;
}

.bl-post-list-message {
    align-items: center;
    bottom: 0;
    display: flex;
    justify-content: center;
    left: 0;
    margin: 0;
    padding: 20px;
    position: absolute;
    right: 0;
    text-align: center;
    top: 36px;
}

.bl-post-list-message[hidden] {
    display: none;
}

.bl-post-list .list > .bl-muted {
    margin: 20px;
}


.bl-formation-categories {
    align-items: center;
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
    list-style: none;
    margin: 0;
    padding: 0;

    li {
        background: var(--badge-bg, #f6f7f7);
        border: 1px solid var(--badge-border, #c3c4c7);
        border-radius: 999px;
        color: var(--badge-text, #1d2327);
        font-size: 12px;
        font-weight: 600;
        line-height: 1.2;
        margin: 0;
        padding: 3px 8px;
        white-space: nowrap;
    }
}

.bl-actions,
.bl-formation-details__actions {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    gap: 8px;

    .button {
        box-sizing: border-box;
        flex: 1 0 max-content;
        justify-content: center;
        margin: 0;
        text-align: center;
        white-space: nowrap;
        width: auto;
    }
}

.bl-formation-details__content {
    line-height: 1.6;

    :is(p, ul, ol) { margin-top: 0; }
    :is(p, ul, ol):last-child { margin-bottom: 0; }

    ul {
        padding-inline-start: 1.5em;
        list-style: disc;
    }
}

.bl-formation-details__zoomable-image {
    cursor: zoom-in;
    max-width: 100%;
    border-radius: 3px;

    &:is(:hover, :focus-visible) {
        box-shadow: 0 0 0 2px var(--bl-accent, #ed5b00);
        outline: none;
    }
}

.bl-formation-image-zoom {
    align-items: center;
    background: rgba(0, 0, 0, 0.82);
    cursor: zoom-out;
    display: flex;
    inset: 0;
    justify-content: center;
    padding: 48px;
    position: fixed;
    z-index: 100000;

    &[hidden] { display: none; }
}

.bl-formation-image-zoom__image {
    background: var(--bl-surface, #fff);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
    cursor: default;
    max-height: 90vh;
    max-width: 90vw;
    object-fit: contain;
    border-radius: 3px;
}

.bl-formation-image-zoom__close {
    background: var(--bl-surface, #fff);
    border: 1px solid var(--bl-border, #c3c4c7);
    border-radius: 999px;
    color: var(--bl-text, #1d2327);
    cursor: pointer;
    display: block;
    font-family: Arial, sans-serif;
    font-size: 28px;
    height: 40px;
    line-height: 36px;
    padding: 0 0 4px;
    position: fixed;
    right: 24px;
    text-align: center;
    top: 24px;
    width: 40px;
}

.bl-influence-edit {
    align-items: center;
    display: inline-flex;
    gap: 2px;
}

.bl-edit {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--bl-text, #1d2327);
    cursor: pointer;
    display: inline-flex;
    font-size: 16px;
    font-weight: 600;
    height: 24px;
    justify-content: center;
    padding: 0;
    width: 24px;

    &:is(:hover, :focus-visible) { background: var(--bl-surface-alt, #f6f7f7); }

    &:disabled {
        cursor: wait;
        opacity: 0.35;
    }
}

@media (max-width: 960px) {
    .bl-post-list .container { grid-template-columns: 1fr; }
    .bl-post-list :is(.list, .detail) { height: auto; min-height: 360px; }
}
/* Calculs de matériaux */

.bl-calculation-page-header {
    margin-bottom: 12px;

    h1 { margin-bottom: 0; }
}

.bl-calculation-delete {
    border-color: var(--bl-error-border) !important;
    color: var(--bl-error-border) !important;

    &:is(:hover, :focus-visible) {
        background: var(--bl-surface-alt) !important;
    }
}

.bl-calculation-toolbar {
    align-items: center;
    background: var(--bl-surface);
    border-bottom: 1px solid var(--bl-border);
    display: grid;
    column-gap: 24px;
    grid-template-columns: minmax(190px, 0.7fr) minmax(230px, 1fr) auto;
    row-gap: 12px;
    margin: 0;
    padding: 9px 10px;
    position: sticky;
    top: 0;
    z-index: 2;
}

.bl-calculation-toolbar .bl-field {
    align-items: center;
    display: grid;
    gap: 7px;
    grid-template-columns: auto minmax(0, 1fr);
}

.bl-calculation-toolbar :is(select, input) { width: 100%; }

.bl-calculation-toolbar__actions {
    align-items: center;
    display: flex;
    gap: 8px;
    min-height: 30px;
}

.bl-calculation-message {
    margin: 0 0 16px !important;

    &:empty { display: none; }
}

.bl-calculation-levels[hidden] { display: none; }

.bl-calculation-layout {
    --bl-detail-width: 310px;
    --bl-panel-height: calc(100dvh - 150px);
    --bl-panel-min-height: min(560px, var(--bl-panel-height));
    gap: 12px;
}

.bl-calculation-builder,
.bl-calculation-total,
.bl-calculation-row {
    background: var(--bl-bg);
}

.bl-calculation-builder,
.bl-calculation-total {
    border-color: var(--bl-border);
    border-radius: 10px;
}


.bl-calculation-rows { counter-reset: calculation-row; }

.bl-calculation-row {
    align-items: center;
    border-bottom: 1px solid var(--bl-border);
    display: grid;
    gap: 10px;
    grid-template-columns: 28px minmax(300px, 1fr) 218px 28px;
    min-height: 52px;
    padding: 8px 10px;
    transition: background-color 140ms ease;

    &::before {
        color: var(--bl-muted);
        content: counter(calculation-row, decimal-leading-zero);
        counter-increment: calculation-row;
        font-family: "Adwaita Mono", monospace;
        font-size: 11px;
        font-weight: 700;
        text-align: center;
    }

    &:hover { background: var(--bl-surface-alt); }

    &.is-empty {
        border-bottom-style: dashed;
        color: var(--bl-muted);
    }

    select {
        width: 100%;

        &:is(:invalid, :disabled) { opacity: 1; }
    }
}

.bl-calculation-remove-cell {
    text-align: center;
    width: 28px;
}

.bl-calculation-modification-selects {
    align-items: center;
    display: flex;
    gap: 10px;
    width: 100%;

    > select {
        flex: 1 1 0;
        min-width: 0;
        width: 0;
    }
}

.bl-calculation-levels {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.bl-calculation-level-field {
    display: grid;
    gap: 4px;
    grid-template-columns: auto 52px;

    > span {
        align-self: center;
        color: var(--bl-muted);
        font-size: 11px;
        font-weight: 600;
    }
}

.bl-calculation-remove-row {
    align-items: center;
    color: var(--bl-muted) !important;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    line-height: 1;
    margin: 0;
    padding: 0;
    text-decoration: none;
    width: 30px;

    &:is(:hover, :focus) { color: var(--bl-error-border) !important; }
    &:disabled { visibility: hidden; }
}

.bl-calculation-total {
    align-self: start;
    padding: 12px;
    position: sticky;
    top: 20px;
}

.bl-calculation-total #bl-calculation-total-content { padding-bottom: 4px; }

.bl-calculation-material-group + .bl-calculation-material-group {
    border-top: 1px solid var(--bl-border);
    margin-top: 18px;
    padding-top: 18px;
}

.bl-calculation-material-group h3 {
    color: var(--bl-accent);
    font-family: "Adwaita Mono", monospace;
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.bl-calculation-material-cost {
    align-items: center;
    border-bottom: 1px solid var(--bl-border);
    display: flex;
    gap: 12px;
    justify-content: space-between;
    padding: 10px 0;

    &:last-child { border-bottom: 0; }
}

.bl-calculation-material-cost__description {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.bl-calculation-material-cost__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-calculation-material-cost__description small {
    color: var(--bl-muted);
    font-size: 11px;
}

.bl-calculation-material-cost__missing {
    align-items: center;
    background: var(--bl-surface-alt);
    border: 1px solid var(--bl-border);
    border-radius: 4px;
    display: inline-flex;
    flex: 0 0 auto;
    font-family: "Adwaita Mono", monospace;
    font-weight: 700;
    justify-content: center;
    min-height: 28px;
    min-width: 32px;
    padding: 0 7px;
}

.bl-calculation-material-cost__complete {
    color: var(--bl-accent);
    flex: 0 0 auto;
}

@media screen and (max-width: 900px) {
    .bl-calculation-layout { grid-template-columns: 1fr; }

    .bl-calculation-builder {
        height: auto;
        min-height: 280px;
        overflow-x: auto;
    }

    .bl-calculation-total {
        height: auto;
        min-height: 0;
        position: static;
    }

    .bl-calculation-toolbar { grid-template-columns: 1fr; }
    .bl-calculation-toolbar__actions { flex-wrap: wrap; }


    .bl-calculation-row {
        align-items: start;
        grid-template-columns: 26px minmax(0, 1fr) 30px;
    }

    .bl-calculation-levels-cell {
        grid-column: 2;
    }

    .bl-calculation-remove-cell {
        grid-column: 3;
        grid-row: 1;
    }
}

@media screen and (max-width: 600px) {
    .bl-calculation-modification-selects { flex-direction: column; }
    .bl-calculation-modification-selects > select { width: 100%; }
    .bl-calculation-levels { grid-template-columns: 1fr; }
}

/* Enveloppe frontale des interfaces Black Lotus. */

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    --bl-text: #f2f2f2;
    --bl-muted: #b8b8b8;
    --bl-disabled: #8f8f8f;
    --bl-bg: #121212;
    --bl-surface: #1e1e1e;
    --bl-surface-alt: #242424;
    --bl-border: #2f2f2f;
    --bl-accent: #ed5b00;
    --bl-accent-hover: #ff6a14;
    --bl-ring: 0 0 0 1px var(--bl-accent);
    --bl-success-bg: #102f1c;
    --bl-success-border: #22c55e;
    --bl-warning-bg: #35280d;
    --bl-warning-border: #eab308;
    --bl-error-bg: #4a1717;
    --bl-error-border: #f87171;
    --bl-info-bg: #102638;
    --bl-info-border: #38bdf8;
    --badge-bg: var(--bl-surface-alt);
    --badge-border: var(--bl-border);
    --badge-text: var(--bl-text);
    --badge-red-bg: #3a1515;
    --badge-red-border: #ef4444;
    --badge-red-text: #fca5a5;
    --badge-orange-bg: #3a220f;
    --badge-orange-border: var(--bl-accent);
    --badge-orange-text: #fdba74;
    --badge-yellow-bg: var(--bl-warning-bg);
    --badge-yellow-border: var(--bl-warning-border);
    --badge-yellow-text: #fde68a;
    --badge-green-bg: var(--bl-success-bg);
    --badge-green-border: var(--bl-success-border);
    --badge-green-text: #86efac;
    --badge-blue-bg: var(--bl-info-bg);
    --badge-blue-border: var(--bl-info-border);
    --badge-blue-text: #7dd3fc;
    --bl-sidebar: var(--bl-surface);
    --bl-sidebar-text: var(--bl-muted);
    background: var(--bl-bg);
    color: var(--bl-text);
    color-scheme: dark;
    font-family: "Adwaita Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.5;
    margin: 0;
    min-height: 100vh;
}

.bl-badge:is(.attaqued, .conquering) {
    background: var(--badge-orange-bg);
    border-color: var(--badge-orange-border);
    color: var(--badge-orange-text);
}

.bl-badge.to_conquer {
    background: var(--badge-yellow-bg);
    border-color: var(--badge-yellow-border);
    color: var(--badge-yellow-text);
}

.bl-badge:is(.war, .conquered) {
    background: var(--badge-green-bg);
    border-color: var(--badge-green-border);
    color: var(--badge-green-text);
}

.bl-badge.elections {
    background: var(--badge-blue-bg);
    border-color: var(--badge-blue-border);
    color: var(--badge-blue-text);
}


.bl-public-sidebar {
    align-items: center;
    background: var(--bl-sidebar);
    border-right: 1px solid var(--bl-border);
    bottom: 0;
    display: flex;
    flex-direction: column;
    gap: 22px;
    left: 0;
    padding: 16px 10px;
    position: fixed;
    top: 0;
    width: 72px;
    z-index: 100;
}

.bl-public-sidebar a {
    color: var(--bl-sidebar-text, #a9adb7);
    text-decoration: none;
}

.bl-public-brand,
.bl-public-nav-link,
.bl-public-account-link,
.bl-public-language-toggle {
    align-items: center;
    border-radius: 12px;
    display: flex;
    flex: 0 0 auto;
    height: 44px;
    justify-content: center;
    position: relative;
    transition: background 150ms ease, color 150ms ease, transform 150ms ease;
    width: 44px;
}

.bl-public-brand {
    background: var(--bl-surface-alt);
    color: var(--bl-text) !important;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.bl-public-brand img {
    border-radius: 12px;
    display: block;
}

.bl-public-nav {
    align-items: center;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.bl-public-nav-link .dashicons,
.bl-public-account-link .dashicons {
    font-size: 21px;
    height: 21px;
    width: 21px;
}

.bl-public-account a::after {
    background: var(--bl-surface-alt);
    border: 1px solid var(--bl-border);
    border-radius: 8px;
    box-shadow: 0 8px 24px var(--bl-bg);
    color: var(--bl-text);
    font-size: 12px;
    font-weight: 600;
    left: calc(100% + 12px);
    opacity: 0;
    padding: 7px 10px;
    pointer-events: none;
    position: absolute;
    transform: translateX(-4px);
    transition: opacity 120ms ease, transform 120ms ease;
    white-space: nowrap;
    z-index: 2;
}

.bl-public-account a::after {
    content: attr(aria-label);
}

.bl-public-account a:is(:hover, :focus-visible)::after {
    opacity: 1;
    transform: translateX(0);
}

.bl-public-sidebar a:is(:hover, :focus-visible),
.bl-public-sidebar a.is-current {
    background: var(--bl-surface-alt);
    color: var(--bl-text);
    outline: none;
}

.bl-public-nav-link.is-current::before {
    background: var(--bl-accent);
    border-radius: 0 4px 4px 0;
    content: "";
    height: 22px;
    left: -14px;
    position: absolute;
    width: 4px;
}

.bl-public-account {
    align-items: center;
    display: flex;
    flex: 0 0 auto;
    flex-direction: column;
    gap: 6px;
}

.bl-public-language-toggle {
    color: var(--bl-text) !important;
    font-size: 11px;
    font-weight: 800;
}

.bl-public-main {
    margin-left: 72px;
    max-width: none;
    min-height: 100vh;
    padding: 32px clamp(20px, 3vw, 52px) 44px;
}

.wrap { margin: 0; }


:is(h1, h2, h3, h4) {
    font-family: "Adwaita Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-weight: 700;
}

h1 {
    font-size: clamp(24px, 3vw, 34px);
    letter-spacing: -0.035em;
    margin: 0 0 22px;
}
h2 { font-size: 20px; letter-spacing: -0.02em; }
h3 { font-size: 15px; }

.button-link {
    appearance: none;
    background: none;
    border: 0;
    box-shadow: none;
    color: var(--bl-accent);
    cursor: pointer;
    font: inherit;
    margin: 0;
    padding: 0;
}

.button,
button.button {
    align-items: center;
    appearance: none;
    background: var(--bl-surface-alt);
    border: 1px solid var(--bl-accent);
    border-radius: 8px;
    color: var(--bl-accent);
    cursor: pointer;
    display: inline-flex;
    font: inherit;
    font-weight: 500;
    justify-content: center;
    line-height: 1;
    margin: 0;
    min-height: 30px;
    padding: 0 10px;
    text-decoration: none;
}

.button:hover,
.button:focus-visible {
    background: var(--bl-surface);
    color: var(--bl-accent-hover);
}
.button-primary { background: var(--bl-accent); color: var(--bl-text); }

.button:is(:disabled, [aria-disabled="true"]),
.button-link:disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

:is(input, select, textarea) {
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-radius: 4px;
    color: var(--bl-text);
    font: inherit;
    line-height: 1.3;
    min-height: 30px;
    padding: 0 8px;
}

textarea { padding-block: 7px; }

:is(input, select, textarea):focus {
    border-color: var(--bl-accent);
    box-shadow: var(--bl-ring, 0 0 0 1px var(--bl-accent));
    outline: none;
}

:is(input, select, textarea):disabled {
    color: var(--bl-disabled);
    cursor: not-allowed;
    opacity: 0.75;
}

select :is(option, optgroup) {
    background: var(--bl-surface);
    color: var(--bl-text);
}

.widefat {
    background: var(--bl-surface);
    border-collapse: collapse;
    color: var(--bl-text);
    width: 100%;
}

.widefat :is(th, td) {
    border-bottom: 1px solid var(--bl-border);
    padding: 9px 10px;
    text-align: left;
}

.striped tbody tr:nth-child(odd) {
    background: var(--bl-surface-alt);
}
.screen-reader-text {
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    overflow: hidden;
    position: absolute;
    width: 1px;
}

.notice {
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-left: 4px solid var(--bl-warning-border, #dba617);
    margin: 12px 0;
    padding: 1px 12px;
}

.notice-success {
    background: var(--bl-success-bg, #edfaef);
    border-left-color: var(--bl-success-border, #22c55e);
}

.notice-error {
    background: var(--bl-error-bg, #fcf0f1);
    border-left-color: var(--bl-error-border, #d63638);
}

.notice-info {
    background: var(--bl-info-bg, #eff6ff);
    border-left-color: var(--bl-info-border, #38bdf8);
}


/* Accueil */

.bl-public-home {
    margin: 0 auto;
    max-width: 800px;
}

.bl-public-manifesto__hero {
    border-bottom: 1px solid var(--bl-border);
    padding: clamp(56px, 9vw, 120px) 0 clamp(40px, 6vw, 72px);
}

.bl-public-manifesto__eyebrow {
    color: var(--bl-accent);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.18em;
    margin: 0 0 18px;
    text-transform: uppercase;
}

.bl-public-manifesto__hero h1 {
    font-size: clamp(44px, 8vw, 88px);
    line-height: 0.95;
    margin: 0;
    max-width: 760px;
    text-transform: uppercase;
}

.bl-public-manifesto__content {
    margin: 0;
    max-width: none;
}

.bl-public-manifesto__content section {
    border-bottom: 1px solid var(--bl-border);
    padding: clamp(44px, 7vw, 76px) 0;
}

.bl-public-manifesto__content section:last-child {
    border-bottom: 0;
}

.bl-public-manifesto__content h2 {
    color: var(--bl-accent);
    font-size: clamp(24px, 4vw, 36px);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin: 0 0 28px;
    text-transform: uppercase;
}

.bl-public-manifesto__content p,
.bl-public-manifesto__content li {
    font-size: clamp(16px, 1.7vw, 19px);
    line-height: 1.75;
}

.bl-public-manifesto__content p { margin: 0; }

.bl-public-manifesto__content ul {
    border-left: 2px solid var(--bl-accent);
    list-style: none;
    margin: 24px 0 30px;
    padding: 2px 0 2px 24px;
}

.bl-public-manifesto__content li + li { margin-top: 8px; }

.bl-public-manifesto blockquote {
    border-left: 2px solid var(--bl-accent);
    margin: 32px 0 0;
    padding-left: clamp(22px, 4vw, 40px);
}

.bl-public-manifesto blockquote p {
    color: var(--bl-text);
    font-size: clamp(21px, 3vw, 30px);
    font-weight: 600;
    line-height: 1.45;
}

/* Listes de sélection + détail */
.bl-post-list .container {
    --bl-detail-width: minmax(0, 1fr);
    --bl-panel-height: calc(100dvh - 150px);
    --bl-panel-min-height: min(560px, var(--bl-panel-height));
    gap: 20px;
    grid-template-columns: 380px minmax(0, 1fr);
}

.bl-post-list__header.has-filters + .container {
    --bl-panel-height: calc(100dvh - 170px);
}

.bl-post-list :is(.list, .detail) {
    background: var(--bl-bg);
    border-color: var(--bl-border);
    border-radius: 10px;
}

.bl-post-list .list {
    background: var(--bl-bg);
    border: 1px solid var(--bl-border);
}

.bl-post-list-table,
.bl-post-list-table tbody {
    background: transparent;
    display: block;
}

.bl-post-list-table thead {
    display: none;
}

.bl-post-list-table tbody {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.bl-post-list-table tbody tr {
    background: transparent !important;
    border-bottom: 1px solid var(--bl-border);
    display: flex;
    flex-wrap: wrap;
    gap: 8px 10px;
    padding: 17px 18px 17px 21px;
    position: relative;
    transition: background-color 140ms ease;
}

.bl-post-list-table tbody tr:last-child {
    border-bottom: 0;
}

.bl-post-list-table tbody tr::before {
    background: transparent;
    bottom: 10px;
    content: "";
    left: 0;
    position: absolute;
    top: 10px;
    width: 3px;
}

.bl-post-list-table tbody tr:is(:hover, :focus-visible) {
    background: var(--bl-surface-alt) !important;
    outline: none;
}

.bl-post-list-table tbody tr.is-selected {
    background: var(--bl-surface-alt) !important;
}

.bl-post-list-table tbody tr.is-selected::before {
    background: var(--bl-accent);
}

.bl-post-list-table tbody td {
    border: 0;
    display: block;
    padding: 0;
    width: auto !important;
}

.bl-post-list-table tbody td[data-label="Titre"],
.bl-post-list-table tbody td[data-label="Système"] {
    flex: 1 0 100%;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.01em;
    order: -2;
}

.bl-post-list-table tbody td[data-label="Mission"],
.bl-post-list-table tbody td[data-label="Détails"] {
    color: var(--bl-muted);
    flex: 1 0 100%;
    line-height: 1.45;
    order: 2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bl-post-list-table tbody td[data-label="Influence"] {
    align-items: center;
    display: flex;
    order: 0;
}

.bl-post-list-table tbody td[data-label="Actions"] {
    display: none;
}

.bl-formation-categories {
    flex: 1 1 auto;
    flex-wrap: wrap;
}

.bl-post-list-table td[data-label="Utilité"],
.bl-post-list-table td[data-label="Catégories"],
.bl-post-list-table td[data-label="Rôles"] {
    align-items: center;
    display: flex;
}

.bl-build-engineer-tag .bl-build-engineer-required {
    background: transparent;
    border: 0;
    height: 16px;
    width: 16px;
}

.bl-post-list-table td[data-label="Catégories"],
.bl-post-list-table td[data-label="Rôles"] {
    flex: 1 1 auto;
    min-width: 0;
}

.bl-post-list-table td[data-label="Utilité"] .bl-badge,
.bl-formation-categories li {
    align-items: center;
    display: inline-flex;
    line-height: 1.2;
    min-height: 24px;
    padding: 3px 8px;
}

.bl-build-engineer-required {
    align-items: center;
    background: var(--bl-surface);
    border: 1px solid var(--bl-border);
    border-radius: 4px;
    color: var(--bl-accent);
    display: inline-flex;
    font-size: 16px;
    height: 26px;
    justify-content: center;
    line-height: 1;
    width: 26px;

    &::before { line-height: 1; }
}

.bl-build-engineer-status {
    align-items: center;
    display: inline-flex;
    gap: 6px;
}

.bl-post-list .detail {
    padding: 20px;
}

.bl-post-list .detail .bl-detail-panel__header {
    margin: -20px -20px 16px;
    padding: 18px 20px;
    top: -20px;
}

.bl-post-list .detail > .bl-detail-panel__section {
    margin: 0 -20px !important;
    padding: 20px !important;
}

.bl-post-list .detail > .bl-detail-panel__section + .bl-detail-panel__section {
    border-top: 1px solid var(--bl-border);
}

:is(
    .bl-post-list .detail,
    .bl-engineering-details
) .bl-detail-panel__section h3 {
    color: var(--bl-accent);
    font-family: "Adwaita Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.12em;
    margin-bottom: 16px;
    text-transform: uppercase;
}

.bl-detail-fields > div {
    align-items: start;
    display: grid;
    gap: 16px;
    grid-template-columns: minmax(110px, 0.35fr) minmax(0, 1fr);
    justify-content: initial;
}

.bl-detail-fields dt {
    color: var(--bl-text);
    font-weight: 700;
}

.bl-detail-fields dd {
    min-width: 0;
    overflow-wrap: anywhere;
    text-align: left;
}

/* Le graphe reste plein écran et le détail s’ouvre dans un inspecteur. */
.bl-engineering-guide {
    --bl-panel-height: calc(100dvh - 150px);
    --bl-panel-min-height: min(560px, var(--bl-panel-height));
    display: block;
    position: relative;
}

.bl-engineering-graph {
    background-color: var(--bl-bg);
    background-image: radial-gradient(var(--bl-border) 1px, transparent 1px);
    background-size: 24px 24px;
    border-radius: 10px;
}

.bl-engineering-details {
    background: var(--bl-bg);
    border: 1px solid var(--bl-border);
    border-radius: 0 10px 10px 0;
    bottom: 0;
    box-shadow: -8px 0 24px var(--bl-bg);
    height: auto;
    margin: 0;
    max-height: none;
    min-height: 0;
    overflow: auto;
    padding: 0;
    position: absolute;
    right: 0;
    top: 0;
    width: min(430px, 100%);
    z-index: 4;
}

.bl-engineering-details[hidden] { display: none; }

.bl-engineering-details__header {
    align-items: center;
    background: var(--bl-surface);
    border: 0;
    border-bottom: 1px solid var(--bl-border);
    margin: 0;
    padding: 22px 24px 20px;
    position: sticky;
    top: 0;
}

.bl-engineering-details__eyebrow {
    color: var(--bl-accent);
    display: block;
    font-family: "Adwaita Mono", monospace;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.14em;
    margin-bottom: 6px;
    text-transform: uppercase;
}

.bl-engineering-details__header h2 {
    font-size: 24px;
    line-height: 1.15;
    margin: 0;
}

.bl-engineering-details__actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.bl-engineering-details__close {
    align-items: center;
    appearance: none;
    background: transparent;
    border: 0;
    border-radius: 4px;
    color: var(--bl-muted);
    cursor: pointer;
    display: inline-flex;
    font: 24px/1 "Adwaita Sans", sans-serif;
    height: 28px;
    justify-content: center;
    padding: 0 0 2px;
    width: 28px;
}

.bl-engineering-details__close:is(:hover, :focus-visible) {
    background: var(--bl-surface-alt);
    color: var(--bl-text);
    outline: none;
}

.bl-engineering-details__section {
    background: transparent;
    border: 0 !important;
    margin: 0 !important;
    min-width: 0;
    padding: 22px 24px !important;
}

.bl-engineering-details__section + .bl-engineering-details__section {
    border-top: 1px solid var(--bl-border) !important;
}

.bl-engineering-details__fields > div {
    gap: 24px;
    padding: 3px 0;
}

@media (max-width: 1100px) {
    .bl-post-list .container {
        grid-template-columns: 300px minmax(0, 1fr);
    }
}

@media (min-width: 761px) {
    .bl-public-sidebar {
        padding-bottom: 32px;
    }

    .bl-public-nav {
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: none;
        width: 72px;
    }
}

@media (max-width: 760px) {
    .bl-public-sidebar {
        border-right: 0;
        border-top: 1px solid var(--bl-border);
        flex-direction: row;
        gap: 8px;
        height: 64px;
        overflow-x: auto;
        padding: 8px 12px;
        right: 0;
        top: auto;
        width: auto;
    }

    .bl-public-brand { display: none; }
    .bl-public-nav { flex-direction: row; gap: 4px; }
    .bl-public-account { flex-direction: row; }
    .bl-public-account a::after { display: none; }
    .bl-public-nav-link.is-current::before {
        border-radius: 4px 4px 0 0;
        bottom: -10px;
        height: 3px;
        left: 11px;
        width: 22px;
    }

    .bl-public-main {
        margin-left: 0;
        padding: 22px 16px 88px;
    }

    .bl-post-list__header {
        align-items: stretch;
        flex-direction: column;
        gap: 14px;
    }

    .bl-post-list__header .filters {
        justify-content: flex-start;
        margin-left: 0;
        width: 100%;
    }

    .bl-post-list .container {
        --bl-panel-height: auto;
        display: block;
    }

    .bl-post-list .list {
        height: auto;
        max-height: 42dvh;
        min-height: 240px;
    }

    .bl-post-list .detail {
        height: auto;
        margin-top: 16px;
        min-height: 360px;
    }

    .bl-engineering-guide {
        --bl-panel-height: calc(100dvh - 170px);
        --bl-panel-min-height: 480px;
    }

    .bl-engineering-details {
        border-radius: 10px;
        bottom: 76px;
        display: block;
        left: 12px;
        max-height: min(70dvh, 620px);
        position: fixed;
        right: 12px;
        top: auto;
        width: auto;
        z-index: 110;
    }

    .bl-engineering-details__header {
        padding: 18px 20px;
    }

    .bl-engineering-details__section {
        padding: 20px !important;
    }

}
