/* Modern Design System Enhancement */

/* Enhanced Typography */
:root {
    /* Existing vars... */
    --font-display: 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-body: 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Menlo', 'Cascadia Code', monospace;
    
    /* Modern gradients */
    --gradient-primary: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
    --gradient-secondary: linear-gradient(135deg, #06b6d4 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    
    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
    --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
    
    /* Animation */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Enhanced body */
body {
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Focus visible for accessibility */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Skip to main content link (accessibility) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--accent);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 0 0 4px 0;
    z-index: 100;
}

.skip-link:focus {
    top: 0;
}

/* Enhanced navigation */
header {
    backdrop-filter: blur(12px);
    background: rgba(10, 10, 15, 0.8);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

nav {
    transition: all var(--transition-base);
}

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

.logo:hover {
    transform: scale(1.05);
}

.nav-links a {
    position: relative;
    transition: color var(--transition-fast);
}

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

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

/* Enhanced hero section */
.hero h1 {
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: -0.02em;
    animation: fadeInUp 0.8s ease-out;
}

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

/* Modern card design */
.tool-card {
    position: relative;
    overflow: hidden;
    transition: all var(--transition-base);
}

.tool-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity var(--transition-base);
    z-index: 0;
}

.tool-card:hover::before {
    opacity: 0.05;
}

.tool-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl), var(--shadow-glow);
}

.tool-card > * {
    position: relative;
    z-index: 1;
}

.tool-icon {
    transition: transform var(--transition-base);
}

.tool-card:hover .tool-icon {
    transform: scale(1.1) rotate(5deg);
}

/* Enhanced buttons */
.btn-primary {
    position: relative;
    overflow: hidden;
    background: var(--gradient-primary);
    transition: all var(--transition-base);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn-primary:hover::before {
    width: 300px;
    height: 300px;
}

.btn-primary:active {
    transform: scale(0.98);
}

/* Loading animation for async actions */
@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.6s linear infinite;
}

/* Enhanced code blocks */
pre {
    position: relative;
    box-shadow: var(--shadow-md);
}

pre code {
    display: block;
    line-height: 1.6;
}

/* Copy button for code blocks */
.code-block-wrapper {
    position: relative;
}

.copy-code-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 6px;
    padding: 6px 12px;
    color: var(--text);
    cursor: pointer;
    font-size: 0.75rem;
    opacity: 0;
    transition: all var(--transition-fast);
}

.code-block-wrapper:hover .copy-code-btn {
    opacity: 1;
}

.copy-code-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Enhanced status messages */
.status {
    animation: slideIn 0.3s ease-out;
}

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

/* Skeleton loading for async content */
.skeleton {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--border) 50%, var(--bg-secondary) 75%);
    background-size: 200% 100%;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Blog post enhancements */
article {
    animation: fadeInUp 0.6s ease-out;
}

article h2 {
    font-family: var(--font-display);
    font-weight: 600;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    scroll-margin-top: 100px; /* For smooth anchor scroll */
}

article h3 {
    font-weight: 600;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

article p {
    line-height: 1.75;
    color: var(--text);
    margin-bottom: 1.25rem;
}

article a {
    color: var(--accent);
    text-decoration: none;
    position: relative;
    transition: color var(--transition-fast);
}

article a:hover {
    color: var(--accent-hover);
}

article a::after {
    content: '';
    position: absolute;
    bottom: -1px;
    left: 0;
    width: 100%;
    height: 1px;
    background: currentColor;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--transition-base);
}

article a:hover::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Table of contents (for long posts) */
.toc {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 2rem 0;
}

.toc h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}

.toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc li {
    margin-bottom: 0.5rem;
}

.toc a {
    color: var(--text-muted);
    transition: all var(--transition-fast);
    padding: 0.25rem 0.5rem;
    display: inline-block;
    border-radius: 4px;
}

.toc a:hover {
    color: var(--accent);
    background: rgba(139, 92, 246, 0.1);
}

/* Reading progress bar */
.reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--gradient-primary);
    z-index: 9999;
    transition: width 0.1s ease-out;
}

/* Responsive images */
article img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
}

/* Callout boxes */
.callout {
    background: var(--bg-secondary);
    border-left: 4px solid var(--accent);
    padding: 1.5rem;
    margin: 2rem 0;
    border-radius: 0 8px 8px 0;
    box-shadow: var(--shadow-sm);
}

.callout-info { border-left-color: #3b82f6; }
.callout-warning { border-left-color: #f59e0b; }
.callout-error { border-left-color: #ef4444; }
.callout-success { border-left-color: #22c55e; }

/* Accessibility improvements */
[aria-hidden="true"] {
    display: none !important;
}

/* Screen reader only content */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

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

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --bg: #000000;
        --text: #ffffff;
        --border: #ffffff;
    }
}

/* Print styles */
@media print {
    header, footer, .nav-links, .btn-row {
        display: none;
    }
    
    body {
        background: white;
        color: black;
    }
    
    a {
        color: black;
        text-decoration: underline;
    }
    
    pre {
        border: 1px solid black;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 768px) {
    .hero h1 {
        font-size: 2rem;
    }
    
    .tool-card:hover {
        transform: none; /* Disable hover lift on touch devices */
    }
    
    article h2 {
        font-size: 1.5rem;
    }
}

/* Dark mode enhancements (already dark, but prepare for light mode toggle) */
@media (prefers-color-scheme: light) {
    /* Future: light mode support */
}
