/* Resets and Base Settings */
* {
    box-sizing: border-box;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #a8a29e; /* Warm stone gray body text */
    background-color: #0a0a0a; /* Deep dark background */
    line-height: 1.7;
    margin: 0;
    padding: 0;
    font-size: 17px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* =========================================
   TOP NAVIGATION (Liquid Glass)
   ========================================= */
.top-nav {
    position: sticky;
    top: 0;
    width: 100%;
    /* Liquid Glass properties */
    background: rgba(10, 10, 10, 0.45); /* Very transparent dark base */
    backdrop-filter: blur(20px) saturate(180%); /* The magic blur and color boost */
    -webkit-backdrop-filter: blur(20px) saturate(180%); /* Safari support */
    
    /* Glass edges and depth */
    border-bottom: 1px solid rgba(255, 255, 255, 0.08); /* Faint light edge at bottom */
    box-shadow: 
        0 4px 30px rgba(0, 0, 0, 0.1), /* Subtle drop shadow */
        inset 0 1px 0 rgba(255, 255, 255, 0.05); /* Faint highlight at top */
    z-index: 100;
}

.nav-container {
    max-width: 640px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.2rem 1.5rem;
}

.nav-brand {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: #F5F0E1; /* Warm Ivory */
    text-decoration: none;
    letter-spacing: -0.02em;
}

.nav-links {
    display: flex;
    gap: 1.5rem;
}

.nav-links a {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #c4bdb1; /* Slightly dimmer warm ivory for nav links */
    text-decoration: none;
    transition: color 0.2s ease;
}

.nav-links a:hover {
    color: #64ffda;
}

/* =========================================
   MAIN CONTENT AREA (Centered, Static)
   ========================================= */
.main-content {
    max-width: 640px; /* Optimal reading width */
    margin: 0 auto;
    padding: 4rem 1.5rem; /* Generous top/bottom padding */
    width: 100%;
    flex: 1;
}

h1, h2 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #F5F0E1; /* Warm Ivory */
    line-height: 1.3;
}

h2 {
    font-size: 1.4rem;
    margin-top: 3.5em;
    margin-bottom: 1.5em;
}

/* Removes top margin from the very first section so it aligns cleanly */
section:first-child h2 {
    margin-top: 0;
    font-size: 2rem; /* Big hero text for "Making machines think" */
}

a {
    color: #F5F0E1; /* Warm Ivory */
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: #64ffda;
    text-decoration: none;
}

p {
    margin-bottom: 1.4em;
}

/* Lists for Projects and Courses */
.item-list {
    list-style-type: none;
    padding: 0;
}

.item-list li {
    margin-bottom: 2rem;
    border-bottom: 1px solid #1a1a1a; /* Very subtle dividers */
    padding-bottom: 1.5rem;
}

.item-list li:last-child {
    border-bottom: none;
}

.item-list p {
    margin: 0.5em 0 0 0;
    color: #a8a29e; /* Warm stone gray */
    font-size: 0.95rem;
}

.item-title {
    font-family: 'Inter', sans-serif;
    font-size: 1.15rem;
    font-weight: 600;
    color: #F5F0E1; /* Warm Ivory */
    display: inline-block;
}

.tech-tag {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    background-color: rgba(100, 255, 218, 0.05);
    color: #64ffda;
    padding: 3px 8px;
    border-radius: 4px;
    margin-left: 10px;
    vertical-align: middle;
    border: 1px solid rgba(100, 255, 218, 0.1);
}

/* =========================================
   BLOG STYLING
   ========================================= */
.blog-post {
    padding-top: 2rem;
}

.back-link {
    margin-bottom: 2rem;
}

.back-link a {
    color: #64ffda;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.post-date {
    color: #857F78; /* Muted warm gray */
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    margin-bottom: 2rem;
}

.post-content {
    color: #c4bdb1; /* Slightly dimmer warm ivory for reading */
    line-height: 1.8;
}

