@import url("https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400&display=swap");
/* ---------------------------------------------------------------------
   Core Typography & Color Variable Definitions
   --------------------------------------------------------------------- */
:root {
    --bg-primary: #ffffff;
    --text-main: #111111;
    --text-muted: #666666;
    --accent-glow: #2bbc89; /* Inspired by your original custom canvas accent */
    --font-sans: 'Inter', 'Inter Variable', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-serif: var(--font-sans);
    /* --font-serif: 'PT Serif', 'Georgia', 'Sitka Text', 'Cambria', 'Charter', serif; */
    --font-mono: 'Menlo', 'Consolas', 'Fira Code', monospace;
}

html {
    scroll-behavior: smooth;
}

:target {
    scroll-margin-top: 24px;
}

/* Explicit data attribute mapping for dark mode */
html[data-theme="dark"] {
    --bg-primary: #0b0b0b;
    --text-main: #f5f5f7;
    --text-muted: #86868b;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #0b0b0b;
        --text-main: #f5f5f7;
        --text-muted: #86868b;
    }
}

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

body {
    background-color: var(--bg-primary);
    color: var(--text-main);
    font-family: var(--font-sans);
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    padding: 0 24px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Academic Prose: The reading font layer for long-form reading */
.article-body,
.note-render-body {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    line-height: 1.75;
    color: var(--text-main);
    text-align: justify;
}

/* Ensure paragraph tags inside your notes maintain clean vertical spacing */
.article-body p,
.note-render-body p {
    margin-bottom: 16px;
}

/* Retain structural locks for inline headings inside note blocks */
.note-render-body h1,
.note-render-body h2,
.note-render-body h3,
.note-render-body h4 {
    font-family: var(--font-sans) !important;
    font-weight: 700;
    color: var(--text-main);
    margin-top: 24px;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
}

/* 1. Set the uniform global reading base */
body, p {
    font-size: 1.05rem !important;
    line-height: 1.6;
}

/* 2. Update your feed card descriptions to inherit this baseline perfectly */
.card-description {
    margin: 0 0 14px 0;
    font-size: 1.05rem !important; /* Forces uniform size match across card lists */
    line-height: 1.5;
    color: var(--text-muted);
    max-width: 720px;
}

/* UI Layout Overrides: Explicitly force headings to remain modern Sans-Serif */
.article-body h1,
.article-body h2,
.article-body h3,
.article-body h4,
.article-body h5,
.article-body h6 {
    font-family: var(--font-sans) !important;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}

/* Keep your custom Table of Contents metadata clean and geometric as well */
.toc-wrapper summary,
#dynamic-toc a {
    font-family: var(--font-sans);
}

/* ---------------------------------------------------------------------
   Isolated Viewport-Fixed Left Margin TOC
   --------------------------------------------------------------------- */

/* 1. Ensure your post text maintains its original clean reading width */
.standalone-post-canvas {
    max-width: 760px; /* Restores your ideal typographic line-length balance */
    margin: 0 auto;
    position: relative;
}

/* 2. Push the TOC completely to the left side of the screen */
.fixed-left-toc {
    position: fixed;
    top: 140px;          /* Aligns vertically with the start of your article body */
    left: calc(50% - 640px); /* Dynamically offsets it to track with your central content container */
    width: 220px;
    z-index: 90;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
}

/* Subtle inner styles for the independent link tree */
.toc-container-inner {
    padding-right: 16px;
}

.toc-title-meta {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    font-weight: 600;
}

/* RESPONSIVE ADJUSTMENTS: On tablets/phones, pull it back into a traditional card layout */
@media (max-width: 1260px) {
    /* Hide or collapse the floating layout if the screen isn't wide enough for margins */
    .fixed-left-toc {
        position: static;
        width: 100%;
        max-height: none;
        margin-bottom: 32px;
    }
    
    .toc-container-inner {
        background: rgba(128, 128, 128, 0.03);
        border: 1px solid rgba(128, 128, 128, 0.08);
        padding: 20px;
        border-radius: 6px;
    }
    .post-layout-grid {
        grid-template-columns: 1fr;
        gap: 32px;
    }
}

/* ---------------------------------------------------------------------
   Structural Layout & Grid Utilities
   --------------------------------------------------------------------- */
.site-wrapper {
    max-width: 680px; /* Monospace reading optimization layout */
    margin: 0 auto;
    padding: 60px 0;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 80px;
}

.nav-brand {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: -0.02em;
}

.nav-links a {
    margin-left: 24px;
    font-size: 0.95rem;
    font-weight: 500;
}

