/* ==========================================================================
   RelateRealms Premium Design System & Stylesheet (custom.css)
   Built on Outfit (UI) and Lora (Reading) Typography
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lora:ital,wght@0,400..700;1,400..700&family=Outfit:wght@300..900&display=swap');

:root {
    /* Color Palette */
    --color-primary: #6366f1;         /* Premium Indigo */
    --color-primary-hover: #4f46e5;
    --color-primary-rgb: 99, 102, 241;
    --color-secondary: #ec4899;       /* Romantic Rose/Pink */
    --color-secondary-hover: #db2777;
    --color-secondary-rgb: 236, 72, 153;
    --color-success: #10b981;
    --color-warning: #f59e0b;
    --color-dark: #0f172a;            /* Slate 900 */
    --color-light: #f8fafc;           /* Slate 50 */
    --color-text-main: #1e293b;       /* Slate 800 */
    --color-text-muted: #64748b;      /* Slate 500 */
    --color-bg-body: #f8fafc;
    --color-bg-card: #ffffff;
    --color-border: #e2e8f0;          /* Slate 200 */
    --color-border-hover: #cbd5e1;    /* Slate 300 */
    
    /* Typography */
    --font-ui: 'Outfit', sans-serif;
    --font-reading: 'Lora', serif;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
    --shadow-premium: 0 20px 25px -5px rgba(99, 102, 241, 0.07), 0 8px 10px -6px rgba(99, 102, 241, 0.07);
    --shadow-glow: 0 0 15px rgba(99, 102, 241, 0.2);

    /* Transitions */
    --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Body */
body {
    background-color: var(--color-bg-body);
    color: var(--color-text-main);
    font-family: var(--font-ui);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

a {
    color: var(--color-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover {
    color: var(--color-primary-hover);
    text-decoration: none;
}

/* Typography Overrides */
h1, h2, h3, h4, h5, h6 {
    color: var(--color-dark);
    font-family: var(--font-ui);
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Custom Components & Utilities */

/* 1. Custom Glassmorphic Navbar */
.navbar-custom {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(226, 232, 240, 0.8);
    padding: 15px 0;
    transition: var(--transition-smooth);
    z-index: 1000;
}
.navbar-custom.sticky {
    padding: 10px 0;
    box-shadow: var(--shadow-md);
    background: rgba(255, 255, 255, 0.95);
}
.navbar-custom .navbar-brand img {
    height: 40px;
    transition: var(--transition-smooth);
}
.navbar-custom.sticky .navbar-brand img {
    height: 35px;
}
.navbar-custom .nav-link {
    color: var(--color-text-main);
    font-weight: 500;
    padding: 8px 16px !important;
    position: relative;
}
.navbar-custom .nav-link:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: 0;
    left: 16px;
    background-color: var(--color-primary);
    transition: var(--transition-fast);
}
.navbar-custom .nav-link:hover {
    color: var(--color-primary);
}
.navbar-custom .nav-link:hover:after,
.navbar-custom .nav-item.active .nav-link:after {
    width: calc(100% - 32px);
}

.navbar-custom .nav-search-btn {
    background: none;
    border: none;
    color: var(--color-text-main);
    font-size: 1.2rem;
    padding: 8px 12px;
    cursor: pointer;
    transition: var(--transition-fast);
}
.navbar-custom .nav-search-btn:hover {
    color: var(--color-primary);
    transform: scale(1.1);
}

/* 2. Custom Buttons */
.btn-custom {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-ui);
    font-weight: 600;
    padding: 12px 28px;
    border-radius: 9999px;
    transition: var(--transition-smooth);
    border: none;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    gap: 8px;
}
.btn-custom-primary {
    background: linear-gradient(135deg, var(--color-primary), #818cf8);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
}
.btn-custom-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
    background: linear-gradient(135deg, var(--color-primary-hover), var(--color-primary));
}
.btn-custom-secondary {
    background: linear-gradient(135deg, var(--color-secondary), #f472b6);
    color: #ffffff !important;
    box-shadow: 0 4px 14px rgba(236, 72, 153, 0.35);
}
.btn-custom-secondary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(236, 72, 153, 0.45);
    background: linear-gradient(135deg, var(--color-secondary-hover), var(--color-secondary));
}
.btn-custom-outline {
    background: transparent;
    border: 2px solid var(--color-primary);
    color: var(--color-primary) !important;
}
.btn-custom-outline:hover {
    background: var(--color-primary);
    color: #ffffff !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(99, 102, 241, 0.25);
}

/* 3. Custom Form Inputs */
.form-group-custom {
    position: relative;
    margin-bottom: 24px;
}
.form-control-custom {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid var(--color-border);
    border-radius: 16px;
    background-color: var(--color-bg-card);
    font-family: var(--font-ui);
    color: var(--color-text-main);
    font-weight: 500;
    transition: var(--transition-smooth);
    outline: none;
}
.form-control-custom:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-glow);
}
.form-group-custom label {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--color-bg-card);
    padding: 0 6px;
    color: var(--color-text-muted);
    transition: var(--transition-smooth);
    pointer-events: none;
}
.form-control-custom:focus ~ label,
.form-control-custom:not(:placeholder-shown) ~ label {
    top: 0;
    font-size: 0.8rem;
    color: var(--color-primary);
    font-weight: 600;
}
textarea.form-control-custom {
    min-height: 150px;
    resize: vertical;
}
textarea.form-control-custom ~ label {
    top: 24px;
    transform: none;
}
textarea.form-control-custom:focus ~ label,
textarea.form-control-custom:not(:placeholder-shown) ~ label {
    top: 0;
}