/* MathJax display equations: allow horizontal scroll when they overflow */
.post-content mjx-container[jax="SVG"][display="true"] {
    overflow-x: auto;
    overflow-y: hidden;
    max-width: 100%;
    padding: 0.5rem 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Webkit scrollbar styling for MathJax containers */
.post-content mjx-container[jax="SVG"][display="true"]::-webkit-scrollbar {
    height: 4px;
}

.post-content mjx-container[jax="SVG"][display="true"]::-webkit-scrollbar-track {
    background: transparent;
}

.post-content mjx-container[jax="SVG"][display="true"]::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 4px;
    transition: background 0.2s ease;
}

.post-content mjx-container[jax="SVG"][display="true"]:hover::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
}

/* On narrow screens, shrink display math slightly for a better fit */
@media (max-width: 600px) {
    .post-content mjx-container[jax="SVG"][display="true"] svg {
        max-width: 100%;
        height: auto;
    }
}

.post-content h1, .post-content h2, .post-content h3 {
    color: #F5F0E1; /* Warm Ivory */
}

.post-content a {
    color: #64ffda;
    text-decoration: underline;
}

/* Make images responsive inside blog posts */
.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 20px auto;
    display: block;
}

/* Code blocks (4-space indented or fenced) */
pre {
    background-color: #141414;
    border: 1px solid #1f1f1f;
    border-radius: 6px;
    padding: 1rem 1.2rem;
    overflow-x: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin: 1.2em 0;
}

pre code {
    font-family: 'Fira Code', monospace;
    font-size: 0.88rem;
    color: #c4bdb1;
    background: none;
    padding: 0;
    border: none;
    border-radius: 0;
}

/* Inline code */
.post-content code {
    font-family: 'Fira Code', monospace;
    font-size: 0.88rem;
    background-color: rgba(255, 255, 255, 0.06);
    color: #e0d9cc;
    padding: 2px 6px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.06);
}

/* Blog List Page */
#blog-page {
    padding-top: 2rem;
}

.blog-subtitle {
    color: #857F78; /* Muted warm gray */
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
}

