:root {
    --bg-color: #ffffff;
    --text-color: #111111;
    --accent-color: #111111;
    --secondary-text: #666666;
    --card-bg: #f5f5f5;
    --border-color: #e0e0e0;
    --transition-speed: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
    --bg-color: #050505;
    --text-color: #ffffff;
    --accent-color: #ffffff;
    --secondary-text: #a0a0a0;
    --card-bg: #111111;
    --border-color: #333333;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    transition: background-color var(--transition-speed), color var(--transition-speed);
    line-height: 1.6;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.7;
}

header {
    position: fixed;
    top: 0;
    width: 100%;
    padding: 2rem 5%;
    display: flex;
    justify-content: center;
    z-index: 1000;
    background: rgba(var(--bg-color), 0.8);
    backdrop-filter: blur(10px);
}

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    max-width: 1200px;
}

.logo {
    font-weight: 800;
    font-size: 1.5rem;
    letter-spacing: -0.05em;
}

.nav-links {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    position: relative;
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 1px;
    background-color: var(--text-color);
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--text-color) !important;
}

#theme-toggle {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.hero {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 0 5%;
    position: relative;
    overflow: hidden;
}

#neural-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

.hero-content {
    position: relative;
    z-index: 1;
}


.profile-container {
    width: 150px;
    height: 150px;
    margin-bottom: 2rem;
    border-radius: 50%;
    overflow: hidden;
    filter: grayscale(100%);
    transition: filter 0.5s ease;
}

.profile-container:hover {
    filter: grayscale(0%);
}

.profile-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

h1 {
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1rem;
    animation: fadeInUp 0.8s ease-out;
}

.subtitle {
    font-size: 1.25rem;
    color: var(--secondary-text);
    font-weight: 300;
    animation: fadeInUp 1s ease-out 0.2s backwards;
}

.section {
    padding: 5rem 5%;
    display: flex;
    justify-content: center;
}

.section.page-start {
    padding-top: 9rem;
}

.container {
    width: 100%;
    max-width: 1200px;
}

.section-title {
    font-size: 2rem;
    font-weight: 600;
    margin-bottom: 2.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
    display: inline-block;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
}

.card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

.card {
    background: var(--card-bg);
    padding: 2.5rem;
    border-radius: 1px;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.card:hover {
    border-color: var(--text-color);
    transform: translateY(-5px);
}

.icon {
    font-size: 2rem;
    margin-bottom: 1.5rem;
    display: block;
}

.card h3 {
    margin-bottom: 1rem;
    font-weight: 600;
}

.card p {
    color: var(--secondary-text);
    font-size: 0.95rem;
}

.mini-card {
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.mini-card:hover {
    background: var(--text-color);
    color: var(--bg-color);
}

.blog-author {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1rem;
}

.blog-author img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--accent-color);
}

.blog-author-info {
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    line-height: 1.2;
}

.blog-author-name {
    font-weight: 600;
    color: var(--text-color);
}

.blog-date {
    color: var(--secondary-text);
    font-size: 0.75rem;
}

.card-icon {
    font-size: 1.5rem;
}

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.tag {
    padding: 0.8rem 1.5rem;
    border: 1px solid var(--border-color);
    border-radius: 100px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s;
    cursor: default;
    display: inline-flex;
    align-items: center;
    gap: 0;
    /* Starts with 0 gap */
    overflow: hidden;
    /* Hide icon when width is 0 */
}

.tag i {
    display: inline-block;
    vertical-align: middle;
    font-size: 1.2rem;
    max-width: 0;
    opacity: 0;
    filter: blur(10px) grayscale(100%);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    /* Slower, diffusion-like reveal */
    transform: scale(0.5);
    margin-right: 0;
}

.tag:hover {
    background: var(--text-color);
    color: var(--bg-color);
    border-color: var(--text-color);
    gap: 0.5rem;
    /* Open gap on hover */
    padding-right: 1.2rem;
    /* Minor adjustment for visual balance */
}

