/* =============================================
   BLOG — Listing & Post Styles
   Extends the main style.css design system
============================================= */
/* Adjust the 80px value to match your actual Navbar height + some padding */
h2, h3, h4 {
    scroll-margin-top: 100px; 
}

/* --- Blog Hero & Listing --- */
.blog-hero {
    padding: 140px 0 40px; /* Remove side padding here, handle it in the container */
    max-width: 1100px;      /* Set a consistent max-width */
    margin: 0 auto;         /* Center it */
    padding-left: 24px;     /* Match the List padding */
}

/* Update the List section to match the Hero */
.blog-list-section {
    padding: 0 24px 120px;  /* Standardize horizontal padding */
    max-width: 1100px;      /* Identical to Hero max-width */
    margin: 0 auto;         /* Centers the section on the page */
}

.blog-list-item {
    display: flex;
    align-items: flex-start;
    gap: 40px;               /* Fixed gap between date and content */
    padding: 30px 0;
    text-align: left;        /* CRITICAL: Force left alignment */
    width: 100%;
}

.blog-list-date {
    min-width: 100px;        /* Fixes the width of the date column */
    flex-shrink: 0;          /* Prevents the date from getting squished */
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-mute);
    padding-top: 6px;        /* Vertical alignment with the title */
}

.blog-list-body {
    flex: 1;                 /* Allows the body to take up remaining space */
    text-align: left;        /* Ensures text doesn't center itself */
}

.blog-list-arrow{
    padding-right: 25px;
    font-size: 24px;
    font-weight: bold;
}


.blog-list-arrow:hover {
        color: var(--accent1);
        transform: scale(1.2);
        transition: transform 0.2s ease, color 0.2s ease;
}


.blog-list-container {
    max-width: 900px;
    margin: 120px auto;
    padding: 0 20px;
}

.blog-list-header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: linear-gradient(to right, #fff, var(--accent1));
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.blog-grid {
    display: flex;
    flex-direction: column;
    gap: 40px;
    margin-top: 60px;
}

.blog-card {
    padding-bottom: 40px;
    border-bottom: 1px solid var(--border);
    transition: transform 0.3s ease;
}

.blog-card:hover .blog-card-title {
    color: var(--accent1);
}

.blog-card-meta {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.blog-card-date {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-mute);
}

.blog-card-title {
    font-size: 1.5rem;
    margin-bottom: 10px;
    transition: color 0.2s;
}

.blog-card-excerpt {
    color: var(--text-dim);
    line-height: 1.6;
    font-size: 0.95rem;
}

.blog-card-link {
    text-decoration: none;
    color: inherit;
}

.blog-list-item {
  display: flex;
  align-items: flex-start;
  gap: 24px;
  padding: 28px 0;
  border-bottom: 1px solid var(--border);
  transition: transform 0.2s;
}

.blog-list-section {
  padding: 0 clamp(20px, 8vw, 120px) 120px;
  max-width: 100%; /* Changed from 860px to fill the space */
}

.blog-list-item {
  width: 100%;
  justify-content: space-between; /* Pushes title left and arrow right */
}

.blog-list-item:first-child { border-top: 1px solid var(--border); }
.blog-list-item:hover {
    background: rgba(45, 212, 191, 0.03); /* Subtle teal tint */
    border-radius: 8px;
}
.blog-list-date {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-mute);
  min-width: 80px;
  padding-top: 4px;
  letter-spacing: 0.05em;
}

.blog-list-title {
  font-family: var(--font-head);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  line-height: 1.3;
  display: block;
  margin-bottom: 6px;
  transition: color 0.2s;
}

.blog-list-title:hover { color: var(--accent1); }

.blog-list-excerpt {
  font-size: 0.88rem;
  color: var(--text-dim);
  line-height: 1.6;
  margin-bottom: 10px;
}

/* --- Tags --- */
.blog-list-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 15px;
}

.blog-tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    padding: 5px 14px;
    border-radius: 100px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.15) 0%, rgba(45, 212, 191, 0.05) 100%);
    color: var(--accent1);
    border: 1px solid rgba(45, 212, 191, 0.3);
    backdrop-filter: blur(4px);
    transition: all 0.3s ease;
    cursor: default;
}

.blog-tag:hover {
    border-color: var(--accent1);
    background: linear-gradient(135deg, rgba(45, 212, 191, 0.25) 0%, rgba(45, 212, 191, 0.1) 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(45, 212, 191, 0.1);
}

/* --- Individual Post Layout --- */
.post-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 140px 24px 0;
}

.post-header {
  margin-bottom: 50px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 30px;
}

