/**
 * Critical CSS - Above-the-fold styles
 * 
 * This file contains only the essential CSS needed for initial page render
 * to improve perceived performance and Core Web Vitals scores.
 * 
 * Load this inline in <head> and defer the main stylesheet.
 * 
 * @package WireBrand
 */

/* ==========================================================================
   CSS Variables
   ========================================================================== */
:root {
    --primary: #0066cc;
    --secondary: #333;
    --text: #333;
    --muted: #666;
    --border: #ddd;
    --bg: #fff;
    --bg-light: #f8f9fa;
    --success: #28a745;
    --error: #dc3545;
    --warning: #ffc107;
}

/* ==========================================================================
   Base Reset & Typography
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ==========================================================================
   Header & Navigation (Critical - Above fold)
   ========================================================================== */
header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #fff;
    border-bottom: 1px solid var(--border);
}

.top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    gap: 20px;
    background: #fff;
}

.logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 16px;
}

.logo-mark {
    width: 32px;
    height: 32px;
    background: var(--primary);
    border-radius: 6px;
}

.search-box {
    flex: 1;
    max-width: 500px;
}

.search-box input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 13px;
}

.top-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Main Navigation */
.main-nav {
    display: flex;
    gap: 24px;
    padding: 0 24px;
    border-top: 1px solid var(--border);
    background: #fafafa;
    overflow-x: auto;
}

.nav-item {
    position: relative;
    padding: 14px 0;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
}

/* ==========================================================================
   Hero Section (Critical - Above fold)
   ========================================================================== */
.hero-large {
    position: relative;
    min-height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
}

.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.6), rgba(0,0,0,0.3));
}

.hero-large-inner {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px;
}

.hero-large-text {
    max-width: 600px;
    color: #fff;
}

.hero-large-tag {
    display: inline-block;
    padding: 6px 14px;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 16px;
}

.hero-large-text h1 {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 16px;
    line-height: 1.2;
}

.hero-large-text p {
    font-size: 16px;
    line-height: 1.6;
    opacity: 0.95;
}

/* ==========================================================================
   Buttons (Critical)
   ========================================================================== */
.btn-main,
.btn-primary {
    display: inline-block;
    padding: 12px 24px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-outline {
    display: inline-block;
    padding: 10px 20px;
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-main:hover,
.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,102,204,0.3);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* ==========================================================================
   Layout Grid (Critical)
   ========================================================================== */
.page-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 24px;
}

.wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px;
}

/* ==========================================================================
   Product Grid (Critical - Likely visible above fold)
   ========================================================================== */
.product-grid,
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.product-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.2s ease;
}

.product-img {
    display: block;
    width: 100%;
    padding-top: 100%;
    background-size: cover;
    background-position: center;
    background-color: #f5f5f5;
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */
.section {
    margin-bottom: 48px;
}

.section-title {
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* Hide elements that can be loaded later */
.lazy-load {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.lazy-load.loaded {
    opacity: 1;
}

/* ==========================================================================
   Responsive - Mobile First
   ========================================================================== */
@media (max-width: 768px) {
    .top-bar {
        flex-wrap: wrap;
        padding: 12px 16px;
    }
    
    .search-box {
        order: 3;
        width: 100%;
        max-width: 100%;
    }
    
    .main-nav {
        padding: 0 16px;
        gap: 16px;
    }
    
    .hero-large-text h1 {
        font-size: 28px;
    }
    
    .page-wrap {
        grid-template-columns: 1fr;
        padding: 16px;
    }
    
    .product-grid,
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: 12px;
    }
}

/* ==========================================================================
   Loading States (Critical for UX)
   ========================================================================== */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hide content that requires JS until loaded */
.requires-js {
    display: none;
}

.js-loaded .requires-js {
    display: block;
}