/* ---------------------------------------------------------------------
   Structural Layout Helpers (Native Flexbox Substitutes)
   --------------------------------------------------------------------- */

/* Replaces Astro/Tailwind flex stacks and centers children vertically */
.flex {
    display: flex;
    align-items: center; /* Forces the text rows and logos to align along a matching center axis */
}

.flex-col {
    flex-direction: column;
    align-items: flex-start; /* Ensures vertical lists of rows don't stretch sideways incorrectly */
}

.gap-4 {
    gap: 16px;
}

/* ---------------------------------------------------------------------
   Academic & Professional Profile Layouts (LinkedIn Style Layout)
   --------------------------------------------------------------------- */
.profile-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

.profile-logo-link {
    display: block;
    flex-shrink: 0;
}

/* Base Light Mode Rules: Crisp 70px x 70px asset framing */
main img[src*="_logo"] {
    width: 90px !important;
    height: 90px !important;
    object-fit: cover !important;
    border-radius: 8px !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background-color: #ffffff !important;
    transition: opacity 0.2s ease, border-color 0.2s ease !important;
}

/* Premium Dark Mode Shield: Protects brand colors and removes glare */
html[data-theme="dark"] main img[src*="_logo"] {
    mix-blend-mode: normal !important; /* Disables all destructive blending */
    filter: none !important;            /* Strips out the color inversions completely */
    
    /* A gentle, 92% opaque card backfill tones down the intensity of pure white */
    background-color: rgba(255, 255, 255, 0.92) !important; 
    
    /* A soft dark-theme border integrates the asset smoothly into the UI */
    border-color: rgba(255, 255, 255, 0.15) !important;
    
    /* Subtle opacity softening makes the card rest comfortably on dark screens */
    opacity: 0.88 !important; 
}

.profile-details {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.5;
}

.profile-details b {
    font-weight: 600;
}

.profile-date {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------------
   Header Navigation Links (Sleek, No Initial Underline)
   --------------------------------------------------------------------- */
header .nav-links a.interactive-link,
header .nav-brand a.interactive-link {
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid transparent; /* Hide initial underline in the header bar */
    padding-bottom: 2px;
    transition: color 0.15s ease, border-color 0.15s ease;
}

/* Explicit Navigation link font-weight layout rule */
header .nav-links a.interactive-link {
    font-weight: 500; 
}

/* Explicit Brand Text link font-weight layout rule (Restoring Boldness) */
header .nav-brand a.interactive-link {
    font-weight: 700; /* Re-locks your name as a bold typographic identity */
    letter-spacing: -0.02em;
}

/* Interactive Hover States */
header .nav-links a.interactive-link:hover,
header .nav-brand a.interactive-link:hover {
    color: var(--accent-glow) !important;
    border-bottom: 1px solid var(--accent-glow); /* Underline appears cleanly only on hover in header */
}

/* ---------------------------------------------------------------------
   Academic & Professional Profile Layouts (LinkedIn Style Layout)
   --------------------------------------------------------------------- */

/* Container for rows (Education / Work blocks) */
.profile-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 28px;
}

/* Force all company/university logos to be exact LinkedIn-style thumbnails */
.profile-logo-link {
    display: block;
    flex-shrink: 0; /* Prevent images from squeezing on narrow displays */
}

.profile-logo-link img {
    width: 56px;   /* Standard compact professional sizing */
    height: 56px;  /* Locked 1:1 Aspect Ratio */
    object-fit: cover; /* Crop perfectly without stretching logos */
    border-radius: 4px; /* Crisp, clean modern corners */
    border: 1px solid rgba(128, 128, 128, 0.15); /* Soft bounding border */
}

/* Profile textual summary columns */
.profile-details {
    font-size: 1rem;
    color: var(--text-main);
    line-height: 1.5;
}

.profile-details b {
    font-weight: 600;
}

/* Subtle inline spacing for dates */
.profile-date {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
}

/* ---------------------------------------------------------------------
   Structural Layout & Grid Utilities (Expanded Layout Pass)
   --------------------------------------------------------------------- */
.site-wrapper {
    max-width: 800px; /* Bounded up from 680px to beautifully balance 16:10 laptop screens */
    margin: 0 auto;
    padding: 60px 0;
}
/* ---------------------------------------------------------------------
   Main Content Body Text Links (Visibly Underlined Baseline)
   --------------------------------------------------------------------- */