.post-meta {
  display: flex;
  gap: 12px;
  margin-bottom: 15px;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-mute);
}

.post-title {
  font-family: var(--font-head);
  font-size: clamp(2.2rem, 5vw, 3.2rem);
  line-height: 1.1;
  color: var(--text);
  margin-bottom: 10px;
}

.post-description {
    color: var(--text-dim);
    font-size: 1.1rem;
    max-width: 800px;
}

/* --- Grid Engine --- */
.post-layout-grid {
    display: grid;
    grid-template-columns: 1fr 280px; 
    gap: 4rem;
    align-items: stretch; /* This makes the sidebar 'track' the full height of the blog */
    position: relative;
}

/* --- Content Typography & Spacing --- */
.post-content {
    min-width: 0;
    line-height: 1.8;
    font-size: 1.05rem;
    color: var(--text-dim);
}

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

.post-content h2 {
    margin: 3.5rem 0 1.5rem;
    font-family: var(--font-head);
    color: var(--text);
    font-size: 1.8rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.5rem;
}

.post-content h3 {
    margin: 2.5rem 0 1rem;
    font-family: var(--font-head);
    color: var(--text);
}

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

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

/* --- Sidebar System --- */
.post-sidebar {
    width: 280px;
}

.sticky-sidebar {
    position: sticky;
    top: 100px;
    display: flex;
    flex-direction: column;
    /* Removed gap: 2.5rem to allow the heading to sit flush against the scroll area */
    max-height: calc(100vh - 120px); 
    overflow: hidden; /* Prevent the entire sidebar from scrolling */
}

/* Sidebar Section Container */
.sidebar-section {
    display: flex;
    flex-direction: column;
    overflow: hidden; /* Important to contain the inner scroll */
    max-height: 100%;
}

.sidebar-section h3 {
    flex-shrink: 0; /* Ensures the "Table of Contents" text never squishes or scrolls */
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-mute);
    margin-bottom: 15px;
    background-color: var(--bg); /* Keeps heading opaque so text hides behind it */
    z-index: 10;
    padding-bottom: 5px;
}

/* --- The Scrolling TOC List --- */
.toc-list {
    list-style: none;
    padding: 0;
    overflow-y: auto; /* Enable scroll only here */
    flex-grow: 1;    /* Take up the remaining sidebar height */
    
    /* Custom Scrollbar for a technical feel */
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 212, 191, 0.2) transparent;
    mask-image: linear-gradient(to bottom, 
        transparent 0%, 
        black 20px, 
        black 100%
    );
    -webkit-mask-image: linear-gradient(to bottom, 
        transparent 0%, 
        black 20px, 
        black 100%
    );

    padding-top: 20px;  /* first element dont feels faded*/
}

/* Chrome/Safari Scrollbar Styling */
.toc-list::-webkit-scrollbar {
    width: 3px;
}
.toc-list::-webkit-scrollbar-thumb {
    background: rgba(45, 212, 191, 0.2);
    border-radius: 10px;
}

.toc-list li { margin-bottom: 12px; }

/* --- Optimized TOC Hover Logic --- */

.toc-list a {
  text-decoration: none;
  font-size: 0.88rem;
  color: var(--text-mute);
  transition: all 0.2s ease; /* Added 'ease' for smoother motion */
  display: block;
  padding-left: 0; /* Starting point */
  border-left: 2px solid transparent; /* Optional: preparation for a sleek indicator */
}

.toc-list a:hover { 
  color: var(--accent1); 
  /* Replace transform with padding-left */
  padding-left: 8px; 
  /* Optional: adds a small vertical line like a professional IDE */
  border-left: 2px solid var(--accent1); 
}
/* AUTHOR AND SHARE */
/* --- Post Credits Styling --- */
.post-end-divider {
    border: 0;
    border-top: 1px solid var(--border);
}

.post-credits {
    display: flex;
    flex-wrap: wrap; /* Allows stacking on very small screens */
    gap: 3rem;
    align-items: flex-start;
    padding: 50px 100px 50px;
}

.credit-author {
    flex: 2; /* Gives more room to the bio */
    min-width: 280px;
}

.credit-share {
    flex: 1; /* Keeps share section compact */
    min-width: 200px;
}

.credit-title {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-mute);
    margin-bottom: 1rem;
}

/* Share Button Alignment */
.share-modern-wrapper {
    display: flex;
    gap: 12px;
}

.author-snippet {
  line-height: 1.6;
  font-size: 0.9rem;
  color: var(--text-dim);
}

/* --- Share Buttons --- */
.share-modern-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.share-trigger {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
}