/* 4. Premium Cards Layout */
.card-custom {
    background-color: var(--color-bg-card);
    border-radius: 24px;
    border: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition-smooth);
    height: 100%;
    display: flex;
    flex-direction: column;
}
.card-custom:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-premium);
    border-color: rgba(99, 102, 241, 0.15);
}
.card-custom-img-wrapper {
    position: relative;
    overflow: hidden;
    aspect-ratio: 16 / 9;
}
.card-custom-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition-smooth);
}
.card-custom:hover .card-custom-img {
    transform: scale(1.05);
}
.card-custom-body {
    padding: 24px;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}
.card-custom-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    align-self: flex-start;
}
.tag-relationship {
    background-color: rgba(236, 72, 153, 0.1);
    color: var(--color-secondary);
}
.tag-friendship {
    background-color: rgba(99, 102, 241, 0.1);
    color: var(--color-primary);
}
.card-custom-title {
    font-size: 1.25rem;
    line-height: 1.4;
    margin-bottom: 12px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.card-custom-title a {
    color: var(--color-dark);
}
.card-custom-title a:hover {
    color: var(--color-primary);
}
.card-custom-meta {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    margin-top: auto;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* 5. Custom Sidebar Widgets */
.sidebar-widget {
    background-color: var(--color-bg-card);
    border-radius: 24px;
    border: 1px solid var(--color-border);
    padding: 24px;
    margin-bottom: 30px;
    box-shadow: var(--shadow-sm);
}
.sidebar-widget-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    position: relative;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--color-border);
}
.sidebar-widget-title::after {
    content: '';
    position: absolute;
    width: 40px;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-primary);
}