main a,
main .interactive-link,
main .email-protection-shield {
    color: var(--text-main);
    text-decoration: none;
    position: relative;
    font-weight: 500;
    
    /* Clean baseline underline visible beforehand for normal text links */
    border-bottom: 1px solid rgba(128, 128, 128, 0.45); 
    padding-bottom: 1px;
    transition: color 0.12s ease, border-color 0.12s ease, text-shadow 0.12s ease;

    /* 🛠️ STEP 1: Keep it as a pure inline element so it wraps and breaks 
       across line breaks naturally on mobile screens. */
    display: inline;

    /* 🛠️ STEP 2: Force the browser to treat line-wrapped fragments 
       as independent inline blocks so styles don't distort at line breaks. */
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
}

/* Adjust layout contrast specifically for Dark Mode body text blocks */
html[data-theme="dark"] main a,
html[data-theme="dark"] main .interactive-link,
html[data-theme="dark"] main .email-protection-shield {
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
}

/* Universal Hover State Matrix */
main a:hover,
main .interactive-link:hover,
main .email-protection-shield:hover {
    color: var(--accent-glow) !important;
    border-bottom: 1px solid var(--accent-glow) !important;
    
    /* 🛠️ STEP 3: Instead of physical font-weight changes which trigger layout shifts, 
       we use a precise, crisp text-shadow matrix. This thickens the appearance of the 
       Inter font characters instantly to simulate font-weight: 600, with absolutely 
       ZERO trailing spaces and ZERO horizontal text shifting! */
    text-shadow: 0.02em 0 currentColor, -0.02em 0 currentColor;
}

/* ---------------------------------------------------------------------
   Antispam Crawler Masking Engine & Explicit Typography Rules
   --------------------------------------------------------------------- */
.email-protection-shield {
    unicode-bidi: bidi-override;
    direction: rtl;
    cursor: pointer;
    font-weight: 500;
}

/* 🛠️ STEP 4: Force the email links to use the exact same 
   text-shadow thickening engine as the rest of your paragraph links,
   permanently stopping the font size jumping/flickering! */
main p a.email-protection-shield:hover,
main section a.email-protection-shield:hover,
main a.email-protection-shield:hover {
    color: var(--accent-glow) !important;
    border-bottom: 1px solid var(--accent-glow) !important;
    font-weight: 500 !important; /* Keeps the base structural font weight identical */
    text-shadow: 0.02em 0 currentColor, -0.02em 0 currentColor; /* Fakes bold optically without size shifts */
}

/* ---------------------------------------------------------------------
   Universal Image Link Overrides (Strips Lines under Logotypes)
   --------------------------------------------------------------------- */

/* Safely targets ANY hyperlink anchor inside the main tag that hosts an image element */
main a:has(img) {
    border-bottom: none !important;
    padding-bottom: 0 !important;
}

/* Ensure the accent underline color is suppressed on hover as well */
main a:has(img):hover {
    border-bottom: none !important;
}

/* Keep the image logo boundaries clean and stable inside their grids */
main a img {
    display: inline-block;
    vertical-align: middle;
}

