/* =========================
   Design System & Premium Styles
   ========================= */

:root {
    --font-heading: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Premium Color Palette (Default: Dark) */
    --background: #020617;
    --background-alt: #0f172a;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --card-bg: rgba(15, 23, 42, 0.6);
    --card-border: rgba(255, 255, 255, 0.06);
    --glass-bg: rgba(2, 6, 23, 0.8);
    --accent: #818cf8;
    --accent-glow: rgba(129, 140, 248, 0.2);
    --grid-opacity: rgba(255, 255, 255, 0.03);

    /* Syntax Highlighting - Dark */
    --z-comment: #5c6370;
    --z-string: #98c379;
    --z-keyword: #c678dd;
    --z-function: #61afef;
    --z-variable: #e06c75;
    --z-number: #d19a66;
    --z-constant: #d19a66;
    --z-class: #e5c07b;
    --z-type: #56b6c2;
    --z-operator: #56b6c2;

    /* Premium Accent Gradient */
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.2);
    --card-shadow-hover: 0 20px 40px -15px rgba(0, 0, 0, 0.3);

    /* Animation Tokens */
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
}

[data-theme="light"] {
    --background: #ffffff;
    --background-alt: #f8fafc;
    --text: #0f172a;
    --text-muted: #64748b;
    --card-bg: rgba(255, 255, 255, 0.7);
    --card-border: rgba(0, 0, 0, 0.08);
    --glass-bg: rgba(255, 255, 255, 0.85);
    --accent: #4f46e5;
    --accent-glow: rgba(79, 70, 229, 0.15);
    --grid-opacity: rgba(0, 0, 0, 0.02);

    /* Syntax Highlighting - Light */
    --z-comment: #a0a1a7;
    --z-string: #50a14f;
    --z-keyword: #a626a4;
    --z-function: #4078f2;
    --z-variable: #e45649;
    --z-number: #986801;
    --z-constant: #986801;
    --z-class: #c18401;
    --z-type: #0184bc;
    --z-operator: #0184bc;
}

/* Base Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.animate-up {
    animation: fadeInUp 0.8s var(--ease-out-expo) both;
}

.animate-fade {
    animation: fadeIn 1s ease both;
}

/* Staggered dynamic delays - used to avoid inline style lints */
.delay-1 {
    animation-delay: 0.1s;
}

.delay-2 {
    animation-delay: 0.2s;
}

.delay-3 {
    animation-delay: 0.3s;
}

.delay-4 {
    animation-delay: 0.4s;
}

.delay-5 {
    animation-delay: 0.5s;
}

