/* Component-specific styles */

/* Tag overflow fix */
.post-card .flex-wrap {
    flex-wrap: wrap !important;
    gap: 0.25rem !important;
}

.post-card .bg-gray-100,
.post-card .dark\:bg-gray-800 {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.5rem !important;
    white-space: nowrap !important;
}

/* Project card overflow fix */
#projects .group {
    overflow: hidden;
}

#projects .flex-wrap {
    max-width: 100%;
    flex-wrap: wrap !important;
}

#projects .text-xs {
    font-size: 0.65rem !important;
    line-height: 1.2;
}

/* Hover underline animation */
.hover-underline-animation {
    display: inline-block;
    position: relative;
}

.hover-underline-animation::after {
    content: '';
    position: absolute;
    width: 100%;
    transform: scaleX(0);
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: currentColor;
    transform-origin: bottom right;
    transition: transform 0.25s ease-out;
}

.hover-underline-animation:hover::after {
    transform: scaleX(1);
    transform-origin: bottom left;
}

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

::-webkit-scrollbar-track {
    background: var(--light-bg);
}

.dark ::-webkit-scrollbar-track {
    background: var(--dark-bg);
}

::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Mobile menu animation */
#mobile-menu {
    transition: all 0.3s ease;
    transform-origin: top;
}

#mobile-menu.hidden {
    opacity: 0;
    transform: translateY(-10px);
    pointer-events: none;
}

/* Touch-friendly theme toggle */
@media (hover: none) and (pointer: coarse) {
    #theme-toggle {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    #theme-toggle:active {
        transform: scale(0.95);
    }
    
    #theme-toggle div {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #theme-toggle i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }
}

/* Enhanced mobile responsiveness */
@media (max-width: 640px) {
    #theme-toggle {
        min-width: 44px;
        min-height: 44px;
    }
    
    #theme-toggle div {
        width: 20px;
        height: 20px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #theme-toggle i {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
        margin: 0;
        padding: 0;
    }
}

/* Card hover effects */
.group:hover .group-hover\:text-blue-500 {
    color: #3b82f6;
}

.group:hover .group-hover\:text-green-500 {
    color: #10b981;
}

/* Loading animation */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.animate-pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Table of Contents Sidebar Styles */
#toc-sidebar {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#toc-sidebar.open {
    transform: translateX(0);
}

#toc-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

/* TOC Toggle Button */
#toc-toggle-btn {
    transition: all 0.3s ease;
}

#toc-toggle-btn:hover {
    transform: translateY(-50%) scale(1.05);
}

#toc-toggle-btn.toc-open {
    left: 320px;
    background-color: #3b82f6;
    border-color: #3b82f6;
}

#toc-toggle-btn.toc-open i {
    color: white;
}

/* TOC Sidebar Content */
#toc-sidebar .toc-nav {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

#toc-sidebar .toc-nav::-webkit-scrollbar {
    width: 4px;
}

#toc-sidebar .toc-nav::-webkit-scrollbar-track {
    background: transparent;
}

#toc-sidebar .toc-nav::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 2px;
}

.dark #toc-sidebar .toc-nav::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.5);
}

/* TOC Progress Bar */
#toc-progress-bar {
    transition: width 0.3s ease;
}

/* Mobile TOC Styles */
#mobile-toc {
    transition: all 0.3s ease;
}

.mobile-toc-header {
    user-select: none;
    transition: background-color 0.2s ease;
}

.mobile-toc-header:hover {
    background-color: rgba(156, 163, 175, 0.1);
}

.dark .mobile-toc-header:hover {
    background-color: rgba(75, 85, 99, 0.3);
}

#mobile-toc-nav {
    transition: max-height 0.3s ease, opacity 0.3s ease, margin 0.3s ease;
    overflow: hidden;
}

#mobile-toc-chevron {
    transition: transform 0.3s ease;
}

#mobile-toc-chevron i {
    transition: transform 0.3s ease;
}

#mobile-toc-chevron.collapsed i {
    transform: rotate(180deg);
}

/* TOC Link Styles */
.toc-link {
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: rgba(59, 130, 246, 0.5);
}

.toc-link.active {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: #3b82f6;
    color: #3b82f6;
    font-weight: 600;
}

.dark .toc-link:hover {
    background-color: rgba(59, 130, 246, 0.2);
    border-left-color: rgba(59, 130, 246, 0.7);
}

