:root {
    --brand-color: #4f46e5;
    /* Indigo 600 */
    --brand-color-light: #eef2ff;
    /* Indigo 50 */
    --brand-color-dark: #3730a3;
    /* Indigo 800 */
    --text-primary: #111827;
    /* Gray 900 */
    --text-secondary: #374151;
    /* Gray 700 */
    --text-muted: #6b7280;
    /* Gray 500 */
    --bg-main: #f9fafb;
    /* Gray 50 */
    --bg-card: #ffffff;
    --border-color: #e5e7eb;
    /* Gray 200 */
}

html {
    scroll-padding-top: 5rem;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-main);
    color: var(--text-secondary);
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* --- Typography & Content Styles --- */
.prose-custom {
    font-size: 1.05rem;
    line-height: 1.75;
}

.prose-custom h1,
.prose-custom h2,
.prose-custom h3,
.prose-custom h4,
.prose-custom h5 {
    color: var(--text-primary);
    font-weight: 800;
    scroll-margin-top: 6rem;
    letter-spacing: -0.025em;
}

.prose-custom h1 {
    font-size: 2.5rem;
    /* 40px */
    line-height: 1.2;
    /* Spacing: More space below the main title */
    margin-bottom: 1em;
}

.prose-custom h2 {
    font-size: 1.75rem;
    /* 28px */
    line-height: 1.25;
    padding-bottom: 0.4em;
    border-bottom: 1px solid var(--border-color);
    /* Spacing: More space after the heading/border to separate it from content */
    margin-bottom: 1.5em;
}

.prose-custom h3 {
    font-size: 1.5rem;
    /* 24px */
    line-height: 1.4;
    font-weight: 700;
    /* Spacing: More space above than below to group with following content */
    margin-top: 3rem;
    margin-bottom: 1em;
}

.prose-custom h4,
.prose-custom h5 {
    font-size: 1.25rem;
    /* 20px */
    line-height: 1.5;
    font-weight: 600;
    /* Spacing: More space above than below to group with following content */
    margin-top: 2.5rem;
    margin-bottom: 0.75em;
}

/* Spacing: Consistent bottom margin for common block elements */
.prose-custom p,
.prose-custom ul,
.prose-custom ol {
    margin-bottom: 1.25em;
}

/* Spacing: Remove bottom margin from last element in an article/div */
.prose-custom p:last-child,
.prose-custom ul:last-child,
.prose-custom ol:last-child {
    margin-bottom: 0;
}

.prose-custom a {
    color: var(--brand-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border-bottom: 1px solid transparent;
}

.prose-custom a:hover {
    color: var(--brand-color-dark);
    border-bottom-color: var(--brand-color-dark);
}

.prose-custom code:not(pre code) {
    color: #c026d3;
    background-color: #fdf4ff;
    padding: 0.2em 0.4em;
    margin: 0 0.1em;
    font-size: 0.875em;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid #f5d0fe;
}

/* Spacing: Dedicated vertical margins for media */
.prose-custom img,
.prose-custom video {
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    margin-top: 2em;
    margin-bottom: 2em;
    margin-left: auto;
    margin-right: auto;
}

/* --- Custom Blockquote / Info Box --- */
.prose-custom .info-blockquote {
    border-left: 4px solid var(--brand-color);
    background-color: var(--brand-color-light);
    color: #312e81;
    padding: 1rem 1.5rem;
    /* Spacing: Consistent margins to fit the rhythm */
    margin: 2em 0;
    border-radius: 0.5rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.prose-custom .info-blockquote i {
    color: var(--brand-color);
    font-size: 1.25rem;
    margin-top: 0.25rem;
}

.prose-custom .info-blockquote p,
.prose-custom .info-blockquote ul {
    margin: 0;
    font-weight: 500;
}

.prose-custom .info-blockquote p:first-of-type::before,
.prose-custom .info-blockquote p:last-of-type::after {
    content: none;
}

/* --- Sidebar Styles --- */
.sidebar-nav-group-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.sidebar-link {
    transition: all 0.2s ease;
    border-left-width: 2px;
    padding: 0.375rem 1rem;
    border-radius: 0 0.375rem 0.375rem 0;
}

.sidebar-link.active {
    color: var(--brand-color);
    font-weight: 600;
    border-left-color: var(--brand-color);
    background-color: var(--brand-color-light);
}

.sidebar-link:not(.active):hover {
    color: var(--text-primary);
    border-left-color: #cbd5e1;
    background-color: #f1f5f9;
}

/* --- Code Block Styles --- */
.code-container {
    background-color: #1e293b;
    border-radius: 0.75rem;
    /* Spacing: Consistent margins to fit the rhythm */
    margin: 2em 0;
    box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.5rem 0.5rem 1rem;
    background-color: #334155;
    border-bottom: 1px solid #475569;
}

.code-lang {
    font-size: 0.8rem;
    color: #e2e8f0;
    font-weight: 600;
    text-transform: uppercase;
    background-color: #475569;
    padding: 0.125rem 0.5rem;
    border-radius: 0.375rem;
}

.copy-button {
    background-color: #475569;
    color: #cbd5e1;
    border: none;
    padding: 0.375rem 0.75rem;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.copy-button:hover {
    background-color: var(--brand-color);
    color: white;
}

.prose-custom pre {
    background-color: transparent;
    margin: 0;
    padding: 1rem;
    color: #e2e8f0;
    font-size: 0.9em;
}

/* Spacing: The primary separator between major sections */
.prose-custom section+section {
    padding-top: 4rem;
    margin-top: 4rem;
    border-top: 1px solid var(--border-color);
}

/* --- Accordion for FAQ/Glossary --- */
.accordion-group {
    border: 1px solid var(--border-color);
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: var(--bg-card);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.accordion-item details {
    border-bottom: 1px solid var(--border-color);
}

.accordion-item:last-child details {
    border-bottom: none;
}

.accordion-item summary {
    padding: 1rem 1.25rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: background-color 0.2s ease;
}

.accordion-item summary:hover {
    background-color: #f9fafb;
}

.accordion-item summary::after {
    content: '\f078';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: transform 0.3s ease;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.accordion-item details[open]>summary {
    background-color: #f9fafb;
    color: var(--brand-color);
}

.accordion-item details[open]>summary::after {
    transform: rotate(180deg);
    color: var(--brand-color);
}

.accordion-content {
    padding: 0 1.25rem 1.25rem 1.25rem;
    line-height: 1.6;
}

.accordion-content> :last-child {
    margin-bottom: 0;
}