.tag:hover i {
    max-width: 1.5rem;
    /* Reveal width */
    opacity: 1;
    filter: blur(0) grayscale(0);
    /* The 'Diffusion' resolve effect */
    transform: scale(1);
    margin-right: 0.2rem;
}

footer {
    padding: 4rem 5%;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 0 auto;
}

.socials {
    display: flex;
    gap: 1.5rem;
    font-size: 1.2rem;
}

/* Scramble Effect Duds */
.dud {
    color: var(--secondary-text);
    opacity: 0.7;
}

.reveal-3d {
    opacity: 0;
    transform: perspective(1000px) rotateX(20deg) translateY(50px) scale(0.9);
    transition: all 0.8s cubic-bezier(0.2, 0.8, 0.2, 1);
    will-change: transform, opacity;
}

.reveal-3d.active {
    opacity: 1;
    transform: perspective(1000px) rotateX(0) translateY(0) scale(1);
}

/* Mermaid Flowchart Styling */
.mermaid svg {
    max-width: 100% !important;
    height: auto !important;
}

/* Flowing Animation for Connections */
/* Flowing Animation for Connections */
.mermaid .edgePaths path,
.mermaid .flowchart-link {
    stroke-dasharray: 10;
    animation: flowAnimation 1s linear infinite;
}

@keyframes flowAnimation {
    from {
        stroke-dashoffset: 20;
    }

    to {
        stroke-dashoffset: 0;
    }
}

/* Red & Black Theme Overrides for Mermaid */
/* Target internal SVG elements rendered by Mermaid */
.mermaid .node rect,
.mermaid .node circle,
.mermaid .node polygon,
.mermaid .node path {
    fill: #000000 !important;
    stroke: #ff0000 !important;
    stroke-width: 2px !important;
}

.mermaid .node .label,
.mermaid .label {
    color: #ff0000 !important;
    fill: #ff0000 !important;
    font-weight: 600 !important;
}

.mermaid .edgeLabel {
    background-color: #000000 !important;
    color: #ff0000 !important;
}

.mermaid .edgeLabel rect {
    fill: #000000 !important;
    opacity: 1 !important;
}

.mermaid .edgePath .path {
    stroke: #ff0000 !important;
    stroke-width: 2px !important;
}

.mermaid .marker {
    fill: #ff0000 !important;
    stroke: #ff0000 !important;
}

/* Scale down Mermaid diagrams in blog content for medium size */
.blog-content .mermaid {
    display: flex;
    justify-content: center;
    width: 100%;
    margin-bottom: 2rem;
}

.blog-content .mermaid svg {
    max-width: 75% !important;
    height: auto !important;
}

/* Ensure font scaling matches box calculation */
.mermaid .node .label,
.mermaid .label,
.mermaid .edgeLabel {
    font-family: 'Inter', sans-serif !important;
    font-size: 14px !important;
}

.hero-content {
    /* 3D tilt effect on hover for hero */
    transition: transform 0.2s ease-out;
    transform-style: preserve-3d;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.5rem;
    }

    nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        display: flex;
        gap: 1.2rem;
        flex-wrap: wrap;
        justify-content: center;
    }

    .logo {
        margin: 0;
    }

    .footer-content {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

/* AI-Themed Read More Button */
.ai-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    color: var(--text-color);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: var(--bg-color);
    overflow: hidden;
    transition: all 0.3s ease;
    z-index: 1;
}

.ai-btn i {
    transition: transform 0.3s ease;
}

.ai-btn:hover {
    border-color: var(--text-color);
    color: var(--text-color);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
}

.ai-btn:hover i {
    transform: translateX(4px);
}

.ai-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 200%;
    height: 100%;
    background: linear-gradient(120deg,
            transparent 30%,
            rgba(var(--text-color), 0.1) 45%,
            rgba(var(--text-color), 0.2) 50%,
            rgba(var(--text-color), 0.1) 55%,
            transparent 70%);
    transition: left 0.6s ease;
    z-index: -1;
}

.ai-btn:hover::before {
    left: 100%;
    transition: left 0.6s ease;
}