.popular-post-item {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}
.popular-post-item:last-child {
    margin-bottom: 0;
}
.popular-post-img-wrapper {
    width: 80px;
    height: 60px;
    border-radius: 12px;
    overflow: hidden;
    flex-shrink: 0;
}
.popular-post-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.popular-post-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.popular-post-title {
    font-size: 0.95rem;
    line-height: 1.3;
    font-weight: 600;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.popular-post-title a {
    color: var(--color-dark);
}
.popular-post-title a:hover {
    color: var(--color-primary);
}
.popular-post-date {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

.keyword-container {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.keyword-badge {
    background-color: var(--color-light);
    color: var(--color-text-muted);
    font-size: 0.8rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--color-border);
    transition: var(--transition-fast);
}
.keyword-badge:hover {
    background-color: var(--color-primary);
    color: #ffffff;
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* 6. High Quality Typography for Article Reading */
.article-container {
    max-width: 800px;
    margin: 0 auto;
}
.article-header {
    margin-bottom: 30px;
}
.article-title {
    font-size: 2.5rem;
    line-height: 1.25;
    font-weight: 800;
    margin-bottom: 20px;
}
@media (max-width: 768px) {
    .article-title {
        font-size: 2rem;
    }
}
.article-meta-info {
    display: flex;
    align-items: center;
    gap: 20px;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    margin-bottom: 24px;
}
.article-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
}
.article-featured-image {
    width: 100%;
    border-radius: 28px;
    box-shadow: var(--shadow-lg);
    margin-bottom: 40px;
    object-fit: cover;
    aspect-ratio: 2 / 1;
}

/* Readable Article Body Text styling */
.article-body {
    font-family: var(--font-reading);
    font-size: 1.15rem;
    line-height: 1.8;
    color: #2d3748; /* Off-black */
}
.article-body p {
    margin-bottom: 24px;
}
.article-body h2 {
    font-family: var(--font-ui);
    font-size: 1.8rem;
    margin-top: 48px;
    margin-bottom: 20px;
    color: var(--color-dark);
}
.article-body h3 {
    font-family: var(--font-ui);
    font-size: 1.4rem;
    margin-top: 36px;
    margin-bottom: 16px;
    color: var(--color-dark);
}
.article-body ul, .article-body ol {
    margin-bottom: 28px;
    padding-left: 24px;
}
.article-body li {
    margin-bottom: 12px;
}
.article-body blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 10px 24px;
    margin: 30px 0;
    font-style: italic;
    background-color: rgba(99, 102, 241, 0.03);
    border-radius: 0 16px 16px 0;
}

/* 7. Share Buttons Component */
.share-section {
    border-top: 1px solid var(--color-border);
    border-bottom: 1px solid var(--color-border);
    padding: 20px 0;
    margin: 40px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 15px;
}
.share-title {
    font-weight: 700;
    margin: 0;
    font-size: 1.1rem;
}
.share-btn-list {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.share-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--color-light);
    color: var(--color-text-main);
    transition: var(--transition-smooth);
    border: 1px solid var(--color-border);
}
.share-btn svg {
    width: 18px;
    height: 18px;
    fill: currentColor;
}
.share-btn:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}
.share-btn.wa:hover { background-color: #25d366; border-color: #25d366; }
.share-btn.fb:hover { background-color: #1877f2; border-color: #1877f2; }
.share-btn.tw:hover { background-color: #1da1f2; border-color: #1da1f2; }
.share-btn.li:hover { background-color: #0077b5; border-color: #0077b5; }
.share-btn.re:hover { background-color: #ff4500; border-color: #ff4500; }
.share-btn.tl:hover { background-color: #0088cc; border-color: #0088cc; }
.share-btn.pi:hover { background-color: #bd081c; border-color: #bd081c; }

/* 8. Accordion/FAQ Drawers (Highly Customized UI) */
.faq-drawer-custom {
    margin-bottom: 16px;
    border-radius: 16px;
    background-color: var(--color-bg-card);
    border: 1px solid var(--color-border);
    overflow: hidden;
    transition: var(--transition-smooth);
}
.faq-drawer-custom:hover {
    border-color: rgba(99, 102, 241, 0.3);
    box-shadow: var(--shadow-sm);
}
.faq-header {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    background: none;
    border: none;
    text-align: left;
    font-weight: 600;
    color: var(--color-dark);
    font-size: 1.05rem;
    cursor: pointer;
    outline: none;
}
.faq-header .faq-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background-color: var(--color-light);
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition-smooth);
    flex-shrink: 0;
    margin-left: 15px;
}
.faq-header.active .faq-icon {
    background-color: var(--color-primary);
    color: #ffffff;
    transform: rotate(180deg);
}
.faq-content-wrapper {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.faq-content {
    padding: 0 24px 20px 24px;
    color: var(--color-text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

/* 9. Interactive Full-Screen Search Modal */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.9);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
}
.search-overlay.active {
    opacity: 1;
    visibility: visible;
}
.search-close-btn {
    position: absolute;
    top: 40px;
    right: 40px;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 2.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.search-close-btn:hover {
    color: var(--color-primary);
    transform: rotate(90deg);
}
.search-container {
    width: 90%;
    max-width: 700px;
    display: flex;
    flex-direction: column;
    gap: 30px;
}
.search-form-wrapper {
    position: relative;
    width: 100%;
}
.search-input-premium {
    width: 100%;
    padding: 20px 60px 20px 30px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 9999px;
    color: #ffffff;
    font-size: 1.5rem;
    outline: none;
    transition: var(--transition-smooth);
}
.search-input-premium::placeholder {
    color: rgba(255, 255, 255, 0.5);
}
.search-input-premium:focus {
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--color-primary);
    box-shadow: 0 0 25px rgba(99, 102, 241, 0.3);
}
.search-submit-icon {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition-fast);
}
.search-submit-icon:hover {
    color: var(--color-primary);
}
.search-results-panel {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    max-height: 400px;
    overflow-y: auto;
    display: none;
    box-shadow: var(--shadow-lg);
    padding: 10px;
}
.search-results-item {
    display: flex;
    padding: 12px 20px;
    border-radius: 12px;
    gap: 15px;
    transition: var(--transition-fast);
}
.search-results-item:hover {
    background-color: var(--color-light);
}
.search-results-img {
    width: 60px;
    height: 45px;
    border-radius: 6px;
    object-fit: cover;
}
.search-results-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.search-results-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--color-dark);
}
.search-results-category {
    font-size: 0.75rem;
    color: var(--color-text-muted);
}

/* 10. Slider & Home Layout Elements */
.slider-container-premium {
    position: relative;
    border-radius: 32px;
    overflow: hidden;
    margin-bottom: 50px;
    box-shadow: var(--shadow-lg);
}
.slide-premium {
    height: 500px;
    position: relative;
    display: flex;
    align-items: flex-end;
}
@media (max-width: 768px) {
    .slide-premium {
        height: 380px;
    }
}
.slide-img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 1;
}
.slide-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(0deg, rgba(15, 23, 42, 0.95) 0%, rgba(15, 23, 42, 0.4) 60%, rgba(15, 23, 42, 0) 100%);
    z-index: 2;
}
.slide-content {
    position: relative;
    z-index: 3;
    padding: 50px;
    color: #ffffff;
    width: 100%;
}
@media (max-width: 576px) {
    .slide-content {
        padding: 24px;
    }
}
.slide-category {
    background-color: var(--color-primary);
    color: #ffffff;
    padding: 4px 12px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    border-radius: 99px;
    display: inline-block;
    margin-bottom: 15px;
}
.slide-title {
    font-size: 2.25rem;
    color: #ffffff;
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 10px;
}
.slide-title a {
    color: #ffffff;
}
.slide-title a:hover {
    color: rgba(255, 255, 255, 0.85);
}
@media (max-width: 768px) {
    .slide-title {
        font-size: 1.5rem;
    }
}
.slide-meta {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
}

/* Carousel Control Custom styling */
.carousel-indicators-custom [data-bs-target] {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    margin: 0 6px;
    border: none;
    transition: var(--transition-fast);
}
.carousel-indicators-custom .active {
    width: 24px;
    border-radius: 4px;
    background-color: #ffffff;
}

/* Footer Section Styling */
.footer-premium {
    background-color: var(--color-dark);
    color: rgba(255, 255, 255, 0.7);
    padding: 80px 0 30px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.footer-title {
    color: #ffffff;
    font-size: 1.25rem;
    margin-bottom: 24px;
}
.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
}
.footer-links li {
    margin-bottom: 12px;
}
.footer-links a {
    color: rgba(255, 255, 255, 0.6);
    transition: var(--transition-fast);
}
.footer-links a:hover {
    color: #ffffff;
    padding-left: 4px;
}
.footer-bottom {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

/* Back to Top button styling */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    background-color: var(--color-primary);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-md);
    cursor: pointer;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    z-index: 999;
}
.back-to-top.active {
    opacity: 1;
    visibility: visible;
}
.back-to-top:hover {
    transform: translateY(-3px);
    background-color: var(--color-primary-hover);
    color: #ffffff;
    box-shadow: var(--shadow-lg);
}

