/* ── Rubric Section ──────────────────────────────────────────────────── */

.rubric-section {
    margin-bottom: 2.5rem;
}

.md-typeset .rubric__summary {
    margin: 0 0 1.25rem;
    color: var(--ops-text-mid);
}

.rubric__summary strong {
    color: var(--ops-text);
}

/* Override MkDocs h3 defaults so the section title renders cleanly */
.rubric-section__title.rubric-section__title {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.75rem;
    align-items: center;
    font-size: 1rem;
    font-weight: 700;
    margin-top: 0;
    margin-bottom: 0.55rem;
    padding: 0 0 0.45rem;
    border-left: 0;
    border-bottom: 1px solid var(--ops-line-strong);
    color: var(--md-default-fg-color);
}

.rubric-section__points {
    margin-left: auto;
    padding: 0.15rem 0.55rem;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--ops-teal) 45%, transparent);
    background: color-mix(in srgb, var(--ops-teal) 10%, transparent);
    color: var(--ops-teal);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
    letter-spacing: 0.02em;
}

/* ── Typed rubric ───────────────────────────────────────────────────── */

.rubric--typed .rubric-section {
    margin-bottom: 1.75rem;
}

.md-typeset ul.rubric-checklist {
    padding: 0;
    margin: 0;
    overflow: hidden;
    list-style: none;
    border: 1px solid var(--ops-line);
    border-radius: var(--ops-radius);
    background: rgba(12, 17, 27, 0.72);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.md-typeset .rubric-checklist__item {
    display: grid;
    grid-template-columns: 1.05rem minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: start;
    padding: 0.8rem 0.9rem;
    margin: 0;
    transition: background-color 0.15s ease;
}

.md-typeset ul.rubric-checklist > li.rubric-checklist__item {
    margin: 0;
}

.md-typeset .rubric-checklist__item + .rubric-checklist__item {
    border-top: 1px solid var(--ops-line);
}

.rubric-checklist__item:hover,
.rubric-checklist__item:focus-within {
    background: rgba(66, 211, 200, 0.035);
}

.rubric-checklist__item.is-checked {
    background: rgba(66, 211, 200, 0.07);
}

.rubric-checklist__checkbox {
    appearance: none;
    display: grid;
    place-content: center;
    width: 0.9rem;
    height: 0.9rem;
    margin: 0.17rem 0 0;
    border: 1.5px solid var(--ops-teal);
    border-radius: 0.16rem;
    background: rgba(66, 211, 200, 0.06);
    color: var(--ops-ink);
    cursor: pointer;
    transition: background-color 0.12s ease, box-shadow 0.12s ease;
}

.rubric-checklist__checkbox::before {
    content: "";
    width: 0.48rem;
    height: 0.48rem;
    clip-path: polygon(14% 44%, 0 59%, 40% 100%, 100% 18%, 84% 4%, 38% 69%);
    background: currentColor;
    transform: scale(0);
    transition: transform 0.12s ease;
}

.rubric-checklist__checkbox:checked {
    background: var(--ops-teal);
}

.rubric-checklist__checkbox:checked::before {
    transform: scale(1);
}

.rubric-checklist__checkbox:focus-visible {
    outline: 2px solid var(--ops-teal);
    outline-offset: 3px;
}

.rubric-checklist__description {
    color: var(--ops-text);
    font-size: 0.84rem;
    line-height: 1.5;
    cursor: pointer;
}

.rubric-checklist__item.is-checked .rubric-checklist__description,
.rubric-checklist__item.is-checked .rubric-checklist__points {
    opacity: 0.72;
}

.rubric-checklist__points {
    min-width: 3.5rem;
    color: var(--ops-teal);
    font-size: 0.76rem;
    font-weight: 800;
    text-align: right;
    white-space: nowrap;
}

.md-typeset .rubric-checklist__tiers {
    grid-column: 2 / -1;
    min-width: 0;
    width: 100%;
    margin-top: 0.15rem;
    overflow-x: auto;
}

.rubric-checklist__tiers > summary {
    color: var(--ops-teal);
    cursor: pointer;
    font-size: 0.76rem;
    font-weight: 700;
}

.rubric-checklist__tiers .rubric-criterion__table {
    margin-top: 0.55rem;
}

.md-typeset .rubric__bonus,
.rubric-checklist__item--bonus .rubric-checklist__points,
.rubric-checklist__item--bonus .rubric-checklist__tiers > summary,
.rubric-criterion--bonus .rubric-criterion__points {
    color: var(--ops-amber);
}

.rubric-checklist__item--bonus .rubric__bonus {
    font-weight: 700;
}

.rubric-checklist__item--bonus .rubric-checklist__checkbox {
    border-color: var(--ops-amber);
    background: color-mix(in srgb, var(--ops-amber) 6%, transparent);
}

.rubric-checklist__item--bonus .rubric-checklist__checkbox:checked {
    background: var(--ops-amber);
}

.rubric-checklist__item--bonus .rubric-checklist__checkbox:focus-visible {
    outline-color: var(--ops-amber);
}

.rubric-checklist__item--bonus.is-checked {
    background: color-mix(in srgb, var(--ops-amber) 7%, transparent);
}

@media (max-width: 520px) {
    .md-typeset .rubric-checklist__item {
        grid-template-columns: 1rem minmax(0, 1fr);
    }

    .rubric-checklist__points {
        grid-column: 2;
        text-align: left;
    }

    .rubric-checklist__tiers .rubric-criterion__table {
        min-width: 28rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rubric-checklist__item,
    .rubric-checklist__checkbox,
    .rubric-checklist__checkbox::before {
        transition: none;
    }
}

/* ── Rubric Criterion (collapsible) ─────────────────────────────────── */

.rubric-criterion {
    border: 1px solid var(--md-default-fg-color--lightest);
    border-radius: 0.4rem;
    margin-bottom: 0.4rem;
    overflow: hidden;
}

.rubric-criterion[open] > summary {
    border-bottom: 1px solid var(--md-default-fg-color--lightest);
}

.rubric-criterion__header {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.6rem 0.9rem;
    cursor: pointer;
    background: var(--md-code-bg-color);
    list-style: none;
    user-select: none;
}

.rubric-criterion__header::-webkit-details-marker {
    display: none;
}

.rubric-criterion__header::before {
    content: "▶";
    font-size: 0.6rem;
    color: var(--md-default-fg-color--light);
    transition: transform 0.15s ease;
    flex-shrink: 0;
}

.rubric-criterion[open] > .rubric-criterion__header::before {
    transform: rotate(90deg);
}

.rubric-criterion__name {
    font-weight: 600;
    font-size: 0.9rem;
    flex: 1;
}

.rubric-criterion__summary {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.rubric-criterion__desc {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--md-default-fg-color--light);
    font-style: italic;
}

.rubric-criterion__points {
    margin-left: auto;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--md-default-fg-color--light);
    white-space: nowrap;
    flex-shrink: 0;
}

/* ── Tier Table ──────────────────────────────────────────────────────── */

.rubric-criterion__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    margin: 0;
    /* Prevent MkDocs from adding extra table styles */
    display: table;
}

