# HTML reports that answer the question

`jifto_report_kit {"folder": "<report folder>"}` writes the style of jifto's PDF report: Lato, white
pages, thin rules, captions "Top View | **Equinox**", stepped legends and distribution bars. Write
`report.html` next to it.

## Structure follows the question

1. **The answer first.** One headline sentence with the decision and its size ("Option B gives the
   courtyard 2.3 more hours of sun at the equinox than A, and is the only one to meet the 2-hour
   guideline"). Then two to four key figures (`.figures`).
2. **The evidence.** The table the answer comes from (options by day, routes by criterion), then the
   captures that show why, each with a caption and its legend. Every coloured image has a legend.
3. **Method and limits.** What was computed, at what resolution, on which days or events, and what was
   left out. Short.

Leave out what the question does not need: a comparison of options has no "suggested
interventions"; a single study may not need a comparison table. Do not copy the PDF report's pages.

## Components

```html
<link rel="stylesheet" href="jifto-report.css">
<script src="jifto-report.js"></script>

<section class="page">
  <header class="page-head"><h1>Courtyard sunlight</h1><p class="lead">Three options on the equinox and both solstices.</p></header>
  <p class="answer">Option B ...</p>
  <div class="figures">
    <div class="figure"><span class="value">5.8 h</span><span class="label">Courtyard, equinox, option B</span></div>
  </div>
  <table class="compare">...</table>
  <div class="grid three">
    <figure class="capture"><img src="B-equinox.png"><figcaption>Top View | <b>Equinox</b></figcaption></figure>
  </div>
  <div class="legend" data-legend='{"title": "Sunlight hours", "stops": [...], "stepped": true}'></div>
  <div class="bar" data-stats='[{"label": "0 - 1", "share_pct": 12.5, "color": "#643c28"}]'></div>
  <footer><span>jifto</span><span>1</span></footer>
</section>
```

- `.legend` draws jifto's stepped legend from the `legend` object of `jifto_capture`, `jifto_results`
  or `jifto_terrain`: one cell per stop, labels on the thresholds, the title above.
- `.bar` draws a distribution bar from `statistics` rows (`share_pct` and `color`; total rows are
  skipped), with the percentages under it.
- `.compare` is a comparison table; mark the best value in each row with `class="best"`.
- Pages are A4 landscape; printing to PDF keeps one page per sheet.
- Copy the captures next to the report and use relative paths, so the folder travels whole.
- Label a distribution bar with what it measures and its base ("Wet ground on the site: 3 515 m²,
  99.6% of it 0 to 50 mm deep"). A bar with one band at 100% says nothing on its own.

## Check it before you hand it over

Print it with headless Chrome and look at every page:

```
chrome --headless=new --no-pdf-header-footer --print-to-pdf=report.pdf file:///.../report.html
```

- The PDF has one page per `<section class="page">`. An extra page means a section overflowed: make
  a capture smaller or move text to a page with room.
- Every number in the answer matches the table, to the same digits.
- Every coloured image has its legend on the same page.
- Every legend fits the question: its top near the largest value that matters (sunlight.MaxSunHours
  to the longest day, stormwater.MaxDepth to the deepest water that decides). A legend whose colours
  all sit in one band, or that saturates, tells the reader nothing.
