/**
 * ARCHTELIER INTERIORS - Global SEO & Performance CSS
 * World-Class Performance Optimizations
 * 
 * Critical CSS for above-the-fold content and performance optimization
 */

/* ===== PERFORMANCE CRITICAL STYLES ===== */

/* CSS Variables - Global Design System */
:root {
    /* Core Colors */
    --bg-primary: #0c0c0c;
    --bg-secondary: #121212;
    --bg-tertiary: #1a1a1a;
    --text-primary: rgba(255, 255, 255, 0.92);
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-tertiary: rgba(255, 255, 255, 0.5);
    
    /* Golden Ratio Colors */
    --gold-primary: #D4AF37;
    --gold-secondary: #E4C56B;
    --gold-tertiary: #F4E4A0;
    --gold-shadow: rgba(212, 175, 55, 0.3);
    --gold-glow: rgba(212, 175, 55, 0.6);
    
    /* Fibonacci-based Spacing */
    --space-xs: 0.382rem;  /* φ^-2 */
    --space-sm: 0.618rem;  /* φ^-1 */
    --space-md: 1rem;      /* φ^0 */
    --space-lg: 1.618rem;  /* φ^1 */
    --space-xl: 2.618rem;  /* φ^2 */
    --space-xxl: 4.236rem; /* φ^3 */
    
    /* Typography Scale (Golden Ratio) */
    --font-xs: 0.618rem;
    --font-sm: 0.75rem;
    --font-base: 1rem;
    --font-lg: 1.25rem;
    --font-xl: 1.618rem;
    --font-xxl: 2.618rem;
    --font-xxxl: 4.236rem;
    
    /* Font Families */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-display: 'Playfair Display', Georgia, 'Times New Roman', serif;
    
    /* Transitions */
    --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    
    /* Shadows */
    --shadow-subtle: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
    --shadow-moderate: 0 4px 6px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.06);
    --shadow-prominent: 0 10px 15px rgba(0, 0, 0, 0.1), 0 4px 6px rgba(0, 0, 0, 0.05);
    --shadow-dramatic: 0 25px 50px rgba(0, 0, 0, 0.25);
    --shadow-gold: 0 0 20px var(--gold-shadow);
    
    /* Border Radius */
    --radius-sm: 0.25rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-full: 9999px;
    
    /* Z-Index Scale */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    --z-toast: 1080;
}

/* Performance Optimizations */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -ms-text-size-adjust: 100%;
    text-size-adjust: 100%;
    font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
    -webkit-font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-primary);
    font-size: var(--font-base);
    line-height: 1.6;
    font-weight: 400;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    font-display: swap;
}

/* Critical Loading States */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 1;
    visibility: visible;
    transition: opacity var(--transition-slow), visibility var(--transition-slow);
}

.loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--gold-shadow);
    border-top: 3px solid var(--gold-primary);
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    filter: drop-shadow(var(--shadow-gold));
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-content {
    position: absolute;
    top: 60%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    font-family: var(--font-display);
    color: var(--gold-primary);
    font-size: var(--font-lg);
    font-weight: 500;
    letter-spacing: 1px;
}

/* Critical Above-the-fold Styles */
.critical-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    background: linear-gradient(135deg, rgba(20, 20, 20, 0.95) 0%, rgba(30, 30, 30, 0.95) 100%);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--gold-shadow);
    z-index: var(--z-fixed);
    height: 80px;
    transition: transform var(--transition-normal);
}

.critical-header.hidden {
    transform: translateY(-100%);
}

/* Advanced Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
    color: var(--gold-primary);
    margin-bottom: var(--space-md);
    letter-spacing: 0.5px;
}

h1 { font-size: var(--font-xxxl); }
h2 { font-size: var(--font-xxl); }
h3 { font-size: var(--font-xl); }
h4 { font-size: var(--font-lg); }
h5 { font-size: var(--font-base); }
h6 { font-size: var(--font-sm); }

p {
    margin-bottom: var(--space-md);
    line-height: 1.7;
}

a {
    color: var(--gold-primary);
    text-decoration: none;
    transition: color var(--transition-fast);
}

a:hover, a:focus {
    color: var(--gold-secondary);
    outline: none;
}

/* Performance Optimized Images */
img {
    max-width: 100%;
    height: auto;
    display: block;
    loading: lazy;
    decoding: async;
}

.critical-image {
    loading: eager;
}

