/***************************************
 * TABLES
 * Bootstrap 5.3 .table with Jena overrides (docs/ui-design-consistency-plan.md, 3.5)
 *
 * <table class="table jena-table">
 *
 * Label/value tables on the results page: hairline grid (1px, outer and
 * rows), label column set apart by weight only (no fill, no letter-spacing),
 * one cell padding.
 *
 * Layout: a fixed 40 / 60 split on every screen (and in the PDF). With 25 %
 * long labels ran over 2–3 lines and the rows felt cramped; most values are
 * short ("Keine Angabe", "Nein"). Fixed layout also cannot outgrow the screen
 * under user text spacing (9.1.4.12), and a content-sized label column
 * collapsed to a few characters on phones. Label above value was rejected:
 * display: block on table parts drops the table semantics in Safari / VoiceOver.
 ***************************************/

.jena-table {
    --bs-table-bg: var(--jena-color-bg-page-default);
    --bs-table-border-color: var(--jena-color-border-neutral-subtle);

    margin-top: var(--jena-space-sm);
    margin-bottom: var(--jena-space-lg);
    table-layout: fixed;
    border: var(--jena-border-width-sm) var(--jena-border-style) var(--jena-color-border-neutral-subtle);
}

/*
 * Cells
 * BITV 9.1.4.10 / 9.2.1.1: tables must fit narrow screens instead of
 * scrolling horizontally (a scroll container would need its own keyboard
 * access). Long German compounds ("Treppenhaus/Eingangsbereich") are
 * hyphenated at syllables via the page `lang` where the browser has a
 * dictionary, and break anywhere as a last resort (e.g. Chrome on Linux).
 */
.jena-table th,
.jena-table td {
    /* 12px top/bottom (sm + xs): rows with wrapped labels get some air */
    padding: calc(var(--jena-space-sm) + var(--jena-space-xs)) var(--jena-space-md);
    vertical-align: top;
    overflow-wrap: anywhere;
    hyphens: auto;
}

.jena-table th {
    width: 40%;
    font-weight: var(--jena-font-weight-semibold);
    color: var(--jena-color-text-primary-default);
}

/*
 * Unanswered factor (D5): the row stays in the list, in form order, but quiet —
 * label in normal weight and muted, value "Keine Angabe". An unticked checkbox
 * is an answer ("does not apply") and is not marked.
 */
.jena-table tr.is-empty th {
    font-weight: var(--jena-font-weight-normal);
    color: var(--jena-color-text-primary-muted);
}

.jena-no-answer {
    color: var(--jena-color-text-primary-muted);
}

/* Phones: less side padding, so the 60 % value column keeps its room. */
@media (width < 576px) {
    .jena-table th,
    .jena-table td {
        padding-inline: var(--jena-space-sm);
    }
}

/* Checkbox results: label left, answer right; the answer wraps below on narrow cells. */
.jena-checkbox-list > li {
    flex-wrap: wrap;
    column-gap: var(--jena-space-sm);
}
