/**
 * ============================================================================
 * Skills OpenClaw - Design System CSS
 * ============================================================================
 * 
 * Dark Premium Theme inspired by Linear/Vercel
 * Mobile-first approach with fluid typography
 * 
 * ============================================================================
 */

/* ============================================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================================ */

:root {
    /* Background Colors */
    --bg-primary: #0a0a0b;
    --bg-secondary: #111113;
    --bg-surface: #18181b;
    --bg-elevated: #1f1f23;
    
    /* Border Colors */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.12);
    --border-accent: rgba(34, 197, 94, 0.5);
    
    /* Text Colors */
    --text-primary: #fafafa;
    --text-secondary: #a1a1aa;
    --text-tertiary: #71717a;
    --text-muted: #52525b;
    
    /* Accent Colors */
    --accent-green: #22c55e;
    --accent-green-light: #4ade80;
    --accent-blue: #3b82f6;
    --accent-blue-light: #60a5fa;
    --accent-purple: #a855f7;
    --accent-purple-light: #c084fc;
    --accent-cyan: #06b6d4;
    --accent-amber: #f59e0b;
    --accent-red: #ef4444;
    
    /* Gradients */
    --gradient-primary: linear-gradient(135deg, var(--accent-green) 0%, var(--accent-blue) 100%);
    --gradient-secondary: linear-gradient(135deg, var(--accent-blue) 0%, var(--accent-purple) 100%);
    --gradient-accent: linear-gradient(135deg, var(--accent-purple) 0%, var(--accent-cyan) 100%);
    --gradient-warm: linear-gradient(135deg, var(--accent-amber) 0%, var(--accent-red) 100%);
    --gradient-mesh: radial-gradient(at 40% 20%, rgba(34, 197, 94, 0.15) 0px, transparent 50%),
                     radial-gradient(at 80% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
                     radial-gradient(at 0% 50%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
                     radial-gradient(at 80% 50%, rgba(6, 182, 212, 0.1) 0px, transparent 50%),
                     radial-gradient(at 0% 100%, rgba(34, 197, 94, 0.1) 0px, transparent 50%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.4);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 8px 10px -6px rgba(0, 0, 0, 0.4);
    --shadow-glow-green: 0 0 20px rgba(34, 197, 94, 0.3), 0 0 40px rgba(34, 197, 94, 0.1);
    --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3), 0 0 40px rgba(59, 130, 246, 0.1);
    --shadow-glow-purple: 0 0 20px rgba(168, 85, 247, 0.3), 0 0 40px rgba(168, 85, 247, 0.1);
    
    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;
    --space-4xl: 6rem;
    
    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-full: 9999px;
    
    /* Transitions */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 200ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
    
    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-fixed: 300;
    --z-modal-backdrop: 400;
    --z-modal: 500;
    --z-toast: 600;
}

/* ============================================================================
   BASE STYLES
   ============================================================================ */

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
}

/* Typography Scale - Fluid with clamp() */
h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 600;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

h1 { font-size: clamp(2.25rem, 5vw + 1rem, 4.5rem); font-weight: 700; }
h2 { font-size: clamp(1.875rem, 4vw + 0.5rem, 3rem); }
h3 { font-size: clamp(1.5rem, 3vw + 0.25rem, 2rem); }
h4 { font-size: clamp(1.25rem, 2vw + 0.25rem, 1.5rem); }
h5 { font-size: clamp(1.125rem, 1.5vw + 0.25rem, 1.25rem); }
h6 { font-size: 1rem; }

p {
    color: var(--text-secondary);
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--transition-fast);
}

/* ============================================================================
   GLASSMORPHISM UTILITIES
   ============================================================================ */

.glass {
    background: rgba(24, 24, 27, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-default);
}

.glass-light {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-subtle);
}

.glass-strong {
    background: rgba(24, 24, 27, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border-strong);
}

