add CSS migration foundation and screenshot tooling (Phase 0)

- CSS file structure with @layer declaration (reset, layout, components, utilities, overrides)
- Layout primitives: .stack, .cluster, .row, .auto-grid, .container-page, .with-sidebar, .center
- mix screenshots task using Playwright for visual regression testing
- Golden baseline captured (10 pages x 4 breakpoints = 40 screenshots)
- No visual changes — new CSS not wired into any layout yet

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
jamey
2026-02-16 23:37:29 +00:00
parent 1a61f4bb62
commit 5fa93f4e75
8 changed files with 559 additions and 0 deletions

17
assets/css/shop.css Normal file
View File

@@ -0,0 +1,17 @@
/* Shop CSS — hand-written, zero-framework stylesheet.
Layered cascade: later layers beat earlier ones, no !important needed.
This file runs alongside app-shop.css during migration (Phases 1-4).
After Phase 5 it replaces app-shop.css entirely. */
@layer reset, primitives, tokens, components, layout, utilities, overrides;
@import "./shop/reset.css";
/* Theme primitives and tokens stay in their existing files.
They'll be wrapped in @layer during Phase 1. */
@import "./shop/components.css";
@import "./shop/layout.css";
@import "./shop/utilities.css";
@import "./shop/overrides.css";

View File

@@ -0,0 +1,11 @@
/* Component styles — extracted from inline styles in later phases.
Each component gets its own section. */
@layer components {
/* Phase 2: product cards, grid, badges, hero, categories */
/* Phase 2: PDP, variant selector, gallery, accordion */
/* Phase 3: layout components (header, footer, nav, search) */
/* Phase 3: cart components (drawer, items, summary) */
/* Phase 4: content components (contact, reviews, newsletter) */
/* Phase 4: page templates (checkout success, etc.) */
}

View File

@@ -0,0 +1,69 @@
/* Layout primitives — composable building blocks for page structure.
Each primitive does one layout job well. Combine them freely. */
@layer layout {
/* Vertical stack with consistent gap */
.stack {
display: flex;
flex-direction: column;
gap: var(--stack-gap, var(--space-md));
}
/* Horizontal flex-wrap cluster for tags, pills, badges */
.cluster {
display: flex;
flex-wrap: wrap;
gap: var(--cluster-gap, var(--space-sm));
align-items: center;
}
/* Horizontal flex row, no wrap — navbars, toolbars, inline groups */
.row {
display: flex;
align-items: center;
gap: var(--row-gap, var(--space-sm));
}
/* Intrinsic responsive grid — items wrap naturally without breakpoints */
.auto-grid {
display: grid;
grid-template-columns: repeat(
auto-fill,
minmax(min(var(--auto-grid-min, 16rem), 100%), 1fr)
);
gap: var(--auto-grid-gap, var(--space-md));
}
/* Centered max-width container */
.container-page {
width: 100%;
max-width: var(--t-layout-max-width, 1400px);
margin-inline: auto;
padding-inline: var(--space-md);
}
/* Main content + sidebar layout */
.with-sidebar {
display: flex;
flex-wrap: wrap;
gap: var(--sidebar-gap, var(--space-xl));
& > :first-child {
flex-grow: 999;
flex-basis: 0;
min-width: 60%;
}
& > :last-child {
flex-grow: 1;
flex-basis: var(--sidebar-width, 20rem);
}
}
/* Flex center — for centering content both axes */
.center {
display: flex;
align-items: center;
justify-content: center;
}
}

View File

@@ -0,0 +1,7 @@
/* Overrides — highest-priority layer for edge cases.
Theme editor preview frame rules go here (migrated from app-shop.css in Phase 5). */
@layer overrides {
/* Cart drawer transitions (currently in app-shop.css, will move here) */
/* Preview-frame rules (currently in app.css, will move here) */
}

80
assets/css/shop/reset.css Normal file
View File

@@ -0,0 +1,80 @@
/* Reset — minimal, modern defaults
Normalises browser inconsistencies without being opinionated. */
@layer reset {
*,
*::before,
*::after {
box-sizing: border-box;
}
* {
margin: 0;
}
html {
-webkit-text-size-adjust: 100%;
-moz-text-size-adjust: 100%;
text-size-adjust: 100%;
}
body {
line-height: 1.5;
-webkit-font-smoothing: antialiased;
}
img,
picture,
video,
canvas,
svg {
display: block;
max-width: 100%;
}
input,
button,
textarea,
select {
font: inherit;
color: inherit;
}
p,
h1,
h2,
h3,
h4,
h5,
h6 {
overflow-wrap: break-word;
}
a {
color: inherit;
text-decoration-skip-ink: auto;
}
ul,
ol {
list-style: none;
padding: 0;
}
fieldset {
border: none;
padding: 0;
}
table {
border-collapse: collapse;
}
/* Remove default button styling */
button {
background: none;
border: none;
padding: 0;
cursor: pointer;
}
}

View File

@@ -0,0 +1,39 @@
/* Utility classes — a small, curated set for common patterns.
Not a framework. Just the handful that earn their keep. */
@layer utilities {
.sr-only {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
.truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.text-balance {
text-wrap: balance;
}
/* Hide visually but keep in DOM (for phx-update="stream" empty states etc.) */
.visually-hidden:not(:focus):not(:active) {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border-width: 0;
}
}