.rubric-criterion__table thead th {
    background: color-mix(in srgb, var(--md-default-fg-color) 6%, transparent);
    padding: 0.4rem 0.75rem;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--md-default-fg-color--light);
}

/* Points column */
.rubric-criterion__table thead th:first-child,
.rubric-tier__points {
    width: 5rem;
    text-align: center;
}

/* Level column */
.rubric-criterion__table thead th:nth-child(2) {
    width: 9rem;
}

.rubric-tier td {
    padding: 0.55rem 0.75rem;
    vertical-align: top;
    border-top: 1px solid var(--md-default-fg-color--lightest);
    line-height: 1.5;
}

.rubric-tier__points {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.rubric-tier__label {
    font-weight: 600;
    white-space: nowrap;
}

/* Highlight the top (full-credit) tier */
.rubric-tier--top td {
    background: color-mix(in srgb, var(--md-primary-fg-color) 8%, transparent);
}

.rubric-tier--top .rubric-tier__points {
    color: var(--md-primary-fg-color);
}

.rubric-checklist__item--bonus .rubric-tier--top td,
.rubric-criterion--bonus .rubric-tier--top td {
    background: color-mix(in srgb, var(--ops-amber) 8%, transparent);
}

.rubric-checklist__item--bonus .rubric-tier--top .rubric-tier__points,
.rubric-criterion--bonus .rubric-tier--top .rubric-tier__points {
    color: var(--ops-amber);
}

/* Mute the zero tier */
.rubric-tier--zero td {
    opacity: 0.55;
}