.share-icon-box {
    width: 32px;
    height: 32px;
    background: rgba(45, 212, 191, 0.1);
    color: var(--accent1);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 0.9rem;
}

.share-trigger span {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-mute);
    text-transform: uppercase;
}

.share-copy-only {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-mute);
    width: 42px;
    height: 42px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.share-trigger:hover, .share-copy-only:hover {
    border-color: var(--accent1);
    color: var(--accent1);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 992px) {
    .post-layout-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-section:has(#toc-list) {
        display: none;
    }

    .sticky-sidebar {
        position: static;
    }

    .post-title { font-size: 2.2rem; }

    .post-credits{
        padding-left: 50px;
        padding-right: 50px;
    }
}

@media (max-width: 600px) {
  .blog-list-item { flex-direction: column; gap: 8px; }
  .blog-list-date { min-width: unset; }
  .post-container { padding-top: 100px;}
}

/* PAGE TABLE, LIST, IMAGES, STYLING */
/* --- Technical Data Table Styling --- */
.post-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 2.5rem 0;
    font-size: 0.95rem;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.02); /* Subtle depth */
    border: 1px solid var(--border);
    border-radius: 8px; /* Note: Requires overflow hidden on table or parent */
    overflow: hidden;
}

.post-content th {
    background-color: rgba(45, 212, 191, 0.05); /* Very light Teal tint */
    color: var(--accent1); /* Your Teal brand color */
    font-family: var(--font-mono);
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.05em;
    padding: 14px 16px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}

.post-content td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}

/* Zebra Striping for readability in long Loksewa notes */
.post-content tr:nth-child(even) {
    background-color: rgba(255, 255, 255, 0.01);
}

/* Hover effect for interactive data tracking */
.post-content tr:hover {
    background-color: rgba(45, 212, 191, 0.03); 
    color: var(--text);
    transition: background 0.2s ease;
}

/* Responsive Table: Allow horizontal scroll on mobile */
@media (max-width: 768px) {
    .post-content {
        overflow-x: auto;
    }
    .post-content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap; /* Prevents text wrapping in tight columns */
    }
}


/* --- Global Post Image Styling --- */
/* This handles standalone images in Markdown that aren't wrapped in <figure> */
.post-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 2.5rem auto; 
    /* Subtle shadow for depth without needing a border */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); 
    border-radius: 8px; /* Consistent with your UI buttons/cards */
}

/* --- Professional Figure & Centered Caption System --- */
figure {
    margin: 3.5rem auto; /* Vertical breathing room between text and figures */
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%; /* Ensures the container spans the full content width */
}

figure img {
    /* Override standalone image margins to prevent double-spacing */
    margin: 0 0 1.2rem 0 !important; 
    max-width: 100%;
    /* Ensures high-res engineering diagrams don't look blurry */
    image-rendering: -webkit-optimize-contrast; 
}

figcaption {
    font-size: 0.85rem;
    font-family: var(--font-mono); /* Technical vibe for Civil Engineering notes */
    color: var(--text-mute);
    line-height: 1.6;
    max-width: 85%; /* Slightly wider for longer technical descriptions */
    margin: 0 auto;
}

/* Engineering-style Figure Prefix */
figcaption::before {
    content: "Fig: ";
    color: var(--accent1); /* Your Teal brand color */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Blockquotes for Key Notes --- */
.post-content blockquote {
    margin: 2rem 0;
    padding: 1.5rem 2rem;
    background: rgba(255, 255, 255, 0.03); /* Subtle background lift */
    border-left: 4px solid var(--accent1); /* Your Teal brand color */
    border-radius: 0 8px 8px 0;
    font-style: italic;
    color: var(--text);
}

.post-content blockquote p {
    margin-bottom: 0; /* Keeps the spacing tight within the quote */
}


/* --- Ultra-Simple Gray Inline Code --- */
.post-content :not(pre) > code {
    font-family: var(--font-mono); /* Keeps the technical mono feel */
    color: var(--text);            /* Uses your main text color for clarity */
    background: rgba(255, 255, 255, 0.041); /* Very subtle light gray tint */
    padding: 2px 5px;
    border-radius: 4px;
    font-size: 0.9em;
    letter-spacing: -0.2px;        /* Tightens mono text for better flow */
}
/* --- Text Links --- */
.post-content a {
    color: var(--accent1);
    text-decoration: none;
    border-bottom: 1px solid rgba(45, 212, 191, 0.3); /* Faint underline */
    transition: color 0.2s ease, border-color 0.2s ease;
}

.post-content a:hover {
    color: var(--text);
    border-bottom-color: var(--accent1); /* Brightens on hover */
}