.dark .toc-link.active {
    background-color: rgba(59, 130, 246, 0.2);
    border-left-color: #60a5fa;
    color: #60a5fa;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    #toc-toggle-btn {
        display: none !important;
    }
    
    #toc-sidebar {
        width: 100%;
        max-width: 320px;
    }
}

@media (max-width: 768px) {
    #mobile-toc {
        margin-bottom: 1rem;
    }
    
    .mobile-toc-header {
        padding: 0.75rem;
    }
    
    #mobile-toc-nav {
        max-height: 300px;
        overflow-y: auto;
    }
    
    #mobile-toc-nav::-webkit-scrollbar {
        width: 4px;
    }
    
    #mobile-toc-nav::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #mobile-toc-nav::-webkit-scrollbar-thumb {
        background: rgba(156, 163, 175, 0.5);
        border-radius: 2px;
    }
    
    .dark #mobile-toc-nav::-webkit-scrollbar-thumb {
        background: rgba(107, 114, 128, 0.5);
    }
}

/* Mobile optimizations for TOC */
@media (max-width: 768px) {
    #table-of-contents {
        position: relative !important;
        top: auto !important;
        margin-bottom: 1rem;
    }
    
    .toc-header {
        padding: 0.75rem;
    }
    
    #toc-nav {
        max-height: 300px;
        overflow-y: auto;
    }
    
    #toc-nav::-webkit-scrollbar {
        width: 4px;
    }
    
    #toc-nav::-webkit-scrollbar-track {
        background: transparent;
    }
    
    #toc-nav::-webkit-scrollbar-thumb {
        background: rgba(156, 163, 175, 0.5);
        border-radius: 2px;
    }
    
    .dark #toc-nav::-webkit-scrollbar-thumb {
        background: rgba(107, 114, 128, 0.5);
    }
}

/* Enhanced Navigation Styles */
.nav-card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.nav-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s ease;
}

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

.nav-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.dark .nav-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Suggestions Grid Animation */
.suggestions-grid {
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.suggestion-card {
    animation: slideIn 0.5s ease-out backwards;
}

.suggestion-card:nth-child(1) { animation-delay: 0.1s; }
.suggestion-card:nth-child(2) { animation-delay: 0.2s; }
.suggestion-card:nth-child(3) { animation-delay: 0.3s; }

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Line clamp utility */
.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Navigation empty state styling */
.nav-empty {
    background: linear-gradient(135deg, #f3f4f6 0%, #e5e7eb 100%);
    border-style: dashed;
    position: relative;
    overflow: hidden;
}

.dark .nav-empty {
    background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
}

.nav-empty::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 10px,
        rgba(156, 163, 175, 0.1) 10px,
        rgba(156, 163, 175, 0.1) 20px
    );
    animation: shimmer 2s linear infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%); }
    100% { transform: translateX(100%) translateY(100%); }
}

/* Mobile responsive navigation */
@media (max-width: 768px) {
    .nav-card {
        padding: 1rem;
    }
    
    .suggestions-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .post-card {
        padding: 1.5rem;
        margin-bottom: 1.5rem;
    }
    
    .post-card .flex.flex-col.sm\\:flex-row {
        gap: 1rem;
    }
}

/* Sticky Header Styles */
#site-header {
    transition: background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(229, 231, 235, 0.5);
}

/* Dark mode header - higher specificity */
html.dark #site-header,
body.dark #site-header {
    background-color: rgba(18, 18, 18, 0.95) !important;
    border-bottom-color: rgba(75, 85, 99, 0.5) !important;
}

#site-header.scrolled {
    background-color: rgba(255, 255, 255, 0.98);
    border-bottom-color: rgba(229, 231, 235, 0.8);
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

/* Dark mode scrolled header - higher specificity */
html.dark #site-header.scrolled,
body.dark #site-header.scrolled {
    background-color: rgba(18, 18, 18, 0.98) !important;
    border-bottom-color: rgba(75, 85, 99, 0.8) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2) !important;
}

/* Prevent transitions during theme initialization */
html:not(.theme-transitions-enabled) #site-header {
    transition: none !important;
}

/* Force dark mode header styling */
.dark #site-header,
html.dark #site-header,
body.dark #site-header {
    background-color: rgba(18, 18, 18, 0.95) !important;
    border-bottom-color: rgba(75, 85, 99, 0.5) !important;
}

/* Mobile dark mode header - higher specificity */
@media (max-width: 768px) {
    .dark #site-header,
    html.dark #site-header,
    body.dark #site-header {
        background-color: rgba(18, 18, 18, 0.95) !important;
        border-bottom-color: rgba(75, 85, 99, 0.5) !important;
    }
}