/* Reading Progress Bar */
#progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--accent-gradient);
    z-index: 1000;
    transition: width 0.1s ease-out;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    background-image:
        radial-gradient(at 0% 0%, rgba(99, 102, 241, 0.1) 0px, transparent 50%),
        radial-gradient(at 100% 100%, rgba(168, 85, 247, 0.1) 0px, transparent 50%),
        linear-gradient(to right, var(--grid-opacity) 1px, transparent 1px),
        linear-gradient(to bottom, var(--grid-opacity) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 40px 40px, 40px 40px;
    color: var(--text);
    font-family: var(--font-body);
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* Background Blobs */
.blob {
    position: fixed;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    border-radius: 50%;
    z-index: -1;
    pointer-events: none;
    filter: blur(80px);
    animation: blobMove 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
}

.blob-1 {
    top: -100px;
    left: -100px;
    animation-delay: 0s;
}

.blob-2 {
    bottom: -100px;
    right: -100px;
    animation-delay: -10s;
}

@keyframes blobMove {
    0% {
        transform: translate(0, 0) scale(1);
    }

    100% {
        transform: translate(100px, 50px) scale(1.1);
    }
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.02;
    pointer-events: none;
    z-index: 9999;
}

[data-theme="dark"] body::before {
    opacity: 0.04;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-family: var(--font-heading);
    font-weight: 700;
    letter-spacing: -0.02em;
}

.profile-img {
    border: 4px solid var(--card-border);
    box-shadow: var(--card-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.profile-img:hover {
    transform: scale(1.05) rotate(2deg);
    box-shadow: 0 0 30px var(--accent-glow);
    border-color: var(--accent);
}

/* Premium Selection Color to match accent */
::selection {
    background: var(--accent);
    color: white;
}

::-moz-selection {
    background: var(--accent);
    color: white;
}

/* Scroll Offset for sticky navigation */
h1,
h2,
h3,
h4,
h5,
h6 {
    scroll-margin-top: 6rem;
}

/* Global Link Resets */
a {
    outline: none;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

/* Hide the hash symbols from Zola anchors unless hovered */
.zola-anchor {
    text-decoration: none;
    font-size: 0.8em;
    margin-right: 0.5rem;
    color: var(--accent);
    opacity: 0.2;
    transition: opacity 0.3s ease;
}

h1:hover .zola-anchor,
h2:hover .zola-anchor,
h3:hover .zola-anchor {
    opacity: 1;
}

/* If the anchor is being displayed as a # prepended to text by some default style */
h1 a,
h2 a,
h3 a {
    text-decoration: none;
    color: inherit;
}

/* Modern Floating Pill Navigation */
#nav-bar {
    position: sticky;
    top: 1.5rem;
    z-index: 100;
    margin: 0 auto 3.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--card-border);
    border-radius: 99px;
    width: fit-content;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* Premium Navigation Links */
#nav-bar a {
    position: relative;
    padding: 0.6rem 1.2rem;
    text-decoration: none;
    font-weight: 600;
    font-family: var(--font-heading);
    font-size: 0.85rem;
    color: var(--text-muted);
    border-radius: 99px;
    letter-spacing: 0.02em;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#nav-bar a:hover {
    color: var(--accent);
    background: transparent;
    box-shadow: 0 0 15px var(--accent-glow);
    transform: translateY(-1px);
}

#nav-bar a.active {
    background: var(--card-bg);
    color: var(--accent);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] #nav-bar a:hover {
    background: transparent;
}

#nav-bar a::after {
    display: none;
    /* Remove old underline effect */
}

/* Theme Toggle Pill */
.theme-toggle {
    margin-left: 0.5rem;
    padding: 0.6rem;
    border-radius: 50%;
    background: transparent;
    border: 1px solid var(--card-border);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-muted);
}

.theme-toggle:hover {
    background: transparent;
    color: var(--accent);
    transform: rotate(15deg) scale(1.1);
    border-color: var(--accent);
    box-shadow: 0 0 15px var(--accent-glow);
}

.theme-toggle .icon {
    width: 1.2rem;
    height: 1.2rem;
}

/* Skill Chips */
.skill-container {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 1.5rem 0;
}

.skill-chip {
    padding: 0.5rem 1rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 99px;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
    cursor: default;
}

.skill-chip:hover {
    transform: translateY(-2px);
    border-color: var(--accent);
    box-shadow: 0 4px 12px var(--accent-glow);
    background: var(--background-alt);
}

.skill-chip span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-gradient);
}

/* Projects Section (Anticipating use) */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 2.5rem;
    height: 100%;
    transition: all 0.5s var(--ease-out-expo);
    box-shadow: var(--card-shadow);
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg,
            transparent,
            rgba(255, 255, 255, 0.05),
            transparent);
    transition: 0.5s;
    pointer-events: none;
}

.project-card:hover::before {
    left: 100%;
}

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--card-shadow-hover);
    border-color: var(--accent);
    background: var(--background-alt);
}

/* Global Strong/Bold Text refinement */
strong,
b {
    color: var(--accent);
    font-weight: 700;
}

/* Blockquote refinement */
blockquote {
    border-left: 4px solid var(--accent);
    padding: 1.5rem 2rem;
    background: var(--card-bg);
    border-radius: 0 16px 16px 0;
    font-style: italic;
    margin: 3rem 0;
    font-size: 1.1rem;
    color: var(--text-muted);
    backdrop-filter: blur(4px);
}

/* Blog & Content Listings */
.content-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.title-list {
    display: flex;
    align-items: baseline;
    gap: 1.5rem;
    padding: 1.25rem 1rem;
    border-bottom: 1px solid var(--card-border);
    transition: all 0.4s var(--ease-out-expo);
    border-radius: 12px;
}

