/* Custom CSS for Janusz Czeropski Portfolio */

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

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

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

html.dark ::-webkit-scrollbar-track {
    background: #1f2937;
}

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

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

/* Fade-in animation for lazy loaded images */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Link hover effects */
a {
    transition: all 0.2s ease;
}

/* Button hover lift */
button, .btn {
    transition: all 0.2s ease;
}

button:hover, .btn:hover {
    transform: translateY(-1px);
}

button:active, .btn:active {
    transform: translateY(0);
}

/* Card hover effects */
.card-hover {
    transition: all 0.3s ease;
}

.card-hover:hover {
    transform: translateY(-4px);
}

/* Gradient text */
.gradient-text {
    background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Focus styles */
*:focus {
    outline: 2px solid #3b82f6;
    outline-offset: 2px;
}

*:focus:not(:focus-visible) {
    outline: none;
}

/* Selection color */
::selection {
    background-color: #3b82f6;
    color: white;
}

html.dark ::selection {
    background-color: #60a5fa;
    color: #1f2937;
}

/* Loading spinner */
.spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3b82f6;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Code blocks */
pre {
    position: relative;
}

pre code {
    display: block;
    overflow-x: auto;
    padding: 1rem;
}

/* Print styles */
@media print {
    nav, footer, .no-print {
        display: none !important;
    }
    
    body {
        background: white !important;
        color: black !important;
    }
    
    a {
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
}

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

/* Skip to content link */
.skip-to-content {
    position: absolute;
    top: -40px;
    left: 0;
    background: #3b82f6;
    color: white;
    padding: 8px;
    text-decoration: none;
    z-index: 100;
}

.skip-to-content:focus {
    top: 0;
}

/* Responsive utilities */
@media (max-width: 640px) {
    .text-responsive {
        font-size: clamp(1rem, 4vw, 2rem);
    }
}

/* Dark mode transitions */
.dark-transition {
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Image placeholder while loading */
img[loading="lazy"] {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

html.dark img[loading="lazy"] {
    background: linear-gradient(90deg, #374151 25%, #1f2937 50%, #374151 75%);
    background-size: 200% 100%;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Hero section animations */
@keyframes slideInFromLeft {
    0% {
        transform: translateX(-100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    0% {
        transform: translateX(100%);
        opacity: 0;
    }
    100% {
        transform: translateX(0);
        opacity: 1;
    }
}

.animate-slide-in-left {
    animation: slideInFromLeft 0.8s ease-out;
}

.animate-slide-in-right {
    animation: slideInFromRight 0.8s ease-out;
}

/* Pulse animation for CTA buttons */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.animate-pulse-slow {
    animation: pulse 3s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Code Block Improvements */
pre {
    background: #1e1e1e !important;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
    line-height: 1.6;
}

pre code {
    background: transparent !important;
    color: #d4d4d4;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.9rem;
    padding: 0;
    border: none;
}

/* Inline code */
code {
    background: #2d2d2d;
    color: #e06c75;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: "Consolas", "Monaco", "Courier New", monospace;
    font-size: 0.9em;
    border: 1px solid #444;
}

/* Dark mode adjustments */
.dark pre {
    background: #0d1117 !important;
    border-color: #30363d;
}

.dark code {
    background: #161b22;
    color: #ff7b72;
    border-color: #30363d;
}

/* Better paragraph spacing in blog posts */
.blog-content p {
    margin-bottom: 1.25rem;
    line-height: 1.8;
}

.blog-content h2 {
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    font-size: 1.75rem;
    font-weight: 700;
}

.blog-content h3 {
    margin-top: 2rem;
    margin-bottom: 0.75rem;
    font-size: 1.4rem;
    font-weight: 600;
}

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

.blog-content li {
    margin-bottom: 0.5rem;
    line-height: 1.7;
}

/* Copy button for code blocks */
pre {
    position: relative;
}

pre::before {
    content: "Code";
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    font-size: 0.75rem;
    color: #888;
    font-family: system-ui, -apple-system, sans-serif;
}