.dark #site-header.scrolled,
html.dark #site-header.scrolled,
body.dark #site-header.scrolled {
    background-color: rgba(18, 18, 18, 0.98) !important;
    border-bottom-color: rgba(75, 85, 99, 0.8) !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.3), 0 1px 2px 0 rgba(0, 0, 0, 0.2) !important;
}

/* Override any potential inline styles */
.dark #site-header[style],
html.dark #site-header[style],
body.dark #site-header[style] {
    background-color: rgba(18, 18, 18, 0.95) !important;
    border-bottom-color: rgba(75, 85, 99, 0.5) !important;
}

.dark #site-header.scrolled[style],
html.dark #site-header.scrolled[style],
body.dark #site-header.scrolled[style] {
    background-color: rgba(18, 18, 18, 0.98) !important;
    border-bottom-color: rgba(75, 85, 99, 0.8) !important;
}

/* Mobile override any potential inline styles */
@media (max-width: 768px) {
    .dark #site-header[style],
    html.dark #site-header[style],
    body.dark #site-header[style] {
        background-color: rgba(18, 18, 18, 0.95) !important;
        border-bottom-color: rgba(75, 85, 99, 0.5) !important;
    }
    
    .dark #site-header.scrolled[style],
    html.dark #site-header.scrolled[style],
    body.dark #site-header.scrolled[style] {
        background-color: rgba(18, 18, 18, 0.98) !important;
        border-bottom-color: rgba(75, 85, 99, 0.8) !important;
    }
}

#site-header.scrolled nav {
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* Header height compensation for main content */
body {
    scroll-padding-top: 80px;
}

/* Ensure mobile menu positioning works with sticky header */
#mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
}

/* Smooth scroll behavior for anchor links */
html {
    scroll-behavior: smooth;
}

/* Adjust main content when header is sticky */
main {
    scroll-margin-top: 80px;
}

/* Header animation on scroll */
@keyframes headerSlideDown {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#site-header.header-visible {
    animation: headerSlideDown 0.3s ease-out;
}

/* Hide header when scrolling down, show when scrolling up */
#site-header.header-hidden {
    transform: translateY(-100%);
}

/* Responsive adjustments for sticky header */
@media (max-width: 768px) {
    #site-header {
        background-color: rgba(255, 255, 255, 0.95) !important;
    }
    
    .dark #site-header,
    html.dark #site-header,
    body.dark #site-header {
        background-color: rgba(18, 18, 18, 0.95) !important;
    }
    
    #site-header.scrolled {
        background-color: rgba(255, 255, 255, 0.98) !important;
    }
    
    .dark #site-header.scrolled,
    html.dark #site-header.scrolled,
    body.dark #site-header.scrolled {
        background-color: rgba(18, 18, 18, 0.98) !important;
    }
    
    #site-header.scrolled nav {
        padding-top: 0.5rem;
        padding-bottom: 0.5rem;
    }
    
    body {
        scroll-padding-top: 60px;
    }
    
    main {
        scroll-margin-top: 60px;
    }
}

/* Back to Top Button Styles */
#back-to-top {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center;
    backdrop-filter: blur(8px);
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.4), 0 2px 4px -2px rgba(59, 130, 246, 0.2);
}

#back-to-top:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    box-shadow: 0 10px 25px -5px rgba(59, 130, 246, 0.6), 0 8px 10px -6px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px) scale(1.1);
}

#back-to-top:active {
    transform: translateY(0) scale(0.95);
}

#back-to-top.scale-125 {
    transform: scale(1.25);
}

#back-to-top.rotate-180 {
    transform: rotate(360deg) scale(1.25);
}

/* Tooltip for back to top button */
#back-to-top .absolute {
    transition: all 0.2s ease;
    transform: translateY(-8px);
}

#back-to-top:hover .absolute {
    transform: translateY(-4px);
    opacity: 1 !important;
}

/* Pulse animation for back to top button */
@keyframes backToTopPulse {
    0%, 100% {
        box-shadow: 0 4px 15px -3px rgba(59, 130, 246, 0.4), 0 2px 4px -2px rgba(59, 130, 246, 0.2);
    }
    50% {
        box-shadow: 0 4px 20px -3px rgba(59, 130, 246, 0.6), 0 2px 8px -2px rgba(59, 130, 246, 0.3);
    }
}

#back-to-top.pulse {
    animation: backToTopPulse 2s infinite;
}