.blog-tabs {
    display: flex;
    gap: 20px;
    border-bottom: 1px solid #1a1a1a;
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.tab-btn {
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
    padding: 10px 0;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    color: #a8a29e; /* Warm stone gray */
    border-bottom: 2px solid transparent;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #F5F0E1; /* Warm Ivory */
}

.tab-btn.active {
    color: #F5F0E1; /* Warm Ivory */
    border-bottom: 2px solid #64ffda;
}

/* The notes categories stay on one row and can be swiped on narrow screens. */
.notes-tabs {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.notes-tabs::-webkit-scrollbar {
    display: none;
}

.notes-tabs .tab-btn {
    flex: 0 0 auto;
    white-space: nowrap;
    scroll-snap-align: start;
}

.category-desc {
    color: #857F78; /* Muted warm gray */
    margin-top: 0;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
}

.post-date-inline {
    color: #857F78; /* Muted warm gray */
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    margin: 0.5rem 0 0 0;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
    .nav-container {
        flex-direction: column;
        gap: 0.8rem;
        padding: 1rem 1.5rem;
    }
    .nav-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem 1.2rem;
    }
    .main-content {
        padding: 2rem 1.5rem;
    }
    .notes-tabs {
        gap: 1.25rem;
        margin-right: -1.5rem;
        padding-right: 1.5rem;
    }
}

/* =========================================
   PREMIUM MICRO-INTERACTIONS & POLISH
   ========================================= */

/* 1. Highlighted Keywords in Text */
.highlight {
    color: #F5F0E1; /* Warm Ivory */
    font-weight: 500;
}

/* 2. Custom Text Selection Color */
::selection {
    background: #64ffda;
    color: #0a0a0a; /* Dark text on green highlight */
}

/* 3. Premium List Hover Effect (Applies to Projects AND Courses) */
.item-list li {
    position: relative;
    transition: background-color 0.2s ease;
    padding: 1.5rem 1rem; /* Add side padding for the hover box */
    margin-left: -1rem;  /* Pull back so it aligns with the h2 above it */
    margin-right: -1rem;
    border-radius: 6px;
}

.item-list li:hover {
    background-color: #111111; /* Very subtle light gray box on hover */
}

/* Make the arrow appear next to titles on hover */
.item-title::after {
    content: ' →';
    font-family: 'Fira Code', monospace;
    font-size: 1rem;
    color: #64ffda;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
    transform: translateX(-5px);
    display: inline-block;
}

.item-list li:hover .item-title::after {
    opacity: 1;
    transform: translateX(0);
}

/* 4. Smooth transition for all links */
a, .item-title {
    transition: color 0.2s ease-in-out;
}

/* =========================================
   MATHJAX / LATEX MATH STYLING
   ========================================= */
/* Ensure MathJax SVG output matches the site's color scheme */
mjx-container {
    color: #F5F0E1 !important; /* Warm Ivory to match headings */
}

/* Display math ($$...$$) gets subtle padding and centering */
mjx-container[display="true"] {
    display: block !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.8em 0;
    margin: 0.5em 0;
}

/* Inline math keeps flow but matches text color */
mjx-container:not([display="true"]) {
    color: #c4bdb1 !important; /* Match surrounding body text */
}

/* =========================================
   SPOTIFY EMBED
   ========================================= */
.spotify-embed {
    margin-top: 3rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(100, 255, 218, 0.08);
    border-radius: 14px;
    box-shadow:
        0 0 20px rgba(100, 255, 218, 0.03),
        inset 0 1px 0 rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.spotify-embed iframe {
    border-radius: 12px;
    display: block;
}

/* =========================================
   NOTES & PDF VIEWER STYLING
   ========================================= */
.note-header-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
}

.pdf-pill-link {
    font-family: 'Fira Code', monospace;
    font-size: 0.75rem;
    color: #64ffda;
    background: rgba(100, 255, 218, 0.08);
    border: 1px solid rgba(100, 255, 218, 0.2);
    border-radius: 9999px;
    padding: 3px 10px;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.pdf-pill-link:hover {
    background: rgba(100, 255, 218, 0.18);
    border-color: #64ffda;
    color: #64ffda;
    transform: translateY(-1px);
}

.note-meta {
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.note-description {
    color: #c4bdb1;
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.pdf-toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.pdf-btn {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    padding: 8px 16px;
    border-radius: 6px;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.pdf-btn.primary {
    background-color: rgba(100, 255, 218, 0.1);
    color: #64ffda;
    border: 1px solid rgba(100, 255, 218, 0.3);
}

.pdf-btn.primary:hover {
    background-color: #64ffda;
    color: #0a0a0a;
    box-shadow: 0 0 15px rgba(100, 255, 218, 0.3);
}

.pdf-btn.secondary {
    background-color: rgba(255, 255, 255, 0.04);
    color: #F5F0E1;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.pdf-btn.secondary:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.25);
    color: #F5F0E1;
}

.pdf-viewer-container {
    width: 100%;
    height: 820px;
    background: #141414;
    border: 1px solid #222222;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 2.5rem;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.pdf-frame {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

.pdf-fallback {
    padding: 2rem;
    text-align: center;
    color: #a8a29e;
    font-size: 0.95rem;
}

.pdf-fallback a {
    color: #64ffda;
    text-decoration: underline;
}

.empty-category-msg {
    color: #857F78;
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    padding: 2rem 0;
}

.note-additional-content {
    margin-top: 2rem;
}

@media (max-width: 600px) {
    .pdf-viewer-container {
        height: 520px;
    }
    .pdf-toolbar {
        flex-direction: column;
    }
    .pdf-btn {
        width: 100%;
    }
}

/* =========================================
   SITE FOOTER
   ========================================= */
.site-footer {
    width: 100%;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(10, 10, 10, 0.4);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin-top: auto;
}

.footer-container {
    max-width: 640px;
    margin: 0 auto;
    padding: 2.5rem 1.5rem 3.5rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
}

.footer-text {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: #857F78;
}

.footer-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.footer-links a {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: #c4bdb1;
    text-decoration: none;
    transition: color 0.2s ease;
}

.footer-links a:hover {
    color: #64ffda;
}

@media (max-width: 600px) {
    .footer-container {
        flex-direction: column-reverse;
        gap: 1.2rem;
        padding: 2rem 1.5rem 3rem 1.5rem;
        text-align: center;
    }
    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: 0.8rem 1.2rem;
    }
}