.title-list:hover {
    background: var(--background-alt);
    padding-left: 1.5rem;
    transform: translateX(8px);
    border-color: var(--accent);
    box-shadow: inset 4px 0 0 var(--accent);
}

.content-meta {
    font-family: var(--font-heading);
    font-weight: 600;
    letter-spacing: 0.05em;
    font-size: 0.8rem;
    text-transform: uppercase;
    color: var(--text-muted);
    min-width: 100px;
}

.content-link {
    text-decoration: none;
    color: inherit;
    font-weight: 500;
    transition: color 0.3s ease;
}

.content-link:hover {
    color: var(--accent);
    background: none !important;
}

/* Premium Buttons */
.button {
    background: var(--accent-gradient);
    color: white;
    padding: 0.8rem 1.8rem;
    border-radius: 12px;
    font-weight: 600;
    font-family: var(--font-heading);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    box-shadow: 0 4px 15px var(--accent-glow);
    border: none;
    cursor: pointer;
    text-decoration: none;
}

.button:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 8px 25px var(--accent-glow);
    filter: brightness(1.1);
}

.button:active {
    transform: translateY(-1px) scale(0.98);
}

/* Footer Layout */
#footer-container {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 4rem 0 2rem;
    color: var(--text-muted);
    font-size: 0.9rem;
    border-top: 1px solid var(--card-border);
    margin-top: 5rem;
}

.footer-socials {
    display: flex;
    gap: 1.5rem;
}

.footer-socials a {
    color: var(--text-muted);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.footer-socials a:hover {
    color: var(--accent);
    transform: translateY(-2px);
}

.footer-socials .icon {
    width: 1.2rem;
    height: 1.2rem;
}

@media (max-width: 640px) {
    #footer-container {
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
    }
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    margin-bottom: 1rem;
}

.project-tag {
    font-size: 0.7rem;
    padding: 0.2rem 0.6rem;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border: 1px solid rgba(129, 140, 248, 0.2);
}

/* Code Blocks */
pre {
    position: relative;
    /* For copy button positioning */
    background-color: #1e293b !important;
    /* Fixed dark background for code */
    color: #f8fafc !important;
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 1.5rem;
    overflow-x: auto;
    margin: 2rem 0;
    font-size: 0.9rem;
    line-height: 1.5;
    box-shadow: var(--card-shadow);
}

[data-theme="light"] pre {
    filter: invert(1) hue-rotate(180deg) brightness(1.1) contrast(0.9);
    border-color: rgba(0, 0, 0, 0.1);
}

pre code {
    background: transparent !important;
    padding: 0;
    border-radius: 0;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

code {
    background-color: var(--background-alt);
    color: var(--accent);
    padding: 0.2rem 0.4rem;
    border-radius: 6px;
    font-size: 0.9em;
    font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
}

/* Copy Button */
.copy-btn {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    padding: 0.4rem 0.8rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 6px;
    color: #f8fafc;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
    opacity: 0;
    z-index: 10;
}

.code-wrapper:hover .copy-btn {
    opacity: 1;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--accent);
}

.copy-btn.copied {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

/* Scrollbar styling */
pre::-webkit-scrollbar {
    height: 8px;
}

pre::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

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

/* Post Header */
/* Blog Typography & Content */
.post {
    max-width: 800px;
    margin: 0 auto;
}

.post-content {
    font-size: 1.125rem;
    line-height: 1.8;
    color: var(--text);
}

.back-link {
    display: inline-block;
    color: var(--text-muted);
    text-decoration: none;
    font-family: var(--font-heading);
    font-size: 0.9rem;
    margin-bottom: 2rem;
    transition: color 0.2s;
}

.back-link:hover {
    color: var(--accent);
}

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

.post-content h2,
.post-content h3,
.post-content h4 {
    margin-top: 3rem;
    margin-bottom: 1rem;
    color: var(--text);
}

.post-content h2 {
    font-size: 2rem;
}

.post-content h3 {
    font-size: 1.5rem;
}

.post-content a {
    color: var(--accent);
    text-decoration: underline;
    text-underline-offset: 4px;
    transition: color 0.2s;
}

.post-content a:hover {
    color: var(--text);
}

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 2.5rem 0;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--card-border);
}

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

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

