Replace fixed max-width with fluid width on `.branch-page`
Intent: Widen the branch review detail page from a hard 1480 px cap to a fluid layout that scales up to 1880 px, keeping a minimum 1 rem horizontal gutter so the content never touches the viewport edges on narrow screens.
Affected files: crates/pika-news/templates/detail.html
@@ -20,7 +20,11 @@
{% endblock %}
{% block styles %}
- .branch-page { max-width: 1480px; margin: 0 auto; padding: 2rem 1rem 3rem; }
+ .branch-page {
+ width: min(1880px, calc(100vw - 2rem));
+ margin: 0 auto;
+ padding: 2rem 1rem 3rem;
+ }
What changed
The .branch-page container in detail.html previously used a single-line declaration with max-width: 1480px. This has been replaced with a multi-line block that uses the CSS min() function:
.branch-page {
width: min(1880px, calc(100vw - 2rem));
margin: 0 auto;
padding: 2rem 1rem 3rem;
}
How it works
| Viewport width | Resolved width | Behaviour |
|---|---|---|
≥ 1912 px (1880 + 2×1rem) | 1880 px | Caps at the new maximum; centered via margin: 0 auto. |
| < 1912 px | 100vw - 2rem | Fills the viewport minus a 1 rem gutter on each side. |
Key differences from the old rule:
widthinstead ofmax-width— combined withmin(), the element always computes an explicit width rather than relying on block-level flow plus a ceiling. The practical rendering is the same, but the intent is more explicit.- 1480 px → 1880 px — an extra 400 px of horizontal room at large viewports, useful for side-by-side diff views and wide metadata panels.
calc(100vw - 2rem)as a floor — guarantees the container never overflows the viewport, replacing the implicit shrink behaviour ofmax-widthwith an explicit calculation.
Why it matters
Branch review pages frequently display diffs, file trees, and discussion panels. The wider cap reduces horizontal scrolling inside diff blocks on large monitors while the min() guard keeps the layout fully responsive on tablets and laptops.