/* Ryan's Personal Academic Site Styles - Refined Cosmic Edition */

/* CSS Reset & Base Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    line-height: 1.6;
    color: #f8fafc;
    background-color: #000005;
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
    transition: all 0.3s ease;
    min-height: 100vh;
    position: relative;
    overflow-x: hidden;
}

/* --- Dark Mode Styles --- */
body.dark-mode {
    background-color: #000000;
    color: #e2e8f0;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
    color: #f1f5f9;
}

body.dark-mode p {
    color: #cbd5e1;
}

body.dark-mode a {
    color: #ffffff;
}

body.dark-mode a:hover {
    color: #93c5fd;
}

/* --- Semantic Hover Effect Classes --- */

/* Card hover effect - for elements that should lift and scale */
.card {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 25px 50px rgba(30, 41, 59, 0.4), 0 10px 30px rgba(71, 85, 105, 0.3);
}

body.dark-mode .card:hover {
    box-shadow: 0 25px 50px rgba(15, 23, 42, 0.6), 0 10px 30px rgba(30, 41, 59, 0.4);
}

/* Interactive section hover effect - for sections that should gently lift */
.interactive-section {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive-section:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 40px rgba(30, 41, 59, 0.3), 0 8px 25px rgba(71, 85, 105, 0.2);
}

body.dark-mode .interactive-section:hover {
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.5), 0 8px 25px rgba(30, 41, 59, 0.3);
}

/* Subtle hover effect - for elements that should have minimal movement */
.hover-subtle {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hover-subtle:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(30, 41, 59, 0.2), 0 6px 20px rgba(71, 85, 105, 0.15);
}

body.dark-mode .hover-subtle:hover {
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.4), 0 6px 20px rgba(30, 41, 59, 0.25);
}

/* Static container */
.static-container {
    transition: all 0.3s ease;
}

/* Typography with animations */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.2;
    margin-bottom: 1rem;
    color: #f1f5f9;
    transition: all 0.3s ease;
    position: relative;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.5rem; }

.page-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #8b5cf6 0%, #06b6d4 50%, #10b981 100%);
    background-size: 200% 200%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradientText 4s ease infinite;
    position: relative;
    display: inline-block;
}

@keyframes gradientText {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

p {
    margin-bottom: 1rem;
    color: #e2e8f0;
    transition: color 0.3s ease;
}

/* Links */
a {
    color: #60a5fa;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    text-decoration: underline;
}

a::before {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    transition: width 0.3s ease;
}

a:hover::before {
    width: 100%;
}

a:hover {
    color: #93c5fd;
    transform: translateY(-1px);
}

/* Theme Toggle */
.theme-toggle {
    position: fixed;
    top: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 50px;
    height: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    z-index: 1000;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.theme-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.1) rotate(180deg);
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-icon {
    font-size: 1.3rem;
    transition: all 0.3s ease;
    display: block;
    line-height: 1;
    color: #f1f5f9;
}

/* Header Styles */
.site-header {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(30px);
    border-radius: 20px;
    padding: 3rem 2rem;
    margin-bottom: 2rem;
    color: white;
    text-align: center;
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
}

.site-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
    animation: shimmer 4s infinite;
}

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

.site-header * {
    position: relative;
    z-index: 1;
}

.site-header .page-title {
    color: white;
    background: linear-gradient(135deg, #ffffff 0%, #f1f5f9 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.site-subtitle {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.2rem;
    font-weight: 300;
    animation: fadeInUp 0.6s ease 0.3s both;
}

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

/* Enhanced Section Styles */
.section {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border-radius: 20px;
    padding: 2.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.12);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradientMove 4s ease infinite;
}

