/* Custom CSS for Personal Blog - Modern Tech Design */

/* Root variables for consistent theming */
:root {
    /* Light theme colors */
    --bg-primary: #fafbfc;
    --bg-secondary: #ffffff;
    --bg-accent: rgba(14, 165, 233, 0.05);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-accent: #0891b2;
    --border-color: rgba(148, 163, 184, 0.2);
    --border-accent: rgba(14, 165, 233, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.1);
    --gradient-primary: linear-gradient(135deg, #0891b2 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
}

:root.dark,
html.dark {
    /* Dark theme colors */
    --bg-primary: #0a0f1c;
    --bg-secondary: #1a2332;
    --bg-accent: rgba(14, 165, 233, 0.1);
    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-accent: #22d3ee;
    --border-color: rgba(148, 163, 184, 0.15);
    --border-accent: rgba(34, 211, 238, 0.3);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --gradient-primary: linear-gradient(135deg, #0891b2 0%, #3b82f6 100%);
    --gradient-accent: linear-gradient(135deg, #06b6d4 0%, #3b82f6 50%, #8b5cf6 100%);
}

/* Modern font stack */
.font-inter {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
}

.font-space {
    font-family: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.font-fira {
    font-family: 'Fira Code', 'SF Mono', Monaco, 'Cascadia Code', 'Roboto Mono', Consolas, 'Courier New', monospace;
}

/* Modern scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

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

/* Smooth transitions for all elements */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}

/* Modern glass effect utility */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.glass-effect-dark {
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Enhanced card styles */
.modern-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    transition: all 0.3s ease;
}

.modern-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 25px -5px var(--shadow-color);
    border-color: var(--border-accent);
}

/* Enhanced button styles */
.modern-btn {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.modern-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.modern-btn:hover::before {
    left: 100%;
}

/* Force dark mode styles when dark class is present */
html.dark,
html.dark body {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
}

/* Enhanced post card styles */
.post-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.post-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-accent);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.post-card:hover::before {
    transform: scaleX(1);
}

.post-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 25px 50px -12px var(--shadow-color);
    border-color: var(--border-accent);
}

/* Tag styles */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.75rem;
    background: var(--bg-accent);
    color: var(--text-accent);
    border: 1px solid var(--border-accent);
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.tag:hover {
    background: var(--text-accent);
    color: white;
    transform: scale(1.05);
}

/* Category badge styles */
.category-badge {
    position: relative;
    overflow: hidden;
    background: var(--gradient-primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.category-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.6s ease;
}

.category-badge:hover::before {
    left: 100%;
}

/* Navigation active states */
.nav-link.active {
    background: var(--gradient-primary) !important;
    color: white !important;
    box-shadow: 0 4px 15px rgba(14, 165, 233, 0.4);
    border-color: rgba(14, 165, 233, 0.3) !important;
}

.nav-link.active .nav-icon {
    background: rgba(255, 255, 255, 0.2) !important;
}

.nav-link.active span {
    color: white !important;
}

.nav-link.active svg {
    color: white !important;
}

/* Search results highlighting */
.search-highlight {
    background: linear-gradient(120deg, #fbbf24 0%, #f59e0b 100%);
    color: #92400e;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
    font-weight: 600;
}

/* Loading animation */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Syntax highlighting improvements */
pre[class*="language-"] {
    background: var(--bg-secondary) !important;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
}

code[class*="language-"] {
    color: var(--text-primary) !important;
    font-family: var(--font-fira);
}

/* Ripple effect */
.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: scale(0);
    animation: ripple 0.6s linear;
    pointer-events: none;
}

@keyframes ripple {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Enhanced entrance animations */
.animate-in {
    animation: slideInUp 0.6s ease-out forwards;
}

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

/* Line clamp utility */
.line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Custom focus styles */
input:focus,
button:focus,
a:focus {
    outline: 2px solid var(--text-accent);
    outline-offset: 2px;
}

/* Enhanced gradient backgrounds */
.gradient-mesh {
    background: 
        radial-gradient(at 40% 20%, rgba(14, 165, 233, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 0%, rgba(59, 130, 246, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 50%, rgba(139, 92, 246, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 50%, rgba(236, 72, 153, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 100%, rgba(6, 182, 212, 0.3) 0px, transparent 50%),
        radial-gradient(at 80% 100%, rgba(16, 185, 129, 0.3) 0px, transparent 50%),
        radial-gradient(at 0% 0%, rgba(249, 115, 22, 0.3) 0px, transparent 50%);
}

/* Modern button hover effects */
.modern-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
}

/* Enhanced card shadows */
.shadow-glow {
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(14, 165, 233, 0.1);
}

.shadow-glow:hover {
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(14, 165, 233, 0.2),
        0 0 20px rgba(14, 165, 233, 0.1);
}

/* Text gradient utilities */
.text-gradient-accent {
    background: linear-gradient(135deg, #0891b2 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-gradient-rainbow {
    background: linear-gradient(135deg, #06b6d4 0%, #3b82f6 25%, #8b5cf6 50%, #ec4899 75%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

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

.dark .skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
    background-size: 200% 100%;
}

/* Responsive utilities */
@media (max-width: 768px) {
    .text-5xl {
        font-size: 2.5rem;
    }
    
    .text-6xl {
        font-size: 3rem;
    }
    
    .text-7xl {
        font-size: 3.5rem;
    }
}

/* Print styles */
@media print {
    .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    .post-card,
    .modern-card {
        break-inside: avoid;
        border: 1px solid #e5e7eb;
        box-shadow: none;
    }
}

html.dark .border-gray-200 {
    border-color: #374151 !important;
}

/* Smooth transitions */
* {
    transition: color 0.3s ease, background-color 0.3s ease;
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dark ::-webkit-scrollbar-track {
    background: #374151;
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Active navigation link */
.nav-link.active {
    background-color: #0d9488;
    color: white;
}

.dark .nav-link.active {
    background-color: #0d9488;
    color: white;
}

/* Post content styling */
.post-content {
    line-height: 1.8;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4,
.post-content h5,
.post-content h6 {
    font-family: 'Merriweather', serif;
    font-weight: 700;
    margin-top: 2rem;
    margin-bottom: 1rem;
}

.post-content h1 { font-size: 2rem; }
.post-content h2 { font-size: 1.75rem; }
.post-content h3 { font-size: 1.5rem; }
.post-content h4 { font-size: 1.25rem; }
.post-content h5 { font-size: 1.125rem; }
.post-content h6 { font-size: 1rem; }

.post-content p {
    margin-bottom: 1.5rem;
}

.post-content ul,
.post-content ol {
    margin-bottom: 1.5rem;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content a {
    color: #0d9488;
    text-decoration: underline;
}

.post-content a:hover {
    color: #0f766e;
}

.dark .post-content a {
    color: #5eead4;
}

.dark .post-content a:hover {
    color: #7dd3fc;
}

.post-content img {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin: 2rem 0;
    max-width: 100%;
    height: auto;
}

.post-content blockquote {
    border-left: 4px solid #0d9488;
    padding-left: 1rem;
    margin: 1.5rem 0;
    font-style: italic;
    background-color: #f0fdfa;
    padding: 1rem;
    border-radius: 0.375rem;
}

.dark .post-content blockquote {
    background-color: #134e4a;
    border-left-color: #5eead4;
}

.post-content code {
    background-color: #f3f4f6;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-family: 'Courier New', monospace;
    font-size: 0.875rem;
}

.dark .post-content code {
    background-color: #374151;
}

.post-content pre {
    background-color: #1f2937;
    color: #f9fafb;
    padding: 1rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
}

/* Tag styling */
.tag {
    display: inline-block;
    background-color: #e5f3f2;
    color: #0d9488;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
    margin: 0.25rem;
    transition: all 0.2s ease;
}

.tag:hover {
    background-color: #0d9488;
    color: white;
    cursor: pointer;
}

.dark .tag {
    background-color: #134e4a;
    color: #5eead4;
}

.dark .tag:hover {
    background-color: #0d9488;
    color: white;
}

/* Post card hover effects */
.post-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.dark .post-card:hover {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.3), 0 4px 6px -2px rgba(0, 0, 0, 0.2);
}

/* Reading time badge */
.reading-time {
    background-color: #fef7ed;
    color: #ea580c;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.dark .reading-time {
    background-color: #431407;
    color: #fb923c;
}

/* Share button styling */
.share-btn {
    transition: all 0.2s ease;
}

.share-btn:hover {
    transform: scale(1.05);
}

/* Search highlight */
.search-highlight {
    background-color: #fef08a;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

.dark .search-highlight {
    background-color: #ca8a04;
    color: #1f2937;
}

/* Loading animation */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.5s ease-out;
}

/* Custom utilities */
.text-shadow {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.backdrop-blur {
    backdrop-filter: blur(10px);
}

/* Print styles */
@media print {
    .sidebar,
    #scrollToTop,
    .share-buttons {
        display: none !important;
    }
    
    main {
        margin-left: 0 !important;
    }
    
    .post-content {
        color: black !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .post-content a {
        text-decoration: underline;
        font-weight: bold;
    }
    
    .tag {
        border: 2px solid currentColor;
    }
}

/* 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;
    }
}

/* Focus styles for accessibility */
button:focus,
input:focus,
a:focus {
    outline: 2px solid #0d9488;
    outline-offset: 2px;
}

/* Mobile-specific styles */
@media (max-width: 1024px) {
    .post-content {
        font-size: 1rem;
    }
    
    .post-content h1 { font-size: 1.75rem; }
    .post-content h2 { font-size: 1.5rem; }
    .post-content h3 { font-size: 1.25rem; }
}