/* Mobile optimizations for back to top button */
@media (max-width: 768px) {
    #back-to-top {
        bottom: 6rem;
        right: 1rem;
        width: 48px;
        height: 48px;
        padding: 12px;
    }
    
    #back-to-top:hover {
        transform: translateY(-2px) scale(1.05);
    }
    
    #back-to-top .absolute {
        display: none; /* Hide tooltip on mobile */
    }
}

/* Profile image styling */
#home .w-32.h-32 img {
    transition: transform 0.3s ease, filter 0.3s ease;
}

#home .w-32.h-32:hover img {
    transform: scale(1.05);
    filter: brightness(1.1);
}

.dark #home .w-32.h-32:hover img {
    filter: brightness(1.2);
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    #back-to-top {
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
    }
    
    #back-to-top:active {
        transform: scale(0.9);
    }
    
    #theme-toggle i {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    #theme-toggle i.fa-moon {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    
    .dark #theme-toggle i.fa-moon {
        transform: translate(-50%, -50%) rotate(180deg);
        opacity: 0;
    }
    
    #theme-toggle i.fa-sun {
        transform: translate(-50%, -50%) rotate(-180deg);
        opacity: 0;
    }
    
    .dark #theme-toggle i.fa-sun {
        transform: translate(-50%, -50%) rotate(0deg);
        opacity: 1;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    #back-to-top {
        background: #000;
        border: 3px solid #fff;
    }
    
    #back-to-top:hover {
        background: #333;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    #back-to-top {
        transition: opacity 0.3s ease;
    }
    
    #back-to-top:hover {
        transform: none;
    }
    
    #back-to-top.scale-125,
    #back-to-top.rotate-180 {
        transform: none;
    }
}

/* Pagination Styles */
.pagination-container {
    animation: fadeInUp 0.6s ease-out;
}

.pagination-controls {
    margin-top: 3rem;
    padding: 2rem 0;
    border-top: 1px solid rgba(229, 231, 235, 0.5);
}

.dark .pagination-container {
    border-top: 1px solid rgba(75, 85, 99, 0.5);
}

.pagination-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    margin: 0 2px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.dark .pagination-btn {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

.pagination-btn:hover:not(.disabled) {
    background: #f9fafb;
    border-color: #3b82f6;
    color: #3b82f6;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.dark .pagination-btn:hover:not(.disabled) {
    background: #374151;
}

.pagination-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.pagination-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.pagination-btn.disabled:hover {
    transform: none;
    box-shadow: none;
}

.pagination-ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    margin: 0 2px;
    color: #9ca3af;
    font-size: 14px;
    font-weight: 500;
}

.dark .pagination-ellipsis {
    color: #6b7280;
}

.pagination-select {
    padding: 8px 12px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.2s ease;
}

.dark .pagination-select {
    background: #1f2937;
    border-color: #374151;
    color: #e5e7eb;
}

.pagination-select:hover {
    border-color: #3b82f6;
}