@keyframes gradientMove {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

body.dark-mode .section {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.section-title {
    color: #f1f5f9;
    border-bottom: 1px solid transparent;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4) bottom;
    background-size: 100% 3px;
    background-repeat: no-repeat;
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    display: inline-block;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 0;
    height: 3px;
    background: linear-gradient(90deg, #10b981, #06b6d4);
    transition: width 0.3s ease;
}

.section-title:hover::after {
    width: 100%;
}

body.dark-mode .section-title {
    color: #f1f5f9;
}

/* Q&A Styles */
.qa-item {
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.06);
    backdrop-filter: blur(20px);
    border-left: 4px solid transparent;
    border-image: linear-gradient(135deg, #8b5cf6, #06b6d4) 1;
    border-radius: 0 12px 12px 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

/* List Styling */
.qa-item ul,
.qa-item ol,
.section ul,
.section ol {
    margin-left: 2rem;
    margin-bottom: 1rem;
}

.qa-item ul li,
.qa-item ol li,
.section ul li,
.section ol li {
    margin-bottom: 0.5rem;
    color: #e2e8f0;
}

body.dark-mode .qa-item ul li,
body.dark-mode .qa-item ol li,
body.dark-mode .section ul li,
body.dark-mode .section ol li {
    color: #cbd5e1;
}

.qa-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4, #10b981);
    animation: gradientMove 4s ease infinite;
}

.qa-item:hover {
    transform: translateX(8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

body.dark-mode .qa-item {
    background: rgba(255, 255, 255, 0.04);
}

.question {
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
    position: relative;
}

.question::before {
    content: '❓';
    margin-right: 0.5rem;
    opacity: 0.8;
}

body.dark-mode .question {
    color: #f1f5f9;
}

.answer {
    color: #e2e8f0;
    margin-bottom: 0;
    transition: color 0.3s ease;
}

body.dark-mode .answer {
    color: #cbd5e1;
}

/* Table Styles with Responsive Design */
.table-container {
    overflow-x: auto;
    border-radius: 12px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

body.dark-mode .table-container {
    background: rgba(255, 255, 255, 0.05);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.notes-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 800px;
    transition: all 0.3s ease;
}

.notes-table th,
.notes-table td {
    padding: 1rem 0.8rem;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
    color: #f1f5f9;
    font-size: 1rem;
    vertical-align: middle;
    word-wrap: break-word;
}

body.dark-mode .notes-table th,
body.dark-mode .notes-table td {
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

body.dark-mode .notes-table td {
    color: #e2e8f0;
}

.notes-table th {
    background: linear-gradient(135deg, #475569 0%, #334155 50%, #1e293b 100%);
    color: #f1f5f9;
    font-weight: 600;
    position: relative;
    overflow: hidden;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.notes-table th::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.notes-table th:hover::before {
    left: 100%;
}

/* Column widths for better layout */
.notes-table th:nth-child(1),
.notes-table td:nth-child(1) {
    width: 10%;
    min-width: 90px;
}

.notes-table th:nth-child(2),
.notes-table td:nth-child(2) {
    width: 35%;
    min-width: 250px;
}

.notes-table th:nth-child(3),
.notes-table td:nth-child(3) {
    width: 15%;
    min-width: 150px;
}

.notes-table th:nth-child(4),
.notes-table td:nth-child(4) {
    width: 3%;
    min-width: 120px;
}

.notes-table tr {
    transition: all 0.3s ease;
}

.notes-table tr:hover {
    background-color: rgba(255, 255, 255, 0.05);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body.dark-mode .notes-table tr:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.notes-table tr:last-child td {
    border-bottom: none;
}

/* Perfect emoji alignment with flexbox */
.course-info {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.course-emoji {
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
}

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 0.35rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.status-badge::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.status-badge:hover::before {
    left: 100%;
}

.status-badge:hover {
    transform: scale(1.05);
}

.status-done {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
    box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

body.dark-mode .status-done {
    background: linear-gradient(135deg, #059669, #047857);
    color: #d1fae5;
}

.status-future {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
    box-shadow: 0 4px 15px rgba(100, 116, 139, 0.3);
}

body.dark-mode .status-future {
    background: linear-gradient(135deg, #475569, #334155);
    color: #e2e8f0;
}

/* Course Links */
.course-link {
    color: #f1f5f9;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    display: inline-block;
    padding: 0.2rem 0;
}

.course-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4);
    transition: width 0.3s ease;
}

.course-link:hover::after {
    width: 100%;
}

.course-link:hover {
    transform: translateY(-2px);
    color: #93c5fd;
}

body.dark-mode .course-link {
    color: #60a5fa;
}

body.dark-mode .course-link:hover {
    color: #93c5fd;
}

/* Misc Notes */
.misc-notes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.note-card {
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 2rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    position: relative;
    overflow: hidden;
}

.note-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradientMove 4s ease infinite;
}

body.dark-mode .note-card {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
}

.note-card-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: #f1f5f9;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

body.dark-mode .note-card-title {
    color: #f1f5f9;
}

.note-card-icon {
    font-size: 1.8rem;
    margin-right: 0.5rem;
    display: inline-block;
    transition: transform 0.3s ease;
}

.note-card:hover .note-card-icon {
    transform: scale(1.2) rotate(10deg);
}

/* Footer */
.site-footer {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(30px);
    color: white;
    border-radius: 20px;
    padding: 2.5rem;
    text-align: center;
    margin-top: 2rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.08);
    position: relative;
    overflow: hidden;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
}

.site-footer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradientMove 4s ease infinite;
}

body.dark-mode .site-footer {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.contact-link {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.contact-link.dark-mode {
    color: #ffffff;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    backdrop-filter: blur(20px);
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.contact-link:hover {
    color: #93c5fd;
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .page-title {
        font-size: 2rem;
    }

    .notes-table {
        font-size: 0.8rem;
        min-width: 700px;
    }

    .notes-table th,
    .notes-table td {
        padding: 0.8rem 0.5rem;
    }

    .contact-links {
        flex-direction: column;
        gap: 1rem;
    }

    .theme-toggle {
        width: 45px;
        height: 45px;
        top: 0.5rem;
        right: 0.5rem;
    }

    .section {
        padding: 2rem;
    }

    .site-header {
        padding: 2rem 1.5rem;
    }

    .table-container {
        margin: 1rem -1rem;
        border-radius: 0;
    }
}

@media (max-width: 480px) {
    .notes-table {
        font-size: 0.75rem;
        min-width: 600px;
    }

    .notes-table th,
    .notes-table td {
        padding: 0.6rem 0.4rem;
    }

    .status-badge {
        font-size: 0.7rem;
        padding: 0.3rem 0.6rem;
    }
}

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

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    border-radius: 10px;
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #06b6d4, #10b981);
}

/* Utilities */
.text-center { text-align: center; }
.mb-0 { margin-bottom: 0; }
.mt-2 { margin-top: 1rem; }

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

.pulse {
    animation: pulse 2s ease-in-out infinite;
}

/* Selection */
::selection {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
}

::-moz-selection {
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    color: white;
}

/* Table of Contents Sidebar - Overlay Style */
.toc-sidebar {
    position: fixed;
    top: 120px;
    right: 0;
    width: 320px;
    max-height: calc(100vh - 140px);
    overflow-y: auto;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(30px);
    border-radius: 20px 0 0 20px;
    padding: 2rem;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-right: none;
    z-index: 1000;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.2);
}

.toc-sidebar.visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

body.dark-mode .toc-sidebar {
    background: rgba(255, 255, 255, 0.08);
    box-shadow: -10px 0 30px rgba(0, 0, 0, 0.3);
}

.toc-title {
    color: #f1f5f9;
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
    text-align: center;
}

.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.toc-item {
    margin-bottom: 0.3rem;
}

.toc-link {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.6rem 1rem;
    display: block;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border-radius: 8px;
    border-left: 3px solid transparent;
}

.toc-link:hover {
    color: #f1f5f9;
    background: rgba(255, 255, 255, 0.08);
    border-left-color: #60a5fa;
    transform: translateX(5px);
}

.toc-link.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
    border-left-color: #60a5fa;
    font-weight: 500;
}

.toc-subheader {
    padding-left: 2rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.6);
}

.toc-subheader:hover {
    color: rgba(255, 255, 255, 0.8);
    border-left-color: rgba(255, 255, 255, 0.3);
}

/* TOC Trigger Zone - Invisible area on the right edge */
.toc-trigger {
    position: fixed;
    top: 0;
    right: 0;
    width: 50px;
    height: 100vh;
    z-index: 999;
    pointer-events: all;
}

/* TOC Toggle Button */
.toc-toggle {
    display: none;
}

/* Hide TOC on mobile */
@media (max-width: 1200px) {
    .toc-sidebar, .toc-trigger {
        display: none;
    }
}

/* Remove the main content margin adjustment */
@media (min-width: 1200px) {
    main {
        margin-right: 0;
    }
}

/* Scroll margin for headers */
.section-header {
    scroll-margin-top: 100px;
}

/* Scrollbar styling for TOC */
.toc-sidebar::-webkit-scrollbar {
    width: 6px;
}

.toc-sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
}

.toc-sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
}

.toc-sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* ToC Indicator - Shows outline when hidden */
.toc-indicator {
    position: fixed;
    top: 120px;
    right: 8px;
    width: 4px;
    max-height: calc(100vh - 140px);
    z-index: 998;
    pointer-events: none;
    transition: all 0.3s ease;
}

.toc-indicator.hidden {
    opacity: 0.4;
}

.toc-indicator.visible {
    opacity: 0;
}

.toc-indicator-item {
    width: 4px;
    margin-bottom: 2px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: all 0.3s ease;
    cursor: pointer;
    pointer-events: all;
}

.toc-indicator-item.header {
    height: 20px;
    background: rgba(255, 255, 255, 0.3);
}

.toc-indicator-item.subheader {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    margin-left: 2px;
    width: 2px;
}

.toc-indicator-item.active {
    background: #60a5fa;
    box-shadow: 0 0 8px rgba(96, 165, 250, 0.5);
}

.toc-indicator-item:hover {
    background: rgba(255, 255, 255, 0.6);
    transform: scaleX(1.5);
}

body.dark-mode .toc-indicator-item {
    background: rgba(255, 255, 255, 0.15);
}

body.dark-mode .toc-indicator-item.header {
    background: rgba(255, 255, 255, 0.25);
}

body.dark-mode .toc-indicator-item:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Hide indicator on mobile */
@media (max-width: 1200px) {
    .toc-indicator {
        display: none;
    }
}

/* Code block styling */
.code-block {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(15px);
    border-radius: 12px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 0.9rem;
    line-height: 1.5;
    overflow-x: auto;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

body.dark-mode .code-block {
    background: rgba(0, 0, 0, 0.4);
    border-color: rgba(255, 255, 255, 0.06);
}

.code-block pre {
    margin: 0;
    padding: 0;
    background: none;
    color: #e2e8f0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* Inline code styling */
code {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-size: 0.9em;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

body.dark-mode code {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.04);
}

.code-block code {
    padding: 0;
    border: none;
    border-radius: 0;
    font-size: inherit;
    font-family: inherit;
    color: inherit;
    background: none;
}

/* Back to Home Link */
.back-to-home-link {
    position: fixed;
    top: 1rem;
    left: 1rem;
    z-index: 1001; /* Higher than theme-toggle to ensure it's on top */
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.5rem 1rem;
    border-radius: 12px;
    color: #f1f5f9;
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to-home-link:hover {
    transform: translateY(-2px) scale(1.05);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
    color: #fff;
}

/* Fix for unwanted highlights in Prism.js code blocks */
.code-block .token {
    background: transparent !important;
}

/* image styling */
.image-container {
    margin: 2rem 0;
    /* Use flexbox to center the image within the container */
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.image-container img {
    /* Prevent small images from stretching by using max-width */
    max-width: 100%;
    /* Allow the image to maintain its aspect ratio */
    height: auto;
    display: block;
    border-radius: 8px;
    transition: transform 0.3s ease;
}

/* responsive image sizing */
@media (max-width: 768px) {
    .image-container {
        margin: 1.5rem 0;
    }
}

/* make sure images work well in dark mode */
[data-theme="dark"] .image-container {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .image-container:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .image-container img {
    filter: brightness(0.9);
}

[data-theme="dark"] .image-container img:hover {
    filter: brightness(1);
}

/* pdf embed container */
.pdf-embed-header {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.08);
    backdrop-filter: blur(25px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.pdf-embed-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #8b5cf6, #06b6d4, #10b981);
    background-size: 200% 100%;
    animation: gradientMove 4s ease infinite;
}

.pdf-embed-title {
    font-weight: 600;
    color: #f1f5f9;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    position: relative;
    z-index: 1;
}

.pdf-embed-download {
    color: #60a5fa;
    text-decoration: none;
    font-size: 0.9rem;
    padding: 0.6rem 1.2rem;
    border: 1px solid rgba(96, 165, 250, 0.5);
    border-radius: 8px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(96, 165, 250, 0.1);
    backdrop-filter: blur(10px);
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.pdf-embed-download::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.pdf-embed-download:hover::before {
    left: 100%;
}

.pdf-embed-download:hover {
    background: rgba(96, 165, 250, 0.2);
    border-color: #60a5fa;
    color: #93c5fd;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(96, 165, 250, 0.2);
}

.pdf-embed iframe {
    width: 100%;
    height: 600px;
    border: none;
    display: block;
}

/* responsive adjustments */
@media (max-width: 768px) {
    .pdf-embed iframe {
        height: 400px;
    }

    .pdf-embed-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .pdf-embed-download {
        text-align: center;
    }
}

/* dark mode adjustments */
body.dark-mode .pdf-embed-header {
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

body.dark-mode .pdf-embed-title {
    color: #f1f5f9;
}

body.dark-mode .pdf-embed-download {
    color: #93c5fd;
    border-color: rgba(147, 197, 253, 0.3);
    background: rgba(147, 197, 253, 0.08);
}

body.dark-mode .pdf-embed-download:hover {
    background: rgba(147, 197, 253, 0.15);
    border-color: #93c5fd;
    color: #bfdbfe;
}