/* Responsive Container System */
.container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.container-sm { max-width: 640px; }
.container-md { max-width: 768px; }
.container-lg { max-width: 1024px; }
.container-xl { max-width: 1280px; }
.container-xxl { max-width: 1536px; }

/* Flexible Grid System */
.grid {
    display: grid;
    gap: var(--space-lg);
}

.grid-1 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.grid-auto-fit {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid-auto-fill {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

/* Flex Utilities */
.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.items-end { align-items: flex-end; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-around { justify-content: space-around; }
.justify-evenly { justify-content: space-evenly; }

/* Spacing Utilities */
.m-0 { margin: 0; }
.m-auto { margin: auto; }
.mx-auto { margin-left: auto; margin-right: auto; }
.my-auto { margin-top: auto; margin-bottom: auto; }

.p-0 { padding: 0; }
.px-0 { padding-left: 0; padding-right: 0; }
.py-0 { padding-top: 0; padding-bottom: 0; }

/* Text Utilities */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }
.text-justify { text-align: justify; }

.text-primary { color: var(--text-primary); }
.text-secondary { color: var(--text-secondary); }
.text-tertiary { color: var(--text-tertiary); }
.text-gold { color: var(--gold-primary); }

.font-light { font-weight: 300; }
.font-normal { font-weight: 400; }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

/* Background Utilities */
.bg-primary { background-color: var(--bg-primary); }
.bg-secondary { background-color: var(--bg-secondary); }
.bg-tertiary { background-color: var(--bg-tertiary); }
.bg-gold { background-color: var(--gold-primary); }

/* Border Utilities */
.border { border: 1px solid var(--text-tertiary); }
.border-gold { border-color: var(--gold-primary); }
.border-0 { border: none; }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

/* Shadow Utilities */
.shadow-subtle { box-shadow: var(--shadow-subtle); }
.shadow-moderate { box-shadow: var(--shadow-moderate); }
.shadow-prominent { box-shadow: var(--shadow-prominent); }
.shadow-dramatic { box-shadow: var(--shadow-dramatic); }
.shadow-gold { box-shadow: var(--shadow-gold); }

/* Animation Utilities */
.transition { transition: all var(--transition-normal); }
.transition-fast { transition: all var(--transition-fast); }
.transition-slow { transition: all var(--transition-slow); }

.hover\:scale-105:hover { transform: scale(1.05); }
.hover\:scale-110:hover { transform: scale(1.1); }
.hover\:translate-y-1:hover { transform: translateY(-4px); }

/* Focus and Accessibility */
.focus\:outline-none:focus { outline: none; }
.focus\:ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px var(--gold-shadow);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Performance Monitoring Indicators */
.performance-indicator {
    position: fixed;
    top: 10px;
    right: 10px;
    background: var(--bg-secondary);
    border: 1px solid var(--gold-primary);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-xs);
    color: var(--gold-primary);
    z-index: var(--z-toast);
    opacity: 0;
    transition: opacity var(--transition-normal);
}

.performance-indicator.show {
    opacity: 1;
}

.performance-indicator.good {
    border-color: #22c55e;
    color: #22c55e;
}

.performance-indicator.needs-improvement {
    border-color: #f59e0b;
    color: #f59e0b;
}

.performance-indicator.poor {
    border-color: #ef4444;
    color: #ef4444;
}

/* A/B Testing Variants */
.ab-test-control {
    /* Control variant styles */
}

.ab-test-variant-a {
    /* Variant A styles */
}

.ab-test-variant-b {
    /* Variant B styles */
}

/* Responsive Design - Mobile First */
@media (max-width: 640px) {
    :root {
        --font-xxxl: 2.618rem;
        --font-xxl: 2rem;
        --font-xl: 1.5rem;
        --space-lg: 1rem;
        --space-xl: 1.618rem;
    }
    
    .container {
        padding: 0 var(--space-md);
    }
    
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1024px) {
    .grid-4 { grid-template-columns: repeat(3, 1fr); }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    /* Already optimized for dark mode */
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .loading-spinner {
        animation: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #cccccc;
        --gold-primary: #ffff00;
        --bg-primary: #000000;
        --bg-secondary: #111111;
    }
}

/* Print Styles */
@media print {
    * {
        background: white !important;
        color: black !important;
        box-shadow: none !important;
    }
    
    .loading-overlay,
    .performance-indicator,
    nav,
    .social-icons,
    .footer-navigation {
        display: none !important;
    }
    
    @page {
        margin: 0.5in;
    }
}

/* Critical Path CSS End */
/* Non-critical styles should be loaded asynchronously */