/* 
   THEME: Neon Aqua & Deep Violet Futurism 
   Unique Palette Generation #842-B
*/
:root {
    --bg-dark: #050a14;
    --bg-gradient: radial-gradient(circle at 50% 0%, #1a0b2e 0%, #050a14 60%);
    --primary: #00f2ff; /* Cyan Neon */
    --secondary: #bd00ff; /* Electric Violet */
    --accent: #ffffff;
    --glass-bg: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-highlight: rgba(255, 255, 255, 0.15);
    --text-main: #e0e6ed;
    --text-muted: #94a3b8;
    --glow-primary: 0 0 20px rgba(0, 242, 255, 0.4);
    --glow-secondary: 0 0 20px rgba(189, 0, 255, 0.4);
    --font-display: 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --ease-out: cubic-bezier(0.215, 0.61, 0.355, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; font-size: 16px; }
body {
    background: var(--bg-dark);
    background-image: var(--bg-gradient);
    color: var(--text-main);
    font-family: var(--font-display);
    line-height: 1.7;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Background Canvas */
#bg-canvas {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -1;
    pointer-events: none;
}

/* Layout */
.layout-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    gap: 3rem;
    position: relative;
    z-index: 1;
}

/* Glassmorphism Utility */
.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    transition: transform 0.3s var(--ease-out), border-color 0.3s ease;
}
.glass-panel:hover {
    border-color: var(--glass-highlight);
}

/* TOC Sidebar */
#toc-sidebar {
    position: sticky;
    top: 2rem;
    height: fit-content;
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}
#toc-sidebar h3 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary);
    margin-bottom: 1rem;
    text-shadow: var(--glow-primary);
}
#toc-list { list-style: none; }
#toc-list li { margin-bottom: 0.5rem; }
#toc-list a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    display: block;
    padding: 0.4rem 0.8rem;
    border-left: 2px solid transparent;
    transition: all 0.2s ease;
}
#toc-list a:hover, #toc-list a.active {
    color: var(--primary);
    border-left-color: var(--primary);
    background: linear-gradient(90deg, rgba(0,242,255,0.1), transparent);
    padding-left: 1.2rem;
}
.toc-progress-bar {
    height: 2px;
    background: var(--secondary);
    width: 0%;
    margin-top: 1rem;
    box-shadow: var(--glow-secondary);
    transition: width 0.1s linear;
}

/* Hero Section */
.hero-section {
    margin-bottom: 4rem;
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
    overflow: hidden;
}
.hero-content h1 {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    background: linear-gradient(135deg, #fff 0%, var(--primary) 50%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
    line-height: 1.2;
}
.subtitle {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 3rem;
}

/* 3D Process Animation Stage */
.stage-container {
    width: 100%;
    height: 300px;
    position: relative;
    perspective: 1000px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 2rem;
}
.stage-label {
    position: absolute;
    bottom: 10px;
    font-family: monospace;
    color: var(--primary);
    font-size: 0.8rem;
    opacity: 0.8;
    z-index: 10;
}
.visualizer {
    width: 200px;
    height: 200px;
    position: relative;
    transform-style: preserve-3d;
    animation: float 6s ease-in-out infinite;
}

/* Rug Mesh Representation */
.rug-mesh {
    position: absolute;
    inset: 0;
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(255,255,255,0.1) 10px),
        repeating-linear-gradient(90deg, transparent, transparent 9px, rgba(255,255,255,0.1) 10px);
    border: 2px solid rgba(255,255,255,0.2);
    transform: rotateX(60deg) rotateZ(45deg);
    box-shadow: 0 0 30px rgba(0,242,255,0.1);
    transition: all 1s ease;
}

/* Particle System (Dirt/Stains) */
.particle-system {
    position: absolute;
    inset: 0;
    transform: rotateX(60deg) rotateZ(45deg);
}
.particle {
    position: absolute;
    width: 6px;
    height: 6px;
    background: #5a3a22; /* Dirt color */
    border-radius: 50%;
    opacity: 0.8;
    transition: all 1.5s var(--ease-out);
}

/* Extraction Beam */
.extraction-beam {
    position: absolute;
    top: -50%;
    left: 50%;
    width: 4px;
    height: 0;
    background: var(--primary);
    box-shadow: 0 0 15px var(--primary);
    transform: translateX(-50%);
    transition: height 0.5s ease;
    z-index: 5;
}
.extraction-beam::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(0,242,255,0.4) 0%, transparent 70%);
    border-radius: 50%;
}

