/* Custom CSS to increase main content width and center align */

/* Increase the max-width of the main content area */
.bd-main .bd-content {
    max-width: 100% !important;
}

/* Adjust the article container width and center it */
.bd-article-container {
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Increase the width of the main article content */
article.bd-article {
    max-width: none !important;
}

/* Center the main container */
.bd-container {
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

/* Center the main content area */
.bd-main {
    margin-left: auto !important;
    margin-right: auto !important;
}

.article-metadata {
    color: #666;
    font-size: 0.9em;
    margin-top: 0.25rem;
    margin-bottom: 1.5rem;
    font-style: italic;
}

/* Footer inline layout - left aligned */
.bd-footer__inner {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start; /* align content to the left */
    align-items: center;
    gap: 0.5rem;
    text-align: left;
    width: 100%;
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 3rem !important; /* 1rem container + 2rem article padding */
    padding-right: 1.5rem !important;
}

.bd-footer__inner .footer-items__start,
.bd-footer__inner .footer-items__end,
.bd-footer__inner .footer-item {
    display: contents;
}

.bd-footer__inner .footer-item p {
    display: inline;
    margin: 0;
}

.bd-footer__inner .footer-item p br {
    display: none;
}

/* Hide breadcrumb header strip */
.bd-header-article {
    display: none !important;
}

/* Ensure content doesn't get too wide on very large screens */
@media (min-width: 1200px) {
    .bd-main .bd-content .bd-article-container {
        max-width: 1400px !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
}

/* Add rounded corners to all images */
img {
    border-radius: 5px !important;
    overflow: hidden;
}

/* Also apply to images in figures */
figure img {
    border-radius: 5px !important;
    overflow: hidden;
}

/* Apply to images in content area */
.bd-article img {
    border-radius: 5px !important;
    overflow: hidden;
}

/* Apply to images in main content */
.bd-main img {
    border-radius: 5px !important;
    overflow: hidden;
}

/* Make figure numbers bold instead of italic */
.caption-number {
    font-weight: bold !important;
    font-style: normal !important;
}

.article-metadata .edit-link {
    color: #586069;
    text-decoration: none;
}

.article-metadata .edit-link:hover {
    color: #0366d6;
    text-decoration: underline;
}

.article-metadata .edit-link i {
    margin-right: 3px;
}

/* Header navbar - align logo text with main content */
.bd-header__inner {
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
}

/* Move logo image to the left so the text aligns with content */
.navbar-brand.logo {
    margin-left: -1.1rem !important; /* Push logo left so text aligns */
}

.navbar-brand.logo .logo__image {
    margin-right: 0.5rem;
}

/* Align navbar icon links with main content on the right */
.navbar-header-items__end {
    padding-right: 1rem !important;
}

/* Giscus comment header styling */
.giscus-header {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
    font-size: 0.95em;
}

.giscus-title {
    font-size: 1.5em;
    font-weight: bold;
}

.giscus-stats {
    color: #586069;
    font-style: italic;
}

.giscus-stats a {
    color: #586069;
    text-decoration: none;
}

.giscus-stats a:hover {
    color: #0366d6;
    text-decoration: underline;
}

#giscus-reactions {
    font-style: normal;
}

/* Dark-themed back-to-top button override */
#pst-back-to-top {
    background-color: #111 !important;
    color: #f1f1f1 !important;
}

#pst-back-to-top:hover,
#pst-back-to-top:focus {
    background-color: #000 !important;
    color: #ffffff !important;
}

/* ===== Image Lightbox Styles ===== */

/* Make images clickable */
.bd-article img:not(.lightbox-ignore),
.bd-main img:not(.lightbox-ignore):not(.logo__image):not([src*="logo"]) {
    cursor: zoom-in;
}

/* Lightbox overlay */
.lightbox-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    cursor: zoom-out;
}

.lightbox-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* Lightbox image */
.lightbox-overlay img {
    max-width: 95%;
    max-height: 95%;
    object-fit: contain;
    border-radius: 8px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    cursor: zoom-out;
}

.lightbox-overlay.active img {
    transform: scale(1);
}

/* Close button */
.lightbox-close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: #fff;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.2s ease, transform 0.2s ease;
    z-index: 10000;
    line-height: 1;
}

.lightbox-close:hover {
    color: #ccc;
    transform: scale(1.1);
}

/* Caption in lightbox */
.lightbox-caption {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #fff;
    font-size: 14px;
    text-align: center;
    max-width: 80%;
    padding: 10px 20px;
    background-color: rgba(0, 0, 0, 0.6);
    border-radius: 5px;
}

/* Navigation arrows (for future enhancement) */
.lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    color: #fff;
    font-size: 50px;
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s ease;
    user-select: none;
}

.lightbox-nav:hover {
    color: #ccc;
}

.lightbox-prev {
    left: 20px;
}

.lightbox-next {
    right: 20px;
}

/* ===== Blog Card Styles ===== */

.blog-card {
    background-color: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: background-color 0.2s ease, transform 0.2s ease;
    border: 1px solid rgba(255, 255, 255, 0.1);
    cursor: pointer;
    position: relative;
}

.blog-card:hover {
    background-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-2px);
}

.blog-card-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    line-height: 1.3;
}

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

/* Make the link cover the entire card */
.blog-card-title a::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
}

.blog-card-title a:hover {
    color: #58a6ff;
}

.blog-card-description {
    color: #8b949e;
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.blog-card-meta {
    color: #6e7681;
    font-size: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.blog-card-meta span:not(:last-child)::after {
    content: "|";
    margin-left: 0.5rem;
    color: #484f58;
}

/* Light theme adjustments */
html[data-theme="light"] .blog-card {
    background-color: rgba(0, 0, 0, 0.03);
    border-color: rgba(0, 0, 0, 0.1);
}

html[data-theme="light"] .blog-card:hover {
    background-color: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .blog-card-description {
    color: #57606a;
}

html[data-theme="light"] .blog-card-meta {
    color: #6e7781;
}

html[data-theme="light"] .blog-card-meta span:not(:last-child)::after {
    color: #d0d7de;
}