/* ============================================================================
   GRADIENT UTILITIES
   ============================================================================ */

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-text-secondary {
    background: var(--gradient-secondary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.gradient-bg {
    background: var(--gradient-primary);
}

.gradient-bg-secondary {
    background: var(--gradient-secondary);
}

.gradient-border {
    position: relative;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    padding: 1px;
    border-radius: inherit;
    background: var(--gradient-primary);
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
}

.mesh-gradient {
    background: var(--gradient-mesh);
}

/* Animated mesh gradient background */
.mesh-gradient-animated {
    position: relative;
    overflow: hidden;
}

.mesh-gradient-animated::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: 
        radial-gradient(circle at 20% 20%, rgba(34, 197, 94, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 80% 20%, rgba(59, 130, 246, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 40% 60%, rgba(168, 85, 247, 0.15) 0%, transparent 40%),
        radial-gradient(circle at 80% 80%, rgba(6, 182, 212, 0.15) 0%, transparent 40%);
    animation: meshMove 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes meshMove {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    25% { transform: translate(5%, 5%) rotate(5deg); }
    50% { transform: translate(-5%, 10%) rotate(-5deg); }
    75% { transform: translate(10%, -5%) rotate(3deg); }
}

/* ============================================================================
   BUTTON STYLES
   ============================================================================ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    font-size: 0.9375rem;
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    cursor: pointer;
    border: none;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: white;
    box-shadow: var(--shadow-md), 0 0 0 0 rgba(34, 197, 94, 0);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg), var(--shadow-glow-green);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-surface);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
}

.btn-secondary:hover {
    background: var(--bg-elevated);
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid transparent;
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

/* Shimmer effect for CTA buttons - Fixed for CLS prevention */
.btn-shimmer {
    position: relative;
    overflow: hidden;
    /* Ensure button has explicit dimensions */
    contain: layout style;
}

.btn-shimmer::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.2),
        transparent
    );
    animation: shimmer 3s infinite;
    pointer-events: none;
    /* Prevent layout shift */
    will-change: left;
    transform: translateZ(0);
}

@keyframes shimmer {
    0% { left: -100%; }
    50%, 100% { left: 100%; }
}

/* ============================================================================
   CARD STYLES
   ============================================================================ */

.card {
    background: var(--bg-surface);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: var(--space-lg);
    transition: all var(--transition-base);
}

.card:hover {
    border-color: var(--border-strong);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-glow:hover {
    box-shadow: var(--shadow-lg), var(--shadow-glow-green);
    border-color: rgba(34, 197, 94, 0.3);
}

.card-interactive {
    cursor: pointer;
}

.card-interactive:hover {
    background: var(--bg-elevated);
}

/* ============================================================================
   INPUT STYLES
   ============================================================================ */

.input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    color: var(--text-primary);
    font-size: 1rem;
    transition: all var(--transition-fast);
}

.input::placeholder {
    color: var(--text-muted);
}

.input:focus {
    outline: none;
    border-color: var(--accent-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1), var(--shadow-glow-green);
}

.input:hover:not(:focus) {
    border-color: var(--border-strong);
}

/* ============================================================================
   BADGE STYLES
   ============================================================================ */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius-full);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid var(--border-default);
}

.badge-success {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--accent-green-light);
}

.badge-info {
    background: rgba(59, 130, 246, 0.1);
    border-color: rgba(59, 130, 246, 0.3);
    color: var(--accent-blue-light);
}

.badge-warning {
    background: rgba(245, 158, 11, 0.1);
    border-color: rgba(245, 158, 11, 0.3);
    color: var(--accent-amber);
}

.badge-live {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
}

.badge-live::before {
    content: '';
    width: 0.5rem;
    height: 0.5rem;
    background: var(--accent-green);
    border-radius: 50%;
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.2); }
}

/* ============================================================================
   ANIMATION KEYFRAMES
   ============================================================================ */

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes glow-pulse {
    0%, 100% { 
        box-shadow: 0 0 20px rgba(34, 197, 94, 0.2);
    }
    50% { 
        box-shadow: 0 0 40px rgba(34, 197, 94, 0.4), 0 0 60px rgba(59, 130, 246, 0.2);
    }
}