.post-content hr {
    margin: 4rem 0;
    border: 0;
    border-top: 1px solid var(--card-border);
}

.post-header {
    margin-bottom: 4rem;
    text-align: center;
}

.post-header time,
.post-header address {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-style: normal;
}

.post-header h1 {
    font-size: 3.5rem;
    margin: 1rem 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

/* Table of Contents */
.toc-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem;
    margin: 2.5rem 0;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.toc-container h2 {
    font-size: 1.2rem;
    margin-top: 0;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.toc-container ul {
    list-style: none;
    padding-left: 0;
    margin-bottom: 0;
}

.toc-container li {
    margin: 0.75rem 0;
}

.toc-container a {
    text-decoration: none;
    color: var(--text-muted);
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.toc-container a:hover {
    color: var(--accent);
    padding-left: 5px;
}

/* Post Tags */
.post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--card-border);
}

.post-tags .tag {
    text-decoration: none;
    background: var(--background-alt);
    color: var(--text-muted);
    padding: 0.4rem 1rem;
    border-radius: 99px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--card-border);
    transition: all 0.3s var(--ease-out-expo);
}

.post-tags .tag:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
    transform: translateY(-2px);
}

/* Tag Cloud Overview Page */
.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 3rem;
}

.tag-card {
    display: flex;
    align-items: center;
    padding: 0.8rem 1.6rem;
    background: var(--background-alt);
    border: 1px solid var(--card-border);
    border-radius: 99px;
    /* Pill shape */
    text-decoration: none;
    color: var(--text);
    font-family: var(--font-heading);
    font-weight: 600;
    transition: all 0.4s var(--ease-out-expo);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.tag-card:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--accent);
    background: var(--card-bg);
    box-shadow: 0 15px 30px -10px var(--accent-glow);
}

.tag-card .count {
    margin-left: 1rem;
    font-size: 0.75rem;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 0.25rem 0.6rem;
    border-radius: 99px;
    font-weight: 700;
    min-width: 1.5rem;
    text-align: center;
}

/* Post Pagination Nav */
.pagination-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-top: 4rem;
    padding-top: 3rem;
    border-top: 1px solid var(--card-border);
}

.nav-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    text-decoration: none;
    transition: all 0.3s var(--ease-out-expo);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.nav-card.next {
    text-align: right;
    align-items: flex-end;
}

.nav-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent);
    background: var(--background-alt);
    box-shadow: var(--card-shadow);
}

.nav-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.nav-title {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 1.1rem;
    color: var(--text);
    line-height: 1.4;
}

@media (max-width: 640px) {
    #nav-bar {
        width: 95%;
        padding: 0.4rem 0.6rem;
        top: 1rem;
    }

    #nav-bar a {
        padding: 0.5rem 0.8rem;
        font-size: 0.75rem;
    }

    .theme-toggle {
        padding: 0.5rem;
    }

    .pagination-nav {
        grid-template-columns: 1fr;
    }

    h1 {
        font-size: 2.5rem !important;
    }
}

/* Pagination */
.pagination {
    margin-top: 4rem;
    display: flex;
    justify-content: center;
}

.pagination-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: var(--card-bg);
    padding: 0.75rem 1.5rem;
    border-radius: 99px;
    border: 1px solid var(--card-border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.page-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--background-alt);
    color: var(--text);
    text-decoration: none;
    transition: all 0.3s ease;
    border: 1px solid var(--card-border);
    font-size: 1.2rem;
    line-height: 1;
}

.page-item:hover {
    background: var(--accent);
    color: white;
    transform: scale(1.1);
}

.page-current {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.02em;
}

.page-current b {
    color: var(--accent);
    font-weight: 700;
}

.content-section p {
    font-size: 1.15rem;
    color: var(--text-muted);
    max-width: 700px;
    margin-bottom: 3rem;
}

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

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

::-webkit-scrollbar-thumb {
    background: var(--card-border);
    border-radius: 10px;
}

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