/* Paper: black only, no fills, hairline rules. Zero @page margins (so browsers can't print the
   URL, which contains names) with padding inside each page instead. Each .page is exactly one
   sheet; PrintPlan counts the same pages this file lays out. */

@media screen {
    .print-only { display: none; }
}

@media print {
    @page { size: letter portrait; margin: 0; }
    @page chart { size: letter landscape; margin: 0; }

    html, body { background: #fff; color: #000; font-size: 12pt; }
    .screen, .ct-bar, #blazor-error-ui { display: none !important; }
    .print-only { display: block; }

    .page {
        position: relative; overflow: hidden; break-after: page; break-inside: avoid;
        display: flex; flex-direction: column;
        font-family: Arial, Helvetica, sans-serif; color: #000;
    }
    .page:last-child { break-after: auto; }
    .page.portrait { width: 8.5in; height: 11in; padding: 0.5in 0.5in 0.3in; }
    .page.landscape { page: chart; width: 11in; height: 8.5in; padding: 0.4in 0.5in 0.25in; }

    /* Every page ends with a strip kept for branding: the same height whether or not it says anything. */
    .page-foot {
        flex: none; height: 0.35in; margin-top: auto; padding-top: 6pt;
        font-size: 9pt; text-align: center; overflow: hidden; white-space: nowrap;
    }

    /* A printout's header: title on the left, the night's date and name small in the top right. */
    .print-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.3in; }
    .print-head > :first-child { min-width: 0; }
    .head-corner { flex: 0 1 auto; max-width: 2.3in; text-align: right; line-height: 1.15; font-size: 10pt; }
    .head-corner .nd-title { font-weight: 700; }

    .fit { white-space: nowrap; overflow: hidden; }
    .box { display: inline-block; border: 1pt solid #000; }
    .line { display: inline-block; border-bottom: 0.75pt solid #000; }

    /* ---------- Player card: one row per round, 20 rounds per page ---------- */
    .card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.3in; }
    /* The name takes the width it needs; the corner gets everything left over. */
    .card-left { flex: 0 1 auto; min-width: 0; }
    .card-name-line { display: flex; align-items: baseline; gap: 14pt; line-height: 1.15; }
    .card-name { min-width: 0; font-size: 40pt; font-weight: 700; letter-spacing: 0.5pt; white-space: nowrap; overflow: hidden; }
    /* 9 letters and up: a little smaller, so the number and the corner still fit beside it. */
    .card-name.long { font-size: 34pt; }
    .card-no { flex: none; font-size: 24pt; font-weight: 700; white-space: nowrap; }
    .card-sub { font-size: 14pt; margin: 4pt 0 2pt; }
    /* The corner: the night's details in small type, right-aligned, tight to the top. It spreads
       left into whatever the name doesn't use, so instructions run on wide, short lines; beside a
       long name it narrows, down to 1.6in. */
    .card-corner { flex: 1 1 0; min-width: 1.6in; text-align: right; line-height: 1.15; }
    .card-corner .nd-date { font-size: 11pt; }
    .card-corner .nd-title { font-size: 12pt; font-weight: 700; }
    .card-corner .nd-notes { font-size: 10pt; font-style: italic; white-space: pre-line; overflow-wrap: anywhere; margin-top: 2pt; }
    /* No name typed: "Name" and a line to write it on, where the printed name would be. */
    .card-name.write-in { flex: 1; min-width: 3in; display: flex; align-items: baseline; gap: 6pt; }
    .card-name.write-in > span:first-child { font-size: 16pt; font-weight: 400; letter-spacing: 0; }
    .card-name.write-in .write-line { flex: 1; border-bottom: 1.5pt solid #000; }

    .card-rows { flex: 1; width: 100%; margin-top: 10pt; border-collapse: collapse; table-layout: fixed; }
    .card-rows col.c-round { width: 9%; }
    .card-rows col.c-table { width: 10%; }
    .card-rows col.c-partner { width: 26%; }
    .card-rows col.c-against { width: 46%; }
    .card-rows col.c-score { width: 9%; }
    .card-rows th { font-size: 12pt; font-weight: 400; text-align: left; padding: 0 4pt 4pt; border-bottom: 1.5pt solid #000; }
    .card-rows td { padding: 1pt 4pt; border-bottom: 0.5pt solid #000; vertical-align: middle; }
    .card-rows tr.filler td { border-bottom: 0; }
    .card-rows td.round-no { font-weight: 700; }
    .card-rows td.table-no { font-weight: 700; }
    .card-rows td.sits-out { font-style: italic; }
    .card-rows td.score { text-align: right; }
    .card-rows td.score .box { width: 0.55in; height: 70%; min-height: 0.26in; vertical-align: middle; }

    /* Up to 10 rounds; 11 rounds and up (20 to a page). */
    .size-l .card-rows td { font-size: 20pt; }
    .size-l .card-rows td.round-no { font-size: 22pt; }
    .size-l .card-rows td.table-no { font-size: 34pt; }
    .size-l .card-rows td.against { font-size: 18pt; }
    /* 20 rows share about 7.8in, so each row stays under 0.38in. */
    .size-m .card-rows td { font-size: 14pt; line-height: 1.1; padding: 0 4pt; }
    .size-m .card-rows td.round-no { font-size: 15pt; }
    .size-m .card-rows td.table-no { font-size: 20pt; }
    .size-m .card-rows td.score .box { height: 0.24in; min-height: 0; }

    .card-total { display: flex; justify-content: flex-end; align-items: center; gap: 12pt; font-size: 20pt; font-weight: 700; margin-top: 10pt; }
    .card-total .total-box { width: 1.3in; height: 0.55in; }

    /* ---------- Wall chart: a grid, 15 rounds and 6 tables to a page ---------- */
    .chart-title { font-size: 16pt; margin: 0 0 6pt; white-space: nowrap; }
    .chart-part { font-weight: 400; }
    .chart-page .chart-grid { width: 100%; border-collapse: collapse; table-layout: fixed; }
    .chart-grid th, .chart-grid td { border: 0.5pt solid #000; }
    .chart-grid th { font-size: 18pt; padding: 1pt; }
    .chart-grid th.r { font-size: 10pt; width: 0.55in; }
    .chart-grid th.s { font-size: 11pt; width: 1.1in; }
    .chart-grid td { font-size: 11pt; line-height: 1.15; padding: 1pt 4pt; white-space: nowrap; overflow: hidden; }
    .chart-grid td.r { font-size: 16pt; font-weight: 700; text-align: center; }
    .chart-grid .pair { overflow: hidden; }
    .chart-grid .second { border-top: 0.5pt solid #000; margin-top: 1pt; padding-top: 1pt; }
    .chart-grid td.sits { font-size: 9pt; line-height: 1.05; font-style: italic; }

    /* ---------- Run sheet ---------- */
    .run-title { font-size: 20pt; margin: 0 0 2pt; }
    .run-sub { font-size: 12pt; margin: 0 0 10pt; }
    .run-body { flex: 1; min-height: 0; display: flex; align-items: stretch; }
    .run-body table { border-collapse: collapse; font-size: 12pt; line-height: 1.1; }
    .run-body th { text-align: left; font-weight: 400; font-size: 11pt; border-bottom: 1pt solid #000; padding: 2pt 4pt; }
    .run-body td { padding: 0 4pt; border-bottom: 0.25pt solid #000; height: 0.24in; }
    .run-body .num { text-align: right; }
    .run-side-title { font-size: 13pt; font-weight: 700; margin: 0 0 4pt; }
    .run-right { flex: 1; min-width: 0; }
    /* The two sides are separate lists: a heavy rule and a wide gap between them,
       and shorter rows on the left so no round lines up with a player. */
    .two-col .run-left { width: 2.6in; padding-right: 0.25in; margin-right: 0.3in; border-right: 2pt solid #000; }
    .run-rounds { width: 100%; }
    .run-rounds td { height: 0.2in; font-size: 11pt; }
    .run-rounds td.num { text-align: left; width: 0.7in; }
    .run-players { width: 100%; table-layout: fixed; }
    .run-players th:nth-child(1) { width: 45%; }
    .run-players .line { width: 100%; height: 0.16in; vertical-align: bottom; }
    .notes { display: flex; flex-direction: column; gap: 12pt; font-size: 12pt; margin-top: 8pt; }
    .notes .line { width: 100%; height: 0; }
}