@keyframes gradient-shift {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes rotate-slow {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Animation utility classes */
.animate-fade-in { animation: fadeIn 0.5s ease-out forwards; }
.animate-fade-in-up { animation: fadeInUp 0.5s ease-out forwards; }
.animate-fade-in-down { animation: fadeInDown 0.5s ease-out forwards; }
.animate-slide-in-left { animation: slideInLeft 0.5s ease-out forwards; }
.animate-slide-in-right { animation: slideInRight 0.5s ease-out forwards; }
.animate-scale-in { animation: scaleIn 0.3s ease-out forwards; }
.animate-float { animation: float 3s ease-in-out infinite; }
.animate-glow-pulse { animation: glow-pulse 3s ease-in-out infinite; }
.animate-gradient { 
    background-size: 200% 200%;
    animation: gradient-shift 4s ease infinite; 
}

/* Stagger delays for children */
.stagger-children > *:nth-child(1) { animation-delay: 0ms; }
.stagger-children > *:nth-child(2) { animation-delay: 50ms; }
.stagger-children > *:nth-child(3) { animation-delay: 100ms; }
.stagger-children > *:nth-child(4) { animation-delay: 150ms; }
.stagger-children > *:nth-child(5) { animation-delay: 200ms; }
.stagger-children > *:nth-child(6) { animation-delay: 250ms; }
.stagger-children > *:nth-child(7) { animation-delay: 300ms; }
.stagger-children > *:nth-child(8) { animation-delay: 350ms; }

/* Initially hidden for GSAP animations */
.gsap-reveal {
    opacity: 0;
    transform: translateY(30px);
}

.gsap-reveal-left {
    opacity: 0;
    transform: translateX(-30px);
}

.gsap-reveal-right {
    opacity: 0;
    transform: translateX(30px);
}

.gsap-reveal-scale {
    opacity: 0;
    transform: scale(0.9);
}

/* ============================================================================
   NAVIGATION SPECIFIC
   ============================================================================ */

.nav-link {
    position: relative;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9375rem;
    padding: 0.5rem 0;
    transition: color var(--transition-fast);
}

.nav-link:hover {
    color: var(--text-primary);
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width var(--transition-base);
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.active {
    color: var(--text-primary);
}

.nav-link.active::after {
    width: 100%;
}

/* ============================================================================
   SECTION STYLES
   ============================================================================ */

.section {
    padding: var(--space-4xl) 0;
}

.section-sm {
    padding: var(--space-2xl) 0;
}

.section-lg {
    padding: calc(var(--space-4xl) * 1.5) 0;
}

.container {
    width: 100%;
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 var(--space-md);
}

@media (min-width: 640px) {
    .container {
        padding: 0 var(--space-lg);
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 var(--space-xl);
    }
}

/* ============================================================================
   SCROLLBAR STYLES
   ============================================================================ */

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-elevated);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ============================================================================
   SELECTION STYLES
   ============================================================================ */

::selection {
    background: rgba(34, 197, 94, 0.3);
    color: var(--text-primary);
}

/* ============================================================================
   REDUCED MOTION
   ============================================================================ */

@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;
    }
    
    .gsap-reveal,
    .gsap-reveal-left,
    .gsap-reveal-right,
    .gsap-reveal-scale {
        opacity: 1;
        transform: none;
    }
}

/* ============================================================================
   UTILITY CLASSES
   ============================================================================ */

.text-balance {
    text-wrap: balance;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

.no-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
}

.no-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Dot pattern background */
.dot-pattern {
    background-image: radial-gradient(rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 24px 24px;
}

/* Grid pattern background */
.grid-pattern {
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
}

/* Noise texture overlay */
.noise-overlay::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
    opacity: 0.03;
    pointer-events: none;
}

/* ============================================================================
   ARTICLE CONTENT - Enhanced Readability
   ============================================================================ */

.article-content {
    font-size: 1.0625rem;
    line-height: 1.85;
}

@media (min-width: 768px) {
    .article-content {
        font-size: 1.125rem;
    }
}

/* Extra spacing between consecutive paragraphs */
.article-content p + p {
    margin-top: 1.75em;
}

/* Headings - more breathing room */
.article-content h2 {
    margin-top: 3em;
    margin-bottom: 1em;
    padding-bottom: 0.5em;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.article-content h3 {
    margin-top: 2.25em;
    margin-bottom: 0.75em;
}

.article-content h2 + h3 {
    margin-top: 1.25em;
}

/* Lists - airy spacing */
.article-content ul,
.article-content ol {
    margin-top: 1.5em;
    margin-bottom: 1.5em;
    padding-left: 1.5em;
}

.article-content li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
    padding-left: 0.5em;
    line-height: 1.75;
}

.article-content li > ul,
.article-content li > ol {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

/* Code blocks - generous padding */
.article-content pre {
    margin-top: 2em;
    margin-bottom: 2em;
    padding: 1.5em;
    border-radius: 0.75rem;
    overflow-x: auto;
}

.article-content code {
    font-size: 0.875em;
}

/* Blockquotes - standout design */
.article-content blockquote {
    margin-top: 2em;
    margin-bottom: 2em;
    padding: 1.25em 1.5em;
    border-left-width: 3px;
}

.article-content blockquote p {
    margin: 0.5em 0;
}

/* Images - full breathing room */
.article-content img {
    margin-top: 2.5em;
    margin-bottom: 2.5em;
}

/* Tables */
.article-content table {
    margin-top: 2em;
    margin-bottom: 2em;
    width: 100%;
    border-collapse: collapse;
}

.article-content th,
.article-content td {
    padding: 0.75em 1em;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}

.article-content th {
    background: rgba(255, 255, 255, 0.05);
    font-weight: 600;
    color: var(--text-primary);
}

.article-content td {
    color: var(--text-secondary);
}

/* Horizontal rules */
.article-content hr {
    margin-top: 3em;
    margin-bottom: 3em;
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}