/* Header section padding helper */
.header-spacing {
    padding-top: 100px;
}

/* ==========================================================================
   11. Table of Contents (TOC) Custom Styling
   ========================================================================== */

/* Desktop TOC Widget inside Sidebar */
.toc-container-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toc-container-list ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.toc-link {
    display: block;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.4;
    padding: 4px 0 4px 16px;
    border-left: 2px solid var(--color-border);
    transition: var(--transition-fast);
    text-decoration: none;
}
.toc-link:hover {
    color: var(--color-primary);
    border-left-color: var(--color-primary);
}
.toc-link.active {
    color: var(--color-primary);
    font-weight: 600;
    border-left-color: var(--color-primary);
}
.toc-link.toc-h3 {
    margin-left: 12px;
    font-size: 0.88rem;
    padding-left: 12px;
}

/* Mobile Bottom Sticky TOC Trigger */
.mobile-toc-container {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1040;
    pointer-events: none;
}
.mobile-toc-trigger {
    pointer-events: auto;
    width: 100%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-top: 1px solid var(--color-border);
    padding: 14px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 -4px 15px rgba(0, 0, 0, 0.06);
    font-family: var(--font-ui);
    font-weight: 600;
    color: var(--color-dark);
    border-radius: 20px 20px 0 0;
    transition: var(--transition-smooth);
    cursor: pointer;
    font-size: 0.95rem;
}
.mobile-toc-trigger:hover {
    background: #ffffff;
    color: var(--color-primary);
}
.mobile-toc-trigger .toggle-arrow {
    font-size: 0.85rem;
    transition: transform 0.3s ease;
    color: var(--color-text-muted);
}
.mobile-toc-trigger.active .toggle-arrow {
    transform: rotate(180deg);
}

