/* Base styles */
:root {
    --primary-color: #2563eb;
    --secondary-color: #3b82f6;
    --text-color: #1f2937;
    --bg-color: #ffffff;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-600: #4b5563;
    --container-width: 1200px;
    --header-height: 70px;
    --transition: all 0.3s ease;
    /* Derived RGB values for effects */
    --primary-rgb: 37, 99, 235;
    --text-rgb: 31, 41, 55;
    --border-color: var(--gray-200);
    /* Theming surfaces and corner lights (light theme defaults) */
    --bg: #fcfcfd; /* light background preference */
    --surface: #ffffff;
    --corner-color-1: 34, 139, 230; /* rgb values for subtle light */
    --corner-color-2: 99, 102, 241; /* rgb values for subtle light */
}

[data-theme="dark"] {
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --text-color: #ffffff;
    --bg-color: #0b0c0f; /* keep legacy var for existing rules */
    --gray-100: #111111;
    --gray-200: #1a1a1a;
    --gray-300: #222222;
    --gray-600: #999999;
    /* Dark surfaces and corner lights */
    --bg: #0b0c0f; /* or #07080a as alternate */
    --surface: #0f1115;
    --corner-color-1: 56, 189, 248;
    --corner-color-2: 99, 102, 241;
    --primary-rgb: 96, 165, 250;
    --text-rgb: 255, 255, 255;
    --border-color: rgba(255, 255, 255, 0.15);
}

/* Reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Global styles */
html {
    scroll-behavior: smooth;
}

/* SEO and Accessibility - Internal Links */
.internal-link {
    color: var(--primary-color);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: var(--transition);
}

.internal-link:hover {
    border-bottom-color: var(--primary-color);
    text-decoration: none;
}

/* Mobile Touch Targets - SEO Factor */
@media (max-width: 768px) {
    .btn, button, a, input, select, textarea {
        min-height: 44px;
        min-width: 44px;
    }
    
    .service-cta, .blog-link, .submit-btn {
        min-height: 48px;
        padding: 12px 24px;
    }
    
    .social-item, .footer-link {
        min-height: 44px;
        min-width: 44px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
}

body {
    font-family: 'Inter', sans-serif;
    line-height: 1.8;
    color: var(--text-color);
    background-color: var(--bg);
    transition: var(--transition);
}

/* Prevent horizontal overflow on small screens */
html, body {
    overflow-x: hidden;
}

/* Space for fixed navbar */
#content {
    display: block;
    padding-top: calc(var(--header-height) + 2.5rem);
}

/* Subtle global glow behind the page */
body::before {
    content: '';
    position: fixed;
    inset: -10% -10% -10% -10%;
    pointer-events: none;
    background:
        radial-gradient(600px 600px at 0% 0%, rgba(var(--corner-color-1), 0.10), transparent 70%),
        radial-gradient(500px 500px at 100% 0%, rgba(var(--corner-color-2), 0.08), transparent 70%),
        radial-gradient(500px 500px at 0% 100%, rgba(var(--corner-color-2), 0.08), transparent 70%),
        radial-gradient(600px 600px at 100% 100%, rgba(var(--corner-color-1), 0.10), transparent 70%);
    z-index: 0;
}

/* Corner light utility: attach to sections/containers that need extra glow */
.corner-light {
    position: relative;
    background-color: var(--bg);
}

.corner-light::before,
.corner-light::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 0;
}

.corner-light::before {
    background:
        radial-gradient(400px 400px at 0% 0%, rgba(var(--corner-color-1), 0.18), transparent 60%),
        radial-gradient(320px 320px at 100% 0%, rgba(var(--corner-color-2), 0.12), transparent 60%);
}

.corner-light::after {
    background:
        radial-gradient(360px 360px at 0% 100%, rgba(var(--corner-color-2), 0.10), transparent 60%),
        radial-gradient(420px 420px at 100% 100%, rgba(var(--corner-color-1), 0.14), transparent 60%);
}

/* Container */
.container {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 0 2rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    margin-bottom: 1.5rem;
    margin-top: 2.5rem;
    line-height: 1.4;
    font-weight: 600;
}

/* Paragraph spacing */
p {
    margin-bottom: 2rem;
    line-height: 1.8;
}

/* List spacing */
ul, ol {
    margin-bottom: 2rem;
    padding-left: 1.5rem;
    line-height: 1.8;
}

li {
    margin-bottom: 0.5rem;
    line-height: 1.8;
}

/* Code block spacing */
pre, code {
    margin-top: 1rem;
    margin-bottom: 1.5rem;
}