/* Metadata formatting (Technical tags and post dates) */
.technical-meta {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Clean list architecture */
.feed-list {
    list-style: none;
    margin-top: 32px;
}

.feed-item {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 16px 0;
    border-bottom: 1px solid rgba(128, 128, 128, 0.1);
}

/* Core Accordion Styling inside public/css/core.css */
details.academic-accordion {
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    padding: 16px 0;
    cursor: pointer;
}

details.academic-accordion[open] {
    border-bottom: 1px solid var(--text-main);
}

details.academic-accordion summary {
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    font-size: 1.05rem;
    user-select: none;
    color: var(--text-main);
}

details.academic-accordion summary::-webkit-details-marker {
    display: none; /* Safeguard to kill standard Safari triangles */
}

details.academic-accordion summary::after {
    content: '+';
    font-family: var(--font-mono);
    font-size: 1.1rem;
    color: var(--text-muted);
    transition: transform 0.25s ease;
}

details.academic-accordion[open] summary::after {
    transform: rotate(45deg);
    color: var(--accent-glow);
}

details.academic-accordion summary:hover {
    color: var(--accent-glow);
}

.accordion-content {
    padding: 12px 4px 4px 4px;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-2px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ---------------------------------------------------------------------
   Global Footer Layout & Single Badge Dark Mode Inversion
   --------------------------------------------------------------------- */
footer {
    border-top: 1px solid rgba(128, 128, 128, 0.15);
    padding: 32px 0 48px 0;
    margin-top: 64px;
}

.footer-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

footer p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin: 0;
}

/* Strip text underlines from the footer badge hyperlink anchor */
.human-badge-wrapper a {
    border-bottom: none !important;
    padding-bottom: 0 !important;
    display: block;
}

.human-badge-wrapper img {
    height: 36px !important; /* Slightly more compact sizing to rest quietly in the footer */
    width: auto !important;
    display: block;
    border-radius: 4px;
    transition: filter 0.3s ease !important;
}

/* Clean Dark Mode Inversion to match your nighttime portfolio aesthetic */
html[data-theme="dark"] .human-badge-wrapper img {
    filter: invert(1) hue-rotate(180deg) brightness(0.95) !important;
}

/* Responsive adjustment for smaller mobile screens */
@media (max-width: 480px) {
    .footer-container {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ---------------------------------------------------------------------
   Premium Code Syntax Block Layouts & Typographic Controls
   --------------------------------------------------------------------- */

/* Set layout rules for inline short code snippets within normal text paragraphs */
main :not(pre) > code {
    font-family: var(--font-mono);
    font-size: 0.88rem;
    padding: 3px 6px;
    background-color: rgba(128, 128, 128, 0.08);
    color: var(--text-main);
    border-radius: 4px;
    border: 1px solid rgba(128, 128, 128, 0.12);
    word-break: break-word;
}

html[data-theme="dark"] main :not(pre) > code {
    background-color: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
}

/* Base structural layout layers for long multi-line computational code blocks */
main pre {
    border: 1px solid rgba(128, 128, 128, 0.15) !important;
    border-radius: 8px !important;
    padding: 20px !important;
    margin: 28px 0 !important;
    overflow-x: auto;
    position: relative;
}

html[data-theme="dark"] main pre {
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
}

/* Ensure font sizing handles are clean and readable */
main pre code {
    font-family: var(--font-mono) !important;
    font-size: 0.92rem !important;
    line-height: 1.6 !important;
}

/* Customize horizontal scrollbar shapes to keep them minimal */
main pre::-webkit-scrollbar {
    height: 8px;
}

main pre::-webkit-scrollbar-track {
    background: #1d1f21;
    border-radius: 0 0 8px 8px;
}

main pre::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 4px;
}

main pre::-webkit-scrollbar-thumb:hover {
    background: var(--accent-glow);
}

/* When your theme engine is set to light, explicitly disable dark theme overrides if necessary */
html[data-theme="light"] link#prism-dark {
    media: none;
}

/* When your theme engine flips to dark mode, force the dark code colors to take priority */
html[data-theme="dark"] link#prism-dark {
    media: all;
}

/* ---------------------------------------------------------------------
   Interactive Bio Metric Badge Systems (ORCID & Chess.com)
   --------------------------------------------------------------------- */
.bio-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 32px;
    align-items: center;
    margin-top: 32px;
    padding-top: 12px;
}

/* Base interactive anchor wrapper layout */
.badge-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none !important;
    border-bottom: none !important;
    color: var(--text-muted);
    transition: color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Text labeling parameters */
.badge-label {
    font-family: var(--font-sans);
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

/* Dimensional boundaries for graphic vector blocks */
.badge-icon {
    width: 20px;
    height: 20px;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 1. ORCID SPECIAL INTERACTION RULES */
.orcid-group:hover {
    color: var(--text-main);
}
.orcid-group:hover .orcid-icon {
    transform: scale(1.08);
}

/* 2. CHESS.COM DYNAMIC CROSS-FADE STACK */
.chess-icon-stack {
    position: relative;
    width: 20px;
    height: 20px;
}

/* Position icons completely overlapping on top of one another */
.chess-default-icon,
.chess-brilliant-icon {
    position: absolute;
    top: 0;
    left: 0;
    display: block;
    width: 20px;
    height: 20px;
    border: none !important;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.chess-default-icon {
    background-color: var(--text-muted);
    -webkit-mask: url("https://cdn.jsdelivr.net/npm/simple-icons@v11/icons/chessdotcom.svg") no-repeat center / contain;
    mask: url("https://cdn.jsdelivr.net/npm/simple-icons@v11/icons/chessdotcom.svg") no-repeat center / contain;
}

/* Initial state variables */
.chess-brilliant-icon {
    opacity: 0;
    transform: scale(0.8) rotate(-15deg);
}

/* Hover State Morphing Animations */
.chess-group:hover {
    color: var(--text-main);
}

/* Fade out standard logo */
.chess-group:hover .chess-default-icon {
    opacity: 0;
    transform: scale(0.8);
    background-color: var(--text-main);
}

/* Fade in and expand the Brilliant emerald medal geometry */
.chess-group:hover .chess-brilliant-icon {
    opacity: 1;
    transform: scale(1.1) rotate(0deg);
}

/* Light up the pawn shape into a matching deep-emerald glow on dark theme mouse hovers */
html[data-theme="dark"] .chess-group:hover .chess-default-icon {
    background-color: #26c2a3;
}
