/* OKR export: the paper delta. The report is `.a-okr-print.okr-export`, already dressed for
   paper by CSS/alt/alt-okrs.css §11; this file adds the page box, cover, scope list, digest,
   section rhythm and page breaks. Without it the report degrades to plainer output. Scoped
   under `.okr-export`; type keeps an 11pt floor. */

/* ---------- on screen ----------
   The report is staged with the `hidden` attribute and only given a box
   inside @media print. `[hidden]{display:none !important}` in CSS/base.css
   already does that; this is the belt to its braces. */
.okr-export{ display:none; }


/* The dialog on screen: it uses the shared OKR flow host, so only the bare scope `<dl>` needs
   dressing. Colours are `--a-*` tokens with classic fallbacks. */
.okr-export-what,
.okr-export-ai{
  display:flex; flex-direction:column; gap:var(--a-2, 8px); min-width:0;
}
.okr-export-what > p,
.okr-export-ai > p{ margin:0; }
.okr-export-ai{
  padding-top:var(--a-3, 12px);
  border-top:1px solid var(--a-line, var(--border, #d8dde5));
}
.okr-export-ai > .a-btn{ align-self:flex-start; }

/* The scope list, in the dialog only — the document's own copy is laid out for
   paper below. Label/value pairs across the width, so one fact is one glance. */
.okr-export-what .okr-export-scope{
  margin:0; display:grid; gap:4px 16px;
  grid-template-columns:repeat(auto-fit, minmax(180px, 1fr));
}
.okr-export-what .okr-export-scope-row{
  display:flex; gap:8px; align-items:baseline; min-width:0;
}
.okr-export-what .okr-export-scope dt{
  flex:0 0 auto; margin:0;
  font:700 var(--a-fs-11)/var(--a-lh-ui) var(--a-body, inherit); letter-spacing:.09em; text-transform:uppercase;
  color:var(--a-dim, var(--text-dim, #5b6472));
}
.okr-export-what .okr-export-scope dd{
  flex:1 1 auto; margin:0; min-width:0;
  font-size:var(--a-fs-ctl-sm); line-height:var(--a-lh-ui); overflow-wrap:anywhere;
  color:var(--a-text, var(--text, #10151d));
}

/* The digest preview — a read-only paragraph, regenerated never edited, since
   an edited narrative under its own provenance line would stop being true. */
.okr-export-ai .okr-export-digest-slot{
  display:flex; flex-direction:column; gap:6px; min-width:0;
  padding:var(--a-3, 12px);
  border:1px solid var(--a-line-soft, var(--border, #e3e7ee));
  border-radius:var(--a-r-sm);
  background:var(--a-panel, var(--panel, #fff));
}
.okr-export-ai .okr-export-digest-body{
  margin:0; font-size:var(--a-fs-ctl); line-height:var(--a-lh-body);
  color:var(--a-text, var(--text, #10151d));
}


@media print{

  /* Page box: the project's one @page rule. Without it a wide table's last column is clipped on
   print. 16mm is binder-safe on A4 and US Letter. */
  @page{ margin:16mm 14mm; }

  .okr-export{
    display:block;
    /* `.a-okr-print` sets the family and 11pt/1.4; the report only adds the
       reading width — the page itself needs no cap, but the cover's prose does. */
    max-width:none;
  }

  /* ---------- the cover ----------
     Not a cover page: the masthead sits at the top of page one with the
     digest under it, the first thing that should be read. */
  .okr-export .okr-export-cover{
    break-after:avoid; page-break-after:avoid;
    border-bottom:2px solid #000; padding-bottom:8pt; margin-bottom:12pt;
  }
  .okr-export .okr-export-cover h1{
    margin:2pt 0 4pt; font-size:22pt; line-height:var(--a-lh-tight); font-weight:700; color:#000;
  }
  .okr-export .okr-export-period{
    margin:0 0 8pt; font-size:12pt; line-height:var(--a-lh-ui); color:#000;
  }
  .okr-export .okr-export-when{
    margin:8pt 0 0; font-size:9pt; line-height:var(--a-lh-ui); color:#333; max-width:78ch;
  }

  /* The scope list — what the reader checks before trusting the numbers, label/
     value pairs across the width. `is-narrow` is the pair that REMOVED work
     from the report and has to be noticed, so it takes the rule beside it. */
  .okr-export .okr-export-scope{
    margin:0; display:grid; gap:3pt 16pt;
    grid-template-columns:repeat(auto-fit, minmax(180pt, 1fr));
  }
  .okr-export .okr-export-scope-row{
    display:flex; gap:6pt; align-items:baseline; min-width:0;
    break-inside:avoid; page-break-inside:avoid;
  }
  .okr-export .okr-export-scope-row.is-narrow{
    border-left:2pt solid #000; padding-left:5pt;
  }
  .okr-export .okr-export-scope dt{
    flex:0 0 auto; margin:0;
    font-size:9pt; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:#333;
  }
  .okr-export .okr-export-scope dd{
    flex:1 1 auto; margin:0; min-width:0;
    font-size:10pt; line-height:var(--a-lh-ui); color:#000; overflow-wrap:anywhere;
  }

  /* ---------- the digest ----------
     The first thing read, so it is set largest. The provenance line must
     never be mistaken for part of the narrative — hence the rule and caption face. */
  .okr-export .okr-export-digest{
    padding:10pt 12pt; margin:0 0 14pt;
    break-inside:avoid; page-break-inside:avoid;
  }
  .okr-export .okr-export-digest-body{
    margin:6pt 0 0; font-size:12pt; line-height:var(--a-lh-body); color:#000; max-width:78ch;
  }
  .okr-export .okr-export-prov{
    margin:8pt 0 0; padding-top:6pt; border-top:1px solid #999;
    /* `.a-okr-lbl`'s caption face is right over a figure, shouty over prose — this is a sentence. */
    text-transform:none; letter-spacing:0; font-weight:400; white-space:normal;
    font-size:9pt; line-height:var(--a-lh-ui); color:#333;
  }

  /* ---------- section rhythm ----------
     A heading that ends a page is a heading for nothing, at every level. */
  .okr-export .okr-export-sec{ margin:0 0 14pt; }
  .okr-export .a-okr-group-h{ break-after:avoid; page-break-after:avoid; }
  .okr-export h2{
    margin:0 0 6pt; font-size:14pt; line-height:var(--a-lh-tight); font-weight:700; color:#000;
    border-bottom:1px solid #000; padding-bottom:3pt;
  }
  .okr-export h3{ margin:0 0 4pt; font-size:12pt; line-height:var(--a-lh-tight); font-weight:700; color:#000; }
  .okr-export h4{ margin:0; font-size:11pt; line-height:var(--a-lh-ui); font-weight:700; color:#000; }
  .okr-export .a-okr-lbl{ font-size:9pt; }

  /* ---------- at a glance ----------
     The headline figures, an ordinary `.a-okr-table` made big enough to read
     as the summary they are. */
  .okr-export .okr-export-fig{
    font-size:16pt; font-weight:700; line-height:var(--a-lh-tight); color:#000; text-align:right;
    white-space:nowrap;
  }
  .okr-export .okr-export-glance .a-okr-th{ font-size:8.5pt; }

  /* ---------- tables ----------
     The header row repeats on every page — without it, page two is unlabelled
     columns. And the table never scrolls: a scroll container prints as its
     visible slice, so the last columns would simply not exist. */
  .okr-export table.a-okr-table{ width:100%; min-width:0; table-layout:auto; margin:4pt 0 0; }
  .okr-export table.a-okr-table thead{ display:table-header-group; }
  .okr-export table.a-okr-table tfoot{ display:table-footer-group; }
  .okr-export .a-okr-th{ font-size:8.5pt; padding:4pt 6pt; border-bottom:1px solid #000; }
  .okr-export .a-okr-td{ font-size:9.5pt; padding:4pt 6pt; vertical-align:top; }
  .okr-export .a-okr-th.num, .okr-export .a-okr-td.a-okr-num{ text-align:right; }
  /* A measure title is the widest thing in the row and the only one that should wrap. */
  .okr-export .a-okr-td{ overflow-wrap:anywhere; }
  .okr-export .a-okr-num{ white-space:nowrap; }

  /* An area starts a page, a quarter does not (per-quarter pages would be near-empty). The
   first area does not break, or the cover and digest would sit alone on page one. */
  .okr-export .okr-export-area{ break-before:page; page-break-before:always; }
  .okr-export .okr-export-area:first-of-type{ break-before:auto; page-break-before:auto; }
  .okr-export .okr-export-areah{
    border-bottom:1px solid #000; padding-bottom:4pt; margin:0 0 8pt;
  }
  .okr-export .okr-export-q{ margin:0 0 10pt; }
  .okr-export .okr-export-qh{ margin:0 0 5pt; }
  .okr-export .okr-export-qh .a-okr-lbl{
    font-size:9pt; letter-spacing:.09em; color:#333;
  }

  /* An objective may break, overriding alt-okrs.css's `break-inside:avoid`: an objective with
   many measures is taller than a page. Heading and first rows are held with `break-after:avoid`
   and the repeating header. Scoped to `.okr-export`. */
  .okr-export .a-okr-group.okr-export-obj{
    break-inside:auto; page-break-inside:auto;
    margin:0 0 10pt; padding:0 0 8pt; border-bottom:1px solid #ccc;
  }
  .okr-export .okr-export-obj:last-child{ border-bottom:0; }
  .okr-export .okr-export-obj .a-okr-group-h{ margin:0 0 4pt; }

  /* The objective's headline facts, one line that wraps rather than clips —
     clipping would drop the period, the fact the health beside it was measured against. */
  .okr-export .okr-export-objmeta{
    display:flex; align-items:center; flex-wrap:wrap; gap:4pt 10pt;
    margin:3pt 0 0; font-size:9.5pt; line-height:var(--a-lh-ui); color:#000;
  }
  .okr-export .okr-export-meta{ color:#333; }
  /* A magnitude worth keeping where the printer has colour, the percentage
     beside it for where it does not. Fixed width so a row compares down the page. */
  .okr-export .okr-export-bar{
    width:90pt; height:5pt; flex:0 0 auto; border-radius:2.5pt;
  }

  /* Push indicator chip: `.a-chip` is not reset by alt-okrs.css's print block, so it would print
   grey on white. #333 on #fff with a #666 border matches CSS/okr-report-print.css. */
  .okr-export .a-chip{
    display:inline-flex; align-items:center; height:auto; padding:1pt 5pt;
    border-radius:8pt; font:600 8pt/1.35 var(--a-body, sans-serif); white-space:normal;
    background:#fff; color:#333; border:0.5pt solid #666;
    max-width:100%; overflow-wrap:anywhere;
  }
  /* Separated from the date it is about — `<td>` is not a flex container, so
     the gap must come from the chip itself. */
  .okr-export .okr-export-push{ margin-left:4pt; }
  .okr-export .okr-export-desc{
    margin:0 0 4pt; font-size:10pt; line-height:var(--a-lh-ui); color:#333; max-width:78ch;
  }

  /* ---------- the footer ---------- */
  .okr-export .okr-export-foot{
    margin:14pt 0 0; padding-top:6pt; border-top:1px solid #999;
    break-inside:avoid; page-break-inside:avoid;
  }
  .okr-export .okr-export-foot .a-okr-lbl{
    text-transform:none; letter-spacing:0; font-weight:400; white-space:normal;
    font-size:9pt; line-height:var(--a-lh-ui); color:#333; max-width:78ch;
  }
}