/* Code block styling with copy button */
pre {
    position: relative;
    background: var(--gray-100);
    border: 1px solid var(--gray-200);
    border-radius: 0.75rem;
    padding: 1.5rem;
    overflow-x: auto;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    font-size: 0.9rem;
    line-height: 1.6;
}

[data-theme="dark"] pre {
    background: rgba(0, 0, 0, 0.4);
    border-color: var(--gray-600);
    color: #e5e7eb;
}

.copy-code-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: rgba(var(--primary-rgb), 0.1);
    border: 1px solid rgba(var(--primary-rgb), 0.2);
    color: var(--primary-color);
    padding: 0.5rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(-5px);
}

pre:hover .copy-code-btn {
    opacity: 1;
    transform: translateY(0);
}

.copy-code-btn:hover {
    background: rgba(var(--primary-rgb), 0.2);
    border-color: rgba(var(--primary-rgb), 0.3);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.2);
}

.copy-code-btn.copied {
    background: rgba(34, 197, 94, 0.1);
    border-color: rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

/* Inline code styling */
code:not(pre code) {
    background: rgba(var(--primary-rgb), 0.1);
    color: var(--primary-color);
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
    font-size: 0.9em;
    font-family: 'Fira Code', 'Monaco', 'Consolas', monospace;
    border: 1px solid rgba(var(--primary-rgb), 0.2);
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    gap: 0.5rem;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--secondary-color);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: var(--gray-100);
    color: var(--text-color);
    border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
    background-color: var(--gray-200);
    transform: translateY(-2px);
}

[data-theme="dark"] .btn-secondary {
    border-color: var(--gray-600);
}

/* Sections */
section {
    padding: 5rem 0;
}

/* Component Separators */
.component-separator {
    position: relative;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    opacity: 0.8;
    margin: 0 20%;
    overflow: hidden;
    box-shadow: 
        0 0 8px rgba(var(--primary-rgb), 0.4),
        0 0 16px rgba(var(--primary-rgb), 0.2),
        0 0 24px rgba(var(--primary-rgb), 0.1);
}

.component-separator::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    animation: separatorGlow 3s ease-in-out infinite;
    box-shadow: 
        0 0 10px rgba(255, 255, 255, 0.5),
        0 0 20px rgba(255, 255, 255, 0.3),
        0 0 30px rgba(255, 255, 255, 0.1);
}

/* Reserve section space to reduce layout shifts */
.about, .services, .projects, .blog, .contact {
    content-visibility: auto;
    contain-intrinsic-size: 1px 900px;
}

@media (prefers-reduced-motion: reduce) {
    .component-separator::before {
        animation: none;
    }
}

/* Make links visually distinct beyond color */
.internal-link {
    text-decoration: underline;
    text-underline-offset: 2px;
}

.component-separator::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--primary-color), transparent);
    filter: blur(2px);
    opacity: 0.6;
    box-shadow: 
        0 0 6px rgba(var(--primary-rgb), 0.3),
        0 0 12px rgba(var(--primary-rgb), 0.2);
}

[data-theme="dark"] .component-separator {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.8), transparent);
    opacity: 0.6;
    box-shadow: 
        0 0 10px rgba(255, 255, 255, 0.3),
        0 0 20px rgba(255, 255, 255, 0.15),
        0 0 30px rgba(255, 255, 255, 0.08);
}

[data-theme="dark"] .component-separator::before {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
    box-shadow: 
        0 0 12px rgba(255, 255, 255, 0.4),
        0 0 24px rgba(255, 255, 255, 0.2),
        0 0 36px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .component-separator::after {
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.7), transparent);
    filter: blur(3px);
    opacity: 0.4;
    box-shadow: 
        0 0 8px rgba(255, 255, 255, 0.2),
        0 0 16px rgba(255, 255, 255, 0.1);
}

@keyframes separatorGlow {
    0%, 100% {
        left: 0;
        opacity: 0.3;
    }
    50% {
        left: 0;
        opacity: 1;
    }
}

/* Utilities */
.text-center { text-align: center; }
.mb-1 { margin-bottom: 1rem; }
.mb-2 { margin-bottom: 2rem; }
.mb-3 { margin-bottom: 3rem; }
.mt-1 { margin-top: 1rem; }
.mt-2 { margin-top: 2rem; }
.mt-3 { margin-top: 3rem; }

/* Responsive */
@media (max-width: 1200px) {
    .container {
        max-width: 960px;
    }
}

@media (max-width: 992px) {
    .container {
        max-width: 720px;
    }
}

@media (max-width: 768px) {
    .container {
        max-width: 540px;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
    h4 { font-size: 1.25rem; }
}

@media (max-width: 576px) {
    .container {
        width: 100%;
        padding: 0 1.5rem;
    }
}