/* Custom styles for Adrin's Blog */

/* ============================================
   Theme Toggle
   ============================================ */
#theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 1050;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--bs-primary);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

#theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* ============================================
   Typography & Readability
   ============================================ */
.page-content {
    max-width: 70ch;
    line-height: 1.75;
    font-size: 1.05rem;
}

.page-content p {
    margin-bottom: 1.5rem;
}

.page-content h2, .page-content h3, .page-content h4 {
    margin-top: 2rem;
    margin-bottom: 1rem;
}

article .card-text {
    line-height: 1.65;
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    letter-spacing: -0.02em;
}

/* ============================================
   Modern Card Design
   ============================================ */
.card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: none;
    background: var(--bs-body-bg);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
}

/* Sidebar cards - subtle styling */
.col-md-3 .card {
    border-radius: 1rem;
    overflow: hidden;
}

.col-md-3 .card:hover {
    transform: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
}

.col-md-3 .card-header {
    border-bottom: none;
    padding: 1rem 1.25rem;
}

.col-md-3 .card-header h6 {
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ============================================
   Modern Sidebar
   ============================================ */
.list-group-item {
    border: none;
    padding: 0.875rem 1.25rem;
    background: transparent;
    transition: background 0.15s;
}

.list-group-item:hover {
    background: var(--bs-tertiary-bg);
}

.list-group-item a {
    font-weight: 500;
}

.list-group-item small {
    font-size: 0.8rem;
    opacity: 0.7;
}

/* Social buttons */
.card-body .btn-outline-secondary {
    border-radius: 50%;
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    transition: all 0.2s;
}

.card-body .btn-outline-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* ============================================
   Navigation
   ============================================ */
.navbar {
    font-size: 0.95rem;
    border-radius: 1rem !important;
}

.nav-link {
    padding: 0.6rem 1.1rem !important;
    font-weight: 500;
    border-radius: 0.5rem;
    margin: 0 0.1rem;
    transition: background 0.15s;
}

.nav-link:hover {
    background: var(--bs-tertiary-bg);
}

.nav-item.active .nav-link {
    background: var(--bs-primary);
    color: white !important;
}

/* ============================================
   Blog Post Cards (Index)
   ============================================ */
main .card {
    border-radius: 1rem;
    overflow: hidden;
}

main .card-body {
    padding: 1.5rem;
}

main .card-title {
    font-size: 1.35rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

main .card-title a {
    background-image: linear-gradient(var(--bs-primary), var(--bs-primary));
    background-size: 0% 2px;
    background-position: 0 100%;
    background-repeat: no-repeat;
    transition: background-size 0.3s;
}

main .card-title a:hover {
    background-size: 100% 2px;
}

/* ============================================
   Links
   ============================================ */
a {
    transition: color 0.15s ease-in-out;
}

.text-decoration-none:hover {
    text-decoration: none !important;
}

/* ============================================
   Footer
   ============================================ */
footer {
    margin-top: 4rem;
    border-top: 1px solid var(--bs-border-color);
    padding-top: 2rem;
}

/* Hide empty "Browse content by" section */
footer .col-md-2:has(ul.list-unstyled:not(:has(li))) {
    display: none;
}

/* ============================================
   Code Blocks
   ============================================ */
.highlight {
    border-radius: 0.75rem;
    margin: 1.5rem 0;
    padding: 1rem;
}

code {
    font-size: 0.9em;
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    background: var(--bs-tertiary-bg);
}

/* ============================================
   Responsive Adjustments
   ============================================ */
@media (max-width: 768px) {
    #theme-toggle {
        bottom: 1rem;
        right: 1rem;
        width: 44px;
        height: 44px;
    }

    .page-content {
        font-size: 1rem;
    }

    main .card-title {
        font-size: 1.15rem;
    }
}

/* ============================================
   Dark Mode Adjustments
   ============================================ */
[data-bs-theme="dark"],
[data-bs-theme="dark"] body,
[data-bs-theme="dark"] body.bg-transparent {
    --bs-body-color: #c9d1d9 !important;
    --bs-body-bg: #0d1117 !important;
    --bs-tertiary-bg: #161b22 !important;
    --bs-secondary-bg: #161b22 !important;
    --bs-body-emphasis: #e6edf3 !important;
    background-color: #0d1117 !important;
    color: #c9d1d9 !important;
    /* Fix blurry text in dark mode */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

[data-bs-theme="dark"] .container,
[data-bs-theme="dark"] .bg-body-tertiary {
    background-color: #161b22 !important;
}

[data-bs-theme="dark"] .page-content,
[data-bs-theme="dark"] .page-content p,
[data-bs-theme="dark"] .page-content li,
[data-bs-theme="dark"] article p,
[data-bs-theme="dark"] .card-text {
    color: #c9d1d9;
}

[data-bs-theme="dark"] h1,
[data-bs-theme="dark"] h2,
[data-bs-theme="dark"] h3,
[data-bs-theme="dark"] h4,
[data-bs-theme="dark"] h5,
[data-bs-theme="dark"] h6,
[data-bs-theme="dark"] h1 a,
[data-bs-theme="dark"] h2 a,
[data-bs-theme="dark"] h3 a {
    color: #e6edf3 !important;
    font-weight: 600;
}

[data-bs-theme="dark"] .card {
    background: #161b22;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] .card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4) !important;
}

[data-bs-theme="dark"] .list-group-item {
    background: transparent;
    color: #c9d1d9;
}

[data-bs-theme="dark"] .list-group-item a {
    color: #58a6ff;
}

[data-bs-theme="dark"] .list-group-item:hover {
    background: #21262d;
}

[data-bs-theme="dark"] .highlight {
    background: #161b22;
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] code {
    background: #21262d;
    color: #f0883e;
}

[data-bs-theme="dark"] #theme-toggle {
    background: #21262d;
    color: #c9d1d9;
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] a {
    color: #58a6ff;
}

[data-bs-theme="dark"] .text-body-secondary,
[data-bs-theme="dark"] small.text-body-secondary,
[data-bs-theme="dark"] .text-body-tertiary {
    color: #8b949e !important;
}

[data-bs-theme="dark"] .text-body-emphasis {
    color: #e6edf3 !important;
}

[data-bs-theme="dark"] .text-body {
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] hr {
    border-color: #30363d;
    opacity: 1;
}

[data-bs-theme="dark"] .navbar {
    background-color: #161b22 !important;
    border: 1px solid #30363d;
}

[data-bs-theme="dark"] .nav-link {
    color: #c9d1d9 !important;
}

[data-bs-theme="dark"] .nav-link:hover {
    color: #e6edf3 !important;
    background-color: #21262d !important;
}

[data-bs-theme="dark"] .nav-item.active .nav-link {
    background: #1f6feb !important;
    color: #fff !important;
}

[data-bs-theme="dark"] main,
[data-bs-theme="dark"] #content {
    color: #c9d1d9;
}

[data-bs-theme="dark"] strong {
    color: #e6edf3;
}

[data-bs-theme="dark"] .card-header {
    background-color: #21262d !important;
    border-bottom: 1px solid #30363d;
}

html[data-bs-theme="dark"] footer,
html[data-bs-theme="dark"] footer.container-fluid {
    background: #0d1117 !important;
    background-image: none !important;
    border-top: 1px solid #30363d !important;
    color: #8b949e !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html[data-bs-theme="dark"] footer a,
html[data-bs-theme="dark"] footer a.text-dark {
    color: #58a6ff !important;
}

html[data-bs-theme="dark"] footer .text-body-secondary,
html[data-bs-theme="dark"] footer .text-body-tertiary,
html[data-bs-theme="dark"] footer .text-muted {
    color: #8b949e !important;
}

html[data-bs-theme="dark"] footer h6 {
    color: #c9d1d9 !important;
}

html[data-bs-theme="dark"] footer p,
html[data-bs-theme="dark"] footer li {
    color: #8b949e !important;
}
