# Catatan Seekor: CSS

### Balance and Proportion

```css
/* Symmetrical Balance */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Asymmetrical Balance */
.asymmetric {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 2rem;
}
```

### Consistency

* **Color Palette**: Gunakan skema warna yang konsisten
* **Typography**: Batasi jumlah font family (2-3)
* **Spacing**: Gunakan sistem spacing yang konsisten
* **Components**: Buat komponen yang dapat digunakan kembali

## UI/UX Design

### User Experience (UX)

* **User Research**: Pahami kebutuhan dan perilaku pengguna
* **Information Architecture**: Organisasi konten yang logis
* **User Flow**: Jalur yang mudah diikuti pengguna
* **Accessibility**: Desain untuk semua pengguna

### User Interface (UI)

```css
/* Modern Button Design */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}
```

## Responsive Design

### CSS Breakpoints

```css
/* Mobile First Approach */
/* Base styles for mobile */
.container {
    padding: 1rem;
    max-width: 100%;
}

/* Tablet */
@media (min-width: 768px) {
    .container {
        padding: 2rem;
        max-width: 750px;
        margin: 0 auto;
    }
}

/* Desktop */
@media (min-width: 1024px) {
    .container {
        padding: 3rem;
        max-width: 1200px;
    }
}

/* Large Desktop */
@media (min-width: 1440px) {
    .container {
        max-width: 1400px;
    }
}
```

### Flexible Grid System

```css
/* CSS Grid Layout */
.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (min-width: 1440px) {
    .grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
```

### Flexible Images

```css
/* Responsive Images */
.responsive-img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Picture Element for Art Direction */
<picture>
    <source media="(min-width: 1024px)" srcset="large.jpg">
    <source media="(min-width: 768px)" srcset="medium.jpg">
    <img src="small.jpg" alt="Description" class="responsive-img">
</picture>
```

## Color Theory

### Color Psychology

* **Red**: Energy, passion, urgency
* **Blue**: Trust, stability, professionalism
* **Green**: Growth, nature, success
* **Yellow**: Optimism, creativity, attention
* **Purple**: Luxury, creativity, mystery
* **Orange**: Enthusiasm, adventure, confidence

### Color Schemes

```css
/* Monochromatic */
.monochromatic {
    background: #f0f0f0;
    color: #333333;
    border: 2px solid #666666;
}

/* Analogous */
.analogous {
    background: #ff6b6b;
    color: #4ecdc4;
    border: 2px solid #45b7aa;
}

/* Complementary */
.complementary {
    background: #ff6b6b;
    color: #4ecdc4;
    border: 2px solid #4ecdc4;
}

/* Triadic */
.triadic {
    background: #ff6b6b;
    color: #4ecdc4;
    border: 2px solid #45b7aa;
}
```

### Accessibility

```css
/* High Contrast */
.high-contrast {
    background: #000000;
    color: #ffffff;
}

/* Color Blind Friendly */
.colorblind-friendly {
    /* Use patterns and icons in addition to color */
    background: #ff6b6b;
    border-left: 4px solid #333333;
}
```

## Typography

### Font Selection

```css
/* Web Safe Fonts */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 
                 Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Custom Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

.custom-font {
    font-family: 'Inter', sans-serif;
    font-weight: 500;
}
```

### Typography Scale

```css
/* Modular Scale */
:root {
    --scale: 1.25;
    --base-size: 16px;
    
    --text-xs: calc(var(--base-size) / var(--scale));
    --text-sm: calc(var(--base-size) / var(--scale) * 0.8);
    --text-base: var(--base-size);
    --text-lg: calc(var(--base-size) * var(--scale));
    --text-xl: calc(var(--base-size) * var(--scale) * var(--scale));
    --text-2xl: calc(var(--base-size) * var(--scale) * var(--scale) * var(--scale));
}

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-base { font-size: var(--text-base); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
```

## Layout Design

### Grid Systems

```css
/* 12-Column Grid */
.grid-12 {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    gap: 1rem;
}

.col-1 { grid-column: span 1; }
.col-2 { grid-column: span 2; }
.col-3 { grid-column: span 3; }
.col-4 { grid-column: span 4; }
.col-6 { grid-column: span 6; }
.col-12 { grid-column: span 12; }

/* Responsive Grid */
@media (max-width: 768px) {
    .col-4, .col-6 {
        grid-column: span 12;
    }
}
```

### Flexbox Layout

```css
/* Flexible Layout */
.flex-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.flex-item {
    flex: 1 1 300px; /* grow, shrink, basis */
    min-width: 0;
}

/* Centering */
.center {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}
```

## Animation and Interaction

### CSS Transitions

```css
/* Smooth Transitions */
.transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-effect:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}
```

### CSS Animations

```css
/* Keyframe Animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-fade-in {
    animation: fadeIn 0.6s ease-out;
}

/* Loading Animation */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    animation: spin 1s linear infinite;
}
```

## Design Tools

### Design Software

* **Figma**: Collaborative design tool
* **Adobe XD**: UI/UX design
* **Sketch**: Mac-based design tool
* **Adobe Photoshop**: Image editing
* **Adobe Illustrator**: Vector graphics

### Prototyping Tools

* **Figma**: Built-in prototyping
* **InVision**: Interactive prototypes
* **Marvel**: Simple prototyping
* **Principle**: Advanced animations
* **Framer**: Code-based prototyping

## Design Systems

### Component Library

```css
/* Button Component */
.btn {
    /* Base styles */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

/* Button Variants */
.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-secondary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}
```

### Design Tokens

```css
/* CSS Custom Properties */
:root {
    /* Colors */
    --primary-color: #3b82f6;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    
    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}
```

## References

### Responsive Design

* [CSS breakpoints for responsive design](https://blog.logrocket.com/css-breakpoints-responsive-design/)