.pagination-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Post card animations for pagination */
.post-card {
    animation: slideIn 0.5s ease-out backwards;
    margin-bottom: 2rem; /* Consistent spacing with grid gap */
    border: 1px solid transparent;
    background: linear-gradient(white, white) padding-box,
                linear-gradient(to bottom, #e5e7eb, #f3f4f6) border-box;
}

.dark .post-card {
    background: linear-gradient(#1f2937, #1f2937) padding-box,
                linear-gradient(to bottom, #374151, #4b5563) border-box;
}

.post-card:hover {
    border-color: #3b82f6;
    box-shadow: 0 20px 25px -5px rgba(59, 130, 246, 0.15), 
                0 10px 10px -5px rgba(59, 130, 246, 0.04);
}

.dark .post-card:hover {
    border-color: #60a5fa;
    box-shadow: 0 20px 25px -5px rgba(96, 165, 250, 0.25), 
                0 10px 10px -5px rgba(96, 165, 250, 0.1);
}

.post-card:nth-child(1) { animation-delay: 0.1s; }
.post-card:nth-child(2) { animation-delay: 0.2s; }
.post-card:nth-child(3) { animation-delay: 0.3s; }
.post-card:nth-child(4) { animation-delay: 0.4s; }
.post-card:nth-child(5) { animation-delay: 0.5s; }

/* TOC Sidebar Styles - Always Visible */
aside.fixed.left-0 {
    transition: all 0.3s ease;
}

/* TOC Sidebar Content */
aside.fixed.left-0 .toc-nav {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    padding-right: 0.5rem;
}

aside.fixed.left-0 .toc-nav::-webkit-scrollbar {
    width: 4px;
}

aside.fixed.left-0 .toc-nav::-webkit-scrollbar-track {
    background: transparent;
}

aside.fixed.left-0 .toc-nav::-webkit-scrollbar-thumb {
    background: rgba(156, 163, 175, 0.5);
    border-radius: 2px;
}

.dark aside.fixed.left-0 .toc-nav::-webkit-scrollbar-thumb {
    background: rgba(107, 114, 128, 0.5);
}

/* Main content adjustment for TOC sidebar */
@media (min-width: 1280px) {
    main {
        max-width: none;
        width: calc(100% - 18rem); /* Account for TOC sidebar */
        padding-right: 2rem;
    }
}

/* Enhanced spacing for list pages */
.grid.gap-12 > * {
    margin-bottom: 0; /* Remove extra margin since grid handles spacing */
}

.grid.gap-8 > * {
    margin-bottom: 0; /* Remove extra margin since grid handles spacing */
}

.grid.gap-10 > * {
    margin-bottom: 0; /* Remove extra margin since grid handles spacing */
}

/* Article content spacing */
article.post-card {
    padding: 2rem; /* Increased padding */
}

article.post-card > div:last-child {
    margin-top: 1.5rem; /* Space before Read more link */
}

/* Improved tag styling */
.post-card .bg-gray-100,
.post-card .bg-gray-50 {
    transition: all 0.2s ease;
}

.post-card .bg-gray-100:hover,
.post-card .bg-gray-50:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.dark .post-card .bg-gray-800:hover {
    background-color: #374151;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Icon spacing improvements */
.post-card .fas.fa-circle {
    margin-right: 0.5rem;
}

.post-card .flex.items-center.gap-2 {
    gap: 0.75rem; /* Better spacing between icon and text */
}

/* Typography hierarchy */
.post-card h2 {
    font-weight: 700; /* Bolder titles */
    line-height: 1.3;
}

.post-card h2 a {
    color: #111827;
}

.dark .post-card h2 a {
    color: #f9fafb;
}

.post-card time {
    font-weight: 300; /* Lighter metadata */
    opacity: 0.8;
}

.post-card p {
    font-weight: 400; /* Regular weight for summary */
    line-height: 1.6;
}

.post-card .text-blue-500 {
    font-weight: 600; /* Medium weight for links */
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* Mobile pagination optimizations */
@media (max-width: 768px) {
    .pagination-controls {
        margin-top: 2rem;
        padding: 1.5rem 0;
    }
    
    .pagination-btn {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
        margin: 0 1px;
    }
    
    .pagination-ellipsis {
        width: 36px;
        height: 36px;
        font-size: 13px;
        margin: 0 1px;
    }
    
    .pagination-select {
        padding: 6px 10px;
        font-size: 13px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .pagination-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .pagination-select {
        min-height: 44px;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .pagination-btn {
        border-width: 2px;
        border-color: #000;
    }
    
    .dark .pagination-btn {
        border-color: #fff;
    }
    
    .pagination-btn.active {
        background: #000;
        color: #fff;
    }
    
    .dark .pagination-btn.active {
        background: white;
        color: black;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .pagination-btn {
        transition: color 0.2s ease, background-color 0.2s ease;
    }
    
    .pagination-btn:hover {
        transform: none;
        box-shadow: none;
    }
    
    .post-card {
        animation: none;
    }
    
    .fade-in {
        animation: none;
    }
}

/* Project Link Buttons Fix */
.prose .inline-flex.items-center.gap-2 {
    transition: all 0.2s ease;
    opacity: 1 !important;
    background-color: inherit !important;
}

.prose .inline-flex.items-center.gap-2:hover {
    opacity: 1 !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Specific button color fixes */
.prose .bg-gray-900:hover {
    background-color: #111827 !important;
}

.prose .bg-blue-500:hover {
    background-color: #2563eb !important;
}

.prose .bg-green-500:hover {
    background-color: #059669 !important;
}

/* Dark mode button fixes */
.dark .prose .bg-gray-900:hover {
    background-color: #000000 !important;
}

.dark .prose .bg-blue-500:hover {
    background-color: #1d4ed8 !important;
}

.dark .prose .bg-green-500:hover {
    background-color: #047857 !important;
}

/* Ensure button text remains visible */
.prose .inline-flex.items-center.gap-2.text-white {
    color: #ffffff !important;
}

.prose .inline-flex.items-center.gap-2:hover {
    color: #ffffff !important;
}