###################################

PROJECTS


// Prototypes, Experiments & Notes


###################################

CSS Organization & Architecture Ideas for Projects

CSS Organization Strategies

1. By Cascade Order (Foundation → Components → States)

1. :root variables
2. Base elements (body, ul, li, a)
3. Layout components (header, project-item, project-name)
4. UI components (icons, status indicators, warnings)
5. Status modifiers (status-in-progress, status-complete, etc.)
6. Special cases (reference folder, root directory)
7. Media queries

2. By Component Hierarchy (Parent → Child)

1. :root variables
2. Base/reset styles
3. Header (header, h1, h2)
4. Project item (project-item → project-name → project-files)
5. Status system (status-indicator, status-label, status-message)
6. Icons (folder-icon, warning-icon)
7. Utilities (unavailable, txt-warning)
8. Media queries

3. By Concern (Layout → Typography → Colors → Interactions)

1. :root variables (grouped by type)
2. Layout (body, header, project-item, flex/grid)
3. Typography (font-family, font-size, font-weight)
4. Colors (all color declarations together)
5. Interactions (hover states, all together)
6. Media queries

4. By Specificity (Low → High)

1. :root, body, element selectors
2. Single class selectors
3. Compound selectors (.project-item.status-*)
4. Pseudo-elements (::before, ::after)
5. Pseudo-classes (:hover)
6. Attribute selectors (:has, [class*])

Strategic Architecture Feedback

Current Approach Assessment

Strengths:

Potential Brittleness:

  1. Tight coupling to HTML structure: Selectors like .project-item.status-in-progress .project-name a assume specific DOM structure
  2. Status system coupling: Status colors are hardcoded in multiple places
  3. No component boundaries: Everything is in one file, harder to extract components

Recommendations for Reusability

Option 1: Component-Based CSS Architecture

Break into logical components that can be reused:

/* components/project-tracker.css */
.project-tracker { /* base styles */ }
.project-tracker__item { /* project-item */ }
.project-tracker__name { /* project-name */ }
.project-tracker__status { /* status system */ }

Pros: Clear boundaries, easier to extract
Cons: More verbose, requires HTML changes

Keep semantic classes but add utility classes for common patterns:

/* Keep your current semantic classes */
.project-item { }

/* Add reusable utilities */
.text-bold { font-weight: bold; }
.text-normal { font-weight: normal; }
.color-inactive { color: var(--gray-dark); }
.bg-hover-orange:hover { background: var(--orange); }

Pros: Flexible, can mix semantic + utility
Cons: Can lead to class soup if overused

Option 3: CSS Custom Properties for Theming

Make the status system themeable:

:root {
  --status-in-progress-color: var(--orange);
  --status-complete-color: var(--text-color);
  --status-inactive-color: var(--gray-dark);
}

.project-item[data-status="in-progress"] {
  --status-color: var(--status-in-progress-color);
  color: var(--status-color);
}

Pros: Very flexible, easy to theme
Cons: Requires HTML data attributes

For Markdown/Todo Reuse

  1. Extract a “status-tracker” component

    • Create a reusable status system that works with any list
    • Use data attributes: data-status="in-progress"
  2. Create a design system file

    /* design-system.css - reusable across projects */
    :root {
      /* All your variables */
    }
    
    /* Base styles that work for any tracker */
    .tracker-item { }
    .tracker-status { }
    
  3. Use CSS Layers (modern browsers)

    @layer base, components, utilities;
    
    @layer base {
      /* Reset, variables */
    }
    
    @layer components {
      /* Your project-specific components */
    }
    
  4. Consider a naming convention

    • Current: Semantic but flat (.project-item.status-in-progress)
    • Alternative: BEM-like but simpler (.project-item--in-progress)
    • Or: Data-driven (.project-item[data-status])

Specific Recommendations

  1. Group status rules together: All status-related CSS in one section
  2. Extract hover pattern: Create a reusable hover utility or mixin pattern
  3. Document the status system: Add comments explaining the status hierarchy
  4. Consider CSS nesting (when widely supported): Reduces repetition
  5. Create a “tracker” base class: Make it work for projects, todos, or any list