/* Visibility matrix - see _modules/partials/visibility_matrix.php.
   Tokens only, so it lands correctly in both dark and [data-theme="light"]. */

.vis-matrix {
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.vis-matrix__controls {
    padding: .85rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.vis-matrix__group {
    display: flex;
    gap: .4rem;
}

.vis-matrix__group--wrap {
    flex-wrap: wrap;
}

.vis-matrix__seg,
.vis-matrix__chip {
    flex: 1 1 auto;
    min-width: 0;
    padding: .45rem .7rem;
    font-size: .85rem;
    line-height: 1.2;
    color: var(--text-secondary);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}

.vis-matrix__chip {
    flex: 0 1 auto;
}

.vis-matrix__seg:hover,
.vis-matrix__chip:hover {
    color: var(--text);
    background: var(--bg-card-hover);
    border-color: var(--border-bright);
}

.vis-matrix__seg.is-on {
    color: var(--accent-fg);
    background: var(--accent);
    border-color: var(--accent);
}

/* Ceilings happen TO the page rather than being chosen, so a lit chip uses the
   warning tone - it must never read as "you turned this on". */
.vis-matrix__chip.is-on {
    color: var(--color-warning);
    background: color-mix(in srgb, var(--color-warning) 16%, transparent);
    border-color: color-mix(in srgb, var(--color-warning) 45%, transparent);
}

.vis-matrix__legend {
    margin: 0 0 .4rem;
    font-size: .78rem;
    color: var(--text-secondary);
}

.vis-matrix__legend:not(:first-child) {
    margin-top: .85rem;
}

.vis-matrix__legend--muted {
    color: var(--text-muted);
}

.vis-matrix__headline {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: .5rem;
}

.vis-matrix__eyebrow {
    font-size: .78rem;
    color: var(--text-secondary);
}

.vis-matrix__level {
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--text);
}

.vis-matrix__badge {
    padding: .1rem .5rem;
    font-size: .72rem;
    border-radius: 999px;
}

.vis-matrix__badge.is-capped {
    color: var(--color-warning);
    background: color-mix(in srgb, var(--color-warning) 16%, transparent);
}

.vis-matrix__badge.is-clear {
    color: var(--color-success);
    background: color-mix(in srgb, var(--color-success) 16%, transparent);
}

.vis-matrix__why {
    margin: -.25rem 0 0;
    font-size: .82rem;
    line-height: 1.55;
    color: var(--text-secondary);
}

/* The grid. Row labels carry the words; every cell is a single glyph, so a
   column reads as one viewer's answers and a row as one capability's. */
.vis-matrix__grid {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.vis-matrix__grid th,
.vis-matrix__grid td {
    padding: .5rem .35rem;
    border-bottom: 1px solid var(--border);
}

.vis-matrix__grid thead th {
    font-size: .72rem;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-bottom-color: var(--border-bright);
}

.vis-matrix__grid thead th:first-child {
    width: 42%;
}

.vis-matrix__grid tbody th {
    font-size: .82rem;
    font-weight: 400;
    color: var(--text);
    text-align: left;
}

.vis-matrix__grid td {
    text-align: center;
    font-size: .95rem;
}

.vis-matrix__grid td.is-yes {
    color: var(--color-success);
}

.vis-matrix__grid td.is-no {
    color: var(--text-muted);
    opacity: .55;
}

.vis-matrix__grid td.is-ro {
    color: var(--color-warning);
}

/* "You" is the column a page owner came here to read. */
.vis-matrix__grid thead th:nth-child(4),
.vis-matrix__grid tbody td:nth-child(4) {
    background: var(--bg-card);
}

.vis-matrix__grid thead th:nth-child(4) {
    color: var(--text-secondary);
}

.vis-matrix__foot {
    margin: 0;
    font-size: .78rem;
    line-height: 1.55;
    color: var(--text-muted);
}

@media (max-width: 575.98px) {
    .vis-matrix__group {
        flex-wrap: wrap;
    }

    .vis-matrix__grid thead th:first-child {
        width: 34%;
    }

    .vis-matrix__grid tbody th {
        font-size: .78rem;
    }

    .vis-matrix__grid th,
    .vis-matrix__grid td {
        padding: .5rem .2rem;
    }
}

/* The edit-form trigger: a quiet inline link under the visibility options. */
.vis-matrix-link {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: 0;
    font-size: .8rem;
    color: var(--text-secondary);
    background: none;
    border: 0;
    text-decoration: underline;
    text-underline-offset: 2px;
    cursor: pointer;
}

.vis-matrix-link:hover {
    color: var(--text);
}