/* Animation States controlled by JS classes */
.stage-container.state-inspection .rug-mesh { border-color: var(--secondary); box-shadow: 0 0 30px rgba(189,0,255,0.3); }
.stage-container.state-cleaning .extraction-beam { height: 150%; }
.stage-container.state-cleaning .particle { 
    transform: translateY(-200px) scale(0); 
    opacity: 0; 
    background: var(--primary); 
}
.stage-container.state-result .rug-mesh { 
    border-color: var(--primary); 
    box-shadow: 0 0 40px rgba(0,242,255,0.4);
    background: 
        repeating-linear-gradient(0deg, transparent, transparent 9px, rgba(0,242,255,0.2) 10px),
        repeating-linear-gradient(90deg, transparent, transparent 9px, rgba(0,242,255,0.2) 10px);
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotateY(0deg); }
    50% { transform: translateY(-15px) rotateY(5deg); }
}

/* Article Content */
.prose {
    padding: 3rem;
    margin-bottom: 3rem;
}
.prose h2 {
    font-size: 2rem;
    margin: 2.5rem 0 1rem;
    color: #fff;
    position: relative;
    padding-left: 1rem;
}
.prose h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0.2em;
    height: 1.2em;
    width: 4px;
    background: linear-gradient(to bottom, var(--primary), var(--secondary));
    border-radius: 2px;
}
.prose h3 {
    font-size: 1.4rem;
    margin: 2rem 0 0.8rem;
    color: var(--primary);
}
.prose p { margin-bottom: 1.2rem; color: var(--text-main); }
.prose ul {
    margin: 1rem 0 1.5rem 1.5rem;
    color: var(--text-muted);
}
.prose li { margin-bottom: 0.5rem; }
.prose a {
    color: var(--primary);
    text-decoration: none;
    border-bottom: 1px solid rgba(0,242,255,0.3);
    transition: all 0.2s;
}
.prose a:hover {
    color: #fff;
    border-bottom-color: #fff;
    text-shadow: var(--glow-primary);
}

/* CTA Box */
.cta-box {
    padding: 3rem;
    text-align: center;
    background: linear-gradient(135deg, rgba(0,242,255,0.05), rgba(189,0,255,0.05));
    border: 1px solid rgba(0,242,255,0.2);
}
.cta-box h2 { margin-top: 0; color: #fff; }
.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
    text-align: left;
}
.contact-item .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 0.3rem;
}
.contact-item a, .contact-item strong {
    color: #fff;
    text-decoration: none;
    font-size: 1.1rem;
}
.full-width { grid-column: 1 / -1; display: flex; gap: 1rem; justify-content: center; margin-top: 1rem; }
.btn-primary, .btn-secondary {
    padding: 0.8rem 2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s var(--ease-out);
    text-align: center;
}
.btn-primary {
    background: var(--primary);
    color: #000;
    box-shadow: var(--glow-primary);
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 0 30px rgba(0,242,255,0.6); }
.btn-secondary {
    border: 1px solid var(--secondary);
    color: var(--secondary);
}
.btn-secondary:hover { background: var(--secondary); color: #fff; box-shadow: var(--glow-secondary); }

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 2rem;
}
.social-links a {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    transition: all 0.3s ease;
}
.social-links svg { width: 20px; height: 20px; }
.social-links a:hover {
    background: var(--primary);
    color: #000;
    transform: scale(1.1);
    box-shadow: var(--glow-primary);
}

/* Mobile Nav */
.mobile-nav { display: none; position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 1rem; background: rgba(5,10,20,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--glass-border); }
#toc-toggle { background: none; border: 1px solid var(--primary); color: var(--primary); padding: 0.5rem 1rem; border-radius: 4px; font-family: inherit; cursor: pointer; }

/* Responsive */
@media (max-width: 900px) {
    .layout-container { grid-template-columns: 1fr; padding: 1rem; gap: 1.5rem; }
    .mobile-nav { display: block; }
    #toc-sidebar { 
        position: fixed; top: 60px; left: 0; bottom: 0; width: 280px; 
        transform: translateX(-100%); transition: transform 0.3s var(--ease-out); 
        z-index: 99; border-radius: 0; border-right: 1px solid var(--glass-border);
    }
    #toc-sidebar.open { transform: translateX(0); }
    .hero-section { padding: 6rem 1rem 3rem; }
    .prose, .cta-box { padding: 1.5rem; }
    .full-width { flex-direction: column; }
    .btn-primary, .btn-secondary { width: 100%; }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
    html { scroll-behavior: auto; }
}