/* The calculator page's result-table rules (hardware ux2 to ux5, 2026-11-13/14) and the canvas form's long-choice column rule (ux5): the edge shadows of a table that
   scrolls, a result table inside a figure card, and every result table stacked on a phone. Moved out of the inline
   <style> of Pages/Calculators.cshtml (2026-11-14: the Brotli document budget, CompressionCachingTests)
   in their original order; linked right after that <style>, so no inline rule that came later wins by order (each
   later inline rule on these selectors is of lower specificity or sets other properties). The House page links it
   after calculator-page.css. */

        /* A table wider than its box scrolls inside it, and shows it: an edge shadow on each side that still has
           columns to scroll to (scroll-attached covers hide a shadow at the end already reached). UX1 S-1, F-4. */
        .grid-out-scroll, .cv-group-table {
            background:linear-gradient(to right, var(--surface) 30%, transparent) left / 28px 100% no-repeat local,
                linear-gradient(to left, var(--surface) 30%, transparent) right / 28px 100% no-repeat local,
                radial-gradient(farthest-side at 0 50%, color-mix(in srgb, var(--ink) 22%, transparent), transparent) left / 12px 100% no-repeat scroll,
                radial-gradient(farthest-side at 100% 50%, color-mix(in srgb, var(--ink) 22%, transparent), transparent) right / 12px 100% no-repeat scroll; }
        /* A result table in a metric card scrolls inside its card, never the page (hardware ux2 S-1: the Stair page's
           "Checks against your limits" widened a 375 px page to 483 px). `contain:inline-size` keeps the table's width
           out of the card's and the grid's own sizing, so the card takes the row's width and the table scrolls in it. */
        .stat:has(> .stat-value > .grid-out) { min-width:0; }
        .stat-value:has(> .grid-out) { contain:inline-size; max-width:100%; overflow-x:auto; }
        /* On a phone a result table keeps its first column (the item a row is about) pinned while the other columns
           scroll inside the table's box, and a cell's figure or size ("1-1/2 in", "$1,477.00") stays on one line
           (hardware ux2: Unit price and Cost were off-screen with nothing saying which row they belonged to). */
        @media (max-width:640px) {
            /* A table that is not stacked (none on a calculator page since hardware ux4; kept for a table a page draws
               itself) keeps its first column pinned while the others scroll inside its box. */
            .cv-table-scroll .grid-out:not(.cv-stack):not(.grid-stack):not(.house-grid) td,
            .stat-value > .grid-out:not(.grid-stack) td { white-space:nowrap; }
            .cv-table-scroll .grid-out:not(.cv-stack):not(.grid-stack):not(.house-grid) tr > :first-child,
            .stat-value > .grid-out:not(.grid-stack) tr > :first-child {
                position:sticky; left:0; z-index:1; background:var(--surface); min-width:7em; max-width:9.5em; white-space:normal;
                box-shadow:inset -1px 0 0 var(--line); }
            /* EVERY RESULT TABLE IS STACKED ON A PHONE, as the House's: each row a block of "heading: value" lines from the
               cell's data-label, so Size never crowds the item and the money columns are on screen. ux3 did it for the
               canvas pages' tables (cv-stack); ux4 for every other one: a result table in a figure card (grid-stack, the
               Stair page's "Checks against your limits", a 600 px table in a 287 px box) and a chart's data table. */
            .cv-table-scroll:has(> .grid-out.cv-stack), .chart-data-scroll:has(> .grid-stack) { overflow-x:visible; background:none; }
            .stat-value:has(> .grid-out.grid-stack) { contain:none; overflow-x:visible; }
            .cv-table-scroll .grid-out.cv-stack, .cv-table-scroll .grid-out.cv-stack tbody,
            .grid-out.grid-stack, .grid-out.grid-stack tbody, .chart-data-table.grid-stack, .chart-data-table.grid-stack tbody { display:block; width:100%; }
            .cv-table-scroll .grid-out.cv-stack thead, .grid-out.grid-stack thead, .chart-data-table.grid-stack thead {
                position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
            .chart-data-table.grid-stack caption { display:block; }
            .cv-table-scroll .grid-out.cv-stack tr, .grid-out.grid-stack tr, .chart-data-table.grid-stack tbody tr {
                display:block; padding:8px 0; border-bottom:1px solid var(--line); }
            .cv-table-scroll .grid-out.cv-stack tr > :first-child, .cv-table-scroll .grid-out.cv-stack td,
            .grid-out.grid-stack td, .chart-data-table.grid-stack tbody th, .chart-data-table.grid-stack td {
                position:static; display:flex; justify-content:space-between; gap:12px; min-width:0; max-width:none;
                padding:2px 0; border:0; box-shadow:none; white-space:normal; text-align:right; }
            .cv-table-scroll .grid-out.cv-stack [data-label]::before, .grid-out.grid-stack [data-label]::before,
            .chart-data-table.grid-stack [data-label]::before { content:attr(data-label); color:var(--muted); font-weight:400; text-align:left; flex:0 0 auto; }
            .cv-table-scroll .grid-out.cv-stack td, .grid-out.grid-stack td, .chart-data-table.grid-stack td { overflow-wrap:normal; word-break:normal; }
            /* A blank cell (an item with no size) is no line at all, never a bare "Size" (hardware ux3 P3). */
            .cv-table-scroll .grid-out.cv-stack td:empty, .grid-out.grid-stack td:empty, .chart-data-table.grid-stack td:empty { display:none; }
            /* A Total row stacked reads as on a desktop (hardware ux4): one bold line, "Total" and its amount, under a 2 px
               rule; a further figure in the row (none on the canvas pages) follows on its own labelled line. */
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row { display:flex; flex-wrap:wrap; align-items:baseline; column-gap:12px;
                border-top:2px solid var(--ink); }
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > * { border-top:0; }
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > :first-child { flex:1 1 auto; order:0; justify-content:flex-start; text-align:left; }
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > .cv-total-amount { flex:0 0 auto; order:1; }
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > :first-child::before,
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > .cv-total-amount::before { content:none; }
            .cv-table-scroll .grid-out.cv-stack tr.cv-total-row > td:not(.cv-total-amount) { flex:1 0 100%; order:2; }
        }
        /* A canvas table the drawing leaves empty says "None." (hardware ux3). */
        .cv-table-none { margin:4px 0 0; color:var(--muted); }

        /* The workbook's Total row: the sum, set apart from the items above it (hardware ux2). */
        .cv-table-scroll .grid-out tr.cv-total-row > * { font-weight:700; color:var(--ink); border-top:2px solid var(--ink); }

        /* A choice with a long option (fields/control.js .ctl-long-choice) takes two of the form's
           columns on a wide screen, so its chosen text is not clipped (hardware ux5: Deck's design
           load read "40 psf (1.9 kPa) live lo"). Below 901px the form may hold one column, where a
           span of two would add a column, so the field keeps its one. */
        @media (min-width:901px) { .cv-form .fields > .field:has(> .ctl-long-choice) { grid-column:span 2; } }
