/* Custom CSS for the Personal Blog */

/* Ensure smooth transitions for sidebar */
#sidebar {
    transition: transform 0.3s ease-in-out;
}

/* Active category link styling */
.category-link.active {
    background-color: rgb(219 234 254); /* bg-blue-50 */
    color: rgb(37 99 235); /* text-blue-600 */
}

/* Custom scrollbar styling for sidebar */
#sidebar::-webkit-scrollbar {
    width: 6px;
}

#sidebar::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

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

/* Overlay for mobile menu */
.sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 30;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease-in-out;
}

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

/* Language button active state */
.lang-active {
    background-color: rgb(37 99 235) !important; /* bg-blue-600 */
}

/* Sidebar resize handle styling */
#sidebar-resize-handle {
    background-color: rgba(229, 231, 235, 0.8); /* gray-200 with opacity */
    transition: all 0.2s ease-in-out;
}

#sidebar-resize-handle:hover {
    background-color: rgb(59, 130, 246); /* blue-500 */
    width: 0.75rem !important; /* w-3 = 12px */
}

#sidebar-resize-handle:active {
    background-color: rgb(37, 99, 235); /* blue-600 */
    width: 1rem !important; /* w-4 = 16px */
}

/* Prevent text selection during resize */
body.resizing {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Responsive grid adjustments for masonry effect */
@media (min-width: 768px) {
    .grid > article:nth-child(3n + 1) img {
        height: 12rem; /* h-48 */
    }

    .grid > article:nth-child(3n + 2) img {
        height: 16rem; /* h-64 */
    }

    .grid > article:nth-child(3n + 3) img {
        height: 10rem; /* h-40 */
    }
}

/* Hover effects for cards */
article a {
    display: block;
    transition: transform 0.2s ease-in-out;
}

article:hover a {
    transform: translateY(-4px);
}

/* Prose styling for article detail page - Tailwind Typography alternative */
.prose {
    color: #374151;
    max-width: 65ch;
}

.prose p {
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    line-height: 1.75;
}

.prose img {
    margin-top: 2em;
    margin-bottom: 2em;
    border-radius: 0.5rem;
}

.prose h1 {
    font-size: 2.25em;
    margin-top: 0;
    margin-bottom: 0.8888889em;
    line-height: 1.1111111;
    font-weight: 800;
    color: #111827;
}

.prose h2 {
    font-size: 1.5em;
    margin-top: 2em;
    margin-bottom: 1em;
    line-height: 1.3333333;
    font-weight: 700;
    color: #111827;
}

.prose h3 {
    font-size: 1.25em;
    margin-top: 1.6em;
    margin-bottom: 0.6em;
    line-height: 1.6;
    font-weight: 600;
    color: #111827;
}

.prose h4 {
    margin-top: 1.5em;
    margin-bottom: 0.5em;
    line-height: 1.5;
    font-weight: 600;
    color: #111827;
}

.prose strong {
    color: #111827;
    font-weight: 600;
}

.prose a {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
    display: inline;
}

.prose a:hover {
    color: #1d4ed8;
}

.prose code {
    color: #111827;
    font-weight: 600;
    font-size: 0.875em;
    background-color: #f3f4f6;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
}

.prose pre {
    color: #e5e7eb;
    background-color: #1f2937;
    overflow-x: auto;
    font-size: 0.875em;
    line-height: 1.7142857;
    margin-top: 1.7142857em;
    margin-bottom: 1.7142857em;
    border-radius: 0.375rem;
    padding: 0.8571429em 1.1428571em;
}

.prose pre code {
    background-color: transparent;
    border-width: 0;
    border-radius: 0;
    padding: 0;
    font-weight: 400;
    color: inherit;
    font-size: inherit;
    font-family: inherit;
    line-height: inherit;
}

.prose blockquote {
    font-weight: 500;
    font-style: italic;
    color: #111827;
    border-left-width: 0.25rem;
    border-left-color: #e5e7eb;
    quotes: "\201C" "\201D" "\2018" "\2019";
    margin-top: 1.6em;
    margin-bottom: 1.6em;
    padding-left: 1em;
}

.prose ul {
    list-style-type: disc;
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose ol {
    list-style-type: decimal;
    margin-top: 1.25em;
    margin-bottom: 1.25em;
    padding-left: 1.625em;
}

.prose li {
    margin-top: 0.5em;
    margin-bottom: 0.5em;
}

.prose table {
    width: 100%;
    table-layout: auto;
    text-align: left;
    margin-top: 2em;
    margin-bottom: 2em;
    font-size: 0.875em;
    line-height: 1.7142857;
}

.prose thead {
    border-bottom-width: 1px;
    border-bottom-color: #d1d5db;
}

.prose thead th {
    color: #111827;
    font-weight: 600;
    vertical-align: bottom;
    padding-right: 0.5714286em;
    padding-bottom: 0.5714286em;
    padding-left: 0.5714286em;
}

.prose tbody tr {
    border-bottom-width: 1px;
    border-bottom-color: #e5e7eb;
}

.prose tbody td {
    vertical-align: baseline;
    padding: 0.5714286em;
}

.prose-lg {
    font-size: 1.125rem;
    line-height: 1.7777778;
}

.prose-lg p {
    margin-top: 1.3333333em;
    margin-bottom: 1.3333333em;
}

.prose-lg h2 {
    font-size: 1.6666667em;
    margin-top: 1.8666667em;
    margin-bottom: 1.0666667em;
    line-height: 1.3333333;
}

/* Carousel Styles */
.carousel-slides {
    position: relative;
}

.carousel-slide {
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.carousel-slide.active {
    display: flex !important;
    opacity: 1;
}

.carousel-indicator.active {
    background-color: rgb(37 99 235) !important;
}

.carousel-prev:hover,
.carousel-next:hover {
    transform: translateY(-50%) scale(1.1);
}
