DIY — Projects Browse Grid
A filterable browse grid for a fictional maker community, styled on a navy blueprint-grid hero with safety-orange accents and mono part-number badges. Fourteen project cards combine live search, category pills, difficulty and time dropdowns, and a Popular / Newest / Quickest sort, all re-rendered with a staggered entrance animation. Cards feature CSS-drawn SVG thumbnails with category-colored top borders, heart-toggle favorites with animated counts, a live results counter, and a drafting-table empty state when no projects match.
MCP
Code
:root {
--blueprint: #0f2a4a;
--blueprint-d: #0a1e36;
--blueprint-l: #16385f;
--grid: rgba(140, 180, 220, 0.14);
--grid-major: rgba(140, 180, 220, 0.26);
--orange: #ff6b35;
--orange-d: #e0521f;
--orange-soft: #ffe3d6;
--kraft: #d9c7a7;
--kraft-l: #efe6d4;
--ink: #1c2733;
--ink-2: #3d4a57;
--muted: #6b7885;
--bg: #f4f1ea;
--white: #ffffff;
--line: rgba(28, 39, 51, 0.12);
--line-2: rgba(28, 39, 51, 0.2);
--ok: #2f9e6f;
--warn: #d98a2b;
--danger: #d4503e;
--r-sm: 6px;
--r-md: 12px;
--r-lg: 18px;
/* category accents */
--c-electronics: #3b82c4;
--c-woodworking: #a0672f;
--c-printing: #7c5bd4;
--c-crafts: #d4508e;
--c-home: #2f9e6f;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: "Inter", system-ui, -apple-system, sans-serif;
background: var(--bg);
color: var(--ink);
line-height: 1.5;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.mono {
font-family: "JetBrains Mono", ui-monospace, monospace;
}
/* ================= Hero ================= */
.hero {
background-color: var(--blueprint);
background-image:
linear-gradient(var(--grid) 1px, transparent 1px),
linear-gradient(90deg, var(--grid) 1px, transparent 1px),
linear-gradient(var(--grid-major) 1px, transparent 1px),
linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
background-size: 8px 8px, 8px 8px, 80px 80px, 80px 80px;
color: var(--kraft-l);
border-bottom: 4px solid var(--orange);
}
.hero-inner {
max-width: 1160px;
margin: 0 auto;
padding: 28px 24px 30px;
}
.hero-top {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 26px;
}
.brand {
display: inline-flex;
align-items: center;
gap: 10px;
}
.brand-mark {
display: inline-flex;
align-items: center;
justify-content: center;
width: 38px;
height: 38px;
border-radius: var(--r-sm);
background: var(--orange);
color: var(--blueprint-d);
box-shadow: 0 3px 0 var(--orange-d);
}
.brand-name {
font-weight: 800;
font-size: 1.15rem;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.brand-name em {
font-style: normal;
color: var(--orange);
}
.hero-ref {
font-size: 0.68rem;
letter-spacing: 0.12em;
color: rgba(217, 199, 167, 0.75);
border: 1px dashed rgba(140, 180, 220, 0.4);
border-radius: var(--r-sm);
padding: 5px 10px;
white-space: nowrap;
}
.hero-title {
margin: 0 0 6px;
font-size: clamp(1.9rem, 4.5vw, 3rem);
font-weight: 800;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--white);
}
.hero-sub {
margin: 0 0 24px;
max-width: 56ch;
color: rgba(239, 230, 212, 0.82);
font-size: 0.98rem;
}
/* ---------- Toolbar ---------- */
.toolbar {
display: flex;
flex-wrap: wrap;
gap: 12px;
margin-bottom: 18px;
}
.search-wrap {
position: relative;
flex: 1 1 280px;
min-width: 220px;
display: flex;
align-items: center;
}
.search-ico {
position: absolute;
left: 14px;
color: var(--muted);
pointer-events: none;
}
.search-input {
width: 100%;
padding: 12px 44px 12px 42px;
border: 2px solid transparent;
border-radius: var(--r-md);
background: var(--white);
color: var(--ink);
font: inherit;
font-size: 0.95rem;
box-shadow: 0 4px 14px rgba(10, 30, 54, 0.35);
transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-input::placeholder { color: var(--muted); }
.search-input:focus {
outline: none;
border-color: var(--orange);
box-shadow: 0 4px 14px rgba(10, 30, 54, 0.35), 0 0 0 3px rgba(255, 107, 53, 0.28);
}
.search-kbd {
position: absolute;
right: 12px;
font-size: 0.7rem;
color: var(--muted);
border: 1px solid var(--line-2);
border-radius: 4px;
padding: 1px 7px;
background: var(--kraft-l);
}
.select-wrap {
display: flex;
align-items: stretch;
border-radius: var(--r-md);
overflow: hidden;
box-shadow: 0 4px 14px rgba(10, 30, 54, 0.35);
}
.select-label {
display: inline-flex;
align-items: center;
padding: 0 10px;
background: var(--blueprint-l);
border: 1px solid rgba(140, 180, 220, 0.3);
border-right: 0;
border-radius: var(--r-md) 0 0 var(--r-md);
color: var(--kraft);
font-size: 0.62rem;
font-weight: 600;
letter-spacing: 0.14em;
}
.select-wrap select {
appearance: none;
border: 2px solid transparent;
border-radius: 0 var(--r-md) var(--r-md) 0;
background: var(--white) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path d='M1 1l4 4 4-4' fill='none' stroke='%236b7885' stroke-width='2' stroke-linecap='round'/></svg>") no-repeat right 12px center;
padding: 11px 32px 11px 12px;
font: inherit;
font-size: 0.88rem;
font-weight: 600;
color: var(--ink);
cursor: pointer;
transition: border-color 0.15s ease;
}
.select-wrap select:focus {
outline: none;
border-color: var(--orange);
}
/* ---------- Category pills ---------- */
.pills {
display: flex;
flex-wrap: wrap;
gap: 8px;
}
.pill {
--pill-accent: var(--kraft);
font: inherit;
font-size: 0.82rem;
font-weight: 600;
letter-spacing: 0.02em;
padding: 8px 16px;
border-radius: 999px;
border: 1.5px solid rgba(140, 180, 220, 0.35);
background: rgba(10, 30, 54, 0.45);
color: var(--kraft-l);
cursor: pointer;
transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.pill:hover { transform: translateY(-1px); border-color: rgba(140, 180, 220, 0.7); }
.pill:focus-visible {
outline: 2px solid var(--orange);
outline-offset: 2px;
}
.pill.is-active {
background: var(--orange);
border-color: var(--orange);
color: var(--blueprint-d);
box-shadow: 0 3px 0 var(--orange-d);
}
.pill-electronics.is-active { background: var(--c-electronics); border-color: var(--c-electronics); box-shadow: 0 3px 0 #2a659e; color: var(--white); }
.pill-woodworking.is-active { background: var(--c-woodworking); border-color: var(--c-woodworking); box-shadow: 0 3px 0 #7d4e21; color: var(--white); }
.pill-printing.is-active { background: var(--c-printing); border-color: var(--c-printing); box-shadow: 0 3px 0 #5f42ab; color: var(--white); }
.pill-crafts.is-active { background: var(--c-crafts); border-color: var(--c-crafts); box-shadow: 0 3px 0 #ab3a6f; color: var(--white); }
.pill-home.is-active { background: var(--c-home); border-color: var(--c-home); box-shadow: 0 3px 0 #237a54; color: var(--white); }
/* ================= Results ================= */
.page {
max-width: 1160px;
margin: 0 auto;
padding: 26px 24px 60px;
}
.results-bar {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
margin-bottom: 18px;
}
.results-count {
margin: 0;
font-size: 0.85rem;
color: var(--muted);
font-weight: 500;
}
.results-count strong { color: var(--ink); font-weight: 700; }
.clear-btn {
font-size: 0.68rem;
letter-spacing: 0.1em;
font-weight: 600;
color: var(--danger);
background: transparent;
border: 1px dashed var(--danger);
border-radius: var(--r-sm);
padding: 6px 12px;
cursor: pointer;
transition: background 0.15s ease, color 0.15s ease;
}
.clear-btn:hover { background: var(--danger); color: var(--white); }
.clear-btn:focus-visible { outline: 2px solid var(--danger); outline-offset: 2px; }
/* ---------- Grid + cards ---------- */
.grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 20px;
}
.card {
--accent: var(--orange);
background: var(--white);
border: 1px solid var(--line);
border-radius: var(--r-lg);
overflow: hidden;
display: flex;
flex-direction: column;
box-shadow: 0 2px 6px rgba(28, 39, 51, 0.06);
transition: transform 0.18s ease, box-shadow 0.18s ease;
opacity: 0;
transform: translateY(14px);
}
.card.is-in {
animation: card-in 0.45s cubic-bezier(0.22, 0.9, 0.3, 1) forwards;
animation-delay: var(--delay, 0ms);
}
@keyframes card-in {
to { opacity: 1; transform: translateY(0); }
}
.card:hover {
transform: translateY(-4px);
box-shadow: 0 14px 30px rgba(28, 39, 51, 0.14);
}
.card:focus-within {
box-shadow: 0 0 0 3px rgba(255, 107, 53, 0.35), 0 14px 30px rgba(28, 39, 51, 0.14);
}
/* thumbnail */
.thumb {
position: relative;
height: 148px;
border-top: 5px solid var(--accent);
background-color: var(--blueprint);
background-image:
linear-gradient(var(--grid) 1px, transparent 1px),
linear-gradient(90deg, var(--grid) 1px, transparent 1px),
linear-gradient(var(--grid-major) 1px, transparent 1px),
linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
background-size: 8px 8px, 8px 8px, 80px 80px, 80px 80px;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
}
.thumb svg {
filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.35));
transition: transform 0.25s ease;
}
.card:hover .thumb svg { transform: translateY(-3px) rotate(-1.5deg); }
.thumb-cat {
position: absolute;
top: 10px;
left: 10px;
font-size: 0.6rem;
font-weight: 700;
letter-spacing: 0.14em;
padding: 4px 9px;
border-radius: 4px;
background: var(--accent);
color: var(--white);
text-transform: uppercase;
}
.thumb-cat.on-light { color: var(--blueprint-d); }
.thumb-part {
position: absolute;
bottom: 8px;
right: 10px;
font-size: 0.6rem;
letter-spacing: 0.1em;
color: rgba(217, 199, 167, 0.7);
}
/* heart */
.fav {
position: absolute;
top: 8px;
right: 8px;
display: inline-flex;
align-items: center;
gap: 6px;
border: 0;
border-radius: 999px;
padding: 6px 11px;
background: rgba(10, 30, 54, 0.72);
color: var(--kraft-l);
font-family: "JetBrains Mono", ui-monospace, monospace;
font-size: 0.72rem;
font-weight: 600;
cursor: pointer;
transition: background 0.15s ease, transform 0.12s ease;
}
.fav:hover { background: rgba(10, 30, 54, 0.92); transform: scale(1.05); }
.fav:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; }
.fav .heart {
width: 14px;
height: 14px;
fill: none;
stroke: currentColor;
stroke-width: 2;
transition: transform 0.2s ease;
}
.fav.is-fav { color: #ff8f68; }
.fav.is-fav .heart { fill: var(--orange); stroke: var(--orange); animation: heart-pop 0.35s ease; }
@keyframes heart-pop {
0% { transform: scale(1); }
40% { transform: scale(1.45); }
100% { transform: scale(1); }
}
/* body */
.card-body {
padding: 16px 16px 14px;
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
}
.card-title {
margin: 0;
font-size: 1.02rem;
font-weight: 700;
line-height: 1.3;
}
.card-title a {
color: inherit;
text-decoration: none;
}
.card-title a:hover { color: var(--orange-d); }
.card-title a:focus-visible { outline: 2px solid var(--orange); outline-offset: 2px; border-radius: 3px; }
.card-author {
margin: 0;
font-size: 0.82rem;
color: var(--muted);
display: flex;
align-items: center;
gap: 7px;
}
.avatar {
width: 22px;
height: 22px;
border-radius: 50%;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 0.6rem;
font-weight: 700;
color: var(--white);
background: var(--accent);
flex: none;
}
.card-badges {
display: flex;
flex-wrap: wrap;
gap: 6px;
margin-top: auto;
padding-top: 8px;
border-top: 1px dashed var(--line-2);
}
.badge {
font-family: "JetBrains Mono", ui-monospace, monospace;
font-size: 0.66rem;
font-weight: 600;
letter-spacing: 0.06em;
padding: 4px 9px;
border-radius: 4px;
border: 1px solid var(--line-2);
color: var(--ink-2);
background: var(--kraft-l);
}
.badge-beginner { border-color: rgba(47, 158, 111, 0.5); color: #1f7a52; background: rgba(47, 158, 111, 0.1); }
.badge-intermediate { border-color: rgba(217, 138, 43, 0.55); color: #a4650f; background: rgba(217, 138, 43, 0.12); }
.badge-advanced { border-color: rgba(212, 80, 62, 0.55); color: #b23726; background: rgba(212, 80, 62, 0.1); }
/* ---------- Empty state ---------- */
.empty {
text-align: center;
padding: 30px 16px 40px;
}
.empty-board {
position: relative;
width: min(340px, 100%);
margin: 0 auto 22px;
border-radius: var(--r-lg);
padding: 30px 20px 26px;
background-color: var(--blueprint);
background-image:
linear-gradient(var(--grid) 1px, transparent 1px),
linear-gradient(90deg, var(--grid) 1px, transparent 1px),
linear-gradient(var(--grid-major) 1px, transparent 1px),
linear-gradient(90deg, var(--grid-major) 1px, transparent 1px);
background-size: 8px 8px, 8px 8px, 80px 80px, 80px 80px;
border-top: 5px solid var(--orange);
box-shadow: 0 14px 30px rgba(15, 42, 74, 0.28);
}
.empty-draft {
position: relative;
display: inline-block;
}
.empty-dim {
position: absolute;
color: rgba(140, 180, 220, 0.8);
font-size: 0.62rem;
letter-spacing: 0.1em;
}
.empty-dim-top { top: -16px; left: 50%; transform: translateX(-50%); }
.empty-dim-side { right: -34px; top: 50%; transform: translateY(-50%) rotate(90deg); }
.empty-stamp {
display: inline-block;
margin-top: 16px;
padding: 5px 14px;
border: 2px dashed rgba(255, 107, 53, 0.8);
border-radius: var(--r-sm);
color: var(--orange);
font-size: 0.72rem;
font-weight: 700;
letter-spacing: 0.18em;
transform: rotate(-2deg);
}
.empty-title {
margin: 0 0 6px;
font-size: 1.3rem;
font-weight: 800;
text-transform: uppercase;
letter-spacing: 0.05em;
}
.empty-text {
margin: 0 auto 18px;
max-width: 40ch;
color: var(--muted);
font-size: 0.92rem;
}
.btn-primary {
font: inherit;
font-weight: 700;
font-size: 0.9rem;
letter-spacing: 0.03em;
text-transform: uppercase;
padding: 12px 24px;
border: 0;
border-radius: var(--r-md);
background: var(--orange);
color: var(--blueprint-d);
cursor: pointer;
box-shadow: 0 4px 0 var(--orange-d);
transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 0 var(--orange-d); }
.btn-primary:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--orange-d); }
.btn-primary:focus-visible { outline: 3px solid var(--blueprint); outline-offset: 2px; }
/* ---------- Footer / toast ---------- */
.foot {
text-align: center;
padding: 22px 16px 34px;
color: var(--muted);
font-size: 0.66rem;
letter-spacing: 0.14em;
border-top: 1px dashed var(--line-2);
}
.toast {
position: fixed;
left: 50%;
bottom: 26px;
transform: translate(-50%, 16px);
background: var(--blueprint-d);
color: var(--kraft-l);
font-size: 0.76rem;
letter-spacing: 0.06em;
padding: 11px 20px;
border-radius: var(--r-md);
border-left: 4px solid var(--orange);
box-shadow: 0 12px 28px rgba(10, 30, 54, 0.4);
opacity: 0;
pointer-events: none;
transition: opacity 0.25s ease, transform 0.25s ease;
z-index: 50;
max-width: calc(100vw - 32px);
}
.toast.show {
opacity: 1;
transform: translate(-50%, 0);
}
/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
.card { opacity: 1; transform: none; }
.card.is-in { animation: none; }
.card:hover { transform: none; }
* { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
/* ---------- Responsive ---------- */
@media (max-width: 760px) {
.toolbar { gap: 10px; }
.select-wrap { flex: 1 1 45%; }
.select-wrap select { width: 100%; }
}
@media (max-width: 520px) {
.hero-inner { padding: 20px 16px 24px; }
.hero-top { margin-bottom: 18px; }
.hero-ref { display: none; }
.hero-title { letter-spacing: 0.03em; }
.page { padding: 20px 16px 48px; }
.grid { grid-template-columns: 1fr; gap: 16px; }
.search-wrap { flex: 1 1 100%; }
.select-wrap { flex: 1 1 100%; }
.select-label { min-width: 88px; justify-content: flex-start; }
.select-wrap select { flex: 1; }
.results-bar { flex-direction: column; align-items: flex-start; gap: 8px; }
.search-kbd { display: none; }
}/* MakerBench — Projects Browse Grid
Vanilla JS: live search, category pills, difficulty/time filters,
sorting, staggered card animation, heart toggles, empty state. */
(function () {
"use strict";
/* ---------------- Data (fictional) ---------------- */
const CATEGORIES = {
electronics: { label: "Electronics", color: "var(--c-electronics)" },
woodworking: { label: "Woodworking", color: "var(--c-woodworking)" },
printing: { label: "3D Printing", color: "var(--c-printing)" },
crafts: { label: "Crafts", color: "var(--c-crafts)" },
home: { label: "Home", color: "var(--c-home)" },
};
// timeBucket: quick (<2h) | medium (2-8h) | long (weekend+)
const PROJECTS = [
{ id: "EL-101", title: "Solder-Fume Extractor Mk.II", author: "Priya Deshmukh", cat: "electronics", difficulty: "intermediate", timeBucket: "medium", timeLabel: "4 h", hours: 4, favs: 312, added: 20260722, art: "circuit" },
{ id: "WD-204", title: "Dovetail Spice Rack", author: "Marcus Vane", cat: "woodworking", difficulty: "beginner", timeBucket: "medium", timeLabel: "3 h", hours: 3, favs: 187, added: 20260718, art: "saw" },
{ id: "3D-330", title: "Parametric Cable Combs", author: "Iris Kowalczyk", cat: "printing", difficulty: "beginner", timeBucket: "quick", timeLabel: "45 min", hours: 0.75, favs: 421, added: 20260726, art: "printer" },
{ id: "CR-118", title: "Kraft-Paper Star Lanterns", author: "June Okafor", cat: "crafts", difficulty: "beginner", timeBucket: "quick", timeLabel: "90 min", hours: 1.5, favs: 264, added: 20260711, art: "scissors" },
{ id: "HM-042", title: "Squeak-Free Door Hinge Fix", author: "Tomás Ferreyra", cat: "home", difficulty: "beginner", timeBucket: "quick", timeLabel: "30 min", hours: 0.5, favs: 98, added: 20260702, art: "house" },
{ id: "EL-137", title: "ESP32 Weather Kiosk", author: "Priya Deshmukh", cat: "electronics", difficulty: "advanced", timeBucket: "long", timeLabel: "2 days", hours: 16, favs: 538, added: 20260714, art: "circuit" },
{ id: "WD-219", title: "Workshop French Cleat Wall", author: "Hana Brandt", cat: "woodworking", difficulty: "intermediate", timeBucket: "long", timeLabel: "Weekend", hours: 12, favs: 610, added: 20260619, art: "saw" },
{ id: "3D-355", title: "Snap-Fit Drawer Organizers", author: "Iris Kowalczyk", cat: "printing", difficulty: "intermediate", timeBucket: "medium", timeLabel: "6 h", hours: 6, favs: 233, added: 20260724, art: "printer" },
{ id: "CR-131", title: "Sashiko-Stitch Tool Roll", author: "June Okafor", cat: "crafts", difficulty: "intermediate", timeBucket: "medium", timeLabel: "5 h", hours: 5, favs: 176, added: 20260707, art: "scissors" },
{ id: "HM-057", title: "Under-Sink Leak Sensor Mount", author: "Tomás Ferreyra", cat: "home", difficulty: "intermediate", timeBucket: "quick", timeLabel: "1 h", hours: 1, favs: 142, added: 20260728, art: "house" },
{ id: "EL-149", title: "Bench PSU From ATX Supply", author: "Marcus Vane", cat: "electronics", difficulty: "advanced", timeBucket: "medium", timeLabel: "7 h", hours: 7, favs: 389, added: 20260625, art: "circuit" },
{ id: "WD-233", title: "Hand-Cut Bandsaw Boxes", author: "Hana Brandt", cat: "woodworking", difficulty: "advanced", timeBucket: "long", timeLabel: "3 days", hours: 20, favs: 295, added: 20260601, art: "saw" },
{ id: "3D-368", title: "Print-in-Place Vise Clamp", author: "Sana Al-Rashid", cat: "printing", difficulty: "advanced", timeBucket: "medium", timeLabel: "8 h", hours: 8, favs: 471, added: 20260721, art: "printer" },
{ id: "HM-063", title: "Blueprint Grid Accent Wall", author: "Sana Al-Rashid", cat: "home", difficulty: "beginner", timeBucket: "long", timeLabel: "Weekend", hours: 10, favs: 205, added: 20260716, art: "house" },
];
/* ---------------- Thumbnail art (CSS/SVG illustrations) ---------------- */
const ART = {
circuit: `
<svg viewBox="0 0 140 90" width="140" height="90" fill="none" stroke-linecap="round" aria-hidden="true">
<rect x="38" y="22" width="64" height="46" rx="6" fill="#16385f" stroke="#8cb4dc" stroke-width="2"/>
<rect x="54" y="36" width="32" height="18" rx="3" fill="#0a1e36" stroke="#ff6b35" stroke-width="2"/>
<circle cx="48" cy="30" r="2.5" fill="#ff6b35"/>
<circle cx="92" cy="60" r="2.5" fill="#2f9e6f"/>
<path d="M38 32H18M38 45H12M38 58H20M102 32h20M102 45h26M102 58h18" stroke="#8cb4dc" stroke-width="2" stroke-dasharray="1 5"/>
<path d="M60 22V10M70 22V14M80 22V10M60 68v12M70 68v8M80 68v12" stroke="#8cb4dc" stroke-width="2"/>
</svg>`,
saw: `
<svg viewBox="0 0 140 90" width="140" height="90" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<rect x="16" y="52" width="108" height="16" rx="3" fill="#a0672f" stroke="#d9c7a7" stroke-width="2"/>
<path d="M16 60h108" stroke="#7d4e21" stroke-width="1.5" stroke-dasharray="8 6"/>
<path d="M34 52 62 20h34l10 12-14 20" fill="#d9c7a7" stroke="#efe6d4" stroke-width="2"/>
<path d="M34 52h58l-4 6H40z" fill="#efe6d4"/>
<path d="M40 52l4 6M50 52l4 6M60 52l4 6M70 52l4 6M80 52l4 6" stroke="#a0672f" stroke-width="2"/>
<rect x="96" y="18" width="18" height="12" rx="4" fill="#ff6b35" stroke="#e0521f" stroke-width="2"/>
</svg>`,
printer: `
<svg viewBox="0 0 140 90" width="140" height="90" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M42 14h56M42 14v56M98 14v56M34 70h72" stroke="#8cb4dc" stroke-width="3"/>
<rect x="52" y="26" width="36" height="10" rx="2" fill="#16385f" stroke="#8cb4dc" stroke-width="2"/>
<path d="M70 36v8" stroke="#ff6b35" stroke-width="3"/>
<path d="M58 70 70 48l12 22z" fill="#ff6b35" stroke="#e0521f" stroke-width="2"/>
<path d="M62 63h16" stroke="#ffe3d6" stroke-width="1.5"/>
<path d="M64 58h12" stroke="#ffe3d6" stroke-width="1.5"/>
</svg>`,
scissors: `
<svg viewBox="0 0 140 90" width="140" height="90" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M20 45h100" stroke="#ff6b35" stroke-width="2" stroke-dasharray="7 6"/>
<circle cx="52" cy="30" r="9" stroke="#d9c7a7" stroke-width="3"/>
<circle cx="52" cy="60" r="9" stroke="#d9c7a7" stroke-width="3"/>
<path d="M59 36 108 58M59 54 108 32" stroke="#efe6d4" stroke-width="4"/>
<circle cx="76" cy="45" r="3" fill="#ff6b35"/>
<path d="M112 28l8-4M112 62l8 4" stroke="#8cb4dc" stroke-width="2"/>
</svg>`,
house: `
<svg viewBox="0 0 140 90" width="140" height="90" fill="none" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
<path d="M40 44 70 18l30 26" stroke="#efe6d4" stroke-width="3.5"/>
<path d="M48 42v30h44V42" stroke="#d9c7a7" stroke-width="3"/>
<rect x="63" y="52" width="14" height="20" fill="#ff6b35" stroke="#e0521f" stroke-width="2"/>
<rect x="52" y="46" width="9" height="9" stroke="#8cb4dc" stroke-width="2"/>
<rect x="79" y="46" width="9" height="9" stroke="#8cb4dc" stroke-width="2"/>
<path d="M30 72h80" stroke="#8cb4dc" stroke-width="2" stroke-dasharray="2 5"/>
</svg>`,
};
/* ---------------- State ---------------- */
const state = {
search: "",
cat: "all",
difficulty: "all",
time: "all",
sort: "popular",
favorites: new Set(),
};
/* ---------------- DOM refs ---------------- */
const grid = document.getElementById("grid");
const emptyEl = document.getElementById("empty");
const countEl = document.getElementById("results-count");
const clearBtn = document.getElementById("clear-filters");
const searchInput = document.getElementById("search");
const difficultySel = document.getElementById("difficulty");
const timeSel = document.getElementById("time");
const sortSel = document.getElementById("sort");
const pills = Array.from(document.querySelectorAll(".pill"));
const toastEl = document.getElementById("toast");
/* ---------------- Toast helper ---------------- */
let toastTimer = null;
function toast(msg) {
toastEl.textContent = msg;
toastEl.classList.add("show");
clearTimeout(toastTimer);
toastTimer = setTimeout(() => toastEl.classList.remove("show"), 2200);
}
/* ---------------- Rendering ---------------- */
function initials(name) {
return name
.split(/\s+/)
.map((w) => w[0])
.slice(0, 2)
.join("")
.toUpperCase();
}
function formatFavs(n) {
return n >= 1000 ? (n / 1000).toFixed(1).replace(/\.0$/, "") + "k" : String(n);
}
function cardHTML(p, index) {
const cat = CATEGORIES[p.cat];
const isFav = state.favorites.has(p.id);
const favCount = p.favs + (isFav ? 1 : 0);
const diffLabel = p.difficulty.charAt(0).toUpperCase() + p.difficulty.slice(1);
return `
<article class="card is-in" style="--accent:${cat.color}; --delay:${index * 55}ms" data-id="${p.id}">
<div class="thumb">
<span class="thumb-cat">${cat.label}</span>
${ART[p.art]}
<span class="thumb-part mono">PART NO. ${p.id}</span>
<button class="fav${isFav ? " is-fav" : ""}" type="button"
aria-pressed="${isFav}" aria-label="${isFav ? "Remove from" : "Add to"} favorites — ${p.title}">
<svg class="heart" viewBox="0 0 24 24" aria-hidden="true">
<path d="M12 20.3 4.9 13a4.6 4.6 0 0 1 0-6.5 4.4 4.4 0 0 1 6.3 0l.8.8.8-.8a4.4 4.4 0 0 1 6.3 0 4.6 4.6 0 0 1 0 6.5z"/>
</svg>
<span class="fav-count">${formatFavs(favCount)}</span>
</button>
</div>
<div class="card-body">
<h2 class="card-title"><a href="#${p.id}" onclick="return false">${p.title}</a></h2>
<p class="card-author">
<span class="avatar" aria-hidden="true">${initials(p.author)}</span>
by ${p.author}
</p>
<div class="card-badges">
<span class="badge badge-${p.difficulty}">${diffLabel.toUpperCase()}</span>
<span class="badge">⏱ ${p.timeLabel.toUpperCase()}</span>
</div>
</div>
</article>`;
}
function applyFilters() {
const q = state.search.trim().toLowerCase();
let list = PROJECTS.filter((p) => {
if (state.cat !== "all" && p.cat !== state.cat) return false;
if (state.difficulty !== "all" && p.difficulty !== state.difficulty) return false;
if (state.time !== "all" && p.timeBucket !== state.time) return false;
if (q) {
const hay = (p.title + " " + p.author + " " + CATEGORIES[p.cat].label + " " + p.id).toLowerCase();
if (!hay.includes(q)) return false;
}
return true;
});
switch (state.sort) {
case "newest":
list.sort((a, b) => b.added - a.added);
break;
case "quickest":
list.sort((a, b) => a.hours - b.hours);
break;
default: // popular
list.sort((a, b) => (b.favs + (state.favorites.has(b.id) ? 1 : 0)) - (a.favs + (state.favorites.has(a.id) ? 1 : 0)));
}
return list;
}
function hasActiveFilters() {
return state.search.trim() !== "" || state.cat !== "all" || state.difficulty !== "all" || state.time !== "all";
}
function render() {
const list = applyFilters();
grid.innerHTML = list.map(cardHTML).join("");
emptyEl.hidden = list.length !== 0;
grid.hidden = list.length === 0;
countEl.innerHTML = `Showing <strong>${list.length}</strong> of <strong>${PROJECTS.length}</strong> projects`;
clearBtn.hidden = !hasActiveFilters();
}
/* ---------------- Events ---------------- */
// Live search (debounced a touch so the stagger doesn't thrash)
let searchTimer = null;
searchInput.addEventListener("input", () => {
clearTimeout(searchTimer);
searchTimer = setTimeout(() => {
state.search = searchInput.value;
render();
}, 140);
});
// "/" focuses search
document.addEventListener("keydown", (e) => {
if (e.key === "/" && document.activeElement !== searchInput && !/^(input|select|textarea)$/i.test(document.activeElement.tagName)) {
e.preventDefault();
searchInput.focus();
}
});
// Category pills
pills.forEach((pill) => {
pill.addEventListener("click", () => {
pills.forEach((p) => {
p.classList.toggle("is-active", p === pill);
p.setAttribute("aria-selected", p === pill ? "true" : "false");
});
state.cat = pill.dataset.cat;
render();
});
});
// Selects
difficultySel.addEventListener("change", () => { state.difficulty = difficultySel.value; render(); });
timeSel.addEventListener("change", () => { state.time = timeSel.value; render(); });
sortSel.addEventListener("change", () => {
state.sort = sortSel.value;
render();
const label = sortSel.options[sortSel.selectedIndex].textContent;
toast("SORTED BY: " + label.toUpperCase());
});
// Heart toggle (event delegation — cards are re-rendered on filter)
grid.addEventListener("click", (e) => {
const favBtn = e.target.closest(".fav");
if (!favBtn) return;
const card = favBtn.closest(".card");
const id = card.dataset.id;
const project = PROJECTS.find((p) => p.id === id);
const nowFav = !state.favorites.has(id);
if (nowFav) state.favorites.add(id);
else state.favorites.delete(id);
favBtn.classList.toggle("is-fav", nowFav);
favBtn.setAttribute("aria-pressed", String(nowFav));
favBtn.setAttribute("aria-label", (nowFav ? "Remove from" : "Add to") + " favorites — " + project.title);
favBtn.querySelector(".fav-count").textContent = formatFavs(project.favs + (nowFav ? 1 : 0));
toast(nowFav ? "★ SAVED: " + project.id : "REMOVED: " + project.id);
});
// Clear / reset
function resetFilters() {
state.search = "";
state.cat = "all";
state.difficulty = "all";
state.time = "all";
searchInput.value = "";
difficultySel.value = "all";
timeSel.value = "all";
pills.forEach((p) => {
const active = p.dataset.cat === "all";
p.classList.toggle("is-active", active);
p.setAttribute("aria-selected", String(active));
});
render();
toast("FILTERS CLEARED — FULL CATALOG");
}
clearBtn.addEventListener("click", resetFilters);
document.getElementById("empty-reset").addEventListener("click", resetFilters);
/* ---------------- Init ---------------- */
render();
})();<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>DIY — Projects Browse Grid</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600;700&display=swap" rel="stylesheet" />
<link rel="stylesheet" href="style.css" />
</head>
<body>
<!-- ======= Hero / top bar ======= -->
<header class="hero" role="banner">
<div class="hero-inner">
<div class="hero-top">
<div class="brand">
<span class="brand-mark" aria-hidden="true">
<svg viewBox="0 0 24 24" width="22" height="22" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<path d="M14.7 6.3a4.5 4.5 0 0 0-6 6L3 18l3 3 5.7-5.7a4.5 4.5 0 0 0 6-6l-2.6 2.6-2.4-2.4 2.6-2.6z"/>
</svg>
</span>
<span class="brand-name">Maker<em>Bench</em></span>
</div>
<span class="hero-ref mono">CAT.NO BRW-014 · REV C</span>
</div>
<h1 class="hero-title">Browse Projects</h1>
<p class="hero-sub">14 community builds, wired, sanded & printed by fictional makers. Pick a lane, grab your safety glasses.</p>
<!-- Search + selects -->
<div class="toolbar" role="search">
<div class="search-wrap">
<svg class="search-ico" aria-hidden="true" viewBox="0 0 24 24" width="18" height="18" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"><circle cx="11" cy="11" r="7"/><path d="m20 20-3.5-3.5"/></svg>
<input id="search" class="search-input" type="search" placeholder="Search projects, makers, tags…" aria-label="Search projects" autocomplete="off" />
<kbd class="search-kbd mono" aria-hidden="true">/</kbd>
</div>
<label class="select-wrap">
<span class="select-label mono">DIFFICULTY</span>
<select id="difficulty" aria-label="Filter by difficulty">
<option value="all">Any</option>
<option value="beginner">Beginner</option>
<option value="intermediate">Intermediate</option>
<option value="advanced">Advanced</option>
</select>
</label>
<label class="select-wrap">
<span class="select-label mono">TIME</span>
<select id="time" aria-label="Filter by build time">
<option value="all">Any</option>
<option value="quick">Under 2 h</option>
<option value="medium">2 – 8 h</option>
<option value="long">Weekend +</option>
</select>
</label>
<label class="select-wrap">
<span class="select-label mono">SORT</span>
<select id="sort" aria-label="Sort projects">
<option value="popular">Popular</option>
<option value="newest">Newest</option>
<option value="quickest">Quickest</option>
</select>
</label>
</div>
<!-- Category pills -->
<div class="pills" role="tablist" aria-label="Filter by category">
<button class="pill is-active" role="tab" aria-selected="true" data-cat="all">All</button>
<button class="pill pill-electronics" role="tab" aria-selected="false" data-cat="electronics">Electronics</button>
<button class="pill pill-woodworking" role="tab" aria-selected="false" data-cat="woodworking">Woodworking</button>
<button class="pill pill-printing" role="tab" aria-selected="false" data-cat="printing">3D Printing</button>
<button class="pill pill-crafts" role="tab" aria-selected="false" data-cat="crafts">Crafts</button>
<button class="pill pill-home" role="tab" aria-selected="false" data-cat="home">Home</button>
</div>
</div>
</header>
<!-- ======= Results ======= -->
<main class="page" role="main">
<div class="results-bar">
<p class="results-count" id="results-count" aria-live="polite">Showing 14 of 14 projects</p>
<button class="clear-btn mono" id="clear-filters" type="button" hidden>✕ CLEAR FILTERS</button>
</div>
<section class="grid" id="grid" aria-label="Project results"><!-- cards injected by script.js --></section>
<!-- Empty state -->
<div class="empty" id="empty" hidden>
<div class="empty-board" aria-hidden="true">
<div class="empty-draft">
<span class="empty-dim empty-dim-top mono">?? mm</span>
<div class="empty-shape">
<svg viewBox="0 0 120 90" width="120" height="90" fill="none" stroke="rgba(140,180,220,0.7)" stroke-width="1.5">
<rect x="10" y="14" width="100" height="62" rx="6" stroke-dasharray="6 5"/>
<circle cx="60" cy="45" r="16"/>
<path d="M52 45h16M60 37v16" stroke-linecap="round"/>
</svg>
</div>
<span class="empty-dim empty-dim-side mono">TBD</span>
</div>
<span class="empty-stamp mono">NO PARTS FOUND</span>
</div>
<h2 class="empty-title">Nothing on the bench</h2>
<p class="empty-text">No projects match those filters. Loosen a spec or two and try again.</p>
<button class="btn-primary" id="empty-reset" type="button">Reset all filters</button>
</div>
</main>
<footer class="foot">
<span class="mono">MAKERBENCH · FICTIONAL DEMO DATA · MEASURE TWICE, FILTER ONCE</span>
</footer>
<div class="toast mono" id="toast" role="status" aria-live="polite"></div>
<script src="script.js"></script>
</body>
</html>Projects Browse Grid
A browse page for a fictional maker community (“MakerBench”) with a dark blueprint-grid hero holding all the controls: a live search input (press / to focus it), category pills for All / Electronics / Woodworking / 3D Printing / Crafts / Home, labeled dropdowns for difficulty and build time, and a sort select covering Popular, Newest, and Quickest. Every control feeds a single filter state, and each change re-renders the grid with a fresh staggered fade-up animation.
The fourteen project cards are built entirely from CSS and inline SVG — no images. Each thumbnail sits on the signature blueprint texture with a category-colored top border, a category tag, and a mono part number, while the card body carries the title, an initials avatar for the fictional author, and mono badges for difficulty (color-coded green / amber / red) and estimated time. A heart button on every thumbnail toggles a favorite with a pop animation, bumps the visible count, and confirms via a workshop-styled toast.
A results counter (“Showing 8 of 14 projects”) stays in sync via aria-live, a dashed “clear filters” button appears only when filters are active, and an empty state — a small drafting-board illustration stamped “NO PARTS FOUND” — offers a one-click reset when nothing matches. The layout collapses cleanly to a single column at narrow widths and respects prefers-reduced-motion.
Illustrative UI only — always follow real safety guidance when working with tools, electronics, or repairs.