:root {
    --bg-color: #0f172a;
    --panel-bg: rgba(30, 41, 59, 0.7);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --card-bg: rgba(30, 41, 59, 0.5);
    --border: rgba(255, 255, 255, 0.1);
}

/* Light mode */
body.light {
    --bg-color: #f1f5f9;
    --panel-bg: rgba(255, 255, 255, 0.8);
    --text-main: #0f172a;
    --text-muted: #475569;
    --accent: #2563eb;
    --accent-hover: #3b82f6;
    --card-bg: rgba(255, 255, 255, 0.7);
    --border: rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image: 
        radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(139, 92, 246, 0.15) 0px, transparent 50%);
    background-attachment: fixed;
    color: var(--text-main);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ── Sidebar ── */
.sidebar {
    width: 280px;
    background: var(--panel-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-right: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), background 0.3s ease;
}

.brand {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 3rem;
    background: linear-gradient(to right, #60a5fa, #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.nav-links li a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: 500;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    display: block;
    transition: all 0.3s ease;
}

.nav-links li a:hover, .nav-links li a.active {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    transform: translateX(5px);
}

body.light .nav-links li a:hover,
body.light .nav-links li a.active {
    background: rgba(0, 0, 0, 0.06);
}

/* ── Main Content ── */
.main-content {
    margin-left: 280px;
    padding: 4rem;
    flex: 1;
    width: calc(100% - 280px);
}

.page-title {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 2rem;
    letter-spacing: -0.025em;
}

/* ── Cards ── */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border);
    border-radius: 1rem;
    padding: 2rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
}

.card h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.card p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    background: rgba(59, 130, 246, 0.2);
    color: var(--accent-hover);
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* ── Text elements ── */
.lead-text {
    font-size: 1.25rem;
    color: var(--text-muted);
    line-height: 1.8;
    max-width: 800px;
    margin-bottom: 2rem;
}

.button {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 0.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    border: none;
    cursor: pointer;
}

.button:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

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

.animate-in {
    animation: fadeIn 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── Blog / prose content ── */
.prose h1, .prose h2, .prose h3, .prose h4 {
    color: var(--text-main);
    margin: 2rem 0 1rem;
    line-height: 1.3;
}
.prose p { color: var(--text-muted); line-height: 1.8; margin-bottom: 1.25rem; font-size: 1.05rem; }
.prose a { color: var(--accent); }
.prose a:hover { color: var(--accent-hover); }
.prose code {
    background: rgba(59, 130, 246, 0.12);
    color: #93c5fd;
    padding: 0.15em 0.4em;
    border-radius: 0.3rem;
    font-size: 0.9em;
    font-family: 'Fira Code', 'Fira Mono', monospace;
}
.prose pre {
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 1.5rem 0;
}
.prose pre code {
    background: none;
    color: inherit;
    padding: 0;
    font-size: 0.9rem;
}
.prose blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 1rem;
    margin: 1.5rem 0;
    color: var(--text-muted);
    font-style: italic;
}
.prose ul, .prose ol {
    padding-left: 1.5rem;
    color: var(--text-muted);
    line-height: 1.8;
    margin-bottom: 1rem;
}

/* ── Theme Toggle Button ── */
.theme-toggle {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 0.5rem;
    padding: 0.4rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--text-main);
}

/* ── Mobile: hamburger + slide-in sidebar ── */
.hamburger {
    display: none;
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 200;
    background: var(--panel-bg);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    padding: 0.5rem 0.65rem;
    cursor: pointer;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    gap: 5px;
}
.hamburger span {
    display: block;
    width: 22px;
    height: 2px;
    background: var(--text-main);
    border-radius: 2px;
    transition: all 0.3s ease;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
    backdrop-filter: blur(2px);
}
.sidebar-overlay.visible { display: block; }

.reading-time {
    display: inline-block;
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-left: 1rem;
}

/* ── highlight.js theme overrides ── */
.hljs { background: transparent !important; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .hamburger { display: flex; }

    .sidebar {
        transform: translateX(-100%);
        width: 280px;
        height: 100vh;
        position: fixed;
        top: 0;
        left: 0;
    }
    .sidebar.open { transform: translateX(0); }

    .main-content {
        margin-left: 0;
        width: 100%;
        padding: 2rem 1.25rem;
        padding-top: 4.5rem;
    }

    .page-title { font-size: 2rem; }
}
