loopable / web /src /customer-grid /catalog.css
fsanyoto's picture
Deploy AIOS web (React glide grid + FastAPI slice)
affe37f verified
Raw History Blame Contribute Delete
15.1 kB
/* customer-grid/catalog.css β€” W37-T32/T33, the catalog designer's new gestures.
*
* β›” WHY THIS FILE AND NOT index.css: contract C8. `index.css` is 12k+ lines and belongs to lane A
* this wave, so every other lane adds styles in its own per-surface stylesheet imported by its own
* component. `navExtras.css` and this wave's `map.css` are the precedent.
*
* ⚠ NOTHING PRINT-RELATED MAY LAND HERE WITHOUT ITS SCAN COMING WITH IT. `catalog.test.ts` reads
* `src/index.css` BY NAME for the print-isolation rules (`html.cg-cat-printing body > *`,
* `print-color-adjust: exact`, the tokens declared inside `.cg-cat-page`). A print rule moved into
* this file would be invisible to that check, which is a gate quietly getting smaller. Everything
* below starts with screen-only gestures. The C1 sheet rules also style the print portal;
* verify_catalog.py --s76-t09-browser checks their PDF content, order, images and isolation.
*/
/* --- dragging a page to reorder it (T32 / R6) -----------------------------
*
* β›” PAGES REORDER, THEY DO NOT FREE-FLOAT. A printed document is a sequence, so a page has a
* position IN that sequence; only the images inside a section carry free coordinates (T33). The
* affordance therefore has to read as "this row moves between other rows", never as "this thing
* floats", which is why the drop target is a LINE and not a box.
*/
.cg-cat-pagerow {
/* The grab affordance sits on the row, not on the button inside it: a draggable <button> starts
a drag in some browsers, fires a click in others, and does neither reliably in Firefox. */
cursor: grab;
position: relative;
border-radius: 5px;
}
.cg-cat-pagerow:active {
cursor: grabbing;
}
.cg-cat-pagerow.is-dragging {
/* Faded, NOT hidden. A row that vanishes while you hold it makes the list jump under the cursor
and you lose the place you were aiming at. */
opacity: 0.42;
}
.cg-cat-pagerow.is-dropzone::before {
/* The insertion LINE. A highlighted box would say "drop it into this page"; a line above the row
says "it lands here, before this one", which is what actually happens. */
content: "";
position: absolute;
left: 2px;
right: 2px;
top: -2px;
height: 2px;
border-radius: 2px;
background: #1f4e78;
}
/* --- free-placed items inside a section (T33 / R6) ------------------------
*
* β›”β›” A COORDINATE-FREE ITEM IS NOT AN ITEM AT THE ORIGIN. Everything authored before this wave
* has no `x`/`y`, and the renderer reads that absence as "flow position N" so an existing catalog
* keeps printing exactly as it did. These rules only ever apply to an item that HAS coordinates;
* the flow layout is untouched and stays the default.
*/
/* β›”β›” DELIBERATELY *NOT* `position: relative`, AND THIS IS THE LOAD-BEARING LINE.
*
* It was relative, which made the GRID the containing block for every placed item. The grid's
* height comes from its in-flow content, and placing an item REMOVES it from that flow: place them
* all and the grid collapses to nothing, so `top: 96%` becomes 96% of zero and every placed image
* piles at the top. A feedback loop between the layout and the coordinates it is measured in.
*
* With the grid static, an absolutely-positioned item resolves against `.cg-cat-page`, which is
* `position: relative` with an EXPLICIT `height: var(--cat-h)` and `overflow: hidden`. That box is
* the sheet of paper: fixed, independent of how much flows inside it, and identical in the designer
* and in the print tree. A percentage of it means the same thing forever.
* ⚠ The class stays because it MARKS the state for the gate and for the eye. It must not acquire a
* `position` later; that is the bug above, coming back.
*/
.cg-cat-slot-free {
position: static;
}
.cg-cat-item-free {
position: absolute;
cursor: grab;
}
.cg-cat-item-free:active {
cursor: grabbing;
}
.cg-cat-item-free.is-dragging {
opacity: 0.55;
outline: 1px dashed #1f4e78;
}
/* refs: company/reference/Mobbin catalog editor 1.webp, Mobbin catalog editor 2.webp, Mobbin catalog product page 1.webp. */
/* C1 pages are self-contained because the print portal lives under body. */
.cg-catalog-editor { display: flex; flex-direction: column; min-width: 0; color: var(--lp-ink); }
.cg-catalog-editor .cg-catalog-record-head { flex-wrap: wrap; gap: 8px; }
.cg-catalog-editor .cg-catalog-record-head h2 { flex: 1; }
.cg-catalog-workspace { display: grid; grid-template-columns: minmax(0, 1fr); height: clamp(480px, 62vh, 760px); min-height: 0; }
.cg-catalog-workspace.has-templates { grid-template-columns: 280px minmax(0, 1fr); }
.cg-catalog-template-panel { min-width: 0; overflow: auto; padding: 16px; background: var(--lp-surface); border-right: 1px solid var(--lp-line); animation: catalog-panel-enter var(--lp-motion-feedback-duration) var(--lp-motion-feedback-easing); }
.cg-catalog-panel-head { display: flex; flex-direction: column; gap: 4px; margin-bottom: 16px; }
.cg-catalog-panel-head h3 { margin: 0; font-size: var(--lp-fs-sm); font-weight: 600; }
.cg-catalog-panel-head > span { color: var(--lp-muted); font-size: var(--lp-fs-2xs); }
.cg-catalog-template-panel p { font-size: var(--lp-fs-xs); }
.cg-catalog-template-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.cg-catalog-template-card, .cg-catalog-page-thumb { appearance: none; display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 8px; border: 1px solid var(--lp-line); border-radius: var(--lp-r-sm); background: var(--lp-surface); color: var(--lp-ink); font: inherit; font-size: var(--lp-fs-2xs); text-align: left; cursor: pointer; transition: transform var(--lp-motion-feedback-duration) var(--lp-motion-feedback-easing), opacity var(--lp-motion-feedback-duration) var(--lp-motion-feedback-easing); }
.cg-catalog-template-card[aria-pressed="true"], .cg-catalog-page-thumb[aria-current="page"] { outline: 2px solid var(--lp-blue-deep); outline-offset: -2px; background: var(--lp-blue-tint); }
.cg-catalog-template-card:disabled { cursor: not-allowed; opacity: var(--lp-home-disabled-opacity); }
.cg-catalog-template-card:focus-visible, .cg-catalog-page-thumb:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 2px; }
.cg-catalog-mini { display: block; position: relative; width: 106.08px; height: 137.28px; overflow: hidden; pointer-events: none; flex: none; }
.cg-catalog-mini > .cg-catalog-sheet { position: absolute; top: 0; left: 0; transform: scale(0.13); transform-origin: top left; }
.cg-catalog-template-card .cg-catalog-mini { width: 97.92px; height: 126.72px; }
.cg-catalog-template-card .cg-catalog-mini > .cg-catalog-sheet { transform: scale(0.12); }
.cg-catalog-page-fields { display: grid; gap: 12px; margin-top: var(--lp-section-gap); }
.cg-catalog-page-fields label { display: grid; gap: 4px; font-size: var(--lp-fs-2xs); }
.cg-catalog-page-fields input, .cg-catalog-page-fields textarea, .cg-catalog-page-fields select { width: 100%; min-width: 0; box-sizing: border-box; padding: 8px; border: 1px solid var(--lp-line); border-radius: var(--lp-r-sm); font-family: inherit; font-size: var(--lp-fs-xs); color: var(--lp-ink); background: var(--lp-surface); }
.cg-catalog-page-fields textarea { min-height: 80px; resize: vertical; }
.cg-catalog-page-fields select { min-height: 80px; }
.cg-catalog-page-fields :is(input, textarea, select):focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 2px; }
.cg-catalog-canvas { display: flex; align-items: center; justify-content: center; min-width: 0; min-height: 0; overflow: auto; background: var(--lp-canvas); padding: 24px; }
.cg-catalog-canvas-sheet { flex: none; border: 1px solid var(--lp-line); }
.cg-catalog-canvas-scale { transform-origin: top left; width: 816px; height: 1056px; }
.cg-catalog-strip { display: flex; gap: 8px; padding: 16px; border-top: 1px solid var(--lp-line); background: var(--lp-surface); min-width: 0; }
.cg-catalog-page-strip { display: flex; align-items: center; gap: 12px; overflow-x: auto; flex: 1; padding: 4px; }
.cg-catalog-page-thumb { flex: none; width: 124px; }
.cg-catalog-page-thumb > span:last-child { width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cg-catalog-add-wrap { display: flex; flex-direction: column; gap: 8px; flex: none; }
.cg-catalog-add { min-height: 56px; }
.cg-catalog-add-menu { display: grid; grid-template-columns: repeat(2, max-content); gap: 4px; }
.cg-catalog-page-actions { display: flex; flex-direction: column; justify-content: center; gap: 4px; }
.cg-catalog-page-actions button:disabled { opacity: var(--lp-home-disabled-opacity); cursor: not-allowed; }
.cg-catalog-sheet { box-sizing: border-box; display: flex; flex-direction: column; gap: 24px; width: 816px; height: 1056px; padding: 48px; border: 0; box-shadow: none; background: var(--lp-surface); color: var(--lp-ink); text-align: var(--catalog-align, left); font-family: inherit; font-size: var(--lp-fs-md); line-height: 1.5; }
.cg-catalog-sheet h3 { margin: 0; font-family: inherit; font-size: var(--lp-fs-xl); font-weight: 500; line-height: 1.2; text-transform: none; letter-spacing: normal; }
.cg-catalog-sheet p { margin: 12px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: var(--lp-fs-sm); }
.cg-catalog-page-copy { flex: none; }
.cg-catalog-products { display: grid; grid-template-columns: repeat(var(--catalog-columns, 2), minmax(0, 1fr)); gap: 24px; min-height: 0; }
.cg-catalog-product { display: flex; flex-direction: column; min-width: 0; gap: 4px; font-size: var(--lp-fs-xs); text-align: left; }
.cg-catalog-product-open { appearance: none; display: flex; flex-direction: column; gap: 4px; width: 100%; padding: 0; border: 0; color: inherit; background: transparent; font: inherit; text-align: inherit; cursor: pointer; }
.cg-catalog-product-open:focus-visible { outline: 2px solid var(--lp-blue-deep); outline-offset: 4px; }
.cg-catalog-product-image { display: flex; align-items: center; justify-content: center; width: 100%; aspect-ratio: 4 / 5; min-height: 0; overflow: hidden; background: var(--lp-surface-2); color: var(--lp-muted); font-size: var(--lp-fs-xs); }
.cg-catalog-product-image img { display: block; width: 100%; height: 100%; object-fit: var(--catalog-image-fit, contain); }
.cg-catalog-product-price { font-variant-numeric: tabular-nums; }
.cg-catalog-kind-grid .cg-catalog-products,
.cg-catalog-kind-section .cg-catalog-products { flex: 1; grid-auto-rows: minmax(0, 1fr); }
.cg-catalog-kind-grid .cg-catalog-product,
.cg-catalog-kind-section .cg-catalog-product { min-height: 0; }
.cg-catalog-kind-grid .cg-catalog-product-open,
.cg-catalog-kind-section .cg-catalog-product-open { flex: 1; min-height: 0; }
.cg-catalog-kind-grid .cg-catalog-product-image,
.cg-catalog-kind-section .cg-catalog-product-image { flex: 1; height: auto; aspect-ratio: auto; }
.cg-catalog-kind-product .cg-catalog-products { grid-template-columns: repeat(var(--catalog-columns, 1), minmax(0, 1fr)); flex: 1; }
.cg-catalog-kind-product .cg-catalog-product-image { height: 720px; aspect-ratio: auto; }
.cg-catalog-kind-product .cg-catalog-product:only-child { max-width: 100%; }
.cg-catalog-kind-product .cg-catalog-product > span, .cg-catalog-kind-product .cg-catalog-product-open > span:last-child { font-size: var(--lp-fs-xs); }
.cg-catalog-hero { min-height: 0; flex: 1; }
.cg-catalog-hero .cg-catalog-product-image { height: 100%; aspect-ratio: auto; }
.cg-catalog-kind-cover .cg-catalog-page-copy, .cg-catalog-kind-closing .cg-catalog-page-copy { padding: 24px 0; }
.cg-catalog-kind-closing { justify-content: center; }
.cg-catalog-kind-section .cg-catalog-page-copy { padding-bottom: 24px; border-bottom: 1px solid var(--lp-line); }
.cg-catalog-kind-toc .cg-catalog-products { margin-top: auto; max-height: 240px; overflow: hidden; }
.cg-catalog-kind-toc .cg-catalog-product-image { height: 160px; }
.cg-catalog-contents { display: flex; flex-direction: column; gap: 24px; list-style: none; padding: 0; margin: 24px 0; }
.cg-catalog-contents li { display: flex; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--lp-line); padding-bottom: 12px; font-size: var(--lp-fs-sm); }
.cg-catalog-contents li span:last-child { font-variant-numeric: tabular-nums; }
.cg-catalog-folio { position: absolute; bottom: 20px; right: 48px; color: var(--lp-muted); font-size: var(--lp-fs-2xs); font-variant-numeric: tabular-nums; }
.cg-catalog-variant-1 { padding: 64px; }
.cg-catalog-variant-1 .cg-catalog-page-copy { text-align: center; }
.cg-catalog-variant-1 .cg-catalog-hero { order: 1; }
.cg-catalog-variant-1 .cg-catalog-products { column-gap: 40px; }
.cg-catalog-variant-1 .cg-catalog-product-image { background: var(--lp-blue-tint); }
.cg-catalog-kind-product.cg-catalog-variant-1 .cg-catalog-product-image { height: 664px; }
.cg-catalog-variant-2 { padding: 32px; background: var(--lp-surface-2); }
.cg-catalog-variant-2 .cg-catalog-page-copy { border-bottom: 1px solid var(--lp-line); padding-bottom: 24px; }
.cg-catalog-variant-2 .cg-catalog-product-image { background: var(--lp-surface); }
.cg-catalog-kind-product.cg-catalog-variant-2 .cg-catalog-product-image { height: 748px; }
.cg-catalog-variant-3 { padding: 56px; }
.cg-catalog-variant-3 .cg-catalog-page-copy { padding: 24px; background: var(--lp-surface-2); }
.cg-catalog-variant-3 .cg-catalog-hero { order: 1; }
.cg-catalog-kind-product.cg-catalog-variant-3 .cg-catalog-product-image { height: 600px; }
.cg-catalog-variant-4 { padding: 40px; }
.cg-catalog-variant-4 .cg-catalog-page-copy { padding: 24px 0; border-top: 1px solid var(--lp-line); border-bottom: 1px solid var(--lp-line); text-align: center; }
.cg-catalog-kind-product.cg-catalog-variant-4 .cg-catalog-product-image { height: 632px; }
.cg-catalog-template-warning { margin: 0 0 8px; font-size: var(--lp-fs-xs); color: var(--lp-muted); }
@keyframes catalog-panel-enter { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: translateX(0); } }
@media (hover: hover) and (pointer: fine) {
.cg-catalog-template-card:not(:disabled):hover, .cg-catalog-page-thumb:hover { transform: translateY(-2px); }
.cg-catalog-template-card:not(:disabled):active, .cg-catalog-page-thumb:active { transform: scale(0.98); }
}
@media (max-width: 700px) {
.cg-catalog-template-list { grid-template-columns: minmax(0, 1fr); }
.cg-catalog-workspace.has-templates { grid-template-columns: 164px minmax(0, 1fr); }
.cg-catalog-template-panel { padding: 8px; }
.cg-catalog-template-card .cg-catalog-mini { width: 106.08px; height: 137.28px; }
.cg-catalog-template-card .cg-catalog-mini > .cg-catalog-sheet { transform: scale(0.13); }
.cg-catalog-canvas { padding: 12px; }
}
@media (prefers-reduced-motion: reduce) {
.cg-catalog-template-panel { animation: none; }
.cg-catalog-template-card, .cg-catalog-page-thumb { transition: none; }
.cg-catalog-template-card:not(:disabled):hover, .cg-catalog-page-thumb:hover,
.cg-catalog-template-card:not(:disabled):active, .cg-catalog-page-thumb:active { transform: none; }
}