/* Matrix-only styling. The shared css/site.css is unchanged. */
.matrix-page {
    --page-width: 1280px;
    --matrix-ink: #33434e;
    --matrix-muted: #63717b;
    --matrix-rule: #e4e8eb;
    --matrix-header: #f6f7f8;
    --matrix-section: #e9edef;
    --matrix-domain: #f4f6f7;
    --matrix-present: #f0f3f5;
    --matrix-selected: #e2ebef;
    --matrix-accent: #496578;
}
.matrix-page main { padding-top: 1.15rem; }
.matrix-title { font-size: clamp(1.6rem, 3.1vw, 2.2rem); margin-bottom: 0.65rem; }

/* The column headers are the only role controls; keep them visible while scrolling. */
.matrix-scroll {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 13rem);
    max-height: calc(100dvh - 13rem);
    min-height: 15rem;
    overflow: auto;
    border: 1px solid #d8dfe3;
}
.competency-table {
    width: 100%;
    min-width: 790px;
    border-collapse: separate;
    border-spacing: 0;
    table-layout: fixed;
    font: 0.77rem/1.26 Arial, Helvetica, sans-serif;
    color: var(--matrix-ink);
}
.competency-table col.role-column { width: 9.8%; }
.competency-table col.competency-column { width: 51%; }
.competency-table th,
.competency-table td {
    border-right: 1px solid var(--matrix-rule);
    border-bottom: 1px solid var(--matrix-rule);
}
.matrix-column-labels th {
    position: sticky;
    top: 0;
    z-index: 10;
    padding: 0;
    background: var(--matrix-header);
    vertical-align: middle;
    box-shadow: 0 1px 0 #d8dfe3;
}
.matrix-control {
    display: block;
    width: 100%;
    height: 100%;
    min-height: 3.6rem;
    border: 0;
    background: transparent;
    color: var(--matrix-ink);
    font: 600 0.72rem/1.25 Arial, Helvetica, sans-serif;
    text-align: center;
    padding: 0.38rem 0.25rem;
    cursor: pointer;
}
.matrix-control small {
    display: block;
    margin-top: 0.17rem;
    color: var(--matrix-muted);
    font-weight: 400;
    font-size: 0.62rem;
}
.matrix-control:hover { background: #edf1f3; }
.matrix-control.is-selected,
.matrix-control[aria-pressed="true"] {
    background: var(--matrix-selected);
    color: var(--matrix-ink);
    box-shadow: inset 0 -2px 0 var(--matrix-accent);
}
.matrix-control.is-selected small,
.matrix-control[aria-pressed="true"] small { color: #536672; }
.matrix-control:focus-visible,
.matrix-scroll:focus-visible {
    outline: 2px solid var(--matrix-accent);
    outline-offset: -3px;
}

/* New and Retained use the same quiet, two-level heading hierarchy. */
.competency-table .section-row th {
    background: var(--matrix-section);
    color: var(--matrix-ink);
    text-align: left;
    font: 700 0.75rem/1.3 Arial, Helvetica, sans-serif;
    letter-spacing: 0.025em;
    padding: 0.45rem 0.55rem;
}
.competency-table .category-row th {
    background: var(--matrix-domain);
    color: #455661;
    text-align: left;
    font: 700 0.72rem/1.25 Arial, Helvetica, sans-serif;
    letter-spacing: 0.015em;
    /* Five role columns at 9.8% each, plus the skills column's text inset. */
    padding: 0.28rem 0.55rem 0.28rem calc(49% + 0.55rem);
}

/* One mark treatment for every historical role; no five-step blue color scale. */
.competency-table .role-cell {
    padding: 0.24rem 0.12rem;
    height: 1.55rem;
    text-align: center;
    color: var(--matrix-ink);
    font-weight: 700;
    background: #fff;
}
.competency-table .role-cell.is-present { background: var(--matrix-present); }
.competency-table .role-cell.is-future,
.competency-table .role-cell.is-present.is-future {
    background: #fff;
    color: inherit;
}
.competency-table .role-cell.is-future span { display: none; }
.competency-table .competency-name {
    padding: 0.24rem 0.55rem;
    text-align: left;
    font-weight: 400;
    background: #fff;
    overflow-wrap: anywhere;
}
/* Highlight only the selected role's marks, with a light tint rather than a solid bar. */
.competency-table.is-focused td[data-role-cell].is-selected {
    background: var(--matrix-selected);
    color: #263f4f;
}
@media (max-width: 720px) {
    .matrix-page { --page-width: 100%; }
    .matrix-page .page-width { width: 94%; }
}


/* Keep the wide table on computers only. Phones use a single-column role view. */
.matrix-mobile { display: none; }

@media (max-width: 900px) {
    .matrix-desktop { display: none; }
    .matrix-mobile { display: block; }

    /* Constrain the ACTUAL content, rather than hiding horizontal overflow. */
    .matrix-page main.page-width {
        width: calc(100% - 32px);
        max-width: 540px;
        min-width: 0;
        margin-left: auto;
        margin-right: auto;
        padding-top: 1.35rem;
    }
    .matrix-content,
    .matrix-mobile,
    .mobile-role-panel {
        width: 100%;
        max-width: 100%;
        min-width: 0;
    }

    /* A slider with five stops and two finger-sized buttons. */
    .mobile-milestone-label {
        display: block;
        margin-bottom: 0.55rem;
        font: 700 0.85rem/1.35 Arial, Helvetica, sans-serif;
        color: var(--matrix-ink);
    }
    .mobile-role-navigation {
        display: grid;
        grid-template-columns: 44px minmax(0, 1fr) 44px;
        align-items: center;
        gap: 10px;
        width: 100%;
        min-width: 0;
    }
    .mobile-role-navigation button {
        width: 44px;
        height: 44px;
        padding: 0;
        border: 1px solid #d8dfe3;
        border-radius: 4px;
        background: #fff;
        color: var(--matrix-ink);
        font: 1.1rem Arial, Helvetica, sans-serif;
        cursor: pointer;
    }
    .mobile-role-navigation button:disabled {
        opacity: 0.35;
        cursor: default;
    }
    .mobile-role-slider {
        display: block;
        width: 100%;
        min-width: 0;
        margin: 0;
        accent-color: var(--matrix-accent);
        cursor: pointer;
    }
    .mobile-role-slider:focus-visible,
    .mobile-role-navigation button:focus-visible {
        outline: 2px solid var(--matrix-accent);
        outline-offset: 2px;
    }
    .mobile-position-count {
        margin: 0.35rem 0 1.4rem;
        color: var(--matrix-muted);
        text-align: center;
        font: 0.78rem/1.35 Arial, Helvetica, sans-serif;
    }

    /* Role and skill lists have no fixed widths or horizontal scrolling. */
    .mobile-role-panel[hidden] { display: none; }
    .mobile-role-info {
        padding-bottom: 1rem;
        border-bottom: 1px solid var(--matrix-rule);
        margin-bottom: 1.2rem;
    }
    .mobile-role-info h2 {
        margin-bottom: 0.22rem;
        font: 600 1.35rem/1.25 Georgia, 'Times New Roman', serif;
        color: var(--matrix-ink);
        overflow-wrap: break-word;
    }
    .mobile-role-info p {
        margin: 0;
        font: 0.85rem/1.55 Arial, Helvetica, sans-serif;
        color: var(--matrix-muted);
        overflow-wrap: break-word;
    }
    .mobile-skill-section { margin: 0 0 1.7rem; }
    .mobile-skill-section h3 {
        margin: 0 0 0.9rem;
        padding: 0.48rem 0.65rem;
        background: var(--matrix-section);
        font: 700 0.85rem/1.3 Arial, Helvetica, sans-serif;
        color: var(--matrix-ink);
    }
    .mobile-skill-domain { margin: 0 0 1rem; }
    .mobile-skill-domain h4 {
        margin: 0 0 0.3rem;
        padding-bottom: 0.25rem;
        border-bottom: 1px solid var(--matrix-rule);
        font: 700 0.72rem/1.4 Arial, Helvetica, sans-serif;
        letter-spacing: 0.015em;
        color: var(--matrix-muted);
        overflow-wrap: break-word;
    }
    .mobile-skill-domain ul {
        list-style: none;
        padding: 0;
        margin: 0;
        min-width: 0;
    }
    .mobile-skill-domain li {
        padding: 0.32rem 0;
        border-bottom: 1px solid #f1f3f4;
        font: 0.92rem/1.45 Arial, Helvetica, sans-serif;
        color: var(--matrix-ink);
        overflow-wrap: break-word;
    }
}