/* Mobile Bottom TOC Drawer */
.mobile-toc-drawer {
    pointer-events: auto;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-radius: 24px 24px 0 0;
    box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1050;
    max-height: 65vh;
    display: flex;
    flex-direction: column;
}
.mobile-toc-drawer.active {
    transform: translateY(0);
}
.mobile-toc-header {
    padding: 18px 24px;
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-family: var(--font-ui);
    color: var(--color-dark);
}
.mobile-toc-close {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 0 4px;
    transition: var(--transition-fast);
}
.mobile-toc-close:hover {
    color: var(--color-secondary);
}
.mobile-toc-body {
    padding: 24px;
    overflow-y: auto;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mobile-toc-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.mobile-toc-body .toc-link {
    border-left: 2px solid var(--color-border);
    padding: 2px 0 2px 14px;
    font-size: 1rem;
}
.mobile-toc-body .toc-link.toc-h3 {
    margin-left: 14px;
    font-size: 0.92rem;
}

/* Backdrop Overlay */
.mobile-toc-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    opacity: 0;
    visibility: hidden;
    transition: var(--transition-smooth);
    z-index: 1045;
}
.mobile-toc-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* Adjust scroll padding to prevent heading getting cut off by navbar when clicking TOC link */
html {
    scroll-behavior: smooth;
    scroll-padding-top: 100px;
}
