Fluid scaling to 1920px and height-aware variables; speed and responsive guidelines

- fluid-wide.css: the fluid.css variables stretched over 360→1920px (export
  @intecion/ipal-kit/fluid-wide.css); fluid.css values unchanged.
- New variables in both (unused until a project opts in): --ipal-measure,
  --ipal-container(-wide), --ipal-hero-min-h (svh), --ipal-fs-display-fit,
  --ipal-fs-h1-fit, --ipal-space-section-fit — keep the hero CTA above the fold
  on 1366×768. Verified in Chromium at 360…1920 widths.
- AGENT.md §6.11a (scaling, viewport test list incl. 13–15" laptops and 125/150 %
  zoom) and §6.11b (Core Web Vitals table: LCP image, sizes, placeholders, video
  modes, YouTube facade, images preset, fonts).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-16 03:21:38 +02:00
co-authored by Claude Opus 5.5
parent 55fc27a13f
commit 69309b09e3
5 changed files with 114 additions and 2 deletions
+37
View File
@@ -690,6 +690,43 @@ bloku nie importował Reacta). Kod: [kod-sekcji.md](./skills/ipal-block/resource
- Warianty → `Record<Variant, string>`, nie łańcuchy ternary.
Przykładowy `styles.css`: [kod-sekcji.md](./skills/ipal-block/resources/kod-sekcji.md).
### 6.11a Skalowanie (fluid / responsive) — od 360 px do 1920 px
- **Skala z pluginu:** `fluid.css` (rośnie do 1280 px) albo `fluid-wide.css` (rośnie do 1920 px —
wybierz, gdy projekt ma wyglądać inaczej na 13″ laptopie i 27″ monitorze). Zero `clamp()` w
komponentach; liczby z `DESIGN.md` → nadpisz `--ipal-*` w `:root`.
- **Wysokość ekranu:** zamiast `h-screen` / `100vh` → `min-h-[var(--ipal-hero-min-h)]` (svh, z
limitem). Nagłówek hero `--ipal-fs-display-fit`, odstępy hero `--ipal-space-section-fit` — na
1366×768 CTA hero musi być widoczne bez przewijania.
- **Szerokości:** kontener `max-w-[var(--ipal-container)]` + `px-gutter`; tekst ciągły
`max-w-[var(--ipal-measure)]` (~68 znaków w linii). Żadnych stałych `w-[640px]`, `h-[500px]`
w sekcjach — `min()`, `%`, `aspect-*`, `max-w-*`.
- **Siatki:** `grid-cols-[repeat(auto-fit,minmax(min(100%,18rem),1fr))]` albo breakpointy;
karta reaguje na swoją kolumnę: container queries (`@container` + `@md:`), nie tylko na ekran.
- **Obrazy kadrowane** (`object-cover`) mają punkt ostrości z panelu (`focalPoint: true` w
Media → `object-position` z `mediaImageProps`).
- **Ekrany testowe** (każda strona, przeglądarka / Playwright): 360×740, 390×844, 768×1024,
1024×768, **1280×800, 1366×768, 1440×900** (laptopy 13–15″), 1536×864, 1920×1080, plus
zoom 125 % i 150 % na 1366 (częsty na Windows). Zero poziomego scrolla, tekst bez ucięć,
menu działa, CTA hero widoczne.
### 6.11b Szybkość (Core Web Vitals)
| Co | Jak | Zakaz |
|---|---|---|
| obraz LCP (pierwszy widoczny, zwykle hero) | `<Media priority>` — dokładnie jeden na stronę | `priority` na wielu obrazach, hero jako CSS `background-image` |
| każdy inny obraz | `<Media sizes={MEDIA_SIZES.third}>` — `sizes` = szerokość na ekranie | brak `sizes` (pobiera pełną szerokość), `<img>` |
| placeholder | `buildMediaPlaceholderHook` + pole w Media (blur + kolor) | puste pudełka „wskakujące” przy ładowaniu |
| wideo w tle | `videoMode="background"`, MP4 H.264 ≤ 20 MB, bez dźwięku, z plakatem | wideo jako hero bez plakatu, `autoplay` z dźwiękiem |
| wideo z treścią | `videoMode="player"` (ładuje się po kliknięciu) | `preload="auto"` |
| YouTube | `<YouTubeEmbed>` z `/client` (iframe dopiero po kliknięciu) | gołe `<iframe src="youtube.com/embed…">` |
| next.config | `images: { ...buildImagesConfig() }` (AVIF/WebP, R2) | brak `remotePatterns` → obrazy z R2 bez optymalizacji |
| fonty | `next/font`, maks. 2 rodziny × 2–3 grubości, `subsets: ['latin', 'latin-ext']` (PL), `display: 'swap'` | `<link>` do Google Fonts, 6 grubości „na zapas” |
| skrypty firm trzecich | `Analytics`/`ConsentScript` z pluginu (po zgodzie, `defer`) | widgety czatu/map ładowane na starcie |
| komponenty klienckie | małe, tylko interakcja (§6.9) | cała sekcja `'use client'` |
Cel na zbudowanej stronie (mobile, Lighthouse/PageSpeed): LCP < 2,5 s, CLS < 0,1, INP < 200 ms.
Kontrole: `ipal-audit` (img/video poza Media, wiele `priority`, `h-screen`, stałe szerokości,
`<iframe>` YouTube) i `ipal-seo-check` (obrazy bez wymiarów, obraz LCP bez priorytetu).
### 6.12 Eksporty i importy
- **Eksporty nazwane** (`export function Hero`). `export default` tylko tam,
+4 -1
View File
@@ -177,7 +177,10 @@ export default { plugins: { '@tailwindcss/postcss': {} } }
}
```
`fluid.css` to same zmienne `clamp()` (360 → 1280 px, w `rem`) — klasy `text-h1`,
`py-section`, `px-gutter`. Liczby z `DESIGN.md` nadpisujesz w `:root` projektu
`py-section`, `px-gutter`. `fluid-wide.css` — te same zmienne, skala do 1920 px (13″ ≠ 27″);
importujesz jeden z dwóch. Oba mają też zmienne wysokości i szerokości: `--ipal-hero-min-h`,
`--ipal-fs-display-fit`, `--ipal-space-section-fit`, `--ipal-measure`, `--ipal-container`
(AGENT.md §6.11a). Liczby z `DESIGN.md` nadpisujesz w `:root` projektu
(`--ipal-fs-h1: clamp(…)`); formuł nie piszesz od zera.
Bez `@source` komponenty pluginu (baner cookies, Turnstile) są bez stylów.
Kolory komponentów pluginu: `--ipal-primary`, `--ipal-radius` (consent.md).
+2 -1
View File
@@ -44,7 +44,8 @@
"types": "./dist/exports/env.d.ts",
"default": "./dist/exports/env.js"
},
"./fluid.css": "./dist/styles/fluid.css"
"./fluid.css": "./dist/styles/fluid.css",
"./fluid-wide.css": "./dist/styles/fluid-wide.css"
},
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
+47
View File
@@ -0,0 +1,47 @@
/*
* @intecion/ipal-kit/fluid-wide.css — the fluid.css scale stretched over 360 → 1920px.
* Same variable names: import ONE of the two. With fluid.css everything stops
* growing at 1280px, so a 13" laptop and a 27" monitor look the same; here type
* and spacing keep scaling up to 1920px (at 1280px they're a little smaller than
* in fluid.css — check the design at 1280, 1440 and 1920).
*
* @import "tailwindcss";
* @import "@intecion/ipal-kit/fluid-wide.css";
* @theme inline { --text-h1: var(--ipal-fs-h1); --spacing-section: var(--ipal-space-section); … }
*
* rem-based (browser zoom and user font size still work, WCAG 1.4.4). Override
* any variable in the project's :root.
*/
:root {
--ipal-fs-sm: clamp(0.875rem, 0.8606rem + 0.0641vw, 0.9375rem); /* 0.875→0.9375rem · small print, captions */
--ipal-fs-base: clamp(1rem, 0.9712rem + 0.1282vw, 1.125rem); /* 1→1.125rem · body text */
--ipal-fs-lg: clamp(1.125rem, 1.0673rem + 0.2564vw, 1.375rem); /* 1.125→1.375rem · lead / intro */
--ipal-fs-h3: clamp(1.25rem, 1.1346rem + 0.5128vw, 1.75rem); /* 1.25→1.75rem · h3 */
--ipal-fs-h2: clamp(1.5rem, 1.2692rem + 1.0256vw, 2.5rem); /* 1.5→2.5rem · h2 — section headings */
--ipal-fs-h1: clamp(2rem, 1.6538rem + 1.5385vw, 3.5rem); /* 2→3.5rem · h1 — page heading */
--ipal-fs-display: clamp(2.5rem, 2.0385rem + 2.0513vw, 4.5rem); /* 2.5→4.5rem · hero / display */
--ipal-space-gap: clamp(1rem, 0.7692rem + 1.0256vw, 2rem); /* 1→2rem · gap between items in a section */
--ipal-space-gutter: clamp(1rem, 0.6538rem + 1.5385vw, 2.5rem); /* 1→2.5rem · container side padding */
--ipal-space-section: clamp(3rem, 1.9615rem + 4.6154vw, 7.5rem); /* 3→7.5rem · vertical padding of a section */
}
/*
* Layout & height-aware helpers (added in 1.10 — nothing uses them until the
* project does, so existing sites look exactly the same):
* max-w-[var(--ipal-measure)] comfortable line length for running text
* --ipal-container / -wide content widths for the section container
* min-h-[var(--ipal-hero-min-h)] hero that fills a laptop screen, not a 4K one
* text-[length:var(--ipal-fs-display-fit)], py-[var(--ipal-space-section-fit)]
* shrink on SHORT screens (1366×768, 1280×720,
* landscape phones) so the hero CTA stays above the fold
* svh = the small viewport height (mobile browser bars shown) — never 100vh.
*/
:root {
--ipal-measure: 68ch;
--ipal-container: 80rem;
--ipal-container-wide: 96rem;
--ipal-hero-min-h: min(100svh, 56rem);
--ipal-fs-display-fit: min(var(--ipal-fs-display), 7svh + 0.75rem);
--ipal-fs-h1-fit: min(var(--ipal-fs-h1), 6svh + 0.5rem);
--ipal-space-section-fit: min(var(--ipal-space-section), 10svh);
}
+24
View File
@@ -19,6 +19,9 @@
*
* The design (DESIGN.md) decides the numbers: override any variable in the project's
* :root — the plugin only removes the clamp() maths from every project.
*
* Wider screens should keep growing (13" laptop → 27" monitor)? Import
* @intecion/ipal-kit/fluid-wide.css instead: same variables, scaled 360 → 1920px.
*/
:root {
--ipal-fs-sm: clamp(0.875rem, 0.8505rem + 0.1087vw, 0.9375rem); /* 0.875→0.9375rem · small print, captions */
@@ -32,3 +35,24 @@
--ipal-space-gutter: clamp(1rem, 0.413rem + 2.6087vw, 2.5rem); /* 1→2.5rem · container side padding */
--ipal-space-section: clamp(3rem, 1.2391rem + 7.8261vw, 7.5rem); /* 3→7.5rem · vertical padding of a section */
}
/*
* Layout & height-aware helpers (added in 1.10 — nothing uses them until the
* project does, so existing sites look exactly the same):
* max-w-[var(--ipal-measure)] comfortable line length for running text
* --ipal-container / -wide content widths for the section container
* min-h-[var(--ipal-hero-min-h)] hero that fills a laptop screen, not a 4K one
* text-[length:var(--ipal-fs-display-fit)], py-[var(--ipal-space-section-fit)]
* shrink on SHORT screens (1366×768, 1280×720,
* landscape phones) so the hero CTA stays above the fold
* svh = the small viewport height (mobile browser bars shown) — never 100vh.
*/
:root {
--ipal-measure: 68ch;
--ipal-container: 80rem;
--ipal-container-wide: 96rem;
--ipal-hero-min-h: min(100svh, 56rem);
--ipal-fs-display-fit: min(var(--ipal-fs-display), 7svh + 0.75rem);
--ipal-fs-h1-fit: min(var(--ipal-fs-h1), 6svh + 0.5rem);
--ipal-space-section-fit: min(var(--ipal-space-section), 10svh);
}